Skip to content

Commit

Permalink
add: welcome component
Browse files Browse the repository at this point in the history
  • Loading branch information
Mostik committed May 2, 2022
1 parent 18f3ed5 commit 101379e
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 1 deletion.
1 change: 1 addition & 0 deletions resources/themes/dark.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cActive": "DDDDDD",
"cInActive": "AAAAAA",
"cMiddle": "555555",

"bgScrollBar": "303030",
"bgVerticalLine": "404040",
Expand Down
1 change: 1 addition & 0 deletions resources/themes/light.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cActive": "DDDDDD",
"cInActive": "AAAAAA",
"cMiddle": "555555",

"bgScrollBar": "c1c1c1",
"bgVerticalLine": "d3d3d3",
Expand Down
2 changes: 2 additions & 0 deletions src/configuration.nim
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type
ColorTheme* = object
cActive*: ColorRGB
cInActive*: ColorRGB
cMiddle*: ColorRGB

bgScrollBar*: ColorRGB
bgVerticalLine*: ColorRGB
Expand Down Expand Up @@ -126,6 +127,7 @@ const defaultColorTheme = ColorTheme(

cActive: rgb(221, 221, 221),
cInActive: rgb(170, 170, 170),
cMiddle: rgb(85, 85, 85),

bgScrollBar: rgb(48, 48, 48),
bgVerticalLine: rgb(64, 64, 64),
Expand Down
8 changes: 7 additions & 1 deletion src/folx.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sequtils, os, times, math, unicode, std/monotimes, options
import cligen
import markup, configuration, git, text, text_editor, side_explorer, explorer, title, status_bar
import markup, configuration, git, text, text_editor, side_explorer, explorer, title, status_bar, welcome

proc contains*(b: Rect, a: GVec2): bool =
let a = a.vec2
Expand Down Expand Up @@ -106,6 +106,9 @@ proc folx(files: seq[string] = @[], workspace: string = "", preferWorkFolderReso
TextEditor text_editor(x = 260, y = 40, w = window.size.vec2.x - 260, h = window.size.vec2.y - 60):
gt = editor_gt
bg = colorTheme.bgTextArea
else:
Welcome(wh = window.size.vec2):
gt = editor_gt

TitleBar(w = window.size.vec2.x, h = 40):
gt = interface_gt
Expand Down Expand Up @@ -134,6 +137,9 @@ proc folx(files: seq[string] = @[], workspace: string = "", preferWorkFolderReso
TextEditor text_editor(top = 40, bottom = 20):
gt = editor_gt
bg = colorTheme.bgTextArea
else:
Welcome(wh = window.size.vec2):
gt = editor_gt

TitleBar(w = window.size.vec2.x, h = 40):
gt = interface_gt
Expand Down
60 changes: 60 additions & 0 deletions src/welcome.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import pixwindy, pixie
import render, configuration, markup

component Name {.noexport.}:
proc handle(
gt: var GlyphTable,
)

let
box = parentBox
dy = round(gt.font.size * 1.27)

image.draw ("folx").toRunes, colorTheme.cMiddle, vec2(box.x, box.y), box, gt, colorTheme.bgTextArea

component Item {.noexport.}:
proc handle(
gt: var GlyphTable,
label: string,
hotkey: string,
)

let
box = parentBox
dy = round(gt.font.size * 1.27)

image.draw (label).toRunes, colorTheme.cMiddle, vec2(box.x, box.y), box, gt, colorTheme.bgTextArea

r.fillStyle = colorTheme.cMiddle
r.fillRoundedRect rect(vec2(box.x + 265, box.y - 2), vec2(130, 40)), 10.0

r.fillStyle = colorTheme.bgTextArea
r.fillRoundedRect rect(vec2(box.x + 267, box.y), vec2(126, 36)), 10.0

image.draw (hotkey).toRunes, colorTheme.cMiddle, vec2(box.x + 280, box.y), box, gt, colorTheme.bgTextArea


component Welcome:
proc handle(
gt: var GlyphTable,
)

let box = parentBox

gt.font.size = gt.font.size * 2.5

Name(x = (box.w - 400) / 2, y = 200, w = 400, h = 50):
gt = gt

Item(x = (box.w - 400) / 2, y = 300, w = 400, h = 50):
gt = gt
label = "Open Folder"
hotkey = "Ctrl+O"

Item(x = (box.w - 400) / 2, y = 400, w = 400, h = 50):
gt = gt
label = "Open Explorer"
hotkey = "Ctrl+E"

gt.font.size = gt.font.size / 2.5

0 comments on commit 101379e

Please sign in to comment.