#include <extendsetsdlg.h>
Inheritance diagram for ExtendSetsDlg:
Public Member Functions | |
ExtendSetsDlg () | |
Constructor. | |
~ExtendSetsDlg () | |
Destructor. | |
void | Do (OpDescriptor *) |
This function should not be called - DoWithParam should be used instead. | |
void | DoWithParam (OpDescriptor *pOp, OpParam *pParam) |
Opens or dismisses the ExtendSetsDlg. | |
virtual MsgResult | Message (Msg *Message) |
Message handler for the ExtendSetsDlg. | |
Static Public Member Functions | |
static BOOL | Init () |
Create an OpDescriptor for the ExtendSetsDlg. May also declare ExtendSetsDlg preferences, although it does not at present. TODO: I don't know what half of the parameters below do, so this needs to be investigated! | |
static OpState | GetState (String_256 *, OpDescriptor *) |
Returns the OpState of this dialog operation. | |
Static Public Attributes | |
static const UINT32 | IDD = _R(IDD_EXTENDSETSDLG) |
static const CDlgMode | Mode = MODAL |
Protected Member Functions | |
BOOL | Create () |
Create an ExtendSetsDlg dialog box. See also: DialogOp::Create. | |
BOOL | SetUpControls () |
Initialise the dialog's set of controls. | |
BOOL | FillCheckListBox () |
Fill our check-list box with a list of all named sets currently in the document. We disable the item for the named set which is doing the extending, and if there are no named sets then we put a message saying so into the list box. | |
void | GenerateListOfSets () |
Regenerates our list of ticked named sets. | |
Protected Attributes | |
BYTE * | m_bArrayExtendFlags |
SGNameItem * | m_pDefineExtendSet |
BOOL * | m_pbCommit |
BYTE * | m_pfExtendFlags |
CTextCheckListBox | m_tclbExtendingSets |
Static Protected Attributes | |
static ExtendSetsDlg * | TheDialog = NULL |
static const INT32 | EXTEND_BEHAVIOUR_NONE = 0 |
static const INT32 | EXTEND_BEHAVIOUR_EXTEND = 1 |
static const INT32 | EXTEND_BEHAVIOUR_STRETCH = 2 |
Private Member Functions | |
CC_DECLARE_DYNCREATE (ExtendSetsDlg) |
Definition at line 128 of file extendsetsdlg.h.
|
Constructor.
Definition at line 143 of file extendsetsdlg.cpp. 00143 : DialogOp(ExtendSetsDlg::IDD, ExtendSetsDlg::Mode) 00144 { 00145 // initialise our public static pointer to ourself. 00146 if (TheDialog == NULL) 00147 TheDialog = this; 00148 00149 // initialise our member variables. 00150 m_bArrayExtendFlags = NULL; 00151 m_pDefineExtendSet = NULL; 00152 m_pbCommit = NULL; 00153 m_pfExtendFlags = NULL; 00154 }
|
|
Destructor.
Definition at line 166 of file extendsetsdlg.cpp. 00167 { 00168 // the public static pointer must no longer point to us. 00169 if (TheDialog == this) 00170 TheDialog = NULL; 00171 00172 // set all our data pointers to NULL, just to clear up. 00173 m_bArrayExtendFlags = NULL; 00174 m_pDefineExtendSet = NULL; 00175 m_pbCommit = NULL; 00176 m_pfExtendFlags = NULL; 00177 }
|
|
|
|
Create an ExtendSetsDlg dialog box. See also: DialogOp::Create.
Reimplemented from DialogOp. Definition at line 394 of file extendsetsdlg.cpp. 00395 { 00396 // perform any custom initialisation. 00397 00398 // only allow one instance of this dialog. 00399 if (TheDialog != this) 00400 return FALSE; 00401 00402 // call the base class implementation, to actually create the dialog. 00403 return DialogOp::Create(); 00404 }
|
|
This function should not be called - DoWithParam should be used instead.
Reimplemented from Operation. Definition at line 335 of file extendsetsdlg.cpp. 00336 { 00337 ERROR3("ExtendSetsDlg::Do- this function should not be called - use DoWithParam instead."); 00338 }
|
|
Opens or dismisses the ExtendSetsDlg.
Reimplemented from Operation. Definition at line 355 of file extendsetsdlg.cpp. 00356 { 00357 // use pParam to initialise any internal member variables, eg: 00358 m_bArrayExtendFlags = ((OpParamExtendSetsDlg*)pParam)->m_bArrayExtendFlags; 00359 m_pDefineExtendSet = ((OpParamExtendSetsDlg*)pParam)->m_pDefineExtendSet; 00360 m_pbCommit = ((OpParamExtendSetsDlg*)pParam)->m_pbCommit; 00361 m_pfExtendFlags = ((OpParamExtendSetsDlg*)pParam)->m_pfExtendFlags; 00362 00363 // validate input parameters. 00364 if (m_bArrayExtendFlags == NULL || m_pDefineExtendSet == NULL || 00365 m_pbCommit == NULL || m_pfExtendFlags == NULL) 00366 { 00367 ERROR2RAW("ExtendSetsDlg::DoWithParam- one or more parameters was NULL!"); 00368 End(); 00369 return; 00370 } 00371 00372 // attempt to create a new dialog. 00373 if ( !Create() ) 00374 { 00375 // if we couldn't create the dialog, tell the user and end the operation. 00376 InformError(); 00377 End(); 00378 } 00379 }
|
|
Fill our check-list box with a list of all named sets currently in the document. We disable the item for the named set which is doing the extending, and if there are no named sets then we put a message saying so into the list box.
Definition at line 493 of file extendsetsdlg.cpp. 00494 { 00495 // iterate over all names used within the document. 00496 NameGallery* pNameGallery = NameGallery::Instance(); 00497 if (!pNameGallery) 00498 return TRUE; 00499 SGUsedNames* pNames = pNameGallery->GetUsedNames(); 00500 SGNameItem* pItem = (SGNameItem*) pNames->GetChild(); 00501 00502 // if there are no named sets then add a disabled item to tell the user that there are 00503 // no named sets (this should never happen, as we have to be called with a set to extend) 00504 INT32 nIndex; 00505 String_256 strName; 00506 strName.Empty(); 00507 if (pItem == NULL) 00508 { 00509 strName.Load(_R(IDS_ES_NO_NAMED_SETS)); 00510 nIndex = m_tclbExtendingSets.AddString((TCHAR*)strName); 00511 m_tclbExtendingSets.Enable(nIndex, FALSE); 00512 } 00513 00514 // ...otherwise, fill the check-list with all named sets. 00515 nIndex = 0; 00516 for (; pItem != NULL; pItem = (SGNameItem*) pItem->GetNext()) 00517 { 00518 // Don't show the target item - it's redundant, illogical and confusing. 00519 if (pItem == m_pDefineExtendSet) continue; 00520 00521 // add a ptr to the SGNameItem and also add its text to the checklistbox. 00522 pItem->GetNameText(&strName); 00523 nIndex = m_tclbExtendingSets.AddString((TCHAR*)strName); 00524 m_tclbExtendingSets.SetItemDataPtr(nIndex, pItem); 00525 m_tclbExtendingSets.SetCheck(nIndex, m_bArrayExtendFlags[nIndex]); 00526 } 00527 00528 return TRUE; 00529 }
|
|
Regenerates our list of ticked named sets.
Definition at line 546 of file extendsetsdlg.cpp. 00547 { 00548 // go through each item in our checklist box and set a corresponding flag in our byte 00549 // array of flags, depending on its checked (also enabled? and/or visible?) status. 00550 INT32 nCount = m_tclbExtendingSets.GetCount(); 00551 for (INT32 i = 0; i < nCount; i ++) 00552 { 00553 if (m_tclbExtendingSets.GetCheck(i) == 1) 00554 m_bArrayExtendFlags[i] = 1; 00555 else 00556 m_bArrayExtendFlags[i] = 0; 00557 } 00558 00559 // set the contents of our pointer to the extend behaviour flag. 00560 BYTE fExtend = 0; 00561 switch (GetSelectedValueIndex(_R(IDC_ES_COMBO_XBEHAVIOUR))) // x-axis behaviour 00562 { 00563 case (ExtendSetsDlg::EXTEND_BEHAVIOUR_EXTEND): 00564 fExtend |= X_EXTEND; 00565 break; 00566 00567 case EXTEND_BEHAVIOUR_STRETCH: 00568 fExtend |= X_STRETCH; 00569 break; 00570 00571 case EXTEND_BEHAVIOUR_NONE: 00572 default: 00573 // we do nothing if the index is set to none, or if we get an invalid value. 00574 break; 00575 } 00576 00577 switch (GetSelectedValueIndex(_R(IDC_ES_COMBO_YBEHAVIOUR))) // y-axis behaviour 00578 { 00579 case EXTEND_BEHAVIOUR_EXTEND: 00580 fExtend |= Y_EXTEND; 00581 break; 00582 00583 case EXTEND_BEHAVIOUR_STRETCH: 00584 fExtend |= Y_STRETCH; 00585 break; 00586 00587 case EXTEND_BEHAVIOUR_NONE: 00588 default: 00589 // we do nothing if the index is set to none, or if we get an invalid value. 00590 break; 00591 } 00592 00593 *m_pfExtendFlags = fExtend; 00594 }
|
|
Returns the OpState of this dialog operation.
Definition at line 249 of file extendsetsdlg.cpp. 00250 { 00251 OpState OpSt; 00252 00253 // set the enabled state of any buttons/menus which work with this dialog. 00254 if (TheDialog != NULL) 00255 OpSt.Ticked = TRUE; 00256 00257 return OpSt; 00258 }
|
|
Create an OpDescriptor for the ExtendSetsDlg. May also declare ExtendSetsDlg preferences, although it does not at present. TODO: I don't know what half of the parameters below do, so this needs to be investigated!
UINT32 toolID, // module ID, 0 if not in tool UINT32 txID, // UI descriptions of op CCRuntimeClass* Op, // pointer to the Op's runtime class TCHAR* tok, // pointer to the OPTOKEN string pfnGetState gs, // pointer to the UI GetState function UINT32 helpId = 0, // assoc. help system identifier UINT32 bubbleID = 0, // string resource for bubble help UINT32 resourceID = 0, // bitmap ("icon") or resource ID UINT32 controlID =0, // assoc. gadget control ID BOOL ReceiveMessages = FALSE, // send this OpDescriptor kernel Msgs BOOL Smart = FALSE, // op does smart attr optimisation BOOL Clean = TRUE, // op doesn't modify document UINT32 OneOpenInstID = 0, // When not 0 only one live instance of the operation is permitted, and OneOpenInstID is the string resource ID describing why.This will be useful for single instance only dialogs. UINT32 AutoStateFlags = 0 // Flags which indicate conditions when the operation should automatically be greyed/ticked etc..(This cuts down the number of tests that need to be made in the GetState function). Reimplemented from SimpleCCObject. Definition at line 302 of file extendsetsdlg.cpp. 00303 { 00304 return (RegisterOpDescriptor(0, // Tool ID 00305 _R(IDS_EXTENDSETS), // String resource ID 00306 CC_RUNTIME_CLASS(ExtendSetsDlg),// Runtime class 00307 OPTOKEN_EXTENDSETSDLG, // Token string 00308 ExtendSetsDlg::GetState, // GetState function 00309 0, // Help ID 00310 _R(IDBBL_EXTENDSETS), // Bubble ID 00311 0, // Resource ID 00312 0, // Control ID 00313 SYSTEMBAR_ILLEGAL, // Bar ID 00314 TRUE, // Receive system messages 00315 FALSE, // Smart duplicate operation 00316 TRUE, // Clean operation 00317 0, // No vertical counterpart 00318 NULL, 00319 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) 00320 )); 00321 }
|
|
Message handler for the ExtendSetsDlg.
Reimplemented from DialogOp. Definition at line 191 of file extendsetsdlg.cpp. 00192 { 00193 BOOL bEndDialog = FALSE; 00194 00195 // only process messages _intended_ for this or all dialogs. 00196 if (IS_OUR_DIALOG_MSG(Message)) 00197 { 00198 DialogMsg* pDialogMsg = (DialogMsg*)Message; 00199 00200 switch (pDialogMsg->DlgMsg) 00201 { 00202 // sent when we must initialise the dialog, after it has been created. 00203 case DIM_CREATE: 00204 SetUpControls(); 00205 break; 00206 00207 // sent to dismiss and cancel the dialog. 00208 // CANCEL was chosen, so note that our list of named sets is now invalid. 00209 case DIM_CANCEL: 00210 *m_pbCommit = FALSE; 00211 bEndDialog = TRUE; 00212 break; 00213 00214 // sent to dismiss and confirm the dialog. 00215 case DIM_COMMIT: 00216 *m_pbCommit = TRUE; 00217 GenerateListOfSets(); 00218 bEndDialog = TRUE; 00219 break; 00220 00221 // further message processing... 00222 default: 00223 break; 00224 } // end switch (pDialogMsg->DlgMsg) 00225 } 00226 00227 // if necessary, close the dialog. 00228 if (bEndDialog) 00229 { 00230 Close(); 00231 End(); 00232 } 00233 00234 return DialogOp::Message(Message); 00235 }
|
|
Initialise the dialog's set of controls.
Definition at line 417 of file extendsetsdlg.cpp. 00418 { 00419 // initialise controls here. 00420 00421 // get the name of the set we are editing. 00422 String_256 strName; 00423 if (m_pDefineExtendSet != NULL) 00424 m_pDefineExtendSet->GetNameText(&strName); 00425 else 00426 strName = "TestName"; // this should never happen, but just in case... 00427 00428 // set the dialog's title text. 00429 String_256 strPrompt; 00430 strPrompt.MakeMsg(_R(IDS_ES_EXTENDTITLE), &strName); 00431 SetTitlebarName(&strPrompt); 00432 00433 // set the text of the 'extended-by' prompt 00434 strPrompt.MakeMsg(_R(IDS_ES_EXTENDEDBY), &strName); 00435 SetStringGadgetValue(_R(IDC_ES_EXTENDEDBY), &strPrompt); 00436 00437 // set the text of the 'extend-type' prompt 00438 strPrompt.MakeMsg(_R(IDS_ES_EXTENDTYPE), &strName); 00439 SetStringGadgetValue(_R(IDC_ES_EXTENDTYPE), &strPrompt); 00440 00441 // set the text of the horizontal and vertical prompts 00442 SetStringGadgetValue(_R(IDC_ES_VERTICAL), _R(IDS_ES_VERTICAL)); 00443 SetStringGadgetValue(_R(IDC_ES_HORIZONTAL), _R(IDS_ES_HORIZONTAL)); 00444 00445 // add 'None', 'Extend' and 'Stretch' values to our two combo-boxes, and initialise them. 00446 INT32 selIndex = 0; 00447 SetStringGadgetValue(_R(IDC_ES_COMBO_XBEHAVIOUR), _R(IDS_ES_BEHAVIOUR_NONE), FALSE, EXTEND_BEHAVIOUR_NONE); 00448 SetStringGadgetValue(_R(IDC_ES_COMBO_XBEHAVIOUR), _R(IDS_ES_BEHAVIOUR_EXTEND), FALSE, EXTEND_BEHAVIOUR_EXTEND); 00449 SetStringGadgetValue(_R(IDC_ES_COMBO_XBEHAVIOUR), _R(IDS_ES_BEHAVIOUR_STRETCH), TRUE, EXTEND_BEHAVIOUR_STRETCH); 00450 00451 selIndex = (*m_pfExtendFlags & X_EXTEND) ? EXTEND_BEHAVIOUR_EXTEND : 00452 (*m_pfExtendFlags & X_STRETCH) ? EXTEND_BEHAVIOUR_STRETCH : 00453 EXTEND_BEHAVIOUR_NONE; 00454 SetSelectedValueIndex(_R(IDC_ES_COMBO_XBEHAVIOUR), selIndex); 00455 SetComboListLength(_R(IDC_ES_COMBO_XBEHAVIOUR)); 00456 00457 SetStringGadgetValue(_R(IDC_ES_COMBO_YBEHAVIOUR), _R(IDS_ES_BEHAVIOUR_NONE), FALSE, EXTEND_BEHAVIOUR_NONE); 00458 SetStringGadgetValue(_R(IDC_ES_COMBO_YBEHAVIOUR), _R(IDS_ES_BEHAVIOUR_EXTEND), FALSE, EXTEND_BEHAVIOUR_EXTEND); 00459 SetStringGadgetValue(_R(IDC_ES_COMBO_YBEHAVIOUR), _R(IDS_ES_BEHAVIOUR_STRETCH), TRUE, EXTEND_BEHAVIOUR_STRETCH); 00460 00461 selIndex = (*m_pfExtendFlags & Y_EXTEND) ? EXTEND_BEHAVIOUR_EXTEND : 00462 (*m_pfExtendFlags & Y_STRETCH) ? EXTEND_BEHAVIOUR_STRETCH : 00463 EXTEND_BEHAVIOUR_NONE; 00464 SetSelectedValueIndex(_R(IDC_ES_COMBO_YBEHAVIOUR), selIndex); 00465 SetComboListLength(_R(IDC_ES_COMBO_YBEHAVIOUR)); 00466 00467 // ok, now add our ultra-funky check-list box to our dialog. 00468 BOOL ok = m_tclbExtendingSets.Create(WindowID, _R(IDC_ES_CHECKLIST)); 00469 if (ok) 00470 FillCheckListBox(); 00471 00472 return ok; 00473 }
|
|
Definition at line 192 of file extendsetsdlg.h. |
|
Definition at line 191 of file extendsetsdlg.h. |
|
Definition at line 193 of file extendsetsdlg.h. |
|
Definition at line 173 of file extendsetsdlg.h. |
|
Definition at line 182 of file extendsetsdlg.h. |
|
Definition at line 184 of file extendsetsdlg.h. |
|
Definition at line 183 of file extendsetsdlg.h. |
|
Definition at line 185 of file extendsetsdlg.h. |
|
Definition at line 188 of file extendsetsdlg.h. |
|
Definition at line 174 of file extendsetsdlg.h. |
|
Definition at line 179 of file extendsetsdlg.h. |