Browse Source

Open files on activate

The default system handlers are used.
master
Macoy Madson 1 month ago
parent
commit
08da245e5e
  1. 18
      src/FileHelper.cake

18
src/FileHelper.cake

@ -324,7 +324,14 @@
(set (path state > needs-update) true)
(set (path state > should-scroll-to-entry) true)
(set (path state > on-activate-index) 0))
(scope (set (path state > focus-filter) true))))
(scope
(set (path state > focus-filter) true)
(var open-file-str dynstring null)
(dynstring-append (addr open-file-str) (path state > current-dir))
(path-append-divider-if-necessary (addr open-file-str))
(dynstring-append (addr open-file-str) (path activated-entry > name))
(open-system-file-explorer open-file-str)
(dynarray-free open-file-str))))
(defun-local set-auto-focus-child-entry (state (* imgui-directory-listing-state)
auto-select-entry-start (* (const char)))
@ -889,10 +896,15 @@
(append-file-entry-to-path (addr (path state > current-dir)) (path current-entry > name))
(set (path state > needs-update) true)))
;; File
(when (imgui-call Selectable entry-name (= entry-index (path state > on-activate-index)))
(when (imgui-call Selectable entry-name (= entry-index (path state > on-activate-index))
ImGuiSelectableFlags_AllowDoubleClick)
;;ImGuiSelectableFlags_SpanAllColumns)
(set (path state > focus-filter) true)
(set (path state > on-activate-index) entry-index)))
(set (path state > on-activate-index) entry-index)
(when (imgui-call IsMouseDoubleClicked 0)
(imgui-directory-listing-activated
(filtered-entry-index-to-entry (path state > on-activate-index) state)
state))))
(var selected-row-color ImU32 (imgui-call GetColorU32 (at ImGuiCol_FrameBg colors)))
(when (= (path state > on-activate-index) filtered-entry-index)

Loading…
Cancel
Save