mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 10:40:45 -08:00
preview panel
This commit is contained in:
parent
05c4759434
commit
816f07b7a7
4 changed files with 93 additions and 33 deletions
|
|
@ -2,13 +2,43 @@
|
||||||
|
|
||||||
(defun on-file-search (obj &key (dir ""))
|
(defun on-file-search (obj &key (dir ""))
|
||||||
"Open file search"
|
"Open file search"
|
||||||
(let* ((*default-title-class* *builder-title-class*)
|
(let* ((app (connection-data-item obj "builder-app-data"))
|
||||||
|
(*default-title-class* *builder-title-class*)
|
||||||
(*default-border-class* *builder-border-class*)
|
(*default-border-class* *builder-border-class*)
|
||||||
(win (create-gui-window obj :title (format nil "Search in ~A"
|
(win (create-gui-window obj :title (format nil "Search in ~A"
|
||||||
dir)
|
dir)
|
||||||
:width 600 :height 400
|
:top (+ (menu-bar-height obj) 20)
|
||||||
|
:left 20
|
||||||
|
:width 1040 :height 600
|
||||||
:client-movement *client-side-movement*))
|
:client-movement *client-side-movement*))
|
||||||
(panel (create-panel-search (window-content win))))
|
(panel (create-panel-search (window-content win))))
|
||||||
|
(set-on-window-size win (lambda (obj)
|
||||||
|
(declare (ignore obj))
|
||||||
|
(clog-ace:resize (preview-ace panel))))
|
||||||
|
(setf (current-editor-is-lisp app) "clog-user")
|
||||||
|
(setup-lisp-ace (preview-ace panel) nil)
|
||||||
|
(set-on-window-focus win
|
||||||
|
(lambda (obj)
|
||||||
|
(declare (ignore obj))
|
||||||
|
(setf (current-editor-is-lisp app) "clog-user")))
|
||||||
|
(set-on-input (result-box panel) (lambda (obj)
|
||||||
|
(let* ((fname (text-value obj))
|
||||||
|
(regex (text-value (grep-input panel)))
|
||||||
|
(c (read-file fname :report-errors nil)))
|
||||||
|
(cond ((or (equalp (pathname-type fname) "lisp")
|
||||||
|
(equalp (pathname-type fname) "asd"))
|
||||||
|
(setf (clog-ace:mode (preview-ace panel)) "ace/mode/lisp"))
|
||||||
|
(t
|
||||||
|
(if (equalp (pathname-type fname) "clog")
|
||||||
|
(setf (clog-ace:mode (preview-ace panel)) "ace/mode/html")
|
||||||
|
(setf (clog-ace:mode (preview-ace panel))
|
||||||
|
(clog-ace:get-mode-from-extension (preview-ace panel) fname)))))
|
||||||
|
(setf (text-value (preview-ace panel)) c)
|
||||||
|
(clog-ace:resize (preview-ace panel))
|
||||||
|
(js-execute obj (format nil "~A.find('~A',{caseSensitive:false,regExp:true})"
|
||||||
|
(clog-ace::js-ace (preview-ace panel)) regex))
|
||||||
|
(clog-ace:execute-command (preview-ace panel) "find"))
|
||||||
|
(focus (result-box panel))))
|
||||||
(setf (text-value (dir-input panel)) dir)))
|
(setf (text-value (dir-input panel)) dir)))
|
||||||
|
|
||||||
(defun panel-search-dir-change (panel target)
|
(defun panel-search-dir-change (panel target)
|
||||||
|
|
@ -31,14 +61,13 @@
|
||||||
(when (and c
|
(when (and c
|
||||||
(ppcre:scan s c))
|
(ppcre:scan s c))
|
||||||
(let ((li (create-option (result-box panel)
|
(let ((li (create-option (result-box panel)
|
||||||
:content (format nil "~A~A" prefix (file-namestring item)))))
|
:content (format nil "~A~A" prefix (file-namestring item))
|
||||||
(flet ((do-select ()
|
:value fname)))
|
||||||
(on-open-file panel :open-file fname
|
(set-on-double-click li (lambda (obj)
|
||||||
:show-find t
|
(declare (ignore obj))
|
||||||
:regex regex)))
|
(on-open-file panel :open-file fname
|
||||||
(set-on-double-click li (lambda (obj)
|
:show-find t
|
||||||
(declare (ignore obj))
|
:regex regex)))))))))
|
||||||
(do-select))))))))))
|
|
||||||
(when subdirs
|
(when subdirs
|
||||||
(dolist (item (uiop:subdirectories dir))
|
(dolist (item (uiop:subdirectories dir))
|
||||||
(do-search item (format nil "~A~A/" prefix (first (last (pathname-directory item)))))))))
|
(do-search item (format nil "~A~A/" prefix (first (last (pathname-directory item)))))))))
|
||||||
|
|
|
||||||
|
|
@ -455,6 +455,7 @@ clog-builder window.")
|
||||||
(create-gui-menu-item tools :content "CLOG Probe Panel" :on-click 'on-probe-panel)
|
(create-gui-menu-item tools :content "CLOG Probe Panel" :on-click 'on-probe-panel)
|
||||||
(create-gui-menu-item tools :content "CLOG Object Scope" :on-click 'on-object-scope)
|
(create-gui-menu-item tools :content "CLOG Object Scope" :on-click 'on-object-scope)
|
||||||
(create-gui-menu-item tools :content "OS Pseudo Shell" :on-click 'on-shell)
|
(create-gui-menu-item tools :content "OS Pseudo Shell" :on-click 'on-shell)
|
||||||
|
(create-gui-menu-item tools :content "Regex File Search" :on-click 'on-file-search)
|
||||||
(create-gui-menu-item tools :content "List Callers" :on-click 'on-show-callers)
|
(create-gui-menu-item tools :content "List Callers" :on-click 'on-show-callers)
|
||||||
(create-gui-menu-item tools :content "List Callees" :on-click 'on-show-callees)
|
(create-gui-menu-item tools :content "List Callees" :on-click 'on-show-callees)
|
||||||
(create-gui-menu-item tools :content "Thread Viewer" :on-click 'on-show-thread-viewer)
|
(create-gui-menu-item tools :content "Thread Viewer" :on-click 'on-show-thread-viewer)
|
||||||
|
|
|
||||||
15
tools/panel-search.clog
vendored
15
tools/panel-search.clog
vendored
|
|
@ -1,9 +1,9 @@
|
||||||
<data id="I3929200389" data-in-package="clog-tools" data-custom-slots=""
|
<data id="I3929316054" data-in-package="clog-tools" data-custom-slots=""
|
||||||
data-clog-next-id="9" data-clog-title="panel-search"></data>
|
data-clog-next-id="14" data-clog-title="panel-search"></data>
|
||||||
<form action="#" onsubmit="return false;" data-clog-name="search-form"
|
<form action="#" onsubmit="return false;" data-clog-name="search-form"
|
||||||
data-clog-type="form">
|
data-clog-type="form">
|
||||||
<div data-clog-type="grid" data-clog-name="result-grid"
|
<div data-clog-type="grid" data-clog-name="result-grid"
|
||||||
style="display: grid; box-sizing: content-box; position: absolute; inset: 5px; gap: 5px; grid-template: "a a a a a" 1fr "d d d d d" 28px "b n o l c" 28px / 1fr 100px 20px 70px 80px;"
|
style="display: grid; box-sizing: content-box; position: absolute; inset: 5px; gap: 5px; grid-template: "a a a a a p" 1fr "d d d d d p" 28px "b n o l c p" 28px / 1fr 100px 20px 70px 80px 50%;"
|
||||||
class=""><select data-clog-type="listbox" size="4"
|
class=""><select data-clog-type="listbox" size="4"
|
||||||
data-clog-name="result-box"
|
data-clog-name="result-box"
|
||||||
style="box-sizing: content-box; position: static; grid-area: a;"
|
style="box-sizing: content-box; position: static; grid-area: a;"
|
||||||
|
|
@ -31,5 +31,14 @@
|
||||||
style="box-sizing: content-box; position: static; height: 22px; grid-area: c;"
|
style="box-sizing: content-box; position: static; height: 22px; grid-area: c;"
|
||||||
class="" tabindex="6"
|
class="" tabindex="6"
|
||||||
data-on-click="(panel-search-on-click panel target)">
|
data-on-click="(panel-search-on-click panel target)">
|
||||||
|
<div data-clog-type="div" data-clog-name="preview-div"
|
||||||
|
style="box-sizing: content-box; position: static; left: 81px; top: 5px; grid-area: p;">
|
||||||
|
<div style="border: thin solid black; box-sizing: content-box; position: relative; width: 100%; height: 100%;"
|
||||||
|
class=" ace_editor ace_hidpi ace-xcode"
|
||||||
|
data-clog-type="clog-ace" data-clog-composite-control="t"
|
||||||
|
data-clog-ace-theme="ace/theme/iplastic"
|
||||||
|
data-clog-ace-mode="ace/mode/lisp" data-clog-ace-tab-size="2"
|
||||||
|
data-clog-name="preview-ace"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
;;;; CLOG Builder generated code - modify original .clog file and rerender
|
;;;; CLOG Builder generated code - modify original .clog file and rerender
|
||||||
(in-package :clog-tools)
|
(in-package :clog-tools)
|
||||||
(defclass panel-search (clog:clog-panel)
|
(defclass panel-search (clog:clog-panel)
|
||||||
((search-button :reader search-button)
|
((preview-ace :reader preview-ace) (preview-div :reader preview-div)
|
||||||
|
(search-button :reader search-button)
|
||||||
(subdir-label :reader subdir-label)
|
(subdir-label :reader subdir-label)
|
||||||
(subdir-check :reader subdir-check)
|
(subdir-check :reader subdir-check)
|
||||||
(name-regex-input :reader name-regex-input)
|
(name-regex-input :reader name-regex-input)
|
||||||
|
|
@ -13,65 +14,79 @@
|
||||||
(let ((panel
|
(let ((panel
|
||||||
(change-class
|
(change-class
|
||||||
(clog:create-div clog-obj :content
|
(clog:create-div clog-obj :content
|
||||||
"<form action=\"#\" onsubmit=\"return false;\" id=\"CLOGB3929199710\"
|
"<form action=\"#\" onsubmit=\"return false;\" id=\"CLOGB3929313686\"
|
||||||
data-clog-name=\"search-form\">
|
data-clog-name=\"search-form\">
|
||||||
<div style=\"display: grid; box-sizing: content-box; position: absolute; inset: 5px; gap: 5px; grid-template: "a a a a a" 1fr "d d d d d" 28px "b n o l c" 28px / 1fr 100px 20px 70px 80px;\"
|
<div style=\"display: grid; box-sizing: content-box; position: absolute; inset: 5px; gap: 5px; grid-template: "a a a a a p" 1fr "d d d d d p" 28px "b n o l c p" 28px / 1fr 100px 20px 70px 80px 50%;\"
|
||||||
class=\"\" id=\"CLOGB3929199711\" data-clog-name=\"result-grid\"><select
|
class=\"\" id=\"CLOGB3929313687\" data-clog-name=\"result-grid\"><select
|
||||||
size=\"4\"
|
size=\"4\"
|
||||||
style=\"box-sizing: content-box; position: static; grid-area: a;\"
|
style=\"box-sizing: content-box; position: static; grid-area: a;\"
|
||||||
class=\"w3-small\" tabindex=\"1\" id=\"CLOGB3929199712\"
|
class=\"w3-small\" tabindex=\"1\" id=\"CLOGB3929313688\"
|
||||||
data-clog-name=\"result-box\"></select><input type=\"TEXT\" value=\"\"
|
data-clog-name=\"result-box\"></select><input type=\"TEXT\" value=\"\"
|
||||||
style=\"box-sizing: content-box; position: static; grid-area: d;\"
|
style=\"box-sizing: content-box; position: static; grid-area: d;\"
|
||||||
placeholder=\"directory to search\" tabindex=\"2\" id=\"CLOGB3929199713\"
|
placeholder=\"directory to search\" tabindex=\"2\" id=\"CLOGB3929313689\"
|
||||||
data-clog-name=\"dir-input\"><input type=\"TEXT\" value=\"\"
|
data-clog-name=\"dir-input\"><input type=\"TEXT\" value=\"\"
|
||||||
style=\"box-sizing: content-box; position: static; left: 50px; top: 8px; grid-area: b;\"
|
style=\"box-sizing: content-box; position: static; left: 50px; top: 8px; grid-area: b;\"
|
||||||
placeholder=\"search regex\" tabindex=\"3\" id=\"CLOGB3929199714\"
|
placeholder=\"search regex\" tabindex=\"3\" id=\"CLOGB3929313690\"
|
||||||
data-clog-name=\"grep-input\">
|
data-clog-name=\"grep-input\">
|
||||||
<input type=\"TEXT\" value=\"(.*\\.lisp$)\"
|
<input type=\"TEXT\" value=\"(.*\\.lisp$)\"
|
||||||
style=\"box-sizing: content-box; position: static; left: 43px; top: 11px; grid-area: n;\"
|
style=\"box-sizing: content-box; position: static; left: 43px; top: 11px; grid-area: n;\"
|
||||||
placeholder=\"file regex\" id=\"CLOGB3929199715\" tabindex=\"4\"
|
placeholder=\"file regex\" tabindex=\"4\" id=\"CLOGB3929313691\"
|
||||||
data-clog-name=\"name-regex-input\"><input type=\"CHECKBOX\" value=\"\"
|
data-clog-name=\"name-regex-input\"><input type=\"CHECKBOX\" value=\"\"
|
||||||
style=\"box-sizing: content-box; position: static; left: 68px; top: 5px; grid-area: o;\"
|
style=\"box-sizing: content-box; position: static; left: 68px; top: 5px; grid-area: o;\"
|
||||||
id=\"CLOGB3929199716\" tabindex=\"5\" checked=\"checked\"
|
tabindex=\"5\" checked=\"checked\" id=\"CLOGB3929313692\"
|
||||||
data-clog-name=\"subdir-check\"><label for=\"CLOGB3929199716\"
|
data-clog-name=\"subdir-check\"><label for=\"CLOGB3929199716\"
|
||||||
style=\"box-sizing: content-box; position: static; left: 70px; top: 11px; grid-area: l; font: 15px / 22.5px sans-serif; visibility: visible; vertical-align: middle; text-align: center;\"
|
style=\"box-sizing: content-box; position: static; left: 70px; top: 11px; grid-area: l; font: 15px / 22.5px sans-serif; visibility: visible; vertical-align: middle; text-align: center;\"
|
||||||
class=\"w3-tiny\" id=\"CLOGB3929199717\"
|
class=\"w3-tiny\" id=\"CLOGB3929313693\"
|
||||||
data-clog-name=\"subdir-label\">subdirectories</label><input
|
data-clog-name=\"subdir-label\">subdirectories</label><input
|
||||||
type=\"submit\" value=\"Search\"
|
type=\"submit\" value=\"Search\"
|
||||||
style=\"box-sizing: content-box; position: static; height: 22px; grid-area: c;\"
|
style=\"box-sizing: content-box; position: static; height: 22px; grid-area: c;\"
|
||||||
class=\"\" tabindex=\"6\" id=\"CLOGB3929199718\"
|
class=\"\" tabindex=\"6\" id=\"CLOGB3929313694\"
|
||||||
data-clog-name=\"search-button\">
|
data-clog-name=\"search-button\">
|
||||||
|
<div id=\"CLOGB392931430312\"
|
||||||
|
style=\"box-sizing: content-box; position: static; left: 81px; top: 5px; grid-area: p;\"
|
||||||
|
data-clog-name=\"preview-div\">
|
||||||
|
<div id=\"CLOGB392931441513\"
|
||||||
|
style=\"border: thin solid black; box-sizing: content-box; position: relative; width: 100%; height: 100%;\"
|
||||||
|
class=\" ace_editor ace_hidpi ace-xcode\"
|
||||||
|
data-clog-name=\"preview-ace\"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>"
|
</form>"
|
||||||
:hidden hidden :class class :style style :html-id
|
:hidden hidden :class class :style style :html-id
|
||||||
html-id :auto-place auto-place)
|
html-id :auto-place auto-place)
|
||||||
'panel-search)))
|
'panel-search)))
|
||||||
|
(setf (slot-value panel 'preview-ace)
|
||||||
|
(attach-as-child clog-obj "CLOGB392931441513" :clog-type
|
||||||
|
'clog-ace:clog-ace-element :new-id t))
|
||||||
|
(setf (slot-value panel 'preview-div)
|
||||||
|
(attach-as-child clog-obj "CLOGB392931430312" :clog-type
|
||||||
|
'clog:clog-div :new-id t))
|
||||||
(setf (slot-value panel 'search-button)
|
(setf (slot-value panel 'search-button)
|
||||||
(attach-as-child clog-obj "CLOGB3929199718" :clog-type
|
(attach-as-child clog-obj "CLOGB3929313694" :clog-type
|
||||||
'clog:clog-form-element :new-id t))
|
'clog:clog-form-element :new-id t))
|
||||||
(setf (slot-value panel 'subdir-label)
|
(setf (slot-value panel 'subdir-label)
|
||||||
(attach-as-child clog-obj "CLOGB3929199717" :clog-type
|
(attach-as-child clog-obj "CLOGB3929313693" :clog-type
|
||||||
'clog:clog-label :new-id t))
|
'clog:clog-label :new-id t))
|
||||||
(setf (slot-value panel 'subdir-check)
|
(setf (slot-value panel 'subdir-check)
|
||||||
(attach-as-child clog-obj "CLOGB3929199716" :clog-type
|
(attach-as-child clog-obj "CLOGB3929313692" :clog-type
|
||||||
'clog:clog-form-element :new-id t))
|
'clog:clog-form-element :new-id t))
|
||||||
(setf (slot-value panel 'name-regex-input)
|
(setf (slot-value panel 'name-regex-input)
|
||||||
(attach-as-child clog-obj "CLOGB3929199715" :clog-type
|
(attach-as-child clog-obj "CLOGB3929313691" :clog-type
|
||||||
'clog:clog-form-element :new-id t))
|
'clog:clog-form-element :new-id t))
|
||||||
(setf (slot-value panel 'grep-input)
|
(setf (slot-value panel 'grep-input)
|
||||||
(attach-as-child clog-obj "CLOGB3929199714" :clog-type
|
(attach-as-child clog-obj "CLOGB3929313690" :clog-type
|
||||||
'clog:clog-form-element :new-id t))
|
'clog:clog-form-element :new-id t))
|
||||||
(setf (slot-value panel 'dir-input)
|
(setf (slot-value panel 'dir-input)
|
||||||
(attach-as-child clog-obj "CLOGB3929199713" :clog-type
|
(attach-as-child clog-obj "CLOGB3929313689" :clog-type
|
||||||
'clog:clog-form-element :new-id t))
|
'clog:clog-form-element :new-id t))
|
||||||
(setf (slot-value panel 'result-box)
|
(setf (slot-value panel 'result-box)
|
||||||
(attach-as-child clog-obj "CLOGB3929199712" :clog-type
|
(attach-as-child clog-obj "CLOGB3929313688" :clog-type
|
||||||
'clog:clog-select :new-id t))
|
'clog:clog-select :new-id t))
|
||||||
(setf (slot-value panel 'result-grid)
|
(setf (slot-value panel 'result-grid)
|
||||||
(attach-as-child clog-obj "CLOGB3929199711" :clog-type
|
(attach-as-child clog-obj "CLOGB3929313687" :clog-type
|
||||||
'clog:clog-div :new-id t))
|
'clog:clog-div :new-id t))
|
||||||
(setf (slot-value panel 'search-form)
|
(setf (slot-value panel 'search-form)
|
||||||
(attach-as-child clog-obj "CLOGB3929199710" :clog-type
|
(attach-as-child clog-obj "CLOGB3929313686" :clog-type
|
||||||
'clog:clog-form :new-id t))
|
'clog:clog-form :new-id t))
|
||||||
(let ((target (grep-input panel)))
|
(let ((target (grep-input panel)))
|
||||||
(declare (ignorable target))
|
(declare (ignorable target))
|
||||||
|
|
@ -82,6 +97,12 @@
|
||||||
(setf (attribute target "for")
|
(setf (attribute target "for")
|
||||||
(clog:js-query target
|
(clog:js-query target
|
||||||
"$('[data-clog-name=\\'subdir-check\\']').attr('id')")))
|
"$('[data-clog-name=\\'subdir-check\\']').attr('id')")))
|
||||||
|
(let ((target (preview-ace panel)))
|
||||||
|
(declare (ignorable target))
|
||||||
|
(clog-ace:attach-clog-ace target)
|
||||||
|
(setf (clog-ace:theme target) "ace/theme/iplastic")
|
||||||
|
(setf (clog-ace:mode target) "ace/mode/lisp")
|
||||||
|
(setf (clog-ace:tab-size target) 2))
|
||||||
(clog:set-on-change (dir-input panel)
|
(clog:set-on-change (dir-input panel)
|
||||||
(lambda (target)
|
(lambda (target)
|
||||||
(declare (ignorable target))
|
(declare (ignorable target))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue