tracedlg.cpp

Go to the documentation of this file.
00001 // $Id: tracedlg.cpp 1334 2006-06-17 09:43:37Z 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 // A sdialog for testing trace things
00099 
00100 /*
00101 */
00102 
00103 #include "camtypes.h"
00104 #include "tracedlg.h"
00105 
00106 #include "tracectl.h"
00107 
00108 //#include "mario.h"
00109 //#include "reshlpid.h"
00110 //#include "tracerc.h"
00111 //#include "rik.h"
00112 //#include "andy.h"
00113 #include "menuops.h"
00114 
00115 #include "oilprog.h"
00116 
00117 #include "ccdc.h"       // specific #includes needed for kernel-rendered dialogues
00118 #include "dlgcol.h"
00119 //#include "fillval.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00120 #include "grnddib.h"
00121 
00122 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00123 //#include "range.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00124 #include "nodebmp.h"
00125 #include "bitmpinf.h"
00126 #include "chapter.h"
00127 //#include "spread.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00128 #include "page.h"
00129 #include "noderend.h"
00130 //#include "fillattr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00131 
00132 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00133 //#include "trans2d.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00134 //#include "monotime.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00135 #include "progress.h"
00136 //#include "resource.h"
00137 //#include "barsdlgs.h"         // for the tracer dialog bar control
00138 #include "bubbleid.h"
00139 
00140 //#include "will2.h"
00141 #include "bmpcomp.h"
00142 #include "wrkrect.h"    
00143 
00144 #include "mrhbits.h"
00145 #include "keypress.h"
00146 #include "fillattr2.h"
00147 
00148 // This is not compulsory, but you may as well put it in so that the correct version
00149 // of your file can be registered in the .exe
00150 DECLARE_SOURCE("$Revision: 1334 $");
00151 
00152 // An implement to match the Declare in the .h file.
00153 // If you have many classes, it is recommended to place them all together, here at the start of the file
00154 CC_IMPLEMENT_DYNAMIC(TraceMsg, Msg)
00155 CC_IMPLEMENT_DYNCREATE(TraceDlg, DialogOp)
00156 CC_IMPLEMENT_DYNCREATE(TraceOp, SelOperation)   
00157 CC_IMPLEMENT_MEMDUMP(TraceOpParam, OpParam)
00158 
00159 // This will get Camelot to display the filename and linenumber of any memory allocations
00160 // that are not released at program exit
00161 #define new CAM_DEBUG_NEW
00162 
00163 
00164 // Set the static vars of the render dialog
00165 const CDlgMode TraceDlg::Mode = MODELESS;
00166 const UINT32 TraceDlg::IDD = _R(IDD_TRACEDLG);
00167 
00168 // Order is
00169 //  Passes
00170 //  RemoveNoise
00171 //  Min area
00172 //  ICT
00173 //  FCT
00174 //  Accuracy
00175 //  Smooth
00176 
00177 #define TRACER_FACTORY_SETTINGS {\
00178             {1, 50, 25, 50, 50, 80, 15},/*mono*/ \
00179             {1, 50, 25, 50, 50, 50, 50},/*GS*/ \
00180             {1, 50, 25, 65, 65, 50, 50},/*256col*/ \
00181             {1, 50, 25, 25, 25, 50, 50} /*true col*/ \
00182             }
00183 
00184 INT32 TraceDlg::DefaultMode=(INT32)TRACEMETHOD_TRUECOL;
00185 INT32 TraceDlg::DefaultSetting[NUM_TRACEMETHOD][NUM_TRACESETTING] = TRACER_FACTORY_SETTINGS;
00186 INT32 TraceDlg::FactorySetting[NUM_TRACEMETHOD][NUM_TRACESETTING] = TRACER_FACTORY_SETTINGS;
00187 
00188 /*******************************************************************************************
00189 
00190 >   BOOL TraceDlg::OriginalChanged()
00191 
00192     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00193     Created:    14/12/94
00194     Inputs:     None
00195     Outputs:    None
00196     Returns:    TRUE if succeeded, FALSE & error set if not
00197     Purpose:    Invalidates area for original bitmap, marks no destination as yet
00198     Errors:     None at present
00199     SeeAlso:    -
00200 
00201 *******************************************************************************************/
00202 
00203 BOOL TraceDlg::OriginalChanged()
00204 {
00205     if (pPrevOriginal==pOriginal) return TRUE;
00206     pPrevOriginal=pOriginal;
00207     if (pTraceControl) pTraceControl->InitBitmap(pOriginal);
00208     InvalidateGadget(_R(IDC_TRACER_ORIGREDRAW));
00209     return FixOriginalComboBox() && SetStatus() && DestinationChanged();
00210 }
00211 
00212 /*******************************************************************************************
00213 
00214 >   BOOL TraceDlg::DestinationChanged()
00215 
00216     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00217     Created:    14/12/94
00218     Inputs:     None
00219     Outputs:    None
00220     Returns:    TRUE if succeeded, FALSE & error set if not
00221     Purpose:    Invalidates area for destination bitmap, marks no destination as yet
00222     Errors:     None at present
00223     SeeAlso:    -
00224 
00225 *******************************************************************************************/
00226 
00227 BOOL TraceDlg::DestinationChanged()
00228 {
00229     InvalidateGadget(_R(IDC_TRACER_DESTREDRAW));
00230     return TRUE;
00231 }
00232 
00233 
00234 /*******************************************************************************************
00235 
00236 >   TraceDlg::TraceDlg() : DialogOp(RenderDlg::IDD, RenderDlg::Mode) 
00237 
00238     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00239     Created:    14/12/94
00240     Purpose:    Constructs the trace dialog Dialog
00241 
00242 *******************************************************************************************/
00243 
00244 TraceDlg::TraceDlg() : DialogOp(TraceDlg::IDD, TraceDlg::Mode) 
00245 {
00246     // Set the 2 colours that we can toggle between
00247     pOriginal = NULL;
00248     pPrevOriginal=NULL;
00249     pTraceControl = new TraceControl; // NULL means tracer won't work...
00250 }       
00251 
00252 
00253 
00254 /*******************************************************************************************
00255 
00256 >   TraceDlg::~TraceDlg()
00257 
00258     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00259     Created:    14/12/94
00260     Purpose:    Destructor, does nothing
00261 
00262 *******************************************************************************************/
00263 
00264 TraceDlg::~TraceDlg()
00265 {
00266     pOriginal = NULL;
00267     
00268     if(!m_p24BitCopyNames.empty())
00269     {
00270         Remove24BitTempCopy();
00271     }
00272 
00273     if (pTraceControl)
00274     {
00275         pTraceControl->InitBitmap(pOriginal);
00276         delete pTraceControl;
00277         pTraceControl = NULL;
00278     }
00279 } 
00280 
00281 void TraceDlg::Remove24BitTempCopy()
00282 {
00283     // Get the selected Document
00284     Document * pDoc = Document::GetSelected();
00285 
00286     // Get the bitmap list
00287     BitmapList* Bitmaps = NULL;
00288     if (pDoc)
00289     {
00290         Bitmaps = pDoc->GetBitmapList();
00291     }
00292 
00293     // Get the first bitmap out of the bitmap list
00294     KernelBitmap * pBmp = (KernelBitmap *)(Bitmaps->GetHead());
00295     KernelBitmap * pTemp = NULL;
00296 
00297     BOOL DeleteThisBMP = FALSE;
00298 
00299     // If we`ve got a valid BMP then do some testing!
00300     while (pBmp != NULL)
00301     {
00302         // Get the first Copy Name from our list
00303         std::list< String_256 >::iterator Pos = m_p24BitCopyNames.begin();
00304 
00305         // While the Position and the BMP are both valid do the check!
00306         while(Pos != m_p24BitCopyNames.end() && pBmp != NULL)
00307         {
00308             // Check to see if the BMP`s name matches the one held in the copy list
00309             if (pBmp->GetName().CompareTo(*Pos) == 0)
00310             {
00311                 // Mark this BMP For deletion!
00312                 DeleteThisBMP = TRUE;
00313 
00314                 // Now break out of this while loop!
00315                 break;
00316             }
00317 
00318             // Get the next name from the copy name list
00319             Pos++;
00320         }
00321 
00322         // If this isn`t the one then get the next in the list!
00323         pTemp = (KernelBitmap *) Bitmaps->GetNext(pBmp);
00324 
00325         // If the flag has been set then delete it!
00326         if(DeleteThisBMP)
00327         {
00328             // Remove it, Detach it, delete it and then just for good measure NULL it!!!
00329             Bitmaps->RemoveItem(pBmp);
00330             pBmp->Detach();
00331             delete pBmp;
00332             pBmp = NULL;
00333 
00334             // Reset the Delete flag
00335             DeleteThisBMP = FALSE;
00336         }
00337 
00338         // Set the Current BMP with the Temp
00339         pBmp = pTemp;
00340     }
00341 
00342     // Finished with everything so make sure the list is totally empty!
00343     m_p24BitCopyNames.clear();
00344 }
00345 
00346 /*******************************************************************************************
00347 
00348 >   BOOL TraceDlg::CheckOriginalBitmap()
00349 
00350     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00351     Created:    14/12/94
00352     Inputs:     None
00353     Outputs:    pOriginal set
00354     Returns:    TRUE if succeeded, FALSE & error set if not
00355     Purpose:    Ensures pOriginal points to a valid bitmap in this document
00356     Errors:     None at present
00357     SeeAlso:    -
00358 
00359 
00360 *******************************************************************************************/
00361 
00362 BOOL TraceDlg::CheckOriginalBitmap()
00363 {
00364     Document * pDoc = Document::GetSelected();
00365 
00366     // Get the bitmap list
00367     BitmapList* Bitmaps = NULL;
00368     if (pDoc) Bitmaps = pDoc->GetBitmapList();
00369 
00370     if (Bitmaps == NULL)
00371     {
00372         pOriginal = NULL;
00373         return OriginalChanged();
00374     }
00375     
00376     KernelBitmap * pBmp = NULL;
00377 
00378     pBmp = (KernelBitmap *)(Bitmaps->GetHead());
00379 
00380     while (pBmp != NULL)
00381     {
00382         if (pBmp == pOriginal) return OriginalChanged(); // OK we've found it.
00383         pBmp = (KernelBitmap *) Bitmaps->GetNext(pBmp);
00384     }
00385 
00386     pOriginal = (KernelBitmap *)(Bitmaps->GetHead()); // possibly NULL but certainly on the list
00387     return OriginalChanged();
00388 }
00389 
00390 /*******************************************************************************************
00391 
00392 >   BOOL TraceDlg::FixOriginalComboBox()
00393 
00394     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00395     Created:    14/12/94
00396     Inputs:     None
00397     Outputs:    None
00398     Returns:    TRUE if succeeded, FALSE & error set if not
00399     Purpose:    Makes the combo box reflect the bitmaps within the document
00400     Errors:     None at present
00401     SeeAlso:    -
00402 
00403 This routine is heavilly copied from one within the fill tool
00404 
00405 *******************************************************************************************/
00406 
00407 BOOL TraceDlg::FixOriginalComboBox()
00408 {
00409     // Find the doccomponent with the list of bitmaps in it
00410     Document * pDoc = Document::GetSelected();
00411 
00412     // Get the bitmap list
00413     BitmapList* Bitmaps = NULL;
00414     if (pDoc) Bitmaps = pDoc->GetBitmapList();
00415 
00416     if (Bitmaps == NULL)
00417         return TRUE;
00418 
00419     String_256 Str;
00420 
00421     DeleteAllValues(_R(IDC_TRACER_BITMAP));
00422 
00423     BOOL DoneMain = FALSE;
00424     INT32 SelIndex = 0;
00425 
00426     BOOL IsMono = FALSE;
00427     if ((pOriginal) && (pOriginal->GetBPP()==1)) IsMono=TRUE;
00428 
00429     EnableGadget(_R(IDC_TRACER_BLURNUM), !IsMono);
00430     EnableGadget(_R(IDC_TRACER_BLURSLIDER), !IsMono);
00431     EnableGadget(_R(IDC_TRACER_BLURTXT), !IsMono);
00432 
00433     if (Bitmaps->GetCount() > 0)
00434     {
00435         INT32 Index = 0;
00436 
00437         ListItem* pBmp = Bitmaps->GetHead();
00438 
00439         while (pBmp != NULL)
00440         {
00441             Str = ((KernelBitmap*)pBmp)->ActualBitmap->GetName();
00442             if (((KernelBitmap*)(pBmp)) == pOriginal)
00443             {
00444                 SetStringGadgetValue(_R(IDC_TRACER_BITMAP),Str, FALSE, -1);
00445                 DoneMain = TRUE;
00446                 SelIndex=Index;
00447             }
00448             SetStringGadgetValue(_R(IDC_TRACER_BITMAP),Str,FALSE, Index++);
00449             pBmp = Bitmaps->GetNext(pBmp);
00450         }
00451     }
00452     else
00453     {
00454         Str.Load(_R(IDS_K_BFXDLG_DEFAULT));
00455         SetStringGadgetValue(_R(IDC_TRACER_BITMAP),Str,TRUE, 0);
00456     }
00457 
00458     Str.Load(_R(IDS_K_BFXDLG_DEFAULT));
00459     SetComboListLength(_R(IDC_TRACER_BITMAP));
00460     if (!DoneMain)
00461     {
00462         SetStringGadgetValue(_R(IDC_TRACER_BITMAP),Str, FALSE, -1);
00463         SetSelectedValueIndex(_R(IDC_TRACER_BITMAP), 0);
00464     }
00465     else
00466     {
00467         SetSelectedValueIndex(_R(IDC_TRACER_BITMAP), SelIndex);
00468     }
00469     return TRUE;
00470 }
00471 
00472 
00473 /*******************************************************************************************
00474 
00475 >   BOOL TraceDlg::ReadOriginalComboBox()
00476 
00477     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00478     Created:    14/12/94
00479     Inputs:     None
00480     Outputs:    None
00481     Returns:    TRUE if succeeded, FALSE & error set if not
00482     Purpose:    Chooses a different bitmap from the combo box
00483     Errors:     None at present
00484     SeeAlso:    -
00485 
00486 This routine is heavilly copied from one within the fill tool
00487 
00488 *******************************************************************************************/
00489 
00490 BOOL TraceDlg::ReadOriginalComboBox()
00491 {
00492     Document * pDoc = Document::GetSelected();
00493     
00494     // Get the bitmap list
00495     BitmapList* Bitmaps = NULL;
00496     if (pDoc) Bitmaps = pDoc->GetBitmapList();
00497 
00498     if (Bitmaps == NULL)
00499         return TRUE;
00500 
00501     ListItem* pBmp = Bitmaps->GetHead();
00502 
00503     WORD Index;
00504     GetValueIndex(_R(IDC_TRACER_BITMAP),&Index); 
00505 
00506     for (INT32 i = 0; i < Index; i++)
00507     {
00508         if (pBmp == NULL)
00509             break;
00510 
00511         pBmp = Bitmaps->GetNext(pBmp);
00512     }
00513 
00514     pOriginal = (KernelBitmap*)pBmp; // Might be NULL (conceivably)
00515     return CheckOriginalBitmap();
00516 }
00517 
00518 
00519 
00520 /*******************************************************************************************
00521 
00522 >   BOOL TraceDlg::SetStatus(BOOL Tracing=FALSE)
00523 
00524     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00525     Created:    14/12/94
00526     Inputs:     Tracing = TRUE if tracing
00527     Outputs:    None
00528     Returns:    TRUE if succeeded, FALSE & error set if not
00529     Purpose:    Makes status line reflect current status
00530     Errors:     None at present
00531     SeeAlso:    -
00532 
00533 *******************************************************************************************/
00534 
00535 BOOL TraceDlg::SetStatus(BOOL Tracing)
00536 {
00537     UINT32 theID = _R(IDS_TRACER_PROGRESSSTRING_BLANK);
00538     INT32 NumPaths=0;
00539     INT32 NumPoints=0;
00540     INT32 Percent=0;
00541     BOOL Done=FALSE;
00542     String_256 Temp;
00543     if (pTraceControl && pTraceControl->GetProgress(&Percent, &NumPaths, NULL, &NumPoints, &Done) && Percent)
00544     {
00545         if (Done)
00546         {
00547             theID = _R(IDS_TRACER_PROGRESSSTRING_DONE);
00548             Tracing=FALSE;
00549         }
00550         else
00551         {
00552             if (Tracing)
00553                 theID = _R(IDS_TRACER_PROGRESSSTRING_TRACING);
00554             else
00555                 theID = _R(IDS_TRACER_PROGRESSSTRING_ABORTED);
00556         }
00557     }
00558     Temp.MakeMsg(theID, NumPaths, NumPoints);
00559     SetStringGadgetValue(_R(IDC_TRACER_STATUSTEXT), Temp);
00560     EnableGadget(_R(IDOK), Done && (!Tracing));
00561     EnableGadget(_R(IDCANCEL), !Tracing);
00562     EnableGadget(_R(IDC_TRACER_TRACEBTN), !Tracing);
00563     EnableGadget(_R(IDC_TRACER_HELP), !Tracing);
00564     return TRUE;
00565 }
00566 
00567 /*******************************************************************************************
00568 
00569 >   BOOL TraceDlg::LoadSettings(INT32 * pSettings)
00570 
00571     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00572     Created:    14/12/94
00573     Inputs:     *pSettings points to area to load from
00574     Outputs:    None
00575     Returns:    TRUE if succeeded, FALSE & error set if not
00576     Purpose:    Sets up the sliders to a settings bank
00577     Errors:     None at present
00578     SeeAlso:    -
00579 
00580 *******************************************************************************************/
00581 BOOL TraceDlg::LoadSettings(INT32 * pSettings)
00582 {
00583     SetLongGadgetValue(_R(IDC_TRACER_PASSESNUM),        pSettings[0]);
00584     SetLongGadgetValue(_R(IDC_TRACER_BLURSLIDER),       pSettings[1]); 
00585     SetLongGadgetValue(_R(IDC_TRACER_MINAREASLIDER),    pSettings[2]); 
00586     SetLongGadgetValue(_R(IDC_TRACER_ICTSLIDER),        pSettings[3]); 
00587     SetLongGadgetValue(_R(IDC_TRACER_FCTSLIDER),        pSettings[4]); 
00588     SetLongGadgetValue(_R(IDC_TRACER_ACCURACYSLIDER),   pSettings[5]); 
00589     SetLongGadgetValue(_R(IDC_TRACER_SMOOTHSLIDER),     pSettings[6]); 
00590     return ReadParams();
00591 }
00592 
00593 /*******************************************************************************************
00594 
00595 >   BOOL TraceDlg::SaveSettings(INT32 * pSettings)
00596 
00597     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00598     Created:    14/12/94
00599     Inputs:     *pSettings points to area to save to
00600     Outputs:    None
00601     Returns:    TRUE if succeeded, FALSE & error set if not
00602     Purpose:    Sets up the sliders to a settings bank
00603     Errors:     None at present
00604     SeeAlso:    -
00605 
00606 *******************************************************************************************/
00607 BOOL TraceDlg::SaveSettings(INT32 * pSettings)
00608 {
00609     pSettings[0]=(INT32)GetLongGadgetValue(_R(IDC_TRACER_PASSESNUM)         ,0, 100, 0, NULL);
00610     pSettings[1]=(INT32)GetLongGadgetValue(_R(IDC_TRACER_BLURSLIDER)        ,0, 100, 0, NULL); 
00611     pSettings[2]=(INT32)GetLongGadgetValue(_R(IDC_TRACER_MINAREASLIDER) ,0, 100, 0, NULL); 
00612     pSettings[3]=(INT32)GetLongGadgetValue(_R(IDC_TRACER_ICTSLIDER)         ,0, 100, 0, NULL); 
00613     pSettings[4]=(INT32)GetLongGadgetValue(_R(IDC_TRACER_FCTSLIDER)         ,0, 100, 0, NULL); 
00614     pSettings[5]=(INT32)GetLongGadgetValue(_R(IDC_TRACER_ACCURACYSLIDER)    ,0, 100, 0, NULL); 
00615     pSettings[6]=(INT32)GetLongGadgetValue(_R(IDC_TRACER_SMOOTHSLIDER)  ,0, 100, 0, NULL); 
00616     return TRUE;
00617 }
00618 
00619 /*******************************************************************************************
00620 
00621 >   TraceMethod TraceDlg::GetTraceMethod()
00622 
00623     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00624     Created:    14/12/94
00625     Inputs:     None
00626     Outputs:    None
00627     Returns:    Currently selected trace method
00628     Purpose:    Sets up the sliders to a settings bank
00629     Errors:     None at present
00630     SeeAlso:    -
00631 
00632 *******************************************************************************************/
00633     
00634 TraceMethod TraceDlg::GetTraceMethod()
00635 {
00636     TraceMethod Method;
00637     switch (GetSelectedValueIndex(_R(IDC_TRACER_METHOD)))
00638     {
00639         case 0:
00640             Method=TRACEMETHOD_MONO;
00641             break;
00642         case 1:
00643             Method=TRACEMETHOD_GREYSCALE;
00644             break;
00645         case 2:
00646             Method=TRACEMETHOD_256COL;
00647             break;
00648         case 3:
00649         default:
00650             Method=TRACEMETHOD_TRUECOL;
00651             break;
00652     }
00653     return Method;
00654 }
00655 
00656 /*******************************************************************************************
00657 
00658 >   BOOL TraceDlg::SetTraceMethod(TraceMethod Method)
00659 
00660     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00661     Created:    14/12/94
00662     Inputs:     None
00663     Outputs:    None
00664     Returns:    TRUE on success else false for failure
00665     Purpose:    Sets the trace method
00666     Errors:     None at present
00667     SeeAlso:    -
00668 
00669 *******************************************************************************************/
00670     
00671 BOOL TraceDlg::SetTraceMethod(TraceMethod Method)
00672 {
00673     switch (Method)
00674     {
00675         case TRACEMETHOD_MONO:
00676             SetSelectedValueIndex(_R(IDC_TRACER_METHOD), 0);
00677             break;
00678         case TRACEMETHOD_GREYSCALE:
00679             SetSelectedValueIndex(_R(IDC_TRACER_METHOD), 1);
00680             break;
00681         case TRACEMETHOD_256COL:
00682             SetSelectedValueIndex(_R(IDC_TRACER_METHOD), 2);
00683             break;
00684         case TRACEMETHOD_TRUECOL:
00685         default:
00686             SetSelectedValueIndex(_R(IDC_TRACER_METHOD), 3);
00687             break;
00688     }
00689     return TRUE;
00690 }
00691 
00692 
00693 /*******************************************************************************************
00694 
00695 >   BOOL TraceDlg::ReadParams()
00696 
00697     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00698     Created:    14/12/94
00699     Purpose:    This is a temporary routine to put the values in the TraceCtl into the dialog
00700 
00701 *******************************************************************************************/
00702 
00703 BOOL TraceDlg::ReadParams()
00704 {
00705     SetLongGadgetValue(_R(IDC_TRACER_BLURNUM),    GetLongGadgetValue(_R(IDC_TRACER_BLURSLIDER), 0, 100, 0, NULL));
00706     SetLongGadgetValue(_R(IDC_TRACER_MINAREANUM), GetLongGadgetValue(_R(IDC_TRACER_MINAREASLIDER), 0, 100, 0, NULL));
00707     SetLongGadgetValue(_R(IDC_TRACER_ACCURACYNUM),GetLongGadgetValue(_R(IDC_TRACER_ACCURACYSLIDER), 0, 100, 0, NULL));
00708     SetLongGadgetValue(_R(IDC_TRACER_ICTNUM),     GetLongGadgetValue(_R(IDC_TRACER_ICTSLIDER), 0, 100, 0, NULL));
00709     SetLongGadgetValue(_R(IDC_TRACER_FCTNUM),     GetLongGadgetValue(_R(IDC_TRACER_FCTSLIDER), 0, 100, 0, NULL));
00710     SetLongGadgetValue(_R(IDC_TRACER_SMOOTHNUM),  GetLongGadgetValue(_R(IDC_TRACER_SMOOTHSLIDER), 0, 100, 0, NULL));
00711     TraceMethod Method=GetTraceMethod();
00712     BOOL Mono=(Method == TRACEMETHOD_MONO);
00713 //  BOOL Limited=(Method == TRACEMETHOD_GREYSCALE) || (Method==TRACEMETHOD_256COL);
00714     BOOL TrueCol=(Method == TRACEMETHOD_TRUECOL);
00715     INT32 Passes = GetLongGadgetValue  (_R(IDC_TRACER_PASSESNUM),   0, 100, 0, NULL);
00716     if (Method != TRACEMETHOD_TRUECOL) Passes=1;
00717     
00718     EnableGadget(_R(IDC_TRACER_FCTNUM), !Mono);
00719     EnableGadget(_R(IDC_TRACER_FCTSLIDER), !Mono);
00720     EnableGadget(_R(IDC_TRACER_FCTTXT), !Mono);
00721     
00722     EnableGadget(_R(IDC_TRACER_ICTNUM), Passes>1);
00723     EnableGadget(_R(IDC_TRACER_ICTSLIDER), Passes>1);
00724     EnableGadget(_R(IDC_TRACER_ICTTXT), Passes>1);
00725     
00726     EnableGadget(_R(IDC_TRACER_PASSESNUM), TrueCol);
00727     EnableGadget(_R(IDC_TRACER_PASSESTXT), TrueCol);
00728 
00729     return TRUE;
00730 }
00731 
00732 
00733 /*******************************************************************************************
00734 
00735 >   void TraceDlg::WriteParams()
00736 
00737     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00738     Created:    14/12/94
00739     Purpose:    This is a temporary routine to put the values in the dialog into the TraceCtl
00740 
00741 *******************************************************************************************/
00742 
00743 BOOL TraceDlg::WriteParams()
00744 {
00745     ERROR2IF((!pTraceControl), FALSE, "No TraceControl in WriteParams()");
00746     
00747     TraceMethod Method = TRACEMETHOD_TRUECOL;
00748     INT32 MinimumArea = 0;
00749     double MaximumInitialAreaErrorThreshold=0.0;
00750     double MinimumInitialAreaErrorThreshold=0.0;
00751     double InitialAreaErrorRatio=0.0;
00752     double MinGradFillError=0.0;
00753     double GradFillErrorRatio=0.0;
00754     double MinPixelError=0.0;
00755     double MaxPixelError=0.0;
00756     double PixelErrorRatio=0.0;
00757     double QuantColours=0.0;
00758     double Blur = 0.0;
00759     double Smooth=0.0;
00760 
00761     pTraceControl->GetParams(   &Method,
00762                                 &MinimumArea,
00763                                 &MaximumInitialAreaErrorThreshold,
00764                                 &MinimumInitialAreaErrorThreshold,
00765                                 &InitialAreaErrorRatio,
00766                                 &MinGradFillError,
00767                                 &GradFillErrorRatio,
00768                                 &MinPixelError,
00769                                 &MaxPixelError,
00770                                 &PixelErrorRatio,
00771                                 &QuantColours,
00772                                 &Blur,
00773                                 &Smooth
00774                                 );
00775 
00776 
00777     MinimumArea                         = GetLongGadgetValue  (_R(IDC_TRACER_MINAREASLIDER),    0, 100, 0, NULL);   
00778     MaximumInitialAreaErrorThreshold    = 0.01+0.003*(double)(GetLongGadgetValue(_R(IDC_TRACER_ICTSLIDER),      0, 100, 0, NULL));
00779     MinimumInitialAreaErrorThreshold    = 0.01+0.003*(double)(GetLongGadgetValue(_R(IDC_TRACER_FCTSLIDER),      0, 100, 0, NULL));
00780     MaxPixelError                       = 0.45+0.16*(double)(100-GetLongGadgetValue(_R(IDC_TRACER_ACCURACYSLIDER),      0, 100, 0, NULL)); // Inversion intentional
00781     MinPixelError = MaxPixelError;
00782     Blur                                = (double)(GetLongGadgetValue(_R(IDC_TRACER_BLURSLIDER),        0, 100, 0, NULL));
00783     Smooth                              = (double)(GetLongGadgetValue(_R(IDC_TRACER_SMOOTHSLIDER),      0, 100, 0, NULL));
00784     QuantColours                        = 0.01*(double)(GetLongGadgetValue(_R(IDC_TRACER_FCTSLIDER),    0, 100, 0, NULL)); // Inversion intentional
00785     
00786     if (QuantColours<0) QuantColours=0;
00787     QuantColours=QuantColours*QuantColours; // spread it out a little at the low end (i.e. high end on the slider)
00788 
00789     INT32 Passes = GetLongGadgetValue  (_R(IDC_TRACER_PASSESNUM),   0, 100, 0, NULL);
00790     Method = GetTraceMethod();
00791     if (Method != TRACEMETHOD_TRUECOL) Passes=1;
00792 
00793     if (Passes<1) Passes=1;
00794     if (Passes>5) Passes=5;
00795     if (MaximumInitialAreaErrorThreshold<MinimumInitialAreaErrorThreshold*1.05)
00796         MaximumInitialAreaErrorThreshold=MinimumInitialAreaErrorThreshold*1.05;
00797     if (Passes==1)
00798     {
00799         MaximumInitialAreaErrorThreshold=MinimumInitialAreaErrorThreshold;
00800         InitialAreaErrorRatio = 0.5;
00801     }
00802     else
00803     {
00804         InitialAreaErrorRatio = exp ((1.0/(double)(Passes-1))*(log(MinimumInitialAreaErrorThreshold)-log(MaximumInitialAreaErrorThreshold)));
00805     }
00806     MinimumInitialAreaErrorThreshold *= 1.000000001; // For rounding
00807 
00808 
00809     TRACEUSER( "Alex", _T("MinimumArea=%d, MaxIE=%f, MinIE=%f, IEAR=%f, MaxPE=%f, Passes=%d\n"),
00810                 MinimumArea,
00811                 MaximumInitialAreaErrorThreshold,
00812                 MinimumInitialAreaErrorThreshold,
00813                 InitialAreaErrorRatio,
00814                 MaxPixelError,
00815                 Passes);
00816 
00817     pTraceControl->SetParams(   &Method,
00818                                 &MinimumArea,
00819                                 &MaximumInitialAreaErrorThreshold,
00820                                 &MinimumInitialAreaErrorThreshold,
00821                                 &InitialAreaErrorRatio,
00822                                 &MinGradFillError,
00823                                 &GradFillErrorRatio,
00824                                 &MinPixelError,
00825                                 &MaxPixelError,
00826                                 &PixelErrorRatio,
00827                                 &QuantColours,
00828                                 &Blur,
00829                                 &Smooth
00830                                 );
00831 
00832     return TRUE;
00833 }
00834 
00835 
00836 
00837 /*******************************************************************************************
00838 
00839 >   BOOL TraceDlg::FindBitmap()
00840 
00841     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00842     Created:    14/12/94
00843     Inputs:     None
00844     Outputs:    pOriginal set
00845     Returns:    TRUE if succeeded, FALSE & error set if not
00846     Purpose:    Set pOriginal to point at a bitmap
00847     Errors:     None at present
00848     SeeAlso:    -
00849 
00850 One ought to call CheckOriginal after this call
00851 
00852 *******************************************************************************************/
00853 
00854 BOOL TraceDlg::FindBitmap()
00855 {
00856 //  pOriginal = NULL;
00857 
00858     Range Sel(*(GetApplication()->FindSelection()));
00859 
00860     Node* FirstSelectedNode = Sel.FindFirst(); 
00861     if (FirstSelectedNode != NULL) // No nodes selected so End
00862     {
00863         Node* CurrentNode = FirstSelectedNode;       
00864         Node* NextCurrent; 
00865         
00866         // Do all bitmaps. OK this should pick up the fill as well. Never mind
00867         while (CurrentNode != NULL)
00868         {
00869             NextCurrent = Sel.FindNext(CurrentNode);
00870             if  ( (CurrentNode->IsSelected()) && (CurrentNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeBitmap)) ) 
00871             {         
00872                 pOriginal = ((NodeBitmap *)(CurrentNode))->GetBitmap();
00873                 return CheckOriginalBitmap();
00874             }
00875             CurrentNode = NextCurrent; 
00876         }
00877 
00878     } 
00879 
00880     // Find the first Fill Attribute in the selection
00881     AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
00882 
00883     while (pAttrNode != NULL)
00884     {
00885         if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapColourFill)))
00886         {
00887             pOriginal = pAttrNode->GetBitmap();
00888             return CheckOriginalBitmap();
00889         }
00890 
00891         // Check the next fill
00892         pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
00893     }
00894 
00895     return CheckOriginalBitmap();
00896 }
00897 
00898 /*******************************************************************************************
00899 
00900 >   BOOL TraceDlg::DoTrace()
00901 
00902     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00903     Created:    31/1/95
00904     Purpose:    Temporary tracing routine
00905 
00906 *******************************************************************************************/
00907 
00908 BOOL TraceDlg::DoTrace(BOOL SingleStep)
00909 {
00910     if (pTraceControl && pOriginal)
00911     {
00912         WriteParams();
00913         KernelBitmap * pDestination;
00914         KernelBitmap * pTemp;
00915         pTraceControl->GetBitmaps(NULL, &pDestination, &pTemp);
00916         if ((!SingleStep) || (!pDestination) || (!pTemp))
00917             pTraceControl->InitBitmap(pOriginal);
00918 
00919         MonotonicTime MT;
00920 
00921         BOOL Done = FALSE;
00922         BOOL Abort = FALSE;
00923 
00924         String_64 ProcessMessage(_R(IDS_TRACEDLG_PREPROCESSING));
00925         BeginSlowJob(100, FALSE, &ProcessMessage);
00926         ContinueSlowJob();
00927 
00928         while ((!Done) && (!Abort))
00929         {
00930             Abort = !(pTraceControl->Trace(&Done));
00931             // invalidate the gadget with the picture in it
00932 
00933             if (!Abort)
00934             {
00935                 if ((Abort = (KeyPress::IsEscapePressed() ==TRUE) /*Assignment*/))
00936                 {
00937                     ERROR1RAW(_R(IDE_TRACER_ABORT));
00938                 }
00939             }
00940 
00941             if (Done || Abort || SingleStep || MT.Elapsed(1000, TRUE))
00942             {
00943                 InvalidateGadget(_R(IDC_TRACER_DESTREDRAW));
00944                 PaintGadgetNow(_R(IDC_TRACER_DESTREDRAW));
00945 
00946                 INT32 Percent;
00947                 INT32 NumPaths;
00948                 INT32 NumCusps;
00949                 INT32 NumPoints;
00950 
00951                 if ((pTraceControl->GetProgress(&Percent, &NumPaths, &NumCusps, &NumPoints))&& !Abort)
00952                 {
00953                     Abort = !ContinueSlowJob(Percent);
00954                     if (Abort) ERROR1RAW(_R(IDE_TRACER_ABORT));
00955                 }
00956                 SetStatus(TRUE);
00957                 //if (Done) TRACEUSER( "Alex", _T("**Done - %d Paths, %d Cusps, %d Points\n"), NumPaths, NumCusps, NumPoints);
00958 
00959             }
00960 
00961             if (SingleStep)
00962             {
00963                 EndSlowJob();
00964                 SetStatus();
00965                 return !Abort;
00966             }
00967 
00968         }
00969         EndSlowJob();
00970         SetStatus();
00971         return (!Abort);
00972     }
00973     return SetStatus();
00974 }
00975 
00976 /********************************************************************************************
00977 
00978 >   BOOL TraceDlg::RenderBitmap(ReDrawInfoType* ExtraInfo, KernelBitmap * BitmapToUse)
00979 
00980     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00981     Created:    20/02/95
00982     Inputs:     ExtraInfo - The structure that has the extra data we need to start rendering
00983                 BitmapToUse - The bitmap to render
00984     Outputs:    None
00985     Returns:    TRUE if succeeded, FALSE & error set if not
00986     Purpose:    Fills a renderable control with a bitmap
00987     Errors:     None at present
00988     SeeAlso:    -
00989 
00990 ********************************************************************************************/
00991 
00992 BOOL TraceDlg::RenderBitmap(ReDrawInfoType* ExtraInfo, KernelBitmap * BitmapToUse)
00993 {
00994     // Go get a render region
00995     DocRect VirtualSize(0, 0, ExtraInfo->dx, ExtraInfo->dy);
00996     RenderRegion* pRender = CreateGRenderRegion(&VirtualSize, ExtraInfo);
00997     if (pRender!=NULL)
00998     {
00999         DialogColourInfo RedrawColours;     // Get a supplier for default dlg colours
01000 
01001         // A Grey colour [...hmmm, it's not a very grey grey any more... oragnge more like]
01002         DocColour Grey(255,200,0);
01003 
01004         // Render the attributes and the a rectangle
01005         pRender->SaveContext();
01006         pRender->SetLineColour(COLOUR_TRANS);
01007 
01008             // Draw a rectangle to fill in the background - Fill with Dialogue Background colour
01009         pRender->SetFillColour(RedrawColours.DialogBack());
01010         pRender->DrawRect(&VirtualSize);
01011     
01012         if (BitmapToUse)
01013         {
01014 
01015             NodeBitmap NB;
01016             NodeBitmap * pNodeBitmap = &NB;
01017         
01018             if (!((pNodeBitmap == NULL) || (!pNodeBitmap->SetUpPath(12,12))))
01019             {
01020                 // Get a new bitmap object for this node.
01021                 pNodeBitmap->GetBitmapRef()->SetBitmap(BitmapToUse);
01022                         
01023                 ENSURE(pNodeBitmap->GetBitmap()->ActualBitmap != NULL, "No bitmap object found!");
01024         
01025                 DocRect BitmapSize(VirtualSize);
01026                 BitmapInfo BMInfo;
01027                 BitmapToUse->ActualBitmap->GetInfo(&BMInfo);
01028                 if (BMInfo.PixelWidth==0) BMInfo.PixelWidth=1;
01029                 if (BMInfo.PixelHeight==0) BMInfo.PixelHeight=1;
01030 
01031                 double BMAspect = ((double)(BMInfo.PixelWidth))/((double)(BMInfo.PixelHeight));
01032                 double RedrawAspect = ((double)(ExtraInfo->dx))/((double)(ExtraInfo->dy));
01033 
01034                 if (BMAspect>RedrawAspect)
01035                 {
01036                     // grey at top and bottom
01037                     INT32 NewHeight = (INT32)( 0.5 + ((double)(VirtualSize.Width()))/BMAspect);
01038                     if (NewHeight<1) NewHeight = 1;
01039                     BitmapSize.lo.y = (VirtualSize.Height()-NewHeight)/2;
01040                     BitmapSize.hi.y = BitmapSize.lo.y + NewHeight;
01041                 }
01042                 else
01043                 {
01044                     // grey on left and right
01045                     INT32 NewWidth = (INT32)( 0.5 + ((double)(VirtualSize.Height()))*BMAspect);
01046                     if (NewWidth<1) NewWidth = 1;
01047                     BitmapSize.lo.x = (VirtualSize.Width()-NewWidth)/2;
01048                     BitmapSize.hi.x = BitmapSize.lo.x + NewWidth;
01049                 }
01050 
01051                 // And set this in our bitmap node
01052                 pNodeBitmap->CreateShape(BitmapSize);
01053                     
01054                 pNodeBitmap->Render(pRender);
01055             }
01056         }
01057 
01058         pRender->RestoreContext();
01059 
01060         // Get rid of the render region
01061         DestroyGRenderRegion(pRender);
01062     }
01063     return TRUE;
01064 }
01065 
01066 
01067 /********************************************************************************************
01068 >   MsgResult TraceDlg::Message( Msg* Message)
01069 
01070     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01071     Created:    20/02/95
01072     Inputs:     Message: The message 
01073 
01074     
01075     Returns:    OK            Message handled ok (return this even if you don't need to 
01076                               respond to the message). 
01077 
01078                 FAIL          Something terrible happened whilst processing the message
01079                               eg. we ran out of memory. You must set ERROR if you
01080                               are returning this value. 
01081 
01082                 EAT_MSG       The Message was handled ok but don't send it to any
01083                               more MessageHandlers. 
01084 
01085     Purpose:    This is the message handler for the TraceDlg
01086      
01087 ********************************************************************************************/
01088 
01089 
01090 MsgResult TraceDlg::Message( Msg* Message)
01091 {
01092     static INT32 OurMessage = 0;
01093     if (IS_OUR_DIALOG_MSG(Message))
01094     {
01095         DialogMsg* Msg = ((DialogMsg*) Message); 
01096         
01097         BOOL EndDialog = FALSE;     // TRUE if we should quit the dialog
01098         BOOL CommitValues = FALSE;  // TRUE if we should commit the dialog values
01099 
01100         switch (Msg->DlgMsg)
01101         {
01102             case DIM_CREATE:
01103             {
01104 
01105                 SetGadgetRange    (_R(IDC_TRACER_BLURSLIDER), 0, 100, 1);
01106                 SetGadgetBitmaps  (_R(IDC_TRACER_BLURSLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01107 //              SetLongGadgetValue(_R(IDC_TRACER_BLURSLIDER), 50); 
01108 
01109                 SetGadgetRange    (_R(IDC_TRACER_ACCURACYSLIDER), 0, 100, 1);
01110                 SetGadgetBitmaps  (_R(IDC_TRACER_ACCURACYSLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01111 //              SetLongGadgetValue(_R(IDC_TRACER_ACCURACYSLIDER), 50); 
01112 
01113                 SetGadgetRange    (_R(IDC_TRACER_MINAREASLIDER), 0, 50, 1);
01114                 SetGadgetBitmaps  (_R(IDC_TRACER_MINAREASLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01115 //              SetLongGadgetValue(_R(IDC_TRACER_MINAREASLIDER), 25); 
01116 
01117                 SetGadgetRange    (_R(IDC_TRACER_ICTSLIDER), 0, 100, 1);
01118                 SetGadgetBitmaps  (_R(IDC_TRACER_ICTSLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01119 //              SetLongGadgetValue(_R(IDC_TRACER_ICTSLIDER), 35); 
01120 
01121                 SetGadgetRange    (_R(IDC_TRACER_FCTSLIDER), 0, 100, 1);
01122                 SetGadgetBitmaps  (_R(IDC_TRACER_FCTSLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01123 //              SetLongGadgetValue(_R(IDC_TRACER_FCTSLIDER), 25); 
01124 
01125                 SetGadgetRange    (_R(IDC_TRACER_SMOOTHSLIDER), 0, 100, 1);
01126                 SetGadgetBitmaps  (_R(IDC_TRACER_SMOOTHSLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
01127 //              SetLongGadgetValue(_R(IDC_TRACER_SMOOTHSLIDER), 50); 
01128 
01129 //              SetLongGadgetValue(_R(IDC_TRACER_PASSESNUM), 1);
01130 
01131                 pOriginal=NULL;
01132                 pPrevOriginal=NULL;
01133                 OurMessage=0;
01134                 FindBitmap();
01135 
01136                 DeleteAllValues(_R(IDC_TRACER_METHOD));
01137 
01138                 String_256 Str0(_R(IDS_TRACER_MONOCHROME));
01139                 String_256 Str1(_R(IDS_TRACER_GREYSCALE));
01140                 String_256 Str2(_R(IDS_TRACER_256COL));
01141                 String_256 Str3(_R(IDS_TRACER_TRUECOL));
01142             
01143                 SetStringGadgetValue(_R(IDC_TRACER_METHOD),Str0,FALSE, 0);
01144                 SetStringGadgetValue(_R(IDC_TRACER_METHOD),Str1,FALSE, 1);
01145                 SetStringGadgetValue(_R(IDC_TRACER_METHOD),Str2,FALSE, 2);
01146                 SetStringGadgetValue(_R(IDC_TRACER_METHOD),Str3,FALSE, 3);
01147             
01148 //              SetStringGadgetValue(_R(IDC_TRACER_METHOD),&Str3, FALSE, -1);
01149                 SetComboListLength(_R(IDC_TRACER_METHOD));
01150                 SetTraceMethod((TraceMethod)DefaultMode);
01151                 DefaultSetting[TRACEMETHOD_MONO][0]=1; // ensure this one pass
01152                 DefaultSetting[TRACEMETHOD_256COL][0]=1; // ensure this one pass
01153                 DefaultSetting[TRACEMETHOD_GREYSCALE][0]=1; // ensure this one pass
01154                 LoadSettings(DefaultSetting[(INT32)DefaultMode]);
01155 
01156 //              ReadParams();
01157                 WriteParams();
01158 //              SetStatus();
01159 //              FixOriginalComboBox();
01160                 break;
01161             }
01162             
01163             case DIM_SLIDER_POS_CHANGING:
01164             case DIM_SLIDER_POS_IDLE:
01165             case DIM_SLIDER_POS_SET:    
01166                 {
01167                     INT32 Passes = GetLongGadgetValue  (_R(IDC_TRACER_PASSESNUM),   0, 100, 0, NULL);
01168                     if (GetTraceMethod() != TRACEMETHOD_TRUECOL) Passes=1;
01169                     
01170                     if (!OurMessage && (Msg->GadgetID == _R(IDC_TRACER_ICTSLIDER) || Msg->GadgetID == _R(IDC_TRACER_FCTSLIDER)))
01171                     {
01172                         // We must fix sliders
01173                         INT32 CurrentInit = GetLongGadgetValue  (_R(IDC_TRACER_ICTSLIDER),  0, 100, 0, NULL);
01174                         INT32 CurrentFinal = GetLongGadgetValue  (_R(IDC_TRACER_FCTSLIDER), 0, 100, 0, NULL);
01175 
01176                         OurMessage++;
01177 
01178                         if (Msg->GadgetID == _R(IDC_TRACER_FCTSLIDER))
01179                         {
01180                             if (Passes<=1)
01181                             {
01182                                 SetLongGadgetValue(_R(IDC_TRACER_ICTSLIDER), CurrentFinal);
01183                             }
01184                             else if (CurrentInit<=CurrentFinal)
01185                             {
01186                                 SetLongGadgetValue(_R(IDC_TRACER_ICTSLIDER), ((CurrentFinal>=100)?100:CurrentFinal+1));
01187                             }
01188                         }
01189                         else
01190                         {
01191                             if (Passes<=1)
01192                             {
01193                                 SetLongGadgetValue(_R(IDC_TRACER_FCTSLIDER), CurrentInit);
01194                             }
01195                             else if (CurrentInit<=CurrentFinal)
01196                             {
01197                                 SetLongGadgetValue(_R(IDC_TRACER_FCTSLIDER), ((CurrentInit<=0)?0:CurrentInit-1));
01198                             }
01199                         }
01200 
01201                         OurMessage--;
01202                     }
01203                     ReadParams();
01204                 }
01205                 break;
01206 
01207             case DIM_TEXT_CHANGED:  // Text changed 
01208                 if (Msg->GadgetID == _R(IDC_TRACER_PASSESNUM)) ReadParams();
01209                 break;
01210 
01211             case DIM_COMMIT:        // Want to commit and quit
01212                 EndDialog = TRUE;
01213                 CommitValues = TRUE; 
01214                 break;
01215 
01216             case DIM_SOFT_COMMIT:   // Want to commit
01217                 CommitValues = TRUE; 
01218                 break; 
01219 
01220             case DIM_CANCEL:        // Want to quit
01221                 EndDialog = TRUE;
01222                 break;
01223 
01224             case DIM_LFT_BN_CLICKED :
01225             {
01226                 TraceMethod Method = GetTraceMethod();
01227                 // See which button was pressed
01228                 if (Msg->GadgetID == _R(IDC_TRACER_TRACEBTN))
01229                 {
01230                     if (!DoTrace(FALSE)) InformError();
01231                 }
01232                 else if (Msg->GadgetID == _R(IDC_TRACER_RESET))
01233                 {
01234                     LoadSettings(DefaultSetting[(INT32)Method]);
01235                 }
01236                 else if (Msg->GadgetID == _R(IDC_TRACER_SAVE))
01237                 {
01238                     DefaultMode=Method;
01239                     SaveSettings(DefaultSetting[(INT32)Method]);
01240                 }
01241                 else if (Msg->GadgetID == _R(IDC_TRACER_DEFAULT))
01242                 {
01243                     LoadSettings(FactorySetting[(INT32)Method]);
01244                 }
01245                 break;
01246             }
01247 
01248             case DIM_REDRAW :
01249             {
01250                 // This is where all the redrawing is done
01251                 // Which control in the window is sending the redraw message (if there are many
01252                 // grdraw controls you can tell which is which from the Gadget ID
01253                 KernelBitmap * pDestination;
01254                 KernelBitmap * pTemp;
01255                 pTraceControl->GetBitmaps(NULL, &pDestination, &pTemp);
01256 
01257                 // Draw the redraw_me control in here
01258                 if (Msg->GadgetID == _R(IDC_TRACER_ORIGREDRAW))
01259                 {
01260                     RenderBitmap((ReDrawInfoType*) Msg->DlgMsgParam, pOriginal);
01261                 }
01262                 else if (Msg->GadgetID == _R(IDC_TRACER_DESTREDRAW))
01263                 {
01264                     RenderBitmap((ReDrawInfoType*) Msg->DlgMsgParam, pDestination);
01265                 }
01266                 break;
01267             }
01268             
01269             case DIM_SELECTION_CHANGED:
01270             {
01271                 if (Msg->GadgetID == _R(IDC_TRACER_BITMAP))
01272                 {
01273                     ReadOriginalComboBox();
01274                 }
01275                 else if (Msg->GadgetID == _R(IDC_TRACER_METHOD))
01276                 {
01277                     LoadSettings(DefaultSetting[(INT32)GetTraceMethod()]);
01278                 }
01279                 break;                                                 
01280             }
01281 
01282             default:
01283                 break;
01284         }
01285 
01286         // End dialog here
01287         if (EndDialog)  // Dialog communication over 
01288         {   
01289             if (pTraceControl)
01290             {
01291                 BOOL Done;
01292                 pTraceControl->GetProgress(NULL,NULL,NULL,NULL,&Done);
01293                 if (CommitValues && pOriginal && Done)
01294                 {
01295                     TraceOpParam param;
01296                     param.pTraceControl = pTraceControl;
01297         
01298                     OpDescriptor* pOpDesc=OpDescriptor::FindOpDescriptor(_T("TraceOp"));
01299                     ERROR3IF_PF(pOpDesc==NULL,("Couldn't find OPTOKEN_OPTRACEOP op descriptor"));
01300                     pOpDesc->Invoke((OpParam*)&param);
01301                 }
01302 
01303                 pTraceControl->InitBitmap(NULL);
01304                 pOriginal = NULL;
01305                 pTraceControl->RemoveTree(TRUE /* delete it*/);
01306             }
01307 
01308             Close();           
01309             TRACEUSER( "Alex", _T("Calling End()\n"));
01310             End();      // End of dialog 
01311 
01312             return OK;
01313         }
01314         //return (DLG_EAT_IF_HUNGRY(Msg));   // I return EAT_MSG unless the message needs to be sent to all dialogs 
01315     } else if (MESSAGE_IS_A(Message, SelChangingMsg))       // Selection changed - use new bitmap
01316     {
01317         SelChangingMsg *Msg = (SelChangingMsg *) Message;
01318         switch ( Msg->State )
01319         {
01320             case SelChangingMsg::SELECTIONCHANGED:
01321             case SelChangingMsg::NODECHANGED:
01322 //              pOriginal=NULL;
01323                 FindBitmap();
01324                 break;
01325             default:
01326                 break;
01327         }
01328     } else if (MESSAGE_IS_A(Message, BitmapListChangedMsg))     // Selection changed - use new bitmap
01329     {
01330         CheckOriginalBitmap();
01331         FixOriginalComboBox();
01332     } else if (MESSAGE_IS_A(Message, TraceMsg))
01333     {
01334         pOriginal=((TraceMsg*)(Message))->pBitmap;
01335         CheckOriginalBitmap();
01336     }
01337 
01338     return DialogOp::Message(Message);
01339 } 
01340 
01341 /*******************************************************************************************
01342 
01343 >   OpState TraceDlg::GetState(String_256*, OpDescriptor*)
01344 
01345     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01346     Created:    14/12/94
01347     Purpose:    Returns the OpState of the dialogue operation
01348 
01349 *******************************************************************************************/
01350 
01351 OpState TraceDlg::GetState(String_256*, OpDescriptor*)
01352 {
01353     return OpState(FALSE, FALSE);
01354 }
01355 
01356          
01357 
01358 /*******************************************************************************************
01359 
01360 >   BOOL TraceDlg::Init()
01361 
01362     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01363     Created:    14/12/94
01364     Returns:    FALSE if it fails (due to lack of memory)
01365     Purpose:    Creates an OpDescriptor for a Trace Dialog
01366 
01367 *******************************************************************************************/
01368 BOOL TraceDlg::Init()
01369 {  
01370     INT32 Mode;
01371     INT32 Setting;
01372     GetApplication()->DeclareSection( _T("Tracer"), 40);
01373     GetApplication()->DeclarePref( _T("Tracer"), _T("DefaultMode"), &DefaultMode, 0, ((INT32)TRACEMETHOD_ILLEGAL)-1);
01374     String_256 PrefName;
01375     String_256 PrefBase(_T("Tracer mode #1%d setting #2%d")); // not resourced as .ini file setting
01376     
01377     for (Mode=0; Mode<(INT32)NUM_TRACEMETHOD; Mode++) for (Setting=0; Setting<(INT32)NUM_TRACESETTING; Setting++)
01378     {
01379         PrefName._MakeMsg(PrefBase, Mode, Setting);
01380         GetApplication()->DeclarePref( _T("Tracer"), PrefName, &(DefaultSetting[Mode][Setting]), 0, 100);
01381     }
01382 
01383     return (RegisterOpDescriptor(0,                             // Tool ID
01384                                 _R(IDS_TRACEDLG),                   // String resouirce ID
01385                                 CC_RUNTIME_CLASS(TraceDlg),     // Runtime class
01386                                 OPTOKEN_TRACEDLG,               // Token string
01387                                 TraceDlg::GetState,             // GetState function
01388                                 0,                              // Help ID
01389                                 _R(IDBBL_BITMAPTRACER),             // Bubble ID
01390                                 _R(IDD_BARCONTROLSTORE),            // Resource ID
01391                                 _R(IDC_BITMAPTRACER),               // Control ID
01392                                 SYSTEMBAR_UTILITIES,            // Bar ID
01393                                 TRUE,                           // Recieve system messages
01394                                 FALSE,                          // Smart duplicate operation
01395                                 TRUE,                           // Clean operation
01396                                 0,                              // No vertical counterpart
01397                                 _R(IDS_TRACER_ONE),
01398                                 GREY_WHEN_NO_CURRENT_DOC | DONT_GREY_WHEN_SELECT_INSIDE)    // String for one copy only
01399         && TraceOp::Init()); // HORRIBLE! But means I don't have to get a lock on main.cpp
01400 }   
01401  
01402 
01403          
01404 
01405 /*******************************************************************************************
01406 
01407 >   void TraceDlg::Do(OpDescriptor*)
01408 
01409     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01410     Created:    14/12/94
01411     Purpose:    Creates and shows a Render Demo dialog
01412 
01413 *******************************************************************************************/
01414 void TraceDlg::Do(OpDescriptor*)
01415 {
01416     // if we can create the dialog, then open it
01417     if (Create())
01418         Open();
01419     else
01420         TRACE( _T("Failed to create Render Demo Dialog\n"));
01421 }
01422 
01423 /********************************************************************************************
01424 
01425 >   void TraceDlg::DoWithParam(OpDescriptor* pOp, OpParam* pParam)     
01426 
01427     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01428     Created:    23/2/95
01429     Inputs:     OpDescriptor (unused)
01430     Outputs:    -
01431     Returns:    -
01432     Purpose:    Performs the BfxOp for the first time
01433     Errors:     -
01434     SeeAlso:    -
01435 
01436 The first parameter should be a kernel bitmap to use or null to just bring the dialog up
01437 
01438 ********************************************************************************************/
01439 
01440 void TraceDlg::DoWithParam(OpDescriptor* pOp, OpParam* pParam)
01441 {
01442     Do(pOp);
01443     KernelBitmap * pBitmap = NULL;
01444     if (pParam) pBitmap = (KernelBitmap *)(void *)(pParam->Param1);
01445     if (pBitmap && pBitmap->IsKindOf(CC_RUNTIME_CLASS(KernelBitmap)))
01446     {
01447         pOriginal=pBitmap;
01448         OriginalChanged();
01449     }
01450     return;
01451 }
01452 
01453 
01454 /********************************************************************************************
01455 
01456 >   TraceOp::TraceOp() 
01457 
01458     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01459     Created:    23/2/95
01460     Inputs:     -
01461     Outputs:    -
01462     Returns:    -
01463     Purpose:    TraceOp constructor
01464     Errors:     -
01465     SeeAlso:    -
01466 
01467 ********************************************************************************************/
01468 
01469 TraceOp::TraceOp(): SelOperation()  
01470 {                                
01471 }
01472    
01473 /********************************************************************************************
01474 
01475 >   BOOL TraceOp::Init()
01476 
01477     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01478     Created:    23/2/95
01479     Inputs:     -
01480     Outputs:    -
01481     Returns:    TRUE if the operation could be successfully initialised 
01482                 FALSE if no more memory could be allocated 
01483                 
01484     Purpose:    BlobyOp initialiser method
01485     Errors:     ERROR will be called if there was insufficient memory to allocate the 
01486                 operation.
01487     SeeAlso:    -
01488 
01489 ********************************************************************************************/
01490 
01491 BOOL TraceOp::Init()
01492 {  
01493     return (SelOperation::RegisterOpDescriptor(
01494                                             0,
01495                                             _R(IDS_TRACEOP),
01496                                             CC_RUNTIME_CLASS(TraceOp),
01497                                             OPTOKEN_TRACEOP,
01498                                             TraceOp::GetState,
01499                                             0,  /* help ID */
01500                                             0,  /* bubble help ID */
01501                                             0   /* bitmap ID */)); 
01502 }
01503 
01504 /********************************************************************************************
01505 
01506 >   OpState TraceOp::GetState(String_256*, OpDescriptor*)
01507 
01508     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01509     Created:    23/2/95
01510     Inputs:     -
01511     Outputs:    -
01512     Returns:    The state of the TraceOp
01513     Purpose:    For finding the TraceOp's state. 
01514     Errors:     -
01515     SeeAlso:    -
01516 
01517 ********************************************************************************************/
01518 
01519 OpState TraceOp::GetState(String_256*, OpDescriptor*)
01520 {    
01521     OpState OpSt;
01522     return(OpSt);
01523 }
01524         
01525 /********************************************************************************************
01526 
01527 >   void TraceOp::DoWithParam(OpDescriptor* pOp, OpParam* pParam)      
01528 
01529     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01530     Created:    23/2/95
01531     Inputs:     OpDescriptor (unused)
01532     Outputs:    -
01533     Returns:    -
01534     Purpose:    Performs the TraceOp for the first time
01535     Errors:     -
01536     SeeAlso:    -
01537 
01538 Blatantly copied from BitFilt::DoImportBitmap
01539 
01540 ********************************************************************************************/
01541 
01542 void TraceOp::DoWithParam(OpDescriptor* pOp, OpParam* pParam)
01543 {               
01544     DocCoord DropPos;
01545     Spread * pSpread;
01546     
01547     if (!GetWorkingDoc()) return;
01548     
01549     if (!FindCentreInsertionPosition(&pSpread, &DropPos))
01550     {
01551         InformError();
01552         FailAndExecute();
01553         End();
01554         return;
01555     }
01556     
01557     // Put up a progress display/hourglass (FALSE => no delay, show it NOW!)
01558     BeginSlowJob(100, FALSE);
01559     TraceControl * pTraceControl = (((TraceOpParam *)(pParam))->pTraceControl);
01560     if (!pTraceControl) return; // we've done.
01561 
01562     KernelBitmap * pKB = NULL;
01563     Node * pXNode = pTraceControl->GetPaths();
01564     if (!pXNode || !pXNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableBounded))) return; // nothing to trace
01565     NodeRenderableBounded *pNodeRenderableBounded = (NodeRenderableBounded *)pXNode;
01566 
01567     if (!pTraceControl->GetBitmaps(&pKB, NULL, NULL)) 
01568     {
01569         InformError();      
01570         FailAndExecute();
01571         End();
01572         return;
01573     }
01574     
01575     if (!pKB)
01576     {
01577         ERROR2RAW("Where did that DropPos go then?");
01578         InformError();      
01579         FailAndExecute();
01580         End();
01581         return;
01582     }
01583 
01584     // First, set the rectangle to the right size for the bitmap...
01585     BitmapInfo BMInfo;
01586     pKB->ActualBitmap->GetInfo(&BMInfo);
01587 
01588     DocRect BoundsRect;
01589     BoundsRect.lo.x = DropPos.x - (BMInfo.RecommendedWidth/2);
01590     BoundsRect.lo.y = DropPos.y - (BMInfo.RecommendedHeight/2);
01591     BoundsRect.hi.x = BoundsRect.lo.x + BMInfo.RecommendedWidth;
01592     BoundsRect.hi.y = BoundsRect.lo.y + BMInfo.RecommendedHeight;
01593     DocCoord Point1 = DocCoord(BoundsRect.hi.x, BoundsRect.lo.y);
01594     DocCoord Point2 = DocCoord(BoundsRect.lo.x, BoundsRect.hi.y);
01595 
01596     pTraceControl->RemoveTree(FALSE); // Don't delete it
01597     pTraceControl->InitBitmap(); // to get us some room back
01598 
01599     Matrix tMatrix(Div32By32(Point1.x-BoundsRect.lo.x,BMInfo.PixelWidth<<8),
01600                         Div32By32(Point2.x-BoundsRect.lo.x,BMInfo.PixelWidth<<8),
01601                    Div32By32(Point1.y-BoundsRect.lo.y,BMInfo.PixelHeight<<8),
01602                         Div32By32(Point2.y-BoundsRect.lo.y,BMInfo.PixelHeight<<8),
01603                    BoundsRect.lo.x,BoundsRect.lo.y);
01604     Trans2DMatrix Trans(tMatrix);
01605 
01606     pNodeRenderableBounded->Transform(Trans);
01607         
01608     // Insert the node, but don't invalidate its region
01609     if (!DoInsertNewNode(pNodeRenderableBounded, pSpread, TRUE))
01610     {
01611         Node * pFirstChild = pNodeRenderableBounded->FindFirstChild();
01612         if (pFirstChild) pNodeRenderableBounded->DeleteChildren(pFirstChild);
01613         delete pNodeRenderableBounded;
01614 
01615         EndSlowJob();
01616         FailAndExecute();
01617         InformError();
01618         End();
01619         return;
01620     }
01621 
01622     // All ok
01623     EndSlowJob();
01624     End();
01625     return;
01626     
01627 }                                                      
01628 
01629 /********************************************************************************************
01630 
01631 >   BOOL TraceOp::FindCentreInsertionPosition(Spread** Spread, DocCoord* Position)
01632 
01633     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01634     Created:    24/3/95
01635     Inputs:     -
01636     Outputs:    Spread:  The spread to place the clipboard objects on
01637                 Position:The centre of the view (Spread coords)
01638     Returns:    TRUE if succeeded else FALSE
01639     Purpose:    Finds the centre insertion position for clipboard objects
01640     Errors:     ERROR2 in various situations
01641     Scope:      private
01642     SeeAlso:    -
01643 
01644 ********************************************************************************************/
01645 
01646 BOOL TraceOp::FindCentreInsertionPosition(Spread** Spread, DocCoord* Position)
01647 {
01648     // ---------------------------------------------------------------------------------
01649     // Find out which spread is in the centre of the view 
01650     // this is the spread that the pasted objects will be placed on
01651 
01652     ERROR2IF((!Spread)||(!Position),FALSE,"Invalid call to FindCentreInsertionPoint()");
01653     // Obtain the current DocView
01654     DocView* CurDocView = GetWorkingDocView();
01655 
01656     ERROR2IF(!CurDocView, FALSE, "The current DocView is NULL"); 
01657 
01658     WorkRect WrkViewRect = CurDocView->GetViewRect();
01659 
01660     ERROR2IF((WrkViewRect.IsEmpty() || (!WrkViewRect.IsValid()) ), FALSE, "Invalid WorkRect");
01661     
01662     // Determine the centre of the view
01663     WorkCoord WrkCentreOfView; 
01664     WrkCentreOfView.x = WrkViewRect.lo.x    + (WrkViewRect.Width()/2); 
01665     WrkCentreOfView.y = WrkViewRect.lo.y    + (WrkViewRect.Height()/2);
01666     
01667     // FindEnclosing spread requires an OilCoord
01668     OilCoord OilCentreOfView = WrkCentreOfView.ToOil(CurDocView->GetScrollOffsets()); 
01669 
01670     // Find out which spread to insert the pasteboard objects onto
01671     (*Spread) = CurDocView->FindEnclosingSpread(OilCentreOfView);
01672     ERROR2IF(!(*Spread), FALSE, "No spread?!");
01673 
01674     // Phew
01675     // ---------------------------------------------------------------------------------
01676     // Now lets find the spread coordinate of the centre of the view
01677     DocRect DocViewRect = CurDocView->GetDocViewRect(*Spread);
01678 
01679     ERROR2IF( ( (DocViewRect.IsEmpty()) || !(DocViewRect.IsValid())), FALSE, "DocViewRect is invalid" );
01680 
01681     // Find the centre of the DocViewRect
01682     DocCoord DocCentreOfView; 
01683     DocCentreOfView.x = DocViewRect.lo.x    + (DocViewRect.Width()/2); 
01684     DocCentreOfView.y = DocViewRect.lo.y    + (DocViewRect.Height()/2);
01685 
01686     // Now convert from DocCoords to spread coords
01687     (*Spread)->DocCoordToSpreadCoord(&DocCentreOfView);
01688 
01689     // Finally, fill in the return value
01690     *Position = DocCentreOfView;
01691     
01692     return TRUE;  
01693 }
01694 
01695 
01696 /********************************************************************************************
01697 
01698 >   static void TraceMsg::OpenOrUse(KernelBitmap * pBitmap)
01699 
01700     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01701     Created:    20/02/95
01702     Inputs:     pBitmap = bitmap to use
01703     Outputs:    -
01704     Returns:    -
01705     Purpose:    Open the tracer dialog if it's not already open, else just uses that bitmap
01706     Errors:     -
01707     SeeAlso:    -
01708 
01709 ********************************************************************************************/
01710 
01711 void TraceMsg::OpenOrUse(KernelBitmap * pBitmap)
01712 {
01713     // Obtain a pointer to the op descriptor for the create operation 
01714     OpDescriptor* OpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(TraceDlg));
01715     if (!OpDesc) return;
01716 
01717     // Only one live instance of the operation is allowed. It's probably a dialog 
01718     if (!MessageHandler::MessageHandlerExists(CC_RUNTIME_CLASS(TraceDlg)))
01719     {
01720         OpParam param((void *)pBitmap,(void *)NULL);
01721         OpDesc->Invoke(&param);
01722     }
01723     else
01724     {
01725         BROADCAST_TO_CLASS(TraceMsg(pBitmap),DialogOp); 
01726     }   
01727     return;
01728 }
01729 
01730 

Generated on Sat Nov 10 03:47:12 2007 for Camelot by  doxygen 1.4.4