From 0d62cb4380e494dd45f3d8618e1c22ef7e0e4e13 Mon Sep 17 00:00:00 2001 From: David Botton Date: Fri, 1 Jul 2022 13:51:40 -0400 Subject: [PATCH] offsets for maximize on clog-gui --- source/clog-gui.lisp | 24 +++++++++++++++++++++--- tools/clog-builder.lisp | 2 +- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/source/clog-gui.lisp b/source/clog-gui.lisp index 673cc97..b05921e 100644 --- a/source/clog-gui.lisp +++ b/source/clog-gui.lisp @@ -107,6 +107,14 @@ :accessor last-x :initform 0 :documentation "Last default open x point") + (body-left-offset + :accessor body-left-offset + :initform 0 + :documentation "Offset for maximize on left side") + (body-right-offset + :accessor body-right-offset + :initform 0 + :documentation "Offset for maximize on right side") (last-y :accessor last-y :initform 0 @@ -162,12 +170,18 @@ ;; clog-gui-initialize ;; ;;;;;;;;;;;;;;;;;;;;;;;;; -(defun clog-gui-initialize (clog-body &key (w3-css-url "/css/w3.css") +(defun clog-gui-initialize (clog-body &key + (body-left-offset 0) + (body-right-offset 0) + (w3-css-url "/css/w3.css") (jquery-ui-css "/css/jquery-ui.css") (jquery-ui "/js/jquery-ui.js")) "Initializes clog-gui and installs a clog-gui object on connection. -If W3-CSS-URL has not been loaded before is installed unless is nil." - (create-clog-gui clog-body) +If W3-CSS-URL has not been loaded before is installed unless is nil. +BODY-LEFT-OFFSET and BODY-RIGHT-OFFSET limit width on maximize." + (let ((app (create-clog-gui clog-body))) + (setf (body-left-offset app) body-left-offset) + (setf (body-right-offset app) body-right-offset)) (set-on-full-screen-change (html-document clog-body) (lambda (obj) (when (current-window obj) @@ -895,6 +909,10 @@ the browser.")) (setf (top obj) (unit :px (menu-bar-height obj))) (setf (left obj) (unit :px 0)) (setf (width obj) (unit :vw 100)) + (setf (left obj) (unit :px (body-left-offset app))) + (setf (width obj) (- (width obj) + (body-left-offset app) + (body-right-offset app))) (setf (height obj) (- (inner-height (window (body app))) (menu-bar-height obj))) (fire-on-window-size-done obj)))) diff --git a/tools/clog-builder.lisp b/tools/clog-builder.lisp index 268d7f1..93219ec 100644 --- a/tools/clog-builder.lisp +++ b/tools/clog-builder.lisp @@ -1759,7 +1759,7 @@ of controls and double click to select control." (let ((app (make-instance 'builder-app-data))) (setf (connection-data-item body "builder-app-data") app) (setf (title (html-document body)) "CLOG Builder") - (clog-gui-initialize body) + (clog-gui-initialize body :body-left-offset 10 :body-right-offset 10) (add-class body "w3-blue-grey") (setf (z-index (create-panel body :positioning :fixed :bottom 0 :left 222