From 03eaf07bee24bb12319e53e090a19f2c2a05ad23 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sat, 2 Nov 2013 14:26:18 +0100 Subject: New Biomes are now displayed in the sidebar. --- main.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/main.go b/main.go index 11468b8..288b59d 100644 --- a/main.go +++ b/main.go @@ -21,10 +21,9 @@ type GUI struct { statusContext uint lastStatus string - sbVBox *gtk.VBox - biomes []BiomeInfo bioVBox *gtk.VBox + bioVBoxWrap *gtk.VBox mapw *MapWidget } @@ -182,19 +181,19 @@ func labelCustomFont(text, font string) *gtk.Label { } func (g *GUI) mkSidebar() *gtk.ScrolledWindow { - g.sbVBox = gtk.NewVBox(false, 0) + sbVBox := gtk.NewVBox(false, 0) - g.sbVBox.PackStart(labelCustomFont("Tools", "Sans Bold 14"), false, false, 3) + sbVBox.PackStart(labelCustomFont("Tools", "Sans Bold 14"), false, false, 3) g.showbiomes = gtk.NewCheckButtonWithLabel("Show Biomes") g.showbiomes.SetActive(true) g.showbiomes.Connect("toggled", g.showbiomesToggled) - g.sbVBox.PackStart(g.showbiomes, false, false, 3) + sbVBox.PackStart(g.showbiomes, false, false, 3) g.fixSnowIce = gtk.NewCheckButtonWithLabel("Fix Snow/Ice") g.fixSnowIce.SetTooltipText("Add Snow/Ice for Taiga/Ice Plains. Remove Snow/Ice for other biomes.") g.fixSnowIce.Connect("toggled", g.fixSnowIceToggled) - g.sbVBox.PackStart(g.fixSnowIce, false, false, 3) + sbVBox.PackStart(g.fixSnowIce, false, false, 3) fill := gtk.NewRadioButtonWithLabel(nil, "Fill") fill.SetActive(true) @@ -208,19 +207,21 @@ func (g *GUI) mkSidebar() *gtk.ScrolledWindow { drawHBox.PackEnd(drawRadius, false, false, 3) draw.Connect("toggled", g.mkUpdateToolFx(draw, NewDrawTool(func() int { return drawRadius.GetValueAsInt() }))) - g.sbVBox.PackStart(fill, false, false, 3) - g.sbVBox.PackStart(drawHBox, false, false, 3) + sbVBox.PackStart(fill, false, false, 3) + sbVBox.PackStart(drawHBox, false, false, 3) - g.sbVBox.PackStart(gtk.NewHSeparator(), false, false, 3) - g.sbVBox.PackStart(labelCustomFont("Biomes", "Sans Bold 14"), false, false, 3) + sbVBox.PackStart(gtk.NewHSeparator(), false, false, 3) + sbVBox.PackStart(labelCustomFont("Biomes", "Sans Bold 14"), false, false, 3) + g.bioVBoxWrap = gtk.NewVBox(false, 0) g.bioVBox = gtk.NewVBox(false, 0) - g.sbVBox.PackStart(g.bioVBox, true, false, 3) + g.bioVBoxWrap.PackStart(g.bioVBox, false, false, 0) + sbVBox.PackStart(g.bioVBoxWrap, false, false, 3) g.updateBiomeInfo() scrolled := gtk.NewScrolledWindow(nil, nil) scrolled.SetPolicy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) - scrolled.AddWithViewPort(g.sbVBox) + scrolled.AddWithViewPort(sbVBox) return scrolled } @@ -240,10 +241,9 @@ func (g *GUI) updateBiomeInfo() { vbox.PackStart(biohbox, false, false, 3) } - g.sbVBox.Remove(g.bioVBox) - g.bioVBox.Destroy() - - g.sbVBox.PackStart(vbox, true, false, 3) + g.bioVBoxWrap.Remove(g.bioVBox) + g.bioVBoxWrap.PackStart(vbox, false, false, 3) + vbox.ShowAll() g.bioVBox = vbox // TODO: Update mapwidget -- cgit v1.2.3-70-g09d2