Skip to content

Commit

Permalink
Fix exit confirmation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
vlaaad committed Sep 2, 2021
1 parent 551c79c commit 0a88a76
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 57 deletions.
1 change: 0 additions & 1 deletion src/vlaaad/reveal/action_popup.clj
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@
:desc {:fx/type fx/ext-let-refs
:refs (into {::text-field {:fx/type :text-field
:text-formatter rfx/code-text-formatter
:style-class "reveal-text-field"
:text text
:on-focused-changed {::event/type ::on-text-focused
:id id}
Expand Down
1 change: 0 additions & 1 deletion src/vlaaad/reveal/output_panel.clj
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@
:children [{:fx/type fx/ext-on-instance-lifecycle
:on-created init-text-field-created!
:desc {:fx/type :text-field
:style-class "reveal-text-field"
:prompt-text "Find..."
:event-filter {::event/type ::on-search-event-filter :id id}
:on-focused-changed {::event/type ::on-search-focus-changed :id id}
Expand Down
28 changes: 18 additions & 10 deletions src/vlaaad/reveal/style.clj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
(delay
(let [util-color (color :util)
symbol-color (color :symbol)
scalar-color (color :scalar)
unfocused-background-color (case @theme :dark "#333" :light "#f2f2f2")
background-color (case @theme :dark "#232325" :light "#fafafa")
scroll-bar-size 10
Expand All @@ -55,16 +56,6 @@
":hover" {:-fx-text-fill symbol-color}
"-selected" {:-fx-background-color selection-color
:-fx-text-fill symbol-color}}}
"-text-field" {:-fx-font-family font-family
:-fx-text-fill symbol-color
:-fx-font-size font-size
:-fx-background-color background-color
:-fx-highlight-fill selection-color
:-fx-highlight-text-fill symbol-color
:-fx-padding [7 7]
":focused" {:-fx-border-color selection-color
:-fx-border-width [0 0 2 0]
:-fx-padding [7 7 5 7]}}
"-search" {:-fx-background-color popup-color
:-fx-padding default-padding}
"-summary" {:-fx-font-family font-family
Expand Down Expand Up @@ -129,6 +120,23 @@
":has-popup:focused" {:-fx-border-width [0 0 2 0]
:-fx-padding [0 0 -2 0]
:-fx-border-color selection-color}}
".text-field" {:-fx-font-family font-family
:-fx-text-fill symbol-color
:-fx-font-size font-size
:-fx-background-color background-color
:-fx-highlight-fill selection-color
:-fx-highlight-text-fill symbol-color
:-fx-prompt-text-fill util-color
:-fx-background-radius 0
:-fx-padding [7 7]
":focused" {:-fx-border-color selection-color
:-fx-border-width [0 0 2 0]
:-fx-padding [7 7 5 7]}}
".hyperlink" {:-fx-font-family font-family
:-fx-text-fill scalar-color
:-fx-padding 0
:-fx-font-size font-size
":focused" {:-fx-border-color scalar-color}}
".button" {:-fx-text-fill util-color
:-fx-font-family font-family
:-fx-font-size font-size
Expand Down
97 changes: 52 additions & 45 deletions src/vlaaad/reveal/ui.clj
Original file line number Diff line number Diff line change
Expand Up @@ -343,55 +343,62 @@
:desc {:fx/type view/ext-try
:desc (get-in views [id :desc])}}]))
:desc {:fx/type fx/ext-let-refs
:refs (cond-> {::stage {:fx/type :stage
:title title
:on-close-request {::event/type ::confirm-exit}
:showing showing
:width 400
:height 500
:icons (if christmas
["vlaaad/reveal/logo-xmas-16.png"
"vlaaad/reveal/logo-xmas-32.png"
"vlaaad/reveal/logo-xmas-64.png"
"vlaaad/reveal/logo-xmas-256.png"
"vlaaad/reveal/logo-xmas-512.png"]
["vlaaad/reveal/logo-16.png"
"vlaaad/reveal/logo-32.png"
"vlaaad/reveal/logo-64.png"
"vlaaad/reveal/logo-256.png"
"vlaaad/reveal/logo-512.png"])
:on-focused-changed {::event/type ::on-window-focused-changed}
:scene {:fx/type :scene
:stylesheets [(:cljfx.css/url @style/style)]
:root {:fx/type :grid-pane
:style-class "reveal-ui"
:column-constraints [{:fx/type :column-constraints
:hgrow :always}]
:row-constraints (let [n (inc (count result-trees))]
(repeat n {:fx/type :row-constraints
:percent-height (/ 100 n)}))
:children
(into [{:fx/type view/queue
:grid-pane/row 0
:grid-pane/column 0
:queue queue
:id :output}]
(map-indexed
(fn [i result-tree]
{:fx/type result-tree-view
:grid-pane/row (inc i)
:grid-pane/column 0
:views views
:index i
:result-tree result-tree}))
result-trees)}}}}
confirm-exit-showing
(assoc ::confirm-exit {:fx/type confirm-exit-dialog})
:refs (cond->
{::stage {:fx/type :stage
:title title
:on-close-request {::event/type ::confirm-exit}
:showing showing
:width 400
:height 500
:icons (if christmas
["vlaaad/reveal/logo-xmas-16.png"
"vlaaad/reveal/logo-xmas-32.png"
"vlaaad/reveal/logo-xmas-64.png"
"vlaaad/reveal/logo-xmas-256.png"
"vlaaad/reveal/logo-xmas-512.png"]
["vlaaad/reveal/logo-16.png"
"vlaaad/reveal/logo-32.png"
"vlaaad/reveal/logo-64.png"
"vlaaad/reveal/logo-256.png"
"vlaaad/reveal/logo-512.png"])
:on-focused-changed {::event/type ::on-window-focused-changed}
:scene
{:fx/type :scene
:stylesheets [(:cljfx.css/url @style/style)]
:root
{:fx/type :stack-pane
:children
[{:fx/type :grid-pane
:style-class "reveal-ui"
:column-constraints [{:fx/type :column-constraints
:hgrow :always}]
:row-constraints (let [n (inc (count result-trees))]
(repeat n {:fx/type :row-constraints
:percent-height (/ 100 n)}))
:children
(into [{:fx/type view/queue
:grid-pane/row 0
:grid-pane/column 0
:queue queue
:id :output}]
(map-indexed
(fn [i result-tree]
{:fx/type result-tree-view
:grid-pane/row (inc i)
:grid-pane/column 0
:views views
:index i
:result-tree result-tree}))
result-trees)}]}}}}
focus
(assoc [::focus focus-key] {:fx/type ext-focused-by-default
:desc {:fx/type fx/ext-get-ref
:ref focus}}))
:desc {:fx/type fx/ext-get-ref :ref ::stage}}})
:desc {:fx/type fx/ext-let-refs
:refs (cond-> {}
confirm-exit-showing
(assoc ::confirm-exit {:fx/type confirm-exit-dialog}))
:desc {:fx/type fx/ext-get-ref :ref ::stage}}}})

(defn oneduce
([xf x]
Expand Down

0 comments on commit 0a88a76

Please sign in to comment.