annotate src/glyphs-widget.c @ 2367:ecf1ebac70d8

[xemacs-hg @ 2004-11-04 23:05:23 by ben] commit mega-patch configure.in: Turn off -Winline and -Wchar-subscripts. Use the right set of cflags when compiling modules. Rewrite ldap configuration to separate the inclusion of lber (needed in recent Cygwin) from the basic checks for the needed libraries. add a function for MAKE_JUNK_C; initially code was added to generate xemacs.def using this, but it will need to be rewritten. add an rm -f for junk.c to avoid weird Cygwin bug with cp -f onto an existing file. Sort list of auto-detected functions and eliminate unused checks for stpcpy, setlocale and getwd. Add autodetection of Cygwin scanf problems BETA: Rewrite section on configure to indicate what flags are important and what not. digest-doc.c, make-dump-id.c, profile.c, sorted-doc.c: Add proper decls for main(). make-msgfile.c: Document that this is old junk. Move proposal to text.c. make-msgfile.lex: Move proposal to text.c. make-mswin-unicode.pl: Convert error-generating code so that the entire message will be seen as a single unrecognized token. mule/mule-ccl.el: Update docs. lispref/mule.texi: Update CCL docs. ldap/eldap.c: Mule-ize. Use EXTERNAL_LIST_LOOP_2 instead of deleted EXTERNAL_LIST_LOOP. * XEmacs 21.5.18 "chestnut" is released. --------------------------------------------------------------- MULE-RELATED WORK: --------------------------------------------------------------- --------------------------- byte-char conversion --------------------------- buffer.c, buffer.h, insdel.c, text.c: Port FSF algorithm for byte-char conversion, replacing broken previous version. Track the char position of the gap. Add functions to do char-byte conversion downwards as well as upwards. Move comments about algorithm workings to internals manual. --------------------------- work on types --------------------------- alloc.c, console-x-impl.h, dump-data.c, dump-data.h, dumper.c, dialog-msw.c, dired-msw.c, doc.c, editfns.c, esd.c, event-gtk.h, event-msw.c, events.c, file-coding.c, file-coding.h, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-x.c, glyphs.c, glyphs.h, gui.c, hpplay.c, imgproc.c, intl-win32.c, lrecord.h, lstream.c, keymap.c, lisp.h, libsst.c, linuxplay.c, miscplay.c, miscplay.h, mule-coding.c, nas.c, nt.c, ntheap.c, ntplay.c, objects-msw.c, objects-tty.c, objects-x.c, print.c, process-nt.c, process.c, redisplay.h, select-common.h, select-gtk.c, select-x.c, sgiplay.c, sound.c, sound.h, sunplay.c, sysfile.h, sysdep.c, syswindows.h, text.c, unexnt.c, win32.c, xgccache.c: Further work on types. This creates a full set of types for all the basic semantics of `char' that I have so far identified, so that its semantics can always be identified for the purposes of proper Mule-safe code, and the raw use of `char' always avoided. (1) More type renaming, for consistency of naming. Char_ASCII -> Ascbyte UChar_ASCII -> UAscbyte Char_Binary -> CBinbyte UChar_Binary -> Binbyte SChar_Binary -> SBinbyte (2) Introduce Rawbyte, CRawbyte, Boolbyte, Chbyte, UChbyte, and Bitbyte and use them. (3) New types Itext, Wexttext and Textcount for separating out the concepts of bytes and textual units (different under UTF-16 and UTF-32, which are potential internal encodings). (4) qxestr*_c -> qxestr*_ascii. lisp.h: New; goes with other qxe() functions. #### Maybe goes in a different section. lisp.h: Group generic int-type defs together with EMACS_INT defs. lisp.h: * lisp.h (WEXTTEXT_IS_WIDE) New defns. lisp.h: New type to replace places where int occurs as a boolean. It's signed because occasionally people may want to use -1 as an error value, and because unsigned ints are viral -- see comments in the internals manual against using them. dynarr.c: int -> Bytecount. --------------------------- Mule-izing --------------------------- device-x.c: Partially Mule-ize. dumper.c, dumper.h: Mule-ize. Use Rawbyte. Use stderr_out not printf. Use wext_*(). sysdep.c, syswindows.h, text.c: New Wexttext API for manipulation of external text that may be Unicode (e.g. startup code under Windows). emacs.c: Mule-ize. Properly deal with argv in external encoding. Use wext_*() and Wexttext. Use Rawbyte. #if 0 some old junk on SCO that is unlikely to be correct. Rewrite allocation code in run-temacs. emacs.c, symsinit.h, win32.c: Rename win32 init function and call it even earlier, to initialize mswindows_9x_p even earlier, for use in startup code (XEUNICODE_P). process.c: Use _wenviron not environ under Windows, to get Unicode environment variables. event-Xt.c: Mule-ize drag-n-drop related stuff. dragdrop.c, dragdrop.h, frame-x.c: Mule-ize. text.h: Add some more stand-in defines for particular kinds of conversion; use in Mule-ization work in frame-x.c etc. --------------------------- Freshening --------------------------- intl-auto-encap-win32.c, intl-auto-encap-win32.h: Regenerate. --------------------------- Unicode-work --------------------------- intl-win32.c, syswindows.h: Factor out common options to MultiByteToWideChar and WideCharToMultiByte. Add convert_unicode_to_multibyte_malloc() and convert_unicode_to_multibyte_dynarr() and use. Add stuff for alloca() conversion of multibyte/unicode. alloc.c: Use dfc_external_data_len() in case of unicode coding system. alloc.c, mule-charset.c: Don't zero out and reinit charset Unicode tables. This fucks up dump-time loading. Anyway, either we load them at dump time or run time, never both. unicode.c: Dump the blank tables as well. --------------------------------------------------------------- DOCUMENTATION, MOSTLY MULE-RELATED: --------------------------------------------------------------- EmacsFrame.c, emodules.c, event-Xt.c, fileio.c, input-method-xlib.c, mule-wnnfns.c, redisplay-gtk.c, redisplay-tty.c, redisplay-x.c, regex.c, sysdep.c: Add comment about Mule work needed. text.h: Add more documentation describing why DFC routines were not written to return their value. Add some other DFC documentation. console-msw.c, console-msw.h: Add pointer to docs in win32.c. emacs.c: Add comments on sources of doc info. text.c, charset.h, unicode.c, intl-win32.c, intl-encap-win32.c, text.h, file-coding.c, mule-coding.c: Collect background comments and related to text matters and internationalization, and proposals for work to be done, in text.c or Internals manual, stuff related to specific textual API's in text.h, and stuff related to internal implementation of Unicode conversion in unicode.c. Put lots of pointers to the comments to make them easier to find. s/mingw32.h, s/win32-common.h, s/win32-native.h, s/windowsnt.h, win32.c: Add bunches of new documentation on the different kinds of builds and environments under Windows and how they work. Collect this info in win32.c. Add pointers to these docs in the relevant s/* files. emacs.c: Document places with long comments. Remove comment about exiting, move to internals manual, put in pointer. event-stream.c: Move docs about event queues and focus to internals manual, put in pointer. events.h: Move docs about event stream callbacks to internals manual, put in pointer. profile.c, redisplay.c, signal.c: Move documentation to the Internals manual. process-nt.c: Add pointer to comment in win32-native.el. lisp.h: Add comments about some comment conventions. lisp.h: Add comment about the second argument. device-msw.c, redisplay-msw.c: @@#### comments are out-of-date. --------------------------------------------------------------- PDUMP WORK (MOTIVATED BY UNICODE CHANGES) --------------------------------------------------------------- alloc.c, buffer.c, bytecode.c, console-impl.h, console.c, device.c, dumper.c, lrecord.h, elhash.c, emodules.h, events.c, extents.c, frame.c, glyphs.c, glyphs.h, mule-charset.c, mule-coding.c, objects.c, profile.c, rangetab.c, redisplay.c, specifier.c, specifier.h, window.c, lstream.c, file-coding.h, file-coding.c: PDUMP: Properly implement dump_add_root_block(), which never worked before, and is necessary for dumping Unicode tables. Pdump name changes for accuracy: XD_STRUCT_PTR -> XD_BLOCK_PTR. XD_STRUCT_ARRAY -> XD_BLOCK_ARRAY. XD_C_STRING -> XD_ASCII_STRING. *_structure_* -> *_block_*. lrecord.h: some comments added about dump_add_root_block() vs dump_add_root_block_ptr(). extents.c: remove incorrect comment about pdump problems with gap array. --------------------------------------------------------------- ALLOCATION --------------------------------------------------------------- abbrev.c, alloc.c, bytecode.c, casefiddle.c, device-msw.c, device-x.c, dired-msw.c, doc.c, doprnt.c, dragdrop.c, editfns.c, emodules.c, file-coding.c, fileio.c, filelock.c, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, gui-msw.c, gui-x.c, imgproc.c, intl-win32.c, lread.c, menubar-gtk.c, menubar.c, nt.c, objects-msw.c, objects-x.c, print.c, process-nt.c, process-unix.c, process.c, realpath.c, redisplay.c, search.c, select-common.c, symbols.c, sysdep.c, syswindows.h, text.c, text.h, ui-byhand.c: New macros {alloca,xnew}_{itext,{i,ext,raw,bin,asc}bytes} for more convenient allocation of these commonly requested items. Modify functions to use alloca_ibytes, alloca_array, alloca_extbytes, xnew_ibytes, etc. also XREALLOC_ARRAY, xnew. alloc.c: Rewrite the allocation functions to factor out repeated code. Add assertions for freeing dumped data. lisp.h: Moved down and consolidated with other allocation stuff. lisp.h, dynarr.c: New functions for allocation that's very efficient when mostly in LIFO order. lisp.h, text.c, text.h: Factor out some stuff for general use by alloca()-conversion funs. text.h, lisp.h: Fill out convenience routines for allocating various kinds of bytes and put them in lisp.h. Use them in place of xmalloc(), ALLOCA(). text.h: Fill out the convenience functions so the _MALLOC() kinds match the alloca() kinds. --------------------------------------------------------------- ERROR-CHECKING --------------------------------------------------------------- text.h: Create ASSERT_ASCTEXT_ASCII() and ASSERT_ASCTEXT_ASCII_LEN() from similar Eistring checkers and change the Eistring checkers to use them instead. --------------------------------------------------------------- MACROS IN LISP.H --------------------------------------------------------------- lisp.h: Redo GCPRO declarations. Create a "base" set of functions that can be used to generate any kind of gcpro sets -- regular, ngcpro, nngcpro, private ones used in GC_EXTERNAL_LIST_LOOP_2. buffer.c, callint.c, chartab.c, console-msw.c, device-x.c, dialog-msw.c, dired.c, extents.c, ui-gtk.c, rangetab.c, nt.c, mule-coding.c, minibuf.c, menubar-msw.c, menubar.c, menubar-gtk.c, lread.c, lisp.h, gutter.c, glyphs.c, glyphs-widget.c, fns.c, fileio.c, file-coding.c, specifier.c: Eliminate EXTERNAL_LIST_LOOP, which does not check for circularities. Use EXTERNAL_LIST_LOOP_2 instead or EXTERNAL_LIST_LOOP_3 or EXTERNAL_PROPERTY_LIST_LOOP_3 or GC_EXTERNAL_LIST_LOOP_2 (new macro). Removed/redid comments on EXTERNAL_LIST_LOOP. --------------------------------------------------------------- SPACING FIXES --------------------------------------------------------------- callint.c, hftctl.c, number-gmp.c, process-unix.c: Spacing fixes. --------------------------------------------------------------- FIX FOR GEOMETRY PROBLEM IN FIRST FRAME --------------------------------------------------------------- unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by release 1.5.12 of Cygwin]. toolbar.c: bug fix for problem of initial frame being 77 chars wide on Windows. will be overridden by my other ws. --------------------------------------------------------------- FIX FOR LEAKING PROCESS HANDLES: --------------------------------------------------------------- process-nt.c: Fixes for leaking handles. Inspired by work done by Adrian Aichner <adrian@xemacs.org>. --------------------------------------------------------------- FIX FOR CYGWIN BUG (Unicode-related): --------------------------------------------------------------- unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by release 1.5.12 of Cygwin]. --------------------------------------------------------------- WARNING FIXES: --------------------------------------------------------------- console-stream.c: `reinit' is unused. compiler.h, event-msw.c, frame-msw.c, intl-encap-win32.c, text.h: Add stuff to deal with ANSI-aliasing warnings I got. regex.c: Gather includes together to avoid warning. --------------------------------------------------------------- CHANGES TO INITIALIZATION ROUTINES: --------------------------------------------------------------- buffer.c, emacs.c, console.c, debug.c, device-x.c, device.c, dragdrop.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, font-lock.c, frame-msw.c, glyphs-widget.c, glyphs.c, gui-x.c, insdel.c, lread.c, lstream.c, menubar-gtk.c, menubar-x.c, minibuf.c, mule-wnnfns.c, objects-msw.c, objects.c, print.c, scrollbar-x.c, search.c, select-x.c, text.c, undo.c, unicode.c, window.c, symsinit.h: Call reinit_*() functions directly from emacs.c, for clarity. Factor out some redundant init code. Move disallowed stuff that had crept into vars_of_glyphs() into complex_vars_of_glyphs(). Call init_eval_semi_early() from eval.c not in the middle of vars_of_() in emacs.c since there should be no order dependency in the latter calls. --------------------------------------------------------------- ARMAGEDDON: --------------------------------------------------------------- alloc.c, emacs.c, lisp.h, print.c: Rename inhibit_non_essential_printing_operations to inhibit_non_essential_conversion_operations. text.c: Assert on !inhibit_non_essential_conversion_operations. console-msw.c, print.c: Don't do conversion in SetConsoleTitle or FindWindow to avoid problems during armageddon. Put #errors for NON_ASCII_INTERNAL_FORMAT in places where problems would arise. --------------------------------------------------------------- CHANGES TO THE BUILD PROCEDURE: --------------------------------------------------------------- config.h.in, s/cxux.h, s/usg5-4-2.h, m/powerpc.h: Add comment about correct ordering of this file. Rearrange everything to follow this -- put all #undefs together and before the s&m files. Add undefs for HAVE_ALLOCA, C_ALLOCA, BROKEN_ALLOCA_IN_FUNCTION_CALLS, STACK_DIRECTION. Remove unused HAVE_STPCPY, HAVE_GETWD, HAVE_SETLOCALE. m/gec63.h: Deleted; totally broken, not used at all, not in FSF. m/7300.h, m/acorn.h, m/alliant-2800.h, m/alliant.h, m/altos.h, m/amdahl.h, m/apollo.h, m/att3b.h, m/aviion.h, m/celerity.h, m/clipper.h, m/cnvrgnt.h, m/convex.h, m/cydra5.h, m/delta.h, m/delta88k.h, m/dpx2.h, m/elxsi.h, m/ews4800r.h, m/gould.h, m/hp300bsd.h, m/hp800.h, m/hp9000s300.h, m/i860.h, m/ibmps2-aix.h, m/ibmrs6000.h, m/ibmrt-aix.h, m/ibmrt.h, m/intel386.h, m/iris4d.h, m/iris5d.h, m/iris6d.h, m/irist.h, m/isi-ov.h, m/luna88k.h, m/m68k.h, m/masscomp.h, m/mg1.h, m/mips-nec.h, m/mips-siemens.h, m/mips.h, m/news.h, m/nh3000.h, m/nh4000.h, m/ns32000.h, m/orion105.h, m/pfa50.h, m/plexus.h, m/pmax.h, m/powerpc.h, m/pyrmips.h, m/sequent-ptx.h, m/sequent.h, m/sgi-challenge.h, m/symmetry.h, m/tad68k.h, m/tahoe.h, m/targon31.h, m/tekxd88.h, m/template.h, m/tower32.h, m/tower32v3.h, m/ustation.h, m/vax.h, m/wicat.h, m/xps100.h: Delete C_ALLOCA, HAVE_ALLOCA, STACK_DIRECTION, BROKEN_ALLOCA_IN_FUNCTION_CALLS. All of this is auto-detected. When in doubt, I followed recent FSF sources, which also have these things deleted.
author ben
date Thu, 04 Nov 2004 23:08:28 +0000
parents 13a418960a88
children ad2f4ae9895b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Widget-specific glyph objects.
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2 Copyright (C) 1998, 1999, 2000, 2002 Andy Piper.
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
3 Copyright (C) 2003 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /* written by Andy Piper <andy@xemacs.org> */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include "lisp.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
28
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
29 #include "bytecode.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "console.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 866
diff changeset
31 #include "device-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "faces.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
33 #include "frame.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "glyphs.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
35 #include "gui.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
36 #include "insdel.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
37 #include "lstream.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "objects.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
39 #include "opaque.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "window.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 DEFINE_IMAGE_INSTANTIATOR_FORMAT (button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 DEFINE_IMAGE_INSTANTIATOR_FORMAT (combo_box);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 Lisp_Object Qcombo_box;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 DEFINE_IMAGE_INSTANTIATOR_FORMAT (edit_field);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 Lisp_Object Qedit_field;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 DEFINE_IMAGE_INSTANTIATOR_FORMAT (scrollbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 Lisp_Object Qscrollbar;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 DEFINE_IMAGE_INSTANTIATOR_FORMAT (widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 DEFINE_IMAGE_INSTANTIATOR_FORMAT (label);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 Lisp_Object Qlabel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 DEFINE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 Lisp_Object Qprogress_gauge;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 DEFINE_IMAGE_INSTANTIATOR_FORMAT (tree_view);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 Lisp_Object Qtree_view;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 DEFINE_IMAGE_INSTANTIATOR_FORMAT (tab_control);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 Lisp_Object Qtab_control;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 DEFINE_IMAGE_INSTANTIATOR_FORMAT (layout);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 Lisp_Object Qlayout;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
60 DEFINE_IMAGE_INSTANTIATOR_FORMAT (native_layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
61 Lisp_Object Qnative_layout;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 Lisp_Object Qetched_in, Qetched_out, Qbevel_in, Qbevel_out;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
64 Lisp_Object Qmake_glyph;
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
65 Lisp_Object Vwidget_border_width;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
66
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
67 static int widget_border_width (Lisp_Object domain);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
68 static int widget_spacing (Lisp_Object domain);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
69 static void widget_query_string_geometry (Lisp_Object string, Lisp_Object face,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
70 int *width, int *height, Lisp_Object domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
1068
9d75b4fe084c [xemacs-hg @ 2002-10-24 14:19:25 by youngs]
youngs
parents: 1065
diff changeset
72 #define BORDER_FIDDLE_FACTOR 10
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 #ifdef DEBUG_WIDGETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 int debug_widget_instances;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 /* TODO:
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
78 - tooltips for controls, especially buttons.
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
79 - keyboard traversal.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
80 - lisp configurable layout.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
83 /* In MS-Windows normal windows work in pixels, dialog boxes work in
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 dialog box units. Why? sigh. We could reuse the metrics for dialogs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 if this were not the case. As it is we have to position things
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 pixel wise. I'm not even sure that X has this problem at least for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 buttons in groups. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 widget_possible_dest_types (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 return IMAGE_WIDGET_MASK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
95 check_valid_instantiator (Lisp_Object data)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 Lisp_Object glyph = data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 if (SYMBOLP (data))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 glyph = XSYMBOL (data)->value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
101 if (!CONSP (glyph) && !VECTORP (glyph))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
102 invalid_argument ("instantiator item must be a vector", data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 check_valid_orientation (Lisp_Object data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 if (!EQ (data, Qhorizontal)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 !EQ (data, Qvertical))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 458
diff changeset
111 invalid_constant ("unknown orientation for layout", data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 static void
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
115 check_valid_tab_orientation (Lisp_Object data)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
116 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
117 if (!EQ (data, Qtop)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
118 &&
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
119 !EQ (data, Qbottom)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
120 &&
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
121 !EQ (data, Qleft)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
122 &&
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
123 !EQ (data, Qright))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 458
diff changeset
124 invalid_constant ("unknown orientation for tab control", data);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
125 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
126
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
127 static void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 check_valid_justification (Lisp_Object data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 {
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
130 if (!EQ (data, Qleft)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
131 &&
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
132 !EQ (data, Qright)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
133 &&
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
134 !EQ (data, Qtop)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
135 &&
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
136 !EQ (data, Qbottom)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
137 &&
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
138 !EQ (data, Qcenter))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 458
diff changeset
139 invalid_constant ("unknown justification for layout", data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 check_valid_border (Lisp_Object data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 if (!EQ (data, Qt) && !EQ (data, Qetched_in) && !EQ (data, Qetched_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 && !EQ (data, Qbevel_in) && !EQ (data, Qbevel_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 && !GLYPHP (data) && !VECTORP (data))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
148 invalid_argument ("unknown border style for layout", data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
152 check_valid_anything (Lisp_Object UNUSED (data))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 check_valid_callback (Lisp_Object data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 if (!SYMBOLP (data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 && !COMPILED_FUNCTIONP (data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 && !CONSP (data))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
163 invalid_argument (":callback must be a function or expression", data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
168 check_valid_int_or_function (Lisp_Object data)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
169 {
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 454
diff changeset
170 if (!INTP (data) && !CONSP (data) && !SYMBOLP (data))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
171 invalid_argument ("must be an integer or expresssion", data);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
172 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
173
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
174 static void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 check_valid_symbol (Lisp_Object data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 CHECK_SYMBOL (data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 check_valid_string_or_vector (Lisp_Object data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 if (!STRINGP (data) && !VECTORP (data))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
184 invalid_argument (":descriptor must be a string or a vector", data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
187 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
188 check_valid_item_list (Lisp_Object items)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2297
diff changeset
190 EXTERNAL_LIST_LOOP_2 (elt, items)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2297
diff changeset
192 if (STRINGP (elt))
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2297
diff changeset
193 CHECK_STRING (elt);
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2297
diff changeset
194 else if (VECTORP (elt))
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2297
diff changeset
195 gui_parse_item_keywords (elt);
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2297
diff changeset
196 else if (LISTP (elt))
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2297
diff changeset
197 check_valid_item_list (elt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 else
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2297
diff changeset
199 invalid_argument ("Item must be vector, list or string", elt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
204 check_valid_instantiator_list (Lisp_Object data)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2297
diff changeset
206 EXTERNAL_LIST_LOOP_2 (elt, data)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2297
diff changeset
208 check_valid_instantiator (elt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 glyph_instantiator_to_glyph (Lisp_Object sym)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 /* This function calls lisp. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 Lisp_Object glyph = sym;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 struct gcpro gcpro1;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
218
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 GCPRO1 (glyph);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 /* if we have a symbol get at the actual data */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 if (SYMBOLP (glyph))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 glyph = XSYMBOL (glyph)->value;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
223
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 if (CONSP (glyph))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 glyph = Feval (glyph);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 /* Be really helpful to the user. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 if (VECTORP (glyph))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
230 glyph = call1 (Qmake_glyph, glyph);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 /* substitute the new glyph */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 RETURN_UNGCPRO (glyph);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
237 static void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 substitute_keyword_value (Lisp_Object inst, Lisp_Object key, Lisp_Object val)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 /* substitute the new glyph */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 for (i = 0; i < XVECTOR_LENGTH (inst); i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 if (EQ (key, XVECTOR_DATA (inst)[i]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 XVECTOR_DATA (inst)[i+1] = val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
252 /* Determine the border with of the widget. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
253 static int
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
254 widget_border_width (Lisp_Object domain)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
255 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
256 /* #### FIXME -- need to use specifiers (Vwidget_border_width) for
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
257 some portion of this. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
258 if (HAS_DEVMETH_P (DOMAIN_XDEVICE (domain),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
259 widget_border_width))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
260 return DEVMETH (DOMAIN_XDEVICE (domain), widget_border_width, ());
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
261 else
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
262 return DEFAULT_WIDGET_BORDER_WIDTH;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
263 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
264
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
265 static int
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
266 widget_instance_border_width (Lisp_Image_Instance* ii)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
267 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
268 return widget_border_width (IMAGE_INSTANCE_DOMAIN (ii));
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
269 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
270
2297
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
271 /* #### It's not clear to me what the value of logical_unit_height should
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
272 be, or whether it should even depend on the current image_instance. It
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
273 really should probably only depend on the default widget face and the
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
274 domain, however you can envisage users wanting different logical units
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
275 for nested layouts - so using the properties of the current layout is
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
276 probably not so dumb. */
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
277 static int
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
278 logical_unit_height (Lisp_Object text, Lisp_Object face, Lisp_Object domain)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
279 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
280 int charheight = 0;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
281 widget_query_string_geometry (text, face,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
282 0, &charheight, domain);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
283 /* For the returned value to be useful it needs to be big enough to
2297
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
284 accomodate the largest single-height widget. This is currently
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
285 the edit-field. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
286 return charheight + 2 * widget_spacing (domain)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
287 + 4 * widget_border_width (domain);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
288 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
289
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
290 static int
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
291 widget_logical_unit_height (Lisp_Image_Instance* ii)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
292 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
293 return logical_unit_height (NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)) ?
866
613552a02607 [xemacs-hg @ 2002-06-04 17:39:43 by andyp]
andyp
parents: 863
diff changeset
294 NILP (IMAGE_INSTANCE_NAME (ii)) ?
613552a02607 [xemacs-hg @ 2002-06-04 17:39:43 by andyp]
andyp
parents: 863
diff changeset
295 Fsymbol_name (Qwidget)
613552a02607 [xemacs-hg @ 2002-06-04 17:39:43 by andyp]
andyp
parents: 863
diff changeset
296 : IMAGE_INSTANCE_NAME (ii)
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
297 : IMAGE_INSTANCE_WIDGET_TEXT (ii),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
298 IMAGE_INSTANCE_WIDGET_FACE (ii),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
299 IMAGE_INSTANCE_DOMAIN (ii));
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
300 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
301
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
302 /* Wire widget property invocations to specific widgets. The problem
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
303 we are solving here is that when instantiators get converted to
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
304 instances they lose some type information (they just become
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
305 subwindows or widgets for example). For widgets we need to preserve
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
306 this type information so that we can do widget specific operations
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
307 on the instances. This is encoded in the widget type
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
308 field. widget_property gets invoked by decoding the primary type
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
309 (Qwidget), <widget>_property then invokes based on the secondary
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
310 type (Qedit_field for example). It is debatable whether we should
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
311 wire things in this generalised way rather than treating widgets
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
312 specially in image_instance_property. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
313 static Lisp_Object
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 widget_property (Lisp_Object image_instance, Lisp_Object prop)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
316 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 struct image_instantiator_methods* meths;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
318 #if 0 /* The usefulness of this is dubious. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 /* first see if its a general property ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 if (!NILP (Fplist_member (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 return Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, Qnil);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
322 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 /* .. then try device specific methods ... */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
324 meths = decode_device_ii_format (image_instance_device (image_instance),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
325 IMAGE_INSTANCE_WIDGET_TYPE (ii),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 ERROR_ME_NOT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 if (meths && HAS_IIFORMAT_METH_P (meths, property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 return IIFORMAT_METH (meths, property, (image_instance, prop));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 /* ... then format specific methods ... */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
330 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 ERROR_ME_NOT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 if (meths && HAS_IIFORMAT_METH_P (meths, property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 return IIFORMAT_METH (meths, property, (image_instance, prop));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 /* ... then fail */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 return Qunbound;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
338 /* Update the displayed properties of a widget.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
339
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
340 #### This has been adapted from the original set_property functions
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
341 and thus reuses the state management of that. A better solution is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
342 to simply re-parse the instantiator when items need updating. This
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
343 make comparing differences much simpler and obviates the need for a
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
344 lot of the state variables.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
345
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
346 #### property is still a valid function since we have to be able to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
347 extract information from the actual widget.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
348
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
349 #### update_widget should probably be re-written to use the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
350 instantiator. We probably want to keep a record of the differences
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
351 also to make this easy. We would also need a pending_instantiator
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
352 so that changes could be delayed. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
353 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
354 widget_update (Lisp_Object image_instance, Lisp_Object instantiator)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
356 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 struct image_instantiator_methods* meths;
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
358 struct gcpro gcpro1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
360 Lisp_Object text = find_keyword_in_vector (instantiator, Q_text);
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
361 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
362 Lisp_Object items = find_keyword_in_vector (instantiator, Q_items);
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
363 Lisp_Object descriptor_item = Qnil;
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
364
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
365 GCPRO1 (descriptor_item);
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
366
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
367 /* Pick up any generic properties that we might need to keep hold
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
368 of.
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
369 #### This is potentially bogus because it is changing the items
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
370 in place rather than in the pending items. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
371 if (!NILP (text))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
372 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
373 IMAGE_INSTANCE_WIDGET_TEXT (ii) = text;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
374 IMAGE_INSTANCE_TEXT_CHANGED (ii) = 1;
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
375 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
376
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
377 /* Retrieve the gui item information. This is easy if we have been
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
378 provided with a vector, more difficult if we have just been given
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
379 keywords.
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
380
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
381 #### This is inconsistent with instantiation in that you have to
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
382 have the :descriptor keyword for updates in order to recognise
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
383 changes. */
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
384 if (VECTORP (desc))
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
385 {
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
386 descriptor_item = gui_parse_item_keywords_no_errors (desc);
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
387 }
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
388 else
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
389 {
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
390 /* Since we are updating the instantiator could be incomplete
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
391 and hence the gui item descriptor not well formed. We
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
392 therefore try updating and discard the results if nothing
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
393 changed. */
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
394 descriptor_item = copy_gui_item (IMAGE_INSTANCE_WIDGET_ITEM (ii));
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
395 if (!update_gui_item_keywords (descriptor_item, instantiator))
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
396 descriptor_item = Qnil;
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
397 }
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
398
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
399 /* Record new items for update. *_redisplay will do the
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
400 rest. */
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
401 if (!EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout)
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
402 &&
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
403 !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qnative_layout))
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
404 {
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
405 if (!NILP (items))
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
406 {
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
407 if (NILP (descriptor_item))
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
408 descriptor_item = IMAGE_INSTANCE_WIDGET_ITEM (ii);
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
409
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
410 check_valid_item_list (items);
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
411 #ifdef DEBUG_WIDGET_OUTPUT
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
412 stderr_out ("items for widget %p updated\n",
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
413 IMAGE_INSTANCE_SUBWINDOW_ID (ii));
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
414 #endif
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
415 /* Don't set the actual items since we might decide not to use
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
416 the new ones (because nothing has really changed). If we did
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
417 set them and didn't use them then we would get into whole
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
418 heaps of trouble when the old items get GC'd. */
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
419 descriptor_item = Fcons (descriptor_item, parse_gui_item_tree_children (items));
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
420 }
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
421 /* If the descriptor was updated but not the items we need to fill
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
422 in the `new' items. */
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
423 else if (!NILP (descriptor_item)
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
424 &&
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
425 CONSP (IMAGE_INSTANCE_WIDGET_ITEMS (ii)))
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
426 {
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
427 descriptor_item = Fcons
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
428 (descriptor_item,
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
429 copy_gui_item_tree (XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii))));
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
430 }
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
431 }
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
432
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
433 if (!NILP (descriptor_item))
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
434 {
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
435 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = descriptor_item;
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
436 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii) = 1;
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
437 }
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
438
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
439 UNGCPRO;
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
440
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
441 /* Now try device specific methods first ... */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
442 meths = decode_device_ii_format (image_instance_device (image_instance),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
443 IMAGE_INSTANCE_WIDGET_TYPE (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
444 ERROR_ME_NOT);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
445 MAYBE_IIFORMAT_METH (meths, update, (image_instance, instantiator));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
446 /* ... then format specific methods ... */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
447 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
448 ERROR_ME_NOT);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
449 MAYBE_IIFORMAT_METH (meths, update, (image_instance, instantiator));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
450 #if 0 /* The usefulness of this is dubious. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
451 /* we didn't do any device specific properties, so shove the property in our plist. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
452 IMAGE_INSTANCE_WIDGET_PROPS (ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
453 = Fplist_put (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, val);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
454 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
455 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
456
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
457 /* Like the rest of redisplay, we want widget updates to occur
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
458 asynchronously. Thus toolkit specific methods for setting
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
459 properties must be called by redisplay instead of by *_update. Thus
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
460 *_update records the change and this function actually implements
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
461 it. We want to be slightly clever about this however by supplying
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
462 format specific functions for the updates instead of lumping them
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
463 all into this function. Note that there is no need for format
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
464 generic functions. This is not the same as widget_update! */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
465 void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
466 redisplay_widget (Lisp_Object widget)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
467 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
468 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (widget);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
469 struct image_instantiator_methods* meths;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
470
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
471 if (!WIDGET_IMAGE_INSTANCEP (widget)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
472 || EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
473 || EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qnative_layout))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
474 return;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
475
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
476 /* Device-format specific methods - e.g. x_tab_control_redisplay () */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
477 meths = decode_device_ii_format (image_instance_device (widget),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 IMAGE_INSTANCE_WIDGET_TYPE (ii),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 ERROR_ME_NOT);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
480 MAYBE_IIFORMAT_METH (meths, redisplay, (widget));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
481
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
482 /* Device generic methods - e.g. x_redisplay_widget (). We must
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
483 update the widget's size as it may have been changed by the the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
484 layout routines. We also do this here so that explicit resizing
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
485 from lisp does not result in synchronous updates. Do this last so
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
486 that format-specific methods have an opportunity to prevent
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
487 wholesale changes - e.g. rebuilding tabs. */
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
488 MAYBE_DEVMETH (DOMAIN_XDEVICE (IMAGE_INSTANCE_DOMAIN (ii)),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
489 redisplay_widget, (ii));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
490
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
491 /* Pick up the items we recorded earlier. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
492 if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
494 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
495 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
496 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
500 static void
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
501 widget_query_string_geometry (Lisp_Object string, Lisp_Object face,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
502 int *width, int *height, Lisp_Object domain)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
503 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
504 struct device *d = DOMAIN_XDEVICE (domain);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
505
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
506 if (HAS_DEVMETH_P (d, widget_query_string_geometry))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
507 DEVMETH (d, widget_query_string_geometry,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
508 (string, face, width, height, domain));
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
509 else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
510 query_string_geometry (string, face, width, height, 0, domain);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
511
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
512 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
513
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
514 /* Determine the spacing of the widget. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
515 static int
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
516 widget_spacing (Lisp_Object domain)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
517 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
518 if (HAS_DEVMETH_P (DOMAIN_XDEVICE (domain), widget_spacing))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
519 return DEVMETH (DOMAIN_XDEVICE (domain),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
520 widget_spacing, (0));
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
521 else
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
522 return DEFAULT_WIDGET_SPACING;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
523 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
524
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
525 /* Query for a widgets desired geometry. If no type specific method is
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
526 provided then use the widget text to calculate sizes. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
527 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
528 widget_query_geometry (Lisp_Object image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
529 int* width, int* height,
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
530 enum image_instance_geometry disp, Lisp_Object domain)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
531 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
532 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
533 struct image_instantiator_methods* meths;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
534 Lisp_Object dynamic_width = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
535 Lisp_Object dynamic_height = Qnil;
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
536
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
537 /* First just set up what we already have. */
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
538 if (width) *width = IMAGE_INSTANCE_WIDTH (ii);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
539 if (height) *height = IMAGE_INSTANCE_HEIGHT (ii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
540
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
541 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
542 ||
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
543 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
544 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
545 /* .. then try device specific methods ... */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
546 meths = decode_device_ii_format (image_instance_device (image_instance),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
547 IMAGE_INSTANCE_WIDGET_TYPE (ii),
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
548 ERROR_ME_NOT);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
549 if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
550 IIFORMAT_METH (meths, query_geometry, (image_instance,
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
551 width, height, disp,
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
552 domain));
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
553 else
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
554 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
555 /* ... then format specific methods ... */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
556 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
557 ERROR_ME_NOT);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
558 if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
559 IIFORMAT_METH (meths, query_geometry, (image_instance,
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
560 width, height, disp,
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
561 domain));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
562 else
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
563 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
564 int w, h;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
565
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
566 /* Then if we are allowed to resize the widget, make the
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
567 size the same as the text dimensions. */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
568 widget_query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
569 IMAGE_INSTANCE_WIDGET_FACE (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
570 &w, &h, domain);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
571 /* Adjust the size for borders. */
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
572 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
573 *width = w + 2 * widget_instance_border_width (ii);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
574 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii))
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
575 *height = h + 2 * widget_instance_border_width (ii);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
576 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
577 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
578 /* Finish off with dynamic sizing. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
579 if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
580 {
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
581 dynamic_width =
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
582 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
583 if (INTP (dynamic_width))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
584 *width = XINT (dynamic_width);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
585 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
586 if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
587 {
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
588 dynamic_height =
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 800
diff changeset
589 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
590 if (INTP (dynamic_height))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
591 *height = XINT (dynamic_height);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
592 }
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
593 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
594 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
595
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
596 static int
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
597 widget_layout (Lisp_Object image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
598 int width, int height, int xoffset, int yoffset,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
599 Lisp_Object domain)
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
600 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
601 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
602 struct image_instantiator_methods* meths;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
603
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
604 /* .. then try device specific methods ... */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
605 meths = decode_device_ii_format (image_instance_device (image_instance),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
606 IMAGE_INSTANCE_WIDGET_TYPE (ii),
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
607 ERROR_ME_NOT);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
608 if (meths && HAS_IIFORMAT_METH_P (meths, layout))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
609 return IIFORMAT_METH (meths, layout, (image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
610 width, height, xoffset, yoffset,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
611 domain));
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
612 else
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
613 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
614 /* ... then format specific methods ... */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
615 meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii),
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
616 ERROR_ME_NOT);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
617 if (meths && HAS_IIFORMAT_METH_P (meths, layout))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
618 return IIFORMAT_METH (meths, layout, (image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
619 width, height, xoffset, yoffset,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
620 domain));
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
621 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
622 return 1;
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
623 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
624
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 widget_validate (Lisp_Object instantiator)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 if (NILP (desc))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 458
diff changeset
631 invalid_argument ("Must supply :descriptor", instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 if (VECTORP (desc))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 gui_parse_item_keywords (desc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 if (!NILP (find_keyword_in_vector (instantiator, Q_width))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 && !NILP (find_keyword_in_vector (instantiator, Q_pixel_width)))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 458
diff changeset
638 invalid_argument ("Must supply only one of :width and :pixel-width", instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 if (!NILP (find_keyword_in_vector (instantiator, Q_height))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 && !NILP (find_keyword_in_vector (instantiator, Q_pixel_height)))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 458
diff changeset
642 invalid_argument ("Must supply only one of :height and :pixel-height", instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 combo_box_validate (Lisp_Object instantiator)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 widget_validate (instantiator);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
649 if (NILP (find_keyword_in_vector (instantiator, Q_items)))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 458
diff changeset
650 invalid_argument ("Must supply item list", instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 /* we need to convert things like glyphs to images, eval expressions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 etc.*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 static Lisp_Object
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
656 widget_normalize (Lisp_Object inst, Lisp_Object UNUSED (console_type),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
657 Lisp_Object UNUSED (dest_mask))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 /* This function can call lisp */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 Lisp_Object glyph = find_keyword_in_vector (inst, Q_image);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 /* we need to eval glyph if its an expression, we do this for the
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
663 same reasons we normalize file to data.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
664
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
665 #### should just normalize the data. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 if (!NILP (glyph))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 {
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
668 substitute_keyword_value (inst, Q_image,
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
669 glyph_instantiator_to_glyph (glyph));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 return inst;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
676 initialize_widget_image_instance (Lisp_Image_Instance *ii, Lisp_Object type)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 /* initialize_subwindow_image_instance (ii);*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 IMAGE_INSTANCE_WIDGET_TYPE (ii) = type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 IMAGE_INSTANCE_WIDGET_PROPS (ii) = Qnil;
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
681 SET_IMAGE_INSTANCE_WIDGET_FACE (ii, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = allocate_gui_item ();
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
683 IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
684 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
685 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii) = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
686 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = Qnil;
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
687 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 1;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
688 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 1;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
689 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_HORIZONTAL;
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
690 IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY (ii) = 0;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
691 IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY (ii) = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 /* Instantiate a button widget. Unfortunately instantiated widgets are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 particular to a frame since they need to have a parent. It's not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 like images where you just select the image into the context you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 want to display it in and BitBlt it. So image instances can have a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 many-to-one relationship with things you see, whereas widgets can
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 only be one-to-one (i.e. per frame) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 void
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
701 widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
702 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
703 int dest_mask, Lisp_Object domain)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
705 /* #### practically all of this should be moved to widget_update()
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
706 so that users can dynamically change all possible widget
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
707 properties. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
708 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 Lisp_Object face = find_keyword_in_vector (instantiator, Q_face);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 Lisp_Object height = find_keyword_in_vector (instantiator, Q_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 Lisp_Object width = find_keyword_in_vector (instantiator, Q_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 Lisp_Object pixwidth = find_keyword_in_vector (instantiator, Q_pixel_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 Lisp_Object pixheight = find_keyword_in_vector (instantiator, Q_pixel_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 Lisp_Object glyph = find_keyword_in_vector (instantiator, Q_image);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
716 Lisp_Object items = find_keyword_in_vector (instantiator, Q_items);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
717 Lisp_Object orient = find_keyword_in_vector (instantiator, Q_orientation);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
718 Lisp_Object mwidth = find_keyword_in_vector (instantiator, Q_margin_width);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
719 Lisp_Object ifocus = find_keyword_in_vector (instantiator, Q_initial_focus);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 int pw=0, ph=0, tw=0, th=0;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
721
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 /* this just does pixel type sizing */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 subwindow_instantiate (image_instance, instantiator, pointer_fg, pointer_bg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 dest_mask, domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
726 if (!(dest_mask & IMAGE_WIDGET_MASK))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
727 incompatible_image_types (instantiator, dest_mask, IMAGE_WIDGET_MASK);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 initialize_widget_image_instance (ii, XVECTOR_DATA (instantiator)[0]);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
731 IMAGE_INSTANCE_TYPE (ii) = IMAGE_WIDGET;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
732
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 /* retrieve the fg and bg colors */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 if (!NILP (face))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
735 SET_IMAGE_INSTANCE_WIDGET_FACE (ii, Fget_face (face));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
737 /* Retrieve the gui item information. This is easy if we have been
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 provided with a vector, more difficult if we have just been given
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
739 keywords. Note that standard gui descriptor shortcuts will not work
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
740 because of keyword parsing.
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
741
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
742 #### This is bogus in that descriptor and items share the same slot,
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
743 we should rationalize. */
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
744 if (VECTORP (desc))
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
745 {
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
746 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
747 gui_parse_item_keywords_no_errors (desc);
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
748 }
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
749 else
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 /* big cheat - we rely on the fact that a gui item looks like an instantiator */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
752 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
753 widget_gui_parse_item_keywords (instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
756 /* Pick up the orientation before we do our first layout. */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
757 if (EQ (orient, Qleft) || EQ (orient, Qright) || EQ (orient, Qvertical))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
758 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_VERTICAL;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
759
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 /* parse more gui items out of the properties */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
761 if (!NILP (items) && !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
762 && !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qnative_layout))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
764 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
765 Fcons (IMAGE_INSTANCE_WIDGET_ITEMS (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
766 parse_gui_item_tree_children (items));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
769 /* Normalize size information. We now only assign sizes if the user
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
770 gives us some explicitly, or there are some constraints that we
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
771 can't change later on. Otherwise we postpone sizing until query
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
772 geometry gets called. */
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
773 if (!NILP (pixwidth)) /* pixwidth takes precendent */
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
774 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
775 if (!INTP (pixwidth))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
776 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii) = pixwidth;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
777 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
778 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
779 pw = XINT (pixwidth);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
780 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
781 }
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
782 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
783 else if (!NILP (width))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
784 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
785 tw = XINT (width);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
786 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
787 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
788
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 if (!NILP (pixheight))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
790 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
791 if (!INTP (pixheight))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
792 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = pixheight;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
793 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
794 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
795 ph = XINT (pixheight);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
796 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
797 }
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
798 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
799 else if (!NILP (height) && XINT (height) > 1)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
800 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
801 th = XINT (height);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
802 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
803 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
804
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
805 /* Taking the default face information when the user has specified
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
806 size in characters is probably as good as any since the widget
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
807 face is more likely to be proportional and thus give inadequate
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
808 results. Using character sizes can only ever be approximate
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
809 anyway. :height is measured in logical characters which take into
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
810 account the borders and spacing on widgets. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
811 if (tw)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
812 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
813 int charwidth;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
814 default_face_font_info (domain, 0, 0, 0, &charwidth, 0);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
815 pw = ROUND_UP (charwidth * tw + 4 * widget_instance_border_width (ii), charwidth);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
816 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
817
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
818 /* For heights the widget face is more appropriate. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
819 if (th == 1)
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
820 {
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
821 int charheight;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
822 if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
823 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
824 widget_query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
825 IMAGE_INSTANCE_WIDGET_FACE (ii),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
826 0, &charheight, domain);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
827 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
828 else
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
829 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
830 default_face_font_info (domain, 0, 0, &charheight, 0, 0);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
831 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
832 ph = (charheight + 2 * widget_instance_border_width (ii)) * th;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
833 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
834 /* For heights > 1 use logical units. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
835 else if (th > 1)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
836 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
837 ph = widget_logical_unit_height (ii) * th;
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
838 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 /* for a widget with an image pick up the dimensions from that */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 if (!NILP (glyph))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 {
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
843 if (!pw)
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
844 pw = glyph_width (glyph, image_instance) + 2 * widget_instance_border_width (ii);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
845 if (!ph)
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
846 ph = glyph_height (glyph, image_instance) + 2 * widget_instance_border_width (ii);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
847 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
848 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
851 /* Pick up the margin width. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
852 if (!NILP (mwidth))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
853 IMAGE_INSTANCE_MARGIN_WIDTH (ii) = XINT (mwidth);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
854
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
855 IMAGE_INSTANCE_WANTS_INITIAL_FOCUS (ii) = !NILP (ifocus);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
856
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
857 /* Layout for the layout widget is premature at this point since the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
858 children will not have been instantiated. We can't instantiate
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
859 them until the device instantiation method for the layout has
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
860 been executed. We do however want to record any specified
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
861 dimensions. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
862 if (pw) IMAGE_INSTANCE_WIDTH (ii) = pw;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
863 if (ph) IMAGE_INSTANCE_HEIGHT (ii) = ph;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
864 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
865
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
866 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
867 widget_post_instantiate (Lisp_Object UNUSED (image_instance),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
868 #ifdef DEBUG_WIDGETS
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
869 Lisp_Object instantiator,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
870 #else
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
871 Lisp_Object UNUSED (instantiator),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
872 #endif
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
873 Lisp_Object UNUSED (domain))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
874 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 #ifdef DEBUG_WIDGETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 debug_widget_instances++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 stderr_out ("instantiated ");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 debug_print (instantiator);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 stderr_out ("%d widgets instantiated\n", debug_widget_instances);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
883 /* Get the geometry of a button control. We need to adjust the size
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
884 depending on the type of button. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
885 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
886 button_query_geometry (Lisp_Object image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
887 int* width, int* height,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
888 enum image_instance_geometry UNUSED (disp),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
889 Lisp_Object domain)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
890 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
891 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
892 int w, h;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
893 widget_query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
894 IMAGE_INSTANCE_WIDGET_FACE (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
895 &w, &h, domain);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
896 /* Adjust the size for borders. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
897 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
898 {
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
899 *width = w + 3 * widget_instance_border_width (ii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
900
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
901 if (EQ (XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (ii))->style, Qradio)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
902 ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
903 EQ (XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (ii))->style, Qtoggle))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
904 /* This is an approximation to the size of the actual button bit. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
905 *width += 12;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
906 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
907 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii))
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
908 *height = h + 3 * widget_instance_border_width (ii);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
909 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
910
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
911 /* Get the geometry of an edit field. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
912 static void
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
913 edit_field_query_geometry (Lisp_Object image_instance,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
914 int* width, int* height,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
915 enum image_instance_geometry UNUSED (disp),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
916 Lisp_Object domain)
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
917 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
918 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
919 int w, h;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
920 widget_query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
921 IMAGE_INSTANCE_WIDGET_FACE (ii),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
922 &w, &h, domain);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
923 /* Adjust the size for borders. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
924 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
925 *width = w + 4 * widget_instance_border_width (ii);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
926 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
927 *height = h + 4 * widget_instance_border_width (ii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
928 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
929
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
930 /* tree-view geometry - get the height right */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
932 tree_view_query_geometry (Lisp_Object image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
933 int* width, int* height,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
934 enum image_instance_geometry UNUSED (disp),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
935 Lisp_Object domain)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
937 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
938 Lisp_Object items = IMAGE_INSTANCE_WIDGET_ITEMS (ii);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
939
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
940
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
941 if (*width)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
942 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
943 /* #### what should this be. reconsider when X has tree views. */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
944 widget_query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
945 IMAGE_INSTANCE_WIDGET_FACE (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
946 width, 0, domain);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
947 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
948 if (*height)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
949 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
950 int len, h;
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
951 /* #### widget face would be better here. */
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
952 default_face_font_info (domain, 0, 0, &h, 0, 0);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
953 GET_LIST_LENGTH (items, len);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
954 *height = len * h;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
955 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957
2297
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
958 /* Get the geometry of a tab control. This is based on the number of
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
959 items and text therein in the tab control. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
961 tab_control_query_geometry (Lisp_Object image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
962 int* width, int* height,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
963 enum image_instance_geometry UNUSED (disp),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
964 Lisp_Object domain)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
966 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
967 Lisp_Object items = XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 Lisp_Object rest;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
969 int tw = 0, th = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
971 LIST_LOOP (rest, items)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
973 int h, w;
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
974
2297
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
975 /* #### Maybe we should allow items to be a list of strings?
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
976 Ie, autoconvert "label" -> ["label" "label" :selected maybe-t].
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
977 Maybe there's a better place (or several places) to do this?
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
978 If so, change image_instantiator_tab_control back to use
13a418960a88 [xemacs-hg @ 2004-09-22 02:05:42 by stephent]
stephent
parents: 2286
diff changeset
979 check_valid_item_list for checking Q_items. -- sjt */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 563
diff changeset
980 widget_query_string_geometry (XGUI_ITEM (XCAR (rest))->name,
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
981 IMAGE_INSTANCE_WIDGET_FACE (ii),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
982 &w, &h, domain);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
983 tw += 5 * widget_instance_border_width (ii); /* some bias */
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
984 tw += w;
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
985 th = max (th, h + 2 * widget_instance_border_width (ii));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
988 /* Fixup returned values depending on orientation. */
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
989 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
990 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
991 if (height) *height = tw;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
992 if (width) *width = th;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
993 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
994 else
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
995 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
996 if (height) *height = th;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
997 if (width) *width = tw;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
998 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1001 /* Determine whether only the order has changed for a tab. */
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1002 int
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1003 tab_control_order_only_changed (Lisp_Object image_instance)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1004 {
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1005 /* Called within redisplay */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1006 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1007 int found = 0, len, pending_len;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1008 Lisp_Object rest;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1009
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1010 /* Degenerate case. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1011 if (NILP (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1012 return 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1013
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1014 /* See whether we just need a change in order. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1015 GET_LIST_LENGTH (IMAGE_INSTANCE_WIDGET_ITEMS (ii), len);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1016 GET_LIST_LENGTH (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1017 pending_len);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1018 if (len == pending_len)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1019 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1020 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1021 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1022 Lisp_Object pending_rest;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1023 found = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1024 LIST_LOOP (pending_rest,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1025 XCDR (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1026 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1027 if (gui_item_equal_sans_selected (XCAR (rest),
1913
7473844a83d3 [xemacs-hg @ 2004-02-17 15:20:41 by james]
james
parents: 1318
diff changeset
1028 XCAR (pending_rest), 0))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1029 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1030 found = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1031 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1032 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1033 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1034 if (!found)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1035 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1036 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1037 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1038 return found;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1039 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1040
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 * widget layout *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 *****************************************************************************/
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1045 /* We need to cascade normalization.*/
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 static Lisp_Object
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1047 layout_normalize (Lisp_Object inst, Lisp_Object console_type,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1048 Lisp_Object dest_mask)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 /* This function can call lisp */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1051 struct gcpro gcpro1, gcpro2;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1052 Lisp_Object alist = Qnil, new_items = Qnil, border;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1053 /* This function can call lisp */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1054 Lisp_Object items;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1055
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1056 GCPRO2 (alist, new_items);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1057 alist = tagged_vector_to_alist (inst);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1058 items = assq_no_quit (Q_items, alist);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1059
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1060 /* We need to normalize sub-objects. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 if (!NILP (items))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 Lisp_Object rest;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1064 LIST_LOOP (rest, XCDR (items))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1066 /* Substitute the new instantiator */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1067 new_items = Fcons (normalize_image_instantiator (XCAR (rest),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1068 console_type, dest_mask),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1069 new_items);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1070 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1071 new_items = Fnreverse (new_items);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1072 Fsetcdr (items, new_items);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1073 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1074 /* Normalize the border spec. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1075 border = assq_no_quit (Q_border, alist);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1076 if (!NILP (border) && VECTORP (XCDR (border)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1077 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1078 Fsetcdr (border, normalize_image_instantiator (XCDR (border),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1079 console_type, dest_mask));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1080 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1081
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1082 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1083 Lisp_Object result = alist_to_tagged_vector (XVECTOR_DATA (inst)[0],
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1084 alist);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1085 free_alist (alist);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1086 RETURN_UNGCPRO (result);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1087 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1088 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1089
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1090 /* Update the instances in the layout. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1091 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1092 layout_update (Lisp_Object image_instance, Lisp_Object instantiator)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1093 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1094 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1095 Lisp_Object items = find_keyword_in_vector (instantiator, Q_items);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1096 Lisp_Object border_inst = find_keyword_in_vector (instantiator, Q_border);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1097 Lisp_Object justify = find_keyword_in_vector (instantiator, Q_justify);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1098 Lisp_Object hjustify = find_keyword_in_vector (instantiator, Q_horizontally_justify);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1099 Lisp_Object vjustify = find_keyword_in_vector (instantiator, Q_vertically_justify);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1100 Lisp_Object border = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1101 Lisp_Object children = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1102 int structure_changed = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1103 struct gcpro gcpro1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1104
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1105 /* Pick up horizontal justification, left is the default.*/
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1106 if (!NILP (hjustify))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1107 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1108 if (EQ (hjustify, Qright) || EQ (hjustify, Qbottom))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1109 IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY (ii) = LAYOUT_JUSTIFY_RIGHT;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1110 else if (EQ (hjustify, Qcenter))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1111 IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY (ii) = LAYOUT_JUSTIFY_CENTER;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1112 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1113 /* If not set use general justification. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1114 else if (!NILP (justify))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1115 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1116 if (EQ (justify, Qright) || EQ (justify, Qbottom))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1117 IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY (ii) = LAYOUT_JUSTIFY_RIGHT;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1118 else if (EQ (justify, Qcenter))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1119 IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY (ii) = LAYOUT_JUSTIFY_CENTER;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1120 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1121
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1122 /* Pick up vertical justification, top is the default. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1123 if (!NILP (vjustify))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1124 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1125 if (EQ (vjustify, Qright) || EQ (vjustify, Qbottom))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1126 IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY (ii) = LAYOUT_JUSTIFY_BOTTOM;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1127 else if (EQ (vjustify, Qcenter))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1128 IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY (ii) = LAYOUT_JUSTIFY_CENTER;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1129 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1130 /* If not set use general justification. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1131 else if (!NILP (justify))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1132 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1133 if (EQ (justify, Qright) || EQ (justify, Qbottom))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1134 IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY (ii) = LAYOUT_JUSTIFY_BOTTOM;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1135 else if (EQ (justify, Qcenter))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1136 IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY (ii) = LAYOUT_JUSTIFY_CENTER;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1137 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1138
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1139 /* We want to avoid consing if we can. This is quite awkward because
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1140 we have to deal with the border as well as the items. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1141 GCPRO1 (border);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1142
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1143 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1144 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1145 border = XCAR (children);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1146 children = XCDR (children);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1147 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1148
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1149 #ifdef DEBUG_WIDGET_OUTPUT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1150 stderr_out ("layout updated\n");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1151 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1152 /* Update the border. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1153 if (!NILP (border_inst))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1154 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1155 if (VECTORP (border_inst))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1156 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1157 /* We are going to be sneaky here and add the border text as
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1158 just another child, the layout and output routines don't know
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1159 this and will just display at the offsets we prescribe. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1160 if (!NILP (border))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1161 call3 (Qset_glyph_image, border, border_inst,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1162 IMAGE_INSTANCE_DOMAIN (ii));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1163 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1164 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1165 border = Fcons (call1 (Qmake_glyph, border_inst), Qnil);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1166 structure_changed = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1167 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1168 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1169 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1170 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1171 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1172 if (!NILP (border))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1173 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1174 border = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1175 structure_changed = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1176 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1177 if (EQ (border_inst, Qt))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1178 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = Qetched_in;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1179 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1180 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = border_inst;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1183
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1184 /* Pick up the sub-widgets. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1185 if (!NILP (items))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1187 int len1, len2;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1188 GET_LIST_LENGTH (items, len1);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1189 GET_LIST_LENGTH (children, len2);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1190 /* The structure hasn't changed so just update the images. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1191 if (!structure_changed && len1 == len2)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1192 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1193 /* Pick up the sub-widgets. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1194 for (; !NILP (children); children = XCDR (children), items = XCDR (items))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1195 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1196 call3 (Qset_glyph_image, XCAR (children), XCAR (items),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1197 IMAGE_INSTANCE_DOMAIN (ii));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1198 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1199 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1200 /* The structure has changed so start over. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1201 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1202 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1203 /* Instantiate any new glyphs. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1204 for (; !NILP (items); items = XCDR (items))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1205 {
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 454
diff changeset
1206 /* #### We really want to use call_with_suspended_errors
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 454
diff changeset
1207 here, but it won't allow us to call lisp. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1208 border = Fcons (call1 (Qmake_glyph, XCAR (items)), border);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1209 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1210 IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = Fnreverse (border);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1211 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1213 UNGCPRO;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1214 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1215
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1216 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1217 layout_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1218 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1219 int dest_mask, Lisp_Object domain)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1220 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1221 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1222 Lisp_Object orient = find_keyword_in_vector (instantiator, Q_orientation);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1223
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1224 #ifdef DEBUG_WIDGET_OUTPUT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1225 stderr_out ("layout instantiated\n");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1226 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1227 /* Do widget type instantiation first. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1228 widget_instantiate (image_instance, instantiator, pointer_fg, pointer_bg,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1229 dest_mask, domain);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1230
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1231 if (NILP (orient))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1232 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1233 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_VERTICAL;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1234 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1235
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1236 /* Get child glyphs and finish instantiation. We can't do image
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1237 instance children yet as we might not have a containing
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1238 window. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1239 layout_update (image_instance, instantiator);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1240 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1241
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1242 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1243 layout_post_instantiate (Lisp_Object UNUSED (image_instance),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1244 Lisp_Object UNUSED (instantiator),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1245 Lisp_Object UNUSED (domain))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1246 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1248
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1249 /* Layout widget. Sizing commentary: we have a number of problems that
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1250 we would like to address. Some consider some of these more
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1251 important than others. It used to be that size information was
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1252 determined at instantiation time and was then fixed forever
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1253 after. Generally this is not what we want. Users want size to be
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1254 "big enough" to accommodate whatever they are trying to show and
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1255 this is dependent on text length, lines, font metrics etc. Of
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1256 course these attributes can change dynamically and so the size
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1257 should changed dynamically also. Only in a few limited cases should
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1258 the size be fixed and remain fixed. Of course this actually means
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1259 that we don't really want to specify the size *at all* for most
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1260 widgets - we want it to be discovered dynamically. Thus we can
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1261 envisage the following scenarios:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1262
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1263 1. A button is sized to accommodate its text, the text changes and the
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1264 button should change size also.
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1265
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1266 2. A button is given an explicit size. Its size should never change.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1267
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1268 3. Layout is put inside an area. The size of the area changes, the
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1269 layout should change with it.
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1270
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1271 4. A button grows to accommodate additional text. The whitespace
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1272 around it should be modified to cope with the new layout
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1273 requirements.
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1274
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1275 5. A button grows. The area surrounding it should grow also if
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1276 possible.
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1277
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1278 What metrics are important?
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1279 1. Actual width and height.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1280
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1281 2. Whether the width and height are what the widget actually wants, or
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1282 whether it can grow or shrink.
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1283
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1284 Text glyphs are particularly troublesome since their metrics depend
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1285 on the context in which they are being viewed. For instance they
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
1286 can appear differently depending on the window face, frame face or
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1287 glyph face. In order to simplify this text glyphs can now only have
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1288 a glyph-face or image-instance face. All other glyphs are
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1289 essentially fixed in appearance. Perhaps the problem is that text
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1290 glyphs are cached on a device basis like most other glyphs. Instead
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1291 they should be cached per-window and then the instance would be
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1292 fixed and we wouldn't have to mess around with font metrics and the
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1293 rest.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1294
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1295 Another sizing problem is alignment. We provide layout widgets that
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1296 allow users to stack widgets vertically or horizontally. These
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1297 layouts also allow the widgets to be centered (space evenly
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1298 distributed), left or right justified (fixed spacing widgets
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1299 stacked against the left, righ, top or bottom edge). Unfortunately
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1300 this doesn't allow widgets in different layouts to be aligned. For
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1301 instance how should the search dialog be organized for alignment?
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1302 The obvious choice of two vertical columns does not work since the
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1303 size of individual widgets will affect where they get placed. The
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1304 same is true for several rows of widgets. To solve this problem we
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1305 introduce the notion of `logical_unit_height'. This is a size
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1306 quantity that is designed to be big enough to accomodate the
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1307 largest `single height unit'. The function
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1308 widget_logical_unit_height() determines the value of this in
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1309 pixels. It is dependent on the widget face and some combination of
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1310 spacing and border-width. Thus if users specify left or right
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1311 justification in a vertical layout they get something in logical
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1312 units. To simplify this the functions
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1313 `widget-logical-to-character-height' and
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1314 `widget-logical-to-character-width' allow conversion between
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1315 characters and logical units so that frames can be sized
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1316 appropriately. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1317
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1318 /* Query the geometry of a layout widget. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1320 layout_query_geometry (Lisp_Object image_instance, int* width,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1321 int* height, enum image_instance_geometry disp,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1322 Lisp_Object UNUSED (domain))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1324 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1325 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii), rest;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1326 int maxph = 0, maxpw = 0, nitems = 0, ph_adjust = 0;
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1327 int gheight, gwidth, luh;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1328
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1329 /* If we are not initialized then we won't have any children. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1330 if (!IMAGE_INSTANCE_INITIALIZED (ii))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1331 return;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1332
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1333 /* First just set up what we already have. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1334 if (width) *width = IMAGE_INSTANCE_WIDTH (ii);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1335 if (height) *height = IMAGE_INSTANCE_HEIGHT (ii);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1336
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1337 /* If we are not allowed to dynamically size then return. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1338 if (!IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1339 &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1340 !IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1341 return;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1342
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1343 luh = widget_logical_unit_height (ii);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1344
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1345 /* Pick up the border text if we have one. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1346 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1347 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1348 glyph_query_geometry (XCAR (items), &gwidth, &gheight, disp,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1349 image_instance);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1350 ph_adjust = gheight;
1068
9d75b4fe084c [xemacs-hg @ 2002-10-24 14:19:25 by youngs]
youngs
parents: 1065
diff changeset
1351 /* Include text width in vertical layouts. */
9d75b4fe084c [xemacs-hg @ 2002-10-24 14:19:25 by youngs]
youngs
parents: 1065
diff changeset
1352 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_VERTICAL)
9d75b4fe084c [xemacs-hg @ 2002-10-24 14:19:25 by youngs]
youngs
parents: 1065
diff changeset
1353 maxpw = gwidth + BORDER_FIDDLE_FACTOR;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1354 items = XCDR (items);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1355 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1356
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1357 /* Flip through the items to work out how much stuff we have to display */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1358 LIST_LOOP (rest, items)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1359 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1360 Lisp_Object glyph = XCAR (rest);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1361 glyph_query_geometry (glyph, &gwidth, &gheight, disp, image_instance);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1362
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1363 nitems ++;
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1364 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1365 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1366 maxph = max (maxph, gheight);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1367 maxpw += gwidth;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1368 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1369 else
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1370 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1371 maxpw = max (maxpw, gwidth);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1372 maxph += gheight;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1373 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1374 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1376 /* Work out minimum space we need to fit all the items. This could
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1377 have been fixed by the user. */
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1378 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1379 {
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1380 if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)))
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1381 {
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1382 Lisp_Object dynamic_width =
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1383 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii));
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1384 if (INTP (dynamic_width))
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1385 *width = XINT (dynamic_width);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1386 }
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1387 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL)
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1388 {
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1389 *width = maxpw + ((nitems + 1) * widget_instance_border_width (ii) +
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1390 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2;
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1391 }
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1392 else
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1393 {
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1394 *width = maxpw + 2 * (widget_instance_border_width (ii) * 2 +
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1395 IMAGE_INSTANCE_MARGIN_WIDTH (ii));
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1396 }
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1397 }
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1398
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1399 /* Work out vertical spacings. */
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1400 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii))
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1401 {
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1402 if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)))
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1403 {
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1404 Lisp_Object dynamic_height =
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1405 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii));
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1406 if (INTP (dynamic_height))
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1407 *height = XINT (dynamic_height);
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1408 }
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1409 else if (IMAGE_INSTANCE_SUBWINDOW_LOGICAL_LAYOUT (ii))
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1410 {
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1411 *height = nitems * luh + ph_adjust;
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1412 }
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1413 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_VERTICAL)
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1414 {
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1415 *height = maxph + ((nitems + 1) * widget_instance_border_width (ii) +
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1416 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust;
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1417 }
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1418 else
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1419 {
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1420 *height = maxph + (2 * widget_instance_border_width (ii) +
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1421 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust;
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1068
diff changeset
1422 }
1065
332649c64dbc [xemacs-hg @ 2002-10-24 13:44:51 by youngs]
youngs
parents: 872
diff changeset
1423 }
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1424 #ifdef DEBUG_WIDGET_OUTPUT
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1425 stderr_out ("layout wants %dx%d\n", *width, *height);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1426 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1427 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1428
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1429 int
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1430 layout_layout (Lisp_Object image_instance,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1431 int width, int height, int UNUSED (xoffset), int yoffset,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1432 Lisp_Object UNUSED (domain))
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1433 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1434 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1435 Lisp_Object rest;
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1436 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1437 int x, y, maxph = 0, maxpw = 0, nitems = 0,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1438 horiz_spacing, vert_spacing, ph_adjust = 0;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1439 int gheight, gwidth;
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1440 /* See comments in widget_logical_unit_height(). */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1441 int luh = widget_logical_unit_height (ii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1443 /* If we are not initialized then we won't have any children. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1444 if (!IMAGE_INSTANCE_INITIALIZED (ii))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1445 return 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1446
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1447 #ifdef DEBUG_WIDGET_OUTPUT
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1448 stderr_out ("layout output %dx%d\n", width, height);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1449 #endif
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1450
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1451 /* Pick up the border text if we have one. A border can have the
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1452 values Qetched_in, Qetched_out, Qbevel_in, Qbevel_out or an
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1453 integer. The first four just affect the display properties of the
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1454 border that is drawn. The last is an offset and implies that the
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1455 first item in the list of subcontrols is a text control that
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1456 should be displayed on the border. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1457 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1458 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1459 Lisp_Object border = XCAR (items);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1460 items = XCDR (items);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1461 glyph_query_geometry (border, &gwidth, &gheight,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1462 IMAGE_DESIRED_GEOMETRY, image_instance);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1463 /* The vertical offset for subsequent items is the full height
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1464 of the border glyph. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1465 ph_adjust = gheight;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1466 /* The offset for the border is half the glyph height. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1467 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (gheight / 2);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1468
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1469 /* #### Really, what should this be? */
1068
9d75b4fe084c [xemacs-hg @ 2002-10-24 14:19:25 by youngs]
youngs
parents: 1065
diff changeset
1470 glyph_do_layout (border, gwidth, gheight, BORDER_FIDDLE_FACTOR, 0,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1471 image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1472 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1473
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1474 /* Flip through the items to work out how much stuff we have to display. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1475 LIST_LOOP (rest, items)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1476 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1477 Lisp_Object glyph = XCAR (rest);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1478
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1479 glyph_query_geometry (glyph, &gwidth, &gheight,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1480 IMAGE_DESIRED_GEOMETRY, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1481 nitems ++;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1482 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1483 == LAYOUT_HORIZONTAL)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1484 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1485 maxph = max (maxph, gheight);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1486 maxpw += gwidth;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1487 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1488 else
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1489 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1490 maxpw = max (maxpw, gwidth);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1491 maxph += gheight;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1492 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1493 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1494
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1495 /* work out spacing between items and bounds of the layout */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1496 if (width < maxpw)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1497 /* The user wants a smaller space than the largest item, so we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1498 just provide default spacing and will let the output routines
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1499 clip. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1500 horiz_spacing = widget_spacing (IMAGE_INSTANCE_DOMAIN (ii));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1501 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1502 == LAYOUT_HORIZONTAL)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1503 /* We have a larger area to display in so distribute the space
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1504 evenly. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1505 horiz_spacing = (width - (maxpw +
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1506 IMAGE_INSTANCE_MARGIN_WIDTH (ii) * 2))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1507 / (nitems + 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508 else
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1509 horiz_spacing = (width - maxpw) / 2
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1510 - IMAGE_INSTANCE_MARGIN_WIDTH (ii);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1511
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1512 /* We are trying here to get widgets to line up when they are left
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1513 or right justified vertically. This means that we must position
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1514 widgets on logical unit boundaries, even though their height may
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1515 be greater or less than a logical unit. In order to avoid
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1516 clipping we need to determine how big the widget wants to be and
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1517 then allocate as many logical units as necessary in order to
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1518 accommodate it. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1519 if (height < maxph)
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1520 vert_spacing = widget_spacing (IMAGE_INSTANCE_DOMAIN (ii)) * 2;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1521 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1522 == LAYOUT_VERTICAL)
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1523 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1524 if (!IMAGE_INSTANCE_SUBWINDOW_V_CENTERED (ii))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1525 vert_spacing = widget_spacing (IMAGE_INSTANCE_DOMAIN (ii)) * 2;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1526 else
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1527 vert_spacing = (height - (maxph + ph_adjust +
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1528 IMAGE_INSTANCE_MARGIN_WIDTH (ii) * 2))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1529 / (nitems + 1);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1530 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531 else
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1532 vert_spacing = (height - (maxph + ph_adjust)) / 2
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1533 - IMAGE_INSTANCE_MARGIN_WIDTH (ii);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1535 y = yoffset = vert_spacing + ph_adjust + IMAGE_INSTANCE_MARGIN_WIDTH (ii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1536 x = horiz_spacing + IMAGE_INSTANCE_MARGIN_WIDTH (ii);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1537
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 /* Now flip through putting items where we want them, paying
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1539 attention to justification. Make sure we don't mess with the
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1540 border glyph. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1541 LIST_LOOP (rest, items)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1542 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 Lisp_Object glyph = XCAR (rest);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1545 glyph_query_geometry (glyph, &gwidth, &gheight,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1546 IMAGE_DESIRED_GEOMETRY, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1547
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1548 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1549 {
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1550 if (IMAGE_INSTANCE_SUBWINDOW_BOTTOM_JUSTIFIED (ii))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1551 y = height - (gheight + vert_spacing);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1552 else if (IMAGE_INSTANCE_SUBWINDOW_V_CENTERED (ii))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1553 y = (height - gheight) / 2;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1554 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1555 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1556 {
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1557 if (IMAGE_INSTANCE_SUBWINDOW_RIGHT_JUSTIFIED (ii))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1558 x = width - (gwidth + horiz_spacing);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1559 else if (IMAGE_INSTANCE_SUBWINDOW_H_CENTERED (ii))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1560 x = (width - gwidth) / 2;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1561 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1562
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1563 /* Now layout subwidgets if they require it. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1564 glyph_do_layout (glyph, gwidth, gheight, x, y, image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1565
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1566 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1567 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1568 x += (gwidth + horiz_spacing);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1569 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1570 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1571 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1572 y += (gheight + vert_spacing);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1573 if (!IMAGE_INSTANCE_SUBWINDOW_V_CENTERED (ii))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1574 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1575 /* justified, vertical layout, try and align on logical unit
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1576 boundaries. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1577 y = ROUND_UP (y - yoffset, luh) + yoffset;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1578 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1579 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1580
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1581 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1582 return 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1583 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1584
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1585 /* Get the glyphs that comprise a layout. These are created internally
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1586 and so are otherwise inaccessible to lisp. We need some way of getting
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1587 properties from the widgets that comprise a layout and this is the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1588 simplest way of doing it.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1590 #### Eventually we should allow some more intelligent access to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1591 sub-widgets. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1592 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1593 layout_property (Lisp_Object image_instance, Lisp_Object prop)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1594 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1595 /* This function can GC. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1596 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1597 if (EQ (prop, Q_items))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1598 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1599 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1600 CONSP (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1601 return Fcopy_sequence (XCDR
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1602 (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii)));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1603 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1604 return Fcopy_sequence (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1606 return Qunbound;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1607 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1609 /* Layout subwindows if they are real subwindows. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1610 static int
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1611 native_layout_layout (Lisp_Object image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1612 int width, int height, int xoffset, int yoffset,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1613 Lisp_Object domain)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1614 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1615 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1616 Lisp_Object rest;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1617
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1618 /* The first time this gets called, the layout will be only
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1619 partially instantiated. The children get done in
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1620 post_instantiate. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1621 if (!IMAGE_INSTANCE_INITIALIZED (ii))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1622 return 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1623
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1624 /* Defining this overrides the default layout_layout so we first have to call that to get
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1625 suitable instances and values set up. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1626 layout_layout (image_instance, width, height, xoffset, yoffset, domain);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1627
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1628 LIST_LOOP (rest, IMAGE_INSTANCE_LAYOUT_CHILDREN (ii))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1629 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1630 struct display_glyph_area dga;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1631 dga.xoffset = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1632 dga.yoffset = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1633 dga.width = IMAGE_INSTANCE_WIDTH (ii);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1634 dga.height = IMAGE_INSTANCE_HEIGHT (ii);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1635
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1636 map_subwindow (XCAR (rest),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1637 IMAGE_INSTANCE_XOFFSET (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1638 IMAGE_INSTANCE_YOFFSET (ii), &dga);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1639 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1640 return 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1643 DEFUN ("widget-logical-to-character-width", Fwidget_logical_to_character_width, 1, 3, 0, /*
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1644 Convert the width in logical widget units to characters.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1645 Logical widget units do not take into account adjusments made for
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1646 layout borders, so this adjusment is approximated.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1647 */
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1648 (width, UNUSED (face), domain))
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1649 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1650 int w, neww, charwidth;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1651 int border_width = DEFAULT_WIDGET_BORDER_WIDTH;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1652
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1653 if (NILP (domain))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1654 domain = Fselected_frame (Qnil);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1655
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1656 CHECK_INT (width);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1657 w = XINT (width);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1658
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1659 if (HAS_DEVMETH_P (DOMAIN_XDEVICE (domain), widget_border_width))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1660 border_width = DEVMETH (DOMAIN_XDEVICE (domain), widget_border_width, ());
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1661
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1662 default_face_font_info (domain, 0, 0, 0, &charwidth, 0);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1663 neww = ROUND_UP (charwidth * w + 4 * border_width + 2 * widget_spacing (domain),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1664 charwidth) / charwidth;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1665
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1666 return make_int (neww);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1667 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1668
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1669 DEFUN ("widget-logical-to-character-height", Fwidget_logical_to_character_height, 1, 3, 0, /*
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1670 Convert the height in logical widget units to characters.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1671 Logical widget units do not take into account adjusments made for
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1672 layout borders, so this adjustment is approximated.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1673
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1674 If the components of a widget layout are justified to the top or the
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1675 bottom then they are aligned in terms of `logical units'. This is a
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1676 size quantity that is designed to be big enough to accomodate the
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1677 largest `single height' widget. It is dependent on the widget face and
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1678 some combination of spacing and border-width. Thus if you specify top
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1679 or bottom justification in a vertical layout the subcontrols are laid
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1680 out one per logical unit. This allows adjoining layouts to have
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1681 identical alignment for their subcontrols.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1682
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1683 Since frame sizes are measured in characters, this function allows you
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1684 to do appropriate conversion between logical units and characters.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1685 */
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1686 (height, UNUSED (face), domain))
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1687 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1688 int h, newh, charheight;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1689
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1690 CHECK_INT (height);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1691 if (NILP (domain))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1692 domain = Fselected_frame (Qnil);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1693
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1694 h = XINT (height);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1695
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1696 default_face_font_info (domain, 0, 0, &charheight, 0, 0);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1697 newh = ROUND_UP (logical_unit_height (Fsymbol_name (Qwidget),
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1698 Vwidget_face, domain) * h, charheight)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1699 / charheight;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1700
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1701 return make_int (newh);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1702 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1703
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1705 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1706 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1709 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1710 syms_of_glyphs_widget (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1711 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1712 DEFSYMBOL (Qetched_in);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1713 DEFSYMBOL (Qetched_out);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1714 DEFSYMBOL (Qbevel_in);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1715 DEFSYMBOL (Qbevel_out);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1716 DEFSYMBOL (Qmake_glyph);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1717
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1718 DEFSUBR (Fwidget_logical_to_character_height);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1719 DEFSUBR (Fwidget_logical_to_character_width);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1720 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1721
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1722 #define VALID_GUI_KEYWORDS(type) do { \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1723 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_active, check_valid_anything); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1724 IIFORMAT_VALID_KEYWORD (type, Q_suffix, check_valid_anything); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1725 IIFORMAT_VALID_KEYWORD (type, Q_keys, check_valid_string); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1726 IIFORMAT_VALID_KEYWORD (type, Q_style, check_valid_symbol); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1727 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_selected, check_valid_anything); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1728 IIFORMAT_VALID_KEYWORD (type, Q_filter, check_valid_anything); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1729 IIFORMAT_VALID_KEYWORD (type, Q_config, check_valid_symbol); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1730 IIFORMAT_VALID_KEYWORD (type, Q_included, check_valid_anything); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1731 IIFORMAT_VALID_KEYWORD (type, Q_initial_focus, check_valid_anything); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1732 IIFORMAT_VALID_KEYWORD (type, Q_key_sequence, check_valid_string); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1733 IIFORMAT_VALID_KEYWORD (type, Q_accelerator, check_valid_string); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1734 IIFORMAT_VALID_KEYWORD (type, Q_label, check_valid_anything); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1735 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_callback, check_valid_callback); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1736 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_callback_ex, check_valid_callback); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1737 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_descriptor, \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1738 check_valid_string_or_vector); \
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1739 } while (0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1740
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1741 #define VALID_WIDGET_KEYWORDS(type) do { \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1742 IIFORMAT_VALID_KEYWORD (type, Q_width, check_valid_int); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1743 IIFORMAT_VALID_KEYWORD (type, Q_height, check_valid_int); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1744 IIFORMAT_VALID_KEYWORD (type, Q_pixel_width, check_valid_int_or_function); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1745 IIFORMAT_VALID_KEYWORD (type, Q_pixel_height, check_valid_int_or_function); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1746 IIFORMAT_VALID_KEYWORD (type, Q_face, check_valid_face); \
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1747 } while (0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1748
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1749
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1750 static void image_instantiator_widget (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1751 { /* we only do this for properties */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1752 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM (widget, "widget");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1753 IIFORMAT_HAS_METHOD (widget, property);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1754 IIFORMAT_HAS_METHOD (widget, update);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
1755 IIFORMAT_HAS_METHOD (widget, query_geometry);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
1756 IIFORMAT_HAS_METHOD (widget, layout);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1757 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1758
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1759 static void image_instantiator_buttons (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1760 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1761 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (button, "button");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1762 IIFORMAT_HAS_SHARED_METHOD (button, validate, widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1763 IIFORMAT_HAS_SHARED_METHOD (button, possible_dest_types, widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1764 IIFORMAT_HAS_SHARED_METHOD (button, instantiate, widget);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1765 IIFORMAT_HAS_SHARED_METHOD (button, post_instantiate, widget);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1766 IIFORMAT_HAS_SHARED_METHOD (button, normalize, widget);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1767 IIFORMAT_HAS_SHARED_METHOD (button, governing_domain, subwindow);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1768 IIFORMAT_HAS_METHOD (button, query_geometry);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1769 IIFORMAT_VALID_KEYWORD (button,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1770 Q_image, check_valid_instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1771 VALID_WIDGET_KEYWORDS (button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1772 VALID_GUI_KEYWORDS (button);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1773 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1774
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1775 static void image_instantiator_edit_fields (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1776 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1777 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit_field, "edit-field");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1778 IIFORMAT_HAS_SHARED_METHOD (edit_field, validate, widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1779 IIFORMAT_HAS_SHARED_METHOD (edit_field, possible_dest_types, widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1780 IIFORMAT_HAS_SHARED_METHOD (edit_field, instantiate, widget);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1781 IIFORMAT_HAS_SHARED_METHOD (edit_field, post_instantiate, widget);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1782 IIFORMAT_HAS_SHARED_METHOD (edit_field, governing_domain, subwindow);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1783 IIFORMAT_HAS_METHOD (edit_field, query_geometry);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1784 VALID_WIDGET_KEYWORDS (edit_field);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1785 VALID_GUI_KEYWORDS (edit_field);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1786 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1787
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1788 static void image_instantiator_combo_box (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1789 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1790 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo_box, "combo-box");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1791 IIFORMAT_HAS_METHOD (combo_box, validate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1792 IIFORMAT_HAS_SHARED_METHOD (combo_box, possible_dest_types, widget);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1793 IIFORMAT_HAS_SHARED_METHOD (combo_box, governing_domain, subwindow);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1794
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 VALID_GUI_KEYWORDS (combo_box);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1796
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1797 IIFORMAT_VALID_KEYWORD (combo_box, Q_width, check_valid_int);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1798 IIFORMAT_VALID_KEYWORD (combo_box, Q_height, check_valid_int);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1799 IIFORMAT_VALID_KEYWORD (combo_box, Q_pixel_width,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1800 check_valid_int_or_function);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1801 IIFORMAT_VALID_KEYWORD (combo_box, Q_face, check_valid_face);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1802 IIFORMAT_VALID_KEYWORD (combo_box, Q_items, check_valid_item_list);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1803 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1804
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1805 static void image_instantiator_scrollbar (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1806 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1807 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (scrollbar, "scrollbar");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1808 IIFORMAT_HAS_SHARED_METHOD (scrollbar, validate, widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1809 IIFORMAT_HAS_SHARED_METHOD (scrollbar, possible_dest_types, widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1810 IIFORMAT_HAS_SHARED_METHOD (scrollbar, instantiate, widget);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1811 IIFORMAT_HAS_SHARED_METHOD (scrollbar, post_instantiate, widget);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1812 IIFORMAT_HAS_SHARED_METHOD (scrollbar, governing_domain, subwindow);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1813 VALID_GUI_KEYWORDS (scrollbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1814
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1815 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_width,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1816 check_valid_int_or_function);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1817 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_height,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1818 check_valid_int_or_function);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1819 IIFORMAT_VALID_KEYWORD (scrollbar, Q_face, check_valid_face);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1820 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1821
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1822 static void image_instantiator_progress_guage (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1823 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1824 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge, "progress-gauge");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1825 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, validate, widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1826 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, possible_dest_types, widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1827 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, instantiate, widget);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1828 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, post_instantiate, widget);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1829 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, governing_domain, subwindow);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1830 VALID_WIDGET_KEYWORDS (progress_gauge);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1831 VALID_GUI_KEYWORDS (progress_gauge);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1832
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1833 IIFORMAT_VALID_KEYWORD (progress_gauge, Q_value, check_valid_int);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1834 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1835
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1836 static void image_instantiator_tree_view (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1837 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree_view, "tree-view");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1839 IIFORMAT_HAS_SHARED_METHOD (tree_view, validate, combo_box);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1840 IIFORMAT_HAS_SHARED_METHOD (tree_view, possible_dest_types, widget);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
1841 IIFORMAT_HAS_SHARED_METHOD (tree_view, instantiate, widget);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1842 IIFORMAT_HAS_SHARED_METHOD (tree_view, post_instantiate, widget);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1843 IIFORMAT_HAS_SHARED_METHOD (tree_view, governing_domain, subwindow);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
1844 IIFORMAT_HAS_METHOD (tree_view, query_geometry);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1845 VALID_WIDGET_KEYWORDS (tree_view);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846 VALID_GUI_KEYWORDS (tree_view);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1847 IIFORMAT_VALID_KEYWORD (tree_view, Q_items, check_valid_item_list);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1848 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1849
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1850 static void image_instantiator_tab_control (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1851 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1852 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab_control, "tab-control");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1853 IIFORMAT_HAS_SHARED_METHOD (tab_control, validate, combo_box);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 IIFORMAT_HAS_SHARED_METHOD (tab_control, possible_dest_types, widget);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
1855 IIFORMAT_HAS_SHARED_METHOD (tab_control, instantiate, widget);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1856 IIFORMAT_HAS_SHARED_METHOD (tab_control, post_instantiate, widget);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1857 IIFORMAT_HAS_SHARED_METHOD (tab_control, governing_domain, subwindow);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
1858 IIFORMAT_HAS_METHOD (tab_control, query_geometry);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 VALID_WIDGET_KEYWORDS (tab_control);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1860 VALID_GUI_KEYWORDS (tab_control);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1861 IIFORMAT_VALID_KEYWORD (tab_control, Q_orientation,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1862 check_valid_tab_orientation);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1863 IIFORMAT_VALID_KEYWORD (tab_control, Q_items, check_valid_item_list);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1864 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1865
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1866 static void image_instantiator_labels (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1867 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1868 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label, "label");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869 IIFORMAT_HAS_SHARED_METHOD (label, possible_dest_types, widget);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
1870 IIFORMAT_HAS_SHARED_METHOD (label, instantiate, widget);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1871 IIFORMAT_HAS_SHARED_METHOD (label, post_instantiate, widget);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1872 IIFORMAT_HAS_SHARED_METHOD (label, governing_domain, subwindow);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873 VALID_WIDGET_KEYWORDS (label);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1874 IIFORMAT_VALID_KEYWORD (label, Q_descriptor, check_valid_string);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1875 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1876
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1877 #define VALID_LAYOUT_KEYWORDS(layout) \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1878 VALID_WIDGET_KEYWORDS (layout); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1879 IIFORMAT_VALID_KEYWORD (layout, Q_orientation, check_valid_orientation); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1880 IIFORMAT_VALID_KEYWORD (layout, Q_justify, check_valid_justification); \
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1881 IIFORMAT_VALID_KEYWORD (layout, Q_vertically_justify, check_valid_justification); \
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1882 IIFORMAT_VALID_KEYWORD (layout, Q_horizontally_justify, check_valid_justification); \
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1883 IIFORMAT_VALID_KEYWORD (layout, Q_border, check_valid_border); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1884 IIFORMAT_VALID_KEYWORD (layout, Q_margin_width, check_valid_int); \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1885 IIFORMAT_VALID_KEYWORD (layout, Q_items, \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1886 check_valid_instantiator_list)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1887
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1888 static void image_instantiator_layout (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1889 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1890 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (layout, "layout");
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1891 IIFORMAT_HAS_SHARED_METHOD (layout, possible_dest_types, widget);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1892 IIFORMAT_HAS_METHOD (layout, instantiate);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1893 IIFORMAT_HAS_METHOD (layout, post_instantiate);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1894 IIFORMAT_HAS_SHARED_METHOD (layout, governing_domain, subwindow);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1895 IIFORMAT_HAS_METHOD (layout, normalize);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1896 IIFORMAT_HAS_METHOD (layout, query_geometry);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1897 IIFORMAT_HAS_METHOD (layout, layout);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1898 IIFORMAT_HAS_METHOD (layout, update);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1899 IIFORMAT_HAS_METHOD (layout, property);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1900
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1901 VALID_GUI_KEYWORDS (layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1902 VALID_LAYOUT_KEYWORDS (layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1903 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1904
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1905 static void image_instantiator_native_layout (void)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1906 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1907 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (native_layout, "native-layout");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1908 IIFORMAT_HAS_SHARED_METHOD (native_layout, possible_dest_types, widget);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1909 IIFORMAT_HAS_SHARED_METHOD (native_layout, instantiate, layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1910 IIFORMAT_HAS_SHARED_METHOD (native_layout, post_instantiate, layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1911 IIFORMAT_HAS_METHOD (native_layout, layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1912 IIFORMAT_HAS_SHARED_METHOD (native_layout, governing_domain, subwindow);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1913 IIFORMAT_HAS_SHARED_METHOD (native_layout, normalize, layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1914 IIFORMAT_HAS_SHARED_METHOD (native_layout, query_geometry, layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1915 IIFORMAT_HAS_SHARED_METHOD (native_layout, layout, layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1916 IIFORMAT_HAS_SHARED_METHOD (native_layout, property, layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1917
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1918 VALID_GUI_KEYWORDS (native_layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1919 VALID_LAYOUT_KEYWORDS (native_layout);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1920 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1921
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1922 void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1923 image_instantiator_format_create_glyphs_widget (void)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1924 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1925 image_instantiator_widget();
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1926 image_instantiator_buttons();
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1927 image_instantiator_edit_fields();
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1928 image_instantiator_combo_box();
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1929 image_instantiator_scrollbar();
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1930 image_instantiator_progress_guage();
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1931 image_instantiator_tree_view();
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1932 image_instantiator_tab_control();
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1933 image_instantiator_labels();
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1934 image_instantiator_layout();
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1935 image_instantiator_native_layout();
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1936 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1937
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1938 void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1939 reinit_vars_of_glyphs_widget (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 #ifdef DEBUG_WIDGETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942 debug_widget_instances = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1943 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1944 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1945
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1946 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1947 vars_of_glyphs_widget (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1948 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1949 }
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1950
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1951
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1952 void
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1953 specifier_vars_of_glyphs_widget (void)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1954 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1955 DEFVAR_SPECIFIER ("widget-border-width",
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1956 &Vwidget_border_width /*
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1957 *Border width of widgets.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1958 This is a specifier; use `set-specifier' to change it.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1959 */ );
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1960 Vwidget_border_width = Fmake_specifier (Qnatnum);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1961 }