Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Pre-release #10

Merged
merged 5 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bettercode/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
:main ^:skip-aot bettercode.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all
:injections [(javafx.application.Platform/exit)]
:jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})
18 changes: 13 additions & 5 deletions bettercode/src/bettercode/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
:width 768
:height 1080
:min-width 768
:min-height 1080
:min-height 1140
:resizable true
:scene {:fx/type :scene
:fill "#23282D"
Expand All @@ -60,8 +60,14 @@
:on-action {:event/type :bettercode.events/openfex
:tclient tclient}}
{:fx/type :menu-item
:style-class "root-menu-bar-item-sub-item"
:text "save"
:on-action {:event/type :bettercode.events/saveevent
:tclient tclient}}
{:fx/type :menu-item
:style-class "root-menu-bar-item-sub-item"
:text "close file"
:on-action {:event/type :bettercode.events/close-file
:tclient tclient}}]}]}
{:fx/type bettercode.elements/editor-pane
:tclient tclient
Expand All @@ -88,16 +94,18 @@
(println "started")
(let [c @(client (if hostname hostname "localhost") 8080)
msg @(s/put! c ["get-dir"])
dirs @(s/take! c)
dirs (vec @(s/take! c))
*context
(atom
(fx/create-context {:title "BetterCode"
:file-path "/home/tim/foo.txt"
:file-path ""
:text-editor ""
:dir-contents dirs
:cur-path "/home/tim/foo.txt"
:cur-path (bettercode.events/parent-dir (subs (dirs 0) 5))
:file-explorer-show true
:file-name-entered ""}
:file-name-entered ""
:line-numbers ""
:vscroll 0}
#(cache/lru-cache-factory % :threshold 4096)))]
(fx/create-app *context
:event-handler bettercode.events/handle-event
Expand Down
75 changes: 44 additions & 31 deletions bettercode/src/bettercode/css.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,33 @@
(def style
(css/register ::style
(let [back-background-color "#2E3440"
status-background-color "#6183AE"
status-background-color "#4C566A"
text-color "#ECEFF4"
border-color "#5E81AC"
border-color "#4C566A"
background-color "#2E3440"
scroll-color "#434C5E22"
thumb-color "#4C566A44"
highlight-color "#5E81AC"]
scroll-color "#434C5E00"
thumb-color "#4C566A22"
highlight-color "#4C566A"
line-no-color "#4C566A"]
{".root" {:-fx-background-color back-background-color
:-fx-text-fill text-color
"-menu-bar" {:-fx-background-color highlight-color
:-fx-text-fill text-color
:-fx-padding 0
:-fx-margin 0
:-fx-control-inner-background highlight-color
" .label" {:-fx-font-size 12
:-fx-text-fill text-color}
"-item" {:-fx-text-fill text-color
:-fx-background-color highlight-color
:-fx-padding 0
:-fx-margin 0
:-fx-control-inner-background highlight-color
:-fx-border-color highlight-color
" .label" {:-fx-font-size 10
:-fx-text-fill text-color}
"-sub-item" {:-fx-text-fill text-color
:-fx-padding 0
:-fx-margin 0
:-fx-background-color highlight-color
:-fx-control-inner-background highlight-color}}}
:-fx-control-inner-background highlight-color
:-fx-padding [4 4 4 4]
":hover" {:-fx-background-color background-color
:-fx-background-radius 5}}}}
"-fsview" {:-fx-control-inner-background back-background-color
"-button" {:-fx-background-color back-background-color
:-fx-border-color border-color
Expand All @@ -38,38 +39,50 @@
:-fx-padding [4 4 4 4]
":hover" {:-fx-background-color border-color
:-fx-background-radius 5}}
"> .virtual-flow" {:-fx-background-color background-color
:-fx-hbar-policy :as-needed
:-fx-vbar-policy :as-needed
"> .corner" {:fx-background-color scroll-color}
"> .scroll-bar" {":horizontal" {:-fx-background-color scroll-color
" .thumb" {:-fx-background-color thumb-color}}
":vertical" {:-fx-background-color scroll-color
" .thumb" {:-fx-background-color thumb-color}}}}}
"-text-area" {"-status" {:-fx-background-color status-background-color
"-filename-input" {:-fx-background-color back-background-color
:-fx-border-color border-color
:-fx-text-fill text-color
:-fx-padding [4 4 4 4]
:-fx-border-radius 5}
"> .virtual-flow" {:-fx-background-color scroll-color
:-fx-hbar-policy :as-needed
:-fx-vbar-policy :as-needed
"> .corner" {:fx-background-color scroll-color}
"> .scroll-bar" {":horizontal" {:-fx-background-color scroll-color
" .thumb" {:-fx-background-color thumb-color}}
":vertical" {:-fx-background-color scroll-color
" .thumb" {:-fx-background-color thumb-color}}}}}
"-text-area" {"-status" {:-fx-background-color back-background-color
:-fx-border-color border-color
:-fx-border-style [:hidden :hidden :solid :hidden]
:-fx-text-fill text-color
:-fx-highlight-fill status-background-color}
"-editor" {:-fx-text-fill text-color
:-fx-highlight-fill highlight-color
:-fx-background-color back-background-color
:-fx-border-color border-color
;:-fx-border-color border-color
" .content" {:-fx-background-color background-color}
" .scroll-pane" {:-fx-background-color background-color
" .scroll-pane" {:-fx-background-color :transparent
:-fx-hbar-policy :as-needed
:-fx-vbar-policy :as-needed
"> .corner" {:-fx-background-color scroll-color}
" .scroll-bar" {":horizontal" {:-fx-background-color scroll-color
" .scroll-bar" {" .decrement-button" {:-fx-opacity 0}
" .increment-button" {:-fx-opacity 0}
":horizontal" {:-fx-background-color :transparent
" .track" {:-fx-opacity 0}
" .track-background" {:-fx-opacity 0}
" .thumb" {:-fx-background-color thumb-color}}
":vertical" {:-fx-background-color scroll-color
":vertical" {:-fx-background-color :transparent
" .track" {:-fx-opacity 0}
" .track-background" {:-fx-opacity 0}
" .thumb" {:-fx-background-color thumb-color}}}}}
"-numbers" {:-fx-text-fill text-color
"-numbers" {:-fx-text-fill line-no-color
:-fx-background-color background-color
:-fx-border-color border-color
;:-fx-border-color border-color
:-fx-highlight-fill background-color
" *.text" {:-fx-text-alignment :right}
" .content" {:-fx-background-color background-color}
" .scroll-pane" {:-fx-hbar-policy :never
:-fx-vbar-policy :never
:-fx-background-color background-color
:-fx-padding 10
:-fx-border-insets 10
:-f-background-insets 10}}}}})))
:-fx-background-color background-color}}}}})))

17 changes: 7 additions & 10 deletions bettercode/src/bettercode/elements.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@
:font "Roboto Mono"
:cursor :text
:text (fx/sub context :text-editor)
:style-class "root-text-area-editor"
:on-key-typed {:event/type :bettercode.events/type-text
:fx/sync true
:tclient tclient}
:on-mouse-clicked {:event/type :bettercode.events/mouse-click
:fx/sync true
:tclient tclient}})
:on-key-typed {:event/type :bettercode.events/text-type}
:on-scroll {:event/type :bettercode.events/scroll}
:style-class "root-text-area-editor"})

(defn line-numbers [{:keys [fx/context]}]
{:fx/type :text-area
:editable false
:pref-width 80
:text (fx/sub context :line-numbers)
:pref-width 40
:pref-height 896
:scroll-top (fx/sub context :vscroll)
:font "Roboto Mono"
:style-class "root-text-area-numbers"})

Expand All @@ -52,7 +50,7 @@
:spacing 28
:children [{:fx/type line-numbers
:h-box/vgrow :always}
{:fx/type text-edit
{:fx/type text-edit ;this doesn't expand downwards for some reason
:tclient tclient
:h-box/vgrow :always
:h-box/hgrow :always}]})
Expand All @@ -61,7 +59,6 @@
{:fx/type :v-box
:pref-width 768
:min-width 768
:pref-height 1080
:min-height 1080
:children [{:fx/type status-row
:v-box/hgrow :always}
Expand Down
Loading