From 77035ad6bdf08097bafd4f4d4668fda4a2db9bac Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 29 May 2019 15:46:21 -0700 Subject: start moving the area text back to the main program Signed-off-by: Jeff Carr --- area.go | 2 +- debug.go | 2 +- mainCloudBox.go | 6 +++--- splash.go | 24 +----------------------- structs.go | 9 +++++++++ 5 files changed, 15 insertions(+), 28 deletions(-) diff --git a/area.go b/area.go index 8240b47..bbc85e5 100644 --- a/area.go +++ b/area.go @@ -25,7 +25,7 @@ func makeSplashArea(ah *AreaHandler) { // There should be another way to do this (?) newB := CreateFontButton("AREA") - ah.Attrstr = makeAttributedString() + // ah.Attrstr = makeAttributedString() ah.Area = ui.NewArea(ah) newB.A = ah.Area Data.AllButtons[1].A = ah.Area diff --git a/debug.go b/debug.go index fa83b37..f898597 100644 --- a/debug.go +++ b/debug.go @@ -82,7 +82,7 @@ func runTestHide(b *ButtonMap) { log.Println("runTestHide START") Data.Window1.Box1.Hide() Data.Window1.Box2.Hide() - time.Sleep(2000 * time.Millisecond) + // time.Sleep(2000 * time.Millisecond) Data.State = "HIDE" log.Println("runTestHide END") } diff --git a/mainCloudBox.go b/mainCloudBox.go index 9ab998d..42529ce 100644 --- a/mainCloudBox.go +++ b/mainCloudBox.go @@ -208,7 +208,7 @@ func ShowMainTab() { } func GoMainWindow() { - Data.Window1 = new(WindowMap) + // Data.Window1 = new(WindowMap) ui.Main(makeCloudWindow) } @@ -235,8 +235,8 @@ func makeCloudWindow() { Data.Window1.W.SetChild(Data.Window1.T) Data.Window1.W.SetMargined(true) - text := makeAttributedString() - Data.Window1.Box1 = ShowSplashBox(text) + // text := makeAttributedString() + Data.Window1.Box1 = ShowSplashBox(Data.Window1.AreaText) Data.Window1.T.Append("WIT Splash", Data.Window1.Box1) Data.Window1.T.SetMargined(0, true) diff --git a/splash.go b/splash.go index e4c6868..5568d99 100644 --- a/splash.go +++ b/splash.go @@ -49,29 +49,7 @@ func ShowSplashBox(newText *ui.AttributedString) *ui.Box { okButton := CreateButton(nil, nil, "OK", "AREA", nil) newbox.Append(okButton, false) + newbox.Append(CreateButton(nil, nil, "NEWTEXT", "NEWTEXT", nil), false) return newbox } - -func makeAttributedString() *ui.AttributedString { - newText := ui.NewAttributedString("") - - appendWithAttributes(newText, "Welcome to the Cloud Control Panel\n", ui.TextSize(16), ui.TextColor{0.0, 0.0, 0.8, .8}) // "RGBT" - - appendWithAttributes(newText, "(alpha)\n\n", ui.TextSize(10)) - - appendWithAttributes(newText, "This control panel was designed to be an interface to your 'private' cloud. ", ui.TextWeightBold) - appendWithAttributes(newText, "The concept of a private cloud means that you can use a providers system, or, seemlessly, use your own hardware in your own datacenter. ", ui.TextWeightBold) - - newText.AppendUnattributed("\n") - newText.AppendUnattributed("\n") - appendWithAttributes(newText, "This control panel requires:\n") - newText.AppendUnattributed("\n") - appendWithAttributes(newText, "IPv6\n") - appendWithAttributes(newText, "newText, Your hostname in DNS\n") - newText.AppendUnattributed("\n\n\n\n\n") - - appendWithAttributes(newText, "\n", ui.TextSize(10)) - - return newText -} diff --git a/structs.go b/structs.go index 3ebe61a..6a10517 100644 --- a/structs.go +++ b/structs.go @@ -1,6 +1,7 @@ package gui import "image/color" +import "golang.org/x/image/font" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" @@ -92,6 +93,14 @@ type WindowMap struct { Box2 *ui.Box AH *AreaHandler + AreaText *ui.AttributedString +} + +type FontString struct { + S string + Size int + F font.Face + W font.Weight } type ButtonMap struct { -- cgit v1.2.3