mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 10:40:45 -08:00
dialog boxes
This commit is contained in:
parent
89f0762ea1
commit
20016bae9c
1 changed files with 50 additions and 7 deletions
|
|
@ -35,11 +35,53 @@
|
|||
:title title
|
||||
:left (- (/ (width (body app)) 2) 200)
|
||||
:width 400
|
||||
:height 60))
|
||||
(form (create-form (window-content win)))
|
||||
:height 360))
|
||||
(box (create-div (window-content win) :class "w3-panel"))
|
||||
(form (create-form box))
|
||||
(dirs (create-select form))
|
||||
(files (create-select form))
|
||||
(input (create-form-element form :input :label
|
||||
(create-label form :content "File Name:")))
|
||||
(ok (create-button form :content "OK")))
|
||||
(ok (create-button form :content " OK ")))
|
||||
(setf (size dirs) 4)
|
||||
(setf (box-width dirs) "100%")
|
||||
(setf (size files) 8)
|
||||
(setf (box-width files) "100%")
|
||||
(setf (box-width input) "100%")
|
||||
(flet ((populate-dirs (dir)
|
||||
(setf (inner-html dirs) "")
|
||||
(add-select-option dirs (format nil "~A" dir) ".")
|
||||
(setf (value input) dir)
|
||||
(unless (or (equalp dir "/") (equalp dir #P"/"))
|
||||
(add-select-option dirs (format nil "~A../" dir) ".."))
|
||||
(dolist (item (uiop:subdirectories dir))
|
||||
(add-select-option dirs item item)))
|
||||
(populate-files (dir)
|
||||
(setf (inner-html files) "")
|
||||
(dolist (item (uiop:directory-files dir))
|
||||
(add-select-option files item (file-namestring item))))
|
||||
(caret-at-end ()
|
||||
(focus input)
|
||||
(js-execute win (format nil "~A.setSelectionRange(~A.value.length,~A.value.length)"
|
||||
(clog::script-id input)
|
||||
(clog::script-id input)
|
||||
(clog::script-id input)))))
|
||||
(populate-dirs "./")
|
||||
(populate-files "./")
|
||||
(set-on-change files (lambda (obj)
|
||||
(setf (value input) (value files))
|
||||
(caret-at-end)))
|
||||
(set-on-change dirs (lambda (obj)
|
||||
(setf (value input) (value dirs))
|
||||
(caret-at-end)
|
||||
(populate-files (value dirs))))
|
||||
(set-on-double-click dirs
|
||||
(lambda (obj)
|
||||
(populate-dirs (truename (value dirs)))))
|
||||
(set-on-double-click files
|
||||
(lambda (obj)
|
||||
(click ok)))
|
||||
)
|
||||
(set-on-click ok (lambda (obj)
|
||||
(declare (ignore obj))
|
||||
(window-close win)
|
||||
|
|
@ -56,10 +98,9 @@
|
|||
(format nil "~A~%=>~A~%" result eval-result)))
|
||||
|
||||
(defun do-ide-file-new (obj)
|
||||
(let ((win (create-gui-window obj
|
||||
:title "New window"
|
||||
:left (random 600)
|
||||
:top (+ 40 (random 400)))))
|
||||
(let ((win (create-gui-window obj :title "New window"
|
||||
:height 400
|
||||
:width 650)))
|
||||
(set-on-window-size win (lambda (obj)
|
||||
(js-execute obj
|
||||
(format nil "editor_~A.resize()" (html-id win)))))
|
||||
|
|
@ -188,6 +229,8 @@
|
|||
(create-gui-menu-item edit :content "Cut" :on-click #'do-ide-edit-cut)
|
||||
(create-gui-menu-item edit :content "Paste" :on-click #'do-ide-edit-paste)
|
||||
(create-gui-menu-item lisp :content "Eval File" :on-click #'do-ide-lisp-eval-file)
|
||||
(create-gui-menu-item wind :content "Maximize All" :on-click #'maximize-all-windows)
|
||||
(create-gui-menu-item wind :content "Normalize All" :on-click #'normalize-all-windows)
|
||||
(create-gui-menu-window-select wind)
|
||||
(create-gui-menu-item help :content "About" :on-click #'do-ide-help-about)
|
||||
(create-gui-menu-full-screen menu))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue