MiscTab Class Reference

Allows the user to set any options which are either too specific to have an associated tab or just do not fit any where else. This includes such things as:- Save preferences on exit switch and save preferences now button. Nudge Size Duplicate distance x,y Default constraint angle Current attribute settings. More...

#include <optsmisc.h>

Inheritance diagram for MiscTab:

OptionsTabs ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 MiscTab ()
 MiscTab constructor. Creates a non-undoable operation.
 ~MiscTab ()
 MiscTab destructor.
virtual BOOL Init ()
 MiscTab initialisation routine.
virtual BOOL HandleMsg (DialogMsg *Msg)
 Handles all the Misc options tabs messages.
virtual BOOL InitSection ()
 Sets initial values for the Misc section of the options dialog box. This section includes the:-
  • Import with layers
  • Save settings on exit
  • Recently used file list size
  • Ask before setting attribute
  • Last attribute applied becomes current
  • Visible layer editing method
  • Constraint angle
  • Duplication distance
  • Nudge size.

virtual BOOL CommitSection ()
 Takes the values in the Misc 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.
BOOL UpdateImportWithLayers ()
 Called when the state of the option Import with layers has been changed. We therefore need to update the state of this button on this tab. Should only update it if the page is present.
BOOL UpdateAskBefore ()
 Called when the user has requested a change in the ask before setting attribute state and hence we need to update the relevent controls on this tab. Should only do this if the tab is present. Usually happens when the user applies an atribute to no selected object and responds Quiet to the prompt.
virtual BOOL NewUnitsInSection ()
 Function called when new default units come into operation. We must convert all units fields to display in the newly specified units.
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.

Protected Member Functions

BOOL InitControlsWithUnits ()
 Sets initial values for the controls on the Misc section of the options dialog box which display measurements in units. This section includes the:-
  • Constraint angle
  • Duplication distance
  • Nudge size.

BOOL SetUpAngleList ()
 Sets up the list of contraint angles. Try and only do this one time as otherwise we get a lot of flicker when it is deleted and recreated.

Private Attributes

BOOL GreyStatus

Detailed Description

Allows the user to set any options which are either too specific to have an associated tab or just do not fit any where else. This includes such things as:- Save preferences on exit switch and save preferences now button. Nudge Size Duplicate distance x,y Default constraint angle Current attribute settings.

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

Definition at line 127 of file optsmisc.h.


Constructor & Destructor Documentation

MiscTab::MiscTab  ) 
 

MiscTab 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 136 of file optsmisc.cpp.

00137 {   
00138     // Do nothing at present
00139 }        

MiscTab::~MiscTab  ) 
 

MiscTab destructor.

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

Errors: -

See also:
-

Definition at line 157 of file optsmisc.cpp.

00158 {   
00159 }        


Member Function Documentation

BOOL MiscTab::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:
MiscTab::GreySection; MiscTab::UngreySection;

Definition at line 611 of file optsmisc.cpp.

00612 {
00613     // Grey/ungrey the controls
00614 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_INFO), Status);
00615 
00616     // Grey/ungrey the controlling Switch
00617 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_IMPWITHLAYERS), Status);
00618 
00619 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_PREFSTXT), Status);
00620 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_SAVEONEXIT), Status);
00621 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_SAVENOW), Status);
00622 
00623 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_FILETXT), Status);
00624 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_FILELISTTXT), Status);
00625 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_FILELISTSIZE), Status);
00626 
00627 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_VISIBLELAYER), Status);
00628 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_LASTATTRB), Status);
00629 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_ASKSETATTRB), Status);
00630 //  pPrefsDlg->EnableGadget(_R(IDC_OPTS_CLOSEDOCVIEWS), Status);
00631 
00632     pPrefsDlg->EnableGadget(_R(IDC_OPTS_EDITGRP), Status);
00633 
00634     pPrefsDlg->EnableGadget(_R(IDC_OPTS_CONSTRAINTTXT), Status);
00635     pPrefsDlg->EnableGadget(_R(IDC_OPTS_ANGLECONST), Status);
00636 
00637     pPrefsDlg->EnableGadget(_R(IDC_OPTS_NUDGETXT), Status);
00638     pPrefsDlg->EnableGadget(_R(IDC_OPTS_NUDGESIZE), Status);
00639 
00640     pPrefsDlg->EnableGadget(_R(IDC_OPTS_DUPLICATETXT), Status);
00641     pPrefsDlg->EnableGadget(_R(IDC_OPTS_XDUPLICATETXT), Status);
00642     pPrefsDlg->EnableGadget(_R(IDC_OPTS_YDUPLICATETXT), Status);
00643     pPrefsDlg->EnableGadget(_R(IDC_OPTS_XDUPLICATE), Status);
00644     pPrefsDlg->EnableGadget(_R(IDC_OPTS_YDUPLICATE), Status);
00645 
00646     return TRUE;
00647 }           

BOOL MiscTab::CommitSection  )  [virtual]
 

Takes the values in the Misc 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 263 of file optsmisc.cpp.

00264 {
00265 TRACEUSER( "Neville", _T("commit misc section\n"));
00266     ERROR2IF(pPrefsDlg == NULL,FALSE,"MiscTab::CommitSection called with no dialog pointer");
00267 
00268     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));  // The Misc page identifier
00269     if (!ok)
00270         return TRUE;    // Talk to page failed to return now
00271 
00272     // Section = Misc
00273 
00274     // Ok has been pressed so take the values from this section of the dialog box
00275     BOOL Valid=0;       // Flag for validity of value
00276     INT32 State=0;      // Flag for state of button/switch
00277     BOOL SetOk=0;       // Preference value set ok
00278 
00279     // Section = Import
00280 //WEBSTER-ranbirr-13/11/96
00281 #ifndef WEBSTER
00282     //State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_IMPWITHLAYERS), 0, 1, 0, &Valid);
00283     State = pPrefsDlg->GetSelectedValueIndex(_R(IDC_OPTS_IMPWITHLAYERS));
00284     Valid = State >= 0 && State <= 2;
00285 
00286     SetOk = Camelot.SetPrefValue(TEXT("Filters"), TEXT("ImportWithLayers"), &State);
00287     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00288 
00289     // Section = Preferences
00290 
00291     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_SAVEONEXIT), 0, 1, 0, &Valid);
00292     if ( State != FALSE )
00293         AppPrefsDlg::SetSaveOnExit(TRUE);
00294     else
00295         AppPrefsDlg::SetSaveOnExit(FALSE);
00296 
00297     // Section = File menu
00298 
00299     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_FILELISTSIZE), 1, 9, _R(IDE_OPTS_INVALIDFILELIST), &Valid);
00300     if (Valid)
00301     {
00302 TRACEUSER( "Neville", _T("commit file list size='%d'\n"), State);
00303         SetOk = Camelot.SetPrefValue(TEXT("Recent File List"), TEXT("FileListSize"), &State);
00304         ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00305     }
00306     else
00307         return FALSE;           // File list size incorrect, user has been warned already
00308 
00309     // Section = Layers
00310 
00311     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_VISIBLELAYER), 0, 1, 0, &Valid);
00312     SetOk = Camelot.SetPrefValue(TEXT("Layers"),TEXT("ActiveLayerVisibleAndEditable"),&State);
00313     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00314     // Now tell the layers gallery to update itself, if present
00315     // Broadcast a SpreadMsg with reason code SpreadMsg::LAYERCHANGES, when the pref changes.
00316     // The layer gallery will then redraw itself. 
00317     BROADCAST_TO_ALL(SpreadMsg(pSpread, pSpread, SpreadMsg::LAYERCHANGES));
00318 
00319     // Section = Attributes
00320 
00321     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_ASKSETATTRB), 0, 1, 0, &Valid);
00322     SetOk = Camelot.SetPrefValue(TEXT("Attributes"),TEXT("AskBeforeSettingCurrentAttr"),&State);
00323     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00324 
00325     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_LASTATTRB), 0, 1, 0, &Valid);
00326     SetOk = Camelot.SetPrefValue(TEXT("Attributes"),TEXT("LastAttrAppliedBecomesCurrent"),&State);
00327     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00328 
00329 //  State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_ASKGREYSCALEBMP), 0, 1, 0, &Valid);
00330     //AttributeManger::ShouldAskAboutContoneColours = State;
00331 //  SetOk = Camelot.SetPrefValue(TEXT("Attributes"),TEXT("AskBeforeSettingContoneColours"),&State);
00332 //  ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00333 
00334     // Section = ask before closing view
00335 
00336     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_CLOSEDOCVIEWS), 0, 1, 0, &Valid);
00337     SetOk = Camelot.SetPrefValue(TEXT("Preferences"),TEXT("RemoveExistingDocs"),&State);
00338     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00339 
00340     State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_GROUPTRANSPARENCY), 0, 1, 0, &Valid);
00341     SetOk = Camelot.SetPrefValue(TEXT("Attributes"),TEXT("GroupTransparency"),&State);
00342     ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00343 
00344 #endif //webster
00345     // All units work off the selected document and so we must do nothing if there is no
00346     // selected document. Check our class variable to see if this is true or not.
00347     // Units should have been set up by the caller.
00348     if (pDocument == NULL || pSpread == NULL)
00349         return TRUE;
00350 
00351     // Section = Constraints
00352 
00353     // Now the constraint angle combo box
00354     // Convert to double uses units and so requires a selected document
00355     double Angle = PI / 4;      // Angle stored in radians in the preference system
00356     double AngleInDegrees = 45; // Angle displayed in degrees to the user
00357     AngleInDegrees = pPrefsDlg->GetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 1, 359,
00358                                                      _R(IDE_OPTS_INVALIDANGLE), &Valid);
00359     if (Valid)
00360     {
00361         // Angle in correct range so put it into the preference system
00362         Angle = AngleInDegrees * PI/180.0;      // convert angle to radians
00363 TRACEUSER( "Neville", _T("commit constraint angle in degrees='%d' angle='%d' Valid ='%d'\n"), AngleInDegrees, Angle, Valid);
00364         SetOk = Camelot.SetPrefValue(TEXT("Constraints"), TEXT("Constrain Angle"), &Angle);
00365         ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00366     }
00367     else
00368         return FALSE;           // Angle incorrect, user has been warned already
00369 
00370     // Now the duplicate distance
00371     // These should be shown in scaled coordinates as they measure distances on the page 
00372     // pSpread tells the dimension class which document to pick the dimensioning from
00373     MILLIPOINT x = 0;
00374     MILLIPOINT y = 0;
00375 //  const INT32 Maxxy = INT_MAX;        // maximum value allowed as the distance
00376     BOOL bValidX = FALSE;
00377     BOOL bValidY = FALSE;
00378 
00379     ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));   // The Misc page identifier
00380     x = pPrefsDlg->GetDimensionGadgetValue(_R(IDC_OPTS_XDUPLICATE), pSpread, &bValidX);
00381 /*  if (Valid && (x > -Maxxy) && (x < Maxxy))
00382     {
00383         // The preference system needs integers rather than MILLIPOINTS.
00384         INT32 xsize = (INT32)x;
00385         SetOk = Camelot.SetPrefValue(TEXT("Duplicate"), TEXT("DuplicatePlacementX"), &xsize);
00386         ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00387     }
00388     else
00389     {
00390         // There is a problem so warn the user that the x size is incorrect
00391         InformWarning(_R(IDE_OPTS_INVALIDDISTANCE));
00392         return FALSE;
00393     }           
00394 */
00395     ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));   // The Misc page identifier
00396     y = pPrefsDlg->GetDimensionGadgetValue(_R(IDC_OPTS_YDUPLICATE), pSpread, &bValidY);
00397 /*  if (Valid && (y > -Maxxy) && (y < Maxxy))
00398     {
00399         // The preference system needs integers rather than MILLIPOINTS.
00400         INT32 ysize = (INT32)y;
00401         SetOk = Camelot.SetPrefValue(TEXT("Duplicate"), TEXT("DuplicatePlacementY"), &ysize);
00402         ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00403     }
00404     else
00405     {
00406         // There is a problem so warn the user that the y size is incorrect
00407         InformWarning(_R(IDE_OPTS_INVALIDDISTANCE));
00408         return FALSE;
00409     }           
00410 */
00411     if (bValidX && bValidY)
00412     {
00413         pDocument->SetDuplicationOffset(DocCoord(x,y));
00414         pDocument->SetModified(TRUE);
00415     }
00416     else
00417     {
00418         // There is a problem so warn the user that the y size is incorrect
00419         InformWarning(_R(IDE_OPTS_INVALIDDISTANCE));
00420         return FALSE;
00421     }           
00422 
00423     // Now the nudge size distance
00424     MILLIPOINT Nudge = 0;
00425     ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));   // The Misc page identifier
00426     Nudge = pPrefsDlg->GetDimensionGadgetValue(_R(IDC_OPTS_NUDGESIZE), pSpread, &Valid);
00427     if (Valid && (Nudge > 0) && (Nudge < MaxDocCoord))
00428     {
00429         // Value apparently read ok so set up the value in the preference system
00430         // The preference system needs UINTs rather than MILLIPOINTS.
00431         UINT32 NudgeSize = (UINT32)Nudge;
00432         pDocument->SetDocNudge (NudgeSize);
00433         pDocument->SetModified (TRUE);
00434         //SetOk = TRUE;//Camelot.SetPrefValue(TEXT("Nudge"), TEXT("StepSize"), &NudgeSize);
00435         //ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_MISC));
00436     }
00437     else
00438     {
00439         // There is a problem so warn the user that the Nudge size is incorrect
00440         InformWarning(_R(IDE_OPTS_INVALIDNUDGE));
00441         return FALSE;
00442     }
00443 
00444     return TRUE;
00445 }

CDlgResID MiscTab::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 198 of file optsmisc.cpp.

00199 {
00200     return _R(IDD_OPTSTAB_MISC);
00201 }

BOOL MiscTab::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:
MiscTab::UngreySection;

Reimplemented from OptionsTabs.

Definition at line 539 of file optsmisc.cpp.

00540 {
00541 TRACEUSER( "Neville", _T("GreySection in MiscTab section\n"));
00542     ERROR2IF(pPrefsDlg == NULL,FALSE,"MiscTab::GreySection called with no dialog pointer");
00543 
00544     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));  // The MiscTab identifier
00545     if (!ok)
00546         return TRUE;    // Talk to page failed to return now
00547 
00548     // Only update if we are not already grey 
00549     if (GreyStatus == TRUE)
00550         return TRUE;
00551 
00552     // Call our central greying/ungreying function
00553     ok = ChangeControlStatus(FALSE);
00554     
00555     GreyStatus = TRUE;
00556 
00557     return ok;
00558 } 

BOOL MiscTab::HandleMsg DialogMsg Msg  )  [virtual]
 

Handles all the Misc 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 784 of file optsmisc.cpp.

00785 {
00786 TRACEUSER( "Neville", _T("MiscTab::HandleMsg\n"));
00787     ERROR2IF(Msg == NULL,FALSE,"MiscTab::Message null message received");
00788     ERROR2IF(pPrefsDlg == NULL,FALSE,"MiscTab::HandleMsg called with no dialog pointer");
00789 
00790     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));  // The Misc page identifier
00791     if (!ok)
00792         return TRUE;        // page not present
00793 
00794     switch(Msg->DlgMsg)
00795     {
00796         case DIM_CREATE:    // Initialise controls
00797             GreyStatus = FALSE; // we are ungreyed by default
00798             ok = InitSection();
00799             if (!ok)
00800                 InformError();
00801             break;
00802 // Moved by Neville 4/6/97 to cover whole switch statement
00803 //WEBSTER-ranbirr-13/11/96
00804 #ifndef WEBSTER
00805         case DIM_SELECTION_CHANGED:
00806         case DIM_LFT_BN_CLICKED:
00807             // A control on the dialog box has been clicked...
00808             if (Msg->GadgetID == _R(IDC_OPTS_LASTATTRB))
00809             {
00810                 // Ungrey the apply as we have clicked on this button
00811                 OptionsTabs::SetApplyNowState(TRUE);
00812                 // If last attibute applied becomes current is True then the ask before
00813                 // setting attribute is superfluous as it will be ignored.
00814                 // Get current button state. 
00815                 BOOL Valid = TRUE;
00816                 BOOL LastAttribute = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_LASTATTRB), 0, 1, 0, &Valid);
00817                 // Set new state of ask before setting button.
00818                 pPrefsDlg->EnableGadget(_R(IDC_OPTS_ASKSETATTRB), !LastAttribute);
00819                 break;
00820             }
00821             else if (Msg->GadgetID == _R(IDC_OPTS_SAVENOW))
00822             {
00823                 // save now action button pressed, save out preferences 
00824                 // but first we must take all the current values
00825                 // Should only be present in options mode
00826                 if (pPrefsDlg->IsKindOf(CC_RUNTIME_CLASS(AppPrefsDlg)))
00827                 {
00828                     // Cast/Convert our dialog pointer to be the correct type 
00829                     AppPrefsDlg *pOptionsDlg = (AppPrefsDlg*) pPrefsDlg;
00830                     ok = pOptionsDlg->CommitDialogValues();
00831                     if (ok)
00832                         Camelot.WritePreferences();
00833                 }
00834             }
00835             else
00836             {
00837                 OptionsTabs::SetApplyNowState(TRUE);
00838             }
00839             break; // DIM_LFT_BN_CLICKED        
00840 #endif //webster
00841         case DIM_TEXT_CHANGED:
00842             OptionsTabs::SetApplyNowState(TRUE);
00843             break; // DIM_TEXT_CHANGED      
00844         default:
00845             break;
00846     }
00847     
00848     return TRUE;
00849 }  

BOOL MiscTab::Init void   )  [virtual]
 

MiscTab 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 177 of file optsmisc.cpp.

00178 {   
00179     return TRUE;
00180 }        

BOOL MiscTab::InitControlsWithUnits  )  [protected]
 

Sets initial values for the controls on the Misc section of the options dialog box which display measurements in units. This section includes the:-

  • Constraint angle
  • Duplication distance
  • Nudge size.

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

Errors: -

See also:
AppPrefsDlg; OptionsTabs;

Definition at line 1040 of file optsmisc.cpp.

01041 {
01042 TRACEUSER( "Neville", _T("InitControlsWithUnits\n"));
01043     ERROR2IF(pPrefsDlg == NULL,FALSE,"MiscTab::InitControlsWithUnits called with no dialog pointer");
01044 
01045     // All units work off the selected document and so we must do nothing if there is no
01046     // selected document. Check our clas variable to see if this is true or not.
01047     // Units should have been set up by the caller.
01048     if (pDocument == NULL || pSpread == NULL)
01049     {
01050         // If this fails then there is no document and so we must ensure
01051         // things which need a selected document are greyed.
01052         GreySection();
01053         return (TRUE);
01054     }
01055 
01056     BOOL ReadOk = FALSE;    // Flag to say whether the preference value was read ok 
01057     BOOL ok = TRUE;         // Flag for whether value set up ok 
01058 
01059     // Sets up controls which display measurements in units
01060 
01061     // Section = Constraints
01062 
01063     // Now the constraint angle combo box
01064     // Doubles actually need document based units to work.
01065     double Angle = 0.0;         // Angle stored in radians in the preference system
01066     double AngleInDegrees = 0;  // Angle displayed in degrees to the user
01067     ReadOk = Camelot.GetPrefValue(TEXT("Constraints"), TEXT("Constrain Angle"), &Angle);
01068 TRACEUSER( "Neville", _T("set constraint angle '%d'\n"),Angle);
01069     // Set up the default option displayed
01070     AngleInDegrees = (Angle * 180.0/PI);    // Convert angle to degrees
01071     ok = pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), AngleInDegrees, FALSE, -1);
01072     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
01073 
01074     // Now the duplicate distance
01075     // These should be shown in scaled coordinates as they measure distances on the page 
01076     // pSpread tells the dimensioning system which document to get the dimensioning
01077     // details from.
01078 //  INT32 x = 0;
01079 //  INT32 y = 0;
01080     DocCoord offset = pDocument->GetDuplicationOffset();
01081 //  ReadOk = Camelot.GetPrefValue(TEXT("Duplicate"), TEXT("DuplicatePlacementX"), &x);
01082     ok = pPrefsDlg->SetDimensionGadgetValue(_R(IDC_OPTS_XDUPLICATE), offset.x, pSpread, TRUE, FALSE, -1);
01083     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
01084 
01085 //  ReadOk = Camelot.GetPrefValue(TEXT("Duplicate"), TEXT("DuplicatePlacementY"), &y);
01086     ok = pPrefsDlg->SetDimensionGadgetValue(_R(IDC_OPTS_YDUPLICATE), offset.y, pSpread, TRUE, FALSE, -1);
01087     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
01088 
01089     // Now the nudge size distance
01090     UINT32 Nudge = pDocument->GetDocNudge ();
01091     //ReadOk = TRUE;//Camelot.GetPrefValue(TEXT("Nudge"), TEXT("StepSize"), &Nudge);
01092     ok = pPrefsDlg->SetDimensionGadgetValue(_R(IDC_OPTS_NUDGESIZE), Nudge, pSpread, TRUE, FALSE, -1);
01093     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
01094 
01095     return TRUE;
01096 }   

BOOL MiscTab::InitSection  )  [virtual]
 

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

  • Import with layers
  • Save settings on exit
  • Recently used file list size
  • Ask before setting attribute
  • Last attribute applied becomes current
  • Visible layer editing method
  • Constraint angle
  • Duplication distance
  • Nudge size.

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:
AppPrefsDlg; OptionsTabs;

Implements OptionsTabs.

Definition at line 877 of file optsmisc.cpp.

00878 {
00879 TRACEUSER( "Neville", _T("InitMiscSection\n"));
00880     ERROR2IF(pPrefsDlg == NULL,FALSE,"MiscTab::InitSection called with no dialog pointer");
00881 
00882     BOOL ReadOk = FALSE;    // Flag to say whether the preference value was read ok 
00883 //  BOOL ok = TRUE;         // Flag for whether value set up ok 
00884 
00885     // Make sure the information field displaying the name of the current document
00886     // is correct.
00887     //String_256 *DocumentName = GetDocumentName();
00888     //pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_DOCUMENT), DocumentName);
00889 
00890     // Section = Import
00891 //WEBSTER-ranbirr-13/11/96
00892 #ifndef WEBSTER
00893 //  BOOL ImportWithLayers = FALSE;
00894 //  ReadOk = Camelot.GetPrefValue(TEXT("Filters"), TEXT("ImportWithLayers"), &ImportWithLayers);
00896 //  pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_IMPWITHLAYERS), ImportWithLayers);
00897 //  ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
00898 
00899     if (pPrefsDlg->GetSelectedValueIndex(_R(IDC_OPTS_IMPWITHLAYERS)) == -1)
00900     {
00901         INT32 ImportWithLayers = 2;
00902         ReadOk = Camelot.GetPrefValue(TEXT("Filters"), TEXT("ImportWithLayers"), &ImportWithLayers);
00903         pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_IMPWITHLAYERS), _R(IDS_IMPORT_NEW_LAYER), FALSE, 0);
00904         pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_IMPWITHLAYERS), _R(IDS_IMPORT_ACTIVE_LAYER), FALSE, 1);
00905         pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_IMPWITHLAYERS), _R(IDS_IMPORT_NAMED_LAYER), FALSE, 2);
00906         pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_IMPWITHLAYERS), ImportWithLayers);
00907     }
00908 #endif //webster
00909 
00910     
00911     
00912     // Section = Preferences
00913 
00914     // Set up the special save settings on exit switch which has no where else to live
00915     // at present
00916 //WEBSTER-ranbirr-13/11/96
00917 #ifndef WEBSTER
00918     if ( AppPrefsDlg::IsSaveOnExitSet() != FALSE )
00919         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_SAVEONEXIT), TRUE);
00920     else
00921         pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_SAVEONEXIT), FALSE);
00922 #endif //webster
00923     // Section = File menu
00924 
00925 //WEBSTER-ranbirr-13/11/96
00926 #ifndef WEBSTER
00927     INT32 FileListSize = 1;
00928     ReadOk = Camelot.GetPrefValue(TEXT("Recent File List"), TEXT("FileListSize"), &FileListSize);
00929     pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_FILELISTSIZE), FileListSize);
00930     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
00931 #endif //webster
00932     // Section = Layers
00933 
00934 //WEBSTER-Neville-4/6/97
00935 #ifndef WEBSTER
00936     BOOL VisibleLayerEditing = FALSE;
00937     ReadOk = Camelot.GetPrefValue(TEXT("Layers"), TEXT("ActiveLayerVisibleAndEditable"), &VisibleLayerEditing);
00938     pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_VISIBLELAYER), VisibleLayerEditing);
00939     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
00940 #endif //webster
00941 
00942     // Section = Attributes
00943 //WEBSTER-ranbirr-13/11/96
00944 #ifndef WEBSTER
00945     BOOL AskBeforeSetting = FALSE;
00946     ReadOk = Camelot.GetPrefValue(TEXT("Attributes"), TEXT("AskBeforeSettingCurrentAttr"), &AskBeforeSetting);
00947     pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_ASKSETATTRB), AskBeforeSetting);
00948     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
00949 
00950     BOOL LastAttribute = FALSE;
00951     ReadOk = Camelot.GetPrefValue(TEXT("Attributes"), TEXT("LastAttrAppliedBecomesCurrent"), &LastAttribute);
00952     pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_LASTATTRB), LastAttribute);
00953     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
00954 
00955     BOOL GroupTransparency = FALSE;
00956     ReadOk = Camelot.GetPrefValue(TEXT("Attributes"), TEXT("GroupTransparency"), &GroupTransparency);
00957     pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_GROUPTRANSPARENCY), GroupTransparency);
00958     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
00959 
00960     // If last attibute applied becomes current is True then the ask before setting
00961     // attribute is superfluous as it will be ignored. 
00962     pPrefsDlg->EnableGadget(_R(IDC_OPTS_ASKSETATTRB), !LastAttribute);
00963 #endif //webster
00964 //  BOOL AskGreyscaleBitmap = FALSE;
00965     //AttributeManger::ShouldAskAboutContoneColours;
00966 //  ReadOk = Camelot.GetPrefValue(TEXT("Attributes"), TEXT("AskBeforeSettingContoneColours"), &AskGreyscaleBitmap);
00967 //  pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_ASKGREYSCALEBMP), AskGreyscaleBitmap);
00968 //  ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
00969 
00970     // Section = ask before closing view
00971 //WEBSTER-ranbirr-13/11/96
00972 #ifndef WEBSTER
00973     BOOL CloseDocViews = FALSE;
00974     ReadOk = Camelot.GetPrefValue(TEXT("Preferences"), TEXT("RemoveExistingDocs"), &CloseDocViews);
00975     pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_CLOSEDOCVIEWS), CloseDocViews);
00976     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
00977 #endif //webster
00978 
00979     // Set up the control list for this first time only
00980     SetUpAngleList();
00981 
00982     // Sets up controls which display measurements in units 
00983     InitControlsWithUnits();
00984     
00985     return TRUE;
00986 }

BOOL MiscTab::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 219 of file optsmisc.cpp.

00220 {
00221     return FALSE;   // This tab is not a document option 
00222 }

BOOL MiscTab::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 240 of file optsmisc.cpp.

00241 {
00242     return TRUE;    // This tab is a program option 
00243 }

BOOL MiscTab::NewUnitsInSection  )  [virtual]
 

Function called when new default units come into operation. We must convert all units fields to display in the newly specified units.

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

Errors: -

See also:
-

Reimplemented from OptionsTabs.

Definition at line 463 of file optsmisc.cpp.

00464 {
00465 TRACEUSER( "Neville", _T("MiscTab::NewUnitsInSection\n"));
00466     ERROR2IF(pPrefsDlg == NULL,FALSE,"MiscTab::NewUnitsInSection called with no dialog pointer");
00467 
00468     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));  // The misc page identifier
00469     if (!ok)
00470         return TRUE;    // Talk to page failed to return now
00471 
00472     // Call the code which sets up any controls displaying measurements in this section code
00473     InitControlsWithUnits();
00474     
00475     return TRUE;
00476 }

BOOL MiscTab::SetUpAngleList  )  [protected]
 

Sets up the list of contraint angles. Try and only do this one time as otherwise we get a lot of flicker when it is deleted and recreated.

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

Errors: -

See also:
InitSection()

Definition at line 1004 of file optsmisc.cpp.

01005 {
01006     // Sets up the list of constraint angles
01007     pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 12.0);
01008     pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 15.0);
01009     pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 30.0);
01010     pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 45.0);
01011     pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 60.0);
01012     pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 72.0);
01013     pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 90.0);
01014     pPrefsDlg->SetComboListLength(_R(IDC_OPTS_ANGLECONST));
01015     
01016     return TRUE;
01017 }   

BOOL MiscTab::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:
MiscTab::UngreySection;

Reimplemented from OptionsTabs.

Definition at line 575 of file optsmisc.cpp.

00576 {
00577 TRACEUSER( "Neville", _T("UngreySection in MiscTab section\n"));
00578     ERROR2IF(pPrefsDlg == NULL,FALSE,"MiscTab::UngreySection called with no dialog pointer");
00579 
00580     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));  // The MiscTab identifier
00581     if (!ok)
00582         return TRUE;    // Talk to page failed to return now
00583 
00584     // Only update if we are not already ungrey 
00585     if (GreyStatus == FALSE)
00586         return TRUE;
00587 
00588     // Call our central greying/ungreying function
00589     ok = ChangeControlStatus(TRUE);
00590     
00591     GreyStatus = FALSE;
00592 
00593     return ok;
00594 }

BOOL MiscTab::UpdateAskBefore  ) 
 

Called when the user has requested a change in the ask before setting attribute state and hence we need to update the relevent controls on this tab. Should only do this if the tab is present. Usually happens when the user applies an atribute to no selected object and responds Quiet to the prompt.

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

Errors: -

See also:
AttributeManager::AttributeSelected();

Definition at line 745 of file optsmisc.cpp.

00746 {
00747 //WEBSTER-ranbirr-13/11/96
00748 #ifndef WEBSTER
00749 TRACEUSER( "Neville", _T("MiscTab::UpdateAskBefore()\n"));
00750     ERROR2IF(pPrefsDlg == NULL,FALSE,"MiscTab::UpdateAskBefore() called with no dialog pointer");
00751 
00752     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));  // The EditTab identifier
00753     if (!ok)
00754         return TRUE;        // page not present
00755 
00756     BOOL AskBeforeSetting = FALSE;
00757     BOOL ReadOk = FALSE;
00758     ReadOk = Camelot.GetPrefValue(TEXT("Attributes"), TEXT("AskBeforeSettingCurrentAttr"), &AskBeforeSetting);
00759     pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_ASKSETATTRB), AskBeforeSetting);
00760     //ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
00761 
00762     return(TRUE);
00763 #else
00764     return FALSE;
00765 #endif //webster
00766     
00767 }   

BOOL MiscTab::UpdateImportWithLayers  ) 
 

Called when the state of the option Import with layers has been changed. We therefore need to update the state of this button on this tab. Should only update it if the page is present.

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

Errors: -

See also:
MiscTab::GreySection; MiscTab::UngreySection; MiscTab::InitSection;

Definition at line 702 of file optsmisc.cpp.

00703 {
00704 //WEBSTER-ranbirr-13/11/96
00705 #ifndef WEBSTER
00706 TRACEUSER( "Neville", _T("MiscTab::UpdateImportWithLayers\n"));
00707     ERROR2IF(pPrefsDlg == NULL,FALSE,"MiscTab::UpdateImportWithLayers called with no dialog pointer");
00708 
00709     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));  // The MiscTab identifier
00710     if (!ok)
00711         return TRUE;        // page not present
00712 
00713     BOOL ReadOk = FALSE;
00714     INT32 ImportWithLayers = 2; // use layer names as the default
00715     ReadOk = Camelot.GetPrefValue(TEXT("Filters"), TEXT("ImportWithLayers"), &ImportWithLayers);
00716 //  pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_IMPWITHLAYERS), ImportWithLayers);
00717     pPrefsDlg->SetSelectedValueIndex(_R(IDC_OPTS_IMPWITHLAYERS), ImportWithLayers);
00718     ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_MISC));
00719 
00720     return (TRUE);
00721 #else 
00722     return FALSE;
00723 #endif //webster
00724 }

BOOL MiscTab::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:
MiscTab::GreySection; MiscTab::UngreySection; MiscTab::InitSection;

Reimplemented from OptionsTabs.

Definition at line 666 of file optsmisc.cpp.

00667 {
00668 TRACEUSER( "Neville", _T("MiscTab::UpdateSection\n"));
00669     ERROR2IF(pPrefsDlg == NULL,FALSE,"MiscTab::UpdateSection called with no dialog pointer");
00670 
00671     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_MISC));  // The MiscTab identifier
00672     if (!ok)
00673         return TRUE;        // page not present
00674 
00675     // Remove any lists that we have created.
00676     //pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_ANGLECONST));
00677 
00678     // Call the code which sets up any controls displaying measurements in this section code
00679     InitControlsWithUnits();
00680 
00681     return TRUE;
00682 }


Member Data Documentation

BOOL MiscTab::GreyStatus [private]
 

Definition at line 174 of file optsmisc.h.


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