summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-05-26 14:47:30 -0700
committerJeff Carr <[email protected]>2019-05-26 14:47:30 -0700
commit59629136af4b87dffc50d06144627a19fc5536e0 (patch)
treeffc4b0d6ee39322d66bd865c60a250c4c68794e2
parent80608e070dd16636780b40a8061ae6ec41e9b1f7 (diff)
clean up more mouse click handling. Almost finished.
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--.structs.go.swpbin0 -> 16384 bytes
-rw-r--r--gui.go9
-rw-r--r--structs.go5
-rw-r--r--tableCallbacks.go19
4 files changed, 20 insertions, 13 deletions
diff --git a/.structs.go.swp b/.structs.go.swp
new file mode 100644
index 0000000..5f7effd
--- /dev/null
+++ b/.structs.go.swp
Binary files differ
diff --git a/gui.go b/gui.go
index 0b52ec5..36d297e 100644
--- a/gui.go
+++ b/gui.go
@@ -134,6 +134,14 @@ func mouseClick(b *ButtonMap) {
createAddVmBox(Data.cloudTab, "Create New Virtual Machine")
return
}
+ if (b.Action == "SHOW VM") {
+ Data.CurrentVM = b.VM
+ if (Data.Debug) {
+ go ui.Main(ShowVM)
+ } else {
+ createVmBox(Data.cloudTab, b.VM)
+ }
+ }
if (b.Action == "ADD") {
log.Println("\tgui.mouseClick() SHOULD ADD VM HERE?")
}
@@ -194,7 +202,6 @@ func CreateButton(a *pb.Account, vm *pb.Event_VM,
newmap.VM = vm
newmap.Action = action
newmap.custom = custom
-// newmap.aTab = Data.CurrentTab
Data.AllButtons = append(Data.AllButtons, newmap)
return newB
diff --git a/structs.go b/structs.go
index 1420989..903034d 100644
--- a/structs.go
+++ b/structs.go
@@ -65,8 +65,9 @@ type GuiDataStructure struct {
// This is "GLOBAL"
AllButtons []ButtonMap
- // a tab (maybe the one the user is playing with?)
// a VM (maybe the one the user is playing with?)
+ // if opening a new window, this is a trick to
+ // pass it in
CurrentVM *pb.Event_VM
// All the tabs
@@ -162,6 +163,8 @@ type HumanCellData struct {
TextID int
Color color.RGBA
ColorID int
+ VM *pb.Event_VM
+ Button *ButtonMap
}
type HumanMap struct {
diff --git a/tableCallbacks.go b/tableCallbacks.go
index 1f926d4..6b9d2eb 100644
--- a/tableCallbacks.go
+++ b/tableCallbacks.go
@@ -97,18 +97,15 @@ func (mh *TableData) SetCellValue(m *ui.TableModel, row, column int, value ui.Ta
func defaultSetCellValue(mh *TableData, row int, column int) {
if (mh.Cells[column].Name == "BUTTON") {
humanID := mh.Cells[column].HumanID
- vmname := mh.Rows[row].HumanData[humanID].Text
- log.Println("vmname =", vmname)
- log.Println("defaultSetCellValue() FOUND THE BUTTON!!!!!!! Button was pressed START", row, column)
- // Data.CurrentVM = fmt.Sprintf("%s",vmname)
- Data.CurrentVM = mh.Rows[row].VM
- log.Println("User last clicked on Data.CurrentVM =", mh.Rows[row].VM)
+ log.Println("defaultSetCellValue() FOUND THE TABLE BUTTON ", row, humanID)
+
+ button := mh.Rows[row].HumanData[humanID].Button
+ if (button != nil) {
+ mouseClick(button)
+ return
+ }
if (Data.Debug) {
- go ui.Main(ShowVM)
- } else {
- // AddVmConfigureTab(vmname, mh.Rows[row].PbVM)
- // createVmBox(Data.cloudTab, buttonVmClick, mh.Rows[row].PbVM)
- createVmBox(Data.cloudTab, mh.Rows[row].VM)
+ panic("defaultSetCellValue() GOT AN UNKNOWN BUTTON CLICK IN TABLE")
}
}
}