Changed "static const int" class members into enums

Not only is the enum syntax more compact, it avoids inadvertent link
failures resulting from how C++ treats "static const int" members:

http://stackoverflow.com/questions/5391973/undefined-reference-to-static-const-int
http://stackoverflow.com/questions/5508182/static-const-int-causes-linking-error-undefined-reference

(And for what it's worth, MSVC6 gave silly errors for these members
wherever a non-zero value was assigned.)
This commit is contained in:
Daniel Richard G 2013-09-09 15:50:32 -04:00
parent a2a78b923f
commit 5cca524c62
7 changed files with 353 additions and 293 deletions

8
dsc.h
View File

@ -381,9 +381,11 @@ public:
class BandedMatrix {
public:
static const int MAX_UNKNOWNS = 16;
static const int RIGHT_OF_DIAG = 1;
static const int LEFT_OF_DIAG = 2;
enum {
MAX_UNKNOWNS = 16,
RIGHT_OF_DIAG = 1,
LEFT_OF_DIAG = 2
};
double A[MAX_UNKNOWNS][MAX_UNKNOWNS];
double B[MAX_UNKNOWNS];

60
expr.h
View File

@ -14,39 +14,41 @@ class Expr {
public:
DWORD marker;
// A parameter, by the hParam handle
static const int PARAM = 0;
// A parameter, by a pointer straight in to the param table (faster,
// if we know that the param table won't move around)
static const int PARAM_PTR = 1;
enum {
// A parameter, by the hParam handle
PARAM = 0,
// A parameter, by a pointer straight in to the param table (faster,
// if we know that the param table won't move around)
PARAM_PTR = 1,
// These are used only for user-entered expressions.
static const int POINT = 10;
static const int ENTITY = 11;
// These are used only for user-entered expressions.
POINT = 10,
ENTITY = 11,
static const int CONSTANT = 20;
CONSTANT = 20,
static const int PLUS = 100;
static const int MINUS = 101;
static const int TIMES = 102;
static const int DIV = 103;
static const int NEGATE = 104;
static const int SQRT = 105;
static const int SQUARE = 106;
static const int SIN = 107;
static const int COS = 108;
static const int ASIN = 109;
static const int ACOS = 110;
PLUS = 100,
MINUS = 101,
TIMES = 102,
DIV = 103,
NEGATE = 104,
SQRT = 105,
SQUARE = 106,
SIN = 107,
COS = 108,
ASIN = 109,
ACOS = 110,
// Special helpers for when we're parsing an expression from text.
// Initially, literals (like a constant number) appear in the same
// format as they will in the finished expression, but the operators
// are different until the parser fixes things up (and builds the
// tree from the flat list that the lexer outputs).
static const int ALL_RESOLVED = 1000;
static const int PAREN = 1001;
static const int BINARY_OP = 1002;
static const int UNARY_OP = 1003;
// Special helpers for when we're parsing an expression from text.
// Initially, literals (like a constant number) appear in the same
// format as they will in the finished expression, but the operators
// are different until the parser fixes things up (and builds the
// tree from the flat list that the lexer outputs).
ALL_RESOLVED = 1000,
PAREN = 1001,
BINARY_OP = 1002,
UNARY_OP = 1003
};
int op;
Expr *a;

View File

@ -74,9 +74,11 @@ class SPoint {
public:
int tag;
static const int UNKNOWN = 0;
static const int NOT_EAR = 1;
static const int EAR = 2;
enum {
UNKNOWN = 0,
NOT_EAR = 1,
EAR = 2
};
int ear;
Vector p;
@ -174,7 +176,7 @@ public:
SBsp2 *more;
static const int POS = 100, NEG = 101, COPLANAR = 200;
enum { POS = 100, NEG = 101, COPLANAR = 200 };
void InsertTriangleHow(int how, STriangle *tr, SMesh *m, SBsp3 *bsp3);
void InsertTriangle(STriangle *tr, SMesh *m, SBsp3 *bsp3);
Vector IntersectionWith(Vector a, Vector b);
@ -202,7 +204,7 @@ public:
Vector IntersectionWith(Vector a, Vector b);
static const int POS = 100, NEG = 101, COPLANAR = 200;
enum { POS = 100, NEG = 101, COPLANAR = 200 };
void InsertHow(int how, STriangle *str, SMesh *instead);
SBsp3 *Insert(STriangle *str, SMesh *instead);
@ -283,10 +285,12 @@ public:
void FindEdgeOn(Vector a, Vector b, int *n, int cnt, bool coplanarIsInter,
bool *inter, bool *fwd,
DWORD *face);
static const int NAKED_OR_SELF_INTER_EDGES = 100;
static const int SELF_INTER_EDGES = 200;
static const int TURNING_EDGES = 300;
static const int EMPHASIZED_EDGES = 400;
enum {
NAKED_OR_SELF_INTER_EDGES = 100,
SELF_INTER_EDGES = 200,
TURNING_EDGES = 300,
EMPHASIZED_EDGES = 400
};
void MakeCertainEdgesInto(SEdgeList *sel, int how, bool coplanarIsInter,
bool *inter, bool *leaky);

260
sketch.h
View File

@ -90,13 +90,15 @@ public:
int tag;
hGroup h;
static const int DRAWING_3D = 5000;
static const int DRAWING_WORKPLANE = 5001;
static const int EXTRUDE = 5100;
static const int LATHE = 5101;
static const int ROTATE = 5200;
static const int TRANSLATE = 5201;
static const int IMPORTED = 5300;
enum {
DRAWING_3D = 5000,
DRAWING_WORKPLANE = 5001,
EXTRUDE = 5100,
LATHE = 5101,
ROTATE = 5200,
TRANSLATE = 5201,
IMPORTED = 5300
};
int type;
int order;
@ -122,12 +124,14 @@ public:
List<hConstraint> remove;
} solved;
// For drawings in 2d
static const int WORKPLANE_BY_POINT_ORTHO = 6000;
static const int WORKPLANE_BY_LINE_SEGMENTS = 6001;
// For extrudes, translates, and rotates
static const int ONE_SIDED = 7000;
static const int TWO_SIDED = 7001;
enum {
// For drawings in 2d
WORKPLANE_BY_POINT_ORTHO = 6000,
WORKPLANE_BY_LINE_SEGMENTS = 6001,
// For extrudes, translates, and rotates
ONE_SIDED = 7000,
TWO_SIDED = 7001
};
int subtype;
bool skipFirst; // for step and repeat ops
@ -145,11 +149,13 @@ public:
SPolygon polyLoops;
SBezierLoopSetSet bezierLoops;
SBezierList bezierOpens;
static const int POLY_GOOD = 0;
static const int POLY_NOT_CLOSED = 1;
static const int POLY_NOT_COPLANAR = 2;
static const int POLY_SELF_INTERSECTING = 3;
static const int POLY_ZERO_LEN_EDGE = 4;
enum {
POLY_GOOD = 0,
POLY_NOT_CLOSED = 1,
POLY_NOT_COPLANAR = 2,
POLY_SELF_INTERSECTING = 3,
POLY_ZERO_LEN_EDGE = 4
};
struct {
int how;
SEdge notClosedAt;
@ -168,15 +174,17 @@ public:
SMesh displayMesh;
SEdgeList displayEdges;
static const int COMBINE_AS_UNION = 0;
static const int COMBINE_AS_DIFFERENCE = 1;
static const int COMBINE_AS_ASSEMBLE = 2;
enum {
COMBINE_AS_UNION = 0,
COMBINE_AS_DIFFERENCE = 1,
COMBINE_AS_ASSEMBLE = 2
};
int meshCombine;
bool forceToMesh;
IdList<EntityMap,EntityId> remap;
static const int REMAP_PRIME = 19477;
enum { REMAP_PRIME = 19477 };
int remapCache[REMAP_PRIME];
char impFile[MAX_PATH];
@ -199,11 +207,13 @@ public:
// entities may have come from multiple requests, it's necessary to
// remap the entity ID so that it's still unique. We do this with a
// mapping list.
static const int REMAP_LAST = 1000;
static const int REMAP_TOP = 1001;
static const int REMAP_BOTTOM = 1002;
static const int REMAP_PT_TO_LINE = 1003;
static const int REMAP_LINE_TO_FACE = 1004;
enum {
REMAP_LAST = 1000,
REMAP_TOP = 1001,
REMAP_BOTTOM = 1002,
REMAP_PT_TO_LINE = 1003,
REMAP_LINE_TO_FACE = 1004
};
hEntity Remap(hEntity in, int copyNumber);
void MakeExtrusionLines(EntityList *el, hEntity in);
void MakeExtrusionTopBottomFaces(EntityList *el, hEntity pt);
@ -253,14 +263,16 @@ public:
hRequest h;
// Types of requests
static const int WORKPLANE = 100;
static const int DATUM_POINT = 101;
static const int LINE_SEGMENT = 200;
static const int CUBIC = 300;
static const int CUBIC_PERIODIC = 301;
static const int CIRCLE = 400;
static const int ARC_OF_CIRCLE = 500;
static const int TTF_TEXT = 600;
enum {
WORKPLANE = 100,
DATUM_POINT = 101,
LINE_SEGMENT = 200,
CUBIC = 300,
CUBIC_PERIODIC = 301,
CIRCLE = 400,
ARC_OF_CIRCLE = 500,
TTF_TEXT = 600
};
int type;
int extraPoints;
@ -288,36 +300,38 @@ public:
static const hEntity FREE_IN_3D;
static const hEntity NO_ENTITY;
static const int POINT_IN_3D = 2000;
static const int POINT_IN_2D = 2001;
static const int POINT_N_TRANS = 2010;
static const int POINT_N_ROT_TRANS = 2011;
static const int POINT_N_COPY = 2012;
static const int POINT_N_ROT_AA = 2013;
enum {
POINT_IN_3D = 2000,
POINT_IN_2D = 2001,
POINT_N_TRANS = 2010,
POINT_N_ROT_TRANS = 2011,
POINT_N_COPY = 2012,
POINT_N_ROT_AA = 2013,
static const int NORMAL_IN_3D = 3000;
static const int NORMAL_IN_2D = 3001;
static const int NORMAL_N_COPY = 3010;
static const int NORMAL_N_ROT = 3011;
static const int NORMAL_N_ROT_AA = 3012;
NORMAL_IN_3D = 3000,
NORMAL_IN_2D = 3001,
NORMAL_N_COPY = 3010,
NORMAL_N_ROT = 3011,
NORMAL_N_ROT_AA = 3012,
static const int DISTANCE = 4000;
static const int DISTANCE_N_COPY = 4001;
DISTANCE = 4000,
DISTANCE_N_COPY = 4001,
static const int FACE_NORMAL_PT = 5000;
static const int FACE_XPROD = 5001;
static const int FACE_N_ROT_TRANS = 5002;
static const int FACE_N_TRANS = 5003;
static const int FACE_N_ROT_AA = 5004;
FACE_NORMAL_PT = 5000,
FACE_XPROD = 5001,
FACE_N_ROT_TRANS = 5002,
FACE_N_TRANS = 5003,
FACE_N_ROT_AA = 5004,
static const int WORKPLANE = 10000;
static const int LINE_SEGMENT = 11000;
static const int CUBIC = 12000;
static const int CUBIC_PERIODIC = 12001;
static const int CIRCLE = 13000;
static const int ARC_OF_CIRCLE = 14000;
static const int TTF_TEXT = 15000;
WORKPLANE = 10000,
LINE_SEGMENT = 11000,
CUBIC = 12000,
CUBIC_PERIODIC = 12001,
CIRCLE = 13000,
ARC_OF_CIRCLE = 14000,
TTF_TEXT = 15000
};
int type;
@ -517,41 +531,43 @@ public:
static const hConstraint NO_CONSTRAINT;
static const int POINTS_COINCIDENT = 20;
static const int PT_PT_DISTANCE = 30;
static const int PT_PLANE_DISTANCE = 31;
static const int PT_LINE_DISTANCE = 32;
static const int PT_FACE_DISTANCE = 33;
static const int PROJ_PT_DISTANCE = 34;
static const int PT_IN_PLANE = 41;
static const int PT_ON_LINE = 42;
static const int PT_ON_FACE = 43;
static const int EQUAL_LENGTH_LINES = 50;
static const int LENGTH_RATIO = 51;
static const int EQ_LEN_PT_LINE_D = 52;
static const int EQ_PT_LN_DISTANCES = 53;
static const int EQUAL_ANGLE = 54;
static const int EQUAL_LINE_ARC_LEN = 55;
static const int SYMMETRIC = 60;
static const int SYMMETRIC_HORIZ = 61;
static const int SYMMETRIC_VERT = 62;
static const int SYMMETRIC_LINE = 63;
static const int AT_MIDPOINT = 70;
static const int HORIZONTAL = 80;
static const int VERTICAL = 81;
static const int DIAMETER = 90;
static const int PT_ON_CIRCLE = 100;
static const int SAME_ORIENTATION = 110;
static const int ANGLE = 120;
static const int PARALLEL = 121;
static const int PERPENDICULAR = 122;
static const int ARC_LINE_TANGENT = 123;
static const int CUBIC_LINE_TANGENT = 124;
static const int CURVE_CURVE_TANGENT = 125;
static const int EQUAL_RADIUS = 130;
static const int WHERE_DRAGGED = 200;
enum {
POINTS_COINCIDENT = 20,
PT_PT_DISTANCE = 30,
PT_PLANE_DISTANCE = 31,
PT_LINE_DISTANCE = 32,
PT_FACE_DISTANCE = 33,
PROJ_PT_DISTANCE = 34,
PT_IN_PLANE = 41,
PT_ON_LINE = 42,
PT_ON_FACE = 43,
EQUAL_LENGTH_LINES = 50,
LENGTH_RATIO = 51,
EQ_LEN_PT_LINE_D = 52,
EQ_PT_LN_DISTANCES = 53,
EQUAL_ANGLE = 54,
EQUAL_LINE_ARC_LEN = 55,
SYMMETRIC = 60,
SYMMETRIC_HORIZ = 61,
SYMMETRIC_VERT = 62,
SYMMETRIC_LINE = 63,
AT_MIDPOINT = 70,
HORIZONTAL = 80,
VERTICAL = 81,
DIAMETER = 90,
PT_ON_CIRCLE = 100,
SAME_ORIENTATION = 110,
ANGLE = 120,
PARALLEL = 121,
PERPENDICULAR = 122,
ARC_LINE_TANGENT = 123,
CUBIC_LINE_TANGENT = 124,
CURVE_CURVE_TANGENT = 125,
EQUAL_RADIUS = 130,
WHERE_DRAGGED = 200,
static const int COMMENT = 1000;
COMMENT = 1000
};
int type;
@ -659,40 +675,46 @@ class Style {
public:
int tag;
hStyle h;
// If an entity has no style, then it will be colored according to
// whether the group that it's in is active or not, whether it's
// construction or not, and so on.
static const int NO_STYLE = 0;
static const int ACTIVE_GRP = 1;
static const int CONSTRUCTION = 2;
static const int INACTIVE_GRP = 3;
static const int DATUM = 4;
static const int SOLID_EDGE = 5;
static const int CONSTRAINT = 6;
static const int SELECTED = 7;
static const int HOVERED = 8;
static const int CONTOUR_FILL = 9;
static const int NORMALS = 10;
static const int ANALYZE = 11;
static const int DRAW_ERROR = 12;
static const int DIM_SOLID = 13;
enum {
// If an entity has no style, then it will be colored according to
// whether the group that it's in is active or not, whether it's
// construction or not, and so on.
NO_STYLE = 0,
static const int FIRST_CUSTOM = 0x100;
ACTIVE_GRP = 1,
CONSTRUCTION = 2,
INACTIVE_GRP = 3,
DATUM = 4,
SOLID_EDGE = 5,
CONSTRAINT = 6,
SELECTED = 7,
HOVERED = 8,
CONTOUR_FILL = 9,
NORMALS = 10,
ANALYZE = 11,
DRAW_ERROR = 12,
DIM_SOLID = 13,
FIRST_CUSTOM = 0x100
};
NameStr name;
static const int UNITS_AS_PIXELS = 0;
static const int UNITS_AS_MM = 1;
enum {
UNITS_AS_PIXELS = 0,
UNITS_AS_MM = 1
};
double width;
int widthAs;
double textHeight;
int textHeightAs;
static const int ORIGIN_LEFT = 0x01;
static const int ORIGIN_RIGHT = 0x02;
static const int ORIGIN_BOT = 0x04;
static const int ORIGIN_TOP = 0x08;
enum {
ORIGIN_LEFT = 0x01,
ORIGIN_RIGHT = 0x02,
ORIGIN_BOT = 0x04,
ORIGIN_TOP = 0x08
};
int textOrigin;
double textAngle;
DWORD color;

View File

@ -251,7 +251,7 @@ void Error(const char *str, ...);
class System {
public:
static const int MAX_UNKNOWNS = 1024;
enum { MAX_UNKNOWNS = 1024 };
EntityList entity;
ParamList param;
@ -261,12 +261,14 @@ public:
// we should put as close as possible to their initial positions.
List<hParam> dragged;
// In general, the tag indicates the subsys that a variable/equation
// has been assigned to; these are exceptions for variables:
static const int VAR_SUBSTITUTED = 10000;
static const int VAR_DOF_TEST = 10001;
// and for equations:
static const int EQ_SUBSTITUTED = 20000;
enum {
// In general, the tag indicates the subsys that a variable/equation
// has been assigned to; these are exceptions for variables:
VAR_SUBSTITUTED = 10000,
VAR_DOF_TEST = 10001,
// and for equations:
EQ_SUBSTITUTED = 20000
};
// The system Jacobian matrix
struct {
@ -314,10 +316,12 @@ public:
bool NewtonSolve(int tag);
static const int SOLVED_OKAY = 0;
static const int DIDNT_CONVERGE = 10;
static const int SINGULAR_JACOBIAN = 11;
static const int TOO_MANY_UNKNOWNS = 20;
enum {
SOLVED_OKAY = 0,
DIDNT_CONVERGE = 10,
SINGULAR_JACOBIAN = 11,
TOO_MANY_UNKNOWNS = 20
};
int Solve(Group *g, int *dof, List<hConstraint> *bad,
bool andFindBad, bool andFindFree);
};
@ -360,9 +364,11 @@ public:
// The filehandle, while loading
FILE *fh;
// Some state while rendering a character to curves
static const int NOTHING = 0;
static const int ON_CURVE = 1;
static const int OFF_CURVE = 2;
enum {
NOTHING = 0,
ON_CURVE = 1,
OFF_CURVE = 2
};
int lastWas;
IntPoint lastOnCurve;
IntPoint lastOffCurve;
@ -585,7 +591,7 @@ public:
IdList<Style,hStyle> style;
hGroup activeGroup;
} UndoState;
static const int MAX_UNDO = 16;
enum { MAX_UNDO = 16 };
typedef struct {
UndoState d[MAX_UNDO];
int cnt;
@ -603,7 +609,7 @@ public:
void UndoClearStack(UndoStack *uk);
// Little bits of extra configuration state
static const int MODEL_COLORS = 8;
enum { MODEL_COLORS = 8 };
int modelColor[MODEL_COLORS];
Vector lightDir[2];
double lightIntensity[2];

View File

@ -28,11 +28,13 @@ public:
SBspUv *more;
static const int INSIDE = 100;
static const int OUTSIDE = 200;
static const int EDGE_PARALLEL = 300;
static const int EDGE_ANTIPARALLEL = 400;
static const int EDGE_OTHER = 500;
enum {
INSIDE = 100,
OUTSIDE = 200,
EDGE_PARALLEL = 300,
EDGE_ANTIPARALLEL = 400,
EDGE_OTHER = 500
};
static SBspUv *Alloc(void);
static SBspUv *From(SEdgeList *el, SSurface *srf);
@ -184,9 +186,11 @@ public:
// therefore must get new hSCurves assigned. For the curves in A and B,
// we use newH to record their new handle in C.
hSCurve newH;
static const int FROM_A = 100;
static const int FROM_B = 200;
static const int FROM_INTERSECTION = 300;
enum {
FROM_A = 100,
FROM_B = 200,
FROM_INTERSECTION = 300
};
int source;
bool isExact;
@ -328,8 +332,10 @@ public:
void TriangulateInto(SShell *shell, SMesh *sm);
// these are intended as bitmasks, even though there's just one now
static const int AS_UV = 0x01;
static const int AS_XYZ = 0x00;
enum {
AS_UV = 0x01,
AS_XYZ = 0x00
};
void MakeTrimEdgesInto(SEdgeList *sel, int flags, SCurve *sc, STrimBy *stb);
void MakeEdgesInto(SShell *shell, SEdgeList *sel, int flags,
SShell *useCurvesFrom=NULL);
@ -361,9 +367,11 @@ public:
void MakeFromUnionOf(SShell *a, SShell *b);
void MakeFromDifferenceOf(SShell *a, SShell *b);
static const int AS_UNION = 10;
static const int AS_DIFFERENCE = 11;
static const int AS_INTERSECT = 12;
enum {
AS_UNION = 10,
AS_DIFFERENCE = 11,
AS_INTERSECT = 12
};
void MakeFromBoolean(SShell *a, SShell *b, int type);
void CopyCurvesSplitAgainst(bool opA, SShell *agnst, SShell *into);
void CopySurfacesTrimAgainst(SShell *sha, SShell *shb, SShell *into,
@ -380,10 +388,12 @@ public:
// Definitions when classifying regions of a surface; it is either inside,
// outside, or coincident (with parallel or antiparallel normal) with a
// shell.
static const int INSIDE = 100;
static const int OUTSIDE = 200;
static const int COINC_SAME = 300;
static const int COINC_OPP = 400;
enum {
INSIDE = 100,
OUTSIDE = 200,
COINC_SAME = 300,
COINC_OPP = 400
};
static const double DOTP_TOL;
int ClassifyRegion(Vector edge_n, Vector inter_surf_n, Vector edge_surf_n);
bool ClassifyEdge(int *indir, int *outdir,

214
ui.h
View File

@ -10,9 +10,11 @@
class TextWindow {
public:
static const int MAX_COLS = 100;
static const int MIN_COLS = 45;
static const int MAX_ROWS = 2000;
enum {
MAX_COLS = 100,
MIN_COLS = 45,
MAX_ROWS = 2000
};
#ifndef RGB
#define RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16))
@ -34,22 +36,24 @@ public:
float bgColorTable[256*3];
float fgColorTable[256*3];
static const int CHAR_WIDTH = 9;
static const int CHAR_HEIGHT = 16;
static const int LINE_HEIGHT = 20;
static const int LEFT_MARGIN = 6;
enum {
CHAR_WIDTH = 9,
CHAR_HEIGHT = 16,
LINE_HEIGHT = 20,
LEFT_MARGIN = 6,
static const int CHECK_FALSE = 0x80;
static const int CHECK_TRUE = 0x81;
static const int RADIO_FALSE = 0x82;
static const int RADIO_TRUE = 0x83;
CHECK_FALSE = 0x80,
CHECK_TRUE = 0x81,
RADIO_FALSE = 0x82,
RADIO_TRUE = 0x83
};
int scrollPos; // The scrollbar position, in half-row units
int halfRows; // The height of our window, in half-row units
BYTE text[MAX_ROWS][MAX_COLS];
typedef void LinkFunction(int link, DWORD v);
static const int NOT_A_LINK = 0;
enum { NOT_A_LINK = 0 };
struct {
char fg;
int bg;
@ -80,9 +84,11 @@ public:
void MouseLeave(void);
void ScrollbarEvent(int newPos);
static const int PAINT = 0;
static const int HOVER = 1;
static const int CLICK = 2;
enum {
PAINT = 0,
HOVER = 1,
CLICK = 2
};
void DrawOrHitTestIcons(int how, double mx, double my);
void TimerCallback(void);
Point2d oldMousePos;
@ -102,16 +108,18 @@ public:
void Show(void);
// State for the screen that we are showing in the text window.
static const int SCREEN_LIST_OF_GROUPS = 0;
static const int SCREEN_GROUP_INFO = 1;
static const int SCREEN_GROUP_SOLVE_INFO = 2;
static const int SCREEN_CONFIGURATION = 3;
static const int SCREEN_STEP_DIMENSION = 4;
static const int SCREEN_LIST_OF_STYLES = 5;
static const int SCREEN_STYLE_INFO = 6;
static const int SCREEN_PASTE_TRANSFORMED = 7;
static const int SCREEN_EDIT_VIEW = 8;
static const int SCREEN_TANGENT_ARC = 9;
enum {
SCREEN_LIST_OF_GROUPS = 0,
SCREEN_GROUP_INFO = 1,
SCREEN_GROUP_SOLVE_INFO = 2,
SCREEN_CONFIGURATION = 3,
SCREEN_STEP_DIMENSION = 4,
SCREEN_LIST_OF_STYLES = 5,
SCREEN_STYLE_INFO = 6,
SCREEN_PASTE_TRANSFORMED = 7,
SCREEN_EDIT_VIEW = 8,
SCREEN_TANGENT_ARC = 9
};
typedef struct {
int screen;
@ -133,53 +141,55 @@ public:
} ShownState;
ShownState shown;
static const int EDIT_NOTHING = 0;
// For multiple groups
static const int EDIT_TIMES_REPEATED = 1;
static const int EDIT_GROUP_NAME = 2;
static const int EDIT_GROUP_SCALE = 3;
static const int EDIT_GROUP_COLOR = 4;
// For the configuraiton screen
static const int EDIT_LIGHT_DIRECTION = 100;
static const int EDIT_LIGHT_INTENSITY = 101;
static const int EDIT_COLOR = 102;
static const int EDIT_CHORD_TOLERANCE = 103;
static const int EDIT_MAX_SEGMENTS = 104;
static const int EDIT_CAMERA_TANGENT = 105;
static const int EDIT_GRID_SPACING = 106;
static const int EDIT_DIGITS_AFTER_DECIMAL = 107;
static const int EDIT_EXPORT_SCALE = 108;
static const int EDIT_EXPORT_OFFSET = 109;
static const int EDIT_CANVAS_SIZE = 110;
static const int EDIT_G_CODE_DEPTH = 120;
static const int EDIT_G_CODE_PASSES = 121;
static const int EDIT_G_CODE_FEED = 122;
static const int EDIT_G_CODE_PLUNGE_FEED = 123;
// For TTF text
static const int EDIT_TTF_TEXT = 300;
// For the step dimension screen
static const int EDIT_STEP_DIM_FINISH = 400;
static const int EDIT_STEP_DIM_STEPS = 401;
// For the styles stuff
static const int EDIT_STYLE_WIDTH = 500;
static const int EDIT_STYLE_TEXT_HEIGHT = 501;
static const int EDIT_STYLE_TEXT_ANGLE = 502;
static const int EDIT_STYLE_COLOR = 503;
static const int EDIT_STYLE_FILL_COLOR = 504;
static const int EDIT_STYLE_NAME = 505;
static const int EDIT_BACKGROUND_COLOR = 506;
static const int EDIT_BACKGROUND_IMG_SCALE = 507;
// For paste transforming
static const int EDIT_PASTE_TIMES_REPEATED = 600;
static const int EDIT_PASTE_ANGLE = 601;
static const int EDIT_PASTE_SCALE = 602;
// For view
static const int EDIT_VIEW_SCALE = 700;
static const int EDIT_VIEW_ORIGIN = 701;
static const int EDIT_VIEW_PROJ_RIGHT = 702;
static const int EDIT_VIEW_PROJ_UP = 703;
// For tangent arc
static const int EDIT_TANGENT_ARC_RADIUS = 800;
enum {
EDIT_NOTHING = 0,
// For multiple groups
EDIT_TIMES_REPEATED = 1,
EDIT_GROUP_NAME = 2,
EDIT_GROUP_SCALE = 3,
EDIT_GROUP_COLOR = 4,
// For the configuraiton screen
EDIT_LIGHT_DIRECTION = 100,
EDIT_LIGHT_INTENSITY = 101,
EDIT_COLOR = 102,
EDIT_CHORD_TOLERANCE = 103,
EDIT_MAX_SEGMENTS = 104,
EDIT_CAMERA_TANGENT = 105,
EDIT_GRID_SPACING = 106,
EDIT_DIGITS_AFTER_DECIMAL = 107,
EDIT_EXPORT_SCALE = 108,
EDIT_EXPORT_OFFSET = 109,
EDIT_CANVAS_SIZE = 110,
EDIT_G_CODE_DEPTH = 120,
EDIT_G_CODE_PASSES = 121,
EDIT_G_CODE_FEED = 122,
EDIT_G_CODE_PLUNGE_FEED = 123,
// For TTF text
EDIT_TTF_TEXT = 300,
// For the step dimension screen
EDIT_STEP_DIM_FINISH = 400,
EDIT_STEP_DIM_STEPS = 401,
// For the styles stuff
EDIT_STYLE_WIDTH = 500,
EDIT_STYLE_TEXT_HEIGHT = 501,
EDIT_STYLE_TEXT_ANGLE = 502,
EDIT_STYLE_COLOR = 503,
EDIT_STYLE_FILL_COLOR = 504,
EDIT_STYLE_NAME = 505,
EDIT_BACKGROUND_COLOR = 506,
EDIT_BACKGROUND_IMG_SCALE = 507,
// For paste transforming
EDIT_PASTE_TIMES_REPEATED = 600,
EDIT_PASTE_ANGLE = 601,
EDIT_PASTE_SCALE = 602,
// For view
EDIT_VIEW_SCALE = 700,
EDIT_VIEW_ORIGIN = 701,
EDIT_VIEW_PROJ_RIGHT = 702,
EDIT_VIEW_PROJ_UP = 703,
// For tangent arc
EDIT_TANGENT_ARC_RADIUS = 800
};
struct {
bool showAgain;
int meaning;
@ -487,17 +497,19 @@ public:
// Operations that must be completed by doing something with the mouse
// are noted here. These occupy the same space as the menu ids.
static const int FIRST_PENDING = 0x0f000000;
static const int DRAGGING_POINTS = 0x0f000000;
static const int DRAGGING_NEW_POINT = 0x0f000001;
static const int DRAGGING_NEW_LINE_POINT = 0x0f000002;
static const int DRAGGING_NEW_CUBIC_POINT = 0x0f000003;
static const int DRAGGING_NEW_ARC_POINT = 0x0f000004;
static const int DRAGGING_CONSTRAINT = 0x0f000005;
static const int DRAGGING_RADIUS = 0x0f000006;
static const int DRAGGING_NORMAL = 0x0f000007;
static const int DRAGGING_NEW_RADIUS = 0x0f000008;
static const int DRAGGING_MARQUEE = 0x0f000009;
enum {
FIRST_PENDING = 0x0f000000,
DRAGGING_POINTS = 0x0f000000,
DRAGGING_NEW_POINT = 0x0f000001,
DRAGGING_NEW_LINE_POINT = 0x0f000002,
DRAGGING_NEW_CUBIC_POINT = 0x0f000003,
DRAGGING_NEW_ARC_POINT = 0x0f000004,
DRAGGING_CONSTRAINT = 0x0f000005,
DRAGGING_RADIUS = 0x0f000006,
DRAGGING_NORMAL = 0x0f000007,
DRAGGING_NEW_RADIUS = 0x0f000008,
DRAGGING_MARQUEE = 0x0f000009
};
struct {
int operation;
@ -568,7 +580,7 @@ public:
void HitTestMakeSelection(Point2d mp);
void ClearSelection(void);
void ClearNonexistentSelectionItems(void);
static const int MAX_SELECTED = 32;
enum { MAX_SELECTED = 32 };
struct {
hEntity point[MAX_SELECTED];
hEntity entity[MAX_SELECTED];
@ -603,22 +615,24 @@ public:
void SelectByMarquee(void);
void ClearSuper(void);
static const int CMNU_UNSELECT_ALL = 0x100;
static const int CMNU_UNSELECT_HOVERED = 0x101;
static const int CMNU_CUT_SEL = 0x102;
static const int CMNU_COPY_SEL = 0x103;
static const int CMNU_PASTE_SEL = 0x104;
static const int CMNU_DELETE_SEL = 0x105;
static const int CMNU_SELECT_CHAIN = 0x106;
static const int CMNU_NEW_CUSTOM_STYLE = 0x110;
static const int CMNU_NO_STYLE = 0x111;
static const int CMNU_GROUP_INFO = 0x120;
static const int CMNU_STYLE_INFO = 0x121;
static const int CMNU_REFERENCE_DIM = 0x130;
static const int CMNU_OTHER_ANGLE = 0x131;
static const int CMNU_DEL_COINCIDENT = 0x132;
static const int CMNU_SNAP_TO_GRID = 0x140;
static const int CMNU_FIRST_STYLE = 0x40000000;
enum {
CMNU_UNSELECT_ALL = 0x100,
CMNU_UNSELECT_HOVERED = 0x101,
CMNU_CUT_SEL = 0x102,
CMNU_COPY_SEL = 0x103,
CMNU_PASTE_SEL = 0x104,
CMNU_DELETE_SEL = 0x105,
CMNU_SELECT_CHAIN = 0x106,
CMNU_NEW_CUSTOM_STYLE = 0x110,
CMNU_NO_STYLE = 0x111,
CMNU_GROUP_INFO = 0x120,
CMNU_STYLE_INFO = 0x121,
CMNU_REFERENCE_DIM = 0x130,
CMNU_OTHER_ANGLE = 0x131,
CMNU_DEL_COINCIDENT = 0x132,
CMNU_SNAP_TO_GRID = 0x140,
CMNU_FIRST_STYLE = 0x40000000
};
void ContextMenuListStyles(void);
SDWORD contextMenuCancelTime;