annotate src/native-gtk-toolbar.c @ 5307:c096d8051f89

Have NATNUMP give t for positive bignums; check limits appropriately. src/ChangeLog addition: 2010-11-20 Aidan Kehoe <kehoea@parhasard.net> * abbrev.c (Fexpand_abbrev): * alloc.c: * alloc.c (Fmake_list): * alloc.c (Fmake_vector): * alloc.c (Fmake_bit_vector): * alloc.c (Fmake_byte_code): * alloc.c (Fmake_string): * alloc.c (vars_of_alloc): * bytecode.c (UNUSED): * bytecode.c (Fbyte_code): * chartab.c (decode_char_table_range): * cmds.c (Fself_insert_command): * data.c (check_integer_range): * data.c (Fnatnump): * data.c (Fnonnegativep): * data.c (Fstring_to_number): * elhash.c (hash_table_size_validate): * elhash.c (decode_hash_table_size): * eval.c (Fbacktrace_frame): * event-stream.c (lisp_number_to_milliseconds): * event-stream.c (Faccept_process_output): * event-stream.c (Frecent_keys): * event-stream.c (Fdispatch_event): * events.c (Fmake_event): * events.c (Fevent_timestamp): * events.c (Fevent_timestamp_lessp): * events.h: * events.h (struct command_builder): * file-coding.c (gzip_putprop): * fns.c: * fns.c (check_sequence_range): * fns.c (Frandom): * fns.c (Fnthcdr): * fns.c (Flast): * fns.c (Fnbutlast): * fns.c (Fbutlast): * fns.c (Fmember): * fns.c (Ffill): * fns.c (Freduce): * fns.c (replace_string_range_1): * fns.c (Freplace): * font-mgr.c (Ffc_pattern_get): * frame-msw.c (msprinter_set_frame_properties): * glyphs.c (check_valid_xbm_inline): * indent.c (Fmove_to_column): * intl-win32.c (mswindows_multibyte_to_unicode_putprop): * lisp.h: * lisp.h (ARRAY_DIMENSION_LIMIT): * lread.c (decode_mode_1): * mule-ccl.c (ccl_get_compiled_code): * number.h: * process-unix.c (unix_open_multicast_group): * process.c (Fset_process_window_size): * profile.c (Fstart_profiling): * unicode.c (Funicode_to_char): Change NATNUMP to return 1 for positive bignums; changes uses of it and of CHECK_NATNUM appropriately, usually by checking for an integer in an appropriate range. Add array-dimension-limit and use it in #'make-vector, #'make-string. Add array-total-size-limit, array-rank-limit while we're at it, for the sake of any Common Lisp-oriented code that uses these limits. Rename check_int_range to check_integer_range, have it take Lisp_Objects (and thus bignums) instead. Remove bignum_butlast(), just set int_n to an appropriately large integer if N is a bignum. Accept bignums in check_sequence_range(), change the functions that use check_sequence_range() appropriately. Move the definition of NATNUMP() to number.h; document why it's a reasonable name, contradicting an old comment. tests/ChangeLog addition: 2010-11-20 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: * automated/lisp-tests.el (featurep): * automated/lisp-tests.el (wrong-type-argument): * automated/mule-tests.el (featurep): Check for args-out-of-range errors instead of wrong-type-argument errors in various places when code is handed a large bignum instead of a fixnum. Also check for the wrong-type-argument errors when giving the same code a non-integer value.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 20 Nov 2010 16:49:11 +0000
parents 97eb4942aec8
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1 /* toolbar implementation -- GTK interface.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
2 Copyright (C) 2000 Aaron Lehmann
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
3 Copyright (C) 2010 Ben Wing.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
4
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
5 This file is part of XEmacs.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
6
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
10 later version.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
11
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
15 for more details.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
16
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
21
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24 #include <config.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25 #include "lisp.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27 #include "console-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28 #include "glyphs-gtk.h"
5176
8b2f75cecb89 rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
29 #include "fontcolor-gtk.h"
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
31 #include "faces.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
32 #include "frame.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
33 #include "toolbar.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
34 #include "window.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
35
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
36 static void
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
37 gtk_clear_toolbar (struct frame *f, enum edge_pos pos);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
38
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
39 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 793
diff changeset
40 gtk_toolbar_callback (GtkWidget *UNUSED (w), gpointer user_data)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
41 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
42 struct toolbar_button *tb = (struct toolbar_button *) user_data;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
43
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44 call0 (tb->callback);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
45 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
46
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
47
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48 static void
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
49 gtk_output_toolbar (struct frame *f, enum edge_pos pos)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51 GtkWidget *toolbar;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
52 Lisp_Object button, window, glyph, instance;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53 unsigned int checksum = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54 struct window *w;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
55 int x, y, bar_width, bar_height, vert;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
56 int cur_x, cur_y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
57
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
58 window = FRAME_LAST_NONMINIBUF_WINDOW (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59 w = XWINDOW (window);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
60
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61 get_toolbar_coords (f, pos, &x, &y, &bar_width, &bar_height, &vert, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
62
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
63 /* Get the toolbar and delete the old widgets in it */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
64 button = FRAME_TOOLBAR_BUTTONS (f, pos);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
65
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
66 /* First loop over all of the buttons to determine how many there
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
67 are. This loop will also make sure that all instances are
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
68 instantiated so when we actually output them they will come up
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
69 immediately. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
70 while (!NILP (button))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
71 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
72 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
73 checksum = HASH4 (checksum,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
74 internal_hash (get_toolbar_button_glyph(w, tb), 0),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
75 internal_hash (tb->callback, 0),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
76 0 /* width */);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
77 button = tb->next;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
78 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
79
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
80 /* Only do updates if the toolbar has changed, or this is the first
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
81 time we have drawn it in this position
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
82 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
83 if (FRAME_GTK_TOOLBAR_WIDGET (f)[pos] &&
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
84 FRAME_GTK_TOOLBAR_CHECKSUM (f, pos) == checksum)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
85 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
87 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
88
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
89 /* Loop through buttons and add them to our toolbar.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
90 This code ignores the button dimensions as we let GTK handle that :)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
91 Attach the toolbar_button struct to the toolbar button so we know what
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
92 function to use as a callback. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
93
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
94 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
95 gtk_clear_toolbar (f, pos);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
96 FRAME_GTK_TOOLBAR_WIDGET (f)[pos] = toolbar =
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
97 gtk_toolbar_new (((pos == TOP_EDGE) || (pos == BOTTOM_EDGE)) ?
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
98 GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
99 GTK_TOOLBAR_BOTH);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
100 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
102 if (NILP (w->toolbar_buttons_captioned_p))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
103 gtk_toolbar_set_style (toolbar, GTK_TOOLBAR_ICONS);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
104 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
105 gtk_toolbar_set_style (toolbar, GTK_TOOLBAR_BOTH);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
107 FRAME_GTK_TOOLBAR_CHECKSUM(f, pos) = checksum;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
108 button = FRAME_TOOLBAR_BUTTONS (f, pos);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
110 cur_x = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
111 cur_y = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
112
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
113 while (!NILP (button))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
114 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
116
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117 if (tb->blank)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
118 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
119 /* It is a blank space... we do not pay attention to the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
120 size, because the GTK toolbar does not allow us to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
121 specify different spacings. *sigh*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
122 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
123 gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
124 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
125 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
126 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
127 /* It actually has a glyph associated with it! What WILL
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
128 they think of next?
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
129 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
130 glyph = tb->up_glyph;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
131
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
132 /* #### It is currently possible for users to trash us by directly
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
133 changing the toolbar glyphs. Avoid crashing in that case. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
134 if (GLYPHP (glyph))
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 462
diff changeset
135 instance = glyph_image_instance (glyph, window,
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 462
diff changeset
136 ERROR_ME_DEBUG_WARN, 1);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
137 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
138 instance = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
139
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
140 if (IMAGE_INSTANCEP(instance))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
141 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
142 GtkWidget *pixmapwid;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
143 GdkPixmap *pixmap;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
144 GdkBitmap *mask;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
145 char *tooltip = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
146
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
147 if (STRINGP (tb->help_string))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
148 tooltip = XSTRING_DATA (tb->help_string);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
149
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
150 pixmap = XIMAGE_INSTANCE_GTK_PIXMAP(instance);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
151 mask = XIMAGE_INSTANCE_GTK_MASK(instance);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
152 pixmapwid = gtk_pixmap_new (pixmap, mask);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
153
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
154 gtk_widget_set_usize (pixmapwid, tb->width, tb->height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
155
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
156 gtk_toolbar_append_item (GTK_TOOLBAR(toolbar), NULL, tooltip, NULL,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
157 pixmapwid, gtk_toolbar_callback, (gpointer) tb);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
158 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
159 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
160 cur_x += vert ? 0 : tb->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
161 cur_y += vert ? tb->height : 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
162 /* Who's idea was it to use a linked list for toolbar buttons? */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
163 button = tb->next;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
164 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
165
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
166 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
167
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
168 x -= vert ? 3 : 2;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
169 y -= vert ? 2 : 3;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
170
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
171 gtk_fixed_put (GTK_FIXED (FRAME_GTK_TEXT_WIDGET (f)), FRAME_GTK_TOOLBAR_WIDGET (f)[pos],x, y);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
172 gtk_widget_show_all (FRAME_GTK_TOOLBAR_WIDGET (f)[pos]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
173 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
174
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
175 static void
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
176 gtk_clear_toolbar (struct frame *f, enum edge_pos pos)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
177 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
178 FRAME_GTK_TOOLBAR_CHECKSUM (f, pos) = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
179 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
180 if (FRAME_GTK_TOOLBAR_WIDGET(f)[pos])
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
181 gtk_widget_destroy (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
182 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
183
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
184 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
185 gtk_output_frame_toolbars (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
186 {
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
187 enum edge_pos pos;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
188
5077
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
189 EDGE_POS_LOOP (pos)
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
190 {
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
191 if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
192 gtk_output_toolbar (f, pos);
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
193 else if (f->toolbar_was_visible[pos])
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
194 gtk_clear_toolbar (f, pos);
d372b17f63ce clean up toolbar/gutter edge geometry
Ben Wing <ben@xemacs.org>
parents: 2500
diff changeset
195 }
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
196 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 793
diff changeset
199 gtk_initialize_frame_toolbars (struct frame *UNUSED (f))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 stderr_out ("We should draw toolbars\n");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
202 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
203
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
204
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
206 /* initialization */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
207 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
210 console_type_create_toolbar_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
211 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
212 CONSOLE_HAS_METHOD (gtk, output_frame_toolbars);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
213 CONSOLE_HAS_METHOD (gtk, initialize_frame_toolbars);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
214 }