Mercurial > vim
comparison src/gui_motif.c @ 54:6bfddb1d126a
updated for version 7.0029
author | vimboss |
---|---|
date | Mon, 03 Jan 2005 20:58:59 +0000 |
parents | 00c35ea0c2b3 |
children | 99064882c85b |
comparison
equal
deleted
inserted
replaced
53:03f7c369396c | 54:6bfddb1d126a |
---|---|
74 static Widget menuBar; | 74 static Widget menuBar; |
75 #endif | 75 #endif |
76 | 76 |
77 static void scroll_cb __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); | 77 static void scroll_cb __ARGS((Widget w, XtPointer client_data, XtPointer call_data)); |
78 #ifdef FEAT_TOOLBAR | 78 #ifdef FEAT_TOOLBAR |
79 # if 0 | |
80 static void toolbar_enter_cb __ARGS((Widget, XtPointer, XEvent *, Boolean *)); | |
81 static void toolbar_leave_cb __ARGS((Widget, XtPointer, XEvent *, Boolean *)); | |
82 # endif | |
83 # ifdef FEAT_FOOTER | 79 # ifdef FEAT_FOOTER |
84 static void toolbarbutton_enter_cb __ARGS((Widget, XtPointer, XEvent *, Boolean *)); | 80 static void toolbarbutton_enter_cb __ARGS((Widget, XtPointer, XEvent *, Boolean *)); |
85 static void toolbarbutton_leave_cb __ARGS((Widget, XtPointer, XEvent *, Boolean *)); | 81 static void toolbarbutton_leave_cb __ARGS((Widget, XtPointer, XEvent *, Boolean *)); |
86 # endif | 82 # endif |
87 static void gui_mch_reset_focus __ARGS((void)); | 83 static void reset_focus __ARGS((void)); |
88 #endif | 84 #endif |
89 #ifdef FEAT_FOOTER | 85 #ifdef FEAT_FOOTER |
90 static int gui_mch_compute_footer_height __ARGS((void)); | 86 static int gui_mch_compute_footer_height __ARGS((void)); |
91 #endif | 87 #endif |
92 #ifdef WSDEBUG | 88 #ifdef WSDEBUG |
318 XmNmarginWidth, 0, | 314 XmNmarginWidth, 0, |
319 XmNadjustLast, True, | 315 XmNadjustLast, True, |
320 NULL); | 316 NULL); |
321 gui_motif_menu_colors(toolBar); | 317 gui_motif_menu_colors(toolBar); |
322 | 318 |
323 # if 0 /* these don't work, because of the XmNtraversalOn above. */ | |
324 XtAddEventHandler(toolBar, EnterWindowMask, False, | |
325 toolbar_enter_cb, NULL); | |
326 XtAddEventHandler(toolBar, LeaveWindowMask, False, | |
327 toolbar_leave_cb, NULL); | |
328 # endif | |
329 #endif | 319 #endif |
330 | 320 |
331 textAreaForm = XtVaCreateManagedWidget("textAreaForm", | 321 textAreaForm = XtVaCreateManagedWidget("textAreaForm", |
332 xmFormWidgetClass, vimForm, | 322 xmFormWidgetClass, vimForm, |
333 XmNleftAttachment, XmATTACH_FORM, | 323 XmNleftAttachment, XmATTACH_FORM, |
406 int w; | 396 int w; |
407 int h; | 397 int h; |
408 { | 398 { |
409 #ifdef FEAT_TOOLBAR | 399 #ifdef FEAT_TOOLBAR |
410 /* Give keyboard focus to the textArea instead of the toolbar. */ | 400 /* Give keyboard focus to the textArea instead of the toolbar. */ |
411 gui_mch_reset_focus(); | 401 reset_focus(); |
412 #endif | 402 #endif |
413 } | 403 } |
414 | 404 |
415 void | 405 void |
416 gui_x11_set_back_color() | 406 gui_x11_set_back_color() |
538 static void gui_motif_add_actext __ARGS((vimmenu_T *menu)); | 528 static void gui_motif_add_actext __ARGS((vimmenu_T *menu)); |
539 #if (XmVersion >= 1002) | 529 #if (XmVersion >= 1002) |
540 static void toggle_tearoff __ARGS((Widget wid)); | 530 static void toggle_tearoff __ARGS((Widget wid)); |
541 static void gui_mch_recurse_tearoffs __ARGS((vimmenu_T *menu)); | 531 static void gui_mch_recurse_tearoffs __ARGS((vimmenu_T *menu)); |
542 #endif | 532 #endif |
543 static void gui_mch_submenu_change __ARGS((vimmenu_T *mp, int colors)); | 533 static void submenu_change __ARGS((vimmenu_T *mp, int colors)); |
544 | 534 |
545 static void do_set_mnemonics __ARGS((int enable)); | 535 static void do_set_mnemonics __ARGS((int enable)); |
546 static int menu_enabled = TRUE; | 536 static int menu_enabled = TRUE; |
547 | 537 |
548 void | 538 void |
1024 */ | 1014 */ |
1025 XtSetArg(args[n], XmNhighlightThickness, 1); n++; | 1015 XtSetArg(args[n], XmNhighlightThickness, 1); n++; |
1026 XtSetArg(args[n], XmNhighlightOnEnter, True); n++; | 1016 XtSetArg(args[n], XmNhighlightOnEnter, True); n++; |
1027 XtSetArg(args[n], XmNmarginWidth, 0); n++; | 1017 XtSetArg(args[n], XmNmarginWidth, 0); n++; |
1028 XtSetArg(args[n], XmNmarginHeight, 0); n++; | 1018 XtSetArg(args[n], XmNmarginHeight, 0); n++; |
1019 XtSetArg(args[n], XmNtraversalOn, False); n++; | |
1029 /* Set the label here, so that we can switch between icons/text | 1020 /* Set the label here, so that we can switch between icons/text |
1030 * by changing the XmNlabelType resource. */ | 1021 * by changing the XmNlabelType resource. */ |
1031 xms = XmStringCreate((char *)menu->dname, STRING_TAG); | 1022 xms = XmStringCreate((char *)menu->dname, STRING_TAG); |
1032 XtSetArg(args[n], XmNlabelString, xms); n++; | 1023 XtSetArg(args[n], XmNlabelString, xms); n++; |
1033 | 1024 |
1051 type, toolBar, args, n); | 1042 type, toolBar, args, n); |
1052 if (menu->id != NULL && type == xmEnhancedButtonWidgetClass) | 1043 if (menu->id != NULL && type == xmEnhancedButtonWidgetClass) |
1053 { | 1044 { |
1054 XtAddCallback(menu->id, | 1045 XtAddCallback(menu->id, |
1055 XmNactivateCallback, gui_x11_menu_cb, menu); | 1046 XmNactivateCallback, gui_x11_menu_cb, menu); |
1056 | |
1057 # ifdef FEAT_FOOTER | 1047 # ifdef FEAT_FOOTER |
1058 XtAddEventHandler(menu->id, EnterWindowMask, False, | 1048 XtAddEventHandler(menu->id, EnterWindowMask, False, |
1059 toolbarbutton_enter_cb, menu); | 1049 toolbarbutton_enter_cb, menu); |
1060 XtAddEventHandler(menu->id, LeaveWindowMask, False, | 1050 XtAddEventHandler(menu->id, LeaveWindowMask, False, |
1061 toolbarbutton_leave_cb, menu); | 1051 toolbarbutton_leave_cb, menu); |
1188 #ifdef FEAT_TOOLBAR | 1178 #ifdef FEAT_TOOLBAR |
1189 gui_motif_menu_colors(toolBarFrame); | 1179 gui_motif_menu_colors(toolBarFrame); |
1190 gui_motif_menu_colors(toolBar); | 1180 gui_motif_menu_colors(toolBar); |
1191 #endif | 1181 #endif |
1192 | 1182 |
1193 gui_mch_submenu_change(root_menu, TRUE); | 1183 submenu_change(root_menu, TRUE); |
1194 } | 1184 } |
1195 | 1185 |
1196 void | 1186 void |
1197 gui_mch_new_menu_font() | 1187 gui_mch_new_menu_font() |
1198 { | 1188 { |
1199 if (menuBar == (Widget)0) | 1189 if (menuBar == (Widget)0) |
1200 return; | 1190 return; |
1201 gui_mch_submenu_change(root_menu, FALSE); | 1191 submenu_change(root_menu, FALSE); |
1202 { | 1192 { |
1203 Dimension height; | 1193 Dimension height; |
1204 Position w, h; | 1194 Position w, h; |
1205 | 1195 |
1206 XtVaGetValues(menuBar, XmNheight, &height, NULL); | 1196 XtVaGetValues(menuBar, XmNheight, &height, NULL); |
1227 if (toolBar == (Widget)0) | 1217 if (toolBar == (Widget)0) |
1228 return; | 1218 return; |
1229 | 1219 |
1230 menu = gui_find_menu((char_u *)"ToolBar"); | 1220 menu = gui_find_menu((char_u *)"ToolBar"); |
1231 if (menu != NULL) | 1221 if (menu != NULL) |
1232 gui_mch_submenu_change(menu, FALSE); | 1222 submenu_change(menu, FALSE); |
1233 # endif | 1223 # endif |
1234 } | 1224 } |
1235 | 1225 |
1236 void | 1226 void |
1237 gui_mch_new_tooltip_colors() | 1227 gui_mch_new_tooltip_colors() |
1242 if (toolBar == (Widget)0) | 1232 if (toolBar == (Widget)0) |
1243 return; | 1233 return; |
1244 | 1234 |
1245 toolbar = gui_find_menu((char_u *)"ToolBar"); | 1235 toolbar = gui_find_menu((char_u *)"ToolBar"); |
1246 if (toolbar != NULL) | 1236 if (toolbar != NULL) |
1247 gui_mch_submenu_change(toolbar, TRUE); | 1237 submenu_change(toolbar, TRUE); |
1248 # endif | 1238 # endif |
1249 } | 1239 } |
1250 #endif | 1240 #endif |
1251 | 1241 |
1252 static void | 1242 static void |
1253 gui_mch_submenu_change(menu, colors) | 1243 submenu_change(menu, colors) |
1254 vimmenu_T *menu; | 1244 vimmenu_T *menu; |
1255 int colors; /* TRUE for colors, FALSE for font */ | 1245 int colors; /* TRUE for colors, FALSE for font */ |
1256 { | 1246 { |
1257 vimmenu_T *mp; | 1247 vimmenu_T *mp; |
1258 | 1248 |
1328 gui_motif_menu_fontlist(mp->submenu_id); | 1318 gui_motif_menu_fontlist(mp->submenu_id); |
1329 toggle_tearoff(mp->submenu_id); | 1319 toggle_tearoff(mp->submenu_id); |
1330 } | 1320 } |
1331 #endif | 1321 #endif |
1332 /* Set the colors for the children */ | 1322 /* Set the colors for the children */ |
1333 gui_mch_submenu_change(mp->children, colors); | 1323 submenu_change(mp->children, colors); |
1334 } | 1324 } |
1335 } | 1325 } |
1336 } | 1326 } |
1337 | 1327 |
1338 /* | 1328 /* |
2798 * A toolbar button has been pushed; now reset the input focus | 2788 * A toolbar button has been pushed; now reset the input focus |
2799 * such that the user can type page up/down etc. and have the | 2789 * such that the user can type page up/down etc. and have the |
2800 * input go to the editor window, not the button | 2790 * input go to the editor window, not the button |
2801 */ | 2791 */ |
2802 static void | 2792 static void |
2803 gui_mch_reset_focus() | 2793 reset_focus() |
2804 { | 2794 { |
2805 if (textArea != NULL) | 2795 if (textArea != NULL) |
2806 XmProcessTraversal(textArea, XmTRAVERSE_CURRENT); | 2796 XmProcessTraversal(textArea, XmTRAVERSE_CURRENT); |
2807 } | 2797 } |
2808 | 2798 |
2850 height = 24; | 2840 height = 24; |
2851 #endif | 2841 #endif |
2852 | 2842 |
2853 return (int)(height + (borders << 1)); | 2843 return (int)(height + (borders << 1)); |
2854 } | 2844 } |
2855 | |
2856 #if 0 /* these are never called. */ | |
2857 /* | |
2858 * The next toolbar enter/leave callbacks make sure the text area gets the | |
2859 * keyboard focus when the pointer is not in the toolbar. | |
2860 */ | |
2861 /*ARGSUSED*/ | |
2862 static void | |
2863 toolbar_enter_cb(w, client_data, event, cont) | |
2864 Widget w; | |
2865 XtPointer client_data; | |
2866 XEvent *event; | |
2867 Boolean *cont; | |
2868 { | |
2869 XmProcessTraversal(toolBar, XmTRAVERSE_CURRENT); | |
2870 } | |
2871 | |
2872 /*ARGSUSED*/ | |
2873 static void | |
2874 toolbar_leave_cb(w, client_data, event, cont) | |
2875 Widget w; | |
2876 XtPointer client_data; | |
2877 XEvent *event; | |
2878 Boolean *cont; | |
2879 { | |
2880 XmProcessTraversal(textArea, XmTRAVERSE_CURRENT); | |
2881 } | |
2882 #endif | |
2883 | 2845 |
2884 # ifdef FEAT_FOOTER | 2846 # ifdef FEAT_FOOTER |
2885 /* | 2847 /* |
2886 * The next toolbar enter/leave callbacks should really do balloon help. But | 2848 * The next toolbar enter/leave callbacks should really do balloon help. But |
2887 * I have to use footer help for backwards compatability. Hopefully both will | 2849 * I have to use footer help for backwards compatability. Hopefully both will |