UI: Renamed Anchor -> Side for frame packing layout

This commit is contained in:
Noah 2019-12-28 21:48:49 -08:00
parent 0437adfbf8
commit b924ea9467
8 changed files with 63 additions and 63 deletions

View File

@ -105,7 +105,7 @@ func NewEditorUI(d *Doodle, s *EditorScene) *EditorUI {
// Position the Canvas inside the frame.
u.Workspace.Pack(u.Canvas, ui.Pack{
Anchor: ui.N,
Side: ui.N,
})
u.Workspace.Compute(d.Engine)
u.ExpandCanvas(d.Engine)
@ -512,7 +512,7 @@ func (u *EditorUI) SetupMenuBar(d *Doodle) *ui.Frame {
w.Handle(ui.MouseUp, btn.Click)
u.Supervisor.Add(w)
frame.Pack(w, ui.Pack{
Anchor: ui.W,
Side: ui.W,
PadX: 1,
})
}
@ -546,7 +546,7 @@ func (u *EditorUI) SetupStatusBar(d *Doodle) *ui.Frame {
label.Configure(style)
label.Compute(d.Engine)
frame.Pack(label, ui.Pack{
Anchor: ui.W,
Side: ui.W,
PadX: 1,
})
@ -571,7 +571,7 @@ func (u *EditorUI) SetupStatusBar(d *Doodle) *ui.Frame {
})
extraLabel.Compute(d.Engine)
frame.Pack(extraLabel, ui.Pack{
Anchor: ui.E,
Side: ui.E,
})
// Set the initial good frame size to have the height secured,

View File

@ -82,7 +82,7 @@ func (u *EditorUI) setupDoodadFrame(e render.Engine, window *ui.Window) (*ui.Fra
})
u.Supervisor.Add(leftBtn)
pager.Pack(leftBtn, ui.Pack{
Anchor: ui.W,
Side: ui.W,
})
scroller := ui.NewFrame("Doodad Scroll Progressbar")
@ -92,7 +92,7 @@ func (u *EditorUI) setupDoodadFrame(e render.Engine, window *ui.Window) (*ui.Fra
Background: render.RGBA(128, 128, 128, 128),
})
pager.Pack(scroller, ui.Pack{
Anchor: ui.W,
Side: ui.W,
})
u.doodadScroller = scroller
@ -105,12 +105,12 @@ func (u *EditorUI) setupDoodadFrame(e render.Engine, window *ui.Window) (*ui.Fra
})
u.Supervisor.Add(rightBtn)
pager.Pack(rightBtn, ui.Pack{
Anchor: ui.E,
Side: ui.E,
})
}
u.doodadPager = pager
frame.Pack(pager, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Fill: true,
PadY: 5,
})
@ -160,7 +160,7 @@ func (u *EditorUI) setupDoodadFrame(e render.Engine, window *ui.Window) (*ui.Fra
row.SetBackground(balance.WindowBackground)
btnRows = append(btnRows, row)
frame.Pack(row, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Fill: true,
})
}
@ -176,7 +176,7 @@ func (u *EditorUI) setupDoodadFrame(e render.Engine, window *ui.Window) (*ui.Fra
buttonSize-2, // rests on top of the window border.
))
row.Pack(btn, ui.Pack{
Anchor: ui.W,
Side: ui.W,
})
// Begin the drag event to grab this Doodad.

View File

@ -32,7 +32,7 @@ func (u *EditorUI) SetupPalette(d *Doodle) *ui.Window {
u.DoodadTab = frame
u.DoodadTab.Hide()
window.Pack(u.DoodadTab, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Fill: true,
})
}
@ -40,7 +40,7 @@ func (u *EditorUI) SetupPalette(d *Doodle) *ui.Window {
// Color Palette Frame.
u.PaletteTab = u.setupPaletteFrame(window)
window.Pack(u.PaletteTab, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Fill: true,
})
@ -79,7 +79,7 @@ func (u *EditorUI) setupPaletteFrame(window *ui.Window) *ui.Frame {
BorderStyle: ui.BorderSunken,
})
swFrame.Pack(colorFrame, ui.Pack{
Anchor: ui.W,
Side: ui.W,
})
label := ui.NewLabel(ui.Label{
@ -88,7 +88,7 @@ func (u *EditorUI) setupPaletteFrame(window *ui.Window) *ui.Frame {
})
label.Font.Color = swatch.Color.Darken(128)
swFrame.Pack(label, ui.Pack{
Anchor: ui.W,
Side: ui.W,
})
btn := ui.NewRadioButton("palette", &u.selectedSwatch, swatch.Name, swFrame)
@ -105,7 +105,7 @@ func (u *EditorUI) setupPaletteFrame(window *ui.Window) *ui.Frame {
})
frame.Pack(btn, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Fill: true,
PadY: 4,
})

View File

@ -24,7 +24,7 @@ func (u *EditorUI) SetupToolbar(d *Doodle) *ui.Frame {
btnFrame := ui.NewFrame("Tool Buttons")
frame.Pack(btnFrame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
})
// Helper functions to toggle the correct palette panel.
@ -146,14 +146,14 @@ func (u *EditorUI) SetupToolbar(d *Doodle) *ui.Frame {
u.Supervisor.Add(btn)
btnFrame.Pack(btn, ui.Pack{
Anchor: ui.N,
Side: ui.N,
PadY: 2,
})
}
// Spacer frame.
frame.Pack(ui.NewFrame("spacer"), ui.Pack{
Anchor: ui.N,
Side: ui.N,
PadY: 8,
})
@ -163,14 +163,14 @@ func (u *EditorUI) SetupToolbar(d *Doodle) *ui.Frame {
Font: balance.LabelFont,
})
frame.Pack(bsLabel, ui.Pack{
Anchor: ui.N,
Side: ui.N,
})
// Brush Size widget
{
sizeFrame := ui.NewFrame("Brush Size Frame")
frame.Pack(sizeFrame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
PadY: 0,
})
@ -184,14 +184,14 @@ func (u *EditorUI) SetupToolbar(d *Doodle) *ui.Frame {
Background: render.Grey,
})
sizeFrame.Pack(sizeLabel, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
PadY: 2,
})
sizeBtnFrame := ui.NewFrame("Size Increment Button Frame")
sizeFrame.Pack(sizeBtnFrame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
})
@ -242,7 +242,7 @@ func (u *EditorUI) SetupToolbar(d *Doodle) *ui.Frame {
})
u.Supervisor.Add(btn)
sizeBtnFrame.Pack(btn, ui.Pack{
Anchor: ui.W,
Side: ui.W,
})
}
}

View File

@ -53,7 +53,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
Background: render.Blue,
})
window.Pack(titleBar, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Fill: true,
})
@ -63,7 +63,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
Background: render.Yellow,
})
window.Pack(body, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Expand: true,
})
s.body = body
@ -77,7 +77,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
Width: 100,
})
body.Pack(leftFrame, ui.Pack{
Anchor: ui.W,
Side: ui.W,
FillY: true,
})
@ -92,7 +92,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
})
s.Supervisor.Add(btn)
leftFrame.Pack(btn, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
PadY: 2,
})
@ -105,7 +105,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
BorderSize: 0,
})
body.Pack(frame, ui.Pack{
Anchor: ui.W,
Side: ui.W,
Expand: true,
Fill: true,
})
@ -119,7 +119,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
Width: 80,
})
body.Pack(rightFrame, ui.Pack{
Anchor: ui.W,
Side: ui.W,
Fill: true,
})
@ -142,7 +142,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
d.Flash("%s clicked", btn)
})
rowFrame.Pack(btn, ui.Pack{
Anchor: ui.W,
Side: ui.W,
Expand: true,
FillX: true,
})
@ -150,7 +150,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
})(row, col, rowFrame)
}
rightFrame.Pack(rowFrame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Fill: true,
})
}
@ -163,7 +163,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
Color: render.Black,
},
}), ui.Pack{
Anchor: ui.NW,
Side: ui.NW,
Padding: 2,
})
@ -175,7 +175,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
}),
)
frame.Pack(cb, ui.Pack{
Anchor: ui.NW,
Side: ui.NW,
Padding: 4,
})
cb.Supervise(s.Supervisor)
@ -187,7 +187,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
Color: render.Red,
},
}), ui.Pack{
Anchor: ui.SE,
Side: ui.SE,
Padding: 8,
})
frame.Pack(ui.NewLabel(ui.Label{
@ -197,7 +197,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
Color: render.Blue,
},
}), ui.Pack{
Anchor: ui.SE,
Side: ui.SE,
Padding: 8,
})
@ -207,7 +207,7 @@ func (s *GUITestScene) Setup(d *Doodle) error {
Background: render.Grey,
})
window.Pack(btnFrame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
})
button1 := ui.NewButton("Button1", ui.NewLabel(ui.Label{
@ -233,11 +233,11 @@ func (s *GUITestScene) Setup(d *Doodle) error {
var align = ui.W
btnFrame.Pack(button1, ui.Pack{
Anchor: align,
Side: align,
Padding: 20,
})
btnFrame.Pack(button2, ui.Pack{
Anchor: align,
Side: align,
Padding: 20,
})

View File

@ -67,7 +67,7 @@ func (s *MainScene) Setup(d *Doodle) error {
})
s.Supervisor.Add(btn)
frame.Pack(btn, ui.Pack{
Anchor: ui.N,
Side: ui.N,
PadY: 8,
// Fill: true,
FillX: true,

View File

@ -136,7 +136,7 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
{
frame := ui.NewFrame("New Level Frame")
window.Pack(frame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Fill: true,
Expand: true,
})
@ -150,13 +150,13 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
Font: balance.LabelFont,
})
frame.Pack(label1, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
})
typeFrame := ui.NewFrame("Page Type Options Frame")
frame.Pack(typeFrame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
})
@ -196,7 +196,7 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
})
s.Supervisor.Add(radio)
typeFrame.Pack(radio, ui.Pack{
Anchor: ui.W,
Side: ui.W,
PadX: 4,
})
}(t)
@ -211,13 +211,13 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
Font: balance.LabelFont,
})
frame.Pack(label2, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
})
wpFrame := ui.NewFrame("Wallpaper Frame")
frame.Pack(wpFrame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
})
@ -246,7 +246,7 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
})
s.Supervisor.Add(radio)
wpFrame.Pack(radio, ui.Pack{
Anchor: ui.W,
Side: ui.W,
PadX: 4,
})
}(t)
@ -264,7 +264,7 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
// })
// bottomFrame.SetBackground(render.Grey)
frame.Pack(bottomFrame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
PadY: 8,
})
@ -309,7 +309,7 @@ func (s *MenuScene) setupNewWindow(d *Doodle) error {
btn.Handle(ui.Click, t.F)
s.Supervisor.Add(btn)
bottomFrame.Pack(btn, ui.Pack{
Anchor: ui.W,
Side: ui.W,
PadX: 4,
PadY: 8,
})
@ -333,7 +333,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
{
frame := ui.NewFrame("Open Drawing Frame")
window.Pack(frame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Fill: true,
Expand: true,
})
@ -347,7 +347,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
Font: balance.LabelFont,
})
frame.Pack(label1, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
})
@ -360,7 +360,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
lvlRow := ui.NewFrame("Level Row 0")
frame.Pack(lvlRow, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
PadY: 1,
})
@ -380,7 +380,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
})
s.Supervisor.Add(btn)
lvlRow.Pack(btn, ui.Pack{
Anchor: ui.W,
Side: ui.W,
Expand: true,
Fill: true,
})
@ -389,7 +389,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
log.Warn("i=%d wrapped at mod 4", i)
lvlRow = ui.NewFrame(fmt.Sprintf("Level Row %d", i))
frame.Pack(lvlRow, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
PadY: 1,
})
@ -409,14 +409,14 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
Font: balance.LabelFont,
})
frame.Pack(label2, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
})
files, _ := userdir.ListDoodads()
ddRow := ui.NewFrame("Doodad Row 0")
frame.Pack(ddRow, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
PadY: 1,
})
@ -431,7 +431,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
})
s.Supervisor.Add(btn)
ddRow.Pack(btn, ui.Pack{
Anchor: ui.W,
Side: ui.W,
Expand: true,
Fill: true,
})
@ -439,7 +439,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
if i > 0 && (i+1)%4 == 0 {
ddRow = ui.NewFrame(fmt.Sprintf("Doodad Row %d", i))
frame.Pack(ddRow, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
PadY: 1,
})
@ -460,7 +460,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
// })
// bottomFrame.SetBackground(render.Grey)
frame.Pack(bottomFrame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
PadY: 8,
})
@ -481,7 +481,7 @@ func (s *MenuScene) setupLoadWindow(d *Doodle) error {
btn.Handle(ui.Click, t.F)
s.Supervisor.Add(btn)
bottomFrame.Pack(btn, ui.Pack{
Anchor: ui.W,
Side: ui.W,
PadX: 4,
PadY: 8,
})

View File

@ -199,7 +199,7 @@ func (s *PlayScene) SetupAlertbox() {
{
frame := ui.NewFrame("Open Drawing Frame")
window.Pack(frame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
Fill: true,
Expand: true,
})
@ -213,7 +213,7 @@ func (s *PlayScene) SetupAlertbox() {
Font: balance.LabelFont,
})
frame.Pack(s.alertBoxLabel, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
PadY: 16,
})
@ -224,7 +224,7 @@ func (s *PlayScene) SetupAlertbox() {
bottomFrame := ui.NewFrame("Button Frame")
frame.Pack(bottomFrame, ui.Pack{
Anchor: ui.N,
Side: ui.N,
FillX: true,
PadY: 8,
})
@ -239,7 +239,7 @@ func (s *PlayScene) SetupAlertbox() {
handler()
})
bottomFrame.Pack(btn, ui.Pack{
Anchor: ui.W,
Side: ui.W,
PadX: 2,
})
s.supervisor.Add(btn)