From e7497fb49b4a8b6437f4c30d2e5d068fcd1e29ca Mon Sep 17 00:00:00 2001 From: David Botton Date: Sun, 3 Jul 2022 16:44:33 -0400 Subject: [PATCH] resize on side panel --- tools/clog-builder.lisp | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/tools/clog-builder.lisp b/tools/clog-builder.lisp index 400a32a..d32f80e 100644 --- a/tools/clog-builder.lisp +++ b/tools/clog-builder.lisp @@ -1071,11 +1071,13 @@ of controls and double click to select control." :class "w3-border")) (side-panel (create-panel content :top 0 :right 0 :bottom 0 :width 10)) (sheight (height content)) - (divider (create-panel content :top (/ sheight 2) :height 5 :left 0 :right 10)) - (control-list (create-panel content :height (- (/ sheight 2) 5) :left 0 :bottom 0 :right 10)) + (divider (create-panel content :top (/ sheight 2) :height 10 :left 0 :right 10)) + (control-list (create-panel content :height (- (/ sheight 2) 10) :left 0 :bottom 0 :right 10)) (pallete (create-select content)) (adj-size 0)) (setf (background-color divider) :black) + (setf (tab-index divider) "-1") + (setf (cursor divider) :ns-resize) (setf (background-color content) :gray) (setf (background-color pallete) :gray) (setf (color pallete) :white) @@ -1094,13 +1096,28 @@ of controls and double click to select control." (format nil "Drag and drop order~%Double click non-focusable~%~ place as static~% child to selected")) (setf (background-color side-panel) :black) - (set-on-resize (window (connection-body obj)) - (lambda (obj) - (declare (ignore obj)) - (setf sheight (height content)) - (set-geometry pallete :left 0 :top 0 :height (/ sheight 2) :right 10) - (set-geometry divider :top (/ sheight 2) :height 5 :left 0 :right 10) - (set-geometry control-list :height (- (/ sheight 2) 5) :left 0 :bottom 0 :right 10))) + (flet ((on-size (obj) + (declare (ignore obj)) + (setf sheight (height content)) + (when (and (> (- (/ sheight 2) adj-size) 5) + (> (+ (- (/ sheight 2) 10) adj-size) 5)) + (set-geometry pallete :height (- (/ sheight 2) adj-size)) + (set-geometry divider :top (- (/ sheight 2) adj-size)) + (set-geometry control-list :height (+ (- (/ sheight 2) 10) adj-size))))) + (set-on-resize (window (connection-body obj)) #'on-size) + (set-on-pointer-down divider (lambda (obj data) + (set-on-pointer-up (connection-body obj) + (lambda (obj data) + (declare (ignore data)) + (set-on-pointer-up (connection-body obj) nil) + (set-on-pointer-move (connection-body obj) nil))) + (set-on-pointer-move (connection-body obj) + (lambda (obj new-data) + (setf adj-size (- (getf data :screen-y) + (getf new-data :screen-y))) + (print adj-size) + (on-size obj)))) + :capture-pointer t)) (set-on-click side-panel (lambda (obj) (declare (ignore obj)) (cond (is-hidden