remove all the uneeded row args

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-13 00:08:59 -07:00
parent ea6d22fc46
commit f3eeb4e9ec
2 changed files with 38 additions and 14 deletions

40
gui.go
View File

@ -58,7 +58,7 @@ func initColumnNames(mh *TableData, cellJWC string, junk string) {
} }
} }
func initRow(mh *TableData, row int, parts []InputData) { func initRow(mh *TableData, parts []InputData) {
tmpBTindex := 0 tmpBTindex := 0
humanID := 0 humanID := 0
for key, foo := range parts { for key, foo := range parts {
@ -68,16 +68,16 @@ func initRow(mh *TableData, row int, parts []InputData) {
humanID += 1 humanID += 1
if (foo.CellType == "BG") { if (foo.CellType == "BG") {
initRowBTcolor (mh, row, tmpBTindex, parts[key]) initRowBTcolor (mh, tmpBTindex, parts[key])
tmpBTindex += 1 tmpBTindex += 1
} else if (foo.CellType == "BUTTON") { } else if (foo.CellType == "BUTTON") {
initRowButtonColumn (mh, row, tmpBTindex, parts[key].Heading, parts[key]) initRowButtonColumn (mh, tmpBTindex, parts[key].Heading, parts[key])
tmpBTindex += 1 tmpBTindex += 1
} else if (foo.CellType == "TEXTCOLOR") { } else if (foo.CellType == "TEXTCOLOR") {
initRowTextColorColumn(mh, row, tmpBTindex, tmpBTindex + 1, parts[key].Heading, ui.TableColor{0.0, 0, 0.9, 1}, parts[key]) initRowTextColorColumn(mh, tmpBTindex, tmpBTindex + 1, parts[key].Heading, ui.TableColor{0.0, 0, 0.9, 1}, parts[key])
tmpBTindex += 2 tmpBTindex += 2
} else if (foo.CellType == "TEXT") { } else if (foo.CellType == "TEXT") {
initRowTextColumn (mh, row, tmpBTindex, parts[key].Heading, parts[key]) initRowTextColumn (mh, tmpBTindex, parts[key].Heading, parts[key])
tmpBTindex += 1 tmpBTindex += 1
} else { } else {
panic("I don't know what this is in initColumnNames") panic("I don't know what this is in initColumnNames")
@ -98,10 +98,34 @@ func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts
initColumnNames(mh, foo.CellType, foo.Heading) initColumnNames(mh, foo.CellType, foo.Heading)
} }
for row := 0; row < mh.RowCount; row++ { /*
initRow(mh, row, parts) tmpBTindex = 0
humanID = 0
for key, foo := range parts {
log.Println(key, foo)
parts[key].Index = humanID
humanID += 1
if (foo.CellType == "BG") {
initRowBTcolor (mh, tmpBTindex, parts[key])
tmpBTindex += 1
} else if (foo.CellType == "BUTTON") {
initRowButtonColumn (mh, tmpBTindex, parts[key].Heading, parts[key])
tmpBTindex += 1
} else if (foo.CellType == "TEXTCOLOR") {
initRowTextColorColumn(mh, tmpBTindex, tmpBTindex + 1, parts[key].Heading, ui.TableColor{0.0, 0, 0.9, 1}, parts[key])
tmpBTindex += 2
} else if (foo.CellType == "TEXT") {
initRowTextColumn (mh, tmpBTindex, parts[key].Heading, parts[key])
tmpBTindex += 1
} else {
panic("I don't know what this is in initColumnNames")
} }
log.Println(mh) }
*/
initRow(mh, parts)
model := ui.NewTableModel(mh) model := ui.NewTableModel(mh)
table := ui.NewTable( table := ui.NewTable(

View File

@ -53,7 +53,7 @@ type TableData struct {
Human [20]HumanMap Human [20]HumanMap
} }
func initRowBTcolor(mh *TableData, row int, intBG int, cell InputData) { func initRowBTcolor(mh *TableData, intBG int, cell InputData) {
humanInt := cell.Index humanInt := cell.Index
// setup mapping from human readable indexes to internal libUI indexes // setup mapping from human readable indexes to internal libUI indexes
@ -64,10 +64,10 @@ func initRowBTcolor(mh *TableData, row int, intBG int, cell InputData) {
mh.Cells[intBG].Name = "BG" mh.Cells[intBG].Name = "BG"
mh.Cells[intBG].HumanID = humanInt mh.Cells[intBG].HumanID = humanInt
log.Println("HumanID = row, intBG, humanInt", row, intBG, humanInt) log.Println("intBG, humanInt", intBG, humanInt)
} }
func initRowButtonColumn(mh *TableData, row int, buttonID int, junk string, cell InputData) { func initRowButtonColumn(mh *TableData, buttonID int, junk string, cell InputData) {
humanInt := cell.Index humanInt := cell.Index
// setup mapping from human readable indexes to internal libUI indexes // setup mapping from human readable indexes to internal libUI indexes
@ -78,10 +78,10 @@ func initRowButtonColumn(mh *TableData, row int, buttonID int, junk string, cell
mh.Cells[buttonID].Name = "BUTTON" mh.Cells[buttonID].Name = "BUTTON"
mh.Cells[buttonID].HumanID = humanInt mh.Cells[buttonID].HumanID = humanInt
log.Println("HumanID = row, buttonID, humanInt", row, buttonID, humanInt) log.Println("buttonID, humanInt", buttonID, humanInt)
} }
func initRowTextColorColumn(mh *TableData, row int, stringID int, colorID int, junk string, color ui.TableColor, cell InputData) { func initRowTextColorColumn(mh *TableData, stringID int, colorID int, junk string, color ui.TableColor, cell InputData) {
humanInt := cell.Index humanInt := cell.Index
// setup mapping from human readable indexes to internal libUI indexes // setup mapping from human readable indexes to internal libUI indexes
@ -97,7 +97,7 @@ func initRowTextColorColumn(mh *TableData, row int, stringID int, colorID int, j
mh.Cells[colorID].HumanID = humanInt mh.Cells[colorID].HumanID = humanInt
} }
func initRowTextColumn(mh *TableData, row int, stringID int, junk string, cell InputData) { func initRowTextColumn(mh *TableData, stringID int, junk string, cell InputData) {
humanInt := cell.Index humanInt := cell.Index
// setup mapping from human readable indexes to internal libUI indexes // setup mapping from human readable indexes to internal libUI indexes