diff options
author | Joe <rbo@gmx.us> | 2024-03-27 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-03-27 20:20:20 +0100 |
commit | 8d1bb55ef66e450106c22ae18c7105029e75f338 (patch) | |
tree | 0d7da559504293ebe923d474fa159a4d9ea55999 /src/i_insert.go | |
parent | k (diff) | |
download | hardflip-8d1bb55ef66e450106c22ae18c7105029e75f338.tar.gz hardflip-8d1bb55ef66e450106c22ae18c7105029e75f338.tar.bz2 hardflip-8d1bb55ef66e450106c22ae18c7105029e75f338.tar.xz hardflip-8d1bb55ef66e450106c22ae18c7105029e75f338.tar.zst hardflip-8d1bb55ef66e450106c22ae18c7105029e75f338.zip |
great
Diffstat (limited to 'src/i_insert.go')
-rw-r--r-- | src/i_insert.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/i_insert.go b/src/i_insert.go index 23c2bc6..ddcefff 100644 --- a/src/i_insert.go +++ b/src/i_insert.go @@ -52,12 +52,24 @@ package main import ( + "errors" "os" "strconv" "github.com/gdamore/tcell/v2" ) +func i_insert_check_ok(data *HardData, insert *HostNode) { + if len(insert.Name) == 0 { + data.insert_err = append(data.insert_err, + errors.New("no name")) + } + if len(insert.Host) == 0 { + data.insert_err = append(data.insert_err, + errors.New("no host")) + } +} + func i_draw_text_box(ui HardUI, line int, dim Quad, label, content string, id, selected int, red bool) { const tbox_size int = 14 @@ -88,6 +100,27 @@ func i_draw_text_box(ui HardUI, line int, dim Quad, label, content string, line, tbox_style, content) } +func i_draw_ok_butt(ui HardUI, line int, id, selected int) { + const butt_size int = 10 + const txt string = "ok" + style := ui.style[DEF_STYLE].Background(tcell.ColorBlack).Dim(true) + + if id == selected { + style = style.Reverse(true).Dim(false) + } + buff := "[" + for i := 0; i < butt_size / 2 - len(txt); i++ { + buff += " " + } + buff += txt + for i := 0; i < butt_size / 2 - len(txt); i++ { + buff += " " + } + buff += "]" + i_draw_text(ui.s, (ui.dim[W] / 2) - (butt_size / 2), line, + (ui.dim[W] / 2) + (butt_size / 2), line, style, buff) +} + func i_draw_insert_panel(ui HardUI, in *HostNode) { if len(in.Name) == 0 { return @@ -187,5 +220,7 @@ func i_draw_insert_ssh(ui HardUI, line int, win Quad, in *HostNode) { i_draw_text(ui.s, ui.dim[W] / 2, win.T + line, win.R - 1, win.T + line, ui.style[ERR_STYLE], text) } + if line += 2; win.T + line >= win.B { return } + i_draw_ok_butt(ui, win.T + line, 11, ui.insert_sel) // TODO: here } |