annotate src/dialog.c @ 407:ed6218a7d4d3

Added tag r21-2-33 for changeset b8cc9ab3f761
author cvs
date Mon, 13 Aug 2007 11:17:10 +0200
parents 2f8bb876ab1d
children 697ef44129c6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Implements elisp-programmable dialog boxes -- generic.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #include "lisp.h"
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
26 #include "frame.h"
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
27 #include "device.h"
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
28
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
29 DEFUN ("popup-dialog-box", Fpopup_dialog_box, 1, 1, 0, /*
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
30 Pop up a dialog box.
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
31 A dialog box description is a list.
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
32
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
33 The first element of a dialog box must be a string, which is the title or
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
34 question.
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
35
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
36 The rest of the elements are descriptions of the dialog box's buttons.
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
37 Each of these is a vector, the syntax of which is essentially the same as
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
38 that of popup menu items. They may have any of the following forms:
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
39
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
40 [ "name" callback <active-p> ]
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
41 [ "name" callback <active-p> "suffix" ]
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
42 [ "name" callback :<keyword> <value> :<keyword> <value> ... ]
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
43
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
44 The name is the string to display on the button; it is filtered through the
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
45 resource database, so it is possible for resources to override what string
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
46 is actually displayed.
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
47
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 286
diff changeset
48 Accelerators can be indicated in the string by putting the sequence
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 286
diff changeset
49 "%_" before the character corresponding to the key that will invoke
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 286
diff changeset
50 the button. Uppercase and lowercase accelerators are equivalent. The
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 286
diff changeset
51 sequence "%%" is also special, and is translated into a single %.
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 286
diff changeset
52
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
53 If the `callback' of a button is a symbol, then it must name a command.
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
54 It will be invoked with `call-interactively'. If it is a list, then it is
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
55 evaluated with `eval'.
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
56
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
57 One (and only one) of the buttons may be `nil'. This marker means that all
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
58 following buttons should be flushright instead of flushleft.
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
59
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
60 Though the keyword/value syntax is supported for dialog boxes just as in
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
61 popup menus, the only keyword which is both meaningful and fully implemented
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 286
diff changeset
62 for dialog box buttons is `:active'. */
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
63 (dbox_desc))
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
64 {
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
65 struct frame *f = selected_frame ();
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
66 struct device *d = XDEVICE (f->device);
286
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
67
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
68 if (!HAS_DEVMETH_P (d, popup_dialog_box))
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
69 signal_simple_error ("Device does not support dialogs", f->device);
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
70
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
71 if (SYMBOLP (dbox_desc))
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
72 dbox_desc = Fsymbol_value (dbox_desc);
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
73 CHECK_CONS (dbox_desc);
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
74 CHECK_STRING (XCAR (dbox_desc));
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
75 if (!CONSP (XCDR (dbox_desc)))
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 286
diff changeset
76 signal_simple_error ("Dialog descriptor must supply at least one button",
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 286
diff changeset
77 dbox_desc);
286
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
78
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 284
diff changeset
79 DEVMETH (d, popup_dialog_box, (f, dbox_desc));
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
80
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
81 return Qnil;
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
82 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 syms_of_dialog (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 {
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 0
diff changeset
87 DEFSUBR (Fpopup_dialog_box);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 vars_of_dialog (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 Fprovide (intern ("dialog"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 }