180 |
xg_list_insert (xg_list_node *list, xg_list_node *node) |
xg_list_insert (xg_list_node *list, xg_list_node *node) |
181 |
{ |
{ |
182 |
xg_list_node *list_start = list->next; |
xg_list_node *list_start = list->next; |
183 |
|
|
184 |
if (list_start) list_start->prev = node; |
if (list_start) list_start->prev = node; |
185 |
node->next = list_start; |
node->next = list_start; |
186 |
node->prev = 0; |
node->prev = 0; |
213 |
char *str; |
char *str; |
214 |
{ |
{ |
215 |
char *utf8_str = str; |
char *utf8_str = str; |
216 |
|
|
217 |
/* If not UTF-8, try current locale. */ |
/* If not UTF-8, try current locale. */ |
218 |
if (str && !g_utf8_validate (str, -1, NULL)) |
if (str && !g_utf8_validate (str, -1, NULL)) |
219 |
utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0); |
utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0); |
242 |
int top = f->output_data.x->top_pos; |
int top = f->output_data.x->top_pos; |
243 |
int yneg = f->output_data.x->size_hint_flags & YNegative; |
int yneg = f->output_data.x->size_hint_flags & YNegative; |
244 |
char geom_str[32]; |
char geom_str[32]; |
245 |
|
|
246 |
if (xneg) |
if (xneg) |
247 |
left = -left; |
left = -left; |
248 |
if (yneg) |
if (yneg) |
260 |
} |
} |
261 |
} |
} |
262 |
|
|
263 |
|
|
264 |
/* Resize the outer window of frame F after chainging the height. |
/* Resize the outer window of frame F after chainging the height. |
265 |
This happend when the menu bar or the tool bar is added or removed. |
This happend when the menu bar or the tool bar is added or removed. |
266 |
COLUMNS/ROWS is the size the edit area shall have after the resize. */ |
COLUMNS/ROWS is the size the edit area shall have after the resize. */ |
299 |
int tbheight = FRAME_TOOLBAR_HEIGHT (f); |
int tbheight = FRAME_TOOLBAR_HEIGHT (f); |
300 |
int rows = PIXEL_TO_CHAR_HEIGHT (f, pixelheight - mbheight - tbheight); |
int rows = PIXEL_TO_CHAR_HEIGHT (f, pixelheight - mbheight - tbheight); |
301 |
int columns = PIXEL_TO_CHAR_WIDTH (f, pixelwidth); |
int columns = PIXEL_TO_CHAR_WIDTH (f, pixelwidth); |
302 |
|
|
303 |
if (FRAME_GTK_WIDGET (f) |
if (FRAME_GTK_WIDGET (f) |
304 |
&& (columns != FRAME_WIDTH (f) || rows != FRAME_HEIGHT (f) |
&& (columns != FRAME_WIDTH (f) || rows != FRAME_HEIGHT (f) |
305 |
|| pixelwidth != PIXEL_WIDTH (f) || pixelheight != PIXEL_HEIGHT (f))) |
|| pixelwidth != PIXEL_WIDTH (f) || pixelheight != PIXEL_HEIGHT (f))) |
333 |
int pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows) |
int pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows) |
334 |
+ FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); |
+ FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); |
335 |
int pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); |
int pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); |
336 |
|
|
337 |
/* Take into account the size of the scroll bar. Always use the |
/* Take into account the size of the scroll bar. Always use the |
338 |
number of columns occupied by the scroll bar here otherwise we |
number of columns occupied by the scroll bar here otherwise we |
339 |
might end up with a frame width that is not a multiple of the |
might end up with a frame width that is not a multiple of the |
374 |
event.any.window = gdkwin; |
event.any.window = gdkwin; |
375 |
gwdesc = gtk_get_event_widget (&event); |
gwdesc = gtk_get_event_widget (&event); |
376 |
} |
} |
377 |
|
|
378 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
379 |
return gwdesc; |
return gwdesc; |
380 |
} |
} |
404 |
GtkRcStyle *style; |
GtkRcStyle *style; |
405 |
int i; |
int i; |
406 |
char *title = 0; |
char *title = 0; |
407 |
|
|
408 |
BLOCK_INPUT; |
BLOCK_INPUT; |
409 |
|
|
410 |
wtop = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
wtop = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
411 |
wvbox = gtk_vbox_new (FALSE, 0); |
wvbox = gtk_vbox_new (FALSE, 0); |
412 |
wfixed = gtk_fixed_new (); /* Must have this to place scroll bars */ |
wfixed = gtk_fixed_new (); /* Must have this to place scroll bars */ |
413 |
|
|
414 |
if (! wtop || ! wvbox || ! wfixed) |
if (! wtop || ! wvbox || ! wfixed) |
415 |
{ |
{ |
416 |
if (wtop) gtk_widget_destroy (wtop); |
if (wtop) gtk_widget_destroy (wtop); |
430 |
else if (! NILP (f->name)) title = SDATA (f->name); |
else if (! NILP (f->name)) title = SDATA (f->name); |
431 |
|
|
432 |
if (title) gtk_window_set_title (GTK_WINDOW (wtop), title); |
if (title) gtk_window_set_title (GTK_WINDOW (wtop), title); |
433 |
|
|
434 |
FRAME_GTK_OUTER_WIDGET (f) = wtop; |
FRAME_GTK_OUTER_WIDGET (f) = wtop; |
435 |
FRAME_GTK_WIDGET (f) = wfixed; |
FRAME_GTK_WIDGET (f) = wfixed; |
436 |
f->output_data.x->vbox_widget = wvbox; |
f->output_data.x->vbox_widget = wvbox; |
440 |
gtk_widget_set_size_request (wfixed, |
gtk_widget_set_size_request (wfixed, |
441 |
PIXEL_WIDTH (f), |
PIXEL_WIDTH (f), |
442 |
PIXEL_HEIGHT (f)); |
PIXEL_HEIGHT (f)); |
443 |
|
|
444 |
gtk_container_add (GTK_CONTAINER (wtop), wvbox); |
gtk_container_add (GTK_CONTAINER (wtop), wvbox); |
445 |
gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0); |
gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0); |
446 |
|
|
456 |
later on when tool bar items are added. */ |
later on when tool bar items are added. */ |
457 |
if (FRAME_EXTERNAL_TOOL_BAR (f) && FRAME_TOOLBAR_HEIGHT (f) == 0) |
if (FRAME_EXTERNAL_TOOL_BAR (f) && FRAME_TOOLBAR_HEIGHT (f) == 0) |
458 |
FRAME_TOOLBAR_HEIGHT (f) = 34; |
FRAME_TOOLBAR_HEIGHT (f) = 34; |
459 |
|
|
460 |
gtk_widget_set_double_buffered (wvbox, FALSE); |
gtk_widget_set_double_buffered (wvbox, FALSE); |
461 |
gtk_widget_set_double_buffered (wfixed, FALSE); |
gtk_widget_set_double_buffered (wfixed, FALSE); |
462 |
gtk_widget_set_double_buffered (wtop, FALSE); |
gtk_widget_set_double_buffered (wtop, FALSE); |
463 |
|
|
464 |
/* GTK documents says use gtk_window_set_resizable. But then a user |
/* GTK documents says use gtk_window_set_resizable. But then a user |
465 |
can't shrink the window from its starting size. */ |
can't shrink the window from its starting size. */ |
466 |
gtk_window_set_policy (GTK_WINDOW (wtop), TRUE, TRUE, TRUE); |
gtk_window_set_policy (GTK_WINDOW (wtop), TRUE, TRUE, TRUE); |
472 |
GTK is to destroy the widget. We want Emacs to do that instead. */ |
GTK is to destroy the widget. We want Emacs to do that instead. */ |
473 |
g_signal_connect (G_OBJECT (wtop), "delete-event", |
g_signal_connect (G_OBJECT (wtop), "delete-event", |
474 |
G_CALLBACK (gtk_true), 0); |
G_CALLBACK (gtk_true), 0); |
475 |
|
|
476 |
/* Convert our geometry parameters into a geometry string |
/* Convert our geometry parameters into a geometry string |
477 |
and specify it. |
and specify it. |
478 |
GTK will itself handle calculating the real position this way. */ |
GTK will itself handle calculating the real position this way. */ |
508 |
/* Must use g_strdup because gtk_widget_modify_style does g_free. */ |
/* Must use g_strdup because gtk_widget_modify_style does g_free. */ |
509 |
style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup ("<none>"); |
style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup ("<none>"); |
510 |
gtk_widget_modify_style (wfixed, style); |
gtk_widget_modify_style (wfixed, style); |
511 |
|
|
512 |
/* GTK does not set any border, and they look bad with GTK. */ |
/* GTK does not set any border, and they look bad with GTK. */ |
513 |
f->output_data.x->border_width = 0; |
f->output_data.x->border_width = 0; |
514 |
f->output_data.x->internal_border_width = 0; |
f->output_data.x->internal_border_width = 0; |
538 |
int base_width, base_height; |
int base_width, base_height; |
539 |
int min_rows = 0, min_cols = 0; |
int min_rows = 0, min_cols = 0; |
540 |
int win_gravity = f->output_data.x->win_gravity; |
int win_gravity = f->output_data.x->win_gravity; |
541 |
|
|
542 |
if (flags) |
if (flags) |
543 |
{ |
{ |
544 |
memset (&size_hints, 0, sizeof (size_hints)); |
memset (&size_hints, 0, sizeof (size_hints)); |
547 |
} |
} |
548 |
else |
else |
549 |
flags = f->output_data.x->size_hint_flags; |
flags = f->output_data.x->size_hint_flags; |
550 |
|
|
551 |
size_hints = f->output_data.x->size_hints; |
size_hints = f->output_data.x->size_hints; |
552 |
hint_flags = f->output_data.x->hint_flags; |
hint_flags = f->output_data.x->hint_flags; |
553 |
|
|
567 |
size_hints.min_width = base_width + min_cols * size_hints.width_inc; |
size_hints.min_width = base_width + min_cols * size_hints.width_inc; |
568 |
size_hints.min_height = base_height + min_rows * size_hints.height_inc; |
size_hints.min_height = base_height + min_rows * size_hints.height_inc; |
569 |
|
|
570 |
|
|
571 |
/* These currently have a one to one mapping with the X values, but I |
/* These currently have a one to one mapping with the X values, but I |
572 |
don't think we should rely on that. */ |
don't think we should rely on that. */ |
573 |
hint_flags |= GDK_HINT_WIN_GRAVITY; |
hint_flags |= GDK_HINT_WIN_GRAVITY; |
648 |
get_dialog_title (char key) |
get_dialog_title (char key) |
649 |
{ |
{ |
650 |
char *title = ""; |
char *title = ""; |
651 |
|
|
652 |
switch (key) { |
switch (key) { |
653 |
case 'E': case 'e': |
case 'E': case 'e': |
654 |
title = "Error"; |
title = "Error"; |
746 |
|
|
747 |
g_signal_connect (G_OBJECT (wdialog), "delete-event", |
g_signal_connect (G_OBJECT (wdialog), "delete-event", |
748 |
G_CALLBACK (dialog_delete_callback), 0); |
G_CALLBACK (dialog_delete_callback), 0); |
749 |
|
|
750 |
if (deactivate_cb) |
if (deactivate_cb) |
751 |
{ |
{ |
752 |
g_signal_connect (G_OBJECT (wdialog), "close", deactivate_cb, 0); |
g_signal_connect (G_OBJECT (wdialog), "close", deactivate_cb, 0); |
876 |
GtkFileSelection *filesel; |
GtkFileSelection *filesel; |
877 |
int filesel_done = XG_FILE_NOT_DONE; |
int filesel_done = XG_FILE_NOT_DONE; |
878 |
char *fn = 0; |
char *fn = 0; |
879 |
|
|
880 |
filewin = gtk_file_selection_new (prompt); |
filewin = gtk_file_selection_new (prompt); |
881 |
filesel = GTK_FILE_SELECTION (filewin); |
filesel = GTK_FILE_SELECTION (filewin); |
882 |
|
|
909 |
gtk_file_selection_hide_fileop_buttons (filesel); |
gtk_file_selection_hide_fileop_buttons (filesel); |
910 |
} |
} |
911 |
|
|
912 |
|
|
913 |
gtk_widget_show_all (filewin); |
gtk_widget_show_all (filewin); |
914 |
|
|
915 |
while (filesel_done == XG_FILE_NOT_DONE) |
while (filesel_done == XG_FILE_NOT_DONE) |
916 |
gtk_main_iteration (); |
gtk_main_iteration (); |
917 |
|
|
950 |
|
|
951 |
The menu bar and all sub menus under the menu bar in a frame |
The menu bar and all sub menus under the menu bar in a frame |
952 |
share the same structure, hence the reference count. |
share the same structure, hence the reference count. |
953 |
|
|
954 |
Returns CL_DATA if CL_DATA is not NULL, or a pointer to a newly |
Returns CL_DATA if CL_DATA is not NULL, or a pointer to a newly |
955 |
allocated xg_menu_cb_data if CL_DATA is NULL. */ |
allocated xg_menu_cb_data if CL_DATA is NULL. */ |
956 |
static xg_menu_cb_data * |
static xg_menu_cb_data * |
1069 |
{ |
{ |
1070 |
xg_menu_item_cb_data *data = (xg_menu_item_cb_data*) client_data; |
xg_menu_item_cb_data *data = (xg_menu_item_cb_data*) client_data; |
1071 |
gpointer call_data = event->type == GDK_LEAVE_NOTIFY ? 0 : client_data; |
gpointer call_data = event->type == GDK_LEAVE_NOTIFY ? 0 : client_data; |
1072 |
|
|
1073 |
if (! NILP (data->help) && data->cl_data->highlight_cb) |
if (! NILP (data->help) && data->cl_data->highlight_cb) |
1074 |
{ |
{ |
1075 |
GtkCallback func = (GtkCallback) data->cl_data->highlight_cb; |
GtkCallback func = (GtkCallback) data->cl_data->highlight_cb; |
1125 |
GtkWidget *wlbl; |
GtkWidget *wlbl; |
1126 |
GtkWidget *wkey; |
GtkWidget *wkey; |
1127 |
GtkWidget *wbox; |
GtkWidget *wbox; |
1128 |
|
|
1129 |
wbox = gtk_hbox_new (FALSE, 0); |
wbox = gtk_hbox_new (FALSE, 0); |
1130 |
wlbl = gtk_label_new_with_mnemonic (utf8_label); |
wlbl = gtk_label_new_with_mnemonic (utf8_label); |
1131 |
wkey = gtk_label_new (utf8_key); |
wkey = gtk_label_new (utf8_key); |
1132 |
|
|
1133 |
gtk_misc_set_alignment (GTK_MISC (wlbl), 0.0, 0.5); |
gtk_misc_set_alignment (GTK_MISC (wlbl), 0.0, 0.5); |
1134 |
gtk_misc_set_alignment (GTK_MISC (wkey), 0.0, 0.5); |
gtk_misc_set_alignment (GTK_MISC (wkey), 0.0, 0.5); |
1135 |
|
|
1136 |
gtk_box_pack_start (GTK_BOX (wbox), wlbl, TRUE, TRUE, 0); |
gtk_box_pack_start (GTK_BOX (wbox), wlbl, TRUE, TRUE, 0); |
1137 |
gtk_box_pack_start (GTK_BOX (wbox), wkey, FALSE, FALSE, 0); |
gtk_box_pack_start (GTK_BOX (wbox), wkey, FALSE, FALSE, 0); |
1138 |
|
|
1146 |
UTF8_LABEL is the text for the menu item (GTK uses UTF8 internally). |
UTF8_LABEL is the text for the menu item (GTK uses UTF8 internally). |
1147 |
UTF8_KEY is the text representing the key binding. |
UTF8_KEY is the text representing the key binding. |
1148 |
ITEM is the widget_value describing the menu item. |
ITEM is the widget_value describing the menu item. |
1149 |
|
|
1150 |
GROUP is an in/out parameter. If the menu item to be created is not |
GROUP is an in/out parameter. If the menu item to be created is not |
1151 |
part of any radio menu group, *GROUP contains NULL on entry and exit. |
part of any radio menu group, *GROUP contains NULL on entry and exit. |
1152 |
If the menu item to be created is part of a radio menu group, on entry |
If the menu item to be created is part of a radio menu group, on entry |
1164 |
{ |
{ |
1165 |
GtkWidget *w; |
GtkWidget *w; |
1166 |
GtkWidget *wtoadd = 0; |
GtkWidget *wtoadd = 0; |
1167 |
|
|
1168 |
if (utf8_key) |
if (utf8_key) |
1169 |
wtoadd = make_widget_for_menu_item (utf8_label, utf8_key); |
wtoadd = make_widget_for_menu_item (utf8_label, utf8_key); |
1170 |
|
|
1171 |
if (item->button_type == BUTTON_TYPE_TOGGLE) |
if (item->button_type == BUTTON_TYPE_TOGGLE) |
1172 |
{ |
{ |
1173 |
*group = NULL; |
*group = NULL; |
1189 |
if (utf8_key) w = gtk_menu_item_new (); |
if (utf8_key) w = gtk_menu_item_new (); |
1190 |
else w = gtk_menu_item_new_with_mnemonic (utf8_label); |
else w = gtk_menu_item_new_with_mnemonic (utf8_label); |
1191 |
} |
} |
1192 |
|
|
1193 |
if (wtoadd) gtk_container_add (GTK_CONTAINER (w), wtoadd); |
if (wtoadd) gtk_container_add (GTK_CONTAINER (w), wtoadd); |
1194 |
if (! item->enabled) gtk_widget_set_sensitive (w, FALSE); |
if (! item->enabled) gtk_widget_set_sensitive (w, FALSE); |
1195 |
|
|
1230 |
/* Callback invoked when a menu is detached. It sets the xg_did_tearoff |
/* Callback invoked when a menu is detached. It sets the xg_did_tearoff |
1231 |
variable. |
variable. |
1232 |
WIDGET is the GtkTearoffMenuItem. |
WIDGET is the GtkTearoffMenuItem. |
1233 |
CLIENT_DATA is not used. */ |
CLIENT_DATA is not used. */ |
1234 |
static void |
static void |
1235 |
tearoff_activate (widget, client_data) |
tearoff_activate (widget, client_data) |
1236 |
GtkWidget *widget; |
GtkWidget *widget; |
1257 |
|
|
1258 |
/* Find the top widget for the detached menu. */ |
/* Find the top widget for the detached menu. */ |
1259 |
p = gtk_widget_get_toplevel (submenu); |
p = gtk_widget_get_toplevel (submenu); |
1260 |
|
|
1261 |
/* Delay destroying the menu until the detached menu is removed. */ |
/* Delay destroying the menu until the detached menu is removed. */ |
1262 |
g_signal_connect (G_OBJECT (p), "unmap_event", |
g_signal_connect (G_OBJECT (p), "unmap_event", |
1263 |
G_CALLBACK (tearoff_remove), menu); |
G_CALLBACK (tearoff_remove), menu); |
1308 |
cb_data->help = item->help; |
cb_data->help = item->help; |
1309 |
cb_data->cl_data = cl_data; |
cb_data->cl_data = cl_data; |
1310 |
cb_data->call_data = item->call_data; |
cb_data->call_data = item->call_data; |
1311 |
|
|
1312 |
g_signal_connect (G_OBJECT (w), |
g_signal_connect (G_OBJECT (w), |
1313 |
"destroy", |
"destroy", |
1314 |
G_CALLBACK (menuitem_destroy_callback), |
G_CALLBACK (menuitem_destroy_callback), |
1395 |
g_object_set_data (G_OBJECT (wmenu), XG_FRAME_DATA, (gpointer)cl_data); |
g_object_set_data (G_OBJECT (wmenu), XG_FRAME_DATA, (gpointer)cl_data); |
1396 |
g_signal_connect (G_OBJECT (wmenu), "destroy", |
g_signal_connect (G_OBJECT (wmenu), "destroy", |
1397 |
G_CALLBACK (menu_destroy_callback), cl_data); |
G_CALLBACK (menu_destroy_callback), cl_data); |
1398 |
|
|
1399 |
if (name) |
if (name) |
1400 |
gtk_widget_set_name (wmenu, name); |
gtk_widget_set_name (wmenu, name); |
1401 |
|
|
1406 |
g_signal_connect (G_OBJECT (wmenu), |
g_signal_connect (G_OBJECT (wmenu), |
1407 |
"grab-notify", G_CALLBACK (menu_grab_callback), 0); |
"grab-notify", G_CALLBACK (menu_grab_callback), 0); |
1408 |
} |
} |
1409 |
|
|
1410 |
if (! menu_bar_p && add_tearoff_p) |
if (! menu_bar_p && add_tearoff_p) |
1411 |
{ |
{ |
1412 |
GtkWidget *tearoff = gtk_tearoff_menu_item_new (); |
GtkWidget *tearoff = gtk_tearoff_menu_item_new (); |
1419 |
for (item = data; item; item = item->next) |
for (item = data; item; item = item->next) |
1420 |
{ |
{ |
1421 |
GtkWidget *w; |
GtkWidget *w; |
1422 |
|
|
1423 |
if (pop_up_p && !item->contents && !item->call_data |
if (pop_up_p && !item->contents && !item->call_data |
1424 |
&& !xg_separator_p (item->name)) |
&& !xg_separator_p (item->name)) |
1425 |
{ |
{ |
1585 |
/* Add a ref to w so we can explicitly destroy it later. */ |
/* Add a ref to w so we can explicitly destroy it later. */ |
1586 |
gtk_widget_ref (w); |
gtk_widget_ref (w); |
1587 |
gtk_container_remove (GTK_CONTAINER (wcont), w); |
gtk_container_remove (GTK_CONTAINER (wcont), w); |
1588 |
|
|
1589 |
/* If there is a menu under this widget that has been detached, |
/* If there is a menu under this widget that has been detached, |
1590 |
there is a reference to it, and just removing w from the |
there is a reference to it, and just removing w from the |
1591 |
container does not destroy the submenu. By explicitly |
container does not destroy the submenu. By explicitly |
1679 |
Current: A B C |
Current: A B C |
1680 |
New: A C |
New: A C |
1681 |
Remove B. */ |
Remove B. */ |
1682 |
|
|
1683 |
gtk_widget_ref (GTK_WIDGET (witem)); |
gtk_widget_ref (GTK_WIDGET (witem)); |
1684 |
gtk_container_remove (GTK_CONTAINER (menubar), GTK_WIDGET (witem)); |
gtk_container_remove (GTK_CONTAINER (menubar), GTK_WIDGET (witem)); |
1685 |
gtk_widget_destroy (GTK_WIDGET (witem)); |
gtk_widget_destroy (GTK_WIDGET (witem)); |
1707 |
is up to date when leaving the minibuffer. */ |
is up to date when leaving the minibuffer. */ |
1708 |
GtkLabel *wlabel = GTK_LABEL (gtk_bin_get_child (GTK_BIN (witem))); |
GtkLabel *wlabel = GTK_LABEL (gtk_bin_get_child (GTK_BIN (witem))); |
1709 |
char *utf8_label = get_utf8_string (val->name); |
char *utf8_label = get_utf8_string (val->name); |
1710 |
|
|
1711 |
gtk_label_set_text_with_mnemonic (wlabel, utf8_label); |
gtk_label_set_text_with_mnemonic (wlabel, utf8_label); |
1712 |
|
|
1713 |
iter = g_list_next (iter); |
iter = g_list_next (iter); |
1787 |
const char *old_label = 0; |
const char *old_label = 0; |
1788 |
const char *old_key = 0; |
const char *old_key = 0; |
1789 |
xg_menu_item_cb_data *cb_data; |
xg_menu_item_cb_data *cb_data; |
1790 |
|
|
1791 |
wchild = gtk_bin_get_child (GTK_BIN (w)); |
wchild = gtk_bin_get_child (GTK_BIN (w)); |
1792 |
utf8_label = get_utf8_string (val->name); |
utf8_label = get_utf8_string (val->name); |
1793 |
utf8_key = get_utf8_string (val->key); |
utf8_key = get_utf8_string (val->key); |
1794 |
|
|
1830 |
} |
} |
1831 |
} |
} |
1832 |
|
|
1833 |
|
|
1834 |
if (wkey) old_key = gtk_label_get_label (wkey); |
if (wkey) old_key = gtk_label_get_label (wkey); |
1835 |
if (wlbl) old_label = gtk_label_get_label (wlbl); |
if (wlbl) old_label = gtk_label_get_label (wlbl); |
1836 |
|
|
1837 |
if (wkey && utf8_key && (! old_key || strcmp (utf8_key, old_key) != 0)) |
if (wkey && utf8_key && (! old_key || strcmp (utf8_key, old_key) != 0)) |
1838 |
gtk_label_set_text (wkey, utf8_key); |
gtk_label_set_text (wkey, utf8_key); |
1839 |
|
|
1842 |
|
|
1843 |
if (utf8_key && utf8_key != val->key) g_free (utf8_key); |
if (utf8_key && utf8_key != val->key) g_free (utf8_key); |
1844 |
if (utf8_label && utf8_label != val->name) g_free (utf8_label); |
if (utf8_label && utf8_label != val->name) g_free (utf8_label); |
1845 |
|
|
1846 |
if (! val->enabled && GTK_WIDGET_SENSITIVE (w)) |
if (! val->enabled && GTK_WIDGET_SENSITIVE (w)) |
1847 |
gtk_widget_set_sensitive (w, FALSE); |
gtk_widget_set_sensitive (w, FALSE); |
1848 |
else if (val->enabled && ! GTK_WIDGET_SENSITIVE (w)) |
else if (val->enabled && ! GTK_WIDGET_SENSITIVE (w)) |
1855 |
cb_data->call_data = val->call_data; |
cb_data->call_data = val->call_data; |
1856 |
cb_data->help = val->help; |
cb_data->help = val->help; |
1857 |
cb_data->cl_data = cl_data; |
cb_data->cl_data = cl_data; |
1858 |
|
|
1859 |
/* We assume the callback functions don't change. */ |
/* We assume the callback functions don't change. */ |
1860 |
if (val->call_data && ! val->contents) |
if (val->call_data && ! val->contents) |
1861 |
{ |
{ |
1951 |
widget_value *cur; |
widget_value *cur; |
1952 |
int has_tearoff_p = 0; |
int has_tearoff_p = 0; |
1953 |
GList *first_radio = 0; |
GList *first_radio = 0; |
1954 |
|
|
1955 |
if (submenu) |
if (submenu) |
1956 |
list = gtk_container_get_children (GTK_CONTAINER (submenu)); |
list = gtk_container_get_children (GTK_CONTAINER (submenu)); |
1957 |
|
|
1958 |
for (cur = val, iter = list; |
for (cur = val, iter = list; |
1959 |
cur && iter; |
cur && iter; |
1960 |
iter = g_list_next (iter), cur = cur->next) |
iter = g_list_next (iter), cur = cur->next) |
2046 |
if (cur && first_radio) remove_from_container (submenu, first_radio); |
if (cur && first_radio) remove_from_container (submenu, first_radio); |
2047 |
else remove_from_container (submenu, iter); |
else remove_from_container (submenu, iter); |
2048 |
} |
} |
2049 |
|
|
2050 |
if (cur) |
if (cur) |
2051 |
{ |
{ |
2052 |
/* More items added. Create them. */ |
/* More items added. Create them. */ |
2062 |
cl_data, |
cl_data, |
2063 |
0); |
0); |
2064 |
} |
} |
2065 |
|
|
2066 |
if (list) g_list_free (list); |
if (list) g_list_free (list); |
2067 |
|
|
2068 |
return newsub; |
return newsub; |
2091 |
GList *list = gtk_container_get_children (GTK_CONTAINER (menubar)); |
GList *list = gtk_container_get_children (GTK_CONTAINER (menubar)); |
2092 |
|
|
2093 |
if (! list) return; |
if (! list) return; |
2094 |
|
|
2095 |
cl_data = (xg_menu_cb_data*) g_object_get_data (G_OBJECT (menubar), |
cl_data = (xg_menu_cb_data*) g_object_get_data (G_OBJECT (menubar), |
2096 |
XG_FRAME_DATA); |
XG_FRAME_DATA); |
2097 |
|
|
2129 |
break; |
break; |
2130 |
} |
} |
2131 |
} |
} |
2132 |
|
|
2133 |
newsub = xg_update_submenu (sub, |
newsub = xg_update_submenu (sub, |
2134 |
f, |
f, |
2135 |
cur->contents, |
cur->contents, |
2159 |
{ |
{ |
2160 |
struct x_output *x = f->output_data.x; |
struct x_output *x = f->output_data.x; |
2161 |
GtkRequisition req; |
GtkRequisition req; |
2162 |
|
|
2163 |
if (!x->menubar_widget || GTK_WIDGET_MAPPED (x->menubar_widget)) |
if (!x->menubar_widget || GTK_WIDGET_MAPPED (x->menubar_widget)) |
2164 |
return 0; |
return 0; |
2165 |
|
|
2177 |
/* The height has changed, resize outer widget and set columns |
/* The height has changed, resize outer widget and set columns |
2178 |
rows to what we had before adding the menu bar. */ |
rows to what we had before adding the menu bar. */ |
2179 |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
2180 |
|
|
2181 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
2182 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
2183 |
} |
} |
2311 |
{ |
{ |
2312 |
gpointer p; |
gpointer p; |
2313 |
int id = (int)data; |
int id = (int)data; |
2314 |
|
|
2315 |
p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA); |
p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA); |
2316 |
if (p) xfree (p); |
if (p) xfree (p); |
2317 |
xg_remove_widget_from_map (id); |
xg_remove_widget_from_map (id); |
2355 |
GtkWidget *wscroll; |
GtkWidget *wscroll; |
2356 |
GtkObject *vadj; |
GtkObject *vadj; |
2357 |
int scroll_id; |
int scroll_id; |
2358 |
|
|
2359 |
/* Page, step increment values are not so important here, they |
/* Page, step increment values are not so important here, they |
2360 |
will be corrected in x_set_toolkit_scroll_bar_thumb. */ |
will be corrected in x_set_toolkit_scroll_bar_thumb. */ |
2361 |
vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX, |
vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX, |
2364 |
wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj)); |
wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj)); |
2365 |
gtk_widget_set_name (wscroll, scroll_bar_name); |
gtk_widget_set_name (wscroll, scroll_bar_name); |
2366 |
gtk_range_set_update_policy (GTK_RANGE (wscroll), GTK_UPDATE_CONTINUOUS); |
gtk_range_set_update_policy (GTK_RANGE (wscroll), GTK_UPDATE_CONTINUOUS); |
2367 |
|
|
2368 |
scroll_id = xg_store_widget_in_map (wscroll); |
scroll_id = xg_store_widget_in_map (wscroll); |
2369 |
|
|
2370 |
g_signal_connect (G_OBJECT (vadj), |
g_signal_connect (G_OBJECT (vadj), |
2371 |
"value-changed", |
"value-changed", |
2372 |
scroll_callback, |
scroll_callback, |
2386 |
"button-release-event", |
"button-release-event", |
2387 |
G_CALLBACK (scroll_bar_button_cb), |
G_CALLBACK (scroll_bar_button_cb), |
2388 |
0); |
0); |
2389 |
|
|
2390 |
gtk_fixed_put (GTK_FIXED (f->output_data.x->edit_widget), |
gtk_fixed_put (GTK_FIXED (f->output_data.x->edit_widget), |
2391 |
wscroll, 0, 0); |
wscroll, 0, 0); |
2392 |
|
|
2426 |
TOP/LEFT are the new pixel positions where the bar shall appear. |
TOP/LEFT are the new pixel positions where the bar shall appear. |
2427 |
WIDTH, HEIGHT is the size in pixels the bar shall have. */ |
WIDTH, HEIGHT is the size in pixels the bar shall have. */ |
2428 |
void |
void |
2429 |
xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) |
xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) |
2430 |
FRAME_PTR f; |
FRAME_PTR f; |
2431 |
int scrollbar_id; |
int scrollbar_id; |
2432 |
int top; |
int top; |
2483 |
gdouble shown; |
gdouble shown; |
2484 |
gdouble top; |
gdouble top; |
2485 |
int size, value; |
int size, value; |
2486 |
|
|
2487 |
adj = gtk_range_get_adjustment (GTK_RANGE (wscroll)); |
adj = gtk_range_get_adjustment (GTK_RANGE (wscroll)); |
2488 |
|
|
2489 |
if (whole <= 0) |
if (whole <= 0) |
2552 |
return; |
return; |
2553 |
|
|
2554 |
idx *= TOOL_BAR_ITEM_NSLOTS; |
idx *= TOOL_BAR_ITEM_NSLOTS; |
2555 |
|
|
2556 |
key = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_KEY); |
key = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_KEY); |
2557 |
XSETFRAME (frame, f); |
XSETFRAME (frame, f); |
2558 |
event.kind = TOOL_BAR_EVENT; |
event.kind = TOOL_BAR_EVENT; |
2678 |
x->handlebox_widget = gtk_handle_box_new (); |
x->handlebox_widget = gtk_handle_box_new (); |
2679 |
gtk_container_add (GTK_CONTAINER (x->handlebox_widget), |
gtk_container_add (GTK_CONTAINER (x->handlebox_widget), |
2680 |
x->toolbar_widget); |
x->toolbar_widget); |
2681 |
|
|
2682 |
gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, |
gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, |
2683 |
FALSE, FALSE, 0); |
FALSE, FALSE, 0); |
2684 |
|
|
2685 |
gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget, |
gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget, |
2686 |
vbox_pos); |
vbox_pos); |
2687 |
|
|
2694 |
|
|
2695 |
gtk_widget_size_request (x->toolbar_widget, &req); |
gtk_widget_size_request (x->toolbar_widget, &req); |
2696 |
FRAME_TOOLBAR_HEIGHT (f) = req.height; |
FRAME_TOOLBAR_HEIGHT (f) = req.height; |
2697 |
|
|
2698 |
/* The height has changed, resize outer widget and set columns |
/* The height has changed, resize outer widget and set columns |
2699 |
rows to what we had before adding the tool bar. */ |
rows to what we had before adding the tool bar. */ |
2700 |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
2701 |
|
|
2702 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
2703 |
} |
} |
2704 |
|
|
2716 |
return; |
return; |
2717 |
|
|
2718 |
BLOCK_INPUT; |
BLOCK_INPUT; |
2719 |
|
|
2720 |
if (! x->toolbar_widget) |
if (! x->toolbar_widget) |
2721 |
xg_create_tool_bar (f); |
xg_create_tool_bar (f); |
2722 |
|
|
2724 |
|
|
2725 |
icon_list = gtk_container_get_children (GTK_CONTAINER (x->toolbar_widget)); |
icon_list = gtk_container_get_children (GTK_CONTAINER (x->toolbar_widget)); |
2726 |
iter = icon_list; |
iter = icon_list; |
2727 |
|
|
2728 |
for (i = 0; i < f->n_tool_bar_items; ++i) |
for (i = 0; i < f->n_tool_bar_items; ++i) |
2729 |
{ |
{ |
2730 |
#define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) |
#define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) |
2775 |
if (wicon) gtk_widget_hide (wicon); |
if (wicon) gtk_widget_hide (wicon); |
2776 |
continue; |
continue; |
2777 |
} |
} |
2778 |
|
|
2779 |
if (! wicon) |
if (! wicon) |
2780 |
{ |
{ |
2781 |
GdkPixmap *gpix = gdk_pixmap_foreign_new (img->pixmap); |
GdkPixmap *gpix = gdk_pixmap_foreign_new (img->pixmap); |
2788 |
w, |
w, |
2789 |
GTK_SIGNAL_FUNC (xg_tool_bar_callback), |
GTK_SIGNAL_FUNC (xg_tool_bar_callback), |
2790 |
(gpointer)i); |
(gpointer)i); |
2791 |
|
|
2792 |
/* Save the image so we can see if an update is needed when |
/* Save the image so we can see if an update is needed when |
2793 |
this function is called again. */ |
this function is called again. */ |
2794 |
g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, |
g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, |
2798 |
of the GtkImage parent. Go upwards until we find the button. */ |
of the GtkImage parent. Go upwards until we find the button. */ |
2799 |
while (! GTK_IS_BUTTON (w)) |
while (! GTK_IS_BUTTON (w)) |
2800 |
w = gtk_widget_get_parent (w); |
w = gtk_widget_get_parent (w); |
2801 |
|
|
2802 |
if (w) |
if (w) |
2803 |
{ |
{ |
2804 |
/* Save the frame in the button so the xg_tool_bar_callback |
/* Save the frame in the button so the xg_tool_bar_callback |
2848 |
gtk_widget_set_sensitive (wicon, enabled_p); |
gtk_widget_set_sensitive (wicon, enabled_p); |
2849 |
gtk_widget_show (wicon); |
gtk_widget_show (wicon); |
2850 |
} |
} |
2851 |
|
|
2852 |
#undef PROP |
#undef PROP |
2853 |
} |
} |
2854 |
|
|