instant: partially revert commit bc96e6f1ff6c72d4d2cafb6a4088ffa32cd3019f. remove...
[oweals/cde.git] / cde / programs / dticon / globals.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: globals.c /main/3 1995/11/02 14:04:57 rswiston $ */
24 /*********************************************************************
25 *  (c) Copyright 1993, 1994 Hewlett-Packard Company
26 *  (c) Copyright 1993, 1994 International Business Machines Corp.
27 *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
28 *  (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
29 *      Novell, Inc.
30 **********************************************************************/
31 #include <Xm/Xm.h>
32 #include <Dt/xpm.h>
33 #include "constants.h"
34
35 char *black_string="black";
36 char *white_string="white";
37 char *none_string="none";
38
39 HelpStruct   *help_head;                /* head of the Help dialog list */
40 int      query_state, error_state;      /* current state of query/error
41                                            dialogs */
42
43 Display *dpy;                           /* default display */
44 Window   root;                          /* default root window */
45 Window   tablet_win;                    /* window ID for graphics tablet */
46 Widget   tablet_wid;                    /* widget ID for graphics tablet */
47 int      screen;                        /* default screen index */
48 Screen  *screen_ptr;                    /* ptr to default screen struct. */
49 Colormap Cmap;                          /* default colormap */
50 Cursor   cursor;                        /* Custom cursor for grab operations */
51 GC       Color_gc;                      /* GC for fat bits & 1:1 color icon */
52 GC       Mono_gc;                       /* GC for 1:1 monochrome icon */
53 GC       Flicker_gc;                    /* GC for flicker lines on tablet */
54 GC       Grid_gc;                       /* GC for grid */
55 GC       Erase_gc;                      /* GC for the ERASE tool */
56 int      cmap_size;                     /* number of cells in colormap */
57 int      MagFactor;                     /* current enlargement value */
58 int      GraphicsOp;                    /* current graphics tool selected */
59 int      Backup_G_Op;                   /* previous graphics tool selected */
60 int      CurrentColor;                  /* current pen color selected */
61 int      ColorBlock;                    /* static color or dynamic color */
62 int      tx, ty, last_tx, last_ty;      /* x & y values on tablet */
63 int      ix, iy, last_ix, last_iy;      /* x & y values in icons */
64 int      ClickCount = 0;                /* ...for multi-click events */
65 int      format = ZPixmap;              /* XImage format for 2ndary ops. */
66 int      multiClickTime;                /* system default multi-click time */
67 XRectangle current_box;                 /* portion of the tablet currently
68                                            visible */
69 XRectangle select_box;                  /* currently selected rect. area */
70 int      icon_width=32, icon_height=32; /* current icon width & height */
71 int      backup_width=0,
72          backup_height=0;               /* current backup icon width & height */
73 Pixmap   color_icon, prev_color_icon;   /* current and 'undo' color pixmaps */
74 Pixmap   mono_icon, prev_mono_icon;     /* current and 'undo' 2-tone pixmaps */
75 Boolean  status, Dirty;                 /* function return & icon modified
76                                            flags */
77 int      X_Hot, Y_Hot;                  /* hotspot coords. for XPM/XBM file */
78 Boolean  hotSpot=False;                 /* is a hot spot currently set? */
79 Boolean  GridEnabled=True;              /* should the tablet grid be visible? */
80 Boolean  FloodToBorder=False;           /* mono or multi-color flood? */
81 Boolean  FirstRigid=False;              /* is this the 1st rigid box drawed? */
82 Boolean  Selected=False;                /* is an area selected? */
83 Boolean  Anchored=False;                /* state flag for poly{line/gon} Ops. */
84 int      pointCount;                    /* num pts. for poly{line/gon} Ops. */
85 int      fileIOMode;                    /* are we reading or writing a file? */
86 int      fileFormat=FORMAT_XPM;         /* default file output format */
87 char     last_fname[MAX_FNAME];         /* last file read or written */
88 XPoint   pointList[MAX_PTS];            /* pt. list for poly{line/gon} Ops. */
89 XImage  *CutCopy=NULL;                  /* XImage from last cut/copy op. */
90 XImage  *CutCopy_mono=NULL;             /* XImage from last cut/copy op. */
91 XImage  *Rotate=NULL;                   /* XImage from last rotation op. */
92 XImage  *Rotate_mono=NULL;              /* XImage from last rotation op. */
93 XImage  *Scale=NULL;                    /* XImage from last scale op. */
94 XImage  *Scale_mono=NULL;               /* XImage from last scale op. */
95 Pixel    black_pixel, white_pixel;      /* default black & white pixels */
96 Pixel    Foreground, Background,
97          TopShadow, BottomShadow,
98          Select, Transparent;           /* the 6 dynamic colors */
99 Pixel    StaticPen[NUM_STATICS],
100          DynamicPen[NUM_DYNAMICS];      /* 22 pens (pixel values) */
101 Pixel    StaticMono[NUM_STATICS],
102          DynamicMono[NUM_DYNAMICS];     /* 22 monochrome fallbacks */
103 Widget   StaticWid[NUM_STATICS],
104          DynamicWid[NUM_DYNAMICS];      /* 22 color button widgets */
105 Widget   GraphicOpsWid[NUM_GFX_OPS];    /* 10 'Graphics Ops.' button widgets */
106
107 Boolean  DialogFlag;                    /* state flag for pop-up dialogs */
108 Boolean  FillSolids;                    /* state flag for polygon fills */
109 Boolean  param_flag[NUM_PARAMS];        /* what cmd. line params got used? */
110 Boolean  argsNeedProcessed;             /* cmd. line args need to be resolved */
111 Boolean  UndoFlag=False;                /* Can we undo the last graphics op.? */
112 XpmAttributes xpm_ReadAttribs;          /* XPM read file attributes */
113 XpmAttributes xpm_WriteAttribs;         /* XPM write file attributes */
114 /* int      numSymbols=0;                  number of color symbols loaded */
115 XpmColorSymbol *colorSymbols;           /* color symbols list */
116 ApplicationData  xrdb;                  /* application specific resources  */
117 SessionData  session;                   /* session specific resources  */
118 PixelTable pixelTable;                  /* used for getting mono equiv icon */
119
120 char dynamic_c_str[NUM_DYNAMICS][30];   /* RGB value str. for dynamic colors */
121
122 char *color_table[NUM_STATICS+NUM_DYNAMICS][6] = {
123         "0",  "iconColor1",         "black",   NULL,  NULL,  "black",
124         "1",  "iconColor2",         "white",   NULL,  NULL,  "white",
125         "2",  "iconColor3",         "black",   NULL,  NULL,  "red",
126         "3",  "iconColor4",         "white",   NULL,  NULL,  "green",
127         "4",  "iconColor5",         "black",   NULL,  NULL,  "blue",
128         "5",  "iconColor6",         "white",   NULL,  NULL,  "yellow",
129         "6",  "iconColor7",         "white",   NULL,  NULL,  "cyan",
130         "7",  "iconColor8",         "black",   NULL,  NULL,  "magenta",
131         "8",  "iconGray1",          "white",   NULL,  NULL,  "#dededededede",
132         "9",  "iconGray2",          "white",   NULL,  NULL,  "#bdbdbdbdbdbd",
133         "a",  "iconGray3",          "white",   NULL,  NULL,  "#adadadadadad",
134         "b",  "iconGray4",          "white",   NULL,  NULL,  "#949494949494",
135         "c",  "iconGray5",          "black",   NULL,  NULL,  "#737373737373",
136         "d",  "iconGray6",          "black",   NULL,  NULL,  "#636363636363",
137         "e",  "iconGray7",          "black",   NULL,  NULL,  "#424242424242",
138         "f",  "iconGray8",          "black",   NULL,  NULL,  "#212121212121",
139         "A",  "background",         "black",   NULL,  NULL,  "#949494949494",
140         "B",  "foreground",         "white",   NULL,  NULL,  "white",
141         "C",  "topShadowColor",     "white",   NULL,  NULL,  "#bdbdbdbdbdbd",
142         "D",  "bottomShadowColor",  "black",   NULL,  NULL,  "#636363636363",
143         "E",  "selectColor",        "white",   NULL,  NULL,  "#737373737373",
144         "F",  "none",               "none",    NULL,  NULL,  "none" };
145
146 char *hints_cmt = { " width height ncolors cpp [x_hot y_hot] " };
147 char *colors_cmt = { " colors " };
148 char *pixels_cmt = { " pixels " };
149
150 /****** STUB **********/
151 #ifdef DEBUG
152 int           debug=True;
153 int           debug_status;
154 XImage       *debug_image, *debug_shape;
155 #endif
156 /**********************/