Mercurial > emacs
comparison lisp/mldrag.el @ 20652:9bdfab6be02f
(mldrag-drag-vertical-line): Handle left-side scroll bars.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 16 Jan 1998 19:11:33 +0000 |
parents | 83f275dcd93a |
children | 15a32cd96ea5 |
comparison
equal
deleted
inserted
replaced
20651:0de9f45a1db6 | 20652:9bdfab6be02f |
---|---|
151 This command should be bound to a down-mouse- event, and is most | 151 This command should be bound to a down-mouse- event, and is most |
152 usefully bound with the `vertical-line' or the `vertical-scroll-bar' | 152 usefully bound with the `vertical-line' or the `vertical-scroll-bar' |
153 prefix. Holding down a mouse button and moving the mouse left and | 153 prefix. Holding down a mouse button and moving the mouse left and |
154 right will make the clicked-on window thinner or wider." | 154 right will make the clicked-on window thinner or wider." |
155 (interactive "e") | 155 (interactive "e") |
156 (let ((done nil) | 156 (let* ((done nil) |
157 (echo-keystrokes 0) | 157 (echo-keystrokes 0) |
158 (start-event-frame (window-frame (car (car (cdr start-event))))) | 158 (start-event-frame (window-frame (car (car (cdr start-event))))) |
159 (start-event-window (car (car (cdr start-event)))) | 159 (scroll-bar-left |
160 (start-nwindows (count-windows t)) | 160 (eq (cdr (assq 'vertical-scroll-bars (frame-parameters))) 'left)) |
161 (old-selected-window (selected-window)) | 161 (start-event-window (car (car (cdr start-event)))) |
162 event mouse x left right edges wconfig growth) | 162 (start-nwindows (count-windows t)) |
163 (old-selected-window (selected-window)) | |
164 event mouse x left right edges wconfig growth) | |
163 (if (one-window-p t) | 165 (if (one-window-p t) |
164 (error "Attempt to resize sole ordinary window")) | 166 (error "Attempt to resize sole ordinary window")) |
165 (if (= (nth 2 (window-edges start-event-window)) | 167 (if (if scroll-bar-left |
166 (frame-width start-event-frame)) | 168 (= (nth 2 (window-edges start-event-window)) |
169 (frame-width start-event-frame)) | |
170 (= (nth 0 (window-edges start-event-window)) 0)) | |
167 (error "Attempt to drag rightmost scrollbar")) | 171 (error "Attempt to drag rightmost scrollbar")) |
168 (unwind-protect | 172 (unwind-protect |
169 (track-mouse | 173 (track-mouse |
170 (progn | 174 (progn |
171 ;; enlarge-window only works on the selected window, so | 175 ;; enlarge-window only works on the selected window, so |
202 (t | 206 (t |
203 (setq x (car (cdr mouse)) | 207 (setq x (car (cdr mouse)) |
204 edges (window-edges) | 208 edges (window-edges) |
205 left (nth 0 edges) | 209 left (nth 0 edges) |
206 right (nth 2 edges)) | 210 right (nth 2 edges)) |
211 (setq foo (cons (list x left) foo)) | |
207 ;; scale back a move that would make the | 212 ;; scale back a move that would make the |
208 ;; window too thin. | 213 ;; window too thin. |
209 (cond ((< (- x left -1) window-min-width) | 214 (if scroll-bar-left |
210 (setq x (+ left window-min-width -1)))) | 215 (cond ((< (- right x) window-min-width) |
216 (setq x (- right window-min-width)))) | |
217 (cond ((< (- x left -1) window-min-width) | |
218 (setq x (+ left window-min-width -1))))) | |
211 ;; compute size change needed | 219 ;; compute size change needed |
212 (setq growth (- x right -1) | 220 (setq growth (if scroll-bar-left |
221 (- left x) | |
222 (- x right -1)) | |
213 wconfig (current-window-configuration)) | 223 wconfig (current-window-configuration)) |
224 (message "%s" growth) | |
214 (enlarge-window growth t) | 225 (enlarge-window growth t) |
215 ;; if this window's growth caused another | 226 ;; if this window's growth caused another |
216 ;; window to be deleted because it was too | 227 ;; window to be deleted because it was too |
217 ;; thin, rescind the change. | 228 ;; thin, rescind the change. |
218 ;; | 229 ;; |
219 ;; if size change caused space to be stolen | 230 ;; if size change caused space to be stolen |
220 ;; from a window to the left of this one, | 231 ;; from a window to the left of this one, |
221 ;; rescind the change. | 232 ;; rescind the change. |
222 (if (or (/= start-nwindows (count-windows t)) | 233 (if (or (/= start-nwindows (count-windows t)) |
223 (/= left (nth 0 (window-edges)))) | 234 (if scroll-bar-left |
235 (/= right (nth 2 (window-edges))) | |
236 (/= left (nth 0 (window-edges))))) | |
224 (set-window-configuration wconfig))))))) | 237 (set-window-configuration wconfig))))))) |
225 ;; restore the old selected window | 238 ;; restore the old selected window |
226 (select-window old-selected-window)))) | 239 (select-window old-selected-window)))) |
227 | 240 |
228 ;; mldrag.el ends here | 241 ;; mldrag.el ends here |