annotate src/gui_motif.c @ 906:039ce9407934 v7.0.032

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