From 3ed3940af059b1e822a7871216e70fad9d4399b8 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 12 Jan 2000 13:58:32 +0000 Subject: Renommage des fichiers d'entetes --- generic/Attrs.h | 132 ++++++++++++++++++++++++ generic/Color.h | 56 +++++++++++ generic/Draw.h | 72 +++++++++++++ generic/Geo.h | 239 ++++++++++++++++++++++++++++++++++++++++++++ generic/Image.h | 59 +++++++++++ generic/Item.h | 277 +++++++++++++++++++++++++++++++++++++++++++++++++++ generic/MapInfo.h | 237 +++++++++++++++++++++++++++++++++++++++++++ generic/OverlapMan.h | 95 ++++++++++++++++++ generic/PostScript.h | 80 +++++++++++++++ generic/Track.h | 56 +++++++++++ generic/WidgetInfo.h | 161 ++++++++++++++++++++++++++++++ generic/tkZinc.h | 59 +++++++++++ 12 files changed, 1523 insertions(+) create mode 100644 generic/Attrs.h create mode 100644 generic/Color.h create mode 100644 generic/Draw.h create mode 100644 generic/Geo.h create mode 100644 generic/Image.h create mode 100644 generic/Item.h create mode 100644 generic/MapInfo.h create mode 100644 generic/OverlapMan.h create mode 100644 generic/PostScript.h create mode 100644 generic/Track.h create mode 100644 generic/WidgetInfo.h create mode 100644 generic/tkZinc.h diff --git a/generic/Attrs.h b/generic/Attrs.h new file mode 100644 index 0000000..1d9ba0e --- /dev/null +++ b/generic/Attrs.h @@ -0,0 +1,132 @@ +/* + * Attrs.h -- Header for the attribute manipulation routines. + * + * Authors : Patrick Lecoanet. + * Creation date : Fri Dec 31 10:06:37 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 _Attrs_h +#define _Attrs_h + +#ifdef __CPLUSPLUS__ +extern "C" { +#endif + + +#include + + +/* + * Label Formats. + */ + +/* + * field flags. + */ +#define LF_ATTACH_PIXEL 0 +#define LF_ATTACH_FWD 1 +#define LF_ATTACH_BWD 2 +#define LF_ATTACH_LEFT 3 /* Align left on left or top on top */ +#define LF_ATTACH_RIGHT 4 /* Align right on right or bottom on bottom */ + +#define LF_DIM_PIXEL 0 +#define LF_DIM_FONT 1 +#define LF_DIM_ICON 2 +#define LF_DIM_AUTO 3 + +typedef struct { + int x_spec; + int y_spec; + short width_spec; + short height_spec; + char x_attach; + char y_attach; + char x_dim; + char y_dim; +} FieldFormatStruct, *FieldFormat; + +typedef struct { + short clip_width; + short clip_height; + int num_fields; + Tcl_HashEntry *entry; + int ref_count; + FieldFormatStruct fields[1]; +} LabelFormatStruct, *LabelFormat; + + +LabelFormat +LabelFormatCreate(Tcl_Interp * /* interp */, + char * /* format_str */, + int /* num_fields */); +LabelFormat +LabelFormatDuplicate(LabelFormat /* label_format */); +void +LabelFormatDelete(LabelFormat /* label_format */); +char * +LabelFormatGetString(LabelFormat /* label_format */); +RadarBool +LabelFormatGetClipBox(LabelFormat /* label_format */, + RadarDim */* width */, + RadarDim */* height */); +#define LabelFormatNumFields(lf) ((lf)->num_fields) +void +LabelFormatGetField(LabelFormat /* label_format */, + int /* field */, + char */* x_attach */, + char */* y_attach */, + char */* x_dim */, + char */* y_dim */, + int */* x_spec */, + int */* y_spec */, + short */* width_spec */, + short */* height_spec */); + +/* + * Line Ends. + */ +typedef struct { + RadarReal shape_a; + RadarReal shape_b; + RadarReal shape_c; + Tcl_HashEntry *entry; + int ref_count; +} LineEndStruct, *LineEnd; + +LineEnd +LineEndCreate(Tcl_Interp *interp, + char *line_end_str); +LineEnd +LineEndDuplicate(LineEnd le); +void +LineEndDelete(LineEnd le); +char * +LineEndGetString(LineEnd le); + +#ifdef __CPLUSPLUS__ +} +#endif + +#endif /* _Attrs_h */ diff --git a/generic/Color.h b/generic/Color.h new file mode 100644 index 0000000..548b946 --- /dev/null +++ b/generic/Color.h @@ -0,0 +1,56 @@ +/* + * Color.h -- Header for color routines. + * + * Authors : Patrick Lecoanet. + * Creation date : Thu Dec 16 15:41:04 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 _Color_h +#define _Color_h + + +#include "Types.h" + + +typedef struct _ColorGradient *RadarColorGradient; + +XColor *RadarGetColor(Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name); +XColor *RadarGetColorByValue(Tk_Window tkwin, XColor *color); +char *RadarNameOfColor(XColor *color); +void RadarFreeColor(XColor *color); + +RadarColorGradient RadarGetColorGradient(Tcl_Interp *interp, Tk_Window tkwin, + Tk_Uid name); +RadarColorGradient RadarGetColorGradientByValue(RadarColorGradient gradient); +RadarColorGradient RadarGetReliefGradient(Tcl_Interp *interp, Tk_Window tkwin, + Tk_Uid name); +int RadarColorGradientSpan(RadarColorGradient); +int RadarColorGradientPixel(RadarColorGradient gradient, Tk_Window tkwin, + int color_index); +char *RadarNameOfColorGradient(RadarColorGradient gradient); +void RadarFreeColorGradient(RadarColorGradient gradient); + + +#endif /* _Color_h */ diff --git a/generic/Draw.h b/generic/Draw.h new file mode 100644 index 0000000..35630ed --- /dev/null +++ b/generic/Draw.h @@ -0,0 +1,72 @@ +/* + * Draw.h -- Header for common drawing routines. + * + * Authors : Patrick Lecoanet. + * Creation date : Sat Dec 10 12:51:30 1994 + * + * $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 _Draw_h +#define _Draw_h + +#include "List.h" +#include "Types.h" +#include "Color.h" + +#include + + +#define LIGHTNING_POINTS 4 +#define CORNER_POINTS 3 +#define DOUBLE_CORNER_POINTS 4 +#define STRAIGHT_POINTS 2 +#define LINE_SHAPE_POINTS 4 /* Maximum of all above */ + + +struct _WidgetInfo; + + +void SetLineStyle(Display *display, GC gc, LineStyle line_style); +void GetLineShape(RadarPoint *p1, RadarPoint *p2, unsigned int line_width, + LineShape shape, RadarBBox *bbox, RadarList to_points); +void DrawLineShape(Display *display, Drawable draw_buffer, GC gc, + RadarPoint *points, int num_points, LineStyle line_style, + RadarColor line_foreground, unsigned int line_width, + LineShape shape); +void DrawRectangleRelief(struct _WidgetInfo *wi, + ReliefStyle relief, RadarColorGradient gradient, + XRectangle *bbox, unsigned int line_width); +int PolygonReliefInBBox(RadarList points, unsigned int line_width, + RadarBBox *bbox); +void GetPolygonReliefBBox(RadarList points, unsigned int line_width, + RadarBBox *bbox); +double PolygonReliefToPointDist(RadarList points, unsigned int line_width, + RadarPoint *pp); +void DrawPolygonRelief(struct _WidgetInfo *wi, ReliefStyle relief, + RadarColorGradient gradient, RadarPoint *points, + int num_points, int line_width); + + +#endif /* _Draw_h */ + diff --git a/generic/Geo.h b/generic/Geo.h new file mode 100644 index 0000000..28e3dae --- /dev/null +++ b/generic/Geo.h @@ -0,0 +1,239 @@ +/* + * Geo.h -- Header for common geometric routines. + * + * Authors : Patrick Lecoanet. + * Creation date : + * + * $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 _Geo_h +#define _Geo_h + + +#include "Types.h" +#include "Attrs.h" +#include "List.h" + +#include +#include + + +#ifndef MIN +#define MIN(a, b) ((a) <= (b) ? (a) : (b)) +#endif +#ifndef MAX +#define MAX(a, b) ((a) >= (b) ? (a) : (b)) +#endif +#ifndef ABS +#define ABS(a) ((a) < 0 ? -(a) : (a)) +#endif +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923 +#endif +#ifndef M_PI_4 +#define M_PI_4 0.78539816339744830962 +#endif + +#define PRECISION_LIMIT 1.0e-6 +#define X_PRECISION_LIMIT 5.0e-2 +#define LINE_END_POINTS 6 + +#define DegreesToRadian(angle) \ + (M_PI * (double) (angle) / 180.0) + +#define REAL_TO_INT(double) \ + (((int) ((double) + (((double) > 0) ? 0.5 : -0.5)))) + + +void +Anchor2Origin(RadarPoint *position, + RadarDim width, + RadarDim height, + RadarAnchor anchor, + RadarPoint *origin); +void +Origin2Anchor(RadarPoint *origin, + RadarDim width, + RadarDim height, + RadarAnchor anchor, + RadarPoint *position); +void +BBox2XRect(RadarBBox *bbox, + XRectangle *rect); +void +GetStringBBox(char *str, + RadarFont font, + RadarPos x, + RadarPos y, + RadarBBox *str_bbox); +void +ResetBBox(RadarBBox *bbox); +void +CopyBBox(RadarBBox *bbox_from, + RadarBBox *bbox_to); +void +IntersectBBox(RadarBBox *bbox1, + RadarBBox *bbox2, + RadarBBox *bbox_inter); +RadarBool +IsEmptyBBox(RadarBBox *bbox); +void +AddBBoxToBBox(RadarBBox *bbox, + RadarBBox *bbox2); +void +AddPointToBBox(RadarBBox *bbox, + RadarPos px, + RadarPos py); +void +AddPointsToBBox(RadarBBox *bbox, + RadarPoint *points, + int num_points); +void +AddStringToBBox(RadarBBox *bbox, + char *str, + RadarFont font, + RadarPos cx, + RadarPos cy); +RadarBool +PointInBBox(RadarBBox *bbox, + RadarPos x, + RadarPos y); + +int +LineInBBox(RadarPoint *p1, + RadarPoint *p2, + RadarBBox *bbox); + +int +BBoxInBBox(RadarBBox *bbox1, + RadarBBox *bbox2); + +int +PolylineInBBox(RadarPoint *points, + int num_points, + int width, + int cap_style, + int join_style, + RadarBBox *bbox); + +int +PolygonInBBox(RadarPoint *points, + int num_points, + RadarBBox *bbox); + +int +OvalInBBox(RadarPoint *center, + int width, + int height, + RadarBBox *bbox); + +RadarBool +PointInAngle(int start_angle, + int angle_extent, + RadarPoint *p); + +double +RectangleToPointDist(RadarBBox *bbox, + RadarPoint *p); +double +LineToPointDist(RadarPoint *p1, + RadarPoint *p2, + RadarPoint *p); + +double +PolygonToPointDist(RadarPoint *points, + int num_points, + RadarPoint *p); + +double +PolylineToPointDist(RadarPoint *points, + int num_points, + int width, + int cap_style, + int join_style, + RadarPoint *p); + +double +OvalToPointDist(RadarPoint *center, + int width, + int height, + unsigned int line_width, + RadarPoint *p); + +void +GetButtPoints(RadarPoint *p1, + RadarPoint *p2, + int width, + RadarBool projecting, + RadarPoint *c1, + RadarPoint *c2); + +RadarBool +GetMiterPoints(RadarPoint *p1, + RadarPoint *p2, + RadarPoint *p3, + int width, + RadarPoint *c1, + RadarPoint *c2); + +RadarBool +IntersectLines(RadarPoint *a1, + RadarPoint *a2, + RadarPoint *b1, + RadarPoint *b2, + RadarPoint *pi); + +void +ShiftLine(RadarPoint *p1, + RadarPoint *p2, + RadarReal dist, + RadarPoint *p3, + RadarPoint *p4); + +void +InsetPolygon(RadarPoint *p, + int num_points, + RadarDim inset); + +void +SmoothPathWithBezier(RadarList from_points, + RadarList to_points); + +void +GetBezierPath(RadarList from_points, + RadarList to_points); + +void +GetLineEnd(RadarPoint *p1, + RadarPoint *p2, + unsigned int line_width, + int cap_style, + LineEnd end_style, + RadarPoint *points); + + +#endif /* _Geo_h */ diff --git a/generic/Image.h b/generic/Image.h new file mode 100644 index 0000000..b04c673 --- /dev/null +++ b/generic/Image.h @@ -0,0 +1,59 @@ +/* + * Image.h -- Image support routines. + * + * Authors : Patrick LECOANET + * Creation date : Wed Dec 8 11:04:44 1999 + * + * $Id$ + */ + +/* + * Copyright (c) 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 _Image_h +#define _Image_h + + +#include "Types.h" + + +typedef struct { + XImage *pixels; + XImage *mask; + int width; + int height; + struct _ImagePixmap *pixmaps; +} ImageBits; + + +ImageBits * +GetImageBits(RadarWindow /* win */, + RadarImage /* image */); +Pixmap +GetImagePixmap(RadarWindow /* win */, + RadarImage /* image */); +void +InvalidateImage(RadarImage /* image */); +XImage * +GetBitmapMask(Display */* dpy */, + Pixmap /* bitmap */); + + +#endif /* _Image_h */ diff --git a/generic/Item.h b/generic/Item.h new file mode 100644 index 0000000..40fbbbb --- /dev/null +++ b/generic/Item.h @@ -0,0 +1,277 @@ +/* + * Item.h -- Header to access items' common state and functions. + * + * Authors : Patrick Lecoanet. + * Creation date : + * + * $Id$ + */ + +/* + * Copyright (c) 1996 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 _Item_h +#define _Item_h + + +#include "PostScript.h" +#include "Attrs.h" +#include "List.h" + +#include + + +#define DEFAULT_TRACK_PRIORITY 5 +#define DEFAULT_WAY_POINT_PRIORITY 4 +#define DEFAULT_TABULAR_PRIORITY 3 +#define DEFAULT_RECTANGLE_PRIORITY 2 +#define DEFAULT_MULTI_POINT_PRIORITY 2 +#define DEFAULT_ARC_PRIORITY 2 +#define DEFAULT_RETICLE_PRIORITY 2 +#define DEFAULT_MAP_PRIORITY 1 +#define DEFAULT_GROUP_PRIORITY 0 +#define DEFAULT_ICON_PRIORITY 2 +#define DEFAULT_TEXT_PRIORITY 2 +#define DEFAULT_MOSAIC_PRIORITY 0 + +#define DEFAULT_MARKER_SIZE 0 +#define DEFAULT_VISIBLE_HISTORY_SIZE 6 +#define DEFAULT_MANAGED_HISTORY_SIZE 6 +#define DEFAULT_SPEED_VECTOR_LENGTH 3 +#define DEFAULT_RETICLE_STEP_SIZE 80 +#define DEFAULT_RETICLE_PERIOD 5 +#define DEFAULT_LABEL_ANGLE 20 +#define DEFAULT_LABEL_DISTANCE 50 +#define DEFAULT_LINE_WIDTH 1 +#define DEFAULT_TILE_SIZE 1 +#define DEFAULT_ROW_COUNT 1 +#define DEFAULT_COLUMN_COUNT 1 + +/* + * Item flags values. + */ +#define VISIBLE_BIT 1 +#define SENSITIVE_BIT 2 +#define ATOMIC_BIT 4 +#define UPDATE_DEPENDENT_BIT 16 +#define COMPOSE_SCALE_BIT 32 +#define COMPOSE_ROTATION_BIT 64 + + +/* + * Item record header -- + */ +typedef struct _ItemStruct { + /* Private data */ + int id; + RadarList tags; + struct _WidgetInfo *wi; /* The radar this item is on */ + struct _ItemClassStruct *class; /* item class */ + struct _ItemStruct *previous; /* previous item in group list */ + struct _ItemStruct *next; /* next item in group list */ + RadarBBox item_bounding_box; /* device item bounding box */ + + /* Common attributes */ + unsigned char flags; + unsigned char part_sensitive; /* Currently limited to 8 parts per item */ + short inv_flags; + struct _ItemStruct *parent; + int priority; + struct _RadarTransfo *transfo; + struct _ItemStruct *connected_item; /* Item this item is connected to */ +} ItemStruct, *Item; + + +/* + * Group item special record. + */ +typedef struct _GroupItemStruct { + ItemStruct header; + + /* Public data */ + Item clip; + + /* Private data */ + Item head; /* Doubly linked list of all items. */ + Item tail; + RadarList dependents; /* List of dependent items. */ +#ifdef OM + /* Overlap manager variables. + * These variables are valid *only* if the overlap + * manager is active. */ + RadarBool call_om; /* Tell if there is a need to call the */ + /* overlap manager. */ +#endif +} GroupItemStruct, *GroupItem; + + +/* + * Field array management record. + */ +typedef struct _FieldSetStruct { + struct _WidgetInfo *wi; + LabelFormat label_format; + unsigned int num_fields; + struct _FieldStruct *fields; + RadarDim label_width; /* Describe the label size. Access these */ + RadarDim label_height; /* 2 only with GetLabelBBox. -1 means + * not up to date. */ + RadarPoint label_pos; /* Describe the label origin. */ +} FieldSetStruct, *FieldSet; + + +/* + * Item class record -- + */ +typedef int (*ItemInitMethod)(Item item, int *argc, Arg **args); +typedef int (*ItemConfigureMethod)(Item item, int argc, RadarAttrList args, + int *flags); +typedef int (*ItemQueryMethod)(Item item, int argc, RadarAttrList args); +typedef void (*ItemCloneMethod)(Item item); +typedef void (*ItemDestroyMethod)(Item item); +typedef void (*ItemDrawMethod)(Item item); +typedef void (*ItemComputeCoordinatesMethod)(Item item, RadarBool force); +typedef int (*ItemToAreaMethod)(Item item, RadarBBox *area, + Tk_Uid tag_uid, int enclosed, RadarBool report); +typedef RadarBool (*ItemIsSensitiveMethod)(Item item, int part); +typedef double (*ItemPickMethod)(Item item, RadarPoint *point, + Item start_item, int aperture, + Item *a_item, int *a_part); +typedef FieldSet (*ItemGetFieldSetMethod)(Item item); +typedef void (*ItemGetAnchorMethod)(Item item, RadarAnchor anchor, + RadarPoint *p); +typedef RadarBool (*ItemGetClipVerticesMethod)(Item item, RadarPoint **points, + int *num_points); +typedef int (*ItemCoordsMethod)(Item item, int index, int cmd, + RadarPoint **points, int *num_points); +typedef void (*ItemPostScriptMethod)(Item item, PostScriptInfo ps_info); + +typedef struct _ItemClassStruct { + int item_size; + RadarBool has_fields; + RadarBool has_parts; /* True for items with parts + * other than fields. */ + RadarBool has_anchors; + char *name; + RadarAttrConfig *attr_desc; + ItemInitMethod Init; + ItemCloneMethod Clone; + ItemDestroyMethod Destroy; + ItemConfigureMethod Configure; + ItemQueryMethod Query; + ItemGetFieldSetMethod GetFieldSet; + ItemGetAnchorMethod GetAnchor; + ItemGetClipVerticesMethod GetClipVertices; + ItemCoordsMethod Coords; + ItemComputeCoordinatesMethod ComputeCoordinates; + ItemToAreaMethod ToArea; + ItemDrawMethod Draw; + ItemIsSensitiveMethod IsSensitive; + ItemPickMethod Pick; + ItemPostScriptMethod PostScript; +} ItemClassStruct, *ItemClass; + + +/* + ********************************************************************************** + * + * Generic methods for all items. + * + ********************************************************************************** + */ +extern struct _ITEM { + Item (*CloneItem)(Item model); + void (*DestroyItem)(Item item); + int (*ConfigureItem)(Item item, int field, int argc, RadarAttrList args, RadarBool init); + int (*QueryItem)(Item item, int field, int argc, RadarAttrList args); + int (*AttributesInfo)(Item item, int field, int argc, Arg *args); + void (*SetFieldsAutoAlign)(Item item, int alignment); + void (*InsertItem)(Item item, Item group, Item mark_item, RadarBool before); + void (*UpdateItemPriority)(Item item, Item mark_item, RadarBool before); + void (*InsertDependentItem)(Item item); + void (*UpdateItemDependency)(Item item, Item old_connection); + void (*RemoveItem)(Item item); + void (*SetId)(Item item); + void (*FreeId)(Item item); + void (*AddTag)(Item item, Tk_Uid tag); + void (*RemoveTag)(Item item, Tk_Uid tag); + void (*FreeTags)(Item item); + void (*ResetTransfo)(Item item); + void (*SetTransfo)(Item item, struct _RadarTransfo *t); + void (*TranslateItem)(Item item, RadarReal tx, RadarReal ty); + void (*ScaleItem)(Item item, RadarReal sx, RadarReal sy); + void (*RotateItem)(Item item, RadarReal angle, RadarPoint *p); + void (*Invalidate)(Item item, int reason); + void (*InvalidateItems)(Item group, ItemClass item_class); + void (*ComposeItemTransform)(Item item, struct _RadarTransfo *current_t, + struct _RadarTransfo *new_t); + void (*GetTransform)(Item item, struct _RadarTransfo *t); +} ITEM; + + +/* + ********************************************************************************** + * + * Methods defined in item.c useful for writing items. + * + ********************************************************************************** + */ +extern struct _ITEM_P { + void (*GlobalModuleInit)(); + Item (*CreateItem)(struct _WidgetInfo *wi, ItemClass item_class, + int *argc, Arg **args); + void (*AddItemClass)(ItemClass class); + ItemClass (*LookupItemClass)(char *class_name); + RadarList (*ItemClassList)(); + void (*Damage)(struct _WidgetInfo *wi, RadarBBox *damage); + void (*Repair)(struct _WidgetInfo *wi); + void (*Update)(struct _WidgetInfo *wi); + int (*ConfigureAttributes)(char *record, int field, int argc, Arg *args, int *flags); + int (*QueryAttribute)(char *record, int field, Arg attr_name); + void (*InitFields)(FieldSet field_set); + void (*CloneFields)(FieldSet field_set); + void (*FreeFields)(FieldSet field_set); + void (*DrawFields)(FieldSet field_set); + int (*FieldsToArea)(FieldSet field_set, RadarBBox *area); + RadarBool (*IsFieldSensitive)(FieldSet field_set, int part); + double (*FieldsPick)(FieldSet field_set, RadarPoint *p, int *part); + void (*LeaderToLabel)(FieldSet field_set, RadarPoint *start, RadarPoint *end); + void (*GetLabelBBox)(FieldSet field_set, RadarDim *w, RadarDim *h); + void (*GetFieldBBox)(FieldSet field_set, unsigned int index, RadarBBox *field_bbox); + void (*ResetTransformStack)(struct _WidgetInfo *wi); + void (*ResetClipStack)(struct _WidgetInfo *wi); +} ITEM_P; + + +extern RadarItemClassId RadarArc; +extern RadarItemClassId RadarMap; +extern RadarItemClassId RadarTabular; +extern RadarItemClassId RadarMosaic; +extern RadarItemClassId RadarCurve; +extern RadarItemClassId RadarRectangle; +extern RadarItemClassId RadarReticle; +extern RadarItemClassId RadarTrack; +extern RadarItemClassId RadarWayPoint; +extern RadarItemClassId RadarGroup; +extern RadarItemClassId RadarIcon; +extern RadarItemClassId RadarText; + + +#endif /* _Item_h */ diff --git a/generic/MapInfo.h b/generic/MapInfo.h new file mode 100644 index 0000000..1c14bea --- /dev/null +++ b/generic/MapInfo.h @@ -0,0 +1,237 @@ +/* + * MapInfo.c -- Public include file for MapInfo interface. + * + * Authors : Patrick Lecoanet. + * Creation date : + * + * $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 _MapInfo_h +#define _MapInfo_h + +#ifdef __CPLUSPLUS__ +extern "C" { +#endif + + +#include "Types.h" +#include "List.h" + + +/* + *----------------------------------------------------------------------- + * + * New types + * + *----------------------------------------------------------------------- + */ + +typedef void *MapInfoId; + +typedef enum { + MapInfoLineSimple, + MapInfoLineDashed, + MapInfoLineDotted, + MapInfoLineMixed, + MapInfoLineMarked +} MapInfoLineStyle; + +typedef enum { + MapInfoNormalText, + MapInfoUnderlinedText +} MapInfoTextStyle; + +typedef struct { + int x, y; +} MapInfoPointStruct, *MapInfoPoint; + + +MapInfoId +MapInfoCreate(char *name); +char * +MapInfoName(MapInfoId /* map_info */); +MapInfoId +MapInfoDuplicate(MapInfoId /* map_info */); +void +MapInfoEmpty(MapInfoId /* map_info */); +void +MapInfoDelete(MapInfoId /* map_info */); +void +MapInfoAddLine(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr /* tag */, + MapInfoLineStyle /* line_style */, + int /* line_width */, + int /* x_from */, + int /* y_from */, + int /* x_to */, + int /* y_to */); +void +MapInfoReplaceLine(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr /* tag */, + MapInfoLineStyle /* line_style */, + int /* line_width */, + int /* x_from */, + int /* y_from */, + int /* x_to */, + int /* y_to */); +void +MapInfoRemoveLine(MapInfoId /* map_info */, + unsigned int /* index */); +void +MapInfoGetLine(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr */* tag */, + MapInfoLineStyle */* line_style */, + int */* line_width */, + int */* x_from */, + int */* y_from */, + int */* x_to */, + int */* y_to */); +void +MapInfoGetMarks(MapInfoId /* map_info */, + unsigned int /* index */, + MapInfoPoint */* marks */, + unsigned int */* num_marks */); +unsigned int +MapInfoNumLines(MapInfoId /* map_info */); +void +MapInfoAddSymbol(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr /* tag */, + int /* x */, + int /* y */, + char /* symbol */); +void +MapInfoReplaceSymbol(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr /* tag */, + int /* x */, + int /* y */, + char /* symbol */); +void +MapInfoRemoveSymbol(MapInfoId /* map_info */, + unsigned int /* index */); +void +MapInfoGetSymbol(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr */* tag */, + int */* x */, + int */* y */, + char */* symbol */); +unsigned int +MapInfoNumSymbols(MapInfoId /* map_info */); +void +MapInfoAddText(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr /* tag */, + MapInfoTextStyle /* text_style */, + MapInfoLineStyle /* line_style */, + int /* x */, + int /* y */, + char */* text */); +void +MapInfoReplaceText(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr /* tag */, + MapInfoTextStyle /* text_style */, + MapInfoLineStyle /* line_style */, + int /* x */, + int /* y */, + char */* text */); +void +MapInfoRemoveText(MapInfoId /* map_info */, + unsigned int /* index */); +void +MapInfoGetText(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr */* tag */, + MapInfoTextStyle */* text_style */, + MapInfoLineStyle */* line_style */, + int */* x */, + int */* y */, + char **/* text */); +unsigned int +MapInfoNumTexts(MapInfoId /* map_info */); +void +MapInfoAddArc(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr /* tag */, + MapInfoLineStyle /* line_style */, + int /* line_width */, + int /* center_x */, + int /* center_y */, + unsigned int /* radius */, + int /* start_angle */, + int /* extend */); +void +MapInfoReplaceArc(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr /* tag */, + MapInfoLineStyle /* line_style */, + int /* line_width */, + int /* center_x */, + int /* center_y */, + unsigned int /* radius */, + int /* start_angle */, + int /* extend */); +void +MapInfoRemoveArc(MapInfoId /* map_info */, + unsigned int /* index */); +void +MapInfoGetArc(MapInfoId /* map_info */, + unsigned int /* index */, + RadarPtr */* tag */, + MapInfoLineStyle */* line_style */, + int */* line_width */, + int */* center_x */, + int */* center_y */, + unsigned int */* radius */, + int */* start_angle */, + int */* extend */); +unsigned int +MapInfoNumArcs(MapInfoId /* map_info */); + +void +MapInfoScale(MapInfoId /* map_info */, + double /* factor */); +void +MapInfoTranslate(MapInfoId /* map_info */, + int x, + int y); + +int +MapInfoGetVideomap(MapInfoId /* map_info */, + char */* filename */, + int /* map_index */); + +RadarList +MapInfoVideomapIds(char */* filename */); + +#ifdef __CPLUSPLUS__ +} +#endif + +#endif /* _MapInfo_h */ diff --git a/generic/OverlapMan.h b/generic/OverlapMan.h new file mode 100644 index 0000000..fb844d9 --- /dev/null +++ b/generic/OverlapMan.h @@ -0,0 +1,95 @@ +/* + * OverlapMan.h -- Track label overlap avoidance manager header file + * + * Authors : + * Creation date : + * + * $Id$ + */ + +/* + * Copyright (c) 1993 - 1999 CENA -- + * + * 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 _OverlapMan_h +#define _OverlapMan_h + + +#include +#include + + +/* + * This is the interface with the radar widget. To substitute + * a different overlap manager, it is necessary to conform to + * this API. + */ +void +OmRegister(void *w, + void *(*_fnext_track)(void *ptr, + void *item, + int *x, int *y, + int *sv_dx, int *sv_dy, + int *label_x, int *label_y, + int *label_width, int *label_height, + int *rho, int *theta, + int *visibility), + void (*_fset_label_angle)(void *ptr, void *item, int theta), + void (*_fquery_label_pos)(void *ptr, void *item, int theta, + int *x, int *y, int *w, int *h)); +void +OmUnregister(void *w); +void +OmProcessOverlap(void *radar, + int width, + int height, + double scale); + +/* + * These are overlap manager public functions used + * to set various parameters controlling the algorithm + * behavior. + */ +void +OmSetParam(double repulsion, + double repulsion_bearing, + double friction, + double best_position_attraction, + double screen_edge_repulsion); +void +OmGetParam(double *repulsion, + double *repulsion_bearing, + double *friction, + double *best_position_attraction, + double *screen_edge_repulsion); +void +OmGetMinParam(double *min_repulsion, + double *min_repulsion_bearing, + double *min_friction, + double *min_best_position_attraction, + double *min_screen_edge_repulsion); +void +OmGetMaxParam(double *max_repulsion, + double *max_repulsion_bearing, + double *max_friction, + double *max_best_position_attraction, + double *max_screen_edge_repulsion); + + +#endif /* _OverlapMan_h */ diff --git a/generic/PostScript.h b/generic/PostScript.h new file mode 100644 index 0000000..e92514b --- /dev/null +++ b/generic/PostScript.h @@ -0,0 +1,80 @@ +/* + * PostScript.h -- Header to access PostScript driver. + * + * Authors : Patrick Lecoanet. + * Creation date : Wed Jan 4 11:30:00 1995 + * + * $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 _PostScript_h +#define _PostScript_h + + +#include "List.h" +#include "Types.h" + +#include +#include + + +/* + * PostScript information record -- + */ +typedef struct _PostScriptStruct { + FILE *file; + char *title; + RadarBool landscape; + int color_mode; + int x_world; + int y_world; + int world_width; + int world_height; + RadarBBox page_bbox; + RadarList fonts; +} PostScriptStruct, *PostScriptInfo; + + +struct _WidgetInfo; + + +/* + ********************************************************************************** + * + * Methods defined in PostScript.c for internal use. + * + ********************************************************************************** + */ + +extern struct _POSTSCRIPT_P { + void (*EmitPostScript)(struct _WidgetInfo *wi, FILE *file, char *title, + RadarBool landscape, int color_mode, + int x_world, int y_world, int world_width, + int world_height, int bbox_ox, int bbox_oy, + int bbox_cx, int bbox_cy); + void (*SetPostScriptFont)(struct _WidgetInfo *wi, PostScriptInfo ps_info, + XFontStruct *fs); +} POSTSCRIPT_P; + + +#endif /* _PostScript_h */ diff --git a/generic/Track.h b/generic/Track.h new file mode 100644 index 0000000..57d52a9 --- /dev/null +++ b/generic/Track.h @@ -0,0 +1,56 @@ +/* + * Track.h -- + * + * Authors : Patrick Lecoanet. + * Creation date : Tue Jan 19 16:03:53 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 _Track_h +#define _Track_h + + +#include "Item.h" + + +/* + ********************************************************************************** + * + * Functions defined in Track.c for internal use. + * + ********************************************************************************** + */ + +void *SendTrackToOm(void *ptr, void *item, int *x, int *y, + int *sv_dx, int *sv_dy, int *label_x, int *label_y, + int *label_width, int *label_height, int *rho, + int *theta, int *visibility); +void SetLabelAngleFromOm(void *ptr, void *item, int theta); +void QueryLabelPosition(void *ptr, void *item, int theta, + int *x, int *y, int *w, int *h); +void SetHistoryVisibility(Item item, int index, RadarBool visibility); +void TruncHistory(Item item); + + +#endif /* _Track_h */ diff --git a/generic/WidgetInfo.h b/generic/WidgetInfo.h new file mode 100644 index 0000000..3220611 --- /dev/null +++ b/generic/WidgetInfo.h @@ -0,0 +1,161 @@ +/* + * WidgetInfo.h -- Radar Widget record. + * + * 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 _WidgetInfo_h +#define _WidgetInfo_h + + +#include +#include + +#include "Item.h" +#include "Transfo.h" +#include "Types.h" + + +#ifndef NUM_ALPHA_STEPS +#define NUM_ALPHA_STEPS 16 +#endif + +/* Constants for flags */ + +#define REPICK_IN_PROGRESS 1 +#define LEFT_GRABBED_ITEM 2 +#define INTERNAL_NEED_REPICK 8 + + +typedef struct _WidgetInfo { + Tcl_Interp *interp; /* Interpreter associated with widget. */ + Tcl_Command cmd; /* Token for radar widget command. */ + Tcl_HashTable *tag_table; /* Hash table for object tags. */ + Tcl_HashTable *id_table; /* Hash table for object ids. */ + Tcl_HashTable *t_table; /* Hash table for transformations. */ + unsigned long obj_id; /* Id for the next new object. */ + Tk_BindingTable binding_table; /* Table of all bindings currently defined + * for this radar. NULL means that no + * bindings exist, so the table hasn't been + * created. Each "object" used for this + * table is either a Tk_Uid for a tag or + * the address of an item named by id. */ + int state; /* Last known modifier state. Used to + * defer picking a new current object + * while buttons are down. */ + Item current_item; /* Item picked from previous pick sequence */ + Item new_item; /* Item picked from current pick sequence */ + int current_part; + int new_part; + XEvent pick_event; /* Event used to forge fake events and to do + * repicks. */ + RadarBool update_pending; /* True means there is a pending graphic + * update. */ + RadarBBox exposed_area; /* Window area that need to be rexposed. + * It is distinct from redraw_area which + * is updated when items are changed. */ + Pixmap alpha_stipples[NUM_ALPHA_STEPS]; + int border_width; + int opt_width; /* Window size as stated/reported by the option. */ + int opt_height; /* They are equal to the width/height fields after + * the actual resize. They may to be equal if + * the resize is not acknowledged by the geo + * manager. */ + Tk_3DBorder bg_border; /* The data describing the background + * and border colors. */ + ReliefStyle relief; /* The border relief. */ + + /* Tracks global resources */ + int track_managed_history_size; /* Size of history for tracks */ + RadarBool track_manage_history; /* Tell if the tracks manage their */ + /* histories. */ + int speed_vector_length; /* How long (in time) are speedvectors*/ +#ifdef OM + int om_group_id; /* Tell which group contains tracks to be */ + Item om_group; /* processed for anti label overlap. */ +#endif + + /* Maps global resources */ + RadarFont map_text_font; /* Font for texts in Map items */ + Pixmap map_distance_symbol; + /* display distance marks along Map */ + /* lines. */ + /* Transformer */ + RadarTransfo *current_transfo; + RadarList transfo_stack; + ClipState *current_clip; + RadarList clip_stack; + + /* Others */ + RadarColor fore_color; /* Default foreground used in new items */ + RadarColor back_color; /* Color of the radar background. */ + RadarColor bbox_color; /* Color used to draw bboxes (debug). */ + Cursor cursor; /* Cursor displayed in radar window. */ + RadarBool draw_bboxes; /* Draw item's bboxes (debug). */ + + int pick_aperture; /* size of pick aperture in pixels */ + RadarFont font; /* Default font used in new items */ + RadarBool reshape; /* Use the Shape Extension on the window.*/ + RadarBool full_reshape; /* Use it on the top level window. */ + char *tile_name; + RadarImage tile; + + /* Radar private resources */ + int width; /* Actual window dimension. */ + int height; + + /* Graphic variables */ + Display *dpy; /* The display of the widget window. */ + Screen *screen; + RadarWindow win; /* The window of the widget. */ + RadarBool realized; + Pixmap draw_buffer; /* Pixmap for double buffering */ + RadarBBox damaged_area; /* The current damaged rectangle */ + Region damaged_region; + GC gc; + RadarBool has_x_shm; /* Tell if the SHM X11 ext is avail. */ + RadarBool has_x_shape; /* Tell if she Shape X ext. is avail. */ + RadarBool has_x_input; /* Tell if she X input ext. is avail. */ + int events_flags; /* NEED_REPICK et al */ + Window real_top; + Item top_group; + RadarList work_item_list; /* Temporary item list used in internal + * works. */ + RadarList work_pts; /* Temporary point list. */ + + /* Perf measurement variables. */ + RadarBool monitoring; + int num_updates; + int last_time; + int total_time; +} WidgetInfo; + + +#ifdef __CPLUSPLUS__ +} +#endif + +#endif /* _WidgetInfo_h */ diff --git a/generic/tkZinc.h b/generic/tkZinc.h new file mode 100644 index 0000000..508da6b --- /dev/null +++ b/generic/tkZinc.h @@ -0,0 +1,59 @@ +/* + * tkRadar.h -- Header file for Tk radar widget. + * + * Authors : Patrick Lecoanet. + * Creation date : Mon Mar 15 14:02:03 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 _tkRadar_h +#define _tkRadar_h + +#include "WidgetInfo.h" +#include "Item.h" +#include "List.h" +#include "MapInfo.h" + + +int RadarItemsWithTagOrId(WidgetInfo *wi, char *tag_or_id, Item *item, + Item **item_list); +int ParseCoordList(WidgetInfo *wi, Arg arg, RadarPoint **pts, + int *num_pts); +void DoItem(Tcl_Interp *interp, Item item, int part, Tk_Uid tag_uid); +void RadarNeedRedisplay(WidgetInfo *wi); + + +typedef void (*MapInfoChangeProc)(ClientData client_data, MapInfoId map_info); + +int Radar_CreateMapInfo(Tcl_Interp *interp, char *name, MapInfoId *map_info); +int Radar_DuplicateMapInfo(Tcl_Interp *interp, char *name, MapInfoId map_info); +int Radar_DeleteMapInfo(Tcl_Interp *interp, char *name); +MapInfoId Radar_GetMapInfo(Tcl_Interp *interp, char *name, MapInfoChangeProc proc, + ClientData client_data); +void Radar_FreeMapInfo(MapInfoId map_info, MapInfoChangeProc proc, + ClientData client_data); +void Radar_UpdateMapInfoClients(MapInfoId map_info); + + +#endif /* _tkRadar_h */ -- cgit v1.1