clean up more mouse click handling. Almost finished.

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-26 14:47:30 -07:00
parent 80608e070d
commit 25757a812f
3 changed files with 20 additions and 13 deletions

9
gui.go
View File

@ -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

View File

@ -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 {

View File

@ -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")
}
}
}