annotate src/gui_athena.c @ 1827:0e4c64dfc611 v7.2.125

updated for version 7.2-125
author vimboss
date Tue, 24 Feb 2009 03:12:40 +0000
parents 73fe8baea242
children fc89a4f98a8b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 * GUI/Motif support by Robert Webb
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * Athena port by Bill Foster
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 * See README.txt for an overview of the Vim source code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 #include <X11/StringDefs.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 #include <X11/Intrinsic.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 # include <X11/neXtaw/Form.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 # include <X11/neXtaw/SimpleMenu.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 # include <X11/neXtaw/MenuButton.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 # include <X11/neXtaw/SmeBSB.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 # include <X11/neXtaw/SmeLine.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 # include <X11/neXtaw/Box.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 # include <X11/neXtaw/Dialog.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 # include <X11/neXtaw/Text.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 # include <X11/neXtaw/AsciiText.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 # include <X11/neXtaw/Scrollbar.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 # include <X11/Xaw/Form.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 # include <X11/Xaw/SimpleMenu.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 # include <X11/Xaw/MenuButton.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 # include <X11/Xaw/SmeBSB.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 # include <X11/Xaw/SmeLine.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 # include <X11/Xaw/Box.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 # include <X11/Xaw/Dialog.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 # include <X11/Xaw/Text.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 # include <X11/Xaw/AsciiText.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 #endif /* FEAT_GUI_NEXTAW */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 #ifndef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 # include "gui_at_sb.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 extern Widget vimShell;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 static Widget vimForm = (Widget)0;
215
a4029d1d83df updated for version 7.0061
vimboss
parents: 125
diff changeset
45 Widget textArea = (Widget)0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 static Widget menuBar = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 static XtIntervalId timer = 0; /* 0 = expired, otherwise active */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 /* Used to figure out menu ordering */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 static vimmenu_T *a_cur_menu = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 static Cardinal athena_calculate_ins_pos __ARGS((Widget));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 static Pixmap gui_athena_create_pullright_pixmap __ARGS((Widget));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 static void gui_athena_menu_timeout __ARGS((XtPointer, XtIntervalId *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 static void gui_athena_popup_callback __ARGS((Widget, XtPointer, XtPointer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 static void gui_athena_delayed_arm_action __ARGS((Widget, XEvent *, String *,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 static void gui_athena_popdown_submenus_action __ARGS((Widget, XEvent *,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 String *, Cardinal *));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 static XtActionsRec pullAction[2] = {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 { "menu-delayedpopup", (XtActionProc)gui_athena_delayed_arm_action},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 { "menu-popdownsubmenus", (XtActionProc)gui_athena_popdown_submenus_action}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 static void gui_mch_reset_focus __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 static Widget toolBar = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 static void gui_athena_scroll_cb_jump __ARGS((Widget, XtPointer, XtPointer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 static void gui_athena_scroll_cb_scroll __ARGS((Widget, XtPointer, XtPointer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_MENU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 static void gui_athena_menu_colors __ARGS((Widget id));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 static void gui_athena_scroll_colors __ARGS((Widget id));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 static XtTranslations popupTrans, parentTrans, menuTrans, supermenuTrans;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 static Pixmap pullerBitmap = None;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 static int puller_width = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 * Scrollbar callback (XtNjumpProc) for when the scrollbar is dragged with the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 * left or middle mouse button.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 gui_athena_scroll_cb_jump(w, client_data, call_data)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 XtPointer client_data, call_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 scrollbar_T *sb, *sb_info;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 long value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 sb = gui_find_scrollbar((long)client_data);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 if (sb == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 else if (sb->wp != NULL) /* Left or right scrollbar */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 * Careful: need to get scrollbar info out of first (left) scrollbar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 * for window, but keep real scrollbar too because we must pass it to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 * gui_drag_scrollbar().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 sb_info = &sb->wp->w_scrollbars[0];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 else /* Bottom scrollbar */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 sb_info = sb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 value = (long)(*((float *)call_data) * (float)(sb_info->max + 1) + 0.001);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 if (value > sb_info->max)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 value = sb_info->max;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 gui_drag_scrollbar(sb, value, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 * Scrollbar callback (XtNscrollProc) for paging up or down with the left or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 * right mouse buttons.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 gui_athena_scroll_cb_scroll(w, client_data, call_data)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 XtPointer client_data, call_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 scrollbar_T *sb, *sb_info;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 long value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 int data = (int)(long)call_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 int page;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 sb = gui_find_scrollbar((long)client_data);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 if (sb == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 if (sb->wp != NULL) /* Left or right scrollbar */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 * Careful: need to get scrollbar info out of first (left) scrollbar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 * for window, but keep real scrollbar too because we must pass it to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 * gui_drag_scrollbar().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 sb_info = &sb->wp->w_scrollbars[0];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 if (sb_info->size > 5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 page = sb_info->size - 2; /* use two lines of context */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 page = sb_info->size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 if (data < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 data = (data - gui.char_height + 1) / gui.char_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 if (data > -sb_info->size)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 data = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 data = -page;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 else if (data > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 data = (data + gui.char_height - 1) / gui.char_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 if (data < sb_info->size)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 data = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 data = page;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 switch (data)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 case ONE_LINE_DATA: data = 1; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 case -ONE_LINE_DATA: data = -1; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 case ONE_PAGE_DATA: data = page; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 case -ONE_PAGE_DATA: data = -page; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 case END_PAGE_DATA: data = sb_info->max; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 case -END_PAGE_DATA: data = -sb_info->max; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 default: data = 0; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 else /* Bottom scrollbar */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 sb_info = sb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 if (data < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 data = (data - gui.char_width + 1) / gui.char_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 if (data > -sb->size)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 data = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 else if (data > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 data = (data + gui.char_width - 1) / gui.char_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 if (data < sb->size)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 data = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 if (data < -1) /* page-width left */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 if (sb->size > 8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 data = -(sb->size - 5);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 data = -sb->size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 else if (data > 1) /* page-width right */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 if (sb->size > 8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 data = (sb->size - 5);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 data = sb->size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 value = sb_info->value + data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 if (value > sb_info->max)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 value = sb_info->max;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 else if (value < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 value = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 /* Update the bottom scrollbar an extra time (why is this needed?? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 if (sb->wp == NULL) /* Bottom scrollbar */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 gui_mch_set_scrollbar_thumb(sb, value, sb->size, sb->max);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 gui_drag_scrollbar(sb, value, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 * Create all the Athena widgets necessary.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 gui_x11_create_widgets()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 * We don't have any borders handled internally by the textArea to worry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 * about so only skip over the configured border width.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 gui.border_offset = gui.border_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 #if 0 /* not needed? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 XtInitializeWidgetClass(formWidgetClass);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 XtInitializeWidgetClass(boxWidgetClass);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 XtInitializeWidgetClass(coreWidgetClass);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 XtInitializeWidgetClass(menuButtonWidgetClass);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 XtInitializeWidgetClass(simpleMenuWidgetClass);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 XtInitializeWidgetClass(scrollbarWidgetClass);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 XtInitializeWidgetClass(vim_scrollbarWidgetClass);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 /* The form containing all the other widgets */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 vimForm = XtVaCreateManagedWidget("vimForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 formWidgetClass, vimShell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 XtNborderWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 gui_athena_scroll_colors(vimForm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 /* The top menu bar */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 menuBar = XtVaCreateManagedWidget("menuBar",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 boxWidgetClass, vimForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 XtNright, XtChainRight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 XtNinsertPosition, athena_calculate_ins_pos,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 gui_athena_menu_colors(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 if (gui.menu_fg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 XtVaSetValues(menuBar, XtNborderColor, gui.menu_fg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 /* Don't create it Managed, it will be managed when creating the first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 * item. Otherwise an empty toolbar shows up. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 toolBar = XtVaCreateWidget("toolBar",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 boxWidgetClass, vimForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 XtNright, XtChainRight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 XtNorientation, XtorientHorizontal,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 XtNhSpace, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 XtNvSpace, 3,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 XtNinsertPosition, athena_calculate_ins_pos,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 gui_athena_menu_colors(toolBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 /* The text area. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 textArea = XtVaCreateManagedWidget("textArea",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 coreWidgetClass, vimForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 XtNbackground, gui.back_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 XtNborderWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 * Install the callbacks.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 gui_x11_callbacks(textArea, vimForm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 popupTrans = XtParseTranslationTable(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 "<EnterWindow>: menu-popdownsubmenus() highlight() menu-delayedpopup()\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 "<LeaveWindow>: unhighlight()\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 "<BtnUp>: menu-popdownsubmenus() XtMenuPopdown() notify() unhighlight()\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 "<Motion>: highlight() menu-delayedpopup()");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 parentTrans = XtParseTranslationTable("<LeaveWindow>: unhighlight()");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 menuTrans = XtParseTranslationTable(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 "<EnterWindow>: menu-popdownsubmenus() highlight() menu-delayedpopup()\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 "<LeaveWindow>: menu-popdownsubmenus() XtMenuPopdown() unhighlight()\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 "<BtnUp>: notify() unhighlight()\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 "<BtnMotion>: highlight() menu-delayedpopup()");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 supermenuTrans = XtParseTranslationTable(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 "<EnterWindow>: menu-popdownsubmenus() highlight() menu-delayedpopup()\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 "<LeaveWindow>: unhighlight()\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 "<BtnUp>: menu-popdownsubmenus() XtMenuPopdown() notify() unhighlight()\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 "<BtnMotion>: highlight() menu-delayedpopup()");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 XtAppAddActions(XtWidgetToApplicationContext(vimForm), pullAction,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 XtNumber(pullAction));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 /* Pretend we don't have input focus, we will get an event if we do. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 gui.in_focus = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 * Calculates the Pixmap based on the size of the current menu font.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 static Pixmap
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 gui_athena_create_pullright_pixmap(w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 Pixmap retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 XFontSet font = None;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 XFontStruct *font = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 if (gui.menu_fontset == NOFONTSET)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 if (gui.menu_font == NOFONT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 XrmValue from, to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 WidgetList children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 Cardinal num_children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 from.size = strlen(from.addr = XtDefaultFontSet);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 to.addr = (XtPointer)&font;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 to.size = sizeof(XFontSet);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 from.size = strlen(from.addr = XtDefaultFont);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 to.addr = (XtPointer)&font;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 to.size = sizeof(XFontStruct *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 /* Assumption: The menuBar children will use the same font as the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 * pulldown menu items AND they will all be of type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 * XtNfont.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 XtVaGetValues(menuBar, XtNchildren, &children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 XtNnumChildren, &num_children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 if (XtConvertAndStore(w ? w :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 (num_children > 0) ? children[0] : menuBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 XtRString, &from,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 XtRFontSet, &to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 XtRFontStruct, &to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 ) == False)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 return None;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 /* "font" should now contain data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 font = (XFontSet)gui.menu_fontset;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 font = (XFontStruct *)gui.menu_font;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 int width, height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 GC draw_gc, undraw_gc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 XGCValues gc_values;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 XPoint points[3];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 height = fontset_height2(font);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 height = font->max_bounds.ascent + font->max_bounds.descent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 width = height - 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 puller_width = width + 4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 retval = XCreatePixmap(gui.dpy,DefaultRootWindow(gui.dpy),width,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 height, 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 gc_values.foreground = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 gc_values.background = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 draw_gc = XCreateGC(gui.dpy, retval,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 GCForeground | GCBackground,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 &gc_values);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 gc_values.foreground = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 gc_values.background = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 undraw_gc = XCreateGC(gui.dpy, retval,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 GCForeground | GCBackground,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 &gc_values);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 points[0].x = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 points[0].y = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 points[1].x = width - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 points[1].y = (height - 1) / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 points[2].x = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 points[2].y = height - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 XFillRectangle(gui.dpy, retval, undraw_gc, 0, 0, height, height);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 XFillPolygon(gui.dpy, retval, draw_gc, points, XtNumber(points),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 Convex, CoordModeOrigin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 XFreeGC(gui.dpy, draw_gc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 XFreeGC(gui.dpy, undraw_gc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 * Called when the GUI is not going to start after all.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 gui_x11_destroy_widgets()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 textArea = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 menuBar = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 toolBar = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 #if defined(FEAT_TOOLBAR) || defined(PROTO)
47
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
457 # include "gui_x11_pm.h"
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
458 # ifdef HAVE_X11_XPM_H
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
459 # include <X11/xpm.h>
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
460 # endif
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
461
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
462 static void createXpmImages __ARGS((char_u *path, char **xpm, Pixmap *sen));
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
463 static void get_toolbar_pixmap __ARGS((vimmenu_T *menu, Pixmap *sen));
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
464
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
465 /*
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
466 * Allocated a pixmap for toolbar menu "menu".
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
467 * Return in "sen".
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
468 */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
469 static void
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
470 get_toolbar_pixmap(menu, sen)
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
471 vimmenu_T *menu;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
472 Pixmap *sen;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
473 {
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
474 char_u buf[MAXPATHL]; /* buffer storing expanded pathname */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
475 char **xpm = NULL; /* xpm array */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
476
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
477 buf[0] = NUL; /* start with NULL path */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
478
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
479 if (menu->iconfile != NULL)
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
480 {
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
481 /* Use the "icon=" argument. */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
482 gui_find_iconfile(menu->iconfile, buf, "xpm");
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
483 createXpmImages(buf, NULL, sen);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
484
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
485 /* If it failed, try using the menu name. */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
486 if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK)
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
487 createXpmImages(buf, NULL, sen);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
488 if (*sen != (Pixmap)0)
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
489 return;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
490 }
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
491
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
492 if (menu->icon_builtin || gui_find_bitmap(menu->name, buf, "xpm") == FAIL)
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
493 {
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
494 if (menu->iconidx >= 0 && menu->iconidx
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
495 < (sizeof(built_in_pixmaps) / sizeof(built_in_pixmaps[0])))
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
496 xpm = built_in_pixmaps[menu->iconidx];
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
497 else
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
498 xpm = tb_blank_xpm;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
499 }
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
500
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
501 if (xpm != NULL || buf[0] != NUL)
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
502 createXpmImages(buf, xpm, sen);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
503 }
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
504
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
505 /*
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
506 * Read an Xpm file, doing color substitutions for the foreground and
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
507 * background colors. If there is an error reading a color xpm file,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
508 * drop back and read the monochrome file. If successful, create the
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
509 * insensitive Pixmap too.
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
510 */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
511 static void
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
512 createXpmImages(path, xpm, sen)
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
513 char_u *path;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
514 char **xpm;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
515 Pixmap *sen;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
516 {
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
517 Window rootWindow;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
518 XpmAttributes attrs;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
519 XpmColorSymbol color[5] =
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
520 {
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
521 {"none", "none", 0},
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
522 {"iconColor1", NULL, 0},
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
523 {"bottomShadowColor", NULL, 0},
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
524 {"topShadowColor", NULL, 0},
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
525 {"selectColor", NULL, 0}
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
526 };
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
527 int screenNum;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
528 int status;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
529 Pixmap mask;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
530 Pixmap map;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
531
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
532 gui_mch_get_toolbar_colors(
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
533 &color[BACKGROUND].pixel,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
534 &color[FOREGROUND].pixel,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
535 &color[BOTTOM_SHADOW].pixel,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
536 &color[TOP_SHADOW].pixel,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
537 &color[HIGHLIGHT].pixel);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
538
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
539 /* Setup the color subsititution table */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
540 attrs.valuemask = XpmColorSymbols;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
541 attrs.colorsymbols = color;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
542 attrs.numsymbols = 5;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
543
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
544 screenNum = DefaultScreen(gui.dpy);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
545 rootWindow = RootWindow(gui.dpy, screenNum);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
546
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
547 /* Create the "sensitive" pixmap */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
548 if (xpm != NULL)
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
549 status = XpmCreatePixmapFromData(gui.dpy, rootWindow, xpm,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
550 &map, &mask, &attrs);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
551 else
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
552 status = XpmReadFileToPixmap(gui.dpy, rootWindow, (char *)path,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
553 &map, &mask, &attrs);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
554 if (status == XpmSuccess && map != 0)
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
555 {
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
556 XGCValues gcvalues;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
557 GC back_gc;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
558 GC mask_gc;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
559
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
560 /* Need to create new Pixmaps with the mask applied. */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
561 gcvalues.foreground = color[BACKGROUND].pixel;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
562 back_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
563 mask_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
564 XSetClipMask(gui.dpy, mask_gc, mask);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
565
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
566 /* Create the "sensitive" pixmap. */
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
567 *sen = XCreatePixmap(gui.dpy, rootWindow,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
568 attrs.width, attrs.height,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
569 DefaultDepth(gui.dpy, screenNum));
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
570 XFillRectangle(gui.dpy, *sen, back_gc, 0, 0,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
571 attrs.width, attrs.height);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
572 XCopyArea(gui.dpy, map, *sen, mask_gc, 0, 0,
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
573 attrs.width, attrs.height, 0, 0);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
574
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
575 XFreeGC(gui.dpy, back_gc);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
576 XFreeGC(gui.dpy, mask_gc);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
577 XFreePixmap(gui.dpy, map);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
578 }
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
579 else
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
580 *sen = 0;
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
581
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
582 XpmFreeAttributes(&attrs);
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
583 }
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
584
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 gui_mch_set_toolbar_pos(x, y, w, h)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 int x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588 int y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 int w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 int h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 Dimension border;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 int height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 if (!XtIsManaged(toolBar)) /* nothing to do */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 XtUnmanageChild(toolBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 XtVaGetValues(toolBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 XtNborderWidth, &border,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 height = h - 2 * border;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 if (height < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603 height = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604 XtVaSetValues(toolBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605 XtNhorizDistance, x,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606 XtNvertDistance, y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 XtNwidth, w - 2 * border,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608 XtNheight, height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 XtManageChild(toolBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 gui_mch_set_text_area_pos(x, y, w, h)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 int x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 int y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 int w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 int h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
621 XtUnmanageChild(textArea);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622 XtVaSetValues(textArea,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623 XtNhorizDistance, x,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 XtNvertDistance, y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 XtNwidth, w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 XtNheight, h,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 XtManageChild(textArea);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 /* Give keyboard focus to the textArea instead of the toolbar. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631 gui_mch_reset_focus();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 * A toolbar button has been pushed; now reset the input focus
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 * such that the user can type page up/down etc. and have the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 * input go to the editor window, not the button
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642 gui_mch_reset_focus()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 XtSetKeyboardFocus(vimForm, textArea);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 gui_x11_set_back_color()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 if (textArea != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 XtVaSetValues(textArea,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 XtNbackground, gui.back_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 #if defined(FEAT_MENU) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660 * Menu stuff.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 static char_u *make_pull_name __ARGS((char_u * name));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664 static Widget get_popup_entry __ARGS((Widget w));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 static Widget submenu_widget __ARGS((Widget));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 static Boolean has_submenu __ARGS((Widget));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 static void gui_mch_submenu_change __ARGS((vimmenu_T *mp, int colors));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668 static void gui_athena_menu_font __ARGS((Widget id));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669 static Boolean gui_athena_menu_has_submenus __ARGS((Widget, Widget));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
672 gui_mch_enable_menu(flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673 int flag;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 if (flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677 XtManageChild(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 # ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679 if (XtIsManaged(toolBar))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681 XtVaSetValues(toolBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 XtNvertDistance, gui.menu_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 XtVaSetValues(textArea,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685 XtNvertDistance, gui.menu_height + gui.toolbar_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 XtUnmanageChild(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 # ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694 if (XtIsManaged(toolBar))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696 XtVaSetValues(toolBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 XtNvertDistance, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705 gui_mch_set_menu_pos(x, y, w, h)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 int x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707 int y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 int w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 int h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 Dimension border;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 int height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 XtUnmanageChild(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 XtVaGetValues(menuBar, XtNborderWidth, &border, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716 /* avoid trouble when there are no menu items, and h is 1 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 height = h - 2 * border;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718 if (height < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 height = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 XtVaSetValues(menuBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721 XtNhorizDistance, x,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 XtNvertDistance, y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 XtNwidth, w - 2 * border,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 XtNheight, height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 XtManageChild(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 * Used to calculate the insertion position of a widget with respect to its
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 * neighbors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733 * Valid range of return values is: 0 (beginning of children) to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 * numChildren (end of children).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 static Cardinal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 athena_calculate_ins_pos(widget)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 Widget widget;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740 /* Assume that if the parent of the vimmenu_T is NULL, then we can get
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 * to this menu by traversing "next", starting at "root_menu".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 * This holds true for popup menus, toolbar, and toplevel menu items.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 /* Popup menus: "id" is NULL. Only submenu_id is valid */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
748 /* Menus that are not toplevel: "parent" will be non-NULL, "id" &
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749 * "submenu_id" will be non-NULL.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752 /* Toplevel menus: "parent" is NULL, id is the widget of the menu item */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
753
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
754 WidgetList children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
755 Cardinal num_children = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757 Arg args[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758 int n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 XtSetArg(args[n], XtNchildren, &children); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762 XtSetArg(args[n], XtNnumChildren, &num_children); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 XtGetValues(XtParent(widget), args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 retval = num_children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 for (i = 0; i < num_children; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768 Widget current = children[i];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769 vimmenu_T *menu = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 for (menu = (a_cur_menu->parent == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772 ? root_menu : a_cur_menu->parent->children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 menu != NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774 menu = menu->next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 if (current == menu->id
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776 && a_cur_menu->priority < menu->priority
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 && i < retval)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 retval = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785 gui_mch_add_menu(menu, idx)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 vimmenu_T *menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787 int idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 char_u *pullright_name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 Dimension height, space, border;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 vimmenu_T *parent = menu->parent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793 a_cur_menu = menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794 if (parent == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 if (menu_is_popup(menu->dname))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
797 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
798 menu->submenu_id = XtVaCreatePopupShell((char *)menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
799 simpleMenuWidgetClass, vimShell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
800 XtNinsertPosition, athena_calculate_ins_pos,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801 XtNtranslations, popupTrans,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
802 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
803 gui_athena_menu_colors(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
804 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
805 else if (menu_is_menubar(menu->dname))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
807 menu->id = XtVaCreateManagedWidget((char *)menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808 menuButtonWidgetClass, menuBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 XtNmenuName, menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 XtNinternational, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814 if (menu->id == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 gui_athena_menu_colors(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 gui_athena_menu_font(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819 menu->submenu_id = XtVaCreatePopupShell((char *)menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 simpleMenuWidgetClass, menu->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 XtNinsertPosition, athena_calculate_ins_pos,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822 XtNtranslations, supermenuTrans,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824 gui_athena_menu_colors(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825 gui_athena_menu_font(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827 /* Don't update the menu height when it was set at a fixed value */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 if (!gui.menu_height_fixed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
829 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831 * When we add a top-level item to the menu bar, we can figure
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
832 * out how high the menu bar should be.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 XtVaGetValues(menuBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 XtNvSpace, &space,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 XtNborderWidth, &border,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 XtVaGetValues(menu->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839 XtNheight, &height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841 gui.menu_height = height + 2 * (space + border);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845 else if (parent->submenu_id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847 menu->id = XtVaCreateManagedWidget((char *)menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 smeBSBObjectClass, parent->submenu_id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 XtNlabel, menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 XtNinternational, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 if (menu->id == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
856 if (pullerBitmap == None)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857 pullerBitmap = gui_athena_create_pullright_pixmap(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859 XtVaSetValues(menu->id, XtNrightBitmap, pullerBitmap,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 /* If there are other menu items that are not pulldown menus,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862 * we need to adjust the right margins of those, too.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 WidgetList children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 Cardinal num_children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 XtVaGetValues(parent->submenu_id, XtNchildren, &children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 XtNnumChildren, &num_children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 for (i = 0; i < num_children; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874 XtVaSetValues(children[i],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 XtNrightMargin, puller_width,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 gui_athena_menu_colors(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 gui_athena_menu_font(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 pullright_name = make_pull_name(menu->dname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 menu->submenu_id = XtVaCreatePopupShell((char *)pullright_name,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 simpleMenuWidgetClass, parent->submenu_id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 XtNtranslations, menuTrans,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 gui_athena_menu_colors(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 gui_athena_menu_font(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 vim_free(pullright_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 XtAddCallback(menu->submenu_id, XtNpopupCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 gui_athena_popup_callback, (XtPointer)menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893 if (parent->parent != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894 XtOverrideTranslations(parent->submenu_id, parentTrans);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 a_cur_menu = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 /* Used to determine whether a SimpleMenu has pulldown entries.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 * "id" is the parent of the menu items.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 * Ignore widget "ignore" in the pane.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 gui_athena_menu_has_submenus(id, ignore)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 Widget id;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 Widget ignore;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 WidgetList children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 Cardinal num_children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 XtVaGetValues(id, XtNchildren, &children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 XtNnumChildren, &num_children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 for (i = 0; i < num_children; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 if (children[i] == ignore)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 if (has_submenu(children[i]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 return True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 return False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927 gui_athena_menu_font(id)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 Widget id;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931 if (gui.menu_fontset != NOFONTSET)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 if (XtIsManaged(id))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 XtUnmanageChild(id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 XtVaSetValues(id, XtNfontSet, gui.menu_fontset, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 /* We should force the widget to recalculate it's
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 * geometry now. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 XtManageChild(id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942 XtVaSetValues(id, XtNfontSet, gui.menu_fontset, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 if (has_submenu(id))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944 XtVaSetValues(id, XtNrightBitmap, pullerBitmap, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 int managed = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 if (gui.menu_font != NOFONT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
950 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 if (XtIsManaged(id))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 XtUnmanageChild(id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954 managed = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957 # ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958 if (gui.fontset != NOFONTSET)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 XtVaSetValues(id, XtNfontSet, gui.menu_font, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 XtVaSetValues(id, XtNfont, gui.menu_font, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 if (has_submenu(id))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 XtVaSetValues(id, XtNrightBitmap, pullerBitmap, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966 /* Force the widget to recalculate it's geometry now. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967 if (managed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968 XtManageChild(id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
969 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
970 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 gui_mch_new_menu_font()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977 Pixmap oldpuller = None;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979 if (menuBar == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
980 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 if (pullerBitmap != None)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 oldpuller = pullerBitmap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 pullerBitmap = gui_athena_create_pullright_pixmap(NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987 gui_mch_submenu_change(root_menu, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 /* Iterate through the menubar menu items and get the height of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991 * each one. The menu bar height is set to the maximum of all
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 * the heights.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 vimmenu_T *mp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 int max_height = 9999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 for (mp = root_menu; mp != NULL; mp = mp->next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 if (menu_is_menubar(mp->dname))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 Dimension height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003 XtVaGetValues(mp->id,
125
2a8d48bdc5de updated for version 7.0044
vimboss
parents: 47
diff changeset
1004 XtNheight, &height,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 if (height < max_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 max_height = height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1010 if (max_height != 9999)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 /* Don't update the menu height when it was set at a fixed value */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 if (!gui.menu_height_fixed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 Dimension space, border;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 XtVaGetValues(menuBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018 XtNvSpace, &space,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019 XtNborderWidth, &border,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021 gui.menu_height = max_height + 2 * (space + border);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 /* Now, to simulate the window being resized. Only, this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 * will resize the window to it's current state.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 * There has to be a better way, but I do not see one at this time.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 * (David Harrison)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 Position w, h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034 XtVaGetValues(vimShell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 XtNwidth, &w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 XtNheight, &h,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038 gui_resize_shell(w, h
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 #ifdef FEAT_XIM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 - xim_get_status_area_height()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 }
811
d2c169a725c8 updated for version 7.0c01
vimboss
parents: 405
diff changeset
1044 gui_set_shellsize(FALSE, TRUE, RESIZE_VERT);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 ui_new_shellsize();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 if (oldpuller != None)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 XFreePixmap(gui.dpy, oldpuller);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 #if defined(FEAT_BEVAL) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 gui_mch_new_tooltip_font()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 # ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 vimmenu_T *menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 if (toolBar == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 menu = gui_find_menu((char_u *)"ToolBar");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 if (menu != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 gui_mch_submenu_change(menu, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 gui_mch_new_tooltip_colors()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 # ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 vimmenu_T *menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 if (toolBar == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 menu = gui_find_menu((char_u *)"ToolBar");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076 if (menu != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 gui_mch_submenu_change(menu, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 gui_mch_submenu_change(menu, colors)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 vimmenu_T *menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 int colors; /* TRUE for colors, FALSE for font */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1086 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1087 vimmenu_T *mp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 for (mp = menu; mp != NULL; mp = mp->next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 if (mp->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 if (colors)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095 gui_athena_menu_colors(mp->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 /* For a toolbar item: Free the pixmap and allocate a new one,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098 * so that the background color is right. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 if (mp->image != (Pixmap)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 XFreePixmap(gui.dpy, mp->image);
47
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
1102 get_toolbar_pixmap(mp, &mp->image);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103 if (mp->image != (Pixmap)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 XtVaSetValues(mp->id, XtNbitmap, mp->image, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 # ifdef FEAT_BEVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 /* If we have a tooltip, then we need to change it's colors */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 if (mp->tip != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111 Arg args[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113 args[0].name = XtNbackground;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 args[0].value = gui.tooltip_bg_pixel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 args[1].name = XtNforeground;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116 args[1].value = gui.tooltip_fg_pixel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1117 XtSetValues(mp->tip->balloonLabel, &args[0], XtNumber(args));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1119 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1120 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 gui_athena_menu_font(mp->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1125 #ifdef FEAT_BEVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1126 /* If we have a tooltip, then we need to change it's font */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1127 /* Assume XtNinternational == True (in createBalloonEvalWindow)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1128 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1129 if (mp->tip != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131 Arg args[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1133 args[0].name = XtNfontSet;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134 args[0].value = (XtArgVal)gui.tooltip_fontset;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 XtSetValues(mp->tip->balloonLabel, &args[0], XtNumber(args));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1137 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1138 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1139 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141 if (mp->children != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 /* Set the colors/font for the tear off widget */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 if (mp->submenu_id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 if (colors)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 gui_athena_menu_colors(mp->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 gui_athena_menu_font(mp->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 /* Set the colors for the children */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152 gui_mch_submenu_change(mp->children, colors);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158 * Make a submenu name into a pullright name.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 * Replace '.' by '_', can't include '.' in the submenu name.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161 static char_u *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162 make_pull_name(name)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163 char_u * name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 char_u *pname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168 pname = vim_strnsave(name, STRLEN(name) + strlen("-pullright"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 if (pname != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 strcat((char *)pname, "-pullright");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 while ((p = vim_strchr(pname, '.')) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173 *p = '_';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1174 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 return pname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1179 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 gui_mch_add_menu_item(menu, idx)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 vimmenu_T *menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182 int idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184 vimmenu_T *parent = menu->parent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 a_cur_menu = menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 # ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188 if (menu_is_toolbar(parent->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190 WidgetClass type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 Arg args[21];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195 if (menu_is_separator(menu->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 XtSetArg(args[n], XtNlabel, ""); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198 XtSetArg(args[n], XtNborderWidth, 0); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201 {
47
eff3887963cc updated for version 7.0028
vimboss
parents: 7
diff changeset
1202 get_toolbar_pixmap(menu, &menu->image);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 XtSetArg(args[n], XtNlabel, menu->dname); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204 XtSetArg(args[n], XtNinternalHeight, 1); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 XtSetArg(args[n], XtNinternalWidth, 1); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 XtSetArg(args[n], XtNborderWidth, 1); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207 if (menu->image != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 XtSetArg(args[n], XtNbitmap, menu->image); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210 XtSetArg(args[n], XtNhighlightThickness, 0); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211 type = commandWidgetClass;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 /* TODO: figure out the position in the toolbar?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213 * This currently works fine for the default toolbar, but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214 * what if we add/remove items during later runtime?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217 /* NOTE: "idx" isn't used here. The position is calculated by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218 * athena_calculate_ins_pos(). The position it calculates
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219 * should be equal to "idx".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221 /* TODO: Could we just store "idx" and use that as the child
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1222 * placement?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 if (menu->id == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227 menu->id = XtCreateManagedWidget((char *)menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1228 type, toolBar, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1229 XtAddCallback(menu->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230 XtNcallback, gui_x11_menu_cb, menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1232 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1233 XtSetValues(menu->id, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1234 gui_athena_menu_colors(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236 #ifdef FEAT_BEVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1237 gui_mch_menu_set_tip(menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240 menu->parent = parent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241 menu->submenu_id = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242 if (!XtIsManaged(toolBar)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243 && vim_strchr(p_go, GO_TOOLBAR) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244 gui_mch_show_toolbar(TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 gui.toolbar_height = gui_mch_compute_toolbar_height();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1247 } /* toolbar menu item */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1248 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1249
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1250 /* Add menu separator */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1251 if (menu_is_separator(menu->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1252 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1253 menu->submenu_id = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1254 menu->id = XtVaCreateManagedWidget((char *)menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1255 smeLineObjectClass, parent->submenu_id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1256 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1257 if (menu->id == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1258 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1259 gui_athena_menu_colors(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1261 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1262 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1263 if (parent != NULL && parent->submenu_id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1264 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1265 menu->submenu_id = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1266 menu->id = XtVaCreateManagedWidget((char *)menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1267 smeBSBObjectClass, parent->submenu_id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1268 XtNlabel, menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270 XtNinternational, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1272 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1273 if (menu->id == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1274 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1275
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1276 /* If there are other "pulldown" items in this pane, then adjust
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1277 * the right margin to accomodate the arrow pixmap, otherwise
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1278 * the right margin will be the same as the left margin.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1279 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1280 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1281 Dimension left_margin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1283 XtVaGetValues(menu->id, XtNleftMargin, &left_margin, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284 XtVaSetValues(menu->id, XtNrightMargin,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1285 gui_athena_menu_has_submenus(parent->submenu_id, NULL) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286 puller_width :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287 left_margin,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1288 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1289 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1290
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1291 gui_athena_menu_colors(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1292 gui_athena_menu_font(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1293 XtAddCallback(menu->id, XtNcallback, gui_x11_menu_cb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1294 (XtPointer)menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1295 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1296 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1297 a_cur_menu = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1298 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1299
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1300 #if defined(FEAT_TOOLBAR) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1301 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1302 gui_mch_show_toolbar(int showit)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1303 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1304 Cardinal numChildren; /* how many children toolBar has */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1305
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1306 if (toolBar == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1307 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1308 XtVaGetValues(toolBar, XtNnumChildren, &numChildren, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1309 if (showit && numChildren > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1310 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1311 /* Assume that we want to show the toolbar if p_toolbar contains valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1312 * option settings, therefore p_toolbar must not be NULL.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1313 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1314 WidgetList children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1315
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1316 XtVaGetValues(toolBar, XtNchildren, &children, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1317 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1318 void (*action)(BalloonEval *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1319 int text = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1320
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1321 if (strstr((const char *)p_toolbar, "tooltips"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1322 action = &gui_mch_enable_beval_area;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1323 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1324 action = &gui_mch_disable_beval_area;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1325 if (strstr((const char *)p_toolbar, "text"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1326 text = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1327 else if (strstr((const char *)p_toolbar, "icons"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1328 text = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1329 if (text != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1330 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1331 vimmenu_T *toolbar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1332 vimmenu_T *cur;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1333
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1334 for (toolbar = root_menu; toolbar; toolbar = toolbar->next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1335 if (menu_is_toolbar(toolbar->dname))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1336 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1337 /* Assumption: toolbar is NULL if there is no toolbar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1338 * otherwise it contains the toolbar menu structure.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1339 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1340 * Assumption: "numChildren" == the number of items in the list
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1341 * of items beginning with toolbar->children.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1342 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1343 if (toolbar)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1344 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1345 for (cur = toolbar->children; cur; cur = cur->next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1346 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1347 Arg args[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1348 int n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1349
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1350 /* Enable/Disable tooltip (OK to enable while currently
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1351 * enabled)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1352 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1353 if (cur->tip != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1354 (*action)(cur->tip);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1355 if (text == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1356 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1357 XtSetArg(args[n], XtNbitmap, None);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1358 n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1359 XtSetArg(args[n], XtNlabel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1360 menu_is_separator(cur->name) ? "" :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1361 (char *)cur->dname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1362 n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1363 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1364 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1365 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1366 XtSetArg(args[n], XtNbitmap, cur->image);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1367 n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1368 XtSetArg(args[n], XtNlabel, (cur->image == None) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1369 menu_is_separator(cur->name) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1370 "" :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1371 (char *)cur->dname
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1372 :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1373 (char *)None);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1374 n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1375 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1376 if (cur->id != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1377 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1378 XtUnmanageChild(cur->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1379 XtSetValues(cur->id, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1380 XtManageChild(cur->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1381 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1382 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1383 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1384 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1385 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1386 gui.toolbar_height = gui_mch_compute_toolbar_height();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1387 XtManageChild(toolBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1388 if (XtIsManaged(menuBar))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1389 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1390 XtVaSetValues(textArea,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1391 XtNvertDistance, gui.toolbar_height + gui.menu_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1392 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1393 XtVaSetValues(toolBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1394 XtNvertDistance, gui.menu_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1395 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1396 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1397 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1398 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1399 XtVaSetValues(textArea,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1400 XtNvertDistance, gui.toolbar_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1401 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1402 XtVaSetValues(toolBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1403 XtNvertDistance, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1404 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1405 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1406 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1407 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1408 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1409 gui.toolbar_height = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1410 if (XtIsManaged(menuBar))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1411 XtVaSetValues(textArea,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1412 XtNvertDistance, gui.menu_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1413 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1414 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1415 XtVaSetValues(textArea,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1416 XtNvertDistance, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1417 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1418
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1419 XtUnmanageChild(toolBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1420 }
811
d2c169a725c8 updated for version 7.0c01
vimboss
parents: 405
diff changeset
1421 gui_set_shellsize(FALSE, FALSE, RESIZE_VERT);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1422 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1424
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1425 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1426 gui_mch_compute_toolbar_height()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1427 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1428 Dimension height; /* total Toolbar height */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1429 Dimension whgt; /* height of each widget */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1430 Dimension marginHeight; /* XmNmarginHeight of toolBar */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1431 Dimension shadowThickness; /* thickness of Xtparent(toolBar) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1432 WidgetList children; /* list of toolBar's children */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1433 Cardinal numChildren; /* how many children toolBar has */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1434 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1435
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1436 height = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1437 shadowThickness = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1438 marginHeight = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1439 if (toolBar != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1440 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1441 XtVaGetValues(toolBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1442 XtNborderWidth, &shadowThickness,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1443 XtNvSpace, &marginHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1444 XtNchildren, &children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1445 XtNnumChildren, &numChildren,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1446 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1447 for (i = 0; i < numChildren; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1448 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 whgt = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1450
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 XtVaGetValues(children[i], XtNheight, &whgt, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452 if (height < whgt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 height = whgt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457 return (int)(height + (marginHeight << 1) + (shadowThickness << 1));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1458 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1460 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461 gui_mch_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 Pixel *bgp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463 Pixel *fgp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464 Pixel *bsp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1465 Pixel *tsp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1466 Pixel *hsp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1467 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1468 XtVaGetValues(toolBar, XtNbackground, bgp, XtNborderColor, fgp, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1469 *bsp = *bgp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1470 *tsp = *fgp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1471 *hsp = *tsp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1472 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1473 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1474
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1475
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1476 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1477 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1478 gui_mch_toggle_tearoffs(enable)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1479 int enable;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1480 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1481 /* no tearoff menus */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1482 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1483
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1484 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1485 gui_mch_new_menu_colors()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1486 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1487 if (menuBar == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1488 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1489 if (gui.menu_fg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1490 XtVaSetValues(menuBar, XtNborderColor, gui.menu_fg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1491 gui_athena_menu_colors(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1492 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1493 gui_athena_menu_colors(toolBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1494 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1495
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1496 gui_mch_submenu_change(root_menu, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1497 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1498
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1499 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1500 * Destroy the machine specific menu widget.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1501 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1502 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1503 gui_mch_destroy_menu(menu)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1504 vimmenu_T *menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1505 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1506 Widget parent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1507
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1508 /* There is no item for the toolbar. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1509 if (menu->id == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1510 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1512 parent = XtParent(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1513
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1514 /* When removing the last "pulldown" menu item from a pane, adjust the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1515 * right margins of the remaining widgets.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1516 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1517 if (menu->submenu_id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1518 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1519 /* Go through the menu items in the parent of this item and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1520 * adjust their margins, if necessary.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1521 * This takes care of the case when we delete the last menu item in a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1522 * pane that has a submenu. In this case, there will be no arrow
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1523 * pixmaps shown anymore.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1524 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1525 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1526 WidgetList children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1527 Cardinal num_children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1528 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1529 Dimension right_margin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1530 Boolean get_left_margin = False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1531
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1532 XtVaGetValues(parent, XtNchildren, &children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1533 XtNnumChildren, &num_children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1534 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1535 if (gui_athena_menu_has_submenus(parent, menu->id))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1536 right_margin = puller_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1537 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1538 get_left_margin = True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1539
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1540 for (i = 0; i < num_children; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1541 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1542 if (children[i] == menu->id)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1543 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1544 if (get_left_margin == True)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1545 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1546 Dimension left_margin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1547
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1548 XtVaGetValues(children[i], XtNleftMargin, &left_margin,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1549 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1550 XtVaSetValues(children[i], XtNrightMargin, left_margin,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1551 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1552 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1553 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1554 XtVaSetValues(children[i], XtNrightMargin, right_margin,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1555 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1556 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1557 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1558 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1559 /* Please be sure to destroy the parent widget first (i.e. menu->id).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1560 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1561 * This code should be basically identical to that in the file gui_motif.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1562 * because they are both Xt based.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1563 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1564 if (menu->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1565 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1566 Cardinal num_children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1567 Dimension height, space, border;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1568
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1569 XtVaGetValues(menuBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1570 XtNvSpace, &space,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1571 XtNborderWidth, &border,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1572 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1573 XtVaGetValues(menu->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1574 XtNheight, &height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1575 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1576 #if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1577 if (parent == toolBar && menu->tip != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1578 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1579 /* We try to destroy this before the actual menu, because there are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1580 * callbacks, etc. that will be unregistered during the tooltip
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1581 * destruction.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1582 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1583 * If you call "gui_mch_destroy_beval_area()" after destroying
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1584 * menu->id, then the tooltip's window will have already been
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1585 * deallocated by Xt, and unknown behaviour will ensue (probably
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1586 * a core dump).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1587 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1588 gui_mch_destroy_beval_area(menu->tip);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1589 menu->tip = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1590 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1591 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1592 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1593 * This is a hack to stop the Athena simpleMenuWidget from getting a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1594 * BadValue error when a menu's last child is destroyed. We check to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1595 * see if this is the last child and if so, don't delete it. The parent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1596 * will be deleted soon anyway, and it will delete it's children like
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1597 * all good widgets do.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1598 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1599 /* NOTE: The cause of the BadValue X Protocol Error is because when the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1600 * last child is destroyed, it is first unmanaged, thus causing a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1601 * geometry resize request from the parent Shell widget.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1602 * Since the Shell widget has no more children, it is resized to have
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1603 * width/height of 0. XConfigureWindow() is then called with the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1604 * width/height of 0, which generates the BadValue.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1605 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1606 * This happens in phase two of the widget destruction process.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1607 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1608 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1609 if (parent != menuBar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1610 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1611 && parent != toolBar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1612 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1613 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1614 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1615 XtVaGetValues(parent, XtNnumChildren, &num_children, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1616 if (num_children > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1617 XtDestroyWidget(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1618 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1619 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1620 XtDestroyWidget(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1621 menu->id = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1622 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1623
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1624 if (parent == menuBar)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1625 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1626 if (!gui.menu_height_fixed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1627 gui.menu_height = height + 2 * (space + border);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1628 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1629 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1630 else if (parent == toolBar)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1631 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1632 /* When removing last toolbar item, don't display the toolbar. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1633 XtVaGetValues(toolBar, XtNnumChildren, &num_children, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1634 if (num_children == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1635 gui_mch_show_toolbar(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1636 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1637 gui.toolbar_height = gui_mch_compute_toolbar_height();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1638 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1639 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1640 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1641 if (menu->submenu_id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1642 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1643 XtDestroyWidget(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1644 menu->submenu_id = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1645 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1646 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1647
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1648 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1649 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1650 gui_athena_menu_timeout(client_data, id)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1651 XtPointer client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1652 XtIntervalId *id;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1653 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1654 Widget w = (Widget)client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1655 Widget popup;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1656
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1657 timer = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1658 if (XtIsSubclass(w,smeBSBObjectClass))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1659 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1660 Pixmap p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1661
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1662 XtVaGetValues(w, XtNrightBitmap, &p, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1663 if ((p != None) && (p != XtUnspecifiedPixmap))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1664 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1665 /* We are dealing with an item that has a submenu */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1666 popup = get_popup_entry(XtParent(w));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1667 if (popup == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1668 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1669 XtPopup(popup, XtGrabNonexclusive);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1670 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1671 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1672 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1673
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1674 /* This routine is used to calculate the position (in screen coordinates)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1675 * where a submenu should appear relative to the menu entry that popped it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1676 * up. It should appear even with and just slightly to the left of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1677 * rightmost end of the menu entry that caused the popup.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1678 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1679 * This is called when XtPopup() is called.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1680 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1681 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1682 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1683 gui_athena_popup_callback(w, client_data, call_data)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1684 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1685 XtPointer client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1686 XtPointer call_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1687 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1688 /* Assumption: XtIsSubclass(XtParent(w),simpleMenuWidgetClass) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1689 vimmenu_T *menu = (vimmenu_T *)client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1690 Dimension width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1691 Position root_x, root_y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1692
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1693 /* First, popdown any siblings that may have menus popped up */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1694 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1695 vimmenu_T *i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1696
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1697 for (i = menu->parent->children; i != NULL; i = i->next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1698 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1699 if (i->submenu_id != NULL && XtIsManaged(i->submenu_id))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1700 XtPopdown(i->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1701 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1702 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1703 XtVaGetValues(XtParent(w),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1704 XtNwidth, &width,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1705 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1706 /* Assumption: XawSimpleMenuGetActiveEntry(XtParent(w)) == menu->id */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1707 /* i.e. This IS the active entry */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1708 XtTranslateCoords(menu->id,width - 5, 0, &root_x, &root_y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1709 XtVaSetValues(w, XtNx, root_x,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1710 XtNy, root_y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1711 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1712 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1713
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1714 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1715 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1716 gui_athena_popdown_submenus_action(w, event, args, nargs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1717 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1718 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1719 String *args;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1720 Cardinal *nargs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1721 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1722 WidgetList children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1723 Cardinal num_children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1724
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1725 XtVaGetValues(w, XtNchildren, &children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1726 XtNnumChildren, &num_children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1727 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1728 for (; num_children > 0; --num_children)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1729 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1730 Widget child = children[num_children - 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1731
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1732 if (has_submenu(child))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1733 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1734 Widget temp_w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1735
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1736 temp_w = submenu_widget(child);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1737 gui_athena_popdown_submenus_action(temp_w,event,args,nargs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1738 XtPopdown(temp_w);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1739 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1740 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1741 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1742
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1743 /* Used to determine if the given widget has a submenu that can be popped up. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1744 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1745 has_submenu(widget)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1746 Widget widget;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1747 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1748 if ((widget != NULL) && XtIsSubclass(widget,smeBSBObjectClass))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1749 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1750 Pixmap p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1751
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1752 XtVaGetValues(widget, XtNrightBitmap, &p, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1753 if ((p != None) && (p != XtUnspecifiedPixmap))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1754 return True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1755 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1756 return False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1757 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1758
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1759 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1760 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761 gui_athena_delayed_arm_action(w, event, args, nargs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1762 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1763 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1764 String *args;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1765 Cardinal *nargs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1766 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 Dimension width, height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1769 if (event->type != MotionNotify)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1770 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1771
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772 XtVaGetValues(w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1773 XtNwidth, &width,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1774 XtNheight, &height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1775 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1776
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1777 if (event->xmotion.x >= (int)width || event->xmotion.y >= (int)height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1778 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1779
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1780 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1781 static Widget previous_active_widget = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1782 Widget current;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1783
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1784 current = XawSimpleMenuGetActiveEntry(w);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1785 if (current != previous_active_widget)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1786 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1787 if (timer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1788 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1789 /* If the timeout hasn't been triggered, remove it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1790 XtRemoveTimeOut(timer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1791 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1792 gui_athena_popdown_submenus_action(w,event,args,nargs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1793 if (has_submenu(current))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1794 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1795 XtAppAddTimeOut(XtWidgetToApplicationContext(w), 600L,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1796 gui_athena_menu_timeout,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1797 (XtPointer)current);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1798 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799 previous_active_widget = current;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1800 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1801 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1802 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1803
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 static Widget
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805 get_popup_entry(w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1806 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1807 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1808 Widget menuw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1810 /* Get the active entry for the current menu */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1811 if ((menuw = XawSimpleMenuGetActiveEntry(w)) == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1812 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1813
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1814 return submenu_widget(menuw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1815 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1816
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1817 /* Given the widget that has been determined to have a submenu, return the submenu widget
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1818 * that is to be popped up.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1819 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1820 static Widget
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1821 submenu_widget(widget)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1822 Widget widget;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1824 /* Precondition: has_submenu(widget) == True
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1825 * XtIsSubclass(XtParent(widget),simpleMenuWidgetClass) == True
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1827
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1828 char_u *pullright_name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1829 Widget popup;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1830
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1831 pullright_name = make_pull_name((char_u *)XtName(widget));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1832 popup = XtNameToWidget(XtParent(widget), (char *)pullright_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1833 vim_free(pullright_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835 return popup;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 /* Postcondition: (popup != NULL) implies
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1837 * (XtIsSubclass(popup,simpleMenuWidgetClass) == True) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1838 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1839
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1840 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1841 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1842 gui_mch_show_popupmenu(menu)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1843 vimmenu_T *menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1844 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1845 int rootx, rooty, winx, winy;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1846 Window root, child;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1847 unsigned int mask;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1848
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1849 if (menu->submenu_id == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1850 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1851
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1852 /* Position the popup menu at the pointer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1853 if (XQueryPointer(gui.dpy, XtWindow(vimShell), &root, &child,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1854 &rootx, &rooty, &winx, &winy, &mask))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1855 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1856 rootx -= 30;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1857 if (rootx < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1858 rootx = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1859 rooty -= 5;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1860 if (rooty < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1861 rooty = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1862 XtVaSetValues(menu->submenu_id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1863 XtNx, rootx,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1864 XtNy, rooty,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1865 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1866 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1867
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1868 XtOverrideTranslations(menu->submenu_id, popupTrans);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1869 XtPopupSpringLoaded(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1870 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1871
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1872 #endif /* FEAT_MENU */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1873
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1874 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1875 * Set the menu and scrollbar colors to their default values.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1876 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1877 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1878 gui_mch_def_colors()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1879 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1880 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1881 * Get the colors ourselves. Using the automatic conversion doesn't
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1882 * handle looking for approximate colors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1883 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1884 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1885 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1886 gui.menu_fg_pixel = gui_get_color((char_u *)gui.rsrc_menu_fg_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1887 gui.menu_bg_pixel = gui_get_color((char_u *)gui.rsrc_menu_bg_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1888 gui.scroll_fg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_fg_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1889 gui.scroll_bg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_bg_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1890 #ifdef FEAT_BEVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1891 gui.tooltip_fg_pixel = gui_get_color((char_u *)gui.rsrc_tooltip_fg_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1892 gui.tooltip_bg_pixel = gui_get_color((char_u *)gui.rsrc_tooltip_bg_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1893 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1894 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1895 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1896
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1897
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1898 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1899 * Scrollbar stuff.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1900 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1901
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1902 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1903 gui_mch_set_scrollbar_thumb(sb, val, size, max)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1904 scrollbar_T *sb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1905 long val;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1906 long size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1907 long max;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1908 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1909 double v, s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1910
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1911 if (sb->id == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1912 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1913
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1914 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1915 * Athena scrollbar must go from 0.0 to 1.0.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1916 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1917 if (max == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1918 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1919 /* So you can't scroll it at all (normally it scrolls past end) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1920 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1921 XawScrollbarSetThumb(sb->id, 0.0, 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1922 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1923 vim_XawScrollbarSetThumb(sb->id, 0.0, 1.0, 0.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1924 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1925 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1926 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1927 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1928 v = (double)val / (double)(max + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1929 s = (double)size / (double)(max + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1930 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1931 XawScrollbarSetThumb(sb->id, v, s);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1932 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1933 vim_XawScrollbarSetThumb(sb->id, v, s, 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1934 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1935 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1936 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1937
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1938 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1939 gui_mch_set_scrollbar_pos(sb, x, y, w, h)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1940 scrollbar_T *sb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1941 int x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1942 int y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1943 int w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1944 int h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1945 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1946 if (sb->id == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1947 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1948
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1949 XtUnmanageChild(sb->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1950 XtVaSetValues(sb->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1951 XtNhorizDistance, x,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1952 XtNvertDistance, y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1953 XtNwidth, w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1954 XtNheight, h,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1955 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1956 XtManageChild(sb->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1957 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1958
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1959 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1960 gui_mch_enable_scrollbar(sb, flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1961 scrollbar_T *sb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1962 int flag;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1963 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1964 if (sb->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1965 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1966 if (flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1967 XtManageChild(sb->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1968 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1969 XtUnmanageChild(sb->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1970 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1971 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1972
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1973 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1974 gui_mch_create_scrollbar(sb, orient)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1975 scrollbar_T *sb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1976 int orient; /* SBAR_VERT or SBAR_HORIZ */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1977 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1978 sb->id = XtVaCreateWidget("scrollBar",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1979 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1980 scrollbarWidgetClass, vimForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1981 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1982 vim_scrollbarWidgetClass, vimForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1983 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1984 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1985 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1986 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1987 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1988 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1989 XtNborderWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1990 XtNorientation, (orient == SBAR_VERT) ? XtorientVertical
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1991 : XtorientHorizontal,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1992 XtNforeground, gui.scroll_fg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1993 XtNbackground, gui.scroll_bg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1994 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1995 if (sb->id == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1996 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1997
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1998 XtAddCallback(sb->id, XtNjumpProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1999 gui_athena_scroll_cb_jump, (XtPointer)sb->ident);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2000 XtAddCallback(sb->id, XtNscrollProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2001 gui_athena_scroll_cb_scroll, (XtPointer)sb->ident);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2002
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2003 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2004 XawScrollbarSetThumb(sb->id, 0.0, 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2005 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2006 vim_XawScrollbarSetThumb(sb->id, 0.0, 1.0, 0.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2007 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2008 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2009
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2010 #if defined(FEAT_WINDOWS) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2011 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2012 gui_mch_destroy_scrollbar(sb)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2013 scrollbar_T *sb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2014 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2015 if (sb->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2016 XtDestroyWidget(sb->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2017 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2018 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2019
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2020 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2021 gui_mch_set_scrollbar_colors(sb)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2022 scrollbar_T *sb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2023 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2024 if (sb->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2025 XtVaSetValues(sb->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2026 XtNforeground, gui.scroll_fg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2027 XtNbackground, gui.scroll_bg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2028 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2029
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2030 /* This is needed for the rectangle below the vertical scrollbars. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2031 if (sb == &gui.bottom_sbar && vimForm != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2032 gui_athena_scroll_colors(vimForm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2033 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2034
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2035 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2036 * Miscellaneous stuff:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2037 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2038 Window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2039 gui_x11_get_wid()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2040 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2041 return XtWindow(textArea);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2042 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2043
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2044 #if defined(FEAT_BROWSE) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2045 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2046 * Put up a file requester.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2047 * Returns the selected name in allocated memory, or NULL for Cancel.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2048 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2049 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2050 char_u *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2051 gui_mch_browse(saving, title, dflt, ext, initdir, filter)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2052 int saving; /* select file to write */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2053 char_u *title; /* not used (title for the window) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2054 char_u *dflt; /* not used (default name) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2055 char_u *ext; /* not used (extension added) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2056 char_u *initdir; /* initial directory, NULL for current dir */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2057 char_u *filter; /* not used (file name filter) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2058 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2059 Position x, y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2060 char_u dirbuf[MAXPATHL];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2061
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2062 /* Concatenate "initdir" and "dflt". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2063 if (initdir == NULL || *initdir == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2064 mch_dirname(dirbuf, MAXPATHL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2065 else if (STRLEN(initdir) + 2 < MAXPATHL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2066 STRCPY(dirbuf, initdir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2067 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2068 dirbuf[0] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2069 if (dflt != NULL && *dflt != NUL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2070 && STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2071 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2072 add_pathsep(dirbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2073 STRCAT(dirbuf, dflt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2074 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2075
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2076 /* Position the file selector just below the menubar */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2077 XtTranslateCoords(vimShell, (Position)0, (Position)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2078 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2079 gui.menu_height
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2080 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2081 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2082 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2083 , &x, &y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2084 return (char_u *)vim_SelFile(vimShell, (char *)title, (char *)dirbuf,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2085 NULL, (int)x, (int)y, gui.menu_fg_pixel, gui.menu_bg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2086 gui.scroll_fg_pixel, gui.scroll_bg_pixel);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2087 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2088 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2089
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2090 #if defined(FEAT_GUI_DIALOG) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2091
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2092 static int dialogStatus;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2093 static Atom dialogatom;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2094
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2095 static void keyhit_callback __ARGS((Widget w, XtPointer client_data, XEvent *event, Boolean *cont));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2096 static void butproc __ARGS((Widget w, XtPointer client_data, XtPointer call_data));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2097 static void dialog_wm_handler __ARGS((Widget w, XtPointer client_data, XEvent *event, Boolean *dum));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2098
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2099 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2100 * Callback function for the textfield. When CR is hit this works like
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2101 * hitting the "OK" button, ESC like "Cancel".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2102 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2103 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2104 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2105 keyhit_callback(w, client_data, event, cont)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2106 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2107 XtPointer client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2108 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2109 Boolean *cont;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2110 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2111 char buf[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2113 if (XLookupString(&(event->xkey), buf, 2, NULL, NULL) == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2114 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2115 if (*buf == CAR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2116 dialogStatus = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2117 else if (*buf == ESC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2118 dialogStatus = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2119 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2120 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2122 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2123 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2124 butproc(w, client_data, call_data)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2125 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2126 XtPointer client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2127 XtPointer call_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2128 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2129 dialogStatus = (int)(long)client_data + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2130 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2132 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2133 * Function called when dialog window closed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2134 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2135 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2136 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2137 dialog_wm_handler(w, client_data, event, dum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2138 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2139 XtPointer client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2140 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2141 Boolean *dum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2142 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2143 if (event->type == ClientMessage
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2144 && ((XClientMessageEvent *)event)->data.l[0] == dialogatom)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2145 dialogStatus = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2146 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2147
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2148 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2149 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2150 gui_mch_dialog(type, title, message, buttons, dfltbutton, textfield)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2151 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2152 char_u *title;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2153 char_u *message;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2154 char_u *buttons;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2155 int dfltbutton;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2156 char_u *textfield;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2157 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2158 char_u *buts;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2159 char_u *p, *next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2160 XtAppContext app;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2161 XEvent event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2162 Position wd, hd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2163 Position wv, hv;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2164 Position x, y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2165 Widget dialog;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2166 Widget dialogshell;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2167 Widget dialogmessage;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2168 Widget dialogtextfield = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2169 Widget dialogButton;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2170 Widget prev_dialogButton = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2171 int butcount;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2172 int vertical;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2174 if (title == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2175 title = (char_u *)_("Vim dialog");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2176 dialogStatus = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2177
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2178 /* if our pointer is currently hidden, then we should show it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2179 gui_mch_mousehide(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2181 /* Check 'v' flag in 'guioptions': vertical button placement. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2182 vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2184 /* The shell is created each time, to make sure it is resized properly */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2185 dialogshell = XtVaCreatePopupShell("dialogShell",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2186 transientShellWidgetClass, vimShell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2187 XtNtitle, title,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2188 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2189 if (dialogshell == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2190 goto error;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2192 dialog = XtVaCreateManagedWidget("dialog",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2193 formWidgetClass, dialogshell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2194 XtNdefaultDistance, 20,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2195 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2196 if (dialog == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2197 goto error;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2198 gui_athena_menu_colors(dialog);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2199 dialogmessage = XtVaCreateManagedWidget("dialogMessage",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2200 labelWidgetClass, dialog,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2201 XtNlabel, message,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2202 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2203 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2204 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2205 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2206 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2207 XtNborderWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2208 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2209 gui_athena_menu_colors(dialogmessage);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2211 if (textfield != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2212 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2213 dialogtextfield = XtVaCreateManagedWidget("textfield",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2214 asciiTextWidgetClass, dialog,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2215 XtNwidth, 400,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2216 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2217 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2218 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2219 XtNright, XtChainRight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2220 XtNfromVert, dialogmessage,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2221 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2222 XtNstring, textfield,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2223 XtNlength, IOSIZE,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2224 XtNuseStringInPlace, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2225 XtNeditType, XawtextEdit,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2226 XtNwrap, XawtextWrapNever,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2227 XtNresize, XawtextResizeHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2228 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2229 XtManageChild(dialogtextfield);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2230 XtAddEventHandler(dialogtextfield, KeyPressMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2231 (XtEventHandler)keyhit_callback, (XtPointer)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2232 XawTextSetInsertionPoint(dialogtextfield,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2233 (XawTextPosition)STRLEN(textfield));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2234 XtSetKeyboardFocus(dialog, dialogtextfield);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2235 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2237 /* make a copy, so that we can insert NULs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2238 buts = vim_strsave(buttons);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2239 if (buts == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2240 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2241
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2242 p = buts;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2243 for (butcount = 0; *p; ++butcount)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2244 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2245 for (next = p; *next; ++next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2246 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2247 if (*next == DLG_HOTKEY_CHAR)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 811
diff changeset
2248 STRMOVE(next, next + 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2249 if (*next == DLG_BUTTON_SEP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2250 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2251 *next++ = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2252 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2253 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2254 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2255 dialogButton = XtVaCreateManagedWidget("button",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2256 commandWidgetClass, dialog,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2257 XtNlabel, p,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2258 XtNtop, XtChainBottom,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2259 XtNbottom, XtChainBottom,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2260 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2261 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2262 XtNfromVert, textfield == NULL ? dialogmessage : dialogtextfield,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2263 XtNvertDistance, vertical ? 4 : 20,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2264 XtNresizable, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2265 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2266 gui_athena_menu_colors(dialogButton);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2267 if (butcount > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2268 XtVaSetValues(dialogButton,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2269 vertical ? XtNfromVert : XtNfromHoriz, prev_dialogButton,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2270 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2271
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2272 XtAddCallback(dialogButton, XtNcallback, butproc, (XtPointer)butcount);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2273 p = next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2274 prev_dialogButton = dialogButton;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2275 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2276 vim_free(buts);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2278 XtRealizeWidget(dialogshell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2280 /* Setup for catching the close-window event, don't let it close Vim! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2281 dialogatom = XInternAtom(gui.dpy, "WM_DELETE_WINDOW", False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2282 XSetWMProtocols(gui.dpy, XtWindow(dialogshell), &dialogatom, 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2283 XtAddEventHandler(dialogshell, NoEventMask, True, dialog_wm_handler, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2284
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2285 XtVaGetValues(dialogshell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2286 XtNwidth, &wd,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2287 XtNheight, &hd,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2288 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2289 XtVaGetValues(vimShell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2290 XtNwidth, &wv,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2291 XtNheight, &hv,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2292 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2293 XtTranslateCoords(vimShell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2294 (Position)((wv - wd) / 2),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2295 (Position)((hv - hd) / 2),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2296 &x, &y);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2297 if (x < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2298 x = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2299 if (y < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2300 y = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2301 XtVaSetValues(dialogshell, XtNx, x, XtNy, y, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2303 /* Position the mouse pointer in the dialog, required for when focus
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2304 * follows mouse. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2305 XWarpPointer(gui.dpy, (Window)0, XtWindow(dialogshell), 0, 0, 0, 0, 20, 40);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2306
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2307
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2308 app = XtWidgetToApplicationContext(dialogshell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2310 XtPopup(dialogshell, XtGrabNonexclusive);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2311
405
23d5c18ecef7 updated for version 7.0106
vimboss
parents: 215
diff changeset
2312 for (;;)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2313 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2314 XtAppNextEvent(app, &event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2315 XtDispatchEvent(&event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2316 if (dialogStatus >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2317 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2318 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2319
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2320 XtPopdown(dialogshell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2321
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2322 if (textfield != NULL && dialogStatus < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2323 *textfield = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2325 error:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2326 XtDestroyWidget(dialogshell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2327
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2328 return dialogStatus;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2329 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2330 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2331
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2332 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_MENU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2333 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2334 * Set the colors of Widget "id" to the menu colors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2335 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2336 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2337 gui_athena_menu_colors(id)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2338 Widget id;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2339 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2340 if (gui.menu_bg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2341 XtVaSetValues(id, XtNbackground, gui.menu_bg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2342 if (gui.menu_fg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2343 XtVaSetValues(id, XtNforeground, gui.menu_fg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2344 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2345 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2346
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2347 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2348 * Set the colors of Widget "id" to the scroll colors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2349 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2350 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2351 gui_athena_scroll_colors(id)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2352 Widget id;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2353 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2354 if (gui.scroll_bg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2355 XtVaSetValues(id, XtNbackground, gui.scroll_bg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2356 if (gui.scroll_fg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2357 XtVaSetValues(id, XtNforeground, gui.scroll_fg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2358 }