-*- indented-text -*-
to 21.2.18 "Toshima"
+-- console features implementation from Andy Piper.
+-- glyph widget support under X/Motif from Andy Piper
-- Make docdir configurable, update package searching rules from Michael
Sperber
-- Fix for Japanese word/character movements from MORIOKA Tomohiko
------------------------
In addition to the system wide packages, each user can have his own
-packages installed in "~/.xemacs/packages". If you want to
+packages installed in "~/.xemacs/xemacs-packages". If you want to
install packages there using the interactive tools, you need to set
-'pui-package-install-dest-dir' to "~/xemacs/packages"
+'pui-package-install-dest-dir' to "~/.xemacs/xemacs-packages"
Site lisp/Site start
--------------------
** The font-menu is now available under MS-Windows
+** MS-Windows support for selection is much more robust
+
+Generally selection should now do what you would expect under
+MS-Windows: the middle mouse button will paste your current selection
+or the clipboard; conversions from different types of selection to the
+clipboard can be made; the kill-ring and friends will be updated as
+per X.
+
+The only thing selection doesn't do is set the clipboard automatically
+as this would break the MS-Windows model. If you want this behaviour
+then set `selection-sets-clipboard' to t
+
\f
* Lisp and internal changes in XEmacs 21.2
==========================================
+1999-06-25 Charles G Waldman <cgw@fnal.gov>
+
+ * cus-face.el (custom-face-italic): insert missing args
+
+1999-06-24 Michael Sperber [Mr. Preprocessor] <sperber@informatik.uni-tuebingen.de>
+
+ * packages.el (package-locations): Changed default early package
+ hierarchies to ~/.xemacs/mule-packages and
+ ~/.xemacs/xemacs-packages.
+
1999-06-23 SL Baur <steve@miho.m17n.org>
* mule/mule-category.el (Top Level): ASCII is also latin-1.
(defun custom-face-italic (face &rest args)
"Return non-nil if the font of FACE is italic."
- (let* ((font (apply 'face-font-name face))
+ (let* ((font (apply 'face-font-name face args))
;; Gag
(fontobj (font-create-object font)))
(font-italic-p fontobj)))
(defvar package-locations
(list
- (list (paths-construct-path '("~" ".xemacs"))
+ (list (paths-construct-path '("~" ".xemacs" "mule-packages"))
+ 'early #'(lambda () (featurep 'mule)))
+ (list (paths-construct-path '("~" ".xemacs" "xemacs-packages"))
'early #'(lambda () t))
(list "site-packages" 'late #'(lambda () t))
(list "infodock-packages" 'late #'(lambda () (featurep 'infodock)))
(list "mule-packages" 'late #'(lambda () (featurep 'mule)))
- (list "xemacs-packages" 'late #'(lambda () t))
- (list "packages" 'late #'(lambda () t)))
+ (list "xemacs-packages" 'late #'(lambda () t)))
"Locations of the various package directories.
This is a list each of whose elements describes one directory.
A directory description is a three-element list.
+1999-06-28 Andy Piper <andy@xemacs.org>
+
+ * lwlib-Xm.c: unconditionally enable text field & list code.
+ (make_progress): new function. creates a slider.
+ (make_text_field): new function. creates an edit field.
+ (make_combo_box): new function. creates a combo box.
+ (xm_creation_table): add new widget functions.
+
+1999-06-25 Andy Piper <andy@xemacs.org>
+
+ * lwlib.h (_widget_value): add arglist slots.
+ declare new functions.
+
+ * lwlib.c (free_widget_value_contents): handle arglists when
+ freeing.
+ (lw_add_value_args_to_args): new function. add arglist entries
+ from a widget_value structure.
+
+ * lwlib-Xm.c (make_button): new function, create a motif button
+ for display in a buffer as a glyph.
+ (xm_creation_table): add make_button.
+
1999-06-22 XEmacs Build Bot <builds@cvs.xemacs.org>
* XEmacs 21.2.17 is released
#include <Xm/Separator.h>
#include <Xm/DialogS.h>
#include <Xm/Form.h>
+#include <Xm/Scale.h>
+#if XmVERSION > 1
+#include <Xm/ComboBox.h>
+#endif
#ifdef LWLIB_MENUBARS_MOTIF
static void xm_pull_down_callback (Widget, XtPointer, XtPointer);
-#if 0
-static void xm_pop_down_callback (Widget, XtPointer, XtPointer);
-#endif /* 0 */
#endif
static void xm_internal_update_other_instances (Widget, XtPointer,
XtPointer);
+static void xm_pop_down_callback (Widget, XtPointer, XtPointer);
static void xm_generic_callback (Widget, XtPointer, XtPointer);
#ifdef LWLIB_DIALOGS_MOTIF
static void xm_nosel_callback (Widget, XtPointer, XtPointer);
#endif /* LWLIB_MENUBARS_MOTIF */
\f
-#ifdef LWLIB_DIALOGS_MOTIF
-
/* update text widgets */
static void
xm_internal_update_other_instances, instance);
}
-#endif /* LWLIB_DIALOGS_MOTIF */
#ifdef LWLIB_SCROLLBARS_MOTIF
XtSetArg (al [1], XmNuserData, val->call_data);
XtSetValues (widget, al, 2);
-#if defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF)
/* Common to all label like widgets */
if (XtIsSubclass (widget, xmLabelWidgetClass))
xm_update_label (instance, widget, val);
-#endif
class = XtClass (widget);
/* Class specific things */
xm_update_menu (instance, widget, val, deep_p);
#endif
}
-#ifdef LWLIB_DIALOGS_MOTIF
else if (class == xmTextWidgetClass)
{
xm_update_text (instance, widget, val);
{
xm_update_text_field (instance, widget, val);
}
-#endif
else if (class == xmListWidgetClass)
{
xm_update_list (instance, widget, val);
XtGetValues (widget, al, 1);
val->edited = True;
}
-#ifdef LWLIB_DIALOGS_MOTIF
else if (class == xmTextWidgetClass)
{
if (val->value)
val->value = XmTextFieldGetString (widget);
val->edited = True;
}
-#endif
else if (class == xmRowColumnWidgetClass)
{
Boolean radiobox = 0;
/* This function is for activating a button from a program. It's wrong because
we pass a NULL argument in the call_data which is not Motif compatible.
This is used from the XmNdefaultAction callback of the List widgets to
- have a dble-click put down a dialog box like the button woudl do.
+ have a double-click put down a dialog box like the button would do.
I could not find a way to do that with accelerators.
*/
static void
#endif /* LWLIB_SCROLLBARS_MOTIF */
-\f/* Table of functions to create widgets */
+/* glyph widgets */
+static Widget
+make_button (widget_instance *instance)
+{
+ Arg al[20];
+ int ac = 0;
+ Widget button = 0;
+ widget_value* val = instance->info->val;
+
+ XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+ XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
+ XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
+ /* The highlight doesn't appear to be dynamically set which makes it
+ look ugly. I think this may be a LessTif bug but for now we just
+ get rid of it. */
+ XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ if (!val->call_data)
+ button = XmCreateLabel (instance->parent, val->name, al, ac);
+
+ else if (val->type == TOGGLE_TYPE || val->type == RADIO_TYPE)
+ {
+ XtSetArg (al [ac], XmNset, val->selected); ac++;
+ XtSetArg (al [ac], XmNindicatorType,
+ (val->type == TOGGLE_TYPE ?
+ XmN_OF_MANY : XmONE_OF_MANY)); ac++;
+ XtSetArg (al [ac], XmNvisibleWhenOff, True); ac++;
+ button = XmCreateToggleButton (instance->parent, val->name, al, ac);
+ XtRemoveAllCallbacks (button, XmNvalueChangedCallback);
+ XtAddCallback (button, XmNvalueChangedCallback, xm_generic_callback,
+ (XtPointer)instance);
+ }
+ else
+ {
+ button = XmCreatePushButton (instance->parent, val->name, al, ac);
+ XtAddCallback (button, XmNactivateCallback, xm_generic_callback,
+ (XtPointer)instance);
+ }
+
+ XtManageChild (button);
+
+ return button;
+}
+
+static Widget
+make_progress (widget_instance *instance)
+{
+ Arg al[20];
+ int ac = 0;
+ Widget scale = 0;
+ widget_value* val = instance->info->val;
+
+ XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+ XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
+ XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
+ XtSetArg (al [ac], XmNorientation, XmHORIZONTAL); ac++;
+ /* The highlight doesn't appear to be dynamically set which makes it
+ look ugly. I think this may be a LessTif bug but for now we just
+ get rid of it. */
+ XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+ if (!val->call_data)
+ XtSetArg (al [ac], XmNsensitive, False); ac++;
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ scale = XmCreateScale (instance->parent, val->name, al, ac);
+ if (val->call_data)
+ XtAddCallback (scale, XmNvalueChangedCallback, xm_generic_callback,
+ (XtPointer)instance);
+
+ XtManageChild (scale);
+
+ return scale;
+}
+
+static Widget
+make_text_field (widget_instance *instance)
+{
+ Arg al[20];
+ int ac = 0;
+ Widget text = 0;
+ widget_value* val = instance->info->val;
+
+ XtSetArg (al [ac], XmNsensitive, val->enabled && val->call_data); ac++;
+ XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+ XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
+ XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
+ /* The highlight doesn't appear to be dynamically set which makes it
+ look ugly. I think this may be a LessTif bug but for now we just
+ get rid of it. */
+ XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ text = XmCreateTextField (instance->parent, val->name, al, ac);
+ if (val->call_data)
+ XtAddCallback (text, XmNvalueChangedCallback, xm_generic_callback,
+ (XtPointer)instance);
+
+ XtManageChild (text);
+
+ return text;
+}
+
+#if XmVERSION > 1
+static Widget
+make_combo_box (widget_instance *instance)
+{
+ Arg al[20];
+ int ac = 0;
+ Widget combo = 0;
+ widget_value* val = instance->info->val;
+
+ XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+ XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
+ XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
+ /* The highlight doesn't appear to be dynamically set which makes it
+ look ugly. I think this may be a LessTif bug but for now we just
+ get rid of it. */
+ XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ combo = XmCreateComboBox (instance->parent, val->name, al, ac);
+ if (val->call_data)
+ XtAddCallback (combo, XmNselectionCallback, xm_generic_callback,
+ (XtPointer)instance);
+
+ XtManageChild (combo);
+
+ return combo;
+}
+#endif
+
+\f
+/* Table of functions to create widgets */
widget_creation_entry
xm_creation_table [] =
{"vertical-scrollbar", make_vertical_scrollbar},
{"horizontal-scrollbar", make_horizontal_scrollbar},
#endif
+ {"button", make_button},
+ {"progress", make_progress},
+ {"text-field", make_text_field},
+#if XmVERSION > 1
+ {"combo-box", make_combo_box},
+#endif
{NULL, NULL}
};
do_call (widget, closure, selection);
}
+static void
+xm_pop_down_callback (Widget widget, XtPointer closure, XtPointer call_data)
+{
+ do_call (widget, closure, post_activate);
+}
+
#ifdef LWLIB_DIALOGS_MOTIF
static void
do_call (widget, closure, pre_activate);
}
-#if 0
-static void
-xm_pop_down_callback (Widget widget, XtPointer closure, XtPointer call_data)
-{
- do_call (widget, closure, post_activate);
-}
-#endif /* 0 */
-
#endif /* LWLIB_MENUBARS_MOTIF */
#ifdef LWLIB_SCROLLBARS_MOTIF
free_widget_value_tree (wv->contents);
wv->contents = (widget_value *) 0xDEADBEEF;
}
+ if (wv->args && wv->free_args)
+ {
+ free (wv->args);
+ wv->args = (void *) 0xDEADBEEF;
+ wv->nargs = 0;
+ }
if (wv->next)
{
free_widget_value_tree (wv->next);
copy->next = copy_widget_value_tree (val->next, change);
copy->toolkit_data = NULL;
copy->free_toolkit_data = False;
+ if (val->nargs)
+ {
+ copy->args = (ArgList)malloc (sizeof (Arg) * val->nargs);
+ memcpy (copy->args, val->args, sizeof(Arg) * val->nargs);
+ copy->nargs = val->nargs;
+ copy->free_args = True;
+ }
#ifdef NEED_SCROLLBARS
copy_scrollbar_values (val, copy);
#endif
}
}
}
+
+void lw_add_value_args_to_args (widget_value* wv, ArgList addto, int* offset)
+{
+ int i;
+ if (wv->nargs && wv->args)
+ {
+ for (i = 0; i<wv->nargs; i++)
+ {
+ addto[i + *offset] = wv->args[i];
+ }
+ *offset += wv->nargs;
+ }
+}
scrollbar_values *scrollbar_data;
/* we resource the widget_value structures; this points to the next
- one on the free list if this one has been deallocated.
- */
+ one on the free list if this one has been deallocated. */
struct _widget_value *free_list;
+
+ /* some things are only possible at creation time. args are applied
+ to widgets at creation time. */
+ ArgList args;
+ int nargs;
+ Boolean free_args;
} widget_value;
Boolean lw_get_some_values (LWLIB_ID id, widget_value* val);
void lw_pop_up_all_widgets (LWLIB_ID id);
void lw_pop_down_all_widgets (LWLIB_ID id);
+void lw_add_value_args_to_args (widget_value* wv, ArgList addto, int* offset);
widget_value *malloc_widget_value (void);
void free_widget_value (widget_value *);
@subsection Manual Binary Package Installation
Pre-compiled, binary packages can be installed in either a system
-package directory (this is determined when XEmacs is compiled), or in a
-subdirectory of your @file{$HOME} directory:
+package directory (this is determined when XEmacs is compiled), or in
+one of the following
+subdirectories of your @file{$HOME} directory:
@example
-~/.xemacs/packages
+~/.xemacs/mule-packages
+~/.xemacs/xemacs-packages
@end example
+Packages in the former directory will only be found by a Mule-enabled
+XEmacs.
+
XEmacs does not have to be running to install binary packages, although
XEmacs will not know about any newly-installed packages until you
restart XEmacs. Note, however, that installing a newer version of a
Download the package(s) that you want to install. Each binary package
will typically be a gzip'd tarball.
-@item
-Decide where to install the packages: in the system package directory,
-or in @file{~/.xemacs/packages}. If you want to install the
-packages in the system package directory, make sure you can write into
-that directory. If you want to install in your @file{$HOME} directory,
-create the directory, @file{~/.xemacs/packages}.
+@item Decide where to install the packages: in the system package
+directory, or in @file{~/.xemacs/mule-packages} or
+@file{~/.xemacs/xemacs-packages}, respectively. If you want to install
+the packages in the system package directory, make sure you can write
+into that directory. If you want to install in your @file{$HOME}
+directory, create the directory, @file{~/.xemacs/mule-packages} or
+@file{~/.xemacs/xemacs-packages}, respectively.
@item
Next, @code{cd} to the directory under which you want to install the
+1999-06-29 Andy Piper <andy@xemacs.org>
+
+ * event-msw.c: fix definition booboo.
+
+1999-06-28 Andy Piper <andy@xemacs.org>
+
+ * glyphs-x.c: change tree -> tree-view, progress ->
+ progress_gauge, edit -> edit-field, tab -> tab-control, combo ->
+ combo-box.
+ (complex_vars_of_glyphs_x): provide-on-console the implemented
+ widget types.
+
+ * glyphs-msw.c: ditto.
+ (complex_vars_of_glyphs_mswindows): ditto.
+
+ * lisp.h: add Fprovide_on_console.
+
+ * fns.c (Ffeaturep): add extra optional console argument.
+ (Fprovide_on_console): like Fprovide but provides only on the
+ specified console-type.
+ (Frequire): check console-features as well as global features.
+
+ * console.c (Fconsole_features): new function. return features for
+ this console.
+ (syms_of_console): add Fconsole_features.
+
+ * console.h (CONMETH_FEATURES): new function for accessing features.
+ (CONSOLE_FEATURES): ditto.
+ (struct console_methods): add features slot.
+ (INITIALIZE_CONSOLE_TYPE): initialize features slot.
+
+1999-06-28 Andy Piper <andy@xemacs.org>
+
+ * event-Xt.c (handle_focus_event_1): conditionally compile for
+ X11R5.
+
+ * s/cygwin32.h: fix me website address.
+
+ * event-msw.c: add NMHDR for pre b20 cygwin builds.
+
+ * gui-x.c (button_item_to_widget_value): only add callback if it
+ is non-nil.
+
+ * glyphs-x.c: add progress, edit and combo instantiators.
+ (x_widget_set_property): new function. uses lwlib to set widget
+ values.
+ (x_widget_property): new function. uses lwlib to get widget
+ values.
+ (x_button_instantiate): support images in buttons.
+ (x_button_property): new function. use lwlib to get the selected
+ state.
+ (x_progress_instantiate): new function for instantiating progress
+ gauges.
+ (x_progress_set_property): new function. sets the progress gauge
+ position.
+ (x_edit_instantiate): new function. for instantiating edit fields.
+ (x_combo_instantiate): new function. for instantiating combo
+ boxes.
+ (image_instantiator_format_create_glyphs_x): add new device ii
+ formats.
+
+ * glyphs-msw.c (mswindows_tab_instantiate): remove redundant var.
+
+ * console.h (CONSOLE_FEATURES): new features accesor.
+
+ * conslots.h (MARKED_SLOT): add features entry.
+
+1999-06-25 Andy Piper <andy@xemacs.org>
+
+ * menubar-x.c (menu_item_descriptor_to_widget_value_1): use new
+ gui functions.
+
+ * menubar-msw.c: move MAX_MENUITEM_LENGTH to gui.h
+
+ * gui.h (struct Lisp_Gui_Item): add accelerator.
+
+ * gui.c (gui_item_add_keyval_pair): deal with accelerators.
+ (gui_item_init): ditto.
+ (gui_add_item_keywords_to_plist): ditto.
+ (mark_gui_item): ditto.
+ (gui_item_hash): ditto.
+ (gui_item_accelerator): new function.
+ (gui_name_accelerator): new function stolen from gui-x.c
+
+ * gui-x.c (popup_selection_callback): always define. mark
+ subwindows changed after calling a callback.
+ (menu_name_to_accelerator): deleted.
+ (button_item_to_widget_value): forward gui_item things to gui_item
+ functions.
+
+ * glyphs-x.h (struct x_subwindow_data): add data for widgets. add
+ appropriate accesors.
+
+ * glyphs-x.c: declare new glyph formats.
+ (x_finalize_image_instance): unmanage and destroy widgets if they
+ exist.
+ (x_unmap_subwindow): handle widgets specially.
+ (x_map_subwindow): ditto. offset display of widgets by offset of
+ text widget within container.
+ (x_update_subwindow): new function. call lw_modify_all_widgets
+ when we are a widget.
+ (x_widget_instantiate): new function for generically creating
+ widgets-glyphs. toolkit specifics forwarded to lwlib.
+ (x_button_instantiate): new function for instantiating
+ widgets-glyph buttons.
+ (console_type_create_glyphs_x): register update_subwindow.
+ (image_instantiator_format_create_glyphs_x): register widget and
+ button types.
+
+ * event-msw.c (mswindows_wnd_proc): remove redundant variable.
+
+ * event-Xt.c (x_event_to_emacs_event): call handle_focus_event_1
+ when we get a button press in case we do not have the focus.
+ (handle_focus_event_1): set the keyboard focus to the text widget
+ if we do not have it.
+
+ * dialog-x.c (dbox_descriptor_to_widget_value): use new gui_item
+ functions.
+
+1999-06-24 SL Baur <steve@miho.m17n.org>
+
+ * syntax.c (scan_words): Restore non-Mule code.
+ (word_constituent_p): Restore.
+
1999-06-23 Olivier Galibert <galibert@pobox.com>
* config.h.in: Add missing #undef *_USER_DEFINED.
return !EQ (type, Qtty) && !EQ (type, Qstream) ? Qt : Qnil;
}
+DEFUN ("console-features", Fconsole_features, 0, 1, 0, /*
+Return a list of console-specific features.
+*/
+ (console))
+{
+ return CONSOLE_FEATURES (decode_console (console));
+}
+
\f
/**********************************************************************/
DEFSUBR (Fconsole_enable_input);
DEFSUBR (Fconsole_disable_input);
DEFSUBR (Fconsole_on_window_system_p);
+ DEFSUBR (Fconsole_features);
DEFSUBR (Fsuspend_console);
DEFSUBR (Fresume_console);
/* dialog methods */
void (*popup_dialog_box_method) (struct frame *, Lisp_Object dbox_desc);
#endif
+
+ /* Console-specific features */
+ Lisp_Object features;
};
/*
#define CONSOLE_TYPE_NAME(c) ((c)->conmeths->name)
#define CONSOLE_TYPE(c) ((c)->conmeths->symbol)
+#define CONSOLE_FEATURES(c) ((c)->conmeths->features)
#define CONMETH_TYPE(meths) ((meths)->symbol)
+#define CONMETH_FEATURES(c) ((meths)->features)
/******** Accessing / calling a console method *********/
add_entry_to_console_type_list (Q##type, type##_console_methods); \
type##_console_methods->image_conversion_list = Qnil; \
staticpro (&type##_console_methods->image_conversion_list); \
+ type##_console_methods->features = Qnil; \
+ staticpro (&type##_console_methods->features); \
} while (0)
/* Declare that console-type TYPE has method M; used in
widget_value *prev = 0, *kids = 0;
int n = 0;
int count = specpdl_depth ();
- Lisp_Object wv_closure;
+ Lisp_Object wv_closure, gui_item;
CHECK_CONS (desc);
CHECK_STRING (XCAR (desc));
CHECK_VECTOR (button);
wv = xmalloc_widget_value ();
- if (!button_item_to_widget_value (button, wv, allow_text_p, 1))
+ gui_item = gui_parse_item_keywords (button);
+ if (!button_item_to_widget_value (gui_item, wv, allow_text_p, 1))
{
free_widget_value (wv);
continue;
#include "events-mod.h"
static void enqueue_Xt_dispatch_event (Lisp_Object event);
+static void handle_focus_event_1 (struct frame *f, int in_p);
static struct event_stream *Xt_event_stream;
{
XButtonEvent *ev = &x_event->xbutton;
struct frame *frame = x_window_to_frame (d, ev->window);
+
if (! frame)
return 0; /* not for us */
XSETFRAME (emacs_event->channel, frame);
emacs_event->event.button.button = ev->button;
emacs_event->event.button.x = ev->x;
emacs_event->event.button.y = ev->y;
-
+ /* because we don't seem to get a FocusIn event for button clicks
+ when a widget-glyph is selected we will assume that we want the
+ focus if a button gets pressed. */
+ if (x_event->type == ButtonPress)
+ handle_focus_event_1 (frame, 1);
}
}
break;
static void
handle_focus_event_1 (struct frame *f, int in_p)
{
+#if XtSpecificationRelease > 5
+ Widget focus_widget = XtGetKeyboardFocusWidget (FRAME_X_TEXT_WIDGET (f));
+#endif
#ifdef HAVE_XIM
XIM_focus_event (f, in_p);
#endif /* HAVE_XIM */
Actually, we half handle it: we handle it as far as changing the
box cursor for redisplay, but we don't call any hooks or do any
select-frame stuff until after the sit-for.
- */
+
+ Unfortunately native widgets break the model because they grab
+ the keyboard focus and nothing sets it back again. I cannot find
+ any reasonable way to do this elsewhere so we assert here that
+ the keybpard focus is on the emacs text widget. Menus and dialogs
+ do this in their selection callback, but we don't want that since
+ a button having focus is legitimate. An edit field having focus
+ is mandatory. Weirdly you get a FocusOut event when you glick in
+ a widget-glyph but you don't get a correspondng FocusIn when you
+ click in the frame. Why is this? */
+ if (in_p
+#if XtSpecificationRelease > 5
+ && FRAME_X_TEXT_WIDGET (f) != focus_widget
+#endif
+ )
+ {
+ lw_set_keyboard_focus (FRAME_X_SHELL_WIDGET (f),
+ FRAME_X_TEXT_WIDGET (f));
+ }
+ /* do the generic event-stream stuff. */
{
Lisp_Object frm;
Lisp_Object conser;
/* Bleagh!!!!!! Apparently some window managers (e.g. MWM)
send synthetic MapNotify events when a window is first
- created, EVENT IF IT'S CREATED ICONIFIED OR INVISIBLE.
+ created, EVEN IF IT'S CREATED ICONIFIED OR INVISIBLE.
Or something like that. We initially tried a different
solution below, but that ran into a different window-
manager bug.
case FocusIn:
case FocusOut:
+
#ifdef EXTERNAL_WIDGET
/* External widget lossage: Ben said:
YUCK. The only way to make focus changes work properly is to
#include <io.h>
#include <errno.h>
+#if defined (__CYGWIN32__) && !defined (CYGWIN_VERSION_DLL_MAJOR)
+typedef struct tagNMHDR {
+ HWND hwndFrom;
+ UINT idFrom;
+ UINT code;
+} NMHDR, *PNMHDR, *LPNMHDR;
+#endif
+
#ifdef HAVE_MENUBARS
#define ADJR_MENUFLAG TRUE
#else
case WM_NOTIFY:
{
LPNMHDR nmhdr = (LPNMHDR)lParam;
- int idCtrl = (int)wParam;
if (nmhdr->code == TTN_NEEDTEXT)
{
\f
Lisp_Object Vfeatures;
-DEFUN ("featurep", Ffeaturep, 1, 1, 0, /*
+DEFUN ("featurep", Ffeaturep, 1, 2, 0, /*
Return non-nil if feature FEXP is present in this Emacs.
Use this to conditionalize execution of lisp code based on the
presence or absence of emacs or environment extensions.
for supporting multiple Emacs variants, lobby Richard Stallman at
<bug-gnu-emacs@prep.ai.mit.edu>.
*/
- (fexp))
+ (fexp, console))
{
#ifndef FEATUREP_SYNTAX
CHECK_SYMBOL (fexp);
if (SYMBOLP (fexp))
{
/* Original definition */
- return NILP (Fmemq (fexp, Vfeatures)) ? Qnil : Qt;
+ return (NILP (Fmemq (fexp, Vfeatures))
+ &&
+ NILP (Fmemq (fexp,
+ CONSOLE_FEATURES (decode_console (console)))))
+ ? Qnil : Qt;
}
else if (INTP (fexp) || FLOATP (fexp))
{
CHECK_SYMBOL (feature);
if (!NILP (Vautoload_queue))
Vautoload_queue = Fcons (Fcons (Vfeatures, Qnil), Vautoload_queue);
+
tem = Fmemq (feature, Vfeatures);
if (NILP (tem))
Vfeatures = Fcons (feature, Vfeatures);
return feature;
}
+DEFUN ("provide-on-console", Fprovide_on_console, 2, 2, 0, /*
+Announce that FEATURE is a feature of the current Emacs.
+This function updates the value of `console-features' for the provided CONSOLE.
+*/
+ (feature, console))
+{
+ Lisp_Object tem;
+ CHECK_SYMBOL (feature);
+
+ if (SYMBOLP (console))
+ {
+ struct console_methods* meths = decode_console_type (console, ERROR_ME);
+
+ tem = Fmemq (feature, CONMETH_FEATURES (meths));
+ if (NILP (tem))
+ CONMETH_FEATURES (meths) =
+ Fcons (feature, CONMETH_FEATURES (meths));
+ }
+ else
+ {
+ struct console* pconsole;
+ CHECK_CONSOLE (console);
+
+ pconsole = decode_console (console);
+ tem = Fmemq (feature, CONSOLE_FEATURES (pconsole));
+ if (NILP (tem))
+ CONSOLE_FEATURES (pconsole) =
+ Fcons (feature, CONSOLE_FEATURES (pconsole));
+ }
+ return feature;
+}
+
DEFUN ("require", Frequire, 1, 2, 0, /*
If feature FEATURE is not loaded, load it from FILENAME.
If FEATURE is not a member of the list `features', then the feature
CHECK_SYMBOL (feature);
tem = Fmemq (feature, Vfeatures);
LOADHIST_ATTACH (Fcons (Qrequire, feature));
- if (!NILP (tem))
+ if (!NILP (tem)
+ ||
+ !NILP (Fmemq (feature, CONSOLE_FEATURES
+ (XCONSOLE (Fselected_console ())))))
return feature;
else
{
DEFSUBR (Ffeaturep);
DEFSUBR (Frequire);
DEFSUBR (Fprovide);
+ DEFSUBR (Fprovide_on_console);
DEFSUBR (Fbase64_encode_region);
DEFSUBR (Fbase64_encode_string);
DEFSUBR (Fbase64_decode_region);
DEFINE_DEVICE_IIFORMAT (mswindows, xface);
#endif
DEFINE_DEVICE_IIFORMAT (mswindows, button);
-DEFINE_DEVICE_IIFORMAT (mswindows, edit);
+DEFINE_DEVICE_IIFORMAT (mswindows, edit_field);
#if 0
DEFINE_DEVICE_IIFORMAT (mswindows, group);
#endif
DEFINE_DEVICE_IIFORMAT (mswindows, widget);
DEFINE_DEVICE_IIFORMAT (mswindows, label);
DEFINE_DEVICE_IIFORMAT (mswindows, scrollbar);
-DEFINE_DEVICE_IIFORMAT (mswindows, combo);
-DEFINE_DEVICE_IIFORMAT (mswindows, progress);
-DEFINE_DEVICE_IIFORMAT (mswindows, tree);
-DEFINE_DEVICE_IIFORMAT (mswindows, tab);
+DEFINE_DEVICE_IIFORMAT (mswindows, combo_box);
+DEFINE_DEVICE_IIFORMAT (mswindows, progress_gauge);
+DEFINE_DEVICE_IIFORMAT (mswindows, tree_view);
+DEFINE_DEVICE_IIFORMAT (mswindows, tab_control);
DEFINE_IMAGE_INSTANTIATOR_FORMAT (bmp);
Lisp_Object Qbmp;
/* instantiate an edit control */
static void
-mswindows_edit_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+mswindows_edit_field_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
Lisp_Object pointer_fg, Lisp_Object pointer_bg,
int dest_mask, Lisp_Object domain)
{
/* instantiate a progress gauge */
static void
-mswindows_progress_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+mswindows_progress_gauge_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
Lisp_Object pointer_fg, Lisp_Object pointer_bg,
int dest_mask, Lisp_Object domain)
{
}
static void
-mswindows_tree_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+mswindows_tree_view_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
Lisp_Object pointer_fg, Lisp_Object pointer_bg,
int dest_mask, Lisp_Object domain)
{
}
static void
-mswindows_tab_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+mswindows_tab_control_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
Lisp_Object pointer_fg, Lisp_Object pointer_bg,
int dest_mask, Lisp_Object domain)
{
Lisp_Object rest;
HWND wnd;
- HTREEITEM parent;
int index = 0;
struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
/* instantiate a combo control */
static void
-mswindows_combo_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+mswindows_combo_box_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
Lisp_Object pointer_fg, Lisp_Object pointer_bg,
int dest_mask, Lisp_Object domain)
{
/* get properties of a combo box */
static Lisp_Object
-mswindows_combo_property (Lisp_Object image_instance, Lisp_Object prop)
+mswindows_combo_box_property (Lisp_Object image_instance, Lisp_Object prop)
{
struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
HANDLE wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
/* set the properties of a progres guage */
static Lisp_Object
-mswindows_progress_set_property (Lisp_Object image_instance, Lisp_Object prop,
+mswindows_progress_gauge_set_property (Lisp_Object image_instance, Lisp_Object prop,
Lisp_Object val)
{
struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
IIFORMAT_HAS_DEVMETHOD (mswindows, button, property);
IIFORMAT_HAS_DEVMETHOD (mswindows, button, instantiate);
- INITIALIZE_DEVICE_IIFORMAT (mswindows, edit);
- IIFORMAT_HAS_DEVMETHOD (mswindows, edit, instantiate);
+ INITIALIZE_DEVICE_IIFORMAT (mswindows, edit_field);
+ IIFORMAT_HAS_DEVMETHOD (mswindows, edit_field, instantiate);
INITIALIZE_DEVICE_IIFORMAT (mswindows, subwindow);
IIFORMAT_HAS_DEVMETHOD (mswindows, subwindow, instantiate);
IIFORMAT_HAS_DEVMETHOD (mswindows, label, instantiate);
/* combo box */
- INITIALIZE_DEVICE_IIFORMAT (mswindows, combo);
- IIFORMAT_HAS_DEVMETHOD (mswindows, combo, property);
- IIFORMAT_HAS_DEVMETHOD (mswindows, combo, instantiate);
+ INITIALIZE_DEVICE_IIFORMAT (mswindows, combo_box);
+ IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, property);
+ IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, instantiate);
/* scrollbar */
INITIALIZE_DEVICE_IIFORMAT (mswindows, scrollbar);
IIFORMAT_HAS_DEVMETHOD (mswindows, scrollbar, instantiate);
/* progress gauge */
- INITIALIZE_DEVICE_IIFORMAT (mswindows, progress);
- IIFORMAT_HAS_DEVMETHOD (mswindows, progress, set_property);
- IIFORMAT_HAS_DEVMETHOD (mswindows, progress, instantiate);
+ INITIALIZE_DEVICE_IIFORMAT (mswindows, progress_gauge);
+ IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, set_property);
+ IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, instantiate);
/* tree view widget */
- INITIALIZE_DEVICE_IIFORMAT (mswindows, tree);
+ INITIALIZE_DEVICE_IIFORMAT (mswindows, tree_view);
/* IIFORMAT_HAS_DEVMETHOD (mswindows, progress, set_property);*/
- IIFORMAT_HAS_DEVMETHOD (mswindows, tree, instantiate);
+ IIFORMAT_HAS_DEVMETHOD (mswindows, tree_view, instantiate);
/* tab control widget */
- INITIALIZE_DEVICE_IIFORMAT (mswindows, tab);
- IIFORMAT_HAS_DEVMETHOD (mswindows, tab, instantiate);
+ INITIALIZE_DEVICE_IIFORMAT (mswindows, tab_control);
+ IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, instantiate);
/* windows bitmap format */
INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (bmp, "bmp");
void
vars_of_glyphs_mswindows (void)
{
- Fprovide (Qbmp);
- Fprovide (Qmswindows_resource);
DEFVAR_LISP ("mswindows-bitmap-file-path", &Vmswindows_bitmap_file_path /*
A list of the directories in which mswindows bitmap files may be found.
This is used by the `make-image-instance' function.
*/ );
Vmswindows_bitmap_file_path = Qnil;
-
- Fprovide (Qbutton);
- Fprovide (Qedit);
- Fprovide (Qcombo);
- Fprovide (Qscrollbar);
- Fprovide (Qlabel);
- Fprovide (Qprogress);
- Fprovide (Qtree);
- Fprovide (Qtab);
}
void
complex_vars_of_glyphs_mswindows (void)
{
+ Fprovide_on_console (Qbmp, Qmswindows);
+ Fprovide_on_console (Qmswindows_resource, Qmswindows);
+ Fprovide_on_console (Qbutton, Qmswindows);
+ Fprovide_on_console (Qedit_field, Qmswindows);
+ Fprovide_on_console (Qcombo_box, Qmswindows);
+ Fprovide_on_console (Qscrollbar, Qmswindows);
+ Fprovide_on_console (Qlabel, Qmswindows);
+ Fprovide_on_console (Qprogress_gauge, Qmswindows);
+ Fprovide_on_console (Qtree_view, Qmswindows);
+ Fprovide_on_console (Qtab_control, Qmswindows);
}
#include "opaque.h"
DEFINE_IMAGE_INSTANTIATOR_FORMAT (button);
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (combo);
-Lisp_Object Qcombo;
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (edit);
-Lisp_Object Qedit;
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (combo_box);
+Lisp_Object Qcombo_box;
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (edit_field);
+Lisp_Object Qedit_field;
DEFINE_IMAGE_INSTANTIATOR_FORMAT (scrollbar);
Lisp_Object Qscrollbar;
DEFINE_IMAGE_INSTANTIATOR_FORMAT (widget);
#endif
DEFINE_IMAGE_INSTANTIATOR_FORMAT (label);
Lisp_Object Qlabel;
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (progress);
-Lisp_Object Qprogress;
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (tree);
-Lisp_Object Qtree;
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (tab);
-Lisp_Object Qtab;
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge);
+Lisp_Object Qprogress_gauge;
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (tree_view);
+Lisp_Object Qtree_view;
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (tab_control);
+Lisp_Object Qtab_control;
Lisp_Object Q_descriptor, Q_height, Q_width, Q_properties, Q_items;
Lisp_Object Q_image, Q_text, Q_percent;
the instances. This is encoded in the widget type
field. widget_property gets invoked by decoding the primary type
(Qwidget), widget property then invokes based on the secondary type
- (Qedit for example). It is debatable that we should wire things in this
+ (Qedit_field for example). It is debatable that we should wire things in this
generalised way rather than treating widgets specially in
image_instance_property. */
static Lisp_Object
}
static void
-combo_validate (Lisp_Object instantiator)
+combo_box_validate (Lisp_Object instantiator)
{
widget_validate (instantiator);
if (NILP (find_keyword_in_vector (instantiator, Q_properties)))
/* combo-box generic instantiation - get he heigh right */
static void
-combo_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+combo_box_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
Lisp_Object pointer_fg, Lisp_Object pointer_bg,
int dest_mask, Lisp_Object domain)
{
}
static void
-tab_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+tab_control_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
Lisp_Object pointer_fg, Lisp_Object pointer_bg,
int dest_mask, Lisp_Object domain)
{
VALID_GUI_KEYWORDS (button);
/* edit fields */
- INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit, "edit");
- IIFORMAT_HAS_SHARED_METHOD (edit, validate, widget);
- IIFORMAT_HAS_SHARED_METHOD (edit, possible_dest_types, widget);
- IIFORMAT_HAS_SHARED_METHOD (edit, instantiate, widget);
- VALID_WIDGET_KEYWORDS (edit);
- VALID_GUI_KEYWORDS (edit);
+ INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit_field, "edit-field");
+ IIFORMAT_HAS_SHARED_METHOD (edit_field, validate, widget);
+ IIFORMAT_HAS_SHARED_METHOD (edit_field, possible_dest_types, widget);
+ IIFORMAT_HAS_SHARED_METHOD (edit_field, instantiate, widget);
+ VALID_WIDGET_KEYWORDS (edit_field);
+ VALID_GUI_KEYWORDS (edit_field);
/* combo box */
- INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo, "combo");
- IIFORMAT_HAS_METHOD (combo, validate);
- IIFORMAT_HAS_SHARED_METHOD (combo, possible_dest_types, widget);
- IIFORMAT_HAS_METHOD (combo, instantiate);
- VALID_GUI_KEYWORDS (combo);
-
- IIFORMAT_VALID_KEYWORD (combo, Q_width, check_valid_int);
- IIFORMAT_VALID_KEYWORD (combo, Q_height, check_valid_int);
- IIFORMAT_VALID_KEYWORD (combo, Q_pixel_width, check_valid_int);
- IIFORMAT_VALID_KEYWORD (combo, Q_face, check_valid_face);
- IIFORMAT_VALID_KEYWORD (combo, Q_properties, check_valid_item_list);
+ INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo_box, "combo-box");
+ IIFORMAT_HAS_METHOD (combo_box, validate);
+ IIFORMAT_HAS_SHARED_METHOD (combo_box, possible_dest_types, widget);
+ IIFORMAT_HAS_METHOD (combo_box, instantiate);
+ VALID_GUI_KEYWORDS (combo_box);
+
+ IIFORMAT_VALID_KEYWORD (combo_box, Q_width, check_valid_int);
+ IIFORMAT_VALID_KEYWORD (combo_box, Q_height, check_valid_int);
+ IIFORMAT_VALID_KEYWORD (combo_box, Q_pixel_width, check_valid_int);
+ IIFORMAT_VALID_KEYWORD (combo_box, Q_face, check_valid_face);
+ IIFORMAT_VALID_KEYWORD (combo_box, Q_properties, check_valid_item_list);
/* scrollbar */
INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (scrollbar, "scrollbar");
IIFORMAT_VALID_KEYWORD (scrollbar, Q_face, check_valid_face);
/* progress guage */
- INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress, "progress");
- IIFORMAT_HAS_SHARED_METHOD (progress, validate, widget);
- IIFORMAT_HAS_SHARED_METHOD (progress, possible_dest_types, widget);
- IIFORMAT_HAS_SHARED_METHOD (progress, instantiate, combo);
- VALID_WIDGET_KEYWORDS (progress);
- VALID_GUI_KEYWORDS (progress);
+ INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge, "progress-gauge");
+ IIFORMAT_HAS_SHARED_METHOD (progress_gauge, validate, widget);
+ IIFORMAT_HAS_SHARED_METHOD (progress_gauge, possible_dest_types, widget);
+ IIFORMAT_HAS_SHARED_METHOD (progress_gauge, instantiate, combo_box);
+ VALID_WIDGET_KEYWORDS (progress_gauge);
+ VALID_GUI_KEYWORDS (progress_gauge);
/* tree view */
- INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree, "tree");
- IIFORMAT_HAS_SHARED_METHOD (tree, validate, combo);
- IIFORMAT_HAS_SHARED_METHOD (tree, possible_dest_types, widget);
- IIFORMAT_HAS_SHARED_METHOD (tree, instantiate, combo);
- VALID_WIDGET_KEYWORDS (tree);
- VALID_GUI_KEYWORDS (tree);
- IIFORMAT_VALID_KEYWORD (tree, Q_properties, check_valid_item_list);
+ INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree_view, "tree-view");
+ IIFORMAT_HAS_SHARED_METHOD (tree_view, validate, combo_box);
+ IIFORMAT_HAS_SHARED_METHOD (tree_view, possible_dest_types, widget);
+ IIFORMAT_HAS_SHARED_METHOD (tree_view, instantiate, combo_box);
+ VALID_WIDGET_KEYWORDS (tree_view);
+ VALID_GUI_KEYWORDS (tree_view);
+ IIFORMAT_VALID_KEYWORD (tree_view, Q_properties, check_valid_item_list);
/* tab control */
- INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab, "tab");
- IIFORMAT_HAS_SHARED_METHOD (tab, validate, combo);
- IIFORMAT_HAS_SHARED_METHOD (tab, possible_dest_types, widget);
- IIFORMAT_HAS_METHOD (tab, instantiate);
- VALID_WIDGET_KEYWORDS (tab);
- VALID_GUI_KEYWORDS (tab);
- IIFORMAT_VALID_KEYWORD (tab, Q_properties, check_valid_item_list);
+ INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab_control, "tab-control");
+ IIFORMAT_HAS_SHARED_METHOD (tab_control, validate, combo_box);
+ IIFORMAT_HAS_SHARED_METHOD (tab_control, possible_dest_types, widget);
+ IIFORMAT_HAS_METHOD (tab_control, instantiate);
+ VALID_WIDGET_KEYWORDS (tab_control);
+ VALID_GUI_KEYWORDS (tab_control);
+ IIFORMAT_VALID_KEYWORD (tab_control, Q_properties, check_valid_item_list);
/* labels */
INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label, "label");
#include "console-x.h"
#include "glyphs-x.h"
#include "objects-x.h"
+#include "gui-x.h"
#include "xmu.h"
#include "buffer.h"
#include "frame.h"
#include "insdel.h"
#include "opaque.h"
+#include "gui.h"
+#include "faces.h"
#include "imgproc.h"
#include "file-coding.h"
#endif
+#ifdef LWLIB_USES_MOTIF
+#include <Xm/Xm.h>
+#endif
+#include <X11/IntrinsicP.h>
+
#if INTBITS == 32
# define FOUR_BYTE_TYPE unsigned int
#elif LONGBITS == 32
DEFINE_IMAGE_INSTANTIATOR_FORMAT (autodetect);
+DEFINE_DEVICE_IIFORMAT (x, widget);
+DEFINE_DEVICE_IIFORMAT (x, button);
+DEFINE_DEVICE_IIFORMAT (x, progress_gauge);
+DEFINE_DEVICE_IIFORMAT (x, edit_field);
+DEFINE_DEVICE_IIFORMAT (x, combo_box);
+
static void cursor_font_instantiate (Lisp_Object image_instance,
Lisp_Object instantiator,
Lisp_Object pointer_fg,
{
Display *dpy = DEVICE_X_DISPLAY (XDEVICE (p->device));
- if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET
- ||
- IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW)
+ if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET)
+ {
+ if (IMAGE_INSTANCE_SUBWINDOW_ID (p))
+ {
+ XtUnmanageChild (IMAGE_INSTANCE_X_WIDGET_ID (p));
+ XtDestroyWidget (IMAGE_INSTANCE_X_WIDGET_ID (p));
+ IMAGE_INSTANCE_SUBWINDOW_ID (p) = 0;
+ }
+ }
+ else if (IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW)
{
if (IMAGE_INSTANCE_SUBWINDOW_ID (p))
XDestroyWindow (dpy, IMAGE_INSTANCE_X_SUBWINDOW_ID (p));
static void
x_unmap_subwindow (struct Lisp_Image_Instance *p)
{
- XUnmapWindow (DisplayOfScreen (IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (p)),
- IMAGE_INSTANCE_X_SUBWINDOW_ID (p));
+ if (IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW)
+ {
+ XUnmapWindow
+ (DisplayOfScreen (IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (p)),
+ IMAGE_INSTANCE_X_SUBWINDOW_ID (p));
+ }
+ else /* must be a widget */
+ {
+ XtUnmapWidget (IMAGE_INSTANCE_X_WIDGET_ID (p));
+ }
}
/* map the subwindow. This is used by redisplay via
static void
x_map_subwindow (struct Lisp_Image_Instance *p, int x, int y)
{
- XMapWindow (DisplayOfScreen (IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (p)),
- IMAGE_INSTANCE_X_SUBWINDOW_ID (p));
- XMoveWindow (DisplayOfScreen (IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (p)),
- IMAGE_INSTANCE_X_SUBWINDOW_ID (p), x, y);
+ if (IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW)
+ {
+ Window subwindow = IMAGE_INSTANCE_X_SUBWINDOW_ID (p);
+ Screen* screen = IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (p);
+ XMapWindow (DisplayOfScreen (screen), subwindow);
+ XMoveWindow (DisplayOfScreen (screen), subwindow, x, y);
+ }
+ else /* must be a widget */
+ {
+ XtMoveWidget (IMAGE_INSTANCE_X_WIDGET_ID (p),
+ x + IMAGE_INSTANCE_X_WIDGET_XOFFSET (p),
+ y + IMAGE_INSTANCE_X_WIDGET_YOFFSET (p));
+ XtMapWidget (IMAGE_INSTANCE_X_WIDGET_ID (p));
+ }
+}
+
+/* when you click on a widget you may activate another widget this
+ needs to be checked and all appropriate widgets updated */
+static void
+x_update_subwindow (struct Lisp_Image_Instance *p)
+{
+ if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET)
+ {
+ widget_value* wv = xmalloc_widget_value ();
+ button_item_to_widget_value (IMAGE_INSTANCE_WIDGET_SINGLE_ITEM (p),
+ wv, 1, 1);
+ lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (p),
+ wv, 1);
+ }
}
/* instantiate and x type subwindow */
dpy = DEVICE_X_DISPLAY (XDEVICE (device));
xs = DefaultScreenOfDisplay (dpy);
- if (dest_mask & IMAGE_SUBWINDOW_MASK)
- IMAGE_INSTANCE_TYPE (ii) = IMAGE_SUBWINDOW;
- else
- incompatible_image_types (instantiator, dest_mask,
- IMAGE_SUBWINDOW_MASK);
+ IMAGE_INSTANCE_TYPE (ii) = IMAGE_SUBWINDOW;
pw = XtWindow (FRAME_X_TEXT_WIDGET (f));
w, h);
}
+/************************************************************************/
+/* widgets */
+/************************************************************************/
+
+static void
+x_widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+ Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+ int dest_mask, Lisp_Object domain,
+ CONST char* type, widget_value* wv)
+{
+ struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+ Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii), pixel;
+ struct device* d = XDEVICE (device);
+ Lisp_Object frame = FW_FRAME (domain);
+ struct frame* f = XFRAME (frame);
+ XColor fcolor, bcolor;
+ Extbyte* nm=0;
+ Widget wid;
+ Arg al [32];
+ int ac = 0;
+ int id = new_lwlib_id ();
+
+ if (!DEVICE_X_P (d))
+ signal_simple_error ("Not an mswindows device", device);
+
+ /* have to set the type this late in case there is no device
+ instantiation for a widget. But we can go ahead and do it without
+ checking because there is always a generic instantiator. */
+ IMAGE_INSTANCE_TYPE (ii) = IMAGE_WIDGET;
+
+ if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
+ GET_C_STRING_OS_DATA_ALLOCA (IMAGE_INSTANCE_WIDGET_TEXT (ii), nm);
+
+ ii->data = xnew_and_zero (struct x_subwindow_data);
+
+ /* copy any args we were given */
+ if (wv->nargs)
+ lw_add_value_args_to_args (wv, al, &ac);
+
+ /* add our own arguments */
+ pixel = FACE_FOREGROUND
+ (IMAGE_INSTANCE_WIDGET_FACE (ii),
+ IMAGE_INSTANCE_SUBWINDOW_FRAME (ii));
+ fcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (pixel));
+ pixel = FACE_BACKGROUND
+ (IMAGE_INSTANCE_WIDGET_FACE (ii),
+ IMAGE_INSTANCE_SUBWINDOW_FRAME (ii));
+ bcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (pixel));
+
+ XtSetArg (al [ac], XtNbackground, bcolor.pixel); ac++;
+ XtSetArg (al [ac], XtNforeground, fcolor.pixel); ac++;
+ XtSetArg (al [ac], XtNfont, (void*)FONT_INSTANCE_X_FONT
+ (XFONT_INSTANCE (widget_face_font_info
+ (domain,
+ IMAGE_INSTANCE_WIDGET_FACE (ii),
+ 0, 0)))); ac++;
+
+ wv->nargs = ac;
+ wv->args = al;
+
+ wid = lw_create_widget (type, wv->name, id, wv, FRAME_X_CONTAINER_WIDGET (f),
+ False, 0, popup_selection_callback, 0);
+
+ IMAGE_INSTANCE_X_WIDGET_LWID (ii) = id;
+
+ /* because the EmacsManager is the widgets parent we have to
+ offset the redisplay of the widget by the amount the text
+ widget is inside the manager. */
+ ac = 0;
+ XtSetArg (al [ac], XtNwidth,
+ (Dimension)IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii)); ac++;
+ XtSetArg (al [ac], XtNheight,
+ (Dimension)IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii)); ac++;
+ XtSetValues (wid, al, ac);
+ /* finally get offsets in the frame */
+ ac = 0;
+ XtSetArg (al [ac], XtNx, &IMAGE_INSTANCE_X_WIDGET_XOFFSET (ii)); ac++;
+ XtSetArg (al [ac], XtNy, &IMAGE_INSTANCE_X_WIDGET_YOFFSET (ii)); ac++;
+ XtGetValues (FRAME_X_TEXT_WIDGET (f), al, ac);
+
+ IMAGE_INSTANCE_SUBWINDOW_ID (ii) = (void*)wid;
+
+ free_widget_value (wv);
+}
+
+static Lisp_Object
+x_widget_set_property (Lisp_Object image_instance, Lisp_Object prop,
+ Lisp_Object val)
+{
+ struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+
+ if (EQ (prop, Q_text))
+ {
+ Extbyte* str=0;
+ widget_value* wv = lw_get_all_values (IMAGE_INSTANCE_X_WIDGET_LWID (ii));
+ CHECK_STRING (val);
+ GET_C_STRING_OS_DATA_ALLOCA (val, str);
+ wv->value = str;
+ lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (ii), wv, False);
+ return Qt;
+ }
+ return Qunbound;
+}
+
+/* get properties of a control */
+static Lisp_Object
+x_widget_property (Lisp_Object image_instance, Lisp_Object prop)
+{
+ struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+ /* get the text from a control */
+ if (EQ (prop, Q_text))
+ {
+ widget_value* wv = lw_get_all_values (IMAGE_INSTANCE_X_WIDGET_LWID (ii));
+ return build_ext_string (wv->value, FORMAT_OS);
+ }
+ return Qunbound;
+}
+
+/* Instantiate a button widget. Unfortunately instantiated widgets are
+ particular to a frame since they need to have a parent. It's not
+ like images where you just select the image into the context you
+ want to display it in and BitBlt it. So images instances can have a
+ many-to-one relationship with things you see, whereas widgets can
+ only be one-to-one (i.e. per frame) */
+static void
+x_button_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+ Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+ int dest_mask, Lisp_Object domain)
+{
+ struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+ Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
+ Lisp_Object glyph = find_keyword_in_vector (instantiator, Q_image);
+ widget_value* wv = xmalloc_widget_value ();
+
+ button_item_to_widget_value (gui, wv, 1, 1);
+
+ if (!NILP (glyph))
+ {
+ if (!IMAGE_INSTANCEP (glyph))
+ glyph = glyph_image_instance (glyph, domain, ERROR_ME, 1);
+ }
+
+ x_widget_instantiate (image_instance, instantiator, pointer_fg,
+ pointer_bg, dest_mask, domain, "button", wv);
+
+ /* add the image if one was given */
+ if (!NILP (glyph) && IMAGE_INSTANCEP (glyph))
+ {
+ Arg al [2];
+ int ac =0;
+#ifdef LWLIB_USES_MOTIF
+ XtSetArg (al [ac], XmNlabelType, XmPIXMAP); ac++;
+ XtSetArg (al [ac], XmNlabelPixmap, XIMAGE_INSTANCE_X_PIXMAP (glyph));ac++;
+#else
+ XtSetArg (al [ac], XtNpixmap, XIMAGE_INSTANCE_X_PIXMAP (glyph)); ac++;
+#endif
+ XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (ii), al, ac);
+ }
+}
+
+/* get properties of a button */
+static Lisp_Object
+x_button_property (Lisp_Object image_instance, Lisp_Object prop)
+{
+ struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+ /* check the state of a button */
+ if (EQ (prop, Q_selected))
+ {
+ widget_value* wv = lw_get_all_values (IMAGE_INSTANCE_X_WIDGET_LWID (ii));
+
+ if (wv->selected)
+ return Qt;
+ else
+ return Qnil;
+ }
+ return Qunbound;
+}
+
+/* instantiate a progress gauge */
+static void
+x_progress_gauge_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+ Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+ int dest_mask, Lisp_Object domain)
+{
+ struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+ Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
+ widget_value* wv = xmalloc_widget_value ();
+
+ button_item_to_widget_value (gui, wv, 1, 1);
+
+ x_widget_instantiate (image_instance, instantiator, pointer_fg,
+ pointer_bg, dest_mask, domain, "progress", wv);
+}
+
+/* set the properties of a progres guage */
+static Lisp_Object
+x_progress_gauge_set_property (Lisp_Object image_instance, Lisp_Object prop,
+ Lisp_Object val)
+{
+ struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+
+ if (EQ (prop, Q_percent))
+ {
+ Arg al [1];
+ CHECK_INT (val);
+ XtSetArg (al[0], XtNvalue, XINT (val));
+ XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (ii), al, 1);
+ return Qt;
+ }
+ return Qunbound;
+}
+
+/* instantiate an edit control */
+static void
+x_edit_field_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+ Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+ int dest_mask, Lisp_Object domain)
+{
+ struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+ Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
+ widget_value* wv = xmalloc_widget_value ();
+
+ button_item_to_widget_value (gui, wv, 1, 1);
+
+ x_widget_instantiate (image_instance, instantiator, pointer_fg,
+ pointer_bg, dest_mask, domain, "text-field", wv);
+}
+
+/* instantiate a combo control */
+static void
+x_combo_box_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+ Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+ int dest_mask, Lisp_Object domain)
+{
+ struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+ Lisp_Object rest;
+ Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
+ widget_value* wv = xmalloc_widget_value ();
+
+ button_item_to_widget_value (gui, wv, 1, 1);
+
+ x_widget_instantiate (image_instance, instantiator, pointer_fg,
+ pointer_bg, dest_mask, domain, "combo-box", wv);
+ /* add items to the combo box */
+ LIST_LOOP (rest, Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), Q_items, Qnil))
+ {
+#if 0
+ Extbyte* str;
+ XmString xmstr;
+ GET_C_STRING_OS_DATA_ALLOCA (XCAR (rest), str);
+ xmstr = XmStringCreate (str, XmSTRING_DEFAULT_CHARSET);
+ XmListAddItem (IMAGE_INSTANCE_X_WIDGET_ID (ii), xmstr, 0);
+ XmStringFree (xmstr);
+#endif
+ }
+}
+
\f
/************************************************************************/
/* initialization */
CONSOLE_HAS_METHOD (x, unmap_subwindow);
CONSOLE_HAS_METHOD (x, map_subwindow);
CONSOLE_HAS_METHOD (x, resize_subwindow);
+ CONSOLE_HAS_METHOD (x, update_subwindow);
}
void
INITIALIZE_DEVICE_IIFORMAT (x, subwindow);
IIFORMAT_HAS_DEVMETHOD (x, subwindow, instantiate);
+ /* button widget */
+ INITIALIZE_DEVICE_IIFORMAT (x, button);
+ IIFORMAT_HAS_DEVMETHOD (x, button, property);
+ IIFORMAT_HAS_DEVMETHOD (x, button, instantiate);
+
+ INITIALIZE_DEVICE_IIFORMAT (x, widget);
+ IIFORMAT_HAS_DEVMETHOD (x, widget, property);
+ IIFORMAT_HAS_DEVMETHOD (x, widget, set_property);
+ /* progress gauge */
+ INITIALIZE_DEVICE_IIFORMAT (x, progress_gauge);
+ IIFORMAT_HAS_DEVMETHOD (x, progress_gauge, set_property);
+ IIFORMAT_HAS_DEVMETHOD (x, progress_gauge, instantiate);
+ /* text field */
+ INITIALIZE_DEVICE_IIFORMAT (x, edit_field);
+ IIFORMAT_HAS_DEVMETHOD (x, edit_field, instantiate);
+ /* combo box */
+ INITIALIZE_DEVICE_IIFORMAT (x, combo_box);
+ IIFORMAT_HAS_DEVMETHOD (x, combo_box, instantiate);
+
INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (cursor_font, "cursor-font");
IIFORMAT_HAS_METHOD (cursor_font, validate);
BUILD_GLYPH_INST (Vhscroll_glyph, hscroll);
#undef BUILD_GLYPH_INST
+ Fprovide_on_console (Qbutton, Qx);
+ Fprovide_on_console (Qedit_field, Qx);
+ Fprovide_on_console (Qprogress_gauge, Qx);
+ /* Fprovide (Qcombo_box);*/
}
struct x_subwindow_data
{
- Screen *xscreen;
- Window parent_window;
+ union
+ {
+ struct
+ {
+ Screen *xscreen;
+ Window parent_window;
+ } sub;
+ struct
+ {
+ Position x_offset;
+ Position y_offset;
+ LWLIB_ID id;
+ } wid;
+ } data;
};
#define X_SUBWINDOW_INSTANCE_DATA(i) ((struct x_subwindow_data *) (i)->data)
#define IMAGE_INSTANCE_X_SUBWINDOW_SCREEN(i) \
- (X_SUBWINDOW_INSTANCE_DATA (i)->xscreen)
+ (X_SUBWINDOW_INSTANCE_DATA (i)->data.sub.xscreen)
#define IMAGE_INSTANCE_X_SUBWINDOW_PARENT(i) \
- (X_SUBWINDOW_INSTANCE_DATA (i)->parent_window)
+ (X_SUBWINDOW_INSTANCE_DATA (i)->data.sub.parent_window)
+#define IMAGE_INSTANCE_X_WIDGET_XOFFSET(i) \
+ (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.x_offset)
+#define IMAGE_INSTANCE_X_WIDGET_YOFFSET(i) \
+ (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.y_offset)
+#define IMAGE_INSTANCE_X_WIDGET_LWID(i) \
+ (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.id)
#define XIMAGE_INSTANCE_X_SUBWINDOW_PARENT(i) \
IMAGE_INSTANCE_X_SUBWINDOW_PARENT (XIMAGE_INSTANCE (i))
#define XIMAGE_INSTANCE_X_SUBWINDOW_SCREEN(i) \
IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (XIMAGE_INSTANCE (i))
+#define XIMAGE_INSTANCE_X_WIDGET_XOFFSET(i) \
+ IMAGE_INSTANCE_X_WIDGET_XOFFSET (XIMAGE_INSTANCE (i))
+#define XIMAGE_INSTANCE_X_WIDGET_YOFFSET(i) \
+ IMAGE_INSTANCE_X_WIDGET_YOFFSET (XIMAGE_INSTANCE (i))
+#define XIMAGE_INSTANCE_X_WIDGET_LWID(i) \
+ IMAGE_INSTANCE_X_WIDGET_LWID (XIMAGE_INSTANCE (i))
#define IMAGE_INSTANCE_X_SUBWINDOW_ID(i) \
((Window) IMAGE_INSTANCE_SUBWINDOW_ID (i))
+#define IMAGE_INSTANCE_X_WIDGET_ID(i) \
+ ((Widget) IMAGE_INSTANCE_SUBWINDOW_ID (i))
#endif /* HAVE_X_WINDOWS */
#endif /* _XEMACS_GLYPHS_X_H_ */
extern Lisp_Object Qxpm, Qxface;
extern Lisp_Object Q_data, Q_file, Q_color_symbols, Qconst_glyph_variable;
-extern Lisp_Object Qxbm, Qedit, Qgroup, Qlabel, Qcombo, Qscrollbar, Qprogress;
-extern Lisp_Object Qtree, Qtab;
+extern Lisp_Object Qxbm, Qedit_field, Qgroup, Qlabel, Qcombo_box, Qscrollbar;
+extern Lisp_Object Qtree_view, Qtab_control, Qprogress_gauge;
extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y;
extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group;
extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text;
#include "device.h"
#include "frame.h"
#include "gui.h"
+#include "redisplay.h"
#include "opaque.h"
-#ifdef HAVE_POPUPS
Lisp_Object Qmenu_no_selection_hook;
-#endif
/* we need a unique id for each popup menu, dialog box, and scrollbar */
static unsigned int lwlib_id_tick;
}
\f
-#ifdef HAVE_POPUPS
-
struct mark_widget_value_closure
{
void (*markobj) (Lisp_Object);
arg = Qmenu_no_selection_hook;
}
else
- get_gui_callback (data, &fn, &arg);
+ {
+ MARK_SUBWINDOWS_CHANGED;
+ get_gui_callback (data, &fn, &arg);
+ }
/* This is the timestamp used for asserting focus so we need to get an
up-to-date value event if no events has been dispatched to emacs
return NULL;
}
-/* set menu accelerator key to first underlined character in menu name */
-
-Lisp_Object
-menu_name_to_accelerator (char *name)
-{
- while (*name) {
- if (*name=='%') {
- ++name;
- if (!(*name))
- return Qnil;
- if (*name=='_' && *(name+1))
- {
- int accelerator = (int) (unsigned char) (*(name+1));
- return make_char (tolower (accelerator));
- }
- }
- ++name;
- }
- return Qnil;
-}
/* This does the dirty work. gc_currently_forbidden is 1 when this is called.
*/
-
int
-button_item_to_widget_value (Lisp_Object desc, widget_value *wv,
+button_item_to_widget_value (Lisp_Object gui_item, widget_value *wv,
int allow_text_field_p, int no_keys_p)
{
/* !!#### This function has not been Mule-ized */
/* This function cannot GC because gc_currently_forbidden is set when
it's called */
- Lisp_Object name = Qnil;
- Lisp_Object callback = Qnil;
- Lisp_Object suffix = Qnil;
- Lisp_Object active_p = Qt;
- Lisp_Object include_p = Qt;
- Lisp_Object selected_p = Qnil;
- Lisp_Object keys = Qnil;
- Lisp_Object style = Qnil;
- Lisp_Object config_tag = Qnil;
- Lisp_Object accel = Qnil;
- int length = XVECTOR_LENGTH (desc);
- Lisp_Object *contents = XVECTOR_DATA (desc);
- int plist_p;
- int selected_spec = 0, included_spec = 0;
-
- if (length < 2)
- signal_simple_error ("Button descriptors must be at least 2 long", desc);
-
- /* length 2: [ "name" callback ]
- length 3: [ "name" callback active-p ]
- length 4: [ "name" callback active-p suffix ]
- or [ "name" callback keyword value ]
- length 5+: [ "name" callback [ keyword value ]+ ]
- */
- plist_p = (length >= 5 || (length > 2 && KEYWORDP (contents [2])));
-
- if (!plist_p && length > 2)
- /* the old way */
- {
- name = contents [0];
- callback = contents [1];
- active_p = contents [2];
- if (length == 4)
- suffix = contents [3];
- }
- else
- {
- /* the new way */
- int i;
- if (length & 1)
- signal_simple_error (
- "Button descriptor has an odd number of keywords and values",
- desc);
-
- name = contents [0];
- callback = contents [1];
- for (i = 2; i < length;)
- {
- Lisp_Object key = contents [i++];
- Lisp_Object val = contents [i++];
- if (!KEYWORDP (key))
- signal_simple_error_2 ("Not a keyword", key, desc);
-
- if (EQ (key, Q_active)) active_p = val;
- else if (EQ (key, Q_suffix)) suffix = val;
- else if (EQ (key, Q_keys)) keys = val;
- else if (EQ (key, Q_style)) style = val;
- else if (EQ (key, Q_selected)) selected_p = val, selected_spec = 1;
- else if (EQ (key, Q_included)) include_p = val, included_spec = 1;
- else if (EQ (key, Q_config)) config_tag = val;
- else if (EQ (key, Q_accelerator))
- {
- if ( SYMBOLP (val)
- || CHARP (val))
- accel = val;
- else
- signal_simple_error ("Bad keyboard accelerator", val);
- }
- else if (EQ (key, Q_filter))
- signal_simple_error(":filter keyword not permitted on leaf nodes", desc);
- else
- signal_simple_error_2 ("Unknown menu item keyword", key, desc);
- }
- }
+ struct Lisp_Gui_Item* pgui = XGUI_ITEM (gui_item);
+
+ if (!NILP (pgui->filter))
+ signal_simple_error(":filter keyword not permitted on leaf nodes", gui_item);
#ifdef HAVE_MENUBARS
- if ((!NILP (config_tag) && NILP (Fmemq (config_tag, Vmenubar_configuration)))
- || (included_spec && NILP (Feval (include_p))))
+ if (!gui_item_included_p (gui_item, Vmenubar_configuration))
{
/* the include specification says to ignore this item. */
return 0;
}
#endif /* HAVE_MENUBARS */
- CHECK_STRING (name);
- wv->name = (char *) XSTRING_DATA (name);
-
- if (NILP (accel))
- accel = menu_name_to_accelerator (wv->name);
- wv->accel = LISP_TO_VOID (accel);
+ CHECK_STRING (pgui->name);
+ wv->name = (char *) XSTRING_DATA (pgui->name);
+ wv->accel = LISP_TO_VOID (gui_item_accelerator (gui_item));
- if (!NILP (suffix))
+ if (!NILP (pgui->suffix))
{
CONST char *const_bogosity;
Lisp_Object suffix2;
/* Shortcut to avoid evaluating suffix each time */
- if (STRINGP (suffix))
- suffix2 = suffix;
+ if (STRINGP (pgui->suffix))
+ suffix2 = pgui->suffix;
else
{
- suffix2 = Feval (suffix);
+ suffix2 = Feval (pgui->suffix);
CHECK_STRING (suffix2);
}
wv->value = xstrdup (wv->value);
}
- wv_set_evalable_slot (wv->enabled, active_p);
- wv_set_evalable_slot (wv->selected, selected_p);
+ wv_set_evalable_slot (wv->enabled, pgui->active);
+ wv_set_evalable_slot (wv->selected, pgui->selected);
- wv->call_data = LISP_TO_VOID (callback);
+ if (!NILP (pgui->callback))
+ wv->call_data = LISP_TO_VOID (pgui->callback);
if (no_keys_p
#ifdef HAVE_MENUBARS
#endif
)
wv->key = 0;
- else if (!NILP (keys)) /* Use this string to generate key bindings */
+ else if (!NILP (pgui->keys)) /* Use this string to generate key bindings */
{
- CHECK_STRING (keys);
- keys = Fsubstitute_command_keys (keys);
- if (XSTRING_LENGTH (keys) > 0)
- wv->key = xstrdup ((char *) XSTRING_DATA (keys));
+ CHECK_STRING (pgui->keys);
+ pgui->keys = Fsubstitute_command_keys (pgui->keys);
+ if (XSTRING_LENGTH (pgui->keys) > 0)
+ wv->key = xstrdup ((char *) XSTRING_DATA (pgui->keys));
else
wv->key = 0;
}
- else if (SYMBOLP (callback)) /* Show the binding of this command. */
+ else if (SYMBOLP (pgui->callback)) /* Show the binding of this command. */
{
char buf [1024];
/* #### Warning, dependency here on current_buffer and point */
- where_is_to_char (callback, buf);
+ where_is_to_char (pgui->callback, buf);
if (buf [0])
wv->key = xstrdup (buf);
else
wv->key = 0;
}
- CHECK_SYMBOL (style);
- if (NILP (style))
+ CHECK_SYMBOL (pgui->style);
+ if (NILP (pgui->style))
{
/* If the callback is nil, treat this item like unselectable text.
This way, dashes will show up as a separator. */
wv->type = BUTTON_TYPE;
}
}
- else if (EQ (style, Qbutton))
+ else if (EQ (pgui->style, Qbutton))
wv->type = BUTTON_TYPE;
- else if (EQ (style, Qtoggle))
+ else if (EQ (pgui->style, Qtoggle))
wv->type = TOGGLE_TYPE;
- else if (EQ (style, Qradio))
+ else if (EQ (pgui->style, Qradio))
wv->type = RADIO_TYPE;
- else if (EQ (style, Qtext))
+ else if (EQ (pgui->style, Qtext))
{
wv->type = TEXT_TYPE;
#if 0
#endif
}
else
- signal_simple_error_2 ("Unknown style", style, desc);
+ signal_simple_error_2 ("Unknown style", pgui->style, gui_item);
if (!allow_text_field_p && (wv->type == TEXT_TYPE))
- signal_simple_error ("Text field not allowed in this context", desc);
+ signal_simple_error ("Text field not allowed in this context", gui_item);
- if (selected_spec && EQ (style, Qtext))
+ if (!NILP (pgui->selected) && EQ (pgui->style, Qtext))
signal_simple_error (
- ":selected only makes sense with :style toggle, radio or button",
- desc);
+ ":selected only makes sense with :style toggle, radio or button",
+ gui_item);
return 1;
}
-#endif /* HAVE_POPUPS */
/* This is a kludge to make sure emacs can only link against a version of
lwlib that was compiled in the right way. Emacs references symbols which
void
syms_of_gui_x (void)
{
-#ifdef HAVE_POPUPS
defsymbol (&Qmenu_no_selection_hook, "menu-no-selection-hook");
-#endif
}
void
{
lwlib_id_tick = (1<<16); /* start big, to not conflict with Energize */
-#ifdef HAVE_POPUPS
popup_up_p = 0;
Vpopup_callbacks = Qnil;
*/ );
#endif
Fset (Qmenu_no_selection_hook, Qnil);
-#endif /* HAVE_POPUPS */
/* this makes only safe calls as in emacs.c */
sanity_check_lwlib ();
else if (EQ (key, Q_callback)) pgui_item->callback = val;
else if (EQ (key, Q_key_sequence)) ; /* ignored for FSF compatability */
else if (EQ (key, Q_label)) ; /* ignored for 21.0 implement in 21.2 */
+ else if (EQ (key, Q_accelerator))
+ {
+ if (SYMBOLP (val) || CHARP (val))
+ pgui_item->accelerator = val;
+ else if (ERRB_EQ (errb, ERROR_ME))
+ signal_simple_error ("Bad keyboard accelerator", val);
+ }
else if (ERRB_EQ (errb, ERROR_ME))
signal_simple_error_2 ("Unknown keyword in gui item", key, pgui_item->name);
}
lp->style = Qnil;
lp->selected = Qnil;
lp->keys = Qnil;
+ lp->accelerator = Qnil;
}
Lisp_Object
Fplist_put (plist, Q_selected, pgui_item->selected);
if (!NILP (pgui_item->keys))
Fplist_put (plist, Q_keys, pgui_item->keys);
+ if (!NILP (pgui_item->accelerator))
+ Fplist_put (plist, Q_accelerator, pgui_item->accelerator);
}
/*
|| !NILP (Feval (XGUI_ITEM (gui_item)->active)));
}
+/* set menu accelerator key to first underlined character in menu name */
+Lisp_Object
+gui_item_accelerator (Lisp_Object gui_item)
+{
+ struct Lisp_Gui_Item* pgui = XGUI_ITEM (gui_item);
+
+ if (!NILP (pgui->accelerator))
+ return pgui->accelerator;
+
+ else
+ return pgui->name;
+}
+
+Lisp_Object
+gui_name_accelerator (Lisp_Object nm)
+{
+ /* !!#### This function has not been Mule-ized */
+ char* name = (char*)XSTRING_DATA (nm);
+
+ while (*name) {
+ if (*name=='%') {
+ ++name;
+ if (!(*name))
+ return Qnil;
+ if (*name=='_' && *(name+1))
+ {
+ int accelerator = (int) (unsigned char) (*(name+1));
+ return make_char (tolower (accelerator));
+ }
+ }
+ ++name;
+ }
+ return Qnil;
+}
+
/*
* Decide whether a GUI item is selected by evaluating its :selected form
* if any
markobj (p->name);
markobj (p->callback);
+ markobj (p->config);
markobj (p->suffix);
markobj (p->active);
markobj (p->included);
markobj (p->style);
markobj (p->selected);
markobj (p->keys);
+ markobj (p->accelerator);
return Qnil;
}
&&
EQ (p1->selected, p2->selected)
&&
+ EQ (p1->accelerator, p2->accelerator)
+ &&
EQ (p1->keys, p2->keys)))
return 0;
return 1;
Lisp_Object style; /* Symbol */
Lisp_Object selected; /* Form */
Lisp_Object keys; /* String */
+ Lisp_Object accelerator; /* Char or Symbol */
};
extern Lisp_Object Q_accelerator, Q_active, Q_config, Q_filter, Q_included;
int gui_item_active_p (Lisp_Object);
int gui_item_selected_p (Lisp_Object);
int gui_item_included_p (Lisp_Object, Lisp_Object into);
+Lisp_Object gui_item_accelerator (Lisp_Object gui_item);
+Lisp_Object gui_name_accelerator (Lisp_Object name);
int gui_item_id_hash (Lisp_Object, Lisp_Object gui_item, int);
unsigned int gui_item_display_flush_left (Lisp_Object pgui_item,
char* buf, Bytecount buf_len);
#define GUI_ITEM_ID_MAX(s) (0x1FFF + GUI_ITEM_ID_MIN (s))
#define GUI_ITEM_ID_BITS(x,s) (((x) & 0x1FFF) + GUI_ITEM_ID_MIN (s))
+#define MAX_MENUITEM_LENGTH 128
+
#endif /* _XEMACS_GUI_H_ */
EXFUN (Fprocess_status, 1);
EXFUN (Fprogn, UNEVALLED);
EXFUN (Fprovide, 1);
+EXFUN (Fprovide_on_console, 2);
EXFUN (Fpurecopy, 1);
EXFUN (Fput, 3);
EXFUN (Fput_range_table, 4);
#define MENU_ITEM_ID_BITS(x) (((x) & 0x7FFF) | 0x8000)
static HMENU top_level_menu;
-#define MAX_MENUITEM_LENGTH 128
-
/*
* This returns Windows-style menu item string:
* "Left Flush\tRight Flush"
}
else if (VECTORP (desc))
{
- if (!button_item_to_widget_value (desc, wv, 1,
+ Lisp_Object gui_item = gui_parse_item_keywords (desc);
+ if (!button_item_to_widget_value (gui_item, wv, 1,
(menu_type == MENUBAR_TYPE
&& depth <= 1)))
{
wv->enabled = 1;
wv->name = (char *) XSTRING_DATA (LISP_GETTEXT (XCAR (desc)));
- accel = menu_name_to_accelerator (wv->name);
+ accel = gui_name_accelerator (LISP_GETTEXT (XCAR (desc)));
wv->accel = LISP_TO_VOID (accel);
desc = Fcdr (desc);
* YMMV. I build with NT4 SP3.
*
* Andy Piper <andy@xemacs.org> 8/1/98
- * http://www.parallax.co.uk/~andyp */
+ * http://www.xemacs.freeserve.co.uk/ */
/* cheesy way to determine cygwin version */
#ifndef NOT_C_CODE
}
\f
-
+#ifdef MULE
/* Return 1 if there is a word boundary between two word-constituent
characters C1 and C2 if they appear in this order, else return 0.
There is no word boundary between two word-constituent ASCII
&& word_boundary_p (c1, c2))
extern int word_boundary_p (Emchar c1, Emchar c2);
+#else
+static int
+word_constituent_p (struct buffer *buf, Bufpos pos,
+ struct Lisp_Char_Table *tab)
+{
+ enum syntaxcode code = SYNTAX_UNSAFE (tab, BUF_FETCH_CHAR (buf, pos));
+ return ((words_include_escapes &&
+ (code == Sescape || code == Scharquote))
+ || (code == Sword));
+}
+#endif
/* Return the position across COUNT words from FROM.
If that many words cannot be found before the end of the buffer, return 0.
{
Bufpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf);
struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+#ifdef MULE
Emchar ch0, ch1;
enum syntaxcode code;
+#endif
while (count > 0)
{
{
if (from == limit)
return 0;
+#ifdef MULE
ch0 = BUF_FETCH_CHAR (buf, from);
code = SYNTAX_UNSAFE (mirrortab, ch0);
+#else
+ if (word_constituent_p (buf, from, mirrortab))
+ break;
+#endif
from++;
+#ifdef MULE
if (words_include_escapes
&& (code == Sescape || code == Scharquote))
break;
if (code == Sword)
break;
+#endif
}
QUIT;
- while ( from != limit )
+ while ((from != limit)
+#ifndef MULE
+ && word_constituent_p (buf, from, mirrortab)
+#endif
+ )
{
+#ifdef MULE
ch1 = BUF_FETCH_CHAR (buf, from);
code = SYNTAX_UNSAFE (mirrortab, ch1);
if (!(words_include_escapes
&& (code == Sescape || code == Scharquote)))
if (code != Sword || WORD_BOUNDARY_P (ch0, ch1))
break;
- from++;
ch0 = ch1;
+#endif
+ from++;
}
count--;
}
{
if (from == limit)
return 0;
+#ifndef MULE
+ if (word_constituent_p (buf, from - 1, mirrortab))
+ break;
+#endif
from--;
+#ifdef MULE
ch1 = BUF_FETCH_CHAR (buf, from - 1);
code = SYNTAX_UNSAFE (mirrortab, ch1);
if (words_include_escapes
break;
if (code == Sword)
break;
+#endif
}
QUIT;
- while ( from != limit )
+ while ((from != limit)
+#ifndef MULE
+ && word_constituent_p (buf, from - 1, mirrortab)
+#endif
+ )
{
+#ifdef MULE
ch0 = BUF_FETCH_CHAR (buf, from - 1);
code = SYNTAX_UNSAFE (mirrortab, ch0);
if (!(words_include_escapes
&& (code == Sescape || code == Scharquote)))
if (code != Sword || WORD_BOUNDARY_P (ch0, ch1))
break;
- from--;
ch1 = ch0;
+#endif
+ from--;
}
count++;
}
(make-extent (point) (point))
(make-glyph [button :descriptor ["ok" (setq ok-select nil) :style radio
:selected (not ok-select)]]))
+;; toggle button
+(set-extent-begin-glyph
+ (make-extent (point) (point))
+ (setq tbutton
+ (make-glyph [button :descriptor ["ok" (setq ok-select nil)
+ :style toggle
+ :selected (not ok-select)]])))
+(set-extent-begin-glyph
+ (make-extent (point) (point))
+ (make-glyph [button :descriptor ["ok" :style toggle
+ :callback
+ (setq ok-select (not ok-select))
+ :selected ok-select]]))
+
;; normal pushbutton
(set-extent-begin-glyph
(make-extent (point) (point))
(setq pbutton (make-glyph
- [button :width 10 :height 2
+ [button :width 10 :height 2
:face modeline-mousable
:descriptor "ok" :callback foo
:selected t])))
-
;; tree view
(set-extent-begin-glyph
(make-extent (point) (point))
(setq tree (make-glyph
- [tree :width 10
- :descriptor "My Tree"
- :properties (:items (["One" foo]
- (["Two" foo]
- ["Four" foo]
- "Six")
- "Three"))])))
+ [tree-view :width 10
+ :descriptor "My Tree"
+ :properties (:items (["One" foo]
+ (["Two" foo]
+ ["Four" foo]
+ "Six")
+ "Three"))])))
;; tab control
(set-extent-begin-glyph
(make-extent (point) (point))
(setq tab (make-glyph
- [tab :descriptor "My Tab"
- :face default
- :properties (:items (["One" foo]
- ["Two" foo]
- ["Three" foo]))])))
+ [tab-control :descriptor "My Tab"
+ :face default
+ :properties (:items (["One" foo]
+ ["Two" foo]
+ ["Three" foo]))])))
;; progress gauge
(set-extent-begin-glyph
(make-extent (point) (point))
(setq pgauge (make-glyph
- [progress :width 10 :height 2
- :descriptor "ok"])))
+ [progress-gauge :width 10 :height 2
+ :descriptor "ok"])))
;; progress the progress ...
(let ((x 0))
(while (<= x 100)
(setq global-mode-string
(cons (make-extent nil nil)
(setq pg (make-glyph
- [progress :width 5 :pixel-height 16
- :descriptor "ok"]))))
+ [progress-gauge :width 5 :pixel-height 16
+ :descriptor "ok"]))))
;; progress the progress ...
(let ((x 0))
(while (<= x 100)
;; edit box
(set-extent-begin-glyph
(make-extent (point) (point))
- (setq hedit (make-glyph [edit :pixel-width 50 :pixel-height 30
- :face bold-italic
- :descriptor ["Hello"]])))
+ (setq hedit (make-glyph [edit-field :pixel-width 50 :pixel-height 30
+ :face bold-italic
+ :descriptor ["Hello"]])))
;; combo box
(set-extent-begin-glyph
(make-extent (point) (point))
(setq hcombo (make-glyph
- [combo :width 10 :height 3 :descriptor ["Hello"]
- :properties (:items ("One" "Two" "Three"))])))
+ [combo-box :width 10 :height 3 :descriptor ["Hello"]
+ :properties (:items ("One" "Two" "Three"))])))
;; line
(set-extent-begin-glyph
; (make-glyph [scrollbar :width 50 :height 20 :descriptor ["Hello"]]))
;; generic subwindow
-(setq sw (make-glyph [subwindow :pixel-width 50 :pixel-height 50]))
+(setq sw (make-glyph [subwindow :pixel-width 50 :pixel-height 70]))
(set-extent-begin-glyph (make-extent (point) (point)) sw)