7
|
1 /* vi:set ts=8 sts=4 sw=4:
|
|
2 *
|
|
3 * VIM - Vi IMproved by Bram Moolenaar
|
|
4 * Motif support by Robert Webb
|
|
5 *
|
|
6 * Do ":help uganda" in Vim to read copying and usage conditions.
|
|
7 * Do ":help credits" in Vim to see a list of people who contributed.
|
|
8 */
|
|
9
|
|
10 #ifdef FEAT_GUI_MOTIF
|
|
11 # include <Xm/Xm.h>
|
|
12 #endif
|
|
13
|
|
14 #ifdef FEAT_GUI_ATHENA
|
|
15 # include <X11/Intrinsic.h>
|
|
16 # include <X11/StringDefs.h>
|
|
17 #endif
|
|
18
|
|
19 #ifdef FEAT_BEVAL
|
|
20 # include "gui_beval.h"
|
|
21 #endif
|
|
22
|
|
23 #ifdef FEAT_GUI_GTK
|
844
|
24 # ifdef VMS /* undef MIN and MAX because Intrinsic.h redefines them anyway */
|
|
25 # ifdef MAX
|
|
26 # undef MAX
|
|
27 # endif
|
|
28 # ifdef MIN
|
|
29 # undef MIN
|
|
30 # endif
|
|
31 # endif
|
7
|
32 # include <X11/Intrinsic.h>
|
|
33 # include <gtk/gtk.h>
|
|
34 #endif
|
|
35
|
|
36 #ifdef FEAT_GUI_MAC
|
|
37 # include <Types.h>
|
|
38 /*# include <Memory.h>*/
|
|
39 # include <Quickdraw.h>
|
|
40 # include <Fonts.h>
|
|
41 # include <Events.h>
|
|
42 # include <Menus.h>
|
|
43 # if !(defined (TARGET_API_MAC_CARBON) && (TARGET_API_MAC_CARBON))
|
|
44 # include <Windows.h>
|
|
45 # endif
|
|
46 # include <Controls.h>
|
|
47 /*# include <TextEdit.h>*/
|
|
48 # include <Dialogs.h>
|
|
49 # include <OSUtils.h>
|
|
50 /*
|
|
51 # include <ToolUtils.h>
|
|
52 # include <SegLoad.h>*/
|
|
53 #endif
|
|
54
|
|
55 #ifdef RISCOS
|
|
56 # include "gui_riscos.h"
|
|
57 #endif
|
|
58
|
|
59 #ifdef FEAT_GUI_PHOTON
|
|
60 # include <Ph.h>
|
|
61 # include <Pt.h>
|
|
62 # include "photon/PxProto.h"
|
|
63 #endif
|
|
64
|
|
65 /*
|
|
66 * On some systems, when we compile with the GUI, we always use it. On Mac
|
|
67 * there is no terminal version, and on Windows we can't figure out how to
|
|
68 * fork one off with :gui.
|
|
69 */
|
|
70 #if defined(FEAT_GUI_MSWIN) || (defined(FEAT_GUI_MAC) && !defined(MACOS_X_UNIX))
|
|
71 # define ALWAYS_USE_GUI
|
|
72 #endif
|
|
73
|
|
74 #if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MAC) || defined(HAVE_GTK2)
|
|
75 # define USE_ON_FLY_SCROLL
|
|
76 #endif
|
|
77
|
|
78 /*
|
|
79 * GUIs that support dropping files on a running Vim.
|
|
80 */
|
|
81 #if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MAC) \
|
574
|
82 || defined(FEAT_GUI_GTK)
|
7
|
83 # define HAVE_DROP_FILE
|
|
84 #endif
|
|
85
|
|
86 /*
|
|
87 * This define makes menus always use a fontset.
|
|
88 * We're not sure if this code always works, thus it can be disabled.
|
|
89 */
|
|
90 #ifdef FEAT_XFONTSET
|
|
91 # define FONTSET_ALWAYS
|
|
92 #endif
|
|
93
|
|
94 /*
|
|
95 * These macros convert between character row/column and pixel coordinates.
|
|
96 * TEXT_X - Convert character column into X pixel coord for drawing strings.
|
|
97 * TEXT_Y - Convert character row into Y pixel coord for drawing strings.
|
|
98 * FILL_X - Convert character column into X pixel coord for filling the area
|
|
99 * under the character.
|
|
100 * FILL_Y - Convert character row into Y pixel coord for filling the area
|
|
101 * under the character.
|
|
102 * X_2_COL - Convert X pixel coord into character column.
|
|
103 * Y_2_ROW - Convert Y pixel coord into character row.
|
|
104 */
|
|
105 #ifdef FEAT_GUI_W32
|
|
106 # define TEXT_X(col) ((col) * gui.char_width)
|
|
107 # define TEXT_Y(row) ((row) * gui.char_height + gui.char_ascent)
|
|
108 # define FILL_X(col) ((col) * gui.char_width)
|
|
109 # define FILL_Y(row) ((row) * gui.char_height)
|
|
110 # define X_2_COL(x) ((x) / gui.char_width)
|
|
111 # define Y_2_ROW(y) ((y) / gui.char_height)
|
|
112 #else
|
|
113 # define TEXT_X(col) ((col) * gui.char_width + gui.border_offset)
|
|
114 # define FILL_X(col) ((col) * gui.char_width + gui.border_offset)
|
|
115 # define X_2_COL(x) (((x) - gui.border_offset) / gui.char_width)
|
|
116 # define TEXT_Y(row) ((row) * gui.char_height + gui.char_ascent \
|
|
117 + gui.border_offset)
|
|
118 # define FILL_Y(row) ((row) * gui.char_height + gui.border_offset)
|
|
119 # define Y_2_ROW(y) (((y) - gui.border_offset) / gui.char_height)
|
|
120 #endif
|
|
121
|
|
122 /* Indices for arrays of scrollbars */
|
|
123 #define SBAR_NONE -1
|
|
124 #define SBAR_LEFT 0
|
|
125 #define SBAR_RIGHT 1
|
|
126 #define SBAR_BOTTOM 2
|
|
127
|
|
128 /* Orientations for scrollbars */
|
|
129 #define SBAR_VERT 0
|
|
130 #define SBAR_HORIZ 1
|
|
131
|
|
132 /* Default size of scrollbar */
|
|
133 #define SB_DEFAULT_WIDTH 16
|
|
134
|
|
135 /* Default height of the menu bar */
|
|
136 #define MENU_DEFAULT_HEIGHT 1 /* figure it out at runtime */
|
|
137
|
|
138 /* Flags for gui_mch_outstr_nowrap() */
|
|
139 #define GUI_MON_WRAP_CURSOR 0x01 /* wrap cursor at end of line */
|
|
140 #define GUI_MON_INVERT 0x02 /* invert the characters */
|
|
141 #define GUI_MON_IS_CURSOR 0x04 /* drawing cursor */
|
|
142 #define GUI_MON_TRS_CURSOR 0x08 /* drawing transparent cursor */
|
|
143 #define GUI_MON_NOCLEAR 0x10 /* don't clear selection */
|
|
144
|
|
145 /* Flags for gui_mch_draw_string() */
|
|
146 #define DRAW_TRANSP 0x01 /* draw with transparant bg */
|
|
147 #define DRAW_BOLD 0x02 /* draw bold text */
|
|
148 #define DRAW_UNDERL 0x04 /* draw underline text */
|
203
|
149 #define DRAW_UNDERC 0x08 /* draw undercurl text */
|
574
|
150 #if defined(RISCOS) || defined(HAVE_GTK2)
|
203
|
151 # define DRAW_ITALIC 0x10 /* draw italic text */
|
7
|
152 #endif
|
203
|
153 #define DRAW_CURSOR 0x20 /* drawing block cursor (win32) */
|
7
|
154
|
|
155 /* For our own tearoff menu item */
|
|
156 #define TEAR_STRING "-->Detach"
|
|
157 #define TEAR_LEN (9) /* length of above string */
|
|
158
|
|
159 /* for the toolbar */
|
|
160 #ifdef FEAT_GUI_W16
|
|
161 # define TOOLBAR_BUTTON_HEIGHT 15
|
|
162 # define TOOLBAR_BUTTON_WIDTH 16
|
|
163 #else
|
|
164 # define TOOLBAR_BUTTON_HEIGHT 18
|
|
165 # define TOOLBAR_BUTTON_WIDTH 18
|
|
166 #endif
|
|
167 #define TOOLBAR_BORDER_HEIGHT 12 /* room above+below buttons for MSWindows */
|
|
168
|
810
|
169 #ifdef FEAT_GUI_MSWIN
|
811
|
170 # define TABLINE_HEIGHT 22
|
810
|
171 #endif
|
819
|
172 #ifdef FEAT_GUI_MOTIF
|
|
173 # define TABLINE_HEIGHT 30
|
|
174 #endif
|
810
|
175
|
574
|
176 #if defined(NO_CONSOLE) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
|
7
|
177 # define NO_CONSOLE_INPUT /* use no_console_input() to check if there
|
|
178 is no console input possible */
|
|
179 #endif
|
|
180
|
|
181 typedef struct GuiScrollbar
|
|
182 {
|
|
183 long ident; /* Unique identifier for each scrollbar */
|
667
|
184 win_T *wp; /* Scrollbar's window, NULL for bottom */
|
7
|
185 int type; /* one of SBAR_{LEFT,RIGHT,BOTTOM} */
|
|
186 long value; /* Represents top line number visible */
|
|
187 #ifdef FEAT_GUI_ATHENA
|
|
188 int pixval; /* pixel count of value */
|
|
189 #endif
|
|
190 long size; /* Size of scrollbar thumb */
|
|
191 long max; /* Number of lines in buffer */
|
|
192
|
|
193 /* Values measured in characters: */
|
|
194 int top; /* Top of scroll bar (chars from row 0) */
|
|
195 int height; /* Current height of scroll bar in rows */
|
|
196 #ifdef FEAT_VERTSPLIT
|
|
197 int width; /* Current width of scroll bar in cols */
|
|
198 #endif
|
|
199 int status_height; /* Height of status line */
|
|
200 #ifdef FEAT_GUI_X11
|
|
201 Widget id; /* Id of real scroll bar */
|
|
202 #endif
|
|
203 #ifdef FEAT_GUI_GTK
|
|
204 GtkWidget *id; /* Id of real scroll bar */
|
|
205 unsigned long handler_id; /* Id of "value_changed" signal handler */
|
|
206 #endif
|
|
207
|
|
208 #ifdef FEAT_GUI_MSWIN
|
|
209 HWND id; /* Id of real scroll bar */
|
|
210 int scroll_shift; /* The scrollbar stuff can handle only up to
|
|
211 32767 lines. When the file is longer,
|
|
212 scroll_shift is set to the number of shifts
|
|
213 to reduce the count. */
|
|
214 #endif
|
|
215 #ifdef FEAT_GUI_MAC
|
|
216 ControlHandle id; /* A handle to the scrollbar */
|
|
217 #endif
|
|
218 #ifdef RISCOS
|
|
219 int id; /* Window handle of scrollbar window */
|
|
220 #endif
|
|
221 #ifdef FEAT_GUI_PHOTON
|
|
222 PtWidget_t *id;
|
|
223 #endif
|
|
224 } scrollbar_T;
|
|
225
|
|
226 typedef long guicolor_T; /* handle for a GUI color; for X11 this should
|
|
227 be "Pixel", but that's an unsigned and we
|
|
228 need a signed value */
|
|
229 #define INVALCOLOR (guicolor_T)-11111 /* number for invalid color; on 32 bit
|
|
230 displays there is a tiny chance this is an
|
|
231 actual color */
|
|
232
|
|
233 #ifdef FEAT_GUI_GTK
|
|
234 # ifdef HAVE_GTK2
|
|
235 typedef PangoFontDescription *GuiFont; /* handle for a GUI font */
|
|
236 typedef PangoFontDescription *GuiFontset; /* handle for a GUI fontset */
|
|
237 # else
|
|
238 typedef GdkFont *GuiFont; /* handle for a GUI font */
|
|
239 typedef GdkFont *GuiFontset; /* handle for a GUI fontset */
|
|
240 # endif
|
|
241 # define NOFONT (GuiFont)NULL
|
|
242 # define NOFONTSET (GuiFontset)NULL
|
|
243 #else
|
|
244 # ifdef FEAT_GUI_PHOTON
|
|
245 typedef char *GuiFont;
|
|
246 typedef char *GuiFontset;
|
|
247 # define NOFONT (GuiFont)NULL
|
|
248 # define NOFONTSET (GuiFontset)NULL
|
|
249 # else
|
|
250 # ifdef FEAT_GUI_X11
|
|
251 typedef XFontStruct *GuiFont; /* handle for a GUI font */
|
|
252 typedef XFontSet GuiFontset; /* handle for a GUI fontset */
|
|
253 # define NOFONT (GuiFont)0
|
|
254 # define NOFONTSET (GuiFontset)0
|
|
255 # else
|
|
256 typedef long_u GuiFont; /* handle for a GUI font */
|
|
257 typedef long_u GuiFontset; /* handle for a GUI fontset */
|
|
258 # define NOFONT (GuiFont)0
|
|
259 # define NOFONTSET (GuiFontset)0
|
|
260 # endif
|
|
261 # endif
|
|
262 #endif
|
|
263
|
|
264 typedef struct Gui
|
|
265 {
|
|
266 int in_focus; /* Vim has input focus */
|
|
267 int in_use; /* Is the GUI being used? */
|
|
268 int starting; /* GUI will start in a little while */
|
|
269 int shell_created; /* Has the shell been created yet? */
|
|
270 int dying; /* Is vim dying? Then output to terminal */
|
|
271 int dofork; /* Use fork() when GUI is starting */
|
|
272 int dragged_sb; /* Which scrollbar being dragged, if any? */
|
|
273 win_T *dragged_wp; /* Which WIN's sb being dragged, if any? */
|
|
274 int pointer_hidden; /* Is the mouse pointer hidden? */
|
|
275 int col; /* Current cursor column in GUI display */
|
|
276 int row; /* Current cursor row in GUI display */
|
|
277 int cursor_col; /* Physical cursor column in GUI display */
|
|
278 int cursor_row; /* Physical cursor row in GUI display */
|
|
279 char cursor_is_valid; /* There is a cursor at cursor_row/col */
|
|
280 int num_cols; /* Number of columns */
|
|
281 int num_rows; /* Number of rows */
|
|
282 int scroll_region_top; /* Top (first) line of scroll region */
|
|
283 int scroll_region_bot; /* Bottom (last) line of scroll region */
|
|
284 int scroll_region_left; /* Left (first) column of scroll region */
|
|
285 int scroll_region_right; /* Right (last) col. of scroll region */
|
|
286 int highlight_mask; /* Highlight attribute mask */
|
|
287 int scrollbar_width; /* Width of vertical scrollbars */
|
|
288 int scrollbar_height; /* Height of horizontal scrollbar */
|
|
289 int left_sbar_x; /* Calculated x coord for left scrollbar */
|
|
290 int right_sbar_x; /* Calculated x coord for right scrollbar */
|
|
291
|
|
292 #ifdef FEAT_MENU
|
|
293 # ifndef FEAT_GUI_GTK
|
|
294 int menu_height; /* Height of the menu bar */
|
|
295 int menu_width; /* Width of the menu bar */
|
|
296 # endif
|
|
297 char menu_is_active; /* TRUE if menu is present */
|
|
298 # ifdef FEAT_GUI_ATHENA
|
|
299 char menu_height_fixed; /* TRUE if menu height fixed */
|
|
300 # endif
|
|
301 #endif
|
|
302
|
|
303 scrollbar_T bottom_sbar; /* Bottom scrollbar */
|
|
304 int which_scrollbars[3];/* Which scrollbar boxes are active? */
|
|
305 int prev_wrap; /* For updating the horizontal scrollbar */
|
444
|
306 int char_width; /* Width of char cell in pixels */
|
|
307 int char_height; /* Height of char cell in pixels, includes
|
|
308 'linespace' */
|
7
|
309 int char_ascent; /* Ascent of char in pixels */
|
|
310 int border_width; /* Width of our border around text area */
|
|
311 int border_offset; /* Total pixel offset for all borders */
|
|
312
|
|
313 GuiFont norm_font; /* Normal font */
|
|
314 #ifndef HAVE_GTK2
|
|
315 GuiFont bold_font; /* Bold font */
|
|
316 GuiFont ital_font; /* Italic font */
|
|
317 GuiFont boldital_font; /* Bold-Italic font */
|
|
318 #else
|
|
319 int font_can_bold; /* Whether norm_font supports bold weight.
|
|
320 * The styled font variants are not used. */
|
|
321 #endif
|
|
322
|
|
323 #if defined(FEAT_MENU) && !defined(HAVE_GTK2)
|
|
324 # ifdef FONTSET_ALWAYS
|
|
325 GuiFontset menu_fontset; /* set of fonts for multi-byte chars */
|
|
326 # else
|
|
327 GuiFont menu_font; /* menu item font */
|
|
328 # endif
|
|
329 #endif
|
|
330 #ifdef FEAT_MBYTE
|
|
331 GuiFont wide_font; /* 'guifontwide' font */
|
|
332 #endif
|
|
333 #ifdef FEAT_XFONTSET
|
|
334 GuiFontset fontset; /* set of fonts for multi-byte chars */
|
|
335 #endif
|
|
336 guicolor_T back_pixel; /* Color of background */
|
|
337 guicolor_T norm_pixel; /* Color of normal text */
|
|
338 guicolor_T def_back_pixel; /* default Color of background */
|
|
339 guicolor_T def_norm_pixel; /* default Color of normal text */
|
|
340
|
|
341 #ifdef FEAT_GUI_X11
|
|
342 char *rsrc_menu_fg_name; /* Color of menu and dialog foregound */
|
|
343 guicolor_T menu_fg_pixel; /* Same in Pixel format */
|
|
344 char *rsrc_menu_bg_name; /* Color of menu and dialog backgound */
|
|
345 guicolor_T menu_bg_pixel; /* Same in Pixel format */
|
|
346 char *rsrc_scroll_fg_name; /* Color of scrollbar foreground */
|
|
347 guicolor_T scroll_fg_pixel; /* Same in Pixel format */
|
|
348 char *rsrc_scroll_bg_name; /* Color of scrollbar background */
|
|
349 guicolor_T scroll_bg_pixel; /* Same in Pixel format */
|
|
350
|
|
351 # ifdef FEAT_GUI_MOTIF
|
|
352 guicolor_T menu_def_fg_pixel; /* Default menu foreground */
|
|
353 guicolor_T menu_def_bg_pixel; /* Default menu background */
|
|
354 guicolor_T scroll_def_fg_pixel; /* Default scrollbar foreground */
|
|
355 guicolor_T scroll_def_bg_pixel; /* Default scrollbar background */
|
|
356 # endif
|
|
357 Display *dpy; /* X display */
|
|
358 Window wid; /* Window id of text area */
|
|
359 int visibility; /* Is shell partially/fully obscured? */
|
|
360 GC text_gc;
|
|
361 GC back_gc;
|
|
362 GC invert_gc;
|
|
363 Cursor blank_pointer; /* Blank pointer */
|
|
364
|
|
365 /* X Resources */
|
|
366 char_u *rsrc_font_name; /* Resource font name, used if 'guifont'
|
|
367 not set */
|
|
368 char_u *rsrc_bold_font_name; /* Resource bold font name */
|
|
369 char_u *rsrc_ital_font_name; /* Resource italic font name */
|
|
370 char_u *rsrc_boldital_font_name; /* Resource bold-italic font name */
|
|
371 char_u *rsrc_menu_font_name; /* Resource menu Font name */
|
|
372 Bool rsrc_rev_video; /* Use reverse video? */
|
|
373
|
|
374 char_u *geom; /* Geometry, eg "80x24" */
|
|
375 Bool color_approx; /* Some color was approximated */
|
|
376 #endif
|
|
377
|
|
378 #ifdef FEAT_GUI_GTK
|
|
379 int visibility; /* Is shell partially/fully obscured? */
|
|
380 GdkCursor *blank_pointer; /* Blank pointer */
|
|
381
|
|
382 /* X Resources */
|
|
383 char_u *geom; /* Geometry, eg "80x24" */
|
|
384
|
|
385 GtkWidget *mainwin; /* top level GTK window */
|
|
386 GtkWidget *formwin; /* manages all the windows below */
|
|
387 GtkWidget *drawarea; /* the "text" area */
|
|
388 # ifdef FEAT_MENU
|
|
389 GtkWidget *menubar; /* menubar */
|
|
390 # endif
|
|
391 # ifdef FEAT_TOOLBAR
|
|
392 GtkWidget *toolbar; /* toolbar */
|
|
393 # endif
|
|
394 # ifdef FEAT_GUI_GNOME
|
|
395 GtkWidget *menubar_h; /* menubar handle */
|
|
396 GtkWidget *toolbar_h; /* toolbar handle */
|
|
397 # endif
|
|
398 GdkColor *fgcolor; /* GDK-styled foreground color */
|
|
399 GdkColor *bgcolor; /* GDK-styled background color */
|
203
|
400 GdkColor *spcolor; /* GDK-styled special color */
|
7
|
401 # ifndef HAVE_GTK2
|
|
402 GuiFont current_font;
|
|
403 # endif
|
|
404 GdkGC *text_gc; /* cached GC for normal text */
|
|
405 # ifdef HAVE_GTK2
|
|
406 PangoContext *text_context; /* the context used for all text */
|
|
407 PangoFont *ascii_font; /* cached font for ASCII strings */
|
|
408 PangoGlyphString *ascii_glyphs; /* cached code point -> glyph map */
|
714
|
409 # endif
|
|
410 # ifdef FEAT_GUI_TABLINE
|
685
|
411 GtkWidget *tabline; /* tab pages line handle */
|
7
|
412 # endif
|
|
413
|
|
414 GtkAccelGroup *accel_group;
|
|
415 # ifndef HAVE_GTK2
|
|
416 GtkWidget *fontdlg; /* font selection dialog window */
|
|
417 char_u *fontname; /* font name from font selection dialog */
|
|
418 # endif
|
|
419 GtkWidget *filedlg; /* file selection dialog */
|
|
420 char_u *browse_fname; /* file name from filedlg */
|
|
421 #endif /* FEAT_GUI_GTK */
|
|
422
|
843
|
423 #if defined(FEAT_GUI_TABLINE) \
|
|
424 && (defined(FEAT_GUI_W32) || defined(FEAT_GUI_MOTIF))
|
|
425 int tabline_height;
|
|
426 #endif
|
|
427
|
7
|
428 #ifdef FEAT_FOOTER
|
|
429 int footer_height; /* height of the message footer */
|
|
430 #endif
|
|
431
|
|
432 #if defined(FEAT_TOOLBAR) \
|
|
433 && (defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MOTIF))
|
|
434 int toolbar_height; /* height of the toolbar */
|
|
435 #endif
|
|
436
|
|
437 #ifdef FEAT_BEVAL_TIP
|
|
438 /* Tooltip properties; also used for balloon evaluation */
|
|
439 char_u *rsrc_tooltip_font_name; /* tooltip font name */
|
|
440 char *rsrc_tooltip_fg_name; /* tooltip foreground color name */
|
|
441 char *rsrc_tooltip_bg_name; /* tooltip background color name */
|
|
442 guicolor_T tooltip_fg_pixel; /* tooltip foreground color */
|
|
443 guicolor_T tooltip_bg_pixel; /* tooltip background color */
|
|
444 XFontSet tooltip_fontset; /* tooltip fontset */
|
|
445 #endif
|
|
446
|
|
447 #ifdef FEAT_GUI_MSWIN
|
|
448 GuiFont currFont; /* Current font */
|
|
449 guicolor_T currFgColor; /* Current foreground text color */
|
|
450 guicolor_T currBgColor; /* Current background text color */
|
203
|
451 guicolor_T currSpColor; /* Current special text color */
|
7
|
452 #endif
|
|
453
|
|
454 #ifdef FEAT_GUI_MAC
|
|
455 WindowPtr VimWindow;
|
|
456 MenuHandle MacOSHelpMenu; /* Help menu provided by the MacOS */
|
|
457 int MacOSHelpItems; /* Nr of help-items supplied by MacOS */
|
|
458 int MacOSHaveCntxMenu; /* Contextual menu available */
|
|
459 WindowPtr wid; /* Window id of text area */
|
|
460 int visibility; /* Is window partially/fully obscured? */
|
|
461 #endif
|
|
462
|
|
463 #ifdef RISCOS
|
|
464 int window_handle;
|
|
465 char_u *window_title;
|
|
466 int window_title_size;
|
|
467 int fg_colour; /* in 0xBBGGRR format */
|
|
468 int bg_colour;
|
|
469 #endif
|
|
470
|
|
471 #ifdef FEAT_GUI_PHOTON
|
|
472 PtWidget_t *vimWindow; /* PtWindow */
|
|
473 PtWidget_t *vimTextArea; /* PtRaw */
|
|
474 PtWidget_t *vimContainer; /* PtPanel */
|
|
475 # if defined(FEAT_MENU) || defined(FEAT_TOOLBAR)
|
|
476 PtWidget_t *vimToolBarGroup;
|
|
477 # endif
|
|
478 # ifdef FEAT_MENU
|
|
479 PtWidget_t *vimMenuBar;
|
|
480 # endif
|
|
481 # ifdef FEAT_TOOLBAR
|
|
482 PtWidget_t *vimToolBar;
|
|
483 int toolbar_height;
|
|
484 # endif
|
|
485 PhEvent_t *event_buffer;
|
|
486 #endif
|
|
487
|
|
488 #ifdef FEAT_XIM
|
|
489 char *rsrc_input_method;
|
|
490 char *rsrc_preedit_type_name;
|
|
491 #endif
|
|
492 } gui_T;
|
|
493
|
|
494 extern gui_T gui; /* this is defined in gui.c */
|
|
495
|
|
496 /* definitions of available window positionings for gui_*_position_in_parent()
|
|
497 */
|
|
498 typedef enum
|
|
499 {
|
|
500 VW_POS_MOUSE,
|
|
501 VW_POS_CENTER,
|
|
502 VW_POS_TOP_CENTER
|
325
|
503 } gui_win_pos_T;
|
7
|
504
|
28
|
505 #ifdef FIND_REPLACE_DIALOG
|
7
|
506 /*
|
|
507 * Flags used to distinguish the different contexts in which the
|
|
508 * find/replace callback may be called.
|
|
509 */
|
|
510 # define FRD_FINDNEXT 1 /* Find next in find dialog */
|
|
511 # define FRD_R_FINDNEXT 2 /* Find next in repl dialog */
|
|
512 # define FRD_REPLACE 3 /* Replace once */
|
|
513 # define FRD_REPLACEALL 4 /* Replace remaining matches */
|
|
514 # define FRD_UNDO 5 /* Undo replaced text */
|
|
515 # define FRD_TYPE_MASK 7 /* Mask for the callback type */
|
|
516 /* Flags which change the way searching is done. */
|
|
517 # define FRD_WHOLE_WORD 0x08 /* match whole word only */
|
|
518 # define FRD_MATCH_CASE 0x10 /* match case */
|
|
519 #endif
|
836
|
520
|
|
521 #ifdef HAVE_GTK2
|
|
522 /*
|
|
523 * Convenience macros to convert from 'encoding' to 'termencoding' and
|
|
524 * vice versa. If no conversion is necessary the passed-in pointer is
|
|
525 * returned as is, without allocating any memory. Thus additional _FREE()
|
|
526 * macros are provided. The _FREE() macros also set the pointer to NULL,
|
|
527 * in order to avoid bugs due to illegal memory access only happening if
|
|
528 * 'encoding' != utf-8...
|
|
529 *
|
|
530 * Defining these macros as pure expressions looks a bit tricky but
|
|
531 * avoids depending on the context of the macro expansion. One of the
|
|
532 * rare occasions where the comma operator comes in handy :)
|
|
533 *
|
|
534 * Note: Do NOT keep the result around when handling control back to
|
|
535 * the main Vim! The user could change 'encoding' at any time.
|
|
536 */
|
|
537 # define CONVERT_TO_UTF8(String) \
|
|
538 ((output_conv.vc_type == CONV_NONE || (String) == NULL) \
|
|
539 ? (String) \
|
|
540 : string_convert(&output_conv, (String), NULL))
|
|
541
|
|
542 # define CONVERT_TO_UTF8_FREE(String) \
|
|
543 ((String) = ((output_conv.vc_type == CONV_NONE) \
|
|
544 ? (char_u *)NULL \
|
|
545 : (vim_free(String), (char_u *)NULL)))
|
|
546
|
|
547 # define CONVERT_FROM_UTF8(String) \
|
|
548 ((input_conv.vc_type == CONV_NONE || (String) == NULL) \
|
|
549 ? (String) \
|
|
550 : string_convert(&input_conv, (String), NULL))
|
|
551
|
|
552 # define CONVERT_FROM_UTF8_FREE(String) \
|
|
553 ((String) = ((input_conv.vc_type == CONV_NONE) \
|
|
554 ? (char_u *)NULL \
|
|
555 : (vim_free(String), (char_u *)NULL)))
|
|
556
|
|
557 #else
|
|
558 # define CONVERT_TO_UTF8(String) (String)
|
|
559 # define CONVERT_TO_UTF8_FREE(String) ((String) = (char_u *)NULL)
|
|
560 # define CONVERT_FROM_UTF8(String) (String)
|
|
561 # define CONVERT_FROM_UTF8_FREE(String) ((String) = (char_u *)NULL)
|
|
562 #endif /* HAVE_GTK2 */
|