From 3a9366c374bbd93b8c7812b1028e57481cd1af97 Mon Sep 17 00:00:00 2001 From: Juan Monetta Date: Wed, 18 Oct 2023 09:02:46 -0300 Subject: [PATCH] Removing some reflections --- src-dbg/flow_storm/debugger/ui/flows/code.clj | 21 +++++++++++-------- src-dbg/flow_storm/debugger/ui/utils.clj | 11 ++++++---- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src-dbg/flow_storm/debugger/ui/flows/code.clj b/src-dbg/flow_storm/debugger/ui/flows/code.clj index 1b700e40..92885a98 100644 --- a/src-dbg/flow_storm/debugger/ui/flows/code.clj +++ b/src-dbg/flow_storm/debugger/ui/flows/code.clj @@ -15,7 +15,10 @@ [javafx.scene.layout Priority VBox HBox] [javafx.scene.text Font] [javafx.scene.input KeyCode MouseButton ScrollEvent] - [org.fxmisc.richtext.model StyleSpansBuilder])) + [org.fxmisc.richtext CodeArea] + [org.fxmisc.richtext.model StyleSpansBuilder] + [javafx.scene.input MouseEvent] + [org.fxmisc.flowless VirtualizedScrollPane])) (declare jump-to-coord) (declare find-and-jump-same-val) @@ -85,7 +88,7 @@ will repaint and arm the form-code-area with the interesting and currently executing tokens. All interesting tokens will be clickable." - [flow-id thread-id form-code-area print-tokens] + [flow-id thread-id ^CodeArea form-code-area print-tokens] (fn [expr-executions curr-coord] (let [interesting-coords (group-by :coord expr-executions) spans (->> print-tokens @@ -108,7 +111,7 @@ (.setOnMouseClicked form-code-area (event-handler - [mev] + [^MouseEvent mev] (let [char-hit (-> mev .getSource (.hit (.getX mev) (.getY mev))) opt-char-idx (.getCharacterIndex char-hit)] (when (.isPresent opt-char-idx) @@ -167,12 +170,12 @@ form-header (doto (h-box [ns-label]) (.setAlignment (Pos/TOP_RIGHT))) - form-code-area (ui-utils/code-area {:editable? false + ^CodeArea form-code-area (ui-utils/code-area {:editable? false :text code-text}) - form-scroll (ui-utils/virtualized-scroll-pane - form-code-area - {:max-height 800}) + ^VirtualizedScrollPane form-scroll (ui-utils/virtualized-scroll-pane + form-code-area + {:max-height 800}) form-pane (v-box [form-header form-scroll] "form-pane") @@ -185,7 +188,7 @@ (.addEventFilter form-code-area ScrollEvent/ANY (event-handler - [sev] + [^ScrollEvent sev] (let [current-absolute-pos (.getEstimatedScrollY form-code-area) view-port-height (.getHeight form-scroll) total-estimated-height (or (-> form-scroll .totalHeightEstimateProperty .getValue) 1.0) @@ -196,7 +199,7 @@ (and at-bottom? (neg? (.getDeltaY sev))) (<= total-estimated-height view-port-height) (or (.isAltDown sev) (.isControlDown sev))) - (.fireEvent forms-box (.copyFor sev form-code-area forms-box)) + (.fireEvent ^Node forms-box (.copyFor sev form-code-area ^Node forms-box)) (.consume sev))))) (ui-utils/add-class form-code-area "form-pane") diff --git a/src-dbg/flow_storm/debugger/ui/utils.clj b/src-dbg/flow_storm/debugger/ui/utils.clj index 57daa690..f9188367 100644 --- a/src-dbg/flow_storm/debugger/ui/utils.clj +++ b/src-dbg/flow_storm/debugger/ui/utils.clj @@ -16,7 +16,7 @@ [org.kordamp.ikonli.javafx FontIcon] [javafx.collections FXCollections ObservableList] [org.fxmisc.richtext CodeArea] - [org.fxmisc.flowless VirtualizedScrollPane])) + [org.fxmisc.flowless VirtualFlow VirtualizedScrollPane])) (defn run-later* [f] @@ -580,13 +580,16 @@ (let [^CodeArea this this ih (+ (-> this .getInsets .getTop) (-> this .getInsets .getBottom)) - childs (.getChildren this) + ^ObservableList childs (.getChildren this) p-cnt (.size (.getParagraphs this))] (if (and (pos? (.size childs)) (pos? p-cnt)) - (let [c (.get childs 0)] + (let [^VirtualFlow c (.get childs 0)] (+ ih (->> (range p-cnt) - (map (fn [i] (-> c (.getCell i) .getNode (.prefHeight w)))) + (map (fn [i] (-> c + (.getCell i) + .getNode + (.prefHeight w)))) (reduce + 0)))) ;; else