(provide (quote sun-mouse)) (defvar extra-click-wait 150 "\ *Number of milliseconds to wait for an extra click. Set this to zero if you don't want chords or double clicks.") (defvar scrollbar-width 5 "\ *The character width of the scrollbar. The cursor is deemed to be in the right edge scrollbar if it is this near the right edge, and more than two chars past the end of the indicated line. Setting to nil limits the scrollbar to the edge or vertical dividing bar.") (defun make-mousemap nil "\ Returns a new mousemap." (byte-code "B" [nil mousemap] 2)) (defun copy-mousemap (mousemap) "\ Return a copy of mousemap." (byte-code "!" [mousemap copy-alist] 2)) (defun define-mouse (mousemap mouse-list def) "\ Args MOUSEMAP, MOUSE-LIST, DEF. Define MOUSE-LIST in MOUSEMAP as DEF. MOUSE-LIST is a list of atoms specifing a mouse hit according to these rules: * One of these atoms specifies the active region of the definition. text, scrollbar, modeline, minibuffer * One or two or these atoms specify the button or button combination. left, middle, right, double * Any combination of these atoms specify the active shift keys. control, shift, meta * With a single unshifted button, you can add up to indicate an up-click. The atom `double' is used with a button designator to denote a double click. Two button chords are denoted by listing the two buttons. See sun-mouse-handler for the treatment of the form DEF." (byte-code "! #" [mouse-list mousemap def mousemap-set mouse-list-to-mouse-code] 5)) (defun global-set-mouse (mouse-list def) "\ Give MOUSE-EVENT-LIST a local definition of DEF. See define-mouse for a description of MOUSE-EVENT-LIST and DEF. Note that if MOUSE-EVENT-LIST has a local definition in the current buffer, that local definition will continue to shadow any global definition." (interactive "xMouse event: xDefinition: ") (byte-code "È #" [current-global-mousemap mouse-list def nil define-mouse] 4)) (defun local-set-mouse (mouse-list def) "\ Give MOUSE-EVENT-LIST a local definition of DEF. See define-mouse for a description of the arguments. The definition goes in the current buffer's local mousemap. Normally buffers in the same major mode share a local mousemap." (interactive "xMouse event: xDefinition: ") (byte-code "È? #" [current-local-mousemap mouse-list def nil make-mousemap define-mouse] 5)) (defun use-global-mousemap (mousemap) "\ Selects MOUSEMAP as the global mousemap." (byte-code " " [current-global-mousemap mousemap] 2)) (defun use-local-mousemap (mousemap) "\ Selects MOUSEMAP as the local mousemap. nil for MOUSEMAP means no local mousemap." (byte-code " " [current-local-mousemap mousemap] 2)) (defun logtest (x y) "\ True if any bits set in X are also set in Y. Just like the Common Lisp function of the same name." (byte-code " \"!?" [x y zerop logand] 4)) (defconst sm::ButtonBits 7) (defconst sm::ShiftmaskBits 56) (defconst sm::DoubleBits 64) (defconst sm::UpBits 128) (defmacro sm::hit-code (hit) (byte-code "E" [hit nth 0] 3)) (defmacro sm::hit-button (hit) (byte-code "EE" [hit logand sm::ButtonBits nth 0] 5)) (defmacro sm::hit-shiftmask (hit) (byte-code "EE" [hit logand sm::ShiftmaskBits nth 0] 5)) (defmacro sm::hit-double (hit) (byte-code "EE" [hit logand sm::DoubleBits nth 0] 5)) (defmacro sm::hit-up (hit) (byte-code "EE" [hit logand sm::UpBits nth 0] 5)) (defmacro sm::hit-x (hit) (byte-code "E" [hit nth 1] 3)) (defmacro sm::hit-y (hit) (byte-code "E" [hit nth 2] 3)) (defmacro sm::hit-delta (hit) (byte-code "E" [hit nth 3] 3)) (defmacro sm::hit-up-p (hit) (byte-code "DDD" [hit not zerop sm::hit-up] 4)) (defmacro sm::loc-w (loc) (byte-code "E" [loc nth 0] 3)) (defmacro sm::loc-x (loc) (byte-code "E" [loc nth 1] 3)) (defmacro sm::loc-y (loc) (byte-code "E" [loc nth 2] 3)) (defmacro eval-in-buffer (buffer &rest forms) "Macro to switches to BUFFER, evaluates FORMS, returns to original buffer." (byte-code "DD \"EE" [buffer forms let ((StartBuffer (current-buffer))) unwind-protect append progn set-buffer (set-buffer StartBuffer)] 7)) (put (quote eval-in-buffer) (quote lisp-indent-hook) 1) (defmacro eval-in-window (window &rest forms) "Switch to WINDOW, evaluate FORMS, return to original window." (byte-code "DD \"EE" [window forms let ((OriginallySelectedWindow (selected-window))) unwind-protect append progn select-window (select-window OriginallySelectedWindow)] 7)) (put (quote eval-in-window) (quote lisp-indent-hook) 1) (defmacro eval-in-windows (form &optional yesmini) "Switches to each window and evaluates FORM. Optional argument YESMINI says to include the minibuffer as a window. This is a macro, and does not evaluate its arguments." (byte-code " EDEDEDEE" [form yesmini let ((OriginallySelectedWindow (selected-window))) unwind-protect while progn not eq OriginallySelectedWindow select-window next-window nil (select-window OriginallySelectedWindow)] 13)) (put (quote eval-in-window) (quote lisp-indent-hook) 0) (defun move-to-loc (x y) "\ Move cursor to window location X, Y. Handles wrapped and horizontally scrolled lines correctly." (byte-code "!i ! i Z^\\\"