#include <barcreationdlg.h>
Inheritance diagram for BarStatesDlg:
Public Member Functions | |
BarStatesDlg () | |
Constructor. | |
~BarStatesDlg () | |
Destructor. | |
void | Do (OpDescriptor *) |
Opens the dialog if it is closed. Closes it if it is open. Should no longer be called, but use the with param instead. | |
void | DoWithParam (OpDescriptor *pOp, OpParam *pParam) |
Performs the BarCreationDlg operation. | |
virtual MsgResult | Message (Msg *Message) |
This is the message handler for the BarStatesDlg. It simply takes the message and redirects it to one of our Message Handler functions. | |
Static Public Member Functions | |
static BOOL | Init () |
Creates an OpDescriptor for a HotLink Dialog and declares some preferences. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
Returns the OpState of the dialogue operation. | |
Static Public Attributes | |
static const UINT32 | IDD |
static const CDlgMode | Mode |
Protected Member Functions | |
BOOL | Create () |
Creates a dlg. | |
void | SetUpControls () |
BOOL | ScanForBarDetails () |
Scans the tree to fill in the variables passed to it Params: NoOfButtons-How many buttons there are in the bar. | |
BOOL | CreateBarStates (BOOL ReCreate=FALSE) |
BOOL | OnSelectionChanged () |
Protected Attributes | |
String_256 | m_BarName |
BOOL | m_StateExists [5] |
BOOL | m_ValidBar |
Static Protected Attributes | |
static BarStatesDlg * | TheDialog |
static INT32 | m_State |
static INT32 | ms_SuggestDesign |
Private Member Functions | |
CC_DECLARE_DYNCREATE (BarStatesDlg) |
Definition at line 222 of file barcreationdlg.h.
|
Constructor. / Set up our static variables const CDlgMode BarStatesDlg::Mode = MODELESS; const UINT32 BarStatesDlg::IDD = _R(IDD_BARSTATESDLG); BarStatesDlg *BarStatesDlgTheDialog = NULL; INT32 BarStatesDlg::m_State = 1; BOOL BarStatesDlg::ms_SuggestDesign = TRUE; /*!
Definition at line 1117 of file barcreationdlg.cpp. 01117 : DialogOp(BarStatesDlg::IDD, BarStatesDlg::Mode) 01118 { 01119 //Set our member variable pointer so it points at ourself 01120 if (TheDialog == NULL) 01121 TheDialog = this; 01122 01123 m_ValidBar = TRUE; 01124 }
|
|
Destructor.
Definition at line 1138 of file barcreationdlg.cpp. 01139 { 01140 //Set our member variable pointer to NULL 01141 if (TheDialog == this) 01142 TheDialog = NULL; 01143 }
|
|
|
|
Creates a dlg.
Reimplemented from DialogOp. Definition at line 1426 of file barcreationdlg.cpp. 01427 { 01428 if (TheDialog != this) // Allow only one instance of this dialogue open at once 01429 return(FALSE); 01430 01431 for (INT32 i = 0; i < 5; i++) 01432 m_StateExists[i] = FALSE; 01433 01434 ScanForBarDetails(); 01435 01436 if (DialogOp::Create()) 01437 { 01438 return(TRUE); 01439 } 01440 01441 return(FALSE); 01442 }
|
|
Definition at line 1645 of file barcreationdlg.cpp. 01646 { 01647 NodeBarProperty* pNodeBarProperty = (NodeBarProperty*) Document::GetCurrent()->GetSetSentinel()->FindBarProperty(); 01648 INT32 BarNumber = SliceHelper::GetBarNumberFromBarName(m_BarName); 01649 01650 if (!pNodeBarProperty || BarNumber >= pNodeBarProperty->HowMany()) 01651 return FALSE; 01652 01653 BarDataType NewBarData = pNodeBarProperty->Bar(BarNumber); 01654 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_BARCREATIONOP); 01655 01656 if (!pOpDesc) 01657 return FALSE; 01658 01659 BYTE ExtendFlags = 0; // dont extend 01660 01661 if (NewBarData.ButtonsExtend) 01662 ExtendFlags = X_EXTEND | Y_EXTEND; 01663 else 01664 if (NewBarData.ButtonsScale) 01665 ExtendFlags = X_STRETCH | Y_STRETCH; 01666 01667 OpParamBarCreation BarParam(m_State == 1, //ms_WantMouse, 01668 m_State == 2, //ms_WantClicked, 01669 m_State == 3, //ms_WantSelected, 01670 m_State == 4, //(ms_StateToCreate == BACKBAR), 01671 NewBarData.IsHorizontal ? FALSE : TRUE, 01672 ms_SuggestDesign, 01673 0, //ms_NoOfButtons, 01674 m_State == 0, // ms_WantDefault - dont use this to make the default from this dlg 01675 REPLACE_SOME_STATES, 01676 NewBarData.Spacing, 01677 NewBarData.RequiresShuffle, 01678 NewBarData.SameSize, 01679 m_BarName, 01680 (m_State == DEFAULT || m_State == BACKBAR) ? TRUE : FALSE, // from selection or from MouseOff? 01681 ExtendFlags, 01682 ReCreate); 01683 pOpDesc->Invoke(&BarParam); 01684 01685 return TRUE; 01686 }
|
|
Opens the dialog if it is closed. Closes it if it is open. Should no longer be called, but use the with param instead.
Reimplemented from Operation. Definition at line 1391 of file barcreationdlg.cpp. 01392 { 01393 m_BarName = "Bar1"; 01394 01395 if (TheDialog==NULL || TheDialog==this) 01396 { 01397 if (Create()) 01398 Open(); 01399 else 01400 End(); 01401 } 01402 else 01403 { 01404 TheDialog->Open(); 01405 TheDialog->BringToTop(); 01406 01407 End(); // Kill ourself 01408 } 01409 }
|
|
Performs the BarCreationDlg operation.
Reimplemented from Operation. Definition at line 1459 of file barcreationdlg.cpp. 01460 { 01461 m_BarName = ((OpParamBarStatesDlg *)pParam)->m_BarName; 01462 01463 if (TheDialog==NULL || TheDialog==this) 01464 { 01465 if (Create()) 01466 Open(); 01467 else 01468 End(); 01469 } 01470 else 01471 { 01472 TheDialog->Open(); 01473 TheDialog->BringToTop(); 01474 01475 TheDialog->m_BarName = ((OpParamBarStatesDlg *)pParam)->m_BarName; 01476 01477 TheDialog->ScanForBarDetails(); // we may be looking at a different bar now 01478 TheDialog->SetUpControls(); 01479 01480 End(); // Kill ourself 01481 } 01482 }
|
|
Returns the OpState of the dialogue operation.
Definition at line 1323 of file barcreationdlg.cpp. 01324 { 01325 OpState OpSt; 01326 01327 // if we don't allow it 01328 OpSt.Greyed = TRUE; 01329 Spread* pSpread = Document::GetSelectedSpread(); 01330 if (pSpread && !pSpread->FindActiveLayer()->IsFrame()) 01331 OpSt.Greyed = FALSE; 01332 01333 // Tick the menu while the editor is open 01334 if (TheDialog != NULL) 01335 OpSt.Ticked = TRUE; 01336 01337 return(OpSt); 01338 }
|
|
Creates an OpDescriptor for a HotLink Dialog and declares some preferences.
Reimplemented from SimpleCCObject. Definition at line 1353 of file barcreationdlg.cpp. 01354 { 01355 return (RegisterOpDescriptor(0, // Tool ID 01356 _R(IDS_CREATE_STATES), // String resource ID 01357 CC_RUNTIME_CLASS(BarStatesDlg), // Runtime class 01358 OPTOKEN_BARSTATESDLG, // Token string 01359 BarStatesDlg::GetState, // GetState function 01360 _R(IDH_NavBar_Edit_States_Dialog_Box), // Help ID 01361 _R(IDBBL_STATES), // Bubble ID 01362 _R(IDD_BARCONTROLSTORE), // Resource ID 01363 _R(IDC_STATES), // Control ID 01364 SYSTEMBAR_UTILITIES, // Bar ID 01365 TRUE, // Recieve system messages 01366 FALSE, // Smart duplicate operation 01367 TRUE, // Clean operation 01368 0, // No vertical counterpart 01369 NULL, 01370 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC), 01371 TRUE 01372 )); 01373 01374 }
|
|
This is the message handler for the BarStatesDlg. It simply takes the message and redirects it to one of our Message Handler functions.
Reimplemented from DialogOp. Definition at line 1159 of file barcreationdlg.cpp. 01160 { 01161 BOOL fEndDialog=FALSE; 01162 01163 //If the message is a dialog message 01164 if (IS_OUR_DIALOG_MSG(Message)) 01165 { 01166 //Then work out what it says 01167 DialogMsg* pDialogMsg = ((DialogMsg*) Message); 01168 01169 switch (pDialogMsg->DlgMsg) 01170 { 01171 case DIM_CREATE: 01172 SetStringGadgetValue(_R(IDC_MUTATE_COLOURS), _R(IDS_STATE_COPY), FALSE, 0); 01173 SetStringGadgetValue(_R(IDC_MUTATE_COLOURS), _R(IDS_STATE_DISTINCT), TRUE, 1); 01174 ScanForBarDetails(); 01175 SetUpControls(); 01176 // throw the keyboard focus 01177 //DialogManager::DefaultKeyboardFocus(); 01178 break; 01179 01180 // these two messages are used to throw the focus back to the main window 01181 case DIM_TITLEFOCUSWARN: 01182 //DialogManager::DefaultKeyboardFocus(); 01183 break; 01184 01185 // focus throw 01186 case DIM_LFT_BN_UP: 01187 //DialogManager::DefaultKeyboardFocus(); 01188 break; 01189 01190 case DIM_CANCEL: 01191 fEndDialog = TRUE; 01192 break; 01193 01194 // manage button controls 01195 case DIM_LFT_BN_CLICKED: 01196 switch(pDialogMsg->GadgetID) 01197 { 01198 case _R(IDC_MOUSE_OFF): 01199 m_State = 0; 01200 SetUpControls(); 01201 //DialogManager::DefaultKeyboardFocus(); // throws focus 01202 break; 01203 case _R(IDC_MOUSE_OVER): 01204 m_State = 1; 01205 SetUpControls(); 01206 //DialogManager::DefaultKeyboardFocus(); // throws focus 01207 break; 01208 case _R(IDC_CLICKED): 01209 m_State = 2; 01210 SetUpControls(); 01211 //DialogManager::DefaultKeyboardFocus(); // throws focus 01212 break; 01213 case _R(IDC_SELECTED): 01214 m_State = 3; 01215 SetUpControls(); 01216 //DialogManager::DefaultKeyboardFocus(); // throws focus 01217 break; 01218 //case _R(IDC_BACK_BAR): 01219 // m_State = 4; 01220 // SetUpControls(); 01221 // break; 01222 01223 case _R(IDC_CREATE_STATE): 01224 // create the state 01225 CreateBarStates(m_StateExists[m_State]); 01226 ScanForBarDetails(); 01227 SetUpControls(); 01228 //DialogManager::DefaultKeyboardFocus(); // throws focus 01229 break; 01230 01231 case _R(IDC_DELETE_STATE): 01232 { 01233 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_DELBAROP); 01234 01235 if (pOpDesc && m_State > 0) // dont allow this to delete the MouseOff State! 01236 { 01237 OpParamDelBar ParamDelBar(m_BarName, m_State); 01238 pOpDesc->Invoke(&ParamDelBar); 01239 01240 ScanForBarDetails(); 01241 SetUpControls(); 01242 } 01243 else if (pOpDesc) 01244 { 01245 if (AskQuestion(_R(IDS_DEL_WHOLE_BAR), _R(IDS_YES), _R(IDS_NO)) == 1) 01246 { 01247 OpParamDelBar ParamDelBar(m_BarName, 5 /* all states */); 01248 pOpDesc->Invoke(&ParamDelBar); 01249 01250 // if the bar has been removed close this dlg 01251 fEndDialog = TRUE; 01252 } 01253 } 01254 } 01255 //DialogManager::DefaultKeyboardFocus(); // throws focus 01256 break; 01257 } 01258 break; 01259 01260 //NB: This means someone has altered the combo box. It doesn't mean 01261 //the selection has changed! 01262 case DIM_SELECTION_CHANGED: 01263 switch(pDialogMsg->GadgetID) 01264 { 01265 // changed the direction of the bar 01266 case _R(IDC_MUTATE_COLOURS): 01267 ms_SuggestDesign = GetSelectedValueIndex(_R(IDC_MUTATE_COLOURS));; 01268 break; 01269 } 01270 break; 01271 01272 } 01273 } 01274 // for whenever someone announces that they have changed the selection. 01275 else if (MESSAGE_IS_A(Message, SelChangingMsg)) 01276 { 01277 SelChangingMsg* pSelChange = (SelChangingMsg*)Message; 01278 01279 if (pSelChange->State == SelChangingMsg::SelectionState::SELECTIONCHANGED || 01280 pSelChange->State == SelChangingMsg::SelectionState::NONCOLOURATTCHANGED) 01281 OnSelectionChanged(); 01282 } 01283 // If we've changed to a different document then get rid of the dlg. 01284 else if (MESSAGE_IS_A(Message, DocChangingMsg)) 01285 { 01286 DocChangingMsg* TheMsg = (DocChangingMsg*) Message; 01287 if (TheMsg->State == DocChangingMsg::BORN || TheMsg->State == DocChangingMsg::SELCHANGED) 01288 Close(); 01289 } 01290 else if (MESSAGE_IS_A(Message, OpMsg)) 01291 { 01292 if (((OpMsg *)Message)->MsgType == OpMsg::AFTER_UNDO || 01293 ((OpMsg *)Message)->MsgType == OpMsg::AFTER_REDO || 01294 IS_A( ((OpMsg *)Message)->pOp, OpDelete) ) 01295 { 01296 ScanForBarDetails(); 01297 SetUpControls(); 01298 OnSelectionChanged(); 01299 } 01300 } 01301 01302 if (fEndDialog) 01303 { 01304 // close the dlg 01305 Close(); 01306 End(); 01307 } 01308 01309 01310 return DialogOp::Message(Message); 01311 }
|
|
Definition at line 1690 of file barcreationdlg.cpp. 01691 { 01692 // show the current layer in the dlg 01693 String_256 LayerName = ""; 01694 Spread* pSpread = Document::GetSelectedSpread(); 01695 if (pSpread == NULL) 01696 return FALSE; 01697 01698 SelRange * pSelection = GetApplication()->FindSelection(); 01699 01700 // scan the selection has the bar name changed? 01701 01702 String_256 TempBarName = ""; 01703 01704 Node * pCurrent = pSelection->FindFirst(); 01705 TemplateAttribute * pTemplAttrib = NULL; 01706 Node * pTempNode = NULL; 01707 01708 BOOL HasASelection = pCurrent != NULL; 01709 01710 while (pCurrent && TempBarName.IsEmpty()) 01711 { 01712 // look at the bar name on the attrib 01713 pTemplAttrib = (TemplateAttribute *) SliceHelper::FindNextOfClass(pCurrent, pCurrent, CC_RUNTIME_CLASS(TemplateAttribute)); 01714 while (pTemplAttrib && TempBarName.IsEmpty()) 01715 { 01716 TempBarName = SliceHelper::GetBarName(pTemplAttrib); 01717 pTemplAttrib = (TemplateAttribute *) SliceHelper::FindNextOfClass(pTemplAttrib, pCurrent, CC_RUNTIME_CLASS(TemplateAttribute)); 01718 } 01719 01720 pCurrent = pSelection->FindNext(pCurrent); 01721 } 01722 01723 // something is selected but that doesn't have a bar name 01724 if (HasASelection && TempBarName.IsEmpty()) 01725 { 01726 // does the selection intersect with any known bars? 01727 SliceHelper::BarNameInRect(pSelection->GetBoundingRect(), &TempBarName); 01728 } 01729 01730 if (HasASelection && TempBarName.IsEmpty() && m_ValidBar) 01731 { 01732 m_ValidBar = FALSE; 01733 01734 EnableGadget(_R(IDC_CREATE_STATE), FALSE); 01735 EnableGadget(_R(IDC_MUTATE_COLOURS), FALSE); 01736 EnableGadget(_R(IDC_DELETE_STATE), FALSE); 01737 01738 ScanForBarDetails(); 01739 } 01740 else 01741 if (!m_ValidBar && !TempBarName.IsEmpty()) 01742 { 01743 m_ValidBar = TRUE; 01744 01745 EnableGadget(_R(IDC_CREATE_STATE), TRUE); 01746 EnableGadget(_R(IDC_MUTATE_COLOURS), TRUE); 01747 EnableGadget(_R(IDC_DELETE_STATE), TRUE); 01748 01749 m_BarName = ""; 01750 } 01751 01752 if (TempBarName.CompareTo(m_BarName) != 0 && !TempBarName.IsEmpty()) 01753 { 01754 // found a new bar, reset the dlg 01755 m_BarName = TempBarName; 01756 ScanForBarDetails(); 01757 SetUpControls(); 01758 } 01759 01760 return TRUE; 01761 }
|
|
Scans the tree to fill in the variables passed to it Params: NoOfButtons-How many buttons there are in the bar.
Definition at line 1496 of file barcreationdlg.cpp. 01497 { 01498 // find me the buttons in this bar 01499 String_256 templayer; 01500 01501 // build up a list of the buttons in the bar 01502 // so that we can shift them along 01503 // it must be better to use a list than keep on 01504 // scanning each time 01505 01506 Layer * pLayer = NULL; 01507 01508 List BarList; 01509 01510 templayer.Load(_R(IDS_ROLLOVER_DEFAULT)); 01511 pLayer = SliceHelper::FindLayerCalled(templayer); 01512 if (pLayer) 01513 SliceHelper::BuildListOfNodesInBar(&BarList, pLayer, m_BarName); 01514 DWORD BarElements = BarList.GetCount(); 01515 DWORD NextElements = BarElements; 01516 if (BarElements > 0) 01517 m_StateExists[0] = TRUE; 01518 else 01519 m_StateExists[0] = FALSE; 01520 01521 templayer.Load(_R(IDS_ROLLOVER_MOUSE)); 01522 pLayer = SliceHelper::FindLayerCalled(templayer); 01523 if (pLayer) 01524 SliceHelper::BuildListOfNodesInBar(&BarList, pLayer, m_BarName); 01525 NextElements = BarList.GetCount(); 01526 if (NextElements > BarElements) 01527 { 01528 BarElements = NextElements; 01529 m_StateExists[1] = TRUE; 01530 } 01531 else 01532 m_StateExists[1] = FALSE; 01533 01534 templayer.Load(_R(IDS_ROLLOVER_CLICKED)); 01535 pLayer = SliceHelper::FindLayerCalled(templayer); 01536 if (pLayer) 01537 SliceHelper::BuildListOfNodesInBar(&BarList, pLayer, m_BarName); 01538 NextElements = BarList.GetCount(); 01539 if (NextElements > BarElements) 01540 { 01541 BarElements = NextElements; 01542 m_StateExists[2] = TRUE; 01543 } 01544 else 01545 m_StateExists[2] = FALSE; 01546 01547 templayer.Load(_R(IDS_ROLLOVER_SELECTED)); 01548 pLayer = SliceHelper::FindLayerCalled(templayer); 01549 if (pLayer) 01550 SliceHelper::BuildListOfNodesInBar(&BarList, pLayer, m_BarName); 01551 NextElements = BarList.GetCount(); 01552 if (NextElements > BarElements) 01553 { 01554 BarElements = NextElements; 01555 m_StateExists[3] = TRUE; 01556 } 01557 else 01558 m_StateExists[3] = FALSE; 01559 01560 01561 // need to do a scan to see if the bar has a back bar or not 01562 templayer.Load(_R(IDS_BACK_BAR)); 01563 pLayer = SliceHelper::FindLayerCalled(templayer); 01564 m_StateExists[4] = FALSE; 01565 if (pLayer) 01566 { 01567 Node * pTemplAttrib = SliceHelper::FindNextOfClass(pLayer, pLayer, CC_RUNTIME_CLASS(TemplateAttribute)); 01568 while (pTemplAttrib) 01569 { 01570 if (m_BarName == SliceHelper::GetBarName((TemplateAttribute *)pTemplAttrib)) 01571 { 01572 m_StateExists[4] = TRUE; 01573 break; 01574 } 01575 pTemplAttrib = SliceHelper::FindNextOfClass(pTemplAttrib, pLayer, CC_RUNTIME_CLASS(TemplateAttribute)); 01576 } 01577 } 01578 01579 NodeListItem *pNodeListItem = NULL; 01580 NodeListItem *pDelThisToo = NULL; 01581 01582 // tidy up the list 01583 pNodeListItem = (NodeListItem *)BarList.GetHead(); 01584 01585 while(pNodeListItem) 01586 { 01587 pDelThisToo = pNodeListItem; 01588 01589 pNodeListItem = (NodeListItem *)BarList.GetNext(pNodeListItem); 01590 01591 // tidy up the list as we go along 01592 BarList.RemoveItem((NodeListItem *)pDelThisToo); 01593 delete pDelThisToo; 01594 } 01595 01596 // if we have done this scan we are looking at a new bar 01597 // set the bar name in the title 01598 String_256 Title; 01599 Title.Load(_R(IDS_BAR_STATES_TITLE)); 01600 if (m_ValidBar) 01601 Title += m_BarName; 01602 else 01603 { 01604 String_256 temp(_R(IDS_NO_VALID_BAR)); 01605 Title += temp; 01606 } 01607 01608 SetTitlebarName(&Title); 01609 01610 return TRUE; 01611 }
|
|
Definition at line 1615 of file barcreationdlg.cpp. 01616 { 01617 SetLongGadgetValue(_R(IDC_MOUSE_OFF), m_State == 0); 01618 SetLongGadgetValue(_R(IDC_MOUSE_OVER), m_State == 1); 01619 SetLongGadgetValue(_R(IDC_CLICKED), m_State == 2); 01620 SetLongGadgetValue(_R(IDC_SELECTED), m_State == 3); 01621 //SetLongGadgetValue(_R(IDC_BACK_BAR), m_State == 4); 01622 01623 HideGadget(_R(IDC_MOUSE_OFF_EXISTS), !m_StateExists[0]); 01624 HideGadget(_R(IDC_MOUSE_OVER_EXISTS), !m_StateExists[1]); 01625 HideGadget(_R(IDC_CLICKED_EXISTS), !m_StateExists[2]); 01626 HideGadget(_R(IDC_SELECTED_EXISTS), !m_StateExists[3]); 01627 //HideGadget(_R(IDC_BACK_BAR_EXISTS), !m_StateExists[4]); 01628 01629 EnableGadget(_R(IDC_DELETE_STATE), m_StateExists[m_State]); 01630 01631 if (m_StateExists[m_State]) 01632 SetStringGadgetValue(_R(IDC_CREATE_STATE), _R(IDS_RECREATE)); 01633 else 01634 SetStringGadgetValue(_R(IDC_CREATE_STATE), _R(IDS_CREATE_BUTTON_TEXT)); 01635 01636 SetSelectedValueIndex(_R(IDC_MUTATE_COLOURS), ms_SuggestDesign); 01637 HideGadget(_R(IDC_MUTATE_COLOURS), m_State == 4); 01638 01639 if (m_State == 4) 01640 SetStringGadgetValue(_R(IDC_SOURCE_TEXT), _R(IDS_FROM_SELECTION)); 01641 else 01642 SetStringGadgetValue(_R(IDC_SOURCE_TEXT), _R(IDS_FROM_MOUSE_OFF)); 01643 }
|
|
Definition at line 260 of file barcreationdlg.h. |
|
Definition at line 253 of file barcreationdlg.h. |
|
Definition at line 254 of file barcreationdlg.h. |
|
Definition at line 256 of file barcreationdlg.h. |
|
Definition at line 257 of file barcreationdlg.h. |
|
Definition at line 261 of file barcreationdlg.h. |
|
Definition at line 255 of file barcreationdlg.h. |
|
Definition at line 252 of file barcreationdlg.h. |