aboutsummaryrefslogtreecommitdiff
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/Types.h357
1 files changed, 357 insertions, 0 deletions
diff --git a/generic/Types.h b/generic/Types.h
new file mode 100644
index 0000000..a508402
--- /dev/null
+++ b/generic/Types.h
@@ -0,0 +1,357 @@
+/*
+ * Types.h -- Types used by the Radar widget.
+ *
+ * Authors : Patrick Lecoanet.
+ * Creation date : Mon Feb 1 12:13:24 1999
+ *
+ * $Id$
+ */
+
+/*
+ * Copyright (c) 1993 - 1999 CENA, Patrick Lecoanet --
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this code; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _Types_h
+#define _Types_h
+
+#include <tk.h>
+#include <X11/Xutil.h>
+#ifdef PTK
+#include <tkVMacro.h>
+#endif
+#include <stdio.h>
+
+
+#ifdef __CPLUSPLUS__
+extern "C" {
+#endif
+
+
+#ifndef PTK
+#define Arg char *
+#define LangFreeProc void
+#define LangString(p) (p)
+#define LangCopyArg(p) (p)
+#define LangStringArg(p) (p)
+#define LangSetString(a,b) (*(a)=(b))
+#define LangSetArg(a,b) (*(a)=(b))
+#define Lang_SplitList(a,b,c,d,e) (Tcl_SplitList(a,b,c,d))
+#endif
+
+
+typedef void *RadarItemClassId;
+typedef void *RadarItemId;
+
+typedef double RadarReal;
+typedef int RadarBool; /* Keep it an int to keep Tk happy */
+typedef RadarReal RadarPos;
+typedef RadarReal RadarDim;
+typedef XColor *RadarColor;
+typedef Tk_Font RadarFont;
+typedef Tk_Window RadarWindow;
+typedef void *RadarPtr;
+typedef Tk_Image RadarImage;
+typedef Arg *RadarAttrList;
+
+typedef struct {
+ RadarPos x, y;
+} RadarPoint;
+
+typedef struct {
+ RadarPos x, y, w, h;
+} RadarRect;
+/*
+ * RadarBBox: orig is into the area while corner is not.
+ * Thus the test: ((bbox.orig.x == bbox.corner.x) ||
+ * (bbox.orig.y == bbox.corner.y))
+ * tells whether the bbox is empty or not.
+ * When interpreting bboxes the X coordinate system is
+ * the norm. x goes from left toward the right and y
+ * goes from the top toward the bottom. Bboxes are
+ * always axes aligned.
+ */
+typedef struct {
+ RadarPoint orig, corner;
+} RadarBBox;
+
+/*
+ * Describe the clipping at a given node
+ * of the item hierarchy.
+ */
+typedef struct {
+ RadarBool simple; /* The clip is an aligned rectangle. */
+ Region region; /* The X region used to draw and to */
+ /* probe for picking. */
+ RadarBBox clip_box; /* The bounding box of the clip area. */
+} ClipState;
+
+/*
+ * Operator constants for the coord method.
+ */
+#define COORDS_READ 0
+#define COORDS_READ_ALL 1
+#define COORDS_REPLACE 2
+#define COORDS_REPLACE_ALL 3
+#define COORDS_ADD 4
+#define COORDS_ADD_LAST 5
+#define COORDS_REMOVE 6
+
+/*
+ * Types and constants for attribute processing.
+ */
+typedef struct {
+ int type;
+ char *name;
+ Tk_Uid uid;
+ int offset;
+ int bool_bit;
+ int flags;
+ RadarBool read_only;
+} RadarAttrConfig;
+
+/*
+ * When adding new type in the following enum
+ * do not forget to update attribute_type_strings
+ * in Item.c.
+ */
+#define RADAR_CONFIG_END 0
+#define RADAR_CONFIG_COLOR 1
+#define RADAR_CONFIG_BOOL 2
+#define RADAR_CONFIG_PATTERN 3
+#define RADAR_CONFIG_TEXT 4
+#define RADAR_CONFIG_FONT 5
+#define RADAR_CONFIG_BORDER 6
+#define RADAR_CONFIG_RELIEF 7
+#define RADAR_CONFIG_DIM 8
+#define RADAR_CONFIG_PRI 9
+#define RADAR_CONFIG_JUSTIFY 10
+#define RADAR_CONFIG_AUTO_JUSTIFY 11
+#define RADAR_CONFIG_LINE_END 12
+#define RADAR_CONFIG_LABEL_FORMAT 13
+#define RADAR_CONFIG_LINE_STYLE 14
+#define RADAR_CONFIG_LINE_SHAPE 15
+#define RADAR_CONFIG_ITEM 16
+#define RADAR_CONFIG_ANGLE 17
+#define RADAR_CONFIG_INT 18
+#define RADAR_CONFIG_UINT 19
+#define RADAR_CONFIG_POINT 20
+#define RADAR_CONFIG_RECT 21
+#define RADAR_CONFIG_PATTERNS 22
+#define RADAR_CONFIG_ANCHOR 23
+#define RADAR_CONFIG_TAGS 24
+#define RADAR_CONFIG_POINTS 25
+#define RADAR_CONFIG_MAP_INFO 26
+#define RADAR_CONFIG_IMAGE 27
+#define RADAR_CONFIG_LEADER_ANCHORS 28
+#define RADAR_CONFIG_JOIN_STYLE 29
+#define RADAR_CONFIG_CAP_STYLE 30
+
+#define RADAR_DRAW_FLAG 1 << 0
+#define RADAR_COORDS_FLAG 1 << 1
+#define RADAR_TRANSFO_FLAG 1 << 2
+#define RADAR_REPICK_FLAG 1 << 3
+#define RADAR_BORDER_FLAG 1 << 4
+#define RADAR_CLFC_FLAG 1 << 5 /* Clear Label Format Cache. */
+#define RADAR_IMAGE_FLAG 1 << 6 /* Update image pointer. */
+#define RADAR_VIS_FLAG 1 << 7 /* Visibility has changed. */
+#define RADAR_MOVED_FLAG 1 << 8 /* Item has moved. */
+#define RADAR_ITEM_FLAG 1 << 9 /* Signal a change in item type attribute. */
+#define RADAR_MAP_INFO_FLAG 1 << 10 /* Update mapinfo pointer. */
+#define RADAR_LAYOUT_FLAG 1 << 10 /* A layout need update. */
+#define RADAR_POLAR_FLAG 1 << 11 /* Signal a cartesian to polar change. */
+#define RADAR_CARTESIAN_FLAG 1 << 12 /* Signal a polar to cartesian change. */
+#define RADAR_TILE_FLAG 1 << 13 /* Update tile pointer. */
+
+/*
+ * Type and constant values for alignments.
+ */
+typedef char RadarJustify;
+#define RadarJustifyLeft TK_JUSTIFY_LEFT
+#define RadarJustifyRight TK_JUSTIFY_RIGHT
+#define RadarJustifyCenter TK_JUSTIFY_CENTER
+
+/*
+ * Type and constant values for anchors.
+ */
+typedef Tk_Anchor RadarAnchor;
+#define RadarAnchorN TK_ANCHOR_N
+#define RadarAnchorS TK_ANCHOR_S
+#define RadarAnchorE TK_ANCHOR_E
+#define RadarAnchorW TK_ANCHOR_W
+#define RadarAnchorNE TK_ANCHOR_NE
+#define RadarAnchorNW TK_ANCHOR_NW
+#define RadarAnchorSE TK_ANCHOR_SE
+#define RadarAnchorSW TK_ANCHOR_SW
+#define RadarAnchorCenter TK_ANCHOR_CENTER
+
+/*
+ * Type and constant values for borders.
+ */
+typedef unsigned char Border;
+#define NO_BORDER 0
+#define LEFT_BORDER 1
+#define RIGHT_BORDER 2
+#define TOP_BORDER 4
+#define BOTTOM_BORDER 8
+#define CONTOUR_BORDER (LEFT_BORDER|RIGHT_BORDER|TOP_BORDER|BOTTOM_BORDER)
+#define COUNTER_OBLIQUE 16
+#define OBLIQUE 32
+
+#define LEFT_SPEC "left"
+#define RIGHT_SPEC "right"
+#define TOP_SPEC "top"
+#define BOTTOM_SPEC "bottom"
+#define CONTOUR_SPEC "contour"
+#define COUNTER_OBLIQUE_SPEC "counteroblique"
+#define OBLIQUE_SPEC "oblique"
+#define NO_BORDER_SPEC "noborder"
+
+/*
+ * Type and constant values for line styles, line shapes and line ends.
+ */
+typedef unsigned char LineStyle;
+typedef unsigned char LineEndStyle;
+typedef unsigned char LineShape;
+
+/* LineStyle */
+#define LINE_SIMPLE 0
+#define LINE_DASHED 1
+#define LINE_MIXED 2
+#define LINE_DOTTED 3
+/* LineShape */
+#define LINE_STRAIGHT 0
+#define LINE_LEFT_LIGHTNING 1
+#define LINE_LEFT_CORNER 2
+#define LINE_DOUBLE_LEFT_CORNER 3
+#define LINE_RIGHT_LIGHTNING 4
+#define LINE_RIGHT_CORNER 5
+#define LINE_DOUBLE_RIGHT_CORNER 6
+
+#define SIMPLE_SPEC "simple"
+#define DASHED_SPEC "dashed"
+#define DOTTED_SPEC "dotted"
+#define MIXED_SPEC "mixed"
+
+#define STRAIGHT_SPEC "straight"
+#define RIGHT_LIGHTNING_SPEC "rightlightning"
+#define LEFT_LIGHTNING_SPEC "leftlightning"
+#define RIGHT_CORNER_SPEC "rightcorner"
+#define LEFT_CORNER_SPEC "leftcorner"
+#define DOUBLE_RIGHT_CORNER_SPEC "doublerightcorner"
+#define DOUBLE_LEFT_CORNER_SPEC "doubleleftcorner"
+
+/*
+ * Type and constant values for relief styles.
+ */
+typedef int ReliefStyle; /* Keep it an int to keep Tk happy */
+#define RELIEF_BEVEL_OUT TK_RELIEF_RAISED
+#define RELIEF_FLAT TK_RELIEF_FLAT
+#define RELIEF_BEVEL_IN TK_RELIEF_SUNKEN
+#define RELIEF_GROOVE TK_RELIEF_GROOVE
+#define RELIEF_RIDGE TK_RELIEF_RIDGE
+/*
+ * Number of steps for relief drawing. This translate in
+ * RELIEF_STEPS*2+1 color steps in the color gradient.
+ */
+#define RELIEF_STEPS 2
+
+/*
+ * Type and constant values for automatic alignments.
+ */
+typedef struct {
+ RadarBool automatic;
+ RadarJustify align[3];
+} AutoAlign;
+#define AA_LEFT 0
+#define AA_CENTER 1
+#define AA_RIGHT 2
+
+#define AA_LEFT_SPEC "l"
+#define AA_CENTER_SPEC "c"
+#define AA_RIGHT_SPEC "r"
+#define AA_AUTO_SPEC "-"
+
+/*
+ * Type for leader anchors.
+ */
+typedef struct {
+ int left_x; /* left leader anchor field or percent of bbox */
+ int right_x; /* right leader anchor field or percent of bbox */
+ short left_y; /* left leader percent of bbox or < 0 if field */
+ short right_y; /* right leader percent of bbox or < 0 if field */
+} LeaderAnchorsStruct, *LeaderAnchors;
+
+#define RadarPixel(color) ((color)->pixel)
+#define RadarFontId(font) (Tk_FontId(font))
+#define RadarWindowId(win) (Tk_WindowId(win))
+#define RadarTextWidth(font, text, len) (Tk_TextWidth(font, text, len))
+#define RadarMalloc(size) (ckalloc(size))
+#define RadarFree(ptr) (ckfree((char *)(ptr)))
+#define RadarRealloc(ptr, size) (ckrealloc((void *)(ptr), size))
+/*
+ * How to make ptk include the right stdio.h ?
+ */
+#ifndef PTK
+#define RadarWarning(msg) (fprintf(stderr, "%s\n", (msg)))
+#else
+#define RadarWarning(msg)
+#endif
+
+#define RadarUnspecifiedPattern None
+#define RadarUnspecifiedImage None
+#define RadarUnspecifiedColor NULL
+#define RADAR_OK TCL_OK
+#define RADAR_ERROR TCL_ERROR
+#define RADAR_NO_ITEM NULL
+
+/*
+ * Various constants used by items.
+ */
+#define RADAR_ANY_CIRCLES -1
+
+/*
+ * Constants for item parts. The fields or item indexable parts are coded
+ * as positive or null integers. The item specific parts (not indexable) are
+ * coded as negatives begining at -2 up to -9 which is the current limit. The
+ * -1 value is reserved to indicate no part.
+ */
+
+#define PART_NUMBER_TO_BIT(part) (1 << (ABS(part)-2))
+#define RADAR_NO_PART -1
+#define RADAR_CURRENT_POSITION -2
+#define RADAR_SPEED_VECTOR -3
+#define RADAR_LEADER -4
+#define RADAR_CONNECTION -5
+
+
+/*
+ * Some flags macros.
+ */
+#define ISSET(var, mask) ((var) & (mask))
+#define ISCLEAR(var, mask) (((var) & (mask)) == 0)
+#define SET(var,mask) ((var) |= (mask))
+#define CLEAR(var, mask) ((var) &= ~(mask))
+#define ASSIGN(var, mask, bool) ((bool) ? SET((var), (mask)) : CLEAR((var), (mask)))
+
+
+#ifdef __CPLUSPLUS__
+}
+#endif
+
+#endif /* _Types_h */