This is largely the patch I intend to apply to 21.2.when-the-dust-has-settled
Now is the time to veto ;)
The patch provides subwindow support and native support for things like
combo boxes, buttons etc in a buffer. The X side has not had the platform
specific stuff implemented yet.
I'm happy with the implementation. I am less convinced about some of the
api which reuses and extends the menu button and glyph api's. Feedback
welcome.
Attached is a screenshot
andy
1998-12-06 Andy Piper <andy(a)xemacs.org>
* glyphs-msw.c (vars_of_glyphs_mswindows): provide widget types
here rather than in glyphs-widget - do this because we only want
to provide what is really available.
* glyphs.c (Fimage_instance_property): new function to get the
properties of image instances. wires through to console specific
methods and then to widget specific methods.
(Fset_image_instance_property): ditto but for setting widget properties.
(check_valid_face): make extern so that it can be used elsewhere.
* glyphs-widget.c (widget_property): new function. gets the
properties of widgets in general and wires the function through to
widget specific ones.
(widget_set_property): ditto but for setting widget properties.
* glyphs-msw.c (mswindows_combo_instantiate): Add functionality to
add items to the list. Play with window styles a bit to get the
desired effect.
(mswindows_widget_property): break out specific widget properties.
(mswindows_button_property): new function. gets the checked state
of a button.
(mswindows_combo_property): new function. gets the current
selection in the combo box.
(mswindows_widget_set_property): new function. sets specific
properties of specific widgets.
* glyphs-widget.c (check_valid_item_list): new function. check
that items for a combo-box are just a list of strings.
(combo_validate): new function. check there is an item list.
(widget_instantiate_1): new function. renamed from
widget_instantiate so that we can do slightly different things for
other widgets.
(widget_instantiate): call widget_instantiate_1.
(combo_instantiate): new function to instantiate combo boxes,
defaults height to the pixel height of the number of items in the
box.
(syms_of_glyphs_widget): move widget keywords here.
(image_instantiator_format_create_glyphs_widget): use new combo
functions.
1998-12-04 Andy Piper <andy(a)xemacs.org>
* event-msw.c (mswindows_wnd_proc): mule-ize.
* glyphs.c (pixmap_to_lisp_data): mule-ize.
* glyphs-msw.c (extract_xpm_color_names): mule-ize.
(resource_name_to_resource): ditto.
(mswindows_resource_instantiate): ditto.
(mswindows_widget_instantiate): ditto.
(mswindows_widget_set_property): ditto.
* redisplay-output.c (redisplay_output_subwindow): don't show
subwindows if they are obscured at the edge of the frame, emacs
gets into some sort of redisplay loop otherwise.
* gui.h: prototype gui_item_selected_p.
* gui.c (gui_item_selected_p): new function to determine the
selected state of a gui_item.
* frame.h (struct frame): add subwindows_changed flag.
* redisplay.c (redisplay_frame): call update_frame_subwindows ().
* glyphs.c (update_subwindow): new function to update a
subwindow's state.
(update_frame_subwindows): new function to update all the
subwindows on a frame.
* console.h (struct console_methods): add update_subwindow.
* glyphs-msw.c (mswindows_widget_property): return selected state
for selected property.
(mswindows_update_subwindow): new function. updates widget glyphs
in redisplay as per menubars or toolbars e.g. selected state.
(console_type_create_glyphs_mswindows): add update_subwindow.
1998-12-03 Andy Piper <andy(a)xemacs.org>
* console-tty.c (syms_of_console_tty): MULE -> FILE_CODING since
tty coding system things are such.
* sound.el (sound-load-list): name changed from sound-load-alist.
(sound-extension-list): name changed from sound-ext-list.
(load-default-sounds): use new names.
(load-sound-file): use new names.
* glyphs-widget.c (widget_face_font_info): new function for
pulling out height and width metrics for a widget's face.
(widget_text_to_pixel_conversion): calculate pixel sizes of text
for widgets.
* event-msw.c (mswindows_drain_windows_queue): translate messages
that are destined for subwindows. This makes edit fields interact
with the keyboard correctly.
nuke warnings by #ifndef'ing out stuff not required by msg select().
* glyphs.h (INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM): new
macro defining the iiforma without the symbol required by widget.
(INITIALIZE_IMAGE_INSTANTIATOR_FORMAT): use it.
* general.c (syms_of_general): add Qwidget, Qselected.
* faces.c (complex_vars_of_faces): add widget face inheriting from
gui-element face.
1998-11-09 Andy Piper <andy(a)xemacs.org>
* window.h (struct window): add a cache of subwindows on a
per-window basis.
* window.c (mark_window): mark the subwindow_instance_cache.
(allocate_window): initialise the subwindow instance_cache.
* toolbar-x.c (x_output_toolbar): call redisplay_clear_region
instead of the devmeth.
(x_clear_toolbar): ditto.
* redisplay-x.c (x_output_display_block): call
redisplay_output_subwindow for subwindows and widgets.
* redisplay-tty.c (tty_output_display_block): add IMAGE_WIDGET to
types to do nothing for.
* lisp.h: declare new widget/subwindow symbols.
* glyphs.c (image_instantiate): cache subwindows on a per-window
basis.
(subwindow_possible_dest_types): new function for subwindow dest
types.
(subwindow_instantiate): generic instantiation of a
subwindow. specialised by device multi-methods.
(Fsubwindowp): moved from glyphs-x.c. adapted for glyph-based
subwindows.
(Fimage_instance_subwindow_id): ditto.
(Fresize_subwindow): ditto.
(Fforce_subwindow_map): ditto.
* glyphs-x.c (x_print_image_instance): remove subwindow
stuff. Handled genrically in glyphs.c.
(x_image_instance_equal): ditto.
(x_image_instance_hash): ditto.
(x_finalize_image_instance): delete subwindows when required.
(mark_subwindow) (print_subwindow) (finalize_subwindow)
(subwindow_hash) (Fmake_subwindow): deleted because of new,
glyph-based, subwindow implementation.
(Fsubwindow_height) (Fsubwindow_width) (Fsubwindow_xid): aliased
in glyphs.el
(Fsubwindowp) (Fresize_subwindow) (Fforce_subwindow_map): moved to
glyphs.c.
(x_unmap_subwindow): new function to unmap X subwindows.
(x_map_subwindow): new function to map X subwindows.
(x_subwindow_instantiate): new function to instantiate X
subwindows.
(x_resize_subwindow): new function to resize X subwindows.
(console_type_create_glyphs_x): add subwindow functions.
(image_instantiator_format_create_glyphs_x): add device
multi-methods for xpm, xbm and subwindow.
* glyphs.el (subwindow-xid): old alias for new subwindow functions.
(subwindow-width): ditto.
(subwindow-height): ditto.
* glyphs-msw.c (mswindows_widget_instantiate): new function for
generally instantiating ms subwindows. Used by
mswindows_*_instantiate.
(mswindows_edit_instantiate): instantiate an edit field on a
mswindows frame.
1998-11-04 Andy Piper <andy(a)xemacs.org>
* symsinit.h: declare new functions.
* redisplay.h: declare new functions.
* redisplay-x.c (x_output_display_block): call
redisplay_clear_region rather than x_clear_region.
(x_output_string): ditto.
(x_output_pixmap): ditto.
(x_clear_to_window_end): ditto.
(x_output_eol_cursor): ditto.
(x_clear_region): only do X specific things. other duties handled
in redisplay_clear_region.
* redisplay-tty.c (tty_clear_region): do tty specific things - some
duties moved to redisplay_clear_region.
* redisplay-output.c (clear_left_border): use
redisplay_clear_region instead of device method.
(clear_right_border): ditto.
(output_display_line): ditto.
(redisplay_output_subwindow): ditto.
(redisplay_clear_top_of_window): ditto.
(redisplay_clear_region): perform duties previously handled by
device methods. call the appropriate device method at the
end. unmap subwindows if necessary.
* redisplay-msw.c (mswindows_output_string): use
redisplay_clear_region instead of mswindows_clear_region.
(mswindows_clear_to_window_end): ditto.
(mswindows_output_display_block): output subwindows when required.
(mswindows_clear_region): only do mswindows specific things,
everything else is now handled in redisplay_clear_region.
* gui.h: add item id hash defines and declare function prototypes.
* gui.c (mark_gui_item): new function for marking gui_items.
(gui_item_hash): generic hash function for generating command ids
for gui_items.
* gui-msw.c: new file.
(mswindows_handle_gui_wm_command): new function to handle widget
callbacks.
* glyphs.h (MAYBE_IIFORMAT_DEVMETH): new function for device
multi-methods.
(IIFORMAT_HAS_SHARED_METHOD): ditto.
(DEFINE_DEVICE_IIFORMAT): ditto.
(INITIALIZE_DEVICE_IIFORMAT): ditto.
(struct Lisp_Image_Instance): add widget and subwindow data plus
appropriate access functions.
* glyphs.c (decode_device_ii_format): new function for decoding
image instantiator functions based on a device type as well as an
image format.
(decode_image_instantiator_format): just call
decode_device_ii_format with nil device.
(add_entry_to_device_ii_format_list): new function for per device
method instances.
(add_entry_to_image_instantiator_format_list): just call
add_entry_to_device_ii_format_list with nil device.
(check_valid_vector): new function.
(instantiate_image_instantiator): instantiate using per-format
method and then per-format-per-device method (device
multi-methods). signal an error if neither is possible.
(mark_image_instance): cope with subwindows and widgets.
(print_image_instance): ditto.
(image_instance_equal): ditto.
(image_instance_hash): ditto.
(allocate_glyph): ditto.
(glyph_width): ditto.
(glyph_height_internal): ditto.
(xpm_instantiate): removed because of device multi-methods.
(mark_subwindow_cachels): new cachel functions for caching
instantiated subwindows on a per-frame basis. mostly copied from
glyph cachel functions.
(update_subwindow_cachel_data): ditto.
(add_subwindow_cachel): ditto.
(get_subwindow_cachel_index): ditto.
(reset_subwindow_cachels): ditto.
(mark_subwindow_cachels_as_not_updated): ditto.
(unmap_subwindow): generic unmapping of subwindows based on cachel
data.
(map_subwindow): ditto.
(initialize_subwindow_image_instance): generic initialisation of
subwindow data.
(syms_of_glyphs): add widget keywords.
* glyphs-x.h (struct x_subwindow_data): convert Lisp_Subwindow to
x_subwindow_data.
1998-11-04 Andy Piper <andy(a)xemacs.org>
* glyphs-widget.c: new file for instantiating widget type glyphs.
(widget_possible_dest_types): new general dest type function for
widgets.
(widget_validate): ditto.
(initialize_widget_image_instance): ditto
(widget_instantiate): ditto. Sets up fg/bg, gui_item parsing
before handing on control to device multi-methods.
(syms_of_glyphs_widget): new function.
(image_instantiator_format_create_glyphs_widget): new function,
added placeholders for button, edit, combo, scrollbar
(vars_of_glyphs_widget): new function.
* glyphs-msw.h (WIDGET_INSTANCE_MSWINDOWS_HANDLE): new define for
storing window ids of widgets.
* glyphs-msw.c (mswindows_finalize_image_instance): cope with
deletion of widget and subwindow glyphs.
(mswindows_unmap_subwindow): new device function for unmapping
subwindows on a msw frame.
(mswindows_map_subwindow): ditto.
(mswindows_register_image_instance): register instantiated widgets
with the widget hastable.
(mswindows_button_instantiate): instantiate a button type widget
on an msw frame.
(mswindows_subwindow_instantiate): instanttiate a subwindow on a
mswindows frame.
(image_instantiator_format_create_glyphs_mswindows): add device
multi-methods for xbm, xpm, subwindow, edit and button.
* frame.h (struct frame): add subwindow_cachels dynarr for caching
information about subwindows visible on the current frame. used by
redisplay_clear_region to unmap subwindows as required.
* frame.c (mark_frame): mark subwindow_cachels.
(allocate_frame_core): instantiate subwindow_cachels.
* frame-msw.c (mswindows_init_frame_1): instntiate and mark the
widget hashtable.
* event-msw.c (mswindows_wnd_proc): add call to
mswindows_handle_gui_wm_command to handle widget callbacks.
* emacs.c (main_1): add calls to glyphs-widget initialisation
routines.
* console.h (struct console_methods): add
unmap/map_subwindow_method for use be redisplay_clear_region to
map and unmap subwindows. Remove xpm and xbm stuff - now dealt
with by image instantiator multi-methods. Add
resize_subwindow_method.
* console-stream.c (stream_clear_region): change signature to
match new generic clear region function.
* configure.in: add gui-msw.o to msw objects.
* Makefile.in.in: add glyphs-widget.o to list of objects.
* console-msw.h (struct mswindows_frame): add widget hashtable for
wiring command ids to callbacks.
---------------------------------------------------------------------------
" .sigs are like your face - rarely seen by you and uglier than you think"
Dr Andy Piper, Technical Architect, Parallax Solutions Ltd
mail: andyp(a)parallax.co.uk web:
www.parallax.co.uk/~andyp