aboutsummaryrefslogtreecommitdiff
path: root/internal/model/enums.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-29 04:03:38 -0400
committerhistoria <[not public]>2026-06-29 04:03:38 -0400
commitba34490aaed5f7c242c2b0453130fefc07d0d5d0 (patch)
treedb5818757d5080221494cead1c7e61a576d1cb65 /internal/model/enums.go
parentb1e252c996a6332d391f96624a7d6f149eb097c4 (diff)
downloadtui-ascii-mapper-ba34490aaed5f7c242c2b0453130fefc07d0d5d0.tar.gz
restructured projectHEADmain
Diffstat (limited to 'internal/model/enums.go')
-rw-r--r--internal/model/enums.go81
1 files changed, 81 insertions, 0 deletions
diff --git a/internal/model/enums.go b/internal/model/enums.go
new file mode 100644
index 0000000..a29cf84
--- /dev/null
+++ b/internal/model/enums.go
@@ -0,0 +1,81 @@
+package model
+
+type Tool int
+
+const (
+ ToolBrush Tool = iota
+ ToolSelect
+ ToolErase
+ ToolFill
+ ToolLine
+ ToolRect
+ ToolCircle
+ ToolText
+)
+
+func (t Tool) String() string {
+ switch t {
+ case ToolBrush:
+ return "Brush"
+ case ToolSelect:
+ return "Select"
+ case ToolErase:
+ return "Erase"
+ case ToolFill:
+ return "Fill"
+ case ToolLine:
+ return "Line"
+ case ToolRect:
+ return "Rectangle"
+ case ToolCircle:
+ return "Circle"
+ case ToolText:
+ return "Text"
+ }
+ return ""
+}
+
+type Mode int
+
+const (
+ ModeNormal Mode = iota
+ ModeDialog
+ ModeLinePreview
+ ModeRectPreview
+ ModeCirclePreview
+ ModeTextEdit
+)
+
+type DialogType int
+
+const (
+ DialogNone DialogType = iota
+ DialogSaveAs
+ DialogOpenMap
+ DialogResize
+ DialogQuitConfirm
+ DialogDeleteSubmapConfirm
+ DialogRenameSymbol
+ DialogRenameMap
+ DialogFileSave
+ DialogFileOpen
+)
+
+func Clamp(v, lo, hi int) int {
+ if v < lo {
+ return lo
+ }
+ if v > hi {
+ return hi
+ }
+ return v
+}
+
+func ContainsInt(s []int, v int) bool {
+ for _, x := range s {
+ if x == v {
+ return true
+ }
+ }
+ return false
+}