annotate src/toolbar-common.c @ 853:2b6fa2618f76

[xemacs-hg @ 2002-05-28 08:44:22 by ben] merge my stderr-proc ws make-docfile.c: Fix places where we forget to check for EOF. code-init.el: Don't use CRLF conversion by default on process output. CMD.EXE and friends work both ways but Cygwin programs don't like the CRs. code-process.el, multicast.el, process.el: Removed. Improvements to call-process-internal: -- allows a buffer to be specified for input and stderr output -- use it on all systems -- implement C-g as documented -- clean up and comment call-process-region uses new call-process facilities; no temp file. remove duplicate funs in process.el. comment exactly how coding systems work and fix various problems. open-multicast-group now does similar coding-system frobbing to open-network-stream. dumped-lisp.el, faces.el, msw-faces.el: Fix some hidden errors due to code not being defined at the right time. xemacs.mak: Add -DSTRICT. ================================================================ ALLOW SEPARATION OF STDOUT AND STDERR IN PROCESSES ================================================================ Standard output and standard error can be processed separately in a process. Each can have its own buffer, its own mark in that buffer, and its filter function. You can specify a separate buffer for stderr in `start-process' to get things started, or use the new primitives: set-process-stderr-buffer process-stderr-buffer process-stderr-mark set-process-stderr-filter process-stderr-filter Also, process-send-region takes a 4th optional arg, a buffer. Currently always uses a pipe() under Unix to read the error output. (#### Would a PTY be better?) sysdep.h, sysproc.h, unexfreebsd.c, unexsunos4.c, nt.c, emacs.c, callproc.c, symsinit.h, sysdep.c, Makefile.in.in, process-unix.c: Delete callproc.c. Move child_setup() to process-unix.c. wait_for_termination() now only needed on a few really old systems. console-msw.h, event-Xt.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.h, process-nt.c, process-unix.c, process.c, process.h, procimpl.h: Rewrite the process methods to handle a separate channel for error input. Create Lstreams for reading in the error channel. Many process methods need change. In general the changes are fairly clear as they involve duplicating what's used for reading the normal stdout and changing for stderr -- although tedious, as such changes are required throughout the entire process code. Rewrote the code that reads process output to do two loops, one for stdout and one for stderr. gpmevent.c, tooltalk.c: set_process_filter takes an argument for stderr. ================================================================ NEW ERROR-TRAPPING MECHANISM ================================================================ Totally rewrite error trapping code to be unified and support more features. Basic function is call_trapping_problems(), which lets you specify, by means of flags, what sorts of problems you want trapped. these can include -- quit -- errors -- throws past the function -- creation of "display objects" (e.g. buffers) -- deletion of already-existing "display objects" (e.g. buffers) -- modification of already-existing buffers -- entering the debugger -- gc -- errors->warnings (ala suspended errors) etc. All other error funs rewritten in terms of this one. Various older mechanisms removed or rewritten. window.c, insdel.c, console.c, buffer.c, device.c, frame.c: When creating a display object, added call to note_object_created(), for use with trapping_problems mechanism. When deleting, call check_allowed_operation() and note_object deleted(). The trapping-problems code records the objects created since the call-trapping-problems began. Those objects can be deleted, but none others (i.e. previously existing ones). bytecode.c, cmdloop.c: internal_catch takes another arg. eval.c: Add long comments describing the "five lists" used to maintain state (backtrace, gcpro, specbind, etc.) in the Lisp engine. backtrace.h, eval.c: Implement trapping-problems mechanism, eliminate old mechanisms or redo in terms of new one. frame.c, gutter.c: Flush out the concept of "critical display section", defined by the in_display() var. Use an internal_bind() to get it reset, rather than just doing it at end, because there may be a non-local exit. event-msw.c, event-stream.c, console-msw.h, device.c, dialog-msw.c, frame.c, frame.h, intl.c, toolbar.c, menubar-msw.c, redisplay.c, alloc.c, menubar-x.c: Make use of new trapping-errors stuff and rewrite code based on old mechanisms. glyphs-widget.c, redisplay.h: Protect calling Lisp in redisplay. insdel.c: Protect hooks against deleting existing buffers. frame-msw.c: Use EQ, not EQUAL in hash tables whose keys are just numbers. Otherwise we run into stickiness in redisplay because internal_equal() can QUIT. ================================================================ SIGNAL, C-G CHANGES ================================================================ Here we change the way that C-g interacts with event reading. The idea is that a C-g occurring while we're reading a user event should be read as C-g, but elsewhere should be a QUIT. The former code did all sorts of bizarreness -- requiring that no QUIT occurs anywhere in event-reading code (impossible to enforce given the stuff called or Lisp code invoked), and having some weird system involving enqueue/dequeue of a C-g and interaction with Vquit_flag -- and it didn't work. Now, we simply enclose all code where we want C-g read as an event with {begin/end}_dont_check_for_quit(). This completely turns off the mechanism that checks (and may remove or alter) C-g in the read-ahead queues, so we just get the C-g normal. Signal.c documents this very carefully. cmdloop.c: Correct use of dont_check_for_quit to new scheme, remove old out-of-date comments. event-stream.c: Fix C-g handling to actually work. device-x.c: Disable quit checking when err out. signal.c: Cleanup. Add large descriptive comment. process-unix.c, process-nt.c, sysdep.c: Use QUIT instead of REALLY_QUIT. It's not necessary to use REALLY_QUIT and just confuses the issue. lisp.h: Comment quit handlers. ================================================================ CONS CHANGES ================================================================ free_cons() now takes a Lisp_Object not the result of XCONS(). car and cdr have been renamed so that they don't get used directly; go through XCAR(), XCDR() instead. alloc.c, dired.c, editfns.c, emodules.c, fns.c, glyphs-msw.c, glyphs-x.c, glyphs.c, keymap.c, minibuf.c, search.c, eval.c, lread.c, lisp.h: Correct free_cons calling convention: now takes Lisp_Object, not Lisp_Cons chartab.c: Eliminate direct use of ->car, ->cdr, should be black box. callint.c: Rewrote using EXTERNAL_LIST_LOOP to avoid use of Lisp_Cons. ================================================================ USE INTERNAL-BIND-* ================================================================ eval.c: Cleanups of these funs. alloc.c, fileio.c, undo.c, specifier.c, text.c, profile.c, lread.c, redisplay.c, menubar-x.c, macros.c: Rewrote to use internal_bind_int() and internal_bind_lisp_object() in place of whatever varied and cumbersome mechanisms were formerly there. ================================================================ SPECBIND SANITY ================================================================ backtrace.h: - Improved comments backtrace.h, bytecode.c, eval.c: Add new mechanism check_specbind_stack_sanity() for sanity checking code each time the catchlist or specbind stack change. Removed older prototype of same mechanism. ================================================================ MISC ================================================================ lisp.h, insdel.c, window.c, device.c, console.c, buffer.c: Fleshed out authorship. device-msw.c: Correct bad Unicode-ization. print.c: Be more careful when not initialized or in fatal error handling. search.c: Eliminate running_asynch_code, an FSF holdover. alloc.c: Added comments about gc-cons-threshold. dialog-x.c: Use begin_gc_forbidden() around code to build up a widget value tree, like in menubar-x.c. gui.c: Use Qunbound not Qnil as the default for gethash. lisp-disunion.h, lisp-union.h: Added warnings on use of VOID_TO_LISP(). lisp.h: Use ERROR_CHECK_STRUCTURES to turn on ERROR_CHECK_TRAPPING_PROBLEMS and ERROR_CHECK_TYPECHECK lisp.h: Add assert_with_message. lisp.h: Add macros for gcproing entire arrays. (You could do this before but it required manual twiddling the gcpro structure.) lisp.h: Add prototypes for new functions defined elsewhere.
author ben
date Tue, 28 May 2002 08:45:36 +0000
parents a5954632b187
children 804517e16990
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 744
diff changeset
1 /* toolbar implementation -- "Generic" (X or GTK) redisplay interface.
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
2 Copyright (C) 1995 Board of Trustees, University of Illinois.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
3 Copyright (C) 1995 Sun Microsystems, Inc.
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
4 Copyright (C) 1995, 1996, 2002 Ben Wing.
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
5 Copyright (C) 1996 Chuck Thompson.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
6
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
7 This file is part of XEmacs.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
8
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
12 later version.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
13
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
17 for more details.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
18
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
23
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
24 /* Synched up with: Not in FSF. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
25
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
26 #include <config.h>
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
27 #include "lisp.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
28
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
29 #include "device.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
30 #include "faces.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
31 #include "frame.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
32 #include "glyphs.h"
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
33 #include "toolbar.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
34 #include "window.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
35
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 744
diff changeset
36 /* This is used when we need to draw the toolbars ourselves -- on X or GTK.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 744
diff changeset
37 On MS Windows, we use the built-in toolbar controls. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 744
diff changeset
38
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
39 /* Only a very few things need to differ based on the toolkit used.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
40 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
41 ** Some of the routines used assert(FRAME_yyy_P(f)) checks, this is
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
42 ** now abstracted into __INTERNAL_APPROPRIATENESS_CHECK(). When we
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
43 ** add new window systems that use this code, we should either add a
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
44 ** new case here, or just remove the checks completely.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
45 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
46 ** At least for X & GTK redraw_frame_toolbars() might end up getting
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
47 ** called before we are completely initialized. To avoid this, we use
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
48 ** the __INTERNAL_MAPPED_P(f) macro, that should return 0 if we should
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
49 ** not draw the toolbars yet. When we add new window systems that use
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
50 ** this code, we should add a new case here, if they need it.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
51 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
52 ** When clearing the toolbar, it is nice to flush the drawing queue.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
53 ** Use __INTERNAL_FLUSH to do this. It is passed a device.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
54 */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
55 #if defined(HAVE_GTK)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
56 #include "console-gtk.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
57 #define __INTERNAL_MAPPED_P(f) GTK_WIDGET_REALIZED (FRAME_GTK_TEXT_WIDGET (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
58 #define __INTERNAL_FLUSH(d) gdk_flush()
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
59 #define __INTERNAL_APPROPRIATENESS_CHECK(f) assert(FRAME_GTK_P (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
60 #elif defined(HAVE_X_WINDOWS)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
61 #include "console-x.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
62 #define __INTERNAL_MAPPED_P(f) XtIsRealized (FRAME_X_SHELL_WIDGET (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
63 #define __INTERNAL_APPROPRIATENESS_CHECK(f) assert(FRAME_X_P (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
64 #define __INTERNAL_FLUSH(d) XFlush (DEVICE_X_DISPLAY (d))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
65 #else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
66 #define __INTERNAL_MAPPED_P(f) abort()
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
67 #define __INTERNAL_APPROPRIATENESS_CHECK(f) abort()
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
68 #define __INTERNAL_FLUSH(f) abort()
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
69 #endif
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
70
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
71 #include "toolbar-common.h"
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
72
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
73 extern Lisp_Object Vtoolbar_shadow_thickness;
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
74
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
75 static void __prepare_button_area (struct frame *f,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
76 struct toolbar_button *tb)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
77 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
78 int sx = tb->x;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
79 int sy = tb->y;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
80 int swidth = tb->width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
81 int sheight = tb->height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
82 int border_width = tb->border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
83 int x_adj, width_adj, y_adj, height_adj;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
84 struct device *d = XDEVICE (f->device);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
85 Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
86 struct window *w = XWINDOW (window);
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
87 int shadow_thickness;
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
88 int def_shadow_thickness = XINT (Fspecifier_instance(Vtoolbar_shadow_thickness, window, Qnil, Qnil));
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
89 face_index toolbar_findex;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
90
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
91 if (tb->vertical)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
92 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
93 x_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
94 width_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
95 y_adj = height_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
96 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
97 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
98 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
99 x_adj = width_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
100 y_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
101 height_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
102 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
103
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
104 toolbar_findex = get_builtin_face_cache_index (w, Vtoolbar_face);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
105
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
106 /* Blank toolbar buttons that should be 3d will have EQ(tb->up_glyph, Qt)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
107 ** Blank toolbar buttons that should be flat will have NILP (tb->up_glyph)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
108 **
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
109 ** Real toolbar buttons will check tb->enabled && tb->down
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
110 */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
111 if (EQ (Qt, tb->up_glyph))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
112 {
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
113 shadow_thickness = def_shadow_thickness;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
114 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
115 else if (NILP (tb->up_glyph))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
116 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
117 shadow_thickness = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
118 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
119 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
120 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
121 if (tb->enabled)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
122 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
123 if (tb->down)
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
124 shadow_thickness = -def_shadow_thickness;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
125 else
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 714
diff changeset
126 shadow_thickness = def_shadow_thickness;
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
127 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
128 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
129 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
130 shadow_thickness = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
131 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
132 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
133
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
134 /* Blank the entire area. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
135 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
136 sx + x_adj, sy + y_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
137 swidth + width_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
138 sheight + height_adj);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
139
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
140 /* Draw the outline. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
141 if (shadow_thickness)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
142 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
143 MAYBE_DEVMETH (d, bevel_area,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
144 (w, toolbar_findex, sx + x_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
145 sy + y_adj, swidth + width_adj,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
146 sheight + height_adj, abs(shadow_thickness),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
147 EDGE_ALL, (shadow_thickness < 0) ? EDGE_BEVEL_IN : EDGE_BEVEL_OUT));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
148 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
149
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
150 /* Handle the borders... */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
151 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
152 sx, sy,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
153 (tb->vertical ? border_width : swidth),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
154 (tb->vertical ? sheight : border_width));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
155 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
156 (tb->vertical ? sx + swidth : sx),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
157 (tb->vertical ? sy : sy + sheight),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
158 (tb->vertical ? border_width : swidth),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
159 (tb->vertical ? sheight : border_width));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
160 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
161
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
162 #define common_draw_blank_toolbar_button(f,tb) __prepare_button_area (f,tb)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
163
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
164 void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
165 common_output_toolbar_button (struct frame *f, Lisp_Object button)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
166 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
167 int shadow_thickness = 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
168 int x_adj, y_adj, width_adj, height_adj;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
169 struct device *d = XDEVICE (f->device);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
170 Lisp_Object instance, frame, window, glyph;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
171 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
172 struct Lisp_Image_Instance *p;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
173 struct window *w;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
174 int vertical = tb->vertical;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
175 int border_width = tb->border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
176 face_index toolbar_findex;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
177
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
178 if (vertical)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
179 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
180 x_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
181 width_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
182 y_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
183 height_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
184 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
185 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
186 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
187 x_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
188 width_adj = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
189 y_adj = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
190 height_adj = - 2 * border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
191 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
192
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
193 frame = wrap_frame (f);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
194 window = FRAME_LAST_NONMINIBUF_WINDOW (f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
195 w = XWINDOW (window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
196
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
197 glyph = get_toolbar_button_glyph (w, tb);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
198
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
199 if (tb->enabled)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
200 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
201 if (tb->down)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
202 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
203 shadow_thickness = -2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
204 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
205 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
206 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
207 shadow_thickness = 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
208 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
209 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
210 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
211 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
212 shadow_thickness = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
213 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
214
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
215 toolbar_findex = get_builtin_face_cache_index (w, Vtoolbar_face);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
216
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
217 __prepare_button_area (f, tb);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
218
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
219 /* #### It is currently possible for users to trash us by directly
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
220 changing the toolbar glyphs. Avoid crashing in that case. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
221 if (GLYPHP (glyph))
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
222 instance = glyph_image_instance (glyph, window, ERROR_ME_DEBUG_WARN, 1);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
223 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
224 instance = Qnil;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
225
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
226 if (IMAGE_INSTANCEP (instance))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
227 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
228 int width = tb->width + width_adj - shadow_thickness * 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
229 int height = tb->height + height_adj - shadow_thickness * 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
230 int x_offset = x_adj + shadow_thickness;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
231 int y_offset = y_adj + shadow_thickness;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
232
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
233 p = XIMAGE_INSTANCE (instance);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
234
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
235 if (IMAGE_INSTANCE_PIXMAP_TYPE_P (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
236 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
237 struct display_box db;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
238 struct display_glyph_area dga;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
239
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
240 if (width > (int) IMAGE_INSTANCE_PIXMAP_WIDTH (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
241 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
242 x_offset += ((int) (width - IMAGE_INSTANCE_PIXMAP_WIDTH (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
243 / 2);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
244 width = IMAGE_INSTANCE_PIXMAP_WIDTH (p);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
245 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
246 if (height > (int) IMAGE_INSTANCE_PIXMAP_HEIGHT (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
247 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
248 y_offset += ((int) (height - IMAGE_INSTANCE_PIXMAP_HEIGHT (p))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
249 / 2);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
250 height = IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
251 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
252
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
253 /* Draw exactly in the area specified... */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
254 db.xpos = tb->x + x_offset;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
255 db.ypos = tb->y + y_offset;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
256 db.width = width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
257 db.height = height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
258
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
259 /* Display the whole glyph */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
260 dga.xoffset = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
261 dga.yoffset = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
262 dga.width = width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
263 dga.height = height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
264
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
265 redisplay_output_pixmap (w, instance,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
266 &db, &dga,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
267 toolbar_findex, 0, 0, 0, 0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
268 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
269 else if (IMAGE_INSTANCE_TYPE (p) == IMAGE_TEXT)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
270 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
271 /* #### We need to make the face used configurable. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
272 struct face_cachel *cachel =
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
273 WINDOW_FACE_CACHEL (w, DEFAULT_INDEX);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
274 struct display_line dl;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
275 Lisp_Object string = IMAGE_INSTANCE_TEXT_STRING (p);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
276 unsigned char charsets[NUM_LEADING_BYTES];
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
277 Emchar_dynarr *buf;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
278 struct font_metric_info fm;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
279
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
280 /* This could be true if we were called via the Expose event
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
281 handler. Mark the button as dirty and return
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
282 immediately. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
283 if (f->window_face_cache_reset)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
284 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
285 tb->dirty = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
286 MARK_TOOLBAR_CHANGED;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
287 return;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
288 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
289 buf = Dynarr_new (Emchar);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
290 convert_intbyte_string_into_emchar_dynarr
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
291 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
292 find_charsets_in_emchar_string (charsets, Dynarr_atp (buf, 0),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
293 Dynarr_length (buf));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
294 ensure_face_cachel_complete (cachel, window, charsets);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
295 face_cachel_charset_font_metric_info (cachel, charsets, &fm);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
296
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
297 dl.ascent = fm.ascent;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
298 dl.descent = fm.descent;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
299 dl.ypos = tb->y + y_offset + fm.ascent;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
300
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
301 if (fm.ascent + fm.descent <= height)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
302 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
303 dl.ypos += (height - fm.ascent - fm.descent) / 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
304 dl.clip = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
305 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
306 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
307 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
308 dl.clip = fm.ascent + fm.descent - height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
309 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
310
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
311 MAYBE_DEVMETH (d, output_string,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
312 (w, &dl, buf, tb->x + x_offset, 0, 0, width,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
313 toolbar_findex, 0, 0, 0, 0));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
314 Dynarr_free (buf);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
315 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
316
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
317 /* We silently ignore the image if it isn't a pixmap or text. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
318 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
319
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
320 tb->dirty = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
321 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
322
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
323 static int
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
324 common_get_button_size (struct frame *f, Lisp_Object window,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
325 struct toolbar_button *tb, int vert, int pos)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
326 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
327 int shadow_thickness = 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
328 int size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
329
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
330 if (tb->blank)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
331 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
332 if (!NILP (tb->down_glyph))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
333 size = XINT (tb->down_glyph);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
334 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
335 size = DEFAULT_TOOLBAR_BLANK_SIZE;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
336 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
337 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
338 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
339 struct window *w = XWINDOW (window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
340 Lisp_Object glyph = get_toolbar_button_glyph (w, tb);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
341
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
342 /* Unless, of course, the user has done something stupid like
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
343 change the glyph out from under us. Use a blank placeholder
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
344 in that case. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
345 if (NILP (glyph))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
346 return XINT (f->toolbar_size[pos]);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
347
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
348 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
349 size = glyph_height (glyph, window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
350 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
351 size = glyph_width (glyph, window);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
352 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
353
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
354 if (!size)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
355 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
356 /* If the glyph doesn't have a size we'll insert a blank
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
357 placeholder instead. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
358 return XINT (f->toolbar_size[pos]);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
359 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
360
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
361 size += shadow_thickness * 2;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
362
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
363 return (size);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
364 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
365
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
366 #define COMMON_OUTPUT_BUTTONS_LOOP(left) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
367 do { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
368 while (!NILP (button)) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
369 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
370 struct toolbar_button *tb = XTOOLBAR_BUTTON (button); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
371 int size, height, width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
372 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
373 if (left && tb->pushright) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
374 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
375 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
376 size = common_get_button_size (f, window, tb, vert, pos); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
377 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
378 if (vert) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
379 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
380 width = bar_width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
381 if (y + size > max_pixpos) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
382 height = max_pixpos - y; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
383 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
384 height = size; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
385 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
386 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
387 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
388 if (x + size > max_pixpos) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
389 width = max_pixpos - x; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
390 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
391 width = size; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
392 height = bar_height; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
393 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
394 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
395 if (tb->x != x \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
396 || tb->y != y \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
397 || tb->width != width \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
398 || tb->height != height \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
399 || tb->dirty) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
400 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
401 if (width && height) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
402 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
403 tb->x = x; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
404 tb->y = y; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
405 tb->width = width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
406 tb->height = height; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
407 tb->border_width = border_width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
408 tb->vertical = vert; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
409 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
410 if (tb->blank || NILP (tb->up_glyph)) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
411 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
412 common_draw_blank_toolbar_button (f, tb); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
413 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
414 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
415 common_output_toolbar_button (f, button); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
416 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
417 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
418 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
419 if (vert) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
420 y += height; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
421 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
422 x += width; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
423 \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
424 if ((vert && y == max_pixpos) || (!vert && x == max_pixpos)) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
425 button = Qnil; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
426 else \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
427 button = tb->next; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
428 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
429 } while (0)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
430
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
431 #define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
432 do { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
433 switch (pos) \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
434 { \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
435 case TOP_TOOLBAR: \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
436 (frame)->top_toolbar_was_visible = flag; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
437 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
438 case BOTTOM_TOOLBAR: \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
439 (frame)->bottom_toolbar_was_visible = flag; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
440 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
441 case LEFT_TOOLBAR: \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
442 (frame)->left_toolbar_was_visible = flag; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
443 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
444 case RIGHT_TOOLBAR: \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
445 (frame)->right_toolbar_was_visible = flag; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
446 break; \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
447 default: \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
448 abort (); \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
449 } \
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
450 } while (0)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
451
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
452 static void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
453 common_output_toolbar (struct frame *f, enum toolbar_pos pos)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
454 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
455 int x, y, bar_width, bar_height, vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
456 int max_pixpos, right_size, right_start, blank_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
457 int border_width = FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
458 Lisp_Object button, window;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
459 face_index toolbar_findex;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
460
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
461 get_toolbar_coords (f, pos, &x, &y, &bar_width, &bar_height, &vert, 1);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
462 window = FRAME_LAST_NONMINIBUF_WINDOW (f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
463 toolbar_findex = get_builtin_face_cache_index (XWINDOW (window), Vtoolbar_face);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
464
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
465 /* Do the border */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
466 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
467 x, y,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
468 (vert ? bar_width : border_width),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
469 (vert ? border_width : bar_height));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
470 redisplay_clear_region (window, toolbar_findex,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
471 (vert ? x : x + bar_width - border_width),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
472 (vert ? y + bar_height - border_width : y),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
473 (vert ? bar_width : border_width),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
474 (vert ? border_width : bar_height));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
475
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
476 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
477 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
478 max_pixpos = y + bar_height - border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
479 y += border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
480 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
481 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
482 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
483 max_pixpos = x + bar_width - border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
484 x += border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
485 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
486
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
487 button = FRAME_TOOLBAR_BUTTONS (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
488 right_size = 0;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
489
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
490 /* First loop over all of the buttons to determine how much room we
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
491 need for left hand and right hand buttons. This loop will also
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
492 make sure that all instances are instantiated so when we actually
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
493 output them they will come up immediately. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
494 while (!NILP (button))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
495 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
496 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
497 int size = common_get_button_size (f, window, tb, vert, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
498
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
499 if (tb->pushright)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
500 right_size += size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
501
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
502 button = tb->next;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
503 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
504
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
505 button = FRAME_TOOLBAR_BUTTONS (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
506
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
507 /* Loop over the left buttons, updating and outputting them. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
508 COMMON_OUTPUT_BUTTONS_LOOP (1);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
509
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
510 /* Now determine where the right buttons start. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
511 right_start = max_pixpos - right_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
512 if (right_start < (vert ? y : x))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
513 right_start = (vert ? y : x);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
514
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
515 /* Output the blank which goes from the end of the left buttons to
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
516 the start of the right. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
517 blank_size = right_start - (vert ? y : x);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
518 if (blank_size)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
519 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
520 int height, width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
521
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
522 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
523 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
524 width = bar_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
525 height = blank_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
526 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
527 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
528 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
529 width = blank_size;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
530 height = bar_height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
531 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
532
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
533 /*
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
534 * Use a 3D pushright separator only if there isn't a toolbar
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
535 * border. A flat separator meshes with the border and looks
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
536 * better.
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
537 */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
538 if (1)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
539 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
540 struct toolbar_button tb;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
541
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
542 tb.x = x;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
543 tb.y = y;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
544 tb.width = width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
545 tb.height = height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
546 tb.border_width = border_width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
547 tb.vertical = vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
548 tb.enabled = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
549 tb.up_glyph = border_width ? Qt : Qnil;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
550
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
551 __prepare_button_area (f, &tb);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
552 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
553
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
554 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
555 y += height;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
556 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
557 x += width;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
558 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
559
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
560 /* Loop over the right buttons, updating and outputting them. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
561 COMMON_OUTPUT_BUTTONS_LOOP (0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
562
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
563 if (!vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
564 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
565 Lisp_Object frame = wrap_frame (f);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
566
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
567 redisplay_clear_region (frame,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
568 DEFAULT_INDEX, FRAME_PIXWIDTH (f) - 1, y, 1,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
569 bar_height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
570 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
571
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
572 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 1);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
573 __INTERNAL_FLUSH (XDEVICE (f->device));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
574 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
575
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
576 static void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
577 common_clear_toolbar (struct frame *f, enum toolbar_pos pos, int thickness_change)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
578 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
579 Lisp_Object frame;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
580 int x, y, width, height, vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
581
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
582 get_toolbar_coords (f, pos, &x, &y, &width, &height, &vert, 1);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
583 frame = wrap_frame (f);
713
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
584
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
585 /* The thickness_change parameter is used by the toolbar resize routines
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
586 to clear any excess toolbar if the size shrinks. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
587 if (thickness_change < 0)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
588 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
589 if (pos == LEFT_TOOLBAR || pos == RIGHT_TOOLBAR)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
590 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
591 x = x + width + thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
592 width = -thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
593 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
594 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
595 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
596 y = y + height + thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
597 height = -thickness_change;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
598 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
599 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
600
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
601 SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
602
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
603 redisplay_clear_region (frame, DEFAULT_INDEX, x, y, width, height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
604
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
605 __INTERNAL_FLUSH (XDEVICE (f->device));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
606 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
607
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
608 void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
609 common_output_frame_toolbars (struct frame *f)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
610 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
611 __INTERNAL_APPROPRIATENESS_CHECK(f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
612
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
613 if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
614 common_output_toolbar (f, TOP_TOOLBAR);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
615 else if (f->top_toolbar_was_visible)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
616 common_clear_toolbar (f, TOP_TOOLBAR, 0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
617
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
618 if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
619 common_output_toolbar (f, BOTTOM_TOOLBAR);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
620 else if (f->bottom_toolbar_was_visible)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
621 common_clear_toolbar (f, BOTTOM_TOOLBAR, 0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
622
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
623 if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
624 common_output_toolbar (f, LEFT_TOOLBAR);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
625 else if (f->left_toolbar_was_visible)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
626 common_clear_toolbar (f, LEFT_TOOLBAR, 0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
627
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
628 if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
629 common_output_toolbar (f, RIGHT_TOOLBAR);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
630 else if (f->right_toolbar_was_visible)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
631 common_clear_toolbar (f, RIGHT_TOOLBAR, 0);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
632 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
633
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
634 static void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
635 common_redraw_exposed_toolbar (struct frame *f, enum toolbar_pos pos, int x, int y,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
636 int width, int height)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
637 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
638 int bar_x, bar_y, bar_width, bar_height, vert;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
639 Lisp_Object button = FRAME_TOOLBAR_BUTTONS (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
640
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
641 get_toolbar_coords (f, pos, &bar_x, &bar_y, &bar_width, &bar_height,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
642 &vert, 1);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
643
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
644 if (((y + height) < bar_y) || (y > (bar_y + bar_height)))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
645 return;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
646 if (((x + width) < bar_x) || (x > (bar_x + bar_width)))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
647 return;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
648
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
649 while (!NILP (button))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
650 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
651 struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
652
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
653 if (vert)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
654 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
655 if (((tb->y + tb->height) > y) && (tb->y < (y + height)))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
656 tb->dirty = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
657
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
658 /* If this is true we have gone past the exposed region. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
659 if (tb->y > (y + height))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
660 break;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
661 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
662 else
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
663 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
664 if (((tb->x + tb->width) > x) && (tb->x < (x + width)))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
665 tb->dirty = 1;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
666
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
667 /* If this is true we have gone past the exposed region. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
668 if (tb->x > (x + width))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
669 break;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
670 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
671
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
672 button = tb->next;
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
673 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
674
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
675 /* Even if none of the buttons is in the area, the blank region at
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
676 the very least must be because the first thing we did is verify
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
677 that some portion of the toolbar is in the exposed region. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
678 common_output_toolbar (f, pos);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
679 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
680
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
681 void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
682 common_redraw_exposed_toolbars (struct frame *f, int x, int y, int width,
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
683 int height)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
684 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
685 __INTERNAL_APPROPRIATENESS_CHECK(f);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
686
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
687 if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
688 common_redraw_exposed_toolbar (f, TOP_TOOLBAR, x, y, width, height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
689
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
690 if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
691 common_redraw_exposed_toolbar (f, BOTTOM_TOOLBAR, x, y, width, height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
692
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
693 if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
694 common_redraw_exposed_toolbar (f, LEFT_TOOLBAR, x, y, width, height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
695
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
696 if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
697 common_redraw_exposed_toolbar (f, RIGHT_TOOLBAR, x, y, width, height);
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
698 }
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
699
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
700 void
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
701 common_redraw_frame_toolbars (struct frame *f)
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
702 {
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
703 /* There are certain startup paths that lead to update_EmacsFrame in
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
704 faces.c being called before a new frame is fully initialized. In
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
705 particular before we have actually mapped it. That routine can
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
706 call this one. So, we need to make sure that the frame is
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
707 actually ready before we try and draw all over it. */
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
708 if (__INTERNAL_MAPPED_P(f))
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
709 common_redraw_exposed_toolbars (f, 0, 0, FRAME_PIXWIDTH (f),
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
710 FRAME_PIXHEIGHT (f));
c2c346111c9a [xemacs-hg @ 2001-12-23 01:11:00 by wmperry]
wmperry
parents:
diff changeset
711 }