sginit.cpp

Go to the documentation of this file.
00001 // $Id: sginit.cpp 1464 2006-07-18 12:32:26Z gerry $
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 // init.cpp - Centralised initialisation for galleries
00099 
00100 #include "camtypes.h"
00101 #include "sginit.h"
00102 
00103 //#include "app.h"      // For GetApplication() - in camtypes.h [AUTOMATICALLY REMOVED]
00104 #include "layergal.h"   // For OpDisplayLayerGallery et al
00105 #include "newcol.h"     // For NewColourDlg
00106 //#include "sgallery.h" // For SGalleryOptionsDlg and SGallerySearchDlg - in camtypes.h [AUTOMATICALLY REMOVED]
00107 #include "sgbitmap.h"   // For OpDisplayBitmapGallery
00108 #include "sgcolour.h"   // For OpDisplayColourGallery && ColourSGallery::Init
00109 //#include "sgfonts.h"  // For OpDisplayFontsGallery
00110 //#include "sglcart.h"  // For OpDisplayLibClipartGallery et al
00111 //#include "sglfills.h" // For OpDisplayLibFillsGallery
00112 #include "sgline.h"     // For OpDisplayLineGallery
00113 #include "ngdialog.h"   // For OpDisplayNameGallery & OpNGPropertyIndexDesc
00114 //#include "sgscan.h"       // For Library::InitLibPrefs() - in camtypes.h [AUTOMATICALLY REMOVED]
00115 #include "layerprp.h"   // For LayerPropertiesDlg::Init()
00116 #include "aprps.h"
00117 //#include "frameops.h" // OpGrabFrame::Init()
00118 
00119 // Taken out by vector stroking code Neville 2/10/97
00120 #ifdef VECTOR_STROKING
00121 //#include "sglinepr.h" // For SGalleryLinePropertiesDlg::Init()
00122 #endif
00123 
00124 DECLARE_SOURCE("$Revision: 1464 $");
00125 
00126 CC_IMPLEMENT_MEMDUMP(SGInit, CC_CLASS_MEMDUMP)
00127 
00128 #define new CAM_DEBUG_NEW
00129                                                        
00130 
00131 #ifndef EXCLUDE_GALS
00132 
00133 /********************************************************************************************
00134 
00135 >   static BOOL SGInit::Init(void)
00136 
00137     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00138     Created:    21/2/94
00139     Purpose:    Initialises the supergallery system
00140                 (Registers Ops for displaying galleries, reads preferences, etc)
00141 
00142 ********************************************************************************************/
00143 
00144 BOOL SGInit::Init(void)
00145 {
00146     // Declare the global supergallery preferences...
00147     Camelot.DeclareSection(TEXT("Displays"), 8);
00148     Camelot.DeclarePref(TEXT("Displays"), TEXT("FixedGalleryColours"),
00149                             &SuperGallery::UseFixedColourSet);
00150 
00152     // I'm putting this in here - cause I can't find a better place - and seeing as these
00153     // are mostly display preferences anyway, it makes sense
00154     static INT32 defaultCompoundToEditableShapesBitmapDPI = 96;
00155     Camelot.DeclarePref(TEXT("Displays"), TEXT("CompCToEDPI"), &defaultCompoundToEditableShapesBitmapDPI, 10, 1000);
00157 
00158     // And initialise each of the derived SuperGallery systems...
00159     BOOL ok = ( SGalleryOptionsDlg::Init()          &&
00160                 SGallerySearchDlg::Init()           &&
00161                 SGallerySortDlg::Init()             &&
00162 
00163 PORTNOTE("galleries", "Excluded various galleries")
00164 #ifndef STANDALONE
00165 #ifndef EXCLUDE_FROM_XARALX
00166                 OpDisplayFrameGallery::Init()       &&
00167 #endif // EXCLUDE_FROM_XARALX
00168                 OpLayerGalChange::Init()            &&
00169 #ifndef EXCLUDE_FROM_XARALX
00170                 OpGrabFrame::Init()                 &&
00171 #endif // EXCLUDE_FROM_XARALX
00172 // WEBSTER - markn 15/1/97
00173 // Removed some init functions that no longer exist
00174 #ifndef WEBSTER
00175                 OpDisplayLayerGallery::Init()       &&
00176                 LayerNameDlg::Init()                &&
00177                 LayerPropertyTabsDlg::Init()        &&              
00178 
00179                 OpDisplayLineGallery::Init()        &&
00180 #ifdef _DEBUG // For now name gallery only on debug builds
00181                 OpDisplayNameGallery::Init()        &&
00182 #endif
00183 #endif // WEBSTER               
00184 // Taken out by vector stroking code Neville 2/10/97
00185 #ifndef EXCLUDE_FROM_XARALX
00186 #ifdef VECTOR_STROKING
00187                 SGalleryLinePropertiesDlg::Init()   &&
00188 #endif // VECTOR_STROKING   
00189 #endif          
00190                 ColourSGallery::Init()              &&
00191                 OpDisplayColourGallery::Init()      &&
00192                 ColourNameDlg::Init()               &&
00193                 NewColourDlg::Init()                &&
00194                 OpDisplayBitmapGallery::Init()      &&
00195 #ifndef EXCLUDE_FROM_XARALX
00196                 OpDisplayFontsGallery::Init()       &&
00197 #endif // EXCLUDE_FROM_XARALX
00198 #endif // STANDALONE
00199 #ifndef EXCLUDE_FROM_XARALX
00200                 LibClipartSGallery::Init()          &&
00201                 OpDisplayLibClipartGallery::Init()  &&
00202 
00203 #ifndef STANDALONE
00204                 LibFillsSGallery::Init()            &&
00205                 OpDisplayLibFillsGallery::Init()    &&
00206 #endif
00207 
00208                 Library::InitLibPrefs() &&
00209 #endif // EXCLUDE_FROM_XARALX
00210                 TRUE
00211             );
00212     
00213     return ok;
00214 }
00215 
00216 
00217 /********************************************************************************************
00218 
00219 >   static void SGInit::DeInit(void)
00220 
00221     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00222     Created:    21/2/94
00223     Purpose:    De-Initialises the supergallery system
00224 
00225 ********************************************************************************************/
00226 
00227 void SGInit::DeInit(void)
00228 {
00229 // WEBSTER - markn 15/1/97
00230 // Removed some deinit functions that no longer exist
00231 
00232     // Nothing much to deinit as yet
00233 PORTNOTE("galleries", "disabled various galleries deinit")
00234 #ifndef STANDALONE
00235 #ifndef WEBSTER
00236     LayerPropertyTabsDlg::Deinit(); 
00237 #endif  // WEBSTER  
00238     GIFAnimationPropertyTabsDlg::Deinit();
00239 #ifndef EXCLUDE_FROM_XARALX
00240     OpGrabFrame::DeInit();
00241 #endif
00242 #endif
00243 }
00244 
00245 #endif
00246 
00247 /********************************************************************************************
00248 
00249 >   static void SGInit::UpdateGalleryButton(char *OpToken, BOOL IsVisible)
00250 
00251     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00252     Created:    21/2/94
00253     Purpose:    Helper function for gallery display Ops - whenever the gallery visibility
00254                 changes, this should be called to update the button for it
00255 
00256 ********************************************************************************************/
00257 
00258 void SGInit::UpdateGalleryButton(ResourceID OpToken, BOOL IsVisible)
00259 {
00260     // Update all button controls that invoke this Op
00261     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OpToken);
00262     if (pOpDesc!=NULL)
00263     {
00264         // Found the opdescriptor. Now find all the gadgets associated with it
00265         List Gadgets;
00266         if (pOpDesc->BuildGadgetList(&Gadgets))
00267         {
00268             // Found some. Set the controls accordingly
00269             GadgetListItem* pGadgetItem = (GadgetListItem*) Gadgets.GetHead();
00270 
00271             while (pGadgetItem != NULL)
00272             {
00273                 // Set the gadget
00274                 pGadgetItem->pDialogOp->SetBoolGadgetSelected(pGadgetItem->gidGadgetID,
00275                                                                     IsVisible);
00276                 // Find the next gadget
00277                 pGadgetItem = (GadgetListItem*) Gadgets.GetNext(pGadgetItem);
00278             }
00279     
00280             // Clean out the list
00281             Gadgets.DeleteAll();
00282         }
00283     }
00284 }

Generated on Sat Nov 10 03:46:53 2007 for Camelot by  doxygen 1.4.4