Mercurial > hg > xemacs-beta
annotate lisp/gui.el @ 5013:ae48681c47fa
changes to VOID_TO_LISP et al.
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-02-08 Ben Wing <ben@xemacs.org>
* casetab.c (compute_canon_mapper):
* casetab.c (initialize_identity_mapper):
* casetab.c (compute_up_or_eqv_mapper):
* casetab.c (recompute_case_table):
* casetab.c (set_case_table):
* chartab.c (copy_mapper):
* chartab.c (copy_char_table_range):
* chartab.c (get_range_char_table_1):
* console.c (find_nonminibuffer_frame_not_on_console_predicate):
* console.c (find_nonminibuffer_frame_not_on_console):
* console.c (nuke_all_console_slots):
* device.c:
* device.c (find_nonminibuffer_frame_not_on_device_predicate):
* device.c (find_nonminibuffer_frame_not_on_device):
* dialog-msw.c (dialog_proc):
* dialog-msw.c (handle_question_dialog_box):
* dialog-x.c (maybe_run_dbox_text_callback):
* eval.c:
* eval.c (safe_run_hook_trapping_problems_1):
* eval.c (safe_run_hook_trapping_problems):
* event-msw.c:
* event-msw.c (mswindows_wnd_proc):
* event-msw.c (mswindows_find_frame):
* faces.c (update_face_inheritance_mapper):
* frame-msw.c (mswindows_init_frame_1):
* frame-msw.c (mswindows_get_mouse_position):
* frame-msw.c (mswindows_get_frame_parent):
* glade.c (connector):
* glade.c (Fglade_xml_signal_connect):
* glade.c (Fglade_xml_signal_autoconnect):
* glade.c (Fglade_xml_textdomain):
* glyphs-msw.c (mswindows_subwindow_instantiate):
* glyphs-msw.c (mswindows_widget_instantiate):
* glyphs.c (check_instance_cache_mapper):
* glyphs.c (check_window_subwindow_cache):
* glyphs.c (check_image_instance_structure):
* gui-x.c (snarf_widget_value_mapper):
* gui-x.c (popup_selection_callback):
* gui-x.c (button_item_to_widget_value):
* keymap.c (map_keymap_mapper):
* keymap.c (Fmap_keymap):
* menubar-gtk.c (__torn_off_sir):
* menubar-gtk.c (__activate_menu):
* menubar-gtk.c (menu_convert):
* menubar-gtk.c (__generic_button_callback):
* menubar-gtk.c (menu_descriptor_to_widget_1):
* menubar-msw.c:
* menubar-msw.c (EMPTY_ITEM_ID):
* menubar-x.c (menu_item_descriptor_to_widget_value_1):
* menubar-x.c (pre_activate_callback):
* menubar-x.c (command_builder_operate_menu_accelerator):
* menubar-x.c (command_builder_find_menu_accelerator):
* print.c (print_internal):
* process-unix.c (close_process_descs_mapfun):
* process.c (get_process_from_usid):
* process.c (init_process_io_handles):
* profile.c (sigprof_handler):
* profile.c (get_profiling_info_timing_maphash):
* profile.c (Fget_profiling_info):
* profile.c (set_profiling_info_timing_maphash):
* profile.c (mark_profiling_info_maphash):
* scrollbar-msw.c (mswindows_create_scrollbar_instance):
* scrollbar-msw.c (mswindows_free_scrollbar_instance):
* scrollbar-msw.c (mswindows_handle_scrollbar_event):
* specifier.c (recompute_cached_specifier_everywhere_mapfun):
* specifier.c (recompute_cached_specifier_everywhere):
* syntax.c (copy_to_mirrortab):
* syntax.c (copy_if_not_already_present):
* syntax.c (update_just_this_syntax_table):
* text.c (new_dfc_convert_now_damn_it):
* text.h (LISP_STRING_TO_EXTERNAL):
* tooltalk.c:
* tooltalk.c (tooltalk_message_callback):
* tooltalk.c (tooltalk_pattern_callback):
* tooltalk.c (Fcreate_tooltalk_message):
* tooltalk.c (Fcreate_tooltalk_pattern):
* ui-byhand.c (__generic_toolbar_callback):
* ui-byhand.c (generic_toolbar_insert_item):
* ui-byhand.c (__emacs_gtk_ctree_recurse_internal):
* ui-byhand.c (Fgtk_ctree_recurse):
* ui-gtk.c (__internal_callback_destroy):
* ui-gtk.c (__internal_callback_marshal):
* ui-gtk.c (Fgtk_signal_connect):
* ui-gtk.c (gtk_type_to_lisp):
* ui-gtk.c (lisp_to_gtk_type):
* ui-gtk.c (lisp_to_gtk_ret_type):
* lisp-disunion.h:
* lisp-disunion.h (NON_LVALUE):
* lisp-union.h:
* lisp.h (LISP_HASH):
Rename:
LISP_TO_VOID -> STORE_LISP_IN_VOID
VOID_TO_LISP -> GET_LISP_FROM_VOID
These new names are meant to clearly identify that the Lisp object
is the source and void the sink, and that they can't be used the
other way around -- they aren't exact opposites despite the old
names. The names are also important given the new functions
created just below. Also, clarify comments in lisp-union.h and
lisp-disunion.h about the use of the functions.
* lisp.h:
New functions STORE_VOID_IN_LISP and GET_VOID_FROM_LISP. These
are different from the above in that the source is a void *
(previously, you had to use make_opaque_ptr()).
* eval.c (restore_lisp_object):
* eval.c (record_unwind_protect_restoring_lisp_object):
* eval.c (struct restore_int):
* eval.c (restore_int):
* eval.c (record_unwind_protect_restoring_int):
* eval.c (free_pointer):
* eval.c (record_unwind_protect_freeing):
* eval.c (free_dynarr):
* eval.c (record_unwind_protect_freeing_dynarr):
* eval.c (unbind_to_1):
Use STORE_VOID_IN_LISP and GET_VOID_FROM_LISP to eliminate the
use of make_opaque_ptr() and mostly eliminate Lisp consing
entirely in the use of these various record_unwind_protect_*
functions as well as internal_bind_* (e.g. internal_bind_int).
* tests.c:
* tests.c (Ftest_store_void_in_lisp):
* tests.c (syms_of_tests):
* tests.c (vars_of_tests):
Add an C-assert-style test to test STORE_VOID_IN_LISP and
GET_VOID_FROM_LISP to make sure the same value comes back that
was put in.
| author | Ben Wing <ben@xemacs.org> |
|---|---|
| date | Mon, 08 Feb 2010 06:42:16 -0600 |
| parents | 79940b592197 |
| children | 308d34e9f07d |
| rev | line source |
|---|---|
| 428 | 1 ;;; gui.el --- Basic GUI functions for XEmacs. |
| 2 | |
| 3 ;; Copyright (C) 1997 Free Software Foundation, Inc. | |
| 4 ;; Copyright (C) 1996 Ben Wing | |
| 5 | |
| 6 ;; Maintainer: XEmacs Development Team | |
| 7 ;; Keywords: internal, dumped | |
| 8 | |
| 9 ;; This file is part of XEmacs. | |
| 10 | |
| 11 ;; XEmacs is free software; you can redistribute it and/or modify it | |
| 12 ;; under the terms of the GNU General Public License as published by | |
| 13 ;; the Free Software Foundation; either version 2, or (at your option) | |
| 14 ;; any later version. | |
| 15 | |
| 16 ;; XEmacs is distributed in the hope that it will be useful, but | |
| 17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 19 ;; General Public License for more details. | |
| 20 | |
| 21 ;; You should have received a copy of the GNU General Public License | |
| 22 ;; along with XEmacs; see the file COPYING. If not, write to the | |
| 23 ;; Free Software Foundation, 59 Temple Place - Suite 330, | |
| 24 ;; Boston, MA 02111-1307, USA. | |
| 25 | |
| 26 ;;; Synched up with: Not in FSF | |
| 27 | |
| 28 ;;; Commentary: | |
| 29 | |
| 30 ;; This file is dumped with XEmacs (when window system support is compiled in). | |
| 31 | |
| 32 ;;; Code: | |
| 33 | |
| 34 (defcustom dialog-frame-plist '(width 60 height 20) | |
| 35 "Plist of frame properties for initially creating a dialog frame. | |
| 36 Properties specified here supersede the values given in | |
| 37 `default-frame-plist'." | |
| 38 :type 'plist | |
| 39 :group 'frames) | |
| 40 | |
| 41 (defun make-dialog-frame (&optional props parent) | |
| 42 "Create a frame suitable for use as a dialog box. | |
| 43 The frame is made a child of PARENT (defaults to the selected frame), | |
| 44 and has additional properties PROPS, as well as `dialog-frame-plist'. | |
| 45 Normally it also has no modelines, menubars, or toolbars." | |
| 46 (or parent (setq parent (selected-frame))) | |
| 47 (let* ((ftop (frame-property parent 'top)) | |
| 48 (fleft (frame-property parent 'left)) | |
| 49 (fwidth (frame-pixel-width parent)) | |
| 50 (fheight (frame-pixel-height parent)) | |
| 51 (fonth (font-height (face-font 'default))) | |
| 52 (fontw (font-width (face-font 'default))) | |
| 53 (props (append props dialog-frame-plist)) | |
| 54 (dfheight (plist-get props 'height)) | |
| 55 (dfwidth (plist-get props 'width)) | |
| 56 ;; under FVWM at least, if I don't specify the initial position, | |
| 57 ;; it ends up always at (0, 0). xwininfo doesn't tell me | |
| 58 ;; that there are any program-specified position hints, so | |
| 59 ;; it must be an FVWM bug. So just be smashing and position | |
| 60 ;; in the center of the selected frame. | |
| 61 (frame (make-frame | |
| 62 (append props | |
| 63 `(popup ,parent initially-unmapped t | |
| 64 menubar-visible-p nil | |
| 65 has-modeline-p nil | |
| 66 default-toolbar-visible-p nil | |
| 67 default-gutter-visible-p nil | |
| 68 modeline-shadow-thickness 0 | |
| 69 left ,(+ fleft (- (/ fwidth 2) | |
| 70 (/ (* dfwidth fontw) | |
| 71 2))) | |
| 72 top ,(+ ftop (- (/ fheight 2) | |
| 73 (/ (* dfheight fonth) | |
| 74 2)))))))) | |
| 75 (set-face-foreground 'modeline [default foreground] frame) | |
| 76 (set-face-background 'modeline [default background] frame) | |
| 77 (make-frame-visible frame) | |
| 78 frame)) | |
| 79 | |
| 80 (defvar gui-button-shadow-thickness 2) | |
| 81 | |
| 82 (defun gui-button-p (object) | |
| 83 "True if OBJECT is a GUI button." | |
| 84 (and (vectorp object) | |
| 85 (> (length object) 0) | |
| 86 (eq 'button (aref object 0)))) | |
| 87 | |
| 88 (make-face 'gui-button-face "Face used for gui buttons") | |
| 89 (if (not (face-differs-from-default-p 'gui-button-face)) | |
| 90 (progn | |
| 91 (set-face-reverse-p 'gui-button-face t) | |
| 711 | 92 (set-face-background 'gui-button-face '(((win color) . "grey75"))) |
| 93 (set-face-foreground 'gui-button-face '(((win color) . "black"))))) | |
| 428 | 94 |
| 454 | 95 |
| 96 (defun gui-button-action (instance action user-data) | |
| 97 (let ((domain (image-instance-domain instance))) | |
| 98 (with-current-buffer (if (windowp domain) | |
| 99 (window-buffer domain) nil) | |
| 100 (funcall action user-data)))) | |
| 101 | |
| 428 | 102 (defun make-gui-button (string &optional action user-data) |
| 103 "Make a GUI button whose label is STRING and whose action is ACTION. | |
| 104 If the button is inserted in a buffer and then clicked on, and ACTION | |
| 454 | 105 is non-nil, ACTION will be called with one argument, USER-DATA. |
| 106 When ACTION is called, the buffer containing the button is made current." | |
| 428 | 107 (vector 'button |
| 108 :descriptor string | |
| 109 :face 'gui-button-face | |
| 454 | 110 :callback-ex `(lambda (image-instance event) |
| 111 (gui-button-action image-instance | |
| 112 (quote ,action) | |
| 113 (quote ,user-data))))) | |
| 428 | 114 |
| 115 (defun insert-gui-button (button &optional pos buffer) | |
| 116 "Insert GUI button BUTTON at POS in BUFFER." | |
| 117 (check-argument-type 'gui-button-p button) | |
| 776 | 118 (if-fboundp 'make-annotation |
| 119 (make-annotation (make-glyph button) | |
| 120 pos 'text buffer nil) | |
| 121 (error 'unimplemented "insert-gui-button requires `annotations' package"))) | |
| 122 | |
| 428 | 123 |
| 124 ;;; gui.el ends here |
