summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-05-30 09:58:05 -0700
committerJeff Carr <[email protected]>2019-05-30 09:58:05 -0700
commit469c7bdd508b25577512704689fd3457aa045ce0 (patch)
tree1319e8f10395f90972980022df90022e32b71889
parent2b7c2022be24a454c79a613332487fe7faea508e (diff)
more variable name changes
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--area.go12
-rw-r--r--splash.go4
-rw-r--r--structs.go156
3 files changed, 92 insertions, 80 deletions
diff --git a/area.go b/area.go
index 7e93a77..ccc7877 100644
--- a/area.go
+++ b/area.go
@@ -25,16 +25,16 @@ func makeSplashArea(wm *GuiWindow, ah *GuiArea) {
// There should be another way to do this (?)
newB := CreateFontButton(wm, "AREA")
- // ah.Attrstr = makeAttributedString()
- ah.Area = ui.NewArea(ah)
- newB.A = ah.Area
+ // ah.UiAttrstr = makeAttributedString()
+ ah.UiArea = ui.NewArea(ah)
+ newB.A = ah.UiArea
newB.WM = wm
- // Data.AllButtons[1].A = ah.Area
+ // Data.AllButtons[1].A = ah.UiArea
// ah.Button = &Data.AllButtons[1]
ah.Button = newB
if (Data.Debug) {
- spew.Dump(ah.Area)
+ spew.Dump(ah.UiArea)
log.Println("DEBUGGING", Data.Debug)
} else {
log.Println("NOT DEBUGGING AREA mhAH.Button =", ah.Button)
@@ -61,7 +61,7 @@ func appendWithAttributes(newText *ui.AttributedString, what string, attrs ...ui
func (ah GuiArea) Draw(a *ui.Area, p *ui.AreaDrawParams) {
tl := ui.DrawNewTextLayout(&ui.DrawTextLayoutParams{
- String: ah.Attrstr,
+ String: ah.UiAttrstr,
DefaultFont: ah.Button.FB.Font(),
Width: p.AreaWidth,
Align: ui.DrawTextAlign(1),
diff --git a/splash.go b/splash.go
index 07ae6da..da2f8f4 100644
--- a/splash.go
+++ b/splash.go
@@ -25,10 +25,10 @@ func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *ui.Box {
// initialize the GuiArea{}
wm.AH = new(GuiArea)
wm.AH.WM = wm
- wm.AH.Attrstr = newText
+ wm.AH.UiAttrstr = newText
makeSplashArea(wm, wm.AH)
- newbox.Append(wm.AH.Area, true)
+ newbox.Append(wm.AH.UiArea, true)
if runtime.GOOS == "linux" {
newbox.Append(ui.NewLabel("OS: Linux"), false)
diff --git a/structs.go b/structs.go
index 0476f6c..b857b1d 100644
--- a/structs.go
+++ b/structs.go
@@ -16,9 +16,7 @@ import pb "git.wit.com/wit/witProtobuf"
var Data GuiData
type GuiData struct {
- State string
- // Width int
- // Height int
+ State string // used like a state machine
// a fallback default function to handle mouse events
// if nothing else is defined to handle them
@@ -56,11 +54,28 @@ type GuiData struct {
EntryPass *ui.Entry
}
-type TableColumnData struct {
- Index int
- CellType string
- Heading string
- Color string
+// Note: every mouse click is handled
+// as a 'Button' regardless of where
+// the user clicks it. You could probably
+// call this 'GuiMouseClick'
+type GuiButton struct {
+ // andlabs/ui stuff
+ B *ui.Button
+ FB *ui.FontButton
+ A *ui.Area
+ W *ui.Window
+ T *ui.Tab
+
+ AH *GuiArea
+
+ // git.wit.com/wit/gui stuff
+ WM *GuiWindow
+ Account *pb.Account
+ VM *pb.Event_VM
+ Action string // what type of button
+
+ // a callback function for the main application
+ custom func (*GuiButton)
}
type GuiEntry struct {
@@ -82,9 +97,9 @@ type GuiEntry struct {
}
type GuiBox struct {
+ W *GuiWindow
EntryMap map[string][]*GuiEntry
- AH *GuiArea
-
+ A *GuiArea
}
type GuiWindow struct {
@@ -99,66 +114,55 @@ type GuiWindow struct {
Action string
}
+//
+// AREA STRUCTURES START
+// AREA STRUCTURES START
+// AREA STRUCTURES START
+//
+type GuiArea struct{
+ WM *GuiWindow
+ Button *GuiButton
+
+ UiAttrstr *ui.AttributedString
+ UiArea *ui.Area
+}
+
type FontString struct {
S string
Size int
F font.Face
W font.Weight
}
-
-type GuiButton struct {
- // andlabs/ui stuff
- B *ui.Button
- FB *ui.FontButton
- A *ui.Area
- W *ui.Window
- T *ui.Tab
-
- AH *GuiArea
-
- // git.wit.com/wit/gui stuff
- WM *GuiWindow
- Account *pb.Account
- VM *pb.Event_VM
- Action string // what type of button
-
- // a callback function for the main application
- custom func (*GuiButton)
-}
-
-
-// AREA STRUCTURES START
-type GuiArea struct{
- Button *GuiButton
- Attrstr *ui.AttributedString
- Area *ui.Area
- WM *GuiWindow
-}
+//
+// AREA STRUCTURES END
+// AREA STRUCTURES END
// AREA STRUCTURES END
+//
//
// TABLE DATA STRUCTURES START
+// TABLE DATA STRUCTURES START
+// TABLE DATA STRUCTURES START
//
-type CellData struct {
- Index int
- HumanID int
- Name string // what type of cell is this?
-}
+//
+// This is the structure that andlabs/ui uses to pass information
+// to the GUI. This is the "authoritative" data.
+//
+type TableData struct {
+ RowCount int // This is the number of 'rows' which really means data elements not what the human sees
+ RowWidth int // This is how wide each row is
+ Rows []RowData // This is all the table data by row
+ generatedColumnTypes []ui.TableValue // generate this dynamically
-// hmm. will this stand the test of time?
-type RowData struct {
- Name string // what kind of row is this?
- Status string // status of the row?
-/*
- // TODO: These may or may not be implementable
- click func() // what function to call if the user clicks on it
- doubleclick func() // what function to call if the user double clicks on it
-*/
- HumanData [20]HumanCellData
+ Cells [20]CellData
+ Human [20]HumanMap
- // The VM from the protobuf
- VM *pb.Event_VM
+ Account *pb.Account // what account this table is for
+
+ lastRow int
+ lastColumn int
+ parentTab *ui.Tab
}
//
@@ -174,7 +178,7 @@ type RowData struct {
// This makes a map so that we can say "give me the value at
// row 4 and column 2" and find the fields that are needed
//
-// TODO: add back image support and the progress bar
+// TODO: re-add images and the progress bar (works in andlabs/ui)
//
type HumanCellData struct {
Name string // what kind of row is this?
@@ -192,24 +196,32 @@ type HumanMap struct {
ColorID int
}
-//
-// This is the structure that andlabs/ui uses to pass information
-// to the GUI. This is the "authoritative" data.
-//
-type TableData struct {
- RowCount int // This is the number of 'rows' which really means data elements not what the human sees
- RowWidth int // This is how wide each row is
- Rows []RowData // This is all the table data by row
- generatedColumnTypes []ui.TableValue // generate this dynamically
+type TableColumnData struct {
+ Index int
+ CellType string
+ Heading string
+ Color string
+}
- Cells [20]CellData
- Human [20]HumanMap
+type CellData struct {
+ Index int
+ HumanID int
+ Name string // what type of cell is this?
+}
- Account *pb.Account // what account this table is for
+// hmm. will this stand the test of time?
+type RowData struct {
+ Name string // what kind of row is this?
+ Status string // status of the row?
+/*
+ // TODO: These may or may not be implementable
+ click func() // what function to call if the user clicks on it
+ doubleclick func() // what function to call if the user double clicks on it
+*/
+ HumanData [20]HumanCellData
- lastRow int
- lastColumn int
- parentTab *ui.Tab
+ // The VM from the protobuf
+ VM *pb.Event_VM
}
//