annotate src/gui_motif.c @ 30626:5bc844667d46 v9.0.0648

patch 9.0.0648: when using powershell input redirection does not work Commit: https://github.com/vim/vim/commit/0a016671b96ae7d27926e9d36dc11945c8f5749d Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon Oct 3 16:05:28 2022 +0100 patch 9.0.0648: when using powershell input redirection does not work Problem: When using powershell input redirection does not work. Solution: Use a different shell command for powershell. (Yegappan Lakshmanan, closes #11257)
author Bram Moolenaar <Bram@vim.org>
date Mon, 03 Oct 2022 17:15:03 +0200
parents be5b8d4616b2
children 101f08b49ed3
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: 7831
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 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 * See README.txt for an overview of the Vim source code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
10956
90af0c60d78d patch 8.0.0367: types in include files may be inconsistent
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
11 #include "vim.h"
90af0c60d78d patch 8.0.0367: types in include files may be inconsistent
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
12
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 #include <Xm/Form.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 #include <Xm/RowColumn.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 #include <Xm/PushB.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 #include <Xm/Text.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 #include <Xm/TextF.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 #include <Xm/Separator.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 #include <Xm/Label.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 #include <Xm/CascadeB.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 #include <Xm/ScrollBar.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 #include <Xm/MenuShell.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 #include <Xm/DrawingA.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 #if (XmVersion >= 1002)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 # include <Xm/RepType.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 #include <Xm/Frame.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 #include <Xm/LabelG.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 #include <Xm/ToggleBG.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 #include <Xm/SeparatoG.h>
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
31 #include <Xm/XmP.h>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 #include <X11/keysym.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 #include <X11/Xatom.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 #include <X11/StringDefs.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 #include <X11/Intrinsic.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 #ifdef HAVE_X11_XPM_H
15517
2ad5f0ffaa2e patch 8.1.0766: various problems when using Vim on VMS
Bram Moolenaar <Bram@vim.org>
parents: 15510
diff changeset
38 # if defined(VMS)
2ad5f0ffaa2e patch 8.1.0766: various problems when using Vim on VMS
Bram Moolenaar <Bram@vim.org>
parents: 15510
diff changeset
39 # include <xpm.h>
2ad5f0ffaa2e patch 8.1.0766: various problems when using Vim on VMS
Bram Moolenaar <Bram@vim.org>
parents: 15510
diff changeset
40 # else
2ad5f0ffaa2e patch 8.1.0766: various problems when using Vim on VMS
Bram Moolenaar <Bram@vim.org>
parents: 15510
diff changeset
41 # include <X11/xpm.h>
2ad5f0ffaa2e patch 8.1.0766: various problems when using Vim on VMS
Bram Moolenaar <Bram@vim.org>
parents: 15510
diff changeset
42 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 # ifdef HAVE_XM_XPMP_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 # include <Xm/XpmP.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 #endif
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 827
diff changeset
48 #ifdef HAVE_XM_NOTEBOOK_H
8e5830943bff updated for version 7.0e04
vimboss
parents: 827
diff changeset
49 # include <Xm/Notebook.h>
8e5830943bff updated for version 7.0e04
vimboss
parents: 827
diff changeset
50 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
52 #include "gui_xmebw.h" // for our Enhanced Button Widget
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
53
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 #if defined(FEAT_GUI_DIALOG) && defined(HAVE_XPM)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 # include "../pixmaps/alert.xpm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 # include "../pixmaps/error.xpm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 # include "../pixmaps/generic.xpm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 # include "../pixmaps/info.xpm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 # include "../pixmaps/quest.xpm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 #define MOTIF_POPUP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 extern Widget vimShell;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 static Widget vimForm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 static Widget textAreaForm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 Widget textArea;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 static Widget toolBarFrame;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 static Widget toolBar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 #endif
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
73 #ifdef FEAT_GUI_TABLINE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
74 static Widget tabLine;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
75 static Widget tabLine_menu = 0;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
76 static int showing_tabline = 0;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
77 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 # if (XmVersion >= 1002)
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
80 // remember the last set value for the tearoff item
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 static int tearoff_val = (int)XmTEAR_OFF_ENABLED;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 static Widget menuBar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 #ifdef FEAT_TOOLBAR
7801
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
87 static void reset_focus(void);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
7801
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
90 static void gui_motif_menu_colors(Widget id);
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
91 static void gui_motif_scroll_colors(Widget id);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 #if (XmVersion >= 1002)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 # define STRING_TAG XmFONTLIST_DEFAULT_TAG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 # define STRING_TAG XmSTRING_DEFAULT_CHARSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 * Call-back routines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 static void
7831
d621ab23fd19 commit https://github.com/vim/vim/commit/c1ab67674aa0dfdcf9f0e9701ac248e3eb41b19c
Christian Brabandt <cb@256bit.org>
parents: 7821
diff changeset
104 scroll_cb(Widget w UNUSED, XtPointer client_data, XtPointer call_data)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 scrollbar_T *sb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 long value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 int dragging;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 sb = gui_find_scrollbar((long)client_data);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 value = ((XmScrollBarCallbackStruct *)call_data)->value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 dragging = (((XmScrollBarCallbackStruct *)call_data)->reason ==
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 (int)XmCR_DRAG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 gui_drag_scrollbar(sb, value, dragging);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
118 #ifdef FEAT_GUI_TABLINE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
119 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
120 tabline_cb(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
121 Widget w UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
122 XtPointer client_data UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
123 XtPointer call_data)
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
124 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
125 XmNotebookCallbackStruct *nptr;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
126
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
127 nptr = (XmNotebookCallbackStruct *)call_data;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
128 if (nptr->reason != (int)XmCR_NONE)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
129 send_tabline_event(nptr->page_number);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
130 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
131
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
132 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
133 tabline_button_cb(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
134 Widget w,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
135 XtPointer client_data UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
136 XtPointer call_data UNUSED)
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
137 {
28191
e4ca5a390f48 patch 8.2.4621: crash when using the tabline right-click menu
Bram Moolenaar <Bram@vim.org>
parents: 28067
diff changeset
138 XtPointer cmd, tab_idx;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
139
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
140 XtVaGetValues(w, XmNuserData, &cmd, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
141 XtVaGetValues(tabLine_menu, XmNuserData, &tab_idx, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
142
28191
e4ca5a390f48 patch 8.2.4621: crash when using the tabline right-click menu
Bram Moolenaar <Bram@vim.org>
parents: 28067
diff changeset
143 send_tabline_menu_event((int)(long)tab_idx, (int)(long)cmd);
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
144 }
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
145
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
146 /*
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
147 * Tabline single mouse click timeout handler
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
148 */
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
149 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
150 motif_tabline_timer_cb (
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
151 XtPointer timed_out,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
152 XtIntervalId *interval_id UNUSED)
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
153 {
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
154 *((int *)timed_out) = TRUE;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
155 }
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
156
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
157 /*
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
158 * check if the tabline tab scroller is clicked
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
159 */
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
160 static int
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
161 tabline_scroller_clicked(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
162 char *scroller_name,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
163 XButtonPressedEvent *event)
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
164 {
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
165 Widget tab_scroll_w;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
166 Position pos_x, pos_y;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
167 Dimension width, height;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
168
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
169 tab_scroll_w = XtNameToWidget(tabLine, scroller_name);
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
170 if (tab_scroll_w != (Widget)0) {
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
171 XtVaGetValues(tab_scroll_w, XmNx, &pos_x, XmNy, &pos_y, XmNwidth,
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
172 &width, XmNheight, &height, NULL);
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
173 if (pos_x >= 0) {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
174 // Tab scroller (next) is visible
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
175 if ((event->x >= pos_x) && (event->x <= pos_x + width) &&
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
176 (event->y >= pos_y) && (event->y <= pos_y + height)) {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
177 // Clicked on the scroller
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
178 return TRUE;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
179 }
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
180 }
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
181 }
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
182 return FALSE;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
183 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
184
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
185 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
186 tabline_menu_cb(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
187 Widget w,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
188 XtPointer closure UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
189 XEvent *e,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
190 Boolean *continue_dispatch UNUSED)
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
191 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
192 Widget tab_w;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
193 XButtonPressedEvent *event;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
194 int tab_idx = 0;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
195 WidgetList children;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
196 Cardinal numChildren;
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
197 static XtIntervalId timer = (XtIntervalId)0;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
198 static int timed_out = TRUE;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
199
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
200 event = (XButtonPressedEvent *)e;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
201
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
202 if (event->button == Button1)
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
203 {
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
204 if (tabline_scroller_clicked("MajorTabScrollerNext", event)
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
205 || tabline_scroller_clicked("MajorTabScrollerPrevious", event))
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
206 return;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
207
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
208 if (!timed_out)
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
209 {
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
210 XtRemoveTimeOut(timer);
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
211 timed_out = TRUE;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
212
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
213 /*
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
214 * Double click on the tabline gutter, add a new tab
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
215 */
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
216 send_tabline_menu_event(0, TABLINE_MENU_NEW);
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
217 }
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
218 else
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
219 {
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
220 /*
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
221 * Single click on the tabline gutter, start a timer to check
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
222 * for double clicks
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
223 */
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
224 timer = XtAppAddTimeOut(app_context, (long_u)p_mouset,
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
225 motif_tabline_timer_cb, &timed_out);
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
226 timed_out = FALSE;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
227 }
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
228 return;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
229 }
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
230
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
231 if (event->button != Button3)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
232 return;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
233
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
234 // When ignoring events don't show the menu.
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
235 if (hold_gui_events
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
236 # ifdef FEAT_CMDWIN
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
237 || cmdwin_type != 0
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
238 # endif
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
239 )
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
240 return;
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
241
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
242 if (event->subwindow != None)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
243 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
244 tab_w = XtWindowToWidget(XtDisplay(w), event->subwindow);
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
245 // LINTED: avoid warning: dubious operation on enum
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
246 if (tab_w != (Widget)0 && XmIsPushButton(tab_w))
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
247 XtVaGetValues(tab_w, XmNpageNumber, &tab_idx, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
248 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
249
28191
e4ca5a390f48 patch 8.2.4621: crash when using the tabline right-click menu
Bram Moolenaar <Bram@vim.org>
parents: 28067
diff changeset
250 XtVaSetValues(tabLine_menu, XmNuserData, (XtPointer)(long)tab_idx, NULL);
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
251 XtVaGetValues(tabLine_menu, XmNchildren, &children, XmNnumChildren,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
252 &numChildren, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
253 XtManageChildren(children, numChildren);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
254 XmMenuPosition(tabLine_menu, (XButtonPressedEvent *)e) ;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
255 XtManageChild(tabLine_menu);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
256 }
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
257
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
258 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
259 tabline_balloon_cb(BalloonEval *beval, int state UNUSED)
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
260 {
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
261 int nr;
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
262 tabpage_T *tp;
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
263
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
264 if (beval->target == (Widget)0)
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
265 return;
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
266
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
267 XtVaGetValues(beval->target, XmNpageNumber, &nr, NULL);
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
268 tp = find_tabpage(nr);
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
269 if (tp == NULL)
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
270 return;
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
271
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
272 get_tabline_label(tp, TRUE);
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
273 gui_mch_post_balloon(beval, NameBuff);
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
274 }
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
275
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
276 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
277
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 * End of call-back routines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
282 /*
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
283 * Implement three dimensional shading of insensitive labels.
66
99064882c85b updated for version 7.0030
vimboss
parents: 54
diff changeset
284 * By Marcin Dalecki.
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
285 */
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
286
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
287 #include <Xm/XmP.h>
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
288 #include <Xm/LabelP.h>
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
289
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
290 static XtExposeProc old_label_expose = NULL;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
291
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
292 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
293 label_expose(Widget _w, XEvent *_event, Region _region)
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
294 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
295 GC insensitiveGC;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
296 XmLabelWidget lw = (XmLabelWidget)_w;
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
297 unsigned char label_type = (int)XmSTRING;
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
298
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
299 XtVaGetValues(_w, XmNlabelType, &label_type, (XtPointer)0);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
300
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
301 if (XtIsSensitive(_w) || label_type != (int)XmSTRING)
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
302 (*old_label_expose)(_w, _event, _region);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
303 else
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
304 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
305 XGCValues values;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
306 XtGCMask mask;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
307 XtGCMask dynamic;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
308 XFontStruct *fs;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
309
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
310 _XmFontListGetDefaultFont(lw->label.font, &fs);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
311
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
312 // FIXME: we should be doing the whole drawing ourself here.
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
313 insensitiveGC = lw->label.insensitive_GC;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
314
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
315 mask = GCForeground | GCBackground | GCGraphicsExposures;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
316 dynamic = GCClipMask | GCClipXOrigin | GCClipYOrigin;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
317 values.graphics_exposures = False;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
318
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
319 if (fs != 0)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
320 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
321 mask |= GCFont;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
322 values.font = fs->fid;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
323 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
324
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
325 if (lw->primitive.top_shadow_pixmap != None
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
326 && lw->primitive.top_shadow_pixmap != XmUNSPECIFIED_PIXMAP)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
327 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
328 mask |= GCFillStyle | GCTile;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
329 values.fill_style = FillTiled;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
330 values.tile = lw->primitive.top_shadow_pixmap;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
331 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
332
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
333 lw->label.TextRect.x += 1;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
334 lw->label.TextRect.y += 1;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
335 if (lw->label._acc_text != 0)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
336 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
337 lw->label.acc_TextRect.x += 1;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
338 lw->label.acc_TextRect.y += 1;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
339 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
340
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
341 values.foreground = lw->primitive.top_shadow_color;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
342 values.background = lw->core.background_pixel;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
343
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
344 lw->label.insensitive_GC = XtAllocateGC((Widget)lw, 0, mask,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
345 &values, dynamic, (XtGCMask)0);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
346 (*old_label_expose)(_w, _event, _region);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
347 XtReleaseGC(_w, lw->label.insensitive_GC);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
348
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
349 lw->label.TextRect.x -= 1;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
350 lw->label.TextRect.y -= 1;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
351 if (lw->label._acc_text != 0)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
352 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
353 lw->label.acc_TextRect.x -= 1;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
354 lw->label.acc_TextRect.y -= 1;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
355 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
356
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
357 values.foreground = lw->primitive.bottom_shadow_color;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
358 values.background = lw->core.background_pixel;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
359
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
360 lw->label.insensitive_GC = XtAllocateGC((Widget) lw, 0, mask,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
361 &values, dynamic, (XtGCMask)0);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
362 (*old_label_expose)(_w, _event, _region);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
363 XtReleaseGC(_w, lw->label.insensitive_GC);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
364
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
365 lw->label.insensitive_GC = insensitiveGC;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
366 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
367 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
368
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 * Create all the motif widgets necessary.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
373 gui_x11_create_widgets(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 {
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
375 #ifdef FEAT_GUI_TABLINE
827
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
376 Widget button, scroller;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
377 Arg args[10];
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
378 int n;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
379 XmString xms;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
380 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
381
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
382 /*
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
383 * Install the 3D shade effect drawing routines.
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
384 */
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
385 if (old_label_expose == NULL)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
386 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
387 old_label_expose = xmLabelWidgetClass->core_class.expose;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
388 xmLabelWidgetClass->core_class.expose = label_expose;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
389 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
390
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 * Start out by adding the configured border width into the border offset
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 gui.border_offset = gui.border_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 * Install the tearOffModel resource converter.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 #if (XmVersion >= 1002)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 XmRepTypeInstallTearOffModelConverter();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
403 // Make sure the "Quit" menu entry of the window manager is ignored
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 XtVaSetValues(vimShell, XmNdeleteResponse, XmDO_NOTHING, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 vimForm = XtVaCreateManagedWidget("vimForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 xmFormWidgetClass, vimShell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 XmNborderWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 XmNhighlightThickness, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 XmNshadowThickness, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 XmNmarginWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 XmNmarginHeight, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 XmNresizePolicy, XmRESIZE_ANY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 gui_motif_menu_colors(vimForm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
419 Arg al[7]; // Make sure there is enough room for arguments!
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 int ac = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 # if (XmVersion >= 1002)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 XtSetArg(al[ac], XmNtearOffModel, tearoff_val); ac++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 # ifndef FEAT_TOOLBAR
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
429 // Always stick to right hand side.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 XtSetArg(al[ac], XmNrightOffset, 0); ac++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 # endif
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
432 XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 menuBar = XmCreateMenuBar(vimForm, "menuBar", al, ac);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 XtManageChild(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 gui_motif_menu_colors(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 * Create an empty ToolBar. We should get buttons defined from menu.vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 toolBarFrame = XtVaCreateWidget("toolBarFrame",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 xmFrameWidgetClass, vimForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 XmNshadowThickness, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 XmNmarginHeight, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 XmNmarginWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 gui_motif_menu_colors(toolBarFrame);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 toolBar = XtVaCreateManagedWidget("toolBar",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 xmRowColumnWidgetClass, toolBarFrame,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 XmNchildType, XmFRAME_WORKAREA_CHILD,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 XmNrowColumnType, XmWORK_AREA,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 XmNorientation, XmHORIZONTAL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 XmNtraversalOn, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 XmNisHomogeneous, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 XmNpacking, XmPACK_TIGHT,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 XmNspacing, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 XmNshadowThickness, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 XmNhighlightThickness, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 XmNmarginHeight, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 XmNmarginWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 XmNadjustLast, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 gui_motif_menu_colors(toolBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
473 #ifdef FEAT_GUI_TABLINE
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
474 // Create the Vim GUI tabline
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
475 n = 0;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
476 XtSetArg(args[n], XmNbindingType, XmNONE); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
477 XtSetArg(args[n], XmNorientation, XmVERTICAL); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
478 XtSetArg(args[n], XmNbackPageSize, XmNONE); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
479 XtSetArg(args[n], XmNbackPageNumber, 0); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
480 XtSetArg(args[n], XmNbackPagePlacement, XmTOP_RIGHT); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
481 XtSetArg(args[n], XmNmajorTabSpacing, 0); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
482 XtSetArg(args[n], XmNshadowThickness, 0); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
483 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
484 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
485 tabLine = XmCreateNotebook(vimForm, "Vim tabline", args, n);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
486
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
487 XtAddCallback(tabLine, XmNpageChangedCallback, (XtCallbackProc)tabline_cb,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
488 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
489 XtAddEventHandler(tabLine, ButtonPressMask, False,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
490 (XtEventHandler)tabline_menu_cb, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
491
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 839
diff changeset
492 gui.tabline_height = TABLINE_HEIGHT;
9f279ebda751 updated for version 7.0f01
vimboss
parents: 839
diff changeset
493
827
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
494 /*
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
495 * Set the size of the minor next/prev scrollers to zero, so
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
496 * that they are not displayed. Due to a bug in OpenMotif 2.3,
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
497 * even if these children widget are unmanaged, they are again
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
498 * managed by the Notebook widget and the notebook widget geometry
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
499 * is adjusted to account for the minor scroller widgets.
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
500 */
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
501 scroller = XtNameToWidget(tabLine, "MinorTabScrollerNext");
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
502 XtVaSetValues(scroller, XmNwidth, 0, XmNresizable, False,
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
503 XmNtraversalOn, False, NULL);
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
504 scroller = XtNameToWidget(tabLine, "MinorTabScrollerPrevious");
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
505 XtVaSetValues(scroller, XmNwidth, 0, XmNresizable, False,
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
506 XmNtraversalOn, False, NULL);
fd1b3406fd1c updated for version 7.0d02
vimboss
parents: 824
diff changeset
507
15134
f2972ff144ab patch 8.1.0577: tabpage right-click menu never shows "Close tab"
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
508 // Create the tabline popup menu
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
509 tabLine_menu = XmCreatePopupMenu(tabLine, "tabline popup", NULL, 0);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
510
15134
f2972ff144ab patch 8.1.0577: tabpage right-click menu never shows "Close tab"
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
511 // Add the buttons to the tabline popup menu
f2972ff144ab patch 8.1.0577: tabpage right-click menu never shows "Close tab"
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
512 n = 0;
28191
e4ca5a390f48 patch 8.2.4621: crash when using the tabline right-click menu
Bram Moolenaar <Bram@vim.org>
parents: 28067
diff changeset
513 XtSetArg(args[n], XmNuserData, (XtPointer)TABLINE_MENU_CLOSE); n++;
15134
f2972ff144ab patch 8.1.0577: tabpage right-click menu never shows "Close tab"
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
514 xms = XmStringCreate((char *)"Close tab", STRING_TAG);
f2972ff144ab patch 8.1.0577: tabpage right-click menu never shows "Close tab"
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
515 XtSetArg(args[n], XmNlabelString, xms); n++;
f2972ff144ab patch 8.1.0577: tabpage right-click menu never shows "Close tab"
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
516 button = XmCreatePushButton(tabLine_menu, "Close", args, n);
f2972ff144ab patch 8.1.0577: tabpage right-click menu never shows "Close tab"
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
517 XtAddCallback(button, XmNactivateCallback,
f2972ff144ab patch 8.1.0577: tabpage right-click menu never shows "Close tab"
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
518 (XtCallbackProc)tabline_button_cb, NULL);
f2972ff144ab patch 8.1.0577: tabpage right-click menu never shows "Close tab"
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
519 XmStringFree(xms);
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
520
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
521 n = 0;
28191
e4ca5a390f48 patch 8.2.4621: crash when using the tabline right-click menu
Bram Moolenaar <Bram@vim.org>
parents: 28067
diff changeset
522 XtSetArg(args[n], XmNuserData, (XtPointer)TABLINE_MENU_NEW); n++;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
523 xms = XmStringCreate((char *)"New Tab", STRING_TAG);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
524 XtSetArg(args[n], XmNlabelString, xms); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
525 button = XmCreatePushButton(tabLine_menu, "New Tab", args, n);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
526 XtAddCallback(button, XmNactivateCallback,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
527 (XtCallbackProc)tabline_button_cb, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
528 XmStringFree(xms);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
529
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
530 n = 0;
28191
e4ca5a390f48 patch 8.2.4621: crash when using the tabline right-click menu
Bram Moolenaar <Bram@vim.org>
parents: 28067
diff changeset
531 XtSetArg(args[n], XmNuserData, (XtPointer)TABLINE_MENU_OPEN); n++;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
532 xms = XmStringCreate((char *)"Open tab...", STRING_TAG);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
533 XtSetArg(args[n], XmNlabelString, xms); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
534 button = XmCreatePushButton(tabLine_menu, "Open tab...", args, n);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
535 XtAddCallback(button, XmNactivateCallback,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
536 (XtCallbackProc)tabline_button_cb, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
537 XmStringFree(xms);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
538 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
539
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540 textAreaForm = XtVaCreateManagedWidget("textAreaForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541 xmFormWidgetClass, vimForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 XmNmarginWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 XmNmarginHeight, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548 XmNresizePolicy, XmRESIZE_ANY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550 gui_motif_scroll_colors(textAreaForm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 textArea = XtVaCreateManagedWidget("textArea",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553 xmDrawingAreaWidgetClass, textAreaForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 XmNforeground, gui.norm_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 XmNbackground, gui.back_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 * These take some control away from the user, but avoids making them
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 * add resources to get a decent looking setup.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565 XmNborderWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 XmNhighlightThickness, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 XmNshadowThickness, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 * Install the callbacks.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 gui_x11_callbacks(textArea, vimForm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
575 // 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
576 gui.in_focus = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 * Called when the GUI is not going to start after all.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
582 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
583 gui_x11_destroy_widgets(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 textArea = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 menuBar = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
592 gui_mch_set_text_area_pos(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
593 int x UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
594 int y UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
595 int w UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
596 int h UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 #ifdef FEAT_TOOLBAR
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
599 // Give keyboard focus to the textArea instead of the toolbar.
54
6bfddb1d126a updated for version 7.0029
vimboss
parents: 48
diff changeset
600 reset_focus();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
605 gui_x11_set_back_color(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 if (textArea != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608 #if (XmVersion >= 1002)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609 XmChangeColor(textArea, gui.back_pixel);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 XtVaSetValues(textArea,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612 XmNbackground, gui.back_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 /*
28303
9849df834f1d patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents: 28247
diff changeset
618 * Manage dialog centered on pointer.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 */
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
620 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
621 manage_centered(Widget dialog_child)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623 Widget shell = XtParent(dialog_child);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 Window root, child;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 unsigned int mask;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 unsigned int width, height, border_width, depth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 int x, y, win_x, win_y, maxX, maxY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 Boolean mappedWhenManaged;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
630 // Temporarily set value of XmNmappedWhenManaged
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
631 // to stop the dialog from popping up right away
1604
3acbcd0d3fd3 updated for version 7.1-317
vimboss
parents: 1522
diff changeset
632 XtVaGetValues(shell, XmNmappedWhenManaged, &mappedWhenManaged, NULL);
3acbcd0d3fd3 updated for version 7.1-317
vimboss
parents: 1522
diff changeset
633 XtVaSetValues(shell, XmNmappedWhenManaged, False, NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 XtManageChild(dialog_child);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
637 // Get the pointer position (x, y)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 XQueryPointer(XtDisplay(shell), XtWindow(shell), &root, &child,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 &x, &y, &win_x, &win_y, &mask);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
641 // Translate the pointer position (x, y) into a position for the new
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
642 // window that will place the pointer at its center
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 XGetGeometry(XtDisplay(shell), XtWindow(shell), &root, &win_x, &win_y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 &width, &height, &border_width, &depth);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 width += 2 * border_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 height += 2 * border_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 x -= width / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648 y -= height / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
650 // Ensure that the dialog remains on screen
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 maxX = XtScreen(shell)->width - width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 maxY = XtScreen(shell)->height - height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 if (x < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 x = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 if (x > maxX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 x = maxX;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657 if (y < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 y = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 if (y > maxY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660 y = maxY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
662 // Set desired window position in the DialogShell
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 XtVaSetValues(shell, XmNx, x, XmNy, y, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
665 // Map the widget
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 XtMapWidget(shell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
668 // Restore the value of XmNmappedWhenManaged
1604
3acbcd0d3fd3 updated for version 7.1-317
vimboss
parents: 1522
diff changeset
669 XtVaSetValues(shell, XmNmappedWhenManaged, mappedWhenManaged, NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671
15510
41fbbcea0f1b patch 8.1.0763: nobody is using the Sun Workshop support
Bram Moolenaar <Bram@vim.org>
parents: 15134
diff changeset
672 #if defined(FEAT_MENU) || defined(FEAT_GUI_DIALOG) || defined(PROTO)
7
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 * Encapsulate the way an XmFontList is created.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677 XmFontList
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
678 gui_motif_create_fontlist(XFontStruct *font)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 XmFontList font_list;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 # if (XmVersion <= 1001)
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
683 // Motif 1.1 method
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 font_list = XmFontListCreate(font, STRING_TAG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685 # else
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
686 // Motif 1.2 method
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 XmFontListEntry font_list_entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689 font_list_entry = XmFontListEntryCreate(STRING_TAG, XmFONT_IS_FONT,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690 (XtPointer)font);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 font_list = XmFontListAppendEntry(NULL, font_list_entry);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 XmFontListEntryFree(&font_list_entry);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694 return font_list;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 # if ((XmVersion > 1001) && defined(FEAT_XFONTSET)) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 XmFontList
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
699 gui_motif_fontset2fontlist(XFontSet *fontset)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701 XmFontList font_list;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
703 // Motif 1.2 method
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 XmFontListEntry font_list_entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 font_list_entry = XmFontListEntryCreate(STRING_TAG,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707 XmFONT_IS_FONTSET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 (XtPointer)*fontset);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 font_list = XmFontListAppendEntry(NULL, font_list_entry);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710 XmFontListEntryFree(&font_list_entry);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 return font_list;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 #if defined(FEAT_MENU) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 * Menu stuff.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721
7801
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
722 static void gui_motif_add_actext(vimmenu_T *menu);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 #if (XmVersion >= 1002)
7801
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
724 static void toggle_tearoff(Widget wid);
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
725 static void gui_mch_recurse_tearoffs(vimmenu_T *menu);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 #endif
7801
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
727 static void submenu_change(vimmenu_T *mp, int colors);
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
728
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
729 static void do_set_mnemonics(int enable);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 static int menu_enabled = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
733 gui_mch_enable_menu(int flag)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 if (flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 XtManageChild(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 if (XtIsManaged(XtParent(toolBar)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
741 // toolBar is attached to top form
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 XtVaSetValues(XtParent(toolBar),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 XmNtopAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 XmNtopWidget, menuBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745 NULL);
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
746 #ifdef FEAT_GUI_TABLINE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
747 if (showing_tabline)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
748 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
749 XtVaSetValues(tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
750 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
751 XmNtopWidget, XtParent(toolBar),
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
752 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
753 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
754 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
755 XmNtopWidget, tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
756 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
757 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
758 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
759 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
760 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
761 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
762 XmNtopWidget, XtParent(toolBar),
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
763 NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 {
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
768 #ifdef FEAT_GUI_TABLINE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
769 if (showing_tabline)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
770 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
771 XtVaSetValues(tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
772 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
773 XmNtopWidget, menuBar,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
774 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
775 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
776 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
777 XmNtopWidget, tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
778 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
779 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
780 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
781 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
782 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
783 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
784 XmNtopWidget, menuBar,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
785 NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 XtUnmanageChild(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792 if (XtIsManaged(XtParent(toolBar)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794 XtVaSetValues(XtParent(toolBar),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 NULL);
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
797 #ifdef FEAT_GUI_TABLINE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
798 if (showing_tabline)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
799 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
800 XtVaSetValues(tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
801 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
802 XmNtopWidget, XtParent(toolBar),
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
803 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
804 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
805 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
806 XmNtopWidget, tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
807 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
808 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
809 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
810 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
811 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
812 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
813 XmNtopWidget, XtParent(toolBar),
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
814 NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818 {
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
819 #ifdef FEAT_GUI_TABLINE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
820 if (showing_tabline)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
821 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
822 XtVaSetValues(tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
823 XmNtopAttachment, XmATTACH_FORM,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
824 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
825 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
826 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
827 XmNtopWidget, tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
828 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
829 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
830 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
831 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
832 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
833 XmNtopAttachment, XmATTACH_FORM,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
834 NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841 * Enable or disable mnemonics for the toplevel menus.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
844 gui_motif_set_mnemonics(int enable)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847 * Don't enable menu mnemonics when the menu bar is disabled, LessTif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 * crashes when using a mnemonic then.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 if (!menu_enabled)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 enable = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 do_set_mnemonics(enable);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
856 do_set_mnemonics(int enable)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 vimmenu_T *menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859
19934
3ff714d765ba patch 8.2.0523: loops are repeated
Bram Moolenaar <Bram@vim.org>
parents: 18788
diff changeset
860 FOR_ALL_MENUS(menu)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 if (menu->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862 XtVaSetValues(menu->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 XmNmnemonic, enable ? menu->mnemonic : NUL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
868 gui_mch_add_menu(vimmenu_T *menu, int idx)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 XmString label;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871 Widget shell;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 vimmenu_T *parent = menu->parent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874 #ifdef MOTIF_POPUP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 if (menu_is_popup(menu->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877 Arg arg[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 int n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
880 // Only create the popup menu when it's actually used, otherwise there
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
881 // is a delay when using the right mouse button.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 # if (XmVersion <= 1002)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 if (mouse_model_popup())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 if (gui.menu_bg_pixel != INVALCOLOR)
22329
858d7ceb1135 patch 8.2.1713: Motif GUI: crash when setting menu colors
Bram Moolenaar <Bram@vim.org>
parents: 21355
diff changeset
887 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 XtSetArg(arg[0], XmNbackground, gui.menu_bg_pixel); n++;
22329
858d7ceb1135 patch 8.2.1713: Motif GUI: crash when setting menu colors
Bram Moolenaar <Bram@vim.org>
parents: 21355
diff changeset
889 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 if (gui.menu_fg_pixel != INVALCOLOR)
22329
858d7ceb1135 patch 8.2.1713: Motif GUI: crash when setting menu colors
Bram Moolenaar <Bram@vim.org>
parents: 21355
diff changeset
891 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892 XtSetArg(arg[1], XmNforeground, gui.menu_fg_pixel); n++;
22329
858d7ceb1135 patch 8.2.1713: Motif GUI: crash when setting menu colors
Bram Moolenaar <Bram@vim.org>
parents: 21355
diff changeset
893 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894 menu->submenu_id = XmCreatePopupMenu(textArea, "contextMenu",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 arg, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 menu->id = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 if (!menu_is_menubar(menu->name)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 || (parent != NULL && parent->submenu_id == (Widget)0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 label = XmStringCreate((char *)menu->dname, STRING_TAG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 if (label == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 menu->id = XtVaCreateWidget("subMenu",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 xmCascadeButtonWidgetClass,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 (parent == NULL) ? menuBar : parent->submenu_id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 XmNlabelString, label,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 XmNmnemonic, p_wak[0] == 'n' ? NUL : menu->mnemonic,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 #if (XmVersion >= 1002)
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
915 // submenu: count the tearoff item (needed for LessTif)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 XmNpositionIndex, idx + (parent != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 && tearoff_val == (int)XmTEAR_OFF_ENABLED ? 1 : 0),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 XmStringFree(label);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
922 if (menu->id == (Widget)0) // failed
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924
28247
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
925 // The "Help" menu is a special case, and should be placed at the far
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
926 // right hand side of the menu-bar. It's recognized by its high priority.
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
927 if (parent == NULL && menu->priority >= 9999)
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
928 XtVaSetValues(menuBar,
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
929 XmNmenuHelpWidget, menu->id,
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
930 NULL);
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
931
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
932 gui_motif_menu_colors(menu->id);
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
933 gui_motif_menu_fontlist(menu->id);
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
934
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
935 // add accelerator text
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 gui_motif_add_actext(menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 shell = XtVaCreateWidget("subMenuShell",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 xmMenuShellWidgetClass, menu->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940 XmNwidth, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 XmNheight, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 gui_motif_menu_colors(shell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944 menu->submenu_id = XtVaCreateWidget("rowColumnMenu",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 xmRowColumnWidgetClass, shell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 XmNrowColumnType, XmMENU_PULLDOWN,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948 gui_motif_menu_colors(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
950 if (menu->submenu_id == (Widget)0) // failed
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 #if (XmVersion >= 1002)
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
954 // Set the colors for the tear off widget
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 toggle_tearoff(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958 XtVaSetValues(menu->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 XmNsubMenuId, menu->submenu_id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961
28247
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
962 // When we add a top-level item to the menu bar, we can figure out how
f70015784777 patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents: 28191
diff changeset
963 // high the menu bar should be.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 if (parent == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 gui_mch_compute_menu_height(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967
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 * Add mnemonic and accelerator text to a menu button.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
973 gui_motif_add_actext(vimmenu_T *menu)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 XmString label;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
977 // Add accelerator text, if there is one
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978 if (menu->actext != NULL && menu->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
980 label = XmStringCreate((char *)menu->actext, STRING_TAG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 if (label == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983 XtVaSetValues(menu->id, XmNacceleratorText, label, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 XmStringFree(label);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
989 gui_mch_toggle_tearoffs(int enable)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991 #if (XmVersion >= 1002)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 if (enable)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 tearoff_val = (int)XmTEAR_OFF_ENABLED;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 tearoff_val = (int)XmTEAR_OFF_DISABLED;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996 toggle_tearoff(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 gui_mch_recurse_tearoffs(root_menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 #if (XmVersion >= 1002)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003 * Set the tearoff for one menu widget on or off, and set the color of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 * tearoff widget.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1007 toggle_tearoff(Widget wid)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1010
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011 XtVaSetValues(wid, XmNtearOffModel, tearoff_val, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 if (tearoff_val == (int)XmTEAR_OFF_ENABLED
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 && (w = XmGetTearOffControl(wid)) != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014 gui_motif_menu_colors(w);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1018 gui_mch_recurse_tearoffs(vimmenu_T *menu)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 while (menu != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 if (!menu_is_popup(menu->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 if (menu->submenu_id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 toggle_tearoff(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 gui_mch_recurse_tearoffs(menu->children);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 menu = menu->next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033 int
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1034 gui_mch_text_area_extra_height(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 Dimension shadowHeight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038 XtVaGetValues(textAreaForm, XmNshadowThickness, &shadowHeight, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 return shadowHeight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 * Compute the height of the menu bar.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 * We need to check all the items for their position and height, for the case
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 * there are several rows, and/or some characters extend higher or lower.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1048 gui_mch_compute_menu_height(
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1049 Widget id) // can be NULL when deleting menu
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 Dimension y, maxy;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 Dimension margin, shadow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 vimmenu_T *mp;
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1054 static Dimension height = 21; // normal height of a menu item
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 * Get the height of the new item, before managing it, because it will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 * still reflect the font size. After managing it depends on the menu
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 * height, which is what we just wanted to get!.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 if (id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 XtVaGetValues(id, XmNheight, &height, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1064 // Find any menu Widget, to be able to call XtManageChild()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065 else
19934
3ff714d765ba patch 8.2.0523: loops are repeated
Bram Moolenaar <Bram@vim.org>
parents: 18788
diff changeset
1066 FOR_ALL_MENUS(mp)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 if (mp->id != (Widget)0 && menu_is_menubar(mp->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 id = mp->id;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 * Now manage the menu item, to make them all be positioned (makes an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 * extra row when needed, removes it when not needed).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 if (id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078 XtManageChild(id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 /*
15034
6e4e0d43b20b patch 8.1.0528: various typos in comments
Bram Moolenaar <Bram@vim.org>
parents: 14862
diff changeset
1081 * Now find the menu item that is the furthest down, and get its position.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 maxy = 0;
19934
3ff714d765ba patch 8.2.0523: loops are repeated
Bram Moolenaar <Bram@vim.org>
parents: 18788
diff changeset
1084 FOR_ALL_MENUS(mp)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1086 if (mp->id != (Widget)0 && menu_is_menubar(mp->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1087 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 XtVaGetValues(mp->id, XmNy, &y, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 if (y > maxy)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 maxy = y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 XtVaGetValues(menuBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095 XmNmarginHeight, &margin,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 XmNshadowThickness, &shadow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 * This computation is the result of trial-and-error:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 * maxy = The maximum position of an item; required for when there are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102 * two or more rows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103 * height = height of an item, before managing it; Hopefully this will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 * change with the font height. Includes shadow-border.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 * shadow = shadow-border; must be subtracted from the height.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106 * margin = margin around the menu buttons; Must be added.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 * Add 4 for the underlining of shortcut keys.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 gui.menu_height = maxy + height - 2 * shadow + 2 * margin + 4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1111 // Somehow the menu bar doesn't resize automatically. Set it here,
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1112 // even though this is a catch 22. Don't do this when starting up,
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1113 // somehow the menu gets very high then.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 if (gui.shell_created)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 XtVaSetValues(menuBar, XmNheight, gui.menu_height, NULL);
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1116 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1117
147
2f5a3b881ada updated for version 7.0046
vimboss
parents: 66
diff changeset
1118 #ifdef FEAT_TOOLBAR
2f5a3b881ada updated for version 7.0046
vimboss
parents: 66
diff changeset
1119
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1120 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1121 * Icons used by the toolbar code.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1122 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1123 #include "gui_x11_pm.h"
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1124
7801
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
1125 static char **get_toolbar_pixmap(vimmenu_T *menu, char **fname);
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1126
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1127 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1128 * Read an Xpm file. Return OK or FAIL.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1129 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1130 static int
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1131 check_xpm(char_u *path)
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1132 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1133 XpmAttributes attrs;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1134 int status;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1135 Pixmap mask;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1136 Pixmap map;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1137
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1138 attrs.valuemask = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1139
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1140 // Create the "sensitive" pixmap
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1141 status = XpmReadFileToPixmap(gui.dpy,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1142 RootWindow(gui.dpy, DefaultScreen(gui.dpy)),
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1143 (char *)path, &map, &mask, &attrs);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1144 XpmFreeAttributes(&attrs);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1145
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1146 if (status == XpmSuccess)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1147 return OK;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1148 return FAIL;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1149 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1150
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1151
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1152 /*
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1153 * Allocated a pixmap for toolbar menu "menu".
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1154 * When it's to be read from a file, "fname" is set to the file name
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1155 * (in allocated memory).
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1156 * Return a blank pixmap if it fails.
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1157 */
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1158 static char **
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1159 get_toolbar_pixmap(vimmenu_T *menu, char **fname)
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1160 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1161 char_u buf[MAXPATHL]; // buffer storing expanded pathname
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1162 char **xpm = NULL; // xpm array
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1163 int res;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1164
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1165 *fname = NULL;
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1166 buf[0] = NUL; // start with NULL path
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1167
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1168 if (menu->iconfile != NULL)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1169 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1170 // Use the "icon=" argument.
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1171 gui_find_iconfile(menu->iconfile, buf, "xpm");
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1172 res = check_xpm(buf);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1173
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1174 // If it failed, try using the menu name.
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1175 if (res == FAIL && gui_find_bitmap(menu->name, buf, "xpm") == OK)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1176 res = check_xpm(buf);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1177 if (res == OK)
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1178 {
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1179 *fname = (char *)vim_strsave(buf);
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1180 return tb_blank_xpm;
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1181 }
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1182 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1183
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1184 if (menu->icon_builtin || gui_find_bitmap(menu->name, buf, "xpm") == FAIL)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1185 {
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1186 if (menu->iconidx >= 0 && menu->iconidx
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1604
diff changeset
1187 < (int)(sizeof(built_in_pixmaps) / sizeof(built_in_pixmaps[0])))
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1188 xpm = built_in_pixmaps[menu->iconidx];
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1189 else
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1190 xpm = tb_blank_xpm;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1191 }
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1192
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1193 return xpm;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194 }
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1195
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1196 /*
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1197 * Add arguments for the toolbar pixmap to a menu item.
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1198 */
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1199 static int
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1200 add_pixmap_args(vimmenu_T *menu, Arg *args, int n)
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1201 {
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1202 vim_free(menu->xpm_fname);
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1203 menu->xpm = get_toolbar_pixmap(menu, &menu->xpm_fname);
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1204 if (menu->xpm == NULL)
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1205 {
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1206 XtSetArg(args[n], XmNlabelType, XmSTRING); n++;
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1207 }
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1208 else
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1209 {
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1210 if (menu->xpm_fname != NULL)
22333
2ccc3e68b617 patch 8.2.1715: Motif GUI: commented out code missed {}
Bram Moolenaar <Bram@vim.org>
parents: 22329
diff changeset
1211 {
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1212 XtSetArg(args[n], XmNpixmapFile, menu->xpm_fname); n++;
22333
2ccc3e68b617 patch 8.2.1715: Motif GUI: commented out code missed {}
Bram Moolenaar <Bram@vim.org>
parents: 22329
diff changeset
1213 }
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1214 XtSetArg(args[n], XmNpixmapData, menu->xpm); n++;
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1215 XtSetArg(args[n], XmNlabelLocation, XmBOTTOM); n++;
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1216 }
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1217 return n;
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1218 }
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1219 #endif // FEAT_TOOLBAR
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1222 gui_mch_add_menu_item(vimmenu_T *menu, int idx)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224 XmString label;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 vimmenu_T *parent = menu->parent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227 # if (XmVersion <= 1002)
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1228 // Don't add Popup menu items when the popup menu isn't used.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1229 if (menu_is_child_of_popup(menu) && !mouse_model_popup())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1233 # ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1234 if (menu_is_toolbar(parent->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1235 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236 WidgetClass type;
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1237 XmString xms = NULL; // fallback label if pixmap not found
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239 Arg args[18];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242 if (menu_is_separator(menu->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244 char *cp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 Dimension wid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1247 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1248 * A separator has the format "-sep%d[:%d]-". The optional :%d is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1249 * a width specifier. If no width is specified then we choose one.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1250 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1251 cp = (char *)vim_strchr(menu->name, ':');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1252 if (cp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1253 wid = (Dimension)atoi(++cp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1254 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1255 wid = 4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1257 type = xmSeparatorWidgetClass;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1258 XtSetArg(args[n], XmNwidth, wid); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1259 XtSetArg(args[n], XmNminWidth, wid); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 XtSetArg(args[n], XmNorientation, XmVERTICAL); n++;
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1261 XtSetArg(args[n], XmNseparatorType, XmSHADOW_ETCHED_IN); n++;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1262 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1263 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1264 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1265 // Without shadows one can't sense whatever the button has been
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1266 // pressed or not! However we want to save a bit of space...
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1267 // Need the highlightThickness to see the focus.
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1268 XtSetArg(args[n], XmNhighlightThickness, 1); n++;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269 XtSetArg(args[n], XmNhighlightOnEnter, True); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270 XtSetArg(args[n], XmNmarginWidth, 0); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271 XtSetArg(args[n], XmNmarginHeight, 0); n++;
54
6bfddb1d126a updated for version 7.0029
vimboss
parents: 48
diff changeset
1272 XtSetArg(args[n], XmNtraversalOn, False); n++;
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1273 // Set the label here, so that we can switch between icons/text
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1274 // by changing the XmNlabelType resource.
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1275 xms = XmStringCreate((char *)menu->dname, STRING_TAG);
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1276 XtSetArg(args[n], XmNlabelString, xms); n++;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1277
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1278 n = add_pixmap_args(menu, args, n);
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1279
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1280 type = xmEnhancedButtonWidgetClass;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1281 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1283 XtSetArg(args[n], XmNpositionIndex, idx); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284 if (menu->id == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1285 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286 menu->id = XtCreateManagedWidget((char *)menu->dname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287 type, toolBar, args, n);
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1288 if (menu->id != NULL && type == xmEnhancedButtonWidgetClass)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1289 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1290 XtAddCallback(menu->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1291 XmNactivateCallback, gui_x11_menu_cb, menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1292 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1293 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1294 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1295 XtSetValues(menu->id, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1296 if (xms != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1297 XmStringFree(xms);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1298
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
1299 # ifdef FEAT_BEVAL_GUI
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1300 gui_mch_menu_set_tip(menu);
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
1301 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1303 menu->parent = parent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1304 menu->submenu_id = NULL;
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1305 // When adding first item to toolbar it might have to be enabled .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1306 if (!XtIsManaged(XtParent(toolBar))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1307 && vim_strchr(p_go, GO_TOOLBAR) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1308 gui_mch_show_toolbar(TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1309 gui.toolbar_height = gui_mch_compute_toolbar_height();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1310 return;
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1311 } // toolbar menu item
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1312 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1313
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1314 // No parent, must be a non-menubar menu
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1315 if (parent->submenu_id == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1316 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1317
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1318 menu->submenu_id = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1319
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1320 // Add menu separator
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1321 if (menu_is_separator(menu->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1322 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1323 menu->id = XtVaCreateWidget("subMenu",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1324 xmSeparatorGadgetClass, parent->submenu_id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1325 #if (XmVersion >= 1002)
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1326 // count the tearoff item (needed for LessTif)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1327 XmNpositionIndex, idx + (tearoff_val == (int)XmTEAR_OFF_ENABLED
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1328 ? 1 : 0),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1329 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1330 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1331 gui_motif_menu_colors(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1332 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1333 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1334
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1335 label = XmStringCreate((char *)menu->dname, STRING_TAG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1336 if (label == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1337 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1338 menu->id = XtVaCreateWidget("subMenu",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1339 xmPushButtonWidgetClass, parent->submenu_id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1340 XmNlabelString, label,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1341 XmNmnemonic, menu->mnemonic,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1342 #if (XmVersion >= 1002)
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1343 // count the tearoff item (needed for LessTif)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1344 XmNpositionIndex, idx + (tearoff_val == (int)XmTEAR_OFF_ENABLED
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1345 ? 1 : 0),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1346 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1347 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1348 gui_motif_menu_colors(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1349 gui_motif_menu_fontlist(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1350 XmStringFree(label);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1351
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1352 if (menu->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1353 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1354 XtAddCallback(menu->id, XmNactivateCallback, gui_x11_menu_cb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1355 (XtPointer)menu);
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1356 // add accelerator text
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1357 gui_motif_add_actext(menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1358 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1359 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1361 #if (XmVersion <= 1002) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1362 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1363 * This function will destroy/create the popup menus dynamically,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1364 * according to the value of 'mousemodel'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1365 * This will fix the "right mouse button freeze" that occurs when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1366 * there exists a popup menu but it isn't managed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1367 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1368 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1369 gui_motif_update_mousemodel(vimmenu_T *menu)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1370 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1371 int idx = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1372
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1373 // When GUI hasn't started the menus have not been created.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1374 if (!gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1375 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1376
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1377 while (menu)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1378 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1379 if (menu->children != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1380 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1381 if (menu_is_popup(menu->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1382 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1383 if (mouse_model_popup())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1384 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1385 // Popup menu will be used. Create the popup menus.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1386 gui_mch_add_menu(menu, idx);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1387 gui_motif_update_mousemodel(menu->children);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1388 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1389 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1390 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1391 // Popup menu will not be used. Destroy the popup menus.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1392 gui_motif_update_mousemodel(menu->children);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1393 gui_mch_destroy_menu(menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1394 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1395 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1396 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1397 else if (menu_is_child_of_popup(menu))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1398 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1399 if (mouse_model_popup())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1400 gui_mch_add_menu_item(menu, idx);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1401 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1402 gui_mch_destroy_menu(menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1403 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1404 menu = menu->next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1405 ++idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1406 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1407 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1408 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1409
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1410 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1411 gui_mch_new_menu_colors(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1412 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1413 if (menuBar == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1414 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1415 gui_motif_menu_colors(menuBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1416 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1417 gui_motif_menu_colors(toolBarFrame);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1418 gui_motif_menu_colors(toolBar);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1419 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1420
54
6bfddb1d126a updated for version 7.0029
vimboss
parents: 48
diff changeset
1421 submenu_change(root_menu, TRUE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1422 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1424 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1425 gui_mch_new_menu_font(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1426 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1427 if (menuBar == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1428 return;
54
6bfddb1d126a updated for version 7.0029
vimboss
parents: 48
diff changeset
1429 submenu_change(root_menu, FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1430 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1431 Dimension height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1432 Position w, h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1433
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1434 XtVaGetValues(menuBar, XmNheight, &height, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1435 gui.menu_height = height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1436
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1437 XtVaGetValues(vimShell, XtNwidth, &w, XtNheight, &h, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1438 gui_resize_shell(w, h
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1439 #ifdef FEAT_XIM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1440 - xim_get_status_area_height()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1441 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1442 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1443 }
811
d2c169a725c8 updated for version 7.0c01
vimboss
parents: 418
diff changeset
1444 gui_set_shellsize(FALSE, TRUE, RESIZE_VERT);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1445 ui_new_shellsize();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1446 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1447
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
1448 #if defined(FEAT_BEVAL_GUI) || defined(PROTO)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1450 gui_mch_new_tooltip_font(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452 # ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 vimmenu_T *menu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455 if (toolBar == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1458 menu = gui_find_menu((char_u *)"ToolBar");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459 if (menu != NULL)
54
6bfddb1d126a updated for version 7.0029
vimboss
parents: 48
diff changeset
1460 submenu_change(menu, FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1465 gui_mch_new_tooltip_colors(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1466 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1467 # ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1468 vimmenu_T *toolbar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1469
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1470 if (toolBar == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1471 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1472
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1473 toolbar = gui_find_menu((char_u *)"ToolBar");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1474 if (toolbar != NULL)
54
6bfddb1d126a updated for version 7.0029
vimboss
parents: 48
diff changeset
1475 submenu_change(toolbar, TRUE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1476 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1477 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1478 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1479
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1480 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1481 submenu_change(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1482 vimmenu_T *menu,
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1483 int colors) // TRUE for colors, FALSE for font
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1484 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1485 vimmenu_T *mp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1486
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1487 for (mp = menu; mp != NULL; mp = mp->next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1488 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1489 if (mp->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1490 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1491 if (colors)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1492 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1493 gui_motif_menu_colors(mp->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1494 #ifdef FEAT_TOOLBAR
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1495 // For a toolbar item: Free the pixmap and allocate a new one,
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1496 // so that the background color is right.
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1497 if (mp->xpm != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1498 {
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1499 int n = 0;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1500 Arg args[18];
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1501
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
1502 n = add_pixmap_args(mp, args, n);
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
1503 XtSetValues(mp->id, args, n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1504 }
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
1505 # ifdef FEAT_BEVAL_GUI
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1506 // If we have a tooltip, then we need to change its font
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1507 if (mp->tip != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1508 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1509 Arg args[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1510
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1511 args[0].name = XmNbackground;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1512 args[0].value = gui.tooltip_bg_pixel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1513 args[1].name = XmNforeground;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1514 args[1].value = gui.tooltip_fg_pixel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1515 XtSetValues(mp->tip->balloonLabel, &args[0], XtNumber(args));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1516 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1517 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1518 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1519 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1520 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1521 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1522 gui_motif_menu_fontlist(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
1523 #ifdef FEAT_BEVAL_GUI
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1524 // If we have a tooltip, then we need to change its font
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1525 if (mp->tip != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1526 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1527 Arg args[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1528
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1529 args[0].name = XmNfontList;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1530 args[0].value = (XtArgVal)gui_motif_fontset2fontlist(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1531 &gui.tooltip_fontset);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1532 XtSetValues(mp->tip->balloonLabel, &args[0], XtNumber(args));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1533 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1534 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1535 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1536 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1537
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1538 if (mp->children != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1539 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1540 #if (XmVersion >= 1002)
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1541 // Set the colors/font for the tear off widget
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1542 if (mp->submenu_id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1543 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1544 if (colors)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1545 gui_motif_menu_colors(mp->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1546 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1547 gui_motif_menu_fontlist(mp->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1548 toggle_tearoff(mp->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1549 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1550 #endif
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1551 // Set the colors for the children
54
6bfddb1d126a updated for version 7.0029
vimboss
parents: 48
diff changeset
1552 submenu_change(mp->children, colors);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1553 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1554 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1555 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1556
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1557 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1558 * Destroy the machine specific menu widget.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1559 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1560 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1561 gui_mch_destroy_menu(vimmenu_T *menu)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1562 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1563 // Please be sure to destroy the parent widget first (i.e. menu->id).
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1564 // On the other hand, problems have been reported that the submenu must be
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1565 // deleted first...
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1566 if (menu->submenu_id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1567 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1568 XtDestroyWidget(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1569 menu->submenu_id = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1570 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1571
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1572 if (menu->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1573 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1574 Widget parent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1575
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1576 parent = XtParent(menu->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
1577 #if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI)
216
da182deebec7 updated for version 7.0061
vimboss
parents: 161
diff changeset
1578 if (parent == toolBar && menu->tip != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1579 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1580 // We try to destroy this before the actual menu, because there are
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1581 // callbacks, etc. that will be unregistered during the tooltip
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1582 // destruction.
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1583 //
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1584 // If you call "gui_mch_destroy_beval_area()" after destroying
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1585 // menu->id, then the tooltip's window will have already been
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1586 // deallocated by Xt, and unknown behaviour will ensue (probably
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1587 // a core dump).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1588 gui_mch_destroy_beval_area(menu->tip);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1589 menu->tip = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1590 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1591 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1592 XtDestroyWidget(menu->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1593 menu->id = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1594 if (parent == menuBar)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1595 gui_mch_compute_menu_height((Widget)0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1596 #ifdef FEAT_TOOLBAR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1597 else if (parent == toolBar)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1598 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1599 Cardinal num_children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1600
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1601 // When removing last toolbar item, don't display the toolbar.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1602 XtVaGetValues(toolBar, XmNnumChildren, &num_children, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1603 if (num_children == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1604 gui_mch_show_toolbar(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1605 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1606 gui.toolbar_height = gui_mch_compute_toolbar_height();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1607 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1608 #endif
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1612 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1613 gui_mch_show_popupmenu(vimmenu_T *menu UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1614 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1615 #ifdef MOTIF_POPUP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1616 XmMenuPosition(menu->submenu_id, gui_x11_get_last_mouse_event());
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1617 XtManageChild(menu->submenu_id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1618 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1619 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1620
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1621 #endif // FEAT_MENU
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1622
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1623 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1624 * Set the menu and scrollbar colors to their default values.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1625 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1626 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1627 gui_mch_def_colors(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1628 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1629 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1630 {
28067
e257b6be5bd6 patch 8.2.4558: Motif: using default colors does not work as expected
Bram Moolenaar <Bram@vim.org>
parents: 28051
diff changeset
1631 gui.menu_fg_pixel = gui_get_color((char_u *)gui.rsrc_menu_fg_name);
e257b6be5bd6 patch 8.2.4558: Motif: using default colors does not work as expected
Bram Moolenaar <Bram@vim.org>
parents: 28051
diff changeset
1632 gui.menu_bg_pixel = gui_get_color((char_u *)gui.rsrc_menu_bg_name);
e257b6be5bd6 patch 8.2.4558: Motif: using default colors does not work as expected
Bram Moolenaar <Bram@vim.org>
parents: 28051
diff changeset
1633 gui.scroll_fg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_fg_name);
e257b6be5bd6 patch 8.2.4558: Motif: using default colors does not work as expected
Bram Moolenaar <Bram@vim.org>
parents: 28051
diff changeset
1634 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
1635 #ifdef FEAT_BEVAL_GUI
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1636 gui.tooltip_fg_pixel =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1637 gui_get_color((char_u *)gui.rsrc_tooltip_fg_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1638 gui.tooltip_bg_pixel =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1639 gui_get_color((char_u *)gui.rsrc_tooltip_bg_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1640 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1641 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1642 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1643
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1644
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1645 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1646 * Scrollbar stuff.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1647 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1648
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1649 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1650 gui_mch_set_scrollbar_thumb(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1651 scrollbar_T *sb,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1652 long val,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1653 long size,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1654 long max)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1655 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1656 if (sb->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1657 XtVaSetValues(sb->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1658 XmNvalue, val,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1659 XmNsliderSize, size,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1660 XmNpageIncrement, (size > 2 ? size - 2 : 1),
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1661 XmNmaximum, max + 1, // Motif has max one past the end
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1662 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1663 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1664
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1665 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1666 gui_mch_set_scrollbar_pos(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1667 scrollbar_T *sb,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1668 int x,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1669 int y,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1670 int w,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1671 int h)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1672 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1673 if (sb->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1674 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1675 if (sb->type == SBAR_LEFT || sb->type == SBAR_RIGHT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1676 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1677 if (y == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1678 h -= gui.border_offset;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1679 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1680 y -= gui.border_offset;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1681 XtVaSetValues(sb->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1682 XmNtopOffset, y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1683 XmNbottomOffset, -y - h,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1684 XmNwidth, w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1685 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1686 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1687 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1688 XtVaSetValues(sb->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1689 XmNtopOffset, y,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1690 XmNleftOffset, x,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1691 XmNrightOffset, gui.which_scrollbars[SBAR_RIGHT]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1692 ? gui.scrollbar_width : 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1693 XmNheight, h,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1694 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1695 XtManageChild(sb->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1696 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1697 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1698
21355
fcccc29bd386 patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents: 20421
diff changeset
1699 int
fcccc29bd386 patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents: 20421
diff changeset
1700 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: 20421
diff changeset
1701 {
27587
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1702 int xpad;
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1703 Dimension tw, ww;
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1704 Position tx;
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1705
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1706 XtVaGetValues(textArea, XtNwidth, &tw, XtNx, &tx, NULL);
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1707 XtVaGetValues(vimShell, XtNwidth, &ww, NULL);
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1708 xpad = ww - tw - tx - gui.scrollbar_width;
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1709 return (xpad < 0) ? 0 : xpad;
21355
fcccc29bd386 patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents: 20421
diff changeset
1710 }
fcccc29bd386 patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents: 20421
diff changeset
1711
fcccc29bd386 patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents: 20421
diff changeset
1712 int
fcccc29bd386 patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents: 20421
diff changeset
1713 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: 20421
diff changeset
1714 {
27587
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1715 int ypad;
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1716 Dimension th, wh;
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1717 Position ty;
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1718
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1719 XtVaGetValues(textArea, XtNheight, &th, XtNy, &ty, NULL);
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1720 XtVaGetValues(vimShell, XtNheight, &wh, NULL);
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1721 ypad = wh - th - ty - gui.scrollbar_height;
298b32b544ae patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
1722 return (ypad < 0) ? 0 : ypad;
21355
fcccc29bd386 patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents: 20421
diff changeset
1723 }
fcccc29bd386 patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents: 20421
diff changeset
1724
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1725 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1726 gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1727 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1728 Arg args[16];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1729 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1730
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1731 if (sb->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1732 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1733 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1734 if (flag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1735 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1736 switch (sb->type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1737 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1738 case SBAR_LEFT:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1739 XtSetArg(args[n], XmNleftOffset, gui.scrollbar_width); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1740 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1741
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1742 case SBAR_RIGHT:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1743 XtSetArg(args[n], XmNrightOffset, gui.scrollbar_width); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1744 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1746 case SBAR_BOTTOM:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1747 XtSetArg(args[n], XmNbottomOffset, gui.scrollbar_height);n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1748 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1749 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1750 XtSetValues(textArea, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1751 XtManageChild(sb->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1752 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1753 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1754 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1755 if (!gui.which_scrollbars[sb->type])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1756 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1757 // The scrollbars of this type are all disabled, adjust the
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1758 // textArea attachment offset.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1759 switch (sb->type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1760 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761 case SBAR_LEFT:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1762 XtSetArg(args[n], XmNleftOffset, 0); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1763 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1764
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1765 case SBAR_RIGHT:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1766 XtSetArg(args[n], XmNrightOffset, 0); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1769 case SBAR_BOTTOM:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1770 XtSetArg(args[n], XmNbottomOffset, 0);n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1771 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1773 XtSetValues(textArea, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1774 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1775 XtUnmanageChild(sb->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1776 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1777 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1778 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1779
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1780 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1781 gui_mch_create_scrollbar(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1782 scrollbar_T *sb,
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1783 int orient) // SBAR_VERT or SBAR_HORIZ
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1784 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1785 Arg args[16];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1786 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1787
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1788 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1789 XtSetArg(args[n], XmNminimum, 0); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1790 XtSetArg(args[n], XmNorientation,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1791 (orient == SBAR_VERT) ? XmVERTICAL : XmHORIZONTAL); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1792
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1793 switch (sb->type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1794 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1795 case SBAR_LEFT:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1796 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1797 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1798 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1800
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1801 case SBAR_RIGHT:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1802 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1803 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1806
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1807 case SBAR_BOTTOM:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1808 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1810 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1811 break;
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 sb->id = XtCreateWidget("scrollBar",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1815 xmScrollBarWidgetClass, textAreaForm, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1816
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1817 if (sb->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1818 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1819 gui_mch_set_scrollbar_colors(sb);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1820 XtAddCallback(sb->id, XmNvalueChangedCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1821 scroll_cb, (XtPointer)sb->ident);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1822 XtAddCallback(sb->id, XmNdragCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 scroll_cb, (XtPointer)sb->ident);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1824 XtAddEventHandler(sb->id, KeyPressMask, FALSE, gui_x11_key_hit_cb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1825 (XtPointer)0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1827 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1828
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1829 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1830 gui_mch_destroy_scrollbar(scrollbar_T *sb)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1831 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1832 if (sb->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1833 XtDestroyWidget(sb->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1837 gui_mch_set_scrollbar_colors(scrollbar_T *sb)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1838 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1839 if (sb->id != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1840 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1841 if (gui.scroll_bg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1842 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1843 #if (XmVersion>=1002)
28067
e257b6be5bd6 patch 8.2.4558: Motif: using default colors does not work as expected
Bram Moolenaar <Bram@vim.org>
parents: 28051
diff changeset
1844 // This should not only set the through color but also adjust
e257b6be5bd6 patch 8.2.4558: Motif: using default colors does not work as expected
Bram Moolenaar <Bram@vim.org>
parents: 28051
diff changeset
1845 // related colors, such as shadows.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1846 XmChangeColor(sb->id, gui.scroll_bg_pixel);
28067
e257b6be5bd6 patch 8.2.4558: Motif: using default colors does not work as expected
Bram Moolenaar <Bram@vim.org>
parents: 28051
diff changeset
1847 #endif
e257b6be5bd6 patch 8.2.4558: Motif: using default colors does not work as expected
Bram Moolenaar <Bram@vim.org>
parents: 28051
diff changeset
1848
e257b6be5bd6 patch 8.2.4558: Motif: using default colors does not work as expected
Bram Moolenaar <Bram@vim.org>
parents: 28051
diff changeset
1849 // Set the through color directly, in case XmChangeColor() decided
e257b6be5bd6 patch 8.2.4558: Motif: using default colors does not work as expected
Bram Moolenaar <Bram@vim.org>
parents: 28051
diff changeset
1850 // to change it.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1851 XtVaSetValues(sb->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1852 XmNtroughColor, gui.scroll_bg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1853 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1854 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1855
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1856 if (gui.scroll_fg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1857 XtVaSetValues(sb->id,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1858 XmNforeground, gui.scroll_fg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1859 XmNbackground, gui.scroll_fg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1860 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1861 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1862
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
1863 // This is needed for the rectangle below the vertical scrollbars.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1864 if (sb == &gui.bottom_sbar && textAreaForm != (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1865 gui_motif_scroll_colors(textAreaForm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1866 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1867
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1868 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1869 * Miscellaneous stuff:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1870 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1871
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1872 Window
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
1873 gui_x11_get_wid(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1874 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1875 return(XtWindow(textArea));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1876 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1877
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1878 /*
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1879 * Look for a widget in the widget tree w, with a mnemonic matching keycode.
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1880 * When one is found, simulate a button press on that widget and give it the
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1881 * keyboard focus. If the mnemonic is on a label, look in the userData field
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1882 * of the label to see if it points to another widget, and give that the focus.
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1883 */
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1884 static void
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1885 do_mnemonic(Widget w, unsigned int keycode)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1886 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1887 WidgetList children;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1888 int numChildren, i;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1889 Boolean isMenu;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1890 KeySym mnemonic = '\0';
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1891 char mneString[2];
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1892 Widget userData;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1893 unsigned char rowColType;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1894
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1895 if (XtIsComposite(w))
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1896 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1897 if (XtClass(w) == xmRowColumnWidgetClass)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1898 {
1604
3acbcd0d3fd3 updated for version 7.1-317
vimboss
parents: 1522
diff changeset
1899 XtVaGetValues(w, XmNrowColumnType, &rowColType, NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1900 isMenu = (rowColType != (unsigned char)XmWORK_AREA);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1901 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1902 else
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1903 isMenu = False;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1904 if (!isMenu)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1905 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1906 XtVaGetValues(w, XmNchildren, &children, XmNnumChildren,
1604
3acbcd0d3fd3 updated for version 7.1-317
vimboss
parents: 1522
diff changeset
1907 &numChildren, NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1908 for (i = 0; i < numChildren; i++)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1909 do_mnemonic(children[i], keycode);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1910 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1911 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1912 else
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1913 {
1604
3acbcd0d3fd3 updated for version 7.1-317
vimboss
parents: 1522
diff changeset
1914 XtVaGetValues(w, XmNmnemonic, &mnemonic, NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1915 if (mnemonic != '\0')
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1916 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1917 mneString[0] = mnemonic;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1918 mneString[1] = '\0';
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1919 if (XKeysymToKeycode(XtDisplay(XtParent(w)),
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1920 XStringToKeysym(mneString)) == keycode)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1921 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1922 if (XtClass(w) == xmLabelWidgetClass
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1923 || XtClass(w) == xmLabelGadgetClass)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1924 {
1604
3acbcd0d3fd3 updated for version 7.1-317
vimboss
parents: 1522
diff changeset
1925 XtVaGetValues(w, XmNuserData, &userData, NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1926 if (userData != NULL && XtIsWidget(userData))
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1927 XmProcessTraversal(userData, XmTRAVERSE_CURRENT);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1928 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1929 else
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1930 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1931 XKeyPressedEvent keyEvent;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1932
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1933 XmProcessTraversal(w, XmTRAVERSE_CURRENT);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1934
20007
aadd1cae2ff5 patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents: 19934
diff changeset
1935 CLEAR_FIELD(keyEvent);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1936 keyEvent.type = KeyPress;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1937 keyEvent.serial = 1;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1938 keyEvent.send_event = True;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1939 keyEvent.display = XtDisplay(w);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1940 keyEvent.window = XtWindow(w);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1941 XtCallActionProc(w, "Activate", (XEvent *) & keyEvent,
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1942 NULL, 0);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1943 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1944 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1945 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1946 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1947 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1948
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1949 /*
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1950 * Callback routine for dialog mnemonic processing.
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1951 */
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1952 static void
24266
982786f8454d patch 8.2.2674: Motif: cancelling the font dialog resets the font
Bram Moolenaar <Bram@vim.org>
parents: 23501
diff changeset
1953 mnemonic_event(
982786f8454d patch 8.2.2674: Motif: cancelling the font dialog resets the font
Bram Moolenaar <Bram@vim.org>
parents: 23501
diff changeset
1954 Widget w,
982786f8454d patch 8.2.2674: Motif: cancelling the font dialog resets the font
Bram Moolenaar <Bram@vim.org>
parents: 23501
diff changeset
1955 XtPointer call_data UNUSED,
982786f8454d patch 8.2.2674: Motif: cancelling the font dialog resets the font
Bram Moolenaar <Bram@vim.org>
parents: 23501
diff changeset
1956 XKeyEvent *event,
982786f8454d patch 8.2.2674: Motif: cancelling the font dialog resets the font
Bram Moolenaar <Bram@vim.org>
parents: 23501
diff changeset
1957 Boolean *b UNUSED)
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1958 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1959 do_mnemonic(w, event->keycode);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1960 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1961
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1962
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1963 /*
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1964 * Search the widget tree under w for widgets with mnemonics. When found, add
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1965 * a passive grab to the dialog widget for the mnemonic character, thus
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1966 * directing mnemonic events to the dialog widget.
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1967 */
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1968 static void
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1969 add_mnemonic_grabs(Widget dialog, Widget w)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1970 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1971 char mneString[2];
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1972 WidgetList children;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1973 int numChildren, i;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1974 Boolean isMenu;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1975 KeySym mnemonic = '\0';
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1976 unsigned char rowColType;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1977
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1978 if (XtIsComposite(w))
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1979 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1980 if (XtClass(w) == xmRowColumnWidgetClass)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1981 {
1604
3acbcd0d3fd3 updated for version 7.1-317
vimboss
parents: 1522
diff changeset
1982 XtVaGetValues(w, XmNrowColumnType, &rowColType, NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1983 isMenu = (rowColType != (unsigned char)XmWORK_AREA);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1984 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1985 else
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1986 isMenu = False;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1987 if (!isMenu)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1988 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1989 XtVaGetValues(w, XmNchildren, &children, XmNnumChildren,
1604
3acbcd0d3fd3 updated for version 7.1-317
vimboss
parents: 1522
diff changeset
1990 &numChildren, NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1991 for (i = 0; i < numChildren; i++)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1992 add_mnemonic_grabs(dialog, children[i]);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1993 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1994 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1995 else
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1996 {
1604
3acbcd0d3fd3 updated for version 7.1-317
vimboss
parents: 1522
diff changeset
1997 XtVaGetValues(w, XmNmnemonic, &mnemonic, NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1998 if (mnemonic != '\0')
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
1999 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2000 mneString[0] = mnemonic;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2001 mneString[1] = '\0';
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2002 XtGrabKey(dialog, XKeysymToKeycode(XtDisplay(dialog),
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2003 XStringToKeysym(mneString)),
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2004 Mod1Mask, True, GrabModeAsync, GrabModeAsync);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2005 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2006 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2007 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2008
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2009 /*
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2010 * Add a handler for mnemonics in a dialog. Motif itself only handles
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2011 * mnemonics in menus. Mnemonics added or changed after this call will be
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2012 * ignored.
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2013 *
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2014 * To add a mnemonic to a text field or list, set the XmNmnemonic resource on
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2015 * the appropriate label and set the XmNuserData resource of the label to the
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2016 * widget to get the focus when the mnemonic is typed.
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2017 */
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2018 static void
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2019 activate_dialog_mnemonics(Widget dialog)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2020 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2021 if (!dialog)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2022 return;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2023
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2024 XtAddEventHandler(dialog, KeyPressMask, False,
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2025 (XtEventHandler) mnemonic_event, (XtPointer) NULL);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2026 add_mnemonic_grabs(dialog, dialog);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2027 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2028
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2029 /*
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2030 * Removes the event handler and key-grabs for dialog mnemonic handling.
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2031 */
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2032 static void
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2033 suppress_dialog_mnemonics(Widget dialog)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2034 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2035 if (!dialog)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2036 return;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2037
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2038 XtUngrabKey(dialog, AnyKey, Mod1Mask);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2039 XtRemoveEventHandler(dialog, KeyPressMask, False,
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2040 (XtEventHandler) mnemonic_event, (XtPointer) NULL);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2041 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2042
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2043 #if defined(FEAT_BROWSE) || defined(FEAT_GUI_DIALOG)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2044 /*
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2045 * Use the 'guifont' or 'guifontset' as a fontlist for a dialog widget.
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2046 */
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2047 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2048 set_fontlist(Widget id)
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2049 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2050 XmFontList fl;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2051
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2052 #ifdef FONTSET_ALWAYS
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
2053 if (gui.fontset != NOFONTSET)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
2054 {
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2055 fl = gui_motif_fontset2fontlist((XFontSet *)&gui.fontset);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2056 if (fl != NULL)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2057 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2058 if (XtIsManaged(id))
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2059 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2060 XtUnmanageChild(id);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2061 XtVaSetValues(id, XmNfontList, fl, NULL);
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2062 // We should force the widget to recalculate its
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2063 // geometry now.
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2064 XtManageChild(id);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2065 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2066 else
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2067 XtVaSetValues(id, XmNfontList, fl, NULL);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2068 XmFontListFree(fl);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2069 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2070 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2071 #else
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
2072 if (gui.norm_font != NOFONT)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
2073 {
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2074 fl = gui_motif_create_fontlist((XFontStruct *)gui.norm_font);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2075 if (fl != NULL)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2076 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2077 if (XtIsManaged(id))
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2078 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2079 XtUnmanageChild(id);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2080 XtVaSetValues(id, XmNfontList, fl, NULL);
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2081 // We should force the widget to recalculate its
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2082 // geometry now.
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2083 XtManageChild(id);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2084 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2085 else
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2086 XtVaSetValues(id, XmNfontList, fl, NULL);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2087 XmFontListFree(fl);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2088 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2089 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2090 #endif
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2091 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2092 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2093
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2094 #if defined(FEAT_BROWSE) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2095
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2096 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2097 * file selector related stuff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2098 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2099
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2100 #include <Xm/FileSB.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2101 #include <Xm/XmStrDefs.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2103 typedef struct dialog_callback_arg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2104 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2105 char * args; // not used right now
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2106 int id;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2107 } dcbarg_T;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2108
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2109 static Widget dialog_wgt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2110 static char *browse_fname = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2111 static XmStringCharSet charset = (XmStringCharSet) XmSTRING_DEFAULT_CHARSET;
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2112 // used to set up XmStrings
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2113
7801
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
2114 static void DialogCancelCB(Widget, XtPointer, XtPointer);
a1e71a01dbd6 commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents: 6819
diff changeset
2115 static void DialogAcceptCB(Widget, XtPointer, XtPointer);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2117 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2118 * This function is used to translate the predefined label text of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2119 * precomposed dialogs. We do this explicitly to allow:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2120 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2121 * - usage of gettext for translation, as in all the other places.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2122 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2123 * - equalize the messages between different GUI implementations as far as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2124 * possible.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2125 */
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2126 static void
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2127 set_predefined_label(Widget parent, String name, char *new_label)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2128 {
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2129 XmString str;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2130 Widget w;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2131 char_u *p, *next;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2132 KeySym mnemonic = NUL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2133
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2134 w = XtNameToWidget(parent, name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2136 if (!w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2137 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2138
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2139 p = vim_strsave((char_u *)new_label);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2140 if (p == NULL)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2141 return;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2142 for (next = p; *next; ++next)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2143 {
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2144 if (*next == DLG_HOTKEY_CHAR)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2145 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2146 int len = STRLEN(next);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2147
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2148 if (len > 0)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2149 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2150 mch_memmove(next, next + 1, len);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2151 mnemonic = next[0];
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2152 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2153 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2154 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2155
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2156 str = XmStringCreate((char *)p, STRING_TAG);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2157 vim_free(p);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2158
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2159 if (str != NULL)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2160 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2161 XtVaSetValues(w,
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2162 XmNlabelString, str,
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2163 XmNmnemonic, mnemonic,
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2164 NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2165 XmStringFree(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2166 }
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2167 gui_motif_menu_fontlist(w);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2168 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2169
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2170 static void
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2171 set_predefined_fontlist(Widget parent, String name)
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2172 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2173 Widget w;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2174 w = XtNameToWidget(parent, name);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2175
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2176 if (!w)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2177 return;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2178
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2179 set_fontlist(w);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2180 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2181
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2182 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2183 * Put up a file requester.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2184 * Returns the selected name in allocated memory, or NULL for Cancel.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2185 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2186 char_u *
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2187 gui_mch_browse(
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2188 int saving UNUSED, // select file to write
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2189 char_u *title, // title for the window
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2190 char_u *dflt, // default name
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2191 char_u *ext UNUSED, // not used (extension added)
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2192 char_u *initdir, // initial directory, NULL for current dir
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2193 char_u *filter) // file name filter
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2194 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2195 char_u dirbuf[MAXPATHL];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2196 char_u dfltbuf[MAXPATHL];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2197 char_u *pattern;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2198 char_u *tofree = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2199
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2200 // There a difference between the resource name and value, Therefore, we
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2201 // avoid to (ab-)use the (maybe internationalized!) dialog title as a
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2202 // dialog name.
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2203
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2204 dialog_wgt = XmCreateFileSelectionDialog(vimShell, "browseDialog", NULL, 0);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2205
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2206 if (initdir == NULL || *initdir == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2207 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2208 mch_dirname(dirbuf, MAXPATHL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2209 initdir = dirbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2210 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2211
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2212 if (dflt == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2213 dflt = (char_u *)"";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2214 else if (STRLEN(initdir) + STRLEN(dflt) + 2 < MAXPATHL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2215 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2216 // The default selection should be the full path, "dflt" is only the
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2217 // file name.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2218 STRCPY(dfltbuf, initdir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2219 add_pathsep(dfltbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2220 STRCAT(dfltbuf, dflt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2221 dflt = dfltbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2222 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2223
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2224 // Can only use one pattern for a file name. Get the first pattern out of
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2225 // the filter. An empty pattern means everything matches.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2226 if (filter == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2227 pattern = (char_u *)"";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2228 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2229 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2230 char_u *s, *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2231
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2232 s = filter;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2233 for (p = filter; *p != NUL; ++p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2234 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2235 if (*p == '\t') // end of description, start of pattern
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2236 s = p + 1;
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2237 if (*p == ';' || *p == '\n') // end of (first) pattern
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2238 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2239 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2240 pattern = vim_strnsave(s, p - s);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2241 tofree = pattern;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2242 if (pattern == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2243 pattern = (char_u *)"";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2244 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2245
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2246 XtVaSetValues(dialog_wgt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2247 XtVaTypedArg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2248 XmNdirectory, XmRString, (char *)initdir, STRLEN(initdir) + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2249 XtVaTypedArg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2250 XmNdirSpec, XmRString, (char *)dflt, STRLEN(dflt) + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2251 XtVaTypedArg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2252 XmNpattern, XmRString, (char *)pattern, STRLEN(pattern) + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2253 XtVaTypedArg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2254 XmNdialogTitle, XmRString, (char *)title, STRLEN(title) + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2255 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2256
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2257 set_predefined_label(dialog_wgt, "Apply", _("&Filter"));
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2258 set_predefined_label(dialog_wgt, "Cancel", _("&Cancel"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2259 set_predefined_label(dialog_wgt, "Dir", _("Directories"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2260 set_predefined_label(dialog_wgt, "FilterLabel", _("Filter"));
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2261 set_predefined_label(dialog_wgt, "Help", _("&Help"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2262 set_predefined_label(dialog_wgt, "Items", _("Files"));
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2263 set_predefined_label(dialog_wgt, "OK", _("&OK"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2264 set_predefined_label(dialog_wgt, "Selection", _("Selection"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2265
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2266 // This is to save us from silly external settings using not fixed with
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2267 // fonts for file selection.
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2268 set_predefined_fontlist(dialog_wgt, "DirListSW.DirList");
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2269 set_predefined_fontlist(dialog_wgt, "ItemsListSW.ItemsList");
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2270
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2271 gui_motif_menu_colors(dialog_wgt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2272 if (gui.scroll_bg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2273 XtVaSetValues(dialog_wgt, XmNtroughColor, gui.scroll_bg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2275 XtAddCallback(dialog_wgt, XmNokCallback, DialogAcceptCB, (XtPointer)0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2276 XtAddCallback(dialog_wgt, XmNcancelCallback, DialogCancelCB, (XtPointer)0);
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2277 // We have no help in this window, so hide help button
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2278 XtUnmanageChild(XmFileSelectionBoxGetChild(dialog_wgt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2279 (unsigned char)XmDIALOG_HELP_BUTTON));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2281 manage_centered(dialog_wgt);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2282 activate_dialog_mnemonics(dialog_wgt);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2283
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2284 // sit in a loop until the dialog box has gone away
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2285 do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2286 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2287 XtAppProcessEvent(XtWidgetToApplicationContext(dialog_wgt),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2288 (XtInputMask)XtIMAll);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2289 } while (XtIsManaged(dialog_wgt));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2290
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2291 suppress_dialog_mnemonics(dialog_wgt);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2292 XtDestroyWidget(dialog_wgt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2293 vim_free(tofree);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2294
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2295 if (browse_fname == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2296 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2297 return vim_strsave((char_u *)browse_fname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2298 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2299
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2300 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2301 * The code below was originally taken from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2302 * /usr/examples/motif/xmsamplers/xmeditor.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2303 * on Digital Unix 4.0d, but heavily modified.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2304 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2305
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2306 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2307 * Process callback from Dialog cancel actions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2308 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2309 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2310 DialogCancelCB(
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2311 Widget w UNUSED, // widget id
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2312 XtPointer client_data UNUSED, // data from application
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2313 XtPointer call_data UNUSED) // data from widget class
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2314 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2315 if (browse_fname != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2316 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2317 XtFree(browse_fname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2318 browse_fname = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2319 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2320 XtUnmanageChild(dialog_wgt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2321 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2322
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2323 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2324 * Process callback from Dialog actions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2325 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2326 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2327 DialogAcceptCB(
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2328 Widget w UNUSED, // widget id
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2329 XtPointer client_data UNUSED, // data from application
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2330 XtPointer call_data) // data from widget class
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2331 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2332 XmFileSelectionBoxCallbackStruct *fcb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2333
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2334 if (browse_fname != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2335 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2336 XtFree(browse_fname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2337 browse_fname = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2338 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2339 fcb = (XmFileSelectionBoxCallbackStruct *)call_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2340
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2341 // get the filename from the file selection box
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2342 XmStringGetLtoR(fcb->value, charset, &browse_fname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2343
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2344 // popdown the file selection box
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2345 XtUnmanageChild(dialog_wgt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2346 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2347
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2348 #endif // FEAT_BROWSE
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2349
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2350 #if defined(FEAT_GUI_DIALOG) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2351
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2352 static int dialogStatus;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2353
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2354 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2355 * Callback function for the textfield. When CR is hit this works like
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2356 * hitting the "OK" button, ESC like "Cancel".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2357 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2358 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2359 keyhit_callback(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2360 Widget w,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2361 XtPointer client_data UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2362 XEvent *event,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2363 Boolean *cont UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2364 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2365 char buf[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2366 KeySym key_sym;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2367
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2368 if (XLookupString(&(event->xkey), buf, 2, &key_sym, NULL) == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2369 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2370 if (*buf == CAR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2371 dialogStatus = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2372 else if (*buf == ESC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2373 dialogStatus = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2374 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2375 if ((key_sym == XK_Left || key_sym == XK_Right)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2376 && !(event->xkey.state & ShiftMask))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2377 XmTextFieldClearSelection(w, XtLastTimestampProcessed(gui.dpy));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2378 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2379
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2380 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2381 butproc(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2382 Widget w UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2383 XtPointer client_data,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2384 XtPointer call_data UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2385 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2386 dialogStatus = (int)(long)client_data + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2387 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2388
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2389 #ifdef HAVE_XPM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2390
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2391 static Widget
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2392 create_pixmap_label(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2393 Widget parent,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2394 String name,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2395 char **data,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2396 ArgList args,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2397 Cardinal arg)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2398 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2399 Widget label;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2400 Display *dsp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2401 Screen *scr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2402 int depth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2403 Pixmap pixmap = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2404 XpmAttributes attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2405 Boolean rs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2406 XpmColorSymbol color[5] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2407 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2408 {"none", NULL, 0},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2409 {"iconColor1", NULL, 0},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2410 {"bottomShadowColor", NULL, 0},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2411 {"topShadowColor", NULL, 0},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2412 {"selectColor", NULL, 0}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2413 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2414
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2415 label = XmCreateLabelGadget(parent, name, args, arg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2416
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2417 /*
1207
beed57a8fcd1 updated for version 7.1b
vimboss
parents: 856
diff changeset
2418 * We need to be careful here, since in case of gadgets, there is
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2419 * no way to get the background color directly from the widget itself.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2420 * In such cases we get it from The Core part of his parent instead.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2421 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2422 dsp = XtDisplayOfObject(label);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2423 scr = XtScreenOfObject(label);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2424 XtVaGetValues(XtIsSubclass(label, coreWidgetClass)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2425 ? label : XtParent(label),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2426 XmNdepth, &depth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2427 XmNbackground, &color[0].pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2428 XmNforeground, &color[1].pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2429 XmNbottomShadowColor, &color[2].pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2430 XmNtopShadowColor, &color[3].pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2431 XmNhighlight, &color[4].pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2432 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2433
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2434 attr.valuemask = XpmColorSymbols | XpmCloseness | XpmDepth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2435 attr.colorsymbols = color;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2436 attr.numsymbols = 5;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2437 attr.closeness = 65535;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2438 attr.depth = depth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2439 XpmCreatePixmapFromData(dsp, RootWindowOfScreen(scr),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2440 data, &pixmap, NULL, &attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2441
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2442 XtVaGetValues(label, XmNrecomputeSize, &rs, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2443 XtVaSetValues(label, XmNrecomputeSize, True, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2444 XtVaSetValues(label,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2445 XmNlabelType, XmPIXMAP,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2446 XmNlabelPixmap, pixmap,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2447 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2448 XtVaSetValues(label, XmNrecomputeSize, rs, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2449
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2450 return label;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2451 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2452 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2453
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2454 int
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2455 gui_mch_dialog(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2456 int type UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2457 char_u *title,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2458 char_u *message,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2459 char_u *button_names,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2460 int dfltbutton,
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2461 char_u *textfield, // buffer of size IOSIZE
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2462 int ex_cmd UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2463 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2464 char_u *buts;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2465 char_u *p, *next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2466 XtAppContext app;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2467 XmString label;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2468 int butcount;
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2469 Widget w;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2470 Widget dialogform = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2471 Widget form = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2472 Widget dialogtextfield = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2473 Widget *buttons;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2474 Widget sep_form = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2475 Boolean vertical;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2476 Widget separator = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2477 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2478 Arg args[6];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2479 #ifdef HAVE_XPM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2480 char **icon_data = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2481 Widget dialogpixmap = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2482 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2483
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2484 if (title == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2485 title = (char_u *)_("Vim dialog");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2486
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2487 // if our pointer is currently hidden, then we should show it.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2488 gui_mch_mousehide(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2489
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2490 dialogform = XmCreateFormDialog(vimShell, (char *)"dialog", NULL, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2491
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2492 // Check 'v' flag in 'guioptions': vertical button placement.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2493 vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2494
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2495 // Set the title of the Dialog window
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2496 label = XmStringCreateSimple((char *)title);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2497 if (label == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2498 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2499 XtVaSetValues(dialogform,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2500 XmNdialogTitle, label,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2501 XmNhorizontalSpacing, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2502 XmNverticalSpacing, vertical ? 0 : 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2503 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2504 XmStringFree(label);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2505
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2506 // make a copy, so that we can insert NULs
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2507 buts = vim_strsave(button_names);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2508 if (buts == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2509 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2510
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2511 // Count the number of buttons and allocate buttons[].
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2512 butcount = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2513 for (p = buts; *p; ++p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2514 if (*p == DLG_BUTTON_SEP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2515 ++butcount;
16825
ce04ebdf26b8 patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents: 16764
diff changeset
2516 buttons = ALLOC_MULT(Widget, butcount);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2517 if (buttons == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2518 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2519 vim_free(buts);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2520 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2521 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2522
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2523 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2524 * Create the buttons.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2525 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2526 sep_form = (Widget) 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2527 p = buts;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2528 for (butcount = 0; *p; ++butcount)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2529 {
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2530 KeySym mnemonic = NUL;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2531
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2532 for (next = p; *next; ++next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2533 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2534 if (*next == DLG_HOTKEY_CHAR)
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2535 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2536 int len = STRLEN(next);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2537
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2538 if (len > 0)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2539 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2540 mch_memmove(next, next + 1, len);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2541 mnemonic = next[0];
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2542 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2543 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2544 if (*next == DLG_BUTTON_SEP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2545 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2546 *next++ = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2547 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2548 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2549 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2550 label = XmStringCreate(_((char *)p), STRING_TAG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2551 if (label == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2552 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2553
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2554 buttons[butcount] = XtVaCreateManagedWidget("button",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2555 xmPushButtonWidgetClass, dialogform,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2556 XmNlabelString, label,
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2557 XmNmnemonic, mnemonic,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2558 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2559 XmNbottomOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2560 XmNshowAsDefault, butcount == dfltbutton - 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2561 XmNdefaultButtonShadowThickness, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2562 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2563 XmStringFree(label);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2564 gui_motif_menu_fontlist(buttons[butcount]);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2565
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2566 // Layout properly.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2567
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2568 if (butcount > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2569 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2570 if (vertical)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2571 XtVaSetValues(buttons[butcount],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2572 XmNtopWidget, buttons[butcount - 1],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2573 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2574 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2575 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2576 if (*next == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2577 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2578 XtVaSetValues(buttons[butcount],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2579 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2580 XmNrightOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2581 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2582
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2583 // fill in a form as invisible separator
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2584 sep_form = XtVaCreateWidget("separatorForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2585 xmFormWidgetClass, dialogform,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2586 XmNleftAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2587 XmNleftWidget, buttons[butcount - 1],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2588 XmNrightAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2589 XmNrightWidget, buttons[butcount],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2590 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2591 XmNbottomOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2592 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2593 XtManageChild(sep_form);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2594 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2595 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2596 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2597 XtVaSetValues(buttons[butcount],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2598 XmNleftAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2599 XmNleftWidget, buttons[butcount - 1],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2600 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2601 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2602 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2603 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2604 else if (!vertical)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2605 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2606 if (*next == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2607 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2608 XtVaSetValues(buttons[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2609 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2610 XmNrightOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2611 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2612
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2613 // fill in a form as invisible separator
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2614 sep_form = XtVaCreateWidget("separatorForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2615 xmFormWidgetClass, dialogform,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2616 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2617 XmNleftOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2618 XmNrightAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2619 XmNrightWidget, buttons[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2620 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2621 XmNbottomOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2622 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2623 XtManageChild(sep_form);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2624 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2625 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2626 XtVaSetValues(buttons[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2627 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2628 XmNleftOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2629 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2630 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2631
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2632 XtAddCallback(buttons[butcount], XmNactivateCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2633 (XtCallbackProc)butproc, (XtPointer)(long)butcount);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2634 p = next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2635 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2636 vim_free(buts);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2637
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2638 separator = (Widget) 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2639 if (butcount > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2640 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2641 // Create the separator for beauty.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2642 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2643 XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2644 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2645 XtSetArg(args[n], XmNbottomWidget, buttons[0]); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2646 XtSetArg(args[n], XmNbottomOffset, 4); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2647 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2648 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2649 separator = XmCreateSeparatorGadget(dialogform, "separator", args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2650 XtManageChild(separator);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2651 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2652
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2653 if (textfield != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2654 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2655 dialogtextfield = XtVaCreateWidget("textField",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2656 xmTextFieldWidgetClass, dialogform,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2657 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2658 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2659 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2660 if (butcount > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2661 XtVaSetValues(dialogtextfield,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2662 XmNbottomAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2663 XmNbottomWidget, separator,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2664 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2665 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2666 XtVaSetValues(dialogtextfield,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2667 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2668 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2669
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2670 set_fontlist(dialogtextfield);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2671 XmTextFieldSetString(dialogtextfield, (char *)textfield);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2672 XtManageChild(dialogtextfield);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2673 XtAddEventHandler(dialogtextfield, KeyPressMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2674 (XtEventHandler)keyhit_callback, (XtPointer)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2675 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2676
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2677 // Form holding both message and pixmap labels
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2678 form = XtVaCreateWidget("separatorForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2679 xmFormWidgetClass, dialogform,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2680 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2681 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2682 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2683 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2684 XtManageChild(form);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2685
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2686 #ifdef HAVE_XPM
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2687 // Add a pixmap, left of the message.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2688 switch (type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2689 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2690 case VIM_GENERIC:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2691 icon_data = generic_xpm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2692 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2693 case VIM_ERROR:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2694 icon_data = error_xpm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2695 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2696 case VIM_WARNING:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2697 icon_data = alert_xpm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2698 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2699 case VIM_INFO:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2700 icon_data = info_xpm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2701 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2702 case VIM_QUESTION:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2703 icon_data = quest_xpm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2704 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2705 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2706 icon_data = generic_xpm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2707 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2708
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2709 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2710 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2711 XtSetArg(args[n], XmNtopOffset, 8); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2712 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2713 XtSetArg(args[n], XmNbottomOffset, 8); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2714 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2715 XtSetArg(args[n], XmNleftOffset, 8); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2716
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2717 dialogpixmap = create_pixmap_label(form, "dialogPixmap",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2718 icon_data, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2719 XtManageChild(dialogpixmap);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2720 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2721
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2722 // Create the dialog message.
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2723 // Since LessTif is apparently having problems with the creation of
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2724 // properly localized string, we use LtoR here. The symptom is that the
26771
fc859aea8cec patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
2725 // string is not shown properly in multiple lines as it does in native
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2726 // Motif.
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2727 label = XmStringCreateLtoR((char *)message, STRING_TAG);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2728 if (label == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2729 return -1;
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2730 w = XtVaCreateManagedWidget("dialogMessage",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2731 xmLabelGadgetClass, form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2732 XmNlabelString, label,
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2733 XmNalignment, XmALIGNMENT_BEGINNING,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2734 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2735 XmNtopOffset, 8,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2736 #ifdef HAVE_XPM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2737 XmNleftAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2738 XmNleftWidget, dialogpixmap,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2739 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2740 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2741 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2742 XmNleftOffset, 8,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2743 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2744 XmNrightOffset, 8,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2745 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2746 XmNbottomOffset, 8,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2747 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2748 XmStringFree(label);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2749 set_fontlist(w);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2750
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2751 if (textfield != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2752 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2753 XtVaSetValues(form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2754 XmNbottomAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2755 XmNbottomWidget, dialogtextfield,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2756 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2757 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2758 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2759 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2760 if (butcount > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2761 XtVaSetValues(form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2762 XmNbottomAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2763 XmNbottomWidget, separator,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2764 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2765 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2766 XtVaSetValues(form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2767 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2768 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2769 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2770
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2771 if (dfltbutton < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2772 dfltbutton = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2773 if (dfltbutton > butcount)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2774 dfltbutton = butcount;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2775 XtVaSetValues(dialogform,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2776 XmNdefaultButton, buttons[dfltbutton - 1], NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2777 if (textfield != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2778 XtVaSetValues(dialogform, XmNinitialFocus, dialogtextfield, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2779 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2780 XtVaSetValues(dialogform, XmNinitialFocus, buttons[dfltbutton - 1],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2781 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2782
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2783 manage_centered(dialogform);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2784 activate_dialog_mnemonics(dialogform);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2785
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2786 if (textfield != NULL && *textfield != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2787 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2788 // This only works after the textfield has been realised.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2789 XmTextFieldSetSelection(dialogtextfield,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2790 (XmTextPosition)0, (XmTextPosition)STRLEN(textfield),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2791 XtLastTimestampProcessed(gui.dpy));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2792 XmTextFieldSetCursorPosition(dialogtextfield,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2793 (XmTextPosition)STRLEN(textfield));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2794 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2795
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2796 app = XtWidgetToApplicationContext(dialogform);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2797
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2798 // Loop until a button is pressed or the dialog is killed somehow.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2799 dialogStatus = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2800 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2801 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2802 XtAppProcessEvent(app, (XtInputMask)XtIMAll);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2803 if (dialogStatus >= 0 || !XtIsManaged(dialogform))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2804 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2805 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2806
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2807 vim_free(buttons);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2808
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2809 if (textfield != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2810 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2811 p = (char_u *)XmTextGetString(dialogtextfield);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2812 if (p == NULL || dialogStatus < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2813 *textfield = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2814 else
418
84825cc6f049 updated for version 7.0109
vimboss
parents: 216
diff changeset
2815 vim_strncpy(textfield, p, IOSIZE - 1);
2137
dabcabce3f9d updated for version 7.2.419
Bram Moolenaar <bram@zimbu.org>
parents: 1887
diff changeset
2816 XtFree((char *)p);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2817 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2818
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
2819 suppress_dialog_mnemonics(dialogform);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2820 XtDestroyWidget(dialogform);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2821
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2822 return dialogStatus;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2823 }
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2824 #endif // FEAT_GUI_DIALOG
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2825
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2826 #if defined(FEAT_TOOLBAR) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2827 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2828 gui_mch_show_toolbar(int showit)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2829 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2830 Cardinal numChildren; // how many children toolBar has
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2831
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2832 if (toolBar == (Widget)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2833 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2834 XtVaGetValues(toolBar, XmNnumChildren, &numChildren, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2835 if (showit && numChildren > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2836 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2837 // Assume that we want to show the toolbar if p_toolbar contains
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2838 // valid option settings, therefore p_toolbar must not be NULL.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2839 WidgetList children;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2840
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2841 XtVaGetValues(toolBar, XmNchildren, &children, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2842 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2843 void (*action)(BalloonEval *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2844 int text = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2845
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2846 if (strstr((const char *)p_toolbar, "tooltips"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2847 action = &gui_mch_enable_beval_area;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2848 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2849 action = &gui_mch_disable_beval_area;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2850 if (strstr((const char *)p_toolbar, "text"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2851 text = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2852 else if (strstr((const char *)p_toolbar, "icons"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2853 text = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2854 if (text != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2855 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2856 vimmenu_T *toolbar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2857 vimmenu_T *cur;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2858
19934
3ff714d765ba patch 8.2.0523: loops are repeated
Bram Moolenaar <Bram@vim.org>
parents: 18788
diff changeset
2859 FOR_ALL_MENUS(toolbar)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2860 if (menu_is_toolbar(toolbar->dname))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2861 break;
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2862 // Assumption: toolbar is NULL if there is no toolbar,
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2863 // otherwise it contains the toolbar menu structure.
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2864 //
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2865 // Assumption: "numChildren" == the number of items in the list
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2866 // of items beginning with toolbar->children.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2867 if (toolbar)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2868 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2869 for (cur = toolbar->children; cur; cur = cur->next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2870 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2871 Arg args[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2872 int n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2873
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2874 // Enable/Disable tooltip (OK to enable while
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2875 // currently enabled).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2876 if (cur->tip != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2877 (*action)(cur->tip);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2878 if (!menu_is_separator(cur->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2879 {
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
2880 if (text == 1 || cur->xpm == NULL)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
2881 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2882 XtSetArg(args[n], XmNlabelType, XmSTRING);
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
2883 ++n;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
2884 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2885 if (cur->id != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2886 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2887 XtUnmanageChild(cur->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2888 XtSetValues(cur->id, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2889 XtManageChild(cur->id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2890 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2891 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2892 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2893 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2894 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2895 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2896 gui.toolbar_height = gui_mch_compute_toolbar_height();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2897 XtManageChild(XtParent(toolBar));
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2898 #ifdef FEAT_GUI_TABLINE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2899 if (showing_tabline)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2900 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2901 XtVaSetValues(tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2902 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2903 XmNtopWidget, XtParent(toolBar),
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2904 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2905 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2906 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2907 XmNtopWidget, tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2908 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2909 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2910 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2911 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2912 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2913 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2914 XmNtopWidget, XtParent(toolBar),
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2915 NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2916 if (XtIsManaged(menuBar))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2917 XtVaSetValues(XtParent(toolBar),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2918 XmNtopAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2919 XmNtopWidget, menuBar,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2920 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2921 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2922 XtVaSetValues(XtParent(toolBar),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2923 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2924 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2925 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2926 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2927 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2928 gui.toolbar_height = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2929 if (XtIsManaged(menuBar))
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2930 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2931 #ifdef FEAT_GUI_TABLINE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2932 if (showing_tabline)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2933 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2934 XtVaSetValues(tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2935 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2936 XmNtopWidget, menuBar,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2937 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2938 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2939 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2940 XmNtopWidget, tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2941 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2942 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2943 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2944 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2945 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2946 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2947 XmNtopWidget, menuBar,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2948 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2949 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2950 else
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2951 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2952 #ifdef FEAT_GUI_TABLINE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2953 if (showing_tabline)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2954 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2955 XtVaSetValues(tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2956 XmNtopAttachment, XmATTACH_FORM,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2957 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2958 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2959 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2960 XmNtopWidget, tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2961 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2962 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2963 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2964 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2965 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2966 XmNtopAttachment, XmATTACH_FORM,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2967 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
2968 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2969
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2970 XtUnmanageChild(XtParent(toolBar));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2971 }
811
d2c169a725c8 updated for version 7.0c01
vimboss
parents: 418
diff changeset
2972 gui_set_shellsize(FALSE, FALSE, RESIZE_VERT);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2973 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2974
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2975 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2976 * A toolbar button has been pushed; now reset the input focus
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2977 * such that the user can type page up/down etc. and have the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2978 * input go to the editor window, not the button
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2979 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2980 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2981 reset_focus(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2982 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2983 if (textArea != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2984 XmProcessTraversal(textArea, XmTRAVERSE_CURRENT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2985 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2986
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2987 int
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
2988 gui_mch_compute_toolbar_height(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2989 {
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
2990 Dimension borders;
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2991 Dimension height; // total Toolbar height
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2992 Dimension whgt; // height of each widget
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2993 WidgetList children; // list of toolBar's children
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
2994 Cardinal numChildren; // how many children toolBar has
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2995 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2996
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
2997 borders = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2998 height = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2999 if (toolBar != (Widget)0 && toolBarFrame != (Widget)0)
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3000 { // get height of XmFrame parent
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3001 Dimension fst;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3002 Dimension fmh;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3003 Dimension tst;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3004 Dimension tmh;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3005
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3006 XtVaGetValues(toolBarFrame,
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3007 XmNshadowThickness, &fst,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3008 XmNmarginHeight, &fmh,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3009 NULL);
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3010 borders += fst + fmh;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3011 XtVaGetValues(toolBar,
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3012 XmNshadowThickness, &tst,
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3013 XmNmarginHeight, &tmh,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3014 XmNchildren, &children,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3015 XmNnumChildren, &numChildren, NULL);
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3016 borders += tst + tmh;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1604
diff changeset
3017 for (i = 0; i < (int)numChildren; i++)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3018 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3019 whgt = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3020 XtVaGetValues(children[i], XmNheight, &whgt, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3021 if (height < whgt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3022 height = whgt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3023 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3024 }
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3025 #ifdef LESSTIF_VERSION
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3026 // Hack: When starting up we get wrong dimensions.
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3027 if (height < 10)
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3028 height = 24;
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3029 #endif
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3030
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3031 return (int)(height + (borders << 1));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3032 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3033
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
3034 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3035 motif_get_toolbar_colors(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3036 Pixel *bgp,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3037 Pixel *fgp,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3038 Pixel *bsp,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3039 Pixel *tsp,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3040 Pixel *hsp)
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
3041 {
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
3042 XtVaGetValues(toolBar,
856
8cd729851562 updated for version 7.0g
vimboss
parents: 844
diff changeset
3043 XmNbackground, bgp,
8cd729851562 updated for version 7.0g
vimboss
parents: 844
diff changeset
3044 XmNforeground, fgp,
8cd729851562 updated for version 7.0g
vimboss
parents: 844
diff changeset
3045 XmNbottomShadowColor, bsp,
8cd729851562 updated for version 7.0g
vimboss
parents: 844
diff changeset
3046 XmNtopShadowColor, tsp,
8cd729851562 updated for version 7.0g
vimboss
parents: 844
diff changeset
3047 XmNhighlightColor, hsp,
8cd729851562 updated for version 7.0g
vimboss
parents: 844
diff changeset
3048 NULL);
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 147
diff changeset
3049 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3050 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3051
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3052 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3053 /*
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3054 * Show or hide the tabline.
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3055 */
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3056 void
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3057 gui_mch_show_tabline(int showit)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3058 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3059 if (tabLine == (Widget)0)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3060 return;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3061
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3062 if (!showit != !showing_tabline)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3063 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3064 if (showit)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3065 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3066 XtManageChild(tabLine);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3067 XtUnmanageChild(XtNameToWidget(tabLine, "PageScroller"));
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3068 XtUnmanageChild(XtNameToWidget(tabLine, "MinorTabScrollerNext"));
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3069 XtUnmanageChild(XtNameToWidget(tabLine,
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3070 "MinorTabScrollerPrevious"));
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3071 #ifdef FEAT_MENU
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3072 # ifdef FEAT_TOOLBAR
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3073 if (XtIsManaged(XtParent(toolBar)))
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3074 XtVaSetValues(tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3075 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3076 XmNtopWidget, XtParent(toolBar), NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3077 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3078 # endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3079 if (XtIsManaged(menuBar))
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3080 XtVaSetValues(tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3081 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3082 XmNtopWidget, menuBar, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3083 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3084 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3085 XtVaSetValues(tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3086 XmNtopAttachment, XmATTACH_FORM, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3087 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3088 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3089 XmNtopWidget, tabLine,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3090 NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3091 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3092 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3093 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3094 XtUnmanageChild(tabLine);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3095 #ifdef FEAT_MENU
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3096 # ifdef FEAT_TOOLBAR
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3097 if (XtIsManaged(XtParent(toolBar)))
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3098 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3099 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3100 XmNtopWidget, XtParent(toolBar), NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3101 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3102 # endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3103 if (XtIsManaged(menuBar))
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3104 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3105 XmNtopAttachment, XmATTACH_WIDGET,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3106 XmNtopWidget, menuBar, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3107 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3108 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3109 XtVaSetValues(textAreaForm,
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3110 XmNtopAttachment, XmATTACH_FORM, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3111 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3112 showing_tabline = showit;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3113 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3114 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3115
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3116 /*
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3117 * Return TRUE when tabline is displayed.
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3118 */
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3119 int
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3120 gui_mch_showing_tabline(void)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3121 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3122 return tabLine != (Widget)0 && showing_tabline;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3123 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3124
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3125 /*
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3126 * Update the labels of the tabline.
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3127 */
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3128 void
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3129 gui_mch_update_tabline(void)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3130 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3131 tabpage_T *tp;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3132 int nr = 1, n;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3133 Arg args[10];
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3134 int curtabidx = 0, currentpage;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3135 Widget tab;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3136 XmNotebookPageInfo page_info;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3137 XmNotebookPageStatus page_status;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3138 int last_page, tab_count;
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3139 XmString label_str;
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3140 char *label_cstr;
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
3141 BalloonEval *beval;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3142
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3143 if (tabLine == (Widget)0)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3144 return;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3145
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3146 // Add a label for each tab page. They all contain the same text area.
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3147 for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, ++nr)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3148 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3149 if (tp == curtab)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3150 curtabidx = nr;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3151
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3152 page_status = XmNotebookGetPageInfo(tabLine, nr, &page_info);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3153 if (page_status == XmPAGE_INVALID
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
3154 || page_info.major_tab_widget == (Widget)0)
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3155 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3156 // Add the tab
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3157 n = 0;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3158 XtSetArg(args[n], XmNnotebookChildType, XmMAJOR_TAB); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3159 XtSetArg(args[n], XmNtraversalOn, False); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3160 XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3161 XtSetArg(args[n], XmNhighlightThickness, 1); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3162 XtSetArg(args[n], XmNshadowThickness , 1); n++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3163 tab = XmCreatePushButton(tabLine, "-Empty-", args, n);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3164 XtManageChild(tab);
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
3165 beval = gui_mch_create_beval_area(tab, NULL, tabline_balloon_cb,
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
3166 NULL);
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
3167 XtVaSetValues(tab, XmNuserData, beval, NULL);
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3168 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3169 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3170 tab = page_info.major_tab_widget;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3171
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3172 XtVaSetValues(tab, XmNpageNumber, nr, NULL);
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3173
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3174 /*
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3175 * Change the label text only if it is different
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3176 */
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3177 XtVaGetValues(tab, XmNlabelString, &label_str, NULL);
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3178 if (XmStringGetLtoR(label_str, XmSTRING_DEFAULT_CHARSET, &label_cstr))
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3179 {
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 838
diff changeset
3180 get_tabline_label(tp, FALSE);
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 838
diff changeset
3181 if (STRCMP(label_cstr, NameBuff) != 0)
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 838
diff changeset
3182 {
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3183 XtVaSetValues(tab, XtVaTypedArg, XmNlabelString, XmRString,
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3184 NameBuff, STRLEN(NameBuff) + 1, NULL);
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3185 /*
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3186 * Force a resize of the tab label button
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3187 */
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3188 XtUnmanageChild(tab);
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3189 XtManageChild(tab);
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3190 }
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3191 XtFree(label_cstr);
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 819
diff changeset
3192 }
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3193 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3194
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3195 tab_count = nr - 1;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3196
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3197 XtVaGetValues(tabLine, XmNlastPageNumber, &last_page, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3198
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3199 // Remove any old labels.
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3200 while (nr <= last_page)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3201 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3202 if (XmNotebookGetPageInfo(tabLine, nr, &page_info) != XmPAGE_INVALID
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3203 && page_info.page_number == nr
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3204 && page_info.major_tab_widget != (Widget)0)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3205 {
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
3206 XtVaGetValues(page_info.major_tab_widget, XmNuserData, &beval, NULL);
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
3207 if (beval != NULL)
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
3208 gui_mch_destroy_beval_area(beval);
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3209 XtUnmanageChild(page_info.major_tab_widget);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3210 XtDestroyWidget(page_info.major_tab_widget);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3211 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3212 nr++;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3213 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3214
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3215 XtVaSetValues(tabLine, XmNlastPageNumber, tab_count, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3216
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3217 XtVaGetValues(tabLine, XmNcurrentPageNumber, &currentpage, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3218 if (currentpage != curtabidx)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3219 XtVaSetValues(tabLine, XmNcurrentPageNumber, curtabidx, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3220 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3221
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3222 /*
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3223 * Set the current tab to "nr". First tab is 1.
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3224 */
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3225 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3226 gui_mch_set_curtab(int nr)
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3227 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3228 int currentpage;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3229
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3230 if (tabLine == (Widget)0)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3231 return;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3232
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3233 XtVaGetValues(tabLine, XmNcurrentPageNumber, &currentpage, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3234 if (currentpage != nr)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3235 XtVaSetValues(tabLine, XmNcurrentPageNumber, nr, NULL);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3236 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3237 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 811
diff changeset
3238
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3239 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3240 * Set the colors of Widget "id" to the menu colors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3241 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3242 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3243 gui_motif_menu_colors(Widget id)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3244 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3245 if (gui.menu_bg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3246 #if (XmVersion >= 1002)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3247 XmChangeColor(id, gui.menu_bg_pixel);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3248 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3249 XtVaSetValues(id, XmNbackground, gui.menu_bg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3250 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3251 if (gui.menu_fg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3252 XtVaSetValues(id, XmNforeground, gui.menu_fg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3253 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3254
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3255 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3256 * Set the colors of Widget "id" to the scrollbar colors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3257 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3258 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3259 gui_motif_scroll_colors(Widget id)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3260 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3261 if (gui.scroll_bg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3262 #if (XmVersion >= 1002)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3263 XmChangeColor(id, gui.scroll_bg_pixel);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3264 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3265 XtVaSetValues(id, XmNbackground, gui.scroll_bg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3266 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3267 if (gui.scroll_fg_pixel != INVALCOLOR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3268 XtVaSetValues(id, XmNforeground, gui.scroll_fg_pixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3269 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3271 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3272 * Set the fontlist for Widget "id" to use gui.menu_fontset or gui.menu_font.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3273 */
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3274 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3275 gui_motif_menu_fontlist(Widget id UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3276 {
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3277 #ifdef FEAT_MENU
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3278 #ifdef FONTSET_ALWAYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3279 if (gui.menu_fontset != NOFONTSET)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3280 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3281 XmFontList fl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3283 fl = gui_motif_fontset2fontlist((XFontSet *)&gui.menu_fontset);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3284 if (fl != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3285 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3286 if (XtIsManaged(id))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3287 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3288 XtUnmanageChild(id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3289 XtVaSetValues(id, XmNfontList, fl, NULL);
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3290 // We should force the widget to recalculate its
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3291 // geometry now.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3292 XtManageChild(id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3293 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3294 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3295 XtVaSetValues(id, XmNfontList, fl, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3296 XmFontListFree(fl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3297 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3298 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3299 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3300 if (gui.menu_font != NOFONT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3301 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3302 XmFontList fl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3303
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3304 fl = gui_motif_create_fontlist((XFontStruct *)gui.menu_font);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3305 if (fl != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3306 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3307 if (XtIsManaged(id))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3308 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3309 XtUnmanageChild(id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3310 XtVaSetValues(id, XmNfontList, fl, NULL);
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3311 // We should force the widget to recalculate its
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3312 // geometry now.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3313 XtManageChild(id);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3314 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3315 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3316 XtVaSetValues(id, XmNfontList, fl, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3317 XmFontListFree(fl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3318 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3319 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3320 #endif
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3321 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3322 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3323
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3325 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3326 * We don't create it twice for the sake of speed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3327 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3328
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3329 typedef struct _SharedFindReplace
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3330 {
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3331 Widget dialog; // the main dialog widget
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3332 Widget wword; // 'Exact match' check button
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3333 Widget mcase; // 'match case' check button
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3334 Widget up; // search direction 'Up' radio button
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3335 Widget down; // search direction 'Down' radio button
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3336 Widget what; // 'Find what' entry text widget
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3337 Widget with; // 'Replace with' entry text widget
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3338 Widget find; // 'Find Next' action button
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3339 Widget replace; // 'Replace With' action button
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3340 Widget all; // 'Replace All' action button
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3341 Widget undo; // 'Undo' action button
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3342
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3343 Widget cancel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3344 } SharedFindReplace;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3345
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1604
diff changeset
3346 static SharedFindReplace find_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 1604
diff changeset
3347 static SharedFindReplace repl_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3348
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3349 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3350 find_replace_destroy_callback(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3351 Widget w UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3352 XtPointer client_data,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3353 XtPointer call_data UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3354 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3355 SharedFindReplace *cd = (SharedFindReplace *)client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3356
48
00c35ea0c2b3 updated for version 7.0028
vimboss
parents: 44
diff changeset
3357 if (cd != NULL)
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3358 // suppress_dialog_mnemonics(cd->dialog);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3359 cd->dialog = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3360 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3361
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3362 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3363 find_replace_dismiss_callback(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3364 Widget w UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3365 XtPointer client_data,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3366 XtPointer call_data UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3367 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3368 SharedFindReplace *cd = (SharedFindReplace *)client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3369
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3370 if (cd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3371 XtUnmanageChild(cd->dialog);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3372 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3373
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3374 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3375 entry_activate_callback(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3376 Widget w UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3377 XtPointer client_data,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3378 XtPointer call_data UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3379 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3380 XmProcessTraversal((Widget)client_data, XmTRAVERSE_CURRENT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3381 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3382
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3383 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3384 find_replace_callback(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3385 Widget w UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3386 XtPointer client_data,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3387 XtPointer call_data UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3388 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3389 long_u flags = (long_u)client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3390 char *find_text, *repl_text;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3391 Boolean direction_down = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3392 Boolean wword;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3393 Boolean mcase;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3394 SharedFindReplace *sfr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3395
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3396 if (flags == FRD_UNDO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3397 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3398 char_u *save_cpo = p_cpo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3399
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3400 // No need to be Vi compatible here.
23501
60ba9ec58fd9 patch 8.2.2293: build failure with Motif
Bram Moolenaar <Bram@vim.org>
parents: 23493
diff changeset
3401 p_cpo = empty_option;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3402 u_undo(1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3403 p_cpo = save_cpo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3404 gui_update_screen();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3405 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3406 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3407
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3408 // Get the search/replace strings from the dialog
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3409 if (flags == FRD_FINDNEXT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3410 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3411 repl_text = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3412 sfr = &find_widgets;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3413 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3414 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3415 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3416 repl_text = XmTextFieldGetString(repl_widgets.with);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3417 sfr = &repl_widgets;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3418 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3419 find_text = XmTextFieldGetString(sfr->what);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3420 XtVaGetValues(sfr->down, XmNset, &direction_down, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3421 XtVaGetValues(sfr->wword, XmNset, &wword, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3422 XtVaGetValues(sfr->mcase, XmNset, &mcase, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3423 if (wword)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3424 flags |= FRD_WHOLE_WORD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3425 if (mcase)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3426 flags |= FRD_MATCH_CASE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3427
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3428 (void)gui_do_findrepl((int)flags, (char_u *)find_text, (char_u *)repl_text,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3429 direction_down);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3430
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3431 if (find_text != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3432 XtFree(find_text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3433 if (repl_text != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3434 XtFree(repl_text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3435 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3436
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3437 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3438 find_replace_keypress(
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3439 Widget w UNUSED,
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3440 SharedFindReplace *frdp,
24266
982786f8454d patch 8.2.2674: Motif: cancelling the font dialog resets the font
Bram Moolenaar <Bram@vim.org>
parents: 23501
diff changeset
3441 XKeyEvent *event,
982786f8454d patch 8.2.2674: Motif: cancelling the font dialog resets the font
Bram Moolenaar <Bram@vim.org>
parents: 23501
diff changeset
3442 Boolean *b UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3443 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3444 KeySym keysym;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3445
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3446 if (frdp == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3447 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3448
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3449 keysym = XLookupKeysym(event, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3450
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3451 // the scape key pops the whole dialog down
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3452 if (keysym == XK_Escape)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3453 XtUnmanageChild(frdp->dialog);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3454 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3455
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3456 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3457 set_label(Widget w, char *label)
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3458 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3459 XmString str;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3460 char_u *p, *next;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3461 KeySym mnemonic = NUL;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3462
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3463 if (!w)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3464 return;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3465
4960
27b008d5b7ac updated for version 7.3.1225
Bram Moolenaar <bram@vim.org>
parents: 4352
diff changeset
3466 p = vim_strsave((char_u *)label);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3467 if (p == NULL)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3468 return;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3469 for (next = p; *next; ++next)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3470 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3471 if (*next == DLG_HOTKEY_CHAR)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3472 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3473 int len = STRLEN(next);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3474
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3475 if (len > 0)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3476 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3477 mch_memmove(next, next + 1, len);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3478 mnemonic = next[0];
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3479 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3480 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3481 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3482
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3483 str = XmStringCreateSimple((char *)p);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3484 vim_free(p);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3485 if (str)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3486 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3487 XtVaSetValues(w,
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3488 XmNlabelString, str,
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3489 XmNmnemonic, mnemonic,
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3490 NULL);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3491 XmStringFree(str);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3492 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3493 gui_motif_menu_fontlist(w);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3494 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3495
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3496 static void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3497 find_replace_dialog_create(char_u *arg, int do_replace)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3498 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3499 SharedFindReplace *frdp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3500 Widget separator;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3501 Widget input_form;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3502 Widget button_form;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3503 Widget toggle_form;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3504 Widget frame;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3505 XmString str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3506 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3507 Arg args[6];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3508 int wword = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3509 int mcase = !p_ic;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3510 Dimension width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3511 Dimension widest;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3512 char_u *entry_text;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3513
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3514 frdp = do_replace ? &repl_widgets : &find_widgets;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3515
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3516 // Get the search string to use.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3517 entry_text = get_find_dialog_text(arg, &wword, &mcase);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3518
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3519 // If the dialog already exists, just raise it.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3520 if (frdp->dialog)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3521 {
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3522 gui_motif_synch_fonts();
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3523
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3524 // If the window is already up, just pop it to the top
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3525 if (XtIsManaged(frdp->dialog))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3526 XMapRaised(XtDisplay(frdp->dialog),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3527 XtWindow(XtParent(frdp->dialog)));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3528 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3529 XtManageChild(frdp->dialog);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3530 XtPopup(XtParent(frdp->dialog), XtGrabNone);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3531 XmProcessTraversal(frdp->what, XmTRAVERSE_CURRENT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3532
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3533 if (entry_text != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3534 XmTextFieldSetString(frdp->what, (char *)entry_text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3535 vim_free(entry_text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3537 XtVaSetValues(frdp->wword, XmNset, wword, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3538 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3539 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3540
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3541 // Create a fresh new dialog window
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3542 if (do_replace)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3543 str = XmStringCreateSimple(_("VIM - Search and Replace..."));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3544 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3545 str = XmStringCreateSimple(_("VIM - Search..."));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3546
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3547 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3548 XtSetArg(args[n], XmNautoUnmanage, False); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3549 XtSetArg(args[n], XmNnoResize, True); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3550 XtSetArg(args[n], XmNdialogTitle, str); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3551
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3552 frdp->dialog = XmCreateFormDialog(vimShell, "findReplaceDialog", args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3553 XmStringFree(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3554 XtAddCallback(frdp->dialog, XmNdestroyCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3555 find_replace_destroy_callback, frdp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3556
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3557 button_form = XtVaCreateWidget("buttonForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3558 xmFormWidgetClass, frdp->dialog,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3559 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3560 XmNrightOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3561 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3562 XmNtopOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3563 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3564 XmNbottomOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3565 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3566
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3567 frdp->find = XtVaCreateManagedWidget("findButton",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3568 xmPushButtonWidgetClass, button_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3569 XmNsensitive, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3570 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3571 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3572 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3573 NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3574 set_label(frdp->find, _("Find &Next"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3575
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3576 XtAddCallback(frdp->find, XmNactivateCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3577 find_replace_callback,
1522
710b52d02c4a updated for version 7.1-237
vimboss
parents: 1207
diff changeset
3578 (do_replace ? (XtPointer)FRD_R_FINDNEXT : (XtPointer)FRD_FINDNEXT));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3579
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3580 if (do_replace)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3581 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3582 frdp->replace = XtVaCreateManagedWidget("replaceButton",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3583 xmPushButtonWidgetClass, button_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3584 XmNtopAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3585 XmNtopWidget, frdp->find,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3586 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3587 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3588 NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3589 set_label(frdp->replace, _("&Replace"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3590 XtAddCallback(frdp->replace, XmNactivateCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3591 find_replace_callback, (XtPointer)FRD_REPLACE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3592
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3593 frdp->all = XtVaCreateManagedWidget("replaceAllButton",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3594 xmPushButtonWidgetClass, button_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3595 XmNtopAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3596 XmNtopWidget, frdp->replace,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3597 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3598 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3599 NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3600 set_label(frdp->all, _("Replace &All"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3601 XtAddCallback(frdp->all, XmNactivateCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3602 find_replace_callback, (XtPointer)FRD_REPLACEALL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3603
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3604 frdp->undo = XtVaCreateManagedWidget("undoButton",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3605 xmPushButtonWidgetClass, button_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3606 XmNtopAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3607 XmNtopWidget, frdp->all,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3608 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3609 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3610 NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3611 set_label(frdp->undo, _("&Undo"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3612 XtAddCallback(frdp->undo, XmNactivateCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3613 find_replace_callback, (XtPointer)FRD_UNDO);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3614 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3615
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3616 frdp->cancel = XtVaCreateManagedWidget("closeButton",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3617 xmPushButtonWidgetClass, button_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3618 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3619 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3620 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3621 NULL);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3622 set_label(frdp->cancel, _("&Cancel"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3623 XtAddCallback(frdp->cancel, XmNactivateCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3624 find_replace_dismiss_callback, frdp);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3625 gui_motif_menu_fontlist(frdp->cancel);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3626
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3627 XtManageChild(button_form);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3628
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3629 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3630 XtSetArg(args[n], XmNorientation, XmVERTICAL); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3631 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3632 XtSetArg(args[n], XmNrightWidget, button_form); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3633 XtSetArg(args[n], XmNrightOffset, 4); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3634 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3635 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3636 separator = XmCreateSeparatorGadget(frdp->dialog, "separator", args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3637 XtManageChild(separator);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3638
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3639 input_form = XtVaCreateWidget("inputForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3640 xmFormWidgetClass, frdp->dialog,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3641 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3642 XmNleftOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3643 XmNrightAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3644 XmNrightWidget, separator,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3645 XmNrightOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3646 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3647 XmNtopOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3648 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3649
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3650 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3651 Widget label_what;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3652 Widget label_with = (Widget)0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3653
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3654 str = XmStringCreateSimple(_("Find what:"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3655 label_what = XtVaCreateManagedWidget("whatLabel",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3656 xmLabelGadgetClass, input_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3657 XmNlabelString, str,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3658 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3659 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3660 XmNtopOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3661 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3662 XmStringFree(str);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3663 gui_motif_menu_fontlist(label_what);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3664
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3665 frdp->what = XtVaCreateManagedWidget("whatText",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3666 xmTextFieldWidgetClass, input_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3667 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3668 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3669 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3670 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3671
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3672 if (do_replace)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3673 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3674 frdp->with = XtVaCreateManagedWidget("withText",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3675 xmTextFieldWidgetClass, input_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3676 XmNtopAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3677 XmNtopWidget, frdp->what,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3678 XmNtopOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3679 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3680 XmNrightAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3681 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3682 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3683
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3684 XtAddCallback(frdp->with, XmNactivateCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3685 find_replace_callback, (XtPointer) FRD_R_FINDNEXT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3686
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3687 str = XmStringCreateSimple(_("Replace with:"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3688 label_with = XtVaCreateManagedWidget("withLabel",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3689 xmLabelGadgetClass, input_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3690 XmNlabelString, str,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3691 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3692 XmNtopAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3693 XmNtopWidget, frdp->what,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3694 XmNtopOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3695 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3696 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3697 XmStringFree(str);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3698 gui_motif_menu_fontlist(label_with);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3699
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3700 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3701 * Make the entry activation only change the input focus onto the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3702 * with item.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3703 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3704 XtAddCallback(frdp->what, XmNactivateCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3705 entry_activate_callback, frdp->with);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3706 XtAddEventHandler(frdp->with, KeyPressMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3707 (XtEventHandler)find_replace_keypress,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3708 (XtPointer) frdp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3709
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3710 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3711 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3712 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3713 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3714 * Make the entry activation do the search.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3715 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3716 XtAddCallback(frdp->what, XmNactivateCallback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3717 find_replace_callback, (XtPointer)FRD_FINDNEXT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3718 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3719 XtAddEventHandler(frdp->what, KeyPressMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3720 (XtEventHandler)find_replace_keypress,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3721 (XtPointer)frdp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3722
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3723 // Get the maximum width between the label widgets and line them up.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3724 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3725 XtSetArg(args[n], XmNwidth, &width); n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3726 XtGetValues(label_what, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3727 widest = width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3728 if (do_replace)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3729 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3730 XtGetValues(label_with, args, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3731 if (width > widest)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3732 widest = width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3733 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3734
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3735 XtVaSetValues(frdp->what, XmNleftOffset, widest, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3736 if (do_replace)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3737 XtVaSetValues(frdp->with, XmNleftOffset, widest, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3738
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3739 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3741 XtManageChild(input_form);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3742
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3743 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3744 Widget radio_box;
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3745 Widget w;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3746
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3747 frame = XtVaCreateWidget("directionFrame",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3748 xmFrameWidgetClass, frdp->dialog,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3749 XmNtopAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3750 XmNtopWidget, input_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3751 XmNtopOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3752 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3753 XmNbottomOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3754 XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3755 XmNrightWidget, input_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3756 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3757
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3758 str = XmStringCreateSimple(_("Direction"));
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3759 w = XtVaCreateManagedWidget("directionFrameLabel",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3760 xmLabelGadgetClass, frame,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3761 XmNlabelString, str,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3762 XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3763 XmNchildType, XmFRAME_TITLE_CHILD,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3764 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3765 XmStringFree(str);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3766 gui_motif_menu_fontlist(w);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3767
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3768 radio_box = XmCreateRadioBox(frame, "radioBox",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3769 (ArgList)NULL, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3770
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3771 str = XmStringCreateSimple( _("Up"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3772 frdp->up = XtVaCreateManagedWidget("upRadioButton",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3773 xmToggleButtonGadgetClass, radio_box,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3774 XmNlabelString, str,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3775 XmNset, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3776 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3777 XmStringFree(str);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3778 gui_motif_menu_fontlist(frdp->up);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3779
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3780 str = XmStringCreateSimple(_("Down"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3781 frdp->down = XtVaCreateManagedWidget("downRadioButton",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3782 xmToggleButtonGadgetClass, radio_box,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3783 XmNlabelString, str,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3784 XmNset, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3785 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3786 XmStringFree(str);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3787 gui_motif_menu_fontlist(frdp->down);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3788
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3789 XtManageChild(radio_box);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3790 XtManageChild(frame);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3791 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3792
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3793 toggle_form = XtVaCreateWidget("toggleForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3794 xmFormWidgetClass, frdp->dialog,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3795 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3796 XmNleftOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3797 XmNrightAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3798 XmNrightWidget, frame,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3799 XmNrightOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3800 XmNtopAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3801 XmNtopWidget, input_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3802 XmNtopOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3803 XmNbottomAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3804 XmNbottomOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3805 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3806
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3807 str = XmStringCreateSimple(_("Match whole word only"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3808 frdp->wword = XtVaCreateManagedWidget("wordToggle",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3809 xmToggleButtonGadgetClass, toggle_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3810 XmNlabelString, str,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3811 XmNtopAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3812 XmNtopOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3813 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3814 XmNleftOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3815 XmNset, wword,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3816 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3817 XmStringFree(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3818
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3819 str = XmStringCreateSimple(_("Match case"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3820 frdp->mcase = XtVaCreateManagedWidget("caseToggle",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3821 xmToggleButtonGadgetClass, toggle_form,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3822 XmNlabelString, str,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3823 XmNleftAttachment, XmATTACH_FORM,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3824 XmNleftOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3825 XmNtopAttachment, XmATTACH_WIDGET,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3826 XmNtopWidget, frdp->wword,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3827 XmNtopOffset, 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3828 XmNset, mcase,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3829 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3830 XmStringFree(str);
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3831 gui_motif_menu_fontlist(frdp->wword);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3832 gui_motif_menu_fontlist(frdp->mcase);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3833
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3834 XtManageChild(toggle_form);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3835
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3836 if (entry_text != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3837 XmTextFieldSetString(frdp->what, (char *)entry_text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3838 vim_free(entry_text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3839
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3840 gui_motif_synch_fonts();
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3841
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3842 manage_centered(frdp->dialog);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3843 activate_dialog_mnemonics(frdp->dialog);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3844 XmProcessTraversal(frdp->what, XmTRAVERSE_CURRENT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3845 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3846
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3847 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3848 gui_mch_find_dialog(exarg_T *eap)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3849 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3850 if (!gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3851 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3852
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3853 find_replace_dialog_create(eap->arg, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3854 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3855
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3856
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3857 void
7821
81794242a275 commit https://github.com/vim/vim/commit/66f948e928d5e0cd3123af902aa8ac1613534c94
Christian Brabandt <cb@256bit.org>
parents: 7815
diff changeset
3858 gui_mch_replace_dialog(exarg_T *eap)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3859 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3860 if (!gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3861 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3862
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3863 find_replace_dialog_create(eap->arg, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3864 }
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3865
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3866 /*
26592
9f445e07f766 patch 8.2.3825: various comments could be improved
Bram Moolenaar <Bram@vim.org>
parents: 24266
diff changeset
3867 * Synchronize all gui elements, which are dependent upon the
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3868 * main text font used. Those are in esp. the find/replace dialogs.
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3869 * If you don't understand why this should be needed, please try to
7815
3a96dfb42c55 commit https://github.com/vim/vim/commit/305598b71261265994e2846b4ff4a4d8efade280
Christian Brabandt <cb@256bit.org>
parents: 7801
diff changeset
3870 * search for "pi\xea\xb6\xe6" in iso8859-2.
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3871 */
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3872 void
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3873 gui_motif_synch_fonts(void)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3874 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3875 SharedFindReplace *frdp;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3876 int do_replace;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3877 XFontStruct *font;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3878 XmFontList font_list;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3879
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3880 // FIXME: Unless we find out how to create a XmFontList from a XFontSet,
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3881 // we just give up here on font synchronization.
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3882 font = (XFontStruct *)gui.norm_font;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3883 if (font == NULL)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3884 return;
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3885
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3886 font_list = gui_motif_create_fontlist(font);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3887
18788
e1f4e9d78a6a patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
3888 // OK this loop is a bit tricky...
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3889 for (do_replace = 0; do_replace <= 1; ++do_replace)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3890 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3891 frdp = (do_replace) ? (&repl_widgets) : (&find_widgets);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3892 if (frdp->dialog)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3893 {
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3894 XtVaSetValues(frdp->what, XmNfontList, font_list, NULL);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3895 if (do_replace)
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3896 XtVaSetValues(frdp->with, XmNfontList, font_list, NULL);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3897 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3898 }
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3899
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3900 XmFontListFree(font_list);
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
3901 }