1 /****************************************************************************
2 **
3 ** This file is part of the LibreCAD project, a 2D CAD program
4 **
5 ** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
6 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
7 **
8 **
9 ** This file may be distributed and/or modified under the terms of the
10 ** GNU General Public License version 2 as published by the Free Software
11 ** Foundation and appearing in the file gpl-2.0.txt included in the
12 ** packaging of this file.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ** GNU General Public License for more details.
18 **
19 ** You should have received a copy of the GNU General Public License
20 ** along with this program; if not, write to the Free Software
21 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 **
23 ** This copyright notice MUST APPEAR in all copies of the script!
24 **
25 **********************************************************************/
26 
27 #ifndef RS_H
28 #define RS_H
29 
30 //#define RS_TEST
31 
32 // Windoze XP can't handle the original MAX/MINDOUBLE's
33 #define RS_MAXDOUBLE 1.0E+10
34 #define RS_MINDOUBLE -1.0E+10
35 //tolerance
36 #define RS_TOLERANCE 1.0e-10
37 //squared tolerance
38 #define RS_TOLERANCE15 1.5e-15
39 #define RS_TOLERANCE2 1.0e-20
40 #define RS_TOLERANCE_ANGLE 1.0e-8
41 
42 /**
43  * Class namespace for various enums along with some simple
44  * wrapper methods for converting the enums to the Qt
45  * counterparts.
46  *
47  * @author Andrew Mustun
48  */
49 class RS2 {
50 public:
51 
52     /**
53      * Flags.
54      */
55     enum Flags {
56         /** Flag for Undoables. */
57         FlagUndone      = 1<<0,
58         /** Entity Visibility. */
59         FlagVisible     = 1<<1,
60         /** Entity attribute (e.g. color) is defined by layer. */
61         FlagByLayer     = 1<<2,
62         /** Entity attribute (e.g. color) defined by block. */
63         FlagByBlock     = 1<<3,
64         /** Layer frozen. */
65         FlagFrozen      = 1<<4,
66         /** Layer frozen by default. */
67         FlagDefFrozen   = 1<<5,
68         /** Layer locked. */
69         FlagLocked      = 1<<6,
70         /** Used for invalid pens. */
71         FlagInvalid     = 1<<7,
72         /** Entity in current selection. */
73         FlagSelected    = 1<<8,
74         /** Polyline closed? */
75         FlagClosed      = 1<<9,
76         /** Flag for temporary entities (e.g. hatch) */
77         FlagTemp        = 1<<10,
78         /** Flag for processed entities (optcontour) */
79         FlagProcessed   = 1<<11,
80         /** Startpoint selected */
81         FlagSelected1   = 1<<12,
82         /** Endpoint selected */
83         FlagSelected2   = 1<<13,
84                 /** Entity is highlighted temporarily (as a user action feedback) */
85                 FlagHighlighted = 1<<14
86     };
87 
88     /**
89      * Variable types used by RS_VariableDict and RS_Variable.
90      */
91     enum VariableType {
92         VariableString,
93         VariableInt,
94         VariableDouble,
95         VariableVector,
96         VariableVoid
97     };
98 
99     /**
100      * File types. Used by file dialogs. Note: the extension might not
101      * be enough to distinguish file types.
102      */
103     enum FormatType {
104         FormatUnknown,       /**< Unknown / unsupported format. */
105         FormatDXF1,          /**< QCad 1 compatibility DXF format. */
106         FormatDXFRW,           /**< DXF format. v2007. */
107         FormatDXFRW2004,           /**< DXF format. v2004. */
108         FormatDXFRW2000,           /**< DXF format. v2000. */
109         FormatDXFRW14,           /**< DXF format. v14. */
110         FormatDXFRW12,           /**< DXF format. v12. */
111 #ifdef DWGSUPPORT
112         FormatDWG,           /**< DWG format. */
113 #endif
114         FormatLFF,           /**< LibreCAD Font File format. */
115         FormatCXF,           /**< CAM Expert Font format. */
116         FormatJWW,           /**< JWW Format type */
117         FormatJWC            /**< JWC Format type */
118     };
119 
120     /**
121      * Entity types returned by the rtti() method
122      */
123     enum EntityType {
124         EntityUnknown,      /**< Unknown */
125         EntityContainer,    /**< Container */
126         EntityBlock,        /**< Block (Group definition) */
127         EntityFontChar,     /**< Font character */
128         EntityInsert,       /**< Insert (Group instance) */
129         EntityGraphic,      /**< Graphic with layers */
130         EntityPoint,        /**< Point */
131         EntityLine,         /**< Line */
132         EntityPolyline,     /**< Polyline */
133         EntityVertex,       /**< Vertex (part of a polyline) */
134         EntityArc,          /**< Arc */
135         EntityCircle,       /**< Circle */
136         EntityEllipse,      /**< Ellipse */
137         EntityHyperbola,      /**< Hyperbola */
138         EntitySolid,        /**< Solid */
139         EntityConstructionLine, /**< Construction line */
140         EntityMText,         /**< Multi-line Text */
141         EntityText,         /**< Single-line Text */
142         EntityDimAligned,   /**< Aligned Dimension */
143         EntityDimLinear,    /**< Linear Dimension */
144         EntityDimRadial,    /**< Radial Dimension */
145         EntityDimDiametric, /**< Diametric Dimension */
146         EntityDimAngular,   /**< Angular Dimension */
147         EntityDimLeader,    /**< Leader Dimension */
148         EntityHatch,        /**< Hatch */
149         EntityImage,        /**< Image */
150         EntitySpline,       /**< Spline */
151         EntitySplinePoints,       /**< SplinePoints */
152         EntityOverlayBox,    /**< OverlayBox */
153         EntityPreview,    /**< Preview Container */
154         EntityPattern,
155         EntityOverlayLine
156     };
157 
158 
159     /**
160      * Action types used by action factories.
161      */
162     enum ActionType {
163         ActionNone,        /**< Invalid action id. */
164 
165         ActionDefault,
166 
167         ActionFileNew,
168         ActionFileNewTemplate,
169         ActionFileOpen,
170         ActionFileSave,
171         ActionFileSaveAs,
172         ActionFileExport,
173         ActionFileClose,
174         ActionFilePrint,
175         ActionFilePrintPDF,
176         ActionFilePrintPreview,
177         ActionFileExportMakerCam,
178         ActionFileQuit,
179 
180         ActionEditKillAllActions,
181         ActionEditUndo,
182         ActionEditRedo,
183         ActionEditCut,
184         ActionEditCutNoSelect,
185         ActionEditCopy,
186         ActionEditCopyNoSelect,
187         ActionEditPaste,
188         ActionOrderNoSelect,
189         ActionOrderBottom,
190         ActionOrderLower,
191         ActionOrderRaise,
192         ActionOrderTop,
193 
194         ActionViewStatusBar,
195         ActionViewLayerList,
196         ActionViewBlockList,
197         ActionViewCommandLine,
198         ActionViewLibrary,
199 
200         ActionViewPenToolbar,
201         ActionViewOptionToolbar,
202         ActionViewCadToolbar,
203         ActionViewFileToolbar,
204         ActionViewEditToolbar,
205         ActionViewSnapToolbar,
206 
207         ActionViewGrid,
208         ActionViewDraft,
209 
210         ActionZoomIn,
211         ActionZoomOut,
212         ActionZoomAuto,
213         ActionZoomWindow,
214         ActionZoomPan,
215         ActionZoomRedraw,
216         ActionZoomPrevious,
217 
218         ActionSelect,
219         ActionSelectSingle,
220         ActionSelectContour,
221         ActionSelectWindow,
222         ActionDeselectWindow,
223         ActionSelectAll,
224         ActionDeselectAll,
225         ActionSelectIntersected,
226         ActionDeselectIntersected,
227         ActionSelectInvert,
228         ActionSelectLayer,
229         ActionSelectDouble,
230         ActionGetSelect,
231 
232         ActionDrawArc,
233         ActionDrawArc3P,
234         ActionDrawArcParallel,
235         ActionDrawArcTangential,
236         ActionDrawCircle,
237         ActionDrawCircle2P,
238         ActionDrawCircle2PR,
239         ActionDrawCircle3P,
240         ActionDrawCircleCR,
241         ActionDrawCircleParallel,
242         ActionDrawCircleInscribe,
243         ActionDrawCircleTan2_1P,
244         ActionDrawCircleTan1_2P,
245         ActionDrawCircleTan2,
246         ActionDrawCircleTan3,
247 
248         ActionDrawEllipseArcAxis,
249         ActionDrawEllipseAxis,
250         ActionDrawEllipseFociPoint,
251         ActionDrawEllipse4Points,
252         ActionDrawEllipseCenter3Points,
253         ActionDrawEllipseInscribe,
254 
255         ActionDrawHatch,
256         ActionDrawHatchNoSelect,
257         ActionDrawImage,
258         ActionDrawLine,
259         ActionDrawLineAngle,
260         ActionDrawLineBisector,
261         ActionDrawLineFree,
262         ActionDrawLineHorVert,
263         ActionDrawLineHorizontal,
264         ActionDrawLineOrthogonal,
265         ActionDrawLineOrthTan,
266         ActionDrawLineParallel,
267         ActionDrawLineParallelThrough,
268         ActionDrawLinePolygonCenCor,
269         ActionDrawLinePolygonCenTan,//add by txmy
270         ActionDrawLinePolygonCorCor,
271         ActionDrawLineRectangle,
272         ActionDrawLineRelAngle,
273         ActionDrawLineTangent1,
274         ActionDrawLineTangent2,
275         ActionDrawLineVertical,
276         ActionDrawMText,
277         ActionDrawPoint,
278         ActionDrawSpline,
279         ActionDrawSplinePoints, //interpolation spline
280         ActionDrawPolyline,
281         ActionDrawText,
282 
283         ActionPolylineAdd,
284         ActionPolylineAppend,
285         ActionPolylineDel,
286         ActionPolylineDelBetween,
287         ActionPolylineTrim,
288         ActionPolylineEquidistant,
289         ActionPolylineSegment,
290 
291         ActionDimAligned,
292         ActionDimLinear,
293         ActionDimLinearVer,
294         ActionDimLinearHor,
295         ActionDimRadial,
296         ActionDimDiametric,
297         ActionDimAngular,
298         ActionDimLeader,
299 
300         ActionModifyAttributes,
301         ActionModifyAttributesNoSelect,
302         ActionModifyDelete,
303         ActionModifyDeleteNoSelect,
304         ActionModifyDeleteQuick,
305         ActionModifyDeleteFree,
306         ActionModifyMove,
307         ActionModifyMoveNoSelect,
308         ActionModifyRotate,
309         ActionModifyRotateNoSelect,
310         ActionModifyScale,
311         ActionModifyScaleNoSelect,
312         ActionModifyMirror,
313         ActionModifyMirrorNoSelect,
314         ActionModifyMoveRotate,
315         ActionModifyMoveRotateNoSelect,
316 		ActionModifyRevertDirection,
317 		ActionModifyRevertDirectionNoSelect,
318         ActionModifyRotate2,
319         ActionModifyRotate2NoSelect,
320         ActionModifyEntity,
321         ActionModifyTrim,
322         ActionModifyTrim2,
323         ActionModifyTrimAmount,
324         ActionModifyCut,
325         ActionModifyStretch,
326         ActionModifyBevel,
327         ActionModifyRound,
328         ActionModifyOffset,
329         ActionModifyOffsetNoSelect,
330 
331         ActionSnapFree,
332         ActionSnapGrid,
333         ActionSnapEndpoint,
334         ActionSnapOnEntity,
335         ActionSnapCenter,
336         ActionSnapMiddle,
337         ActionSnapDist,
338         ActionSnapIntersection,
339         ActionSnapIntersectionManual,
340 
341         ActionRestrictNothing,
342         ActionRestrictOrthogonal,
343         ActionRestrictHorizontal,
344         ActionRestrictVertical,
345 
346         ActionSetRelativeZero,
347         ActionLockRelativeZero,
348         ActionUnlockRelativeZero,
349 
350         ActionInfoInside,
351         ActionInfoDist,
352         ActionInfoDist2,
353         ActionInfoAngle,
354         ActionInfoTotalLength,
355         ActionInfoTotalLengthNoSelect,
356         ActionInfoArea,
357 
358         ActionLayersDefreezeAll,
359         ActionLayersFreezeAll,
360         ActionLayersUnlockAll,
361         ActionLayersLockAll,
362         ActionLayersAdd,
363         ActionLayersRemove,
364         ActionLayersEdit,
365         ActionLayersToggleView,
366         ActionLayersToggleLock,
367         ActionLayersTogglePrint,
368         ActionLayersToggleConstruction,
369 
370         ActionBlocksDefreezeAll,
371         ActionBlocksFreezeAll,
372         ActionBlocksAdd,
373         ActionBlocksRemove,
374         ActionBlocksAttributes,
375         ActionBlocksEdit,
376         ActionBlocksSave,
377         ActionBlocksInsert,
378         ActionBlocksToggleView,
379         ActionBlocksCreate,
380         ActionBlocksCreateNoSelect,
381         ActionBlocksExplode,
382         ActionBlocksExplodeNoSelect,
383         ActionBlocksImport,
384 
385         ActionModifyExplodeText,
386         ActionModifyExplodeTextNoSelect,
387 
388         ActionLibraryInsert,
389 
390         ActionOptionsGeneral,
391         ActionOptionsDrawing,
392 
393         ActionToolRegenerateDimensions,
394 
395         ActionScriptOpenIDE,
396         ActionScriptRun,
397 
398         /** Needed to loop through all actions */
399         ActionLast
400     };
401 
402     /**
403     * Entity ending. Used for returning which end of an entity is meant.
404      */
405     enum Ending {
406         EndingStart,    /**< Start point. */
407         EndingEnd,      /**< End point. */
408         EndingNone      /**< Neither. */
409     };
410 
411     /**
412      * Update mode for non-atomic entities that need to be updated when
413      * they change. e.g. texts, inserts, ...
414      */
415     enum UpdateMode {
416         NoUpdate,       /**< No automatic updates. */
417         Update,         /**< Always update automatically when modified. */
418                 PreviewUpdate   /**< Update automatically but only for previews (quick update) */
419     };
420 
421     /**
422      * Drawing mode.
423      */
424     enum DrawingMode {
425         ModeFull,       /**< Draw everything always detailed (default) */
426         ModeAuto,       /**< Draw details when reasonable */
427         ModePreview,    /**< Draw only in black/white without styles */
428         ModeBW,         /**< Black/white. Can be used for printing. */
429         ModeWB,         /**< White/black, used for export */
430     };
431 
432     /**
433      * Undoable rtti.
434      */
435     enum UndoableType {
436         UndoableUnknown,    /**< Unknown undoable */
437         UndoableEntity,     /**< Entity */
438         UndoableLayer       /**< Layer */
439     };
440 
441     /**
442      * Units.
443      */
444     enum Unit {
445         None = 0,               /**< No unit (unit from parent) */
446         Inch = 1,               /**< Inch */
447         Foot = 2,               /**< Foot: 12 Inches */
448         Mile = 3,               /**< Mile: 1760 Yards = 1609 m */
449         Millimeter = 4,         /**< Millimeter: 0.001m */
450         Centimeter = 5,         /**< Centimeter: 0.01m */
451         Meter = 6,              /**< Meter */
452         Kilometer = 7,          /**< Kilometer: 1000m */
453         Microinch = 8,          /**< Microinch: 0.000001 */
454         Mil = 9,                /**< Mil = 0.001 Inch*/
455         Yard = 10,              /**< Yard: 3 Feet */
456         Angstrom = 11,          /**< Angstrom: 10^-10m  */
457         Nanometer = 12,         /**< Nanometer: 10^-9m  */
458         Micron = 13,            /**< Micron: 10^-6m  */
459         Decimeter = 14,         /**< Decimeter: 0.1m */
460         Decameter = 15,         /**< Decameter: 10m */
461         Hectometer = 16,        /**< Hectometer: 100m */
462         Gigameter = 17,         /**< Gigameter: 1000000m */
463         Astro = 18,             /**< Astro: 149.6 x 10^9m */
464         Lightyear = 19,         /**< Lightyear: 9460731798 x 10^6m */
465         Parsec = 20,            /**< Parsec: 30857 x 10^12 */
466 
467         LastUnit = 21           /**< Used to iterate through units */
468     };
469 
470 
471     /**
472      * Format for length values.
473      */
474     enum LinearFormat {
475         /** Scientific (e.g. 2.5E+05) */
476         Scientific,
477         /** Decimal (e.g. 9.5)*/
478         Decimal,
479         /** Engineering (e.g. 7' 11.5")*/
480         Engineering,
481         /** Architectural (e.g. 7'-9 1/8")*/
482         Architectural,
483         /** Fractional (e.g. 7 9 1/8) */
484         Fractional,
485         /** Metric Architectural using DIN 406 (e.g. 1.12⁵)*/
486         ArchitecturalMetric
487     };
488 
489     /**
490      * Angle Units.
491      */
492     enum AngleUnit {
493         Deg,               /**< Degrees */
494         Rad,               /**< Radians */
495         Gra                /**< Gradians */
496     };
497 
498     /**
499      * Display formats for angles.
500      */
501     enum AngleFormat {
502         /** Degrees with decimal point (e.g. 24.5�) */
503         DegreesDecimal,
504         /** Degrees, Minutes and Seconds (e.g. 24�30'5'') */
505         DegreesMinutesSeconds,
506         /** Gradians with decimal point (e.g. 390.5)*/
507         Gradians,
508         /** Radians with decimal point (e.g. 1.57)*/
509         Radians,
510         /** Surveyor's units */
511         Surveyors
512     };
513 
514     /**
515      * Enum of levels of resolving when iterating through an entity tree.
516      */
517     enum ResolveLevel {
518         /** Groups are not resolved */
519         ResolveNone,
520         /**
521         * Resolve all but not Inserts.
522         */
523         ResolveAllButInserts,
524         /**
525          * Resolve all but not Text or MText.
526          */
527         ResolveAllButTexts,
528         /**
529          * Resolve no text or images, added as a quick fix for bug#422
530          */
531         ResolveAllButTextImage,
532         /**
533          * all Entity Containers are resolved
534          * (including Texts, Polylines, ...)
535          */
536         ResolveAll
537     };
538 
539     /**
540      * Direction used for scrolling actions.
541      */
542     enum Direction {
543         Up, Left, Right, Down
544     };
545 
546 	enum SubWindowMode {
547 		CurrentMode = -1, Maximized, Cascade, Tile, TileVertical, TileHorizontal
548 	};
549 
550 	enum TabShape {
551 		AnyShape = -1, Rounded, Triangular
552 	};
553 
554 	enum TabPosition {
555 		AnyPosition = -1, North, South, West, East
556 	};
557 
558     /**
559      * Vertical alignments.
560      */
561 //    enum VAlign {
562 //        VAlignTop,      /**< Top. */
563 //        VAlignMiddle,   /**< Middle */
564 //        VAlignBottom    /**< Bottom */
565 //    };
566 
567     /**
568      * Horizontal alignments.
569      */
570 //    enum HAlign {
571 //        HAlignLeft,     /**< Left */
572 //        HAlignCenter,   /**< Centered */
573 //        HAlignRight     /**< Right */
574 //    };
575 
576     /**
577      * Text drawing direction.
578      */
579 //    enum TextDrawingDirection {
580 //        LeftToRight,     /**< Left to right */
581 //        TopToBottom,     /**< Top to bottom */
582 //        ByStyle          /**< Inherited from associated text style */
583 //    };
584 
585     /**
586      * Line spacing style for texts.
587      */
588 //    enum TextLineSpacingStyle {
589 //        AtLeast,        /**< Taller characters will override */
590 //        Exact           /**< Taller characters will not override */
591 //    };
592 
593     /**
594      * Leader path type.
595      */
596     enum LeaderPathType {
597         Straight,      /**< Straight line segments */
598         Spline         /**< Splines */
599     };
600 
601     /**
602      * Direction for zooming actions.
603      */
604     enum ZoomDirection {
605         In, Out
606     };
607 
608     /**
609      * Axis specification for zooming actions.
610      */
611     enum Axis {
612         OnlyX, OnlyY, Both
613     };
614 
615     /**
616      * Crosshair type
617      */
618     enum CrosshairType {
619         LeftCrosshair,         /**< Left type isometric Crosshair */
620         TopCrosshair,         /**< Top type isometric Crosshair */
621         RightCrosshair,         /**< Right type isometric Crosshair */
622         OrthogonalCrosshair         /**< Orthogonal Crosshair */
623     };
624 
625     /**
626      * Snapping modes
627      */
628     enum SnapMode {
629         SnapFree,         /**< Free positioning */
630         SnapGrid,         /**< Snap to grid points */
631         SnapEndpoint,     /**< Snap to endpoints */
632         SnapMiddle,       /**< Snap to middle points */
633         SnapCenter,       /**< Snap to centers */
634         SnapOnEntity,     /**< Snap to the next point on an entity */
635         SnapDist,         /**< Snap to points with a distance to an endpoint */
636         SnapIntersection, /**< Snap to intersection */
637         SnapIntersectionManual  /**< Snap to intersection manually */
638     };
639 
640     /**
641      * Snap restrictions
642      */
643     enum SnapRestriction {
644         RestrictNothing,        /**< No restriction to snap mode */
645         RestrictHorizontal,     /**< Restrict to 0,180 degrees */
646         RestrictVertical,       /**< Restrict to 90,270 degrees */
647         RestrictOrthogonal      /**< Restrict to 90,180,270,0 degrees */
648     };
649 
650     /**
651      * Enum of line styles:
652      */
653     enum LineType {
654         LineByBlock = -2,      /**< Line type defined by block not entity */
655         LineByLayer = -1,     /**< Line type defined by layer not entity */
656         NoPen = 0,            /**< No line at all. */
657         SolidLine = 1,        /**< Normal line. */
658 
659         DotLine = 2,          /**< Dotted line. */
660         DotLineTiny = 3,          /**< Dotted line tiny */
661         DotLine2 = 4,         /**< Dotted line small. */
662         DotLineX2 = 5,        /**< Dotted line large. */
663 
664         DashLine = 6,         /**< Dashed line. */
665         DashLineTiny=7,       /**< Dashed line tiny */
666         DashLine2 = 8,        /**< Dashed line small. */
667         DashLineX2 = 9,       /**< Dashed line large. */
668 
669         DashDotLine = 10,      /**< Alternate dots and dashes. */
670         DashDotLineTiny = 11,      /**< Alternate dots and dashes tiny. */
671         DashDotLine2 = 12,     /**< Alternate dots and dashes small. */
672         DashDotLineX2 = 13,   /**< Alternate dots and dashes large. */
673 
674         DivideLine = 14,      /**< dash, dot, dot. */
675         DivideLineTiny = 15,      /**< dash, dot, dot, tiny */
676         DivideLine2 = 16,     /**< dash, dot, dot small. */
677         DivideLineX2 = 17,    /**< dash, dot, dot large. */
678 
679         CenterLine = 18,      /**< dash, small dash. */
680         CenterLineTiny = 19,      /**< dash, small dash tiny */
681         CenterLine2 = 20,     /**< dash, small dash small. */
682         CenterLineX2 = 21,    /**< dash, small dash large. */
683 
684         BorderLine = 22,      /**< dash, dash, dot. */
685         BorderLineTiny = 23,      /**< dash, dash, dot tiny */
686         BorderLine2 = 24,     /**< dash, dash, dot small. */
687         BorderLineX2 = 25,    /**< dash, dash, dot large. */
688 
689         LineTypeUnchanged=26      /**< Line type defined by block not entity */
690     };
691 
692     /**
693      * Enum of line widths:
694      */
695     enum LineWidth {
696         Width00 = 0,       /**< Width 1.  (0.00mm) */
697         Width01 = 5,       /**< Width 2.  (0.05mm) */
698         Width02 = 9,       /**< Width 3.  (0.09mm) */
699         Width03 = 13,      /**< Width 4.  (0.13mm) */
700         Width04 = 15,      /**< Width 5.  (0.15mm) */
701         Width05 = 18,      /**< Width 6.  (0.18mm) */
702         Width06 = 20,      /**< Width 7.  (0.20mm) */
703         Width07 = 25,      /**< Width 8.  (0.25mm) */
704         Width08 = 30,      /**< Width 9.  (0.30mm) */
705         Width09 = 35,      /**< Width 10. (0.35mm) */
706         Width10 = 40,      /**< Width 11. (0.40mm) */
707         Width11 = 50,      /**< Width 12. (0.50mm) */
708         Width12 = 53,      /**< Width 13. (0.53mm) */
709         Width13 = 60,      /**< Width 14. (0.60mm) */
710         Width14 = 70,      /**< Width 15. (0.70mm) */
711         Width15 = 80,      /**< Width 16. (0.80mm) */
712         Width16 = 90,      /**< Width 17. (0.90mm) */
713         Width17 = 100,     /**< Width 18. (1.00mm) */
714         Width18 = 106,     /**< Width 19. (1.06mm) */
715         Width19 = 120,     /**< Width 20. (1.20mm) */
716         Width20 = 140,     /**< Width 21. (1.40mm) */
717         Width21 = 158,     /**< Width 22. (1.58mm) */
718         Width22 = 200,     /**< Width 23. (2.00mm) */
719         Width23 = 211,     /**< Width 24. (2.11mm) */
720         WidthByLayer = -1, /**< Line width defined by layer not entity. */
721         WidthByBlock = -2, /**< Line width defined by block not entity. */
722         WidthDefault = -3  /**< Line width defaults to the predefined line width. */
723     };
724 
725     /**
726      * Wrapper for Qt
727      */
728     /*
729        static int qw(RS2::LineWidth w) {
730            switch (w) {
731            case Width00:
732                return 1;  // 0 is more accurate but quite slow
733                break;
734            case WidthByLayer:
735            case WidthByBlock:
736            case WidthDefault:
737                return 1;
738                break;
739            case Width01:
740            case Width02:
741            case Width03:
742            case Width04:
743            case Width05:
744            case Width06:
745            case Width07:
746            case Width08:
747                return 1;
748                break;
749            case Width09:
750            case Width10:
751                return 3;
752                break;
753            case Width11:
754                return 4;
755                break;
756            case Width12:
757            case Width13:
758                return 5;
759                break;
760            case Width14:
761                return 6;
762                break;
763            case Width15:
764                return 7;
765                break;
766            case Width16:
767                return 8;
768                break;
769            case Width17:
770                return 9;
771                break;
772            case Width18:
773            case Width19:
774                return 10;
775                break;
776            case Width20:
777                return 12;
778                break;
779            case Width21:
780            case Width22:
781            case Width23:
782            //case Width24:
783                return 14;
784                break;
785            default:
786                return (int)w;
787                break;
788            }
789            return (int)w;
790        }
791     */
792 
793     /**
794      * Wrapper for Qt
795      */
796 	static LineWidth intToLineWidth(int w);
797 
798     /**
799      * Enum of cursor types.
800      */
801     enum CursorType {
802         ArrowCursor,          /**< ArrowCursor - standard arrow cursor. */
803         UpArrowCursor,        /**< UpArrowCursor - upwards arrow. */
804         CrossCursor,          /**< CrossCursor - crosshair. */
805         WaitCursor,           /**< WaitCursor - hourglass/watch. */
806         IbeamCursor,          /**< IbeamCursor - ibeam/text entry. */
807         SizeVerCursor,        /**< SizeVerCursor - vertical resize. */
808         SizeHorCursor,        /**< SizeHorCursor - horizontal resize. */
809         SizeBDiagCursor,      /**< SizeBDiagCursor - diagonal resize (/). */
810         SizeFDiagCursor,      /**< SizeFDiagCursor - diagonal resize (\). */
811         SizeAllCursor,        /**< SizeAllCursor - all directions resize. */
812         BlankCursor,          /**< BlankCursor - blank/invisible cursor. */
813         SplitVCursor,         /**< SplitVCursor - vertical splitting. */
814         SplitHCursor,         /**< SplitHCursor - horizontal splitting. */
815         PointingHandCursor,   /**< PointingHandCursor - a pointing hand. */
816         ForbiddenCursor,      /**< ForbiddenCursor - a slashed circle. */
817         WhatsThisCursor,      /**< WhatsThisCursor - an arrow with a ?. */
818         OpenHandCursor,       /**< Qt OpenHandCursor */
819         ClosedHandCursor,     /**< Qt ClosedHandCursor */
820         CadCursor,            /**< CadCursor - a bigger cross. */
821         DelCursor,            /**< DelCursor - cursor for choosing entities */
822         SelectCursor,         /**< SelectCursor - for selecting single entities */
823         MagnifierCursor,      /**< MagnifierCursor - a magnifying glass. */
824         MovingHandCursor      /**< Moving hand - a little flat hand. */
825     };
826 
827     /**
828      * Wrapper for Qt.
829      */
830 	/*
831     static Qt::CursorShape rsToQtCursorType(RS2::CursorType t) {
832         switch (t) {
833         case ArrowCursor:
834             return Qt::ArrowCursor;
835         case UpArrowCursor:
836             return Qt::UpArrowCursor;
837         case CrossCursor:
838             return Qt::CrossCursor;
839         case WaitCursor:
840             return Qt::WaitCursor;
841         case IbeamCursor:
842             return Qt::IBeamCursor;
843         case SizeVerCursor:
844             return Qt::SizeVerCursor;
845         case SizeHorCursor:
846             return Qt::SizeHorCursor;
847         case SizeBDiagCursor:
848             return Qt::SizeBDiagCursor;
849         case SizeFDiagCursor:
850             return Qt::SizeFDiagCursor;
851         case SizeAllCursor:
852             return Qt::SizeAllCursor;
853         case BlankCursor:
854             return Qt::BlankCursor;
855         case SplitVCursor:
856             return Qt::SplitVCursor;
857         case SplitHCursor:
858             return Qt::SplitHCursor;
859         case PointingHandCursor:
860             return Qt::PointingHandCursor;
861         case OpenHandCursor:
862             return Qt::OpenHandCursor;
863         case ClosedHandCursor:
864             return Qt::ClosedHandCursor;
865         case ForbiddenCursor:
866             return Qt::ForbiddenCursor;
867         case WhatsThisCursor:
868             return Qt::WhatsThisCursor;
869         default:
870             return Qt::ArrowCursor;
871         }
872     }
873 */
874     /**
875      * Paper formats.
876      */
877     enum PaperFormat {
878         FirstPaperFormat,
879         Custom = FirstPaperFormat,
880 
881         /* ISO "A" Series */
882         A0,   /* 841 x 1189 mm	33.1 x 46.8 in */
883         A1,   /* 594 x 841 mm	23.4 x 33.1 in */
884         A2,   /* 420 x 594 mm	16.5 x 23.4 in */
885         A3,   /* 297 x 420 mm	11.7 x 16.5 in */
886         A4,   /* 210 x 297 mm	8.3 x 11.7 in  */
887 
888         /* Removed ISO "B" and "C" series, C5E, Comm10E, DLE, (envelope sizes) */
889 
890         /* US "Office" */
891         Letter,   /* 216 x 279 mm   8.5 x 11.0 in */
892         Legal,    /* 216 x 356 mm   8.5 x 14.0 in */
893         Tabloid,  /* 279 x 432 mm   11.0 x 17.0 in */
894         /* Tabloid = Ledger = ANSI B.  Although, technically, both ANSI B and
895            Ledger are defined in the qt library as 431.8 mm x 279.4 mm / 17
896            x 11", while Tabloid is 279 x 432 mm / 11.0 x 17.0 in .  Using either
897            "Ledger" or "AnsiB" will result in the wrong page orientation when
898            printing or exporting to PDF.) */
899 
900         /* ANSI */
901         //Ansi_A,   /* 216 x 279 mm	8.5 x 11.0 in */
902         //Ansi_B,   /* 279 x 432 mm	11.0 x 17.0 in */
903         Ansi_C,   /* 432 x 559 mm	17.0 x 22.0 in */
904         Ansi_D,   /* 559 x 864 mm	22.0 x 34.0 in */
905         Ansi_E,   /* 864 x 1118 mm	34.0 x 44.0 in */
906 
907         /* Architectural */
908         Arch_A,    /* 229 x 305 mm	9.0 x 12.0 in */
909         Arch_B,    /* 305 x 457 mm	12.0 x 18.0 in */
910         Arch_C,    /* 457 x 610 mm	18.0 x 24.0 in */
911         Arch_D,    /* 610 x 914 mm	24.0 x 36.0 in */
912         Arch_E,    /* 914 x 1219 mm	36.0 x 48.0 in */
913 
914         NPageFormat
915     };
916 
917         /**
918          * Items that can be put on a overlay, the items are rendered in this order. Best is to leave snapper as last so
919          * it always shows up
920          */
921         enum OverlayGraphics {
922                 ActionPreviewEntity, // Action Entities
923                 Snapper // Snapper
924         };
925 
926         //Different re-draw methods to speed up rendering of the screen
927         enum RedrawMethod {
928                 RedrawNone = 0,
929                 RedrawGrid = 1,
930                 RedrawOverlay = 2,
931                 RedrawDrawing = 4,
932                 RedrawAll = 0xffff
933         };
934 
935         /**
936          * Text drawing direction.
937          */
938         enum TextLocaleDirection {
939             locLeftToRight,     /** Left to right **/
940             locRightToLeft      /** Right to Left **/
941         };
942 
943 };
944 
945 #endif
946