bars.h

Go to the documentation of this file.
00001 // $Id: bars.h 1386 2006-06-28 17:49:55Z 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 // Header for kernel bar implementation
00099 
00100 #ifndef INC_BARS
00101 #define INC_BARS
00102 
00103 //#include "pump.h"
00104 #include "dialogop.h"
00105 //#include "list.h"
00106 //#include "ccfile.h"
00107 #include "dockbar.h"
00108 //#include "opdesc.h"
00109 //#include "barmsg.h"
00110 
00111 
00112 // Markn 7-3-97
00113 // DEFAULT_TOOL_INFOBAR_SLOT defines the default tool info bar slot.  The infobar should always go in the slot underneath
00114 // the last bar of the program.  In CorelXARA v1.5, this slot was slot 1 (i.e. underneath the Standard & Gallery bars,
00115 // which appeared on slot 0)
00116 //
00117 // Since the arrival of the Animation system, the new control bar has highlighted the need for an extra
00118 // slot to be used.  Instead of having to remember to change all tool bar .ini files to the new slot position,
00119 // all we have to change in the future is this constant.
00120 
00121 #define DEFAULT_TOOL_INFOBAR_SLOT 2
00122 
00123 class BarCreate;
00124 class LoadRegistryEntries;
00125 class SaveRegistryEntries;
00126 
00127 /********************************************************************************************
00128 
00129 >   class SimpleBarControl : public CCObject
00130 
00131     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00132     Created:    5/4/94
00133     Purpose:    Contains all info about the control, plus a ptr to a message handler to 
00134                 pump all the messages to.
00135 
00136 ********************************************************************************************/
00137 
00138 class  SimpleBarControl : public CCObject
00139 {
00140 public:
00141     BarControlInfo  BarCtrlInfo;
00142     OpDescriptor*   pOpDesc;
00143     UINT32          BubbleID;
00144     UINT32          StatusID;
00145 
00146     SimpleBarControl& operator=(SimpleBarControl& other)
00147     {
00148         BarCtrlInfo = other.BarCtrlInfo;
00149         pOpDesc     = other.pOpDesc;
00150         BubbleID    = other.BubbleID;
00151         StatusID    = other.StatusID;
00152 
00153         return *this;
00154     }
00155 
00156     SimpleBarControl() : BarCtrlInfo(0, 0, 0) {}
00157 };
00158 
00159 
00160 /********************************************************************************************
00161 
00162 >   class BarIten : public ListItem
00163 
00164     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00165     Created:    5/4/94
00166     Purpose:    A virtual class used for deriving all types of bar item.
00167 
00168 ********************************************************************************************/
00169 
00170 class BarItem : public ListItem
00171 {
00172     CC_DECLARE_DYNAMIC( BarItem )
00173 
00174 public:
00175     virtual BOOL Read(CCLexFile& file)  = 0;
00176     virtual BOOL Write(CCLexFile& file) = 0;
00177 
00178     virtual BOOL Read(String_256*)      = 0;
00179     virtual BOOL Write(String_256*)     = 0;
00180 };
00181 
00182 /********************************************************************************************
00183 
00184 >   class BarControlBase: public BarItem
00185 
00186     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00187     Created:    19/5/94
00188     Purpose:    Base class from which all bar control classes are derived. 
00189     
00190                 This class was created so that the new (at the time) BarToolButton would
00191                 behave correctly. It contains methods and data which used to be in the 
00192                 BarOpControl class. 
00193 
00194     SeeAlso:    BarOpControl
00195     SeeAlso:    BarToolButton
00196 
00197 ********************************************************************************************/
00198 
00199 class BarControlBase: public BarItem
00200 {
00201     CC_DECLARE_DYNAMIC( BarControlBase )
00202     
00203 public:
00204 
00205     // Called to obtain the bar items BubbleID
00206     // Note: there is no Set fn in base class cos BarControl extracts this info from the 
00207     // OpDescriptor.
00208     virtual UINT32 GetBubbleID(BOOL Horz);  
00209 
00210     // ( Bodge) Don't no what this is (If it's the status bar description then it will
00211     //  be required) ?  (Mark could you confirm this)
00212     virtual UINT32 GetStatusID(BOOL Horz); 
00213 
00214     // Set/get controls windowID 
00215     CWindowID GetWinID()              { return WinID; }
00216     virtual void SetWinID(CWindowID NewWinID) { WinID = NewWinID; }
00217 
00218 private:
00219 
00220     CWindowID WinID;  // ID of control
00221 }; 
00222 
00223 /********************************************************************************************
00224 
00225 >   class BarControl : public BarControlBase
00226 
00227     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00228     Created:    5/4/94
00229     Purpose:    This defines a control and its associated OpDescriptor within a bar.  
00230                 It holds separate horz and vert versions of the control in case the 
00231                 appearence and/or functionality changes with the orientation of the bar.
00232 
00233 ********************************************************************************************/
00234 
00235 class BarControl : public BarControlBase
00236 {
00237     CC_DECLARE_DYNAMIC( BarControl )
00238 
00239 public:
00240     BarControl()
00241     {
00242         Visible = TRUE;
00243     }
00244 
00245     BarControl( BarControl &other)
00246     {
00247         SetEnabledState(other.IsEnabled()); 
00248         SetVisibleState(other.IsVisible());
00249         Horizontal = other.Horizontal;
00250         Vertical = other.Vertical;
00251     }
00252 
00253     BarControl& operator=( BarControl &other)
00254     {
00255         SetEnabledState(other.IsEnabled());
00256         SetVisibleState(other.IsVisible());
00257         Horizontal = other.Horizontal;
00258         Vertical = other.Vertical;
00259         return *this; 
00260     }
00261     void                    SetHorzOpDesc(OpDescriptor* pHorzOpDesc);
00262     void                    SetVertOpDesc(OpDescriptor* pVertOpDesc);
00263     const SimpleBarControl* GetHorzControl() { return (&Horizontal); }
00264     const SimpleBarControl* GetVertControl() { return (&Vertical); }
00265     BarControlInfo          GetBarControlInfo(BOOL Horz);
00266     OpDescriptor*           GetOpDescriptor(BOOL Horz);
00267     UINT32                  GetBubbleID(BOOL Horz);  
00268     UINT32                  GetStatusID(BOOL Horz); 
00269 
00270     BOOL                    Read(CCLexFile& file);
00271     BOOL                    Write(CCLexFile& file);
00272 
00273     // the new registry forms of the above functions
00274     virtual BOOL Read(String_256*);
00275     virtual BOOL Write(String_256*);
00276 
00277 //  CWindowID               GetWinID()                   { return WinID; }
00278 //  void                        SetWinID(CWindowID NewWinID) { WinID = NewWinID; }
00279     UINT32                  GetUniqueGadgetID()          { return UniqueGadgetID; }
00280     void                    SetUniqueGadgetID(UINT32 UniqueGadget) {UniqueGadgetID = UniqueGadget;}
00281 
00282     BOOL                    IsEnabled()                  { return Enabled; }
00283     BOOL                    IsVisible()                  { return Visible; }
00284     void                    SetEnabledState(BOOL enabled) {Enabled = enabled;}
00285     void                    SetVisibleState(BOOL visible) {Visible = visible;}
00286 
00287 private:
00288     // New registry based code  
00289     BOOL                    ReadSimpleBarControl(String_256 *pString, SimpleBarControl* pSBC);
00290     // older ini file based code
00291     BOOL                    ReadSimpleBarControl(CCLexFile& file,SimpleBarControl* pSBC);
00292     
00293     void                    SetOpDesc(SimpleBarControl* pSimpleBC, OpDescriptor* pOpDesc);
00294     SimpleBarControl        Horizontal;
00295     SimpleBarControl        Vertical;
00296 
00297     UINT32  UniqueGadgetID; // Because bars can have controls taken from more that one resource
00298                             // the ControlID cannot be assumed to be unique. The UniqueGadgetID
00299                             // is filled in when a bar is created (in the oil layer) and given
00300                             // to the control. Before an OpDescriptor control message is sent 
00301                             // the UniqueGadgetID is mapped to the controlID and it is the 
00302                             // ControlID which will be found in the messages GadgetID field. 
00303 
00304     BOOL    Enabled;        // Current gadget enabled state. This needs to be cached to reduce
00305                             // the number of Enable messages we need to send to controls during 
00306                             // idle time, 
00307 
00308     BOOL    Visible;        // To stop the resuffle HideDisableGadgetAndResuffleBar and
00309                             // ShowEnableGadgetAndResuffleBar from performing their operation
00310                             // on a single controls more than once (once one of these have
00311                             // already been applied)
00312 
00313 //  CWindowID               WinID;
00314 };
00315 
00316 
00317 /********************************************************************************************
00318 
00319 >   class BarToolButton : public BarControlBase
00320 
00321     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00322     Created:    5/5/94
00323     Purpose:    This defines a tool button used within a ToolBarOp.  It is different from a 
00324                 BarControl in that it has no associated OpDescriptor and is not specified
00325                 in a resource.
00326 
00327 ********************************************************************************************/
00328 
00329 enum BitmapType { Active, Inactive }; 
00330 
00331 class BarToolButton : public BarControlBase
00332 {
00333     CC_DECLARE_DYNAMIC( BarToolButton )
00334 
00335 public:
00336 
00337     // Default constructor
00338     BarToolButton();
00339 
00340 // I don't no why these methods were in this class as BarToolButtons are not 
00341 // ever read from a file I don't think (Mark could you confirm this)
00342     BOOL    Read(CCLexFile&)            { return TRUE; }
00343     BOOL    Write(CCLexFile&)           { return TRUE; }
00344 
00345     // the new registry forms of the above functions
00346     virtual BOOL    Read(String_256 *) { return TRUE; }
00347     virtual BOOL    Write(String_256 *) { return TRUE; }
00348 
00349     UINT32  GetToolID()                 { return ToolID; }
00350     void    SetToolID(UINT32 ThisToolID)    {ToolID = ThisToolID;}
00351                                  
00352     // Returns the resource ID of the button's Bubble help string
00353     UINT32  GetBubbleID(BOOL)           { return BubbleID;}  
00354     void    SetBubbleID(UINT32 Id)      { BubbleID = Id;}
00355 
00356     UINT32  GetStatusID(BOOL)           { return StatusID; }
00357     void    SetStatusID(UINT32 Id)      { StatusID  = Id;}
00358 
00359     UINT32    GetBitmap(BitmapType Type);
00360     void    SetBitmap(BitmapType Type, UINT32 ThisBitmap);
00361 
00362 private:
00363     UINT32  ToolID;         // This is the ID that is placed into the GadgetID field of the
00364                             // message passed to the message handler of the ToolBarOp that
00365                             // contains this control (if you follow me).
00366                             // The ToolID of the tool that this control represents is used.
00367 
00368     UINT32  Bitmap;         // This is the bitmap displayed when the tool is unselected 
00369     UINT32  BitmapActive;   // This is the bitmap displayed when the tool is selected
00370 
00371     UINT32  BubbleID;       // Resource ID of the bubble help string for both horizontal 
00372                             // and vertical bars.
00373 
00374     UINT32  StatusID;
00375 };
00376 
00377 
00378 /********************************************************************************************
00379 
00380 >   class DDeckerTop : public BarItem
00381 
00382     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00383     Created:    5/4/94
00384     Purpose:    Defines the start of the top row of double decker bar controls
00385 
00386 ********************************************************************************************/
00387 
00388 class DDeckerTop : public BarItem
00389 {
00390     CC_DECLARE_DYNAMIC( DDeckerTop )
00391 
00392 public:
00393     BOOL Read(CCLexFile&)           { return TRUE; }
00394     BOOL Write(CCLexFile& file);
00395 
00396     virtual BOOL Read(String_256*)          { return TRUE; }
00397     virtual BOOL Write(String_256*);
00398 };
00399 
00400 
00401 /********************************************************************************************
00402 
00403 >   class DDeckerBottom : public BarItem
00404 
00405     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00406     Created:    5/4/94
00407     Purpose:    Defines the start of the bottom row of double decker bar controls
00408 
00409 ********************************************************************************************/
00410 
00411 class DDeckerBottom : public BarItem
00412 {
00413     CC_DECLARE_DYNAMIC( DDeckerBottom )
00414 
00415 public:
00416     BOOL Read(CCLexFile&)           { return TRUE; }
00417     BOOL Write(CCLexFile& file);
00418 
00419     virtual BOOL Read(String_256*)          { return TRUE; }
00420     virtual BOOL Write(String_256*);
00421 };
00422 
00423 
00424 /********************************************************************************************
00425 
00426 >   class DDeckerEnd : public BarItem
00427 
00428     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00429     Created:    5/4/94
00430     Purpose:    Defines the end of a row of double decker bar controls
00431 
00432 ********************************************************************************************/
00433 
00434 class DDeckerEnd : public BarItem
00435 {
00436     CC_DECLARE_DYNAMIC( DDeckerEnd )
00437 
00438 public:
00439     BOOL Read(CCLexFile&)           { return TRUE; }
00440     BOOL Write(CCLexFile& file);
00441 
00442     virtual BOOL Read(String_256*)          { return TRUE; }
00443     virtual BOOL Write(String_256*);
00444 };
00445 
00446 
00447 
00448 /********************************************************************************************
00449 
00450 >   class BarNewPage : public BarItem
00451 
00452     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00453     Created:    5/4/94
00454     Purpose:    Defines a gap between the item before this one and the one that follows. Can
00455                 be viewed as a 'space' char when look at as a formatting item.
00456 
00457 ********************************************************************************************/
00458 
00459 class BarNewPage : public BarItem
00460 {
00461     CC_DECLARE_DYNAMIC( BarNewPage)
00462 
00463 public:
00464     BOOL Read(CCLexFile&)           { return TRUE; }
00465     BOOL Write(CCLexFile& file);
00466 
00467     virtual BOOL Read(String_256*)          { return TRUE; }
00468     virtual BOOL Write(String_256*);
00469 };
00470 
00471 /********************************************************************************************
00472 
00473 >   class BarSeparator : public BarItem
00474 
00475     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00476     Created:    5/4/94
00477     Purpose:    Defines a gap between the item before this one and the one that follows. Can
00478                 be viewed as a 'space' char when look at as a formatting item.
00479 
00480 ********************************************************************************************/
00481 
00482 class BarSeparator : public BarItem
00483 {
00484     CC_DECLARE_DYNAMIC( BarSeparator )
00485 
00486 public:
00487     BOOL Read(CCLexFile&)           { return TRUE; }
00488     BOOL Write(CCLexFile& file);
00489 
00490     virtual BOOL Read(String_256*)          { return TRUE; }
00491     virtual BOOL Write(String_256*);
00492 };
00493 
00494 
00495 /********************************************************************************************
00496 
00497 >   class BarLineFeed : public BarItem
00498 
00499     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00500     Created:    5/4/94
00501     Purpose:    Defines a new line after the item before this one. Can
00502                 be viewed as a 'LF/CR' char pair when look at as a formatting item.
00503 
00504 ********************************************************************************************/
00505 
00506 class BarLineFeed : public BarItem
00507 {
00508     CC_DECLARE_DYNAMIC( BarLineFeed )
00509 
00510 public:
00511     BOOL Read(CCLexFile&)           { return TRUE; }
00512     BOOL Write(CCLexFile& file);
00513 
00514     virtual BOOL Read(String_256*)          { return TRUE; }
00515     virtual BOOL Write(String_256*);
00516 };
00517 
00518 
00519 
00520 // Slight compiler bodge from Andy here:
00521 // this macro turns a NULL class pointer into DialogBarOp. It is used as the constructors
00522 // have to take a default argument of NULL, to stop VC++ from using the wrong function.
00523 // If the compiler worked, the default argument with be CC_RUNTIME_CLASS(DialogBarOp)
00524 #define SAFECLASS(TheClass) (TheClass?TheClass:CC_RUNTIME_CLASS(DialogBarOp))
00525 
00526 
00527 // All the bar tokens that can be read
00528 enum TokenIndex
00529 {
00530     TOKEN_NONE = -1,
00531     TOKEN_BAR,
00532     TOKEN_BAR_END,
00533     TOKEN_BAR_CONTROL,
00534     TOKEN_BAR_CONTROL_HORZ,
00535     TOKEN_BAR_CONTROL_VERT,
00536     TOKEN_BAR_CONTROL_BOTH,
00537     TOKEN_BAR_SEPARATOR,
00538     TOKEN_BAR_LINEFEED,
00539     TOKEN_DOCKBAR_LEFT,
00540     TOKEN_DOCKBAR_RIGHT,
00541     TOKEN_DOCKBAR_TOP,
00542     TOKEN_DOCKBAR_BOTTOM,
00543     TOKEN_DOCKBAR_FLOAT,
00544     TOKEN_DOCKING_BAR,
00545     TOKEN_BIG,
00546     TOKEN_SMALL,
00547     TOKEN_GALLERY,
00548     TOKEN_GALLERY_END,
00549     TOKEN_DDECKER_TOP,
00550     TOKEN_DDECKER_BOTTOM,
00551     TOKEN_DDECKER_END,
00552     TOKEN_VISIBLE,
00553     TOKEN_INVISIBLE,
00554     TOKEN_STATUS_BAR,
00555     TOKEN_COLOUR_BAR,
00556     TOKEN_SCROLL_BARS,
00557     TOKEN_FULLSCREEN,
00558     TOKEN_ON,
00559     TOKEN_OFF,
00560     TOKEN_INFO_BAR,
00561     TOKEN_BAR_NEWPAGE,
00562     // Add new token indexs BEFORE NUM_TOKENS
00563     NUM_TOKENS
00564 };
00565 
00566 /********************************************************************************************
00567 
00568 >   class DialogBarOp : public DialogOp
00569 
00570     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00571     Created:    5/4/94
00572     Purpose:    The kernel version of camelot bar.  Allows bar items to be added, removed, moved
00573                 etc within the bar, and is also the place to store any information about the
00574                 bar that will need to live longer that the lifetime of the program.
00575 
00576 
00577 ********************************************************************************************/
00578 
00579 #define OPTOKEN_DLGBAROP _T("DialogBarOp")
00580 enum Orientation { Horizontal, Vertical }; 
00581 
00582 class DialogBarOp : public DialogOp
00583 {
00584     CC_DECLARE_DYNCREATE( DialogBarOp )   
00585 public:
00586     DialogBarOp(CCRuntimeClass* Class = NULL);
00587     DialogBarOp(String_32& NewName,CCRuntimeClass* Class = NULL);
00588     DialogBarOp(UINT32 StringID, CCRuntimeClass* Class = NULL);
00589     ~DialogBarOp();
00590     void DialogBarOpInit(String_32& NewName);
00591 
00592     BOOL IsABar() {return TRUE;}
00593 
00594     virtual MsgResult Message(Msg* Msg);
00595 
00596     virtual void    UpdateState(); // Called during idle processing to disable controls
00597     static  void    UpdateStateOfAllBars(); 
00598     static BOOL     Init();
00599     static OpState  GetState(String_256* Description, OpDescriptor*);
00600 
00601     // functions to write bars data out to an ini file
00602     static BOOL     WriteBars(CCLexFile& file);
00603     static BOOL     WriteNamedBars(String_256 FileName);
00604     static BOOL     WriteBarsToFile(CCLexFile& file);
00605     static BOOL     WriteDockingBarsToFile(CCLexFile& file);
00606     static BOOL     WriteWorkSpaceInfoToFile(CCLexFile& file);
00607     // functions to read bars data in from an ini file
00608     static BOOL     ReadBarsFromFile(   CCLexFile& file,
00609                                         BarCreate& BarCreate,
00610                                         UINT32* pNumBarsRead = NULL,
00611                                         UINT32* pNumDockingBarsRead = NULL);
00612 protected:
00613     // new registry related items
00614     static BOOL     WriteBarsToRegistry(HKEY hSubKey);
00615     static BOOL     WriteWorkSpaceInfoToRegistry(HKEY hSubKey);
00616     static BOOL     WriteDockingBarsToRegistry(HKEY hSubKey);
00617     
00618     static BOOL     ReadBarsFromRegistry(HKEY hSubKey);
00619     static BOOL     ReadWorkSpaceInfoFromRegistry(HKEY hSubKey);
00620     static BOOL     ReadDockingBarsFromRegistry(HKEY hSubKey);
00621 
00622     // clean out any registry data for the name bar
00623     static BOOL     WipeRegistrySettingsForBar(TCHAR * pBarName);
00624     // find out if the bars stored in the registry are up to date or not
00625     static BOOL     ReadRegistryBarsVersion();
00626 
00627 public:
00628     static BOOL MakeControlBank();
00629 
00630     static DialogBarOp*     FindDialogBarOp(String_32& DialogBarOpName, INT32 limit = -1);
00631     static DialogBarOp*     FindDialogBarOp(UINT_PTR WinID);
00632 
00633     static DialogBarOp*     AllBarsOp;
00634     BOOL                IsAllBarsOp();
00635     static BOOL             AddOpToAll(OpDescriptor* pHorzOpDesc,OpDescriptor* pVertOpDesc);
00636 
00637 
00638     static UINT32           FindUniqueBarNumber();
00639 
00640     // List Access functions
00641     LISTPOS         AddBarItem(BarItem* pBarItem);
00642     BarItem*        RemoveBarItem(LISTPOS here);
00643     BarItem*        RemoveBarItem(BarItem * thisItem);
00644     void            MoveBarItem(LISTPOS here,LISTPOS newpos);
00645     BOOL            DeleteBarItem(CWindowID WinID);
00646     BarItem*        GetBarItem(CWindowID WinID);
00647     void            InsertItemAfter(LISTPOS here,BarItem * thisItem);
00648     
00649     // dynamic infobar stuff ....
00650     BOOL HideDisableGadgetAndResuffleBar (CWindowID WinID);
00651     BOOL ShowEnableGadgetAndResuffleBar (CWindowID WinID);
00652     BOOL ResetHiddenGadgetStates ();
00653 
00654     void            DeleteAllBarItems();
00655     BOOL            IsListEmpty();
00656     BarItem*        GetPtrBarItem(LISTPOS here);
00657     BarItem*        GetPtrBarNext(BarItem * ThisItem);
00658     BarItem*        GetPtrBarPrev(BarItem * ThisItem);
00659     BarItem*        InsertItemBefore(BarItem * here ,BarItem * newItem);
00660     BarItem*        GetPtrBarHead();
00661     DWORD           GetNumBarItems() const;
00662 
00663     BOOL            Read(CCLexFile& file);
00664     virtual BOOL    Write(CCLexFile& file);
00665 
00666     // the new registry forms of the above functions
00667     virtual BOOL    Read(LoadRegistryEntries& Loader);
00668     virtual BOOL    Write(SaveRegistryEntries& Saver);
00669 
00670     DockBarType     GetDockBarType()                        { return Dock; }
00671     void            SetDockBarType(DockBarType DockValue)   { Dock = DockValue; }
00672     UINT32          GetSlot()                               { return Slot; }
00673     void            SetSlot(UINT32 SlotNum)                     { Slot = SlotNum; }
00674     UINT32          GetOffset()                             { return Offset; }
00675     void            SetOffset(INT32 OffsetValue)                { Offset = OffsetValue; }
00676     wxPoint         GetFloatingCPoint()                     { return FloatPos; }
00677     void            SetFloatingCPoint(wxPoint& Pos)             { FloatPos = Pos; }
00678     wxRect          GetBarRect()                            { return BarRect; }
00679     void            SetBarRect(wxRect& Rect)                    { BarRect = Rect; }
00680     String_32&      GetName()                               { return Name; }
00681     void            SetName(String_32& str);
00682 
00683     void            SetCurrentOrientation(Orientation   BarDirection); 
00684     BOOL            IsHorizontal() { return (BarOrientation == Horizontal); }
00685 
00686     // This function loads the bars.ini file and then creates the initial bars
00687     static BOOL LoadBars();
00688     static BOOL LoadDefaultBars();
00689     static BOOL WipeBarFiles();
00690     static BOOL LoadNamedBars(String_256 FileName); 
00691 
00692     void            Delete();
00693 
00694     // This function should be called whenever the state of the system has changed
00695     // it indicates that the Bar states should be updated. The updating will 
00696     // occur during idle events.
00697 
00698 
00699     static void SetSystemStateChanged(BOOL State = TRUE); 
00700     static BOOL ShouldUpdateBarState();
00701     UINT32 GetUniqueID();
00702 
00703     // This func asks the derived class whether it wants its list box to allow multiple
00704     // selection or not.
00705     // This is a very specialised func associated with BaseBar::Create() and galleries.
00706     virtual BOOL AllowMulSelInListBox();
00707 
00708 protected:
00709     // Called from LoadBars()
00710     static BOOL     LoadNamedBarFile(String_256 FileName,BOOL * Opened);
00711     static BOOL     LoadBarsFromRes();
00712     static BOOL     ReadResVersion();
00713     static BOOL     CreateBars();
00714     static BOOL     SetValidPath(String_256 Filename);
00715     static PathName     ValidPath;
00716         
00717     // Called when wanting to ignore a bar definition
00718     static BOOL FlushUpToToken(CCLexFile& file,TokenIndex Token);
00719 
00720     DockBarType     Dock;
00721     UINT32          Slot;
00722     INT32               Offset;
00723     wxPoint         FloatPos;   
00724     wxRect          BarRect;
00725 
00726     BOOL            InitiallyVisible;   // TRUE if bar should be made visible when program starts up
00727     List            BarItemList;
00728 private:
00729     
00730     String_32       Name;
00731 
00732     Orientation     BarOrientation;
00733 
00734     static BOOL     SystemStateChanged; // Set to TRUE initially so that the bar
00735                                                // state will be refreshed.
00736 
00737 #ifdef _DEBUG
00738 public :
00739     static void TestStart();
00740     static void TestEnd();
00741 #endif
00742 };
00743 
00744 // Function headers for inlines
00745 
00746 /********************************************************************************************
00747 
00748 >   inline static void DialogBarOp::SetSystemStateChanged(BOOL State = TRUE)  
00749 
00750     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00751     Created:    27/5/94
00752 
00753     Inputs:     State: TRUE if the system state has changed
00754                        FALSE to indicate that the state of the bars has been updated to
00755                        reflect the new system state 
00756     Outputs:    -
00757     Returns:    -
00758     Purpose:    This function is called whenever the state of the system has changed in a
00759                 way that indicates the bar state needs refreshing. Currently this function
00760                 is called in the Operation End method and when the selection changes.
00761 
00762                 In future this function may need to be called from other places as well.
00763 
00764                 The state of the bars is updated during Idle events. 
00765                 
00766     Errors:     -
00767     SeeAlso:    DialogBarOp::ShouldUpdateBarState
00768 
00769 ********************************************************************************************/
00770 
00771 
00772 /********************************************************************************************
00773 
00774 >   inline static BOOL DialogBarOp::ShouldUpdateBarState() { return SystemStateChanged == TRUE; }
00775 
00776     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00777     Created:    27/5/94
00778     Inputs:     -
00779     Outputs:    -
00780     Returns:    TRUE if we should update the bars states.  
00781     Purpose:    To determine if we need to update the state of the visible bars.
00782     Errors:     -
00783     SeeAlso:    DialogBarOp::SetSystemStateChanged
00784 
00785 ********************************************************************************************/
00786 
00787 
00788 /********************************************************************************************
00789 
00790 >   class SystemBarOp : public DialogBarOp
00791 
00792     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00793     Created:    15/04/94
00794     Purpose:    A special version of DialogBarOp that is used internally to store all the
00795                 BarItems in a form where they can be used by the Customize dialog.
00796                 They are never seen by the user, never loaded and never saved.
00797 
00798 ********************************************************************************************/
00799 
00800 #define OPTOKEN_SYSTEMBAROP _T("SystemBarOp")
00801 
00802 class SystemBarOp : public DialogBarOp
00803 {
00804     CC_DECLARE_DYNCREATE( SystemBarOp )
00805 public:
00806     SystemBarOp();                  // Default constructor (needed by DYNCREATE)
00807     SystemBarOp(UINT32 BarNameID, 
00808                 SystemBarType GrpBarID,
00809                 DockBarType DockType = DOCKBAR_BOTTOM,
00810                 UINT32 Slot = 0,
00811                 INT32 Offset = -1);
00812 
00813     virtual MsgResult Message(Msg* Msg);
00814 
00815     // Functions to add BarItems to system bars...
00816     static SystemBarOp* FindType(SystemBarType);            // Find a hidden bar by type
00817     static BOOL     Connect(SystemBarType,  OpDescriptor* pHorzOpDesc, 
00818                                             OpDescriptor* pVertOpDesc = NULL);  // Connects an OpDesc to a bar
00819     static BOOL     Connect(SystemBarOp*,   OpDescriptor* pHorzOpDesc, 
00820                                             OpDescriptor* pVertOpDesc = NULL);  // Connects an OpDesc to a bar
00821     static BOOL     Separate(SystemBarType);                // Connects a Separator to a bar
00822     static BOOL     Separate(SystemBarOp*);                 // Connects a Separator to a bar
00823 
00824     // the old ini file based reading/writing functions
00825     BOOL            Read(CCLexFile& file);  // Override DialogBarOp write function
00826     BOOL            Write(CCLexFile& file); // Override DialogBarOp read function
00827 
00828     // the new registry forms of the above functions
00829     virtual BOOL    Read(LoadRegistryEntries& Loader); // Override DialogBarOp read function
00830     virtual BOOL    Write(SaveRegistryEntries& Saver); // Override DialogBarOp write function
00831 
00832     static BOOL     Init();
00833 
00834 
00835 // Extra member vars on top of those in DialogBarOp
00836     SystemBarType   GroupBarID;             // Holds hidden group identity
00837 
00838 //  virtual void    UpdateState() {}; // does nothing 
00839 };
00840 
00841 
00842 
00843 /********************************************************************************************
00844 
00845 >   class InformationBarOp : public DialogBarOp
00846 
00847     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> & Mark Neves
00848     Created:    17/4/94
00849     Purpose:    The kernel version of info bar.  
00850 
00851 ********************************************************************************************/
00852 
00853 class InformationBarOp: public DialogBarOp
00854 {
00855     CC_DECLARE_DYNCREATE( InformationBarOp )   
00856 public:
00857     InformationBarOp(CCRuntimeClass* Class = NULL);
00858     InformationBarOp(String_32& NewName,CCRuntimeClass* Class = NULL);
00859 
00860     BOOL Create();
00861     void MakeCurrent(){ InformationBarOp::CurrentInfoBarOp = this;};
00862     void Delete();
00863     void SetInfo();
00864     void GetInfo();
00865     static BOOL IsVisible();
00866     static BOOL IsHidden(){ return Hidden;};
00867     static void SetVisibility(BOOL Open,BOOL Force = FALSE);
00868 
00869     // read/write data to/from ini file
00870     static BOOL Read(CCLexFile& file);
00871     static BOOL WriteStatic(CCLexFile& file);
00872 
00873     // read/write data to/from registry
00874     static BOOL Read(HKEY hSubKey);
00875     static BOOL Write(HKEY hSubKey);
00876 
00877     virtual void CloseProfileDialog (CBiasGainGadget& Gadget);
00878     //static void AllowInteractiveProfiles () {}
00879 
00880 protected:
00881 
00882     // InformationBarOp::Message should get a look in after you derived class has received
00883     // a message in case it has to do general infobar message handling.
00884     // Call this at the end of your own message handler.
00885     virtual MsgResult Message(Msg* pMsg);
00886 
00887     // Justin says: I am removing this dummy function because it hides the base class version
00888     // which correctly updates the grey-state of controls with multiple instances.
00889 //  virtual void    UpdateState() {}; // does nothing 
00890 
00891     virtual void HandleProfileButtonClick (CBiasGainGadget& Gadget, CGadgetID ProfileGadgetID);
00892     virtual void HandleProfileSelChangingMsg (CBiasGainGadget& Gadget, CGadgetID ProfileGadgetID);
00893     virtual CProfileBiasGain* GetProfileFromSelection (CGadgetID ProfileGadgetID, BOOL* bMany, BOOL* bAllSameType);
00894 
00895 private:
00896     static DockBarType          Dock;
00897     static UINT32                   Slot;
00898     static UINT32                   Offset;
00899     static wxPoint              FloatPos;
00900     static InformationBarOp*    CurrentInfoBarOp;
00901     static BOOL                 Visible;
00902     static BOOL                 Hidden;
00903 };
00904 
00905 
00906 /********************************************************************************************
00907 
00908 >   class BarCreate : public SimpleCCObject
00909 
00910     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00911     Created:    28/4/94
00912     Purpose:    Abstract class for creating DialogBarOps and derived classes.
00913                 Derived classes of BarCreate are used by DialogBarOp::ReadBarsFromFile
00914 
00915 ********************************************************************************************/
00916 
00917 class BarCreate : public SimpleCCObject
00918 {
00919 public:
00920     virtual ~BarCreate() { }
00921     virtual DialogBarOp*    Create() = 0;
00922 };
00923 
00924 
00925 /********************************************************************************************
00926 
00927 >   class DialogBarOpCreate : public BarCreate
00928 
00929     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00930     Created:    28/4/94
00931     Purpose:    Class for creating DialogBarOps.
00932                 Derived classes of BarCreate are used by DialogBarOp::ReadBarsFromFile
00933 
00934 ********************************************************************************************/
00935 
00936 class DialogBarOpCreate : public BarCreate
00937 {
00938 public:
00939     DialogBarOp*    Create() { return (new DialogBarOp); }
00940 };
00941 
00942 
00943 
00944 /********************************************************************************************
00945 
00946 >   class DockingBar : public ListItem
00947 
00948     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00949     Created:    5/4/94
00950     Purpose:    The kernel's version of a docking bar. All information that needs to be saved
00951                 in the BARS.INI file should be represented in this class.
00952 
00953 ********************************************************************************************/
00954 
00955 /*
00956 class DockingBar : public ListItem
00957 {
00958 public:
00959 
00960     DockingBar();
00961     ~DockingBar();
00962 
00963     BOOL            HasBigControls();
00964     void            SetBigControlsState(BOOL Big);
00965     BOOL            Write(CCLexFile& file);
00966     DockBarType     GetDockBarType()  { return Dock; }
00967 
00968     static List*    GetPtrDockingBarList() { return &DockingBarList; }
00969     static BOOL     WriteDockingBars(CCLexFile& file);
00970 
00971 private:
00972     struct CCAPI Dummy
00973     {
00974         BOOL    Big : 1;    // TRUE = Big control icons used in all bars docked with this bar
00975     } DockingBarFlags;
00976 
00977     DockBarType Dock;
00978 
00979     static List DockingBarList;
00980 };
00981 */
00982 
00983 #endif // INC_BARS

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