InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CPathCreationTracker.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Lonnie Millett
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __CPathCreationTracker__
25 #define __CPathCreationTracker__
26 
27 #include "CTracker.h"
28 #include "IPlaceBehavior.h"
29 #include "IDynamicTrackerData.h"
30 #include "PMPoint.h"
31 #include "PMRect.h"
32 #include "UIDRef.h"
33 #include "TransformTypes.h"
34 
35 //----------------------------------------------------------------------------------------
36 // Forward Declarations
37 //----------------------------------------------------------------------------------------
38 
39 class ICommand;
40 class PMPoint;
41 class IPathGeometry;
42 class ICmdCollection;
43 
44 //----------------------------------------------------------------------------------------
45 // CPathCreationTracker: Tracker for creating new page items
46 //----------------------------------------------------------------------------------------
47 
48 
60 {
61  public:
62  // Dynamic cursor options for specifying what gets drawn in the cursor while tracking
63  enum CursorOptions
64  {
65  kDefaultCursor = 0, // do not modify the cursor
66  kShowWidthHeight, // Add width/height information to cursor
67  kShowXPosition, // Add X Position information to cursor (useful for vertical guides)
68  kShowYPosition, // Add Y Position information to cursor (useful for horizontal guides)
69  kShowXYPosition, // Add X,Y Position information to cursor
70  kShowLineLength, // Add Line length information to cursor
71  kShowScale // Add Scale information to cursor
72  };
73 
78 
80  virtual ~CPathCreationTracker();
81 
85  virtual bool16 BeginTracking(IEvent* theEvent);
86 
93  virtual void ContinueTracking(const PBPMPoint& where, bool16 mouseDidMove);
94 
98  virtual bool16 EndTracking(IEvent* theEvent);
99 
103  virtual void AbortTracking(IEvent* theEvent);
104 
105  protected:
108  virtual void CleanupTracking();
109 
111  virtual CursorOptions GetCursorOption(void) const;
112 
116  virtual void HandleMove(PMPoint& where);
121  virtual PMPoint AutoScroll(const PMPoint& scrollBy, const PMPoint& scrolledPoint);
122 
128  virtual void MakePath (const PMPoint& startPt, const PMPoint& endPoint, IPathGeometry* pathGeometry);
129 
133  virtual void ShiftConstrainPoint(PMPoint& where);
134 
135 
143  virtual bool16 MovedMinimumDistance (const PBPMPoint& newLocation);
144 
145 
148  virtual bool16 IsGraphicFrame();
149 
150 
154  virtual void ProcessAdditionalCreationCommands (const UIDRef& newItem, const UIDRef& parent, const PMPointList& points, IPlaceBehavior::eAfterPlace afterPlace);
155 
156  //
161  virtual UIDRef CreatePageItem (const UIDRef& parent, const PMPointList& points, const IEvent& theEvent, IPlaceBehavior::eAfterPlace *afterPlace = nil);
162 
163 
171  virtual void SetBoundingBox (const UIDRef& newItem, const UIDRef& parent, const PMPointList& points);
172 
173 
179  virtual void AddToHierarchy (const UIDRef& parent, const UIDRef& newItem);
180 
181 
187  virtual void ProcessAdditionalSelectionCommands (const UIDRef& newItem);
188 
194  virtual void ProcessAddToSelectionCommand(IControlView *view, const UIDRef& newItem);
195 
199  virtual void CompletelyCreateItem(IEvent* theEvent);
200 
201 
207  virtual bool16 SufficientSize(const PMPointList& points);
208 
211  virtual void ConvertToPasteboardConstrained(PMPoint thePoint, PMPoint& convertedPoint);
214  virtual void ConvertToPasteboardConstrained(GSysPoint thePoint, PMPoint& convertedPoint);
215 
216  virtual void SetUpParentTransforms(PMPoint *endPoint);
217 
218  virtual UIDRef GetParent();
219 
220  private:
221 
225  bool16 DrawingCursorFeedback();
226  PMPointList GetEffectiveBoundsUsingObjectStyle(const PMPointList& currentPoints, const UIDRef pageItem);
227  protected:
232  virtual void CheckSmartDimensions(PBPMPoint& endPoint,
233  PBPMPoint& startPoint,
234  SnapType& snapType,
235  const IControlView* view);
236  virtual Geometry::BoundsKind GetPathCreationBoundsKind();
237 
238  ClassID fClassID; // the class of the item we're creating
239  PMPoint fStartPnt; // location of first mouse down, constrained to paste board
240  PMPoint fStartGlobalPt; // stored global location of first mouse down.
241  PMRect fPasteBoardBoundaries;
242  PMRect fPasteBoardBoundsSpreadCoordinates;
243  bool16 fShiftKeyPressed; // True if shift key is currently pressed
244  bool16 fShownFirstTime;
245  bool16 fOptionAltKeyPressed; // True if option/alt key is currently pressed
246  bool16 fCmdCtrlKeyPressed; // True if command/control key is currently pressed
247  bool16 fCreatingFromCenter; // True when user has option/alt key pressed
248  PMMatrix fSpreadToPasteboardMatrix;
249  PMMatrix fPasteboardToSpreadMatrix;
250  PMMatrix fTransformMatrix;
251  PMMatrix fBackTransformMatrix;
252  IAbortableCmdSeq* fTrackerSequence;
253 
254  PMRect fGraphicBBox;
255  bool32 fCreateMultiple;
256  int32 fRows;
257  int32 fColumns;
258  static PMReal fHSpacing;
259  static PMReal fVSpacing;
260 };
261 
262 
263 #endif