Skip to content

Commit e89e4e7

Browse files
authored
Merge pull request #10 from vision-05/dev
First Pre-release
2 parents a3ef9c8 + 61dc2ba commit e89e4e7

File tree

9 files changed

+158
-118
lines changed

9 files changed

+158
-118
lines changed

bettercode/project.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
:main ^:skip-aot bettercode.core
1616
:target-path "target/%s"
1717
:profiles {:uberjar {:aot :all
18+
:injections [(javafx.application.Platform/exit)]
1819
:jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})

bettercode/src/bettercode/core.clj

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
:width 768
4343
:height 1080
4444
:min-width 768
45-
:min-height 1080
45+
:min-height 1140
4646
:resizable true
4747
:scene {:fx/type :scene
4848
:fill "#23282D"
@@ -60,8 +60,14 @@
6060
:on-action {:event/type :bettercode.events/openfex
6161
:tclient tclient}}
6262
{:fx/type :menu-item
63+
:style-class "root-menu-bar-item-sub-item"
6364
:text "save"
6465
:on-action {:event/type :bettercode.events/saveevent
66+
:tclient tclient}}
67+
{:fx/type :menu-item
68+
:style-class "root-menu-bar-item-sub-item"
69+
:text "close file"
70+
:on-action {:event/type :bettercode.events/close-file
6571
:tclient tclient}}]}]}
6672
{:fx/type bettercode.elements/editor-pane
6773
:tclient tclient
@@ -88,16 +94,18 @@
8894
(println "started")
8995
(let [c @(client (if hostname hostname "localhost") 8080)
9096
msg @(s/put! c ["get-dir"])
91-
dirs @(s/take! c)
97+
dirs (vec @(s/take! c))
9298
*context
9399
(atom
94100
(fx/create-context {:title "BetterCode"
95-
:file-path "/home/tim/foo.txt"
101+
:file-path ""
96102
:text-editor ""
97103
:dir-contents dirs
98-
:cur-path "/home/tim/foo.txt"
104+
:cur-path (bettercode.events/parent-dir (subs (dirs 0) 5))
99105
:file-explorer-show true
100-
:file-name-entered ""}
106+
:file-name-entered ""
107+
:line-numbers ""
108+
:vscroll 0}
101109
#(cache/lru-cache-factory % :threshold 4096)))]
102110
(fx/create-app *context
103111
:event-handler bettercode.events/handle-event

bettercode/src/bettercode/css.clj

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,33 @@
44
(def style
55
(css/register ::style
66
(let [back-background-color "#2E3440"
7-
status-background-color "#6183AE"
7+
status-background-color "#4C566A"
88
text-color "#ECEFF4"
9-
border-color "#5E81AC"
9+
border-color "#4C566A"
1010
background-color "#2E3440"
11-
scroll-color "#434C5E22"
12-
thumb-color "#4C566A44"
13-
highlight-color "#5E81AC"]
11+
scroll-color "#434C5E00"
12+
thumb-color "#4C566A22"
13+
highlight-color "#4C566A"
14+
line-no-color "#4C566A"]
1415
{".root" {:-fx-background-color back-background-color
1516
:-fx-text-fill text-color
1617
"-menu-bar" {:-fx-background-color highlight-color
1718
:-fx-text-fill text-color
18-
:-fx-padding 0
19-
:-fx-margin 0
19+
:-fx-control-inner-background highlight-color
2020
" .label" {:-fx-font-size 12
2121
:-fx-text-fill text-color}
2222
"-item" {:-fx-text-fill text-color
2323
:-fx-background-color highlight-color
24-
:-fx-padding 0
25-
:-fx-margin 0
24+
:-fx-control-inner-background highlight-color
25+
:-fx-border-color highlight-color
2626
" .label" {:-fx-font-size 10
2727
:-fx-text-fill text-color}
2828
"-sub-item" {:-fx-text-fill text-color
29-
:-fx-padding 0
30-
:-fx-margin 0
3129
:-fx-background-color highlight-color
32-
:-fx-control-inner-background highlight-color}}}
30+
:-fx-control-inner-background highlight-color
31+
:-fx-padding [4 4 4 4]
32+
":hover" {:-fx-background-color background-color
33+
:-fx-background-radius 5}}}}
3334
"-fsview" {:-fx-control-inner-background back-background-color
3435
"-button" {:-fx-background-color back-background-color
3536
:-fx-border-color border-color
@@ -38,38 +39,50 @@
3839
:-fx-padding [4 4 4 4]
3940
":hover" {:-fx-background-color border-color
4041
:-fx-background-radius 5}}
41-
"> .virtual-flow" {:-fx-background-color background-color
42-
:-fx-hbar-policy :as-needed
43-
:-fx-vbar-policy :as-needed
44-
"> .corner" {:fx-background-color scroll-color}
45-
"> .scroll-bar" {":horizontal" {:-fx-background-color scroll-color
46-
" .thumb" {:-fx-background-color thumb-color}}
47-
":vertical" {:-fx-background-color scroll-color
48-
" .thumb" {:-fx-background-color thumb-color}}}}}
49-
"-text-area" {"-status" {:-fx-background-color status-background-color
42+
"-filename-input" {:-fx-background-color back-background-color
43+
:-fx-border-color border-color
44+
:-fx-text-fill text-color
45+
:-fx-padding [4 4 4 4]
46+
:-fx-border-radius 5}
47+
"> .virtual-flow" {:-fx-background-color scroll-color
48+
:-fx-hbar-policy :as-needed
49+
:-fx-vbar-policy :as-needed
50+
"> .corner" {:fx-background-color scroll-color}
51+
"> .scroll-bar" {":horizontal" {:-fx-background-color scroll-color
52+
" .thumb" {:-fx-background-color thumb-color}}
53+
":vertical" {:-fx-background-color scroll-color
54+
" .thumb" {:-fx-background-color thumb-color}}}}}
55+
"-text-area" {"-status" {:-fx-background-color back-background-color
56+
:-fx-border-color border-color
57+
:-fx-border-style [:hidden :hidden :solid :hidden]
5058
:-fx-text-fill text-color
5159
:-fx-highlight-fill status-background-color}
5260
"-editor" {:-fx-text-fill text-color
5361
:-fx-highlight-fill highlight-color
5462
:-fx-background-color back-background-color
55-
:-fx-border-color border-color
63+
;:-fx-border-color border-color
5664
" .content" {:-fx-background-color background-color}
57-
" .scroll-pane" {:-fx-background-color background-color
65+
" .scroll-pane" {:-fx-background-color :transparent
5866
:-fx-hbar-policy :as-needed
5967
:-fx-vbar-policy :as-needed
6068
"> .corner" {:-fx-background-color scroll-color}
61-
" .scroll-bar" {":horizontal" {:-fx-background-color scroll-color
69+
" .scroll-bar" {" .decrement-button" {:-fx-opacity 0}
70+
" .increment-button" {:-fx-opacity 0}
71+
":horizontal" {:-fx-background-color :transparent
72+
" .track" {:-fx-opacity 0}
73+
" .track-background" {:-fx-opacity 0}
6274
" .thumb" {:-fx-background-color thumb-color}}
63-
":vertical" {:-fx-background-color scroll-color
75+
":vertical" {:-fx-background-color :transparent
76+
" .track" {:-fx-opacity 0}
77+
" .track-background" {:-fx-opacity 0}
6478
" .thumb" {:-fx-background-color thumb-color}}}}}
65-
"-numbers" {:-fx-text-fill text-color
79+
"-numbers" {:-fx-text-fill line-no-color
6680
:-fx-background-color background-color
67-
:-fx-border-color border-color
81+
;:-fx-border-color border-color
82+
:-fx-highlight-fill background-color
83+
" *.text" {:-fx-text-alignment :right}
6884
" .content" {:-fx-background-color background-color}
6985
" .scroll-pane" {:-fx-hbar-policy :never
7086
:-fx-vbar-policy :never
71-
:-fx-background-color background-color
72-
:-fx-padding 10
73-
:-fx-border-insets 10
74-
:-f-background-insets 10}}}}})))
87+
:-fx-background-color background-color}}}}})))
7588

bettercode/src/bettercode/elements.clj

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@
2020
:font "Roboto Mono"
2121
:cursor :text
2222
:text (fx/sub context :text-editor)
23-
:style-class "root-text-area-editor"
24-
:on-key-typed {:event/type :bettercode.events/type-text
25-
:fx/sync true
26-
:tclient tclient}
27-
:on-mouse-clicked {:event/type :bettercode.events/mouse-click
28-
:fx/sync true
29-
:tclient tclient}})
23+
:on-key-typed {:event/type :bettercode.events/text-type}
24+
:on-scroll {:event/type :bettercode.events/scroll}
25+
:style-class "root-text-area-editor"})
3026

3127
(defn line-numbers [{:keys [fx/context]}]
3228
{:fx/type :text-area
3329
:editable false
34-
:pref-width 80
30+
:text (fx/sub context :line-numbers)
31+
:pref-width 40
3532
:pref-height 896
33+
:scroll-top (fx/sub context :vscroll)
3634
:font "Roboto Mono"
3735
:style-class "root-text-area-numbers"})
3836

@@ -52,7 +50,7 @@
5250
:spacing 28
5351
:children [{:fx/type line-numbers
5452
:h-box/vgrow :always}
55-
{:fx/type text-edit
53+
{:fx/type text-edit ;this doesn't expand downwards for some reason
5654
:tclient tclient
5755
:h-box/vgrow :always
5856
:h-box/hgrow :always}]})
@@ -61,7 +59,6 @@
6159
{:fx/type :v-box
6260
:pref-width 768
6361
:min-width 768
64-
:pref-height 1080
6562
:min-height 1080
6663
:children [{:fx/type status-row
6764
:v-box/hgrow :always}

0 commit comments

Comments
 (0)