[Igarden-commit] CommonSource/CQTImagePane CQTImagePane.cpp, 1.10, 1.11 CGWorld.cpp, 1.23, 1.24
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2006-10-18 01:15:41
|
Update of /cvsroot/igarden/CommonSource/CQTImagePane In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11411 Modified Files: CQTImagePane.cpp CGWorld.cpp Log Message: Change #error to #warning to ease porting Index: CGWorld.cpp =================================================================== RCS file: /cvsroot/igarden/CommonSource/CQTImagePane/CGWorld.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** CGWorld.cpp 7 Oct 2006 23:57:28 -0000 1.23 --- CGWorld.cpp 18 Oct 2006 01:15:38 -0000 1.24 *************** *** 38,41 **** --- 38,42 ---- GDHandle inGDeviceH) { + #if OPT_MACOS ::GetGWorld(&mSavePort, &mSaveDevice); *************** *** 73,76 **** --- 74,82 ---- } ::SetGWorld(mSavePort, mSaveDevice); + #elif OPT_XWIN + #warning ***Look for OPT_MACOS thoughout this CGWorld to port + #else + #error Look for OPT_MACOS thoughout this CGWorld to port + #endif } *************** *** 81,86 **** CGWorld::~CGWorld() { ! OSErr status; if(mMacGWorld != nil) { ::DisposeGWorld(mMacGWorld); --- 87,93 ---- CGWorld::~CGWorld() { ! OSErrorCode status; + #if OPT_MACOS if(mMacGWorld != nil) { ::DisposeGWorld(mMacGWorld); *************** *** 88,93 **** --- 95,102 ---- mMacGWorld = nil; } + #endif } + #if OPT_MACOS // --------------------------------------------------------------------------- // ¥ GetMacGWorld *************** *** 98,101 **** --- 107,111 ---- return mMacGWorld; } + #endif // --------------------------------------------------------------------------- *************** *** 105,109 **** --- 115,121 ---- CGWorld::LockPixels() const { + #if OPT_MACOS return ::LockPixels(::GetGWorldPixMap(mMacGWorld)); + #endif } *************** *** 114,118 **** --- 126,132 ---- CGWorld::UnlockPixels() const { + #if OPT_MACOS ::UnlockPixels(::GetGWorldPixMap(mMacGWorld)); + #endif } *************** *** 132,141 **** CGWorld::BeginDrawing() { ! OSErr status; ::GetGWorld(&mSavePort, &mSaveDevice); ::SetGWorld(mMacGWorld, nil); status = QDErr(); return LockPixels(); } --- 146,157 ---- CGWorld::BeginDrawing() { ! OSErrorCode status; + #if OPT_MACOS ::GetGWorld(&mSavePort, &mSaveDevice); ::SetGWorld(mMacGWorld, nil); status = QDErr(); return LockPixels(); + #endif } *************** *** 152,157 **** --- 168,175 ---- CGWorld::EndDrawing() { + #if OPT_MACOS UnlockPixels(); ::SetGWorld(mSavePort, mSaveDevice); + #endif } *************** *** 177,185 **** #if OPT_MACOS GrafPtr graf; - #endif if(LockPixels()) { - #if OPT_MACOS #if TARGET_API_MAC_CARBON graf = GetWindowPort(inDestWindow->GetRootWindow()); --- 195,201 ---- *************** *** 192,200 **** #endif &mBounds, &inDestRect, srcCopy, nil); //inXferMode, inMaskRgn); - #else - #error Needs to be ported - #endif UnlockPixels(); } } --- 208,214 ---- #endif &mBounds, &inDestRect, srcCopy, nil); //inXferMode, inMaskRgn); UnlockPixels(); } + #endif } *************** *** 204,212 **** #if OPT_MACOS GrafPtr graf; - #endif if(LockPixels()) { - #if OPT_MACOS #if TARGET_API_MAC_CARBON ::GetPort(&graf); --- 218,224 ---- *************** *** 219,227 **** #endif &mBounds, &inDestRect, srcCopy, nil); //inXferMode, inMaskRgn); - #else - #error Needs to be ported - #endif UnlockPixels(); } } --- 231,237 ---- #endif &mBounds, &inDestRect, srcCopy, nil); //inXferMode, inMaskRgn); UnlockPixels(); } + #endif } *************** *** 237,240 **** --- 247,251 ---- double zoom) const { + #if OPT_MACOS PixMapHandle pixMap; Ptr baseAddress; *************** *** 266,269 **** --- 277,281 ---- UnlockPixels(); } + #endif } *************** *** 275,283 **** #if OPT_MACOS GrafPtr graf; - #endif if(LockPixels()) { - #if OPT_MACOS graf = destGWorld->GetMacGWorld(); #if TARGET_API_MAC_CARBON --- 287,293 ---- *************** *** 289,297 **** #endif &mBounds, &inDestRect, srcCopy, nil); //inXferMode, inMaskRgn); - #else - #error Needs to be ported - #endif UnlockPixels(); } } --- 299,305 ---- #endif &mBounds, &inDestRect, srcCopy, nil); //inXferMode, inMaskRgn); UnlockPixels(); } + #endif } *************** *** 309,312 **** --- 317,321 ---- double zoom) const { + #if OPT_MACOS PixMapHandle pixMap; Ptr baseAddress; *************** *** 368,373 **** --- 377,384 ---- UnlockPixels(); } + #endif } + #if OPT_MACOS void CGWorld::CopyImageSection( *************** *** 379,385 **** { Rect localSrcRect; - #if OPT_MACOS GrafPtr graf; - #endif if(LockPixels()) --- 390,394 ---- *************** *** 391,395 **** // localSrcRect.bottom += mBounds.top; - #if OPT_MACOS #if TARGET_API_MAC_CARBON graf = destGWorld->GetMacGWorld(); --- 400,403 ---- *************** *** 402,411 **** #endif &localSrcRect, &inDestRect, inXferMode, inMaskRgn); - #else - #error Needs to be ported - #endif UnlockPixels(); } } //PROCEDURE CalcMask (srcPtr,dstPtr:øPtr; // srcRow,dstRow,height,words:øInteger); --- 410,417 ---- #endif &localSrcRect, &inDestRect, inXferMode, inMaskRgn); UnlockPixels(); } } + #endif //PROCEDURE CalcMask (srcPtr,dstPtr:øPtr; // srcRow,dstRow,height,words:øInteger); *************** *** 431,438 **** --- 437,446 ---- flags = Update(inBounds); + #if OPT_MACOS ::GetGWorld(&mSavePort, &mSaveDevice); ::SetGWorld(mMacGWorld, nil); ::SetOrigin(mBounds.left, mBounds.top); ::SetGWorld(mSavePort, mSaveDevice); + #endif } *************** *** 528,532 **** --- 536,542 ---- } + #if OPT_MACOS return ::UpdateGWorld(&mMacGWorld, inPixelDepth, &gwRect, inCTableH, inGDeviceH, inFlags); + #endif } *************** *** 571,579 **** { GLuint texName; - PixMapHandle pixMap; long width, height, y; - Ptr baseAddress; long rowBytes; char *srcPtr, *destPtr; pixMap = ::GetGWorldPixMap(mMacGWorld); --- 581,590 ---- { GLuint texName; long width, height, y; long rowBytes; char *srcPtr, *destPtr; + #if OPT_MACOS + PixMapHandle pixMap; + Ptr baseAddress; pixMap = ::GetGWorldPixMap(mMacGWorld); *************** *** 607,611 **** UnlockPixels(); } ! return texName; } --- 618,622 ---- UnlockPixels(); } ! #endif return texName; } Index: CQTImagePane.cpp =================================================================== RCS file: /cvsroot/igarden/CommonSource/CQTImagePane/CQTImagePane.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CQTImagePane.cpp 7 Oct 2006 23:51:17 -0000 1.10 --- CQTImagePane.cpp 18 Oct 2006 01:15:38 -0000 1.11 *************** *** 23,27 **** #include "MyAssert.h" - #if OPT_MACOS // ================================================================================= --- 23,26 ---- *************** *** 70,73 **** --- 69,73 ---- delete mGWorld; + #if OPT_MACOS if(mComponentOpened) { ::CloseComponent(*mComponent); // Just throw away any errors *************** *** 80,83 **** --- 80,88 ---- mDataH = nil; } + #elif OPT_XWIN + #warning ***Look for OPT_MACOS thoughout this CQTImagePane to port + #else + #error Look for OPT_MACOS thoughout this CQTImagePane to port + #endif } *************** *** 91,97 **** CQTImagePane::InitMembers(const SQTPaneInfo& inInfo) { mComponent = new GraphicsImportComponent(); mComponentOpened = false; ! mGWorld = nil; mGWorldDirty = true; mOptions = inInfo.options; --- 96,105 ---- CQTImagePane::InitMembers(const SQTPaneInfo& inInfo) { + #if OPT_MACOS mComponent = new GraphicsImportComponent(); + mDataH = nil; + #endif mComponentOpened = false; ! mGWorld = NULL; mGWorldDirty = true; mOptions = inInfo.options; *************** *** 100,104 **** mBGColor.blue = GetBValue(PaletteColor(inInfo.bgColor)); mCursorID = inInfo.cursorID; - mDataH = nil; mMessage = 0; mDragMessage = 0; --- 108,111 ---- *************** *** 120,123 **** --- 127,131 ---- CQTImagePane::DoDrawView(Rect r) { + #if OPT_MACOS #pragma unused(r) // Get the pane's frame *************** *** 289,293 **** mGWorldDirty = false; } - // Blit the prepared image to the screen finalRect = theLocalFrameRect; --- 297,300 ---- *************** *** 295,298 **** --- 302,306 ---- XGDraw draw(this); mGWorld->CopyImage(this, finalRect); + #endif //OPT_MACOS } *************** *** 395,398 **** --- 403,407 ---- #pragma mark - + #if OPT_MACOS // --------------------------------------------------------------------------------- // ¥ GetGIComponent *************** *** 404,407 **** --- 413,417 ---- return mComponent; } + #endif // --------------------------------------------------------------------------------- *************** *** 608,614 **** CQTImagePane::SetSource(const XGFileSpecifier& file) { ! OSErr result = noErr; ! FSSpec inFile = file.GetFileName(); if(mComponentOpened) { result = ::CloseComponent(*mComponent); --- 618,625 ---- CQTImagePane::SetSource(const XGFileSpecifier& file) { ! OSErrorCode result = 0; + #if OPT_MACOS + FSSpec inFile = file.GetFileName(); if(mComponentOpened) { result = ::CloseComponent(*mComponent); *************** *** 629,632 **** --- 640,644 ---- ComputeScaledRect(); } + #endif return result; *************** *** 687,692 **** CQTImagePane::ClearSource() { ! OSErr result = noErr; if(mComponentOpened) { result = ::CloseComponent(*mComponent); --- 699,705 ---- CQTImagePane::ClearSource() { ! OSErrorCode result = 0; + #if OPT_MACOS if(mComponentOpened) { result = ::CloseComponent(*mComponent); *************** *** 695,698 **** --- 708,712 ---- mComponentOpened = false; } + #endif mGWorldDirty = true; *************** *** 735,739 **** --- 749,755 ---- else { + #if OPT_MACOS /*!!!ThrowIfOSErr_*/status = (GetNaturalSize(theImageSize)); + #endif } height = theImageSize.bottom - theImageSize.top; *************** *** 758,762 **** _scaledRect.right = _scaledRect.left + scaleWidth; } - // --------------------------------------------------------------------------------- // ¥ SourceSpecified --- 774,777 ---- *************** *** 766,774 **** --- 781,792 ---- CQTImagePane::SourceSpecified() const { + #if OPT_MACOS return mComponentOpened; + #endif } #pragma mark - + #if OPT_MACOS // --------------------------------------------------------------------------------- // ¥ GetNaturalSize *************** *** 814,818 **** return result; } - #else - #error TO_BE_PORTED #endif \ No newline at end of file --- 832,834 ---- |