InfoBarOp Class Reference

#include <infobar.h>

Inheritance diagram for InfoBarOp:

DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 InfoBarOp (CDlgResID DialogID=0)
virtual MsgResult Message (Msg *Msg)
void Do (OpDescriptor *)
 This function should be over-ridden to perform an operation without passing a parameter.
BOOL Create ()
 The create method reserves everything needed to guarantee that the dialog will appear. It returns FALSE if it fails. If any dialog merging was specified (by providing a non-zero value for SubDialogID in the call to the DialogOp constructor) then it will be carried out when this function is called.
BOOL Create (UINT32 DialogID)
void OnSizeParent (WPARAM, LPARAM lParam)
 Resize the info bar when the parent window moves/resizes, or when one of the children becomes visible/invisible.
void Toggle ()
 Toggle the Info Bar on or off (i.e. make it invisible or visible).
void NewCurrentSpread ()
 This function gets called by the LayerManager when the Current Spread is changing.
void DisableLayerControl ()
 Disables the layer control.
void EnableLayerControl ()
 Enables the layer control.

Static Public Member Functions

static BOOL Init ()
 Declares a preference that allows you to clear memory in delete().
static OpState GetState (String_256 *, OpDescriptor *)

Static Public Attributes

static UINT32 IDD = _R(IDD_INFOBAR)
static const CDlgMode Mode = MODELESS
static BOOL Visible = TRUE

Private Member Functions

void ChangeActiveLayer (WORD LayerIndex)
 Changes the active layer.

Private Attributes

wxPoint DragPos
BOOL DraggingBar

Detailed Description

Definition at line 106 of file infobar.h.


Constructor & Destructor Documentation

InfoBarOp::InfoBarOp CDlgResID  DialogID = 0  ) 
 

Definition at line 126 of file infobar.cpp.

00126                                           :
00127     DialogOp(InfoBarOp::IDD, InfoBarOp::Mode, SubDialogID)
00128 {
00129 
00130     // Not dragging the info bar intially
00131     DraggingBar = FALSE;
00132 }


Member Function Documentation

void InfoBarOp::ChangeActiveLayer WORD  NewLayerIndex  )  [private]
 

Changes the active layer.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/1/94
Parameters:
NewLayerIndex,: z-order Index of the new active layer. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 483 of file infobar.cpp.

00484 {
00485     ENSURE(FALSE,"This function should not be called");
00486 /*
00487     INT32 CurrentIndex = 0; 
00488     // Traverse the Layer Manager's LyrDetList 
00489     List* LyrList = &((Document::GetCurrent()->GetLayerMgr()).LyrDetList); 
00490     ListItem* CurLayerDet = LyrList->GetHead();  
00491     ENSURE(CurLayerDet != NULL, "The LyrDetList is empty"); 
00492     while (CurLayerDet != NULL)
00493     {
00494         if (CurrentIndex == NewLayerIndex)
00495         {
00496             // We have found the layer to make active 
00497             ((LyrDetails*)CurLayerDet)->Status.Flags.Active = TRUE; 
00498         }
00499         else if ( ((LyrDetails*)CurLayerDet)->Status.Flags.Active )
00500         {
00501             // We have found the old active layer 
00502             ((LyrDetails*)CurLayerDet)->Status.Flags.Active = FALSE; 
00503         }
00504         CurLayerDet = LyrList->GetNext(CurLayerDet); // Get next layer detail record 
00505         CurrentIndex ++;    
00506     }
00507     
00508     // Commit the changes 
00509     (Document::GetCurrent()->GetLayerMgr()).CommitLayerChanges(); 
00510 */
00511 }

BOOL InfoBarOp::Create UINT32  DialogID  ) 
 

BOOL InfoBarOp::Create void   )  [virtual]
 

The create method reserves everything needed to guarantee that the dialog will appear. It returns FALSE if it fails. If any dialog merging was specified (by providing a non-zero value for SubDialogID in the call to the DialogOp constructor) then it will be carried out when this function is called.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/8/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if all resources to create the dialog can be successfully allocated. FALSE otherwise

Errors: If the resources cannot be allocated then ERRORIF is called with a Dialog creation failed error message.

See also:
-

Reimplemented from DialogOp.

Definition at line 241 of file infobar.cpp.

00242 {
00243     return DialogOp::Create();
00244 }

void InfoBarOp::DisableLayerControl  ) 
 

Disables the layer control.

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

Errors: -

See also:
-

Definition at line 441 of file infobar.cpp.

00442 {
00443      EnableGadget(_R(IDC_LAYER_COMBO), FALSE ); 
00444      EnableGadget(_R(IDC_INVOKE_LYR_DLG), FALSE); 
00445 } 

void InfoBarOp::Do OpDescriptor  )  [virtual]
 

This function should be over-ridden to perform an operation without passing a parameter.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/6/94
Parameters:
OpDesc,: A pointer to the OpDescriptor which invoked the operation [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Operation::DoWithParam

Reimplemented from Operation.

Definition at line 248 of file infobar.cpp.

00249 {
00250     // Just to make sure info bar is not opened until it is positioned correctly (by
00251     // InfoBarOp::OnSizeParent()).
00252     Close();
00253 }

void InfoBarOp::EnableLayerControl  ) 
 

Enables the layer control.

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

Errors: -

See also:
-

Definition at line 462 of file infobar.cpp.

00463 {
00464      EnableGadget(_R(IDC_LAYER_COMBO), TRUE ); 
00465      EnableGadget(_R(IDC_INVOKE_LYR_DLG), TRUE ); 
00466 } 

OpState InfoBarOp::GetState String_256 ,
OpDescriptor
[static]
 

Definition at line 211 of file infobar.cpp.

00212 {
00213     OpState OpSt;
00214     return(OpSt);
00215 }

BOOL InfoBarOp::Init void   )  [static]
 

Declares a preference that allows you to clear memory in delete().

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/4/94
Returns:
TRUE if it worked OK, FALSE if not

Reimplemented from SimpleCCObject.

Definition at line 219 of file infobar.cpp.

00220 {
00221     // Create the OpDescriptor for this operation class.
00222     if (!(RegisterOpDescriptor(
00223                                0,
00224                                _R(IDT_VIEWINFOBAR),
00225                                CC_RUNTIME_CLASS(InfoBarOp),
00226                                OPTOKEN_INFOBAR,
00227                                InfoBarOp::GetState,
00228                                0,   /* help ID */
00229                                _R(IDBBL_INFOBAROP),
00230                                0    /* bitmap ID */)))
00231     {
00232         return FALSE; 
00233     }
00234     // Declare info bar preference.
00235     return Camelot.DeclareSection("Windows", 5) &&
00236            Camelot.DeclarePref("Windows", "InfoBarIsVisible", &Visible);
00237 }

MsgResult InfoBarOp::Message Msg Message  )  [virtual]
 

if (IS_OUR_DIALOG_MSG(Message)) { DialogMsg* Msg = (DialogMsg*)Message; Handle Msg here }

Pass message on to base class for rest of handling. return <BaseClass>Message(Message);

This Pure virtual function will ENSURE

Returns:
Errors: -
See also:
MessageHandler

IS_OUR_DIALOG_MSG

Reimplemented from DialogOp.

Definition at line 135 of file infobar.cpp.

00136 {
00137 /*
00138     if (Document::GetCurrent() == NULL)
00139         // No document - can't do anything
00140         return;
00141 
00142     // Process static Infobar control messages 
00143     if ((Gadget == _R(IDC_INVOKE_LYR_DLG)) && (DlgMsg == DIM_LFT_BN_CLICKED))
00144     {
00145         // Obtain a pointer to the op descriptor for the Layer dialog operation 
00146         OpDescriptor* OpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(LayerDlg)); 
00147         // Invoke the operation. 
00148         OpDesc->Invoke();         
00149     }   
00150 
00151     // Process active layer selection
00152     if ((Gadget == _R(IDC_LAYER_COMBO)) && (DlgMsg == DIM_SELECTION_CHANGED))
00153     {
00154         // Obtain the index of the selected item
00155         WORD Index;  
00156         GetValueIndex(_R(IDC_LAYER_COMBO), &Index); 
00157         ChangeActiveLayer(Index); 
00158     }
00159 
00160     if (Gadget >= _R(ID_FIRST_TOOL_CTRL))
00161     {
00162         // Gadgets with IDs of 1000 or greater belong to the tool, not the Info bar, so
00163         // pass the message on to the tool.
00164         Tool *pTool = Tool::GetCurrent();
00165         ENSURE(pTool != NULL, "InfoBarOp::HandleMessage - no Tool is selected!");
00166         if (pTool != NULL)
00167             pTool->HandleInfoBarMessage(DlgMsg, Gadget);
00168     }
00169     else
00170     {
00171         #if 0
00172         // Handle the dragging of the info bar
00173         switch (DlgMsg)
00174         {
00175             case DIM_RGT_BN_DOWN:
00176             case DIM_LFT_BN_DOWN:
00177                 GetCursorPos(&DragPos);
00178                 SetCapture(WindowID);
00179                 DraggingBar = TRUE;
00180                 break;
00181 
00182             case DIM_MOUSE_DRAG:
00183                 if (!DraggingBar)
00184                 {
00185                     GetCursorPos(&DragPos);
00186                     SetCapture(WindowID);
00187                     DraggingBar = TRUE;
00188                     return;
00189                 }
00190 
00191                 POINT CurrPoint;
00192                 GetCursorPos(&CurrPoint);
00193                 ScrollWindow(WindowID, CurrPoint.x - DragPos.x, 0, NULL, NULL);
00194                 DragPos = CurrPoint;
00195                 break;
00196 
00197             case DIM_RGT_BN_UP:
00198             case DIM_LFT_BN_UP:
00199                 ReleaseCapture();
00200                 DraggingBar = FALSE;
00201                 break;
00202         }
00203         #endif
00204     }
00205 */
00206     return OK; 
00207 }

void InfoBarOp::NewCurrentSpread  ) 
 

This function gets called by the LayerManager when the Current Spread is changing.

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

Errors: -

See also:
-

Definition at line 377 of file infobar.cpp.

00378 {
00379     ENSURE(FALSE,"This function should not be called");
00380 /*
00381     GadgetRedraw(_R(IDC_LAYER_COMBO),FALSE);    // Turn off drawing until we have finished making changes 
00382                                             // to the gadget. 
00383     // Delete any existing list items 
00384     INT32 Count; 
00385     GetValueCount(_R(IDC_LAYER_COMBO),&Count); 
00386     while (Count != 0)
00387     {
00388         DeleteValue(_R(IDC_LAYER_COMBO), FALSE, Count-1); 
00389         Count--; 
00390     }
00391 
00392     WORD SelItemIndex = 0; // The list index of the selected item (i.e. the active layer)
00393     WORD i = 0; 
00394 
00395     BOOL FoundActiveLayer = FALSE; 
00396 
00397     // Traverse the Layer Manager's LyrDetList and add all layer identifiers to the list gadget
00398     List* LyrList = &((Document::GetCurrent()->GetLayerMgr()).LyrDetList); 
00399     ListItem* CurLayerDet = LyrList->GetHead();  
00400     ENSURE(CurLayerDet != NULL, "The LyrDetList is empty"); 
00401     while (CurLayerDet != NULL)
00402     {
00403         // Is the current layer the active layer ? 
00404         if ( ((LyrDetails*)CurLayerDet)->Status.Flags.Active ) 
00405         {
00406             // Ensure that there is only one active layer 
00407             ENSURE (!FoundActiveLayer, "More than one active layer found"); 
00408             FoundActiveLayer = TRUE; 
00409             SelItemIndex = i; 
00410         }
00411         // Add string to end of list box 
00412         SetStringGadgetValue(_R(IDC_LAYER_COMBO),&(((LyrDetails*)CurLayerDet)->Status.StringLayerID)); 
00413 
00414         CurLayerDet = LyrList->GetNext(CurLayerDet);    
00415         i++; 
00416     }
00417 
00418     ENSURE(FoundActiveLayer,"No active layer was found"); 
00419 
00420     GadgetRedraw(_R(IDC_LAYER_COMBO),TRUE); // Turn drawing back on 
00421 
00422     SetSelectedValueIndex(_R(IDC_LAYER_COMBO), SelItemIndex); // Select the active layer 
00423 */
00424 } 

void InfoBarOp::OnSizeParent WPARAM  ,
LPARAM  lParam
 

Resize the info bar when the parent window moves/resizes, or when one of the children becomes visible/invisible.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/11/93
Parameters:
WPARAM - ignored. [INPUTS] lParam - the special MFC structure that is sent when a parent tells its child windows to resize themselves.
lParam - the structure is updated to reflect how much client area was [OUTPUTS] taken by the Info Bar.
The WM_SIZEPARENT message is sent, which is a special AFX message (from the WM_USER address space I think). The child windows then adjust the structure passed to them to steal part of the workspace for themselves, and whatever is left over is used for the client area.

This is all undocumented and was deduced by looking at the MFC files WINCORE.CPP, WINFRM.CPP, BARCORE.CPP, and BARDLG.CPP.

Definition at line 279 of file infobar.cpp.

00280 {
00281     AFX_SIZEPARENTPARAMS FAR* lpLayout = (AFX_SIZEPARENTPARAMS FAR*)lParam;
00282 
00283     if (Visible)
00284     {
00285         // Make the window zero size to avoid redraws
00286         //MoveWindow(WindowID, 0, 0, 0, 0, FALSE);
00287 
00288         // Info Bar is visible - reposition it wrt parent window.
00289         CRect rect;
00290         rect.CopyRect(&lpLayout->rect);
00291 
00292         CSize sizeAvail = rect.Size();  // maximum size available
00293         CSize size;     // maximum requested size
00294         size.cx = min(32767, sizeAvail.cx);
00295         size.cy = min(28, sizeAvail.cy);
00296 
00297 
00298         // top align (stretch width)
00299         size.cx = sizeAvail.cx;
00300         lpLayout->rect.top += size.cy;
00301 
00302         rect.right = rect.left + size.cx;
00303         rect.bottom = rect.top + size.cy;
00304 
00305         #if _MFC_VER < 0x300
00306         _AfxRepositionWindow(lpLayout, WindowID, &rect);
00307 
00308         // If the window hasn't actually been opened yet, then open it.
00309         // This deferral is necessary otherwise the window is opened before being
00310         // correctly positioned, and a portion of the document view is invalidated
00311         // and redrawn, which we definitely don't want.
00312         #if 1
00313         if (!IsWindowVisible(WindowID))
00314         {
00315             lpLayout->hDWP =
00316                 ::DeferWindowPos(lpLayout->hDWP, WindowID, NULL, 0, 0, 0, 0,
00317                                  SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|
00318                                  SWP_SHOWWINDOW);
00319         }
00320         #endif
00321         #else
00322         lpLayout->hDWP = ::DeferWindowPos(lpLayout->hDWP, WindowID, NULL,
00323                                           rect.left, rect.top,
00324                                           rect.right - rect.left, rect.bottom - rect.top,
00325                                           SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW);
00326         #endif
00327     }
00328 }

void InfoBarOp::Toggle  ) 
 

Toggle the Info Bar on or off (i.e. make it invisible or visible).

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/11/93

Definition at line 341 of file infobar.cpp.

00342 {
00343     // Work out whether to open or close the info bar, and do so.
00344     // (Also update preference variable)
00345     if (IsOpen())
00346     {
00347         Close();
00348         Visible = FALSE;
00349     }
00350     else
00351     {
00352         Open();
00353         Visible = TRUE;
00354     }
00355 
00356     // Find the main frame, and force the child windows to be repositioned/redrawn.
00357     CMainFrame *pFrame = (CMainFrame *) AfxGetApp()->m_pMainWnd;
00358     pFrame->RecalcLayout();
00359 }


Member Data Documentation

BOOL InfoBarOp::DraggingBar [private]
 

Definition at line 142 of file infobar.h.

wxPoint InfoBarOp::DragPos [private]
 

Definition at line 141 of file infobar.h.

UINT32 InfoBarOp::IDD = _R(IDD_INFOBAR) [static]
 

Definition at line 121 of file infobar.h.

const CDlgMode InfoBarOp::Mode = MODELESS [static]
 

Definition at line 122 of file infobar.h.

BOOL InfoBarOp::Visible = TRUE [static]
 

Definition at line 138 of file infobar.h.


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