#include <optsscal.h>
Inheritance diagram for ScaleTab:
Public Member Functions | |
ScaleTab () | |
ScaleTab constructor. Creates a non-Scaleable operation. | |
~ScaleTab () | |
ScaleTab destructor. | |
virtual BOOL | Init () |
ScaleTab initialisation routine. | |
virtual BOOL | HandleMsg (DialogMsg *Msg) |
Handles all the Scale options tabs messages. | |
virtual BOOL | InitSection () |
Sets initial values for the Scale section of the options dialog box. This section includes the:-. | |
virtual BOOL | CommitSection () |
Takes the values in the Scale 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. | |
Protected Member Functions | |
BOOL | ShowScaleDetails () |
Shows scale factor details in the dialog. | |
Protected Attributes | |
DimScale * | pDimScale |
Private Attributes | |
BOOL | GreyStatus |
String_256 | OldDrawingStr |
String_256 | OldRealStr |
BOOL | OldActiveState |
Definition at line 123 of file optsscal.h.
|
ScaleTab constructor. Creates a non-Scaleable operation.
Definition at line 141 of file optsscal.cpp.
|
|
ScaleTab destructor.
Definition at line 162 of file optsscal.cpp.
|
|
Called to grey/ungrey all controls on this tab.
Definition at line 495 of file optsscal.cpp. 00496 { 00497 // Grey/ungrey the information fields 00498 pPrefsDlg->EnableGadget(_R(IDC_OPTS_INFO), Status); 00499 00500 // Grey/ungrey the controlling Switch 00501 pPrefsDlg->EnableGadget(_R(IDC_OPTS_USESCALEFACTOR), Status); 00502 00503 // Grey/ungrey the display fields 00504 pPrefsDlg->EnableGadget(_R(IDC_OPTS_DRAWINGSCALE), Status); 00505 pPrefsDlg->EnableGadget(_R(IDC_OPTS_REALSCALE), Status); 00506 00507 // Grey/ungrey the static text fields accordingly 00508 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEGROUP), Status); 00509 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEEG), Status); 00510 pPrefsDlg->EnableGadget(_R(IDC_OPTS_REALWORLD), Status); 00511 pPrefsDlg->EnableGadget(_R(IDC_OPTS_DRAWING), Status); 00512 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALETO), Status); 00513 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALETO2), Status); 00514 00515 return TRUE; 00516 }
|
|
Takes the values in the Scale 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 268 of file optsscal.cpp. 00269 { 00270 TRACEUSER( "Neville", _T("commit Scale section\n")); 00271 ERROR3IF(pPrefsDlg == NULL, "ScaleTab::CommitSection called with no dialog pointer"); 00272 00273 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE)); // The Scale tab identifier 00274 if (!ok) 00275 return TRUE; // Talk to View failed to return now 00276 00277 // Ok has been pressed so take the values from this section of the dialog box 00278 // Takes the values in the dialog and sets the DimScale object accordingly. 00279 BOOL Valid=TRUE; // Flag for validity of value 00280 // BOOL State=FALSE; // Flag for state of button/switch 00281 BOOL SetOk=TRUE; // Preference value set ok 00282 00283 // Section = Scale settings 00284 00285 // Now check that we have the selected view still, just in case it has switched 00286 // without us being told about it or even we have no current document/view. 00287 // This may be a valid state now, so do not complain about it. 00288 DocView* pCurrentView = DocView::GetSelected(); 00289 if (pCurrentView != NULL) 00290 { 00291 // Only if there is a current view do we read the values. 00292 String_256 DrawingStr; 00293 String_256 RealStr; 00294 //TCHAR* pDrawingStr = DrawingStr; 00295 //TCHAR* pRealStr = RealStr; 00296 BOOL Active; 00297 00298 // Get the values from the dialog box 00299 Active = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_USESCALEFACTOR),0,1,0, &Valid); 00300 DrawingStr = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_DRAWINGSCALE), &Valid); 00301 RealStr = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_REALSCALE), &Valid); 00302 00303 Spread* pSpread = pCurrentView->GetFirstSelectedSpread(); 00304 // If no selected spread then use the visible spread 00305 if (pSpread == NULL) 00306 pSpread = pCurrentView->GetVisibleSpread(); 00307 00308 // Only do the chnage if we have a valid spread pointer and we have changed something. 00309 if ( (pSpread != NULL) && 00310 ( 00311 (OldActiveState != Active) || 00312 (OldDrawingStr != DrawingStr) || 00313 (OldRealStr != RealStr) 00314 ) 00315 ) 00316 { 00317 pDimScale = pSpread->GetPtrDimScale(); 00318 if (pDimScale != NULL) 00319 { 00320 // Only if active is set do we need to try and set new strings 00321 // and hence a new drawing scale 00322 if (Active) 00323 { 00324 // Dim Scales can only be 32 characters long 00325 String_32 DrawingStr32 = _T(""); 00326 String_32 RealStr32 = _T(""); 00327 // Check if read in strings are longer than this 00328 if (DrawingStr.Length() > DrawingStr32.MaxLength()) 00329 { 00330 InformError(_R(IDE_OPTS_INVALIDDRAWSCALE)); 00331 return FALSE; 00332 } 00333 if (RealStr.Length() > RealStr32.MaxLength()) 00334 { 00335 InformError(_R(IDE_OPTS_INVALIDREALSCALE)); 00336 return FALSE; 00337 } 00338 00339 RealStr32 = RealStr; 00340 DrawingStr32 = DrawingStr; 00341 00342 // Try and set these strings as new drawing and real scales strings 00343 SetOk = pDimScale->SetDrawingScaleStr(DrawingStr32); 00344 if (!SetOk) 00345 { 00346 InformError(_R(IDE_OPTS_INVALIDDRAWSCALE)); 00347 return FALSE; 00348 } 00349 00350 SetOk = SetOk && pDimScale->SetRealScaleStr(RealStr32); 00351 if (!SetOk) 00352 { 00353 InformError(_R(IDE_OPTS_INVALIDREALSCALE)); 00354 return FALSE; 00355 } 00356 00357 // Now try to convert these into a new scaling factor 00358 if (SetOk) 00359 SetOk = SetOk && pDimScale->SetScaleFactor(); 00360 00361 // If we failed in any of the conversions then warn the user and fail 00362 if (!SetOk) 00363 { 00364 InformError(_R(IDE_OPTS_INVALIDSCALING)); 00365 return FALSE; 00366 } 00367 } 00368 00369 // Set up a possibly new active state 00370 pDimScale->SetActiveState(Active); 00371 00372 } 00373 00374 // Now tell other users of units/scaling factors that there they are likely 00375 // to need to update any currently displayed units. 00376 Document *pCurrentDoc = (Document *)pSpread->FindOwnerDoc(); 00377 BROADCAST_TO_ALL(OptionsChangingMsg(pCurrentDoc, OptionsChangingMsg::NEWUNITS)); 00378 // unfortunately pScopeDoc is NULL!, and since pCurrentDoc is calulated I thought it ought to use! - Ed 17/10/95 00379 // BROADCAST_TO_ALL(OptionsChangingMsg(pScopeDocument, OptionsChangingMsg::OptionsState::NEWUNITS)); 00380 00381 // Make sure the document is marked as modified. 00382 pCurrentDoc->SetModified(TRUE); 00383 00384 // And note the new states 00385 OldActiveState = Active; 00386 OldDrawingStr = DrawingStr; 00387 OldRealStr = RealStr; 00388 } 00389 } 00390 // else 00391 // ERROR2(FALSE,_R(IDE_OPTS_READPREF_SCALE)); 00392 00393 return TRUE; 00394 }
|
|
Allows the options dialog code to determine the dialog ID of this section.
Implements OptionsTabs. Definition at line 203 of file optsscal.cpp. 00204 { 00205 return _R(IDD_OPTSTAB_SCALE); 00206 }
|
|
Called when the user has closed all documents.
Reimplemented from OptionsTabs. Definition at line 411 of file optsscal.cpp. 00412 { 00413 TRACEUSER( "Neville", _T("GreySection in ScaleTab section\n")); 00414 ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::GreySection called with no dialog pointer"); 00415 00416 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE)); // The ScaleTab identifier 00417 if (!ok) 00418 return TRUE; // Talk to page failed to return now 00419 00420 // Make sure the information field displaying the name of the current document 00421 // is correct. 00422 String_256 DocumentName(_R(IDT_OPTS_SCALING_INFO)); 00423 DocumentName += *GetDocumentName(); 00424 pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName); 00425 00426 // Only update if we are not already grey 00427 if (GreyStatus == TRUE) 00428 return TRUE; 00429 00430 // Call our central greying/ungreying function 00431 ok = ChangeControlStatus(FALSE); 00432 00433 GreyStatus = TRUE; 00434 00435 return ok; 00436 }
|
|
Handles all the Scale options tabs messages.
Implements OptionsTabs. Definition at line 566 of file optsscal.cpp. 00567 { 00568 TRACEUSER( "Neville", _T("HandleScaleMsg\n")); 00569 ERROR2IF(Msg == NULL,FALSE,"ScaleTab::Message null message received"); 00570 ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::HandleMsg called with no dialog pointer"); 00571 00572 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE)); // The Scale tab identifier 00573 if (!ok) 00574 return TRUE; // page not present 00575 00576 switch(Msg->DlgMsg) 00577 { 00578 case DIM_CREATE: // Initialise controls 00579 GreyStatus = FALSE; // we are ungreyed by default 00580 ok = InitSection(); 00581 if (!ok) 00582 InformError(); 00583 break; 00584 case DIM_LFT_BN_CLICKED: 00585 OptionsTabs::SetApplyNowState(TRUE); 00586 if (Msg->GadgetID == _R(IDC_OPTS_USESCALEFACTOR)) 00587 { 00588 BOOL Valid; 00589 BOOL Active = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_USESCALEFACTOR),0,1,0,&Valid); 00590 // Grey/ungrey the editable fields accordingly 00591 pPrefsDlg->EnableGadget(_R(IDC_OPTS_DRAWINGSCALE), Active); 00592 pPrefsDlg->EnableGadget(_R(IDC_OPTS_REALSCALE), Active); 00593 // Grey/ungrey the static text fields accordingly 00594 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEEG), Active); 00595 pPrefsDlg->EnableGadget(_R(IDC_OPTS_REALWORLD), Active); 00596 pPrefsDlg->EnableGadget(_R(IDC_OPTS_DRAWING), Active); 00597 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALETO), Active); 00598 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALETO2), Active); 00599 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEGROUP), Active); 00600 } 00601 break; 00602 case DIM_SELECTION_CHANGED: 00603 case DIM_TEXT_CHANGED: 00604 OptionsTabs::SetApplyNowState(TRUE); 00605 break; 00606 default: 00607 break; 00608 } 00609 00610 return TRUE; 00611 }
|
|
ScaleTab initialisation routine.
Reimplemented from OptionsTabs. Definition at line 182 of file optsscal.cpp. 00183 { 00184 return TRUE; 00185 }
|
|
Sets initial values for the Scale section of the options dialog box. This section includes the:-.
Implements OptionsTabs. Definition at line 630 of file optsscal.cpp. 00631 { 00632 TRACEUSER( "Neville", _T("ScaleTab::InitSection\n")); 00633 ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::InitSection called with no dialog pointer"); 00634 00635 // BOOL ReadOk = FALSE; // Flag to say whether the preference value was read ok 00636 00637 // Make sure the information field displaying the name of the current document 00638 // is correct. 00639 String_256 DocumentName(_R(IDT_OPTS_SCALING_INFO)); 00640 DocumentName += *GetDocumentName(); 00641 pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName); 00642 00643 // Section = Scale settings 00644 00645 DocView* pSelectedView = DocView::GetSelected(); 00646 // This may now be a valid state so must not error 00647 //ERROR3IF(pSelectedView == NULL,"ScaleTab::InitSection Where's the current view eh?"); 00648 if (pSelectedView != NULL) 00649 { 00650 Spread* pSpread = pSelectedView->GetFirstSelectedSpread(); 00651 00652 // If no selected spread then use the visible spread 00653 if (pSpread == NULL) 00654 pSpread = pSelectedView->GetVisibleSpread(); 00655 00656 // If no selected spread then use the first spread 00657 // Of course, this should not be here but above routines seem to return 00658 // null a bit too often for my liking 00659 if (pSpread == NULL) 00660 { 00661 TRACEUSER( "Neville", _T("ScaleTab::InitSection BODGE! using 1st spread\n")); 00662 Document* pSelectedDoc = Document::GetSelected(); 00663 if (pSelectedDoc !=NULL ) 00664 pSpread = pSelectedDoc->FindFirstSpread(); 00665 } 00666 00667 // Go and get a pointer to the scaling values 00668 if (pSpread != NULL) 00669 { 00670 pDimScale = pSpread->GetPtrDimScale(); 00671 if (pDimScale != NULL) 00672 { 00673 // And now show the initial state of the controls given this 00674 // scaling 00675 ShowScaleDetails(); 00676 } 00677 } 00678 } 00679 else 00680 { 00681 // If no current view then ensure section is greyed 00682 GreySection(); 00683 } 00684 00685 return TRUE; 00686 }
|
|
Allows the document options dialog code to determine if this tab belongs to the group of document options.
Implements OptionsTabs. Definition at line 224 of file optsscal.cpp. 00225 { 00226 return TRUE; // This tab is not a document option 00227 }
|
|
Allows the program options dialog code to determine if this tab belongs to the group of program options.
Implements OptionsTabs. Definition at line 245 of file optsscal.cpp. 00246 { 00247 return TRUE; // This tab is a program option 00248 }
|
|
Shows scale factor details in the dialog.
Definition at line 703 of file optsscal.cpp. 00704 { 00705 TRACEUSER( "Neville", _T("ScaleTab::ShowScaleDetails\n")); 00706 ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::ShowScaleDetails called with no dialog pointer"); 00707 ERROR2IF(pDimScale == NULL,FALSE,"ScaleTab::ShowScaleDetails pDimScale is NULL"); 00708 00709 String_32 Str; 00710 00711 // Get current state of dimension scaling to see whether it is active or 00712 // noton this view. 00713 BOOL Active = pDimScale->IsActive(); 00714 pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_USESCALEFACTOR), (INT32)Active); 00715 // remember entry states in our class variables 00716 OldActiveState = Active; 00717 00718 Str = pDimScale->GetDrawingScaleStr(); 00719 pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_DRAWINGSCALE), Str); 00720 pPrefsDlg->EnableGadget(_R(IDC_OPTS_DRAWINGSCALE), Active); 00721 // remember entry states in our class variables 00722 OldDrawingStr = Str; 00723 00724 Str = pDimScale->GetRealScaleStr(); 00725 pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_REALSCALE), Str); 00726 pPrefsDlg->EnableGadget(_R(IDC_OPTS_REALSCALE), Active); 00727 // remember entry states in our class variables 00728 OldRealStr = Str; 00729 00730 // Grey/ungrey the static text fields accordingly 00731 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEEG), Active); 00732 pPrefsDlg->EnableGadget(_R(IDC_OPTS_REALWORLD), Active); 00733 pPrefsDlg->EnableGadget(_R(IDC_OPTS_DRAWING), Active); 00734 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALETO), Active); 00735 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALETO2), Active); 00736 pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEGROUP), Active); 00737 00738 return TRUE; 00739 }
|
|
Called when the user has selected a new document.
Reimplemented from OptionsTabs. Definition at line 453 of file optsscal.cpp. 00454 { 00455 TRACEUSER( "Neville", _T("UngreySection in ScaleTab section\n")); 00456 ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::UngreySection called with no dialog pointer"); 00457 00458 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE)); // The ScaleTab identifier 00459 if (!ok) 00460 return TRUE; // Talk to page failed to return now 00461 00462 // Make sure the information field displaying the name of the current document 00463 // is correct. 00464 String_256 DocumentName(_R(IDT_OPTS_SCALING_INFO)); 00465 DocumentName += *GetDocumentName(); 00466 pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName); 00467 00468 // Only update if we are not already ungrey 00469 if (GreyStatus == FALSE) 00470 return TRUE; 00471 00472 // Call our central greying/ungreying function 00473 ok = ChangeControlStatus(TRUE); 00474 00475 GreyStatus = FALSE; 00476 00477 return ok; 00478 }
|
|
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 535 of file optsscal.cpp. 00536 { 00537 TRACEUSER( "Neville", _T("ScaleTab::UpdateSection\n")); 00538 ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::UpdateSection called with no dialog pointer"); 00539 00540 BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE)); // The ScaleTab identifier 00541 if (!ok) 00542 return TRUE; // page not present 00543 00544 // Remove any lists that we have created. 00545 //pPrefsDlg->DeleteAllValues(_R(IDC_OPTS_SIZELIST)); 00546 00547 // Call the normal init section code 00548 return InitSection(); 00549 }
|
|
Definition at line 161 of file optsscal.h. |
|
Definition at line 166 of file optsscal.h. |
|
Definition at line 164 of file optsscal.h. |
|
Definition at line 165 of file optsscal.h. |
|
Definition at line 156 of file optsscal.h. |