30 |
#include "../bitmaps/print.xpm" |
#include "../bitmaps/print.xpm" |
31 |
|
|
32 |
void |
void |
33 |
arshell_setup_menubar() |
arshell_setup_menubar () |
34 |
{ |
{ |
35 |
if(arshell.gui.menubar.menubar_widget!=NULL) |
if (arshell.gui.menubar.menubar_widget != NULL) |
36 |
{ |
{ |
37 |
XtVaSetValues(arshell.gui.widgets.mainwindow, |
XtVaSetValues (arshell.gui.widgets.mainwindow, |
38 |
XmNmenuBar, arshell.gui.menubar.menubar_widget, |
XmNmenuBar, arshell.gui.menubar.menubar_widget, NULL); |
|
NULL); |
|
39 |
} |
} |
40 |
} |
} |
41 |
|
|
42 |
void |
void |
43 |
arshell_default_menubar_action() |
arshell_default_menubar_action () |
44 |
{ |
{ |
45 |
antiright_set(XmNorientation, XmHORIZONTAL); |
antiright_set (XmNorientation, XmHORIZONTAL); |
46 |
arshell.gui.menubar= |
arshell.gui.menubar = |
47 |
antiright_defined_menubar(arshell.gui.widgets.mainwindow, NULL); |
antiright_defined_menubar (arshell.gui.widgets.mainwindow, NULL); |
48 |
arshell.flags.use_menubar=True; |
arshell.flags.use_menubar = True; |
49 |
} |
} |
50 |
|
|
51 |
void |
void |
52 |
arshell_align_left(Widget widget) |
arshell_align_left (Widget widget) |
53 |
{ |
{ |
54 |
ARCLARG; |
ARCLARG; |
55 |
antiright_set(XmNalignment, XmALIGNMENT_BEGINNING); |
antiright_set (XmNalignment, XmALIGNMENT_BEGINNING); |
56 |
antiright_set_values(widget); |
antiright_set_values (widget); |
57 |
} |
} |
58 |
|
|
59 |
void |
void |
60 |
arshell_add_button_to_file_menu(int *counter_int, char **argv) |
arshell_add_button_to_file_menu (int *counter_int, char **argv) |
61 |
{ |
{ |
62 |
Widget button; |
Widget button; |
63 |
(*counter_int)++; |
(*counter_int)++; |
64 |
button=arshell_optioned_button(arshell.gui.menubar.file_widget, |
button = arshell_optioned_button (arshell.gui.menubar.file_widget, |
65 |
arshell_system_cb, |
arshell_system_cb, argv[(*counter_int)]); |
66 |
argv[(*counter_int)]); |
arshell_align_left (button); |
|
arshell_align_left(button); |
|
67 |
} |
} |
68 |
|
|
69 |
void |
void |
70 |
arshell_add_button_to_edit_menu(int *counter_int, char **argv) |
arshell_add_button_to_edit_menu (int *counter_int, char **argv) |
71 |
{ |
{ |
72 |
(*counter_int)++; |
(*counter_int)++; |
73 |
if((arshell.gui.widgets.work != NULL)) |
if ((arshell.gui.widgets.work != NULL)) |
74 |
{ |
{ |
75 |
Widget button; |
Widget button; |
76 |
if(arshell.gui.menubar.edit_widget==NULL) |
if (arshell.gui.menubar.edit_widget == NULL) |
77 |
{ |
{ |
78 |
antiright_edit_menu(arshell.gui.menubar.menubar_widget, |
antiright_edit_menu (arshell.gui.menubar.menubar_widget, |
79 |
arshell.gui.widgets.work); |
arshell.gui.widgets.work); |
80 |
} |
} |
81 |
button=arshell_optioned_button(arshell.gui.menubar.edit_widget, |
button = arshell_optioned_button (arshell.gui.menubar.edit_widget, |
82 |
arshell_system_cb, |
arshell_system_cb, |
83 |
argv[(*counter_int)]); |
argv[(*counter_int)]); |
84 |
arshell_align_left(button); |
arshell_align_left (button); |
85 |
} |
} |
86 |
} |
} |
87 |
|
|
88 |
void |
void |
89 |
arshell_add_button_to_view_menu(int* counter_int, char** argv) |
arshell_add_button_to_view_menu (int *counter_int, char **argv) |
90 |
{ |
{ |
91 |
Widget button; |
Widget button; |
92 |
(*counter_int)++; |
(*counter_int)++; |
93 |
button=arshell_optioned_button(arshell.gui.menubar.view_widget, |
button = arshell_optioned_button (arshell.gui.menubar.view_widget, |
94 |
arshell_system_cb, |
arshell_system_cb, argv[(*counter_int)]); |
95 |
argv[(*counter_int)]); |
arshell_align_left (button); |
|
arshell_align_left(button); |
|
96 |
} |
} |
97 |
|
|
98 |
void |
void |
99 |
arshell_add_button_to_help_menu(int *counter_int, char **argv) |
arshell_add_button_to_help_menu (int *counter_int, char **argv) |
100 |
{ |
{ |
101 |
Widget button; |
Widget button; |
102 |
(*counter_int)++; |
(*counter_int)++; |
103 |
button=arshell_optioned_button(arshell.gui.menubar.help_widget, |
button = arshell_optioned_button (arshell.gui.menubar.help_widget, |
104 |
arshell_system_cb, |
arshell_system_cb, argv[(*counter_int)]); |
105 |
argv[(*counter_int)]); |
arshell_align_left (button); |
|
arshell_align_left(button); |
|
106 |
} |
} |
107 |
|
|
108 |
void |
void |
109 |
arshell_handle_menubar_sub_arguments(int* counter_int, char** argv) |
arshell_handle_menubar_sub_arguments (int *counter_int, char **argv) |
110 |
{ |
{ |
111 |
switch(argv[(*counter_int)][3]) |
switch (argv[(*counter_int)][3]) |
112 |
{ |
{ |
113 |
case 'f': |
case 'f': |
114 |
arshell_add_button_to_file_menu(counter_int, argv); |
arshell_add_button_to_file_menu (counter_int, argv); |
115 |
break; |
break; |
116 |
case 'e': |
case 'e': |
117 |
arshell_add_button_to_edit_menu(counter_int, argv); |
arshell_add_button_to_edit_menu (counter_int, argv); |
118 |
break; |
break; |
119 |
case 'v': |
case 'v': |
120 |
arshell_add_button_to_view_menu(counter_int, argv); |
arshell_add_button_to_view_menu (counter_int, argv); |
121 |
break; |
break; |
122 |
case 'h': |
case 'h': |
123 |
arshell_add_button_to_help_menu(counter_int, argv); |
arshell_add_button_to_help_menu (counter_int, argv); |
124 |
break; |
break; |
125 |
default: |
default: |
126 |
arshell_default_menubar_action(arshell.gui.widgets.row, |
arshell_default_menubar_action (arshell.gui.widgets.row, |
127 |
arshell.gui.menubar); |
arshell.gui.menubar); |
128 |
break; |
break; |
129 |
} |
} |
130 |
} |
} |
131 |
|
|
132 |
void |
void |
133 |
arshell_hide_sticky_note_toolbar() |
arshell_hide_sticky_note_toolbar () |
134 |
{ |
{ |
135 |
char *title; |
char *title; |
136 |
ARCLARG; |
ARCLARG; |
137 |
antiright_set(XmNtitle, (XtArgVal)&title); |
antiright_set (XmNtitle, (XtArgVal) & title); |
138 |
antiright_get_values(antiright.parent_widget); |
antiright_get_values (antiright.parent_widget); |
139 |
if((title[0]=='S') & (title[1]=='t') & (title[2]=='i')) |
if ((title[0] == 'S') & (title[1] == 't') & (title[2] == 'i')) |
140 |
{ |
{ |
141 |
XtUnmanageChild(XtParent(arshell.gui.layout.row_manager_widget)); |
XtUnmanageChild (XtParent (arshell.gui.layout.row_manager_widget)); |
142 |
} |
} |
143 |
ARCLARG; |
ARCLARG; |
144 |
} |
} |
145 |
|
|
146 |
Widget |
Widget |
147 |
antiright_toolbar_button(Widget parent, char *description, char **icon, |
antiright_toolbar_button (Widget parent, char *description, char **icon, |
148 |
XtCallbackProc callback, XtPointer client_data) |
XtCallbackProc callback, XtPointer client_data) |
149 |
{ |
{ |
150 |
Widget button; |
Widget button; |
151 |
ARCLARG; |
ARCLARG; |
152 |
antiright_set(XmNshadowThickness, 0); |
antiright_set (XmNshadowThickness, 0); |
153 |
button=antiright_button(parent, "button", callback, client_data); |
button = antiright_button (parent, "button", callback, client_data); |
154 |
antiright_set_tooltip(button, description); |
antiright_set_tooltip (button, description); |
155 |
antiright_set_pixmap_from_data(button, icon); |
antiright_set_pixmap_from_data (button, icon); |
156 |
ARCLARG; |
ARCLARG; |
157 |
return(button); |
return (button); |
158 |
} |
} |
159 |
|
|
160 |
Widget |
Widget |
161 |
arshell_toolbar_button(char *description, char **icon, |
arshell_toolbar_button (char *description, char **icon, |
162 |
XtCallbackProc callback, XtPointer client_data) |
XtCallbackProc callback, XtPointer client_data) |
163 |
{ |
{ |
164 |
return(antiright_toolbar_button(arshell.gui.layout.row_manager_widget, |
return (antiright_toolbar_button (arshell.gui.layout.row_manager_widget, |
165 |
description, icon, |
description, icon, |
166 |
callback, client_data)); |
callback, client_data)); |
167 |
} |
} |
168 |
|
|
169 |
void |
void |
170 |
arshell_toggle_toolbar_cb(Widget widget, |
arshell_toggle_toolbar_cb (Widget widget, |
171 |
XtPointer client_data, XtPointer call_data) |
XtPointer client_data, XtPointer call_data) |
172 |
{ |
{ |
173 |
if(XmToggleButtonGetState(widget)) |
if (XmToggleButtonGetState (widget)) |
174 |
{ |
{ |
175 |
if(!XtIsManaged(XtParent(arshell.gui.layout.row_manager_widget))) |
if (!XtIsManaged (XtParent (arshell.gui.layout.row_manager_widget))) |
176 |
{ |
{ |
177 |
XtManageChild(XtParent(arshell.gui.layout.row_manager_widget)); |
XtManageChild (XtParent (arshell.gui.layout.row_manager_widget)); |
178 |
} |
} |
179 |
} |
} |
180 |
else |
else |
181 |
{ |
{ |
182 |
if(XtIsManaged(XtParent(arshell.gui.layout.row_manager_widget))) |
if (XtIsManaged (XtParent (arshell.gui.layout.row_manager_widget))) |
183 |
{ |
{ |
184 |
XtUnmanageChild(XtParent(arshell.gui.layout.row_manager_widget)); |
XtUnmanageChild (XtParent (arshell.gui.layout.row_manager_widget)); |
185 |
} |
} |
186 |
} |
} |
187 |
client_data=NULL; |
client_data = NULL; |
188 |
call_data=NULL; |
call_data = NULL; |
189 |
} |
} |
190 |
|
|
191 |
void |
void |
192 |
arshell_setup_editor_toolbar() |
arshell_setup_editor_toolbar () |
193 |
{ |
{ |
194 |
arshell_initialize_row_manager(); |
arshell_initialize_row_manager (); |
195 |
/* ARCLARG; |
/* ARCLARG; |
196 |
antiright_set(XmNmarginWidth, 0); |
antiright_set(XmNmarginWidth, 0); |
197 |
antiright_set(XmNmarginHeight, 0); |
antiright_set(XmNmarginHeight, 0); |
198 |
antiright_set(XmNpacking, XmPACK_TIGHT); |
antiright_set(XmNpacking, XmPACK_TIGHT); |
199 |
antiright_set(XmNorientation, XmHORIZONTAL); |
antiright_set(XmNorientation, XmHORIZONTAL); |
200 |
antiright_set(XmNspacing, 0); |
antiright_set(XmNspacing, 0); |
201 |
arshell.edit.toolbar= |
arshell.edit.toolbar= |
202 |
antiright_row(arshell.gui.layout.row_manager_widget);*/ |
antiright_row(arshell.gui.layout.row_manager_widget); */ |
203 |
|
|
204 |
arshell_hide_sticky_note_toolbar(); |
arshell_hide_sticky_note_toolbar (); |
205 |
arshell_toolbar_button("Open a file.", open_xpm, |
arshell_toolbar_button ("Open a file.", open_xpm, arshell_open_cb, NULL); |
206 |
arshell_open_cb, NULL); |
arshell_toolbar_button ("Save the current file.", save_xpm, |
207 |
arshell_toolbar_button("Save the current file.", save_xpm, |
arshell_save_work_area, NULL); |
208 |
arshell_save_work_area, NULL); |
arshell_toolbar_button ("Print the current file.", print_xpm, |
209 |
arshell_toolbar_button("Print the current file.", print_xpm, |
arshell_print_cb, NULL); |
210 |
arshell_print_cb, NULL); |
arshell_toolbar_button ("Cut the selection into the clipboard.", cut_xpm, |
211 |
arshell_toolbar_button("Cut the selection into the clipboard.", cut_xpm, |
antiright_cut_cb, arshell.gui.widgets.work); |
212 |
antiright_cut_cb, arshell.gui.widgets.work); |
arshell_toolbar_button ("Copy the selection into the clipboard.", copy_xpm, |
213 |
arshell_toolbar_button("Copy the selection into the clipboard.", copy_xpm, |
antiright_copy_cb, arshell.gui.widgets.work); |
214 |
antiright_copy_cb, arshell.gui.widgets.work); |
arshell_toolbar_button ("Paste the contents of the clipboard.", paste_xpm, |
215 |
arshell_toolbar_button("Paste the contents of the clipboard.", paste_xpm, |
antiright_paste_cb, arshell.gui.widgets.work); |
216 |
antiright_paste_cb, arshell.gui.widgets.work); |
arshell_toolbar_button ("Search for and optionally replace text.", |
217 |
arshell_toolbar_button("Search for and optionally replace text.", search_xpm, |
search_xpm, arshell_search_replace_cb, NULL); |
218 |
arshell_search_replace_cb, NULL); |
arshell_row_layout (); |
|
arshell_row_layout(); |
|
219 |
} |
} |
220 |
|
|
221 |
void |
void |
222 |
arshell_setup_work_menubar() |
arshell_setup_work_menubar () |
223 |
{ |
{ |
224 |
Widget toggle_widget; |
Widget toggle_widget; |
225 |
ARCLARG; |
ARCLARG; |
226 |
arshell_setup_editor_toolbar(); |
arshell_setup_editor_toolbar (); |
227 |
ARCLARG; |
ARCLARG; |
228 |
if(arshell.gui.menubar.menubar_widget != NULL) |
if (arshell.gui.menubar.menubar_widget != NULL) |
229 |
{ |
{ |
230 |
antiright_separator(arshell.gui.menubar.file_widget); |
antiright_separator (arshell.gui.menubar.file_widget); |
231 |
antiright_button(arshell.gui.menubar.file_widget, "Save", |
antiright_button (arshell.gui.menubar.file_widget, "Save", |
232 |
arshell_save_work_area, NULL); |
arshell_save_work_area, NULL); |
233 |
antiright_button(arshell.gui.menubar.file_widget, "Save As", |
antiright_button (arshell.gui.menubar.file_widget, "Save As", |
234 |
arshell_save_as_cb, NULL); |
arshell_save_as_cb, NULL); |
235 |
antiright_separator(arshell.gui.menubar.file_widget); |
antiright_separator (arshell.gui.menubar.file_widget); |
236 |
antiright_button(arshell.gui.menubar.file_widget, "Insert", |
antiright_button (arshell.gui.menubar.file_widget, "Insert", |
237 |
arshell_insert_file_cb, NULL); |
arshell_insert_file_cb, NULL); |
238 |
antiright_button(arshell.gui.menubar.file_widget, "Open", |
antiright_button (arshell.gui.menubar.file_widget, "Open", |
239 |
arshell_open_cb, NULL); |
arshell_open_cb, NULL); |
240 |
antiright_button(arshell.gui.menubar.file_widget, "Revert", |
antiright_button (arshell.gui.menubar.file_widget, "Revert", |
241 |
arshell_revert_file_cb, NULL); |
arshell_revert_file_cb, NULL); |
242 |
antiright_separator(arshell.gui.menubar.file_widget); |
antiright_separator (arshell.gui.menubar.file_widget); |
243 |
antiright_button(arshell.gui.menubar.file_widget, "Print", |
antiright_button (arshell.gui.menubar.file_widget, "Print", |
244 |
arshell_print_cb, NULL); |
arshell_print_cb, NULL); |
245 |
antiright_button(arshell.gui.menubar.file_widget, "Spell Check", |
antiright_button (arshell.gui.menubar.file_widget, "Spell Check", |
246 |
arshell_spell_check_buffer, NULL); |
arshell_spell_check_buffer, NULL); |
247 |
arshell.gui.menubar.edit_widget= |
arshell.gui.menubar.edit_widget = |
248 |
antiright_edit_menu(arshell.gui.menubar.menubar_widget, |
antiright_edit_menu (arshell.gui.menubar.menubar_widget, |
249 |
arshell.gui.widgets.work); |
arshell.gui.widgets.work); |
250 |
antiright_separator(arshell.gui.menubar.edit_widget); |
antiright_separator (arshell.gui.menubar.edit_widget); |
251 |
antiright_button(arshell.gui.menubar.edit_widget, "Select All", |
antiright_button (arshell.gui.menubar.edit_widget, "Select All", |
252 |
arshell_select_all, NULL); |
arshell_select_all, NULL); |
253 |
antiright_separator(arshell.gui.menubar.edit_widget); |
antiright_separator (arshell.gui.menubar.edit_widget); |
254 |
antiright_button(arshell.gui.menubar.edit_widget, "Search/Replace", |
antiright_button (arshell.gui.menubar.edit_widget, "Search/Replace", |
255 |
arshell_search_replace_cb, NULL); |
arshell_search_replace_cb, NULL); |
256 |
antiright_button(arshell.gui.menubar.edit_widget, "Find at Cursor", |
antiright_button (arshell.gui.menubar.edit_widget, "Find at Cursor", |
257 |
arshell_find_at_cursor_cb, NULL); |
arshell_find_at_cursor_cb, NULL); |
258 |
antiright_button(arshell.gui.menubar.edit_widget, "Find Selected", |
antiright_button (arshell.gui.menubar.edit_widget, "Find Selected", |
259 |
arshell_find_selected, NULL); |
arshell_find_selected, NULL); |
260 |
antiright_button(arshell.gui.menubar.edit_widget, "Go to Line", |
antiright_button (arshell.gui.menubar.edit_widget, "Go to Line", |
261 |
arshell_goto_line_cb, NULL); |
arshell_goto_line_cb, NULL); |
262 |
antiright_separator(arshell.gui.menubar.edit_widget); |
antiright_separator (arshell.gui.menubar.edit_widget); |
263 |
antiright_button(arshell.gui.menubar.edit_widget, "Lower Selection Case", |
antiright_button (arshell.gui.menubar.edit_widget, |
264 |
arshell_lower_selection_case, NULL); |
"Lower Selection Case", arshell_lower_selection_case, |
265 |
antiright_button(arshell.gui.menubar.edit_widget, "Raise Selection Case", |
NULL); |
266 |
arshell_upper_selection_case, NULL); |
antiright_button (arshell.gui.menubar.edit_widget, |
267 |
antiright_separator(arshell.gui.menubar.edit_widget); |
"Raise Selection Case", arshell_upper_selection_case, |
268 |
antiright_button(arshell.gui.menubar.edit_widget, "Comment Selected", |
NULL); |
269 |
antiright_comment_selection, arshell.gui.widgets.work); |
antiright_separator (arshell.gui.menubar.edit_widget); |
270 |
antiright_button(arshell.gui.menubar.edit_widget, "Uncomment Selected", |
antiright_button (arshell.gui.menubar.edit_widget, "Comment Selected", |
271 |
antiright_uncomment_selection, arshell.gui.widgets.work); |
antiright_comment_selection, |
272 |
antiright_separator(arshell.gui.menubar.edit_widget); |
arshell.gui.widgets.work); |
273 |
antiright_button(arshell.gui.menubar.edit_widget, "Fill Selected", |
antiright_button (arshell.gui.menubar.edit_widget, "Uncomment Selected", |
274 |
antiright_fill_selection, arshell.gui.widgets.work); |
antiright_uncomment_selection, |
275 |
antiright_button(arshell.gui.menubar.edit_widget, "Fill All", |
arshell.gui.widgets.work); |
276 |
antiright_fill_all, arshell.gui.widgets.work); |
antiright_separator (arshell.gui.menubar.edit_widget); |
277 |
antiright_separator(arshell.gui.menubar.view_widget); |
antiright_button (arshell.gui.menubar.edit_widget, "Fill Selected", |
278 |
|
antiright_fill_selection, arshell.gui.widgets.work); |
279 |
|
antiright_button (arshell.gui.menubar.edit_widget, "Fill All", |
280 |
|
antiright_fill_all, arshell.gui.widgets.work); |
281 |
|
antiright_separator (arshell.gui.menubar.view_widget); |
282 |
ARCLARG; |
ARCLARG; |
283 |
toggle_widget=XmCreateToggleButton(arshell.gui.menubar.view_widget, |
toggle_widget = XmCreateToggleButton (arshell.gui.menubar.view_widget, |
284 |
"Show/Hide Toolbar", ARARGS); |
"Show/Hide Toolbar", ARARGS); |
285 |
XtManageChild(toggle_widget); |
XtManageChild (toggle_widget); |
286 |
if(XtIsManaged(XtParent(arshell.gui.layout.row_manager_widget))) |
if (XtIsManaged (XtParent (arshell.gui.layout.row_manager_widget))) |
287 |
XmToggleButtonSetState(toggle_widget, True, True); |
XmToggleButtonSetState (toggle_widget, True, True); |
288 |
XtAddCallback(toggle_widget, XmNvalueChangedCallback, |
XtAddCallback (toggle_widget, XmNvalueChangedCallback, |
289 |
arshell_toggle_toolbar_cb, NULL); |
arshell_toggle_toolbar_cb, NULL); |
290 |
#if XmVERSION > 1 & XmREVISION > 1 |
#if XmVERSION > 1 & XmREVISION > 1 |
291 |
antiright_separator(arshell.gui.menubar.view_widget); |
antiright_separator (arshell.gui.menubar.view_widget); |
292 |
antiright_button(arshell.gui.menubar.view_widget, "Change Font", |
antiright_button (arshell.gui.menubar.view_widget, "Change Font", |
293 |
arshell_change_font_cb, NULL); |
arshell_change_font_cb, NULL); |
294 |
#endif /* XmVERSION > 1 & XmREVISION > 1 */ |
#endif /* XmVERSION > 1 & XmREVISION > 1 */ |
295 |
antiright_separator(arshell.gui.menubar.view_widget); |
antiright_separator (arshell.gui.menubar.view_widget); |
296 |
} |
} |
297 |
|
|
298 |
} |
} |