00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 #include "camtypes.h"
00104
00105
00106
00107 #include "bevinfo.h"
00108
00109 #include "attrbev.h"
00110
00111
00112
00113 #include "nbevcont.h"
00114 #include "opbevel.h"
00115
00116
00117
00118
00119 #include "pen.h"
00120
00121
00122
00123
00124 #include "blobs.h"
00125 #include "bevtool.h"
00126 #include "selall.h"
00127 #include "cutop.h"
00128 #include "csrstack.h"
00129 #include "optsmsgs.h"
00130 #include "gdraw2.h"
00131
00132
00133 #include "ncntrcnt.h"
00134 #include "lineattr.h"
00135
00136
00137 #include "nodebev.h"
00138
00139 DECLARE_SOURCE( "$Revision: 1752 $" );
00140
00141
00142 CC_IMPLEMENT_DYNCREATE( BevelInfoBarOp, InformationBarOp )
00143 #define new CAM_DEBUG_NEW
00144
00145 struct BevelComboMap
00146 {
00147
00148 UINT32 StringID;
00149
00150
00151 INT32 TypeNum;
00152 } ;
00153
00154
00155 INT32 NumBevelTypes = 16;
00156
00157 BevelComboMap BevelTypes[] =
00158 {
00159 { _R(IDS_BEVELNONE), -1 },
00160 { _R(IDS_BEVELFLAT), (INT32)BEVEL_FLAT },
00161 { _R(IDS_BEVELSMOOTH_1), (INT32)BEVEL_SMOOTH_1 } ,
00162 { _R(IDS_BEVELSMOOTH_2), (INT32)BEVEL_SMOOTH_2 } ,
00163 { _R(IDS_BEVELMESA_1), (INT32)BEVEL_MESA_1 },
00164 { _R(IDS_BEVELMESA_2), (INT32)BEVEL_MESA_2 },
00165 { _R(IDS_BEVELROUND), (INT32)BEVEL_ROUND },
00166 { _R(IDS_BEVELHALFROUND), (INT32)BEVEL_HALFROUND},
00167 { _R(IDS_BEVELFRAME), (INT32)BEVEL_FRAME },
00168 { _R(IDS_BEVELPOINT_1), (INT32)BEVEL_POINT_1 },
00169 { _R(IDS_BEVELPOINT_2A), (INT32)BEVEL_POINT_2a },
00170 { _R(IDS_BEVELPOINT_2B), (INT32)BEVEL_POINT_2b },
00171 { _R(IDS_BEVELRUFFLE_2A), (INT32)BEVEL_RUFFLE_2a },
00172 { _R(IDS_BEVELRUFFLE_2B), (INT32)BEVEL_RUFFLE_2b },
00173 { _R(IDS_BEVELRUFFLE_3A), (INT32)BEVEL_RUFFLE_3a },
00174 { _R(IDS_BEVELRUFFLE_3B), (INT32)BEVEL_RUFFLE_3b }
00175 } ;
00176
00177
00178 INT32 NumSliderTypes = 4;
00179 const UINT32 SliderTypes[] =
00180 {
00181 _R(IDS_BEVELDEPTH),
00182 _R(IDS_BEVELCONTRAST),
00183 _R(IDS_BEVELLIGHTANGLE),
00184 _R(IDS_BEVELLIGHTTILT)
00185 } ;
00186
00187
00188 INT32 NumInnerTypes = 2;
00189 const UINT32 InnerTypes[] =
00190 {
00191 _R(IDS_BEVELINNER),
00192 _R(IDS_BEVELOUTER)
00193 } ;
00194
00195
00196 #define BEVEL_DEPTH_MIN 0
00197 #define BEVEL_DEPTH_MAX 250000
00198 #define BEVEL_CONTRAST_MIN 0
00199 #define BEVEL_CONTRAST_MAX 100
00200 #define BEVEL_LIGHTANGLE_MIN 0
00201 #define BEVEL_LIGHTANGLE_MAX 360
00202 #define BEVEL_LIGHTTILT_MIN 0
00203 #define BEVEL_LIGHTTILT_MAX 90
00204
00205
00206 BevelInfoBarOp * BevelInfoBarOp::pCurrentBar = NULL;
00207
00209
00210 CProfileBiasGain BevelSliderProfile((AFp)0.7, (AFp)0.0);
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 BevelInfoBarOp::BevelInfoBarOp()
00223 {
00224 DlgResID = _R(IDD_BEVELINFOBAR);
00225
00226 ControlsExist = FALSE;
00227
00228
00229 m_bControlsEnabled = FALSE;
00230
00231
00232 m_Depth = 0;
00233 m_LightAngle = 0;
00234 m_Contrast = 100;
00235 m_SliderComboIndex = 1;
00236 m_bComboChanged = FALSE;
00237 m_bAmDragging = FALSE;
00238 m_pDragBlob = NULL;
00239 m_BlobAngle = 0;
00240 m_bUserSet = FALSE;
00241 m_UserIndent = FALSE;
00242 m_bButtonIsInner = FALSE;
00243 m_bButtonIsOuter = FALSE;
00244 m_bAmDraggingSlider = FALSE;
00245 pTool = NULL;
00246 CanRetroFit = FALSE;
00247 m_LightTilt = 0;
00248 m_LastDragWidth = 0;
00249 m_BetweenViews = FALSE;
00250 }
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270 MsgResult BevelInfoBarOp::Message(Msg* Message)
00271 {
00272
00273 INT32 value = 0;
00274
00275 if (IS_OUR_DIALOG_MSG(Message))
00276 {
00277 DialogMsg* Msg = (DialogMsg*)Message;
00278
00279
00280 if (Msg->DlgMsg == DIM_CANCEL)
00281 {
00282
00283 Close();
00284 m_bComboChanged = FALSE;
00285 }
00286 else if (Msg->DlgMsg == DIM_CREATE)
00287 {
00288 m_BetweenViews = FALSE;
00289
00290
00291 if (WindowID!=NULL)
00292 {
00293
00294 ControlsExist = TRUE;
00295
00296 String_64 Str;
00297
00298
00299
00300 SetLongGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT), 0, FALSE, -1);
00301
00302
00303 DeleteAllValues( _R(IDC_BEVEL_SLIDER_COMBO));
00304
00305
00306 for ( INT32 i=0; i<NumSliderTypes; i++ )
00307 {
00308 Str.Load( SliderTypes[i] );
00309 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_COMBO), Str, TRUE, i);
00310 }
00311
00312 SetComboListLength(_R(IDC_BEVEL_SLIDER_COMBO));
00313
00314 LoadBevelTypeComboStrings(FALSE);
00315 LoadBevelDirectionComboStrings(FALSE);
00316
00317 UpdateControls();
00318 UpdateJoinTypeControls();
00319
00320 SetGadgetBitmaps(_R(IDC_BEVELSLIDER), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
00321
00322 m_bComboChanged = FALSE;
00323 }
00324
00325 }
00326 else
00327 {
00328
00329 if (ControlsExist)
00330 {
00331 if (WindowID!=NULL)
00332 {
00333 if (FALSE) {}
00334 else if (Msg->GadgetID == _R(IDC_BEVEL_TYPE_COMBO))
00335 {
00336 if (Msg->DlgMsg == DIM_SELECTION_CHANGED)
00337 {
00338
00339 HandleBevelTypeChanged();
00340 }
00341 }
00342 else if (Msg->GadgetID == _R(IDC_BEVEL_SLIDER_COMBO))
00343 {
00344 if (Msg->DlgMsg == DIM_SELECTION_CHANGED)
00345 {
00346
00347 SliderUpdate(FALSE);
00348 }
00349 }
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361 else if (Msg->GadgetID == _R(IDC_BEVELSLIDER))
00362 {
00363
00364 if (Msg->DlgMsg == DIM_SLIDER_POS_SET)
00365 {
00366 if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 0)
00367 {
00368 pTool->m_pDragBevelOp->RenderDragBlobs(m_LastDragWidth,
00369 Document::GetSelectedSpread());
00370 }
00371
00372 HandleSliderChanged();
00373 m_bAmDraggingSlider = FALSE;
00374 }
00375 else if (Msg->DlgMsg == DIM_SLIDER_POS_CHANGING)
00376 {
00377
00378
00379 if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 0)
00380 {
00381 if (!m_bAmDraggingSlider)
00382 {
00383 pTool->m_pDragBevelOp->SetupDragInfo();
00384 m_bAmDraggingSlider = TRUE;
00385 }
00386 else
00387 {
00388
00389
00390 pTool->m_pDragBevelOp->RenderDragBlobs(m_LastDragWidth,
00391 Document::GetSelectedSpread());
00392 }
00393 }
00394
00395
00396 m_bAmDraggingSlider = TRUE;
00397 if (pTool->AreManyBevelLightAngles() &&
00398 GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 2)
00399 {
00400
00401 MsgResult Result = InformationBarOp::Message(Message);
00402 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_LIGHTANGLE_MIN, BEVEL_LIGHTANGLE_MAX);
00403
00404 INT32 Angle = GetLongGadgetValue(_R(IDC_BEVELSLIDER),
00405 BEVEL_LIGHTANGLE_MIN,
00406 BEVEL_LIGHTANGLE_MAX);
00407
00408
00409
00410
00411
00412 pTool->ChangeBlobAngles(Angle);
00413
00414
00415 SliderUpdate(TRUE);
00416
00417 return Result;
00418 }
00419 if (pTool->AreManyBevelLightTilts() &&
00420 GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 3)
00421 {
00422
00423 MsgResult Result = InformationBarOp::Message(Message);
00424 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_LIGHTTILT_MIN, BEVEL_LIGHTTILT_MAX);
00425
00426 INT32 Angle = GetLongGadgetValue(_R(IDC_BEVELSLIDER),
00427 BEVEL_LIGHTTILT_MIN,
00428 BEVEL_LIGHTTILT_MAX);
00429
00430
00431
00432
00433
00434 pTool->ChangeBlobTilts(Angle);
00435
00436
00437 SliderUpdate(TRUE);
00438
00439 return Result;
00440 }
00441 else
00442 {
00443 SliderUpdate(TRUE);
00444
00445 if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 3)
00446 {
00447 RedrawBlobs(FALSE, TRUE);
00448 }
00449 else
00450 {
00451 RedrawBlobs(TRUE, FALSE);
00452 }
00453
00454
00455 if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 0)
00456 {
00457 INT32 Width = m_Depth;
00458
00459 if(!m_bButtonIsInner)
00460 Width = -Width;
00461
00462 pTool->m_pDragBevelOp->RenderDragBlobs(Width,Document::GetSelectedSpread());
00463 m_LastDragWidth = Width;
00464 }
00465 }
00466
00467
00468 PaintGadgetNow(_R(IDC_BEVEL_SLIDER_EDIT));
00469 }
00470 }
00471 else if (Msg->GadgetID == _R(IDC_BEVEL_SLIDER_EDIT))
00472 {
00473 if (Msg->DlgMsg == DIM_SELECTION_CHANGED)
00474 {
00475 if (ConvertStringToValue(_R(IDC_BEVEL_SLIDER_EDIT), value))
00476 {
00477
00478 if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 0)
00479 {
00480 m_Depth = value;
00481 }
00482 else if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 1)
00483 {
00484 m_Contrast = value;
00485 }
00486 else if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 2)
00487 {
00488 m_LightAngle = value;
00489 }
00490 else if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 3)
00491 {
00492 if (value < 0 || value > 90)
00493 {
00494 SliderUpdate(FALSE);
00495 goto sliderout;
00496 }
00497
00498 m_LightTilt = value;
00499 }
00500 }
00501
00502 SliderUpdate(FALSE);
00503 HandleSliderChanged();
00504 sliderout: {}
00505 }
00506 }
00507 else if (Msg->GadgetID == _R(IDC_BTN_BEVELOUTER))
00508 {
00509 if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
00510 {
00511 if (!m_bButtonIsOuter)
00512 {
00513
00514 HandleBevelDirectionsToOuter();
00515 }
00516 else
00517 {
00518 UpdateControls();
00519 }
00520 }
00521 }
00522 else if (Msg->GadgetID == _R(IDC_BTN_BEVELINNER))
00523 {
00524 if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
00525 {
00526 if (!m_bButtonIsInner)
00527 {
00528
00529 HandleBevelDirectionsToInner();
00530 }
00531 else
00532 {
00533 UpdateControls();
00534 }
00535 }
00536 }
00537 else if (Msg->GadgetID == _R(IDC_BEVELJOINTYPEMITRE))
00538 {
00539 if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
00540 {
00541 HandleJoinTypeMitreClicked();
00542 }
00543 }
00544 else if (Msg->GadgetID == _R(IDC_BEVELJOINTYPEROUND))
00545 {
00546 if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
00547 {
00548 HandleJoinTypeRoundClicked();
00549 }
00550 }
00551 else if (Msg->GadgetID == _R(IDC_BEVELJOINTYPEBEVEL))
00552 {
00553 if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
00554 {
00555 HandleJoinTypeBevelClicked();
00556 }
00557 }
00558 }
00559 }
00560 }
00561 }
00562 else
00563 {
00564 if (Tool::GetCurrentID() == TOOLID_BEVELTOOL)
00565 {
00566 if (MESSAGE_IS_A(Message, DocViewMsg))
00567 {
00568
00569 DocViewMsg* msg = (DocViewMsg*) Message;
00570
00571
00572 if ((msg->State == DocViewMsg::SELABOUTTOCHANGE || msg->State == DocViewMsg::SELCHANGED )
00573 && msg->pOldDocView && !GetApplication()->CamelotIsDying())
00574 {
00575
00576 CCamView* pOilView = msg->pOldDocView->GetConnectionToOilView();
00577 BlobManager* pBlobManager = GetApplication()->GetBlobManager();
00578 ENSURE(pBlobManager, "Can't get BlobManager");
00579
00580 PORTNOTE("other", "Removed IsScreenCamView test");
00581 if (pOilView!=NULL )
00582 {
00583
00584 if (msg->State == DocViewMsg::SELABOUTTOCHANGE)
00585 {
00586 pBlobManager->RenderToolBlobsOff(pTool, msg->pOldDocView->GetVisibleSpread(), NULL);
00587 pTool->ClearToolBlobList();
00588
00589 m_BetweenViews = TRUE;
00590 }
00591 else
00592 {
00593 pTool->SetupSelectionBlobs();
00594 pBlobManager->RenderToolBlobsOn(pTool, msg->pOldDocView->GetVisibleSpread(), NULL);
00595
00596 m_BetweenViews = FALSE;
00597 }
00598 }
00599 }
00600 }
00601 else if (MESSAGE_IS_A(Message, OpMsg))
00602 {
00603 if (((OpMsg *)Message)->MsgType == OpMsg::AFTER_UNDO ||
00604 ((OpMsg *)Message)->MsgType == OpMsg::AFTER_REDO)
00605 {
00606
00607 if (pTool && BevelTool::AmActive())
00608 {
00609
00610 pTool->SetBlobRendering(TRUE);
00611 pTool->SetupBlobList();
00612 pTool->RenderToolBlobs(Document::GetSelectedSpread(), NULL);
00613 }
00614 }
00615 else if (((OpMsg *)Message)->MsgType == OpMsg::BEFORE_UNDO ||
00616 ((OpMsg *)Message)->MsgType == OpMsg::BEFORE_REDO)
00617 {
00618
00619 if (pTool && BevelTool::AmActive())
00620 {
00621
00622 pTool->RenderToolBlobs(Document::GetSelectedSpread(), NULL);
00623 pTool->SetBlobRendering(FALSE);
00624 }
00625 }
00626 else if (((OpMsg *)Message)->pOp->IsKindOf(CC_RUNTIME_CLASS(SelectAllOp)))
00627 {
00628
00629 pTool->InvalidateToolBlobs();
00630 }
00631 else if (((OpMsg *)Message)->pOp->IsKindOf(CC_RUNTIME_CLASS(SelectNoneOp)))
00632 {
00633 pTool->InvalidateToolBlobs();
00634 }
00635 else if (((OpMsg *)Message)->pOp->IsKindOf(CC_RUNTIME_CLASS(OpDelete)))
00636 {
00637 pTool->InvalidateToolBlobs();
00638 }
00639 }
00640 else if (MESSAGE_IS_A(Message, OptionsChangingMsg))
00641 {
00642 OptionsChangingMsg* Msg = (OptionsChangingMsg*)Message;
00643
00644 if(Msg->State == OptionsChangingMsg::NEWUNITS)
00645 {
00646
00647 UpdateControls();
00648 }
00649 }
00650 else if (MESSAGE_IS_A(Message, SelChangingMsg))
00651 {
00652 UpdateControls();
00653 SelChangingMsg* pSelChangeMsg = (SelChangingMsg*)Message;
00654 if (pSelChangeMsg->State == SelChangingMsg::SELECTIONCHANGED && pTool && !m_BetweenViews)
00655 {
00656
00657
00658 if (!pSelChangeMsg->InDifferentDocument)
00659 {
00660 pTool->InvalidateToolBlobs();
00661
00662
00663
00664
00665
00666 }
00667
00668 }
00669
00670
00671
00672 if (pSelChangeMsg->State == SelChangingMsg::SELECTIONCHANGED ||
00673 pSelChangeMsg->State == SelChangingMsg::NONCOLOURATTCHANGED)
00674 UpdateJoinTypeControls();
00675 EnableDisableJoinTypeControls();
00676 }
00677 }
00678 }
00679
00680 return (InformationBarOp::Message(Message));
00681 }
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694 void BevelInfoBarOp::SliderUpdate(BOOL bSetVariables, BOOL bTestMany)
00695 {
00696 if (!ControlsExist)
00697 return;
00698
00699 List ContourList;
00700 BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContourController));
00701
00702 if (!ContourList.IsEmpty())
00703 {
00704 ContourList.DeleteAll();
00705 EnableGadget(_R(IDC_BEVEL_SLIDER_COMBO), FALSE);
00706 EnableGadget(_R(IDC_BEVELSLIDER), FALSE);
00707 EnableGadget(_R(IDC_BEVEL_SLIDER_EDIT), FALSE);
00708 EnableGadget(_R(IDC_BEVEL_TYPE_COMBO), FALSE);
00709 return;
00710 }
00711
00712 TRACEUSER( "DavidM", _T("Slider update !\n"));
00713
00714 INT32 value = 0;
00715
00716 String_256 Str;
00717
00718 TRACEUSER( "DavidM", _T("Slider update\n"));
00719
00720
00721
00722 if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) < 0 ||
00723 GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) > NumSliderTypes-1)
00724 {
00725 SetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO), 1);
00726 }
00727
00728
00729 if (bSetVariables)
00730 {
00731 switch (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)))
00732 {
00733 case 0:
00734
00735 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_DEPTH_MIN, BEVEL_DEPTH_MAX);
00736
00737 value = GetSliderDepth();
00738 m_Depth = value;
00739 ConvertValueToString(Str,
00740 value,
00741 PIXELS);
00742
00743 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT),
00744 Str);
00745 m_SliderComboIndex = 0;
00746
00747 break;
00748 case 1:
00749
00750 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_CONTRAST_MIN, BEVEL_CONTRAST_MAX);
00751 value = GetLongGadgetValue(_R(IDC_BEVELSLIDER), BEVEL_CONTRAST_MIN,
00752 BEVEL_CONTRAST_MAX);
00753
00754 m_Contrast = value;
00755 SetLongGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT), value);
00756 Str = GetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT));
00757 Str += _T(" %");
00758 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT),
00759 Str);
00760
00761 m_SliderComboIndex = 1;
00762
00763 if (pTool)
00764 pTool->ChangeContrastAndReRender(m_Contrast);
00765
00766 break;
00767 case 2:
00768
00769 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_LIGHTANGLE_MIN, BEVEL_LIGHTANGLE_MAX);
00770 value = GetLongGadgetValue(_R(IDC_BEVELSLIDER), BEVEL_LIGHTANGLE_MIN,
00771 BEVEL_LIGHTANGLE_MAX);
00772
00773
00774
00775 m_LightAngle = value;
00776 SetLongGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT), value);
00777 Str = GetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT));
00778 Str += _T(" ");
00779 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT),
00780 Str);
00781
00782 m_SliderComboIndex = 2;
00783
00784 break;
00785 case 3:
00786
00787 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_LIGHTTILT_MIN, BEVEL_LIGHTTILT_MAX);
00788 value = GetLongGadgetValue(_R(IDC_BEVELSLIDER), BEVEL_LIGHTTILT_MIN,
00789 BEVEL_LIGHTTILT_MAX);
00790
00791 m_LightTilt = value;
00792 SetLongGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT), value);
00793 Str = GetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT));
00794 Str += _T(" ");
00795 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT),
00796 Str);
00797
00798 m_SliderComboIndex = 3;
00799 break;
00800 }
00801 }
00802 else
00803 {
00804
00805 switch (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)))
00806 {
00807 case 0:
00808
00809
00810
00811 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_DEPTH_MIN, BEVEL_DEPTH_MAX);
00812
00813 SetSliderDepth(abs(m_Depth));
00814
00815 if (pTool->AreManyBevelIndents() && bTestMany)
00816 {
00817 Str.Load(_R(IDS_BEVELSTRING_MANY));
00818 }
00819 else
00820 {
00821 ConvertValueToString(Str,
00822 m_Depth,
00823 PIXELS);
00824 }
00825
00826 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT),
00827 Str);
00828
00829 PaintGadgetNow(_R(IDC_BEVELSLIDER));
00830 PaintGadgetNow(_R(IDC_BEVEL_SLIDER_EDIT));
00831
00832 m_SliderComboIndex = 0;
00833
00834 break;
00835 case 1:
00836
00837 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_CONTRAST_MIN, BEVEL_CONTRAST_MAX);
00838 value = m_Contrast;
00839
00840
00841 SetLongGadgetValue(_R(IDC_BEVELSLIDER), value);
00842
00843
00844 if (pTool->AreManyBevelContrasts() && bTestMany)
00845 {
00846 Str.Load(_R(IDS_BEVELSTRING_MANY));
00847 }
00848 else
00849 {
00850 SetLongGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT), m_Contrast);
00851 Str = GetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT));
00852 Str += _T(" %");
00853
00854
00855 }
00856
00857 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT),
00858 Str);
00859
00860 m_SliderComboIndex = 1;
00861
00862 PaintGadgetNow(_R(IDC_BEVELSLIDER));
00863 PaintGadgetNow(_R(IDC_BEVEL_SLIDER_EDIT));
00864
00865 break;
00866 case 2:
00867
00868 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_LIGHTANGLE_MIN, BEVEL_LIGHTANGLE_MAX);
00869
00870 value = m_LightAngle;
00871
00872 SetLongGadgetValue(_R(IDC_BEVELSLIDER), value);
00873
00874 if (pTool->AreManyBevelLightAngles() && bTestMany)
00875 {
00876 Str.Load(_R(IDS_BEVELSTRING_MANY));
00877 }
00878 else
00879 {
00880 SetLongGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT), BEVEL_LIGHTANGLE_MAX - value);
00881 Str = GetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT));
00882 Str += _T(" ");
00883 }
00884
00885 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT),
00886 Str);
00887
00888 m_SliderComboIndex = 2;
00889
00890 PaintGadgetNow(_R(IDC_BEVELSLIDER));
00891 PaintGadgetNow(_R(IDC_BEVEL_SLIDER_EDIT));
00892
00893 break;
00894 case 3:
00895
00896 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_LIGHTTILT_MIN, BEVEL_LIGHTTILT_MAX);
00897
00898 value = m_LightTilt;
00899
00900
00901 SetLongGadgetValue(_R(IDC_BEVELSLIDER), value);
00902
00903 if (pTool->AreManyBevelLightTilts() && bTestMany)
00904 {
00905 Str.Load(_R(IDS_BEVELSTRING_MANY));
00906 }
00907 else
00908 {
00909 SetLongGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT), m_LightTilt);
00910 Str = GetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT));
00911 Str += _T(" ");
00912 }
00913
00914 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT),
00915 Str);
00916
00917 m_SliderComboIndex = 3;
00918
00919 PaintGadgetNow(_R(IDC_BEVELSLIDER));
00920 PaintGadgetNow(_R(IDC_BEVEL_SLIDER_EDIT));
00921
00922 break;
00923 }
00924 }
00925
00926
00927 Document* pDoc = Document::GetCurrent();
00928
00929 if (pDoc)
00930 {
00931 if (GetApplication()->FindSelection()->IsEmpty())
00932 {
00933 EnableGadget(_R(IDC_BEVEL_SLIDER_COMBO), FALSE);
00934 EnableGadget(_R(IDC_BEVELSLIDER), FALSE);
00935 EnableGadget(_R(IDC_BEVEL_SLIDER_EDIT), FALSE);
00936 EnableGadget(_R(IDC_BEVEL_TYPE_COMBO), FALSE);
00937 }
00938 else
00939 {
00940
00941
00942 if (NodeBevelController::SelectionHasBevelNode() ||
00943 NodeBevelController::SelectionHasBevelInkNode())
00944 {
00945 EnableGadget(_R(IDC_BEVEL_SLIDER_COMBO), TRUE);
00946 EnableGadget(_R(IDC_BEVELSLIDER), TRUE);
00947 EnableGadget(_R(IDC_BEVEL_SLIDER_EDIT), TRUE);
00948 EnableGadget(_R(IDC_BEVEL_TYPE_COMBO), TRUE);
00949 }
00950 else
00951 {
00952 EnableGadget(_R(IDC_BEVEL_SLIDER_COMBO), TRUE);
00953
00954 if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) == 0)
00955 {
00956 EnableGadget(_R(IDC_BEVELSLIDER), TRUE);
00957 EnableGadget(_R(IDC_BEVEL_SLIDER_EDIT), TRUE);
00958 }
00959 else
00960 {
00961 EnableGadget(_R(IDC_BEVELSLIDER), FALSE);
00962 EnableGadget(_R(IDC_BEVEL_SLIDER_EDIT), FALSE);
00963 }
00964
00965 if (OpCreateBevel::GetState(NULL, NULL).Greyed)
00966 {
00967 EnableGadget(_R(IDC_BEVEL_TYPE_COMBO), FALSE);
00968 }
00969 else
00970 {
00971 EnableGadget(_R(IDC_BEVEL_TYPE_COMBO), TRUE);
00972 }
00973 }
00974 }
00975 }
00976 else
00977 {
00978 EnableGadget(_R(IDC_BEVEL_SLIDER_COMBO), FALSE);
00979 EnableGadget(_R(IDC_BEVELSLIDER), FALSE);
00980 EnableGadget(_R(IDC_BEVEL_SLIDER_EDIT), FALSE);
00981 EnableGadget(_R(IDC_BEVEL_TYPE_COMBO), FALSE);
00982 }
00983
00984
00985 switch (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)))
00986 {
00987 case 0:
00988 SetGadgetHelp(_R(IDC_BEVELSLIDER), _R(IDBBL_BEVELSLIDERDEPTH), _R(IDS_BEVELSLIDERDEPTHID));
00989 SetGadgetHelp(_R(IDC_BEVEL_SLIDER_EDIT), _R(IDBBL_BEVELSLIDERDEPTH), _R(IDS_BEVELSLIDERDEPTHID));
00990 break;
00991 case 1:
00992 SetGadgetHelp(_R(IDC_BEVELSLIDER), _R(IDBBL_BEVELSLIDERCONTRAST), _R(IDS_BEVELSLIDERCONTRASTID));
00993 SetGadgetHelp(_R(IDC_BEVEL_SLIDER_EDIT), _R(IDBBL_BEVELSLIDERCONTRAST), _R(IDS_BEVELSLIDERCONTRASTID));
00994 break;
00995 case 2:
00996 SetGadgetHelp(_R(IDC_BEVELSLIDER), _R(IDBBL_BEVELSLIDERLIGHTANGLE), _R(IDS_BEVELSLIDERLIGHTANGLEID));
00997 SetGadgetHelp(_R(IDC_BEVEL_SLIDER_EDIT), _R(IDBBL_BEVELSLIDERLIGHTANGLE), _R(IDS_BEVELSLIDERLIGHTANGLEID));
00998 break;
00999 case 3:
01000 SetGadgetHelp(_R(IDC_BEVELSLIDER), _R(IDBBL_BEVELSLIDERTILT), _R(IDS_BEVELSLIDERTILTID));
01001 SetGadgetHelp(_R(IDC_BEVEL_SLIDER_EDIT), _R(IDBBL_BEVELSLIDERTILT), _R(IDS_BEVELSLIDERTILTID));
01002 break;
01003 }
01004
01005 SetGadgetHelp(_R(IDC_BEVEL_TYPE_COMBO), _R(IDBBL_BEVELTYPECOMBO), _R(IDS_BEVELTYPECOMBO));
01006 SetGadgetHelp(_R(IDC_BEVEL_SLIDER_COMBO), _R(IDBBL_BEVELSLIDERCOMBO), _R(IDS_BEVELSLIDERCOMBO));
01007 }
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019 void BevelInfoBarOp::DoBevel()
01020 {
01021
01022 BevelInfo BI;
01023
01024 OpDescriptor* pOpDesc = NULL;
01025
01026 if(m_Depth == 0)
01027 {
01028 SetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO),0);
01029 }
01030
01031 BI.m_BevelType = BevelTypes[GetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO))].TypeNum;
01032 BI.m_bBevelTypeChanged = TRUE;
01033 BI.m_LightAngle = m_LightAngle;
01034 BI.m_Indent = m_Depth;
01035
01036 if (pTool->AreManyBevelTypes())
01037 {
01038
01039 BI.m_BevelType = BevelTypes[GetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO)) - 1].TypeNum;
01040 }
01041
01042 TRACEUSER( "DavidM", _T("Bevel type change %d\n"), BI.m_BevelType);
01043
01044 BlobManager* BlobMgr = GetApplication()->GetBlobManager();
01045
01046 BI.m_bOuter = GetBoolGadgetSelected(_R(IDC_BTN_BEVELOUTER));
01047 BI.m_Contrast = m_Contrast;
01048 BI.m_bCreateNewBevels = TRUE;
01049
01050 Spread * pSpread = Document::GetSelectedSpread();
01051
01052 if (BI.m_BevelType >= 0)
01053 {
01054 pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpCreateBevel));
01055
01056 if (pTool && pSpread && BlobMgr)
01057 {
01058 pTool->RenderToolBlobs(pSpread, NULL);
01059 pTool->SetBlobRendering(FALSE);
01060 }
01061
01062 if (pOpDesc)
01063 {
01064 pOpDesc->Invoke(&BI);
01065 }
01066
01067 if (pTool && pSpread && BlobMgr)
01068 {
01069 pTool->SetupBlobList();
01070 pTool->SetBlobRendering(TRUE);
01071 pTool->RenderToolBlobs(pSpread, NULL);
01072 }
01073 }
01074 else
01075 {
01076
01077
01078 pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpRemoveBevel));
01079
01080
01081
01082 if (pTool && pSpread && BlobMgr)
01083 {
01084
01085 pTool->RenderToolBlobs(pSpread, NULL);
01086 pTool->SetBlobRendering(FALSE);
01087 }
01088
01089 if (pOpDesc)
01090 {
01091 pOpDesc->Invoke();
01092 }
01093
01094 if (pTool && pSpread && BlobMgr)
01095 {
01096 pTool->SetBlobRendering(TRUE);
01097 pTool->SetupBlobList();
01098 pTool->RenderToolBlobs(pSpread, NULL);
01099 }
01100
01101 }
01102
01103 UpdateControls();
01104 }
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117 void BevelInfoBarOp::SetToolActiveState(BOOL IsToolActive)
01118 {
01119
01120 m_bComboChanged = FALSE;
01121 ControlsExist = IsToolActive;
01122
01123 }
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139 void BevelInfoBarOp::SetRetroState(BOOL CanFit)
01140 {
01141
01142 CanRetroFit = CanFit;
01143
01144
01145 SetRetroString();
01146 }
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161 void BevelInfoBarOp::SetRetroString()
01162 {
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185 }
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198 void BevelInfoBarOp::UpdateControls()
01199 {
01200
01201 BOOL HaveGotContours = FALSE;
01202 List ContourList;
01203 BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContourController));
01204
01205 if (!ContourList.IsEmpty())
01206 {
01207 ContourList.DeleteAll();
01208 HaveGotContours = TRUE;
01209 }
01210
01211 if (!ControlsExist || !pTool)
01212 return;
01213
01214
01215 if (!HasWindow())
01216 return;
01217
01218 TRACEUSER( "DavidM", _T("Update controls\n"));
01219
01220 NodeBevel * pBevel = NULL;
01221
01222 AttrBevelIndent * pIndent = NULL;
01223 AttrBevelLightAngle * pLightAngle = NULL;
01224 AttrBevelType * pType = NULL;
01225 AttrBevelContrast * pContrast = NULL;
01226 AttrBevelLightTilt * pTilt = NULL;
01227
01228
01229 Range Sel(*(GetApplication()->FindSelection()));
01230 RangeControl rg = Sel.GetRangeControlFlags();
01231 rg.PromoteToParent = TRUE;
01232 Sel.SetRangeControl(rg);
01233
01234
01235 List NodeList;
01236 NodeListItem * pItem = NULL;
01237
01238
01239 BevelTools::BuildListOfSelectedNodes(&NodeList,
01240 CC_RUNTIME_CLASS(NodeBevel), TRUE);
01241
01242 AttrBevelIndent * pCurrentIndent = NULL;
01243 AttrBevelLightAngle * pCurrentLightAngle = NULL;
01244 AttrBevelContrast * pCurrentContrast = NULL;
01245
01246 AttrBevelLightTilt * pCurrentTilt = NULL;
01247
01248
01249
01250 Document* pDoc = Document::GetCurrent();
01251
01252 if (NodeList.IsEmpty() || HaveGotContours)
01253 {
01254
01255 if (pDoc)
01256 {
01257
01258 LoadBevelTypeComboStrings(FALSE);
01259 LoadBevelDirectionComboStrings(FALSE);
01260
01261
01262
01263 pCurrentIndent = (AttrBevelIndent *)pDoc->GetAttributeMgr().GetCurrentAttribute(
01264 CC_RUNTIME_CLASS(NodeRenderableInk),
01265 CC_RUNTIME_CLASS(AttrBevelIndent));
01266
01267 if (pCurrentIndent)
01268 {
01269 m_Depth = pCurrentIndent->Value.m_Indent;
01270
01271
01272 m_bUserSet = TRUE;
01273 m_UserIndent = m_Depth;
01274 }
01275
01276 if (m_Depth < 0)
01277 m_Depth = - m_Depth;
01278
01279 pCurrentLightAngle = (AttrBevelLightAngle *)pDoc->GetAttributeMgr().GetCurrentAttribute(
01280 CC_RUNTIME_CLASS(NodeRenderableInk),
01281 CC_RUNTIME_CLASS(AttrBevelLightAngle));
01282
01283 if (pCurrentLightAngle)
01284 {
01285 m_LightAngle = pCurrentLightAngle->Value.m_LightAngle;
01286 }
01287
01288 SetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO),
01289 0);
01290
01291 pCurrentContrast = (AttrBevelContrast *)pDoc->GetAttributeMgr().GetCurrentAttribute(
01292 CC_RUNTIME_CLASS(NodeRenderableInk),
01293 CC_RUNTIME_CLASS(AttrBevelContrast));
01294
01295 if (pCurrentContrast)
01296 {
01297 m_Contrast = pCurrentContrast->Value.m_Contrast;
01298 }
01299
01300 pCurrentTilt = (AttrBevelLightTilt *)pDoc->GetAttributeMgr().GetCurrentAttribute(
01301 CC_RUNTIME_CLASS(NodeRenderableInk),
01302 CC_RUNTIME_CLASS(AttrBevelLightTilt));
01303
01304 if (pCurrentTilt)
01305 {
01306 m_LightTilt = pCurrentTilt->Value.m_LightTilt;
01307 }
01308 }
01309
01310 UpdateInnerOuterButtons(FALSE, FALSE, TRUE);
01311
01312 EnableGadget(_R(IDC_BEVELJOINTYPEMITRE), FALSE);
01313 EnableGadget(_R(IDC_BEVELJOINTYPEROUND), FALSE);
01314 EnableGadget(_R(IDC_BEVELJOINTYPEBEVEL), FALSE);
01315 }
01316 else
01317 {
01318 m_bControlsEnabled = TRUE;
01319
01320 pIndent = NULL;
01321 pLightAngle = NULL;
01322 pContrast = NULL;
01323 pType = NULL;
01324
01325
01326 pItem = (NodeListItem *)NodeList.GetHead();
01327
01328
01329 if (pItem && (!pIndent || !pLightAngle || !pType || !pContrast))
01330 {
01331 if (pItem->pNode)
01332 {
01333 pBevel = (NodeBevel *)pItem->pNode;
01334
01335 pBevel->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrBevelIndent),
01336 (NodeAttribute **)(&pIndent));
01337
01338 pBevel->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrBevelLightAngle),
01339 (NodeAttribute **)(&pLightAngle));
01340
01341 pBevel->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrBevelContrast),
01342 (NodeAttribute **)(&pContrast));
01343
01344 pBevel->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrBevelType),
01345 (NodeAttribute **)(&pType));
01346
01347 pBevel->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrBevelLightTilt),
01348 (NodeAttribute **)(&pTilt));
01349 }
01350
01351 pItem = (NodeListItem *)NodeList.GetNext(pItem);
01352 }
01353
01354
01355 if (pType)
01356 {
01357
01358 if (pTool->AreManyBevelTypes())
01359 {
01360 LoadBevelTypeComboStrings(TRUE);
01361 SetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO), 0);
01362 }
01363 else
01364 {
01365 LoadBevelTypeComboStrings(FALSE);
01366 for (INT32 i = 0 ; i < NumBevelTypes; i++)
01367 {
01368 if (pType->Value.m_Type == BevelTypes[i].TypeNum)
01369 SetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO), i);
01370 }
01371 }
01372 }
01373 else
01374 {
01375
01376 LoadBevelTypeComboStrings(FALSE);
01377 SetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO), 0);
01378 }
01379
01380 if (pIndent)
01381 {
01382 if (pTool->AreManyBevelDirections())
01383 {
01384 UpdateInnerOuterButtons(TRUE, FALSE, FALSE);
01385 }
01386 else
01387 {
01388 if (pIndent->Value.m_Indent < 0)
01389 {
01390 UpdateInnerOuterButtons(FALSE, TRUE, FALSE);
01391 }
01392 else
01393 {
01394 UpdateInnerOuterButtons(FALSE, FALSE, FALSE);
01395 }
01396 }
01397
01398 SetLongGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT), abs(pIndent->Value.m_Indent), FALSE, -1);
01399 }
01400
01401 SetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO), m_SliderComboIndex);
01402
01403 if (pIndent)
01404 {
01405 m_Depth = abs(pIndent->Value.m_Indent);
01406 }
01407 else
01408 {
01409 m_Depth = 0;
01410 }
01411
01412 if (pLightAngle)
01413 {
01414
01415
01416 m_LightAngle = BEVEL_LIGHTANGLE_MAX - pLightAngle->Value.m_LightAngle;
01417 }
01418
01419 if (pContrast)
01420 {
01421 m_Contrast = pContrast->Value.m_Contrast;
01422 }
01423 else
01424 {
01425 m_Contrast = 0;
01426 }
01427
01428 if (pTilt)
01429 {
01430 m_LightTilt = pTilt->Value.m_LightTilt;
01431 }
01432 else
01433 {
01434 m_LightTilt = 45;
01435 }
01436 }
01437
01438
01439 NodeList.DeleteAll();
01440
01441 SliderUpdate(FALSE);
01442 }
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455 void BevelInfoBarOp::UpdateState()
01456 {
01457
01458 TRACEUSER( "DavidM", _T("BevelInfoBarOp::UpdateState\n"));
01459
01460 if (!ControlsExist)
01461 return;
01462
01463 UpdateControls();
01464
01465 return;
01466
01467 }
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483 BOOL BevelInfoBarOp::ConvertValueToString(String_256 &In, const INT32 value, UnitType type)
01484 {
01485 BOOL Converted = FALSE;
01486
01487 Spread * CurrentSpread = Document::GetSelectedSpread();
01488
01489 if (CurrentSpread)
01490 {
01491
01492
01493 DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) CurrentSpread);
01494 pDimScale->ConvertToUnits((INT32)value , &In);
01495 Converted = TRUE;
01496 }
01497
01498 if (In.Length() == 0)
01499 {
01500 In = _T("0");
01501 }
01502
01503 return Converted;
01504
01505 }
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522 BOOL BevelInfoBarOp::ConvertStringToValue(CGadgetID ID, INT32 &Value)
01523 {
01524 String_64 Str;
01525 Str.Load(_R(IDS_BEVELSTRING_MANY));
01526
01527 BOOL Valid = FALSE;
01528
01529 Spread * CurrentSpread = Document::GetSelectedSpread();
01530
01531 DimScale* pDimScale = NULL;
01532 String_128 FieldContents;
01533 String_128 NumberString;
01534 INT32 i = 0;
01535 BOOL bUpdate = FALSE;
01536
01537
01538 FieldContents = GetStringGadgetValue(ID, &Valid);
01539
01540 if (Str == FieldContents)
01541 return FALSE;
01542
01543 if (CurrentSpread != NULL)
01544 {
01545
01546
01547 switch (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)))
01548 {
01549 case 0:
01550
01551 pDimScale = DimScale::GetPtrDimScale((Node*) CurrentSpread);
01552
01553 FieldContents = GetStringGadgetValue(ID, &Valid);
01554 Valid = pDimScale->ConvertToMillipoints(FieldContents, &Value);
01555
01556 if (Value > BEVEL_DEPTH_MAX)
01557 Value = BEVEL_DEPTH_MAX;
01558 break;
01559 case 1:
01560 FieldContents = GetStringGadgetValue(ID, &Valid);
01561
01562 for (i = 0 ; i < FieldContents.Length(); i++)
01563 {
01564 if (FieldContents[i] >= '0' && FieldContents[i] <= '9')
01565 {
01566 NumberString += FieldContents[i];
01567 }
01568 else
01569 {
01570 i = FieldContents.Length();
01571 }
01572 }
01573
01574 SetStringGadgetValue(ID, NumberString);
01575 Value = GetLongGadgetValue(ID, BEVEL_CONTRAST_MIN, BEVEL_CONTRAST_MAX);
01576 SetStringGadgetValue(ID, FieldContents);
01577 break;
01578 case 2:
01579 case 3:
01580 FieldContents = GetStringGadgetValue(ID, &Valid);
01581
01582 for (i = 0 ; i < FieldContents.Length(); i++)
01583 {
01584 if (FieldContents[i] >= '0' && FieldContents[i] <= '9')
01585 {
01586 NumberString += FieldContents[i];
01587 }
01588 else
01589 {
01590
01591 if (i == 0 && FieldContents[i] == '-')
01592 {
01593 NumberString += FieldContents[i];
01594 }
01595 else
01596 {
01597 i = FieldContents.Length();
01598 }
01599 }
01600 }
01601
01602 SetStringGadgetValue(ID, NumberString);
01603 Value = GetLongGadgetValue(ID, -1000, 1000);
01604
01605 while (Value < BEVEL_LIGHTANGLE_MIN)
01606 {
01607 bUpdate = TRUE;
01608 Value += 360;
01609 }
01610
01611 while (Value > BEVEL_LIGHTANGLE_MAX)
01612 {
01613 bUpdate = TRUE;
01614 Value -= 360;
01615 }
01616
01617 if (!bUpdate)
01618 {
01619 SetStringGadgetValue(ID, FieldContents);
01620 }
01621 else
01622 {
01623 SetLongGadgetValue(ID, Value);
01624 NumberString = GetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT));
01625 NumberString += _T(" ");
01626 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT),
01627 NumberString);
01628 }
01629
01630 break;
01631 }
01632 }
01633 else
01634 {
01635
01636 }
01637
01638 return Valid;
01639 }
01640
01641
01642
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654 void BevelInfoBarOp::HandleBevelTypeChanged()
01655 {
01656 if (!pTool)
01657 return;
01658
01659 if(m_Depth == 0)
01660 {
01661 m_Depth = 3000;
01662 SetBoolGadgetSelected(_R(IDC_BTN_BEVELOUTER),TRUE);
01663 }
01664
01665 DoBevel();
01666 }
01667
01668
01669
01670
01671
01672
01673
01674
01675
01676
01677
01678
01679
01680 void BevelInfoBarOp::DoBevelAttrChange(BevelInfo * pBevParam)
01681 {
01682
01683
01684 Spread * pSpread = Document::GetSelectedSpread();
01685
01686 pBevParam->m_bCreateNewBevels = FALSE;
01687
01688
01689 if (pTool && pSpread)
01690 {
01691 pTool->RenderToolBlobs(pSpread, NULL);
01692 pTool->SetBlobRendering(FALSE);
01693 }
01694
01695 OpDescriptor * pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpCreateBevel));
01696
01697 if (pOpDesc)
01698 {
01699 pOpDesc->Invoke(pBevParam);
01700 }
01701
01702
01703
01704 if (pTool && pSpread)
01705 {
01706 pTool->SetBlobRendering(TRUE);
01707 pTool->SetupBlobList();
01708 pTool->RenderToolBlobs(pSpread, NULL);
01709 }
01710
01711
01712 }
01713
01714
01715
01716
01717
01718
01719
01720
01721
01722
01723
01724
01725
01726
01727 void BevelInfoBarOp::HandleSliderChanged()
01728 {
01729
01730 String_64 Str;
01731
01732
01733 Range Sel(*(GetApplication()->FindSelection()));
01734 RangeControl rg = Sel.GetRangeControlFlags();
01735 rg.PromoteToParent = TRUE;
01736 Sel.SetRangeControl(rg);
01737
01738
01739 BevelInfo BI;
01740
01741 SetUpBevelInfo(&BI);
01742
01743
01744
01745
01746
01747
01748 switch (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)))
01749 {
01750 case 0:
01751
01752 if (!(NodeBevelController::SelectionHasBevelNode() ||
01753 NodeBevelController::SelectionHasBevelInkNode()) ||
01754 m_Depth == 0)
01755 {
01756 if(m_Depth > 0 && BevelTypes[GetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO))].TypeNum == -1)
01757 {
01758 SetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO),1);
01759 UpdateInnerOuterButtons(FALSE,TRUE,FALSE);
01760 }
01761
01762 DoBevel();
01763 return;
01764 }
01765
01766
01767 BI.m_bBevelIndentChanged = TRUE;
01768 m_bUserSet = TRUE;
01769 m_UserIndent = BI.m_Indent;
01770
01771 if (BI.m_bOuter)
01772 {
01773 m_UserIndent = -m_UserIndent;
01774 }
01775
01776 break;
01777 case 1:
01778
01779 BI.m_bBevelContrastChanged = TRUE;
01780 break;
01781 case 2:
01782 BI.m_bBevelLightAngleChanged = TRUE;
01783 break;
01784 case 3:
01785 BI.m_bBevelLightTiltChanged = TRUE;
01786 break;
01787 default:
01788 ERROR3("Bevel infobar slider combo has invalid value");
01789 return;
01790 }
01791
01792
01793
01794
01795 DoBevelAttrChange(&BI);
01796 }
01797
01798
01799
01800
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811 void BevelInfoBarOp::RedrawBlobs(BOOL bAngle, BOOL bTilt)
01812 {
01813 if (bAngle)
01814 {
01815 if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) != 2)
01816 return;
01817
01818 INT32 LightAngle = 0;
01819 LightAngle = GetLongGadgetValue(_R(IDC_BEVELSLIDER), BEVEL_LIGHTANGLE_MIN,
01820 BEVEL_LIGHTANGLE_MAX);
01821
01822
01823
01824 if (pTool)
01825 {
01826 pTool->ChangeBlobAngles(LightAngle);
01827 }
01828 }
01829 else if (bTilt)
01830 {
01831 if (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)) != 3)
01832 return;
01833
01834 INT32 Tilt = 0;
01835
01836 Tilt = GetLongGadgetValue(_R(IDC_BEVELSLIDER), BEVEL_LIGHTTILT_MIN,
01837 BEVEL_LIGHTTILT_MAX);
01838
01839
01840 if (pTool)
01841 {
01842 pTool->ChangeBlobTilts(Tilt);
01843 }
01844 }
01845 }
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859 void BevelInfoBarOp::HandleBevelDirectionsToOuter()
01860 {
01861
01862 BevelInfo BI;
01863
01864 SetUpBevelInfo(&BI);
01865
01866 BI.m_bBevelDirectionChanged = TRUE;
01867 BI.m_bOuter = TRUE;
01868
01869
01870 Range Sel(*(GetApplication()->FindSelection()));
01871 RangeControl rg = Sel.GetRangeControlFlags();
01872 rg.PromoteToParent = TRUE;
01873 Sel.SetRangeControl(rg);
01874
01875 AttrBevelIndent * pIndent = NULL;
01876 if (Sel.IsEmpty())
01877 {
01878
01879 pIndent = new AttrBevelIndent;
01880
01881 if (!pIndent)
01882 {
01883 ERROR3("Can't create bevel indent");
01884 return;
01885 }
01886
01887 pIndent->Value.m_Indent = BI.m_Indent;
01888
01889 m_bUserSet = TRUE;
01890 m_UserIndent = BI.m_Indent;
01891
01892 if (BI.m_bOuter)
01893 {
01894 pIndent->Value.m_Indent = -BI.m_Indent;
01895 m_UserIndent = -m_UserIndent;
01896 }
01897
01898 AttributeManager::AttributeSelected(pIndent);
01899
01900 return;
01901 }
01902
01903
01904 DoBevelAttrChange(&BI);
01905
01906 }
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920 void BevelInfoBarOp::HandleBevelDirectionsToInner()
01921 {
01922
01923 BevelInfo BI;
01924
01925 SetUpBevelInfo(&BI);
01926
01927 BI.m_bBevelDirectionChanged = TRUE;
01928 BI.m_bOuter = FALSE;
01929
01930
01931 Range Sel(*(GetApplication()->FindSelection()));
01932 RangeControl rg = Sel.GetRangeControlFlags();
01933 rg.PromoteToParent = TRUE;
01934 Sel.SetRangeControl(rg);
01935
01936 AttrBevelIndent * pIndent = NULL;
01937 if (Sel.IsEmpty())
01938 {
01939
01940 pIndent = new AttrBevelIndent;
01941 if (!pIndent)
01942 {
01943 ERROR3("Can't create bevel indent");
01944 return ;
01945 }
01946
01947 pIndent->Value.m_Indent = BI.m_Indent;
01948
01949 m_bUserSet = TRUE;
01950 m_UserIndent = BI.m_Indent;
01951
01952 if (BI.m_bOuter)
01953 {
01954 pIndent->Value.m_Indent = -BI.m_Indent;
01955 m_UserIndent = -m_UserIndent;
01956 }
01957
01958 AttributeManager::AttributeSelected(pIndent);
01959
01960 return;
01961 }
01962
01963
01964 DoBevelAttrChange(&BI);
01965 }
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983 void BevelInfoBarOp::HandleBevelDirectionChanged()
01984 {
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998 BevelInfo BI;
01999
02000 SetUpBevelInfo(&BI);
02001
02002 BI.m_bBevelDirectionChanged = TRUE;
02003
02004
02005 Range Sel(*(GetApplication()->FindSelection()));
02006 RangeControl rg = Sel.GetRangeControlFlags();
02007 rg.PromoteToParent = TRUE;
02008 Sel.SetRangeControl(rg);
02009
02010 AttrBevelIndent * pIndent = NULL;
02011 if (Sel.IsEmpty())
02012 {
02013
02014 pIndent = new AttrBevelIndent;
02015
02016 if (!pIndent)
02017 {
02018 ERROR3("Can't create bevel indent");
02019 return;
02020 }
02021
02022 pIndent->Value.m_Indent = BI.m_Indent;
02023
02024 m_bUserSet = TRUE;
02025 m_UserIndent = BI.m_Indent;
02026
02027 if (BI.m_bOuter)
02028 {
02029 pIndent->Value.m_Indent = -BI.m_Indent;
02030 m_UserIndent = -m_UserIndent;
02031 }
02032
02033 AttributeManager::AttributeSelected(pIndent);
02034
02035 return;
02036 }
02037
02038
02039 DoBevelAttrChange(&BI);
02040 }
02041
02042
02043
02044
02045
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060
02061 void BevelInfoBarOp::HandleJoinTypeMitreClicked()
02062 {
02063 BOOL fRound = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEROUND));
02064 BOOL fBevel = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEBEVEL));
02065
02066
02067
02068 if (fRound || fBevel)
02069 ChangeJoinType(MitreJoin);
02070 else
02071 SetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEMITRE), TRUE);
02072 }
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092
02093 void BevelInfoBarOp::HandleJoinTypeRoundClicked()
02094 {
02095 BOOL fMitre = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEMITRE));
02096 BOOL fBevel = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEBEVEL));
02097
02098
02099
02100 if (fMitre || fBevel)
02101 ChangeJoinType(RoundJoin);
02102 else
02103 SetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEROUND), TRUE);
02104 }
02105
02106
02107
02108
02109
02110
02111
02112
02113
02114
02115
02116
02117
02118
02119
02120
02121
02122
02123
02124
02125 void BevelInfoBarOp::HandleJoinTypeBevelClicked()
02126 {
02127 BOOL fRound = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEROUND));
02128 BOOL fMitre = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEMITRE));
02129
02130
02131
02132 if (fRound || fMitre)
02133 ChangeJoinType(BevelledJoin);
02134 else
02135 SetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEBEVEL), TRUE);
02136 }
02137
02138
02139
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157 void BevelInfoBarOp::ChangeJoinType(JointType jt)
02158 {
02159
02160 BevelInfo BI;
02161
02162 SetUpBevelInfo(&BI);
02163
02164 BI.m_bJointTypeChanged = TRUE;
02165 BI.m_JointType = jt;
02166
02167
02168 Range Sel(*(GetApplication()->FindSelection()));
02169 RangeControl rg = Sel.GetRangeControlFlags();
02170 rg.PromoteToParent = TRUE;
02171 Sel.SetRangeControl(rg);
02172
02173 AttrJoinType* pJoinType = NULL;
02174 if (Sel.IsEmpty())
02175 {
02176
02177 pJoinType = new AttrJoinType;
02178
02179 if (!pJoinType)
02180 {
02181 ERROR3("Can't create bevel indent");
02182 return;
02183 }
02184
02185 pJoinType->Value.JoinType = BI.m_JointType;
02186
02187 AttributeManager::AttributeSelected( pJoinType );
02188 return;
02189 }
02190
02191
02192 DoBevelAttrChange(&BI);
02193 }
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205
02206
02207
02208
02209
02210
02211 void BevelInfoBarOp::UpdateJoinTypeControls()
02212 {
02213
02214
02215
02216 if (!ControlsExist || !HasWindow())
02217 return;
02218
02219
02220
02221
02222
02223 NodeAttribute* pAttr;
02224 SelRange::CommonAttribResult eResult;
02225 eResult = GetApplication()->
02226 FindSelection()->
02227 FindCommonAttribute(CC_RUNTIME_CLASS(AttrJoinType), &pAttr);
02228
02229
02230 BOOL fMitre = FALSE;
02231 BOOL fRound = FALSE;
02232 BOOL fBevel = FALSE;
02233
02234 switch (eResult)
02235 {
02236
02237 case SelRange::ATTR_NONE:
02238 break;
02239
02240
02241 case SelRange::ATTR_COMMON:
02242 if (pAttr != NULL)
02243 {
02244 fMitre = ( ((AttrJoinType*)pAttr)->Value.JoinType == MitreJoin );
02245 fRound = ( ((AttrJoinType*)pAttr)->Value.JoinType == RoundJoin );
02246 fBevel = ( ((AttrJoinType*)pAttr)->Value.JoinType == BevelledJoin );
02247 }
02248 break;
02249
02250
02251 case SelRange::ATTR_MANY:
02252 {
02253
02254 SelRange* pSel = GetApplication()->FindSelection();
02255 for (Node* pSelNode = pSel->FindFirst();
02256 pSelNode != NULL && !(fMitre && fRound && fBevel);
02257 pSelNode = pSel->FindNext(pSelNode))
02258 {
02259 if (!pSelNode->IsAnObject())
02260 continue;
02261
02262 ((NodeRenderableInk*)pSelNode)->
02263 FindAppliedAttribute(CC_RUNTIME_CLASS(AttrJoinType), &pAttr);
02264 if (pAttr != NULL)
02265 {
02266 fMitre |= ( ((AttrJoinType*)pAttr)->Value.JoinType == MitreJoin );
02267 fRound |= ( ((AttrJoinType*)pAttr)->Value.JoinType == RoundJoin );
02268 fBevel |= ( ((AttrJoinType*)pAttr)->Value.JoinType == BevelledJoin );
02269 }
02270 }
02271 }
02272 break;
02273
02274
02275 default:
02276 ERROR3("BevelInfoBarOp::UpdateJoinTypeControls; invalid result from FindCommonAttribute()");
02277 break;
02278 }
02279
02280 SetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEMITRE), fMitre);
02281 SetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEROUND), fRound);
02282 SetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEBEVEL), fBevel);
02283 }
02284
02285
02286
02287
02288
02289
02290
02291
02292
02293
02294
02295
02296
02297 void BevelInfoBarOp::EnableDisableJoinTypeControls()
02298 {
02299
02300 SelRange* pSel = GetApplication()->FindSelection();
02301 if (pSel == NULL || pSel->IsEmpty())
02302 {
02303 EnableGadget(_R(IDC_BEVELJOINTYPEMITRE), FALSE);
02304 EnableGadget(_R(IDC_BEVELJOINTYPEROUND), FALSE);
02305 EnableGadget(_R(IDC_BEVELJOINTYPEBEVEL), FALSE);
02306 }
02307 else
02308 {
02309 EnableGadget(_R(IDC_BEVELJOINTYPEMITRE), TRUE);
02310 EnableGadget(_R(IDC_BEVELJOINTYPEROUND), TRUE);
02311 EnableGadget(_R(IDC_BEVELJOINTYPEBEVEL), TRUE);
02312 }
02313 }
02314
02315
02316
02317
02318
02319
02320
02321
02322
02323
02324
02325
02326
02327
02328
02329 void BevelInfoBarOp::SetUpBevelInfo(BevelInfo * pInfo)
02330 {
02331 pInfo->m_BevelType = BevelTypes[GetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO))].TypeNum;
02332
02333 pInfo->m_LightAngle = m_LightAngle;
02334 pInfo->m_Contrast = m_Contrast;
02335 pInfo->m_Indent = m_Depth;
02336 pInfo->m_Tilt = m_LightTilt;
02337
02338 INT32 DirectionIndex = 0 ;
02339
02340 if (m_bButtonIsOuter)
02341 DirectionIndex = 1;
02342
02343 if (pTool->AreManyBevelTypes())
02344 {
02345 pInfo->m_BevelType = BevelTypes[GetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO))-1].TypeNum;
02346 }
02347
02348
02349 if (pTool->AreManyBevelDirections())
02350 {
02351 DirectionIndex -= 1;
02352 }
02353
02354
02355 if (DirectionIndex == 0)
02356 {
02357 pInfo->m_bOuter = FALSE;
02358 }
02359 else
02360 {
02361 pInfo->m_bOuter = TRUE;
02362 }
02363 }
02364
02365
02366
02367
02368
02369
02370
02371
02372
02373
02374
02375
02376
02377
02378
02379 void BevelInfoBarOp::BeginDrag(BevelBlob * pBlob)
02380 {
02381 if (!pBlob)
02382 {
02383 ERROR3("BevelInfoBarOp::BeginDrag - blob passed in is NULL");
02384 return;
02385 }
02386
02387 m_pDragBlob = pBlob;
02388 m_bAmDragging = TRUE;
02389 m_BlobAngle = pBlob->GetAngle();
02390
02391 StartDrag( DRAGTYPE_AUTOSCROLL );
02392 }
02393
02394
02395
02396
02397
02398
02399
02400
02401
02402
02403
02404
02405
02406
02407
02408
02409 void BevelInfoBarOp::DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods,
02410 Spread* pSpread, BOOL bSolidDrag)
02411 {
02412
02413 if (!pTool || !m_pDragBlob)
02414 return;
02415
02416
02417 m_pDragBlob->CalculateAngle(PointerPos, ClickMods.Constrain);
02418
02419 m_pDragBlob->RenderNodes();
02420
02421 Document * pDoc = Document::GetCurrent();
02422
02423 if (pDoc)
02424 {
02425 pDoc->ForceRedraw(pSpread, m_pDragBlob->GetRect());
02426 }
02427
02428 GetApplication()->ServiceRendering();
02429
02430
02431
02432 m_LightAngle = BEVEL_LIGHTANGLE_MAX - m_pDragBlob->GetAngle();
02433
02434 SliderUpdate(FALSE);
02435 }
02436
02437
02438
02439
02440
02441
02442
02443
02444
02445
02446
02447
02448
02449
02450
02451
02452 void BevelInfoBarOp::DragFinished( DocCoord PointerPos, ClickModifiers ClickMods,
02453 Spread* pSpread, BOOL Success, BOOL bSolidDrag)
02454 {
02455 if (!pTool || !m_pDragBlob)
02456 {
02457 EndDrag();
02458 return;
02459 }
02460
02461
02462
02463
02464 BlobManager* pBlobMgr = GetApplication()->GetBlobManager();
02465
02466 if (!pBlobMgr)
02467 {
02468 ERROR3("DragFinished - no blob manager\n");
02469 return;
02470 }
02471
02472 OpDescriptor * pOpDesc = NULL;
02473
02474 OpChangeLightAnglesParam Param;
02475
02476 if (!Success)
02477 {
02478
02479
02480 pTool->RenderBlob(m_pDragBlob);
02481 m_pDragBlob->SetAngle(m_BlobAngle);
02482
02483
02484 NodeListItem * pItem = (NodeListItem *)m_pDragBlob->GetList()->GetHead();
02485
02486 Document * pDoc = Document::GetCurrent();
02487
02488 while (pItem)
02489 {
02490 ((NodeBevelController *)pItem->pNode)->RegenerateNode(NULL, FALSE);
02491 ((NodeBevelController *)pItem->pNode)->ReleaseCached();
02492
02493 pItem = (NodeListItem *)m_pDragBlob->GetList()->GetNext(pItem);
02494 }
02495
02496 if (pDoc)
02497 {
02498 if (pSpread)
02499 {
02500 pDoc->ForceRedraw(pSpread,
02501 m_pDragBlob->GetRect());
02502 }
02503 else
02504 {
02505 pSpread = Document::GetSelectedSpread();
02506
02507 pDoc->ForceRedraw(pSpread,
02508 m_pDragBlob->GetRect());
02509 }
02510 }
02511
02512 pTool->RenderBlob(m_pDragBlob);
02513
02514
02515 }
02516 else
02517 {
02518
02519
02520 pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpChangeBevelLightAngle));
02521
02522 Param.pNodes = m_pDragBlob->GetList();
02523 Param.NewLightAngle = m_pDragBlob->GetAngle();
02524 Param.OldLightAngle = m_BlobAngle;
02525
02526 if (pTool)
02527 {
02528 pTool->RenderToolBlobs(pSpread, NULL);
02529 pTool->SetBlobRendering(FALSE);
02530 }
02531
02532
02533 if (pOpDesc)
02534 {
02535 pOpDesc->Invoke(&Param);
02536 }
02537
02538 if (pTool)
02539 {
02540 pTool->SetBlobRendering(TRUE);
02541 pTool->SetupBlobList();
02542 pTool->RenderToolBlobs(pSpread, NULL);
02543 }
02544 }
02545
02546 m_bAmDragging = FALSE;
02547
02548 EndDrag();
02549 }
02550
02551
02552
02553
02554
02555
02556
02557
02558
02559
02560
02561
02562
02563
02564
02565 void BevelInfoBarOp::LoadBevelTypeComboStrings(BOOL bMany)
02566 {
02567
02568 DeleteAllValues( _R(IDC_BEVEL_TYPE_COMBO));
02569
02570
02571 String_64 Str;
02572
02573 INT32 Offset = 0;
02574
02575
02576 if (bMany)
02577 {
02578 Str.Load( _R(IDS_BEVELSTRING_MANY) );
02579 SetStringGadgetValue(_R(IDC_BEVEL_TYPE_COMBO), Str, TRUE, 0);
02580 Offset = 1;
02581 }
02582
02583
02584 for ( INT32 i=0; i<NumBevelTypes; i++ )
02585 {
02586 Str.Load( BevelTypes[i].StringID );
02587 SetStringGadgetValue(_R(IDC_BEVEL_TYPE_COMBO), Str, TRUE, i + Offset);
02588 }
02589
02590 SetComboListLength(_R(IDC_BEVEL_TYPE_COMBO));
02591 }
02592
02593
02594
02595
02596
02597
02598
02599
02600
02601
02602
02603
02604
02605
02606
02607 void BevelInfoBarOp::LoadBevelDirectionComboStrings(BOOL bMany)
02608 {
02609
02610
02611
02612
02613
02614
02615
02616
02617
02618
02619
02620
02621
02622
02623
02624
02625
02626
02627
02628
02629
02630
02631
02632
02633
02634
02635 }
02636
02637
02638
02639
02640
02641
02642
02643
02644
02645
02646
02647
02648
02649
02650
02651 void BevelInfoBarOp::UpdateInnerOuterButtons(BOOL bMany, BOOL bOuter, BOOL bNoSelection)
02652 {
02653 m_bButtonIsInner = FALSE;
02654 m_bButtonIsOuter = FALSE;
02655
02656 if (bNoSelection)
02657 {
02658 EnableGadget(_R(IDC_BTN_BEVELOUTER), FALSE);
02659 EnableGadget(_R(IDC_BTN_BEVELINNER), FALSE);
02660 SetBoolGadgetSelected(_R(IDC_BTN_BEVELOUTER), FALSE);
02661 SetBoolGadgetSelected(_R(IDC_BTN_BEVELINNER), FALSE);
02662 }
02663 else if (bMany)
02664 {
02665 EnableGadget(_R(IDC_BTN_BEVELOUTER), TRUE);
02666 EnableGadget(_R(IDC_BTN_BEVELINNER), TRUE);
02667
02668 SetBoolGadgetSelected(_R(IDC_BTN_BEVELOUTER), FALSE);
02669 SetBoolGadgetSelected(_R(IDC_BTN_BEVELINNER), FALSE);
02670 }
02671 else if (bOuter)
02672 {
02673 EnableGadget(_R(IDC_BTN_BEVELOUTER), TRUE);
02674 EnableGadget(_R(IDC_BTN_BEVELINNER), TRUE);
02675
02676 SetBoolGadgetSelected(_R(IDC_BTN_BEVELOUTER), TRUE);
02677 SetBoolGadgetSelected(_R(IDC_BTN_BEVELINNER), FALSE);
02678 m_bButtonIsOuter = TRUE;
02679 }
02680 else
02681 {
02682 EnableGadget(_R(IDC_BTN_BEVELOUTER), TRUE);
02683 EnableGadget(_R(IDC_BTN_BEVELINNER), TRUE);
02684
02685 SetBoolGadgetSelected(_R(IDC_BTN_BEVELOUTER), FALSE);
02686 SetBoolGadgetSelected(_R(IDC_BTN_BEVELINNER), TRUE);
02687 m_bButtonIsInner = TRUE;
02688 }
02689 }
02690
02691
02692
02693
02694
02695
02696
02697
02698
02699
02700
02701
02702
02703
02704
02705 MILLIPOINT BevelInfoBarOp::GetSliderDepth()
02706 {
02707 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_DEPTH_MIN, BEVEL_DEPTH_MAX);
02708 MILLIPOINT Value = GetLongGadgetValue(_R(IDC_BEVELSLIDER), BEVEL_DEPTH_MIN,
02709 BEVEL_DEPTH_MAX);
02710
02711
02712 if (Value > BEVEL_DEPTH_MAX)
02713 Value = BEVEL_DEPTH_MAX;
02714
02715 double dValue = Value - BEVEL_DEPTH_MIN;
02716 dValue /= (double)(BEVEL_DEPTH_MAX - BEVEL_DEPTH_MIN);
02717
02718
02719
02720 BevelSliderProfile.SetBias(-BevelSliderProfile.GetBias());
02721 double dSliderValue = BevelSliderProfile.MapZeroToOne((AFp)dValue);
02722 BevelSliderProfile.SetBias(-BevelSliderProfile.GetBias());
02723
02724 dSliderValue *= (double)(BEVEL_DEPTH_MAX - BEVEL_DEPTH_MIN);
02725 dSliderValue += BEVEL_DEPTH_MIN;
02726
02727 return (INT32)dSliderValue;
02728 }
02729
02730
02731
02732
02733
02734
02735
02736
02737
02738
02739
02740
02741
02742
02743 void BevelInfoBarOp::SetSliderDepth(MILLIPOINT Value)
02744 {
02745
02746 if (Value > BEVEL_DEPTH_MAX)
02747 Value = BEVEL_DEPTH_MAX;
02748
02749 if (Value < BEVEL_DEPTH_MIN)
02750 Value = BEVEL_DEPTH_MIN;
02751
02752 double dValue = Value - BEVEL_DEPTH_MIN;
02753 dValue /= (double)(BEVEL_DEPTH_MAX - BEVEL_DEPTH_MIN);
02754
02755
02756 double dSliderValue = 0;
02757
02758 dSliderValue = BevelSliderProfile.MapZeroToOne((AFp)(dValue));
02759
02760
02761 dSliderValue *= (double)(BEVEL_DEPTH_MAX - BEVEL_DEPTH_MIN);
02762 dSliderValue += BEVEL_DEPTH_MIN;
02763
02764 SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_DEPTH_MIN, BEVEL_DEPTH_MAX);
02765
02766 SetLongGadgetValue(_R(IDC_BEVELSLIDER), (INT32)dSliderValue);
02767 }
02768
02769
02770
02771
02772
02773
02774
02775
02776
02777
02778
02779
02780
02781