LayerPropertyTabsDlg Class Reference

#include <layerprp.h>

Inheritance diagram for LayerPropertyTabsDlg:

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

Public Member Functions

 LayerPropertyTabsDlg ()
 LayerPropertyTabsDlg constructor. Creates a non-undoable operation.
 LayerPropertyTabsDlg (INT32 StartingPage)
 LayerPropertyTabsDlg constructor which allows a starting page to be specified. Creates a non-undoable operation.
 ~LayerPropertyTabsDlg ()
 LayerPropertyTabsDlg 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 layer properties 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.

Static Public Member Functions

static BOOL Init ()
 LayerPropertyTabsDlg Init method. Called when the kernel initialises.
static void Deinit ()
 LayerPropertyTabsDlg Deinit method. Called when the kernel deinitialises.
static OpState GetState (String_256 *, OpDescriptor *)
 LayerPropertyTabsDlg GetState method.
static LayerPropertyTabsGetLayerPropertiesTabs ()
 Allows somebody to get a Pointer to the layer property tabs handling class.

Static Public Attributes

static const CDlgResID IDD = _R(IDD_LAYERPROPERTIES)
static const CDlgMode Mode = MODELESS

Private Attributes

String_256 TitleString

Static Private Attributes

static LayerPropertyTabspLayerProperties = NULL

Detailed Description

Definition at line 144 of file layerprp.h.


Constructor & Destructor Documentation

LayerPropertyTabsDlg::LayerPropertyTabsDlg  ) 
 

LayerPropertyTabsDlg constructor. Creates a non-undoable operation.

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

Errors: -

See also:
-

Definition at line 187 of file layerprp.cpp.

00187                                           : DialogTabOp(LayerPropertyTabsDlg::IDD, LayerPropertyTabsDlg::Mode) 
00188 {
00189     // At present, just:- 
00190     if (pLayerProperties)
00191     {
00192         pLayerProperties->SetApplyNowState(FALSE);      // grey the apply now button
00193         pLayerProperties->SetInitMessageState(FALSE);   // not sending an init message
00194 
00195 
00196         // Set default units
00197         pLayerProperties->SetDefaultUnits();                // set up our default display units
00198 
00199         // Document and spread we are supposed to be working on. Of course none at present.
00200         pLayerProperties->pScopeDocument = NULL;            // Document in use when sending messages
00201         pLayerProperties->SetCurrentDocAndSpread(NULL);
00202     }
00203 }

LayerPropertyTabsDlg::LayerPropertyTabsDlg INT32  StartingPage  ) 
 

LayerPropertyTabsDlg constructor which allows a starting page to be specified. Creates a non-undoable operation.

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

Errors: -

See also:
-

Definition at line 222 of file layerprp.cpp.

00222                                                             : DialogTabOp(LayerPropertyTabsDlg::IDD, LayerPropertyTabsDlg::Mode,
00223                                                         CC_RUNTIME_CLASS(DialogOp), StartingPage) 
00224 {
00225     // At present, just:- 
00226     if (pLayerProperties)
00227     {
00228         pLayerProperties->SetApplyNowState(FALSE);      // grey the apply now button
00229         pLayerProperties->SetInitMessageState(FALSE);   // not sending an init message
00230 
00231 
00232         // Set default units
00233         pLayerProperties->SetDefaultUnits();                // set up our default display units
00234 
00235         // Document and spread we are supposed to be working on. Of course none at present.
00236         pLayerProperties->pScopeDocument = NULL;            // Document in use when sending messages
00237         pLayerProperties->SetCurrentDocAndSpread(NULL);
00238     }
00239 }

LayerPropertyTabsDlg::~LayerPropertyTabsDlg  ) 
 

LayerPropertyTabsDlg destructor.

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

Errors: -

See also:
-

Definition at line 257 of file layerprp.cpp.

00258 {
00259     // Make sure that we remove our options tabs link to the dialog box class
00260     // as the dialog will now be destroyed
00261     // At present, just:- 
00262     if (pLayerProperties)
00263     {
00264         pLayerProperties->SetTabbedDlg(NULL);
00265     }
00266 }


Member Function Documentation

BOOL LayerPropertyTabsDlg::CommitDialogValues  ) 
 

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:
28/9/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if values in dialog box ok, False otherwise.

Errors: -

See also:
-

Definition at line 284 of file layerprp.cpp.

00285 {
00286     // Ok has been pressed so take the values from the dialog box
00287     BOOL ok = TRUE;
00288     BOOL ValuesOk = TRUE;
00289 
00290     // Make sure that we have set up our class variables so that the tabs know what
00291     // is the current document and spread to work on.
00292     Document *pDocument = Document::GetSelected();
00293     pLayerProperties->SetCurrentDocAndSpread(pDocument);
00294     // Plus the current document units are correct
00295     pLayerProperties->SetUpDocUnits();
00296 
00297     // Go through all the tabs declared to the system in turn
00298     // and tell them to commit the values for their tab
00299     LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00300 
00301     while (pLayerPropertyTabs != NULL)
00302     {
00303         // Only get the tab to commit if it is in use
00304         if ( pLayerPropertyTabs->IsPropertyRequired() )
00305         {
00306             // Get the found page to commit its values.
00307             // Should return False if reported error and we should just fail.
00308             //               2 if set an error which we should report and then fail. 
00309             ok = pLayerPropertyTabs->CommitSection();
00310             if ( ok != TRUE)
00311             {
00312                 if (ok == 2)
00313                     InformError();          // If error required show it.
00314 
00315                 // Carry on with other pages so that report all errors and have a chance
00316                 // to correct mistakes in other pages but make note of error state.
00317                 ValuesOk = FALSE;   
00318             }
00319         }
00320         // Get the next option's tab.
00321         pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00322     }
00323 
00324     // Return whether we found bad values or not.
00325     return ValuesOk;
00326 }

void LayerPropertyTabsDlg::Deinit void   )  [static]
 

LayerPropertyTabsDlg Deinit method. Called when the kernel deinitialises.

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

Errors: -

See also:
-

Definition at line 1010 of file layerprp.cpp.

01011 {
01012     // Remove any options tabs that have been declared to the system.
01013     LayerPropertyTabs::DeinitLayerPropertyTabs();   
01014     pLayerProperties = NULL;
01015 }

void LayerPropertyTabsDlg::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:
28/9/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 1034 of file layerprp.cpp.

01035 {
01036     BOOL ok;
01037 
01038 //  if (LayerPropertyTabs::pPropertiesDlg != NULL)
01039 //  {
01040 //      ERROR3("LayerPropertyTabsDlg::Do an options tabbed dialog box is already present");
01041 //      return;
01042 //  }
01043 
01044     if (pLayerProperties == NULL)
01045     {
01046         // Could not create the dialog box so call inform error 
01047         ERROR3("LayerPropertyTabsDlg::Do no LayerProperty present");
01048         //InformError();                        // Show user the error
01049         End();                              // End the operation 
01050     }
01051 
01052     // Set up the name that the main dialog page is going to use
01053     String_256 Temp(_R(IDN_LAYERPROPERTYTAB)); 
01054     TitleString = Temp;
01055     SetName(&TitleString);
01056     
01057     // Make sure that our options tabs have a link to the dialog box class
01058     LayerPropertyTabs::SetTabbedDlg(this);
01059     pLayerProperties->SetApplyNowState(FALSE);
01060 
01061     // Make sure that we have set up our class variables so that the tabs know what
01062     // is the current document and spread to work on.
01063     Document *pDocument = Document::GetSelected();
01064     pLayerProperties->SetCurrentDocAndSpread(pDocument);
01065         
01066     // Force the dialog box to be created, as it is non-modal it must be opened if the create
01067     // works ok.
01068     ok = Create();                          // create the dialog box
01069 
01070     if ( ok )
01071     {
01072         // Modal at present so remove the Open()
01073         Open();                             // created ok so open the dialog box up
01074         
01075         // grey out the apply now button as this should only become enabled when we have 
01076         // made a change to the dialog box.
01077         pLayerProperties->SetInitMessageState(FALSE);
01078         pLayerProperties->SetApplyNowState(FALSE);
01079         pLayerProperties->GreyApplyNow();
01080     }
01081     else
01082     {
01083         // Could not create the dialog box so call inform error 
01084         InformError();                      // Show user the error
01085         End();                              // End the operation 
01086     }                   
01087 }

LayerPropertyTabs * LayerPropertyTabsDlg::GetLayerPropertiesTabs  )  [static]
 

Allows somebody to get a Pointer to the layer property tabs handling class.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
04/12/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Pointer to the layer property tabs handling class, if any.

Errors: -

See also:
-

Definition at line 1151 of file layerprp.cpp.

01152 {
01153     return pLayerProperties;
01154 }

OpState LayerPropertyTabsDlg::GetState String_256 ,
OpDescriptor
[static]
 

LayerPropertyTabsDlg GetState method.

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

Errors: -

See also:
-

Definition at line 891 of file layerprp.cpp.

00892 {    
00893     OpState OpSt;
00894 
00895     // If the pointer is non-null then it implies that another dialog box is up which
00896     // uses our tab set and so we must force greying of the menu option 
00897     if (pLayerProperties && pLayerProperties->GetTabbedDlg() != NULL)
00898         OpSt.Greyed = TRUE;
00899 
00900     return(OpSt);
00901 }

BOOL LayerPropertyTabsDlg::Init void   )  [static]
 

LayerPropertyTabsDlg Init method. Called when the kernel initialises.

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

Errors: -

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 921 of file layerprp.cpp.

00922 {
00923     BOOL InitOK;
00924 
00925     // Now register ourselves with the dialog system
00926     InitOK = RegisterOpDescriptor(
00927                                 0,                              // Tool ID 
00928                                 _R(IDS_LAYERPROPERTYTABDLG),        // String resource ID
00929                                 CC_RUNTIME_CLASS(LayerPropertyTabsDlg), // Runtime class
00930                                 OPTOKEN_LAYERPROPERTYTABS,      // Token string
00931                                 GetState,                       // GetState function
00932                                 0,                              // help ID
00933                                 _R(IDBBL_LAYERPROPERTYTAB),         // bubble help
00934                                 0, //_R(IDD_BARCONTROLSTORE),           // resource ID
00935                                 0, //_R(IDC_BTN_OPTIONSDLG),                // control ID
00936                                 SYSTEMBAR_ILLEGAL,              // Bar ID
00937                                 TRUE,                           // Recieve system messages
00938                                 FALSE,                          // Smart duplicate operation
00939                                 TRUE,                           // Clean operation
00940                                 0,                              // No vertical counterpart
00941                                 _R(IDS_LAYERPROPERTYTABDLG_ONE),    // String for one copy only error
00942                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00943                                 );
00944 
00945     // Now register ourselves with the dialog system for the units button on the windows
00946     // button bar as well
00947     InitOK = InitOK && RegisterOpDescriptor(
00948                                 0,                              // Tool ID
00949                                 _R(IDS_LAYERPROPERTIESDLG),         // String resource ID
00950                                 CC_RUNTIME_CLASS(LayerPropertiesDlg),   // Runtime class
00951                                 OPTOKEN_LAYERPROPERTIESDLG,     // Token string
00952                                 GetState,                       // GetState function
00953                                 0,                              // help ID
00954                                 _R(IDBBL_LAYERPROPERTIESDLG),       // bubble help
00955                                 0, //_R(IDD_BARCONTROLSTORE),           // resource ID
00956                                 0, //_R(IDC_BTN_UNITSETUPDLG),          // control ID
00957                                 SYSTEMBAR_ILLEGAL,              // Bar ID
00958                                 TRUE,                           // Receive messages
00959                                 FALSE,                          // Smart duplicate operation
00960                                 TRUE,                           // Clean operation
00961                                 NULL,                           // No vertical counterpart
00962                                 _R(IDS_LAYERPROPERTIESDLG_ONE),     // String for one copy only error
00963                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags                               );
00964                                 );
00965 
00966     // Now register ourselves with the dialog system for the units button on the windows
00967     // button bar as well
00968     InitOK = InitOK && RegisterOpDescriptor(
00969                                 0,                              // Tool ID
00970                                 _R(IDS_GUIDEPROPERTIESDLG),         // String resource ID
00971                                 CC_RUNTIME_CLASS(GuidePropertiesDlg),   // Runtime class
00972                                 OPTOKEN_GUIDEPROPERTIESDLG,     // Token string
00973                                 GetState,                       // GetState function
00974                                 0,                              // help ID
00975                                 _R(IDBBL_GUIDEPROPERTIESDLG),       // bubble help
00976                                 0, //_R(IDD_BARCONTROLSTORE),           // resource ID
00977                                 0, //_R(IDC_BTN_UNITSETUPDLG),          // control ID
00978                                 SYSTEMBAR_ILLEGAL,              // Bar ID
00979                                 TRUE,                           // Receive messages
00980                                 FALSE,                          // Smart duplicate operation
00981                                 TRUE,                           // Clean operation
00982                                 NULL,                           // No vertical counterpart
00983                                 _R(IDS_GUIDEPROPERTIESDLG_ONE),     // String for one copy only error
00984                                 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags                               );
00985                                 );
00986 
00987     // Set up any layer property tabs that are required and get our link to them
00988     InitOK = InitOK && LayerPropertyTabs::InitLayerPropertyTabs();  
00989     pLayerProperties = LayerPropertyTabs::GetFirst();
00990 
00991     return (InitOK);
00992 }

MsgResult LayerPropertyTabsDlg::Message Msg Message  )  [virtual]
 

Handles all the layer properties dialog's messages.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/9/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 352 of file layerprp.cpp.

00353 {
00354     ERROR3IF(Message == NULL,"LayerPropertyTabsDlg::Message null message received");
00355     ERROR3IF(pLayerProperties == NULL,"LayerPropertyTabsDlg::Message no pLayerProperties pointer");
00356     
00357     // Cope with document changing messages so that if all documents are closed then
00358     // we take some remedial action such as greying all controls. 
00359     if (MESSAGE_IS_A(Message, DocChangingMsg))
00360     {
00361         DocChangingMsg *TheMsg = (DocChangingMsg *) Message;
00362 
00363         switch ( TheMsg->State )
00364         {
00365 //          case DocChangingMsg::TITLECHANGED:
00366             case DocChangingMsg::SELCHANGED:
00367             {
00368                 // In the different cases there are different document pointers that
00369                 // we must use.
00370                 Document *pDocument = NULL;
00371                 if (TheMsg->State == DocChangingMsg::TITLECHANGED)
00372                 {
00373                     // Document title has changed message.
00374                     pDocument = TheMsg->pChangingDoc;
00375                 }
00376                 else
00377                 {
00378                     // Document selection changed.
00379                     pDocument = TheMsg->pNewDoc;
00380                 }
00381                             
00382                 // Make sure that we have set up our class variables so that the 
00383                 // tabs know what is the current document and spread to work on.
00384                 pLayerProperties->SetCurrentDocAndSpread(pDocument);
00385                 // Plus the current document units are correct
00386                 pLayerProperties->SetUpDocUnits();
00387 
00388                 // Is the new one null ==> no new document
00389                 if (pDocument == NULL)
00390                 {
00391                     // Now go through all the tabs declared to the system
00392                     // And call a function to get them to update themselves.
00393                     LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00394 
00395                     while (pLayerPropertyTabs != NULL)
00396                     {
00397                         // Only get the tab to update if it is in use
00398                         if ( pLayerPropertyTabs->IsPropertyRequired() )
00399                         {
00400                             // Get that tab to update itself.
00401                             pLayerPropertyTabs->GreySection();
00402                         }
00403 
00404                         // Get the next option's tab.
00405                         pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00406                     }
00407                 }
00408                 else
00409                 {
00410                     // Now go through all the tabs declared to the system
00411                     // And call a function to get them to update themselves.
00412                     LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00413 
00414                     while (pLayerPropertyTabs != NULL)
00415                     {
00416                         // Only get the tab to update if it is in use
00417                         if ( pLayerPropertyTabs->IsPropertyRequired() )
00418                         {
00419                             // Get that tab to update itself.
00420                             pLayerPropertyTabs->UngreySection();
00421                         }
00422                         // Get the next option's tab.
00423                         pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00424                     }
00425                 }
00426             }
00427             break;
00428             
00429             // This message is sent when a new or just opened document is stable.
00430             // Selection messages no good as the template document is loaded into
00431             // the same document and hence the selected document/spread/view does
00432             // not change and so we do not get the last update.
00433             // Could cache all messages from BORN to this and only update on this.
00434             case DocChangingMsg::BORNANDSTABLE:
00435             {
00436                 // In the different cases there are different document pointers that
00437                 // we must use, in this case the changing doc is relevent.
00438                 Document *pDocument = NULL;
00439                 pDocument = TheMsg->pChangingDoc;
00440                 if (pDocument != NULL)
00441                 {
00442                     // Now go through all the tabs declared to the system
00443                     // And call a function to get them to update themselves.
00444                     // Work out the document name and pass this to the tab so that it has
00445                     // chance to fill in its info field ok.
00446                     pLayerProperties->SetCurrentDocAndSpread(pDocument);
00447 
00448                     LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00449 
00450                     while (pLayerPropertyTabs != NULL)
00451                     {
00452                         // Only get the tab to update if it is in use
00453                         if ( pLayerPropertyTabs->IsPropertyRequired() )
00454                         {
00455                             // Get that tab to update itself.
00456                             pLayerPropertyTabs->UpdateSection();
00457                         }
00458 
00459                         // Get the next option's tab.
00460                         pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00461                     }
00462                 }
00463             }
00464             break;
00465             default:
00466                 break;
00467         }
00468     }
00469 
00470 
00471     // Cope with document view changing messages so that we allow all the tabs to update
00472     // themselves when switching to a new view.
00473     // Unfortunately, at present if we sit on the DocView changing message and wait for
00474     // a selection then at this point there is NO SELECTED spread and so things will fail.
00475     // Therefore, wait for a selected spread message  
00476     if (MESSAGE_IS_A(Message, DocViewMsg))
00477     {
00478         DocViewMsg *TheMsg = (DocViewMsg *) Message;
00479 
00480         switch ( TheMsg->State )
00481         {
00482             case DocViewMsg::SELCHANGED:
00483             {
00484                 if (TheMsg->pNewDocView != NULL)
00485                 {
00486                     // Now go through all the tabs declared to the system
00487                     // And call a function to get them to update themselves.
00488                     // Work out the document name and pass this to the tab so that it has
00489                     // chance to fill in its info field ok.
00490                     Document *pDocument = TheMsg->pNewDocView->GetDoc();
00491                     pLayerProperties->SetCurrentDocAndSpread(pDocument);
00492 
00493                     LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00494 
00495                     while (pLayerPropertyTabs != NULL)
00496                     {
00497                         // Only get the tab to update if it is in use
00498                         if ( pLayerPropertyTabs->IsPropertyRequired() )
00499                         {
00500                             // Get that tab to update itself.
00501                             pLayerPropertyTabs->UpdateSection();
00502                         }
00503 
00504                         // Get the next option's tab.
00505                         pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00506                     }
00507                 }
00508             }
00509             break;
00510             default:
00511                 break;
00512         }
00513     }
00514 
00515     // Cope with document view changing messages so that we allow all the tabs to update
00516     // themselves when switching to a new view.
00517     // Unfortunately, at present if we sit on the DocView changing message and wait for
00518     // a selection then at this point there is NO SELECTED spread and so things will fail.
00519     // Therefore, wait for a selected spread message  
00520     if (MESSAGE_IS_A(Message, SpreadMsg))
00521     {
00522         SpreadMsg *TheMsg = (SpreadMsg *) Message;
00523 
00524         switch ( TheMsg->Reason )
00525         {
00526             // The selected spread has changed
00527             case SpreadMsg::SELCHANGED:
00528             {
00529                 // pOldSpread = ptr to the old selected spread
00530                 // pNewSpread = ptr to the new selected spread
00531                 if (TheMsg->pNewSpread != NULL)
00532                 {
00533                     // Now go through all the tabs declared to the system
00534                     // And call a function to get them to update themselves.
00535                     // Work out the document name and pass this to the tab so that it has
00536                     // chance to fill in its info field ok.
00537                     Document *pDocument = (Document *)TheMsg->pNewSpread->FindOwnerDoc();
00538                     pLayerProperties->SetCurrentDocAndSpread(pDocument);
00539 
00540                     LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00541 
00542                     while (pLayerPropertyTabs != NULL)
00543                     {
00544                         // Only get the tab to update if it is in use
00545                         if ( pLayerPropertyTabs->IsPropertyRequired() )
00546                         {
00547                             // Get that tab to update itself.
00548                             pLayerPropertyTabs->UpdateLayerSection();
00549                         }
00550 
00551                         // Get the next option's tab.
00552                         pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00553                     }
00554                 }
00555             }
00556             break;
00557 
00558 /*          // The layers of a spread have changed.
00559             case SpreadMsg::LAYERCHANGES:
00560             {
00561                 // pOldSpread = pNewSpread = spread whose layers have changed
00562                 if (TheMsg->pNewSpread != NULL)
00563                 {
00564                     // Now go through all the tabs declared to the system
00565                     // And call a function to get them to update themselves.
00566                     // Work out the document name and pass this to the tab so that it has
00567                     // chance to fill in its info field ok.
00568                     Document *pDocument = (Document *)TheMsg->pNewSpread->FindOwnerDoc();
00569                     PropertyTabs::SetCurrentDocAndSpread(pDocument);
00570 
00571                     LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00572 
00573                     while (pLayerPropertyTabs != NULL)
00574                     {
00575                         // Only get the tab to update if it is in use
00576                         if ( pLayerPropertyTabs->IsPropertyRequired() )
00577                         {
00578                             // Get that tab to update itself.
00579                             pLayerPropertyTabs->UpdateLayerSection();
00580                         }
00581 
00582                         // Get the next option's tab.
00583                         pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00584                     }
00585                 }
00586             }
00587             break;
00588 */
00589             default:
00590                 break;
00591         }
00592     }
00593 
00594     // Copes with a layer changing method
00595     if (MESSAGE_IS_A(Message, LayerMsg))
00596     {
00597         LayerMsg *TheMsg = (LayerMsg *) Message;
00598 
00599         switch ( TheMsg->Reason )
00600         {
00601             // The active layer has changed.
00602             case LayerMsg::ACTIVE_LAYER_CHANGED:
00603             {
00604                 if (TheMsg->pNewLayer != NULL)
00605                 {
00606                     // Now go through all the tabs declared to the system
00607                     // And call a function to get them to update themselves.
00608                     pLayerProperties->SetActiveLayer(TheMsg->pNewLayer);
00609 
00610                     LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00611 
00612                     while (pLayerPropertyTabs != NULL)
00613                     {
00614                         // Only get the tab to update if it is in use
00615                         if ( pLayerPropertyTabs->IsPropertyRequired() )
00616                         {
00617                             // Get that tab to update itself.
00618                             pLayerPropertyTabs->UpdateLayerSection();
00619                         }
00620 
00621                         // Get the next option's tab.
00622                         pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00623                     }
00624                 }
00625             }
00626             break;
00627 
00628             case LayerMsg::GUIDELINES_CHANGED:
00629             {
00630                 // Only pass on if the layer that's changed is the same as the layer we consider
00631                 // to be the active layer.
00632                 if (TheMsg->pNewLayer == pLayerProperties->GetGuideLayer())
00633                 {
00634                     LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00635 
00636                     while (pLayerPropertyTabs != NULL)
00637                     {
00638                         // Only get the tab to update if it is in use
00639                         if ( pLayerPropertyTabs->IsPropertyRequired() )
00640                         {
00641                             // Get that tab to update itself.
00642                             pLayerPropertyTabs->UpdateGuidelineSection();
00643                         }
00644 
00645                         // Get the next option's tab.
00646                         pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00647                     }
00648                 }
00649             }
00650             break;
00651             default:
00652                 break;
00653         }
00654     }
00655 
00656     // Cope with a new units messages so that we give the options tabs a chance to
00657     // update themselves to display using the newly specified defaults.
00658     if (MESSAGE_IS_A(Message, OptionsChangingMsg))
00659     {
00660         OptionsChangingMsg *TheMsg = (OptionsChangingMsg *) Message;
00661 
00662         // Make sure that we have set up our class variables so that the tabs know what
00663         // is the current document and spread to work on.
00664         Document *pDocument = Document::GetSelected();
00665         pLayerProperties->SetCurrentDocAndSpread(pDocument);
00666         // Plus the current document units are correct
00667         pLayerProperties->SetUpDocUnits();
00668 
00669         switch ( TheMsg->State )
00670         {
00671             case OptionsChangingMsg::NEWUNITS:
00672             {
00673                 // Current display units may have changed changed so may need to update
00674                 // any display fields on other tabs which are using units. 
00675                 // Now go through all the tabs declared to the system
00676                 // And call a function to get them to update themselves.
00677                 LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00678 
00679                 while (pLayerPropertyTabs != NULL)
00680                 {
00681                     // Only get the tab to update if it is in use
00682                     if ( pLayerPropertyTabs->IsPropertyRequired() )
00683                     {
00684                         // Get that tab to update itself.
00685                         pLayerPropertyTabs->NewUnitsInSection();
00686                     }
00687 
00688                     // Get the next option's tab.
00689                     pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00690                 }
00691                 break;
00692             }
00693             default:
00694                 break;
00695         }
00696     }
00697 
00698     
00699     // Cope with messages for the dialog box
00700     if (IS_OUR_DIALOG_MSG(Message))
00701     {
00702         DialogMsg* Msg = (DialogMsg*)Message;
00703 
00704         MsgResult Result;
00705 
00706         // Main handler for dialog type messages
00707         BOOL EndDialog = FALSE;                     // TRUE if we should quit the dialog
00708         BOOL CommitValues = FALSE;                  // TRUE if we should commit the dialog values
00709         BOOL OldApplyNow = pLayerProperties->GetApplyNowState();    // Old ApplyNow button state  
00710 
00711         // Make sure that we have set up our class variables so that the tabs know what
00712         // is the current document and spread to work on.
00713         Document *pDocument = Document::GetSelected();
00714         pLayerProperties->SetCurrentDocAndSpread(pDocument);
00715         // Plus the current document units are correct
00716         pLayerProperties->SetUpDocUnits();
00717         
00718         // Check if sending init/create message and if so set flag True.
00719         // If True then do not ungrey the ApplyNow button on changing messages
00720         if (Msg->DlgMsg == DIM_CREATE)
00721             pLayerProperties->SetInitMessageState(TRUE);                
00722         
00723         // If the message is not for the main options window then try the tab pages 
00724         BOOL FoundPage = FALSE;
00725         if (Msg->PageID != 0)
00726         {
00727             // Now go through all the tabs declared to the system
00728             // And see if the message is for that page or not.
00729             LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00730 
00731             while (pLayerPropertyTabs != NULL && !FoundPage)
00732             {
00733                 CDlgResID PageId = pLayerPropertyTabs->GetPageID();
00734                 if (PageId == Msg->PageID)
00735                 {
00736                     // Found the correct page so stop the search and send the message
00737                     // to that page
00738                     pLayerPropertyTabs->HandleMsg(Msg);
00739                     FoundPage = TRUE;
00740                 }
00741                 // Get the next option's tab.
00742                 pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00743             }
00744         }
00745         else
00746         {
00747             // Main page window
00748             switch (Msg->DlgMsg)
00749             {
00750 //              case DIM_CREATE:        // Creating the main dialog box
00751                     // grey out the apply now button as this should only become enabled when 
00752                     // we have made a change to the dialog box.
00753 //                  pLayerProperties->SetInitMessageState(FALSE);
00754 //                  pLayerProperties->SetApplyNowState(FALSE);
00755 //                  pLayerProperties->GreyApplyNow();
00756 //                  break;
00757                 
00758                 case DIM_COMMIT:        // Want to commit and quit
00759                     EndDialog = TRUE;
00760                     CommitValues = TRUE;
00761                     break;
00762 
00763                 case DIM_SOFT_COMMIT:   // Want to commit
00764                     CommitValues = TRUE;
00765                     break;
00766 
00767                 case DIM_CANCEL:        // Want to quit
00768                     EndDialog = TRUE;
00769                     break;
00770 
00771                 default:
00772                     break;
00773             }
00774         }
00775 
00776         // Commit values here
00777         if (CommitValues)
00778         {
00779             BOOL ok = CommitDialogValues();
00780             // Only unset EndDialog as in SOFT_COMMIT case we do not want to end the
00781             // Operation and hence close the dialog box
00782             if (!ok)
00783             {
00784                 EndDialog = FALSE;  // Values not correct so do not allow exit
00785             }
00786         }
00787 
00788         if ( !OldApplyNow && pLayerProperties->GetApplyNowState()
00789              && !EndDialog && !pLayerProperties->GetInitMessageState() )
00790         {
00791             // Check for a change from apply now being False to it becoming
00792             // True as an item has been changed.
00793             pLayerProperties->UngreyApplyNow();
00794         }
00795 
00796         if ( pLayerProperties->GetApplyNowState() && (Msg->DlgMsg == DIM_SOFT_COMMIT)
00797              && !EndDialog && !pLayerProperties->GetInitMessageState() )
00798         {
00799             // Check for an apply now (DIM_SOFT_COMMIT) being used and the
00800             // apply being True, should always be the case, so that we can reset
00801             // the grey state to False as we are in an unchanged state.
00802             pLayerProperties->SetApplyNowState(FALSE);
00803             pLayerProperties->GreyApplyNow();
00804         }
00805 
00806         // Allow the base class access to the message, it will do the
00807         // DLG_EAT_IF_HUNGRY(Msg) for us
00808 
00809         // Must do this before the Close and End
00810         Result = DialogTabOp::Message(Message);
00811 
00812         // End dialog here
00813         if (EndDialog) 
00814         {
00815             // Make sure that we remove our options tabs link to the dialog box class
00816             // as the dialog will now be destroyed
00817             pLayerProperties->SetTabbedDlg(NULL);
00818         }
00819         
00820         // Check if have been sending an init/create message and if so then set flag False.
00821         // Only do this in the init/create case as we might be sent one of these and then
00822         // be sent other messages whilst in the middle of the init/create message such as
00823         // text changing messages.
00824         if (Msg->DlgMsg == DIM_CREATE)
00825             pLayerProperties->SetInitMessageState(FALSE);               
00826         
00827         // The message was for our dialog box so return that we have handled it, if necessary
00828         //return (DLG_EAT_IF_HUNGRY(Msg)); 
00829         return Result;
00830     }
00831 
00832     if (MESSAGE_IS_A(Message, ColourChangingMsg))
00833     {
00834         ColourChangingMsg *Msg = (ColourChangingMsg *) Message;
00835         BOOL CallColourListChanged = FALSE;
00836         Document* pDoc = NULL;
00837 
00838         switch ( Msg->State )
00839         {
00840             case ColourChangingMsg::LISTDESELECTED:
00841                 pDoc = NULL;
00842                 CallColourListChanged = TRUE;
00843                 break;
00844 
00845             case ColourChangingMsg::LISTPAGED:
00846             case ColourChangingMsg::LISTUPDATED:
00847             case ColourChangingMsg::COLOURUPDATED:
00848             case ColourChangingMsg::COLOURUPDATEDINVISIBLE:
00849                 pDoc = Msg->ScopeDoc;
00850                 CallColourListChanged = TRUE;
00851                 break;
00852             default:
00853                 break;
00854         }
00855 
00856         // Call the ColourListChanged() func is the colour list has changed
00857         if (CallColourListChanged)
00858         {
00859             LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
00860 
00861             while (pLayerPropertyTabs != NULL)
00862             {
00863                 // Only get the tab to update if it is in use
00864                 if ( pLayerPropertyTabs->IsPropertyRequired() )
00865                     pLayerPropertyTabs->ColourListChanged(pDoc);
00866 
00867                 // Get the next option's tab.
00868                 pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
00869             }
00870         }
00871     }
00872 
00873     return DialogTabOp::Message(Message);
00874 }

BOOL LayerPropertyTabsDlg::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:
28/9/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 1113 of file layerprp.cpp.

01114 {
01115     BOOL ok = TRUE;
01116 
01117     // Now go through all the tabs declared to the system
01118     LayerPropertyTabs *pLayerPropertyTabs = LayerPropertyTabs::GetFirst();
01119 
01120     while (pLayerPropertyTabs != NULL)
01121     {
01122         // Only add the tab if it is a program based option
01123         if ( pLayerPropertyTabs->IsPropertyRequired() )
01124         {
01125             CDlgResID PageId = pLayerPropertyTabs->GetPageID();
01126             ok = ok && AddAPage(PageId);
01127         }
01128 
01129         // Get the next option's tab.
01130         pLayerPropertyTabs = LayerPropertyTabs::GetNext(pLayerPropertyTabs);
01131     }
01132 
01133     return (ok); 
01134 }


Member Data Documentation

const CDlgResID LayerPropertyTabsDlg::IDD = _R(IDD_LAYERPROPERTIES) [static]
 

Definition at line 166 of file layerprp.h.

const CDlgMode LayerPropertyTabsDlg::Mode = MODELESS [static]
 

Definition at line 167 of file layerprp.h.

LayerPropertyTabs * LayerPropertyTabsDlg::pLayerProperties = NULL [static, private]
 

Definition at line 178 of file layerprp.h.

String_256 LayerPropertyTabsDlg::TitleString [private]
 

Definition at line 176 of file layerprp.h.


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