Mercurial > hg > xemacs-beta
comparison src/native-gtk-toolbar.c @ 5077:d372b17f63ce
clean up toolbar/gutter edge geometry
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-02-25 Ben Wing <ben@xemacs.org>
* EmacsFrame.c (EmacsFrameSetValues):
* frame-impl.h:
* frame-impl.h (struct frame):
* frame-impl.h (FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT):
* frame-impl.h (FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH):
* frame-impl.h (FRAME_REAL_TOP_TOOLBAR_HEIGHT):
* frame-impl.h (FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH):
* frame-impl.h (FRAME_REAL_TOP_TOOLBAR_VISIBLE):
* frame-impl.h (FRAME_REAL_TOP_TOOLBAR_BOUNDS):
* frame.h:
* frame.h (enum edge_pos):
* gutter.c:
* gutter.c (get_gutter_coords):
* gutter.c (display_boxes_in_gutter_p):
* gutter.c (construct_window_gutter_spec):
* gutter.c (calculate_gutter_size_from_display_lines):
* gutter.c (calculate_gutter_size):
* gutter.c (output_gutter):
* gutter.c (clear_gutter):
* gutter.c (mark_gutters):
* gutter.c (gutter_extent_signal_changed_region_maybe):
* gutter.c (update_gutter_geometry):
* gutter.c (update_frame_gutter_geometry):
* gutter.c (update_frame_gutters):
* gutter.c (reset_gutter_display_lines):
* gutter.c (redraw_exposed_gutter):
* gutter.c (redraw_exposed_gutters):
* gutter.c (free_frame_gutters):
* gutter.c (decode_gutter_position):
* gutter.c (Fset_default_gutter_position):
* gutter.c (Fgutter_pixel_width):
* gutter.c (Fgutter_pixel_height):
* gutter.c (recompute_overlaying_specifier):
* gutter.c (gutter_specs_changed_1):
* gutter.c (gutter_specs_changed):
* gutter.c (top_gutter_specs_changed):
* gutter.c (bottom_gutter_specs_changed):
* gutter.c (left_gutter_specs_changed):
* gutter.c (right_gutter_specs_changed):
* gutter.c (gutter_geometry_changed_in_window):
* gutter.c (init_frame_gutters):
* gutter.c (specifier_vars_of_gutter):
* gutter.h:
* gutter.h (WINDOW_REAL_TOP_GUTTER_BOUNDS):
* gutter.h (FRAME_TOP_GUTTER_BOUNDS):
* lisp.h (enum edge_style):
* native-gtk-toolbar.c:
* native-gtk-toolbar.c (gtk_output_toolbar):
* native-gtk-toolbar.c (gtk_clear_toolbar):
* native-gtk-toolbar.c (gtk_output_frame_toolbars):
* native-gtk-toolbar.c (gtk_initialize_frame_toolbars):
* toolbar-msw.c:
* toolbar-msw.c (TOOLBAR_HANDLE):
* toolbar-msw.c (allocate_toolbar_item_id):
* toolbar-msw.c (mswindows_clear_toolbar):
* toolbar-msw.c (mswindows_output_toolbar):
* toolbar-msw.c (mswindows_move_toolbar):
* toolbar-msw.c (mswindows_redraw_exposed_toolbars):
* toolbar-msw.c (mswindows_initialize_frame_toolbars):
* toolbar-msw.c (mswindows_output_frame_toolbars):
* toolbar-msw.c (mswindows_clear_frame_toolbars):
* toolbar-msw.c (DELETE_TOOLBAR):
* toolbar-msw.c (mswindows_free_frame_toolbars):
* toolbar-msw.c (mswindows_get_toolbar_button_text):
* toolbar-xlike.c:
* toolbar-xlike.c (__prepare_button_area):
* toolbar-xlike.c (XLIKE_OUTPUT_BUTTONS_LOOP):
* toolbar-xlike.c (xlike_output_toolbar):
* toolbar-xlike.c (xlike_clear_toolbar):
* toolbar-xlike.c (xlike_output_frame_toolbars):
* toolbar-xlike.c (xlike_clear_frame_toolbars):
* toolbar-xlike.c (xlike_redraw_exposed_toolbar):
* toolbar-xlike.c (xlike_redraw_exposed_toolbars):
* toolbar-xlike.c (xlike_redraw_frame_toolbars):
* toolbar.c:
* toolbar.c (decode_toolbar_position):
* toolbar.c (Fset_default_toolbar_position):
* toolbar.c (mark_frame_toolbar_buttons_dirty):
* toolbar.c (compute_frame_toolbar_buttons):
* toolbar.c (set_frame_toolbar):
* toolbar.c (compute_frame_toolbars_data):
* toolbar.c (update_frame_toolbars_geometry):
* toolbar.c (init_frame_toolbars):
* toolbar.c (get_toolbar_coords):
* toolbar.c (CHECK_TOOLBAR):
* toolbar.c (toolbar_buttons_at_pixpos):
* toolbar.c (CTB_ERROR):
* toolbar.c (recompute_overlaying_specifier):
* toolbar.c (specifier_vars_of_toolbar):
* toolbar.h:
* toolbar.h (SET_TOOLBAR_WAS_VISIBLE_FLAG):
Create new enum edge_pos with TOP_EDGE, BOTTOM_EDGE, LEFT_EDGE,
RIGHT_EDGE; subsume TOP_BORDER, TOP_GUTTER, enum toolbar_pos,
enum gutter_pos, etc.
Create EDGE_POS_LOOP, subsuming GUTTER_POS_LOOP.
Create NUM_EDGES, use in many places instead of hardcoded '4'.
Instead of top_toolbar_was_visible, bottom_toolbar_was_visible,
etc. make an array toolbar_was_visible[NUM_EDGES]. This increases
the frame size by 15 bytes or so (could be 3 if we use Boolbytes)
but hardly seems w to matter -- frames are heavy weight objects
anyway. Same with top_gutter_was_visible, etc.
Remove duplicated SET_TOOLBAR_WAS_VISIBLE_FLAG and put defn in
one place (toolbar.h).
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Thu, 25 Feb 2010 04:45:13 -0600 |
parents | 3d8143fc88e1 |
children | 97eb4942aec8 |
comparison
equal
deleted
inserted
replaced
5076:d555581e3cba | 5077:d372b17f63ce |
---|---|
1 /* toolbar implementation -- GTK interface. | 1 /* toolbar implementation -- GTK interface. |
2 Copyright (C) 2000 Aaron Lehmann | 2 Copyright (C) 2000 Aaron Lehmann |
3 Copyright (C) 2010 Ben Wing. | |
3 | 4 |
4 This file is part of XEmacs. | 5 This file is part of XEmacs. |
5 | 6 |
6 XEmacs is free software; you can redistribute it and/or modify it | 7 XEmacs is free software; you can redistribute it and/or modify it |
7 under the terms of the GNU General Public License as published by the | 8 under the terms of the GNU General Public License as published by the |
30 #include "faces.h" | 31 #include "faces.h" |
31 #include "frame.h" | 32 #include "frame.h" |
32 #include "toolbar.h" | 33 #include "toolbar.h" |
33 #include "window.h" | 34 #include "window.h" |
34 | 35 |
35 #define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag) \ | 36 static void |
36 do { \ | 37 gtk_clear_toolbar (struct frame *f, enum edge_pos pos); |
37 switch (pos) \ | |
38 { \ | |
39 case TOP_TOOLBAR: \ | |
40 (frame)->top_toolbar_was_visible = flag; \ | |
41 break; \ | |
42 case BOTTOM_TOOLBAR: \ | |
43 (frame)->bottom_toolbar_was_visible = flag; \ | |
44 break; \ | |
45 case LEFT_TOOLBAR: \ | |
46 (frame)->left_toolbar_was_visible = flag; \ | |
47 break; \ | |
48 case RIGHT_TOOLBAR: \ | |
49 (frame)->right_toolbar_was_visible = flag; \ | |
50 break; \ | |
51 default: \ | |
52 ABORT (); \ | |
53 } \ | |
54 } while (0) | |
55 | |
56 static void | |
57 gtk_clear_toolbar (struct frame *f, enum toolbar_pos pos); | |
58 | 38 |
59 static void | 39 static void |
60 gtk_toolbar_callback (GtkWidget *UNUSED (w), gpointer user_data) | 40 gtk_toolbar_callback (GtkWidget *UNUSED (w), gpointer user_data) |
61 { | 41 { |
62 struct toolbar_button *tb = (struct toolbar_button *) user_data; | 42 struct toolbar_button *tb = (struct toolbar_button *) user_data; |
64 call0 (tb->callback); | 44 call0 (tb->callback); |
65 } | 45 } |
66 | 46 |
67 | 47 |
68 static void | 48 static void |
69 gtk_output_toolbar (struct frame *f, enum toolbar_pos pos) | 49 gtk_output_toolbar (struct frame *f, enum edge_pos pos) |
70 { | 50 { |
71 GtkWidget *toolbar; | 51 GtkWidget *toolbar; |
72 Lisp_Object button, window, glyph, instance; | 52 Lisp_Object button, window, glyph, instance; |
73 unsigned int checksum = 0; | 53 unsigned int checksum = 0; |
74 struct window *w; | 54 struct window *w; |
112 function to use as a callback. */ | 92 function to use as a callback. */ |
113 | 93 |
114 { | 94 { |
115 gtk_clear_toolbar (f, pos); | 95 gtk_clear_toolbar (f, pos); |
116 FRAME_GTK_TOOLBAR_WIDGET (f)[pos] = toolbar = | 96 FRAME_GTK_TOOLBAR_WIDGET (f)[pos] = toolbar = |
117 gtk_toolbar_new (((pos == TOP_TOOLBAR) || (pos == BOTTOM_TOOLBAR)) ? | 97 gtk_toolbar_new (((pos == TOP_EDGE) || (pos == BOTTOM_EDGE)) ? |
118 GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, | 98 GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, |
119 GTK_TOOLBAR_BOTH); | 99 GTK_TOOLBAR_BOTH); |
120 } | 100 } |
121 | 101 |
122 if (NILP (w->toolbar_buttons_captioned_p)) | 102 if (NILP (w->toolbar_buttons_captioned_p)) |
191 gtk_fixed_put (GTK_FIXED (FRAME_GTK_TEXT_WIDGET (f)), FRAME_GTK_TOOLBAR_WIDGET (f)[pos],x, y); | 171 gtk_fixed_put (GTK_FIXED (FRAME_GTK_TEXT_WIDGET (f)), FRAME_GTK_TOOLBAR_WIDGET (f)[pos],x, y); |
192 gtk_widget_show_all (FRAME_GTK_TOOLBAR_WIDGET (f)[pos]); | 172 gtk_widget_show_all (FRAME_GTK_TOOLBAR_WIDGET (f)[pos]); |
193 } | 173 } |
194 | 174 |
195 static void | 175 static void |
196 gtk_clear_toolbar (struct frame *f, enum toolbar_pos pos) | 176 gtk_clear_toolbar (struct frame *f, enum edge_pos pos) |
197 { | 177 { |
198 FRAME_GTK_TOOLBAR_CHECKSUM (f, pos) = 0; | 178 FRAME_GTK_TOOLBAR_CHECKSUM (f, pos) = 0; |
199 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0); | 179 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0); |
200 if (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]) | 180 if (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]) |
201 gtk_widget_destroy (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]); | 181 gtk_widget_destroy (FRAME_GTK_TOOLBAR_WIDGET(f)[pos]); |
202 } | 182 } |
203 | 183 |
204 static void | 184 static void |
205 gtk_output_frame_toolbars (struct frame *f) | 185 gtk_output_frame_toolbars (struct frame *f) |
206 { | 186 { |
207 if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f)) | 187 enum edge_pos pos; |
208 gtk_output_toolbar (f, TOP_TOOLBAR); | 188 |
209 else if (f->top_toolbar_was_visible) | 189 EDGE_POS_LOOP (pos) |
210 gtk_clear_toolbar (f, TOP_TOOLBAR); | 190 { |
211 | 191 if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos)) |
212 if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f)) | 192 gtk_output_toolbar (f, pos); |
213 gtk_output_toolbar (f, BOTTOM_TOOLBAR); | 193 else if (f->toolbar_was_visible[pos]) |
214 else if (f->bottom_toolbar_was_visible) | 194 gtk_clear_toolbar (f, pos); |
215 gtk_clear_toolbar (f, LEFT_TOOLBAR); | 195 } |
216 | |
217 if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f)) | |
218 gtk_output_toolbar (f, LEFT_TOOLBAR); | |
219 else if (f->left_toolbar_was_visible) | |
220 gtk_clear_toolbar (f, LEFT_TOOLBAR); | |
221 | |
222 if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f)) | |
223 gtk_output_toolbar (f, RIGHT_TOOLBAR); | |
224 else if (f->right_toolbar_was_visible) | |
225 gtk_clear_toolbar (f, RIGHT_TOOLBAR); | |
226 } | 196 } |
227 | 197 |
228 static void | 198 static void |
229 gtk_initialize_frame_toolbars (struct frame *UNUSED (f)) | 199 gtk_initialize_frame_toolbars (struct frame *UNUSED (f)) |
230 { | 200 { |