annotate src/gui_athena.c @ 22782:53b996eb5e76 v8.2.1939

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