PrintPrefsDlg Class Reference

#include <prnprefs.h>

Inheritance diagram for PrintPrefsDlg:

DialogTabOp DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject PrintTabPrintPrefsDlg List of all members.

Public Member Functions

 PrintPrefsDlg ()
 PrintPrefsDlg constructor. Creates a non-undoable operation.
 PrintPrefsDlg (INT32 StartingPage)
 PrintPrefsDlg constructor. Creates a non-undoable operation.
 ~PrintPrefsDlg ()
 PrintPrefsDlg 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 HasImages ()
TabType GetTabType ()

Static Public Member Functions

static BOOL Init ()
 PrintPrefsDlg Init method. Called when the kernel initialises.
static void Deinit ()
static OpState GetState (String_256 *, OpDescriptor *)
 PrintPrefsDlg GetState method.
static BOOL InvokeDialog ()
 How to invoke or start a PrintPrefsDlg box.
static void SetCurrentDlg (PrintPrefsDlg *pDlg)
 This sets the ptr to the currently created PrintPrefsDlg. There should only be one at a time, so if you set this value to a non-NULL value, and there's already one set, an ERROR3 will go off.
static void CloseCurrentDlg ()
 This will close the currently open print prefs dlg, if there is one. If there isn't one open, nothing happens.

Private Member Functions

BOOL CommitDialogValues ()
 Takes the values in the dialog box and sets the return values accordingly Called when ok is pressed on the dialog box.

Private Attributes

String_256 TitleString

Static Private Attributes

static const CDlgResID IDD = _R(IDD_DOCUMENTOPTIONS)
static const CDlgMode Mode = MODAL
static BOOL OkUsed = FALSE
static BOOL Open = FALSE
static PrintPrefsDlgpCurrentDlg = NULL

Detailed Description

Definition at line 130 of file prnprefs.h.


Constructor & Destructor Documentation

PrintPrefsDlg::PrintPrefsDlg  ) 
 

PrintPrefsDlg constructor. Creates a non-undoable operation.

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

Errors: -

See also:
-

Definition at line 216 of file prnprefs.cpp.

00216                             : DialogTabOp(PrintPrefsDlg::IDD, PrintPrefsDlg::Mode) 
00217 {
00218     // At present, just:- 
00219     OptionsTabs::SetApplyNowState(FALSE);       // grey the apply now button
00220     OptionsTabs::SetInitMessageState(FALSE);    // not sending an init message
00221     OptionsTabs::pScopeDocument = NULL;         // Document in use when sending messages
00222 
00223     // Set default units
00224     OptionsTabs::SetDefaultUnits();             // set up our default display units
00225 
00226     // Document and spread we are supposed to be working on. Of course none at present.
00227     OptionsTabs::SetCurrentDocAndSpread(NULL);
00228 
00229     PrintPrefsDlg::SetCurrentDlg(this);
00230 }

PrintPrefsDlg::PrintPrefsDlg INT32  StartingPage  ) 
 

PrintPrefsDlg constructor. Creates a non-undoable operation.

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

Errors: -

See also:
-

Definition at line 248 of file prnprefs.cpp.

00248                                               : DialogTabOp(PrintPrefsDlg::IDD, PrintPrefsDlg::Mode,
00249                                                         CC_RUNTIME_CLASS(DialogOp), StartingPage) 
00250 {
00251     // At present, just:- 
00252     OptionsTabs::SetApplyNowState(FALSE);       // grey the apply now button
00253     OptionsTabs::SetInitMessageState(FALSE);    // not sending an init message
00254     OptionsTabs::pScopeDocument = NULL;         // Document in use when sending messages
00255 
00256     // Set default units
00257     OptionsTabs::SetDefaultUnits();             // set up our default display units
00258 
00259     // Document and spread we are supposed to be working on. Of course none at present.
00260     OptionsTabs::SetCurrentDocAndSpread(NULL);
00261 
00262     PrintPrefsDlg::SetCurrentDlg(this);
00263 }

PrintPrefsDlg::~PrintPrefsDlg  ) 
 

PrintPrefsDlg destructor.

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

Errors: -

See also:
-

Definition at line 282 of file prnprefs.cpp.

00283 {
00284     // Make sure that we remove our options tabs link to the dialog box class
00285     // as the dialog will now be destroyed
00286     OptionsTabs::pPrefsDlg = NULL;
00287 
00288     PrintPrefsDlg::SetCurrentDlg(NULL);
00289 }


Member Function Documentation

void PrintPrefsDlg::CloseCurrentDlg  )  [static]
 

This will close the currently open print prefs dlg, if there is one. If there isn't one open, nothing happens.

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

Errors: -

See also:
PrintPrefsDlg::SetCurrentDlg()

Definition at line 902 of file prnprefs.cpp.

00903 {
00904     if (pCurrentDlg != NULL)
00905     {
00906         DialogMsg Msg(pCurrentDlg->WindowID, DIM_CANCEL, 0);
00907         pCurrentDlg->Message(&Msg);
00908     }
00909 }

BOOL PrintPrefsDlg::CommitDialogValues  )  [private]
 

Takes the values in the dialog box and sets the return values accordingly Called when ok is pressed on the dialog box.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if values in dialog box ok, False otherwise.

Errors: -

See also:
-

Definition at line 308 of file prnprefs.cpp.

00309 {
00310     // Ok has been pressed so take the values from the dialog box
00311     BOOL ok = TRUE;
00312     BOOL ValuesOk = TRUE;
00313 
00314     // Go through all the tabs declared to the system in turn
00315     // and tell them to commit the values for their tab
00316     OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
00317 
00318     while (pOptionsTabs != NULL)
00319     {
00320         // Only get the tab to commit if it is a print based option
00321         if ( pOptionsTabs->IsPrintingOption() )
00322         {
00323             // Get the found page to commit its values.
00324             // Should return False if reported error and we should just fail.
00325             //               2 if set an error which we should report and then fail. 
00326             ok = pOptionsTabs->CommitSection();
00327             if ( ok != TRUE )
00328             {
00329                 if (ok == 2)
00330                     InformError();          // If error required show it.
00331 
00332                 // Carry on with other pages so that report all errors and have a chance
00333                 // to correct mistakes in other pages but make note of error state.
00334                 ValuesOk = FALSE;   
00335                 //return FALSE;
00336             }
00337         }
00338         // Get the next option's tab.
00339         pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
00340     }
00341 
00342     // Return whether we found bad values or not.
00343     return ValuesOk;
00344 }

static void PrintPrefsDlg::Deinit  )  [static]
 

void PrintPrefsDlg::Do OpDescriptor  )  [virtual]
 

Creates then opens the dialog in response to a request from the user.

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

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 760 of file prnprefs.cpp.

00761 {
00762     BOOL ok;
00763 
00764     if (OptionsTabs::pPrefsDlg != NULL)
00765     {
00766         ERROR3("PrintPrefsDlg::Do an options tabbed dialog box is already present");
00767         return;
00768     }
00769     
00770     // Set up the name that the main dialog page is going to use
00771     String_256 Temp(_R(IDN_PRINTOPTS)); 
00772     TitleString = Temp;
00773     SetName(&TitleString);
00774 
00775     // Make sure that our options tabs have a link to the dialog box class
00776     OptionsTabs::pPrefsDlg = this;
00777     OptionsTabs::SetApplyNowState(FALSE);
00778 
00779     // Make sure that we have set up our class variables so that the tabs know what
00780     // is the current document and spread to work on.
00781     Document *pDocument = Document::GetSelected();
00782     OptionsTabs::SetCurrentDocAndSpread(pDocument);
00783     // Work out the document name so that it is ready for options tabs to display.
00784     OptionsTabs::SetDocumentName(pDocument);
00785     
00786         
00787     // Force the dialog box to be created, as it is non-modal it must be opened if the create
00788     // works ok.
00789     ok = Create();                          // create the dialog box
00790 
00791     if ( ok )
00792     {
00793 //      // Modal at present so remove the Open()
00794 //      Open();                             // created ok so open the dialog box up
00795 //      
00796 //      // grey out the apply now button as this should only become enabled when we have 
00797 //      // made a change to the dialog box.
00798 //      OptionsTabs::SetInitMessageState(FALSE);
00799 //      OptionsTabs::SetApplyNowState(FALSE);
00800 //      OptionsTabs::GreyApplyNow();
00801     }
00802     else
00803     {
00804         // Could not create the dialog box so call inform error 
00805         InformError();                      // Show user the error
00806         End();                              // End the operation 
00807     }                   
00808 }

OpState PrintPrefsDlg::GetState String_256 ,
OpDescriptor
[static]
 

PrintPrefsDlg GetState method.

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

Errors: -

See also:
-

Definition at line 663 of file prnprefs.cpp.

00664 {    
00665     OpState OpSt;
00666 
00667     // If the pointer is non-null then it implies that another dialog box is up which
00668     // uses our tab set and so we must force greying of the menu option 
00669     // This one is different in that we force the main options dialog box to be closed.
00670     if (OptionsTabs::pPrefsDlg != NULL)
00671         OpSt.Greyed=TRUE;
00672 
00673     return(OpSt);
00674 }

TabType PrintPrefsDlg::GetTabType  )  [inline, virtual]
 

Reimplemented from DialogTabOp.

Definition at line 157 of file prnprefs.h.

00157 {return TABTYPE_TREE/*TABTYPE_LIST*/;}

BOOL PrintPrefsDlg::HasImages  )  [inline, virtual]
 

Reimplemented from DialogTabOp.

Definition at line 156 of file prnprefs.h.

00156 {return TRUE;}

BOOL PrintPrefsDlg::Init void   )  [static]
 

PrintPrefsDlg Init method. Called when the kernel initialises.

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

Errors: -

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 694 of file prnprefs.cpp.

00695 {
00696     BOOL InitOK;
00697 
00698     // Now register ourselves with the dialog system
00699     InitOK = RegisterOpDescriptor(
00700                                 0,                              // Tool ID 
00701                                 _R(IDS_PRINTOPTIONS),               // String resource ID
00702                                 CC_RUNTIME_CLASS(PrintPrefsDlg),    // Runtime class
00703                                 OPTOKEN_PRINTOPTIONS,           // Token string
00704                                 GetState,                       // GetState function
00705                                 0,                              // help ID
00706                                 0,                              // bubble help
00707                                 0,                              // resource ID
00708                                 0,                              // control ID
00709                                 SYSTEMBAR_ILLEGAL,              // Bar ID
00710                                 FALSE,                          // Recieve system messages
00711                                 FALSE,                          // Smart duplicate operation
00712                                 TRUE,                           // Clean operation
00713                                 0,                              // No vertical counterpart
00714                                 _R(IDS_PRINTPREFSDLG_ONE),          // String for one copy only error
00715                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags                               );
00716                                 );
00717 
00718     // Now register ourselves with the dialog system for the units button on the windows
00719     // button bar as well
00720     InitOK = InitOK && RegisterOpDescriptor(
00721                                 0,                              // Tool ID
00722                                 _R(IDS_PRINTOPTIONS),               // String resource ID
00723                                 CC_RUNTIME_CLASS(PrintTabPrintPrefsDlg),    // Runtime class
00724                                 OPTOKEN_PRINTOPTIONSDLG,        // Token string
00725                                 GetState,                       // GetState function
00726                                 0,                              // help ID
00727                                 0,                              // bubble help
00728                                 0,                              // resource ID
00729                                 0,                              // control ID
00730                                 SYSTEMBAR_ILLEGAL,              // Bar ID
00731                                 FALSE,                          // Recieve system messages
00732                                 FALSE,                          // Smart duplicate operation
00733                                 TRUE,                           // Clean operation
00734                                 0,                              // No vertical counterpart
00735                                 _R(IDS_PRINTPREFSDLG_ONE),          // String for one copy only error
00736                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags                               );
00737                                 );
00738 
00739     // Options tabs and page sizes initialised by the applications options (AppPrefsDlg)
00740     // class.
00741 
00742     return (InitOK);
00743 }

BOOL PrintPrefsDlg::InvokeDialog  )  [static]
 

How to invoke or start a PrintPrefsDlg box.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if Ok used or False if Cancel used.

Errors: -

See also:
-

Definition at line 162 of file prnprefs.cpp.

00163 {
00164     static BOOL FirstTime = TRUE;
00165 
00166     if (!Open)
00167     {
00168         Open = TRUE; 
00169 
00170         // First time through we want to force open the second Print tab as opposed to the Output
00171         // tab as this is deemed to be the better option.
00172         OpDescriptor *pOpDesc = NULL;
00173         if (!FirstTime)
00174         {
00175             pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(PrintPrefsDlg));
00176         }
00177         else
00178         {
00179             // Only do this the first time
00180             FirstTime = FALSE;
00181             pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_PRINTOPTIONSDLG);
00182         }
00183         ERROR3IF(pOpDesc == NULL,"PrintPrefsDlg::InvokeDialog is unable to find the PrintPrefsDlg OpDescriptor");
00184 
00185         if (pOpDesc != NULL)
00186             pOpDesc->Invoke();
00187 
00188         Open = FALSE;
00189 
00190         return OkUsed;
00191     }
00192     else
00193     {
00194         ERROR3("PrintPrefsDlg::InvokeDialog() called again, before previous call returned");
00195         return FALSE;
00196     }
00197 }

MsgResult PrintPrefsDlg::Message Msg Message  )  [virtual]
 

Handles all the application preferences dialog's messages.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
OK Message handled ok (return this even if you don't need to respond to the message).
FAIL Something terrible happened whilst processing the message eg. we ran out of memory. You must set ERROR if you are returning this value.

EAT_MSG The Message was handled ok but don't send it to any more MessageHandlers.

Returns:
Errors: -
See also:
-

Reimplemented from DialogTabOp.

Definition at line 370 of file prnprefs.cpp.

00371 {
00372 TRACEUSER( "Neville", _T("PrintPrefsDlg::Message\n"));
00373     ERROR3IF(Message == NULL,"PrintPrefsDlg::Message null message received");
00374 
00375     // Jason - This is a message-loop lock which is used in the DIM_CREATE code to 
00376     // allow the print marks manager cache print marks - this causes a lot of diocument
00377     // message broadcats and suchlike, which cause re-entrant messages to come in
00378     // here and trigger 3 billion ERROR3s. While caching the print marks, we lock this
00379     // message handler so that it just ignores all resultant broadcasts.
00380     static BOOL IgnoreAllMessages = FALSE;
00381     if (IgnoreAllMessages)
00382         return DialogTabOp::Message(Message);
00383 
00384 
00385     // Cope with messages for the dialog box
00386     if (MESSAGE_IS_A(Message,PrintMsg))     // Check for print messages
00387     {
00388         PrintMsg* pPrintMsg = (PrintMsg*)Message;
00389 
00390         if (pPrintMsg->Reason == PrintMsg::SETTINGSCHANGED)
00391         {
00392             // Tell the print layout tab about the print settings change
00393             OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
00394             while (pOptionsTabs != NULL)
00395             {
00396                 if (pOptionsTabs->GetPageID() == _R(IDD_OPTSTAB_PRINTLAYOUT) ||
00397                     pOptionsTabs->GetPageID() == _R(IDD_OPTSTAB_PRINTGENERAL))
00398                 {
00399                     PrintBaseTab* pBaseTab = (PrintBaseTab *) pOptionsTabs;
00400                     pBaseTab->PrintSettingsChanged();
00401                 }
00402 
00403                 // Get the next option's tab.
00404                 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
00405             }
00406         }
00407 
00408         return DialogTabOp::Message(Message);
00409     }
00410 
00411     if (IS_OUR_DIALOG_MSG(Message))
00412     {
00413         DialogMsg* Msg = (DialogMsg*)Message;
00414 
00415         MsgResult Result;
00416 
00417         // Main handler for dialog type messages
00418         BOOL EndDialog = FALSE;         // TRUE if we should quit the dialog
00419         BOOL CommitValues = FALSE;      // TRUE if we should commit the dialog values
00420         BOOL OldApplyNow = OptionsTabs::GetApplyNowState(); // Old ApplyNow button state  
00421 
00422         // Make sure that we have set up our class variables so that the tabs know what
00423         // is the current document and spread to work on.
00424         Document *pDocument = Document::GetSelected();
00425         OptionsTabs::SetCurrentDocAndSpread(pDocument);
00426         // Plus the current document units are correct
00427         OptionsTabs::SetUpDocUnits();
00428 
00429         // Check if sending init/create message and if so set flag True.
00430         // If True then do not ungrey the ApplyNow button on changing messages
00431         if (Msg->DlgMsg == DIM_CREATE)
00432         {
00433 TRACEUSER( "Neville", _T("PrintPrefsDlg::Message DIM_CREATE\n"));
00434             OptionsTabs::SetInitMessageState(TRUE);             
00435         }
00436 
00437         // If the message is not for the main options window then try the tab pages 
00438         BOOL FoundPage = FALSE;
00439 TRACEUSER( "Neville", _T("PrintPrefsDlg::Message PageID = %d\n"),Msg->PageID);
00440         if (Msg->PageID != 0)
00441         {
00442             // Now go through all the tabs declared to the system
00443             // And see if the message is for that page or not.
00444             OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
00445 
00446             while (pOptionsTabs != NULL && !FoundPage)
00447             {
00448                 CDlgResID PageId = pOptionsTabs->GetPageID();
00449                 if (PageId == Msg->PageID)
00450                 {
00451                     // Found the correct page so stop the search and send the message
00452                     // to that page
00453                     pOptionsTabs->HandleMsg(Msg);
00454                     FoundPage = TRUE;
00455                 }
00456                 // Get the next option's tab.
00457                 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
00458             }
00459         }
00460         else
00461         {
00462             // Main page window
00463             switch (Msg->DlgMsg)
00464             {
00465                 case DIM_CREATE:        // Creating the main dialog box
00466                 {
00467                     // grey out the apply now button as this should only become enabled when 
00468                     // we have made a change to the dialog box.
00469                     OptionsTabs::SetInitMessageState(FALSE);
00470 
00471                     IgnoreAllMessages = TRUE;
00472                     // BLOCK
00473                     {
00474                         // Make sure the print marks are cached by the PMManager. This must be done now
00475                         // because we want to demand-load the marks, but if we leave it any later we get
00476                         // an awful lot of rather nasty problems with document messages flying around.
00477                         PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
00478                         if (pMarksMan)
00479                         {
00480                             pMarksMan->ConstructCache();
00481                             if (Document::GetSelected() != NULL)
00482                                 pMarksMan->AddDefaultMarksToDoc(Document::GetSelected());
00483                         }
00484                     }
00485                     IgnoreAllMessages = FALSE;
00486 
00487                     OptionsTabs::SetApplyNowState(FALSE);
00488                     OptionsTabs::GreyApplyNow();
00489                     // remove the apply now button as not required.
00490                     CDlgResID PageID = GetCurrentPageID();  // Get currently selected Tab id
00491                     TalkToPage(0);                      // Select the main tab
00492                     HideGadget(_R(ID_APPLY_NOW), TRUE);         // hide button on main tab
00493                     TalkToPage(PageID);                     // Select the originally selected tab
00494 
00495                     // Pass the message up to all the tabs in case it's of use to them
00496                     OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
00497                     while (pOptionsTabs != NULL)
00498                     {
00499                         if (pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintSepsTab)) || // only these classes need this message
00500                             pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintImagesetterTab)))
00501                             pOptionsTabs->HandleMsg(Msg);
00502                         pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
00503                     }
00504                     break;
00505                 }
00506 
00507 
00508                 case DIM_COMMIT:        // Want to commit and quit
00509                     {
00510                         OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
00511                         while (pOptionsTabs != NULL)
00512                         {
00513                             if (pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintSepsTab)) || // only these classes need this message
00514                                 pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintImagesetterTab)))
00515                                 pOptionsTabs->HandleMsg(Msg);
00516 
00517                             // Get the next option's tab.
00518                             pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
00519                         }
00520                         OkUsed = TRUE;      // Flag ok used
00521                         EndDialog = TRUE;
00522                         CommitValues = TRUE;
00523                     }
00524                     break;
00525 
00526                 case DIM_SOFT_COMMIT:   // Want to commit but leave the dialogue open
00527                     {
00528                         // Pass the message up to all the tabs in case it's of use to them
00529                         OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
00530                         while (pOptionsTabs != NULL)
00531                         {
00532                             if (pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintSepsTab)) || // only these classes need this message
00533                                 pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintImagesetterTab)))
00534                                 pOptionsTabs->HandleMsg(Msg);
00535                             pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
00536                         }
00537 
00538                         OkUsed = TRUE;      // Flag ok used
00539                         CommitValues = TRUE;
00540                     }
00541                     break;
00542 
00543                 case DIM_CANCEL:        // Want to quit
00544                     {
00545                         // Pass the message up to all the tabs in case it's of use to them
00546                         OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
00547                         while (pOptionsTabs != NULL)
00548                         {
00549                             if (pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintSepsTab)) || // only these classes need this message
00550                                 pOptionsTabs->IsKindOf(CC_RUNTIME_CLASS(PrintImagesetterTab)))
00551                                 pOptionsTabs->HandleMsg(Msg);
00552                             pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
00553                         }
00554                     }
00555                     OkUsed = FALSE;     // Flag ok used
00556                     EndDialog = TRUE;
00557                     break;
00558 
00559                 default:
00560                     break;
00561             }
00562         }
00563 
00564         // Commit values here
00565         if (CommitValues)
00566         {
00567             BOOL ok = CommitDialogValues();
00568             // Only unset EndDialog as in SOFT_COMMIT case we do not want to end the
00569             // Operation and hence close the dialog box
00570             if (!ok)
00571             {
00572                 Msg->DlgMsg = DIM_NONE; // prevent baseclass from removing the dialog
00573                 EndDialog = FALSE;  // Values not correct so do not allow exit
00574             }
00575         }
00576 
00577         if ( !OldApplyNow && OptionsTabs::GetApplyNowState()
00578              && !EndDialog && !OptionsTabs::GetInitMessageState() )
00579         {
00580             // Check for a change from apply now being False to it becoming
00581             // True as an item has been changed.
00582             OptionsTabs::UngreyApplyNow();
00583         }
00584 
00585         if ( OptionsTabs::GetApplyNowState() && (Msg->DlgMsg == DIM_SOFT_COMMIT)
00586              && !EndDialog && !OptionsTabs::GetInitMessageState() )
00587         {
00588             // Check for an apply now (DIM_SOFT_COMMIT) being used and the
00589             // apply being True, should always be the case, so that we can reset
00590             // the grey state to False as we are in an unchanged state.
00591             OptionsTabs::SetApplyNowState(FALSE);
00592             OptionsTabs::GreyApplyNow();
00593         }
00594 
00595         // End dialog here
00596         if (EndDialog) 
00597         {
00598             // Grey all the tabs to remove the Indexed colour in use error
00599             OptionsTabs::SetCurrentDocAndSpread(NULL);
00600             OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
00601             while (pOptionsTabs != NULL)
00602             {
00603                 if (pOptionsTabs->IsPrintingOption())
00604                     pOptionsTabs->GreySection();
00605                 pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
00606             }
00607             
00608             // Note this destroys "this". Hence don't call the base class
00609             Close();                // Hide the dialog box
00610             End();                  // Finish the operation
00611             
00612             // Make sure that we remove our options tabs link to the dialog box class
00613             // as the dialog will now be destroyed
00614             OptionsTabs::pPrefsDlg = NULL;
00615             return OK;
00616         }
00617 
00618         // Allow the base class access to the message, it will do the
00619         // DLG_EAT_IF_HUNGRY(Msg) for us
00620         // Must do this before the Close and End
00621         Result = DialogTabOp::Message(Message);
00622 
00623         // Check if have been sending an init/create message and if so then set flag False.
00624         // Only do this in the init/create case as we might be sent one of these and then
00625         // be sent other messages whilst in the middle of the init/create message such as
00626         // text changing messages.
00627         if (Msg->DlgMsg == DIM_CREATE)
00628             OptionsTabs::SetInitMessageState(FALSE);                
00629 
00630         // The message was for our dialog box so return that we have handled it, if necessary
00631         //return (DLG_EAT_IF_HUNGRY(Msg)); 
00632         return Result;
00633     }
00634 
00635     // If nobody above has processed the message, then pass it around all the tabs in
00636     // case it's of use to them.
00637     OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
00638 
00639     while (pOptionsTabs != NULL)
00640     {
00641         pOptionsTabs->Message(Message);
00642         pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
00643     }
00644 
00645     return DialogTabOp::Message(Message);
00646 }

BOOL PrintPrefsDlg::RegisterYourPagesInOrderPlease  )  [virtual]
 

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.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
return TRUE if all calls to AddAPage returned TRUE, else FALSE
This function get's called directly from the Create method, Don't call it explicitly yourself. If you return FALSE from this method then the Create method will fail.

Returns:
Errors: -
See also:
DialogTabOp::AddAPage; DialogOp::Create

Reimplemented from DialogTabOp.

Definition at line 834 of file prnprefs.cpp.

00835 {
00836     BOOL ok = TRUE;
00837 
00838     // Now go through all the tabs declared to the system
00839     OptionsTabs *pOptionsTabs = OptionsTabs::GetFirst();
00840 
00841     while (pOptionsTabs != NULL)
00842     {
00843         // Only add the tab if it is a document based option
00844         if ( pOptionsTabs->IsPrintingOption() )
00845         {
00846             CDlgResID PageId = pOptionsTabs->GetPageID();
00847             ok = ok && AddAPage(PageId);
00848         }
00849 
00850         // Get the next option's tab.
00851         pOptionsTabs = OptionsTabs::GetNext(pOptionsTabs);
00852     }
00853 
00854     return (ok); 
00855 }

void PrintPrefsDlg::SetCurrentDlg PrintPrefsDlg pDlg  )  [static]
 

This sets the ptr to the currently created PrintPrefsDlg. There should only be one at a time, so if you set this value to a non-NULL value, and there's already one set, an ERROR3 will go off.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/2/96
Parameters:
pDlg = ptr to a PrintPrefsDlg [INPUTS]
- [OUTPUTS]
Returns:
-
NOTE: This should only be called from the constructors & destructors of the PrintPrefsDlg class

Returns:
Errors: -
See also:
PrintPrefsDlg::CloseCurrentDlg()

Definition at line 878 of file prnprefs.cpp.

00879 {
00880     ERROR3IF(pDlg != NULL && pCurrentDlg != NULL,"Setting current Dlg, but there's already one there");
00881     ERROR3IF(pDlg == NULL && pCurrentDlg == NULL,"Setting current Dlg to NULL, but there's no current dlg");
00882 
00883     pCurrentDlg = pDlg;
00884 }


Member Data Documentation

const CDlgResID PrintPrefsDlg::IDD = _R(IDD_DOCUMENTOPTIONS) [static, private]
 

Definition at line 161 of file prnprefs.h.

const CDlgMode PrintPrefsDlg::Mode = MODAL [static, private]
 

Definition at line 162 of file prnprefs.h.

BOOL PrintPrefsDlg::OkUsed = FALSE [static, private]
 

Definition at line 170 of file prnprefs.h.

BOOL PrintPrefsDlg::Open = FALSE [static, private]
 

Definition at line 171 of file prnprefs.h.

PrintPrefsDlg * PrintPrefsDlg::pCurrentDlg = NULL [static, private]
 

Definition at line 172 of file prnprefs.h.

String_256 PrintPrefsDlg::TitleString [private]
 

Definition at line 167 of file prnprefs.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:05 2007 for Camelot by  doxygen 1.4.4