app.cpp

Go to the documentation of this file.
00001 // $Id: app.cpp 1531 2006-07-25 16:05:48Z 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 
00099 #include "camtypes.h"
00100 
00101 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00102 #include "colormgr.h"
00103 //#include "document.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 //#include "rndrgn.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 //#include "ensure.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 //#include "prefs.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 
00108 //#include "pump.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 //#include "ops.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00110 //#include "dialogop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00111 //#include "bars.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00112 //#include "opdesc.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00113 //#include "range.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00114 #include "objreg.h"
00115 #include "pen.h"
00116 #include "blobs.h"
00117 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00118 //#include "clipint.h"
00119 //#include "doccomp.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00120 //#include "keypress.h"
00121 //#include "tool.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00122 //#include "keymsg.h"
00123 #include "hotkeys.h"
00124 #include "statline.h"
00125 #include "camelot.h"
00126 #include "dbugtree.h"
00127 //#include "atminfo.h"
00128 #include "fontman.h"
00129 #include "coldlog.h"
00130 //#include "xaracms.h"
00131 #include "prnmks.h"
00132 #include "camelot.h"
00133 //#include "ralphcri.h"
00134 #include "ralphdoc.h"
00135 //#include "registry.h"
00136 
00137 //#include "resimmap.h" //For _R(IDS_NEWTEMPLATES_RELATIVEPATH)
00138 
00139 #ifdef FREEHANDPLUGINS
00140 // Only add in if required - general plug-in removal at present
00141 #include "apiobj.h"     // APIObject
00142 #include "handman.h"    //  HandleManager
00143 #endif
00144 //#include "plugmngr.h" // Plug-in Manager
00145 #include "filtrmgr.h"   // Filter Manager
00146 #include "tmpltarg.h"   // WizOp(s)
00147 #include "tmplmngr.h"
00148 
00149 #include "noisebas.h"
00150 #ifdef AUTOMATION
00151 #include "ccc.h"        // ConcurrencyController
00152 #endif
00153 
00154 #include "objcache.h"   // the objectcache header
00155 #include "cachrand.h"   // ObjectCache (random)
00156 #include "cachfifo.h"   // ObjectCache (fifo)
00157 #include "cachweak.h"   //
00158 //#include "bitmapcache.h"
00159 
00160 #include "sgliboil.h"   // AppendSlashIfNotPresent
00161 
00162 DECLARE_SOURCE("$Revision: 1531 $");
00163 
00164 CC_IMPLEMENT_MEMDUMP(Application, CCObject)
00165 
00166 // Declare smart memory handling in Debug builds
00167 #define new CAM_DEBUG_NEW
00168 
00169 Application Camelot;
00170 
00171 /***********************************************************************************************
00172 
00173 >   Application::Application()
00174 
00175     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00176     Created:    20/5/93
00177     
00178     Inputs:     -
00179     Outputs:    -
00180     Returns:    -
00181                  
00182     Purpose:    Initialise the application.
00183                
00184     Errors:     None.
00185                                                                  
00186 ***********************************************************************************************/
00187 
00188 Application::Application() : m_pTemplateManager( new CTemplateManager )
00189 {
00190 // WEBSTER - markn 25/4/97
00191 // No pen stuff required in Webster
00192 // Now taken out via vector stroking code Neville 2/10/97
00193 #ifdef VECTOR_STROKING
00194     PressurePen = NULL;
00195     PenInitialised = FALSE;
00196 #endif // VECTOR_STROKING
00197 
00198     CamelotPrefs = NULL;
00199     Selection = NULL;
00200     TheColourManager = NULL;
00201     BlobMgr = NULL;
00202     DocComponentClasses = NULL;
00203     pATMIniCache = NULL;
00204 
00205     FontMgr                     = NULL;
00206     CMSManager                  = NULL;
00207     TheMarksManager             = NULL;
00208     ThePlugInManager            = NULL;
00209     TheFilterManager            = NULL;
00210     TheAPIObject                = NULL;
00211     TheHandleManager            = NULL;
00212     TheNoiseManager             = NULL;
00213     TheWizardOfOps              = NULL;
00214     DisabledRealDownload        = FALSE;
00215 PORTNOTE("other","Removed HKEY usage")
00216 #ifndef EXCLUDE_FROM_XARALX
00217     key                         = NULL;
00218     key2                        = NULL;
00219 #endif
00220 #ifdef AUTOMATION
00221     TheConcurrencyController    = NULL;
00222 #endif
00223 
00224     // This variable will get set to TRUE when Camelot starts to shut down
00225     CamelotShuttingDown = FALSE; 
00226     BgRendering = FALSE;
00227 
00228     // Temporary: Remove when Kernel StatusLine is actually created by Oil statusline
00229     m_pStatusLine = NULL;
00230 }
00231 
00232 /***********************************************************************************************
00233 
00234 >   Application::~Application()
00235 
00236     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00237     Created:    20/5/93
00238     
00239     Inputs:     - 
00240     Outputs:    -
00241     Returns:    -
00242                  
00243     Purpose:    Destroys any documents associated with this object.
00244                
00245     Errors:     None.
00246                                                                  
00247 ***********************************************************************************************/
00248 
00249 Application::~Application()
00250 {
00251     // Delete any documents still associated with this application
00252     Document *pDocument = (Document *) Documents.GetHead();
00253     
00254     while (pDocument != NULL)
00255     {
00256         delete Documents.RemoveItem(pDocument);
00257         pDocument = (Document *) Documents.GetHead();
00258     }
00259 
00260 //  ERROR3IF(DocComponentClasses != NULL,
00261 //              "Application was not properly de-initialised");
00262     if (DocComponentClasses != 0) TRACE( wxT("WARNING: Application was not properly de-initialised\n") );
00263 
00264     RegenList.DeleteAll();
00265 }
00266 
00267 #if _AFXDLL
00268 
00269 // these must be an out-of-line function in DLL builds
00270 
00271 Application *GetApplication()
00272 {
00273     return &Camelot;
00274 }
00275 
00276 #endif
00277 
00278 /***********************************************************************************************
00279 
00280 >   BOOL Application::Init()
00281 
00282     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00283     Created:    26/8/93
00284     
00285     Inputs:     -
00286     Outputs:    -
00287     Returns:    TRUE if the object initialised ok.
00288                  
00289     Purpose:    Initialise the application, including the user preferences system. This is
00290                 the earliest kernel-level code to be called - do NOT ADD THINGS HERE. Almost
00291                 everything that needs to be initialised should go in InitKernel, which gets
00292                 called after this and some OIL initialisation. If you think you qualify to
00293                 add something here, speak to Andy first.
00294                
00295     Errors:     None.
00296                                                                  
00297 ***********************************************************************************************/
00298 
00299 BOOL Application::Init()
00300 {
00301     
00302     // Initialise the message handler class groups
00303     if(!(
00304         MessageHandler::RegisterClassGroup(CC_RUNTIME_CLASS(MessageHandler)) && 
00305         MessageHandler::RegisterClassGroup(CC_RUNTIME_CLASS(Operation))     &&
00306         MessageHandler::RegisterClassGroup(CC_RUNTIME_CLASS(DialogOp))      &&
00307         MessageHandler::RegisterClassGroup(CC_RUNTIME_CLASS(OpDescriptor))  &&
00308         MessageHandler::RegisterClassGroup(CC_RUNTIME_CLASS(DialogBarOp))   &&
00309         MessageHandler::RegisterClassGroup(CC_RUNTIME_CLASS(SelRangeMessageHandler))
00310       ))
00311     {
00312         return FALSE; // Failed
00313     }
00314 
00315 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00316 PORTNOTE("colourmanager","Removed XaraCMS usage")
00317     // Create the Xara CMS manager - we have to get this in there
00318     // before a colour manager initialise otherwise there'll be trouble.
00319     // Note that if this fails in any way, we continue happily, simply disabling
00320     // the advanced colour management functions.
00321     CMSManager = new XaraCMS;
00322     if (CMSManager != NULL)
00323     {
00324         // We got one. Let's initialise it
00325         if (!CMSManager->Initialise(1))
00326         {
00327             delete CMSManager;
00328             CMSManager = NULL;
00329         }
00330     }
00331     CMSManager = NULL;
00332 #else 
00333     CMSManager = NULL;
00334 #endif
00335 
00336     // startup the noise system
00337     TheNoiseManager = new NoiseMan;
00338     if (TheNoiseManager == NULL)
00339         return FALSE;
00340 
00341     if (!TheNoiseManager->Initialise())
00342         return FALSE;
00343 
00344     // Initialise the colour system
00345     if (!ColourManager::Init())
00346         return FALSE;
00347 
00348     // Create and initialise the Camelot Selection object
00349     // This must be done AFTER registering the SelRangeMessageHandler class above,
00350     // as the Selection tries to register a message handler when it is constructed.
00351     // Thus it is necessary to defer creation of the object until the msg system
00352     // has been appropriately set up.
00353     Selection = new SelRange;
00354     if (Selection == NULL)
00355         return(FALSE);
00356 
00357     // startup the noise system
00358     // Create and initialise the colour manager
00359     // THis is done here for the same reasons as described for the SelRange, above.
00360     TheColourManager = new ColourManager;
00361     if (TheColourManager == NULL)
00362         return(FALSE);
00363 
00364     // create and initialise a new Blob Manager
00365     BlobMgr = new BlobManager;
00366     if (BlobMgr == NULL)
00367         return FALSE;
00368 
00369 PORTNOTE("other","Removed init of stuff that is not supported")
00370 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00371     // create the ATM ini cache.
00372     pATMIniCache = new ATMIniCache;
00373     if (pATMIniCache == NULL)
00374         return FALSE;
00375 #endif
00376 
00377     // Create the font mangler
00378     FontMgr = new FontManager;
00379     if (FontMgr == NULL)
00380         return FALSE;
00381 
00382     // And make sure its initialised;
00383     if (!FontMgr->Init())
00384         return FALSE;
00385 
00386 #if !defined(EXCLUDE_FROM_RALPH)
00387 #ifndef STANDALONE
00388 #ifndef WEBSTER
00389 // Do not do do on Webster as this conflicts with the CleanUpAfterExport code in BaseCamelotFilter
00390 
00391     // Create a print marks manager please
00392     TheMarksManager = new PrintMarksMan;
00393     if (TheMarksManager == NULL)
00394         return FALSE;
00395 #endif // WEBSTER
00396 #endif
00397 #endif
00398 
00399 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00400 #ifndef STANDALONE
00401 #ifdef FREEHANDPLUGINS
00402 // Only add in if required - general plug-in removal at present
00403     // Create the external (Freehand Xtra) API object
00404     TheAPIObject = new APIObject;
00405     if (TheAPIObject == NULL)
00406         return FALSE; // Actually we can probably run without this...
00407 #endif // FREEHANDPLUGINS
00408 
00409 #ifdef PLUGINSUPPORT
00410     // Create a plug-in manager please
00411     ThePlugInManager = new PlugInManager;
00412     if (ThePlugInManager == NULL)
00413         return FALSE;
00414 #endif // PLUGINSUPPORT
00415 
00416 #ifdef FREEHANDPLUGINS
00417     TRACEUSER( "claude", _T("new handlemanager\n"));
00418     TheHandleManager = new HandleManager;
00419     if (TheHandleManager == NULL)
00420         return FALSE;
00421 #endif // FREEHANDPLUGINS
00422 
00423     if (!InitFilterManager())
00424     {
00425         return FALSE;
00426     }
00427     
00428 #endif // STANDALONE
00429 #endif // EXCLUDE_FROM_RALPH, EXCLUDE_FROM_XARALX
00430 
00431 #ifndef EXCLUDE_FROM_XARALX
00432 #ifdef AUTOMATION
00433     if (!InitCCC())
00434     {
00435         return FALSE;
00436     }
00437 #endif
00438 #endif
00439 
00440     // Initialise the object registry. 
00441     if (!ObjectRegistry::Init())
00442     {
00443         // Error has been set
00444         return (FALSE);  
00445     }
00446 
00447     if (!InitWizOps())
00448     {
00449         return FALSE;
00450     }  
00451 
00452 #if !defined(EXCLUDE_FROM_RALPH)
00453     // Create and initialise the CamelotPrefs object.
00454     // This object is dynamically created rather than being embedded in the Appliation object
00455     // because the Application destructor is called after the SimpleCCObject::MemoryDump()
00456     // function is called.  Hence if the CamelotPrefs object were embedded, the MemoryDump
00457     // would list all the preference-related objects on application termination.
00458     CamelotPrefs = new Preferences;
00459 
00460     if (!((CamelotPrefs != NULL) && CamelotPrefs->Init()))
00461         return FALSE;
00462 #endif
00463 
00464 #ifdef VECTOR_STROKING // Neville 6/8/97
00465     m_pObjCache = new ObjectCacheFIFO(50);      // set a cache of 50 bytes
00466 
00467     if (m_pObjCache == NULL)
00468         return FALSE;
00469     // Set the cache size with an arbitrary value (in bytes)
00470     //m_ObjCache->SetMaxCacheSize(50);
00471 #endif // VECTOR_STROKING
00472 
00473     // Set up the Bitmap Cache...
00474     TheBitmapCache = new CBitmapCache();
00475     TheBitmapCache->Initialise();                   // Initialise with default settings
00476 
00477     // Get an empty list object to hold all the registered doc components
00478     DocComponentClasses = new List;
00479     if (DocComponentClasses == NULL)
00480         return FALSE;
00481 
00482     // Eveything worked (gasp!)
00483     return TRUE; 
00484 }
00485 
00486 
00487 /***********************************************************************************************
00488 
00489 >   BOOL Application::InitFilterManager()
00490 
00491     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00492     Created:    26/12/96
00493     Returns:    TRUE if OK, FALSE if failed
00494     Purpose:    Support function to initialize this Application's FilterManager
00495                                                                  
00496 ***********************************************************************************************/
00497 BOOL Application::InitFilterManager()
00498 {
00499     BOOL Success = FALSE;
00500 
00501     TheFilterManager = new FilterManager;
00502     if (TheFilterManager != NULL)
00503     {
00504         Success = TheFilterManager->Init();
00505     }
00506     else
00507     {
00508         Success = FALSE;
00509     }
00510 
00511     return Success;
00512 }
00513 
00514 
00515 /***********************************************************************************************
00516 
00517 >   BOOL Application::InitWizOps()
00518 
00519     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00520     Created:    26/12/96
00521 
00522     Purpose:    Support function to initialize this Application's WizardOfOps from the local
00523                 registry.
00524 
00525     Returns:    TRUE if OK, FALSE if failed
00526                                                                  
00527 ***********************************************************************************************/
00528 BOOL Application::InitWizOps()
00529 {
00530     BOOL Ok = TRUE;
00531 
00532     TheWizardOfOps = new WizOps;
00533     if (TheWizardOfOps != NULL)
00534     {
00535         Ok = TheWizardOfOps->InitializeFromRegistry();
00536     }
00537     else
00538     {
00539         Ok = FALSE;
00540     }
00541 
00542     return Ok;
00543 }
00544 
00545 
00546 #ifdef AUTOMATION
00547 /***********************************************************************************************
00548 
00549 >   BOOL Application::InitCCC()
00550 
00551     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00552     Created:    26/03/97
00553 
00554     Returns:    TRUE if OK, FALSE if failed
00555     Purpose:    Support function to initialize this Application's ConcurrencyController
00556                                                                  
00557 ***********************************************************************************************/
00558 BOOL Application::InitCCC()
00559 {
00560     BOOL Success = FALSE;
00561 
00562     TheConcurrencyController = new ConcurrencyController;
00563     if (TheConcurrencyController != NULL)
00564     {
00565         Success = TheConcurrencyController->Init();
00566     }
00567     else
00568     {
00569         Success = FALSE;
00570     }
00571 
00572     return Success;
00573 }
00574 #endif  // AUTOMATION
00575 
00576 
00577 /***********************************************************************************************
00578 
00579 >   BOOL Application:LateInit()
00580 
00581     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00582     Created:    26/9/94
00583     Returns:    TRUE if OK, FALSE if failed->SetError.
00584     Purpose:    Initialise the application object bits that require the preferences system
00585                 to be fully up & running. Currently that means the pen only.
00586     Errors:     None.
00587                                                                  
00588 ***********************************************************************************************/
00589 
00590 BOOL Application::LateInit()
00591 {
00592 #ifdef PLUGINSUPPORT
00593 // Only add in if required - general plug-in removal at present
00594     // We need the preferences system present so we must wait until here
00595     // before we ask the PlugInManager to initialise iteself;
00596     if (ThePlugInManager == NULL || !ThePlugInManager->Init())
00597         return FALSE;
00598 #endif // PLUGINSUPPORT
00599 
00600     m_pTemplateManager->Init();
00601 
00602     // Everything went ok
00603     return TRUE;
00604 }
00605 
00606 /********************************************************************************************
00607 
00608 >   void Application::Deinit()
00609 
00610     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00611     Created:    26/8/93
00612     Purpose:    Close down the kernel application object, including the user preferences 
00613                 system.
00614                                                                  
00615 ********************************************************************************************/
00616 
00617 void Application::Deinit()
00618 {
00619 #ifdef PLUGINSUPPORT
00620 // Only add in if required - general plug-in removal at present
00621     // We need to ask the plug-in manager to save out its list of pathnames.
00622     // So before the prefs system is vaped.
00623     PlugInManager * pPlugMan = GetApplication()->GetPlugInManager();
00624     if (pPlugMan)
00625         pPlugMan->WritePathNameList();
00626 #endif // PLUGINSUPPORT
00627 
00628 #ifdef FREEHANDPLUGINS
00629     //  clean up the memory used by MOA
00630     TRACEUSER( "claude", wxT("Free up frmo the handle manager\n") );
00631     HandleManager* pHandleCleaning = GetApplication()->GetHandleManager();
00632     if(pHandleCleaning)
00633         pHandleCleaning->FreeAll();
00634 #endif // FREEHANDPLUGINS
00635 
00636     if (CamelotPrefs!=NULL)
00637     {
00638         CamelotPrefs->Deinit();
00639         delete CamelotPrefs;
00640         CamelotPrefs = NULL;
00641     }
00642 
00643     if (Selection!=NULL)
00644     {
00645         delete Selection;
00646         Selection = NULL;
00647     }
00648         
00649     if (DocComponentClasses != NULL)
00650     {
00651         DocComponentClasses->DeleteAll();
00652         delete DocComponentClasses;
00653         DocComponentClasses = NULL;
00654     }
00655 
00656     if (TheColourManager!=NULL)
00657     {
00658         ColourManager::Deinit();
00659         delete TheColourManager;
00660         TheColourManager = NULL;
00661     }
00662 
00663     if (TheNoiseManager!=NULL)
00664     {
00665         TheNoiseManager->Destroy();
00666         delete TheNoiseManager;
00667         TheNoiseManager=NULL;
00668     }
00669 
00670 #if !defined(EXCLUDE_FROM_RALPH)
00671 #if !defined(EXCLUDE_FROM_XARALX)
00672 PORTNOTE("colourmanager","Removed XaraCMS usage")
00673     if (CMSManager!=NULL)
00674     {
00675         CMSManager->Finalise();
00676         delete CMSManager;
00677         CMSManager = NULL;
00678     }
00679 
00680 // VECTOR_STROKING - markn 25/4/97
00681 // No pen stuff required in Webster
00682 // Taken out by vector stroking code Neville 2/10/97
00683 #ifdef VECTOR_STROKING
00684     if (PressurePen != NULL)
00685     {
00686         delete PressurePen;
00687         PressurePen = NULL;
00688     }
00689 #endif // VECTOR_STROKING
00690 
00691 #endif  // EXCLUDE_FROM_XARALX
00692     // Get rid of the blob manager
00693     if (BlobMgr!=NULL)
00694     {
00695         delete BlobMgr;
00696         BlobMgr = NULL;
00697     }
00698 #endif // EXCLUDE_FROM_RALPH
00699 
00700 PORTNOTE("other","Removed un-=impl. stuff")
00701 #ifndef EXCLUDE_FROM_XARALX
00702     // Get rid of the ATM Ini cache object
00703     if (pATMIniCache!=NULL)
00704     {
00705         delete pATMIniCache;
00706         pATMIniCache = NULL;
00707     } */
00708 #endif
00709 
00710     // Get rid of the font manager
00711     if (FontMgr!=NULL)
00712     {
00713         delete FontMgr;
00714         FontMgr = NULL;
00715     }
00716 
00717 #if !defined(EXCLUDE_FROM_RALPH)
00718 #ifndef STANDALONE
00719 #ifndef WEBSTER
00720 // Do not do do on Webster as this conflicts with the CleanUpAfterExport code in BaseCamelotFilter
00721 
00722     // Toast the marks manager
00723     if (TheMarksManager!=NULL)
00724     {
00725         delete TheMarksManager;
00726         TheMarksManager = NULL;
00727     }
00728 #endif // WEBSTER
00729 #endif
00730 #endif
00731 
00732 #ifdef PLUGINSUPPORT
00733 // Only add in if required - general plug-in removal at present
00734     // Toast the plug-in manager
00735     if (ThePlugInManager != NULL)
00736     {
00737         delete ThePlugInManager;
00738         ThePlugInManager = NULL;
00739     }
00740 #endif // PLUGINSUPPORT
00741 
00742 #ifdef FREEHANDPLUGINS
00743     // Nuke the API interfaces (must be done after killing the plugin manager). Don't delete
00744     // it afterwards, it's all handled by the reference count...
00745     if(TheAPIObject != NULL)
00746         TheAPIObject->ShutDown();
00747 
00748     //  Delete the Moa handle manager
00749     if(TheHandleManager != NULL)
00750     {
00751         TRACEUSER( "claude", wxT("deleting the moa handle manager\n") );
00752         delete TheHandleManager;
00753         TheHandleManager = NULL;
00754     }
00755 #endif // FREEHANDPLUGINS
00756 
00757     DeinitFilterManager();
00758 
00759     if (m_pObjCache != NULL)
00760     {
00761         delete m_pObjCache;
00762         m_pObjCache = NULL;
00763     }
00764 
00765     if (TheBitmapCache)
00766     {
00767         TheBitmapCache->DeInitialise();
00768         delete TheBitmapCache;
00769         TheBitmapCache = NULL;
00770     }
00771 
00772     DeinitWizOps();
00773 
00774 #ifdef AUTOMATION
00775     DestroyCCC();
00776 #endif
00777 
00778     // DialogManager was deinitialized a while ago, but this bit needs to be done after
00779     // the pref system has gone. It merely frees some memory
00780     DialogManager::FreePaneInfoHash();
00781 
00782     ObjectRegistry::Delete();
00783 }
00784 
00785 
00786 /***********************************************************************************************
00787 
00788 >   BOOL Application::DeinitFilterManager()
00789 
00790     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00791     Created:    26/12/96
00792     Returns:    TRUE if OK, FALSE if failed
00793     Purpose:    Support function to deinitialize & destruct this Application's FilterManager
00794                                                                  
00795 ***********************************************************************************************/
00796 BOOL Application::DeinitFilterManager()
00797 {
00798     BOOL Success = FALSE;
00799 
00800     FilterManager* pFilterManager = GetFilterManager();
00801     if (pFilterManager != NULL)
00802     {
00803         Success = TheFilterManager->DeInit();
00804         // ...ignore any errors
00805         if (!Success)
00806         {
00807             TRACE( wxT("Deinit of FilterManager not successful") );
00808         }
00809         delete TheFilterManager;
00810         TheFilterManager = NULL;
00811         Success = TRUE;
00812     }
00813     else
00814     {
00815         TRACE( wxT("No Filter Manager") );
00816         Success = FALSE;
00817     }
00818 
00819     return Success;
00820 }
00821 
00822 
00823 /***********************************************************************************************
00824 
00825 >   BOOL Application::DeinitWizOps()
00826 
00827     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00828     Created:    26/12/96
00829 
00830     Purpose:    Support function to deinitialize & destruct this Application's WizOps
00831 
00832     Returns:    TRUE if OK, FALSE if failed
00833                                                                  
00834 ***********************************************************************************************/
00835 BOOL Application::DeinitWizOps()
00836 {
00837     BOOL Ok = TRUE;
00838 
00839     if (TheWizardOfOps != NULL)
00840     {
00841         delete TheWizardOfOps;
00842         TheWizardOfOps = NULL;
00843     }
00844     else
00845     {
00846         TRACE( wxT("No WizOps") );
00847         Ok = FALSE;
00848     }
00849 
00850     return Ok;
00851 }
00852 
00853 
00854 #ifdef AUTOMATION
00855 /***********************************************************************************************
00856 
00857 >   BOOL Application::DestroyCCC()
00858 
00859     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00860     Created:    26/12/96
00861     Returns:    TRUE if OK, FALSE if failed
00862     Purpose:    Support function to deinitialize & destruct this Application's 
00863                 ConcurrencyController.
00864                                                                  
00865 ***********************************************************************************************/
00866 BOOL Application::DestroyCCC()
00867 {
00868     BOOL Success = FALSE;
00869 
00870     if (TheConcurrencyController != NULL)
00871     {
00872         delete TheConcurrencyController;
00873         TheConcurrencyController = NULL;
00874         Success = TRUE;
00875     }
00876     else
00877     {
00878         TRACE( wxT("No ConcurrencyController") );
00879         Success = FALSE;
00880     }
00881 
00882     return Success;
00883 }
00884 #endif
00885 
00886 
00887 /***********************************************************************************************
00888 
00889 >   RenderRegionList* Application::GetRegionList()
00890 
00891     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00892     Created:    9/6/95
00893     Purpose:    Gets a pointer to the Applications RenderRegion list.
00894 
00895 ***********************************************************************************************/
00896 
00897 RenderRegionList* Application::GetRegionList()
00898 {
00899     return &RenderList;
00900 }
00901 
00902 /***********************************************************************************************
00903 
00904 >   void Application::AddRenderRegion(RenderRegion *pRegion)
00905 
00906     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00907     Created:    27/5/93
00908     Inputs:     pRegion - pointer to the RenderRegion to add to the list.
00909     Returns:    Region - the render region to add.
00910     Purpose:    To add a RenderRegion object to the RenderList. Automatically sets a flag
00911                 to do immediate rendering if the render region is an immediate one.
00912     SeeAlso:    RenderRegion; List
00913 
00914 ***********************************************************************************************/
00915 
00916 void Application::AddRenderRegion(RenderRegion *pRegion)
00917 {
00918     // Is this render region an immediate one?
00919 
00920     View *pView = pRegion->GetRenderView();
00921     ENSURE(pView != NULL, "No View in AddRenderRegion!");
00922 
00923     if (!pView->GetForeBackMode())
00924     {
00925 //      TRACE(_T("ImmediateRender\n"));
00926         // Yes - set the flag to indicate we should do some immediate rendering on the
00927         // next redraw event.
00928         ImmediateRenderPending = TRUE;
00929     }
00930 
00931     // Add this render region to the list.
00932     RenderList.Merge(pRegion);
00933 }
00934 
00935 /***********************************************************************************************
00936 
00937 >   BOOL Application::DeleteRenderRegion(RenderRegion *Region)
00938 
00939     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00940     Created:    27/5/93
00941     Inputs:     Region - pointer to the RenderRegion to remove from the list.
00942     Returns:    TRUE if the region was in the list, FALSE otherwise.
00943     Purpose:    To remove a RenderRegion object from the RenderList.  If the
00944                 region in not in the list, no errors occur.  The RenderRegion object will
00945                 be destroyed (i.e. delete will be called on it).
00946     Errors:     -
00947     SeeAlso:    RenderRegion; List
00948 
00949 ***********************************************************************************************/
00950 
00951 BOOL Application::DeleteRenderRegion(RenderRegion *Region)
00952 {
00953 #ifdef RALPH
00954         // Wait until it's safe to enter
00955         CCamApp::EnterGDrawCriticalSection();
00956 #endif
00957     if (RenderList.FindPosition(Region) == NOT_IN_LIST)
00958     {
00959     #ifdef RALPH
00960         // Let another process have a go
00961         CCamApp::ExitGDrawCriticalSection();
00962     #endif
00963         ENSURE( FALSE, "Couldn't find Region in List" );
00964         return FALSE;
00965     }
00966     
00967     RenderList.Remove(Region);
00968     #ifdef RALPH
00969         // Let another process have a go
00970         CCamApp::ExitGDrawCriticalSection();
00971     #endif
00972     return TRUE;
00973 }
00974 
00975 
00976 /********************************************************************************************
00977 
00978 >   BOOL Application::ServiceRendering(BOOL bImmediate = FALSE)
00979 
00980     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00981     Created:    27/06/94
00982     Returns:    TRUE if more rendering needs to be done, FALSE if there are no more
00983                 regions left to render.
00984     Purpose:    Render some objects!  This function will either render any outstanding 
00985                 'immediate' render regions to completion, or render a background render
00986                 regions for one time-slice.
00987     SeeAlso:    RenderRegionList::ImmediateRender; RenderRegionList::BackgroundRender
00988 
00989 ********************************************************************************************/
00990 
00991 BOOL Application::ServiceRendering(BOOL bImmediate)
00992 { 
00993 #ifdef RALPH
00994 #ifdef _DEBUG
00995     if(::GetCurrentThreadId() == RalphDocument::GetImportingThreadID())
00996     {
00997         // If we get in here, it's extremely BAD !
00998         AfxDebugBreak();
00999     }
01000 #endif
01001 
01002     // Fixes splodgy text problems...
01003     RalphCriticalSection RCS;
01004 #endif
01005 
01006 #ifdef RALPH
01007         // Wait until it's safe to enter
01008         CCamApp::EnterGDrawCriticalSection();
01009 #endif
01010 
01011     // DMc - render the list of nodes to regenerate
01012     RegenerateNodesInList();
01013 
01014 //  TRACEUSER( "Gerry", _T("Service Rendering - Enter\n"));
01015     if (ImmediateRenderPending || bImmediate)
01016     {
01017         // Render all immediate render regions to completion, and then clear the
01018         // flag so we do some background rendering the next time around.
01019         RenderList.ImmediateRender(bImmediate);
01020         ImmediateRenderPending = FALSE;
01021 
01022     #ifdef RALPH
01023         // Let another process have a go
01024         CCamApp::ExitGDrawCriticalSection();
01025     #endif
01026 
01027         // Try background rendering next
01028 //      TRACEUSER( "Gerry", _T("Service Rendering - Exit - More\n"));
01029         return TRUE;
01030     }
01031     else
01032     {
01033         BOOL ok = RenderList.BackgroundRender();
01034     #ifdef RALPH
01035         // Let another process have a go
01036         CCamApp::ExitGDrawCriticalSection();
01037     #endif
01038 
01039 //      TRACEUSER( "Gerry", _T("Service Rendering - Exit - %s\n"), ok ? _T("More") : _T("Finished"));
01040         return ok;
01041     }
01042 
01043 //  TRACEUSER( "Gerry", _T("Service Rendering - Exit - More\n"));
01044     return TRUE;
01045 }
01046 
01047 
01048 /********************************************************************************************
01049 
01050 >   BOOL Application::IsBgRendering()
01051 
01052     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01053     Created:    10/5/95
01054     Returns:    TRUE if Background rendering is in progress.
01055     Purpose:    Find out if there is Background rendering in progress or not.
01056 
01057 ********************************************************************************************/
01058 
01059 BOOL Application::IsBgRendering()
01060 {
01061     return BgRendering;
01062 }
01063 
01064 
01065 
01066 /********************************************************************************************
01067 
01068 >   void Application::RegisterDocComponent(DocComponentClass *pClass)
01069 
01070     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
01071     Created:    02/08/94
01072     Inputs:     pClass - pointer to the Document component class thatis to be added.
01073     Purpose:    Register a new Document Component class with the application.  This class
01074                 will be asked to add an instance to a document every time a new document
01075                 is created. 
01076     SeeAlso:    DocComponentClass; DocComponent
01077 
01078 ********************************************************************************************/
01079 
01080 void Application::RegisterDocComponent(DocComponentClass *pClass)
01081 {
01082     // Check for multiple registrations in debug build...
01083     #if _DEBUG
01084     DocComponentClass *pItem = (DocComponentClass *) DocComponentClasses->GetHead();
01085 
01086     while (pItem != NULL)
01087     {
01088         // Already registered?
01089         if (pItem->GetRuntimeClass() == pClass->GetRuntimeClass())
01090         {
01091             ENSURE(FALSE, "Document component registered more than once!");
01092             return;
01093         }
01094         // Try the next one
01095         pItem = (DocComponentClass *) DocComponentClasses->GetNext(pItem);
01096     }
01097     #endif
01098 
01099     // Simple - just add it to the list
01100     DocComponentClasses->AddTail(pClass);
01101 }
01102 
01103 
01104 /********************************************************************************************
01105 
01106 >   DocComponentClass *Application::EnumerateDocComponents(DocComponentClass *pContext)
01107 
01108     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
01109     Created:    02/08/94
01110     Inputs:     pContext: NULL => Get the first document component
01111                       non-NULL => Get the next document component after the one pointed to
01112                                   by pContext.
01113     Returns:    Pointer to the required document component.
01114     Purpose:    Allow the caller to examine/use all the registered document components.
01115                 pContext should be NULL for the first call, which will return the first
01116                 registered document component.  After that, the returned pointer should
01117                 be passed back in to this function, which will return the next one, and
01118                 so on.
01119                 For example:
01120                 MonoOn
01121                     DocComponentClass *pDocComp = NULL;
01122                     do
01123                     {
01124                         pDocComp = Camelot.EnumerateDocComponents(pDocComp);
01125 
01126                         // Do something groovy with pDocComp...
01127                     }
01128                     while (pDocComp != NULL);
01129                 MonoOff
01130 
01131     SeeAlso:    Application::RegisterDocComponent;
01132                 DocComponent; 
01133                 DocComponentClass
01134 
01135 ********************************************************************************************/
01136 
01137 DocComponentClass *Application::EnumerateDocComponents(DocComponentClass *pContext)
01138 {
01139     if (pContext == NULL)
01140     {
01141         // Return the first item in the list...
01142         return (DocComponentClass *) (DocComponentClasses->GetHead());
01143     }
01144     else
01145     {
01146         // Return the next document component...
01147         return (DocComponentClass *) (DocComponentClasses->GetNext(pContext));
01148     }
01149 }
01150 
01151 
01152 /********************************************************************************************
01153 
01154 >   BOOL Application::ApplyDocComponents(Document *pDocument)
01155 
01156     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
01157     Created:    02/08/94
01158     Inputs:     pDocument - the document to add the components to.
01159     Returns:    TRUE if all the components were added successfully;
01160                 FALSE if not.
01161     Purpose:    Given a document, apply all the currently registered document components
01162                 to it.  i.e., add a colour table, units information, etc.
01163     Errors:     Out of memory, or other errors depending on implementations of each
01164                 document component.
01165     SeeAlso:    DocComponent; 
01166                 DocComponentClass
01167 
01168 ********************************************************************************************/
01169 
01170 BOOL Application::ApplyDocComponents(BaseDocument *pDocument)
01171 {
01172     // Go through the registered components and add their virtual function to add an
01173     // instance of the class to the Document object...
01174     DocComponentClass *pItem = (DocComponentClass *) DocComponentClasses->GetHead();
01175 
01176     while (pItem != NULL)
01177     {
01178         if (!pItem->AddComponent(pDocument))
01179         {
01180             // Component could not be added - probably out of memory.
01181             return FALSE;
01182         }
01183         // Try the next one
01184         pItem = (DocComponentClass *) DocComponentClasses->GetNext(pItem);
01185     }
01186 
01187     // All the components were successfully added
01188     return TRUE;
01189 }
01190 
01191 /********************************************************************************************
01192 >   BOOL Application::OnKeyPress(KeyPress* pKeyPress)
01193 
01194     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> (simplified by JustinF)
01195     Created:    26/8/94
01196     Inputs:     pKeyPress =Ptr to platform-indy key press object
01197     Returns:    TRUE  if the key press was processed, so do not pass on.
01198                 FALSE if not processed, so pass on to other interested parties
01199     Purpose:    This is where key presses are handled in Camelot. It does the following in this order -
01200 
01201                     1) Lets the current tool have a go
01202                     2) See if a temporary tool switch has occurred
01203                     3) Check for a hot-key combination
01204                     [ 4) Broadcast key press to all live ops - removed as it slows text typing by 20% ]
01205 
01206                 If at any of the stages the key is processed, this function exits immediately with TRUE,
01207                 i.e. it doesn't let the next stage try and deal with a key press that's been processed
01208                 
01209     Errors:     -
01210     SeeAlso:    KeyPress::TranslateMessage
01211 ********************************************************************************************/
01212 
01213 BOOL Application::OnKeyPress(KeyPress* pKeyPress)
01214 {
01215 #if !defined(EXCLUDE_FROM_RALPH)
01216 PORTNOTE("other","Removed XaraCMS usage")
01217     // First, pass the keypress to the Colour Editor.
01218     // This is used to stop keypresses while dragging in the editor, so must be done first
01219     if (ColourEditDlg::OnKeyPress(pKeyPress))
01220         return(TRUE);
01221 #endif
01222 
01223     // Pass this keypress on to selected DocView, if we have one, otherwise
01224     // pass on to tools, hotkeys etc.
01225     DocView* pDocView = DocView::GetSelected();
01226     return ( (pDocView != NULL && pDocView->HandleKeyPress(pKeyPress))
01227             || Tool::SwitchTool(pKeyPress)
01228             || HotKey::OnKeyPress(pKeyPress)
01229 // removed by Ed 27/4/95 - no-one uses this and it slows text typing by 20%!
01230 //          || (BROADCAST_TO_ALL(KeyMsg(KeyMsg::KEYPRESS, pKeyPress)) == EAT_MSG )
01231             );
01232 }
01233 
01234 
01235 
01236 /********************************************************************************************
01237 
01238 >   void Application::RegisterIdleProcessor(INT32 Priority, Operation* pOp)
01239 
01240     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
01241     Created:    12/9/94
01242     Inputs:     Priority - either IDLEPRIORITY_HIGH or IDLEPRIORITY_LOW.
01243                 pOp - Pointer to an operation.
01244     Returns:    -
01245     Purpose:    If an operation wants to do processing on idle events then it must register
01246                 to receive them.  It registers by calling this function with a pointer to
01247                 itself.  On idle events the operations OnIdle function is called.
01248 
01249     Notes:      If the operator is already registered for idles of the given priority,
01250                 this call does nothing (i.e. registering twice will give you only one
01251                 entry in the list)
01252 
01253                 HIGH priority handlers are called on every Idle event. LOW priority
01254                 handlers will only be called on idle events if there were no high
01255                 priority handlers which returned TRUE from their OnIdle method. 
01256                 i.e. If any high priority handler is active, all low-priority idles
01257                 cease to occur.
01258 
01259     Errors:     -
01260     SeeAlso:    Operation::OnIdleEvent, Application::CallIdleProcessors, 
01261                 Application::RemoveIdleProcessor
01262 
01263 ********************************************************************************************/
01264 
01265 void Application::RegisterIdleProcessor(INT32 Priority, Operation* pOp)
01266 {
01267     List* Current = (Priority==IDLEPRIORITY_HIGH) ? &IdleHighPriorityOps : &IdleLowPriorityOps;
01268 
01269     // Ensure the given Op is only registered once on the list
01270     ListItemOpPtr* Entry = (ListItemOpPtr *)Current->GetHead();
01271     while (Entry != NULL)
01272     {
01273         if (Entry->pOp == pOp)      // Hey, you're already registered!
01274             return;
01275 
01276         Entry = (ListItemOpPtr *) Current->GetNext(Entry);
01277     }
01278 
01279     // Have not found an entry in this list for this Op, so add one
01280     Entry = new ListItemOpPtr;
01281     Entry->pOp = pOp;
01282     Current->AddTail(Entry);
01283 
01284     NeedMoreIdles(); // ensure it gets at least a first idle event
01285 }
01286 
01287 
01288 
01289 /********************************************************************************************
01290 
01291 >   void Application::RemoveIdleProcessor(INT32 Priority, Operation* pOp)
01292 
01293     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
01294     Created:    12/9/94
01295     Inputs:     Priority - either IDLEPRIORITY_HIGH or IDLEPRIORITY_LOW.
01296                 pOp - Pointer to an operation.
01297     Returns:    -
01298     Purpose:    Stops an operation from receiving idle events.
01299 
01300     Notes:      If the Operation was not registered for idles, this call returns
01301                 quietly. This allows you to ensure you are deregistered without
01302                 having to remember if you did/didn't register for idles.
01303 
01304                 It is safe to call this method when processing an idle event - the event
01305                 processing code ensures that if you remove yourself from the list, it does
01306                 not give a toss (or an access violation!).
01307 
01308     Errors:     -
01309     SeeAlso:    Application::CallIdleProcessors
01310 
01311 ********************************************************************************************/
01312 
01313 void Application::RemoveIdleProcessor(INT32 Priority, Operation* pOp)
01314 {
01315     List* Current = (Priority==IDLEPRIORITY_HIGH) ? &IdleHighPriorityOps : &IdleLowPriorityOps;
01316     ListItemOpPtr* Entry = (ListItemOpPtr *)Current->GetHead();
01317 
01318     while (Entry != NULL)
01319     {
01320         if (Entry->pOp == pOp)
01321         {
01322             Current->RemoveItem(Entry);
01323             delete Entry;
01324             return;
01325         }
01326 
01327         Entry = (ListItemOpPtr *) Current->GetNext(Entry);
01328     }
01329 }
01330 
01331 /********************************************************************************************
01332 
01333 >   void Application::NeedMoreIdles()
01334 
01335     Author:     Alex Bligh <alex@alex.org.uk>
01336     Created:    17/5/2006
01337     Inputs:     -
01338     Returns:    -
01339     Purpose:    Tells the application we need more idles
01340 
01341     Notes:      This tells the application that we need further idle events, e.g. in the
01342                 scenario of a newly added idle handler, or an idle handler that previously
01343                 returned FALSE now returning true. This avoids waiting for the next event.
01344 
01345     Errors:     -
01346     SeeAlso:    Application::CallIdleProcessors
01347 
01348 ********************************************************************************************/
01349 
01350 void Application::NeedMoreIdles()
01351 {
01352     CCamApp::NeedMoreIdles();
01353 }
01354 
01355 /********************************************************************************************
01356 
01357 >   BOOL Application::CallIdleProcessors()
01358 
01359     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
01360     Created:    12/9/94
01361     Inputs:     -
01362     Returns:    TRUE if the registered operations require more idle events.
01363                 FALSE if no operations need further idle events.
01364 
01365     Purpose:    To call registered operations OnIdle functions.
01366 
01367     Notes:      It is assumed that if there are any processes registered, we still 
01368                 require idle events.
01369 
01370                 When idle processsor methods are called, they return the following values:
01371                 HIGH PRIORITY:  TRUE  = (claim) DO NOT call low-priority processors
01372                                 FALSE = (don't claim) DO call low-priority processors
01373 
01374                 LOW PRIORITY:   The return code is ignored.
01375 
01376                 This allows us to drag in the DragManager, updating fequently on high-priority
01377                 idles, but when the mouse is not moving, allow low-priority idles to be
01378                 called (which allows scrolling in galleries to be highly responsive, but
01379                 background redraws will kick into action very fast while the mouse stays still)
01380 
01381                 Most high-priority handlers will just override all events while they're running,
01382                 though there should never be very many high-priority handlers around.
01383 
01384                 [TODO: Perhaps low priority handlers should always be called once in a while (e.g.
01385                 always call them if they have not been called for a second or so), so that
01386                 we can never get inot a complete-lock-out situation.]
01387 
01388     Errors:     -
01389     SeeAlso:    Application::RegisterIdleProcessor
01390 
01391 ********************************************************************************************/
01392 
01393 BOOL Application::CallIdleProcessors()
01394 {
01395     // If the system is disabled (due to an error box being up) we must not do anything,
01396     // as we definitely do not want to cause a re-entrant error situation!
01397     if( CCamApp::IsDisabled() )
01398         return(TRUE);
01399 
01400     BOOL CallLowPriorityHandlers = TRUE;
01401 
01402     ListItemOpPtr *CurrentOp = (ListItemOpPtr*)IdleHighPriorityOps.GetHead();
01403     ListItemOpPtr *NextOp;
01404 
01405     // If there are no registered processors, we'll return FALSE as idles aren't needed
01406     BOOL MoreIdlesNeeded = FALSE;
01407 
01408     while (CurrentOp != NULL)
01409     {
01410         // Remember the next item in the list now, in case this one deregisters itself
01411         NextOp = (ListItemOpPtr *) IdleHighPriorityOps.GetNext(CurrentOp);
01412 
01413         // Call the handler, and if it claims idles, disable calling of low-priority handlers
01414         if (CurrentOp->pOp->OnIdleEvent())
01415         {
01416             MoreIdlesNeeded = TRUE; // we need more idles
01417             CallLowPriorityHandlers = FALSE;
01418         }
01419 
01420         CurrentOp = NextOp;
01421     }
01422 
01423     // If nobody objects to a low-priority pass, do one
01424     if (CallLowPriorityHandlers)
01425     {
01426         CurrentOp = (ListItemOpPtr*)IdleLowPriorityOps.GetHead();
01427 
01428         while (CurrentOp != NULL)
01429         {
01430             // Remember the next item in the list now, in case this one deregisters itself
01431             NextOp = (ListItemOpPtr *) IdleLowPriorityOps.GetNext(CurrentOp);               
01432             MoreIdlesNeeded = MoreIdlesNeeded || CurrentOp->pOp->OnIdleEvent();
01433             CurrentOp = NextOp;
01434         }
01435     }
01436 
01437     return MoreIdlesNeeded;
01438 }
01439 
01440 
01441 
01442 /********************************************************************************************
01443 
01444 >   BOOL Application::OnIdle(BOOL IdleRedraw)
01445 
01446     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
01447     Created:    12/9/94
01448     Inputs:     IdleRedraw - TRUE if background redrawing should be performed.
01449     Returns:    TRUE if more idle messages are needed.
01450                 FALSE if no more idle processing is needed 
01451     Purpose:    This is where idle events are recived by the kernel.
01452     Errors:     -
01453     SeeAlso:    CCamApp::OnIdle
01454 
01455 ********************************************************************************************/
01456 
01457 BOOL Application::OnIdle(BOOL IdleRedraw)
01458 {
01459     // If the system is disabled (due to an error box being up) we must not do anything,
01460     // as we definitely do not want to cause a re-entrant error situation!
01461     if( CCamApp::IsDisabled() )
01462         return(TRUE);
01463 
01464     Tool* CurTool=Tool::GetCurrent();
01465     BOOL  Idles  =FALSE;
01466 
01467     if (IdleRedraw)
01468         if (ServiceRendering())
01469             Idles=TRUE;
01470 
01471     if (CurTool!=NULL)
01472         if (CurTool->OnIdle())
01473             Idles=TRUE;
01474 
01475     if (CallIdleProcessors())
01476         Idles=TRUE;
01477 
01478 //  ControlList::Idle();
01479 
01480 //  Idles=TRUE;
01481 
01482     return Idles;
01483 }
01484 
01485 /***********************************************************************************************
01486 
01487 >   BOOL Application::CreateDragTargets()
01488     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
01489     Created:    2/11/94
01490     Inputs:     -
01491     Outputs:    -
01492     Returns:    -
01493     Purpose:    tell all documents to create a drag target for each of their views 
01494     SeeAlso:    -
01495 *********************************************************************************************/
01496 
01497 
01498 BOOL Application::CreateDragTargets(DragInformation * DragInfo)
01499 {
01500     Document* pDocument = (Document*) Documents.GetHead();
01501     while (pDocument != NULL)
01502     {
01503         pDocument->CreateDragTargets(DragInfo);
01504 
01505         pDocument = (Document*) Documents.GetNext(pDocument);
01506     }
01507     return TRUE;
01508 }
01509 
01510 /***********************************************************************************************
01511 
01512 >   void Application::ShowViewScrollers(BOOL fIsVisible)
01513     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
01514     Created:    2/11/94
01515     Inputs:     -
01516     Outputs:    -
01517     Returns:    -
01518     Purpose:    Show or Hide all Scrollers on all Views on all Documents
01519     SeeAlso:    -
01520 *********************************************************************************************/
01521 
01522 
01523 void Application::ShowViewScrollers(BOOL fIsVisible)
01524 {
01525     Document* pDocument = (Document*) Documents.GetHead();
01526     while (pDocument != NULL)
01527     {
01528         pDocument->ShowViewScrollers(fIsVisible);
01529         pDocument = (Document*) Documents.GetNext(pDocument);
01530     }
01531 
01532 }
01533 
01534 
01535 /********************************************************************************************
01536 >   BOOL Application::UpdateStatusBarText(String_256* text, BOOL PrefixSelDesc=TRUE)
01537 
01538     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
01539     Created:    16/11/94
01540     Inputs:     ptext         - text to go in the specified status bar pane
01541                 PrefixSelDesc - TRUE to prefix the displayed text with a selection description
01542     Returns:    FALSE if falied
01543     Purpose:    Just interfaces to similar StatusLine funtion
01544     Notes:      This has been bodged by Jason to return without an error if the status line has
01545                 not yet been initialised as the progress system is tries to use it in this state!
01546 ********************************************************************************************/
01547 
01548 BOOL Application::UpdateStatusBarText(String_256* ptext, BOOL PrefixSelDesc)
01549 {
01550     StatusLine* pStatusLine = GetpStatusLine();
01551 
01552 //  ERROR2IF(pStatusLine==NULL,FALSE,"Application::UpdateStatusBarText() - pStatusLine==NULL");
01553     if (pStatusLine==NULL)
01554         return FALSE;   
01555     
01556     return pStatusLine->UpdateText(ptext,PrefixSelDesc);
01557 }
01558 
01559 
01560 
01561 /********************************************************************************************
01562 >   BOOL Application::LockOutControlHelp ()
01563 
01564     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
01565     Created:    19/4/2000
01566     Inputs:     N/A
01567     Returns:    Whatever our helper function feels like.
01568     Purpose:    Just interfaces to similar StatusLine funtion
01569     Notes:      This is really a bodge to fix the annoying features of camelot that persist
01570                 in infinitely updating the status bar with different text.  At present, this
01571                 occurs in two places (known to me):  the transparency slider and when typing
01572                 text within the text tool.  This function locks the status bar to prevent
01573                 these guys such annoying things.  NOTE:  if one calls this - then you MUST
01574                 also have a matching Application::UnlockControlHelp () somewhere; cause
01575                 otherwise camelots status bar will never again update itself ....
01576 
01577                 NOTE:  this function can also be used to prevent the status bar from updating
01578                        at all (as in the solution to the text tool probs) ....  
01579     See Also:   Application::UnlockControlHelp ()
01580 ********************************************************************************************/
01581 
01582 BOOL Application::LockOutControlHelp ()
01583 {
01584     StatusLine* pStatusLine = GetpStatusLine ();
01585 
01586     if (pStatusLine==NULL)
01587         return FALSE;   
01588 
01589     return (pStatusLine->LockOutControlHelp ());
01590 }
01591 
01592 
01593 
01594 /********************************************************************************************
01595 >   BOOL Application::UnlockControlHelp ()
01596 
01597     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
01598     Created:    19/4/2000
01599     Inputs:     N/A
01600     Returns:    Whatever our helper function feels like.
01601     Purpose:    Just interfaces to similar StatusLine funtion
01602     Notes:      See Application::LockOutControlHelp ()
01603     See Also:   Application::LockOutControlHelp ()
01604 ********************************************************************************************/
01605 
01606 BOOL Application::UnlockControlHelp ()
01607 {
01608     StatusLine* pStatusLine = GetpStatusLine ();
01609 
01610     if (pStatusLine==NULL)
01611         return FALSE;   
01612 
01613     return (pStatusLine->UnlockControlHelp ());
01614 }
01615 
01616 
01617 
01618 /********************************************************************************************
01619 >   CCStatusBar* Application::GetpCCStatusBar()
01620 
01621     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
01622     Created:    22/11/94
01623     Purpose:    return pointer to CMainFrame::CCStatusBar
01624     Returns:    pointer to CMainFrame::CCStatusBar else NULL if error (see Errors)
01625 ********************************************************************************************/
01626 
01627 CCStatusBar* Application::GetpCCStatusBar()
01628 {
01629     PORTNOTETRACE("other","Application::GetpCCStatusBar - do nothing");
01630 #ifndef EXCLUDE_FROM_XARALX
01631     CMainFrame* mfwindow = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
01632     ERROR2IF(mfwindow==NULL,NULL,"Application::GetpCCStatusBar() - mfwindow==NULL");
01633 
01634     return mfwindow->GetpCCStatusBar();
01635 #else
01636     return NULL;
01637 #endif
01638 }
01639 
01640 
01641 /********************************************************************************************
01642 >   StatusLine* Application::GetpStatusLine()
01643 
01644     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
01645     Created:    22/11/94
01646     Returns:    Pointer to CMainFrame::StatusLine else NULL if error (or not initialised)
01647     Notes:      This has been bodged by Jason to return without an error if the mainframe has
01648                 not yet been initialised as the progress system is tries to use it in this state!
01649 ********************************************************************************************/
01650 
01651 StatusLine* Application::GetpStatusLine()
01652 {
01653     return StatusLine::Get();
01654 }
01655 
01656 
01658 // Comments for the help system...
01659 
01660 /***********************************************************************************************
01661 
01662 >   inline ColourManager *Application::FindTheColourManager(void)
01663 
01664     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01665     Created:    11/5/94
01666     Inputs:     -
01667     Outputs:    -
01668     Returns:    A pointer to the system Colour manager object
01669     Purpose:    To find the single 'global' ColourManager instance in Camelot
01670     SeeAlso:    ColourManager
01671 
01672 ***********************************************************************************************/
01673 
01674 
01675 
01676 /***********************************************************************************************
01677 
01678 >   void Application::DumpAllOps(Document* pDoc = NULL)
01679 
01680     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
01681     Created:    15/8/95
01682     Inputs:     pDoc points to the document containing the operation histor to dump, NULL for
01683                 selected doc.
01684     Outputs:    Displays debug info
01685     Returns:    -
01686     Purpose:    Dumps information about all the operations in the history list to the debugger
01687     SeeAlso:    Application::DumpLastOp
01688 
01689 ***********************************************************************************************/
01690 void Application::DumpAllOps(Document* pDoc)
01691 {
01692     PORTNOTETRACE("other","Application::DumpAllOps - do nothing");
01693 #ifndef EXCLUDE_FROM_XARALX
01694 #if DEBUG_TREE
01695     if (pDoc == NULL)
01696         pDoc = Document::GetSelected();
01697 
01698     pDoc->GetOpHistory().DumpAll();
01699 #endif
01700 #endif
01701 }
01702 
01703 
01704 
01705 /***********************************************************************************************
01706 
01707 >   void Application::DumpLastOp(Document* pDoc = NULL)
01708 
01709     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
01710     Created:    15/8/95
01711     Inputs:     pDoc points to the document containing the operation histor to dump, NULL for
01712                 selected doc.
01713     Outputs:    Displays debug info
01714     Returns:    -
01715     Purpose:    Dumps information about the last operation in the history list to the debugger
01716     SeeAlso:    Application::DumpAllOps
01717 
01718 ***********************************************************************************************/
01719 void Application::DumpLastOp(Document* pDoc)
01720 {
01721     PORTNOTE("other","Application::DumpLastOp - do nothing")
01722 #ifndef EXCLUDE_FROM_XARALX
01723 #if DEBUG_TREE
01724     if (pDoc == NULL)
01725         pDoc = Document::GetSelected();
01726 
01727     pDoc->GetOpHistory().DumpLast();
01728 #endif
01729 #endif
01730 }
01731 
01732 
01733 
01734 /***********************************************************************************************
01735 
01736 >   void Application::DumpTree(BaseDocument* pDoc = NULL)
01737 
01738     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
01739     Created:    15/8/95
01740     Inputs:     pDoc points to the document containing the operation histor to dump, NULL for
01741                 selected doc.
01742     Outputs:    Displays debug info
01743     Returns:    -
01744     Purpose:    Dumps information about the document tree to the debugger
01745     SeeAlso:    Application::DumpAllOps
01746 
01747 ***********************************************************************************************/
01748 void Application::DumpTree(BaseDocument* pDoc)
01749 {
01750 PORTNOTE("other","Removed DebugTreeDlg usage")
01751 #ifndef EXCLUDE_FROM_XARALX
01752 #if DEBUG_TREE
01753     DebugTreeDlg::TweeDump(pDoc);
01754 #endif
01755 #endif
01756 }
01757 
01758 
01759 
01760 /***********************************************************************************************
01761 
01762 >   CCPen* Application::GetPressurePen()
01763 
01764     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01765     Created:    24/1/97
01766 
01767     Returns:    NULL, or a pointer to the application wide instance of the pressure pen
01768     Purpose:    Dumps information about the document tree to the debugger
01769     SeeAlso:    Application::DumpAllOps
01770 
01771 ***********************************************************************************************/
01772 
01773 // WEBSTER - markn 25/4/97
01774 // No pen stuff required in Webster
01775 // Taken out by vector stroking code Neville 2/10/97
01776 #ifdef VECTOR_STROKING
01777 
01778 CCPen* Application::GetPressurePen()
01779 {
01780     // If we haven't tried initialising the pen, then do so now.
01781     // (i.e. this is demand-initialised)
01782     if (!PenInitialised)
01783     {
01784         PenInitialised = TRUE;
01785         PressurePen = CCPen::Init();    // This will return NULL if it fails, but that's OK
01786     }
01787 
01788     return(PressurePen);
01789 }
01790 
01791 #endif // VECTOR_STROKING
01792 
01793 
01794 /***********************************************************************************************
01795 
01796 >   ObjectCache* Application::GetObjectCache()
01797 
01798     Author:     Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
01799     Created:    28/01/97
01800     Inputs:     -
01801     Outputs:    -
01802     Returns:    a pointer to the cache object
01803     Purpose:    return a pointer to the cache object so that external objects can add object in 
01804                 the cache.
01805     SeeAlso:    Application::Init(), Application::DeInit()
01806 
01807 ***********************************************************************************************/
01808 
01809 ObjectCache* Application::GetObjectCache()
01810 {
01811     return m_pObjCache;
01812 }
01813 
01814 
01815 /********************************************************************************************
01816 
01817 >   void DocView::RegenerateNodesInList()
01818 
01819     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
01820     Created:    1/6/99
01821     Inputs:     The node to add to the list
01822     Outputs:    -
01823     Returns:    -
01824     Purpose:    Calls all of the regeneration functions of the nodes in the list
01825     Errors:     -
01826     SeeAlso:    -
01827 
01828 ********************************************************************************************/
01829 
01830 void Application::RegenerateNodesInList()
01831 {
01832     if (RegenList.IsEmpty())
01833         return;
01834 
01835     NodeListItem *pItem = (NodeListItem *)RegenList.GetHead();
01836 
01837     while (pItem)
01838     {
01839         if (pItem->pNode)
01840         {
01841             if (pItem->pNode->GetHiddenCnt()==0)
01842             {
01843                 if (pItem->pNode->IsBounded())
01844                 {
01845                     ((NodeRenderableBounded *)pItem->pNode)->InvalidateBoundingRect();
01846                 }
01847 
01848                 pItem->pNode->RegenerateNode(NULL, FALSE, FALSE);
01849                 
01850                 if (pItem->pNode->IsBounded())
01851                 {
01852                     ((NodeRenderableBounded *)pItem->pNode)->InvalidateBoundingRect();
01853                 }
01854             }
01855         }
01856 
01857         pItem = (NodeListItem *)RegenList.GetNext(pItem);
01858     }
01859 
01860     RegenList.DeleteAll();
01861 }
01862 
01863 /********************************************************************************************
01864 
01865 >   BOOL Application::AddNodeToRegenList(Node * pNode)
01866 
01867     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
01868     Created:    1/6/99
01869     Inputs:     The node to add to the list
01870     Outputs:    -
01871     Returns:    -
01872     Purpose:    Adds a node to the regeneration list
01873     Errors:     -
01874     SeeAlso:    -
01875 
01876 ********************************************************************************************/
01877 
01878 BOOL Application::AddNodeToRegenList(Node * pNode)
01879 {
01880     // check to see if the node is already in the list
01881     NodeListItem * pItem = (NodeListItem *)RegenList.GetHead();
01882 
01883     BOOL bAdd = TRUE;
01884 
01885     while (pItem)
01886     {
01887         if (pItem->pNode == pNode)
01888         {
01889             bAdd = FALSE;
01890             break;
01891         }
01892 
01893         pItem = (NodeListItem *)RegenList.GetNext(pItem);
01894     }
01895 
01896     if (!bAdd)
01897         return TRUE;
01898 
01899     pItem = new NodeListItem(pNode);
01900 
01901     ERROR2IF(!pItem, FALSE, "Memory Error !");
01902 
01903     RegenList.AddTail(pItem);
01904 
01905     return TRUE;
01906 }
01907 
01908 
01909 /********************************************************************************************
01910 
01911 >   BOOL Application::ChangeRealDownloadBrowserOtion (HKEY rootKey, HKEY key, BOOL changeVal)
01912 
01913     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
01914     Created:    15/9/2000
01915     Inputs:     rootKey - HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER (not checked)
01916                 key     - already opened subpath key (to realdownload directory)
01917                 changeVal - value to change the realdownload "EnableBrowserWatch" key to
01918     Outputs:    -
01919     Returns:    TRUE if changed value, FALSE otherwise
01920     Purpose:    Change the RealDownload "EnableBrowserWatch" key value
01921     Errors:     -
01922     SeeAlso:    -
01923 
01924 ********************************************************************************************/
01925 
01926 PORTNOTE("other","Removed HKEY usage")
01927 #ifndef EXCLUDE_FROM_XARALX
01928 BOOL Application::ChangeRealDownloadBrowserOtion (HKEY rootKey, HKEY key, BOOL changeVal)
01929 {
01930     LPCTSTR path = "software\\realnetworks\\realdownload\\";
01931     
01932     const INT32 buf_size = 256;
01933     DWORD dwIndex   = 0;                // index of subkey to enumerate 
01934     TCHAR Name[buf_size];               // buffer for subkey name
01935     DWORD cbName    = buf_size;         // size of subkey buffer 
01936     TCHAR Class[buf_size];              // buffer for class string 
01937     DWORD cbClass   = buf_size;         // size of class buffer 
01938     FILETIME ftLastWriteTime;           // time key last written to
01939 
01940     BOOL returnVal = FALSE;
01941 
01942     INT32 nResult = ERROR_SUCCESS;
01943 //  String_256 KeyName;
01944 
01945     do
01946     {
01947         // reset the string sizes to their maximum for receiving data
01948         cbName  = buf_size;
01949         cbClass = buf_size;
01950 
01951         // Does another sub-key exist?
01952         nResult = ::RegEnumKeyEx(key, dwIndex, Name, &cbName, NULL, Class, &cbClass, &ftLastWriteTime);
01953 
01954         if (nResult == ERROR_SUCCESS)
01955         {
01956             // weve hit a real download version number - scan it ....
01957 
01958             char subpath [100];
01959             char newpath [200];
01960             
01961             sprintf (subpath, "%s", Name);
01962             sprintf (newpath, "%s%s", path, subpath);
01963 
01964             HKEY subkey = OpenRegKey (rootKey, newpath);
01965 
01966             DWORD newval = (DWORD) changeVal;
01967 
01968             if (subkey)
01969             {   
01970                 DWORD type, dataVal, dataSize;
01971 
01972                 if (RegQueryValueEx (subkey, "EnableBrowserWatch", NULL, &type, (unsigned char*) &dataVal, &dataSize) == ERROR_SUCCESS)
01973                 {
01974                     BOOL currentVal = (BOOL) dataVal;
01975 
01976                     if (currentVal == TRUE)
01977                     {
01978                         if (RegSetValueEx (subkey, "EnableBrowserWatch", NULL, REG_DWORD, (unsigned char*) &newval, sizeof (newval)) == ERROR_SUCCESS)
01979                         {
01980                             RegCloseKey (subkey);
01981                             return (TRUE);
01982                         }
01983                         else
01984                         {
01985                             RegCloseKey (subkey);
01986                             return (FALSE);
01987                         }
01988                     }
01989                     else if ((currentVal == FALSE) && (changeVal == TRUE))      // were resetting to TRUE
01990                     {
01991                         if (RegSetValueEx (subkey, "EnableBrowserWatch", NULL, REG_DWORD, (unsigned char*) &newval, sizeof (newval)) == ERROR_SUCCESS)
01992                         {
01993                             RegCloseKey (subkey);
01994                             return (TRUE);
01995                         }
01996                         else
01997                         {
01998                             RegCloseKey (subkey);
01999                             return (FALSE);
02000                         }
02001                     }
02002                 }
02003 
02004                 RegCloseKey (subkey);
02005             }
02006             
02007             //          KeyName = Name;
02008         }
02009 
02010         // increment our indexing item and try again
02011         dwIndex ++;
02012 
02013     } while (nResult == ERROR_SUCCESS);
02014 
02015     if (DisabledRealDownload)
02016     {
02017         return (TRUE);
02018     }
02019     else
02020     {
02021         return (FALSE);
02022     }
02023 
02024     return false;
02025 }
02026 #endif
02027 
02028 /********************************************************************************************
02029 
02030 >   void Application::CheckRealDownload ()
02031 
02032     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
02033     Created:    15/9/2000
02034     Inputs:     -
02035     Outputs:    -
02036     Returns:    -
02037     Purpose:    Disables RealDownload browser integration if necessary - to prevent camelot
02038                 from dying when downloading files that are registered with RealDownload.
02039     Errors:     -
02040     SeeAlso:    -
02041 
02042 ********************************************************************************************/
02043 
02044 void Application::CheckRealDownload ()
02045 {
02046     PORTNOTE("other","Application::CheckRealDownload - do nothing")
02047 #ifndef EXCLUDE_FROM_XARALX
02048     key = OpenRegKey (HKEY_CURRENT_USER, "software\\realnetworks\\realdownload\\");
02049 
02050     if (key)
02051     {
02052         // disable it ....
02053         DisabledRealDownload = ChangeRealDownloadBrowserOtion (HKEY_CURRENT_USER, key, FALSE);
02054 
02055         if (DisabledRealDownload)
02056         {
02057             key2 = OpenRegKey (HKEY_LOCAL_MACHINE, "software\\realnetworks\\realdownload\\");
02058 
02059             if (key2)
02060             {
02061                 // disable it ....
02062                 ChangeRealDownloadBrowserOtion (HKEY_LOCAL_MACHINE, key2, FALSE);
02063             }
02064         }
02065     }
02066     else
02067     {
02068         key2 = OpenRegKey (HKEY_LOCAL_MACHINE, "software\\realnetworks\\realdownload\\");
02069 
02070         if (key2)
02071         {
02072             // disable it ....
02073             DisabledRealDownload = ChangeRealDownloadBrowserOtion (HKEY_LOCAL_MACHINE, key2, FALSE);
02074         }
02075     }
02076 #endif
02077 }
02078 
02079 
02080 /********************************************************************************************
02081 
02082 >   void Application::ResetRealDownload ()
02083 
02084     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
02085     Created:    15/9/2000
02086     Inputs:     -
02087     Outputs:    -
02088     Returns:    -
02089     Purpose:    Re-enables RealDownload browser integration if we disabled it.
02090     Errors:     -
02091     SeeAlso:    -
02092 
02093 ********************************************************************************************/
02094 
02095 void Application::ResetRealDownload ()
02096 {
02097     PORTNOTE("other","Application::ResetRealDownload - do nothing")
02098 #ifndef EXCLUDE_FROM_XARALX
02099     if (DisabledRealDownload)
02100     {
02101         if (key)
02102         {
02103             // both HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE could have been used, reset both ....
02104 
02105             ChangeRealDownloadBrowserOtion (HKEY_CURRENT_USER, key, TRUE);
02106             RegCloseKey (key);
02107 
02108             if (key2)
02109             {
02110                 ChangeRealDownloadBrowserOtion (HKEY_LOCAL_MACHINE, key2, TRUE);
02111                 RegCloseKey (key2);
02112             }
02113             
02114             DisabledRealDownload = FALSE;
02115         }
02116         else if (key2)
02117         {
02118             // only HKEY_LOCAL_MACHINE will have been used, reset it ....
02119 
02120             ChangeRealDownloadBrowserOtion (HKEY_LOCAL_MACHINE, key2, TRUE);
02121             RegCloseKey (key2);
02122 
02123             DisabledRealDownload = FALSE;
02124         }
02125     }
02126 #endif
02127 }
02128 
02129 
02130 
02131 
02132 /********************************************************************************************
02133 
02134 >   BOOL Application::GetConvertToEditableShapesDPI (INT32* pValue)
02135 
02136     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
02137     Created:    13/11/2000
02138     Inputs:     -
02139     Outputs:    -
02140     Returns:    -
02141     Purpose:    Wrapper function for gaining access to convert to editable shapes DPI
02142                 (as requested by karim).
02143     Errors:     -
02144     SeeAlso:    -
02145 
02146 ********************************************************************************************/
02147 
02148 BOOL Application::GetConvertToEditableShapesDPI (INT32* pValue)
02149 {
02150     return (Camelot.GetPrefValue(TEXT("Displays"),TEXT("CompCToEDPI"),pValue));
02151 }
02152 
02153 
02154 
02155 

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