#include <appprefs.h>
Inheritance diagram for AppPrefsDlg:
Public Member Functions | |
AppPrefsDlg () | |
AppPrefsDlg constructor. Creates a non-undoable operation. | |
AppPrefsDlg (INT32 StartingPage) | |
AppPrefsDlg constructor which allows a starting page to be specified. Creates a non-undoable operation. | |
~AppPrefsDlg () | |
AppPrefsDlg destructor. | |
void | Do (OpDescriptor *) |
Creates then opens the dialog in response to a request from the user. | |
virtual MsgResult | Message (Msg *Message) |
Handles all the application preferences dialog's messages. | |
virtual BOOL | RegisterYourPagesInOrderPlease () |
This virtual function will get called to give you a chance to add pages to your DialogTabOp. This function will usually make multiple calls to AddAPage to register the initial set of pages to be contained in the tab dialog. The pages should all be the same size and be registered in the left to right order in which you wish them to appear. | |
BOOL | CommitDialogValues () |
Takes the values in the dialog box and sets the return values accordingly Called when ok is pressed on the dialog box. | |
BOOL | HasImages () |
TabType | GetTabType () |
Static Public Member Functions | |
static BOOL | Init () |
AppPrefsDlg Init method. Called when the kernel initialises. | |
static void | Deinit () |
AppPrefsDlg Deinit method. Called when the kernel deinitialises. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
AppPrefsDlg GetState method. | |
static BOOL | IsSaveOnExitSet () |
If TRUE, then the preference file Camelot.INI will be saved when the program exits. If FALSE, then no save will take place. Allows the state of the save preferences on exit flag to be read. | |
static BOOL | SetSaveOnExit (BOOL NewState) |
This allows the state of the Save on exit flag to be set to either TRUE or FALSE. | |
Static Public Attributes | |
static const CDlgResID | IDD = _R(IDD_APPLICATIONOPTIONS) |
static const CDlgMode | Mode = MODELESS |
static PageSizesList * | pPageSizesList = NULL |
Private Attributes | |
String_256 | TitleString |
Definition at line 139 of file appprefs.h.
|
AppPrefsDlg constructor. Creates a non-undoable operation.
Definition at line 303 of file appprefs.cpp. 00303 : DialogTabOp(AppPrefsDlg::IDD, AppPrefsDlg::Mode) 00304 { 00305 // At present, just:- 00306 OptionsTabs::SetApplyNowState(FALSE); // grey the apply now button 00307 OptionsTabs::SetInitMessageState(FALSE); // not sending an init message 00308 OptionsTabs::pScopeDocument = NULL; // Document in use when sending messages 00309 00310 // Set default units 00311 OptionsTabs::SetDefaultUnits(); // set up our default display units 00312 00313 // Document and spread we are supposed to be working on. Of course none at present. 00314 OptionsTabs::SetCurrentDocAndSpread(NULL); 00315 }
|
|
AppPrefsDlg constructor which allows a starting page to be specified. Creates a non-undoable operation.
Definition at line 334 of file appprefs.cpp. 00334 : DialogTabOp(AppPrefsDlg::IDD, AppPrefsDlg::Mode, 00335 CC_RUNTIME_CLASS(DialogOp), StartingPage) 00336 { 00337 // At present, just:- 00338 OptionsTabs::SetApplyNowState(FALSE); // grey the apply now button 00339 OptionsTabs::SetInitMessageState(FALSE); // not sending an init message 00340 OptionsTabs::pScopeDocument = NULL; // Document in use when sending messages 00341 00342 // Set default units 00343 OptionsTabs::SetDefaultUnits(); // set up our default display units 00344 00345 // Document and spread we are supposed to be working on. Of course none at present. 00346 OptionsTabs::SetCurrentDocAndSpread(NULL); 00347 }
|
|
AppPrefsDlg destructor.
Definition at line 365 of file appprefs.cpp. 00366 { 00367 // Make sure that we remove our options tabs link to the dialog box class 00368 // as the dialog will now be destroyed 00369 OptionsTabs::pPrefsDlg = NULL; 00370 }
|
|
Takes the values in the dialog box and sets the return values accordingly Called when ok is pressed on the dialog box.
Definition at line 388 of file appprefs.cpp. 00389 { 00390 // Ok has been pressed so take the values from the dialog box 00391 BOOL ok = TRUE; 00392 BOOL ValuesOk = TRUE; 00393 00394 // Make sure that we have set up our class variables so that the tabs know what 00395 // is the current document and spread to work on. 00396 Document *pDocument = Document::GetSelected(); 00397 OptionsTabs::SetCurrentDocAndSpread(pDocument); 00398 // Plus the current document units are correct 00399 OptionsTabs::SetUpDocUnits(); 00400 00401 // Go through all the tabs declared to the system in turn 00402 // and tell them to commit the values for their tab 00403 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00404 00405 while (pOptionsTabs != NULL) 00406 { 00407 // Only get the tab to commit if it is a program based option 00408 if ( pOptionsTabs->IsProgramOption() ) 00409 { 00410 // Get the found page to commit its values. 00411 // Should return False if reported error and we should just fail. 00412 // 2 if set an error which we should report and then fail. 00413 ok = pOptionsTabs->CommitSection(); 00414 if ( ok != TRUE) 00415 { 00416 if (ok == 2) 00417 InformError(); // If error required show it. 00418 00419 // Carry on with other pages so that report all errors and have a chance 00420 // to correct mistakes in other pages but make note of error state. 00421 ValuesOk = FALSE; 00422 } 00423 } 00424 // Get the next option's tab. 00425 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00426 } 00427 00428 // Return whether we found bad values or not. 00429 return ValuesOk; 00430 }
|
|
AppPrefsDlg Deinit method. Called when the kernel deinitialises.
Definition at line 1272 of file appprefs.cpp. 01273 { 01274 BOOL ok; 01275 01276 // Remove any options tabs that have been declared to the system. 01277 ok = OptionsTabs::DeinitOptionsTabs(); 01278 01279 // Remove the page sizes list that is currently attached to the applications options 01280 // dialog box for the present moment. 01281 if (pPageSizesList != NULL) 01282 { 01283 ok = pPageSizesList->DeinitPageSizes(); // delete all list items 01284 delete pPageSizesList; // delete list item object 01285 pPageSizesList = NULL; // set item pointer to null 01286 } 01287 }
|
|
Creates then opens the dialog in response to a request from the user.
Reimplemented from Operation. Definition at line 1306 of file appprefs.cpp. 01307 { 01308 BOOL ok; 01309 01310 //if (OptionsTabs::pPrefsDlg != NULL) 01311 //{ 01312 // ERROR3("AppPrefsDlg::Do an options tabbed dialog box is already present"); 01313 // return; 01314 //} 01315 01316 // Set up the name that the main dialog page is going to use 01317 String_256 Temp(_R(IDN_APPLICATIONOPTS)); 01318 TitleString = Temp; 01319 SetName(&TitleString); 01320 01321 // Make sure that our options tabs have a link to the dialog box class 01322 OptionsTabs::pPrefsDlg = this; 01323 OptionsTabs::SetApplyNowState(FALSE); 01324 01325 // Make sure that we have set up our class variables so that the tabs know what 01326 // is the current document and spread to work on. 01327 Document *pDocument = Document::GetSelected(); 01328 OptionsTabs::SetCurrentDocAndSpread(pDocument); 01329 // Work out the document name so that it is ready for options tabs to display. 01330 OptionsTabs::SetDocumentName(pDocument); 01331 01332 // Force the dialog box to be created, as it is non-modal it must be opened if the create 01333 // works ok. 01334 ok = Create(); // create the dialog box 01335 01336 if ( ok ) 01337 { 01338 // MarkH 29/6/99 - We need to physically walk through the tabs and initialize them as 01339 // the new MFC in VC6 dosn't do it for you!!! GIT!!!! 01340 // Now go through all the tabs declared to the system 01341 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 01342 01343 while (pOptionsTabs != NULL) 01344 { 01345 // Only Initialize the Section tab if it is a program based option 01346 if ( pOptionsTabs->IsProgramOption() ) 01347 { 01348 // Make sure we`re talking to the page! 01349 TalkToPage(pOptionsTabs->GetPageID()); 01350 pOptionsTabs->InitSection(); 01351 } 01352 01353 // Get the next option's tab. 01354 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 01355 } 01356 01357 // Modal at present so remove the Open() 01358 Open(); // created ok so open the dialog box up 01359 01360 // grey out the apply now button as this should only become enabled when we have 01361 // made a change to the dialog box. 01362 OptionsTabs::SetInitMessageState(FALSE); 01363 OptionsTabs::SetApplyNowState(FALSE); 01364 OptionsTabs::GreyApplyNow(); 01365 } 01366 else 01367 { 01368 // Could not create the dialog box so call inform error 01369 InformError(); // Show user the error 01370 End(); // End the operation 01371 } 01372 }
|
|
AppPrefsDlg GetState method.
Definition at line 1073 of file appprefs.cpp. 01074 { 01075 OpState OpSt; 01076 01077 // If the pointer is non-null then it implies that another dialog box is up which 01078 // uses our tab set and so we must force greying of the menu option 01079 if (OptionsTabs::pPrefsDlg != NULL) 01080 OpSt.Greyed=TRUE; 01081 01082 return(OpSt); 01083 }
|
|
Reimplemented from DialogTabOp. Definition at line 175 of file appprefs.h. 00175 {return TABTYPE_TREE/*TABTYPE_LIST*/;}
|
|
Reimplemented from DialogTabOp. Definition at line 174 of file appprefs.h. 00174 {return TRUE;}
|
|
AppPrefsDlg Init method. Called when the kernel initialises.
Reimplemented from SimpleCCObject. Definition at line 1103 of file appprefs.cpp. 01104 { 01105 BOOL InitOK = TRUE; 01106 01107 // Declare any preferences that we require. 01108 if ( Camelot.DeclareSection(TEXT("Preferences"), 3) ) 01109 { 01110 // section declared ok so now define the preference option 01111 Camelot.DeclarePref(TEXT("Preferences"), TEXT("SaveOnExit"), &SaveOnExit, 0, 1); 01112 } 01113 01114 // Now register ourselves with the dialog system 01115 InitOK = RegisterOpDescriptor( 01116 0, // Tool ID 01117 _R(IDS_UTILOPTIONS), // String resource ID 01118 CC_RUNTIME_CLASS(AppPrefsDlg), // Runtime class 01119 OPTOKEN_UTILOPTIONS, // Token string 01120 GetState, // GetState function 01121 0, // help ID 01122 _R(IDBBL_OPTIONSDLG), // bubble help 01123 _R(IDD_BARCONTROLSTORE), // resource ID 01124 _R(IDC_BTN_OPTIONSDLG), // control ID 01125 SYSTEMBAR_WINDOW, // Bar ID 01126 TRUE, // Recieve system messages 01127 FALSE, // Smart duplicate operation 01128 TRUE, // Clean operation 01129 0, // No vertical counterpart 01130 _R(IDS_APPPREFSDLG_ONE), // String for one copy only error 01131 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags 01132 ); 01133 01134 // Now register ourselves with the dialog system for the units button on the windows 01135 // button bar as well 01136 InitOK = InitOK && RegisterOpDescriptor( 01137 0, // Tool ID 01138 _R(IDS_UNITDLG), // String resource ID 01139 CC_RUNTIME_CLASS(UnitsTabAppPrefsDlg), // Runtime class 01140 OPTOKEN_UNITDLG, // Token string 01141 GetState, // GetState function 01142 0, // help ID 01143 _R(IDBBL_UNITDLG), // bubble help 01144 _R(IDD_BARCONTROLSTORE), // resource ID 01145 _R(IDC_BTN_UNITSETUPDLG), // control ID 01146 SYSTEMBAR_WINDOW, // Bar ID 01147 TRUE, // Receive messages 01148 FALSE, // Smart duplicate operation 01149 TRUE, // Clean operation 01150 NULL, // No vertical counterpart 01151 _R(IDS_UNIT_DLG_OPEN), // String for one copy only error 01152 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags ); 01153 ); 01154 01155 // Now register ourselves with the dialog system for the units button on the windows 01156 // button bar as well 01157 InitOK = InitOK && RegisterOpDescriptor( 01158 0, // Tool ID 01159 _R(IDS_SCALEDLG), // String resource ID 01160 CC_RUNTIME_CLASS(ScaleTabAppPrefsDlg), // Runtime class 01161 OPTOKEN_SCALEDLG, // Token string 01162 GetState, // GetState function 01163 0, // help ID 01164 _R(IDBBL_SCALEDLG), // bubble help 01165 _R(IDD_BARCONTROLSTORE), // resource ID 01166 _R(IDC_BTN_SCALEFACTORDLG), // control ID 01167 SYSTEMBAR_WINDOW, // Bar ID 01168 TRUE, // Receive messages 01169 FALSE, // Smart duplicate operation 01170 TRUE, // Clean operation 01171 NULL, // No vertical counterpart 01172 _R(IDS_SCALE_DLG_OPEN), // String for one copy only error 01173 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags ); 01174 ); 01175 01176 // Now register ourselves with the dialog system for somebody who wants to get to the page options tab 01177 InitOK = InitOK && RegisterOpDescriptor( 01178 0, // Tool ID 01179 _R(IDS_PAGESIZEDLG), // String resource ID 01180 CC_RUNTIME_CLASS(PageTabAppPrefsDlg), // Runtime class 01181 OPTOKEN_PAGESIZEDLG, // Token string 01182 GetState, // GetState function 01183 0, // help ID 01184 _R(IDBBL_PAGESIZEDLG), // bubble help 01185 _R(IDD_BARCONTROLSTORE), // resource ID 01186 _R(IDC_BTN_PAGESIZEDLG), // control ID 01187 SYSTEMBAR_WINDOW, // Bar ID 01188 TRUE, // Recieve system messages 01189 FALSE, // Smart duplicate operation 01190 TRUE, // Clean operation 01191 NULL, // No vertical counterpart 01192 _R(IDS_APPPREFSDLG_ONE), // String for one copy only error 01193 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags 01194 ); 01195 01196 // Now register ourselves with the dialog system for somebody who wants to get to the page options tab 01197 InitOK = InitOK && RegisterOpDescriptor( 01198 0, // Tool ID 01199 _R(IDS_GRIDANDRULERSDLG), // String resource ID 01200 CC_RUNTIME_CLASS(GridTabAppPrefsDlg), // Runtime class 01201 OPTOKEN_GRIDANDRULERSDLG, // Token string 01202 GetState, // GetState function 01203 0, // help ID 01204 _R(IDBBL_GRIDANDRULERSDLG), // bubble help 01205 0, //_R(IDD_BARCONTROLSTORE), // resource ID 01206 0, //_R(IDC_BTN_PAGESIZEDLG), // control ID 01207 SYSTEMBAR_WINDOW, // Bar ID 01208 TRUE, // Recieve system messages 01209 FALSE, // Smart duplicate operation 01210 TRUE, // Clean operation 01211 NULL, // No vertical counterpart 01212 _R(IDS_APPPREFSDLG_ONE), // String for one copy only error 01213 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags 01214 ); 01215 01216 // Now register ourselves with the dialog system for somebody who wants to get to the plug-ins tab 01217 InitOK = InitOK && RegisterOpDescriptor( 01218 0, // Tool ID 01219 _R(IDS_PLUGINS_PLUGINSMNGR), // String resource ID 01220 CC_RUNTIME_CLASS(PlugsTabAppPrefsDlg), // Runtime class 01221 OPTOKEN_PLUGSDLG, // Token string 01222 GetState, // GetState function 01223 0, // help ID 01224 0, // bubble help 01225 0, // resource ID 01226 _R(IDS_PLUGINS_PLUGINSMNGR), // control ID 01227 SYSTEMBAR_WINDOW, // Bar ID 01228 TRUE, // Recieve system messages 01229 FALSE, // Smart duplicate operation 01230 TRUE, // Clean operation 01231 NULL, // No vertical counterpart 01232 _R(IDS_APPPREFSDLG_ONE), // String for one copy only error 01233 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags 01234 ); 01235 01236 // Set up any options tabs that are required 01237 InitOK = InitOK && OptionsTabs::InitOptionsTabs(); 01238 01239 // Set up any page sizes that are required 01240 // Make the doc unit list 01241 pPageSizesList = new PageSizesList; 01242 InitOK = InitOK && (pPageSizesList != NULL && pPageSizesList->InitPageSizes()); 01243 01244 01245 // Set up our special print options dialog box as well as this is effectively the 01246 // same dialog box. 01247 // WEBSTER-ranbirr-13/11/96 01248 #ifndef WEBSTER 01249 InitOK = InitOK && PrintPrefsDlg::Init(); 01250 #endif //webster 01251 01252 01253 return (InitOK); 01254 }
|
|
If TRUE, then the preference file Camelot.INI will be saved when the program exits. If FALSE, then no save will take place. Allows the state of the save preferences on exit flag to be read.
Definition at line 250 of file appprefs.cpp. 00251 { 00252 if ( SaveOnExit == 0 ) 00253 return FALSE; 00254 else 00255 return TRUE; 00256 }
|
|
Handles all the application preferences dialog's messages.
EAT_MSG The Message was handled ok but don't send it to any more MessageHandlers.
Reimplemented from DialogTabOp. Definition at line 455 of file appprefs.cpp. 00456 { 00457 #ifndef STANDALONE 00458 00459 #ifndef REMOVE_PRINT_TABS 00460 // Jason - This is a message-loop lock which is used in the DIM_CREATE code to 00461 // allow the print marks manager cache print marks - this causes a lot of diocument 00462 // message broadcats and suchlike, which cause re-entrant messages to come in 00463 // here and trigger 3 billion ERROR3s. While caching the print marks, we lock this 00464 // message handler so that it just ignores all resultant broadcasts. 00465 static BOOL IgnoreAllMessages = FALSE; 00466 if (IgnoreAllMessages) 00467 return DialogTabOp::Message(Message); 00468 #endif 00469 00470 ERROR3IF(Message == NULL,"AppPrefsDlg::Message null message received"); 00471 00472 // Cope with document changing messages so that if all documents are closed then 00473 // we take some remedial action such as greying all controls. 00474 if (MESSAGE_IS_A(Message, DocChangingMsg)) 00475 { 00476 DocChangingMsg *TheMsg = (DocChangingMsg *) Message; 00477 00478 switch ( TheMsg->State ) 00479 { 00480 case DocChangingMsg::TITLECHANGED: 00481 case DocChangingMsg::SELCHANGED: 00482 { 00483 // In the different cases there are different document pointers that 00484 // we must use. 00485 Document *pDocument = NULL; 00486 if (TheMsg->State == DocChangingMsg::TITLECHANGED) 00487 { 00488 // Document title has changed message. 00489 pDocument = TheMsg->pChangingDoc; 00490 } 00491 else 00492 { 00493 // Document selection changed. 00494 pDocument = TheMsg->pNewDoc; 00495 } 00496 00497 // Make sure that we have set up our class variables so that the 00498 // tabs know what is the current document and spread to work on. 00499 OptionsTabs::SetCurrentDocAndSpread(pDocument); 00500 // Plus the current document units are correct 00501 OptionsTabs::SetUpDocUnits(); 00502 // Set the document name up to be either:- 00503 // - the default if we have a null document pointer 00504 // - the current name of the document 00505 OptionsTabs::SetDocumentName(pDocument); 00506 00507 // Is the new one null ==> no new document 00508 if (pDocument == NULL) 00509 { 00510 // Now go through all the tabs declared to the system 00511 // And call a function to get them to update themselves. 00512 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00513 00514 while (pOptionsTabs != NULL) 00515 { 00516 // Only get the tab to update if it is a program based option 00517 if ( pOptionsTabs->IsProgramOption() ) 00518 { 00519 // Get that tab to update itself. 00520 pOptionsTabs->GreySection(); 00521 } 00522 00523 // Get the next option's tab. 00524 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00525 } 00526 } 00527 else 00528 { 00529 // Now go through all the tabs declared to the system 00530 // And call a function to get them to update themselves. 00531 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00532 00533 while (pOptionsTabs != NULL) 00534 { 00535 // Only get the tab to update if it is a program based option 00536 if ( pOptionsTabs->IsProgramOption() ) 00537 { 00538 // Get that tab to update itself. 00539 pOptionsTabs->UngreySection(); 00540 //pOptionsTabs->UpdateSection(); 00541 } 00542 // Get the next option's tab. 00543 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00544 } 00545 } 00546 } 00547 break; 00548 00549 // This message is sent when a new or just opened document is stable. 00550 // Selection messages no good as the template document is loaded into 00551 // the same document and hence the selected document/spread/view does 00552 // not change and so we do not get the last update. 00553 // Could cache all messages from BORN to this and only update on this. 00554 case DocChangingMsg::BORNANDSTABLE: 00555 { 00556 // In the different cases there are different document pointers that 00557 // we must use, in this case the changing doc is relevent. 00558 Document *pDocument = NULL; 00559 pDocument = TheMsg->pChangingDoc; 00560 if (pDocument != NULL) 00561 { 00562 // Now go through all the tabs declared to the system 00563 // And call a function to get them to update themselves. 00564 // Work out the document name and pass this to the tab so that it has 00565 // chance to fill in its info field ok. 00566 OptionsTabs::SetCurrentDocAndSpread(pDocument); 00567 OptionsTabs::SetDocumentName(pDocument); 00568 00569 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00570 String_256 DocumentName = *OptionsTabs::GetDocumentName(); 00571 00572 while (pOptionsTabs != NULL) 00573 { 00574 // Only get the tab to update if it is a document based option 00575 if ( pOptionsTabs->IsProgramOption() ) 00576 { 00577 // Get that tab to update itself. 00578 //pOptionsTabs->UngreySection(); 00579 pOptionsTabs->UpdateSection(&DocumentName); 00580 } 00581 00582 // Get the next option's tab. 00583 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00584 } 00585 } 00586 } 00587 break; 00588 00589 default: 00590 break; 00591 00592 } 00593 } 00594 #ifndef REMOVE_PRINT_TABS 00595 // WEBSTER-ranbirr-13/11/96 00596 #ifndef WEBSTER 00597 else if (MESSAGE_IS_A(Message,PrintMsg)) // Check for print messages 00598 { 00599 PrintMsg* pPrintMsg = (PrintMsg*)Message; 00600 00601 if (pPrintMsg->Reason == PrintMsg::SETTINGSCHANGED) 00602 { 00603 // Tell the print layout tab about the print settings change 00604 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00605 while (pOptionsTabs != NULL) 00606 { 00607 if (pOptionsTabs->GetPageID() == _R(IDD_OPTSTAB_PRINTLAYOUT) || 00608 pOptionsTabs->GetPageID() == _R(IDD_OPTSTAB_PRINTGENERAL)) 00609 { 00610 PrintBaseTab* pBaseTab = (PrintBaseTab *) pOptionsTabs; 00611 pBaseTab->PrintSettingsChanged(); 00612 } 00613 00614 // Get the next option's tab. 00615 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00616 } 00617 } 00618 } 00619 #endif 00620 #endif //webster 00621 else if (MESSAGE_IS_A(Message, DocViewMsg)) 00622 { 00623 // Cope with document view changing messages so that we allow all the tabs to update 00624 // themselves when switching to a new view. 00625 // Unfortunately, at present if we sit on the DocView changing message and wait for 00626 // a selection then at this point there is NO SELECTED spread and so things will fail. 00627 // Therefore, wait for a selected spread message 00628 00629 DocViewMsg *TheMsg = (DocViewMsg *) Message; 00630 00631 switch ( TheMsg->State ) 00632 { 00633 case DocViewMsg::SELCHANGED: 00634 { 00635 if (TheMsg->pNewDocView != NULL) 00636 { 00637 // Now go through all the tabs declared to the system 00638 // And call a function to get them to update themselves. 00639 // Work out the document name and pass this to the tab so that it has 00640 // chance to fill in its info field ok. 00641 Document *pDocument = TheMsg->pNewDocView->GetDoc(); 00642 OptionsTabs::SetCurrentDocAndSpread(pDocument); 00643 OptionsTabs::SetDocumentName(pDocument); 00644 00645 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00646 String_256 DocumentName = *OptionsTabs::GetDocumentName(); 00647 00648 while (pOptionsTabs != NULL) 00649 { 00650 // Only get the tab to update if it is a application based option 00651 if ( pOptionsTabs->IsProgramOption() ) 00652 { 00653 // Get that tab to update itself. 00654 //pOptionsTabs->UngreySection(); 00655 pOptionsTabs->UpdateSection(&DocumentName); 00656 } 00657 00658 // Get the next option's tab. 00659 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00660 } 00661 } 00662 } 00663 break; 00664 00665 default: 00666 break; 00667 } 00668 } 00669 else if (MESSAGE_IS_A(Message, OptionsChangingMsg)) 00670 { 00671 // Cope with a new units messages so that we give the options tabs a chance to 00672 // update themselves to display using the newly specified defaults. 00673 00674 OptionsChangingMsg *TheMsg = (OptionsChangingMsg *) Message; 00675 00676 // Make sure that we have set up our class variables so that the tabs know what 00677 // is the current document and spread to work on. 00678 Document *pDocument = Document::GetSelected(); 00679 OptionsTabs::SetCurrentDocAndSpread(pDocument); 00680 // Plus the current document units are correct 00681 OptionsTabs::SetUpDocUnits(); 00682 00683 switch ( TheMsg->State ) 00684 { 00685 case OptionsChangingMsg::NEWUNITS: 00686 { 00687 // Current display units may have changed changed so may need to update 00688 // any display fields on other tabs which are using units. 00689 // Now go through all the tabs declared to the system 00690 // And call a function to get them to update themselves. 00691 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00692 00693 while (pOptionsTabs != NULL) 00694 { 00695 // Only get the tab to update if it is a program based option 00696 if ( pOptionsTabs->IsProgramOption() ) 00697 { 00698 // Get that tab to update itself. 00699 pOptionsTabs->NewUnitsInSection(); 00700 } 00701 00702 // Get the next option's tab. 00703 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00704 } 00705 break; 00706 } 00707 // WEBSTER-ranbirr-13/11/96 00708 #ifndef WEBSTER 00709 case OptionsChangingMsg::ASKBEFORESETTINGATTR: 00710 { 00711 // Tell the Misc tab about the change in state of ask before setting 00712 // the attribute 00713 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00714 while (pOptionsTabs != NULL) 00715 { 00716 if (pOptionsTabs->GetPageID() == _R(IDD_OPTSTAB_MISC)) 00717 { 00718 MiscTab *pMiscTab = (MiscTab *) pOptionsTabs; 00719 pMiscTab->UpdateAskBefore(); 00720 } 00721 00722 // Get the next option's tab. 00723 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00724 } 00725 break; 00726 } 00727 case OptionsChangingMsg::IMPORTWITHLAYERS: 00728 { 00729 // Tell the Misc tab about the change in state of Import with layers 00730 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00731 while (pOptionsTabs != NULL) 00732 { 00733 if (pOptionsTabs->GetPageID() == _R(IDD_OPTSTAB_MISC)) 00734 { 00735 MiscTab *pMiscTab = (MiscTab *) pOptionsTabs; 00736 pMiscTab->UpdateImportWithLayers(); 00737 } 00738 00739 // Get the next option's tab. 00740 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00741 } 00742 break; 00743 } 00744 #endif //webster 00745 case OptionsChangingMsg::NEWPAGESIZE: 00746 case OptionsChangingMsg::PAGESIZEHASCHANGED: 00747 { 00748 // Current page size may have changed changed so may need to update 00749 // any display fields on other tabs which are showing pages. 00750 // Now go through all the tabs declared to the system 00751 // And call a function to get them to update themselves. 00752 // PAGESIZEHASCHANGED is sent by the page tab so do not get it to update. 00753 // NEWPAGESIZE sent by the undo/redo actions so do get it to update 00754 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00755 00756 while (pOptionsTabs != NULL) 00757 { 00758 // If we are the page tab then call its special function but only if it 00759 // did not send the message. 00760 if (pOptionsTabs->GetPageID() == _R(IDD_OPTSTAB_PAGE) && 00761 TheMsg->State == OptionsChangingMsg::NEWPAGESIZE ) 00762 { 00763 PageTab *pPageTab = (PageTab *) pOptionsTabs; 00764 pPageTab->UpdatePageSection(); 00765 } 00766 // Only sned the message to a tab if its an application based option 00767 if ( pOptionsTabs->IsProgramOption() ) 00768 { 00769 // Call a function to allow other tabs to update themselves 00770 pOptionsTabs->PageSizeHasChanged(); 00771 } 00772 00773 // Get the next option's tab. 00774 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00775 } 00776 break; 00777 } 00778 case OptionsChangingMsg::NEWDEFAULTGRID: 00779 { 00780 // Current default grid may have changed changed 00781 // so may need to update any display fields on other tabs which 00782 // are showing pages. 00783 // Now go through all the tabs declared to the system 00784 // And call a function to get them to update themselves. 00785 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00786 00787 while (pOptionsTabs != NULL) 00788 { 00789 if (pOptionsTabs->GetPageID() == _R(IDD_OPTSTAB_GRID)) 00790 { 00791 GridTab *pGridTab = (GridTab *) pOptionsTabs; 00792 pGridTab->UpdateGridSection(); 00793 } 00794 00795 // Get the next option's tab. 00796 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00797 } 00798 break; 00799 } 00800 00801 default: 00802 { 00803 // If nobody above has processed the message, then pass it around all the tabs in 00804 // case it's of use to them. 00805 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00806 00807 while (pOptionsTabs != NULL) 00808 { 00809 // Only sned the message to a tab if its an application based option 00810 if ( pOptionsTabs->IsProgramOption() ) 00811 pOptionsTabs->Message(Message); 00812 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00813 } 00814 } 00815 break; 00816 } 00817 } 00818 else if (IS_OUR_DIALOG_MSG(Message)) 00819 { 00820 // Cope with messages for the dialog box 00821 DialogMsg* Msg = (DialogMsg*)Message; 00822 00823 MsgResult Result; 00824 00825 // Main handler for dialog type messages 00826 BOOL EndDialog = FALSE; // TRUE if we should quit the dialog 00827 BOOL CommitValues = FALSE; // TRUE if we should commit the dialog values 00828 BOOL OldApplyNow = OptionsTabs::GetApplyNowState(); // Old ApplyNow button state 00829 00830 // Make sure that we have set up our class variables so that the tabs know what 00831 // is the current document and spread to work on. 00832 Document *pDocument = Document::GetSelected(); 00833 OptionsTabs::SetCurrentDocAndSpread(pDocument); 00834 // Plus the current document units are correct 00835 OptionsTabs::SetUpDocUnits(); 00836 00837 // Check if sending init/create message and if so set flag True. 00838 // If True then do not ungrey the ApplyNow button on changing messages 00839 if (Msg->DlgMsg == DIM_CREATE) 00840 OptionsTabs::SetInitMessageState(TRUE); 00841 00842 // If the message is not for the main options window then try the tab pages 00843 BOOL FoundPage = FALSE; 00844 if (Msg->PageID != 0) 00845 { 00846 // Now go through all the tabs declared to the system 00847 // And see if the message is for that page or not. 00848 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00849 00850 while (pOptionsTabs != NULL && !FoundPage) 00851 { 00852 CDlgResID PageId = pOptionsTabs->GetPageID(); 00853 if (PageId == Msg->PageID) 00854 { 00855 // Found the correct page so stop the search and send the message 00856 // to that page 00857 pOptionsTabs->HandleMsg(Msg); 00858 FoundPage = TRUE; 00859 } 00860 // Get the next option's tab. 00861 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00862 } 00863 } 00864 else 00865 { 00866 // Main page window 00867 switch (Msg->DlgMsg) 00868 { 00869 case DIM_CREATE: // Creating the main dialog box 00870 #ifndef REMOVE_PRINT_TABS 00871 IgnoreAllMessages = TRUE; 00872 // BLOCK 00873 { 00874 // Make sure the print marks are cached by the PMManager. This must be done now 00875 // because we want to demand-load the marks, but if we leave it any later we get 00876 // an awful lot of rather nasty problems with document messages flying around. 00877 PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager(); 00878 if (pMarksMan) 00879 { 00880 pMarksMan->ConstructCache(); 00881 if (Document::GetSelected() != NULL) 00882 pMarksMan->AddDefaultMarksToDoc(Document::GetSelected()); 00883 } 00884 } 00885 IgnoreAllMessages = FALSE; 00886 #endif 00887 break; 00888 // grey out the apply now button as this should only become enabled when 00889 // we have made a change to the dialog box. 00890 // OptionsTabs::SetInitMessageState(FALSE); 00891 // OptionsTabs::SetApplyNowState(FALSE); 00892 // OptionsTabs::GreyApplyNow(); 00893 // break; 00894 00895 case DIM_COMMIT: // Want to commit and quit 00896 { 00897 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00898 while (pOptionsTabs != NULL) 00899 { 00900 // Only give the tab the message if it is a application based option 00901 if ( pOptionsTabs->IsProgramOption() ) 00902 pOptionsTabs->HandleMsg(Msg); 00903 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00904 } 00905 EndDialog = TRUE; 00906 CommitValues = TRUE; 00907 } 00908 break; 00909 00910 case DIM_SOFT_COMMIT: // Want to commit 00911 { 00912 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00913 while (pOptionsTabs != NULL) 00914 { 00915 // Only give the tab the message if it is a application based option 00916 if ( pOptionsTabs->IsProgramOption() ) 00917 pOptionsTabs->HandleMsg(Msg); 00918 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00919 } 00920 00921 CommitValues = TRUE; 00922 } 00923 break; 00924 00925 case DIM_CANCEL: // Want to quit 00926 { 00927 00928 // We pass the message to all the tabs so that they clean up and discard all changes made, if any 00929 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 00930 while (pOptionsTabs != NULL) 00931 { 00932 // Only give the tab the message if it is a application based option 00933 if ( pOptionsTabs->IsProgramOption() ) 00934 pOptionsTabs->HandleMsg(Msg); 00935 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 00936 } 00937 EndDialog = TRUE; 00938 } 00939 break; 00940 00941 default: 00942 break; 00943 } 00944 } 00945 00946 // Commit values here 00947 if (CommitValues) 00948 { 00949 // // To stop dangerous things happening such as being told to cancel the dialog box 00950 // // when we are in the middle of a apply now/ok, we will grey all the dodgy buttons 00951 // // whilst we are in danger of this happening. 00952 // // Example: if change show transparency state and apply this, then a dialog may 00953 // // pop up to question whether this is required or not. At this point the dialog 00954 // // box is still accessable. If click cancel then access violations happen. 00955 // CDlgResID PageID = GetCurrentPageID(); // Get currently selected Tab id 00956 // TalkToPage(NULL); // Select the main tab 00957 // EnableGadget(_R(ID_APPLY_NOW), FALSE); // grey button on main tab 00958 // EnableGadget(IDOK, FALSE); // grey button on main tab 00959 // EnableGadget(IDCANCEL, FALSE); // grey button on main tab 00960 // TalkToPage(PageID); // Select the originally selected tab 00961 // BOOL ApplyNow = OptionsTabs::SetApplyNowState(FALSE); 00962 00963 BOOL ok = CommitDialogValues(); 00964 // Only unset EndDialog as in SOFT_COMMIT case we do not want to end the 00965 // Operation and hence close the dialog box 00966 if (!ok) 00967 { 00968 EndDialog = FALSE; // Values not correct so do not allow exit 00969 Msg->DlgMsg = DIM_SOFT_COMMIT; // turn the message into a soft-commit so the base class does not destroy the dialog 00970 } 00971 00972 #ifndef REMOVE_PRINT_TABS 00973 // Now, a nasty bodge. The print tabs need to re-cache their local print control data 00974 // from the committed values in the document print control, or else all hell will break 00975 // loose. 00976 // WEBSTER-ranbirr-13/11/96 00977 #ifndef WEBSTER 00978 PrintBaseTab::DocumentSettingsUpdated(); 00979 #endif 00980 00981 // // Committing and not closing the dialog so re-enable the ok, cancel and apply 00982 // // now buttons. 00983 // PageID = GetCurrentPageID(); // Get currently selected Tab id 00984 // TalkToPage(NULL); // Select the main tab 00985 // EnableGadget(_R(ID_APPLY_NOW), TRUE); // ungrey button on main tab 00986 // EnableGadget(IDOK, TRUE); // ungrey button on main tab 00987 // EnableGadget(IDCANCEL, TRUE); // ungrey button on main tab 00988 // TalkToPage(PageID); // Select the originally selected tab 00989 // OptionsTabs::SetApplyNowState(ApplyNow); 00990 #endif //webster 00991 } 00992 00993 if ( !OldApplyNow && OptionsTabs::GetApplyNowState() 00994 && !EndDialog && !OptionsTabs::GetInitMessageState() ) 00995 { 00996 // Check for a change from apply now being False to it becoming 00997 // True as an item has been changed. 00998 OptionsTabs::UngreyApplyNow(); 00999 } 01000 01001 if ( OptionsTabs::GetApplyNowState() && (Msg->DlgMsg == DIM_SOFT_COMMIT) 01002 && !EndDialog && !OptionsTabs::GetInitMessageState() ) 01003 { 01004 // Check for an apply now (DIM_SOFT_COMMIT) being used and the 01005 // apply being True, should always be the case, so that we can reset 01006 // the grey state to False as we are in an unchanged state. 01007 OptionsTabs::SetApplyNowState(FALSE); 01008 OptionsTabs::GreyApplyNow(); 01009 } 01010 01011 // Allow the base class access to the message, it will do the 01012 // DLG_EAT_IF_HUNGRY(Msg) for us 01013 // Note that this call can DELETE "this" 01014 Result = DialogTabOp::Message(Message); 01015 01016 // End dialog here 01017 if (EndDialog) 01018 { 01019 // Make sure that we remove our options tabs link to the dialog box class 01020 // as the dialog will now be destroyed 01021 OptionsTabs::pPrefsDlg = NULL; 01022 } 01023 01024 // Check if have been sending an init/create message and if so then set flag False. 01025 // Only do this in the init/create case as we might be sent one of these and then 01026 // be sent other messages whilst in the middle of the init/create message such as 01027 // text changing messages. 01028 if (Msg->DlgMsg == DIM_CREATE) 01029 OptionsTabs::SetInitMessageState(FALSE); 01030 01031 // The message was for our dialog box so return that we have handled it, if necessary 01032 //return (DLG_EAT_IF_HUNGRY(Msg)); 01033 return Result; 01034 } 01035 else 01036 { 01037 // If nobody above has processed the message, then pass it around all the tabs in 01038 // case it's of use to them. 01039 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 01040 01041 while (pOptionsTabs != NULL) 01042 { 01043 // Only give the tab the message if it is a application based option 01044 if ( pOptionsTabs->IsProgramOption() ) 01045 pOptionsTabs->Message(Message); 01046 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 01047 } 01048 } 01049 01050 01051 #endif 01052 01053 // return OK; 01054 return DialogTabOp::Message(Message); 01055 01056 }
|
|
This virtual function will get called to give you a chance to add pages to your DialogTabOp. This function will usually make multiple calls to AddAPage to register the initial set of pages to be contained in the tab dialog. The pages should all be the same size and be registered in the left to right order in which you wish them to appear.
Reimplemented from DialogTabOp. Definition at line 1398 of file appprefs.cpp. 01399 { 01400 BOOL ok = TRUE; 01401 01402 // Now go through all the tabs declared to the system 01403 OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst(); 01404 01405 while (pOptionsTabs != NULL) 01406 { 01407 // Only add the tab if it is a program based option 01408 if ( pOptionsTabs->IsProgramOption() ) 01409 { 01410 CDlgResID PageId = pOptionsTabs->GetPageID(); 01411 ok = ok && AddAPage(PageId); 01412 } 01413 01414 // Get the next option's tab. 01415 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs); 01416 } 01417 return (ok); 01418 }
|
|
This allows the state of the Save on exit flag to be set to either TRUE or FALSE.
Definition at line 273 of file appprefs.cpp. 00274 { 00275 // First, remember old state 00276 BOOL OldSaveOnExit = SaveOnExit; 00277 00278 if ( NewState != 0 ) 00279 SaveOnExit = TRUE; 00280 else 00281 SaveOnExit = FALSE; 00282 00283 return OldSaveOnExit; 00284 }
|
|
Definition at line 161 of file appprefs.h. |
|
Definition at line 162 of file appprefs.h. |
|
Definition at line 169 of file appprefs.h. |
|
Definition at line 178 of file appprefs.h. |