DialogBarOp Class Reference

#include <bars.h>

Inheritance diagram for DialogBarOp:

DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject InformationBarOp SystemBarOp BevelInfoBarOp BezToolInfoBarOp BlankInfoBarOp BlendInfoBarOp ContourInfoBarOp FreeHandInfoBarOp GradInfoBarOp GridInfoBarOp LiveEffectsInfoBarOp MouldInfoBarOp PenToolInfoBarOp QuickShapeBaseInfoBarOp SelectorInfoBarOp SliceInfoBarOp TextInfoBarOp TranspInfoBarOp ZoomInfoBarOp List of all members.

Public Member Functions

 DialogBarOp (CCRuntimeClass *Class=NULL)
 Constructor.
 DialogBarOp (String_32 &NewName, CCRuntimeClass *Class=NULL)
 Constructor.
 DialogBarOp (UINT32 StringID, CCRuntimeClass *Class=NULL)
 Constructor.
 ~DialogBarOp ()
 Destructor.
void DialogBarOpInit (String_32 &NewName)
 Common routine called by all Constructors.
BOOL IsABar ()
virtual MsgResult Message (Msg *Msg)
 The default DialogBarOp Message handler This should be overriden for InformationBar DialogBarOps which will have a structure identical to DialogOps.
virtual void UpdateState ()
 This function gets called during idle time. It calls the GetState fn associated with each controls OpDescriptor. The button gets disabled if the operation is not executable.
BOOL IsAllBarsOp ()
 

LISTPOS AddBarItem (BarItem *pBarItem)
 Adding a bar item to a bar.
BarItemRemoveBarItem (LISTPOS here)
 Removes the bar item from the list of bar items n the bar. This does NOT delete the item, or any memory associated with it. It is just delinked.
BarItemRemoveBarItem (BarItem *thisItem)
 Removes the bar item from the list of bar items n the bar. This does NOT delete the item, or any memory associated with it. It is just delinked.
void MoveBarItem (LISTPOS here, LISTPOS newpos)
 Moves the bar item at 'here' to a new position in the bar. All items that were at positions from 'newpos' onwards before the call and shuffled along one position to accommodate the move.
BOOL DeleteBarItem (CWindowID WinID)
 Removes and deletes all bar items attached to this bar. It's main function is for tidying up after errors during the reconstruction of the bars system when the tokenised ASCII file is read in.
BarItemGetBarItem (CWindowID WinID)
 Removes and deletes all bar items attached to this bar. It's main function is for tidying up after errors during the reconstruction of the bars system when the tokenised ASCII file is read in.
void InsertItemAfter (LISTPOS here, BarItem *thisItem)
 
BOOL HideDisableGadgetAndResuffleBar (CWindowID WinID)
 This function is the saviour of camelots GUI infobars - several of which have become too crowded, and as such; their controls no longer fit into the 'static' docked infobar. The function hides the requested control and automatically resuffles those controls that occur after it. For example: Combo1, Combo2, Combo3; call on Combo1 gives: Combo2, Combo3 If you are calling this operation - you MUST ensure that the infobar (which is WinID's parent) has been handled within winoil.cpp. Refer (basebar2.cpp) line 1311 for the code that MUST be checked/edited (or search on DialogBarOp::HideDisableGadgetAndResuffleBar). If you want to see an example of how to use this function correctly, consult tool.cpp - since this is the first place the function was used within camelot. TIP: I would recommend that you hide the controls in a left to right order (i.e. leftmost first).
BOOL ShowEnableGadgetAndResuffleBar (CWindowID WinID)
 Does the opposite of BOOL DialogBarOp::HideDisableGadgetAndResuffleBar (CWindowID WinID).
BOOL ResetHiddenGadgetStates ()
 This function is required to fix the errors that originate on 'dynamic' infobars when we change to another tool - or drag the infobar into a floating one; and then make it dockable again. The problems result from the fact that we need to reset our visibility flags (in these cases) in order for the HideDisableGadgetAndResuffleBar and ShowDisableGadgetAndResuffleBar to do their stuff correctly. This function handles this ....
void DeleteAllBarItems ()
 Removes and deletes all bar items attached to this bar. It's main function is for tidying up after errors during the reconstruction of the bars system when the tokenised ASCII file is read in.
BOOL IsListEmpty ()
 

BarItemGetPtrBarItem (LISTPOS here)
 Allows you to get your mits on a bar item.
BarItemGetPtrBarNext (BarItem *ThisItem)
 Allows you to get your mits on a bar item.
BarItemGetPtrBarPrev (BarItem *ThisItem)
 Allows you to get your mits on a bar item.
BarItemInsertItemBefore (BarItem *here, BarItem *newItem)
 Allows you to insert a bar item.
BarItemGetPtrBarHead ()
 Allows you to get your mits on a bar item.
DWORD GetNumBarItems () const
 You can find out just how many pesky bar items are in this bar with this call.
BOOL Read (CCLexFile &file)
 Read the dialog bar from the file in a tokenized form.
virtual BOOL Write (CCLexFile &file)
 Write the dialog bar to the file in a tokenized form.
virtual BOOL Read (LoadRegistryEntries &Loader)
 Read the dialog bar or super gallery definition from the registry.
virtual BOOL Write (SaveRegistryEntries &Saver)
 Write the dialog bar to the registry.
DockBarType GetDockBarType ()
void SetDockBarType (DockBarType DockValue)
UINT32 GetSlot ()
void SetSlot (UINT32 SlotNum)
UINT32 GetOffset ()
void SetOffset (INT32 OffsetValue)
wxPoint GetFloatingCPoint ()
void SetFloatingCPoint (wxPoint &Pos)
wxRect GetBarRect ()
void SetBarRect (wxRect &Rect)
String_32GetName ()
void SetName (String_32 &str)
 "I name this bar..."
void SetCurrentOrientation (Orientation BarDirection)
 To inform the DialogBarOp of its current orientation (horizontal or vertical).
BOOL IsHorizontal ()
void Delete ()
 The DialogBarOp Delete method Deletes the window and resets WindowID to NULL.
UINT32 GetUniqueID ()
 This function returns a uniqueID i.e. highest + 1.
virtual BOOL AllowMulSelInListBox ()
 Linked heavilly with the BaseBar class and the creation of list boxes associated with the dialog bar op of a gallery. This gives the derived dialog bar op the opportunity to have a say to whether the list box should allow multiple selection or not. This base version always returns TRUE.

Static Public Member Functions

static void UpdateStateOfAllBars ()
 This static function gets called during idle time If the system state has changed then it updates the enabled state of all visible DialogBars.
static BOOL Init ()
 Adds the operation to the list of all known operations.
static OpState GetState (String_256 *Description, OpDescriptor *)
 Find out the state of the operation at the specific time.
static BOOL WriteBars (CCLexFile &file)
 Writes all the bars in tokenized form to the given file.
static BOOL WriteNamedBars (String_256 FileName)
 writes current bars set up to *.ini file
static BOOL WriteBarsToFile (CCLexFile &file)
 Writes the entire kernel's bar representation to the given file. It is written in an ASCII tokenized form so that CCLexFile can be used to read the file back in when reconstructing the bars system.
static BOOL WriteDockingBarsToFile (CCLexFile &file)
 Writes the persistant docking data retrieved from the docking system.
static BOOL WriteWorkSpaceInfoToFile (CCLexFile &file)
 Writes workspace data to ini file ( Full Screen Mode etc..).
static BOOL ReadBarsFromFile (CCLexFile &file, BarCreate &BarCreate, UINT32 *pNumBarsRead=NULL, UINT32 *pNumDockingBarsRead=NULL)
 Reads the bars represented in the given file. It reads the file in an ASCII tokenized form using CCLexFile::GetSimpleToken(), and reconstructs the bars defined.
static BOOL MakeControlBank ()
 Build a control bar that contains all the controls defined in the bars.ini resource.
static DialogBarOpFindDialogBarOp (String_32 &DialogBarOpName, INT32 limit=-1)
 Looks for a given DialogBarOp by using its name.
static DialogBarOpFindDialogBarOp (UINT_PTR WinID)
 Looks for a given DialogBarOp by using its name.
static BOOL AddOpToAll (OpDescriptor *pHorzOpDesc, OpDescriptor *pVertOpDesc)
 DEAD.
static UINT32 FindUniqueBarNumber ()
 

static BOOL LoadBars ()
 loads in, and then creates initial bars This function must get called after the docking bars have been created
static BOOL LoadDefaultBars ()
 loads in, and then creates initial bars This function must get called after the docking bars have been created
static BOOL WipeBarFiles ()
 Wipes bar config files from disc - called if the user selects default settings.
static BOOL LoadNamedBars (String_256 FileName)
 loads in, and then creates initial bars This function must get called after the docking bars have been created
static void SetSystemStateChanged (BOOL State=TRUE)
 Constructor.
static BOOL ShouldUpdateBarState ()
 


Static Public Attributes

static DialogBarOpAllBarsOp = NULL

Static Protected Member Functions

static BOOL WriteBarsToRegistry (HKEY hSubKey)
 The constructor The destructor Find out the size of controls used by all bars docked with this docking bar Sets the size of controls used by all bars docked with this docking bar Writes a tokenized form of the docking bar to the given file Writes all the docking bars in tokenized form to the given file Asks each relevent kernel bar representation to write its definition out. Each bar is written into a numbered section which is a sub-section of the supplied key. The numbering is 1..n. Each bar should write out some standard named sections and then write out any bar items as separate numbered lines into their section. The helper class SaveRegistryEntries can be used to handle this automatically.
static BOOL WriteWorkSpaceInfoToRegistry (HKEY hSubKey)
 Writes workspace data to registry ( Full Screen Mode etc..).
static BOOL WriteDockingBarsToRegistry (HKEY hSubKey)
 Writes the persistant docking data retrieved from the docking system.
static BOOL ReadBarsFromRegistry (HKEY hSubKey)
 Reads the bar definitions from the specified section in the registry. Each bar is written into a numbered section which is a sub-section of the supplied key. The numbering is 1..n. So we need to search for these numbered sections until we fail to find one.
static BOOL ReadWorkSpaceInfoFromRegistry (HKEY hSubKey)
 Reads workspace data from the registry ( Full Screen Mode etc..).
static BOOL ReadDockingBarsFromRegistry (HKEY hSubKey)
 Reads in the persistant docking data retrieved from the docking system.
static BOOL WipeRegistrySettingsForBar (TCHAR *pBarName)
 Wipes bar registry settings for the named section. Called if the user selects default settings.
static BOOL ReadRegistryBarsVersion ()
static BOOL LoadNamedBarFile (String_256 FileName, BOOL *Opened)
 loads in bar defs from *.confile. This function must get called after the docking bars have been created
static BOOL LoadBarsFromRes ()
 loads in bars from the bars.ini resource that's bound into the exe. This function must get called after the docking bars have been created
static BOOL ReadResVersion ()
 Reads Revision number of bars.ini checks whether this is the same as the version in prefs.
static BOOL CreateBars ()
 Creates initial bars loaded in using either LoadBarsFromFile or LoadBarsFromRes. Only DialogBarOps are created. All derived classes are ignored, such as InformationBarOps and SystemBarOps. This function must get called after the docking bars have been created.
static BOOL SetValidPath (String_256 Filename)
 looks for bars.con files first in prefs path then in windows dir if found sets ValidPath and return TRUE else return FALSE
static BOOL FlushUpToToken (CCLexFile &file, TokenIndex Token)
 This reads the file until it finds the token given, or it finds the end of file. This is used to skip over bar definitions that ReadBarsFromFile() knows it can ignore, e.g. old versions of bars, extinct class names, etc.

Protected Attributes

DockBarType Dock
UINT32 Slot
INT32 Offset
wxPoint FloatPos
wxRect BarRect
BOOL InitiallyVisible
List BarItemList

Static Protected Attributes

static PathName ValidPath

Private Attributes

String_32 Name
Orientation BarOrientation

Static Private Attributes

static BOOL SystemStateChanged = TRUE

Detailed Description

Definition at line 582 of file bars.h.


Constructor & Destructor Documentation

DialogBarOp::DialogBarOp CCRuntimeClass Class = NULL  ) 
 

Constructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
Class = the message handler class list to add this object to. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 304 of file bars.cpp.

00304                                              : DialogOp(_R(IDD_BLANKBAR), MODELESS,0,SAFECLASS(Class))
00305 {
00306     String_32 str = String_32(_R(IDS_K_BARS_NONAME));
00307     DialogBarOpInit(str);
00308 }

DialogBarOp::DialogBarOp String_32 NewName,
CCRuntimeClass Class = NULL
 

Constructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
NewName = Name of this bar [INPUTS] Class = the message handler class list to add this object to.
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 350 of file bars.cpp.

00350                                                                 : DialogOp(_R(IDD_BLANKBAR), MODELESS,0,SAFECLASS(Class))
00351 {
00352     DialogBarOpInit(NewName);
00353 }

DialogBarOp::DialogBarOp UINT32  StringID,
CCRuntimeClass Class = NULL
 

Constructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
StringID = ID of name of the dialog bar op. [INPUTS] Class = the message handler class list to add this object to.
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 327 of file bars.cpp.

00327                                                               : DialogOp(_R(IDD_BLANKBAR), MODELESS,0,SAFECLASS(Class))
00328 {
00329     String_32 str = String_32(StringID);
00330     DialogBarOpInit(str);
00331 }

DialogBarOp::~DialogBarOp  ) 
 

Destructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 402 of file bars.cpp.

00403 {
00404 //  if (IsUserName("MarkN")) TRACE( _T("~DialogBarOp\n"));
00405     DeleteAllBarItems();
00406 }


Member Function Documentation

LISTPOS DialogBarOp::AddBarItem BarItem pBarItem  ) 
 

Adding a bar item to a bar.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
pBarItem = ptr to a bar item to add to the dialog bar [INPUTS]
- [OUTPUTS]
Returns:
The position of the new bar item in the bar

Errors: -

See also:
-

Definition at line 424 of file bars.cpp.

00425 {
00426     BarItemList.AddTail(pBarItem);
00427     return (BarItemList.FindPosition(pBarItem));
00428 }

BOOL DialogBarOp::AddOpToAll OpDescriptor pHorzOpDesc,
OpDescriptor pVertOpDesc
[static]
 

DEAD.

static BOOL DialogBarOp::AddOpToAll( OpDescriptor* pHorzOpDesc, OpDescriptor* pVertOpDesc = NULL)

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/5/95
Parameters:
Pointer to the Horz OpDescriptor to connect to a bar [INPUTS] Pointer to the Vert OpDescriptor to connect to a bar (should be NULL if Vert is same as Horz op desc)
- [OUTPUTS]
Returns:
TRUE if added OK. FALSE otherwise.

Errors: -

See also:
-

Definition at line 5737 of file bars.cpp.

05738 {
05739     return FALSE;
05740 }

BOOL DialogBarOp::AllowMulSelInListBox  )  [virtual]
 

Linked heavilly with the BaseBar class and the creation of list boxes associated with the dialog bar op of a gallery. This gives the derived dialog bar op the opportunity to have a say to whether the list box should allow multiple selection or not. This base version always returns TRUE.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the list box associated with the dialog bar op should allow multiple selection or not

Errors: -

See also:
-

Definition at line 5691 of file bars.cpp.

05692 {
05693     return TRUE;
05694 }

BOOL DialogBarOp::CreateBars  )  [static, protected]
 

Creates initial bars loaded in using either LoadBarsFromFile or LoadBarsFromRes. Only DialogBarOps are created. All derived classes are ignored, such as InformationBarOps and SystemBarOps. This function must get called after the docking bars have been created.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful

Errors: -

See also:
LoadBarsFromFile,LoadBarsFromRes,LoadBars

Definition at line 3127 of file bars.cpp.

03128 {
03129 
03130 
03131     List*       pList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogBarOp));
03132     ListItem*   pListItem = pList->GetHead();
03133 //  ListItem*   pListItem = pList->GetTail();
03134 
03135     OILFixedDockingBar::DoNotTidyBars ();
03136 
03137     while (pListItem != NULL)
03138     {
03139         DialogBarOp* pDialogBarOp = (DialogBarOp*)pListItem;
03140 
03141         
03142 //      TCHAR* p=pDialogBarOp->Name;
03143 
03144         if  (   (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(DialogBarOp))
03145     /*      #ifdef _DEBUG
03146             ||  (   pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(SystemBarOp)
03147                     && ShowSystemBars
03148                 )
03149             #endif*/
03150             || (pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(SuperGallery)))
03151             )                                   
03152         {
03153             if ((pDialogBarOp->GetNumBarItems() > 0) && pDialogBarOp->InitiallyVisible)
03154             {
03155                 if (!pDialogBarOp->Create())
03156                 {
03157                     ENSURE(FALSE, "Failed to create bar"); 
03158                     return FALSE; 
03159                 }
03160             }
03161         }
03162 //      pListItem = pList->GetPrev(pListItem);
03163         pListItem = pList->GetNext(pListItem);
03164     }
03165 
03166     OILFixedDockingBar::AllowTidyBars ();
03167 
03168     return TRUE; 
03169 }

void DialogBarOp::Delete  ) 
 

The DialogBarOp Delete method Deletes the window and resets WindowID to NULL.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> (using Simon code)
Date:
29/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented in InformationBarOp.

Definition at line 2561 of file bars.cpp.

02562 {
02563     if (WindowID != NULL)
02564     {
02565         PORTNOTETRACE("dialog","Warning - DialogBarOp::Delete called and disabled");
02566 #ifndef EXCLUDE_FROM_XARALX
02567         KernelBarPos*   pKernelBarPos;
02568         DockBarType     Dock;
02569 
02570         if (GetMainFrame()->GetBarPosInfo(WindowID,&Dock,&pKernelBarPos))
02571         {
02572             SetDockBarType(Dock);
02573             if (Dock == DOCKBAR_FLOAT)
02574                 SetFloatingCPoint(wxPoint(pKernelBarPos->x,pKernelBarPos->y));
02575             else
02576             {
02577                 SetSlot(pKernelBarPos->Slot);
02578                 SetOffset(pKernelBarPos->Position);
02579             }
02580         }
02581 #endif
02582         CCamApp::GetDlgManager()->Delete(WindowID, this);
02583         WindowID = NULL;
02584     }
02585 }

void DialogBarOp::DeleteAllBarItems  ) 
 

Removes and deletes all bar items attached to this bar. It's main function is for tidying up after errors during the reconstruction of the bars system when the tokenised ASCII file is read in.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 961 of file bars.cpp.

00962 {
00963 //  if (IsUserName("MarkN")) TRACE( _T("DeleteAllBarItems()\n"));
00964 
00965     BarItem* pNextBarItem = (BarItem*) BarItemList.GetHead();
00966     BarItem* pThisBarItem;
00967     
00968     while (pNextBarItem != NULL)
00969     {
00970         pThisBarItem = pNextBarItem;
00971         pNextBarItem = (BarItem*) BarItemList.GetNext(pThisBarItem);
00972 
00973         BarItemList.RemoveItem(pThisBarItem);
00974         //if (IsUserName("MarkN")) TRACE( _T("deleting pThisBarItem (%p)\n"),pThisBarItem);
00975         delete pThisBarItem;
00976     }
00977 }

BOOL DialogBarOp::DeleteBarItem CWindowID  WinID  ) 
 

Removes and deletes all bar items attached to this bar. It's main function is for tidying up after errors during the reconstruction of the bars system when the tokenised ASCII file is read in.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1042 of file bars.cpp.

01043 {
01044 //  if (IsUserName("MarkN")) TRACE( _T("DeleteAllBarItems()\n"));
01045 
01046     BarItem* pNextBarItem = (BarItem*) BarItemList.GetHead();
01047     BarItem* pThisBarItem;
01048     
01049     while (pNextBarItem != NULL)
01050     {
01051         pThisBarItem = pNextBarItem;
01052         pNextBarItem = (BarItem*) BarItemList.GetNext(pThisBarItem);
01053         if (pThisBarItem->IsKindOf(CC_RUNTIME_CLASS(BarControl)))
01054         {
01055             BarControl* BarCtrl = (BarControl*)pThisBarItem;
01056             if(WinID == BarCtrl->GetWinID())
01057             {
01058                 BarItemList.RemoveItem(pThisBarItem);
01059                 delete pThisBarItem;
01060                 return TRUE;
01061             }
01062         }
01063     }
01064     
01065     ERROR2(FALSE,"Can't find bar item to delete");
01066 }

void DialogBarOp::DialogBarOpInit String_32 NewName  ) 
 

Common routine called by all Constructors.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/94
Parameters:
NewName = Name of this bar [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 371 of file bars.cpp.

00372 {
00373     Name = NewName;
00374     Dock = DOCKBAR_TOP;
00375     Slot = 0;
00376     Offset = 0;
00377     FloatPos = wxPoint(100,100);
00378     BarRect = wxRect(0, 0, 0, 0);
00379     BarOrientation = Horizontal; 
00380     InitiallyVisible = TRUE;
00381 
00382     // Report new bar to any dialog ops...
00383     BROADCAST_TO_CLASS( BarMsg(BAR_CREATE,this), DialogOp );
00384 }

DialogBarOp * DialogBarOp::FindDialogBarOp UINT_PTR  ID  )  [static]
 

Looks for a given DialogBarOp by using its name.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/94
Parameters:
DialogBarOpName = Name of op to find [INPUTS]
- [OUTPUTS]
Returns:
ptr to DialogBarOp NULL is returned if not found

Errors: -

See also:
-

Definition at line 3270 of file bars.cpp.

03271 {
03272     List*           pList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogBarOp));
03273     DialogBarOp*    pDialogBarOp = (DialogBarOp*)pList->GetHead();
03274 
03275     while (pDialogBarOp != NULL)
03276     {
03277         if (pDialogBarOp->WindowID == (CWindowID)ID)
03278             return (pDialogBarOp);
03279 
03280         pDialogBarOp = (DialogBarOp*)pList->GetNext(pDialogBarOp);
03281     }
03282 
03283     return NULL;
03284 } 

DialogBarOp * DialogBarOp::FindDialogBarOp String_32 DialogBarOpName,
INT32  limit = -1
[static]
 

Looks for a given DialogBarOp by using its name.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/94
Parameters:
DialogBarOpName = Name of op to find [INPUTS] limit if -1 then it means use the whole name for the check (default) if > 0 then limit the check to the limit number of characters
- [OUTPUTS]
Returns:
ptr to DialogBarOp NULL is returned if not found

Errors: -

See also:
-

Definition at line 3189 of file bars.cpp.

03190 {
03191     List*           pList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogBarOp));
03192     DialogBarOp*    pDialogBarOp = (DialogBarOp*)pList->GetHead();
03193     
03194     String_32       OpName;
03195     while (pDialogBarOp != NULL)
03196     {
03197         if (limit > 0)
03198             pDialogBarOp->Name.Left(&OpName, limit);
03199         else
03200             OpName = pDialogBarOp->Name;
03201         
03202         if (OpName == DialogBarOpName)
03203             return (pDialogBarOp);
03204 
03205         pDialogBarOp = (DialogBarOp*)pList->GetNext(pDialogBarOp);
03206     }
03207 
03208     return NULL;
03209 }

UINT32 DialogBarOp::FindUniqueBarNumber  )  [static]
 

static UINT32 DialogBarOp::FindUniqueBarNumber()

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/94
Parameters:
DialogBarOpName = Name of op to find [INPUTS]
- [OUTPUTS]
Returns:
unique nuber to put in new bar name

Errors: -

See also:
-

Definition at line 3227 of file bars.cpp.

03228 {
03229     List*           pList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogBarOp));
03230     DialogBarOp*    pDialogBarOp = (DialogBarOp*)pList->GetHead();
03231     UINT32 Highest = 0;
03232     String_32 name;
03233     String_32 prefix;
03234     String_32 number;
03235     while (pDialogBarOp != NULL)
03236     {
03237         name = pDialogBarOp->GetName();
03238         name.Left(&prefix,3);
03239         if(!prefix.CompareTo(_T("Bar")))
03240         {   
03241             //Highest ++;
03242             name.Right(&number,name.Length()-4);
03243             TCHAR *pszMark;
03244             UINT32 SoFar = camStrtol( (const TCHAR *)number, &pszMark, 10 );
03245             if(SoFar>=Highest)
03246                 Highest = SoFar;
03247         }
03248         pDialogBarOp = (DialogBarOp*)pList->GetNext(pDialogBarOp);
03249     }
03250 
03251     return Highest+1;
03252 } 

BOOL DialogBarOp::FlushUpToToken CCLexFile file,
TokenIndex  Token
[static, protected]
 

This reads the file until it finds the token given, or it finds the end of file. This is used to skip over bar definitions that ReadBarsFromFile() knows it can ignore, e.g. old versions of bars, extinct class names, etc.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/4/95
Parameters:
file = file to read bar tokens from [INPUTS] Token= token that we want to read up to.
- [OUTPUTS]
Returns:
TRUE = Able to read upto token OR end of file FALSE = Failed to read the bar info without error. The error cases are - 1. File error (e.g. file open, disk fault, etc)

Errors: -

See also:
DialogBarOp::ReadBarsFromFile()

Definition at line 5364 of file bars.cpp.

05365 {
05366     BOOL finished = FALSE,ok = TRUE;
05367 
05368     // Get ptr to token buffer. Guaranteed not to move until next
05369     // InitLexer() call
05370     const TCHAR* TokenBuf = file.GetTokenBuf();
05371 
05372     while (!finished && ok)
05373     {
05374         ok = file.GetSimpleToken();
05375 
05376         if (ok)
05377             finished = (file.GetTokenType() == TOKEN_EOF) || (FindToken(TokenBuf) == Token);
05378     }
05379 
05380     return ok;
05381 }

BarItem * DialogBarOp::GetBarItem CWindowID  WinID  ) 
 

Removes and deletes all bar items attached to this bar. It's main function is for tidying up after errors during the reconstruction of the bars system when the tokenised ASCII file is read in.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 997 of file bars.cpp.

00998 {
00999 //  if (IsUserName("MarkN")) TRACE( _T("DeleteAllBarItems()\n"));
01000 
01001     BarItem* pNextBarItem = (BarItem*) BarItemList.GetHead();
01002     BarItem* pThisBarItem;
01003     
01004     while (pNextBarItem != NULL)
01005     {
01006         pThisBarItem = pNextBarItem;
01007         pNextBarItem = (BarItem*) BarItemList.GetNext(pThisBarItem);
01008         if (pThisBarItem->IsKindOf(CC_RUNTIME_CLASS(BarControl)))
01009         {
01010             BarControl* BarCtrl = (BarControl*)pThisBarItem;
01011             if(WinID == BarCtrl->GetWinID())
01012             {
01013                 return pThisBarItem;
01014             }
01015         }
01016     }
01017 
01018     return (NULL);
01019     
01020 //  ERROR2(NULL,"Can't find bar item");
01021 }

wxRect DialogBarOp::GetBarRect  )  [inline]
 

Definition at line 678 of file bars.h.

00678 { return BarRect; }

DockBarType DialogBarOp::GetDockBarType  )  [inline]
 

Definition at line 670 of file bars.h.

00670 { return Dock; }

wxPoint DialogBarOp::GetFloatingCPoint  )  [inline]
 

Definition at line 676 of file bars.h.

00676 { return FloatPos; }

String_32& DialogBarOp::GetName  )  [inline]
 

Definition at line 680 of file bars.h.

00680 { return Name; }

DWORD DialogBarOp::GetNumBarItems  )  const
 

You can find out just how many pesky bar items are in this bar with this call.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Num bar items in the bar

Errors: -

See also:
-

Definition at line 1214 of file bars.cpp.

01215 {
01216     return (BarItemList.GetCount());
01217 }

UINT32 DialogBarOp::GetOffset  )  [inline]
 

Definition at line 674 of file bars.h.

00674 { return Offset; }

BarItem * DialogBarOp::GetPtrBarHead  ) 
 

Allows you to get your mits on a bar item.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
ptr to the head of baritem list

Errors: Debug build - An ENSURE failure if a bar item is not found. Retail build - NULL is returned if a bar item is not found.

See also:
-

Definition at line 1107 of file bars.cpp.

01108 {
01109     BarItem* pBarItem = (BarItem*) BarItemList.GetHead();
01110     //ENSURE(pBarItem != NULL,"Couldn't get ptr bar item. Item not found.");
01111 
01112     return (pBarItem);
01113 }

BarItem * DialogBarOp::GetPtrBarItem LISTPOS  here  ) 
 

Allows you to get your mits on a bar item.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
here = position of the bar item. [INPUTS]
- [OUTPUTS]
Returns:
ptr to the bar item at position 'here'

Errors: Debug build - An ENSURE failure if a bar item is not found. Retail build - NULL is returned if a bar item is not found.

See also:
-

Definition at line 1083 of file bars.cpp.

01084 {
01085     BarItem* pBarItem = (BarItem*) BarItemList.FindItem(here);
01086     ENSURE(pBarItem != NULL,"Couldn't get ptr bar item. Item not found.");
01087     
01088     return (pBarItem);
01089 }

BarItem * DialogBarOp::GetPtrBarNext BarItem ThisItem  ) 
 

Allows you to get your mits on a bar item.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
ptr to the next item in baritem list

Errors: -

See also:
-

Definition at line 1150 of file bars.cpp.

01151 {
01152     BarItem* pBarItem = (BarItem*) BarItemList.GetNext(ThisItem);
01153     return (pBarItem);
01154 }

BarItem * DialogBarOp::GetPtrBarPrev BarItem ThisItem  ) 
 

Allows you to get your mits on a bar item.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
ptr to the previous item in baritem list

Errors: -

See also:
-

Definition at line 1170 of file bars.cpp.

01171 {
01172     BarItem* pBarItem = (BarItem*) BarItemList.GetPrev(ThisItem);
01173     return (pBarItem);
01174 }

UINT32 DialogBarOp::GetSlot  )  [inline]
 

Definition at line 672 of file bars.h.

00672 { return Slot; }

OpState DialogBarOp::GetState String_256 Description,
OpDescriptor
[static]
 

Find out the state of the operation at the specific time.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/2/94
Parameters:
Description - GetState fills this string with an approriate description [OUTPUTS] of the current state of the push tool
Returns:
The state of the operation, so that menu items (ticks and greying can be done properly

Definition at line 2163 of file bars.cpp.

02164 {
02165     OpState State;
02166     
02167     return State;
02168 }

UINT32 DialogBarOp::GetUniqueID  ) 
 

This function returns a uniqueID i.e. highest + 1.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DialogBarOp::UpdateStateOfAllBars

Definition at line 2395 of file bars.cpp.

02396 {
02397     UINT32 HighestSoFar = 100;
02398     UINT32 FoundID =0;
02399 
02400     if (WindowID != NULL)  // If the WindowID is NULL then the DialogBar has not been created
02401     {
02402         for (BarItem* CurrentBarItem = (BarItem*)BarItemList.GetHead();
02403                  CurrentBarItem != NULL; 
02404                  CurrentBarItem = (BarItem*)BarItemList.GetNext( (ListItem*)CurrentBarItem ))
02405         {
02406             if (CurrentBarItem->IsKindOf(CC_RUNTIME_CLASS(BarControl)))
02407             {
02408                 BarControl* BarCtrl = (BarControl*)CurrentBarItem;
02409                 FoundID = BarCtrl->GetUniqueGadgetID();
02410                 if(FoundID >HighestSoFar)
02411                     HighestSoFar = FoundID;                 
02412                 
02413             }
02414         }
02415     } 
02416     return HighestSoFar + 1;
02417 }

BOOL DialogBarOp::HideDisableGadgetAndResuffleBar CWindowID  WinID  ) 
 

This function is the saviour of camelots GUI infobars - several of which have become too crowded, and as such; their controls no longer fit into the 'static' docked infobar. The function hides the requested control and automatically resuffles those controls that occur after it. For example: Combo1, Combo2, Combo3; call on Combo1 gives: Combo2, Combo3 If you are calling this operation - you MUST ensure that the infobar (which is WinID's parent) has been handled within winoil.cpp. Refer (basebar2.cpp) line 1311 for the code that MUST be checked/edited (or search on DialogBarOp::HideDisableGadgetAndResuffleBar). If you want to see an example of how to use this function correctly, consult tool.cpp - since this is the first place the function was used within camelot. TIP: I would recommend that you hide the controls in a left to right order (i.e. leftmost first).

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/9/99
Parameters:
WinID - the handle to the control that this operation is to be performed on [INPUTS]
- [OUTPUTS]
Returns:
TRUE - if operation successful (i.e. could be applied to this infobar) FALSE - if operation was NOT successful

Errors: -

See also:
BOOL DialogBarOp::ShowEnableGadgetAndResuffleBar (CWindowID WinID) BOOL DialogBarOp::ResetHiddenGadgetStates ()

Definition at line 537 of file bars.cpp.

00538 {   
00539     /*KernelBarPos*     pKernelBarPos;
00540     DockBarType     Dock;
00541     
00542     if (GetMainFrame()->GetBarPosInfo(GetParent ((HWND) WinID),&Dock,&pKernelBarPos))
00543     {
00544         SetDockBarType(Dock);
00545         if (Dock == DOCKBAR_FLOAT)
00546             SetFloatingCPoint(wxPoint(pKernelBarPos->x,pKernelBarPos->y));
00547         else
00548         {
00549             SetSlot(pKernelBarPos->Slot);
00550             SetOffset(pKernelBarPos->Position);
00551         }
00552     }
00553 
00554     // Save this info bar's data in the static vars
00555     // These vars are used by
00556     DialogBarOp::Dock           = GetDockBarType();
00557     DialogBarOp::Slot           = GetSlot();
00558     DialogBarOp::Offset         = GetOffset();
00559     DialogBarOp::FloatPos       = GetFloatingCPoint();
00560     
00561     switch (GetDockBarType ())
00562     {
00563         case DOCKBAR_LEFT:      // This should not be possible for infobars
00564         return (FALSE);         // NOT a chance!
00565         case DOCKBAR_RIGHT:     // This should not be possible for infobars
00566         return (FALSE);         // NOT a chance!
00567         case DOCKBAR_TOP:       
00568             // handle internally - so that caller does NOT have to worry ....
00569             EnableGadget (CamalotSDKGetDlgCtrlID (WinID), FALSE);
00570         break;                  // will process this one (cause its of static size)
00571         case DOCKBAR_BOTTOM:
00572             // handle internally - so that caller does NOT have to worry ....
00573             EnableGadget (CamalotSDKGetDlgCtrlID (WinID), FALSE);
00574         break;                  // will process this one (cause its of static size)
00575         case DOCKBAR_FLOAT:
00576             // handle internally - so that caller does NOT have to worry ....
00577             EnableGadget (CamalotSDKGetDlgCtrlID (WinID), FALSE);
00578         return (FALSE);         // we will NOT process this because of the problems
00579                                 // it causes
00580         case DOCKBAR_INVALID:   // god knows !!!!
00581         return (FALSE);
00582     }
00583     
00584     RECT windowRect;
00585 
00586     CamalotSDKGetWindowRect (WinID, &windowRect);
00587 
00588     POINT topLeft;
00589     topLeft.x = windowRect.left;
00590     topLeft.y = windowRect.top;
00591 
00592     CamalotSDKScreenToClient (CamalotSDKGetParent (WinID), &topLeft);
00593 
00594     INT32 xLength = windowRect.right - windowRect.left;
00595 
00596     BarItem* hideControl = GetBarItem ((HWND) WinID);
00597     BarControl* hideBControl = NULL;
00598 
00599     if (hideControl->IsKindOf(CC_RUNTIME_CLASS(BarControl)))
00600     {
00601         hideBControl = (BarControl*) hideControl;
00602     }
00603     
00604     // firstly, lets hide the gadget that this operation has been requested for ....
00605 
00606     if (hideBControl->IsVisible () == TRUE)
00607     {
00608         hideBControl->SetVisibleState (FALSE);
00609 
00610         CamalotSDKShowWindow (WinID, SW_HIDE);
00611 
00612         //BarItem* hideControl = GetBarItem ((HWND) WinID);
00613         BarItem* prevControl = GetPtrBarPrev (hideControl);
00614         BarItem* nextControl = GetPtrBarNext (hideControl);
00615 
00616         if (prevControl->IsKindOf(CC_RUNTIME_CLASS(BarSeparator)))
00617         {   
00618             if (!(GetMainFrame()->GetDockBar(GetDockBarType ())->IsBigControls()))
00619             {
00620                 xLength += SMALL_SEPARATOR;
00621             }
00622             else
00623             {
00624                 xLength += LARGE_SEPARATOR;
00625             }
00626         }
00627 
00628         while (nextControl != NULL)
00629         {
00630             CWindowID barCtrlID  = NULL;
00631             BarControl* barCtrl = NULL;
00632 
00633             if (nextControl->IsKindOf(CC_RUNTIME_CLASS(BarControl)))
00634             {
00635                 barCtrl = (BarControl*) nextControl;
00636                 barCtrlID = barCtrl->GetWinID ();
00637 
00638                 CamalotSDKGetWindowRect (barCtrlID, &windowRect);
00639                 topLeft.x = windowRect.left;
00640                 topLeft.y = windowRect.top;
00641             
00642                 CamalotSDKScreenToClient (CamalotSDKGetParent (WinID), &topLeft);
00643                 topLeft.x -= xLength;
00644                 //windowRect.right -= xLength;
00645 
00646                 BarItem* controlSep = GetPtrBarPrev (nextControl);
00647                 
00648                 INT32 sepLength = 0;
00649 
00650                 if (controlSep->IsKindOf(CC_RUNTIME_CLASS(BarSeparator)))
00651                 {   
00652                     if (!(GetMainFrame()->GetDockBar(GetDockBarType ())->IsBigControls()))
00653                     {
00654                         sepLength += SMALL_SEPARATOR;
00655                     }
00656                     else
00657                     {
00658                         sepLength += LARGE_SEPARATOR;
00659                     }
00660                 }
00661 
00662                 //InvalidateRect (GetParent ((HWND) WinID), &windowRect, TRUE);
00663 
00664                 CamalotSDKMoveWindow ((HWND) barCtrlID, topLeft.x, topLeft.y,
00665                                       windowRect.right - windowRect.left,
00666                                       windowRect.bottom - windowRect.top, TRUE);*/
00667 
00668                 /*RECT sepRect;
00669                 sepRect.right = windowRect.left;
00670                 sepRect.left = sepRect.right - sepLength;
00671                 sepRect.top = windowRect.top;
00672                 sepRect.bottom = windowRect.bottom;
00673 
00674                 InvalidateRect (GetParent ((HWND) WinID), &sepRect, TRUE);*/
00675 
00676             // need to do this - cause camelots bubble help system sometimes gets
00677             // broken otherwise ....
00678 
00679             //InvalidateRect (GetParent ((HWND) hideControl), NULL, TRUE);
00680             //BringWindowToTop ((HWND) barCtrlID);
00681 
00682 /*          }
00683 
00684             nextControl = (BarItem*) BarItemList.GetNext(nextControl);
00685         }
00686         return (TRUE);
00687     }
00688     else
00689     {
00690         return (FALSE);
00691     }*/
00692     
00693     return (TRUE);//FALSE);
00694 }

BOOL DialogBarOp::Init void   )  [static]
 

Adds the operation to the list of all known operations.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/2/94
Returns:
TRUE if all went OK, FALSE otherwise

Reimplemented from SimpleCCObject.

Reimplemented in SystemBarOp, and TextInfoBarOp.

Definition at line 2124 of file bars.cpp.

02125 {
02126     BOOL ok;
02127     ok = (RegisterOpDescriptor(
02128                                 0, 
02129                                 _R(IDS_MARKN_EMPTY),
02130                                 CC_RUNTIME_CLASS(DialogBarOp), 
02131                                 OPTOKEN_DLGBAROP,
02132                                 NULL,       // No GetState fn
02133                                 0,          /* help ID */
02134                                 _R(IDBBL_NOOP), /* bubble ID */
02135                                 0           /* bitmap ID */
02136                                 )
02137             ); 
02138 
02139     if (Camelot.DeclareSection( _T("DebugFlags"), 10))
02140         Camelot.DeclarePref( NULL, _T("ShowSystemBars"), &ShowSystemBars, FALSE, TRUE );
02141     if (Camelot.DeclareSection(_T("BarsPath"),2))
02142         Camelot.DeclarePref(_T("BarsPath"), _T("DefaultBarsConfigPath"), &DefaultBarsConfigPath);
02143     if (Camelot.DeclareSection(_T("BarsVer"),2))
02144         Camelot.DeclarePref(_T("BarsVer"), _T("BarsVersion"), &BarsVersion);
02145     return (ok);
02146 }

void DialogBarOp::InsertItemAfter LISTPOS  here,
BarItem thisItem
 

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
here = position of the bar item to be moved. [INPUTS] newpos = the new pos of the bar item
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 495 of file bars.cpp.

00496 {
00497 
00498     UINT32 NoItems = GetNumBarItems();
00499     if(here == -1)
00500         BarItemList.AddHead(thisItem);
00501     else if ((unsigned)here >= NoItems)
00502         BarItemList.AddTail(thisItem);
00503     else
00504         BarItemList.InsertAfter(here,thisItem);
00505 }

BarItem * DialogBarOp::InsertItemBefore BarItem here,
BarItem newItem
 

Allows you to insert a bar item.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1192 of file bars.cpp.

01193 {
01194     ListItem * item;
01195     item = BarItemList.InsertBefore((ListItem*) here, (ListItem*) newItem); 
01196     return (BarItem *)item;
01197 }

BOOL DialogBarOp::IsABar  )  [inline, virtual]
 

Reimplemented from DialogOp.

Definition at line 592 of file bars.h.

00592 {return TRUE;}

BOOL DialogBarOp::IsAllBarsOp  ) 
 

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/5/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this is the special bar that contains all controls

Errors: -

See also:
-

Definition at line 5711 of file bars.cpp.

05712 {
05713     
05714     return this == AllBarsOp;
05715         
05716     //return Name == String_32(_R(IDS_CONTROLBANKNAME));
05717 
05718 }

BOOL DialogBarOp::IsHorizontal  )  [inline]
 

Definition at line 684 of file bars.h.

00684 { return (BarOrientation == Horizontal); }

BOOL DialogBarOp::IsListEmpty  ) 
 

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if List is empty FALSE otherwise

Errors: -

See also:
-

Definition at line 1130 of file bars.cpp.

01131 {
01132     return (BarItemList.IsEmpty());
01133 }

BOOL DialogBarOp::LoadBars  )  [static]
 

loads in, and then creates initial bars This function must get called after the docking bars have been created

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> & MarkN
Date:
20/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful

Errors: -

See also:
LoadBarsFromFile,LoadBarsFromRes,CreateBars

Definition at line 2804 of file bars.cpp.

02805 {  
02806 #pragma message( __LOCMSG__ "DialogBarOp::LoadBars - do nothing" )
02807     TRACE( _T("Warning - DialogBarOp::LoadBars called") );
02808 //  return LoadNamedBars(GetMainFrame()->InFullScreenMode() ? "clean" : "normal");
02809 
02810     return false;
02811 }

BOOL DialogBarOp::LoadBarsFromRes  )  [static, protected]
 

loads in bars from the bars.ini resource that's bound into the exe. This function must get called after the docking bars have been created

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful

Errors: -

See also:
LoadBarsFromFile,LoadBars,CreateBars

Definition at line 3086 of file bars.cpp.

03087 {  
03088     BOOL ok = TRUE;
03089 //if (IsUserName("MarkN")) TRACE( _T("DialogBarOp::LoadBarsFromRes()\n"));
03090 #pragma message( __LOCMSG__ "DialogBarOp::ReadResVersion- do nothing" )
03091     TRACE( _T("Warning - DialogBarOp::ReadResVersion called") );
03092 /*
03093     BOOL open=FALSE; 
03094     UINT32 NumBars;
03095     UINT32 NumDockingBars;
03096     CCResTextFile file; // Resource File
03097     DialogBarOpCreate BarCreate;
03098 
03099     if (ok) ok = open = file.open(_R(IDM_DEFAULT_BARS), _R(IDT_CAM_BARS_RES));
03100     if (ok) ok = ReadBarsFromFile(file,BarCreate,&NumBars,&NumDockingBars);
03101     if (ok) ok = ((NumBars > 0) && (NumDockingBars == NUM_DOCKBARS));
03102     
03103     if (open) file.close(); */
03104 
03105     return ok; 
03106 }

BOOL DialogBarOp::LoadDefaultBars  )  [static]
 

loads in, and then creates initial bars This function must get called after the docking bars have been created

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> & MarkN
Date:
20/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful

Errors: -

See also:
LoadBarsFromFile,LoadBarsFromRes,CreateBars

Definition at line 2685 of file bars.cpp.

02686 {  
02687     BOOL ok=TRUE;
02688     if (ok)  ok = LoadBarsFromRes();    // When we are able to read BARS.INI from file, delete
02689                                         // this line and uncomment the two above
02690     if (ok)  ok = CreateBars();
02691     return ok;
02692 
02693 }

BOOL DialogBarOp::LoadNamedBarFile String_256  FileName,
BOOL *  Opened
[static, protected]
 

loads in bar defs from *.confile. This function must get called after the docking bars have been created

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/10/94
Parameters:
FileName - file to load [INPUTS] Opened - flag.. did we open the file
- [OUTPUTS]
Returns:
TRUE if successful

Errors: -

See also:
LoadBars,LoadBarsFromRes,CreateBars

Definition at line 2954 of file bars.cpp.

02955 {  
02956 #pragma message( __LOCMSG__ "DialogBarOp::LoadNamedBarFile - do nothing" )
02957     TRACE( _T("Warning - DialogBarOp::LoadNamedBarFile called") );
02958 /*  BOOL ok = TRUE;
02959     BOOL open = FALSE;
02960     UINT32 NumBars = 0;
02961     UINT32 NumDockingBars = 0; 
02962     
02963 #ifdef SAVE_PREFS_TO_REGISTRY
02964     // Try and read the separate bars settings from the registry
02965     // First work out the section name we require and then open it up ready for reading
02966     String_256 KeySectionName;
02967     if (!FileName.CompareTo("normal"))
02968         KeySectionName = PRODUCT_REGISTRYKEY_BARSNORMAL;
02969     else
02970         KeySectionName = PRODUCT_REGISTRYKEY_BARSFULL;
02971 
02972     HKEY hRegKey = OpenRegKey(hAppStateRegKey, KeySectionName);
02973     // Was that section there?
02974     // If we failed then read bars from the ini file
02975     if (hRegKey != NULL)
02976     {
02977         // Say that we have opened the file and try to read in definitions
02978         // so if we fail then the caller gets a chance to destruct things.
02979         *Opened = TRUE;
02980         // We opened the key so its present. Read all the sub sections from there.
02981         ok = ok && ReadDockingBarsFromRegistry(hRegKey);
02982         ok = ok && ReadWorkSpaceInfoFromRegistry(hRegKey);
02983         ok = ok && ReadBarsFromRegistry(hRegKey);
02984         CloseRegKey(hRegKey);
02985     }
02986     else
02987 #endif
02988     {
02989         // If the main ini file is in the registry then don't even think about using ini files.
02990         // This is because the version number of the bars is stored in the ini file!!!! We will
02991         // have already checked the one stored in the registry rather than the one in the
02992         // ini file. So this would be an unsafe operation.
02993         // If we are not using the registry then we will have used the ini file version number
02994         // and so it is safer.
02995         if (CCamApp::AreWeUsingTheRegistry())
02996             return FALSE;
02997         
02998         // Read all of the data from the ini file
02999 
03000         //Find the path to a valid *.con file
03001         ok = SetValidPath((TCHAR *)FileName);
03002         
03003         if(!ok)
03004             return ok;
03005 
03006         PathName path  = ValidPath;
03007         CCDiskFile file;
03008         DialogBarOpCreate BarCreate;
03009         if (ok) ok = open = file.open(path,ios::in);
03010         if (ok) ok = ReadBarsFromFile(file,BarCreate,&NumBars,&NumDockingBars);
03011         if (ok) ok = ((NumBars > 0) && (NumDockingBars == NUM_DOCKBARS));
03012         if (open) file.close();
03013         if(!ok)
03014             TRACEUSER( "Neville", _T("Can't find a bars file - loading from resources\n"));
03015         * Opened = open;
03016     }
03017 
03018     return ok; */
03019 
03020     return false;
03021 }

BOOL DialogBarOp::LoadNamedBars String_256  FileName  )  [static]
 

loads in, and then creates initial bars This function must get called after the docking bars have been created

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> & MarkN
Date:
20/4/94
Parameters:
FileName This dictates whether we look for the full screen or normal [INPUTS] mode file. Should be either "Normal" or "Clean" when "Clear" corresponds to the full screen operation.
- [OUTPUTS]
Returns:
TRUE if successful

Errors: -

See also:
LoadBarsFromFile,LoadBarsFromRes,CreateBars

Definition at line 2713 of file bars.cpp.

02714 {  
02715 #pragma message( __LOCMSG__ "DialogBarOp::LoadNamedBars - do nothing" )
02716     TRACE( _T("Warning - DialogBarOp::LoadNamedBars called") );
02717 /*  // Simon - In dire emergency please uncomment this back in - Chris.
02718         
02719 //  if (ok)  ok = LoadBarsFromRes();    // When we are able to read BARS.INI from file, delete
02720 //                                      // this line and uncomment the two above
02721 //  if (ok)  ok = CreateBars();
02722 //  return ok;
02723     
02724     BOOL ok=FALSE;
02725     BOOL LoadFromRes =FALSE;
02726     BOOL BadBarsFile=FALSE;
02727     BOOL FileOpened = FALSE;
02728     
02729     #ifndef STANDALONE
02730     if(!ReadResVersion())
02731     {
02732         // look for bars config file
02733         ok = LoadNamedBarFile((TCHAR *)FileName,&FileOpened);
02734 
02735         if(FileOpened)
02736             // Note if it's a bad bars file
02737             BadBarsFile=!ok;
02738     }
02739     else
02740         ok = FALSE;
02741     #endif
02742 
02743     // Failed so we'd better load from resources !!
02744     if(!ok)
02745     {
02746         // kill all bars ( except infobar at the mo..) in case any were created with a bad bars file
02747         if (BadBarsFile)
02748         {
02749             BROADCAST_TO_CLASS(DialogMsg(NULL, DIM_BAR_DEATH, NULL ),DialogBarOp);
02750         }
02751 
02752         // load default bars from the bound in resource files
02753         LoadFromRes = ok = LoadBarsFromRes();
02754         ERROR2IF(!ok,FALSE,"Serious error - unable to load bars from bound in resource files");
02755     }
02756 
02757     if (ok) ok = CreateBars();
02758 
02759     // I dont like this very much but it gets round the need to distribute 2 config files
02760     // we can probably lose this for the release - note it should also go if we shift up 
02761     // to multiple config files Chris. 
02762     if(ok)
02763     {
02764         if(!(FileName.CompareTo("clean")))
02765         {
02766             if(!GetMainFrame()->IsFullScreenMode())
02767             {
02768                 GetMainFrame()->DoFullScreenMode(TRUE);
02769                 if(LoadFromRes)
02770                 {
02771                     GetMainFrame()->ShowStatusBar(FALSE);
02772                     GetMainFrame()->ShowScrollBars(FALSE);  
02773                 }
02774             }
02775         }
02776     }
02777 
02778     // If we come across a bad bars file, tell the user
02779     ERROR1IF(BadBarsFile,ok,_R(IDE_BADBARSFILE));
02780 
02781     return (ok); */
02782 
02783     return false;
02784 }

BOOL DialogBarOp::MakeControlBank  )  [static]
 

Build a control bar that contains all the controls defined in the bars.ini resource.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/5/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Errors: -

See also:
-

Definition at line 2026 of file bars.cpp.

02027 {
02028 #pragma message( __LOCMSG__ "DialogBarOp::MakeControlBank - do nothing" )
02029     TRACE( _T("Warning - DialogBarOp::MakeControlBank called") );
02030 /*  // create the bar
02031     if(DialogBarOp::AllBarsOp == NULL)
02032     {
02033         AllBarsOp = new DialogBarOp(String_32(_R(IDS_CONTROLBANKNAME)));
02034         AllBarsOp->SetDockBarType(DOCKBAR_FLOAT);
02035         AllBarsOp->InitiallyVisible = FALSE;
02036     }
02037     ERROR2IF(AllBarsOp==NULL,FALSE,"NULL AllBarsOp");
02038     
02039     BOOL ok = TRUE,open=FALSE,finished=FALSE,InBar= FALSE; 
02040     INT32 Count = 0 ;
02041 
02042     CCResTextFile file; // Resource File
02043     DialogBarOpCreate BarCreate;
02044 
02045     if (ok) ok = open = file.open(_R(IDM_DEFAULT_BARS), _R(IDT_CAM_BARS_RES));
02046     if(!open)
02047         return FALSE;
02048     
02049     file.InitLexer();                   // Initialise lexing routines
02050     file.SetDelimiters("\r\n");         // Set token delimiting characters
02051     file.SetCommentMarker(';');         // Set comment marker char
02052     file.SetWhitespace(" \t");          // Set whitespace chars
02053     file.SetStringDelimiters("\"\"");   // Set string delimiters
02054 
02055     TokenIndex Token;
02056     const TCHAR* TokenBuf = file.GetTokenBuf();
02057     BarItem* pBarItem;
02058 
02059     while (ok)
02060     {
02061         pBarItem = NULL;
02062         ok = file.GetSimpleToken();
02063 
02064         if (ok)
02065         {
02066             Token = FindToken(TokenBuf);
02067             switch (Token)
02068             {
02069                 case TOKEN_BAR           : 
02070                     InBar = TRUE; break;
02071                 case TOKEN_BAR_CONTROL   : 
02072                     if(InBar)
02073                         pBarItem = new BarControl; Count ++;  break;
02074                 case TOKEN_BAR_SEPARATOR : 
02075                     if(InBar)                   
02076                         pBarItem = new BarSeparator;  break;
02077                 case TOKEN_BAR_END       :
02078                     InBar = FALSE ; break;
02079             }
02080 
02081 
02082             if (pBarItem && InBar)
02083             {
02084                 if( Count == 11 )
02085                 {
02086                     BarLineFeed* pBarItem = new BarLineFeed;
02087                     AllBarsOp->AddBarItem(pBarItem);
02088                     Count =0;
02089                 }
02090             
02091                 if (ok) ok = pBarItem->Read(file);
02092                 if (ok) AllBarsOp->AddBarItem(pBarItem);
02093                 if (!ok) 
02094                 {
02095                     if (pBarItem != NULL) delete pBarItem;
02096                     AllBarsOp->DeleteAllBarItems();
02097                     if (open) file.close();
02098                     return FALSE;
02099                 }
02100             }
02101         
02102         }// end if ok
02103     }// end while
02104     
02105     if(open) file.DeinitLexer();
02106     
02107     if (open) file.close();
02108     return TRUE; */
02109 
02110     return false;
02111 }

MsgResult DialogBarOp::Message Msg Msg  )  [virtual]
 

The default DialogBarOp Message handler This should be overriden for InformationBar DialogBarOps which will have a structure identical to DialogOps.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/94
Parameters:
Msg,: The message to handle [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from DialogOp.

Reimplemented in SystemBarOp, InformationBarOp, BevelInfoBarOp, BezToolInfoBarOp, BlendInfoBarOp, BlankInfoBarOp, ContourInfoBarOp, GradInfoBarOp, TranspInfoBarOp, FreeHandInfoBarOp, GridInfoBarOp, LiveEffectsInfoBarOp, MouldInfoBarOp, PenToolInfoBarOp, QuickShapeBaseInfoBarOp, SelectorInfoBarOp, SliceInfoBarOp, TextInfoBarOp, and ZoomInfoBarOp.

Definition at line 2241 of file bars.cpp.

02242 {
02243     BOOL DestroyWindow = FALSE; // Set to TRUE if we should destroy the bars window  
02244     // allow Cancel / BarDeath messages through even for ops with no window
02245     if(MESSAGE_IS_A(Msg,KeyMsg))
02246     {
02247         KeyMsg* KMsg = (KeyMsg*)Msg;
02248         if( KMsg->pKeyPress->GetVirtKey() == CAMKEY(ESCAPE) || 
02249             KMsg->pKeyPress->GetVirtKey() == CAMKEY(CANCEL) )
02250         {
02251             if(BaseBar::EscPressed( KMsg->pKeyPress->IsPress() ))
02252                 return EAT_MSG;
02253         }
02254         else if( KMsg->pKeyPress->GetVirtKey() == CAMKEY(CONTROL) )
02255         {
02256             if(BaseBar::CtlPressed( KMsg->pKeyPress->IsPress() ))
02257                 return EAT_MSG;
02258         }
02259         else if( KMsg->pKeyPress->GetVirtKey() == CAMKEY(MENU) )
02260         {
02261             if(BaseBar::AltPressed( KMsg->pKeyPress->IsPress() ))
02262                 return EAT_MSG;
02263         }
02264         
02265     }   
02266 
02267     else if (IS_OUR_DIALOG_MSG(Msg)||
02268          Msg->IsKindOf(CC_RUNTIME_CLASS(DialogMsg)) &&
02269             ((DialogMsg*)Msg)->DlgMsg == DIM_BAR_DEATH )
02270 
02271     {
02272         
02273         // It's a dialog message 
02274         DialogMsg* DlgMsg = (DialogMsg*)Msg; 
02275         if(DlgMsg->DlgMsg==DIM_BAR_DEATH)
02276         {
02277             if(IS_KIND_OF(InformationBarOp))
02278                 return (DLG_EAT_IF_HUNGRY(DlgMsg)); 
02279         
02280             if(IsAllBarsOp())
02281                 return (DLG_EAT_IF_HUNGRY(DlgMsg)); 
02282         }            
02283 
02284 // The equivalend of the following now done in DialogOp so "bar" controls (i.e. ones with
02285 // associated OpDescriptors can live in classes derived from DialogOp (not DialogBarOp)
02286 #if 0
02287         OpDescriptor* OpDesc = NULL;
02288         BarControl* BarCtrl = NULL;
02289 
02290         // Traverse the list of all BarItems
02291         for (BarItem* CurrentBarItem = (BarItem*)BarItemList.GetHead();
02292              CurrentBarItem != NULL; 
02293              CurrentBarItem = (BarItem*)BarItemList.GetNext((ListItem*)CurrentBarItem ))
02294         {
02295             if (CurrentBarItem->IsKindOf(CC_RUNTIME_CLASS(BarControl)))
02296             {
02297                 BarCtrl = (BarControl*)CurrentBarItem;
02298                 BarControlInfo BarCtrlInfo = BarCtrl->GetBarControlInfo(BarOrientation == Horizontal);  
02299                    
02300                 // Obtain the OpDescriptor
02301                 OpDesc = (BarCtrl)->
02302                         GetOpDescriptor(BarOrientation == Horizontal);
02303                 
02304                 //ENSURE(OpDesc != NULL, "DialogBarOp has a NULL OpDescriptor"); 
02305                 if (OpDesc != NULL)
02306                 {
02307                     OpDesc->SetBarControlInfo(BarCtrlInfo);
02308                     SendMessageToBarControl(OpDesc, DlgMsg, BarCtrlInfo.ControlID, BarCtrl->GetUniqueGadgetID() );
02309                 }
02310             }
02311         }
02312 #endif
02313         
02314         if (DlgMsg->DlgMsg == DIM_CANCEL||DlgMsg->DlgMsg == DIM_BAR_DEATH)
02315         {
02316 PORTNOTE("other", "Removed GetBarPosInfo usage")
02317 #ifndef EXCLUDE_FROM_XARALX
02318             KernelBarPos*   pKernelBarPos;
02319             DockBarType     Dock;
02320             if (GetMainFrame()->GetBarPosInfo(WindowID,&Dock,&pKernelBarPos))
02321             {
02322                 SetDockBarType(Dock);
02323                 if (Dock == DOCKBAR_FLOAT)
02324                     SetFloatingCPoint(wxPoint(pKernelBarPos->x,pKernelBarPos->y));
02325                 else
02326                 {
02327                     SetSlot(pKernelBarPos->Slot);
02328                     SetOffset(pKernelBarPos->Position);
02329                 }
02330             }
02331 #endif
02332             
02333             // This is new and may cause problems - it used to only be set on
02334             // a cancel message to a control but now overides default close handling
02335             // allowing bars and galleries to be closed on a single click
02336 
02337             DestroyWindow = TRUE;
02338         }
02339         
02340         if (DestroyWindow && WindowID != NULL)
02341         {
02342             // Destroy the bar window                            
02343             CCamApp::GetDlgManager()->Delete(WindowID, this);
02344             WindowID = NULL;
02345         }
02346 
02347         if (DlgMsg->DlgMsg == DIM_CANCEL||DlgMsg->DlgMsg == DIM_BAR_DEATH)
02348         {
02349             // Report bar is closing to interested parties
02350             BROADCAST_TO_CLASS(BarMsg(BAR_CLOSE,this),DialogOp);
02351             // This should only be called if we really want to destroy the bar list
02352             // So far only used when we are about to read in another *.ini file 
02353         }
02354         if(DlgMsg->DlgMsg == DIM_BAR_DEATH)
02355         {
02356         
02357             End();
02358             return(OK);
02359         }
02360         return DialogOp::Message(Msg);
02361     
02362     //  return (DLG_EAT_IF_HUNGRY(DlgMsg));  
02363     
02364     }
02365         
02366     // We must destroy the dialog if the application is dying
02367     else if (MESSAGE_IS_A(Msg,DeathMsg))
02368     {
02369         // Camelot is ending, so end the Op
02370         End();
02371         return OK;
02372         // ** Note: We do not need to send an OpDescControlDestroyMsg to all OpDescriptors on
02373         // receipt of a DeathMsg as a DIM_CANCEL message should have already sent these !
02374     }
02375 
02376     return DialogOp::Message(Msg);
02377 }

void DialogBarOp::MoveBarItem LISTPOS  here,
LISTPOS  newpos
 

Moves the bar item at 'here' to a new position in the bar. All items that were at positions from 'newpos' onwards before the call and shuffled along one position to accommodate the move.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
here = position of the bar item to be moved. [INPUTS] newpos = the new pos of the bar item
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 929 of file bars.cpp.

00930 {
00931     if (here == newpos) return;
00932 
00933     BarItem* pBarItem = RemoveBarItem(here);
00934 
00935     if (pBarItem == NULL) return;
00936 
00937     if ((unsigned)newpos >= GetNumBarItems())
00938         BarItemList.AddTail(pBarItem);
00939     else
00940         BarItemList.InsertBefore(newpos,pBarItem);
00941 }

BOOL DialogBarOp::Read LoadRegistryEntries Loader  )  [virtual]
 

Read the dialog bar or super gallery definition from the registry.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/2/97
Parameters:
Loader = the class to use to load the data from the registry. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Errors: -

See also:
-

Reimplemented in SystemBarOp.

Definition at line 1672 of file bars.cpp.

01673 {
01674 #pragma message( __LOCMSG__ "BaseTextClass::PreOpProcessing - do nothing" )
01675     TRACE( _T("Warning - BaseTextClass::PreOpProcessing called") );
01676 /*  BOOL ok = TRUE;
01677 
01678     HKEY hRegKey = Loader.GetRegKey();
01679     if (hRegKey == NULL)
01680     {
01681         //ERROR3("DialogBarOp::Read failed to get registry key");
01682         return FALSE;
01683     }
01684 
01685     // Read the name of the bar from the registry
01686     String_256 BarName;
01687     ok = GetRegString(hRegKey, TEXT("Name"), &BarName);
01688     Name = BarName;
01689 
01690     DockBarType ReadDock = (DockBarType)GetRegInt(hRegKey, TEXT("Dock"));
01691     // check that the value read in is ok
01692     switch (ReadDock)
01693     {
01694         case DOCKBAR_TOP:
01695         case DOCKBAR_BOTTOM:
01696         case DOCKBAR_LEFT:
01697         case DOCKBAR_RIGHT:
01698         case DOCKBAR_FLOAT:
01699             Dock = ReadDock;
01700             break;
01701         default : 
01702             ok = FALSE;
01703             TRACE( _T("Unrecognised bar position : '%d'"),ReadDock);
01704             break;
01705     }
01706 
01707     if (Dock == DOCKBAR_FLOAT)
01708     {
01709         FloatPos.x = GetRegDword(hRegKey, TEXT("x"));
01710         FloatPos.y = GetRegDword(hRegKey, TEXT("y"));
01711     }
01712     else
01713     {
01714         Slot = GetRegDword(hRegKey, TEXT("Slot"));
01715         Offset = GetRegDword(hRegKey, TEXT("Offset"));
01716     }
01717 
01718     INT32 Width = GetRegDword(hRegKey, TEXT("Width"));
01719     INT32 Height = GetRegDword(hRegKey, TEXT("Height"));
01720     if (Width > 0 && Height > 0)
01721     {
01722         BarRect.width  = Width;
01723         BarRect.height = Height;
01724     }
01725 
01726     // Visibility applies to all bars so get the visibility of the bar
01727     InitiallyVisible = GetRegBool(hRegKey, TEXT("Visibility"));
01728 
01729     // Now read in the controls for that bar
01730     String_256 data;
01731     BOOL finished = FALSE;
01732     BarItem* pBarItem = NULL;
01733     while (!finished && ok)
01734     {
01735         // blank our reading string
01736         data.Empty();
01737 
01738         // get the next line from the registry
01739         ok = Loader.LoadNextEntry(&data);
01740         if (ok)
01741         {
01742             // Get the first word up to the next white space character from the string
01743             String_256 FoundToken;
01744             INT32 index = data.FindNextChar(' ', 0);
01745             if (index == -1)
01746             {
01747                 // There is no white space character so use whole word
01748                 FoundToken = data;
01749             }
01750             else
01751             {
01752                 // stick the word into our string
01753                 data.Left(&FoundToken, index);
01754             }
01755 
01756             // cant do a switch, must do it the hard way
01757             if (FoundToken == String_256(TokenTable[TOKEN_BAR_CONTROL].Token))
01758                 pBarItem = new BarControl;
01759             else if (FoundToken == String_256(TokenTable[TOKEN_BAR_SEPARATOR].Token))
01760                 pBarItem = new BarSeparator;
01761             else if (FoundToken == String_256(TokenTable[TOKEN_BAR_NEWPAGE].Token))
01762                 pBarItem = new BarNewPage;
01763             else if (FoundToken == String_256(TokenTable[TOKEN_BAR_LINEFEED].Token))
01764                 pBarItem = new BarLineFeed;
01765             else if (FoundToken == String_256(TokenTable[TOKEN_DDECKER_TOP].Token))
01766                 pBarItem = new DDeckerTop;
01767             else if (FoundToken == String_256(TokenTable[TOKEN_DDECKER_BOTTOM].Token))
01768                 pBarItem = new DDeckerBottom;
01769             else if (FoundToken == String_256(TokenTable[TOKEN_DDECKER_END].Token))
01770                 pBarItem = new DDeckerEnd;
01771             else if (FoundToken == String_256(TokenTable[TOKEN_BAR_END].Token))
01772                 finished = TRUE;  
01773             else if (FoundToken == String_256(TokenTable[TOKEN_GALLERY_END].Token))
01774                 finished = TRUE;
01775             else
01776             {
01777                 ok = FALSE;
01778                 TRACE( _T("Unexpected token string : '%s'\n"),(TCHAR*)FoundToken);
01779             }
01780 
01781             if (!finished && ok && pBarItem != NULL)
01782             {
01783                 // Ask the bar item to parse the rest of its details from the string
01784                 // First transfer the remainder of the string into a new one skipping
01785                 // the space after the details
01786                 String_256 BarItemDef;
01787                 data.Mid(&BarItemDef, index + 1, data.Length() - (index + 1));
01788                 // and now ask the bar item to parse it
01789                 if (ok) ok = pBarItem->Read(&BarItemDef);
01790                 if (ok) AddBarItem(pBarItem);
01791 
01792                 if (!ok) 
01793                 {
01794                     if (pBarItem != NULL) delete pBarItem;
01795                     DeleteAllBarItems();
01796                     return FALSE;
01797                 }
01798             }
01799         }
01800         else
01801             finished = TRUE;
01802     }
01803 
01804     return TRUE; */
01805 
01806     return true;
01807 }

BOOL DialogBarOp::Read CCLexFile file  ) 
 

Read the dialog bar from the file in a tokenized form.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/4/94
Parameters:
file = a file to read the dialog bar from. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Errors: -

See also:
-

Reimplemented in SystemBarOp, and InformationBarOp.

Definition at line 1479 of file bars.cpp.

01480 {
01481     TokenIndex Token;
01482     const TCHAR* TokenBuf = file.GetTokenBuf();
01483     BOOL ok;
01484 
01485     // Read the bar's name
01486     ok = file.GetSimpleToken();
01487 
01488     if (ok)
01489     {
01490         // The token is either a string or an ID...
01491         LexTokenType TokenType = file.GetTokenType();
01492 
01493         switch (TokenType)
01494         {
01495             case TOKEN_NORMAL:
01496                 {
01497                     INT32 ID = 0;
01498                     ok = (camSscanf(TokenBuf, _T("%li"), &ID) == 1);
01499                     if(ID == 0)
01500                     {
01501                         Name.operator=((const TCHAR*) TokenBuf);
01502                     }
01503                     else
01504                     {
01505                         Name=ID;
01506                     }
01507                 }
01508                 break;
01509     
01510             case TOKEN_STRING:
01511             default:
01512                 Name.operator=((const TCHAR*) TokenBuf);
01513                 break;
01514         }
01515     }
01516 
01517     // Read the bar's docking position
01518     if (ok) ok = file.GetSimpleToken();
01519 
01520     if (ok)
01521     {
01522         Token = FindToken(TokenBuf);
01523         switch (Token)
01524         {
01525             case TOKEN_DOCKBAR_TOP    : Dock = DOCKBAR_TOP;    break;
01526             case TOKEN_DOCKBAR_BOTTOM : Dock = DOCKBAR_BOTTOM; break;
01527             case TOKEN_DOCKBAR_LEFT   : Dock = DOCKBAR_LEFT;   break;
01528             case TOKEN_DOCKBAR_RIGHT  : Dock = DOCKBAR_RIGHT;  break;
01529             case TOKEN_DOCKBAR_FLOAT  : Dock = DOCKBAR_FLOAT;  break;
01530 
01531             default : 
01532                 ok = FALSE;
01533                 TRACE( _T("Unrecognised docking bar position : '%s'"),TokenBuf);
01534                 break;
01535         }
01536 
01537         if (ok)
01538         {
01539             // If the bar is floating, then read in the floating X and Y coords
01540             // Otherwise, read in the bar's docked slot and offset.
01541             if (Dock == DOCKBAR_FLOAT)
01542             {
01543                 ok = file.GetSimpleToken();
01544                 if (ok)
01545                 {   
01546                     ok = (camSscanf(TokenBuf, _T("%li"),&FloatPos.x) == 1);
01547                     if (!ok) TRACE( _T("Expected the bar's floating x pos, but got '%s'\n"),TokenBuf);
01548                 }
01549 
01550                 if (ok) ok = file.GetSimpleToken();
01551                 if (ok)
01552                 {
01553                     ok = (camSscanf(TokenBuf, _T("%li"),&FloatPos.y) == 1);
01554                     if (!ok) TRACE( _T("Expected the bar's floating y pos, but got '%s'\n"),TokenBuf);
01555                 }
01556             }
01557             else
01558             {
01559                 ok = file.GetSimpleToken();
01560                 if (ok)
01561                 {
01562                     ok = (camSscanf(TokenBuf, _T("%li"),&Slot) == 1);
01563                     if (!ok) TRACE( _T("Expected the bar's slot, but got '%s'\n"),TokenBuf);
01564                 }
01565 
01566                 if (ok) ok = file.GetSimpleToken();
01567                 if (ok)
01568                 {
01569                     ok = (camSscanf(TokenBuf, _T("%li"),&Offset) == 1);
01570                     if (!ok) TRACE( _T("Expected the bar's offset, but got '%s'\n"),TokenBuf);
01571                 }
01572             }
01573         }
01574 
01575 
01576         if (ok)
01577         {
01578             // Default to being invisible (stop galleries opening by default)
01579             InitiallyVisible = FALSE;
01580             if ( (GetRuntimeClass() == CC_RUNTIME_CLASS(DialogBarOp)) ||
01581                  (GetRuntimeClass() == CC_RUNTIME_CLASS(SystemBarOp)) )
01582             {   
01583                 ok = file.GetSimpleToken();
01584                 if (ok)
01585                 {
01586                     Token = FindToken(TokenBuf);
01587                     switch (Token)
01588                     {
01589                         case TOKEN_VISIBLE   : InitiallyVisible = TRUE;  break;
01590                         case TOKEN_INVISIBLE : break;
01591                         default : 
01592                             ok = FALSE;
01593                             TRACE( _T("Expected '%s' or '%s', but got '%s'\n"),TokenTable[TOKEN_VISIBLE].Token,TokenTable[TOKEN_INVISIBLE].Token,TokenBuf);
01594                             break;
01595                     }
01596                 }
01597             }
01598 
01599             BOOL finished = FALSE;
01600             while (!finished && ok)
01601             {
01602                 BarItem* pBarItem=NULL;
01603 
01604                 ok = file.GetSimpleToken();
01605                 if (ok)
01606                 {
01607                     Token = FindToken(TokenBuf);
01608 
01609                     switch (Token)
01610                     {
01611                         case TOKEN_BAR_CONTROL   : pBarItem = new BarControl;    break;
01612                         case TOKEN_BAR_SEPARATOR : pBarItem = new BarSeparator;  break;
01613                         case TOKEN_BAR_NEWPAGE   : pBarItem = new BarNewPage;  break;
01614                         case TOKEN_BAR_LINEFEED  : pBarItem = new BarLineFeed;   break;
01615                         case TOKEN_DDECKER_TOP   : pBarItem = new DDeckerTop;   break;
01616                         case TOKEN_DDECKER_BOTTOM: pBarItem = new DDeckerBottom;break;
01617                         case TOKEN_DDECKER_END   : pBarItem = new DDeckerEnd;   break;
01618                         case TOKEN_BAR_END       : // NB! RUNS ON!!!     
01619                         case TOKEN_GALLERY_END   : finished = TRUE;              break;
01620                         default : 
01621                             ok = FALSE;
01622                             TRACE( _T("Unexpected token string : '%s'\n"),TokenBuf);
01623                             break;
01624                     }
01625 
01626                     if (!finished && ok)
01627                     {
01628                         ok = (pBarItem != NULL);
01629                         if (ok) ok = pBarItem->Read(file);
01630                         if (ok) AddBarItem(pBarItem);
01631 
01632                         if (!ok) 
01633                         {
01634                             if (pBarItem != NULL) delete pBarItem;
01635                             DeleteAllBarItems();
01636                             return FALSE;
01637                         }
01638                     }
01639                 }
01640             }
01641         }
01642     }
01643 
01644     if (!ok)
01645     {
01646         // If something when wrong, tell the debug dudes and give as much info as possible
01647         TRACE( _T("\n\nError reading a bar : \n"));
01648         TRACE( _T(" Token buffer = %s\n"),TokenBuf);
01649         TRACE( _T(" Line buffer  = %s\n"),file.GetLineBuf());
01650     }
01651 
01652 
01653     return (ok);
01654 }

BOOL DialogBarOp::ReadBarsFromFile CCLexFile file,
BarCreate BarCreate,
UINT32 pNumBarsRead = NULL,
UINT32 pNumDockingBarsRead = NULL
[static]
 

Reads the bars represented in the given file. It reads the file in an ASCII tokenized form using CCLexFile::GetSimpleToken(), and reconstructs the bars defined.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/94
Parameters:
file = file to read bar tokens from [INPUTS] BarCreate = reference to class for creation of object to read pNumBarsRead = where to put num bars, galleries read on exit pNumDockingBarsRead = where to put num dock bars read on exit
Num bars read is stored in *pNumBarsRead if != NULL [OUTPUTS] Num dock bars read is stored in *pNumDockingBarsRead if != NULL
Returns:
TRUE = At least one bar and all docking bars have been read from the file without error. FALSE = Failed to read the bar info without error. The error cases are - 1. If a syntax error occurs during reading of file 2. File error (e.g. file open, disk fault, etc)
This also reads galleries from your favorite bars.ini file (or equivalent). They are (of course) created without reference to your BarCreate function as the create function is cunningly encoded within the gallery definition itself.

Returns:
Errors: -
See also:
-

Definition at line 5417 of file bars.cpp.

05421 {
05422 #pragma message( __LOCMSG__ "DialogBarOp::ReadBarsFromFile - do nothing" )
05423     TRACE( _T("Warning - DialogBarOp::ReadBarsFromFile called") );
05424 /*  BOOL ok  = TRUE;                    // Indicates a serious error if FALSE
05425     BOOL eof = FALSE;                   // TRUE if end of file is found
05426     UINT32 NumBarsRead = 0;             // Count of number of bars read
05427     UINT32 NumDockingBarsRead = 0;      // Count of number of docking bars read
05428     
05429     ok = file.InitLexer();              // Initialise lexing routines
05430 
05431     file.SetDelimiters("\r\n");         // Set token delimiting characters
05432     file.SetCommentMarker(';');         // Set comment marker char
05433     file.SetWhitespace(" \t");          // Set whitespace chars
05434     file.SetStringDelimiters("\"\"");   // Set string delimiters
05435 
05436     // Get ptr to token buffer. Guaranteed not to move until next
05437     // InitLexer() call
05438     const TCHAR* TokenBuf = file.GetTokenBuf();
05439 
05440     while (ok && !eof)
05441     {
05442         // Get keyword token and token type
05443         BOOL main_token_ok     = file.GetSimpleToken();
05444         LexTokenType TokenType = file.GetTokenType();
05445 
05446         if (!main_token_ok)
05447         {
05448             // If no main token, check for EOF
05449             // If EOF then everything's ok
05450             eof = (TokenType == TOKEN_EOF);
05451             ok  = eof;
05452         }           
05453 
05454         if (main_token_ok)
05455         {
05456             // Get token index from our list of tokens
05457             TokenIndex Token = FindToken(TokenBuf);
05458 
05459             switch (Token)
05460             {
05461                 case TOKEN_BAR :
05462                 {
05463                     // Create DialogBarOp or derived class using BarCreate object
05464                     DialogBarOp* pDialogBarOp = BarCreate.Create();
05465 
05466                     // Read definition and inc num bars read
05467                     ok = (pDialogBarOp != NULL);
05468                     if (ok) ok = pDialogBarOp->Read(file);
05469                     if (ok) NumBarsRead++;
05470                     if (!ok && (pDialogBarOp != NULL)) pDialogBarOp->End();
05471                 }
05472                 break;
05473                 case TOKEN_INFO_BAR :
05474                 {
05475                     // Create DialogBarOp or derived class using BarCreate object
05476                                         // Read definition and inc num bars read
05477                      ok = InformationBarOp::Read(file);
05478                 }
05479                 break;
05480 
05481                 case TOKEN_GALLERY :
05482                 {
05483                     // New type by Alex; the only difference is where we get the type from
05484                     // (it's encoded in ASCII in BARS.INI)
05485                     CCRuntimeClass *pCCRuntimeClass;
05486 
05487                     ok = file.GetSimpleToken();
05488                     // Get a pointer to the corresponding runtime class object.
05489                     if (ok)
05490                     {
05491                         ok = ((pCCRuntimeClass = CCObject::GetRuntimeClassByName( TokenBuf )) != NULL);
05492                         if (!ok)
05493                         {
05494                             TRACE( _T("Resource file contains unknown gallery class : '%s'\n"),TokenBuf);
05495 //                          ok = FlushUpToToken(file,TOKEN_GALLERY_END);
05496 //                          break;
05497                         }
05498                     }
05499 
05500                     if (ok) 
05501                     {
05502                         // Go and create the object of the correct runtime class
05503                         DialogBarOp* pDialogBarOp = (DialogBarOp *) pCCRuntimeClass->CreateObject();
05504 
05505                         // Read definition and inc num bars read
05506                         ok = (pDialogBarOp != NULL);
05507                         if (!ok) TRACE( _T("Unable to create an object called '%s'\n"),TokenBuf);
05508 
05509                         // Check it's a real gallery. We ensure on debug builds, but just ignore the
05510                         // entry in retail builds.
05511                         //
05512                         // This should only ever happen if ccobject.cpp is broken or someone's put an
05513                         // incorrectly derived, or non DYNA_CREATE class in BARS.INI
05514                         //
05515                         if (ok) 
05516                         {
05517                             ok = (pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(SuperGallery)));
05518 #ifdef _DEBUG
05519                             if (!ok) TRACE( _T("'%s' is not defined as an instance of a SuperGallery"));
05520 #endif
05521                         }
05522 
05523                         // Note that the read function is likely to be overridden so this can read
05524                         // gellery specific parameters
05525                         if (ok) ok = pDialogBarOp->Read(file);
05526                         if (ok) NumBarsRead++;
05527                         if (!ok && (pDialogBarOp != NULL)) pDialogBarOp->End();
05528                     } 
05529                 }
05530                 break;
05531                 
05532                 case TOKEN_STATUS_BAR :
05533                 {
05534                     ok = file.GetSimpleToken();
05535                     if (ok)
05536                     {
05537                         BOOL Show;
05538                         Token = FindToken(TokenBuf);
05539                         switch(Token)
05540                         {
05541                             case TOKEN_VISIBLE  :   Show = TRUE;        break;
05542                             case TOKEN_INVISIBLE:   Show = FALSE;       break; 
05543                          }
05544                          GetMainFrame()->ShowStatusBar(Show);                       
05545                     }
05546                  
05547 
05548                 }
05549                 break;
05550                 case TOKEN_COLOUR_BAR :
05551                 {
05552                     ok = file.GetSimpleToken();
05553                     if (ok)
05554                     {
05555                         BOOL Show;
05556                         Token = FindToken(TokenBuf);
05557                         switch(Token)
05558                         {
05559                             case TOKEN_VISIBLE  :   Show = TRUE;        break;
05560                             case TOKEN_INVISIBLE:   Show = FALSE;       break; 
05561                          }
05562                          GetMainFrame()->ShowColourBar(Show);                       
05563                     }
05564                  
05565 
05566                 }
05567                 break;
05568                 
05569                 case TOKEN_SCROLL_BARS :
05570                 {
05571                     ok = file.GetSimpleToken();
05572                     if (ok)
05573                     {
05574                         BOOL Show;
05575                         Token = FindToken(TokenBuf);
05576                         switch(Token)
05577                         {
05578                             case TOKEN_VISIBLE  :   Show = TRUE;        break;
05579                             case TOKEN_INVISIBLE:   Show = FALSE;       break; 
05580                          }
05581                          GetMainFrame()->ShowScrollBars(Show);                      
05582                     }
05583                  
05584 
05585                 }
05586                 break;
05587                 
05588                 case TOKEN_FULLSCREEN :
05589                 {
05590                     ok = file.GetSimpleToken();
05591                     if (ok)
05592                     {
05593                         BOOL Mode;
05594                         Token = FindToken(TokenBuf);
05595                         switch(Token)
05596                         {
05597                             case TOKEN_ON  :    Mode = TRUE;        break;
05598                             case TOKEN_OFF:     Mode = FALSE;       break; 
05599                          }
05600                          GetMainFrame()->DoFullScreenMode(Mode);                        
05601                     }
05602                 }
05603                 break;
05604                 
05605                 case TOKEN_DOCKING_BAR :
05606                 {
05607                     DockBarType DockType;
05608 
05609                     // Which bar are we refering to ??
05610                     ok = file.GetSimpleToken();
05611                     if (ok)
05612                     {
05613                         Token = FindToken(TokenBuf);
05614                         switch(Token)
05615                         {
05616                             case TOKEN_DOCKBAR_LEFT:    DockType=DOCKBAR_LEFT;      break;
05617                             case TOKEN_DOCKBAR_RIGHT:   DockType=DOCKBAR_RIGHT;     break;
05618                             case TOKEN_DOCKBAR_TOP:     DockType=DOCKBAR_TOP;       break;
05619                             case TOKEN_DOCKBAR_BOTTOM:  DockType=DOCKBAR_BOTTOM;    break;
05620                             case TOKEN_DOCKBAR_FLOAT:   DockType=DOCKBAR_FLOAT;     break;
05621 
05622                             default:
05623                                 TRACE( _T("No dockbar type in bars.ini"));
05624                                 ok = FALSE;
05625                                 break;
05626                         }
05627                         if (ok) ok = file.GetSimpleToken();
05628                         // Check for Small/Big controls
05629                         if (ok)
05630                         {
05631                             Token = FindToken(TokenBuf);
05632                 
05633                             OILDockingBar* pDockBar = GetMainFrame()->GetDockBar(DockType);
05634                             // Set the dockbar control size - default to small
05635                             pDockBar->SetBigControlState(Token == TOKEN_BIG);
05636 
05637                             // Inc num docking bars read
05638                             NumDockingBarsRead++;
05639                         }
05640                     }
05641                 }
05642                 break;
05643             }
05644         }
05645     }
05646 
05647     if (!ok)
05648     {
05649         // If something when wrong, tell the debug dudes and give as much info as possible
05650         //ENSURE(FALSE,"Error reading a bar control. See TRACE output for details");
05651         TRACE( _T("\n\nError reading bars from a file"));
05652         TRACE( _T(" Token buffer = %s\n"),TokenBuf);
05653         TRACE( _T(" Line buffer  = %s\n"),file.GetLineBuf());
05654     }
05655 
05656 
05657     // We are now finished with the lexer
05658     file.DeinitLexer();
05659 
05660     // Relay num bars and docking bars back to caller if they want the info
05661     if (pNumBarsRead        != NULL) *pNumBarsRead        = NumBarsRead;
05662     if (pNumDockingBarsRead != NULL) *pNumDockingBarsRead = NumDockingBarsRead;
05663 
05664     return (ok); */
05665 
05666     return false;
05667 }

BOOL DialogBarOp::ReadBarsFromRegistry HKEY  hSubKey  )  [static, protected]
 

Reads the bar definitions from the specified section in the registry. Each bar is written into a numbered section which is a sub-section of the supplied key. The numbering is 1..n. So we need to search for these numbered sections until we fail to find one.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/2/97
Parameters:
hSubKey the parent key to use in the registry [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
LoadRegistryEntries;

Definition at line 4840 of file bars.cpp.

04841 {
04842 #pragma message( __LOCMSG__ "DialogBarOp::ReadBarsFromRegistry - do nothing" )
04843     TRACE( _T("Warning - DialogBarOp::ReadBarsFromRegistry called") );
04844 /*  ERROR2IF(hSubKey == NULL,FALSE,"ReadBarsFromRegistry bad registry key!");
04845 
04846     BOOL ok = TRUE;
04847     INT32 NumBarsRead = 0;
04848 
04849     ok = ok && InformationBarOp::Read(hSubKey);
04850 
04851     // Now go through all the numbered bar entries and read in all the ones that exist
04852     // These will contain all the gallery and tool bar definitions
04853     DialogBarOpCreate BarCreate;
04854     BOOL Finished = FALSE;
04855     INT32 i = 0;
04856     TCHAR buf[10];
04857     while (!Finished && ok)
04858     { 
04859         // Make up the bar number for this index
04860         wsprintf(buf, TEXT("%d"), i + 1);
04861         String_256 name(buf);
04862         // check to see if the registry key exists
04863         LoadRegistryEntries Loader;
04864         if (Loader.StartLoading(&name, hSubKey))
04865         {
04866             // The key exists and so we must have a bars or a super gallery definition 
04867             HKEY hRegKey = Loader.GetRegKey();
04868             ERROR2IF(hRegKey == NULL, FALSE,"ReadBarsFromRegistry Failed to get reg key");
04869 
04870             // This is the dialog bar op that we are going to create
04871             DialogBarOp* pDialogBarOp = NULL;
04872 
04873             // Get the type of bar we are dealing with
04874             String_256 BarType;
04875             ok = GetRegString(hRegKey, TEXT("Type"), &BarType);
04876             if (BarType == String_256(TokenTable[TOKEN_BAR].Token))
04877             {
04878                 // Create DialogBarOp or derived class using BarCreate object
04879                 pDialogBarOp = BarCreate.Create();
04880             }
04881             else if (BarType == String_256(TokenTable[TOKEN_GALLERY].Token))
04882             {
04883                 // Its a super gallery so get the class name that was saved as well
04884                 String_256 ClassName;
04885                 ok = ok && GetRegString(hRegKey, TEXT("ClassName"), &ClassName);
04886                 // Use this to create the new class
04887                 CCRuntimeClass * pCCRuntimeClass = CCObject::GetRuntimeClassByName( ClassName );
04888                 if (pCCRuntimeClass != NULL)
04889                 {
04890                     // Go and create the object of the correct runtime class
04891                     pDialogBarOp = (DialogBarOp *) pCCRuntimeClass->CreateObject();
04892                     // Check it's a real gallery. We ensure on debug builds, but just ignore the
04893                     // entry in retail builds.
04894                     //
04895                     // This should only ever happen if ccobject.cpp is broken or someone's put an
04896                     // incorrectly derived, or non DYNA_CREATE class in BARS.INI
04897                     //
04898                     ok = (pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(SuperGallery)));
04899                 }
04900                 else
04901                     TRACE( _T("Registry definition contains unknown gallery class : '%s'\n"),(TCHAR *)ClassName);
04902             }
04903             else
04904             {
04905                 ERROR3("Unknown bar type in DialogBarOp::Read");
04906                 return FALSE;
04907             }
04908 
04909             if (pDialogBarOp != NULL)
04910             {
04911                 // Read definition and inc num bars read
04912                 // ask the bar to extract all the details from this section
04913                 ok = ok && pDialogBarOp->Read(Loader);
04914                 
04915                 if (ok)
04916                     NumBarsRead++;
04917                 else
04918                     pDialogBarOp->End();
04919             }
04920             else
04921                 ok = FALSE;
04922 
04923             // stop the loader class, only required if the key was opened
04924             Loader.StopLoading();
04925         }
04926         else
04927         {
04928             // The key does not exist and so we must have reached the end of the list
04929             Finished = TRUE;
04930         }
04931 
04932         // increment out count to step onto the next bars definition
04933         i++;
04934     }
04935 
04936     return (ok); */
04937 
04938     return false;
04939 }

BOOL DialogBarOp::ReadDockingBarsFromRegistry HKEY  hSubKey  )  [static, protected]
 

Reads in the persistant docking data retrieved from the docking system.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/2/97
Parameters:
hSubKey the registery section to read the data from [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 5010 of file bars.cpp.

05011 {
05012 #pragma message( __LOCMSG__ "DialogBarOp::ReadDockingBarsFromRegistry - do nothing" )
05013     TRACE( _T("Warning - DialogBarOp::ReadDockingBarsFromRegistry called") );
05014 /*  ERROR2IF(hSubKey == NULL,FALSE,"ReadDockingBarsFromRegistry bad registry key!");
05015 
05016     BOOL ok = TRUE;
05017     CCamFrame* pMainFrame = GetMainFrame();
05018 
05019     if (pMainFrame == NULL)
05020         return FALSE;
05021 
05022     // Save it into the registry
05023     // First open/create a new sub-key under the app-state key for holding the data.
05024     HKEY hRegKey = CreateRegKey(hSubKey, PRODUCT_REGISTRYKEY_BARSETTINGS);
05025     if (hRegKey == NULL)
05026     {
05027         //ERROR3("DialogBarOp::ReadDockingBarsFromRegistry failed to get registry key");
05028         return FALSE;
05029     }
05030 
05031     DockBarType DockType;
05032     for (INT32 i = 0; i < NUM_DOCKBARS && ok; i++)
05033     {
05034         OILDockingBar* pDockBar = pMainFrame->GetDockBar((DockBarType)i);
05035         if (ok) ok = (pDockBar != NULL);
05036 
05037         switch (i)
05038         {
05039             case 0: DockType = DOCKBAR_LEFT;        break;
05040             case 1: DockType = DOCKBAR_RIGHT;       break;
05041             case 2: DockType = DOCKBAR_TOP;         break;
05042             case 3: DockType = DOCKBAR_BOTTOM;      break;
05043             case 4: DockType = DOCKBAR_FLOAT;       break;
05044             default:
05045                 TRACEUSER( "Neville", _T("ReadDockingBarsFromRegistry bad dockbar type"));
05046                 ok = FALSE;
05047                 break;
05048         }
05049         
05050         if (ok)
05051         {
05052             // get the details on that bar's status i.e. big or small
05053             BOOL State = GetRegBool(hRegKey, TokenTable[TOKEN_DOCKBAR_LEFT+i].Token);
05054 
05055             OILDockingBar* pDockBar = pMainFrame->GetDockBar(DockType);
05056             // Set the dockbar control size - default to small
05057             pDockBar->SetBigControlState(State);
05058         }
05059     }
05060 
05061     // Close down the key
05062     CloseRegKey(hRegKey);
05063 
05064     return (ok); */
05065 
05066     return false;
05067 }

static BOOL DialogBarOp::ReadRegistryBarsVersion  )  [static, protected]
 

BOOL DialogBarOp::ReadResVersion  )  [static, protected]
 

Reads Revision number of bars.ini checks whether this is the same as the version in prefs.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if bars.ini is a new revision

Errors: -

See also:
LoadBarsFromFile,LoadBars,CreateBars

Definition at line 3039 of file bars.cpp.

03040 {  
03041 #pragma message( __LOCMSG__ "DialogBarOp::ReadResVersion- do nothing" )
03042     TRACE( _T("Warning - DialogBarOp::ReadResVersion called") );
03043 /*  BOOL ok = TRUE,open=FALSE; 
03044     BOOL NewVersion = FALSE;
03045     CCResTextFile file; // Resource File
03046 
03047     if (ok) ok = open = file.open(_R(IDM_DEFAULT_BARS), _R(IDT_CAM_BARS_RES));
03048     String_64 Version;
03049     String_64 Temp;
03050     ok = file.InitLexer();              // Initialise lexing routine
03051     file.SetStringDelimiters("$$");
03052     const TCHAR* TokenBuf = file.GetTokenBuf();
03053     if (ok) ok = file.GetSimpleToken();
03054     if (ok) Temp=((const TCHAR*) TokenBuf);
03055     // this is a bit naff but RCS adds an extra white space at the end of the
03056     // the string when it substitutes
03057     Temp.Left(&Version,Temp.Length()-1);
03058     if(Version.CompareTo(BarsVersion))
03059     {
03060         camStrcpy(BarsVersion,Version);
03061         NewVersion = TRUE;
03062     }
03063     if (open) file.close();
03064 
03065     return NewVersion; */
03066 
03067     return false;
03068 }

BOOL DialogBarOp::ReadWorkSpaceInfoFromRegistry HKEY  hSubKey  )  [static, protected]
 

Reads workspace data from the registry ( Full Screen Mode etc..).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/2/97
Parameters:
hSubKey the registery section to read the data from [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 5134 of file bars.cpp.

05135 {
05136 #pragma message( __LOCMSG__ "DialogBarOp::ReadWorkSpaceInfoFromRegistry - do nothing" )
05137     TRACE( _T("Warning - DialogBarOp::ReadWorkSpaceInfoFromRegistry called") );
05138 /*  ERROR2IF(hSubKey == NULL,FALSE,"ReadWorkSpaceInfoFromRegistry bad registry key!");
05139 
05140     BOOL ok = TRUE;
05141     CCamFrame* pMainFrame = GetMainFrame();
05142 
05143     if (pMainFrame == NULL)
05144         return FALSE;
05145     
05146     // Save it into the registry
05147     // First open/create a new sub-key under the app-state key for holding the data.
05148     HKEY hRegKey = OpenRegKey(hSubKey, PRODUCT_REGISTRYKEY_BARSETTINGS);
05149     if (hRegKey == NULL)
05150     {
05151         //ERROR3("DialogBarOp::ReadWorkSpaceInfoFromRegistry failed to get registry key");
05152         return FALSE;
05153     }
05154 
05155     // Save the value
05156     BOOL Show = TRUE;
05157     Show = GetRegBool(hRegKey, TokenTable[TOKEN_FULLSCREEN].Token);
05158     pMainFrame->DoFullScreenMode(Show);
05159     
05160     Show = GetRegBool(hRegKey, TokenTable[TOKEN_STATUS_BAR].Token);
05161     pMainFrame->ShowStatusBar(Show);
05162 
05163     Show = GetRegBool(hRegKey, TokenTable[TOKEN_COLOUR_BAR].Token);
05164     pMainFrame->ShowColourBar(Show);
05165 
05166     Show = GetRegBool(hRegKey, TokenTable[TOKEN_SCROLL_BARS].Token);
05167     pMainFrame->ShowScrollBars(Show);
05168 
05169     // Close down the key
05170     CloseRegKey(hRegKey);
05171 
05172     return (ok); */
05173 
05174     return false;
05175 }

BarItem * DialogBarOp::RemoveBarItem BarItem thisItem  ) 
 

Removes the bar item from the list of bar items n the bar. This does NOT delete the item, or any memory associated with it. It is just delinked.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
here = position of the bar item to be removed from the list [INPUTS]
- [OUTPUTS]
Returns:
pBarItem = ptr to the bar item that has been removed.

Errors: Debug build - An ENSURE failure if the bar item is not found. Retail build - NULL is returned if the bar item is not found.

See also:
-

Definition at line 474 of file bars.cpp.

00475 {
00476     return (BarItem *)BarItemList.RemoveItem(thisItem);
00477 }

BarItem * DialogBarOp::RemoveBarItem LISTPOS  here  ) 
 

Removes the bar item from the list of bar items n the bar. This does NOT delete the item, or any memory associated with it. It is just delinked.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
here = position of the bar item to be removed from the list [INPUTS]
- [OUTPUTS]
Returns:
pBarItem = ptr to the bar item that has been removed.

Errors: Debug build - An ENSURE failure if the bar item is not found. Retail build - NULL is returned if the bar item is not found.

See also:
-

Definition at line 447 of file bars.cpp.

00448 {
00449     BarItem* pBarItem = (BarItem*) BarItemList.FindItem(here);
00450     ENSURE(pBarItem != NULL,"Couldn't remove bar item. Item not found.");
00451     
00452     BarItemList.RemoveItem(pBarItem);
00453 
00454     return (pBarItem);
00455 }

BOOL DialogBarOp::ResetHiddenGadgetStates  ) 
 

This function is required to fix the errors that originate on 'dynamic' infobars when we change to another tool - or drag the infobar into a floating one; and then make it dockable again. The problems result from the fact that we need to reset our visibility flags (in these cases) in order for the HideDisableGadgetAndResuffleBar and ShowDisableGadgetAndResuffleBar to do their stuff correctly. This function handles this ....

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/10/99
Parameters:
WinID - the handle to the control that this operation is to be performed on [INPUTS]
- [OUTPUTS]
Returns:
TRUE - if function traversed all controls in the dialogbar FALSE - if operation contains NO controls
This function should only be called from the following places:

1) Inside of BaseBar::Recreate (DockBarType DockBarTyp, BaseBar* BaseBar, DialogBarOp* Op,BOOL CanCopy ). Although (in this file) this is the only place the function needs to be called, YOU MUST UPDATE THE LOGIC THAT IS RESPONSIBLE FOR CALLING THE FUNCTION. This is located at about line 1248.

2) Inside of your InfoBars Tool::SelectChange(BOOL isSelected) - within the isSelected FALSE part of this code, you need to add the following line:

(your infobar op)->ResetHiddenGadgetStates ();

Returns:
Errors: -
See also:
BOOL DialogBarOp::HideDisableGadgetAndResuffleBar (CWindowID WinID) BOOL DialogBarOp::ShowDisableGadgetAndResuffleBar (CWindowID WinID)

Definition at line 881 of file bars.cpp.

00882 {
00883     /*BarItem* theItem = GetPtrBarHead ();
00884 
00885     if (theItem != NULL)
00886     {
00887         while (theItem != NULL)
00888         {
00889             if (theItem->IsKindOf(CC_RUNTIME_CLASS(BarControl)))
00890             {
00891                 BarControl* theBCItem = (BarControl*) theItem;
00892 
00893                 if (theBCItem->IsVisible () == FALSE)
00894                 {
00895                     theBCItem->SetVisibleState (TRUE);
00896                     //theBCItem->SetRequireResetOfVisibleState (TRUE);
00897                 }
00898             }
00899             theItem = (BarItem*) BarItemList.GetNext (theItem);
00900         }
00901         //SetRequireResetOfHiddenControls (TRUE);
00902         return (TRUE);
00903     }
00904     else
00905     {
00906         return (FALSE);
00907     }*/
00908     return (TRUE);//FALSE);
00909 }

void DialogBarOp::SetBarRect wxRect &  Rect  )  [inline]
 

Definition at line 679 of file bars.h.

00679 { BarRect = Rect; }

void DialogBarOp::SetCurrentOrientation Orientation  Orient  ) 
 

To inform the DialogBarOp of its current orientation (horizontal or vertical).

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/94
Parameters:
BarDirection,: The orientation of the bar [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2219 of file bars.cpp.

02220 {
02221     BarOrientation = Orient;    
02222 }

void DialogBarOp::SetDockBarType DockBarType  DockValue  )  [inline]
 

Definition at line 671 of file bars.h.

00671 { Dock = DockValue; }

void DialogBarOp::SetFloatingCPoint wxPoint &  Pos  )  [inline]
 

Definition at line 677 of file bars.h.

00677 { FloatPos = Pos; }

void DialogBarOp::SetName String_32 str  ) 
 

"I name this bar..."

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> (& Phil)
Date:
12/4/94
Parameters:
Reference to string containing new name for bar [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1235 of file bars.cpp.

01236 {
01237     Name = str;
01238 
01239     // Report changes to bar to any dialog ops...
01240     BROADCAST_TO_CLASS( BarMsg(BAR_CHANGESTATE,this), DialogOp );
01241 
01242 }

void DialogBarOp::SetOffset INT32  OffsetValue  )  [inline]
 

Definition at line 675 of file bars.h.

00675 { Offset = OffsetValue; }

void DialogBarOp::SetSlot UINT32  SlotNum  )  [inline]
 

Definition at line 673 of file bars.h.

00673 { Slot = SlotNum; }

void DialogBarOp::SetSystemStateChanged BOOL  State = TRUE  )  [static]
 

Constructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
New SystemChangedState. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 260 of file bars.cpp.

00261 {
00262     SystemStateChanged = State;
00263     if (State)
00264         ControlList::Get()->Changed();
00265 } 

BOOL DialogBarOp::SetValidPath String_256  FileName  )  [static, protected]
 

looks for bars.con files first in prefs path then in windows dir if found sets ValidPath and return TRUE else return FALSE

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/10/94
Parameters:
FileName This dictates whether we look for the full screen or normal [INPUTS] mode file. Should be either "Normal" or "Clean" when "Clear" corresponds to the full screen operation.
- [OUTPUTS]
Returns:
TRUE if successful

Errors:

Note : These functions will fail badly with path names > 255

Definition at line 2605 of file bars.cpp.

02606  {
02607 #pragma message( __LOCMSG__ "DialogBarOp::SetValidPath - do nothing" )
02608     TRACE( _T("Warning - DialogBarOp::SetValidPath called") );
02609 /*   // new naming convention = PRODUCT_BASENAME.cle/nor
02610     // I've left the above intact as I can't get hold of the files 
02611     // I need to do this properly - this function is called with either "normal" or "clean"
02612 
02613     // Updated for doing the CorelXARA product 28/9/95
02614     // File was called XStudio.nor or .cle (or XViewer.nor or .cle)
02615     // We will now call them all CorelX##.ini where #### in this case is either BN or BF 
02616     String_256 File( _T("") );
02617     if(!FileName.CompareTo( _T("normal") ))
02618         File = PRODUCT_BARSNORMAL_INIFILE;
02619     else
02620         File = PRODUCT_BARSFULL_INIFILE;
02621 
02622 #if defined(__WXMSW__)
02623     const UINT32 cchMaxPath = _MAX_PATH;
02624 #else
02625     const UINT32 cchMaxPath = 1 + pathconf( "/", _PC_PATH_MAX );
02626 #endif
02627     TCHAR *szBuff = static_cast<TCHAR *>( alloca( cchMaxPath * sizeof(TCHAR) ) );
02628     CCDiskFile file;
02629     BOOL ok = FALSE;
02630 
02631     // first check prefs path
02632 
02633     ok = DefaultBarsConfigPath.Length() > 0;
02634     if (ok)
02635     {
02636         String_256 Temp = DefaultBarsConfigPath;
02637         Temp += _T("\\");
02638         Temp += File;
02639         camStrcpy( szBuff, Temp );
02640         TRACEUSER( "chris", _T("Loading Bars from Prefs path\n"));
02641         if (_taccess(szBuff, 0) == 0)
02642         {
02643             // yes - use this name
02644             ValidPath.SetPathName(szBuff);
02645             return TRUE;
02646         }
02647     }
02648     
02649     // either there is no pref or we can't find the file . try windows directory
02650 
02651     UINT32 Len = GetWindowsDirectory((LPSTR)szBuff, cchMaxPath - 1);
02652     if ((Len > 0) && (Len < cchMaxPath))
02653     {
02654         String_256 Temp = _T("\\") + File;
02655         camStrcat(szBuff, Temp );
02656         TRACEUSER( "chris", _T("Loading Bars from Windows path\n"));
02657         if (_taccess(szBuff, 0) == 0)
02658         {
02659             // yes - use this name
02660             ValidPath.SetPathName(szBuff);
02661             return TRUE;
02662         }
02663     }
02664 
02665     // oops .. Can't find a bars file anywhere !!! */
02666     return FALSE;
02667  }

BOOL DialogBarOp::ShouldUpdateBarState  )  [static]
 

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
Class = the message handler class list to add this object to. [INPUTS]
- [OUTPUTS]
Returns:
SystemStateChanged

Errors: -

See also:
-

Definition at line 282 of file bars.cpp.

00283 {
00284  return SystemStateChanged == TRUE;
00285  
00286 }

BOOL DialogBarOp::ShowEnableGadgetAndResuffleBar CWindowID  WinID  ) 
 

Does the opposite of BOOL DialogBarOp::HideDisableGadgetAndResuffleBar (CWindowID WinID).

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/9/99
Parameters:
WinID - the handle to the control that this operation is to be performed on [INPUTS]
- [OUTPUTS]
Returns:
TRUE - if operation successful (i.e. could be applied to this infobar) FALSE - if operation was NOT successful

Errors: -

See also:
BOOL DialogBarOp::ShowDisableGadgetAndResuffleBar (CWindowID WinID) BOOL DialogBarOp::ResetHiddenGadgetStates ()

Definition at line 714 of file bars.cpp.

00715 {
00716     // firstly - we need to check to see if the control is of the bar is of the
00717     // correct docking type - BEFORE we continue ....
00718 
00719 /*  KernelBarPos*   pKernelBarPos;
00720     DockBarType     Dock;
00721 
00722     if (GetMainFrame()->GetBarPosInfo(GetParent ((HWND) WinID),&Dock,&pKernelBarPos))
00723     {
00724         SetDockBarType(Dock);
00725         if (Dock == DOCKBAR_FLOAT)
00726             SetFloatingCPoint(wxPoint(pKernelBarPos->x,pKernelBarPos->y));
00727         else
00728         {
00729             SetSlot(pKernelBarPos->Slot);
00730             SetOffset(pKernelBarPos->Position);
00731         }
00732     }
00733 
00734     // Save this info bar's data in the static vars
00735     // These vars are used by
00736     DialogBarOp::Dock           = GetDockBarType();
00737     DialogBarOp::Slot           = GetSlot();
00738     DialogBarOp::Offset         = GetOffset();
00739     DialogBarOp::FloatPos       = GetFloatingCPoint();
00740 
00741     RECT windowRect;
00742 
00743     CamalotSDKGetWindowRect ((HWND) WinID, &windowRect);
00744 
00745     switch (GetDockBarType ())
00746     {
00747         case DOCKBAR_LEFT:      // This should not be possible for infobars
00748         return (FALSE);         // NOT a chance!
00749         case DOCKBAR_RIGHT:     // This should not be possible for infobars
00750         return (FALSE);         // NOT a chance!
00751         case DOCKBAR_TOP:
00752             // handle internally - so that caller does NOT have to worry ....
00753             EnableGadget (CamalotSDKGetDlgCtrlID (WinID), TRUE);
00754         break;                  // will process this one (cause its of static size)
00755         case DOCKBAR_BOTTOM:
00756             // handle internally - so that caller does NOT have to worry ....
00757             EnableGadget (CamalotSDKGetDlgCtrlID (WinID), TRUE);
00758         break;                  // will process this one (cause its of static size)
00759         case DOCKBAR_FLOAT:
00760             // handle internally - so that caller does NOT have to worry ....
00761             EnableGadget (CamalotSDKGetDlgCtrlID (WinID), TRUE);
00762         return (FALSE);         // we will NOT process this because of the problems
00763                                 // it causes
00764         case DOCKBAR_INVALID:   // god knows !!!!
00765         return (FALSE);
00766     }
00767 
00768     POINT topLeft;
00769     topLeft.x = windowRect.left;
00770     topLeft.y = windowRect.top;
00771 
00772     CamalotSDKScreenToClient (CamalotSDKGetParent (WinID), &topLeft);
00773 
00774     INT32 xLength = windowRect.right - windowRect.left;
00775 
00776     BarItem* hideControl = GetBarItem ((HWND) WinID);
00777     BarControl* hideBControl = NULL;
00778 
00779     if (hideControl->IsKindOf(CC_RUNTIME_CLASS(BarControl)))
00780     {
00781         hideBControl = (BarControl*) hideControl;
00782     }
00783     
00784     // firstly, lets hide the gadget that this operation has been requested for ....
00785 
00786     if (hideBControl->IsVisible () == FALSE)
00787     {
00788         hideBControl->BarControl::SetVisibleState (TRUE);
00789         
00790         CamalotSDKShowWindow (WinID, SW_SHOW);
00791 
00792         //BarItem* hideControl = GetBarItem ((HWND) WinID);
00793         BarItem* prevControl = GetPtrBarPrev (hideControl);
00794         BarItem* nextControl = GetPtrBarNext (hideControl);
00795 
00796         if (prevControl->IsKindOf(CC_RUNTIME_CLASS(BarSeparator)))
00797         {   
00798             if (!(GetMainFrame()->GetDockBar(GetDockBarType ())->IsBigControls()))
00799             {
00800                 xLength += SMALL_SEPARATOR;
00801             }
00802             else
00803             {
00804                 xLength += LARGE_SEPARATOR;
00805             }
00806         }
00807 
00808         while (nextControl != NULL)
00809         {
00810             CWindowID barCtrlID  = NULL;
00811             BarControl* barCtrl = NULL;
00812 
00813             if (nextControl->IsKindOf(CC_RUNTIME_CLASS(BarControl)))
00814             {
00815                 barCtrl = (BarControl*) nextControl;
00816                 barCtrlID = barCtrl->GetWinID ();
00817 
00818             CamalotSDKGetWindowRect (barCtrlID, &windowRect);
00819             topLeft.x = windowRect.left;
00820             topLeft.y = windowRect.top;
00821             
00822             CamalotSDKScreenToClient (CamalotSDKGetParent (WinID), &topLeft);
00823             topLeft.x += xLength;
00824             //windowRect.right -= xLength;
00825 
00826             MoveWindow ((HWND) barCtrlID, topLeft.x, topLeft.y,
00827                         windowRect.right - windowRect.left,
00828                         windowRect.bottom - windowRect.top, TRUE);
00829 
00830             }
00831 
00832             nextControl = (BarItem*) BarItemList.GetNext(nextControl);
00833         }
00834         return (TRUE);
00835     }
00836     else
00837     {
00838         return (FALSE);
00839     }*/
00840     
00841     return (TRUE);//FALSE);
00842 }

void DialogBarOp::UpdateState  )  [virtual]
 

This function gets called during idle time. It calls the GetState fn associated with each controls OpDescriptor. The button gets disabled if the operation is not executable.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DialogBarOp::UpdateStateOfAllBars

Reimplemented in BevelInfoBarOp, BezToolInfoBarOp, BlendInfoBarOp, ContourInfoBarOp, FreeHandInfoBarOp, LiveEffectsInfoBarOp, and MouldInfoBarOp.

Definition at line 2437 of file bars.cpp.

02438 {
02439     if (WindowID != NULL)  // If the WindowID is NULL then the DialogBar has not been created
02440     {
02441         String_256 Desc; 
02442         // Call the GetState fn for all controls
02443         for (BarItem* CurrentBarItem = (BarItem*)BarItemList.GetHead();
02444                  CurrentBarItem != NULL; 
02445                  CurrentBarItem = (BarItem*)BarItemList.GetNext( (ListItem*)CurrentBarItem ))
02446         {
02447             if (CurrentBarItem->IsKindOf(CC_RUNTIME_CLASS(BarControl)))
02448             {
02449                 BarControl* BarCtrl = (BarControl*)CurrentBarItem;
02450                
02451                 // Obtain the OpDescriptor
02452                 OpDescriptor* OpDesc = (BarCtrl)->
02453                         GetOpDescriptor(BarOrientation == Horizontal);
02454 
02455                 if (OpDesc != NULL)
02456                 {
02457                     OpState NewState = OpDesc->GetOpsState(&Desc); 
02458 
02459                     // if a description has been returned
02460                     /*
02461                     // Special disabled string description stuff cannot be implemented yet
02462                     // it requires shield technology
02463                     if (!ButtonDesc.IsEmpty() && (newState.Greyed))
02464                     {
02465                         String_256 disabledStub(_R(IDS_DISABLED_BECAUSE));
02466             
02467                         WhyDisabled = disabledStub;
02468 
02469                         // Set up reason why item is disabled
02470                         WhyDisabled += ButtonDesc;
02471                     }
02472                     */
02473                     // Set the controls greyed state
02474                     if (BarCtrl->IsEnabled() != !NewState.Greyed)
02475                     {
02476                         // The controls state has changed 
02477                         EnableGadget(BarCtrl->
02478                             GetUniqueGadgetID(), !NewState.Greyed);
02479                         BarCtrl->SetEnabledState(!NewState.Greyed); 
02480                     }
02481                     // set the control's ticked state
02482                     // First determine if the control can be ticked
02483                     if (IsGadgetTickable(BarCtrl->GetUniqueGadgetID()))
02484                     {
02485                         // All tickable gadget's must have a BOOL value (TRUE = ticked)
02486                         BOOL Selected = GetLongGadgetValue(BarCtrl->GetUniqueGadgetID(),0,1);
02487                         if(Selected != NewState.Ticked)
02488                         {
02489                             // We need to change the ticked state
02490                             SetBoolGadgetSelected(BarCtrl->GetUniqueGadgetID(),NewState.Ticked!=0);
02491                         }
02492                     }
02493  
02494                 }
02495             }
02496         }
02497     }
02498 }

void DialogBarOp::UpdateStateOfAllBars  )  [static]
 

This static function gets called during idle time If the system state has changed then it updates the enabled state of all visible DialogBars.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DialogBarOp::UpdateState

DialogBarOp::SetSystemStateChanged

Definition at line 2520 of file bars.cpp.

02521 {
02522     // Determine if we need to update the state of the bars.
02523     if (ShouldUpdateBarState())
02524     {
02525     /*  if (IsUserName("Simon"))
02526         {
02527             TRACE( _T("The state of the bars is being updated")); 
02528         }
02529       */
02530         List* pBarList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogBarOp));
02531         ListItem*  pCurrentBar = pBarList->GetHead();
02532         while (pCurrentBar != NULL)
02533         {
02534             ((DialogBarOp*)pCurrentBar)->UpdateState(); 
02535             pCurrentBar = pBarList->GetNext(pCurrentBar);
02536         }
02537         // The bars now reflect the system state 
02538         SetSystemStateChanged(FALSE); 
02539     }           
02540 }

BOOL DialogBarOp::WipeBarFiles  )  [static]
 

Wipes bar config files from disc - called if the user selects default settings.

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/10/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful

Errors: -

Definition at line 2889 of file bars.cpp.

02890 {  
02891 //  BOOL ok = TRUE;
02892     BOOL UnlinkOK = TRUE;
02893 
02894 #pragma message( __LOCMSG__ "DialogBarOp::WipeBarFiles - do nothing" )
02895     TRACE( _T("Warning - DialogBarOp::WipeBarFiles called") );
02896 /*#ifdef SAVE_PREFS_TO_REGISTRY
02897     // Wipe all the bars settings from the registry.
02898     // We need to do sub-directories first as you cannot wipe a directory which has sub-directories
02899     // (well it is rumoured that you cannot do this on NT but it works on 95!)
02900     WipeRegistrySettingsForBar(PRODUCT_REGISTRYKEY_BARSFULL);
02901     WipeRegistrySettingsForBar(PRODUCT_REGISTRYKEY_BARSNORMAL);
02902 
02903     // We must wipe the ini file as well as otherwise when the code checks to 
02904     // see if the registry settings and then falls back on the ini file if they
02905     // are not there, then we wont be using the default settings.
02906 #endif
02907 
02908     String_256 FilePath;
02909     //Find the path to a valid xstudio.nor file
02910     ok = SetValidPath("normal");
02911     // the file must exist... so we can delete it
02912     if(ok)
02913     {   
02914         FilePath = ValidPath.GetPath();
02915         // delete the file
02916         if(_unlink(FilePath) !=0)
02917             UnlinkOK = FALSE;
02918     }
02919 
02920     //Find the path to a valid xstudio.cle file
02921     ok = SetValidPath("clean");
02922     if(ok)
02923     {
02924         FilePath = ValidPath.GetPath();
02925         // delete the file
02926         if(_unlink(FilePath) !=0)
02927             UnlinkOK = FALSE;
02928     
02929     }
02930     
02931     ERROR2IF(UnlinkOK==FALSE,FALSE,"Couldn't delete a bars config file"); */
02932     
02933     return UnlinkOK;
02934 }

BOOL DialogBarOp::WipeRegistrySettingsForBar TCHAR pBarName  )  [static, protected]
 

Wipes bar registry settings for the named section. Called if the user selects default settings.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/2/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful

Errors: -

Definition at line 2829 of file bars.cpp.

02830 {
02831 #pragma message( __LOCMSG__ "DialogBarOp::WipeRegistrySettingsForBar - do nothing" )
02832     TRACE( _T("Warning - DialogBarOp::WipeRegistrySettingsForBar called") );
02833 /*  ERROR2IF(pBarName == NULL,FALSE,"WipeRegistrySettingsForBar bar section name");
02834     // Wipe all the bars settings from the registry.
02835     // We need to do sub-directories first as you cannot wipe a directory which has sub-directories
02836     // (well it is rumoured that you cannot do this on NT but it works on 95!)
02837     
02838     // Wipe the named sub sections
02839     String_256 MainKeyName = pBarName;
02840     HKEY hRegKey = OpenRegKey(hAppStateRegKey, MainKeyName);
02841     // Was that section there?
02842     if (hRegKey != NULL)
02843     {
02844         // yes so wipe the named sub-sections
02845         DeleteRegKey(hRegKey, PRODUCT_REGISTRYKEY_BARSETTINGS );
02846         DeleteRegKey(hRegKey, TokenTable[TOKEN_INFO_BAR].Token );
02847 
02848         // delete all the numbered sections which contain the bar definitions
02849         BOOL Finished = FALSE;
02850         INT32 i = 0;
02851         TCHAR buf[10];
02852         while (!Finished)
02853         { 
02854             // Make up the bar number for this index
02855             wsprintf(buf, TEXT("%d"), i + 1);
02856             String_256 name(buf);
02857             if (!DeleteRegKey(hRegKey, name))
02858                 Finished = TRUE;
02859 
02860             i++;
02861         }
02862 
02863         CloseRegKey(hRegKey);
02864 
02865         // Wipe the main key
02866         DeleteRegKey(hAppStateRegKey, MainKeyName);
02867     }
02868 
02869     return TRUE; */
02870 
02871     return true;
02872 }

BOOL DialogBarOp::Write SaveRegistryEntries Saver  )  [virtual]
 

Write the dialog bar to the registry.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/2/97
Parameters:
Saver = the class to use to save the data into the registry. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Errors: -

See also:
-

Reimplemented in SystemBarOp.

Definition at line 1824 of file bars.cpp.

01825 {
01826 #pragma message( __LOCMSG__ "DialogBarOp::Write(SaveRegistryEntries& Saver) - do nothing" )
01827     TRACE( _T("Warning - DialogBarOp::Write(SaveRegistryEntries& Saver) called") );
01828 /*  //ERROR2IF(hSubKey == NULL,FALSE,"DialogBarOp::Write bad sub key");
01829 
01830     BOOL ok = TRUE;
01831     // we don't want to write out the control bank
01832     if (IsAllBarsOp())
01833         return ok;
01834 
01835     HKEY hRegKey = Saver.GetRegKey();
01836     if (hRegKey == NULL)
01837     {
01838         ERROR3("DialogBarOp::Write failed to get registry key");
01839         return FALSE;
01840     }
01841 
01842     // save out the name into the registry
01843     ok = ok && SetRegString(hRegKey, TEXT("Name"), Name);
01844 
01845     ok = ok && SetRegString(hRegKey, TEXT("Type"), TokenTable[TOKEN_BAR].Token);
01846 
01847     KernelBarPos* pKernelBarPos = NULL;
01848     if(IsVisible())
01849         GetMainFrame()->GetBarPosInfo(WindowID,&Dock,&pKernelBarPos);
01850 
01851     ok = ok && SetRegInt(hRegKey, TEXT("Dock"), Dock);
01852 
01853     if (IsVisible())
01854     {
01855         SetDockBarType(Dock);
01856         if (pKernelBarPos)
01857         {
01858             if (Dock == DOCKBAR_FLOAT)
01859                 SetFloatingCPoint(wxPoint(pKernelBarPos->x,pKernelBarPos->y));
01860             else
01861             {
01862                 SetSlot(pKernelBarPos->Slot);
01863                 SetOffset(pKernelBarPos->Position);
01864             }
01865         }
01866     }
01867 
01868     if (Dock == DOCKBAR_FLOAT)
01869     {
01870         ok = ok && SetRegDword(hRegKey, TEXT("x"), FloatPos.x);
01871         ok = ok && SetRegDword(hRegKey, TEXT("y"), FloatPos.y);
01872     }
01873     else
01874     {
01875         ok = ok && SetRegDword(hRegKey, TEXT("Slot"), Slot);
01876         ok = ok && SetRegDword(hRegKey, TEXT("Offset"), Offset);
01877     }
01878 
01879     // save the visibility of the bar
01880     ok = ok && SetRegBool(hRegKey, TEXT("Visibility"), IsVisible());
01881 
01882     // save out the items on the bar
01883     // get the first control on this bar
01884     BarItem* pBarItem = (BarItem*) BarItemList.GetHead();
01885     String_256 data;
01886     while (pBarItem != NULL && ok)
01887     {
01888         data.Empty();
01889         // get the bar control to put its details into a string for us
01890         if (ok) ok = pBarItem->Write(&data);
01891         // now write that out to the registry
01892         Saver.SaveNextEntry(&data);
01893 
01894         // get the next control on this bar
01895         pBarItem = (BarItem*)BarItemList.GetNext(pBarItem);
01896     }
01897 
01898     // The saver will automatically shut down our use of the key
01899     // so just return the result of the saving to the user
01900     return ok; */
01901 
01902     return false;
01903 }

BOOL DialogBarOp::Write CCLexFile file  )  [virtual]
 

Write the dialog bar to the file in a tokenized form.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/94
Parameters:
file = a file to Write the dialog bar to. [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Errors: -

See also:
-

Reimplemented in SystemBarOp.

Definition at line 1376 of file bars.cpp.

01377 {
01378 #pragma message( __LOCMSG__ "DialogBarOp::Write(CCLexFile& file) - do nothing" )
01379     TRACE( _T("Warning - DialogBarOp::Write(CCLexFile& file) called") );
01380 /*  BOOL ok = TRUE;
01381     // we don't want to write out the control bank
01382     if(IsAllBarsOp())
01383         return ok;
01384     String_256 str;
01385 
01386     if (ok) ok = file.PutToken(TokenTable[TOKEN_BAR].Token);
01387     if (ok) ok = file.PutString(Name);
01388     KernelBarPos*   pKernelBarPos = NULL;
01389     
01390     if(IsVisible())
01391         GetMainFrame()->GetBarPosInfo(WindowID,&Dock,&pKernelBarPos);
01392     
01393     switch (Dock)
01394     {
01395         case DOCKBAR_TOP    : str = TokenTable[TOKEN_DOCKBAR_TOP].Token;    break;
01396         case DOCKBAR_BOTTOM : str = TokenTable[TOKEN_DOCKBAR_BOTTOM].Token; break;
01397         case DOCKBAR_LEFT   : str = TokenTable[TOKEN_DOCKBAR_LEFT].Token;   break;
01398         case DOCKBAR_RIGHT  : str = TokenTable[TOKEN_DOCKBAR_RIGHT].Token;  break;
01399         case DOCKBAR_FLOAT  : str = TokenTable[TOKEN_DOCKBAR_FLOAT].Token;  break;
01400         default             : ok  = FALSE;                break;
01401     }
01402 
01403     if (ok) ok = file.PutToken(str);
01404     
01405     if(IsVisible())
01406     {
01407         SetDockBarType(Dock);
01408         if(pKernelBarPos)
01409         {
01410             if (Dock == DOCKBAR_FLOAT)
01411                 SetFloatingCPoint(wxPoint(pKernelBarPos->x,pKernelBarPos->y));
01412             else
01413             {
01414                 SetSlot(pKernelBarPos->Slot);
01415                 SetOffset(pKernelBarPos->Position);
01416             }
01417         }
01418     }
01419     if (Dock == DOCKBAR_FLOAT)
01420     {
01421         if (ok) ok = file.PutToken(FloatPos.x);
01422         if (ok) ok = file.PutToken(FloatPos.y);
01423     }
01424     else
01425     {
01426         if (ok) ok = file.PutToken(Slot);
01427         if (ok) ok = file.PutToken(Offset);
01428     }
01429 
01430     if(IsVisible())
01431     {
01432         if (ok) ok = file.PutToken(TokenTable[TOKEN_VISIBLE].Token);
01433     }
01434     else
01435     {
01436         if (ok) ok = file.PutToken(TokenTable[TOKEN_INVISIBLE].Token);
01437     }
01438 
01439 
01440     file.IncIndent();
01441 
01442     BarItem* pBarItem = (BarItem*) BarItemList.GetHead();
01443     while (pBarItem != NULL && ok)
01444     {
01445         if (ok) ok = file.PutNewLine();
01446         if (ok) ok = pBarItem->Write(file);
01447         pBarItem = (BarItem*)BarItemList.GetNext(pBarItem);
01448     }
01449 
01450     file.DecIndent();
01451     if (ok) ok = file.PutNewLine();
01452 
01453     if (ok) ok = file.PutToken(TokenTable[TOKEN_BAR_END].Token);
01454     if (ok) ok = file.PutNewLine();
01455     if (ok) ok = file.PutNewLine();
01456 
01457     return ok; */
01458 
01459     return false;
01460 }

BOOL DialogBarOp::WriteBars CCLexFile file  )  [static]
 

Writes all the bars in tokenized form to the given file.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/94
Parameters:
file = a file object [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Errors: -

See also:
-

Definition at line 2185 of file bars.cpp.

02186 {
02187     BOOL            ok = TRUE;
02188     List*           pList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogBarOp));
02189     DialogBarOp*    pDialogBarOp = (DialogBarOp*)pList->GetHead();
02190 
02191     while (pDialogBarOp != NULL && ok)
02192     {
02193         if (!pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(SystemBarOp))
02194             &&!pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(InformationBarOp)))
02195             if(!pDialogBarOp->IsListEmpty())
02196                 ok = pDialogBarOp->Write(file);
02197         pDialogBarOp = (DialogBarOp*)pList->GetNext(pDialogBarOp);
02198     }
02199 
02200     return (ok);
02201 }

BOOL DialogBarOp::WriteBarsToFile CCLexFile file  )  [static]
 

Writes the entire kernel's bar representation to the given file. It is written in an ASCII tokenized form so that CCLexFile can be used to read the file back in when reconstructing the bars system.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/4/94
Parameters:
file = file to write bar tokens to [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 5198 of file bars.cpp.

05199 {
05200     BOOL ok = TRUE;
05201 
05202 PORTNOTE("other","WriteBarsToFile - Removed")
05203 #if !defined(EXCLUDE_FROM_XARALX)
05204 
05205     ok = file.InitLexer();
05206 
05207     if (ok) ok = DialogBarOp::WriteDockingBarsToFile(file);
05208     if (ok) ok = DialogBarOp::WriteWorkSpaceInfoToFile(file);
05209     if (ok) ok = InformationBarOp::WriteStatic(file);
05210     if (ok) ok = DialogBarOp::WriteBars(file);
05211 
05212     file.DeinitLexer();
05213 #endif
05214 
05215     return (ok);
05216 }

BOOL DialogBarOp::WriteBarsToRegistry HKEY  hSubKey  )  [static, protected]
 

The constructor The destructor Find out the size of controls used by all bars docked with this docking bar Sets the size of controls used by all bars docked with this docking bar Writes a tokenized form of the docking bar to the given file Writes all the docking bars in tokenized form to the given file Asks each relevent kernel bar representation to write its definition out. Each bar is written into a numbered section which is a sub-section of the supplied key. The numbering is 1..n. Each bar should write out some standard named sections and then write out any bar items as separate numbered lines into their section. The helper class SaveRegistryEntries can be used to handle this automatically.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/2/97
Parameters:
hSubKey the parent key to use in the registry [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
SaveRegistryEntries;

Definition at line 4762 of file bars.cpp.

04763 {
04764 #pragma message( __LOCMSG__ "DialogBarOp::WriteBarsToRegistry - do nothing" )
04765     TRACE( _T("Warning - DialogBarOp::WriteBarsToRegistry called") );
04766 /*  ERROR2IF(hSubKey == NULL,FALSE,"WriteBarsToRegistry bad registry key!");
04767 
04768     BOOL ok = TRUE;
04769 
04770     //if (ok) ok = DialogBarOp::WriteDockingBarsToRegistry();
04771     //if (ok) ok = DialogBarOp::WriteWorkSpaceInfoToFile();
04772 
04773     // save out a version number of the bars, the current build number
04774     // the hSubKey should be opened and ready for writing
04775     ok = ok && SetRegDword(hSubKey, TEXT("VersionMajor"), CAMELOT_VERSION_MAJOR);
04776     ok = ok && SetRegDword(hSubKey, TEXT("VersionMinor"), CAMELOT_VERSION_MINOR);
04777 
04778     ok = ok && InformationBarOp::Write(hSubKey);
04779 
04780     // Go through all the bars and if they are the correct type then ask them to write
04781     // themselves out to the registry.
04782     List* pList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogBarOp));
04783     
04784     // Get the first bar in the list
04785     DialogBarOp* pDialogBarOp = (DialogBarOp*)pList->GetHead();
04786     // Loop through all bars
04787     INT32 i = 0;
04788     TCHAR buf[10];
04789     while (pDialogBarOp != NULL && ok)
04790     {
04791         // Use the same method as before, nasty but should ensure we do everything as intended
04792         if (!pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(SystemBarOp)) &&
04793             !pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(InformationBarOp)))
04794         {
04795             // we don't want to write out the control bank or any list items that are blank
04796             if (!pDialogBarOp->IsListEmpty() && !pDialogBarOp->IsAllBarsOp())
04797             {
04798                 // write out the data for that bar using the counter number as the key name
04799                 wsprintf(buf, TEXT("%d"), i + 1);
04800                 String_256 name(buf);
04801                 SaveRegistryEntries Saver;
04802                 Saver.StartSaving(&name, hSubKey);
04803                 
04804                 ok = pDialogBarOp->Write(Saver);
04805 
04806                 Saver.StopSaving();
04807 
04808                 // Only increment our count after we have written a valid bar definition section
04809                 i++;
04810             }
04811         }
04812 
04813         // Get the next bar in the list
04814         pDialogBarOp = (DialogBarOp*)pList->GetNext(pDialogBarOp);
04815     }
04816 
04817     return (ok); */
04818 
04819     return true;
04820 }

BOOL DialogBarOp::WriteDockingBarsToFile CCLexFile file  )  [static]
 

Writes the persistant docking data retrieved from the docking system.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/4/94
Parameters:
file = file to write persistant docking data to [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 5233 of file bars.cpp.

05234 {
05235 #pragma message( __LOCMSG__ "DialogBarOp::WriteDockingBarsToFile - do nothing" )
05236     TRACE( _T("Warning - DialogBarOp::WriteDockingBarsToFile called") );
05237 /*  BOOL ok = TRUE;
05238     CCamFrame* pMainFrame = GetMainFrame();
05239 
05240     ok = (pMainFrame != NULL);
05241 
05242     for (INT32 i=0;i<NUM_DOCKBARS && ok;i++)
05243     {
05244         OILDockingBar* pDockBar = pMainFrame->GetDockBar((DockBarType)i);
05245         if (ok) ok = (pDockBar != NULL);
05246 
05247         if (ok) ok = file.PutToken(TokenTable[TOKEN_DOCKING_BAR].Token);
05248         if (ok) ok = file.PutToken(TokenTable[TOKEN_DOCKBAR_LEFT+i].Token);
05249         if (ok)
05250         {
05251             if (pDockBar->IsBigControls())
05252                 ok = file.PutToken(TokenTable[TOKEN_BIG].Token);
05253             else
05254                 ok = file.PutToken(TokenTable[TOKEN_SMALL].Token);
05255         }
05256         if (ok) ok = file.PutNewLine();
05257     }
05258 
05259     if (ok) ok = file.PutNewLine();
05260 
05261     return (ok); */
05262 
05263     return false;
05264 }

BOOL DialogBarOp::WriteDockingBarsToRegistry HKEY  hSubKey  )  [static, protected]
 

Writes the persistant docking data retrieved from the docking system.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/2/97
Parameters:
hSubKey the registery section to save the data into [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 4956 of file bars.cpp.

04957 {
04958 #pragma message( __LOCMSG__ "DialogBarOp::WriteDockingBarsToRegistry - do nothing" )
04959     TRACE( _T("Warning - DialogBarOp::WriteDockingBarsToRegistry called") );
04960 /*  ERROR2IF(hSubKey == NULL,FALSE,"WriteDockingBarsToRegistry bad registry key!");
04961 
04962     BOOL                ok = TRUE;
04963     CCamFrame          *pMainFrame = GetMainFrame();
04964 
04965     if (pMainFrame == NULL)
04966         return FALSE;
04967 
04968     // Save it into the registry
04969     String_256 SectionName;
04970     // First open/create a new sub-key under the app-state key for holding the data.
04971     HKEY hRegKey = CreateRegKey(hSubKey, PRODUCT_REGISTRYKEY_BARSETTINGS);
04972     if (hRegKey == NULL)
04973     {
04974         ERROR3("DialogBarOp::WriteWorkSpaceInfoToRegistry failed to get registry key");
04975         return FALSE;
04976     }
04977 
04978     for (INT32 i = 0; i < NUM_DOCKBARS && ok; i++)
04979     {
04980         OILDockingBar* pDockBar = pMainFrame->GetDockBar((DockBarType)i);
04981         if (ok) ok = (pDockBar != NULL);
04982 
04983         // save out the details on that bar's status i.e. big or small
04984         ok = ok && SetRegBool(hRegKey, TokenTable[TOKEN_DOCKBAR_LEFT+i].Token, pDockBar->IsBigControls());
04985     }
04986 
04987     // Close down the key
04988     CloseRegKey(hRegKey);
04989 
04990     return (ok); */
04991 
04992     return false;
04993 }

BOOL DialogBarOp::WriteNamedBars String_256  FileName  )  [static]
 

writes current bars set up to *.ini file

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/94
Parameters:
File name [INPUTS]
- [OUTPUTS]
Returns:
Error condition

Errors: write failed

See also:
-

Definition at line 3451 of file bars.cpp.

03452 {
03453 
03454 #ifdef STANDALONE
03455 
03456     // Standalone doesn't need to write any bars out
03457     return TRUE;
03458 
03459 #else
03460     BOOL ok = TRUE;
03461 
03462 #ifdef SAVE_PREFS_TO_REGISTRY
03463     // Check to see which section we are trying to access and then open the relevant key
03464     // for that section
03465     String_256 KeySectionName;
03466     if (!FileName.CompareTo("normal"))
03467         KeySectionName = PRODUCT_REGISTRYKEY_BARSNORMAL;
03468     else
03469         KeySectionName = PRODUCT_REGISTRYKEY_BARSFULL;
03470 
03471     HKEY hRegKey = CreateRegKey(hAppStateRegKey, KeySectionName);
03472     if (hRegKey != NULL)
03473     {
03474         // Write the workspace settings into the registry
03475         // These use the BarSettings sections
03476         ok = ok && WriteWorkSpaceInfoToRegistry(hRegKey);
03477         ok = ok && WriteDockingBarsToRegistry(hRegKey);
03478         // These write out to their own sections
03479         ok = ok && WriteBarsToRegistry(hRegKey);
03480     }
03481     CloseRegKey(hRegKey);
03482 
03483 #else   
03484     // File was called XStudio.nor or .cle (or XViewer.nor or .cle)
03485     // We will now call them all CorelX##.ini where #### in this case is either BN or BF
03486     String_256 File("");
03487 
03488     if(!FileName.CompareTo( _T("normal") ))
03489         File = PRODUCT_BARSNORMAL_INIFILE;
03490     else
03491         File = PRODUCT_BARSFULL_INIFILE;
03492 
03493     // first look for a prefs path
03494 #if defined(__WXMSW__)
03495     const UINT32 cchMaxPath = _MAX_PATH;
03496 #else
03497     const UINT32 cchMaxPath = 1 + pathconf( "/", _PC_PATH_MAX );
03498 #endif
03499     TCHAR *szBuff = static_cast<TCHAR *>(alloca( cchMaxPath * sizeof(TCHAR) ));
03500     if (DefaultBarsConfigPath.Length() > 0)
03501     {
03502         camStrcpy( szBuff, DefaultBarsConfigPath );
03503         camStrcpy( szBuff, _T("\\") );
03504         camStrcpy( szBuff, File );
03505     }
03506     // no entry use windows dir
03507     else
03508     {
03509 #if defined(__WXMSW__)
03510         UINT32 Len = GetWindowsDirectory(szBuff, cchMaxPath - 1);
03511 #else
03512         camStrcpy( szBuff, _T("~/.XaraLX") );
03513         UINT32 Len = camStrlen( szBuff );
03514 #endif
03515         
03516         if ((Len > 0) && (Len < cchMaxPath))
03517         {
03518             camStrcat( szBuff, _T("\\") );
03519             camStrcat( szBuff, File );
03520         }   
03521     }
03522 
03523     PathName path;
03524 
03525     CCDiskFile file;
03526     if (ok) ok = path.SetPathName(szBuff);
03527     if (ok) ok = file.open(path,ios::out);
03528     if (ok) ok = DialogBarOp::WriteBarsToFile(file);
03529     if (ok) file.close();
03530     
03531     // the write has failed probably due to  disc full
03532     // we'll delete the corrupt file and set an error.
03533 #pragma message( __LOCMSG__ "Removed _tremove on non-Windows OS" )
03534     #if defined(__WXMSW__)
03535     if(!ok)
03536         _tremove(szBuff);
03537     #endif
03538     
03539     ERROR1IF(!ok,FALSE,_R(IDE_CANT_SAVE_BARS));
03540 #endif
03541 
03542     // return the result to the caller
03543     return ok;
03544 #endif
03545 }

BOOL DialogBarOp::WriteWorkSpaceInfoToFile CCLexFile file  )  [static]
 

Writes workspace data to ini file ( Full Screen Mode etc..).

Author:
Chris_Parks (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/94
Parameters:
file = file to write persistant docking data to [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 5281 of file bars.cpp.

05282 {
05283 #pragma message( __LOCMSG__ "DialogBarOp::WriteWorkSpaceInfoToFile - do nothing" )
05284     TRACE( _T("Warning - DialogBarOp::WriteWorkSpaceInfoToFile called") );
05285 /*  BOOL ok = TRUE;
05286     CCamFrame* pMainFrame = GetMainFrame();
05287 
05288     ok = (pMainFrame != NULL);
05289     
05290     if (ok) ok = file.PutToken(TokenTable[TOKEN_FULLSCREEN].Token);
05291     if(pMainFrame->IsFullScreenMode())
05292     {
05293         if (ok) ok = file.PutToken(TokenTable[TOKEN_ON].Token);
05294     }
05295     else
05296     {
05297         if (ok) ok = file.PutToken(TokenTable[TOKEN_OFF].Token);
05298     }
05299     if (ok) ok = file.PutNewLine();
05300 
05301     if (ok) ok = file.PutToken(TokenTable[TOKEN_STATUS_BAR].Token);
05302     
05303     if(pMainFrame->IsStatusBarVisible())
05304     {
05305         if (ok) ok = file.PutToken(TokenTable[TOKEN_VISIBLE].Token);
05306     }
05307     else
05308     {
05309         if (ok) ok = file.PutToken(TokenTable[TOKEN_INVISIBLE].Token);
05310     }
05311     if (ok) ok = file.PutNewLine();
05312 
05313     if (ok) ok = file.PutToken(TokenTable[TOKEN_COLOUR_BAR].Token);
05314     if(pMainFrame->IsColourBarVisible())
05315     {
05316         if (ok) ok = file.PutToken(TokenTable[TOKEN_VISIBLE].Token);
05317     }
05318     else
05319     {
05320         if (ok) ok = file.PutToken(TokenTable[TOKEN_INVISIBLE].Token);
05321     }
05322     
05323     if (ok) ok = file.PutNewLine();
05324 
05325     if (ok) ok = file.PutToken(TokenTable[TOKEN_SCROLL_BARS].Token);
05326     if(pMainFrame->AreScrollBarsVisible())
05327     {
05328         if (ok) ok = file.PutToken(TokenTable[TOKEN_VISIBLE].Token);
05329     }
05330     else
05331     {
05332         if (ok) ok = file.PutToken(TokenTable[TOKEN_INVISIBLE].Token);
05333     }
05334     
05335     if (ok) ok = file.PutNewLine();
05336     if (ok) ok = file.PutNewLine();
05337 
05338     return (ok); */
05339 
05340     return false;
05341 }

BOOL DialogBarOp::WriteWorkSpaceInfoToRegistry HKEY  hSubKey  )  [static, protected]
 

Writes workspace data to registry ( Full Screen Mode etc..).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/2/97
Parameters:
hSubKey the registery section to save the data into [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 5084 of file bars.cpp.

05085 {
05086 #pragma message( __LOCMSG__ "DialogBarOp::WriteWorkSpaceInfoToRegistry - do nothing" )
05087     TRACE( _T("Warning - DialogBarOp::WriteWorkSpaceInfoToRegistry called") );
05088 /*  ERROR2IF(hSubKey == NULL,FALSE,"WriteWorkSpaceInfoToRegistry bad registry key!");
05089 
05090     BOOL ok = TRUE;
05091     CCamFrame* pMainFrame = GetMainFrame();
05092 
05093     if (pMainFrame == NULL)
05094         return FALSE;
05095     
05096     // Save it into the registry
05097     // First open/create a new sub-key under the app-state key for holding the data.
05098     HKEY hRegKey = CreateRegKey(hSubKey, PRODUCT_REGISTRYKEY_BARSETTINGS);
05099     if (hRegKey == NULL)
05100     {
05101         ERROR3("DialogBarOp::WriteWorkSpaceInfoToRegistry failed to get registry key");
05102         return FALSE;
05103     }
05104 
05105     // Save the value
05106     ok = ok && SetRegBool(hRegKey, TokenTable[TOKEN_FULLSCREEN].Token, pMainFrame->IsFullScreenMode());
05107     ok = ok && SetRegBool(hRegKey, TokenTable[TOKEN_STATUS_BAR].Token, pMainFrame->IsStatusBarVisible());
05108     ok = ok && SetRegBool(hRegKey, TokenTable[TOKEN_COLOUR_BAR].Token, pMainFrame->IsColourBarVisible());
05109     ok = ok && SetRegBool(hRegKey, TokenTable[TOKEN_SCROLL_BARS].Token, pMainFrame->AreScrollBarsVisible());
05110 
05111     // Close down the key
05112     CloseRegKey(hRegKey);
05113 
05114     return (ok); */
05115 
05116     return false;
05117 }


Member Data Documentation

DialogBarOp * DialogBarOp::AllBarsOp = NULL [static]
 

Definition at line 633 of file bars.h.

List DialogBarOp::BarItemList [protected]
 

Definition at line 727 of file bars.h.

Orientation DialogBarOp::BarOrientation [private]
 

Definition at line 732 of file bars.h.

wxRect DialogBarOp::BarRect [protected]
 

Definition at line 724 of file bars.h.

DockBarType DialogBarOp::Dock [protected]
 

Reimplemented in InformationBarOp.

Definition at line 720 of file bars.h.

wxPoint DialogBarOp::FloatPos [protected]
 

Reimplemented in InformationBarOp.

Definition at line 723 of file bars.h.

BOOL DialogBarOp::InitiallyVisible [protected]
 

Definition at line 726 of file bars.h.

String_32 DialogBarOp::Name [private]
 

Definition at line 730 of file bars.h.

INT32 DialogBarOp::Offset [protected]
 

Reimplemented in InformationBarOp.

Definition at line 722 of file bars.h.

UINT32 DialogBarOp::Slot [protected]
 

Reimplemented in InformationBarOp.

Definition at line 721 of file bars.h.

BOOL DialogBarOp::SystemStateChanged = TRUE [static, private]
 

Definition at line 734 of file bars.h.

PathName DialogBarOp::ValidPath [static, protected]
 

Definition at line 715 of file bars.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:53:31 2007 for Camelot by  doxygen 1.4.4