🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #407

dragging modeline

#407
From: Marc Andreessen
Date: Wed, 18 Nov 1992 02:11
92 lines
4019 bytes
Enhanced (read apparently fixed) version follows (disclaimer: I wrote
none of this; it was shamelessly ripped off from IMOUSE and I just
hacked it together one crazy day).

Marc

------- Start of forwarded message -------
From: kanderso@BBN.COM
To: Marc Andreessen <marca@ncsa.uiuc.edu>
Cc: MThome@BBN.COM, Cerys@BBN.COM, ABoulanger@BBN.COM
Subject: Re: Dragging mode line - request 
Date: Wed, 18 Nov 92 09:40:15 -0500

Thanks, i liked your mode line dragging software. However, i did not seem
that the eval-in-window stuff was necessary.  Here's what i'm now using:

;; Date: Tue, 17 Nov 92 19:32:46 -0800
;; From: Marc Andreessen <marca@ncsa.uiuc.edu>
;; To: Kevin Davidson <tkld@cogsci.ed.ac.uk>
;; Cc: epoch@cs.uiuc.edu
;; Subject: Dragging mode line - request
;; References: <11524@burns.ed.ac.uk>

;; Try this......... (you might have to have a few things from the imouse
;; package also; see the FAQ).

;; Marc

;;; Modeline drag support, extracted from Imouse package.

(require 'cl)
(require 'motion)
(require 'drag)

(defvar simplemouse::drag-scroll-start nil
  "Where mouse-drag-scroll started.")
(defvar simplemouse::drag-scroll-win nil
  "The window where mouse-drag-scroll started.")
(defvar simplemouse::drag-scroll-crs nil
  "The cursor used before mouse-drag-scroll started.")

(defvar drag-modeline-glyph 116
  "*The cursor glyph used to indicate drag scrolling.")

;;; KRA 18NOV92: Eval-in-window does not seem to be necessary
; (defun eval-in-window (window &rest forms)
;  "Switch to WINDOW, evaluate FORMS, return to original window."
;  (` (let ((OriginallySelectedWindow (selected-window)))
;       (unwind-protect
;           (progn
;             (select-window (, window))
;             (,@ forms))
;         (select-window OriginallySelectedWindow)))))
; (put 'eval-in-window 'lisp-indent-hook 1)

(defun mouse-move-modeline (mdata)
  "Shrink or stretch a window by dragging its modeline."
  (setq mouse::downp nil) 
  (setq simplemouse::drag-scroll-win (nth 2 mdata))
  (setq simplemouse::drag-scroll-crs (epoch::cursor-glyph nil))
  (let ((modeline (nth 3 (window-pixedges simplemouse::drag-scroll-win))))
    (epoch::warp-pointer (/ (window-pixwidth simplemouse::drag-scroll-win) 2)
			 (- modeline 3)))
  (setq simplemouse::drag-scroll-start (epoch::query-pointer))
  (epoch::cursor-glyph drag-modeline-glyph)
  (message "Hold button down to shrink or stretch window, release it when done."))

(defun mouse-move-modeline-terminate (mdata)
  "The up click handler that goes with mouse-move-modeline.
This actually resizes the window in one fell swoop"
  (unwind-protect
      (let* ((drag-scroll-end   (epoch::query-pointer))
	     (delta-y	    (- (nth 1 simplemouse::drag-scroll-start)
			       (nth 1 drag-scroll-end)))
	     (pixheight	    (window-pixheight simplemouse::drag-scroll-win))
	     (height	    (window-height simplemouse::drag-scroll-win)))
	(unless (< (abs delta-y) 2)
;; KRA	  (eval-in-window simplemouse::drag-scroll-win
	    (move-modeline-up (/ (* delta-y height) pixheight))
;; KRA	    )
	  ))
    ;; Restore normal environment.
    (epoch::cursor-glyph simplemouse::drag-scroll-crs)
    (message "width: %d, height: %d"
	     (window-width simplemouse::drag-scroll-win)
	     (window-height simplemouse::drag-scroll-win)))
  )

;;; Moved to my epoch-init.el
;;; (global-set-mouse mouse-mode-middle mouse-down 'mouse-move-modeline)
;;; (global-set-mouse mouse-mode-middle mouse-up 'mouse-move-modeline-terminate)
------- End of forwarded message -------
Technical Details
Message-ID: <9211181811.AA07224@wintermute.ncsa.uiuc.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!ncsa.uiuc.edu!marca

Show Full Headers
Complete Article Headers
Newsgroups: gnu.epoch.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!ncsa.uiuc.edu!marca
From: marca@ncsa.uiuc.edu (Marc Andreessen)
Subject: dragging modeline
Message-ID: <9211181811.AA07224@wintermute.ncsa.uiuc.edu>
Sender: daemon@cis.ohio-state.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 18 Nov 1992 02:11:06 GMT
Lines: 93