diff --git a/README.md b/README.md index 642ce7c..70ef732 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ CL-USER> (ql:quickload :clog) ; if not already loaded CL-USER> (clog:run-tutorial 1) ``` -Tip for Windows WSL linux user. Install "sudo apt install xdg-utils" to +Tip for Windows WSL linux user. Install "sudo apt install xdg-utils wslu" to install xdg-open so that run-tutorial uses the windows browser. To see where the source, tutorial and demo files are: diff --git a/open-file b/open-file new file mode 100755 index 0000000..35f0139 --- /dev/null +++ b/open-file @@ -0,0 +1 @@ +sbcl --eval "(ql:quickload :clog/tools)" --eval "(clog-tools:clog-open \"$1\")" diff --git a/open-file.bat b/open-file.bat new file mode 100755 index 0000000..e62873b --- /dev/null +++ b/open-file.bat @@ -0,0 +1 @@ +sbcl --eval "(ql:quickload :clog/tools)" --eval "(clog-tools:clog-open \"%1\")" diff --git a/source/clog-helpers.lisp b/source/clog-helpers.lisp index 8e35371..bd712f8 100644 --- a/source/clog-helpers.lisp +++ b/source/clog-helpers.lisp @@ -16,6 +16,7 @@ (defpackage #:clog-tools (:use #:cl #:clog #:clog-gui #:clog-web) (:export :clog-builder + :clog-open :add-supported-controls :control-info :clog-db-admin)) diff --git a/tools/clog-builder.lisp b/tools/clog-builder.lisp index 5fe1c63..8d553cc 100644 --- a/tools/clog-builder.lisp +++ b/tools/clog-builder.lisp @@ -498,10 +498,6 @@ clog-builder window.") (projects-load *start-project*)) (on-project-tree body :project *start-project*) (when *start-dir* - (when *start-project* - (set-geometry (current-window body) :top 38 :left 5 :right "" :height "" :bottom 22) - (set-geometry (current-window body) :height (height (current-window body)) - :bottom (bottom (current-window body)))) (handler-case (on-dir-win body :dir *start-dir*) (error (msg) @@ -509,7 +505,7 @@ clog-builder window.") (setf *start-dir* nil))) (set-geometry (current-window body) :top 38 :left "" :right 5 :height "" :bottom 22) (set-geometry (current-window body) :height (height (current-window body)) - :bottom (bottom (current-window body)))))) + :bottom (bottom (current-window body)))))) (set-on-before-unload (window body) (lambda(obj) (declare (ignore obj)) ;; return empty string to prevent nav off page @@ -523,6 +519,22 @@ clog-builder window.") (clog:shutdown) (uiop:quit)))) +(defun clog-open (&optional open-file) + (unless (is-running-p) + (clog-builder :app t :port 0 :start-browser nil) + (sleep 1)) + (let* ((open-loc (if (and (> (length open-file) 5) + (equal (subseq open-file (- (length open-file) 5)) ".clog")) + "/panel-editor?open-panel" + "/source-editor?open-file")) + (open-url (format nil "~A=~A" + open-loc (if (or (eq open-file nil) + (equal open-file "")) + "%20" + open-file)))) + (format t "~%If browser does not start go to http://127.0.0.1:~A~A" clog:*clog-port* open-url) + (open-browser :url (format nil "http://127.0.0.1:~A~A" clog:*clog-port* open-url)))) + (defun clog-builder (&key (port 8080) (start-browser t) app project dir static-root system clogframe) "Start clog-builder. When PORT is 0 choose a random port. When APP is