diff --git a/tools/clog-builder-search.lisp b/tools/clog-builder-search.lisp index 7a5ce40..5c680e4 100644 --- a/tools/clog-builder-search.lisp +++ b/tools/clog-builder-search.lisp @@ -2,13 +2,43 @@ (defun on-file-search (obj &key (dir "")) "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*) (win (create-gui-window obj :title (format nil "Search in ~A" dir) - :width 600 :height 400 + :top (+ (menu-bar-height obj) 20) + :left 20 + :width 1040 :height 600 :client-movement *client-side-movement*)) (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))) (defun panel-search-dir-change (panel target) @@ -31,14 +61,13 @@ (when (and c (ppcre:scan s c)) (let ((li (create-option (result-box panel) - :content (format nil "~A~A" prefix (file-namestring item))))) - (flet ((do-select () - (on-open-file panel :open-file fname - :show-find t - :regex regex))) - (set-on-double-click li (lambda (obj) - (declare (ignore obj)) - (do-select)))))))))) + :content (format nil "~A~A" prefix (file-namestring item)) + :value fname))) + (set-on-double-click li (lambda (obj) + (declare (ignore obj)) + (on-open-file panel :open-file fname + :show-find t + :regex regex))))))))) (when subdirs (dolist (item (uiop:subdirectories dir)) (do-search item (format nil "~A~A/" prefix (first (last (pathname-directory item))))))))) diff --git a/tools/clog-builder.lisp b/tools/clog-builder.lisp index d272199..1d188e5 100644 --- a/tools/clog-builder.lisp +++ b/tools/clog-builder.lisp @@ -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 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 "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 Callees" :on-click 'on-show-callees) (create-gui-menu-item tools :content "Thread Viewer" :on-click 'on-show-thread-viewer) diff --git a/tools/panel-search.clog b/tools/panel-search.clog index c4a201f..db5a7b2 100644 --- a/tools/panel-search.clog +++ b/tools/panel-search.clog @@ -1,9 +1,9 @@ - +
+
+
+
" :hidden hidden :class class :style style :html-id html-id :auto-place auto-place) '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) - (attach-as-child clog-obj "CLOGB3929199718" :clog-type + (attach-as-child clog-obj "CLOGB3929313694" :clog-type 'clog:clog-form-element :new-id t)) (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)) (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)) (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)) (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)) (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)) (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)) (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)) (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)) (let ((target (grep-input panel))) (declare (ignorable target)) @@ -82,6 +97,12 @@ (setf (attribute target "for") (clog:js-query target "$('[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) (lambda (target) (declare (ignorable target))