bfxdlg2.cpp

Go to the documentation of this file.
00001 // $Id: bfxdlg2.cpp 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // Handles the bitmap effects dialog
00099 
00100 /*
00101 */
00102 
00103 #include "camtypes.h"
00104 //#include "bfxrc.h"
00105 #include "bfxdlg2.h"
00106 #include "bfxdlg.h"     // BfxMsg
00107 //#include "bitmap.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "bmplist.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 #include "oilprog.h"
00110 
00111 #include "ccdc.h"       // specific #includes needed for kernel-rendered dialogues
00112 #include "dlgcol.h"
00113 //#include "fillval.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00114 #include "grnddib.h"
00115 
00116 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00117 //#include "range.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00118 #include "nodebmp.h"
00119 #include "bitmpinf.h"
00120 //#include "bmplist.h"
00121 #include "bmpcomp.h"
00122 //#include "fillattr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00123 #include "bitmapfx.h"
00124 //#include "undoop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00125 #include "progress.h"
00126 #include "csrstack.h"
00127 //#include "document.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00128 #include "chapter.h"
00129 #include "page.h"
00130 //#include "spread.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00131 //#include "trans2d.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00132 //#include "rikdlg.h"
00133 //#include "resource.h"
00134 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00135 //#include "barsdlgs.h"         // for the bitmap effects bar control
00136 #include "wrkrect.h"
00137 
00138 //#include "will2.h"
00139 
00140 #include "mrhbits.h"
00141 //#include "resource.h"
00142 
00143 // This is not compulsory, but you may as well put it in so that the correct version
00144 // of your file can be registered in the .exe
00145 DECLARE_SOURCE("$Revision: 1282 $");
00146 
00147 // An implement to match the Declare in the .h file.
00148 // If you have many classes, it is recommended to place them all together, here at the start of the file
00149 CC_IMPLEMENT_DYNCREATE(BfxPlugInDlg, DialogOp)
00150 CC_IMPLEMENT_DYNCREATE(BfxBrightnessContrastDlg, BfxPlugInDlg)
00151 CC_IMPLEMENT_DYNCREATE(BfxSpecialEffectsDlg, BfxPlugInDlg)
00152 CC_IMPLEMENT_DYNCREATE(BfxResizeDlg, BfxPlugInDlg)
00153 CC_IMPLEMENT_DYNCREATE(BfxFlipAndRotateDlg, BfxPlugInDlg)
00154 CC_IMPLEMENT_DYNCREATE(BfxColourDepthDlg, BfxPlugInDlg)
00155 
00156 // This will get Camelot to display the filename and linenumber of any memory allocations
00157 // that are not released at program exit
00158 #define new CAM_DEBUG_NEW
00159 
00160 const CDlgMode BfxPlugInDlg::Mode = MODAL;      // Mode of the dialog  
00161 UINT32 BfxPlugInDlg::IDD = _R(IDD_BFXDLG);      // Used to uniquely identify the tabbed dialog
00162                                                 // there is no actual resource associated with this ID.
00163 BOOL BfxPlugInDlg::InteractiveBCC = TRUE;
00164 
00165 /********************************************************************************************
00166 
00167 >   BfxPlugInDlg::BfxPlugInDlg(CDlgResID id = BfxPlugInDlg::IDD): DialogOp(id, BfxPlugInDlg::Mode) 
00168 
00169     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00170     Created:    20/02/95
00171     Purpose:    The Constructor of the DialogTabOp derived class simply sets modality of the
00172                 dialog, and it's ID.
00173 
00174 ********************************************************************************************/
00175 
00176 BfxBrightnessContrastDlg::BfxBrightnessContrastDlg() : BfxPlugInDlg( _R(IDD_BFXPLUGINDLG_PG3) ) 
00177 {
00178     OpenPage = _R(IDD_BFXPLUGINDLG_PG3);
00179 }
00180 
00181 BfxSpecialEffectsDlg::BfxSpecialEffectsDlg() : BfxPlugInDlg( _R(IDD_BFXPLUGINDLG_PG5) ) 
00182 {
00183     OpenPage = _R(IDD_BFXPLUGINDLG_PG5);
00184 }
00185 
00186 BfxResizeDlg::BfxResizeDlg() : BfxPlugInDlg( _R(IDD_BFXPLUGINDLG_PG2) ) 
00187 {
00188     OpenPage = _R(IDD_BFXPLUGINDLG_PG2);
00189 }
00190 
00191 BfxFlipAndRotateDlg::BfxFlipAndRotateDlg() : BfxPlugInDlg( _R(IDD_BFXPLUGINDLG_PG1) ) 
00192 {
00193     OpenPage = _R(IDD_BFXPLUGINDLG_PG1);
00194 }
00195 
00196 BfxColourDepthDlg::BfxColourDepthDlg() : BfxPlugInDlg( _R(IDD_BFXPLUGINDLG_PG4) ) 
00197 {
00198     OpenPage = _R(IDD_BFXPLUGINDLG_PG4);
00199 }
00200 
00201 BfxPlugInDlg::BfxPlugInDlg(CDlgResID id) : DialogOp(id, BfxPlugInDlg::Mode) 
00202 {
00203     pOriginal = NULL;
00204     pDestination = NULL;
00205     pPrevOriginal=NULL;
00206     pOrigInfo = NULL;
00207     m_UseInitial = TRUE;
00208     Clean = FALSE;
00209     pFX = NULL;
00210     SetParameters();
00211     for (INT32 i = 0; i<=8; i++) Matrix[i]=(i==4)?1.0:0.0;
00212 
00213     m_pParam = NULL;
00214     m_pDocument = NULL;
00215 }        
00216 
00217 /********************************************************************************************
00218 
00219 >   BfxPlugInDlg::~BfxPlugInDlg()
00220 
00221     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00222     Created:    20/02/95
00223     Purpose:    Destructor
00224 
00225 ********************************************************************************************/
00226 
00227 BfxPlugInDlg::~BfxPlugInDlg()
00228 {
00229     // Check to see if we needed to generate a copy of any 32bit BMPs
00230     if(!m_p24BitCopyNames.IsEmpty())
00231     {
00232         // If so remove the tempory version!
00233         Remove24BitTempCopy();
00234     }
00235 
00236     if (pFX) delete pFX;
00237     if (pDestination) {TRACEUSER( "Neville", _T("Destructor deleting destination\n"));delete pDestination;}
00238     if (pOrigInfo) delete pOrigInfo;
00239 }        
00240 
00241 void BfxPlugInDlg::Remove24BitTempCopy()
00242 {
00243     // Get the selected Document
00244     Document * pDoc = Document::GetSelected();
00245 
00246     // Get the bitmap list
00247     BitmapList* Bitmaps = NULL;
00248     if (pDoc)
00249     {
00250         Bitmaps = pDoc->GetBitmapList();
00251     }
00252 
00253     // Get the first bitmap out of the bitmap list
00254     KernelBitmap * pBmp = (KernelBitmap *)(Bitmaps->GetHead());
00255     KernelBitmap * pTemp = NULL;
00256 
00257     POSITION Pos = NULL;
00258     BOOL DeleteThisBMP = FALSE;
00259 
00260     // If we`ve got a valid BMP then do some testing!
00261     while (pBmp != NULL)
00262     {
00263         // Get the first Copy Name from our list
00264         Pos = m_p24BitCopyNames.GetHeadPosition();
00265 
00266         // While the Position and the BMP are both valid do the check!
00267         while(Pos != NULL && pBmp != NULL)
00268         {
00269             // Check to see if the BMP`s name matches the one held in the copy list
00270             if (pBmp->GetName().CompareTo(m_p24BitCopyNames.GetAt(Pos)) == 0)
00271             {
00272                 // Mark this BMP For deletion!
00273                 DeleteThisBMP = TRUE;
00274 
00275                 // Now break out of this while loop!
00276                 break;
00277             }
00278 
00279             // Get the next name from the copy name list
00280             m_p24BitCopyNames.GetNext(Pos);
00281         }
00282 
00283         // If this isn`t the one then get the next in the list!
00284         pTemp = (KernelBitmap *) Bitmaps->GetNext(pBmp);
00285 
00286         // If the flag has been set then delete it!
00287         if(DeleteThisBMP)
00288         {
00289             // Remove it, Detach it, delete it and then just for good measure NULL it!!!
00290             Bitmaps->RemoveItem(pBmp);
00291             pBmp->Detach();
00292             delete pBmp;
00293             pBmp = NULL;
00294 
00295             // Reset the Delete flag
00296             DeleteThisBMP = FALSE;
00297         }
00298 
00299         // Set the Current BMP with the Temp
00300         pBmp = pTemp;
00301     }
00302 
00303     // Finished with everything so make sure the list is totally empty!
00304     while(!m_p24BitCopyNames.IsEmpty())
00305     {
00306         m_p24BitCopyNames.RemoveHead();
00307     }
00308 }
00309 
00310 /*******************************************************************************************
00311 
00312 >   BOOL BfxPlugInDlg::OriginalChanged()
00313 
00314     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00315     Created:    14/12/94
00316     Inputs:     None
00317     Outputs:    None
00318     Returns:    TRUE if succeeded, FALSE & error set if not
00319     Purpose:    Invalidates area for original bitmap, marks no destination as yet
00320     Errors:     None at present
00321     SeeAlso:    -
00322 
00323 *******************************************************************************************/
00324 
00325 BOOL BfxPlugInDlg::OriginalChanged()
00326 {
00327     if (pPrevOriginal==pOriginal) return TRUE;
00328     pPrevOriginal=pOriginal;
00329 
00330     if (!pOrigInfo)
00331     {
00332         pOrigInfo = new BitmapInfo;
00333         if (!pOrigInfo) return FALSE; // error already set.
00334     }
00335 
00336     pOrigInfo->PixelWidth = 100;
00337     pOrigInfo->PixelHeight = 100;
00338     pOrigInfo->PixelDepth = 24;
00339     if (pOriginal && pOrigInfo) // Should always be true
00340     {
00341         pOriginal->ActualBitmap->GetInfo(pOrigInfo);
00342     }
00343 
00344     if (SetDirty() && (OpenPage != 0))
00345     {
00346         InvalidateGadget(_R(IDC_BFXDLG_ORIGREDRAW));
00347     }
00348 
00349     BROADCAST_TO_CLASS(DialogMsg(WindowID, DIM_OUT_OF_SPACE, _R(IDC_BFXDLG_ORIGREDRAW),
00350                        0, OpenPage) ,DialogOp);  // Pretty horrible bodge
00351 
00352     return FixOriginalComboBox();
00353 }
00354 
00355 /*******************************************************************************************
00356 
00357 >   BOOL BfxPlugInDlg::SetEffect(CCRuntimeClass * Effect)
00358 
00359     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00360     Created:    14/12/94
00361     Inputs:     Effect = runtime class of effect to be used, or none.
00362     Outputs:    None
00363     Returns:    TRUE if succeeded, FALSE & error set if not
00364     Purpose:    Choses the bitmap effect for processing
00365     Errors:     None at present
00366     SeeAlso:    -
00367 
00368 *******************************************************************************************/
00369 
00370 BOOL BfxPlugInDlg::SetEffect(CCRuntimeClass * Effect)
00371 {
00372     if (pFX)
00373     {
00374         if (pFX->GetRuntimeClass() == Effect) return TRUE;
00375         delete pFX;
00376         pFX = NULL;
00377     }
00378     if (Effect)
00379     {
00380         pFX = (AccusoftBitmapEffect *) (Effect->CreateObject());
00381         if (!pFX) return FALSE;
00382         return pFX->SetParameters(Param1, Param2, Param3, Matrix);
00383     }
00384     else return TRUE;
00385 }
00386 
00387 /*******************************************************************************************
00388 
00389 >   BOOL BfxPlugInDlg::SetDirty(BOOL Redraw=TRUE)
00390 
00391     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00392     Created:    14/12/94
00393     Inputs:     None
00394     Outputs:    None
00395     Returns:    TRUE if succeeded, FALSE & error set if not
00396     Purpose:    Clears the clean flag and deletes the effect
00397     Errors:     None at present
00398     SeeAlso:    -
00399 
00400 *******************************************************************************************/
00401 
00402 BOOL BfxPlugInDlg::SetDirty(BOOL Redraw)
00403 {
00404     if (!ClearDestination(Redraw)) return FALSE;
00405     Clean = FALSE;
00406     if (pFX)
00407     {
00408         delete pFX;
00409         pFX = NULL;
00410     }
00411     return TRUE;
00412 }
00413 
00414 /*******************************************************************************************
00415 
00416 >   BOOL BfxPlugInDlg::DestinationChanged()
00417 
00418     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00419     Created:    14/12/94
00420     Inputs:     None
00421     Outputs:    None
00422     Returns:    TRUE if succeeded, FALSE & error set if not
00423     Purpose:    Invalidates area for destination bitmap, marks no destination as yet
00424     Errors:     None at present
00425     SeeAlso:    -
00426 
00427 *******************************************************************************************/
00428 
00429 BOOL BfxPlugInDlg::DestinationChanged()
00430 {
00431     if (OpenPage)
00432     {
00433         InvalidateGadget(_R(IDC_BFXDLG_ORIGREDRAW2));
00434     }
00435     return TRUE;
00436 }
00437 
00438 /*******************************************************************************************
00439 
00440 >   BOOL BfxPlugInDlg::ClearDestination(BOOL Redraw=TRUE)
00441 
00442     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00443     Created:    14/12/94
00444     Inputs:     None
00445     Outputs:    None
00446     Returns:    TRUE if succeeded, FALSE & error set if not
00447     Purpose:    Marks no dest bitmap
00448     Errors:     None at present
00449     SeeAlso:    -
00450 
00451 *******************************************************************************************/
00452 
00453 BOOL BfxPlugInDlg::ClearDestination(BOOL Redraw)
00454 {
00455     if (pDestination)
00456     {
00457         delete pDestination;
00458         pDestination = NULL; //TRACEUSER( "Neville", _T("ClearDestination deleting dest\n"));
00459         return ((!Redraw) || (DestinationChanged()));
00460     }
00461     return TRUE;
00462 }
00463 
00464 /*******************************************************************************************
00465 
00466 >   BOOL BfxPlugInDlg::FindBitmap()
00467 
00468     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00469     Created:    14/12/94
00470     Inputs:     None
00471     Outputs:    pOriginal set
00472     Returns:    TRUE if succeeded, FALSE & error set if not
00473     Purpose:    Set pOriginal to point at a bitmap
00474     Errors:     None at present
00475     SeeAlso:    -
00476 
00477 *******************************************************************************************/
00478 
00479 BOOL BfxPlugInDlg::FindBitmap()
00480 {
00481 //  pOriginal = NULL;
00482 
00483     // Check if the dialog is being invoked via a parameter (eg. from the Bitmap Gallery).
00484     if (m_pParam != 0)
00485     {
00486         pOriginal = (KernelBitmap*) m_pParam->Param1;
00487         return CheckOriginalBitmap();
00488     }
00489 
00490     Range Sel(*(GetApplication()->FindSelection()));
00491     Node* FirstSelectedNode = Sel.FindFirst(); 
00492     if (FirstSelectedNode != NULL) // No nodes selected so End
00493     {
00494         Node* CurrentNode = FirstSelectedNode;       
00495         Node* NextCurrent; 
00496         
00497         // Do all bitmaps. OK this should pick up the fill as well. Never mind
00498         while (CurrentNode != NULL)
00499         {
00500             NextCurrent = Sel.FindNext(CurrentNode);
00501             if  (CurrentNode->IsSelected() &&
00502                  CurrentNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeBitmap)) 
00503             {         
00504                 pOriginal = ((NodeBitmap *)(CurrentNode))->GetBitmap();
00505                 return CheckOriginalBitmap();
00506             }
00507 
00508             CurrentNode = NextCurrent; 
00509         }
00510     } 
00511 
00512     // Find the first Fill Attribute in the selection
00513     AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
00514 
00515     while (pAttrNode != NULL)
00516     {
00517         if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapColourFill)))
00518         {
00519             pOriginal = pAttrNode->GetBitmap();
00520             return CheckOriginalBitmap();
00521         }
00522 
00523         // Check the next fill
00524         pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
00525     }
00526 
00527     return CheckOriginalBitmap();
00528 }
00529 
00530 /*******************************************************************************************
00531 
00532 >   BOOL BfxPlugInDlg::CheckOriginalBitmap()
00533 
00534     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00535     Created:    14/12/94
00536     Inputs:     None
00537     Outputs:    pOriginal set
00538     Returns:    TRUE if succeeded, FALSE & error set if not
00539     Purpose:    Ensures pOriginal points to a valid bitmap in this document
00540     Errors:     None at present
00541     SeeAlso:    -
00542 
00543 
00544 *******************************************************************************************/
00545 
00546 BOOL BfxPlugInDlg::CheckOriginalBitmap()
00547 {
00548     Document * pDoc = Document::GetSelected();
00549 
00550     // Get the bitmap list
00551     BitmapList* Bitmaps = NULL;
00552     if (pDoc) Bitmaps = pDoc->GetBitmapList();
00553 
00554     if (Bitmaps == NULL)
00555     {
00556         pOriginal = NULL;
00557         return OriginalChanged();
00558     }
00559 
00560     KernelBitmap * pBmp = NULL;
00561 
00562     if(pOriginal != NULL)
00563     {
00564         // Check to see if the Bitmap we`re operating on is 32Bit!
00565         if(pOriginal->ActualBitmap->GetBitmapInfoHeader()->biBitCount == 32)
00566         {
00567             // First check to see if we`ve already got a 24bit copy of the 32bit BMP!
00568             BOOL AlreadyHaveCopy = FALSE;
00569             
00570             // Get first bitmap in the bitmap list
00571             pBmp = (KernelBitmap *)(Bitmaps->GetHead());
00572 
00573             // While the BMP is valid do the conversion!
00574             while (pBmp != NULL)
00575             {
00576                 // check to see if this bitmap has already been converted!
00577                 String_256 strTemp = pOriginal->GetName();
00578                 strTemp += TEXT("(24-bit Copy)");
00579                 if (pBmp->GetName().CompareTo(strTemp) == 0)
00580                 {
00581                     // Has been converted so set the flag and break out of the while loop!
00582                     AlreadyHaveCopy = TRUE;
00583                     break;
00584                 }
00585                 // Get the next bitmap in the list
00586                 pBmp = (KernelBitmap *) Bitmaps->GetNext(pBmp);
00587             }
00588 
00589             // If the flag has been set then use the converted bitmap that`s already there!
00590             if(AlreadyHaveCopy)
00591             {
00592                 InformWarning(_R(IDS_BFX_USE_CONVERT_MSG),_R(IDS_OK),0,0,0,1,2);
00593                 pOriginal = pBmp;
00594             }
00595             else
00596             {
00597                 // Ask the user wether or not they want to use a 24bit copy of the BMP or use the Default Bitmap?
00598                 InformWarning(_R(IDS_BFX_BMP_CONVERT_MSG),_R(IDS_OK),0,0,0,1,2);
00599 
00600                 // Setup a new name to give converted 32Bit BMPs
00601                 String_256 NewName = pOriginal->GetName();
00602                 NewName += "(24-bit Copy)";
00603 
00604                 // Add the name to our copy name list
00605                 m_p24BitCopyNames.AddTail(NewName);
00606 
00607                 // We need to convert the 32Bit to 24Bit, so setup a new Kernel Bitmap!
00608                 UINT32 Height = pOriginal->GetBitmapInfoHeader()->biHeight;
00609                 UINT32 Width = pOriginal->GetBitmapInfoHeader()->biWidth;
00610                 KernelBitmap* pNewBMP = new KernelBitmap( Width, Height, 24, 96);
00611 
00612                 if(pNewBMP != NULL)
00613                 {
00614                     // We need to convert it to 24Bit
00615                     pNewBMP->ActualBitmap = CBMPBits::RenderKernelBMPToTransparentWhiteRect(pOriginal,TRUE,24);
00616                 
00617                     // Set the new Bitmap name!
00618                     pNewBMP->SetName(NewName);
00619 
00620                     // Make the Original Bitmap = to the new Bitmap!
00621                     pOriginal = pNewBMP;
00622 
00623                     // Attach the bitmap to the Bitmap List!
00624                     pNewBMP->Attach(Document::GetCurrent()->GetBitmapList());
00625                 }
00626                 else
00627                 {
00628                     ERROR2(FALSE,"Could not make 24Bit Bitmap Copy Of 32Bit Source!");
00629                 }
00630             }
00631 
00632             FixOriginalComboBox();
00633             return OriginalChanged();
00634         }
00635     }
00636 
00637     pBmp = (KernelBitmap *)(Bitmaps->GetHead());
00638 
00639     while (pBmp != NULL)
00640     {
00641         if (pBmp == pOriginal) return OriginalChanged(); // OK we've found it.
00642         pBmp = (KernelBitmap *) Bitmaps->GetNext(pBmp);
00643     }
00644 
00645     pOriginal = (KernelBitmap *)(Bitmaps->GetHead()); // possibly NULL but certainly on the list
00646     return OriginalChanged();
00647 }
00648 
00649 /*******************************************************************************************
00650 
00651 >   BOOL BfxPlugInDlg::FixOriginalComboBox()
00652 
00653     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00654     Created:    14/12/94
00655     Inputs:     None
00656     Outputs:    None
00657     Returns:    TRUE if succeeded, FALSE & error set if not
00658     Purpose:    Makes the combo box reflect the bitmaps within the document
00659     Errors:     None at present
00660     SeeAlso:    -
00661 
00662 This routine is heavilly copied from one within the fill tool
00663 
00664 *******************************************************************************************/
00665 
00666 BOOL BfxPlugInDlg::FixOriginalComboBox()
00667 {
00668     // Find the doccomponent with the list of bitmaps in it
00669     Document * pDoc = Document::GetSelected();
00670 
00671     // Get the bitmap list
00672     BitmapList* Bitmaps = NULL;
00673     if (pDoc) Bitmaps = pDoc->GetBitmapList();
00674 
00675     if (Bitmaps == NULL)
00676         return TRUE;
00677 
00678     String_256 Str;
00679 
00680     if (OpenPage)
00681     {
00682         DeleteAllValues(_R(IDC_BFXDLG_ORIGCOMBO));
00683     }
00684 
00685     BOOL DoneMain = FALSE;
00686     INT32 SelIndex = 0;
00687 
00688     // need a pointer of type CustomComboBoxControlDataItem to insert items into
00689     // a custom combobox ....
00690     CustomComboBoxControlDataItem* theItem = NULL;
00691 
00692     if (Bitmaps->GetCount() > 0)
00693     {
00694         INT32 Index = 0;
00695 
00696         ListItem* pBmp = Bitmaps->GetHead();
00697 
00698         while (pBmp != NULL)
00699         {
00700             /*Str = ((KernelBitmap*)pBmp)->ActualBitmap->GetName();
00701             if (OpenPage)
00702             {
00703                 if (((KernelBitmap*)(pBmp)) == pOriginal)
00704                 {
00705                     SetStringGadgetValue(_R(IDC_BFXDLG_ORIGCOMBO),&Str, FALSE, -1);
00706                     DoneMain = TRUE;
00707                     SelIndex=Index;
00708                 }
00709                 SetStringGadgetValue(_R(IDC_BFXDLG_ORIGCOMBO),&Str,FALSE, Index++);
00710             }*/
00711 
00712             if (OpenPage)
00713             {
00714                 if (!((KernelBitmap*)pBmp)->HasBeenDeleted())   // Ignore deleted bitmaps
00715                 {
00716                     Str = ((KernelBitmap*)pBmp)->ActualBitmap->GetName();
00717                     // for the standard combobox - the following line sufficed
00718     //              SetStringGadgetValue(_R(IDC_EFFECT),&Str,FALSE, Index);
00719 
00720                     // but for a custom combobox we have to do a lot more work ....
00721                 
00722                     theItem = new CustomComboBoxControlDataItem ();
00723                     theItem->itemName = Str;
00724                     theItem->itemID = Index;
00725 
00726                     KernelBitmap* bitmap = ((KernelBitmap*)pBmp);
00727 
00728                     // make the custom combobox know about our bitmap ....
00729                     theItem->oilItemBitmap = (KernelBitmap*) bitmap;
00730 
00731                     // and insert the data item into the cutsom combobox ....
00732                     
00733                     if (((KernelBitmap*)(pBmp)) == pOriginal)
00734                     {
00735                         SetCustomComboGadgetValue ( _R(IDC_BFXDLG_ORIGCOMBO), theItem, TRUE, 0);
00736                         
00737                         String_64 Str;
00738                         Str = ((KernelBitmap*)(pBmp))->GetName ();
00739                         
00740                         // call custom controls interface ....
00741                         SelectCustomComboGadgetValueOnString (_R(IDC_BFXDLG_ORIGCOMBO), &Str);
00742                         
00743                         //SetCustomComboGadgetValue(_R(IDC_BFXDLG_ORIGCOMBO),&Str, FALSE, -1);
00744                         DoneMain = TRUE;
00745                         SelIndex=Index;
00746 
00747                         Index++;
00748                     }
00749                     else
00750                     {
00751                         SetCustomComboGadgetValue ( _R(IDC_BFXDLG_ORIGCOMBO), theItem, TRUE, 0);
00752                         Index++;
00753                     }
00754                 }
00755             }
00756 
00757             pBmp = Bitmaps->GetNext(pBmp);
00758         }
00759     }
00760     else
00761     {
00762         /*Str.Load(_R(IDS_K_BFXDLG_DEFAULT));
00763         if (OpenPage) SetStringGadgetValue(_R(IDC_BFXDLG_ORIGCOMBO),&Str,TRUE, 0);*/
00764     }
00765 
00766     if (OpenPage)
00767     {
00768         Str.Load(_R(IDS_K_BFXDLG_DEFAULT));
00769         //SetComboListLength(_R(IDC_BFXDLG_ORIGCOMBO));
00770         if (!DoneMain)
00771         {
00772             // call custom controls interface ....
00773             SelectCustomComboGadgetValueOnString (_R(IDC_BFXDLG_ORIGCOMBO), &Str);
00774             
00775             //SetStringGadgetValue(_R(IDC_BFXDLG_ORIGCOMBO),&Str, FALSE, -1);
00776             //SetSelectedValueIndex(_R(IDC_BFXDLG_ORIGCOMBO), 0);
00777         }
00778         /*else
00779         {
00780             SetSelectedValueIndex(_R(IDC_BFXDLG_ORIGCOMBO), SelIndex);
00781         }*/
00782     }
00783     return TRUE;
00784 }
00785 
00786 
00787 /*******************************************************************************************
00788 
00789 >   BOOL BfxPlugInDlg::ReadOriginalComboBox()
00790 
00791     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00792     Created:    14/12/94
00793     Inputs:     None
00794     Outputs:    None
00795     Returns:    TRUE if succeeded, FALSE & error set if not
00796     Purpose:    Chooses a different bitmap from the combo box
00797     Errors:     None at present
00798     SeeAlso:    -
00799 
00800 This routine is heavilly copied from one within the fill tool
00801 
00802 *******************************************************************************************/
00803 
00804 BOOL BfxPlugInDlg::ReadOriginalComboBox()
00805 {
00806     if (!OpenPage) return FALSE;
00807 
00808     Document * pDoc = Document::GetSelected();
00809 
00810     // Get the bitmap list
00811     BitmapList* Bitmaps = NULL;
00812     if (pDoc) Bitmaps = pDoc->GetBitmapList();
00813 
00814     if (Bitmaps == NULL)
00815         return TRUE;
00816 
00817     ListItem* pBmp = Bitmaps->GetHead();
00818 
00819     WORD Index;
00820     GetValueIndex(_R(IDC_BFXDLG_ORIGCOMBO),&Index); 
00821 
00822     for (INT32 i = 0; i < Index; i++)
00823     {
00824         if (pBmp == NULL)
00825             break;
00826 
00827         pBmp = Bitmaps->GetNext(pBmp);
00828     }
00829 
00830     pOriginal = (KernelBitmap*)pBmp; // Might be NULL (conceivably)
00831     return CheckOriginalBitmap();
00832 }
00833 
00834 /********************************************************************************************
00835 
00836 >   BOOL BfxPlugInDlg::RenderBitmap(ReDrawInfoType* ExtraInfo, KernelBitmap * BitmapToUse)
00837 
00838     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00839     Created:    20/02/95
00840     Inputs:     ExtraInfo - The structure that has the extra data we need to start rendering
00841                 BitmapToUse - The bitmap to render
00842     Outputs:    None
00843     Returns:    TRUE if succeeded, FALSE & error set if not
00844     Purpose:    Fills a renderable control with a bitmap
00845     Errors:     None at present
00846     SeeAlso:    -
00847 
00848 ********************************************************************************************/
00849 
00850 BOOL BfxPlugInDlg::RenderBitmap(ReDrawInfoType* ExtraInfo, KernelBitmap * BitmapToUse)
00851 {
00852     // Go get a render region
00853     DocRect VirtualSize(0, 0, ExtraInfo->dx, ExtraInfo->dy);
00854     RenderRegion* pRender = CreateGRenderRegion(&VirtualSize, ExtraInfo);
00855     if (pRender!=NULL)
00856     {
00857         pRender->m_DoCompression = TRUE;
00858 
00859         DialogColourInfo RedrawColours;     // Get a supplier for default dlg colours
00860 
00861         // A Grey colour [...hmmm, it's not a very grey grey any more... oragnge more like]
00862         DocColour Grey(255,200,0);
00863 
00864         // Render the attributes and the a rectangle
00865         pRender->SaveContext();
00866         pRender->SetLineColour(COLOUR_TRANS);
00867 
00868             // Draw a rectangle to fill in the background - Fill with Dialogue Background colour
00869         pRender->SetFillColour(RedrawColours.DialogBack());
00870         pRender->DrawRect(&VirtualSize);
00871     
00872         if (BitmapToUse)
00873         {
00874 
00875             NodeBitmap NB;
00876             NodeBitmap * pNodeBitmap = &NB;
00877         
00878             if (!((pNodeBitmap == NULL) || (!pNodeBitmap->SetUpPath(12,12))))
00879             {
00880                 // Get a new bitmap object for this node.
00881                 pNodeBitmap->GetBitmapRef()->SetBitmap(BitmapToUse);
00882                         
00883                 ENSURE(pNodeBitmap->GetBitmap()->ActualBitmap != NULL, "No bitmap object found!");
00884         
00885                 DocRect BitmapSize(VirtualSize);
00886                 BitmapInfo BMInfo;
00887                 BitmapToUse->ActualBitmap->GetInfo(&BMInfo);
00888                 if (BMInfo.PixelWidth==0) BMInfo.PixelWidth=1;
00889                 if (BMInfo.PixelHeight==0) BMInfo.PixelHeight=1;
00890 
00891                 double BMAspect = ((double)(BMInfo.PixelWidth))/((double)(BMInfo.PixelHeight));
00892                 double RedrawAspect = ((double)(ExtraInfo->dx))/((double)(ExtraInfo->dy));
00893 
00894                 if (BMAspect>RedrawAspect)
00895                 {
00896                     // grey at top and bottom
00897                     INT32 NewHeight = (INT32)( 0.5 + ((double)(VirtualSize.Width()))/BMAspect);
00898                     if (NewHeight<1) NewHeight = 1;
00899                     BitmapSize.loy = (VirtualSize.Height()-NewHeight)/2;
00900                     BitmapSize.hiy = BitmapSize.loy + NewHeight;
00901                 }
00902                 else
00903                 {
00904                     // grey on left and right
00905                     INT32 NewWidth = (INT32)( 0.5 + ((double)(VirtualSize.Height()))*BMAspect);
00906                     if (NewWidth<1) NewWidth = 1;
00907                     BitmapSize.lox = (VirtualSize.Width()-NewWidth)/2;
00908                     BitmapSize.hix = BitmapSize.lox + NewWidth;
00909                 }
00910 
00911                 // And set this in our bitmap node
00912                 pNodeBitmap->CreateShape(BitmapSize);
00913                     
00914                 pNodeBitmap->Render(pRender);
00915             }
00916         }
00917 
00918         pRender->RestoreContext();
00919 
00920         // Get rid of the render region
00921         DestroyGRenderRegion(pRender);
00922     }
00923     return TRUE;
00924 }
00925 
00926 /********************************************************************************************
00927 >   MsgResult BfxPlugInDlg::Message( Msg* Message)
00928 
00929     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00930     Created:    20/02/95
00931     Inputs:     Message: The message 
00932 
00933     
00934     Returns:    OK            Message handled ok (return this even if you don't need to 
00935                               respond to the message). 
00936 
00937                 FAIL          Something terrible happened whilst processing the message
00938                               eg. we ran out of memory. You must set ERROR if you
00939                               are returning this value. 
00940 
00941                 EAT_MSG       The Message was handled ok but don't send it to any
00942                               more MessageHandlers. 
00943 
00944     Purpose:    This is the message handler for the BfxPlugInDlg
00945      
00946 ********************************************************************************************/
00947 
00948 
00949 MsgResult BfxPlugInDlg::Message( Msg* Message)
00950 {
00951     if (IS_OUR_DIALOG_MSG(Message))
00952     {
00953         DialogMsg* Msg = ((DialogMsg*) Message); 
00954         
00955         BOOL EndDialog = FALSE;     // TRUE if we should quit the dialog
00956         BOOL CommitValues = FALSE;  // TRUE if we should commit the dialog values
00957 
00958         // Determine from what page the message originated
00959         if (OpenPage) switch (OpenPage)
00960         {
00961             case _R(IDD_BFXPLUGINDLG_PG1):
00962                 HandleFlipAndRotateMsg(Msg, &CommitValues, &EndDialog); 
00963                 break;
00964             case _R(IDD_BFXPLUGINDLG_PG2):
00965                 HandleResizeMsg(Msg, &CommitValues, &EndDialog); 
00966                 break;
00967             case _R(IDD_BFXPLUGINDLG_PG3):
00968                 HandleBrightnessAndContrastMsg(Msg, &CommitValues, &EndDialog); 
00969                 break;
00970             case _R(IDD_BFXPLUGINDLG_PG4):
00971                 HandleDitherMsg(Msg, &CommitValues, &EndDialog); 
00972                 break;
00973             case _R(IDD_BFXPLUGINDLG_PG5):
00974                 HandleSpecialEffectsMsg(Msg, &CommitValues, &EndDialog); 
00975                 break;
00976             case _R(IDD_BFXPLUGINDLG_PG6):
00977                 HandleAlchemistMsg(Msg, &CommitValues, &EndDialog); 
00978                 break;
00979             default:
00980                 ERROR3("Message from unknown tab dialog page"); 
00981         }
00982 
00983         switch (Msg->DlgMsg)
00984         {
00985             case DIM_CREATE:
00986                 pOriginal=NULL;
00987                 FindBitmap();
00988                 FixOriginalComboBox();
00989                 SetDirty();
00990                 break;
00991             
00992             case DIM_COMMIT:        // Want to commit and quit
00993                 EndDialog = TRUE;
00994                 CommitValues = TRUE; 
00995                 break;
00996 
00997             case DIM_SOFT_COMMIT:   // Want to commit
00998                 CommitValues = TRUE; 
00999                 break; 
01000 
01001             case DIM_CANCEL:        // Want to quit
01002                 if (!(IsCustomComboDropdownVisible (_R(IDC_BFXDLG_ORIGCOMBO))))
01003                 {
01004                     EndDialog = TRUE;
01005                 }
01006                 else
01007                 {
01008                     CloseDropdown (_R(IDC_BFXDLG_ORIGCOMBO), FALSE);
01009                 }
01010                 break;
01011 
01012         // These are common to all pages, and get passed on to the pages themselves
01013             case DIM_SET_ACTIVE:
01014                 CheckOriginalBitmap();
01015                 FixOriginalComboBox();
01016                 SetDirty();
01017                 break;
01018 
01019             case DIM_REDRAW :
01020                 // This is where all the redrawing is done
01021                 // Which control in the window is sending the redraw message (if there are many
01022                 // grdraw controls you can tell which is which from the Gadget ID
01023                 switch (Msg->GadgetID)
01024                 {
01025                     // Draw the redraw_me control in here
01026                     case _R(IDC_BFXDLG_ORIGREDRAW) :
01027                     {
01028                         RenderBitmap((ReDrawInfoType*) Msg->DlgMsgParam, pOriginal);
01029                         break;
01030                     }
01031                     case _R(IDC_BFXDLG_ORIGREDRAW2) :
01032                     {
01033                         RenderBitmap((ReDrawInfoType*) Msg->DlgMsgParam, pDestination);
01034                         break;
01035                     }
01036                 }
01037                 break;
01038             
01039             case DIM_SELECTION_CHANGED:
01040                 switch (Msg->GadgetID)
01041                 {
01042                     // Draw the redraw_me control in here
01043                     case _R(IDC_BFXDLG_ORIGCOMBO) :
01044                     {
01045                         ReadOriginalComboBox();
01046                         break;
01047                     }
01048                 }
01049                 break;                                                 
01050         }
01051 
01052         // Commit values here
01053         if (CommitValues)
01054         {
01055             if (pOriginal)
01056             {
01057                 if (pFX)
01058                 {
01059                     if (!Clean)
01060                     {
01061                         // Check to see if we`re exiting without doing anything to a converted 32bit BMP
01062                 /*      if(Msg->DlgMsg == DIM_COMMIT && m_UseInitial)
01063                         {
01064                             // Right, we`ve got to rename it or the Destructor will delete it!
01065                             // Get The Current Name and then chop off the "(Copy)"
01066                             StringBase Current;
01067                             Current.Alloc(256);
01068                             pOriginal->GetName().Left(&Current,pOriginal->GetName().Length() - 13);
01069                             String_256 NewName = (TCHAR*)Current;
01070 
01071                             // Set the name with the new string! Now there should be two bitmaps with the
01072                             // same name, but one will be 32bit and the other this 24bit copy!
01073                             pOriginal->SetName(NewName);
01074                         }
01075 
01076                     */
01077                         ClearDestination();
01078 
01079                         // Bodge to avoid progress bar on interactive B&C
01080 /*                      if (Msg->DlgMsg==DIM_COMMIT || Msg->DlgMsg==DIM_SOFT_COMMIT)
01081                         {
01082                             BeginSlowJob(100, FALSE, &String_64(_R(IDS_BFXDLG_PROCESSING)));
01083                             ContinueSlowJob();
01084                         }
01085 */                      
01086                         BeginSlowJob();
01087                         BeginBusyCursor();
01088                         
01089                         pFX->SetParameters(Param1, Param2, Param3, Matrix);
01090                         pDestination = pFX->GetProcessedBitmap(pOriginal);
01091 
01092 /*                      if (Msg->DlgMsg==DIM_COMMIT || Msg->DlgMsg==DIM_SOFT_COMMIT)
01093                         {
01094                             ContinueSlowJob(99);
01095                             EndSlowJob();
01096                         }
01097 */                      
01098                         EndBusyCursor();
01099                         EndSlowJob();
01100                         
01101                         if (!pDestination)  
01102                         {
01103                             InformError ();
01104                             EndDialog = FALSE;          // an error occured - we don't want to close the dialog!
01105                         }
01106                         else
01107                         {
01108                             DestinationChanged();
01109                             Clean=TRUE;
01110                         }
01111                     }
01112                 }
01113                 else
01114                 {
01115                     TRACEUSER( "Neville", _T("Wierd - he didn't actually ask for an effect..."));
01116                     // Check to see if we`re exiting without doing anything to a converted 32bit BMP
01117                     if(Msg->DlgMsg == DIM_COMMIT && m_UseInitial)
01118                     {
01119                         // Right, we`ve got to rename it or the Destructor will delete it!
01120                         // Get The Current Name and then chop off the "(Copy)"
01121                         StringBase Current;
01122                         Current.Alloc(256);
01123                         pOriginal->GetName().Left(&Current,pOriginal->GetName().Length() - 13);
01124                         String_256 NewName = (TCHAR*)Current;
01125 
01126                         // Set the name with the new string! Now there should be two bitmaps with the
01127                         // same name, but one will be 32bit and the other this 24bit copy!
01128                         pOriginal->SetName(NewName);
01129                     }
01130                 }
01131             }
01132         }
01133 
01134         // End dialog here
01135         if (EndDialog)  // Dialog communication over 
01136         {   
01137             // **** Warning ****
01138             // This assumes that the dialog box is modal and so the OpParam is still around
01139             // rather than having been deleted 
01140             if (m_pParam != NULL)
01141             {
01142                 // return the ok/cancel state to the caller
01143                 if (m_pParam->Output != NULL)
01144                     *(m_pParam->Output) = CommitValues;
01145                 // return a default of a null bitmap to the caller
01146                 m_pParam->Param1 = NULL;
01147             }
01148 
01149             if (pOriginal != NULL && CommitValues && pDestination != NULL)
01150             {
01151                 OpenPage = 0;
01152                 //TalkToPage(0);
01153 
01154                 // The bitmap created is a temp bitmap, so we need to add it properly to the system.
01155                 // So we'll extract the OILBitmap (which will delete the KBmp),
01156                 // and create a 'proper' kbmp to attach to the node
01157                 OILBitmap * pDestWinBitmap = pDestination->ExtractOILBitmap();
01158 
01159                 // See if this matches an existing bitmap, otherwise this will create a new kernel
01160                 // bitmap for us.
01161                 KernelBitmap * pDestBitmap = NULL;
01162                 BitmapList * pBmpList = NULL;
01163                 // The bitmap system relies on the Current Doc being correct,
01164                 // so we'll set it to be on the safe side
01165                 BOOL IsNew = TRUE;
01166                 if (m_pDocument)
01167                 {
01168                     m_pDocument->SetCurrent();
01169                     //pDestBitmap = KernelBitmap::MakeKernelBitmap(pDestWinBitmap, m_pDocument);
01170                     pDestBitmap = KernelBitmap::TryAndUseExistingBitmap(pDestWinBitmap, m_pDocument, &IsNew);
01171                     pBmpList = m_pDocument->GetBitmapList();
01172                     ERROR3IF(pBmpList == NULL,"No document bitmap ref found!");
01173                 }
01174 
01175                 // Try and add it to the list of bitmaps already present in this document
01176                 if (pDestBitmap != NULL && pBmpList != NULL)
01177                 {
01178                     // and then attach the bitmap
01179                     pDestBitmap->Attach(pBmpList);
01180                     
01181                     // remove this pointer so that the new bitmap does not get deleted
01182                     // pDestBitmap is more than likely equal to pDestination
01183                     //if (!IsNew) This always seems to be true
01184                     pDestination = NULL;
01185 
01186                     // tell everybody about the new bitmap in the system
01187                     BROADCAST_TO_ALL(BitmapListChangedMsg(pBmpList, pDestBitmap)); 
01188 
01189                     // return the output bitmap to the caller
01190                     if (m_pParam)
01191                         m_pParam->Param1 = (INT32)pDestBitmap;
01192                 }
01193                 else
01194                     ERROR3("Couldn't add bitmap into system");
01195             }
01196 
01197             ClearDestination();
01198 
01199             Close();           
01200 //          TRACEUSER( "Neville", _T("Calling End()\n"));
01201             End();      // End of dialog 
01202         }
01203         //return (DLG_EAT_IF_HUNGRY(Msg));   // I return EAT_MSG unless the message needs to be sent to all dialogs 
01204     } else if (MESSAGE_IS_A(Message, SelChangingMsg))       // Selection changed - use new bitmap
01205     {
01206         //if (OpenPage) TalkToPage(OpenPage);
01207         SelChangingMsg *Msg = (SelChangingMsg *) Message;
01208         switch ( Msg->State )
01209         {
01210             case SelChangingMsg::SelectionState::SELECTIONCHANGED:
01211             case SelChangingMsg::SelectionState::NODECHANGED:
01212 //              pOriginal=NULL;
01213                 FindBitmap();
01214                 break;
01215         }
01216     } else if (MESSAGE_IS_A(Message, BitmapListChangedMsg))     // Selection changed - use new bitmap
01217     {
01218         //if (OpenPage) TalkToPage(OpenPage);
01219         CheckOriginalBitmap();
01220         FixOriginalComboBox();
01221     } else if (MESSAGE_IS_A(Message, BfxMsg))
01222     {
01223         //if (OpenPage) TalkToPage(OpenPage);
01224         pOriginal=((BfxMsg*)(Message))->pBitmap;
01225         CheckOriginalBitmap();
01226     }
01227 
01228     return DialogOp::Message(Message);
01229 } 
01230 
01231 
01232 
01233 // -----------------------------------------------------------------------------------------
01234 // Message handlers for individual pages
01235 
01236 /********************************************************************************************
01237 
01238 >   void BfxPlugInDlg::HandleFlipAndRotateMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01239 
01240     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01241     Created:    20/02/95
01242     Inputs:     Msg: The message sent from page 1 of the dialog
01243     Outputs:    -
01244     Returns:    -
01245     Purpose:    All messages generated from the tabbed dialog's page 1 get processed here
01246     Errors:     -
01247     Scope:      private
01248     SeeAlso:    BfxPlugInDlg::Message
01249 
01250 ********************************************************************************************/
01251 
01252 
01253 void BfxPlugInDlg::HandleFlipAndRotateMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01254 {
01255     //TalkToPage(_R(IDD_BFXPLUGINDLG_PG1));  // The Coords Page identifier
01256     switch(Msg->DlgMsg)
01257     {
01258         case DIM_CREATE:
01259             SetLongGadgetValue(_R(IDC_BFXDLG_FLIPX), TRUE); 
01260             SetLongGadgetValue(_R(IDC_BFXDLG_FLIPY), FALSE); 
01261             SetLongGadgetValue(_R(IDC_BFXDLG_ROTATE90), FALSE); 
01262             SetLongGadgetValue(_R(IDC_BFXDLG_ROTATE180), FALSE); 
01263             SetLongGadgetValue(_R(IDC_BFXDLG_ROTATE270), FALSE); 
01264             break;
01265 
01266         case DIM_LFT_BN_CLICKED:
01267         case DIM_SELECTION_CHANGED:
01268             {
01269                 m_UseInitial = FALSE;
01270                 switch (Msg->GadgetID)
01271                 {
01272                     case _R(IDC_BFXDLG_FLIPX):
01273                     case _R(IDC_BFXDLG_FLIPY):
01274                     case _R(IDC_BFXDLG_ROTATE90):
01275                     case _R(IDC_BFXDLG_ROTATE180):
01276                     case _R(IDC_BFXDLG_ROTATE270):
01277                         SetDirty();
01278                         break;
01279                     default:
01280                         break;
01281                 }
01282             }
01283 //          break;
01284             *pCommitValues = TRUE;
01285 
01286         case DIM_SOFT_COMMIT:
01287         case DIM_COMMIT:
01288             {
01289                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_FLIPX))) SetEffect(CC_RUNTIME_CLASS(ABFXFlipX));
01290                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_FLIPY))) SetEffect(CC_RUNTIME_CLASS(ABFXFlipY));
01291                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_ROTATE90) )) SetEffect(CC_RUNTIME_CLASS(ABFXRotate90 ));
01292                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_ROTATE180))) SetEffect(CC_RUNTIME_CLASS(ABFXRotate180));
01293                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_ROTATE270))) SetEffect(CC_RUNTIME_CLASS(ABFXRotate270));
01294             }
01295             break;
01296 
01297     }
01298 }
01299 
01300 /********************************************************************************************
01301 
01302 >   void BfxPlugInDlg::HandleResizeMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01303 
01304     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01305     Created:    20/02/95
01306     Inputs:     Msg: The message sent from page 1 of the dialog
01307     Outputs:    -
01308     Returns:    -
01309     Purpose:    All messages generated from the tabbed dialog's page 1 get processed here
01310     Errors:     -
01311     Scope:      private
01312     SeeAlso:    BfxPlugInDlg::Message
01313 
01314 ********************************************************************************************/
01315 
01316 
01317 void BfxPlugInDlg::HandleResizeMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01318 {
01319     static BOOL ReEntered = FALSE;
01320     BOOL RescanSize = FALSE;
01321     //TalkToPage(_R(IDD_BFXPLUGINDLG_PG2));  // The Coords Page identifier
01322     switch(Msg->DlgMsg)
01323     {
01324         case DIM_SET_ACTIVE:
01325             ReEntered = FALSE; // Just in case we get out of sync
01326             break;
01327 
01328         case DIM_CREATE:
01329             FindBitmap();
01330             SetLongGadgetValue(_R(IDC_BFXDLG_INTERP), TRUE); 
01331             SetLongGadgetValue(_R(IDC_BFXDLG_ASPECT), TRUE); 
01332             RescanSize=TRUE;
01333 
01334             // Disable this to begin with, until a new and different size is entered.
01335             EnableGadget(_R(ID_APPLY_NOW), FALSE);
01336             break;
01337 
01338         case DIM_OUT_OF_SPACE: // BODGE!!
01339             if (Msg->GadgetID == _R(IDC_BFXDLG_ORIGREDRAW))
01340                 RescanSize=TRUE;
01341             break;
01342 
01343         case DIM_SELECTION_CHANGED:
01344         case DIM_SLIDER_POS_SET:
01345         //case DIM_SLIDER_POS_CHANGING:
01346         case DIM_LFT_BN_CLICKED:
01347         case DIM_TEXT_CHANGED:             // Text changed 
01348         {
01349             m_UseInitial = FALSE;
01350             SetDirty();
01351             INT32 NewX = GetLongGadgetValue(_R(IDC_BFXDLG_NEWXSIZE),0,10000000);
01352             INT32 NewY = GetLongGadgetValue(_R(IDC_BFXDLG_NEWYSIZE),0,10000000);
01353             EnableGadget(_R(ID_APPLY_NOW),
01354                             NewX != (INT32) pOrigInfo->PixelWidth || NewY != (INT32) pOrigInfo->PixelHeight);
01355 
01356             if ((GetLongGadgetValue(_R(IDC_BFXDLG_ASPECT),0,1)!=0) && !ReEntered)
01357             {
01358                 switch (Msg->GadgetID)
01359                 {
01360                     case _R(IDC_BFXDLG_NEWXSIZE):
01361                         if (pOrigInfo->PixelWidth)
01362                         {
01363                             ReEntered = TRUE;
01364                             SetLongGadgetValue(_R(IDC_BFXDLG_NEWYSIZE), (INT32)(0.5+ (
01365                                 ((double)(pOrigInfo->PixelHeight))/((double)(pOrigInfo->PixelWidth))*((double)(NewX)) )));
01366                             ReEntered = FALSE;
01367                         }
01368                         break;
01369                 
01370                     case _R(IDC_BFXDLG_NEWYSIZE):
01371                         if (pOrigInfo->PixelHeight)
01372                         {
01373                             ReEntered = TRUE;
01374                             SetLongGadgetValue(_R(IDC_BFXDLG_NEWXSIZE), (INT32)(0.5+ (
01375                                 ((double)(pOrigInfo->PixelWidth))/((double)(pOrigInfo->PixelHeight))*((double)(NewY)) )));
01376                             ReEntered = FALSE;
01377                         }
01378                         break;
01379 
01380                     default:
01381                         break;
01382                 }
01383             }
01384             break;
01385         }
01386         case DIM_SOFT_COMMIT:
01387         case DIM_COMMIT:
01388             {
01389                 SetEffect(CC_RUNTIME_CLASS(ABFXResize));
01390                 INT32 NewX = GetLongGadgetValue(_R(IDC_BFXDLG_NEWXSIZE),0,10000000);
01391                 INT32 NewY = GetLongGadgetValue(_R(IDC_BFXDLG_NEWYSIZE),0,10000000);
01392                 if (NewX<2) NewX = 2;
01393                 if (NewY<2) NewY = 2;
01394                 SetParameters(NewX, NewY, (INT32)(BOOL)(GetLongGadgetValue(_R(IDC_BFXDLG_INTERP),0,1)!=0));
01395                 }
01396             break;
01397     }
01398 
01399     if (RescanSize && pOrigInfo)
01400     {
01401         ReEntered = TRUE;
01402         SetLongGadgetValue(_R(IDC_BFXDLG_ORIGXSIZE), pOrigInfo->PixelWidth);
01403         SetLongGadgetValue(_R(IDC_BFXDLG_NEWXSIZE),  pOrigInfo->PixelWidth);
01404         SetLongGadgetValue(_R(IDC_BFXDLG_ORIGYSIZE), pOrigInfo->PixelHeight);
01405         SetLongGadgetValue(_R(IDC_BFXDLG_NEWYSIZE),  pOrigInfo->PixelHeight);
01406         ReEntered = FALSE;
01407     }
01408 }
01409 /********************************************************************************************
01410 
01411 >   void BfxPlugInDlg::HandleBrightnessAndContrastMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01412 
01413     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01414     Created:    20/02/95
01415     Inputs:     Msg: The message sent from page 1 of the dialog
01416     Outputs:    -
01417     Returns:    -
01418     Purpose:    All messages generated from the tabbed dialog's page 1 get processed here
01419     Errors:     -
01420     Scope:      private
01421     SeeAlso:    BfxPlugInDlg::Message
01422 
01423 ********************************************************************************************/
01424 
01425 
01426 void BfxPlugInDlg::HandleBrightnessAndContrastMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01427 {
01428     //TalkToPage(_R(IDD_BFXPLUGINDLG_PG3));  // The Coords Page identifier
01429     switch(Msg->DlgMsg)
01430     {
01431         case DIM_CREATE:
01432             SetGadgetRange(_R(IDC_BFXDLG_BRIGHTNESS), -127, 127, 1);
01433             SetGadgetBitmaps(_R(IDC_BFXDLG_BRIGHTNESS), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
01434             SetGadgetRange(_R(IDC_BFXDLG_CONTRAST), -127, 127, 1);
01435             SetGadgetBitmaps(_R(IDC_BFXDLG_CONTRAST), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
01436             SetGadgetRange(_R(IDC_BFXDLG_COLOUR), -127, 127, 1);
01437             SetGadgetBitmaps(_R(IDC_BFXDLG_COLOUR), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
01438             SetLongGadgetValue(_R(IDC_BFXDLG_BRIGHTNESS), 0); 
01439             SetLongGadgetValue(_R(IDC_BFXDLG_CONTRAST), 0); 
01440             SetLongGadgetValue(_R(IDC_BFXDLG_COLOUR), 0); 
01441             break;
01442 //      case DIM_SLIDER_POS_SET:
01443 //      case DIM_SLIDER_POS_IDLE:
01444         case DIM_LFT_BN_CLICKED:
01445         case DIM_SELECTION_CHANGED:
01446             {
01447                 switch (Msg->GadgetID)
01448                 {
01449                     case _R(IDC_BFXDLG_BRIGHTNESS):
01450                     case _R(IDC_BFXDLG_CONTRAST):
01451                     case _R(IDC_BFXDLG_COLOUR):
01452                         SetDirty();
01453                         break;
01454                     default:
01455                         break;
01456                 }
01457             }
01458             break;
01459 
01460         case DIM_SLIDER_POS_SET:
01461         case DIM_SLIDER_POS_IDLE:
01462             m_UseInitial = FALSE;
01463         case DIM_SOFT_COMMIT:
01464         case DIM_COMMIT:
01465             {
01466                 INT32 Brightness = -GetLongGadgetValue(_R(IDC_BFXDLG_BRIGHTNESS),-127,127);
01467                 INT32 Contrast = -GetLongGadgetValue(_R(IDC_BFXDLG_CONTRAST),-127,127);
01468                 INT32 Colour = -GetLongGadgetValue(_R(IDC_BFXDLG_COLOUR),-127,127);
01469                 if (Msg->DlgMsg == DIM_SLIDER_POS_SET || Msg->DlgMsg == DIM_SLIDER_POS_IDLE)
01470                 {
01471                     if (InteractiveBCC)
01472                     {                   
01473                         if ((!pFX) || (!pFX->IsKindOf(CC_RUNTIME_CLASS(ABFXBrightnessContrast))) ||
01474                             (Brightness!=Param1) || (Contrast!=Param2) || (Colour!=Param3))
01475                         {
01476                             *pCommitValues = TRUE;
01477                             *pEndDialog = FALSE;
01478                             SetDirty(FALSE); // no redraw right now
01479                         }
01480                         else break;
01481                     }
01482                     else
01483                     {
01484                         SetDirty();
01485                         break;
01486                     }
01487                 }
01488                 SetEffect(CC_RUNTIME_CLASS(ABFXBrightnessContrast));
01489                 SetParameters(Brightness, Contrast, Colour);
01490             }
01491             break;
01492 
01493     }
01494 }
01495 /********************************************************************************************
01496 
01497 >   void BfxPlugInDlg::HandleDitherMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01498 
01499     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01500     Created:    20/02/95
01501     Inputs:     Msg: The message sent from page 1 of the dialog
01502     Outputs:    -
01503     Returns:    -
01504     Purpose:    All messages generated from the tabbed dialog's page 1 get processed here
01505     Errors:     -
01506     Scope:      private
01507     SeeAlso:    BfxPlugInDlg::Message
01508 
01509 ********************************************************************************************/
01510 
01511 
01512 void BfxPlugInDlg::HandleDitherMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01513 {
01514     //TalkToPage(_R(IDD_BFXPLUGINDLG_PG4));  // The Coords Page identifier
01515     switch(Msg->DlgMsg)
01516     {
01517         case DIM_CREATE:
01518             SetLongGadgetValue(_R(IDC_BFXDLG_BAYERMONO), TRUE); 
01519             SetLongGadgetValue(_R(IDC_BFXDLG_HALFTONEMONO), FALSE); 
01520             SetLongGadgetValue(_R(IDC_BFXDLG_DIFFUSIONMONO), FALSE); 
01521             SetLongGadgetValue(_R(IDC_BFXDLG_BAYERCOLOUR), FALSE); 
01522             SetLongGadgetValue(_R(IDC_BFXDLG_DIFFUSIONCOLOUR), FALSE); 
01523             SetLongGadgetValue(_R(IDC_BFXDLG_POPULARITY), FALSE); 
01524             SetLongGadgetValue(_R(IDC_BFXDLG_MAKEGREYSCALE), FALSE); 
01525             SetLongGadgetValue(_R(IDC_BFXDLG_OCTREECOLOUR), FALSE); 
01526             
01527 //EnableGadget(_R(IDC_BFXDLG_DIFFUSIONCOLOUR), FALSE); // Accusoft library crashes
01528 //EnableGadget(_R(IDC_BFXDLG_OCTREECOLOUR), FALSE); // Accusoft library crashes
01529 
01530             //EnableGadget (_R(IDC_BFXDLG_ORIGCOMBO), TRUE);    // need to force custom control to redraw!
01531             
01532             break;
01533 
01534         case DIM_LFT_BN_CLICKED:
01535         case DIM_SELECTION_CHANGED:
01536             {
01537                 m_UseInitial = FALSE;
01538                 switch (Msg->GadgetID)
01539                 {
01540                     case _R(IDC_BFXDLG_BAYERMONO):
01541                     case _R(IDC_BFXDLG_HALFTONEMONO):
01542                     case _R(IDC_BFXDLG_DIFFUSIONMONO):
01543                     case _R(IDC_BFXDLG_BAYERCOLOUR):
01544                     case _R(IDC_BFXDLG_DIFFUSIONCOLOUR):
01545                     case _R(IDC_BFXDLG_POPULARITY):
01546                     case _R(IDC_BFXDLG_MAKEGREYSCALE):
01547                     case _R(IDC_BFXDLG_OCTREECOLOUR):
01548                         SetDirty();
01549                         break;
01550                     default:
01551                         break;
01552                 }
01553             }
01554 //          break;
01555             *pCommitValues = TRUE;
01556 
01557         case DIM_SOFT_COMMIT:
01558         case DIM_COMMIT:
01559             {
01560                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_BAYERMONO)      )) SetEffect(CC_RUNTIME_CLASS(ABFXBayerMono));
01561                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_HALFTONEMONO)   )) SetEffect(CC_RUNTIME_CLASS(ABFXHalftoneMono));
01562                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_DIFFUSIONMONO)  )) SetEffect(CC_RUNTIME_CLASS(ABFXDiffusionMono));
01563                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_BAYERCOLOUR)    )) SetEffect(CC_RUNTIME_CLASS(ABFXBayerColour));
01564                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_DIFFUSIONCOLOUR))) SetEffect(CC_RUNTIME_CLASS(ABFXDiffusionColour));
01565                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_POPULARITY)     )) SetEffect(CC_RUNTIME_CLASS(ABFXPopularityColour));
01566                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_MAKEGREYSCALE)  )) SetEffect(CC_RUNTIME_CLASS(ABFXMakeGreyscale));
01567                 if (GetBoolGadgetSelected(_R(IDC_BFXDLG_OCTREECOLOUR)      )) SetEffect(CC_RUNTIME_CLASS(ABFXOctree));
01568             }
01569             break;
01570 
01571     }
01572 }
01573 
01574 /********************************************************************************************
01575 
01576 >   void BfxPlugInDlg::HandleSpecialEffectsMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01577 
01578     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01579     Created:    20/02/95
01580     Inputs:     Msg: The message sent from page 1 of the dialog
01581     Outputs:    -
01582     Returns:    -
01583     Purpose:    All messages generated from the tabbed dialog's page 1 get processed here
01584     Errors:     -
01585     Scope:      private
01586     SeeAlso:    BfxPlugInDlg::Message
01587 
01588 ********************************************************************************************/
01589 
01590 
01591 void BfxPlugInDlg::HandleSpecialEffectsMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01592 {
01593     //TalkToPage(_R(IDD_BFXPLUGINDLG_PG5));  // The Coords Page identifier
01594     switch(Msg->DlgMsg)
01595     {
01596         case DIM_CREATE:
01597             {
01598                 SetLongGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO), 0); 
01599                 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM1), (INT32)(Matrix[0]+0.5));
01600                 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM2), (INT32)(Matrix[1]+0.5));
01601                 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM3), (INT32)(Matrix[2]+0.5));
01602                 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM4), (INT32)(Matrix[3]+0.5));
01603                 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM5), (INT32)(Matrix[4]+0.5));
01604                 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM6), (INT32)(Matrix[5]+0.5));
01605                 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM7), (INT32)(Matrix[6]+0.5));
01606                 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM8), (INT32)(Matrix[7]+0.5));
01607                 SetLongGadgetValue(_R(IDC_BFXDLG_CUSTOM9), (INT32)(Matrix[8]+0.5));
01608                 SetGadgetRange(_R(IDC_BFXDLG_AMOUNT), 0, 127, 1);
01609                 SetGadgetBitmaps(_R(IDC_BFXDLG_AMOUNT), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01610                 SetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT), 64); 
01611 
01612                 DeleteAllValues(_R(IDC_BFXDLG_EFFECTCOMBO));
01613 
01614                 String_256 Str0(_R(IDS_BFXDLG_EFFECTMENU0));
01615                 String_256 Str1(_R(IDS_BFXDLG_EFFECTMENU1));
01616                 String_256 Str2(_R(IDS_BFXDLG_EFFECTMENU2));
01617                 String_256 Str3(_R(IDS_BFXDLG_EFFECTMENU3));
01618                 String_256 Str4(_R(IDS_BFXDLG_EFFECTMENU4));
01619                 String_256 Str5(_R(IDS_BFXDLG_EFFECTMENU5));
01620                 String_256 Str6(_R(IDS_BFXDLG_EFFECTMENU6));
01621                 String_256 Str7(_R(IDS_BFXDLG_EFFECTMENU7));
01622                 String_256 Str8(_R(IDS_BFXDLG_EFFECTMENU8));
01623                 String_256 Str9(_R(IDS_BFXDLG_EFFECTMENU9));
01624                 String_256 Str10(_R(IDS_BFXDLG_EFFECTMENU10));
01625                 String_256 Str11(_R(IDS_BFXDLG_EFFECTMENU11));
01626                 String_256 Str12(_R(IDS_BFXDLG_EFFECTMENU12));
01627                 String_256 Str13(_R(IDS_BFXDLG_EFFECTMENU13));
01628                 String_256 Str14(_R(IDS_BFXDLG_EFFECTMENU14));
01629                 String_256 Str15(_R(IDS_BFXDLG_EFFECTMENU15));
01630                 String_256 Str16(_R(IDS_BFXDLG_EFFECTMENU16));
01631                 String_256 Str17(_R(IDS_BFXDLG_EFFECTMENU17));
01632                 String_256 Str18(_R(IDS_BFXDLG_EFFECTMENU18));
01633                 String_256 Str19(_R(IDS_BFXDLG_EFFECTMENU19));
01634             
01635                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str0,FALSE, 0);
01636                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str1,FALSE, 1);
01637                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str2,FALSE, 2);
01638                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str3,FALSE, 3);
01639                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str4,FALSE, 4);
01640                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str5,FALSE, 5);
01641                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str6,FALSE, 6);
01642                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str7,FALSE, 7);
01643                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str8,FALSE, 8);
01644                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str9,FALSE, 9);
01645                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str10,FALSE, 10);
01646                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str11,FALSE, 11);
01647                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str12,FALSE, 12);
01648                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str13,FALSE, 13);
01649                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str14,FALSE, 14);
01650                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str15,FALSE, 15);
01651                 if (IsUserName("Neville"))
01652                 {
01653                     SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str16,FALSE, 16);
01654                     SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str17,FALSE, 17);
01655                     SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str18,FALSE, 18);
01656                     SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str19,FALSE, 19);
01657                 }           
01658                 
01659                 
01660                 SetStringGadgetValue(_R(IDC_BFXDLG_EFFECTCOMBO),&Str11, FALSE, -1);
01661                 SetComboListLength(_R(IDC_BFXDLG_EFFECTCOMBO));
01662                 SetSelectedValueIndex(_R(IDC_BFXDLG_EFFECTCOMBO), 11);
01663             }
01664             //break; RUN THROUGH
01665 
01666         case DIM_SLIDER_POS_SET:
01667             if(Msg->DlgMsg != DIM_CREATE)
01668             {
01669                 m_UseInitial = FALSE;
01670             }
01671         //case DIM_SLIDER_POS_CHANGING:
01672         case DIM_LFT_BN_CLICKED:
01673         case DIM_SELECTION_CHANGED:
01674         case DIM_TEXT_CHANGED:             // Text changed 
01675             {
01676                 SetDirty();
01677                 INT32 Choice = GetSelectedValueIndex(_R(IDC_BFXDLG_EFFECTCOMBO));
01678                 BOOL GreyAmount = (Choice <= 9);
01679                 BOOL GreyCustom = (Choice != 0);
01680                 EnableGadget(_R(IDC_BFXDLG_CUSTOM1), !GreyCustom);
01681                 EnableGadget(_R(IDC_BFXDLG_CUSTOM2), !GreyCustom);
01682                 EnableGadget(_R(IDC_BFXDLG_CUSTOM3), !GreyCustom);
01683                 EnableGadget(_R(IDC_BFXDLG_CUSTOM4), !GreyCustom);
01684                 EnableGadget(_R(IDC_BFXDLG_CUSTOM5), !GreyCustom);
01685                 EnableGadget(_R(IDC_BFXDLG_CUSTOM6), !GreyCustom);
01686                 EnableGadget(_R(IDC_BFXDLG_CUSTOM7), !GreyCustom);
01687                 EnableGadget(_R(IDC_BFXDLG_CUSTOM8), !GreyCustom);
01688                 EnableGadget(_R(IDC_BFXDLG_CUSTOM9), !GreyCustom);
01689                 EnableGadget(_R(IDC_BFXDLG_AMOUNT), !GreyAmount);
01690                 EnableGadget(_R(IDC_BFXDLG_AMOUNTTXT), !GreyAmount);
01691             }
01692             
01693             if (Msg->DlgMsg == DIM_CREATE) break; else *pCommitValues = TRUE;
01694 
01695         case DIM_SOFT_COMMIT:
01696                 m_UseInitial = FALSE;
01697         case DIM_COMMIT:
01698             {
01699                 INT32 Choice = GetSelectedValueIndex(_R(IDC_BFXDLG_EFFECTCOMBO));
01700                 Matrix[0]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM1),-255.0,255.0);
01701                 Matrix[1]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM2),-255.0,255.0);
01702                 Matrix[2]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM3),-255.0,255.0);
01703                 Matrix[3]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM4),-255.0,255.0);
01704                 Matrix[4]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM5),-255.0,255.0);
01705                 Matrix[5]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM6),-255.0,255.0);
01706                 Matrix[6]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM7),-255.0,255.0);
01707                 Matrix[7]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM8),-255.0,255.0);
01708                 Matrix[8]=GetDoubleGadgetValue(_R(IDC_BFXDLG_CUSTOM9),-255.0,255.0);
01709 
01710                 switch (Choice)
01711                 {
01712                     case 0:
01713                     case 1:
01714                     case 2:
01715                     case 3:
01716                     case 4:
01717                     case 5:
01718                     case 6:
01719                     case 7:
01720                     case 8:
01721                     case 9:
01722                         SetEffect(CC_RUNTIME_CLASS(ABFXSpecialEffect));
01723                         SetParameters((INT32) Choice);
01724                         break;
01725                     case 10:
01726                         SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01727                         SetParameters(((INT32) 127-GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127)), 1);
01728                         break;
01729                     case 11:
01730                         SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01731                         SetParameters(((INT32) 127-GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127)), 2);
01732                         break;
01733                     case 12:
01734                         SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01735                         SetParameters(((INT32) 127-GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127)), 3);
01736                         break;
01737                     case 13:
01738                         SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01739                         SetParameters(((INT32) GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127))-127, 1);
01740                         break;
01741                     case 14:
01742                         SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01743                         SetParameters(((INT32) GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127))-127, 2);
01744                         break;
01745                     case 15:
01746                         SetEffect(CC_RUNTIME_CLASS(ABFXSharpenBlur));
01747                         SetParameters(((INT32) GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127))-127, 3);
01748                         break;
01749                     case 16:
01750                     case 17:
01751                     case 18:
01752                     case 19:
01753                         SetEffect(CC_RUNTIME_CLASS(ABFXRemoveDither));
01754                         SetParameters((127-((INT32) GetLongGadgetValue(_R(IDC_BFXDLG_AMOUNT),0,127)))<<1, 30, Choice-16);
01755                         break;
01756                 }                                           
01757             }
01758 
01759     }
01760 }
01761 
01762 /********************************************************************************************
01763 
01764 >   void BfxPlugInDlg::HandleSpecialEffectsMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01765 
01766     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01767     Created:    20/02/95
01768     Inputs:     Msg: The message sent from page 1 of the dialog
01769     Outputs:    -
01770     Returns:    -
01771     Purpose:    All messages generated from the tabbed dialog's page 1 get processed here
01772     Errors:     -
01773     Scope:      private
01774     SeeAlso:    BfxPlugInDlg::Message
01775 
01776 ********************************************************************************************/
01777 
01778 
01779 void BfxPlugInDlg::HandleAlchemistMsg(DialogMsg* Msg, BOOL *pCommitValues, BOOL *pEndDialog)
01780 {
01781     //TalkToPage(_R(IDD_BFXPLUGINDLG_PG6));  // The Coords Page identifier
01782     switch(Msg->DlgMsg)
01783     {
01784         case DIM_CREATE:
01785             {
01786                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_HUE_CHECK), TRUE); 
01787                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_SATURATION_CHECK), TRUE); 
01788                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_VALUE_CHECK), TRUE); 
01789                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_RAINBOW_CHECK), TRUE); 
01790                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_VARIATION_CHECK), TRUE); 
01791                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_SHAPES_CHECK), TRUE); 
01792                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_STYLE_CHECK), TRUE); 
01793                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_OPACITY_CHECK), TRUE); 
01794                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_GRAIN_CHECK), TRUE); 
01795 
01796                 SetGadgetRange    (_R(IDC_BFXDLG_ALC_HUE_SLIDER), 0, 127, 1);
01797                 SetGadgetBitmaps  (_R(IDC_BFXDLG_ALC_HUE_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01798                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_HUE_SLIDER), 64); 
01799                 SetGadgetRange    (_R(IDC_BFXDLG_ALC_SATURATION_SLIDER), 0, 127, 1);
01800                 SetGadgetBitmaps  (_R(IDC_BFXDLG_ALC_SATURATION_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01801                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_SATURATION_SLIDER), 64); 
01802                 SetGadgetRange    (_R(IDC_BFXDLG_ALC_VALUE_SLIDER), 0, 127, 1);
01803                 SetGadgetBitmaps  (_R(IDC_BFXDLG_ALC_VALUE_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01804                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_VALUE_SLIDER), 64); 
01805                 SetGadgetRange    (_R(IDC_BFXDLG_ALC_RAINBOW_SLIDER), 0, 127, 1);
01806                 SetGadgetBitmaps  (_R(IDC_BFXDLG_ALC_RAINBOW_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01807                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_RAINBOW_SLIDER), 64); 
01808                 SetGadgetRange    (_R(IDC_BFXDLG_ALC_VARIATION_SLIDER), 0, 127, 1);
01809                 SetGadgetBitmaps  (_R(IDC_BFXDLG_ALC_VARIATION_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01810                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_VARIATION_SLIDER), 64); 
01811                 SetGadgetRange    (_R(IDC_BFXDLG_ALC_SHAPES_SLIDER), 0, 127, 1);
01812                 SetGadgetBitmaps  (_R(IDC_BFXDLG_ALC_SHAPES_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01813                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_SHAPES_SLIDER), 64); 
01814                 SetGadgetRange    (_R(IDC_BFXDLG_ALC_STYLE_SLIDER), 0, 127, 1);
01815                 SetGadgetBitmaps  (_R(IDC_BFXDLG_ALC_STYLE_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01816                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_STYLE_SLIDER), 64); 
01817                 SetGadgetRange    (_R(IDC_BFXDLG_ALC_OPACITY_SLIDER), 0, 127, 1);
01818                 SetGadgetBitmaps  (_R(IDC_BFXDLG_ALC_OPACITY_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01819                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_OPACITY_SLIDER), 64); 
01820                 SetGadgetRange    (_R(IDC_BFXDLG_ALC_GRAIN_SLIDER), 0, 127, 1);
01821                 SetGadgetBitmaps  (_R(IDC_BFXDLG_ALC_GRAIN_SLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01822                 SetLongGadgetValue(_R(IDC_BFXDLG_ALC_GRAIN_SLIDER), 64); 
01823 
01824             }
01825             break; //RUN THROUGH
01826 
01827         case DIM_SLIDER_POS_SET:
01828         //case DIM_SLIDER_POS_CHANGING:
01829         case DIM_LFT_BN_CLICKED:
01830         case DIM_SELECTION_CHANGED:
01831         case DIM_TEXT_CHANGED:             // Text changed 
01832             {
01833                 SetDirty();
01834             }
01835 //          break;
01836             *pCommitValues = TRUE;
01837 
01838         case DIM_SOFT_COMMIT:
01839         case DIM_COMMIT:
01840             {
01841             }
01842             break;
01843 
01844     }
01845 }
01846 
01847 
01848 /********************************************************************************************
01849 
01850 >   OpState BfxPlugInDlg::GetState(String_256*, OpDescriptor*)
01851 
01852 
01853     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01854     Created:    20/02/95
01855     Inputs:     -
01856     Outputs:    -
01857     Returns:    -
01858     Purpose:    The standard GetState fn, does nothing
01859     Errors:     -
01860     SeeAlso:    -
01861 
01862 ********************************************************************************************/
01863 
01864 
01865 OpState BfxPlugInDlg::GetState(String_256*, OpDescriptor*)
01866 {    
01867     OpState OpSt;
01868     return(OpSt);
01869 }
01870          
01871 /********************************************************************************************
01872 
01873 >   BOOL BfxPlugInDlg::Init()
01874 
01875 
01876     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01877     Created:    20/02/95
01878     Inputs:     -
01879     Outputs:    -
01880     Returns:    -
01881     Purpose:    The standard Init fn for the op. 
01882     Errors:     -
01883     SeeAlso:    -
01884 
01885 ********************************************************************************************/
01886 
01887 
01888 BOOL BfxPlugInDlg::Init()
01889 {  
01890     GetApplication()->DeclareSection( "Bitmap Effects", 1);
01891     GetApplication()->DeclarePref( "Bitmap Effects", "Interactive Brightness & Contrast", &InteractiveBCC, FALSE, TRUE);
01892     
01893     BOOL ok = TRUE; 
01894     ok = ok && RegisterOpDescriptor(
01895                                     0,                         // Tool ID                    
01896                                     _R(IDS_BFXDLGM),               // String resource ID        
01897                                     CC_RUNTIME_CLASS(BfxBrightnessContrastDlg),  // Runtime class              
01898                                     OPTOKEN_BFXDLG_BRIGHTNESSCONTRAST,             // Token string               
01899                                     BfxPlugInDlg::GetState,     // GetState function          
01900                                     0,  /* help ID */           // Help ID                    
01901                                     NULL,                       // Bubble ID                  
01902                                     NULL,                       // Resource ID                
01903                                     NULL,                       // Control ID                 
01904                                     SYSTEMBAR_ILLEGAL,         // Bar ID                     
01905                                     TRUE,                      // Recieve system messages    
01906                                     FALSE,                     // Smart duplicate operation  
01907                                     TRUE,                      // Clean operation            
01908                                     0,                         // No vertical counterpart
01909                                     _R(IDS_BFXDLG_ONE),            // String for one copy only
01910                                     GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE
01911                                     );
01912     ok = ok && RegisterOpDescriptor(
01913                                     0,                         // Tool ID                    
01914                                     _R(IDS_BFXDLGM),               // String resource ID        
01915                                     CC_RUNTIME_CLASS(BfxSpecialEffectsDlg),  // Runtime class              
01916                                     OPTOKEN_BFXDLG_SPECIALEFFECTS,             // Token string               
01917                                     BfxPlugInDlg::GetState,     // GetState function          
01918                                     0,  /* help ID */           // Help ID                    
01919                                     NULL,                       // Bubble ID                  
01920                                     NULL,                       // Resource ID                
01921                                     NULL,                       // Control ID                 
01922                                     SYSTEMBAR_ILLEGAL,         // Bar ID                     
01923                                     TRUE,                      // Recieve system messages    
01924                                     FALSE,                     // Smart duplicate operation  
01925                                     TRUE,                      // Clean operation            
01926                                     0,                         // No vertical counterpart
01927                                     _R(IDS_BFXDLG_ONE),            // String for one copy only
01928                                     GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE
01929                                     );
01930     ok = ok && RegisterOpDescriptor(
01931                                     0,                         // Tool ID                    
01932                                     _R(IDS_BFXDLGM),               // String resource ID        
01933                                     CC_RUNTIME_CLASS(BfxResizeDlg),  // Runtime class              
01934                                     OPTOKEN_BFXDLG_RESIZE,         // Token string               
01935                                     BfxPlugInDlg::GetState,     // GetState function          
01936                                     0,  /* help ID */           // Help ID                    
01937                                     NULL,                       // Bubble ID                  
01938                                     NULL,                       // Resource ID                
01939                                     NULL,                       // Control ID                 
01940                                     SYSTEMBAR_ILLEGAL,         // Bar ID                     
01941                                     TRUE,                      // Recieve system messages    
01942                                     FALSE,                     // Smart duplicate operation  
01943                                     TRUE,                      // Clean operation            
01944                                     0,                         // No vertical counterpart
01945                                     _R(IDS_BFXDLG_ONE),            // String for one copy only
01946                                     GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE
01947                                     );
01948     ok = ok && RegisterOpDescriptor(
01949                                     0,                         // Tool ID                    
01950                                     _R(IDS_BFXDLGM),               // String resource ID        
01951                                     CC_RUNTIME_CLASS(BfxFlipAndRotateDlg),  // Runtime class              
01952                                     OPTOKEN_BFXDLG_FLIPROTATE,     // Token string               
01953                                     BfxPlugInDlg::GetState,     // GetState function          
01954                                     0,  /* help ID */           // Help ID                    
01955                                     NULL,                       // Bubble ID                  
01956                                     NULL,                       // Resource ID                
01957                                     NULL,                       // Control ID                 
01958                                     SYSTEMBAR_ILLEGAL,         // Bar ID                     
01959                                     TRUE,                      // Recieve system messages    
01960                                     FALSE,                     // Smart duplicate operation  
01961                                     TRUE,                      // Clean operation            
01962                                     0,                         // No vertical counterpart
01963                                     _R(IDS_BFXDLG_ONE),            // String for one copy only
01964                                     GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE
01965                                     );
01966     ok = ok && RegisterOpDescriptor(
01967                                     0,                         // Tool ID                    
01968                                     _R(IDS_BFXDLGM),               // String resource ID        
01969                                     CC_RUNTIME_CLASS(BfxColourDepthDlg),  // Runtime class              
01970                                     OPTOKEN_BFXDLG_COLOURDEPTH,            // Token string               
01971                                     BfxPlugInDlg::GetState,     // GetState function          
01972                                     0,  /* help ID */           // Help ID                    
01973                                     NULL,                       // Bubble ID                  
01974                                     NULL,                       // Resource ID                
01975                                     NULL,                       // Control ID                 
01976                                     SYSTEMBAR_ILLEGAL,         // Bar ID                     
01977                                     TRUE,                      // Recieve system messages    
01978                                     FALSE,                     // Smart duplicate operation  
01979                                     TRUE,                      // Clean operation            
01980                                     0,                         // No vertical counterpart
01981                                     _R(IDS_BFXDLG_ONE),            // String for one copy only
01982                                     GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE
01983                                     );
01984 
01985     ok = ok && BfxOp::Init();
01986 
01987     return ok;
01988 } 
01989 
01990 /********************************************************************************************
01991 
01992 >   void BfxPlugInDlg::Do(OpDescriptor*)
01993 
01994     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01995     Created:    20/02/95
01996     Inputs:     -
01997     Outputs:    -
01998     Returns:    -
01999     Purpose:    Like all Do functions invokes the BfxPlugInDlg
02000     Errors:     -
02001     SeeAlso:    -
02002 
02003 ********************************************************************************************/
02004 
02005 void BfxPlugInDlg::Do(OpDescriptor*)
02006 {
02007     //String_256 Title(_R(IDS_BFXDLG));
02008     //SetName(&Title); 
02009     BOOL ok = Create(); // Create the dialog please
02010     if (!ok)
02011     {
02012         /*InformError(blobby)*/;    // Display an error if this is a real dialog please
02013         OpenPage=0;
02014         End(); 
02015     }
02016 //  TalkToPage(0);
02017     //SetStringGadgetValue(_R(ID_APPLY_NOW), _R(IDS_BFXDLG_TEST));
02018     //SetStringGadgetValue(IDOK, _R(IDS_BFXDLG_INSERT));
02019     //SetStringGadgetValue(IDCANCEL, _R(IDS_BFXDLG_CLOSE));
02020 }
02021 
02022 /********************************************************************************************
02023 
02024 >   void BfxPlugInDlg::DoWithParam(OpDescriptor* pOp, OpParam* pParam)     
02025 
02026     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
02027     Created:    23/2/95
02028     Inputs:     OpDescriptor (unused)
02029     Outputs:    -
02030     Returns:    -
02031     Purpose:    Performs the BfxOp for the first time
02032     Errors:     -
02033     SeeAlso:    -
02034 
02035 The first parameter should be a kernel bitmap to use or null to just bring the dialog up
02036 
02037 ********************************************************************************************/
02038 
02039 void BfxPlugInDlg::DoWithParam(OpDescriptor* pOp, OpParam* pParam)
02040 {
02041     // remember the parameter so that we can return the ok/cancel to the caller
02042     m_pParam = pParam;
02043 
02044     KernelBitmap * pBitmap = NULL;
02045     if (pParam)
02046     {
02047         pBitmap = (KernelBitmap *)(void *)(pParam->Param1);
02048         m_pDocument = (Document*)(pParam->Param2);
02049     }
02050 
02051     if (pBitmap && pBitmap->IsKindOf(CC_RUNTIME_CLASS(KernelBitmap)))
02052     {
02053         // open and create the dialog box
02054         Do(pOp);
02055 
02056         OriginalChanged();
02057     }
02058 
02059     return;
02060 }
02061 

Generated on Sat Nov 10 03:44:20 2007 for Camelot by  doxygen 1.4.4