13 // Windoze XP can't handle the original MAX/MINDOUBLE's
14 #define RS_MAXDOUBLE 1.0E+10
15 #define RS_MINDOUBLE -1.0E+10
18 * Class namespace for various enums along with some simple wrapper methods for
19 * converting the enums to the Qt counterparts.
21 * @author James Hammons
22 * @author Andrew Mustun
32 /** Flag for Undoables. */
34 /** Entity Visibility. */
36 /** Entity attribute (e.g. color) is defined by layer. */
38 /** Entity attribute (e.g. color) defined by block. */
42 /** Layer frozen by default. */
43 FlagDefFrozen = 1 << 5,
46 /** Used for invalid pens. */
48 /** Entity in current selection. */
49 FlagSelected = 1 << 8,
50 /** Polyline closed? */
52 /** Flag for temporary entities (e.g. hatch) */
54 /** Flag for processed entities (optcontour) */
55 FlagProcessed = 1 << 11,
56 /** Startpoint selected */
57 FlagSelected1 = 1 << 12,
58 /** Endpoint selected */
59 FlagSelected2 = 1 << 13,
60 /** Entity is highlighted temporarily (as a user action feedback) */
61 FlagHighlighted = 1 << 14
65 * Variable types used by RS_VariableDict and RS_Variable.
76 * File types. Used by file dialogs. Note: the extension might not
77 * be enough to distinguish file types.
80 FormatUnknown, /**< Unknown / unsupported format. */
81 FormatDXF1, /**< QCad 1 compatibility DXF format. */
82 FormatDXF, /**< DXF format. 2000. */
83 FormatDXF12, /**< DXF format. R12. */
84 FormatCXF, /**< CAM Expert Font format. */
85 FormatCAM /**< CAM Expert CAM format (NC, CNC, D, ..) */
89 * Entity types returned by the rtti() method
92 EntityUnknown, /**< Unknown */
93 EntityContainer, /**< Container */
94 EntityBlock, /**< Block (Group definition) */
95 EntityFontChar, /**< Font character */
96 EntityInsert, /**< Insert (Group instance) */
97 EntityGraphic, /**< Graphic with layers */
98 EntityPoint, /**< Point */
99 EntityLine, /**< Line */
100 EntityPolyline, /**< Polyline */
101 EntityVertex, /**< Vertex (part of a polyline) */
102 EntityArc, /**< Arc */
103 EntityCircle, /**< Circle */
104 EntityEllipse, /**< Ellipse */
105 EntitySolid, /**< Ellipse */
106 EntityConstructionLine, /**< Construction line */
107 EntityText, /**< Text */
108 EntityDimAligned, /**< Aligned Dimension */
109 EntityDimLinear, /**< Linear Dimension */
110 EntityDimRadial, /**< Radial Dimension */
111 EntityDimDiametric, /**< Diametric Dimension */
112 EntityDimAngular, /**< Angular Dimension */
113 EntityDimLeader, /**< Leader Dimension */
114 EntityHatch, /**< Hatch */
115 EntityImage, /**< Image */
116 EntitySpline /**< Spline */
120 * Action types used by action factories.
123 ActionNone, /**< Invalid action id. */
134 ActionFilePrintPreview,
142 ActionEditCutNoSelect,
144 ActionEditCopyNoSelect,
150 ActionViewCommandLine,
151 ActionViewOptionToolbar,
166 ActionDeselectWindow,
169 ActionSelectIntersected,
170 ActionDeselectIntersected,
177 ActionDrawArcParallel,
178 ActionDrawArcTangential,
183 ActionDrawCircleParallel,
184 ActionDrawEllipseArcAxis,
185 ActionDrawEllipseAxis,
187 ActionDrawHatchNoSelect,
191 ActionDrawLineBisector,
193 ActionDrawLineHorVert,
194 ActionDrawLineHorizontal,
195 ActionDrawLineOrthogonal,
196 ActionDrawLineParallel,
197 ActionDrawLineParallelThrough,
198 ActionDrawLinePolygon,
199 ActionDrawLinePolygon2,
200 ActionDrawLineRectangle,
201 ActionDrawLineRelAngle,
202 ActionDrawLineTangent1,
203 ActionDrawLineTangent2,
204 ActionDrawLineVertical,
211 ActionPolylineAppend,
213 ActionPolylineDelBetween,
225 ActionModifyAttributes,
226 ActionModifyAttributesNoSelect,
228 ActionModifyDeleteNoSelect,
229 ActionModifyDeleteQuick,
230 ActionModifyDeleteFree,
232 ActionModifyMoveNoSelect,
234 ActionModifyRotateNoSelect,
236 ActionModifyScaleNoSelect,
238 ActionModifyMirrorNoSelect,
239 ActionModifyMoveRotate,
240 ActionModifyMoveRotateNoSelect,
242 ActionModifyRotate2NoSelect,
246 ActionModifyTrimAmount,
259 ActionSnapIntersection,
260 ActionSnapIntersectionManual,
262 ActionRestrictNothing,
263 ActionRestrictOrthogonal,
264 ActionRestrictHorizontal,
265 ActionRestrictVertical,
267 ActionSetRelativeZero,
268 ActionLockRelativeZero,
269 ActionUnlockRelativeZero,
275 ActionInfoTotalLength,
276 ActionInfoTotalLengthNoSelect,
279 ActionLayersDefreezeAll,
280 ActionLayersFreezeAll,
284 ActionLayersToggleView,
285 ActionLayersToggleLock,
287 ActionBlocksDefreezeAll,
288 ActionBlocksFreezeAll,
291 ActionBlocksAttributes,
294 ActionBlocksToggleView,
296 ActionBlocksCreateNoSelect,
298 ActionBlocksExplodeNoSelect,
300 ActionModifyExplodeText,
301 ActionModifyExplodeTextNoSelect,
305 ActionOptionsGeneral,
306 ActionOptionsDrawing,
308 ActionToolRegenerateDimensions,
313 #ifndef RS_NO_COMPLEX_ENTITIES
314 ActionPARISDebugCreateContainer,
322 /** Needed to loop through all actions */
327 * Entity ending. Used for returning which end of an entity is ment.
330 EndingStart, /**< Start point. */
331 EndingEnd, /**< End point. */
332 EndingNone /**< Neither. */
336 * Update mode for non-atomic entities that need to be updated when
337 * they change. e.g. texts, inserts, ...
340 NoUpdate, /**< No automatic updates. */
341 Update, /**< Always update automatically when modified. */
342 PreviewUpdate /**< Update automatically but only for previews (quick update) */
349 ModeFull, /**< Draw everything always detailed (default) */
350 ModeAuto, /**< Draw details when reasonable */
351 ModePreview, /**< Draw only in black/white without styles */
352 ModeXOR, /**< XOR mode for moving previews */
353 ModeBW /**< Black/white. Can be used for printing. */
360 UndoableUnknown, /**< Unknown undoable */
361 UndoableEntity, /**< Entity */
362 UndoableLayer /**< Layer */
369 ToolBarMain, /**< Main (menu). */
370 ToolBarPoints, /**< Points. */
371 ToolBarLines, /**< Lines. */
372 ToolBarArcs, /**< Arcs. */
373 ToolBarCircles, /**< Circles. */
374 ToolBarEllipses, /**< Ellipses. */
375 ToolBarSplines, /**< Splines. */
376 ToolBarPolylines, /**< Polylines. */
377 ToolBarText, /**< Text. */
378 ToolBarDim, /**< Dimensions. */
379 ToolBarSnap, /**< Snap. */
380 ToolBarModify, /**< Modify. */
381 ToolBarSelect, /**< Select. */
382 ToolBarInfo /**< Information */
389 None = 0, /**< No unit (unit from parent) */
390 Inch = 1, /**< Inch */
391 Foot = 2, /**< Foot: 12 Inches */
392 Mile = 3, /**< Mile: 1760 Yards = 1609 m */
393 Millimeter = 4, /**< Millimeter: 0.001m */
394 Centimeter = 5, /**< Centimeter: 0.01m */
395 Meter = 6, /**< Meter */
396 Kilometer = 7, /**< Kilometer: 1000m */
397 Microinch = 8, /**< Microinch: 0.000001 */
398 Mil = 9, /**< Mil = 0.001 Inch*/
399 Yard = 10, /**< Yard: 3 Feet */
400 Angstrom = 11, /**< Angstrom: 10^-10m */
401 Nanometer = 12, /**< Nanometer: 10^-9m */
402 Micron = 13, /**< Micron: 10^-6m */
403 Decimeter = 14, /**< Decimeter: 0.1m */
404 Decameter = 15, /**< Decameter: 10m */
405 Hectometer = 16, /**< Hectometer: 100m */
406 Gigameter = 17, /**< Gigameter: 1000000m */
407 Astro = 18, /**< Astro: 149.6 x 10^9m */
408 Lightyear = 19, /**< Lightyear: 9460731798 x 10^6m */
409 Parsec = 20, /**< Parsec: 30857 x 10^12 */
411 LastUnit = 21 /**< Used to iterate through units */
416 * Format for length values.
419 /** Scientific (e.g. 2.5E+05) */
421 /** Decimal (e.g. 9.5)*/
423 /** Engineering (e.g. 7' 11.5")*/
425 /** Architectural (e.g. 7'-9 1/8")*/
427 /** Fractional (e.g. 7 9 1/8) */
441 * Display formats for angles.
444 /** Degrees with decimal point (e.g. 24.5°) */
446 /** Degrees, Minutes and Seconds (e.g. 24°30'5") */
447 DegreesMinutesSeconds,
448 /** Gradians with decimal point (e.g. 390.5)*/
450 /** Radians with decimal point (e.g. 1.57)*/
452 /** Surveyor's units */
457 * Enum of levels of resolving when iterating through an entity tree.
460 /** Groups are not resolved */
463 * Resolve all but not Inserts.
465 ResolveAllButInserts,
467 * all Entity Containers are resolved
468 * (including Texts, Polylines, ...)
474 * Direction used for scrolling actions.
477 Up, Left, Right, Down
481 * Vertical alignments.
484 VAlignTop, /**< Top. */
485 VAlignMiddle, /**< Middle */
486 VAlignBottom /**< Bottom */
490 * Horizontal alignments.
493 HAlignLeft, /**< Left */
494 HAlignCenter, /**< Centered */
495 HAlignRight /**< Right */
499 * Text drawing direction.
501 enum TextDrawingDirection {
502 LeftToRight, /**< Left to right */
503 TopToBottom, /**< Top to bottom */
504 ByStyle /**< Inherited from associated text style */
508 * Line spacing style for texts.
510 enum TextLineSpacingStyle {
511 AtLeast, /**< Taller characters will override */
512 Exact /**< Taller characters will not override */
518 enum LeaderPathType {
519 Straight, /**< Straight line segments */
520 Spline /**< Splines */
524 * Direction for zooming actions.
531 * Axis specification for zooming actions.
541 SnapFree, /**< Free positioning */
542 SnapGrid, /**< Snap to grid points */
543 SnapEndpoint, /**< Snap to endpoints */
544 SnapMiddle, /**< Snap to middle points */
545 SnapCenter, /**< Snap to centers */
546 SnapOnEntity, /**< Snap to the next point on an entity */
547 SnapDist, /**< Snap to points with a distance to an endpoint */
548 SnapIntersection, /**< Snap to intersection */
549 SnapIntersectionManual /**< Snap to intersection manually */
555 enum SnapRestriction {
556 RestrictNothing, /**< No restriction to snap mode */
557 RestrictOrthogonal, /**< Restrict to 90,180,270,0 degrees */
558 RestrictHorizontal, /**< Restrict to 0,180 degrees */
559 RestrictVertical /**< Restrict to 90,270 degrees */
563 * Enum of line styles:
566 NoPen = 0, /**< No line at all. */
567 SolidLine = 1, /**< Normal line. */
569 DotLine = 2, /**< Dotted line. */
570 DotLine2 = 3, /**< Dotted line small. */
571 DotLineX2 = 4, /**< Dotted line large. */
573 DashLine = 5, /**< Dashed line. */
574 DashLine2 = 6, /**< Dashed line small. */
575 DashLineX2 = 7, /**< Dashed line large. */
577 DashDotLine = 8, /**< Alternate dots and dashes. */
578 DashDotLine2 = 9, /**< Alternate dots and dashes small. */
579 DashDotLineX2 = 10, /**< Alternate dots and dashes large. */
581 DivideLine = 11, /**< dash, dot, dot. */
582 DivideLine2 = 12, /**< dash, dot, dot small. */
583 DivideLineX2 = 13, /**< dash, dot, dot large. */
585 CenterLine = 14, /**< dash, small dash. */
586 CenterLine2 = 15, /**< dash, small dash small. */
587 CenterLineX2 = 16, /**< dash, small dash large. */
589 BorderLine = 17, /**< dash, dash, dot. */
590 BorderLine2 = 18, /**< dash, dash, dot small. */
591 BorderLineX2 = 19, /**< dash, dash, dot large. */
593 LineByLayer = -1, /**< Line type defined by layer not entity */
594 LineByBlock = -2 /**< Line type defined by block not entity */
600 static Qt::PenStyle rsToQtLineType(RS2::LineType t) {
606 return Qt::SolidLine;
621 return Qt::DashDotLine;
626 return Qt::DashDotDotLine;
631 return Qt::DashDotLine;
636 return Qt::DashDotLine;
641 return Qt::SolidLine;
644 return Qt::SolidLine;
650 static RS2::LineType qtToRsPenStyle(Qt::PenStyle s)
665 case Qt::DashDotLine:
668 case Qt::DashDotDotLine:
680 * \brief Struct that stores a line type pattern (e.g. dash dot dot).
682 struct LineTypePatternStruct
690 * Enum of line widths:
693 Width00 = 0, /**< Width 1. (0.00mm) */
694 Width01 = 5, /**< Width 2. (0.05mm) */
695 Width02 = 9, /**< Width 3. (0.09mm) */
696 Width03 = 13, /**< Width 4. (0.13mm) */
697 Width04 = 15, /**< Width 5. (0.15mm) */
698 Width05 = 18, /**< Width 6. (0.18mm) */
699 Width06 = 20, /**< Width 7. (0.20mm) */
700 Width07 = 25, /**< Width 8. (0.25mm) */
701 Width08 = 30, /**< Width 9. (0.30mm) */
702 Width09 = 35, /**< Width 10. (0.35mm) */
703 Width10 = 40, /**< Width 11. (0.40mm) */
704 Width11 = 50, /**< Width 12. (0.50mm) */
705 Width12 = 53, /**< Width 13. (0.53mm) */
706 Width13 = 60, /**< Width 14. (0.60mm) */
707 Width14 = 70, /**< Width 15. (0.70mm) */
708 Width15 = 80, /**< Width 16. (0.80mm) */
709 Width16 = 90, /**< Width 17. (0.90mm) */
710 Width17 = 100, /**< Width 18. (1.00mm) */
711 Width18 = 106, /**< Width 19. (1.06mm) */
712 Width19 = 120, /**< Width 20. (1.20mm) */
713 Width20 = 140, /**< Width 21. (1.40mm) */
714 Width21 = 158, /**< Width 22. (1.58mm) */
715 Width22 = 200, /**< Width 23. (2.00mm) */
716 Width23 = 211, /**< Width 24. (2.11mm) */
717 WidthByLayer = -1, /**< Line width defined by layer not entity. */
718 WidthByBlock = -2, /**< Line width defined by block not entity. */
719 WidthDefault = -3 /**< Line width defaults to the predefined line width. */
725 static LineWidth intToLineWidth(int w)
838 * Enum of cursor types.
841 ArrowCursor, /**< ArrowCursor - standard arrow cursor. */
842 UpArrowCursor, /**< UpArrowCursor - upwards arrow. */
843 CrossCursor, /**< CrossCursor - crosshair. */
844 WaitCursor, /**< WaitCursor - hourglass/watch. */
845 IbeamCursor, /**< IbeamCursor - ibeam/text entry. */
846 SizeVerCursor, /**< SizeVerCursor - vertical resize. */
847 SizeHorCursor, /**< SizeHorCursor - horizontal resize. */
848 SizeBDiagCursor, /**< SizeBDiagCursor - diagonal resize (/). */
849 SizeFDiagCursor, /**< SizeFDiagCursor - diagonal resize (\). */
850 SizeAllCursor, /**< SizeAllCursor - all directions resize. */
851 BlankCursor, /**< BlankCursor - blank/invisible cursor. */
852 SplitVCursor, /**< SplitVCursor - vertical splitting. */
853 SplitHCursor, /**< SplitHCursor - horziontal splitting. */
854 PointingHandCursor, /**< PointingHandCursor - a pointing hand. */
855 ForbiddenCursor, /**< ForbiddenCursor - a slashed circle. */
856 WhatsThisCursor, /**< WhatsThisCursor - an arrow with a ?. */
857 CadCursor, /**< CadCursor - a bigger cross. */
858 DelCursor, /**< DelCursor - cursor for choosing entities */
859 SelectCursor, /**< SelectCursor - for selecting single entities */
860 MagnifierCursor, /**< MagnifierCursor - a magnifying glass. */
861 MovingHandCursor /**< Moving hand - a little flat hand. */
867 static Qt::CursorShape rsToQtCursorType(RS2::CursorType t)
872 return Qt::ArrowCursor;
875 return Qt::UpArrowCursor;
878 return Qt::CrossCursor;
881 return Qt::WaitCursor;
884 return Qt::IBeamCursor;
887 return Qt::SizeVerCursor;
890 return Qt::SizeHorCursor;
892 case SizeBDiagCursor:
893 return Qt::SizeBDiagCursor;
895 case SizeFDiagCursor:
896 return Qt::SizeFDiagCursor;
899 return Qt::SizeAllCursor;
902 return Qt::BlankCursor;
905 return Qt::SplitVCursor;
908 return Qt::SplitHCursor;
910 case PointingHandCursor:
911 return Qt::PointingHandCursor;
913 case ForbiddenCursor:
914 return Qt::ForbiddenCursor;
916 case WhatsThisCursor:
917 return Qt::WhatsThisCursor;
920 return Qt::ArrowCursor;
924 return Qt::ArrowCursor;
968 static QPrinter::PageSize rsToQtPaperFormat(RS2::PaperFormat f)
970 QPrinter::PageSize ret;
975 ret = QPrinter::Custom;
978 ret = QPrinter::Letter;
981 ret = QPrinter::Legal;
984 ret = QPrinter::Executive;
1048 ret = QPrinter::B10;
1051 ret = QPrinter::C5E;
1054 ret = QPrinter::Comm10E;
1057 ret = QPrinter::DLE;
1060 ret = QPrinter::Folio;
1063 // ret = QPrinter::Ledger;
1066 ret = QPrinter::Tabloid;
1069 ret = QPrinter::NPageSize;