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 #ifndef INC_CONTOURTOOL
00101 #define INC_CONTOURTOOL
00102
00103
00104
00105
00106 #include "blendatt.h"
00107
00108 #include "biasgdgt.h"
00109
00110
00111 #include "bevtrap.h"
00112 #include "dragtool.h"
00113
00114 class ContourTool;
00115 class ContourInfoBarOp;
00116 class AttrJoinType;
00117 class BlendToolRef;
00118
00119 #define OPTOKEN_CONTOURNODES _T("ContourNode")
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 class OpContourNodes : public SelOperation
00137 {
00138 CC_DECLARE_DYNCREATE(OpContourNodes);
00139
00140 public:
00141
00142 OpContourNodes();
00143 ~OpContourNodes();
00144
00145
00146 BOOL DoDrag(ContourTool * pTool, ContourInfoBarOp * pOp, DocCoord & PointerPos, BOOL bDragOnBlob,
00147 DocRect * pBlobRect = NULL);
00148 virtual BOOL SnappingDrag() { return FALSE; }
00149
00150
00151 virtual void DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread*, BOOL bSolidDrag);
00152 virtual void DragFinished( DocCoord PointerPos,
00153 ClickModifiers ClickMods, Spread*,
00154 BOOL Success, BOOL bSolidDrag);
00155
00156
00157 BOOL SetupDragInfo();
00158
00159
00160 void RenderDragBlobs(INT32 Width,Spread* pSpread,BOOL bKeepDirections=FALSE);
00161
00162
00163 void RenderDragBlobs(DocRect Rect,Spread* pSpread, BOOL bSolidDrag);
00164
00165
00166 static BOOL Declare();
00167 static OpState GetState(String_256* Description, OpDescriptor*);
00168
00169 void GetOpName(String_256* OpName);
00170
00171
00172 private:
00173
00174 ContourTool * m_pTool;
00175 ContourInfoBarOp * m_pBarOp;
00176
00177 BOOL m_bHasDragged;
00178 DocCoord m_LastPointerPos;
00179 DocCoord m_ThisPointerPos;
00180
00181
00182 DocRect m_BlobRect;
00183
00184
00185 DocRect m_SelRect;
00186
00187
00188 Path * m_pPathList;
00189 UINT32 m_NumPaths;
00190
00191
00192 BOOL * m_pPathOuterList;
00193 AttrJoinType ** m_pPathJoinTypeList;
00194 JointType m_JoinType;
00195
00196
00197 UINT32 * m_pSetList;
00198 UINT32 m_NumSets;
00199
00200 BOOL m_bDragStartedOnBlob;
00201
00202
00203 INT32 m_Flatness;
00204
00205
00206
00207
00208 BOOL NodeCanBeDragContoured(Node* pSubNode, Node* pNode, BOOL bContourNodesExist);
00209
00210
00211 void AlterPointerPosToAccountForBlob(DocCoord * pPoint);
00212
00213
00214
00215
00216
00217
00218
00219
00220 MILLIPOINT m_OriginalWidth;
00221
00222
00223 MILLIPOINT m_StartDragWidth;
00224
00225 };
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 class CCAPI ContourTool : public DragTool
00239 {
00240
00241 CC_DECLARE_MEMDUMP(ContourTool);
00242
00243 public:
00244 ContourTool();
00245 ~ContourTool();
00246
00247
00248 BOOL Init();
00249 void Describe(void* InfoPtr);
00250 UINT32 GetID() { return TOOLID_CONTOURTOOL; };
00251
00252
00253 void SelectChange(BOOL isSelected);
00254 void OnClick( DocCoord, ClickType, ClickModifiers, Spread* );
00255 void OnMouseMove(DocCoord PointerPos,Spread* pSpread,ClickModifiers ClickMods);
00256 void RenderToolBlobs(Spread* pSpread,DocRect* pDocRect);
00257 BOOL GetStatusLineText(String_256* ptext, Spread*, DocCoord, ClickModifiers);
00258 BOOL OnKeyPress(KeyPress* pKeyPress);
00259
00260
00261 static ContourInfoBarOp* GetContourInfoBarOp() { return pContourInfoBarOp; }
00262 static BOOL IsCurrent();
00263 static void DisplayStatusBarHelp(UINT32 StatusID);
00264
00265 static BlendToolRef* GetPtrRefStart() { return pRefStart; }
00266 static BlendToolRef* GetPtrRefEnd() { return pRefEnd; }
00267
00268 static void UpdateRef(BlendToolRef* pRef,Spread* pSpread, DocCoord PointerPos,BOOL CheckNodeUnderPoint = TRUE);
00269 static void UpdateCursorAndStatus();
00270 static void CheckNodeRemapping(BlendToolRef* pRefStart, BlendToolRef* pRefEnd);
00271
00272 static INT32 CalculateContourWidth(DocRect &br, DocCoord &PointerPos);
00273 static INT32 CalculateContourWidth(Node * pNode, DocCoord &PointerPos);
00274
00275 BOOL AreToolBlobsRenderedOnSelection() { return TRUE; }
00276
00277 void SetupToolBlobs();
00278
00279
00280 void SetBlobRendering(BOOL b)
00281 {
00282 if (b)
00283 m_bDisableBlobRenderingFlag = FALSE;
00284 else
00285 m_bDisableBlobRenderingFlag = TRUE;
00286 }
00287
00288
00289
00290 static OpContourNodes *m_pOpContourNodes;
00291
00292 private:
00293
00294 static NodeRenderableInk* FindObject(Spread* pSpread, DocCoord ClickPos);
00295 static BOOL IsPointOverPathBlob(DocCoord* pPointerPos,BlendToolRef* pRef);
00296 static BOOL IsPointOverBlendBlob(DocCoord* pPointerPos,BlendToolRef* pRef);
00297
00298 BOOL CreateCursors();
00299 void DestroyCursors();
00300
00301 static ContourInfoBarOp* pContourInfoBarOp;
00302
00303
00304 static Cursor* pcNormalCursor;
00305 static Cursor* pcOverBlob;
00306
00307 static Cursor* pcCurrentCursor;
00308 static INT32 CurrentCursorID;
00309
00310
00311 static UINT32 StatusID;
00312
00313
00314 static BlendToolRef *pRefStart;
00315 static BlendToolRef *pRefEnd;
00316
00317
00318 static TCHAR* FamilyName;
00319 static TCHAR* ToolName;
00320 static TCHAR* Purpose;
00321 static TCHAR* Author;
00322
00323
00324 DocCoord m_BlobPoints[8];
00325
00326
00327 BOOL IsPointOverBlob(DocCoord &Point, DocRect *pBlobRect = NULL);
00328
00329 BOOL m_bDisableBlobRenderingFlag;
00330 void InformWarningBevelExistsInSelection();
00331 };
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350 class ContourInfoBarOp : public InformationBarOp
00351 {
00352 CC_DECLARE_DYNCREATE( ContourInfoBarOp )
00353 public:
00354 ContourInfoBarOp()
00355 {
00356 DlgResID = _R(IDD_CONTOURINFOBAR);
00357 m_DetachBlendPath = FALSE;
00358 m_EditBlendSteps = TRUE;
00359 m_BlendAntiAlias = TRUE;
00360 m_OneToOne = FALSE;
00361 m_Tangential = FALSE;
00362 m_BlendedOnCurve = FALSE;
00363 m_bUpdateState = TRUE;
00364 m_pTool = NULL;
00365 m_bDragging = FALSE;
00366 m_LastDragWidth = 0;
00367 m_bInsetPath = FALSE;
00368 m_bOuterIsSelected = TRUE;
00369 }
00370
00371 virtual void UpdateState();
00372
00373 MsgResult Message(Msg* Msg);
00374
00375
00376 void SetSliderValue(UINT32 Width, BOOL bMany);
00377
00378
00379 void SetUpdateState(BOOL bUpdateState) { m_bUpdateState = bUpdateState; }
00380
00381 ContourTool * m_pTool;
00382
00383 BOOL m_BetweenViews;
00384
00385 private:
00386
00387 void ChangeBitmapButtonState(CGadgetID GadgetID, BOOL* CurrentState);
00388 void InitialiseObjectGainGadget(CGadgetID GadgetID, UINT32 BubbleID, UINT32 StatusID)
00389 {
00390 m_BiasGainObjectGadget.Init(this, GadgetID, BubbleID, StatusID);
00391 };
00392
00393 void InitialiseAttrGainGadget(CGadgetID GadgetID, UINT32 BubbleID, UINT32 StatusID)
00394 {
00395 m_BiasGainAttrGadget.Init(this, GadgetID, BubbleID, StatusID);
00396 };
00397
00398 void ChangeProfile(CProfileBiasGain* Profile, CGadgetID GadgetID);
00399 void ChangeProfileOnIdle(CProfileBiasGain* Profile, CGadgetID GadgetID);
00400
00401 BOOL m_DetachBlendPath;
00402 BOOL m_EditBlendSteps;
00403
00404
00405 BOOL m_BlendAntiAlias;
00406 BOOL m_OneToOne;
00407 BOOL m_Tangential;
00408 BOOL m_BlendedOnCurve;
00409
00410 Spread* m_BlobsSpread;
00411 public:
00412
00413 CBiasGainGadget m_BiasGainObjectGadget;
00414 CBiasGainGadget m_BiasGainAttrGadget;
00415
00416 BOOL GetInsetPathFlag() { return m_bInsetPath; }
00417
00418 private:
00419
00420
00421 BOOL m_bOuterIsSelected;
00422 BOOL m_bInnerIsSelected;
00423
00424 void DealWithContourOuterClick();
00425 void DealWithContourInnerClick();
00426 void DealWithWidthChange(UINT32 Width);
00427 void DealWithInsetPathClick();
00428
00429 BOOL ConvertValueToString(String_256 &In, const INT32 value, UnitType type=NOTYPE);
00430 BOOL ConvertStringToValue(CGadgetID ID,INT32 &value);
00431
00433
00434
00435
00436 void HandleJoinTypeMitreClicked();
00437 void HandleJoinTypeRoundClicked();
00438 void HandleJoinTypeBevelClicked();
00439 void ChangeJoinType(JointType jt);
00440 void UpdateJoinTypeControls();
00441 void EnableDisableJoinTypeControls();
00442
00444
00445 CProfileBiasGain* GetProfileFromSelection (CGadgetID ProfileGadgetID, BOOL* bMany, BOOL* bAllSameType);
00446
00447
00448 BOOL m_bUpdateState;
00449
00450
00451 BOOL m_bDragging;
00452
00453
00454 MILLIPOINT m_LastDragWidth;
00455
00456
00457 MILLIPOINT GetSliderLogValue();
00458 BOOL SetSliderLogValue(MILLIPOINT Width);
00459
00460 void UpdateGadgetHelp();
00461
00462 BOOL m_bInsetPath;
00463
00464 BOOL CheckForBevels();
00465 };
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477 class ContourDragBecomeA : public BecomeA
00478 {
00479 public:
00480
00481 ContourDragBecomeA(BecomeAReason Reason,
00482 CCRuntimeClass* pClass,
00483 UndoableOperation* pOp,
00484 BOOL Sel,
00485 Path * pPathList,
00486 UINT32 NumPaths,
00487 BOOL IncludeLineWidths = FALSE) : BecomeA(Reason, pClass, pOp, Sel)
00488 {
00489 m_pPathList = pPathList;
00490 m_NumPaths = NumPaths;
00491 m_Count = 0;
00492 m_IncludeLineWidths = IncludeLineWidths;
00493
00494
00495 fSilhouette = TRUE;
00496 }
00497
00498
00499 virtual BOOL PassBack(NodeRenderableInk* pNewNode,NodeRenderableInk* pCreatedByNode,
00500 CCAttrMap* pAttrMap);
00501
00502
00503
00504 private:
00505
00506
00507 Path * m_pPathList;
00508
00509
00510 UINT32 m_NumPaths;
00511
00512
00513
00514
00515 BOOL m_IncludeLineWidths;
00516 } ;
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533 class ContourInfoBarOpCreate : public BarCreate
00534 {
00535 public:
00536 DialogBarOp* Create() { return (new ContourInfoBarOp); }
00537 };
00538
00539
00540
00541 #endif // INC_CONTOURTOOL