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 #ifndef INC_SHAPEOPS
00104 #define INC_SHAPEOPS
00105
00106
00107
00108
00109
00110
00111 #define OPTOKEN_EDITREGULARSHAPE _T("EditRegularShape")
00112 #define OPTOKEN_DRAGREGULARSHAPE _T("DragRegularShape")
00113 #define OPTOKEN_RESHAPESHAPEEDGE _T("ReshapeShapeEdge")
00114 #define OPTOKEN_TOGGLEELIPPOLY _T("ShapeToggleElipPoly")
00115 #define OPTOKEN_TOGGLECURVATURE _T("ShapeToggleCurvature")
00116 #define OPTOKEN_TOGGLESTELLATION _T("ShapeToggleStellation")
00117 #define OPTOKEN_QUICKSHAPE_MAKEREGULAR _T("QuickShapeMakeRegular")
00118
00119 #define OPTOKEN_QUICKSHAPE_NUMBERSIDES _T("QuickShapeNumberSides")
00120 #define OPTOKEN_QUICKSHAPE_NUMBERSIDES3 _T("QuickShapeNumberSides3")
00121 #define OPTOKEN_QUICKSHAPE_NUMBERSIDES4 _T("QuickShapeNumberSides4")
00122 #define OPTOKEN_QUICKSHAPE_NUMBERSIDES5 _T("QuickShapeNumberSides5")
00123 #define OPTOKEN_QUICKSHAPE_NUMBERSIDES6 _T("QuickShapeNumberSides6")
00124 #define OPTOKEN_QUICKSHAPE_NUMBERSIDES7 _T("QuickShapeNumberSides7")
00125 #define OPTOKEN_QUICKSHAPE_NUMBERSIDES8 _T("QuickShapeNumberSides8")
00126 #define OPTOKEN_QUICKSHAPE_NUMBERSIDES9 _T("QuickShapeNumberSides9")
00127 #define OPTOKEN_QUICKSHAPE_NUMBERSIDES10 _T("QuickShapeNumberSides10")
00128
00129 class Cursor;
00130 class NodeRegularShape;
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 class EditRegularShapeParam : public OpParam
00148 {
00149 CC_DECLARE_MEMDUMP(EditRegularShapeParam)
00150
00151 public:
00152 enum BooleanChange {CHANGE_DONTCARE, CHANGE_SETFALSE, CHANGE_SETTRUE};
00153 enum AffectShape {AFFECT_ALL, AFFECT_ELLIPSES, AFFECT_RECTANGLES};
00154
00155 EditRegularShapeParam(NodeRegularShape* ChangeShapes);
00156
00157 NodeRegularShape* ShapeToChange;
00158 AffectShape ShapesToAffect;
00159 Path* NewEdgePath1;
00160 Path* NewEdgePath2;
00161 UINT32 NewNumSides;
00162 BooleanChange NewCircular;
00163 BooleanChange NewStellated;
00164 BooleanChange NewPrimaryCurvature;
00165 BooleanChange NewStellationCurvature;
00166 double NewStellRadiusToPrimary;
00167 double NewPrimaryCurveToPrimary;
00168 double NewStellCurveToStell;
00169 double NewStellOffsetRatio;
00170
00171 DocCoord TranslateTo;
00172 DocCoord TranslateBy;
00173 INT32 SetRadiusLength;
00174 INT32 AddRadiusLength;
00175 double RotateTo;
00176 double RotateBy;
00177 INT32 SetStellationLength;
00178 INT32 AddStellationLength;
00179 double SetStellationOffset;
00180 double AddStellationOffset;
00181 double AddPrimaryCurvature;
00182 double AddStellationCurvature;
00183 INT32 SetMajorAxisLength;
00184 INT32 AddMajorAxisLength;
00185 INT32 SetMinorAxisLength;
00186 INT32 AddMinorAxisLength;
00187 };
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205 class OpEditRegularShape: public SelOperation
00206 {
00207 CC_DECLARE_DYNCREATE( OpEditRegularShape )
00208
00209 public:
00210 OpEditRegularShape();
00211 static BOOL Init();
00212 static OpState GetState(String_256*, OpDescriptor*);
00213 void DoWithParam(OpDescriptor* pOpDesc, OpParam* pEntryOpParam);
00214
00215 protected:
00216 BOOL CarryOut(NodeRegularShape* ShapeToEdit, EditRegularShapeParam* pOpParam);
00217 BOOL ShouldDoThisShape(NodeRegularShape* pShape, EditRegularShapeParam::AffectShape Allowance);
00218 };
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 class OpDragRegularShape : public SelOperation
00236 {
00237
00238 CC_DECLARE_DYNCREATE(OpDragRegularShape)
00239
00240 enum DragType {DRAG_CENTRE, DRAG_ELLIPSE, DRAG_PRIMARY, DRAG_STELLATION,
00241 DRAG_PRIMARYCURVE, DRAG_STELLATIONCURVE};
00242
00243 public:
00244
00245 OpDragRegularShape();
00246
00247
00248 void DoStartDragEdit( NodeRegularShape*, DocCoord, Spread *, DragType, BOOL QuickShape);
00249 void DoStartDragEditCurve( NodeRegularShape*, DocCoord, Spread *, DragType, DocCoord Start, DocCoord End);
00250 virtual BOOL SnappingDrag();
00251
00252
00253 virtual void DragPointerMove( DocCoord Pos, ClickModifiers Mods, Spread* pSpread, BOOL bSolidDrag);
00254 virtual void DragFinished( DocCoord Pos, ClickModifiers Mods, Spread* pSpread, BOOL Success, BOOL bSolidDrag);
00255
00256
00257 virtual void RenderDragBlobs( DocRect, Spread * , BOOL bSolidDrag);
00258
00259
00260 static BOOL Init();
00261 static OpState GetState(String_256* Description, OpDescriptor*);
00262
00263 private:
00264
00265 BOOL ProcessCentre(DocCoord Pos, ClickModifiers Mods);
00266 BOOL ProcessPrimary(DocCoord Pos, ClickModifiers Mods);
00267 BOOL ProcessRectangle(DocCoord Pos, ClickModifiers Mods);
00268 BOOL ProcessRectangleDiagonal(DocCoord Pos, ClickModifiers Mods);
00269 BOOL ProcessRectangleEdge(DocCoord Pos, DocCoord OtherEnd);
00270 BOOL ProcessEllipse(DocCoord Pos, ClickModifiers Mods);
00271 BOOL ProcessStellation(DocCoord Pos, ClickModifiers Mods);
00272 BOOL ProcessRadius(DocCoord Pos, ClickModifiers Mods);
00273 BOOL ProcessPrimaryCurve(DocCoord Pos);
00274 BOOL ProcessStellationCurve(DocCoord Pos);
00275 void WheelConstrain(DocCoord* PointerPos, const DocCoord StartPos);
00276 DocCoord GetUTPosition(DocCoord TransedPos);
00277 BOOL IsJoinAcute(const DocCoord* pJoin, const DocCoord* pOtherEndOfJoin, const DocCoord* pOtherPoint);
00278
00279
00280 DocCoord LastMousePos;
00281 DocCoord StartMousePos;
00282 Spread* StartSpread;
00283 NodeRegularShape* OriginalShape;
00284 NodeRegularShape* EditShape;
00285 Cursor* pCursor;
00286 INT32 CurrentCursorID;
00287 DragType DragObject;
00288
00289 DocCoord LineStart;
00290 DocCoord LineEnd;
00291 Matrix transMat;
00292 DocCoord RectangleArray[4];
00293 BOOL DragAroundCentre;
00294 };
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310 class OpReformShapeEdge : public SelOperation
00311 {
00312
00313 CC_DECLARE_DYNCREATE(OpReformShapeEdge)
00314
00315
00316 public:
00317
00318 OpReformShapeEdge();
00319
00320
00321 void DoStartDragEdit(NodeRegularShape* OrigShape, BOOL EdgeOne, DocCoord Anchor,
00322 Spread *pSpread, INT32 SegmentIndex);
00323
00324
00325 virtual void DragPointerMove( DocCoord Pos, ClickModifiers Mods, Spread* pSpread, BOOL bSolidDrag);
00326 virtual void DragFinished( DocCoord Pos, ClickModifiers Mods, Spread* pSpread, BOOL Success, BOOL bSolidDrag);
00327
00328
00329 virtual void RenderDragBlobs( DocRect, Spread * , BOOL bSolidDrag);
00330
00331
00332 static BOOL Init();
00333 static OpState GetState(String_256* Description, OpDescriptor*);
00334
00335 private:
00336 enum DragType {DRAG_EDGE1, DRAG_EDGE2};
00337 void RecalculateEdge( DocCoord Offset);
00338 BOOL BuildEditEdge();
00339 BOOL BuildEditShape(BOOL CopyToBoth, BOOL ShouldMirror);
00340 BOOL ReversePath(Path* NewPath, BOOL ShouldMirror);
00341
00342 NodeRegularShape* EditShape;
00343 NodeRegularShape* OriginalShape;
00344 DocCoord StartMousePos;
00345 DocCoord UTStartMousePos;
00346 DocCoord OrigControl1;
00347 DocCoord OrigControl2;
00348 Spread* StartSpread;
00349 Path* EditEdge;
00350 INT32 Index;
00351 double paramdist;
00352 DragType EdgeDrag;
00353
00354 };
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369 class ChangeShapeDataAction : public Action
00370 {
00371
00372 CC_DECLARE_DYNCREATE(ChangeShapeDataAction)
00373
00374 public:
00375
00376 enum ChangeItem {CHANGE_NUMSIDES, CHANGE_CIRCULAR, CHANGE_STELLATED, CHANGE_PRIMARYCURVATURE,
00377 CHANGE_STELLATIONCURVATURE, CHANGE_STELLRADIUSTOPRIMARY,
00378 CHANGE_PRIMARYCURVETOPRIMARY, CHANGE_STELLCURVETOSTELL, CHANGE_STELLATIONOFFSET};
00379
00380 ChangeShapeDataAction();
00381 virtual ActionCode Execute();
00382 static ActionCode Init( Operation* pOp,
00383 ActionList* pActionList,
00384 NodeRegularShape* pShape,
00385 enum ChangeItem NewItem,
00386 double NewData,
00387 Action** NewAction);
00388 static ActionCode DoToggle( Operation* pOp,
00389 ActionList* pActionList,
00390 NodeRegularShape* pShape,
00391 enum ChangeItem NewItem,
00392 double NewData);
00393
00394 private:
00395 NodeRegularShape* pToggleShape;
00396 enum ChangeItem ChangeItemID;
00397 double NewValue;
00398 };
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413 class ChangeShapePointAction : public Action
00414 {
00415
00416 CC_DECLARE_DYNCREATE(ChangeShapePointAction)
00417
00418 public:
00419 enum ChangeItem {CHANGE_MAJOR, CHANGE_CENTRE, CHANGE_MINOR};
00420
00421 ChangeShapePointAction();
00422 virtual ActionCode Execute();
00423 static ActionCode Init( Operation* pOp,
00424 ActionList* pActionList,
00425 NodeRegularShape* pShape,
00426 enum ChangeItem NewItem,
00427 DocCoord NewData,
00428 Action** NewAction);
00429 static ActionCode DoToggle( Operation* pOp,
00430 ActionList* pActionList,
00431 NodeRegularShape* pShape,
00432 enum ChangeItem NewItem,
00433 DocCoord NewData);
00434
00435
00436 private:
00437 NodeRegularShape* pToggleShape;
00438 enum ChangeItem ChangeItemID;
00439 DocCoord NewValue;
00440 };
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455 class ChangeShapePathAction : public Action
00456 {
00457
00458 CC_DECLARE_DYNCREATE(ChangeShapePathAction)
00459
00460 public:
00461 enum ChangeItem {CHANGE_PATH1, CHANGE_PATH2};
00462
00463 ChangeShapePathAction();
00464 virtual ActionCode Execute();
00465 static ActionCode Init( Operation* pOp,
00466 ActionList* pActionList,
00467 NodeRegularShape* pShape,
00468 enum ChangeItem NewItem,
00469 Path* NewPath,
00470 Action** NewAction);
00471 static ActionCode DoReshape( Operation* pOp,
00472 ActionList* pActionList,
00473 NodeRegularShape* pShape,
00474 enum ChangeItem NewItem,
00475 Path* NewPath);
00476 private:
00477 NodeRegularShape* pShape;
00478 enum ChangeItem ChangeItemID;
00479 Path NewEdge;
00480 };
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494 class ShapeEditedMsg : public Msg
00495 {
00496 CC_DECLARE_DYNAMIC(ShapeEditedMsg)
00497
00498 public:
00499 NodeRegularShape* pShape;
00500 Spread* pSpread;
00501
00502 ShapeEditedMsg(NodeRegularShape* pChangeShape, Spread* pParentSpread);
00503 };
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519 class CCAPI OpShapeToggleBase: public SelOperation
00520 {
00521 CC_DECLARE_DYNCREATE( OpShapeToggleBase )
00522
00523 public:
00524 OpShapeToggleBase();
00525 void Do(OpDescriptor*);
00526
00527 protected:
00528 virtual BOOL DoAction(NodeRegularShape* pShape);
00529 };
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545 class CCAPI OpShapeToggleElipPoly: public OpShapeToggleBase
00546 {
00547 CC_DECLARE_DYNCREATE( OpShapeToggleElipPoly )
00548
00549 public:
00550 OpShapeToggleElipPoly();
00551 static BOOL Init();
00552 static OpState GetState(String_256*, OpDescriptor*);
00553 protected:
00554 BOOL DoAction(NodeRegularShape* pShape);
00555 };
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571 class CCAPI OpShapeToggleCurvature: public OpShapeToggleBase
00572 {
00573 CC_DECLARE_DYNCREATE( OpShapeToggleCurvature )
00574
00575 public:
00576 OpShapeToggleCurvature();
00577 static BOOL Init();
00578 static OpState GetState(String_256*, OpDescriptor*);
00579 protected:
00580 BOOL DoAction(NodeRegularShape* pShape);
00581 };
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597 class CCAPI OpShapeToggleStellation: public OpShapeToggleBase
00598 {
00599 CC_DECLARE_DYNCREATE( OpShapeToggleStellation )
00600
00601 public:
00602 OpShapeToggleStellation();
00603 static BOOL Init();
00604 static OpState GetState(String_256*, OpDescriptor*);
00605 protected:
00606 BOOL DoAction(NodeRegularShape* pShape);
00607 };
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623 class CCAPI OpShapeToggleSetNumSides: public SelOperation
00624 {
00625 CC_DECLARE_DYNCREATE( OpShapeToggleSetNumSides )
00626
00627 public:
00628 OpShapeToggleSetNumSides();
00629 static OpState GetState(String_256*, OpDescriptor*);
00630 static BOOL Init();
00631
00632 protected:
00633 BOOL DoAction(INT32 NewNumSides);
00634 };
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650 class CCAPI OpShapeToggleSetNumSides3: public OpShapeToggleSetNumSides
00651 {
00652 CC_DECLARE_DYNCREATE( OpShapeToggleSetNumSides3 )
00653
00654 public:
00655 OpShapeToggleSetNumSides3() {};
00656 void Do(OpDescriptor*);
00657 };
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673 class CCAPI OpShapeToggleSetNumSides4: public OpShapeToggleSetNumSides
00674 {
00675 CC_DECLARE_DYNCREATE( OpShapeToggleSetNumSides4 )
00676
00677 public:
00678 OpShapeToggleSetNumSides4() {};
00679 void Do(OpDescriptor*);
00680 };
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696 class CCAPI OpShapeToggleSetNumSides5: public OpShapeToggleSetNumSides
00697 {
00698 CC_DECLARE_DYNCREATE( OpShapeToggleSetNumSides5 )
00699
00700 public:
00701 OpShapeToggleSetNumSides5() {};
00702 void Do(OpDescriptor*);
00703 };
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719 class CCAPI OpShapeToggleSetNumSides6: public OpShapeToggleSetNumSides
00720 {
00721 CC_DECLARE_DYNCREATE( OpShapeToggleSetNumSides6 )
00722
00723 public:
00724 OpShapeToggleSetNumSides6() {};
00725 void Do(OpDescriptor*);
00726 };
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742 class CCAPI OpShapeToggleSetNumSides7: public OpShapeToggleSetNumSides
00743 {
00744 CC_DECLARE_DYNCREATE( OpShapeToggleSetNumSides7 )
00745
00746 public:
00747 OpShapeToggleSetNumSides7() {};
00748 void Do(OpDescriptor*);
00749 };
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765 class CCAPI OpShapeToggleSetNumSides8: public OpShapeToggleSetNumSides
00766 {
00767 CC_DECLARE_DYNCREATE( OpShapeToggleSetNumSides8 )
00768
00769 public:
00770 OpShapeToggleSetNumSides8() {};
00771 void Do(OpDescriptor*);
00772 };
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788 class CCAPI OpShapeToggleSetNumSides9: public OpShapeToggleSetNumSides
00789 {
00790 CC_DECLARE_DYNCREATE( OpShapeToggleSetNumSides9 )
00791
00792 public:
00793 OpShapeToggleSetNumSides9() {};
00794 void Do(OpDescriptor*);
00795 };
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811 class CCAPI OpShapeToggleSetNumSides10: public OpShapeToggleSetNumSides
00812 {
00813 CC_DECLARE_DYNCREATE( OpShapeToggleSetNumSides10 )
00814
00815 public:
00816 OpShapeToggleSetNumSides10() {};
00817 void Do(OpDescriptor*);
00818 };
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833 class CCAPI OpShapeMakeRegular: public SelOperation
00834 {
00835 CC_DECLARE_DYNCREATE( OpShapeMakeRegular )
00836
00837 public:
00838 OpShapeMakeRegular() {};
00839 static OpState GetState(String_256*, OpDescriptor*);
00840 static BOOL Init();
00841 void DoMakeRegular(NodeRegularShape* pShape, DocCoord RegularPoint);
00842
00843 protected:
00844 BOOL DoActions(NodeRegularShape* pShape, DocCoord RegularPoint);
00845
00846 };
00847
00848
00849
00850
00851 #endif // INC_SHAPEOPS