InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PathTypes.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Paul Sorrick
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 __PathTypes__
25 #define __PathTypes__
26 
27 #include "K2Vector.h"
28 #include "IPMStream.h"
29 
31 enum PathPointIndex
32 {
34  kLeftDirPt = 0,
36  kAnchorPt,
38  kRightDirPt,
40  kBothDirPts,
42  kSegment
43 } ;
44 
46 enum PMPathPointType
47 {
49  kCS,
52  kCK,
55  kL
56 };
57 DECLARE_BASE_TYPE(PMPathPointType);
58 
61 
63 enum PMPathSegmentType
64 {
66  kLine,
68  kCurve,
70  kNoSegment
71 } ;
72 
79 inline int32 PT_INDEX( int32 n, int32 total ) { return (n + total) % total ; }
80 
83 {
84 public:
85  typedef base_type data_type;
86 
88  PointSelector() :
89  fPathIndex( -1 ),
90  fPointIndex( -1 ),
91  fSelector( kAnchorPt ),
92  fAdornmentClass(kInvalidClass)
93  {}
95  PointSelector( int32 path, int32 point, PathPointIndex flags = kAnchorPt, ClassID adornmentClass = kInvalidClass ) :
96  fPathIndex( path ),
97  fPointIndex( point ),
98  fSelector( flags ),
99  fAdornmentClass (adornmentClass)
100  {}
101 
103  int32 PathIndex() const { return fPathIndex ; }
105  void PathIndex( int32 pathIndex ) { fPathIndex = pathIndex ; }
106 
108  int32 PointIndex() const { return fPointIndex ; }
110  void PointIndex( int32 pointIndex ) { fPointIndex = pointIndex ; }
111 
113  PathPointIndex Selector() const { return fSelector ; }
115  void Selector( PathPointIndex selector ) { fSelector = selector ; }
116 
118  ClassID AdornmentClass() const { return fAdornmentClass; }
120  void AdornmentClass (ClassID adornmentClass) { fAdornmentClass = adornmentClass; }
121 
123  bool16 operator==( const PointSelector& other ) const
124  {
125  return ( fPathIndex == other.fPathIndex && fPointIndex == other.fPointIndex && fSelector == other.fSelector ) ;
126  }
128  bool16 operator!=( const PointSelector& other ) const
129  {
130  return ( fPathIndex != other.fPathIndex || fPointIndex != other.fPointIndex || fSelector != other.fSelector ) ;
131  }
133  bool16 operator<( const PointSelector& other ) const
134  {
135  if ( fPathIndex < other.fPathIndex )
136  return kTrue ;
137  if ( fPathIndex > other.fPathIndex )
138  return kFalse ;
139  if ( fPointIndex < other.fPointIndex )
140  return kTrue ;
141  return kFalse ;
142  }
143  void ReadWrite(IPMStream *s)
144  {
145  s->XferInt32(fPathIndex);
146  s->XferInt32(fPointIndex);
147  s->XferInt32((int32&)fSelector);
148  s->XferID(fAdornmentClass);
149  }
150 private:
151  int32 fPathIndex ;
152  int32 fPointIndex ;
153  PathPointIndex fSelector ;
154 
155  ClassID fAdornmentClass; // If the item hit was an adornment then this will not be kInvalidClass
156 } ;
157 
160 
161 #endif