Skip to content

Commit a770ff4

Browse files
committed
cofwidget: remove IDs
1 parent 2217643 commit a770ff4

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

pkg/widgets/cofwidget/widget.go

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ func (p *widget) makeAnimationTab(state *widgetState) giu.Layout {
120120
}
121121

122122
func (p *widget) makeLayerTab(state *widgetState) giu.Layout {
123-
addLayerButtonID := fmt.Sprintf("Add a new layer...##%sAddLayer", p.id)
124-
addLayerButton := giu.Button(addLayerButtonID).Size(actionButtonW, actionButtonH)
123+
addLayerButton := giu.Button("Add a new layer...").Size(actionButtonW, actionButtonH)
125124
addLayerButton.OnClick(func() {
126125
p.createNewLayer()
127126
})
@@ -136,11 +135,10 @@ func (p *widget) makeLayerTab(state *widgetState) giu.Layout {
136135
}
137136

138137
currentLayerName := layerStrings[state.viewerState.LayerIndex]
139-
layerList := giu.Combo("", currentLayerName, layerStrings, &state.LayerIndex).ID("##" + p.id + "layer")
138+
layerList := giu.Combo("", currentLayerName, layerStrings, &state.LayerIndex)
140139
layerList.Size(layerListW).OnChange(p.onUpdate)
141140

142-
deleteLayerButtonID := fmt.Sprintf("Delete current layer...##%sDeleteLayer", p.id)
143-
deleteLayerButton := giu.Button(deleteLayerButtonID).Size(actionButtonW, actionButtonH)
141+
deleteLayerButton := giu.Button("Delete current layer...").Size(actionButtonW, actionButtonH)
144142
deleteLayerButton.OnClick(func() {
145143
const (
146144
strPrompt = "Do you really want to remove this layer?"
@@ -193,8 +191,7 @@ func (p *widget) makePriorityTab(state *widgetState) giu.Layout {
193191
}
194192

195193
directionString := directionStrings[state.viewerState.DirectionIndex]
196-
directionList := giu.Combo("", directionString, directionStrings, &state.DirectionIndex).
197-
ID("##" + p.id + "dir")
194+
directionList := giu.Combo("", directionString, directionStrings, &state.DirectionIndex)
198195
directionList.Size(layerListW).OnChange(p.onUpdate)
199196

200197
frameStrings := make([]string, 0)
@@ -203,23 +200,20 @@ func (p *widget) makePriorityTab(state *widgetState) giu.Layout {
203200
}
204201

205202
frameString := frameStrings[state.FrameIndex]
206-
frameList := giu.Combo("", frameString, frameStrings, &state.FrameIndex).
207-
ID("##" + p.id + "frame")
203+
frameList := giu.Combo("", frameString, frameStrings, &state.FrameIndex)
208204
frameList.Size(layerListW).OnChange(p.onUpdate)
209205

210206
const (
211207
strPrompt = "Do you really want to remove this direction?"
212208
strMessage = "If you'll click YES, all data from this direction will be lost. Continue?"
213209
)
214210

215-
duplicateButtonID := fmt.Sprintf("Duplicate current direction...##%sDuplicateDirection", p.id)
216-
duplicateButton := giu.Button(duplicateButtonID).Size(actionButtonW, actionButtonH)
211+
duplicateButton := giu.Button("Duplicate current direction...").Size(actionButtonW, actionButtonH)
217212
duplicateButton.OnClick(func() {
218213
p.duplicateDirection()
219214
})
220215

221-
deleteButtonID := fmt.Sprintf("Delete current direction...##%sDeleteDirection", p.id)
222-
deleteButton := giu.Button(deleteButtonID).Size(actionButtonW, actionButtonH)
216+
deleteButton := giu.Button("Delete current direction...").Size(actionButtonW, actionButtonH)
223217
deleteButton.OnClick(func() {
224218
fnYes := func() {
225219
p.deleteCurrentDirection()
@@ -432,35 +426,29 @@ func (p *widget) makeAddLayerLayout() giu.Layout {
432426
giu.Row(
433427
giu.Label("Type: "),
434428
giu.Combo("", compositeTypeList[state.newLayerFields.LayerType],
435-
compositeTypeList, &state.newLayerFields.LayerType).Size(bigListW).ID(
436-
"##"+p.id+"AddLayerType",
437-
),
429+
compositeTypeList, &state.newLayerFields.LayerType).Size(bigListW),
438430
),
439431
giu.Row(
440432
giu.Label("Shadow: "),
441433
widgets.MakeCheckboxFromByte("##"+p.id+"AddLayerShadow", &state.newLayerFields.Shadow),
442434
),
443435
giu.Row(
444436
giu.Label("Selectable: "),
445-
giu.Checkbox("", &state.newLayerFields.Selectable).ID("##"+p.id+"AddLayerSelectable"),
437+
giu.Checkbox("", &state.newLayerFields.Selectable),
446438
),
447439
giu.Row(
448440
giu.Label("Transparent: "),
449-
giu.Checkbox("", &state.newLayerFields.Transparent).ID("##"+p.id+"AddLayerTransparent"),
441+
giu.Checkbox("", &state.newLayerFields.Transparent),
450442
),
451443
giu.Row(
452444
giu.Label("Draw effect: "),
453445
giu.Combo("", drawEffectList[state.newLayerFields.DrawEffect],
454-
drawEffectList, &state.newLayerFields.DrawEffect).Size(bigListW).ID(
455-
"##"+p.id+"AddLayerDrawEffect",
456-
),
446+
drawEffectList, &state.newLayerFields.DrawEffect).Size(bigListW),
457447
),
458448
giu.Row(
459449
giu.Label("Weapon class: "),
460450
giu.Combo("", weaponClassList[state.newLayerFields.WeaponClass],
461-
weaponClassList, &state.newLayerFields.WeaponClass).Size(bigListW).ID(
462-
"##"+p.id+"AddLayerWeaponClass",
463-
),
451+
weaponClassList, &state.newLayerFields.WeaponClass).Size(bigListW),
464452
),
465453
giu.Separator(),
466454
p.makeSaveCancelButtonRow(available, state),

0 commit comments

Comments
 (0)