🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #779

Re: shrink or enlarge window

#779
From: Kermit Tensmeyer
Date: Fri, 21 May 1993 20:22
97 lines
4335 bytes
In article <C7An0u.1Kzu@hawnews.watson.ibm.com> rekers@watson.ibm.com (Jan Rekers) writes:
>In article <JAEHO.93May19153426@poas.engin.umich.edu>, jaeho@engin.umich.edu (Jaeho Lee) writes:
>|> Is there any implementation of mouse-based shrink-window and
>|> enlarge-window in epoch? It would be great if I can point the
>|> mode-line (the mode-line spliting two windows) and drag it to enlarge
>|> or shrink the window.
>
>According to me, the biggest advantage of epoch over emacs is the fact
>that you can use a separate X window for every buffer. This allows you
>to use your windowmanager for these kind of things.
>

   there is also a package called m-modeline that require basic Epoch functions


also include here for you use...


------------Cut Here--------

;;; 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.")

(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)
	  (eval-in-window simplemouse::drag-scroll-win
	    (move-modeline-up (/ (* delta-y height) pixheight)))))
    ;; 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)))
  )

(defun simplemouse-do-bindings ()
  "Bind the mouse keys according to Simplemouse's preferences."
  (let ((MODE-MODIFY  (+ mouse-middle mouse-mode -1))
	(DOWN	      mouse-down)
	(UP	      mouse-up))
    (global-set-mouse MODE-MODIFY DOWN	'mouse-move-modeline)
    (global-set-mouse MODE-MODIFY UP	'mouse-move-modeline-terminate)
    ))

(simplemouse-do-bindings)





--------- Cut Here -----------

-- 
         Kermit Tensmeyer                         | Intergraph Corporation
   kltensme@kt8127.b23a.ingr.com                       | Deep in Dixie
Technical Details
Message-ID: <1993May21.202218.24841@infonode.ingr.com>
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!news.cac.psu.edu!howland.reston.ans.net!ux1.cso.uiuc.edu!sdd.hp.com!cs.utexas.edu!uunet!infonode!kltensme
References: <JAEHO.93May19153426@poas.engin.umich.edu> <C7An0u.1Kzu@hawnews.watson.ibm.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc7ee,a14a53ebac31bbc0
X-Google-Attributes: gidfc7ee,public
X-Google-ArrivalTime: 1993-05-21 13:46:17 PST
Newsgroups: gnu.epoch.misc
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!news.cac.psu.edu!howland.reston.ans.net!ux1.cso.uiuc.edu!sdd.hp.com!cs.utexas.edu!uunet!infonode!kltensme
From: kltensme@infonode.ingr.com (Kermit Tensmeyer)
Subject: Re: shrink or enlarge window
Message-ID: <1993May21.202218.24841@infonode.ingr.com>
Organization: Intergraph
References: <JAEHO.93May19153426@poas.engin.umich.edu> <C7An0u.1Kzu@hawnews.watson.ibm.com>
Date: Fri, 21 May 1993 20:22:18 GMT
Lines: 97