#include <optsedit.h>
Inheritance diagram for EditTab:
Public Member Functions | |
EditTab () | |
EditTab constructor. Creates a non-undoable operation. | |
~EditTab () | |
EditTab destructor. | |
virtual BOOL | Init () |
EditTab initialisation routine. | |
virtual BOOL | HandleMsg (DialogMsg *Msg) |
Handles all the Edit options tabs messages. | |
virtual BOOL | InitSection () |
Sets initial values for the Edit section of the options dialog box. This section includes the:-. | |
virtual BOOL | CommitSection () |
Takes the values in the Edit 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 | 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. | |
Private Attributes | |
BOOL | GreyStatus |
Definition at line 124 of file optsedit.h.
|
EditTab constructor. Creates a non-undoable operation.
Definition at line 134 of file optsedit.cpp.
|
|
EditTab destructor.
Definition at line 155 of file optsedit.cpp.
|
|
Called to grey/ungrey all controls on this tab.
Definition at line 527 of file optsedit.cpp. 00528 { 00529 // Grey/ungrey the controls 00530 // pPrefsDlg->EnableGadget(_R(IDC_OPTS_LASTATTRB), Status); 00531 // pPrefsDlg->EnableGadget(_R(IDC_OPTS_ASKSETATTRB), Status); 00532 00533 pPrefsDlg->EnableGadget(_R(IDC_OPTS_ANGLEGROUP), Status); 00534 pPrefsDlg->EnableGadget(_R(IDC_OPTS_ANGLECONST), Status); 00535 00536 pPrefsDlg->EnableGadget(_R(IDC_OPTS_NUDGEGROUP), Status); 00537 pPrefsDlg->EnableGadget(_R(IDC_OPTS_NUDGESIZE), Status); 00538 00539 pPrefsDlg->EnableGadget(_R(IDC_OPTS_DUPLICATEGROUP), Status); 00540 pPrefsDlg->EnableGadget(_R(IDC_OPTS_XDUPLICATETXT), Status); 00541 pPrefsDlg->EnableGadget(_R(IDC_OPTS_YDUPLICATETXT), Status); 00542 pPrefsDlg->EnableGadget(_R(IDC_OPTS_XDUPLICATE), Status); 00543 pPrefsDlg->EnableGadget(_R(IDC_OPTS_YDUPLICATE), Status); 00544 00545 return TRUE; 00546 }
|
|
Takes the values in the Edit section tab of the options dialog box and sets the associated preference values accordingly Called when ok is pressed on the dialog box.
Implements OptionsTabs. Definition at line 261 of file optsedit.cpp. 00262 { 00263 TRACEUSER( "Neville", _T("commit edit section\n")); 00264 ERROR2IF(pPrefsDlg == NULL,FALSE,"EditTab::CommitSection called with no dialog pointer"); 00265 00266 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT)); // The edit page identifier 00267 if (!ok) 00268 return TRUE; // Talk to page failed to return now 00269 00270 // Section = Edit 00271 00272 // Ok has been pressed so take the values from this section of the dialog box 00273 BOOL Valid=FALSE; // Flag for validity of value 00274 BOOL State=FALSE; // Flag for state of button/switch 00275 BOOL SetOk=TRUE; // Preference value set ok 00276 00277 // Section = Attributes 00278 00279 State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_ASKSETATTRB), 0, 1, 0, &Valid); 00280 SetOk = Camelot.SetPrefValue(TEXT("Attributes"),TEXT("AskBeforeSettingCurrentAttr"),&State); 00281 ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_EDIT)); 00282 00283 State = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_LASTATTRB), 0, 1, 0, &Valid); 00284 SetOk = Camelot.SetPrefValue(TEXT("Attributes"),TEXT("LastAttrAppliedBecomesCurrent"),&State); 00285 ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_EDIT)); 00286 00287 00288 // Set up the units that are used in the currently selected document 00289 // All units work off the selected document and so we must do nothing if there is no 00290 // selected document. 00291 ok = SetUpDocUnits(); 00292 if (!ok) 00293 return (TRUE); 00294 00295 // Section = Constraints 00296 00297 // Now the constraint angle combo box 00298 // Convert to double uses units and so requires a selected document 00299 double Angle = 0.0; // Angle stored in radians in the preference system 00300 double AngleInDegrees = 0; // Angle displayed in degrees to the user 00301 AngleInDegrees = pPrefsDlg->GetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 00302 0, 360, _R(IDE_OPTS_INVALIDANGLE), &Valid); 00303 if (Valid) 00304 { 00305 // Angle in correct range so put it into the preference system 00306 Angle = AngleInDegrees * PI/180.0; // convert angle to radians 00307 TRACEUSER( "Neville", _T("commit constraint angle in degrees='%d' angle='%d' Valid ='%d'\n"), AngleInDegrees, Angle, Valid); 00308 SetOk = Camelot.SetPrefValue(TEXT("Constraints"), TEXT("Constrain Angle"), &Angle); 00309 ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_EDIT)); 00310 } 00311 else 00312 return FALSE; // Angle incorrect, user has been warned already 00313 00314 // Now the duplicate distance 00315 INT32 x = 0; 00316 INT32 y = 0; 00317 const INT32 Maxxy = INT_MAX; // maximum value allowed as the distance 00318 BOOL bValidX = FALSE; 00319 BOOL bValidY = FALSE; 00320 00321 ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT)); // The edit page identifier 00322 x = pPrefsDlg->GetUnitGadgetValue(_R(IDC_OPTS_XDUPLICATE), CurrentScaledUnits, 00323 -Maxxy, Maxxy, _R(IDE_OPTS_INVALIDDISTANCE), &bValidX); 00324 /* if (Valid) 00325 { 00326 SetOk = Camelot.SetPrefValue(TEXT("Duplicate"), TEXT("DuplicatePlacementX"), &x); 00327 ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_EDIT)); 00328 } 00329 else 00330 return FALSE; // Duplicate x incorrect, user has been warned already 00331 */ 00332 ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT)); // The edit page identifier 00333 y = pPrefsDlg->GetUnitGadgetValue(_R(IDC_OPTS_YDUPLICATE), CurrentScaledUnits, 00334 -Maxxy, Maxxy, _R(IDE_OPTS_INVALIDDISTANCE), &bValidY); 00335 /* if (Valid) 00336 { 00337 SetOk = Camelot.SetPrefValue(TEXT("Duplicate"), TEXT("DuplicatePlacementY"), &y); 00338 ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_EDIT)); 00339 } 00340 else 00341 return FALSE; // Duplicate y incorrect, user has been warned already 00342 */ 00343 if (bValidX && bValidY) 00344 { 00345 pDocument->SetDuplicationOffset(DocCoord(x,y)); 00346 pDocument->SetModified(TRUE); 00347 } 00348 else 00349 return FALSE; 00350 00351 // Now the nudge size distance 00352 UINT32 Nudge = 0; 00353 ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT)); // The edit page identifier 00354 Nudge = pPrefsDlg->GetUnitGadgetValue(_R(IDC_OPTS_NUDGESIZE), CurrentScaledUnits, 00355 0, INT_MAX, _R(IDE_OPTS_INVALIDNUDGE), &Valid); 00356 TRACEUSER( "Neville", _T("commit nudge distance='%d' Valid ='%d'\n"),Nudge, Valid); 00357 if (Valid) 00358 { 00359 /*SetOk =*/ pDocument->SetDocNudge (Nudge);//Camelot.SetPrefValue(TEXT("Nudge"), TEXT("StepSize"), &Nudge); 00360 pDocument->SetModified (TRUE); 00361 //ERROR2IF(!SetOk,2,_R(IDE_OPTS_SETPREF_EDIT)); 00362 } 00363 else 00364 return FALSE; // Nudge size incorrect, user has been warned already 00365 00366 return TRUE; 00367 }
|
|
Allows the options dialog code to determine the dialog ID of this section.
Implements OptionsTabs. Definition at line 196 of file optsedit.cpp. 00197 { 00198 return _R(IDD_OPTSTAB_EDIT); 00199 }
|
|
Called when the user has closed all documents.
Reimplemented from OptionsTabs. Definition at line 455 of file optsedit.cpp. 00456 { 00457 TRACEUSER( "Neville", _T("GreySection in EditTab section\n")); 00458 ERROR2IF(pPrefsDlg == NULL,FALSE,"EditTab::GreySection called with no dialog pointer"); 00459 00460 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT)); // The EditTab identifier 00461 if (!ok) 00462 return TRUE; // Talk to page failed to return now 00463 00464 // Only update if we are not already grey 00465 if (GreyStatus == TRUE) 00466 return TRUE; 00467 00468 // Call our central greying/ungreying function 00469 ok = ChangeControlStatus(FALSE); 00470 00471 GreyStatus = TRUE; 00472 00473 return ok; 00474 }
|
|
Handles all the Edit options tabs messages.
Implements OptionsTabs. Definition at line 635 of file optsedit.cpp. 00636 { 00637 TRACEUSER( "Neville", _T("HandleEditMsg\n")); 00638 ERROR2IF(Msg == NULL,FALSE,"EditTab::Message null message received"); 00639 ERROR2IF(pPrefsDlg == NULL,FALSE,"EditTab::HandleMsg called with no dialog pointer"); 00640 00641 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT)); // The edit page identifier 00642 if (!ok) 00643 return TRUE; // no page present = handled message 00644 00645 switch(Msg->DlgMsg) 00646 { 00647 case DIM_CREATE: // Initialise controls 00648 GreyStatus = FALSE; // we are ungreyed by default 00649 ok = InitSection(); 00650 if (!ok) 00651 InformError(); 00652 break; 00653 case DIM_SELECTION_CHANGED: 00654 case DIM_LFT_BN_CLICKED: 00655 case DIM_TEXT_CHANGED: 00656 OptionsTabs::SetApplyNowState(TRUE); 00657 break; 00658 default: 00659 break; 00660 } 00661 return TRUE; 00662 }
|
|
EditTab initialisation routine.
Reimplemented from OptionsTabs. Definition at line 175 of file optsedit.cpp. 00176 { 00177 return TRUE; 00178 }
|
|
Sets initial values for the Edit section of the options dialog box. This section includes the:-.
Implements OptionsTabs. Definition at line 681 of file optsedit.cpp. 00682 { 00683 TRACEUSER( "Neville", _T("InitEditSection\n")); 00684 ERROR2IF(pPrefsDlg == NULL,FALSE,"EditTab::InitSection called with no dialog pointer"); 00685 00686 BOOL ReadOk = FALSE; // Flag to say whether the preference value was read ok 00687 BOOL ok = TRUE; // Flag for whether value set up ok 00688 00689 // Section = Attributes 00690 00691 BOOL AskBeforeSetting = FALSE; 00692 ReadOk = Camelot.GetPrefValue(TEXT("Attributes"), TEXT("AskBeforeSettingCurrentAttr"), &AskBeforeSetting); 00693 pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_ASKSETATTRB), AskBeforeSetting); 00694 ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_EDIT)); 00695 00696 BOOL LastAttribute = FALSE; 00697 ReadOk = Camelot.GetPrefValue(TEXT("Attributes"), TEXT("LastAttrAppliedBecomesCurrent"), &LastAttribute); 00698 pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_LASTATTRB), LastAttribute); 00699 ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_EDIT)); 00700 00701 // Set up the units that are used in the currently selected document 00702 // All units work off the selected document and so we must do nothing if there is no 00703 // selected document. 00704 ok = SetUpDocUnits(); 00705 if (!ok) 00706 { 00707 // If this fails then there is no document and so we must ensure 00708 // things which need a selected document are greyed. 00709 GreySection(); 00710 return (TRUE); 00711 } 00712 00713 // Section = Constraints 00714 00715 // Now the constraint angle combo box 00716 double Angle = 0.0; // Angle stored in radians in the preference system 00717 double AngleInDegrees = 0; // Angle displayed in degrees to the user 00718 ReadOk = Camelot.GetPrefValue(TEXT("Constraints"), TEXT("Constrain Angle"), &Angle); 00719 TRACEUSER( "Neville", _T("set constraint angle '%d'\n"),Angle); 00720 // Set up the list of available options 00721 pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 12.0); 00722 pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 15.0); 00723 pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 30.0); 00724 pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 45.0); 00725 pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 60.0); 00726 pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 72.0); 00727 pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), 90.0); 00728 pPrefsDlg->SetComboListLength(_R(IDC_OPTS_ANGLECONST)); 00729 // Set up the default option displayed 00730 AngleInDegrees = (Angle * 180.0/PI); // Convert angle to degrees 00731 ok = pPrefsDlg->SetDoubleGadgetValue(_R(IDC_OPTS_ANGLECONST), AngleInDegrees, FALSE, -1); 00732 ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_EDIT)); 00733 00734 // Now the duplicate distance 00735 // INT32 x = 0; 00736 // INT32 y = 0; 00737 DocCoord offset = pDocument->GetDuplicationOffset(); 00738 // ReadOk = Camelot.GetPrefValue(TEXT("Duplicate"), TEXT("DuplicatePlacementX"), &x); 00739 ok = pPrefsDlg->SetUnitGadgetValue(_R(IDC_OPTS_XDUPLICATE), CurrentScaledUnits, offset.x, FALSE, -1); 00740 ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_EDIT)); 00741 00742 // ReadOk = Camelot.GetPrefValue(TEXT("Duplicate"), TEXT("DuplicatePlacementY"), &y); 00743 ok = pPrefsDlg->SetUnitGadgetValue(_R(IDC_OPTS_YDUPLICATE), CurrentScaledUnits, offset.y, FALSE, -1); 00744 ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_EDIT)); 00745 00746 // Now the nudge size distance 00747 UINT32 Nudge = pDocument->GetDocNudge (); 00748 //ReadOk SetOk = pDocument->SetDocNudge (Nudge);//Camelot.GetPrefValue(TEXT("Nudge"), TEXT("StepSize"), &Nudge); 00749 ok = pPrefsDlg->SetUnitGadgetValue(_R(IDC_OPTS_NUDGESIZE), CurrentScaledUnits, Nudge, FALSE, -1); 00750 ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_EDIT)); 00751 00752 return TRUE; 00753 }
|
|
Allows the document options dialog code to determine if this tab belongs to the group of document options.
Implements OptionsTabs. Definition at line 217 of file optsedit.cpp. 00218 { 00219 return FALSE; // This tab is not a document option 00220 }
|
|
Allows the program options dialog code to determine if this tab belongs to the group of program options.
Implements OptionsTabs. Definition at line 238 of file optsedit.cpp. 00239 { 00240 return TRUE; // This tab is a program option 00241 }
|
|
Function called when new default units come into operation. We must convert all units fields to display in the newly specified units.
Reimplemented from OptionsTabs. Definition at line 385 of file optsedit.cpp. 00386 { 00387 TRACEUSER( "Neville", _T("New units in edit section\n")); 00388 ERROR2IF(pPrefsDlg == NULL,FALSE,"EditTab::NewUnitsInSection called with no dialog pointer"); 00389 00390 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT)); // The edit page identifier 00391 if (!ok) 00392 return TRUE; // Talk to page failed to return now 00393 00394 // Set up the common variables 00395 BOOL Valid=FALSE; // Flag for validity of value 00396 00397 // We will not error on any of the conversions as this might mean double errors 00398 // when say an apply is used but instead just ignore the conversion. This also means 00399 // not specifying an error message in the GetUnitGadgetValue calls. 00400 00401 // Set up the units that are used in the currently selected document 00402 // All units work off the selected document and so we must do nothing if there is no 00403 // selected document. 00404 ok = SetUpDocUnits(); 00405 if (!ok) 00406 return (TRUE); 00407 00408 // Now the duplicate distance 00409 INT32 x = 0; 00410 INT32 y = 0; 00411 const INT32 Maxxy = INT_MAX; // maximum value allowed as the distance 00412 00413 x = pPrefsDlg->GetUnitGadgetValue(_R(IDC_OPTS_XDUPLICATE), CurrentScaledUnits, 00414 -Maxxy, Maxxy, 0, &Valid); 00415 if (Valid) 00416 { 00417 ok = pPrefsDlg->SetUnitGadgetValue(_R(IDC_OPTS_XDUPLICATE), CurrentScaledUnits, x, FALSE, -1); 00418 } 00419 00420 y = pPrefsDlg->GetUnitGadgetValue(_R(IDC_OPTS_YDUPLICATE), CurrentScaledUnits, 00421 -Maxxy, Maxxy, 0, &Valid); 00422 if (Valid) 00423 { 00424 ok = pPrefsDlg->SetUnitGadgetValue(_R(IDC_OPTS_YDUPLICATE), CurrentScaledUnits, y, FALSE, -1); 00425 } 00426 00427 // Now the nudge size distance 00428 UINT32 Nudge = 0; 00429 Nudge = pPrefsDlg->GetUnitGadgetValue(_R(IDC_OPTS_NUDGESIZE), CurrentScaledUnits, 00430 0, INT_MAX, 0, &Valid); 00431 if (Valid) 00432 { 00433 ok = pPrefsDlg->SetUnitGadgetValue(_R(IDC_OPTS_NUDGESIZE), CurrentScaledUnits, Nudge, FALSE, -1); 00434 } 00435 00436 return TRUE; 00437 }
|
|
Called when the user has selected a new document.
Reimplemented from OptionsTabs. Definition at line 491 of file optsedit.cpp. 00492 { 00493 TRACEUSER( "Neville", _T("UngreySection in EditTab section\n")); 00494 ERROR2IF(pPrefsDlg == NULL,FALSE,"EditTab::UngreySection called with no dialog pointer"); 00495 00496 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT)); // The EditTab identifier 00497 if (!ok) 00498 return TRUE; // Talk to page failed to return now 00499 00500 // Only update if we are not already ungrey 00501 if (GreyStatus == FALSE) 00502 return TRUE; 00503 00504 // Call our central greying/ungreying function 00505 ok = ChangeControlStatus(TRUE); 00506 00507 GreyStatus = FALSE; 00508 00509 return ok; 00510 }
|
|
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.
Definition at line 601 of file optsedit.cpp. 00602 { 00603 TRACEUSER( "Neville", _T("EditTab::UpdateAskBefore()\n")); 00604 ERROR2IF(pPrefsDlg == NULL,FALSE,"EditTab::UpdateAskBefore() called with no dialog pointer"); 00605 00606 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT)); // The EditTab identifier 00607 if (!ok) 00608 return TRUE; // page not present 00609 00610 BOOL AskBeforeSetting = FALSE; 00611 BOOL ReadOk = FALSE; 00612 ReadOk = Camelot.GetPrefValue(TEXT("Attributes"), TEXT("AskBeforeSettingCurrentAttr"), &AskBeforeSetting); 00613 pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_ASKSETATTRB), AskBeforeSetting); 00614 //ERROR2IF(!ReadOk,FALSE,_R(IDE_OPTS_READPREF_EDIT)); 00615 00616 return(TRUE); 00617 00618 }
|
|
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.
Reimplemented from OptionsTabs. Definition at line 565 of file optsedit.cpp. 00566 { 00567 TRACEUSER( "Neville", _T("EditTab::UpdateSection\n")); 00568 ERROR2IF(pPrefsDlg == NULL,FALSE,"EditTab::UpdateSection called with no dialog pointer"); 00569 00570 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_EDIT)); // The EditTab identifier 00571 if (!ok) 00572 return TRUE; // page not present 00573 00574 // Remove any lists that we have created. 00575 pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_ANGLECONST)); 00576 00577 // Call the normal init section code 00578 return InitSection(); 00579 }
|
|
Definition at line 165 of file optsedit.h. |