UnitsTab Class Reference

Allows the user to define the default units that are used for displaying size information, font size information and general display information. Also, alllows them to define their own units and edit the scaling factor applied to the spread, layer, or whatever. Based on the old UnitsDlg code. More...

#include <optsunit.h>

Inheritance diagram for UnitsTab:

OptionsTabs ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 UnitsTab ()
 UnitsTab constructor. Creates a non-undoable operation.
 ~UnitsTab ()
 UnitsTab destructor.
virtual BOOL Init ()
 UnitsTab initialisation routine.
virtual BOOL HandleMsg (DialogMsg *Msg)
 Handles all the units options tabs messages.
virtual BOOL InitSection ()
 Sets initial values for the Units section of the options dialog box. This section includes the:-.
virtual BOOL CommitSection ()
 Takes the values in the Units section tab of the options dialog box and sets the associated preference values accordingly Called when ok is pressed on the dialog box.
virtual BOOL GreySection ()
 Called when the user has closed all documents.
virtual BOOL UngreySection ()
 Called when the user has selected a new document.
BOOL ChangeControlStatus (const BOOL Status)
 Called to grey/ungrey all controls on this tab.
virtual BOOL UpdateSection (String_256 *DocumentName)
 Called when we have switched to a new document and need to update all the controls on this tab. Should only init the tab if the page is present. The document name allows the info field on the tab to be filled in correctly.
virtual CDlgResID GetPageID ()
 Allows the options dialog code to determine the dialog ID of this section.
virtual BOOL IsDocumentOption ()
 Allows the document options dialog code to determine if this tab belongs to the group of document options.
virtual BOOL IsProgramOption ()
 Allows the program options dialog code to determine if this tab belongs to the group of program options.

Static Public Member Functions

static ScaleUnitGetColourUnitPreference ()
 Retrieves the user's Colour Unit preference to be used by the Colour Editor If no preference is found StandardUnit::UnitPercent is the default Scope: static.

Protected Member Functions

BOOL CommitDialogValues ()
 Takes the values in the dialog. Called when the OK button is selected.
BOOL SelectCurrentUserUnit ()
 Make sure that the current user unit, if any, is selected and hence shown as selected in the user units list.
BOOL InitControls ()
 Inits all the controls in the dialog Called immediately after the bar is created to init drop lists, grey out gadgets, etc.
BOOL InitUnitListControls ()
 Fills in all the drop lists and combo boxes of units with the ones in the document.
BOOL EnableControls ()
 Enables or disables the controls depending on the current context, i.e. the controls are disabled if there is no selection, etc.
void SetUnitToken (CGadgetID ID, UnitType ThisUnitType, INT32 Index=-1, BOOL EndOfList=FALSE)
 Readable function for putting unit token strings in controls.
void ShowUnitDetails (CGadgetID ID, UnitType ThisUnitType, INT32 Index=-1, BOOL EndOfList=FALSE)
 Shows the summary of the details of the specified unit for putting user unit token strings in the scrollable details list.
BOOL UpdateUnitListControls ()
 Updates the new name name of the currently selected user unit, if any in all of the lists.
BOOL CreateNewUnit ()
 Creates a new user unit that the user has just requested.
BOOL DeleteUnit ()
 Deletes the currently selected user unit.
BOOL ShowUnitProperties ()
 Shows the current properties of the selected user unit.

Protected Attributes

ScaleUnitm_pOldColourUnit
RadioGroup m_ColourUnitRadioGroup

Private Attributes

DocUnitListpDocUnitList
UnitType CurrentUserUnitType
BOOL GreyStatus
UnitType OldPageUnits
UnitType OldFontUnits

Detailed Description

Allows the user to define the default units that are used for displaying size information, font size information and general display information. Also, alllows them to define their own units and edit the scaling factor applied to the spread, layer, or whatever. Based on the old UnitsDlg code.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/12/94
See also:
UnitsDlg;

OptionsTabs; AppPrefsDlg; DocPrefsDlg;

Definition at line 126 of file optsunit.h.


Constructor & Destructor Documentation

UnitsTab::UnitsTab  ) 
 

UnitsTab constructor. Creates a non-undoable operation.

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

Errors: -

See also:
-

Definition at line 168 of file optsunit.cpp.

00169 {   
00170     // Do nothing at present
00171 }        

UnitsTab::~UnitsTab  ) 
 

UnitsTab destructor.

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

Errors: -

See also:
-

Definition at line 189 of file optsunit.cpp.

00190 {   
00191 }        


Member Function Documentation

BOOL UnitsTab::ChangeControlStatus const BOOL  Status  ) 
 

Called to grey/ungrey all controls on this tab.

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

Errors: -

See also:
UnitsTab::GreySection; UnitsTab::UngreySection;

Definition at line 429 of file optsunit.cpp.

00430 {
00431     // Main units section
00432     pPrefsDlg->EnableGadget(_R(IDC_OPTS_INFO), Status);
00433 
00434     pPrefsDlg->EnableGadget(_R(IDC_OPTS_UNITSGROUP),    Status);
00435     pPrefsDlg->EnableGadget(_R(IDC_OPTS_PAGEUNITSTXT),  Status);
00436 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEDUNITSTXT),Status);
00437     pPrefsDlg->EnableGadget(_R(IDC_OPTS_FONTUNITSTXT),  Status);
00438     pPrefsDlg->EnableGadget(_R(IDC_OPTS_PAGEUNITS),     Status);
00439 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEDUNITS),   Status);
00440     pPrefsDlg->EnableGadget(_R(IDC_OPTS_FONTUNITS),     Status);
00441 
00442     pPrefsDlg->EnableGadget(_R(IDC_OPTS_CLR_UNIT_USE_PERCENT),  Status);
00443     pPrefsDlg->EnableGadget(_R(IDC_OPTS_CLR_UNIT_USE_BYTE),     Status);
00444     
00445     // Buttons in the user units section
00446     pPrefsDlg->EnableGadget(_R(IDC_OPTS_NEWUNIT),       Status);
00447     pPrefsDlg->EnableGadget(_R(IDC_OPTS_DELETEUNIT),    Status);
00448     pPrefsDlg->EnableGadget(_R(IDC_OPTS_UNITPROPERTY),  Status);
00449 
00450     return TRUE;
00451 }           

BOOL UnitsTab::CommitDialogValues  )  [protected]
 

Takes the values in the dialog. Called when the OK button is selected.

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

Errors: -

See also:
-

Definition at line 575 of file optsunit.cpp.

00576 {
00577     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::CommitDialogValues called with no dialog pointer");
00578     ERROR2IF(pDocUnitList == NULL,FALSE,"UnitsTab::HandleMsg called with no doc unit list");
00579 
00580 
00581     // ****
00582     // All of the user units are handled as immediate edits and so no extra actions
00583     // are required.
00584 
00585     // ****
00586     // Now update the defaults units that may have been choosen by the user
00587 
00588     // Set up the units with useful defaults, just in case
00589     UnitType PageUnitType = MILLIMETRES;
00590     //UnitType ScaledUnitType = AUTOMATIC;
00591     UnitType FontUnitType = COMP_POINTS;
00592     WORD Index;
00593 
00594     // Work out which page units menu item is selected and then work out the unit type
00595     pPrefsDlg->GetValueIndex(_R(IDC_OPTS_PAGEUNITS), &Index);
00596     Unit *pPageUnit = pDocUnitList->FindUnit(Index);
00597     if (pPageUnit)
00598         PageUnitType = pPageUnit->GetUnitType();
00599     
00600     pPrefsDlg->GetValueIndex(_R(IDC_OPTS_FONTUNITS),  &Index);
00601     Unit *pFontUnit = pDocUnitList->FindUnit(Index);
00602     if (pFontUnit)
00603         FontUnitType = pFontUnit->GetUnitType();
00604 
00605 //  pPrefsDlg->GetValueIndex(_R(IDC_OPTS_SCALEDUNITS), &Index);
00606 //  if (Index <= 0)
00607 //      ScaledUnitType = AUTOMATIC;
00608 //  else
00609 //  {
00610 //      // Remove the automatic units from the calculation
00611 //      Unit *pScaleUnit = pDocUnitList->FindUnit(Index - 1);
00612 //      if (pScaleUnit)
00613 //          ScaledUnitType = pScaleUnit->GetUnitType();
00614 //  }
00615 
00616     if (pDocUnitList != NULL)
00617     {
00618         pDocUnitList->SetPageUnits(PageUnitType);
00619         //pDocUnitList->SetScaleUnits(ScaledUnitType);
00620         pDocUnitList->SetFontUnits(FontUnitType);
00621     }
00622 
00623     ScaleUnit*  pColourUnit = (ScaleUnit*)m_ColourUnitRadioGroup.GetSelected();
00624     ERROR3IF(pColourUnit == NULL, "UnitsTab::CommitDialogValues - Gibberish from GetSelected()");
00625 
00626     // If we have changed the units from the entry ones then tell other users about the change 
00627     // Do a blantant update if the current user units are the current page or font units
00628     if (
00629         (PageUnitType != OldPageUnits) ||
00630         //(ScaledUnitType != OldScaledUnits) ||
00631         (FontUnitType != OldFontUnits) ||
00632         (pColourUnit != NULL && m_pOldColourUnit != pColourUnit) ||
00633         (CurrentUserUnitType == PageUnitType) ||
00634         (CurrentUserUnitType == FontUnitType)
00635        )
00636     {
00637         // Colour units have changed so store the default as a preference then send a message in case
00638         // the Colour Editor is listening
00639         if (m_pOldColourUnit != pColourUnit)
00640         {
00641             ERROR3IF(!(pColourUnit->IS_KIND_OF(ScaleUnit)), "UnitsTab::CommitDialogValues - Not ScaleUnit");
00642             Camelot.SetPrefDirect(ColourUnitSection, ColourUnitPreference, pColourUnit->GetQualifier()->GetToken(), TRUE);
00643             m_pOldColourUnit = pColourUnit;
00644         }
00645         // Now tell other users of units that there is a possibly new default units in operation
00646         // and so update any currently displayed units. 
00647         BROADCAST_TO_ALL(OptionsChangingMsg(pDocument, OptionsChangingMsg::NEWUNITS));
00648 
00649         // Mark the document as modified as we have changed something that is saved with the
00650         // document but only if the page or font units have changed.
00651         if (pDocument &&
00652             (
00653                 (PageUnitType != OldPageUnits) ||
00654                 (FontUnitType != OldFontUnits)
00655             )
00656            )
00657         {
00658             pDocument->SetModified(TRUE);
00659         }   
00660 
00661         // Note the new entry state of the controls
00662         //OldScaledUnits = ScaledUnitType; 
00663         OldPageUnits = PageUnitType; 
00664         OldFontUnits = FontUnitType; 
00665     }
00666     
00667     // If there is a currently seleted user unit then make sure its name in all the lists is
00668     // correct. Only really true on Apply Now clicks as Oks will of course remove the dialog
00669     // box.
00670     if (CurrentUserUnitType != NOTYPE)
00671     {
00672         // Need to do this as otherwise for some strange reason the DialogManager errors
00673         // denying knowledge of the control. Really saying WindowHandler is 0!
00674         BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNITS)); // The edit page identifier
00675         if (!ok)
00676             return TRUE;        // page not present
00677 
00678         //InitControls();
00679         UpdateUnitListControls();
00680     }
00681 
00682     return TRUE;
00683 }

BOOL UnitsTab::CommitSection  )  [virtual]
 

Takes the values in the Units section tab of the options dialog box and sets the associated preference values accordingly Called when ok is pressed on the dialog box.

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

Errors: -

See also:
-

Implements OptionsTabs.

Definition at line 301 of file optsunit.cpp.

00302 {
00303 TRACEUSER( "Neville", _T("commit units section\n"));
00304     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::CommitSection called with no dialog pointer");
00305 
00306     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNITS)); // The units page identifier
00307     if (!ok)
00308         return TRUE;    // Talk to page failed to return now
00309 
00310     // Section = Units
00311 
00312     // All units work off the selected document and so we must do nothing if there is no
00313     // selected document. Check our clas variable to see if this is true or not.
00314     // Units should have been set up by the caller.
00315     if (pDocument == NULL || pSpread == NULL)
00316     {
00317         // If this fails then there is no document and so we must ensure
00318         // things which need a selected document are greyed.
00319         GreySection();
00320         return TRUE;
00321     }
00322 
00323     ok = CommitDialogValues();
00324 
00325     return ok;
00326 }

BOOL UnitsTab::CreateNewUnit  )  [protected]
 

Creates a new user unit that the user has just requested.

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

Errors: -

See also:
-

Definition at line 700 of file optsunit.cpp.

00701 {
00702     ERROR2IF(pDocUnitList == NULL,FALSE,"UnitsTab::CreateNewUnit called with no doc unit list");
00703 
00704     Unit* pUnit = NULL;
00705 
00706     BOOL ok;
00707     ok = pDocUnitList->MakeNewUnit(&pUnit);
00708 
00709     if (ok)
00710     {
00711         CurrentUserUnitType = pUnit->GetUnitType();
00712         // Fire up the user units name dialog box, but only if we have
00713         // a current user unit to edit.
00714         BOOL Ok = TRUE; 
00715         if (CurrentUserUnitType != NOTYPE)
00716         {
00717             // This is ok as we are using a modal dialog box
00718             Ok = UnitPropertiesDlg::InvokeDialog(CurrentUserUnitType);
00719             
00720             if (!Ok)
00721                 DeleteUnit();           
00722         }
00723 
00724         // Only do the rest of this if the user named the unit ok
00725         if (Ok)
00726         {
00727             EnableControls();
00728             SetUnitToken(_R(IDC_OPTS_PAGEUNITS),  CurrentUserUnitType, 0,TRUE);
00729             //SetUnitToken(_R(IDC_OPTS_SCALEDUNITS),CurrentUserUnitType,NULL,TRUE);
00730             SetUnitToken(_R(IDC_OPTS_FONTUNITS),  CurrentUserUnitType, 0,TRUE);
00731             InitControls();
00732             // Now make sure the current user unit is selected in the list
00733             SelectCurrentUserUnit();
00734             // Mark the document as modified as we have changed something
00735             // that is saved with the document.
00736             if (pDocument)
00737                 pDocument->SetModified(TRUE);
00738         }
00739     }
00740     else
00741     {
00742         // Failed to create the new unit, usually due to no memory.
00743         // So report this to the user. Error set by new on failure. 
00744         InformError();
00745     }
00746     
00747     return TRUE;
00748 }

BOOL UnitsTab::DeleteUnit  )  [protected]
 

Deletes the currently selected user unit.

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

Errors: -

See also:
-

Definition at line 765 of file optsunit.cpp.

00766 {
00767     ERROR2IF(pDocument == NULL,FALSE,"UnitsTab::DeleteUnit called with no document");
00768     ERROR2IF(pSpread == NULL,FALSE,"UnitsTab::DeleteUnit called with no document");
00769     ERROR2IF(pDocUnitList == NULL,FALSE,"UnitsTab::DeleteUnit called with no doc unit list");
00770 
00771     Unit* pNextUserUnit = NULL;
00772     Unit* pCurUserUnit = NULL;
00773     pCurUserUnit  = pDocUnitList->FindUnit(CurrentUserUnitType);
00774     pNextUserUnit = pDocUnitList->FindNextUserUnit(pCurUserUnit);
00775     if (pNextUserUnit == NULL)
00776     {
00777         pNextUserUnit = pDocUnitList->FindFirstUserUnit();
00778         if (pNextUserUnit->GetUnitType() == CurrentUserUnitType)
00779             pNextUserUnit = NULL;
00780     }
00781 
00782     UnitReason DeleteReason = UNITREASON_OK;
00783 
00784     // Before we try and delete the unit we must check if it is being used
00785     // by the default grid or by the scaling strings. If so then we should not
00786     // allow the operation to continue.
00787     // First check the grid
00788     NodeGrid* pDefaultGrid = pSpread->FindFirstDefaultGridInSpread();
00789     if (pDefaultGrid)
00790     {
00791         // Default grid present so ensure not using these units
00792         // Specify True so that we get the scaled units. Otherwise,
00793         // if scaling is set then the user is warned but cannot see the
00794         // units in the grid tab!
00795         UnitType GridUnits = pDefaultGrid->GetUnits(TRUE);
00796         if (CurrentUserUnitType == GridUnits)
00797             DeleteReason = UNITREASON_BEINGUSED;
00798     }
00799 
00800     // Now the document scaling, returns page units if not active
00801     // If present in inactive strings then user will be warned when they
00802     // try and activate this scale.
00803     DimScale* pDimScale = pSpread->GetPtrDimScale();
00804     if (pDimScale)
00805     {
00806             UnitType ScaleUnits = pDimScale->GetScaleUnits();
00807         if (CurrentUserUnitType == ScaleUnits)
00808             DeleteReason = UNITREASON_BEINGUSED;
00809         else
00810         {
00811             // If scale string ok then check the drawing string, if the scale is
00812             // active
00813             BOOL Active = pDimScale->IsActive();
00814             if (Active)
00815             {
00816                 String_32 Str;
00817                 BOOL ok = TRUE;
00818                 double dummy = 0.0;
00819                 Str = pDimScale->GetDrawingScaleStr();
00820                 ok = Convert::StringToComponents(Str, &dummy, &ScaleUnits);
00821                 if (ok && CurrentUserUnitType == ScaleUnits)
00822                     DeleteReason = UNITREASON_BEINGUSED;
00823             }
00824         }
00825     }
00826 
00827     // Try and delete the unit from the doc unit list, will complain if the
00828     // unit has decendents i.e. units based on it or it is being used for 
00829     // the default page, font or scaling units.
00830     // Only do it if we haven't found above reason not to delete it
00831     if (DeleteReason == UNITREASON_OK)
00832         DeleteReason = pDocUnitList->DeleteUnit(CurrentUserUnitType);
00833 
00834     switch (DeleteReason)
00835     {
00836         case UNITREASON_OK :
00837             if (pNextUserUnit == NULL)
00838                 CurrentUserUnitType = NOTYPE;
00839             else
00840                 CurrentUserUnitType = pNextUserUnit->GetUnitType();
00841 
00842             EnableControls();
00843             InitControls();
00844             // Now make sure the current user unit is selected in the list
00845             SelectCurrentUserUnit();
00846 
00847             // Mark the document as modified as we have changed something
00848             // that is saved with the document.
00849             if (pDocument)
00850                 pDocument->SetModified(TRUE);
00851             break;
00852 
00853         case UNITREASON_HASDESCENDENTS:
00854             Error::SetError(_R(IDS_UNITERROR_HASDESCENDENTS),0);
00855             InformError();
00856             break;
00857 
00858         case UNITREASON_BEINGUSED:
00859             Error::SetError(_R(IDS_UNITERROR_BEINGUSED),0);
00860             InformError();
00861             break;
00862 
00863         default :
00864             ENSURE(FALSE,"Unexpected DeleteUnit reason");
00865             break;
00866     }
00867 
00868     return TRUE;
00869 }

BOOL UnitsTab::EnableControls  )  [protected]
 

Enables or disables the controls depending on the current context, i.e. the controls are disabled if there is no selection, etc.

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

Definition at line 1273 of file optsunit.cpp.

01274 {
01275 TRACEUSER( "Neville", _T("UnitsTab::EnableControls\n"));
01276     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::EnableControls called with no dialog pointer");
01277     ERROR2IF(pDocUnitList == NULL,FALSE,"UnitsTab::EnableControls called with no doc unit list pointer");
01278 
01279     BOOL enable = (pDocUnitList->FindFirstUserUnit() != NULL);
01280 
01281     pPrefsDlg->EnableGadget(_R(IDC_OPTS_DELETEUNIT),    enable);
01282     pPrefsDlg->EnableGadget(_R(IDC_OPTS_UNITPROPERTY),  enable);
01283 
01284     return TRUE;
01285 }           

ScaleUnit * UnitsTab::GetColourUnitPreference  )  [static]
 

Retrieves the user's Colour Unit preference to be used by the Colour Editor If no preference is found StandardUnit::UnitPercent is the default Scope: static.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/06/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A pointer to the preferred colour unit NULL if an error occurred

Definition at line 1187 of file optsunit.cpp.

01188 {
01189     String_32 DefaultUnitString;
01190     Camelot.GetPrefDirect(ColourUnitSection, ColourUnitPreference, &DefaultUnitString);
01191     ScaleUnit* pColourUnit = StandardUnit::PercentGroup.FindUnitFromQualifier(DefaultUnitString);
01192     if (pColourUnit == NULL)        // no default has been set
01193         pColourUnit = &StandardUnit::UnitPercent;
01194     if (!pColourUnit->IS_KIND_OF(ScaleUnit))
01195     {
01196         ERROR3("m_pOldColourUnit is not");
01197         return NULL;
01198     }
01199     return pColourUnit;
01200 }

CDlgResID UnitsTab::GetPageID  )  [virtual]
 

Allows the options dialog code to determine the dialog ID of this section.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The dialog ID of this tab section.

Errors: -

See also:
-

Implements OptionsTabs.

Definition at line 236 of file optsunit.cpp.

00237 {
00238     return _R(IDD_OPTSTAB_UNITS);
00239 }

BOOL UnitsTab::GreySection  )  [virtual]
 

Called when the user has closed all documents.

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

Errors: -

See also:
UnitsTab::UngreySection;

Reimplemented from OptionsTabs.

Definition at line 343 of file optsunit.cpp.

00344 {
00345 TRACEUSER( "Neville", _T("GreySection in UnitsTab section\n"));
00346     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::GreySection called with no dialog pointer");
00347 
00348     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNITS)); // The UnitsTab identifier
00349     if (!ok)
00350         return TRUE;    // Talk to page failed to return now
00351 
00352     // Make sure the information field displaying the name of the current document
00353     // is correct.
00354     String_256  DocumentName(_R(IDT_OPTS_UNITS_INFO)); 
00355     DocumentName += *GetDocumentName();
00356     pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName);
00357 
00358     // Only update if we are not already grey 
00359     if (GreyStatus == TRUE)
00360         return TRUE;
00361 
00362     m_ColourUnitRadioGroup.Disable();
00363     // Call our central greying/ungreying function
00364     ok = ChangeControlStatus(FALSE);
00365     
00366     GreyStatus = TRUE;
00367 
00368     return ok;
00369 } 

BOOL UnitsTab::HandleMsg DialogMsg Msg  )  [virtual]
 

Handles all the units options tabs messages.

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

Errors: -

See also:
-

Implements OptionsTabs.

Definition at line 498 of file optsunit.cpp.

00499 {
00500 TRACEUSER( "Neville", _T("HandleUnitsMsg\n"));
00501     ERROR2IF(Msg == NULL,FALSE,"UnitsTab::Message null message received");
00502     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::HandleMsg called with no dialog pointer");
00503 
00504     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNITS)); // The edit page identifier
00505     if (!ok)
00506         return TRUE;        // page not present
00507     
00508     switch(Msg->DlgMsg)
00509     {
00510         case DIM_CREATE:    // Initialise controls
00511             GreyStatus = FALSE; // we are ungreyed by default
00512             ok = InitSection();
00513             if (!ok)
00514                 InformError();
00515             break;
00516 
00517         case DIM_LFT_BN_CLICKED:
00518             OptionsTabs::SetApplyNowState(TRUE);
00519             if (Msg->GadgetID == _R(IDC_OPTS_UNITPROPERTY))
00520                 // Show the user the properties of the selected user unit
00521                 ShowUnitProperties();
00522             else if (Msg->GadgetID == _R(IDC_OPTS_NEWUNIT))
00523                 // Create the user a new unit
00524                 CreateNewUnit();
00525             else if (Msg->GadgetID == _R(IDC_OPTS_DELETEUNIT))
00526                 // Delete the currently selected user unit
00527                 DeleteUnit();
00528             break;
00529 
00530         case DIM_SELECTION_CHANGED:
00531         {
00532             OptionsTabs::SetApplyNowState(TRUE);
00533             ERROR2IF(pDocUnitList == NULL,FALSE,"UnitsTab::HandleMsg called with no doc unit list");
00534             
00535             WORD Index = 0;
00536             Unit* pUnit = NULL;
00537 //          Unit* pCurUserUnit = NULL;
00538             
00539             if (Msg->GadgetID == _R(IDC_OPTS_UNITSLIST))
00540             {
00541                 // Clicked on the list of user unit types
00542                 // Now, switch to the new item
00543                 pPrefsDlg->GetValueIndex(_R(IDC_OPTS_UNITSLIST), &Index); 
00544                 pUnit = pDocUnitList->FindUserUnit(Index);
00545                 if (pUnit != NULL)
00546                 {
00547                     CurrentUserUnitType = pUnit->GetUnitType();
00548                 }
00549             }
00550         }
00551         default:
00552             break;
00553     }
00554 
00555     return TRUE;
00556 }  

BOOL UnitsTab::Init void   )  [virtual]
 

UnitsTab initialisation routine.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if initialised ok, False if failed.

Errors: -

See also:
-

Reimplemented from OptionsTabs.

Definition at line 209 of file optsunit.cpp.

00210 {   
00211     CurrentUserUnitType  = NOTYPE;
00212     pDocUnitList         = NULL;
00213 
00214     // Initialise the dialog box that we require to create new and edit user units
00215     BOOL ok = UnitPropertiesDlg::Init();
00216 
00217     return ok;
00218 }        

BOOL UnitsTab::InitControls void   )  [protected]
 

Inits all the controls in the dialog Called immediately after the bar is created to init drop lists, grey out gadgets, etc.

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

Definition at line 1126 of file optsunit.cpp.

01127 {                            
01128 TRACEUSER( "Neville", _T("UnitsTab::InitControls\n"));
01129     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::InitControls called with no dialog pointer");
01130     ERROR2IF(pDocUnitList == NULL,FALSE,"UnitsTab::InitControls called with no doc unit list pointer");
01131 
01132     InitUnitListControls();
01133 
01134     // Get the current default settings
01135     UnitType PageUnits   = pDocUnitList->GetPageUnits();    // The units used to display page measurements
01136     //UnitType ScaledUnits = pDocUnitList->GetScaleUnits(); // The units to display scaled measurements
01137     UnitType FontUnits   = pDocUnitList->GetFontUnits();    // The units to display font measurements
01138 
01139     // Work out the indicies which these units correspond to on a list of units 
01140     INT32 PageUnitsIndex = pDocUnitList->FindUnitIndex(PageUnits);
01141     INT32 FontUnitsIndex = pDocUnitList->FindUnitIndex(FontUnits);
01142     
01143     // And now select the correct item on the list of units
01144     pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_PAGEUNITS), PageUnitsIndex);
01145     pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_FONTUNITS), FontUnitsIndex);
01146 
01147 //  // Remember to add in the automatic units to the index calculation
01148 //  if (ScaledUnits != AUTOMATIC)
01149 //  {
01150 //      // Not Automatic so work out the index which this item corresponds to on the unit list
01151 //      INT32 ScaleUnitsIndex = pDocUnitList->FindUnitIndex(ScaledUnits);
01152 //      pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_SCALEDUNITS), ScaleUnitsIndex + 1);
01153 //  }
01154 //  else
01155 //      pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_SCALEDUNITS), 0);
01156 
01157     // Note entry state of controls
01158     //OldScaledUnits = ScaledUnits; 
01159     OldPageUnits = PageUnits; 
01160     OldFontUnits = FontUnits; 
01161     
01162     m_pOldColourUnit = GetColourUnitPreference();
01163     if (m_pOldColourUnit == NULL)
01164         return FALSE;
01165     m_ColourUnitRadioGroup.SetDefault(m_pOldColourUnit);
01166 
01167     EnableControls();
01168 
01169     return TRUE;
01170 }

BOOL UnitsTab::InitSection  )  [virtual]
 

Sets initial values for the Units section of the options dialog box. This section includes the:-.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
-

Implements OptionsTabs.

Definition at line 1305 of file optsunit.cpp.

01306 {
01307 TRACEUSER( "Neville", _T("InitUnitsSection\n"));
01308     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::InitSection called with no dialog pointer");
01309 
01310     // Make sure the information field displaying the name of the current document
01311     // is correct.
01312     String_256  DocumentName(_R(IDT_OPTS_UNITS_INFO)); 
01313     DocumentName += *GetDocumentName();
01314     pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName);
01315 
01316     m_ColourUnitRadioGroup.SetAssociations((DialogOp*)pPrefsDlg, ColourUnitAssociations, NUM_CLR_DEFAULTS);
01317 
01318     // If no current document then do nothing as this may be valid
01319     // Use the document specified in the base class (OptionsTabs)
01320     if (pDocument != NULL)
01321     {
01322         // This uses current doc instead of selected doc
01323         //pDocUnitList = DocUnitList::GetCurrentDocUnitList();
01324         pDocUnitList = pDocument->GetDocUnitList();
01325         ERROR3IF(pDocUnitList == NULL,"Where's the current doc unit list eh?");
01326 
01327         if (pDocUnitList != NULL)
01328         {
01329             // Find out if we have any user defined units in this document 
01330             Unit* pUserUnit = pDocUnitList->FindFirstUserUnit();
01331             if (pUserUnit != NULL)
01332                 CurrentUserUnitType = pUserUnit->GetUnitType();
01333             else
01334                 CurrentUserUnitType  = NOTYPE;
01335         }
01336         else
01337         {
01338             // Could not create and hence find any units
01339             pDocUnitList = NULL;        // reset the unit list to null just in case
01340             // Ensure our section is greyed.
01341             GreySection();
01342             return FALSE;               // Could not initialise ok so fail 
01343         }                   
01344 
01345         // Section = Units
01346 
01347         InitControls();
01348         SelectCurrentUserUnit();
01349         //ShowUnitDetails();
01350     }
01351     else
01352     {
01353         // Ensure our section is greyed.
01354         GreySection();
01355     }
01356             
01357     return TRUE;
01358 }

BOOL UnitsTab::InitUnitListControls  )  [protected]
 

Fills in all the drop lists and combo boxes of units with the ones in the document.

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

Definition at line 1218 of file optsunit.cpp.

01219 {                            
01220 TRACEUSER( "Neville", _T("UnitsTab::InitControls()\n"));
01221     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::InitUnitListControls called with no dialog pointer");
01222     ERROR2IF(pDocUnitList == NULL,FALSE,"UnitsTab::InitUnitListControls called with no doc unit list pointer");
01223 
01224     INT32 i;
01225     Unit* pUnit = NULL;
01226 
01227     // Make sure all the lists are blank
01228     pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_PAGEUNITS));
01229     //pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_SCALEDUNITS));
01230     pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_FONTUNITS));
01231 
01232     pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_UNITSLIST));
01233 
01234     //SetUnitToken(_R(IDC_OPTS_SCALEDUNITS),AUTOMATIC,0);
01235 
01236     UnitType ThisUnitType = NOTYPE;
01237     for (i = 0; i < pDocUnitList->GetNumUnits(); i++)
01238     {
01239         pUnit = pDocUnitList->FindUnit(i);
01240         ThisUnitType = pUnit->GetUnitType();
01241         SetUnitToken(_R(IDC_OPTS_PAGEUNITS), ThisUnitType , i);
01242         //SetUnitToken(_R(IDC_OPTS_SCALEDUNITS), ThisUnitType, i+1);
01243         SetUnitToken(_R(IDC_OPTS_FONTUNITS), ThisUnitType, i);
01244     }
01245 
01246     // Update the list of user unit details
01247     pUnit = pDocUnitList->FindFirstUserUnit();
01248     for (i = 0; pUnit != NULL; i++)
01249     {
01250         ShowUnitDetails(_R(IDC_OPTS_UNITSLIST),pUnit->GetUnitType(), i);
01251         pUnit = pDocUnitList->FindNextUserUnit(pUnit);
01252     }
01253 
01254     return TRUE;
01255 }           

BOOL UnitsTab::IsDocumentOption  )  [virtual]
 

Allows the document options dialog code to determine if this tab belongs to the group of document options.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Returns True if this tab is a document option.

Errors: -

See also:
IsProgramOption();

Implements OptionsTabs.

Definition at line 257 of file optsunit.cpp.

00258 {
00259     return TRUE;    // This tab is a document option 
00260 }

BOOL UnitsTab::IsProgramOption  )  [virtual]
 

Allows the program options dialog code to determine if this tab belongs to the group of program options.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Returns True if this tab is a program option.

Errors: -

See also:
IsProgramOption();

Implements OptionsTabs.

Definition at line 278 of file optsunit.cpp.

00279 {
00280     return TRUE;    // This tab is a program option 
00281 }

BOOL UnitsTab::SelectCurrentUserUnit  )  [protected]
 

Make sure that the current user unit, if any, is selected and hence shown as selected in the user units list.

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

Errors: -

See also:
-

Definition at line 941 of file optsunit.cpp.

00942 {
00943     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::CommitUserDialogValues called with no dialog pointer");
00944     ERROR2IF(pDocUnitList == NULL,FALSE,"UnitsTab::CommitUserDialogValues called with no doc unit list pointer");
00945 
00946     // Check if the user has selected a valid user unit to edit
00947     // If not do nothing 
00948     if (CurrentUserUnitType != NOTYPE)
00949     {
00950         INT32 UnitIndex = pDocUnitList->FindUnitIndex(CurrentUserUnitType);
00951         Unit * pUnit = pDocUnitList->FindFirstUserUnit();
00952         if (pUnit)
00953         {
00954             UnitType FirstUserUnitType = pUnit->GetUnitType();
00955             INT32 UserUnitIndex = pDocUnitList->FindUnitIndex(FirstUserUnitType); 
00956             INT32 Index = UnitIndex - UserUnitIndex;
00957             pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_UNITSLIST), Index);
00958         }
00959     }
00960     
00961     return TRUE;
00962 }

void UnitsTab::SetUnitToken CGadgetID  ID,
UnitType  ThisUnitType,
INT32  Index = -1,
BOOL  EndOfList = FALSE
[protected]
 

Readable function for putting unit token strings in controls.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/7/94
Parameters:
ID = the ID of the control to put the unit token in [INPUTS] ThisUnitType = the type of the unit whose token you want putting in the control Index = index into a drop list (-1 = main field) EndOfList - if TRUE, item is stuck on end of list, regardless of Index
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 1042 of file optsunit.cpp.

01043 {
01044     String_32 Str = pDocUnitList->GetToken(ThisUnitType);
01045     String_256 Str256 = Str;
01046     pPrefsDlg->SetStringGadgetValue(ID, Str256, EndOfList, Index);
01047 }

void UnitsTab::ShowUnitDetails CGadgetID  ID,
UnitType  ThisUnitType,
INT32  Index = -1,
BOOL  EndOfList = FALSE
[protected]
 

Shows the summary of the details of the specified unit for putting user unit token strings in the scrollable details list.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/11/95
Parameters:
ID = the ID of the control to put the unit token in [INPUTS] ThisUnitType = the type of the unit whose token you want putting in the control Index = index into a drop list (-1 = main field) EndOfList - if TRUE, item is stuck on end of list, regardless of Index
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 1068 of file optsunit.cpp.

01069 {
01070     String_256 Details;
01071 
01072     String_32 Name = pDocUnitList->GetToken(ThisUnitType);
01073 
01074     // Add the abbreviation
01075     String_32 Abbrev = pDocUnitList->GetSpecifier(ThisUnitType);
01076 
01077     Unit* pCurUserUnit = NULL;
01078     pCurUserUnit = pDocUnitList->FindUnit(ThisUnitType);
01079 
01080     String_32 PrefixStr;
01081     double BaseNumerator = 0.0;
01082     double BaseDenominator = 0.0;
01083     String_32 Numerator;
01084     String_32 Denominator;
01085     String_32 BasedOn;
01086     if (pCurUserUnit)
01087     {
01088         // Set up the prefix/suffix state for this user's unit.
01089         if (pCurUserUnit->IsPrefix())
01090             PrefixStr.MakeMsg(_R(IDS_UNITS_PREFIX));
01091         else
01092             PrefixStr.MakeMsg(_R(IDS_UNITS_SUFFIX));
01093 
01094         BaseNumerator = pCurUserUnit->GetBaseNumerator();
01095         BaseDenominator = pCurUserUnit->GetBaseDenominator();
01096         Convert::DoubleToString(BaseNumerator, &Numerator);
01097         Convert::DoubleToString(BaseDenominator, &Denominator);
01098 
01099         UnitType BaseUnit = pCurUserUnit->GetBaseUnitType();
01100         BasedOn = pDocUnitList->GetSpecifier(BaseUnit);
01101     }
01102 
01103     Details.MakeMsg(_R(IDS_UNITSDESCRIPTION), (TCHAR*)Name, (TCHAR*)Abbrev, (TCHAR*)PrefixStr,
01104                                           (TCHAR*)Denominator, (TCHAR*)Numerator,
01105                                           (TCHAR*)BasedOn);
01106 
01107     pPrefsDlg->SetStringGadgetValue(ID, Details, EndOfList, Index);
01108 }

BOOL UnitsTab::ShowUnitProperties  )  [protected]
 

Shows the current properties of the selected user unit.

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

Errors: -

See also:
-

Definition at line 886 of file optsunit.cpp.

00887 {
00888     ERROR2IF(pDocUnitList == NULL,FALSE,"UnitsTab::ShowUnitProperties called with no doc unit list");
00889 
00890     // Fire up the user units property dialog box, but only if we have
00891     // a current user unit to edit.
00892     BOOL Ok = TRUE; 
00893     if (CurrentUserUnitType != NOTYPE)
00894     {
00895         // This is ok as we are using a modal dialog box
00896         Ok = UnitPropertiesDlg::InvokeDialog(CurrentUserUnitType);
00897 
00898         // If Oked then make sure everything is updated to reflect this potential new info
00899         if (Ok)
00900         {
00901             // Make sure that the selected user units list item is updated with the new info.
00902             if (CurrentUserUnitType != NOTYPE)
00903             {
00904                 INT32 UnitIndex = pDocUnitList->FindUnitIndex(CurrentUserUnitType);
00905                 Unit * pUnit = pDocUnitList->FindFirstUserUnit();
00906                 if (pUnit)
00907                 {
00908                     UnitType FirstUserUnitType = pUnit->GetUnitType();
00909                     INT32 UserUnitIndex = pDocUnitList->FindUnitIndex(FirstUserUnitType); 
00910                     INT32 Index = UnitIndex - UserUnitIndex;
00911                     pPrefsDlg->DeleteValue(_R(IDC_OPTS_UNITSLIST), FALSE, Index);
00912                     ShowUnitDetails(_R(IDC_OPTS_UNITSLIST), CurrentUserUnitType, Index, FALSE);
00913                     pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_UNITSLIST), Index);
00914                 }
00915             }
00916 
00917             // Make sure the controls displaying user units are updated with this change.
00918             UpdateUnitListControls();
00919         }
00920     }
00921 
00922     return TRUE;
00923 }

BOOL UnitsTab::UngreySection  )  [virtual]
 

Called when the user has selected a new document.

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

Errors: -

See also:
UnitsTab::UngreySection;

Reimplemented from OptionsTabs.

Definition at line 386 of file optsunit.cpp.

00387 {
00388 TRACEUSER( "Neville", _T("UngreySection in UnitsTab section\n"));
00389     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::UngreySection called with no dialog pointer");
00390 
00391     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNITS)); // The UnitsTab identifier
00392     if (!ok)
00393         return TRUE;    // Talk to page failed to return now
00394 
00395     // Make sure the information field displaying the name of the current document
00396     // is correct.
00397     String_256  DocumentName(_R(IDT_OPTS_UNITS_INFO)); 
00398     DocumentName += *GetDocumentName();
00399     pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName);
00400 
00401     // Only update if we are not already ungrey 
00402     if (GreyStatus == FALSE)
00403         return TRUE;
00404 
00405     m_ColourUnitRadioGroup.Enable();
00406     // Call our central greying/ungreying function
00407     ok = ChangeControlStatus(TRUE);
00408     
00409     GreyStatus = FALSE;
00410 
00411     return ok;
00412 }

BOOL UnitsTab::UpdateSection String_256 DocumentName  )  [virtual]
 

Called when we have switched to a new document and need to update all the controls on this tab. Should only init the tab if the page is present. The document name allows the info field on the tab to be filled in correctly.

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

Errors: -

See also:
UnitsTab::GreySection; UnitsTab::UngreySection; UnitsTab::InitSection;

Reimplemented from OptionsTabs.

Definition at line 470 of file optsunit.cpp.

00471 {
00472 TRACEUSER( "Neville", _T("UnitsTab::UpdateSection\n"));
00473     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::UpdateSection called with no dialog pointer");
00474 
00475     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_UNITS)); // The UnitsTab identifier
00476     if (!ok)
00477         return TRUE;        // page not present
00478 
00479     // Call the normal init section code
00480     return InitSection();
00481 }

BOOL UnitsTab::UpdateUnitListControls  )  [protected]
 

Updates the new name name of the currently selected user unit, if any in all of the lists.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/9/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
UnitPropertiesDlg::DisplayUserUnitDetails; UnitsTab::ShowUnitDetails;

Definition at line 979 of file optsunit.cpp.

00980 {
00981 TRACEUSER( "Neville", _T("UnitsTab::UpdateUnitListControls()\n"));
00982     ERROR2IF(pPrefsDlg == NULL,FALSE,"UnitsTab::UpdateUnitListControls called with no dialog pointer");
00983     ERROR2IF(pDocUnitList == NULL,FALSE,"UnitsTab::UpdateUnitListControls called with no doc unit list pointer");
00984 
00985     // Make sure that we have the text for the current unit up to date
00986     String_256 TokenStr = _T("");
00987     String_32 TokenStr_32 = _T("");
00988     Unit* pCurUserUnit = NULL;
00989 
00990     pCurUserUnit = pDocUnitList->FindUnit(CurrentUserUnitType);
00991     if (pCurUserUnit != NULL)
00992     {
00993         // Get the current name for this unit
00994         TokenStr = pCurUserUnit->GetToken();
00995         //TokenStr = TokenStr_32;
00996 
00997         // Now update the name in the lists
00998         INT32 UnitIndex = pDocUnitList->FindUnitIndex(CurrentUserUnitType);
00999         // Have to delete them and then reinsert them back into the list
01000         // These lists have all units on
01001         pPrefsDlg->DeleteValue(_R(IDC_OPTS_PAGEUNITS), FALSE, UnitIndex);
01002         pPrefsDlg->DeleteValue(_R(IDC_OPTS_FONTUNITS), FALSE, UnitIndex);
01003         pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_PAGEUNITS), TokenStr, FALSE, UnitIndex);
01004         pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_FONTUNITS), TokenStr, FALSE, UnitIndex);
01005 
01006         // Must set the selected item as otherwise it will blank the main list item. 
01007 
01008         // Work out the indicies which these units correspond to on a list of units 
01009         // Get the current default settings
01010         UnitType PageUnits  = pDocUnitList->GetPageUnits();
01011         UnitType FontUnits  = pDocUnitList->GetFontUnits();
01012         INT32 PageUnitsIndex = pDocUnitList->FindUnitIndex(PageUnits);
01013         INT32 FontUnitsIndex = pDocUnitList->FindUnitIndex(FontUnits);
01014         
01015         // And now select the correct item on the list of units
01016         pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_PAGEUNITS), PageUnitsIndex);
01017         pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_FONTUNITS), FontUnitsIndex);
01018     }
01019 
01020     return TRUE;
01021 }


Member Data Documentation

UnitType UnitsTab::CurrentUserUnitType [private]
 

Definition at line 189 of file optsunit.h.

BOOL UnitsTab::GreyStatus [private]
 

Definition at line 191 of file optsunit.h.

RadioGroup UnitsTab::m_ColourUnitRadioGroup [protected]
 

Definition at line 185 of file optsunit.h.

ScaleUnit* UnitsTab::m_pOldColourUnit [protected]
 

Definition at line 183 of file optsunit.h.

UnitType UnitsTab::OldFontUnits [private]
 

Definition at line 196 of file optsunit.h.

UnitType UnitsTab::OldPageUnits [private]
 

Definition at line 194 of file optsunit.h.

DocUnitList* UnitsTab::pDocUnitList [private]
 

Definition at line 188 of file optsunit.h.


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