annotate oldXMenu/Create.c @ 82072:7894e62e5b10

(perform-replace): Use isearch-no-upper-case-p.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 23 Jul 2007 21:32:32 +0000
parents 365a8de87f1f
children 95361d2f1ff8 edf631bdbb7a ec58e5c426ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
1 /* Copyright Massachusetts Institute of Technology 1985 */
Dave Love <fx@gnu.org>
parents:
diff changeset
2
Dave Love <fx@gnu.org>
parents:
diff changeset
3 #include "copyright.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
4
Dave Love <fx@gnu.org>
parents:
diff changeset
5 /*
76170
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
6 Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006,
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
7 2007 Free Software Foundation, Inc.
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
8
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
9 This program is free software; you can redistribute it and/or modify
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
10 it under the terms of the GNU General Public License as published by
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
11 the Free Software Foundation; either version 2, or (at your option)
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
12 any later version.
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
13
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
14 This program is distributed in the hope that it will be useful,
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
17 GNU General Public License for more details.
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
18
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
19 You should have received a copy of the GNU General Public License
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
20 along with this program; see the file COPYING. If not, write to the
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
21 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
22 Boston, MA 02110-1301, USA. */
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
23
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
24
365a8de87f1f Add GPL for FSF copyright. Adjust FSF copyright years based on
Glenn Morris <rgm@gnu.org>
parents: 75348
diff changeset
25 /*
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
26 * XMenu: MIT Project Athena, X Window system menu package
Dave Love <fx@gnu.org>
parents:
diff changeset
27 *
Dave Love <fx@gnu.org>
parents:
diff changeset
28 * XMenuCreate - Creates an X window system menu object.
Dave Love <fx@gnu.org>
parents:
diff changeset
29 *
Dave Love <fx@gnu.org>
parents:
diff changeset
30 * Author: Tony Della Fera, DEC
Dave Love <fx@gnu.org>
parents:
diff changeset
31 * January 23, 1986
Dave Love <fx@gnu.org>
parents:
diff changeset
32 *
Dave Love <fx@gnu.org>
parents:
diff changeset
33 */
Dave Love <fx@gnu.org>
parents:
diff changeset
34
Dave Love <fx@gnu.org>
parents:
diff changeset
35 #include <config.h>
Dave Love <fx@gnu.org>
parents:
diff changeset
36 #include "XMenuInt.h"
Dave Love <fx@gnu.org>
parents:
diff changeset
37
Dave Love <fx@gnu.org>
parents:
diff changeset
38
Dave Love <fx@gnu.org>
parents:
diff changeset
39 #ifdef EMACS_BITMAP_FILES
Dave Love <fx@gnu.org>
parents:
diff changeset
40 #include "../src/bitmaps/dimple1.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
41 #include "../src/bitmaps/dimple3.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
42 #include "../src/bitmaps/gray1.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
43 #include "../src/bitmaps/gray3.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
44 #include "../src/bitmaps/crosswv.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
45
Dave Love <fx@gnu.org>
parents:
diff changeset
46 #include "../src/bitmaps/leftptr.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
47 #include "../src/bitmaps/leftpmsk.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
48 #include "../src/bitmaps/rtptr.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
49 #include "../src/bitmaps/rtpmsk.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
50 #include "../src/bitmaps/cntrptr.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
51 #include "../src/bitmaps/cntrpmsk.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
52 #include "../src/bitmaps/stipple.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
53
Dave Love <fx@gnu.org>
parents:
diff changeset
54 #else
Dave Love <fx@gnu.org>
parents:
diff changeset
55 #ifndef VMS
Dave Love <fx@gnu.org>
parents:
diff changeset
56
Dave Love <fx@gnu.org>
parents:
diff changeset
57 #include <X11/bitmaps/dimple1>
Dave Love <fx@gnu.org>
parents:
diff changeset
58 #include <X11/bitmaps/dimple3>
Dave Love <fx@gnu.org>
parents:
diff changeset
59 #include <X11/bitmaps/gray1>
Dave Love <fx@gnu.org>
parents:
diff changeset
60 #include <X11/bitmaps/gray3>
Dave Love <fx@gnu.org>
parents:
diff changeset
61 #include <X11/bitmaps/cross_weave>
Dave Love <fx@gnu.org>
parents:
diff changeset
62
Dave Love <fx@gnu.org>
parents:
diff changeset
63 #include <X11/bitmaps/left_ptr>
Dave Love <fx@gnu.org>
parents:
diff changeset
64 #include <X11/bitmaps/left_ptrmsk>
Dave Love <fx@gnu.org>
parents:
diff changeset
65 #include <X11/bitmaps/right_ptr>
Dave Love <fx@gnu.org>
parents:
diff changeset
66 #include <X11/bitmaps/right_ptrmsk>
Dave Love <fx@gnu.org>
parents:
diff changeset
67 #include <X11/bitmaps/cntr_ptr>
Dave Love <fx@gnu.org>
parents:
diff changeset
68 #include <X11/bitmaps/cntr_ptrmsk>
Dave Love <fx@gnu.org>
parents:
diff changeset
69 #include <X11/bitmaps/stipple>
Dave Love <fx@gnu.org>
parents:
diff changeset
70
Dave Love <fx@gnu.org>
parents:
diff changeset
71 #else
Dave Love <fx@gnu.org>
parents:
diff changeset
72
Dave Love <fx@gnu.org>
parents:
diff changeset
73 #include "[-.src.bitmaps]dimple1.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
74 #include "[-.src.bitmaps]dimple3.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
75 #include "[-.src.bitmaps]gray1.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
76 #include "[-.src.bitmaps]gray3.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
77 #include "[-.src.bitmaps]crosswv.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
78
Dave Love <fx@gnu.org>
parents:
diff changeset
79 #include "[-.src.bitmaps]leftptr.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
80 #include "[-.src.bitmaps]leftpmsk.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
81 #include "[-.src.bitmaps]rtptr.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
82 #include "[-.src.bitmaps]rtpmsk.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
83 #include "[-.src.bitmaps]cntrptr.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
84 #include "[-.src.bitmaps]cntrpmsk.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
85 #include "[-.src.bitmaps]stipple.xbm"
Dave Love <fx@gnu.org>
parents:
diff changeset
86
Dave Love <fx@gnu.org>
parents:
diff changeset
87 #endif /* VMS */
Dave Love <fx@gnu.org>
parents:
diff changeset
88 #endif /* not EMACS_BITMAP_FILES */
Dave Love <fx@gnu.org>
parents:
diff changeset
89
Dave Love <fx@gnu.org>
parents:
diff changeset
90 #define DEF_FREEZE 0
Dave Love <fx@gnu.org>
parents:
diff changeset
91 #define DEF_REVERSE 0
Dave Love <fx@gnu.org>
parents:
diff changeset
92 #define DEF_MENU_STYLE LEFT
Dave Love <fx@gnu.org>
parents:
diff changeset
93 #define DEF_MENU_MODE BOX
Dave Love <fx@gnu.org>
parents:
diff changeset
94 #define DEF_INACT_PNUM 3
Dave Love <fx@gnu.org>
parents:
diff changeset
95 #define MAX_INACT_PNUM 4
Dave Love <fx@gnu.org>
parents:
diff changeset
96
Dave Love <fx@gnu.org>
parents:
diff changeset
97 #define DEF_P_STYLE CENTER
Dave Love <fx@gnu.org>
parents:
diff changeset
98
Dave Love <fx@gnu.org>
parents:
diff changeset
99 #define DEF_P_EVENTS (EnterWindowMask | ExposureMask)
Dave Love <fx@gnu.org>
parents:
diff changeset
100 #define DEF_P_FNT_NAME "fixed"
Dave Love <fx@gnu.org>
parents:
diff changeset
101 #define DEF_P_SPREAD 0.5
Dave Love <fx@gnu.org>
parents:
diff changeset
102 #define DEF_P_BDR_WIDTH 2
Dave Love <fx@gnu.org>
parents:
diff changeset
103
Dave Love <fx@gnu.org>
parents:
diff changeset
104 #define DEF_S_STYLE LEFT
Dave Love <fx@gnu.org>
parents:
diff changeset
105 #define DEF_S_EVENTS (EnterWindowMask | LeaveWindowMask)
Dave Love <fx@gnu.org>
parents:
diff changeset
106 #define DEF_S_FNT_NAME "fixed"
Dave Love <fx@gnu.org>
parents:
diff changeset
107 #define DEF_S_SPREAD 0.10
Dave Love <fx@gnu.org>
parents:
diff changeset
108 #define DEF_S_BDR_WIDTH 1
Dave Love <fx@gnu.org>
parents:
diff changeset
109
Dave Love <fx@gnu.org>
parents:
diff changeset
110 #define XASSOC_TABLE_SIZE 64
Dave Love <fx@gnu.org>
parents:
diff changeset
111
Dave Love <fx@gnu.org>
parents:
diff changeset
112 #define TILE_BUF_SIZE 5
Dave Love <fx@gnu.org>
parents:
diff changeset
113
Dave Love <fx@gnu.org>
parents:
diff changeset
114 int atoi();
Dave Love <fx@gnu.org>
parents:
diff changeset
115 double atof();
Dave Love <fx@gnu.org>
parents:
diff changeset
116 char *x_get_resource_string ();
Dave Love <fx@gnu.org>
parents:
diff changeset
117
Dave Love <fx@gnu.org>
parents:
diff changeset
118
Dave Love <fx@gnu.org>
parents:
diff changeset
119
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
120 static Status
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
121 XAllocDisplayColor(display, map, colorName, color, junk)
Dave Love <fx@gnu.org>
parents:
diff changeset
122 Display *display;
Dave Love <fx@gnu.org>
parents:
diff changeset
123 Colormap map;
Dave Love <fx@gnu.org>
parents:
diff changeset
124 char *colorName;
Dave Love <fx@gnu.org>
parents:
diff changeset
125 XColor *color;
Dave Love <fx@gnu.org>
parents:
diff changeset
126 XColor *junk;
Dave Love <fx@gnu.org>
parents:
diff changeset
127 {
Dave Love <fx@gnu.org>
parents:
diff changeset
128 return (colorName!=0 &&
Dave Love <fx@gnu.org>
parents:
diff changeset
129 XParseColor(display, map, colorName, color) &&
Dave Love <fx@gnu.org>
parents:
diff changeset
130 XAllocColor(display, map, color));
Dave Love <fx@gnu.org>
parents:
diff changeset
131 }
Dave Love <fx@gnu.org>
parents:
diff changeset
132
Dave Love <fx@gnu.org>
parents:
diff changeset
133
Dave Love <fx@gnu.org>
parents:
diff changeset
134 XMenu *
Dave Love <fx@gnu.org>
parents:
diff changeset
135 XMenuCreate(display, parent, def_env)
Dave Love <fx@gnu.org>
parents:
diff changeset
136 Display *display; /* ID of previously opened display */
Dave Love <fx@gnu.org>
parents:
diff changeset
137 Window parent; /* Window ID of the menu's parent window. */
Dave Love <fx@gnu.org>
parents:
diff changeset
138 register char *def_env; /* X Defaults program environment name. */
Dave Love <fx@gnu.org>
parents:
diff changeset
139 {
Dave Love <fx@gnu.org>
parents:
diff changeset
140 register int i; /* Loop counter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
141 register int j; /* Loop counter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
142 register char *def_val; /* X Default value temp variable. */
Dave Love <fx@gnu.org>
parents:
diff changeset
143
Dave Love <fx@gnu.org>
parents:
diff changeset
144 register XMenu *menu; /* Pointer to the new menu. */
Dave Love <fx@gnu.org>
parents:
diff changeset
145 XMStyle menu_style; /* Menu display style. */
Dave Love <fx@gnu.org>
parents:
diff changeset
146 XMMode menu_mode; /* Menu display mode. */
Dave Love <fx@gnu.org>
parents:
diff changeset
147 XMPane *pane; /* Pane list header. */
Dave Love <fx@gnu.org>
parents:
diff changeset
148 XAssocTable *assoc_tab; /* XAssocTable pointer. */
Dave Love <fx@gnu.org>
parents:
diff changeset
149
Dave Love <fx@gnu.org>
parents:
diff changeset
150 int freeze; /* Freeze server mode. */
Dave Love <fx@gnu.org>
parents:
diff changeset
151 int reverse; /* Reverse video mode. */
Dave Love <fx@gnu.org>
parents:
diff changeset
152
Dave Love <fx@gnu.org>
parents:
diff changeset
153 XMStyle p_style; /* Pane display style. */
Dave Love <fx@gnu.org>
parents:
diff changeset
154 char *p_fnt_name; /* Flag font name. */
Dave Love <fx@gnu.org>
parents:
diff changeset
155 XFontStruct *p_fnt_info; /* Flag font structure */
Dave Love <fx@gnu.org>
parents:
diff changeset
156 int p_fnt_pad; /* Flag font padding in pixels. */
Dave Love <fx@gnu.org>
parents:
diff changeset
157 double p_spread; /* Pane spread in flag height fractions. */
Dave Love <fx@gnu.org>
parents:
diff changeset
158 int p_fnt_height; /* Pane character height. */
Dave Love <fx@gnu.org>
parents:
diff changeset
159 int p_bdr_width; /* Pane border width. */
Dave Love <fx@gnu.org>
parents:
diff changeset
160 int flag_height; /* Flag window height. */
Dave Love <fx@gnu.org>
parents:
diff changeset
161 int p_height; /* Pane window height. */
Dave Love <fx@gnu.org>
parents:
diff changeset
162 int p_x_off; /* Pane X offset. */
Dave Love <fx@gnu.org>
parents:
diff changeset
163 int p_y_off; /* Pane Y offset. */
Dave Love <fx@gnu.org>
parents:
diff changeset
164 GC pane_GC; /* Pane graphics context. */
Dave Love <fx@gnu.org>
parents:
diff changeset
165
Dave Love <fx@gnu.org>
parents:
diff changeset
166 XMStyle s_style; /* Selection display style. */
Dave Love <fx@gnu.org>
parents:
diff changeset
167 char *s_fnt_name; /* Selection font name. */
Dave Love <fx@gnu.org>
parents:
diff changeset
168 XFontStruct *s_fnt_info; /* Selection font structure. */
Dave Love <fx@gnu.org>
parents:
diff changeset
169 int s_fnt_pad; /* Selection font padding in pixels. */
Dave Love <fx@gnu.org>
parents:
diff changeset
170 int s_fnt_height; /* Selection font character height */
Dave Love <fx@gnu.org>
parents:
diff changeset
171 double s_spread; /* Select spread in line height fractions. */
Dave Love <fx@gnu.org>
parents:
diff changeset
172 int s_bdr_width; /* Highlight border width. */
Dave Love <fx@gnu.org>
parents:
diff changeset
173 int s_height; /* Selection window height. */
Dave Love <fx@gnu.org>
parents:
diff changeset
174 int s_x_off; /* Selection window X offset. */
Dave Love <fx@gnu.org>
parents:
diff changeset
175 int s_y_off; /* Selection window Y offset. */
Dave Love <fx@gnu.org>
parents:
diff changeset
176 GC normal_select_GC; /* GC used for normal video selection. */
Dave Love <fx@gnu.org>
parents:
diff changeset
177 GC inverse_select_GC; /* GC used for inverse video selection. */
Dave Love <fx@gnu.org>
parents:
diff changeset
178 GC inact_GC; /* GC for inactive pane header and */
Dave Love <fx@gnu.org>
parents:
diff changeset
179 /* selections. */
Dave Love <fx@gnu.org>
parents:
diff changeset
180 GC inact_GC_noexpose;
Dave Love <fx@gnu.org>
parents:
diff changeset
181
Dave Love <fx@gnu.org>
parents:
diff changeset
182 XColor color_def; /* Temp color definition holder. */
Dave Love <fx@gnu.org>
parents:
diff changeset
183 XColor screen_def; /* Temp screen color definition holder */
Dave Love <fx@gnu.org>
parents:
diff changeset
184 XColor p_bdr_color; /* Color of border. */
Dave Love <fx@gnu.org>
parents:
diff changeset
185 XColor s_bdr_color; /* Color of highlight. */
Dave Love <fx@gnu.org>
parents:
diff changeset
186 XColor p_frg_color; /* Color of pane foreground color. */
Dave Love <fx@gnu.org>
parents:
diff changeset
187 XColor s_frg_color; /* Color of selection foreground. */
Dave Love <fx@gnu.org>
parents:
diff changeset
188 XColor bkgnd_color; /* Color of background.. */
Dave Love <fx@gnu.org>
parents:
diff changeset
189 XColor mouse_color; /* Color of mouse cursor. */
Dave Love <fx@gnu.org>
parents:
diff changeset
190 Cursor mouse_cursor; /* Mouse cursor. */
Dave Love <fx@gnu.org>
parents:
diff changeset
191 Pixmap inact_bitmap; /* Menu inactive pixmap. */
Dave Love <fx@gnu.org>
parents:
diff changeset
192
Dave Love <fx@gnu.org>
parents:
diff changeset
193 int inact_pnum; /* Inactive background pattern number. */
Dave Love <fx@gnu.org>
parents:
diff changeset
194
Dave Love <fx@gnu.org>
parents:
diff changeset
195 Pixel p_bdr_pixel; /* Pane border pixel. */
Dave Love <fx@gnu.org>
parents:
diff changeset
196 Pixel s_bdr_pixel; /* Selection border pixel. */
Dave Love <fx@gnu.org>
parents:
diff changeset
197 Pixel p_frg_pixel; /* Pane foreground pixel. */
Dave Love <fx@gnu.org>
parents:
diff changeset
198 Pixel s_frg_pixel; /* Selection foreground pixel. */
Dave Love <fx@gnu.org>
parents:
diff changeset
199 Pixel bkgnd_pixel; /* Menu background pixel. */
Dave Love <fx@gnu.org>
parents:
diff changeset
200
Dave Love <fx@gnu.org>
parents:
diff changeset
201 int *width, *height;
Dave Love <fx@gnu.org>
parents:
diff changeset
202 Pixmap *bitmap;
Dave Love <fx@gnu.org>
parents:
diff changeset
203 int *x_hot, *y_hot;
Dave Love <fx@gnu.org>
parents:
diff changeset
204 int status; /* Return code from XReadBitmapFile. */
Dave Love <fx@gnu.org>
parents:
diff changeset
205
Dave Love <fx@gnu.org>
parents:
diff changeset
206 Pixmap cursor; /* Cursor pixmap holder. */
Dave Love <fx@gnu.org>
parents:
diff changeset
207 Pixmap cursor_mask; /* Cursor mask pixmap holder. */
Dave Love <fx@gnu.org>
parents:
diff changeset
208 Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */
Dave Love <fx@gnu.org>
parents:
diff changeset
209 unsigned long valuemask;
Dave Love <fx@gnu.org>
parents:
diff changeset
210 XGCValues *values;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
211
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
212 Window root = RootWindow (display, DefaultScreen (display));
Dave Love <fx@gnu.org>
parents:
diff changeset
213
Dave Love <fx@gnu.org>
parents:
diff changeset
214 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
215 * Calloc the XMenu structure and the initial pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
216 */
Dave Love <fx@gnu.org>
parents:
diff changeset
217 menu = (XMenu *)calloc(1, sizeof(XMenu));
Dave Love <fx@gnu.org>
parents:
diff changeset
218 if (menu == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
219 _XMErrorCode = XME_CALLOC;
Dave Love <fx@gnu.org>
parents:
diff changeset
220 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
221 }
Dave Love <fx@gnu.org>
parents:
diff changeset
222 pane = (XMPane *)calloc(1, sizeof(XMPane));
Dave Love <fx@gnu.org>
parents:
diff changeset
223 if (pane == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
224 _XMErrorCode = XME_CALLOC;
Dave Love <fx@gnu.org>
parents:
diff changeset
225 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
226 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
227
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
228 /*
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
229 * Create the XAssocTable
Dave Love <fx@gnu.org>
parents:
diff changeset
230 */
Dave Love <fx@gnu.org>
parents:
diff changeset
231 assoc_tab = (XAssocTable *)XCreateAssocTable(XASSOC_TABLE_SIZE);
Dave Love <fx@gnu.org>
parents:
diff changeset
232 if(assoc_tab == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
233 _XMErrorCode= XME_CREATE_ASSOC;
Dave Love <fx@gnu.org>
parents:
diff changeset
234 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
235 }
Dave Love <fx@gnu.org>
parents:
diff changeset
236
Dave Love <fx@gnu.org>
parents:
diff changeset
237 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
238 * Set up the default environment name.
Dave Love <fx@gnu.org>
parents:
diff changeset
239 */
Dave Love <fx@gnu.org>
parents:
diff changeset
240 if (def_env == NULL || *def_env == '\0') def_env = "XMenu";
Dave Love <fx@gnu.org>
parents:
diff changeset
241
Dave Love <fx@gnu.org>
parents:
diff changeset
242 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
243 * Set up internal fail-safe defaults.
Dave Love <fx@gnu.org>
parents:
diff changeset
244 */
Dave Love <fx@gnu.org>
parents:
diff changeset
245 freeze = DEF_FREEZE;
Dave Love <fx@gnu.org>
parents:
diff changeset
246 reverse = DEF_REVERSE;
Dave Love <fx@gnu.org>
parents:
diff changeset
247 menu_style = DEF_MENU_STYLE;
Dave Love <fx@gnu.org>
parents:
diff changeset
248 menu_mode = DEF_MENU_MODE;
Dave Love <fx@gnu.org>
parents:
diff changeset
249 inact_pnum = DEF_INACT_PNUM;
Dave Love <fx@gnu.org>
parents:
diff changeset
250
Dave Love <fx@gnu.org>
parents:
diff changeset
251 p_style = DEF_P_STYLE;
Dave Love <fx@gnu.org>
parents:
diff changeset
252 p_spread = DEF_P_SPREAD;
Dave Love <fx@gnu.org>
parents:
diff changeset
253 p_fnt_name = DEF_P_FNT_NAME;
Dave Love <fx@gnu.org>
parents:
diff changeset
254 p_bdr_width = DEF_P_BDR_WIDTH;
Dave Love <fx@gnu.org>
parents:
diff changeset
255
Dave Love <fx@gnu.org>
parents:
diff changeset
256 s_style = DEF_S_STYLE;
Dave Love <fx@gnu.org>
parents:
diff changeset
257 s_spread = DEF_S_SPREAD;
Dave Love <fx@gnu.org>
parents:
diff changeset
258 s_fnt_name = DEF_S_FNT_NAME;
Dave Love <fx@gnu.org>
parents:
diff changeset
259 s_bdr_width = DEF_S_BDR_WIDTH;
Dave Love <fx@gnu.org>
parents:
diff changeset
260
Dave Love <fx@gnu.org>
parents:
diff changeset
261 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
262 * Get default values from X.
Dave Love <fx@gnu.org>
parents:
diff changeset
263 */
Dave Love <fx@gnu.org>
parents:
diff changeset
264 def_val = x_get_resource_string ("menuFreeze", "MenuFreeze");
Dave Love <fx@gnu.org>
parents:
diff changeset
265 if (def_val != NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
266 if (strcmp(def_val, "on") == 0) freeze = 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
267 else if (strcmp(def_val, "off") == 0) freeze = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
268 }
Dave Love <fx@gnu.org>
parents:
diff changeset
269
Dave Love <fx@gnu.org>
parents:
diff changeset
270 def_val = x_get_resource_string ("menuReverseVideo", "MenuReverseVideo");
Dave Love <fx@gnu.org>
parents:
diff changeset
271 if (def_val != NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
272 if (strcmp(def_val, "on") == 0) reverse = 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
273 else if (strcmp(def_val, "off") == 0) reverse = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
274 }
Dave Love <fx@gnu.org>
parents:
diff changeset
275
Dave Love <fx@gnu.org>
parents:
diff changeset
276 def_val = x_get_resource_string ("menuStyle", "MenuStyle");
Dave Love <fx@gnu.org>
parents:
diff changeset
277 if (def_val != NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
278 if (strcmp(def_val, "right_hand") == 0) menu_style = RIGHT;
Dave Love <fx@gnu.org>
parents:
diff changeset
279 else if (strcmp(def_val, "left_hand") == 0) menu_style = LEFT;
Dave Love <fx@gnu.org>
parents:
diff changeset
280 else if (strcmp(def_val, "center") == 0) menu_style = CENTER;
Dave Love <fx@gnu.org>
parents:
diff changeset
281 }
Dave Love <fx@gnu.org>
parents:
diff changeset
282
Dave Love <fx@gnu.org>
parents:
diff changeset
283 def_val = x_get_resource_string ("menuMode", "MenuMode");
Dave Love <fx@gnu.org>
parents:
diff changeset
284 if (def_val != NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
285 if (strcmp(def_val, "box") == 0) menu_mode = BOX;
Dave Love <fx@gnu.org>
parents:
diff changeset
286 else if (strcmp(def_val, "invert") == 0) menu_mode = INVERT;
Dave Love <fx@gnu.org>
parents:
diff changeset
287 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
288
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
289 def_val = x_get_resource_string ("menuMouse", "MenuMouse");
Dave Love <fx@gnu.org>
parents:
diff changeset
290 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
291 def_val != NULL &&
Dave Love <fx@gnu.org>
parents:
diff changeset
292 DisplayCells(display, DefaultScreen(display)) > 2 &&
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
293 XAllocDisplayColor(display,
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
294 DefaultColormap(display, DefaultScreen(display)),
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
295 def_val,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
296 &mouse_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
297 );
Dave Love <fx@gnu.org>
parents:
diff changeset
298 else if (reverse &&
Dave Love <fx@gnu.org>
parents:
diff changeset
299 XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
300 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
301 "white",
Dave Love <fx@gnu.org>
parents:
diff changeset
302 &mouse_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
303 );
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
304
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
305 else if (XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
306 DefaultColormap(display, DefaultScreen(display)),
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
307 "black",
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
308 &mouse_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
309 );
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
310
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
311 else ;
Dave Love <fx@gnu.org>
parents:
diff changeset
312
Dave Love <fx@gnu.org>
parents:
diff changeset
313 def_val = x_get_resource_string ("menuBackground", "MenuBackground");
Dave Love <fx@gnu.org>
parents:
diff changeset
314 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
315 def_val != NULL &&
Dave Love <fx@gnu.org>
parents:
diff changeset
316 DisplayCells(display, DefaultScreen(display)) > 2 &&
Dave Love <fx@gnu.org>
parents:
diff changeset
317 XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
318 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
319 def_val,
Dave Love <fx@gnu.org>
parents:
diff changeset
320 &bkgnd_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
321 );
Dave Love <fx@gnu.org>
parents:
diff changeset
322 else if (reverse &&
Dave Love <fx@gnu.org>
parents:
diff changeset
323 XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
324 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
325 "black",
Dave Love <fx@gnu.org>
parents:
diff changeset
326 &bkgnd_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
327 );
Dave Love <fx@gnu.org>
parents:
diff changeset
328 else if (XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
329 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
330 "white",
Dave Love <fx@gnu.org>
parents:
diff changeset
331 &bkgnd_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
332 );
Dave Love <fx@gnu.org>
parents:
diff changeset
333 else;
Dave Love <fx@gnu.org>
parents:
diff changeset
334
Dave Love <fx@gnu.org>
parents:
diff changeset
335 def_val = x_get_resource_string ("menuInactivePattern", "MenuInactivePattern");
Dave Love <fx@gnu.org>
parents:
diff changeset
336 if (def_val != NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
337 if (strcmp(def_val, "dimple1") == 0) inact_pnum = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
338 else if (strcmp(def_val, "dimple3") == 0) inact_pnum = 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
339 else if (strcmp(def_val, "gray1") == 0) inact_pnum = 2;
Dave Love <fx@gnu.org>
parents:
diff changeset
340 else if (strcmp(def_val, "gray3") == 0) inact_pnum = 3;
Dave Love <fx@gnu.org>
parents:
diff changeset
341 else if (strcmp(def_val, "cross_weave") == 0) inact_pnum = 4;
Dave Love <fx@gnu.org>
parents:
diff changeset
342 }
Dave Love <fx@gnu.org>
parents:
diff changeset
343
Dave Love <fx@gnu.org>
parents:
diff changeset
344 def_val = x_get_resource_string ("paneStyle", "PaneStyle");
Dave Love <fx@gnu.org>
parents:
diff changeset
345 if (def_val != NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
346 if (strcmp(def_val, "flush_left") == 0) p_style = LEFT;
Dave Love <fx@gnu.org>
parents:
diff changeset
347 else if (strcmp(def_val, "flush_right") == 0) p_style = RIGHT;
Dave Love <fx@gnu.org>
parents:
diff changeset
348 else if (strcmp(def_val, "center") == 0) p_style = CENTER;
Dave Love <fx@gnu.org>
parents:
diff changeset
349 }
Dave Love <fx@gnu.org>
parents:
diff changeset
350
Dave Love <fx@gnu.org>
parents:
diff changeset
351 def_val = x_get_resource_string ("paneFont", "PaneFont");
Dave Love <fx@gnu.org>
parents:
diff changeset
352 if (def_val != NULL) p_fnt_name = def_val;
Dave Love <fx@gnu.org>
parents:
diff changeset
353
Dave Love <fx@gnu.org>
parents:
diff changeset
354 def_val = x_get_resource_string ("paneForeground", "PaneForeground");
Dave Love <fx@gnu.org>
parents:
diff changeset
355 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
356 def_val != NULL &&
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
357 DisplayCells(display, DefaultScreen(display)) > 2
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
358 )
Dave Love <fx@gnu.org>
parents:
diff changeset
359 XAllocDisplayColor(display, DefaultColormap(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
360 DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
361 def_val,
Dave Love <fx@gnu.org>
parents:
diff changeset
362 &p_frg_color, &color_def);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
363
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
364 else if (reverse) XAllocDisplayColor(display,
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
365 DefaultColormap(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
366 DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
367 "white",
Dave Love <fx@gnu.org>
parents:
diff changeset
368 &p_frg_color, &color_def);
Dave Love <fx@gnu.org>
parents:
diff changeset
369 else XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
370 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
371 "black",
Dave Love <fx@gnu.org>
parents:
diff changeset
372 &p_frg_color, &color_def);
Dave Love <fx@gnu.org>
parents:
diff changeset
373
Dave Love <fx@gnu.org>
parents:
diff changeset
374 def_val = x_get_resource_string ("paneBorder", "PaneBorder");
Dave Love <fx@gnu.org>
parents:
diff changeset
375 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
376 def_val != NULL &&
Dave Love <fx@gnu.org>
parents:
diff changeset
377 DisplayCells(display, DefaultScreen(display)) > 2 &&
Dave Love <fx@gnu.org>
parents:
diff changeset
378 XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
379 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
380 def_val,
Dave Love <fx@gnu.org>
parents:
diff changeset
381 &p_bdr_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
382 );
Dave Love <fx@gnu.org>
parents:
diff changeset
383 else if (reverse &&
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
384 XAllocDisplayColor(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
385 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
386 "white",
Dave Love <fx@gnu.org>
parents:
diff changeset
387 &p_bdr_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
388 );
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
389 else XAllocDisplayColor(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
390 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
391 "black",
Dave Love <fx@gnu.org>
parents:
diff changeset
392 &p_bdr_color, &color_def);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
393
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
394 def_val = x_get_resource_string ("paneBorderWidth", "PaneBorderWidth");
Dave Love <fx@gnu.org>
parents:
diff changeset
395 if (def_val != NULL) p_bdr_width = atoi(def_val);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
396
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
397 def_val = x_get_resource_string ("paneSpread", "PaneSpread");
Dave Love <fx@gnu.org>
parents:
diff changeset
398 if (def_val != NULL) p_spread = atof(def_val);
Dave Love <fx@gnu.org>
parents:
diff changeset
399
Dave Love <fx@gnu.org>
parents:
diff changeset
400 def_val = x_get_resource_string ("selectionStyle", "SelectionStyle");
Dave Love <fx@gnu.org>
parents:
diff changeset
401 if (def_val != NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
402 if (strcmp(def_val, "flush_left") == 0) s_style = LEFT;
Dave Love <fx@gnu.org>
parents:
diff changeset
403 else if (strcmp(def_val, "flush_right") == 0) s_style = RIGHT;
Dave Love <fx@gnu.org>
parents:
diff changeset
404 else if (strcmp(def_val, "center") == 0) s_style = CENTER;
Dave Love <fx@gnu.org>
parents:
diff changeset
405 }
Dave Love <fx@gnu.org>
parents:
diff changeset
406
Dave Love <fx@gnu.org>
parents:
diff changeset
407 def_val = x_get_resource_string ("selectionFont", "SelectionFont");
Dave Love <fx@gnu.org>
parents:
diff changeset
408 if (def_val != NULL) s_fnt_name = def_val;
Dave Love <fx@gnu.org>
parents:
diff changeset
409
Dave Love <fx@gnu.org>
parents:
diff changeset
410 def_val = x_get_resource_string ("selectionForeground", "SelectionForeground");
Dave Love <fx@gnu.org>
parents:
diff changeset
411 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
412 def_val != NULL &&
Dave Love <fx@gnu.org>
parents:
diff changeset
413 DisplayCells(display, DefaultScreen(display)) > 2 &&
Dave Love <fx@gnu.org>
parents:
diff changeset
414 XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
415 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
416 def_val,
Dave Love <fx@gnu.org>
parents:
diff changeset
417 &s_frg_color, &color_def)
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
418 );
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
419 else if (reverse &&
Dave Love <fx@gnu.org>
parents:
diff changeset
420 XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
421 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
422 "white",
Dave Love <fx@gnu.org>
parents:
diff changeset
423 &s_frg_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
424 ) ;
Dave Love <fx@gnu.org>
parents:
diff changeset
425 else if (XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
426 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
427 "black",
Dave Love <fx@gnu.org>
parents:
diff changeset
428 &s_frg_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
429 ) ;
Dave Love <fx@gnu.org>
parents:
diff changeset
430 else ;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
431
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
432
Dave Love <fx@gnu.org>
parents:
diff changeset
433 def_val = x_get_resource_string ("selectionBorder", "SelectionBorder");
Dave Love <fx@gnu.org>
parents:
diff changeset
434 if (
Dave Love <fx@gnu.org>
parents:
diff changeset
435 def_val != NULL &&
Dave Love <fx@gnu.org>
parents:
diff changeset
436 DisplayCells(display, DefaultScreen(display)) > 2 &&
Dave Love <fx@gnu.org>
parents:
diff changeset
437 XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
438 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
439 def_val,
Dave Love <fx@gnu.org>
parents:
diff changeset
440 &s_bdr_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
441 ) ;
Dave Love <fx@gnu.org>
parents:
diff changeset
442 else if (reverse &&
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
443 XAllocDisplayColor(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
444 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
445 "white",
Dave Love <fx@gnu.org>
parents:
diff changeset
446 &s_bdr_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
447 ) ;
Dave Love <fx@gnu.org>
parents:
diff changeset
448 else if (XAllocDisplayColor(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
449 DefaultColormap(display, DefaultScreen(display)),
Dave Love <fx@gnu.org>
parents:
diff changeset
450 "black",
Dave Love <fx@gnu.org>
parents:
diff changeset
451 &s_bdr_color, &color_def)
Dave Love <fx@gnu.org>
parents:
diff changeset
452 ) ;
Dave Love <fx@gnu.org>
parents:
diff changeset
453 else ;
Dave Love <fx@gnu.org>
parents:
diff changeset
454
Dave Love <fx@gnu.org>
parents:
diff changeset
455 def_val = x_get_resource_string ("selectionBorderWidth", "SelectionBorderWidth");
Dave Love <fx@gnu.org>
parents:
diff changeset
456 if (def_val != NULL) s_bdr_width = atoi(def_val);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
457
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
458 def_val = x_get_resource_string ("selectionSpread", "SelectionSpread");
Dave Love <fx@gnu.org>
parents:
diff changeset
459 if (def_val != NULL) s_spread = atof(def_val);
Dave Love <fx@gnu.org>
parents:
diff changeset
460
Dave Love <fx@gnu.org>
parents:
diff changeset
461 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
462 * Create and store the inactive pattern pixmap.
Dave Love <fx@gnu.org>
parents:
diff changeset
463 */
Dave Love <fx@gnu.org>
parents:
diff changeset
464 {
Dave Love <fx@gnu.org>
parents:
diff changeset
465 char *data = NULL;
Dave Love <fx@gnu.org>
parents:
diff changeset
466 int width, height;
Dave Love <fx@gnu.org>
parents:
diff changeset
467
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
468 switch (inact_pnum)
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
469 {
Dave Love <fx@gnu.org>
parents:
diff changeset
470 case 0:
Dave Love <fx@gnu.org>
parents:
diff changeset
471 data = (char *)dimple1_bits;
Dave Love <fx@gnu.org>
parents:
diff changeset
472 width = dimple1_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
473 height = dimple1_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
474 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
475
Dave Love <fx@gnu.org>
parents:
diff changeset
476 case 1:
Dave Love <fx@gnu.org>
parents:
diff changeset
477 data = (char *)dimple3_bits;
Dave Love <fx@gnu.org>
parents:
diff changeset
478 width = dimple3_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
479 height = dimple3_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
480 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
481
Dave Love <fx@gnu.org>
parents:
diff changeset
482 case 2:
Dave Love <fx@gnu.org>
parents:
diff changeset
483 data = (char *)gray1_bits;
Dave Love <fx@gnu.org>
parents:
diff changeset
484 width = gray1_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
485 height = gray1_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
486 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
487
Dave Love <fx@gnu.org>
parents:
diff changeset
488 case 3:
Dave Love <fx@gnu.org>
parents:
diff changeset
489 data = (char *)gray3_bits;
Dave Love <fx@gnu.org>
parents:
diff changeset
490 width = gray3_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
491 height = gray3_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
492 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
493
Dave Love <fx@gnu.org>
parents:
diff changeset
494 case 4:
Dave Love <fx@gnu.org>
parents:
diff changeset
495 data = (char *)cross_weave_bits;
Dave Love <fx@gnu.org>
parents:
diff changeset
496 width = cross_weave_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
497 height = cross_weave_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
498 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
499 }
Dave Love <fx@gnu.org>
parents:
diff changeset
500
Dave Love <fx@gnu.org>
parents:
diff changeset
501 if (! data)
Dave Love <fx@gnu.org>
parents:
diff changeset
502 {
Dave Love <fx@gnu.org>
parents:
diff changeset
503 _XMErrorCode = XME_STORE_BITMAP;
Dave Love <fx@gnu.org>
parents:
diff changeset
504 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
505 }
Dave Love <fx@gnu.org>
parents:
diff changeset
506
Dave Love <fx@gnu.org>
parents:
diff changeset
507 inact_bitmap =
Dave Love <fx@gnu.org>
parents:
diff changeset
508 XCreatePixmapFromBitmapData
Dave Love <fx@gnu.org>
parents:
diff changeset
509 (display, root, data, width, height,
Dave Love <fx@gnu.org>
parents:
diff changeset
510 p_frg_color.pixel, bkgnd_color.pixel,
Dave Love <fx@gnu.org>
parents:
diff changeset
511 DisplayPlanes (display, DefaultScreen (display)));
Dave Love <fx@gnu.org>
parents:
diff changeset
512 }
Dave Love <fx@gnu.org>
parents:
diff changeset
513
Dave Love <fx@gnu.org>
parents:
diff changeset
514 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
515 * Load the mouse cursor.
Dave Love <fx@gnu.org>
parents:
diff changeset
516 */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
517
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
518 switch (menu_style) {
Dave Love <fx@gnu.org>
parents:
diff changeset
519 case LEFT:
Dave Love <fx@gnu.org>
parents:
diff changeset
520 cursor = XCreateBitmapFromData(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
521 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
522 left_ptr_bits,
Dave Love <fx@gnu.org>
parents:
diff changeset
523 left_ptr_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
524 left_ptr_height);
Dave Love <fx@gnu.org>
parents:
diff changeset
525 cursor_mask = XCreateBitmapFromData(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
526 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
527 left_ptrmsk_bits,
Dave Love <fx@gnu.org>
parents:
diff changeset
528 left_ptrmsk_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
529 left_ptrmsk_height);
Dave Love <fx@gnu.org>
parents:
diff changeset
530 mouse_cursor = XCreatePixmapCursor(
Dave Love <fx@gnu.org>
parents:
diff changeset
531 display,
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
532 cursor, cursor_mask,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
533 &mouse_color, &bkgnd_color,
Dave Love <fx@gnu.org>
parents:
diff changeset
534 left_ptr_x_hot,
Dave Love <fx@gnu.org>
parents:
diff changeset
535 left_ptr_y_hot
Dave Love <fx@gnu.org>
parents:
diff changeset
536 );
Dave Love <fx@gnu.org>
parents:
diff changeset
537 XFreePixmap(display, cursor);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
538 XFreePixmap(display, cursor_mask);
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
539 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
540 case RIGHT:
Dave Love <fx@gnu.org>
parents:
diff changeset
541 cursor = XCreateBitmapFromData(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
542 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
543 right_ptr_bits,
Dave Love <fx@gnu.org>
parents:
diff changeset
544 right_ptr_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
545 right_ptr_height);
Dave Love <fx@gnu.org>
parents:
diff changeset
546 cursor_mask = XCreateBitmapFromData(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
547 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
548 right_ptrmsk_bits,
Dave Love <fx@gnu.org>
parents:
diff changeset
549 right_ptrmsk_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
550 right_ptrmsk_height);
Dave Love <fx@gnu.org>
parents:
diff changeset
551 mouse_cursor = XCreatePixmapCursor(
Dave Love <fx@gnu.org>
parents:
diff changeset
552 display,
Dave Love <fx@gnu.org>
parents:
diff changeset
553 cursor, cursor_mask,
Dave Love <fx@gnu.org>
parents:
diff changeset
554 &mouse_color, &bkgnd_color,
Dave Love <fx@gnu.org>
parents:
diff changeset
555 right_ptr_x_hot,
Dave Love <fx@gnu.org>
parents:
diff changeset
556 right_ptr_y_hot
Dave Love <fx@gnu.org>
parents:
diff changeset
557 );
Dave Love <fx@gnu.org>
parents:
diff changeset
558 XFreePixmap(display, cursor);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
559 XFreePixmap(display, cursor_mask);
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
560 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
561 case CENTER:
Dave Love <fx@gnu.org>
parents:
diff changeset
562 cursor = XCreateBitmapFromData(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
563 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
564 cntr_ptr_bits,
Dave Love <fx@gnu.org>
parents:
diff changeset
565 cntr_ptr_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
566 cntr_ptr_height);
Dave Love <fx@gnu.org>
parents:
diff changeset
567 cursor_mask = XCreateBitmapFromData(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
568 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
569 cntr_ptrmsk_bits,
Dave Love <fx@gnu.org>
parents:
diff changeset
570 cntr_ptrmsk_width,
Dave Love <fx@gnu.org>
parents:
diff changeset
571 cntr_ptrmsk_height);
Dave Love <fx@gnu.org>
parents:
diff changeset
572 mouse_cursor = XCreatePixmapCursor(
Dave Love <fx@gnu.org>
parents:
diff changeset
573 display,
Dave Love <fx@gnu.org>
parents:
diff changeset
574 cursor, cursor_mask,
Dave Love <fx@gnu.org>
parents:
diff changeset
575 &mouse_color, &bkgnd_color,
Dave Love <fx@gnu.org>
parents:
diff changeset
576 cntr_ptr_x_hot,
Dave Love <fx@gnu.org>
parents:
diff changeset
577 cntr_ptr_y_hot
Dave Love <fx@gnu.org>
parents:
diff changeset
578 );
Dave Love <fx@gnu.org>
parents:
diff changeset
579 XFreePixmap(display, cursor);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
580 XFreePixmap(display, cursor_mask);
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
581 break;
Dave Love <fx@gnu.org>
parents:
diff changeset
582 default:
Dave Love <fx@gnu.org>
parents:
diff changeset
583 /* Error! Invalid style parameter. */
Dave Love <fx@gnu.org>
parents:
diff changeset
584 _XMErrorCode = XME_STYLE_PARAM;
Dave Love <fx@gnu.org>
parents:
diff changeset
585 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
586 }
Dave Love <fx@gnu.org>
parents:
diff changeset
587 if (mouse_cursor == _X_FAILURE) {
Dave Love <fx@gnu.org>
parents:
diff changeset
588 _XMErrorCode = XME_CREATE_CURSOR;
Dave Love <fx@gnu.org>
parents:
diff changeset
589 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
590 }
Dave Love <fx@gnu.org>
parents:
diff changeset
591
Dave Love <fx@gnu.org>
parents:
diff changeset
592 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
593 * Open the pane and selection fonts.
Dave Love <fx@gnu.org>
parents:
diff changeset
594 */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
595
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
596 p_fnt_info = XLoadQueryFont(display, p_fnt_name);
Dave Love <fx@gnu.org>
parents:
diff changeset
597 if (p_fnt_info == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
598 _XMErrorCode = XME_OPEN_FONT;
Dave Love <fx@gnu.org>
parents:
diff changeset
599 return(NULL);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
600
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
601 }
Dave Love <fx@gnu.org>
parents:
diff changeset
602
Dave Love <fx@gnu.org>
parents:
diff changeset
603 s_fnt_info = XLoadQueryFont(display, s_fnt_name);
Dave Love <fx@gnu.org>
parents:
diff changeset
604 if (s_fnt_info == NULL) {
Dave Love <fx@gnu.org>
parents:
diff changeset
605 _XMErrorCode = XME_OPEN_FONT;
Dave Love <fx@gnu.org>
parents:
diff changeset
606 return(NULL);
Dave Love <fx@gnu.org>
parents:
diff changeset
607 }
Dave Love <fx@gnu.org>
parents:
diff changeset
608 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
609 * Calculate the fixed padding value in pixels for each font.
Dave Love <fx@gnu.org>
parents:
diff changeset
610 */
Dave Love <fx@gnu.org>
parents:
diff changeset
611 p_fnt_height = p_fnt_info->max_bounds.ascent + p_fnt_info->max_bounds.descent;
Dave Love <fx@gnu.org>
parents:
diff changeset
612 s_fnt_height = s_fnt_info->max_bounds.ascent + s_fnt_info->max_bounds.descent;
Dave Love <fx@gnu.org>
parents:
diff changeset
613 p_fnt_pad = s_spread * p_fnt_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
614 s_fnt_pad = s_spread * s_fnt_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
615
Dave Love <fx@gnu.org>
parents:
diff changeset
616 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
617 * Calculate fixed height and offset requirements.
Dave Love <fx@gnu.org>
parents:
diff changeset
618 */
Dave Love <fx@gnu.org>
parents:
diff changeset
619 flag_height = p_fnt_height + (p_fnt_pad << 1);
Dave Love <fx@gnu.org>
parents:
diff changeset
620
Dave Love <fx@gnu.org>
parents:
diff changeset
621 p_height = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
622 p_y_off = flag_height + p_bdr_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
623 p_x_off = p_y_off * p_spread;
Dave Love <fx@gnu.org>
parents:
diff changeset
624
Dave Love <fx@gnu.org>
parents:
diff changeset
625 s_height = s_fnt_height + (s_fnt_pad << 1) + (s_bdr_width << 1);
Dave Love <fx@gnu.org>
parents:
diff changeset
626 s_y_off = s_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
627 s_x_off = p_x_off;
Dave Love <fx@gnu.org>
parents:
diff changeset
628
Dave Love <fx@gnu.org>
parents:
diff changeset
629 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
630 * Set up the pane list header.
Dave Love <fx@gnu.org>
parents:
diff changeset
631 */
Dave Love <fx@gnu.org>
parents:
diff changeset
632 pane->next = pane;
Dave Love <fx@gnu.org>
parents:
diff changeset
633 pane->prev = pane;
Dave Love <fx@gnu.org>
parents:
diff changeset
634 pane->type = PL_HEADER;
Dave Love <fx@gnu.org>
parents:
diff changeset
635 pane->serial = -1;
Dave Love <fx@gnu.org>
parents:
diff changeset
636
Dave Love <fx@gnu.org>
parents:
diff changeset
637 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
638 * Initialize the internal pane and selection creation queues.
Dave Love <fx@gnu.org>
parents:
diff changeset
639 */
Dave Love <fx@gnu.org>
parents:
diff changeset
640 _XMWinQueInit();
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
641
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
642 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
643 * Create pane, active, and inactive GC's.
Dave Love <fx@gnu.org>
parents:
diff changeset
644 */
Dave Love <fx@gnu.org>
parents:
diff changeset
645 values = (XGCValues *)malloc(sizeof(XGCValues));
Dave Love <fx@gnu.org>
parents:
diff changeset
646 valuemask = (GCForeground | GCBackground | GCFont | GCLineWidth);
Dave Love <fx@gnu.org>
parents:
diff changeset
647
Dave Love <fx@gnu.org>
parents:
diff changeset
648 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
649 * First, pane.
Dave Love <fx@gnu.org>
parents:
diff changeset
650 */
Dave Love <fx@gnu.org>
parents:
diff changeset
651
Dave Love <fx@gnu.org>
parents:
diff changeset
652 values->foreground = p_frg_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
653 values->background = bkgnd_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
654 values->font = p_fnt_info->fid;
Dave Love <fx@gnu.org>
parents:
diff changeset
655 values->line_width = p_bdr_width;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
656
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
657 pane_GC = XCreateGC(
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
658 display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
659 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
660 valuemask,
Dave Love <fx@gnu.org>
parents:
diff changeset
661 values);
Dave Love <fx@gnu.org>
parents:
diff changeset
662 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
663 * Then normal video selection.
Dave Love <fx@gnu.org>
parents:
diff changeset
664 */
Dave Love <fx@gnu.org>
parents:
diff changeset
665
Dave Love <fx@gnu.org>
parents:
diff changeset
666 values->foreground = s_frg_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
667 values->background = bkgnd_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
668 values->font = s_fnt_info->fid;
Dave Love <fx@gnu.org>
parents:
diff changeset
669 values->line_width = s_bdr_width;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
670 normal_select_GC = XCreateGC(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
671 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
672 valuemask,
Dave Love <fx@gnu.org>
parents:
diff changeset
673 values);
Dave Love <fx@gnu.org>
parents:
diff changeset
674 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
675 * Inverse video selection.
Dave Love <fx@gnu.org>
parents:
diff changeset
676 */
Dave Love <fx@gnu.org>
parents:
diff changeset
677
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
678 values->foreground = bkgnd_color.pixel;
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
679 values->background = s_frg_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
680 values->font = s_fnt_info->fid;
Dave Love <fx@gnu.org>
parents:
diff changeset
681 values->line_width = s_bdr_width;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
682 inverse_select_GC = XCreateGC(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
683 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
684 valuemask,
Dave Love <fx@gnu.org>
parents:
diff changeset
685 values);
Dave Love <fx@gnu.org>
parents:
diff changeset
686 stipple_pixmap = XCreateBitmapFromData(display,
Dave Love <fx@gnu.org>
parents:
diff changeset
687 root,
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
688 stipple_bits,
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
689 stipple_width,
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
690 stipple_height);
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
691
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
692 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
693 * Finally, inactive pane header and selections
Dave Love <fx@gnu.org>
parents:
diff changeset
694 */
Dave Love <fx@gnu.org>
parents:
diff changeset
695 valuemask |= (GCFillStyle | GCStipple);
Dave Love <fx@gnu.org>
parents:
diff changeset
696 values->foreground = s_frg_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
697 values->background = bkgnd_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
698 values->font = s_fnt_info->fid;
Dave Love <fx@gnu.org>
parents:
diff changeset
699 values->line_width = s_bdr_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
700 values->fill_style = FillStippled;
Dave Love <fx@gnu.org>
parents:
diff changeset
701 values->stipple = stipple_pixmap;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
702
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
703 inact_GC = XCreateGC(display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
704 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
705 valuemask,
Dave Love <fx@gnu.org>
parents:
diff changeset
706 values);
Dave Love <fx@gnu.org>
parents:
diff changeset
707
Dave Love <fx@gnu.org>
parents:
diff changeset
708 valuemask |= (GCGraphicsExposures);
Dave Love <fx@gnu.org>
parents:
diff changeset
709 values->graphics_exposures = False;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25858
diff changeset
710 inact_GC_noexpose = XCreateGC (display,
25858
Dave Love <fx@gnu.org>
parents:
diff changeset
711 root,
Dave Love <fx@gnu.org>
parents:
diff changeset
712 valuemask, values);
Dave Love <fx@gnu.org>
parents:
diff changeset
713
Dave Love <fx@gnu.org>
parents:
diff changeset
714
Dave Love <fx@gnu.org>
parents:
diff changeset
715 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
716 * Construct the XMenu object.
Dave Love <fx@gnu.org>
parents:
diff changeset
717 */
Dave Love <fx@gnu.org>
parents:
diff changeset
718 /* -------------------- Menu data -------------------- */
Dave Love <fx@gnu.org>
parents:
diff changeset
719 menu->menu_style = menu_style;
Dave Love <fx@gnu.org>
parents:
diff changeset
720 menu->menu_mode = menu_mode;
Dave Love <fx@gnu.org>
parents:
diff changeset
721 menu->freeze = freeze;
Dave Love <fx@gnu.org>
parents:
diff changeset
722 menu->aeq = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
723 menu->recompute = 1;
Dave Love <fx@gnu.org>
parents:
diff changeset
724 menu->parent = parent;
Dave Love <fx@gnu.org>
parents:
diff changeset
725 menu->height = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
726 menu->width = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
727 menu->mouse_cursor = mouse_cursor;
Dave Love <fx@gnu.org>
parents:
diff changeset
728 menu->assoc_tab = assoc_tab;
Dave Love <fx@gnu.org>
parents:
diff changeset
729 menu->p_list = pane;
Dave Love <fx@gnu.org>
parents:
diff changeset
730 /* -------------------- Pane window data -------------------- */
Dave Love <fx@gnu.org>
parents:
diff changeset
731 menu->p_style = p_style;
Dave Love <fx@gnu.org>
parents:
diff changeset
732 menu->p_events = DEF_P_EVENTS;
Dave Love <fx@gnu.org>
parents:
diff changeset
733 menu->p_fnt_info = p_fnt_info;
Dave Love <fx@gnu.org>
parents:
diff changeset
734 menu->p_fnt_pad = p_fnt_pad;
Dave Love <fx@gnu.org>
parents:
diff changeset
735 menu->p_spread = p_spread;
Dave Love <fx@gnu.org>
parents:
diff changeset
736 menu->p_bdr_width = p_bdr_width;
Dave Love <fx@gnu.org>
parents:
diff changeset
737 menu->flag_height = flag_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
738 menu->p_width = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
739 menu->p_height = p_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
740 menu->p_x_off = p_x_off;
Dave Love <fx@gnu.org>
parents:
diff changeset
741 menu->p_y_off = p_y_off;
Dave Love <fx@gnu.org>
parents:
diff changeset
742 menu->p_count = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
743 menu->pane_GC = pane_GC;
Dave Love <fx@gnu.org>
parents:
diff changeset
744 menu->x_pos = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
745 menu->y_pos = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
746 /* -------------------- Selection window data -------------------- */
Dave Love <fx@gnu.org>
parents:
diff changeset
747 menu->s_style = s_style;
Dave Love <fx@gnu.org>
parents:
diff changeset
748 menu->s_events = DEF_S_EVENTS;
Dave Love <fx@gnu.org>
parents:
diff changeset
749 menu->s_fnt_info = s_fnt_info;
Dave Love <fx@gnu.org>
parents:
diff changeset
750 menu->s_fnt_pad = s_fnt_pad;
Dave Love <fx@gnu.org>
parents:
diff changeset
751 menu->s_spread = s_spread;
Dave Love <fx@gnu.org>
parents:
diff changeset
752 menu->s_bdr_width = s_bdr_width; /* unnecessary */
Dave Love <fx@gnu.org>
parents:
diff changeset
753 menu->s_width = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
754 menu->s_height = s_height;
Dave Love <fx@gnu.org>
parents:
diff changeset
755 menu->s_x_off = s_x_off;
Dave Love <fx@gnu.org>
parents:
diff changeset
756 menu->s_y_off = s_y_off;
Dave Love <fx@gnu.org>
parents:
diff changeset
757 menu->s_count = 0;
Dave Love <fx@gnu.org>
parents:
diff changeset
758 menu->normal_select_GC = normal_select_GC;
Dave Love <fx@gnu.org>
parents:
diff changeset
759 menu->inverse_select_GC = inverse_select_GC;
Dave Love <fx@gnu.org>
parents:
diff changeset
760 menu->inact_GC = inact_GC;
Dave Love <fx@gnu.org>
parents:
diff changeset
761 /* -------------------- Color data -------------------- */
Dave Love <fx@gnu.org>
parents:
diff changeset
762 menu->p_bdr_color = p_bdr_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
763 menu->s_bdr_color = s_bdr_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
764 menu->p_frg_color = p_frg_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
765 menu->s_frg_color = s_frg_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
766 menu->bkgnd_color = bkgnd_color.pixel;
Dave Love <fx@gnu.org>
parents:
diff changeset
767 /* -------------------- Pixmap data -------------------- */
Dave Love <fx@gnu.org>
parents:
diff changeset
768 menu->p_bdr_pixmap = None;
Dave Love <fx@gnu.org>
parents:
diff changeset
769 menu->s_bdr_pixmap = None;
Dave Love <fx@gnu.org>
parents:
diff changeset
770 menu->p_frg_pixmap = None;
Dave Love <fx@gnu.org>
parents:
diff changeset
771 menu->s_frg_pixmap = None;
Dave Love <fx@gnu.org>
parents:
diff changeset
772 menu->bkgnd_pixmap = None;
Dave Love <fx@gnu.org>
parents:
diff changeset
773 menu->inact_pixmap = inact_bitmap;
Dave Love <fx@gnu.org>
parents:
diff changeset
774
Dave Love <fx@gnu.org>
parents:
diff changeset
775 /*
Dave Love <fx@gnu.org>
parents:
diff changeset
776 * Return the completed XMenu.
Dave Love <fx@gnu.org>
parents:
diff changeset
777 */
Dave Love <fx@gnu.org>
parents:
diff changeset
778 _XMErrorCode = XME_NO_ERROR;
Dave Love <fx@gnu.org>
parents:
diff changeset
779 return(menu);
Dave Love <fx@gnu.org>
parents:
diff changeset
780 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
781
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
782 /* arch-tag: 6945b7d2-3b13-40b9-8b6e-56b1b20f3463
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
783 (do not change this comment) */