From 1c97bf160520f9e0b193236a902eb4b73d59d134 Mon Sep 17 00:00:00 2001 From: tomo Date: Wed, 30 Jun 1999 10:33:11 +0000 Subject: [PATCH] Contents in release-21-2 at 1999-06-30-19. --- CHANGES-beta | 2 + README.packages | 4 +- etc/NEWS | 12 ++ lisp/ChangeLog | 10 ++ lisp/cus-face.el | 2 +- lisp/packages.el | 7 +- lwlib/ChangeLog | 22 +++ lwlib/lwlib-Xm.c | 185 +++++++++++++++++++++--- lwlib/lwlib.c | 26 ++++ lwlib/lwlib.h | 10 +- man/xemacs/packages.texi | 24 ++-- src/ChangeLog | 124 ++++++++++++++++ src/console.c | 9 ++ src/console.h | 7 + src/dialog-x.c | 5 +- src/event-Xt.c | 35 ++++- src/event-msw.c | 9 +- src/fns.c | 49 ++++++- src/glyphs-msw.c | 70 +++++---- src/glyphs-widget.c | 102 ++++++------- src/glyphs-x.c | 359 ++++++++++++++++++++++++++++++++++++++++++++-- src/glyphs-x.h | 34 ++++- src/glyphs.h | 4 +- src/gui-x.c | 179 ++++++----------------- src/gui.c | 49 +++++++ src/gui.h | 5 + src/lisp.h | 1 + src/menubar-msw.c | 2 - src/menubar-x.c | 5 +- src/s/cygwin32.h | 2 +- src/syntax.c | 48 ++++++- tests/glyph-test.el | 61 ++++---- 32 files changed, 1134 insertions(+), 329 deletions(-) diff --git a/CHANGES-beta b/CHANGES-beta index 525f4f6..9b9b8a7 100644 --- a/CHANGES-beta +++ b/CHANGES-beta @@ -1,5 +1,7 @@ -*- 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 diff --git a/README.packages b/README.packages index e74d442..4ac2cfa 100644 --- a/README.packages +++ b/README.packages @@ -213,9 +213,9 @@ User Package directories ------------------------ 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 -------------------- diff --git a/etc/NEWS b/etc/NEWS index f2cb4cb..ce047cd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -108,6 +108,18 @@ will use this at build time. ** 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 + * Lisp and internal changes in XEmacs 21.2 ========================================== diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d902e68..8b07788 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +1999-06-25 Charles G Waldman + + * cus-face.el (custom-face-italic): insert missing args + +1999-06-24 Michael Sperber [Mr. Preprocessor] + + * packages.el (package-locations): Changed default early package + hierarchies to ~/.xemacs/mule-packages and + ~/.xemacs/xemacs-packages. + 1999-06-23 SL Baur * mule/mule-category.el (Top Level): ASCII is also latin-1. diff --git a/lisp/cus-face.el b/lisp/cus-face.el index ddc6c87..cf4755d 100644 --- a/lisp/cus-face.el +++ b/lisp/cus-face.el @@ -184,7 +184,7 @@ If FRAME is nil, use the default face." (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))) diff --git a/lisp/packages.el b/lisp/packages.el index eb3b4a7..1e374bf 100644 --- a/lisp/packages.el +++ b/lisp/packages.el @@ -86,13 +86,14 @@ (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. diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 736e05d..60391ae 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,25 @@ +1999-06-28 Andy Piper + + * 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 + + * 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 * XEmacs 21.2.17 is released diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index 80c7b13..98f570c 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -60,15 +60,17 @@ Boston, MA 02111-1307, USA. */ #include #include #include +#include +#if XmVERSION > 1 +#include +#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); @@ -658,8 +660,6 @@ xm_update_menu (widget_instance* instance, Widget widget, widget_value* val, #endif /* LWLIB_MENUBARS_MOTIF */ -#ifdef LWLIB_DIALOGS_MOTIF - /* update text widgets */ static void @@ -685,7 +685,6 @@ xm_update_text_field (widget_instance* instance, Widget widget, xm_internal_update_other_instances, instance); } -#endif /* LWLIB_DIALOGS_MOTIF */ #ifdef LWLIB_SCROLLBARS_MOTIF @@ -778,11 +777,9 @@ xm_update_one_widget (widget_instance* instance, Widget widget, 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 */ @@ -816,7 +813,6 @@ xm_update_one_widget (widget_instance* instance, Widget widget, xm_update_menu (instance, widget, val, deep_p); #endif } -#ifdef LWLIB_DIALOGS_MOTIF else if (class == xmTextWidgetClass) { xm_update_text (instance, widget, val); @@ -825,7 +821,6 @@ xm_update_one_widget (widget_instance* instance, Widget widget, { xm_update_text_field (instance, widget, val); } -#endif else if (class == xmListWidgetClass) { xm_update_list (instance, widget, val); @@ -861,7 +856,6 @@ xm_update_one_value (widget_instance* instance, Widget widget, XtGetValues (widget, al, 1); val->edited = True; } -#ifdef LWLIB_DIALOGS_MOTIF else if (class == xmTextWidgetClass) { if (val->value) @@ -876,7 +870,6 @@ xm_update_one_value (widget_instance* instance, Widget widget, val->value = XmTextFieldGetString (widget); val->edited = True; } -#endif else if (class == xmRowColumnWidgetClass) { Boolean radiobox = 0; @@ -946,7 +939,7 @@ xm_update_one_value (widget_instance* instance, Widget widget, /* 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 @@ -1571,7 +1564,151 @@ make_horizontal_scrollbar (widget_instance *instance) #endif /* LWLIB_SCROLLBARS_MOTIF */ - /* 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 + + +/* Table of functions to create widgets */ widget_creation_entry xm_creation_table [] = @@ -1584,6 +1721,12 @@ 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} }; @@ -1795,6 +1938,12 @@ xm_generic_callback (Widget widget, XtPointer closure, XtPointer call_data) 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 @@ -1830,14 +1979,6 @@ xm_pull_down_callback (Widget widget, XtPointer closure, XtPointer call_data) 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 diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c index 20c160f..dcbc0b2 100644 --- a/lwlib/lwlib.c +++ b/lwlib/lwlib.c @@ -155,6 +155,12 @@ free_widget_value_contents (widget_value *wv) 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); @@ -263,6 +269,13 @@ copy_widget_value_tree (widget_value *val, change_type change) 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 @@ -1300,3 +1313,16 @@ lw_show_busy (Widget w, Boolean busy) } } } + +void lw_add_value_args_to_args (widget_value* wv, ArgList addto, int* offset) +{ + int i; + if (wv->nargs && wv->args) + { + for (i = 0; inargs; i++) + { + addto[i + *offset] = wv->args[i]; + } + *offset += wv->nargs; + } +} diff --git a/lwlib/lwlib.h b/lwlib/lwlib.h index b770831..96dfa56 100644 --- a/lwlib/lwlib.h +++ b/lwlib/lwlib.h @@ -148,9 +148,14 @@ typedef struct _widget_value 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; @@ -201,6 +206,7 @@ widget_value* lw_get_all_values (LWLIB_ID id); 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 *); diff --git a/man/xemacs/packages.texi b/man/xemacs/packages.texi index 91ac7fb..4810382 100644 --- a/man/xemacs/packages.texi +++ b/man/xemacs/packages.texi @@ -258,13 +258,18 @@ it depends upon. @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 @@ -278,12 +283,13 @@ To install binary packages manually: 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 diff --git a/src/ChangeLog b/src/ChangeLog index 90780bc..5cb90c3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,127 @@ +1999-06-29 Andy Piper + + * event-msw.c: fix definition booboo. + +1999-06-28 Andy Piper + + * 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 + + * 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 + + * 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 + + * syntax.c (scan_words): Restore non-Mule code. + (word_constituent_p): Restore. + 1999-06-23 Olivier Galibert * config.h.in: Add missing #undef *_USER_DEFINED. diff --git a/src/console.c b/src/console.c index 7e27f86..2b4c637 100644 --- a/src/console.c +++ b/src/console.c @@ -781,6 +781,14 @@ the toolbar, glyphs, etc. 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)); +} + /**********************************************************************/ @@ -1079,6 +1087,7 @@ syms_of_console (void) DEFSUBR (Fconsole_enable_input); DEFSUBR (Fconsole_disable_input); DEFSUBR (Fconsole_on_window_system_p); + DEFSUBR (Fconsole_features); DEFSUBR (Fsuspend_console); DEFSUBR (Fresume_console); diff --git a/src/console.h b/src/console.h index d551141..df4eeb7 100644 --- a/src/console.h +++ b/src/console.h @@ -272,6 +272,9 @@ struct console_methods /* dialog methods */ void (*popup_dialog_box_method) (struct frame *, Lisp_Object dbox_desc); #endif + + /* Console-specific features */ + Lisp_Object features; }; /* @@ -283,7 +286,9 @@ struct console_methods #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 *********/ @@ -349,6 +354,8 @@ struct console_methods * type##_console_methods 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 diff --git a/src/dialog-x.c b/src/dialog-x.c index 918b632..a61eee8 100644 --- a/src/dialog-x.c +++ b/src/dialog-x.c @@ -120,7 +120,7 @@ dbox_descriptor_to_widget_value (Lisp_Object desc) 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)); @@ -163,7 +163,8 @@ dbox_descriptor_to_widget_value (Lisp_Object 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; diff --git a/src/event-Xt.c b/src/event-Xt.c index b729cfa..40c0752 100644 --- a/src/event-Xt.c +++ b/src/event-Xt.c @@ -78,6 +78,7 @@ Boston, MA 02111-1307, USA. */ #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; @@ -1046,6 +1047,7 @@ x_event_to_emacs_event (XEvent *x_event, struct Lisp_Event *emacs_event) { 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); @@ -1058,7 +1060,11 @@ x_event_to_emacs_event (XEvent *x_event, struct Lisp_Event *emacs_event) 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; @@ -1304,6 +1310,9 @@ x_event_to_emacs_event (XEvent *x_event, struct Lisp_Event *emacs_event) 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 */ @@ -1319,7 +1328,26 @@ handle_focus_event_1 (struct frame *f, int in_p) 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; @@ -1404,7 +1432,7 @@ handle_map_event (struct frame *f, XEvent *event) /* 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. @@ -1579,6 +1607,7 @@ emacs_Xt_handle_magic_event (struct Lisp_Event *emacs_event) case FocusIn: case FocusOut: + #ifdef EXTERNAL_WIDGET /* External widget lossage: Ben said: YUCK. The only way to make focus changes work properly is to diff --git a/src/event-msw.c b/src/event-msw.c index e8d8fc0..2a9b919 100644 --- a/src/event-msw.c +++ b/src/event-msw.c @@ -72,6 +72,14 @@ typedef unsigned int SOCKET; #include #include +#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 @@ -1929,7 +1937,6 @@ mswindows_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_NOTIFY: { LPNMHDR nmhdr = (LPNMHDR)lParam; - int idCtrl = (int)wParam; if (nmhdr->code == TTN_NEEDTEXT) { diff --git a/src/fns.c b/src/fns.c index 55d5e2f..bf65f9f 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3231,7 +3231,7 @@ in which case you can't use this. 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. @@ -3266,7 +3266,7 @@ symbol) are not yet supported by FSF Emacs. If you feel they are useful for supporting multiple Emacs variants, lobby Richard Stallman at . */ - (fexp)) + (fexp, console)) { #ifndef FEATUREP_SYNTAX CHECK_SYMBOL (fexp); @@ -3278,7 +3278,11 @@ for supporting multiple Emacs variants, lobby Richard Stallman at 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)) { @@ -3347,6 +3351,7 @@ This function updates the value of the variable `features'. 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); @@ -3354,6 +3359,38 @@ This function updates the value of the variable `features'. 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 @@ -3366,7 +3403,10 @@ If FILENAME is omitted, the printname of FEATURE is used as the file name. 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 { @@ -3877,6 +3917,7 @@ syms_of_fns (void) DEFSUBR (Ffeaturep); DEFSUBR (Frequire); DEFSUBR (Fprovide); + DEFSUBR (Fprovide_on_console); DEFSUBR (Fbase64_encode_region); DEFSUBR (Fbase64_encode_string); DEFSUBR (Fbase64_decode_region); diff --git a/src/glyphs-msw.c b/src/glyphs-msw.c index 4f95bc2..a619dfb 100644 --- a/src/glyphs-msw.c +++ b/src/glyphs-msw.c @@ -61,7 +61,7 @@ DEFINE_DEVICE_IIFORMAT (mswindows, xbm); 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 @@ -69,10 +69,10 @@ DEFINE_DEVICE_IIFORMAT (mswindows, subwindow); 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; @@ -2319,7 +2319,7 @@ mswindows_button_instantiate (Lisp_Object image_instance, Lisp_Object instantiat /* 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) { @@ -2332,7 +2332,7 @@ mswindows_edit_instantiate (Lisp_Object image_instance, Lisp_Object instantiator /* 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) { @@ -2431,7 +2431,7 @@ static void add_tree_item_list (Lisp_Object image_instance, } 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) { @@ -2509,13 +2509,12 @@ static TC_ITEM* add_tab_item (Lisp_Object image_instance, } 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, @@ -2573,7 +2572,7 @@ mswindows_scrollbar_instantiate (Lisp_Object image_instance, Lisp_Object instant /* 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) { @@ -2646,7 +2645,7 @@ mswindows_button_property (Lisp_Object image_instance, Lisp_Object prop) /* 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); @@ -2683,7 +2682,7 @@ mswindows_widget_set_property (Lisp_Object image_instance, Lisp_Object prop, /* 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); @@ -2745,8 +2744,8 @@ image_instantiator_format_create_glyphs_mswindows (void) 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); @@ -2763,27 +2762,27 @@ image_instantiator_format_create_glyphs_mswindows (void) 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"); @@ -2813,25 +2812,24 @@ image_instantiator_format_create_glyphs_mswindows (void) 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); } diff --git a/src/glyphs-widget.c b/src/glyphs-widget.c index 7b4e2bc..3fbf075 100644 --- a/src/glyphs-widget.c +++ b/src/glyphs-widget.c @@ -38,10 +38,10 @@ Boston, MA 02111-1307, USA. */ #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); @@ -51,12 +51,12 @@ Lisp_Object Qgroup; #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; @@ -187,7 +187,7 @@ check_valid_item_list (Lisp_Object data) 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 @@ -270,7 +270,7 @@ widget_validate (Lisp_Object instantiator) } 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))) @@ -434,7 +434,7 @@ widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, /* 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) { @@ -447,7 +447,7 @@ combo_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, } 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) { @@ -541,25 +541,25 @@ image_instantiator_format_create_glyphs_widget (void) 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"); @@ -573,30 +573,30 @@ image_instantiator_format_create_glyphs_widget (void) 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"); diff --git a/src/glyphs-x.c b/src/glyphs-x.c index bbe3cf1..cbd91ed 100644 --- a/src/glyphs-x.c +++ b/src/glyphs-x.c @@ -51,6 +51,7 @@ Boston, MA 02111-1307, USA. */ #include "console-x.h" #include "glyphs-x.h" #include "objects-x.h" +#include "gui-x.h" #include "xmu.h" #include "buffer.h" @@ -58,6 +59,8 @@ Boston, MA 02111-1307, USA. */ #include "frame.h" #include "insdel.h" #include "opaque.h" +#include "gui.h" +#include "faces.h" #include "imgproc.h" @@ -69,6 +72,11 @@ Boston, MA 02111-1307, USA. */ #include "file-coding.h" #endif +#ifdef LWLIB_USES_MOTIF +#include +#endif +#include + #if INTBITS == 32 # define FOUR_BYTE_TYPE unsigned int #elif LONGBITS == 32 @@ -97,6 +105,12 @@ DEFINE_IMAGE_INSTANTIATOR_FORMAT (font); 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, @@ -336,9 +350,16 @@ x_finalize_image_instance (struct Lisp_Image_Instance *p) { 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)); @@ -1967,8 +1988,16 @@ x_colorize_image_instance (Lisp_Object image_instance, 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 @@ -1976,10 +2005,35 @@ x_unmap_subwindow (struct Lisp_Image_Instance *p) 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 */ @@ -2007,11 +2061,7 @@ x_subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, 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)); @@ -2070,6 +2120,263 @@ x_resize_subwindow (struct Lisp_Image_Instance* ii, int w, int h) 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 + } +} + /************************************************************************/ /* initialization */ @@ -2098,6 +2405,7 @@ console_type_create_glyphs_x (void) 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 @@ -2113,6 +2421,25 @@ image_instantiator_format_create_glyphs_x (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); @@ -2181,4 +2508,8 @@ complex_vars_of_glyphs_x (void) 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);*/ } diff --git a/src/glyphs-x.h b/src/glyphs-x.h index ed77321..a2bc03f 100644 --- a/src/glyphs-x.h +++ b/src/glyphs-x.h @@ -80,22 +80,48 @@ struct x_image_instance_data 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_ */ diff --git a/src/glyphs.h b/src/glyphs.h index a0ff30a..cbc8ad1 100644 --- a/src/glyphs.h +++ b/src/glyphs.h @@ -624,8 +624,8 @@ DECLARE_LRECORD (glyph, struct Lisp_Glyph); 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; diff --git a/src/gui-x.c b/src/gui-x.c index f176a57..e35e65e 100644 --- a/src/gui-x.c +++ b/src/gui-x.c @@ -35,11 +35,10 @@ Boston, MA 02111-1307, USA. */ #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; @@ -59,8 +58,6 @@ xmalloc_widget_value (void) } -#ifdef HAVE_POPUPS - struct mark_widget_value_closure { void (*markobj) (Lisp_Object); @@ -259,7 +256,10 @@ popup_selection_callback (Widget widget, LWLIB_ID ignored_id, 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 @@ -315,139 +315,44 @@ menu_separator_style (CONST char *s) 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); } @@ -456,10 +361,11 @@ button_item_to_widget_value (Lisp_Object desc, widget_value *wv, 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 @@ -467,28 +373,28 @@ button_item_to_widget_value (Lisp_Object desc, widget_value *wv, #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. */ @@ -515,13 +421,13 @@ button_item_to_widget_value (Lisp_Object desc, widget_value *wv, 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 @@ -530,19 +436,18 @@ button_item_to_widget_value (Lisp_Object desc, widget_value *wv, #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 @@ -600,9 +505,7 @@ sanity_check_lwlib (void) void syms_of_gui_x (void) { -#ifdef HAVE_POPUPS defsymbol (&Qmenu_no_selection_hook, "menu-no-selection-hook"); -#endif } void @@ -610,7 +513,6 @@ vars_of_gui_x (void) { lwlib_id_tick = (1<<16); /* start big, to not conflict with Energize */ -#ifdef HAVE_POPUPS popup_up_p = 0; Vpopup_callbacks = Qnil; @@ -625,7 +527,6 @@ without a selection having been made. */ ); #endif Fset (Qmenu_no_selection_hook, Qnil); -#endif /* HAVE_POPUPS */ /* this makes only safe calls as in emacs.c */ sanity_check_lwlib (); diff --git a/src/gui.c b/src/gui.c index 587c163..55e6572 100644 --- a/src/gui.c +++ b/src/gui.c @@ -122,6 +122,13 @@ gui_item_add_keyval_pair (Lisp_Object gui_item, 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); } @@ -141,6 +148,7 @@ gui_item_init (Lisp_Object gui_item) lp->style = Qnil; lp->selected = Qnil; lp->keys = Qnil; + lp->accelerator = Qnil; } Lisp_Object @@ -262,6 +270,8 @@ gui_add_item_keywords_to_plist (Lisp_Object plist, Lisp_Object gui_item) 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); } /* @@ -278,6 +288,41 @@ gui_item_active_p (Lisp_Object gui_item) || !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 @@ -427,6 +472,7 @@ mark_gui_item (Lisp_Object obj, void (*markobj) (Lisp_Object)) markobj (p->name); markobj (p->callback); + markobj (p->config); markobj (p->suffix); markobj (p->active); markobj (p->included); @@ -435,6 +481,7 @@ mark_gui_item (Lisp_Object obj, void (*markobj) (Lisp_Object)) markobj (p->style); markobj (p->selected); markobj (p->keys); + markobj (p->accelerator); return Qnil; } @@ -493,6 +540,8 @@ gui_item_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) && EQ (p1->selected, p2->selected) && + EQ (p1->accelerator, p2->accelerator) + && EQ (p1->keys, p2->keys))) return 0; return 1; diff --git a/src/gui.h b/src/gui.h index 362152e..904bd96 100644 --- a/src/gui.h +++ b/src/gui.h @@ -60,6 +60,7 @@ struct Lisp_Gui_Item 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; @@ -74,6 +75,8 @@ Lisp_Object gui_parse_item_keywords_no_errors (Lisp_Object item); 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); @@ -89,4 +92,6 @@ void gui_item_init (Lisp_Object gui_item); #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_ */ diff --git a/src/lisp.h b/src/lisp.h index ba673ac..a615f67 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2739,6 +2739,7 @@ EXFUN (Fprint, 2); 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); diff --git a/src/menubar-msw.c b/src/menubar-msw.c index e3db02f..2681f0f 100644 --- a/src/menubar-msw.c +++ b/src/menubar-msw.c @@ -116,8 +116,6 @@ static Lisp_Object current_hash_table; #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" diff --git a/src/menubar-x.c b/src/menubar-x.c index 61258db..6212281 100644 --- a/src/menubar-x.c +++ b/src/menubar-x.c @@ -131,7 +131,8 @@ menu_item_descriptor_to_widget_value_1 (Lisp_Object desc, } 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))) { @@ -157,7 +158,7 @@ menu_item_descriptor_to_widget_value_1 (Lisp_Object desc, 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); diff --git a/src/s/cygwin32.h b/src/s/cygwin32.h index 2e2148c..65ee42d 100644 --- a/src/s/cygwin32.h +++ b/src/s/cygwin32.h @@ -38,7 +38,7 @@ Boston, MA 02111-1307, USA. */ * YMMV. I build with NT4 SP3. * * Andy Piper 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 diff --git a/src/syntax.c b/src/syntax.c index 16a0902..4fdc4be 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -327,7 +327,7 @@ syntax table. } - +#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 @@ -337,6 +337,17 @@ syntax table. && 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. @@ -347,8 +358,10 @@ scan_words (struct buffer *buf, Bufpos from, int count) { 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) { @@ -358,28 +371,41 @@ scan_words (struct buffer *buf, Bufpos from, int count) { 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--; } @@ -392,7 +418,12 @@ scan_words (struct buffer *buf, Bufpos from, int 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 @@ -400,20 +431,27 @@ scan_words (struct buffer *buf, Bufpos from, int count) 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++; } diff --git a/tests/glyph-test.el b/tests/glyph-test.el index 31bdc9a..fa8859b 100644 --- a/tests/glyph-test.el +++ b/tests/glyph-test.el @@ -17,43 +17,56 @@ (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) @@ -65,8 +78,8 @@ (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) @@ -90,15 +103,15 @@ ;; 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 @@ -111,6 +124,6 @@ ; (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) -- 1.7.10.4