Skip to content

Commit

Permalink
better align notes list panes widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnovak committed Jun 29, 2024
1 parent f928d1d commit 5ab82d7
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8442,11 +8442,14 @@ proc renderNotesListPane(x, y, w, h: float; a) =
var
wx = LeftPad
wy = 44

let
wh = 24
ButtonWidth = 24

# Scope filter
koi.radioButtons(
wx, wy, w=w-LeftPad-RightPad - 32, wh,
wx, wy, w=w-LeftPad-RightPad - 30, wh,
nls.currFilter.scope, style = a.theme.radioButtonStyle
)

Expand All @@ -8459,36 +8462,36 @@ proc renderNotesListPane(x, y, w, h: float; a) =
nls.prevLinkCursor = nls.linkCursor

koi.checkBox(
wx+244, wy, w=24,
wx+245, wy, w=ButtonWidth,
nls.linkCursor,
tooltip = "Link cursor and note selection",
style = cbStyle
)

# Note types filter
wy += 33
if koi.button(wx+244, wy, w=24, wh, "A",
if koi.button(wx+245, wy, w=ButtonWidth, wh, "A",
tooltip = "Show all note types",
style = a.theme.buttonStyle):
nls.currFilter.noteType = @[ntfNone, ntfNumber, ntfId, ntfIcon]

koi.multiRadioButtons(
wx, wy, w=w-LeftPad-RightPad - 32, wh,
wx, wy, w=w-LeftPad-RightPad - 30, wh,
nls.currFilter.noteType, style = a.theme.radioButtonStyle
)

# Note text filter
wy += 44
koi.label(wx+1, wy, 60, wh, "Search", style=a.theme.labelStyle)

if koi.button(wx+244, wy, w=24, wh, IconTrash,
if koi.button(wx+245, wy, w=ButtonWidth, wh, IconTrash,
disabled = nls.currFilter.searchTerm.isEmptyOrWhitespace,
tooltip = "Clear search term",
style = a.theme.buttonStyle):
nls.currFilter.searchTerm = ""

koi.textField(
wx+64, wy, w=177, wh, nls.currFilter.searchTerm,
wx+64, wy, w=174, wh, nls.currFilter.searchTerm,
style = a.theme.textFieldStyle
)

Expand All @@ -8498,7 +8501,7 @@ proc renderNotesListPane(x, y, w, h: float; a) =
koi.label(wx+1, wy, 60, wh, "Order by", style=a.theme.labelStyle)

koi.dropDown(
wx+64, wy, w=48, wh, nls.currFilter.ordering,
wx+64, wy, w=65, wh, nls.currFilter.ordering,
style = a.theme.dropDownStyle
)

Expand All @@ -8525,12 +8528,14 @@ proc renderNotesListPane(x, y, w, h: float; a) =
of nsfLevel: not l.regionOpts.enabled
of nsfRegion: true

if koi.button(wx+213, wy, w=24, wh, IconPlusSmall, tooltip = "Expand all",
if koi.button(wx+214, wy, w=ButtonWidth, wh, IconPlusSmall,
tooltip = "Expand all",
disabled = expandCollapseDisabled,
style = a.theme.buttonStyle):
setExpandedStates(expanded=true, a)

if koi.button(wx+244, wy, w=24, wh, IconMinusSmall, tooltip = "Collapse all",
if koi.button(wx+245, wy, w=ButtonWidth, wh, IconMinusSmall,
tooltip = "Collapse all",
disabled = expandCollapseDisabled,
style = a.theme.buttonStyle):
setExpandedStates(expanded=false, a)
Expand Down

0 comments on commit 5ab82d7

Please sign in to comment.