0.5.1 Beads properties work. /JL
This commit is contained in:
@@ -28,6 +28,7 @@ type (
|
|||||||
Green byte
|
Green byte
|
||||||
Blue byte
|
Blue byte
|
||||||
TextColor walk.Color
|
TextColor walk.Color
|
||||||
|
GreyScale bool
|
||||||
}
|
}
|
||||||
|
|
||||||
Serie struct {
|
Serie struct {
|
||||||
@@ -96,7 +97,7 @@ func LoadBeads(mw *MyMainWindow) {
|
|||||||
if brand.BrandName == mw.brand_combo.Text() {
|
if brand.BrandName == mw.brand_combo.Text() {
|
||||||
for _, bead := range brand.Colors {
|
for _, bead := range brand.Colors {
|
||||||
if !bead.Disabled {
|
if !bead.Disabled {
|
||||||
bc := NewBeadColor(mw, bead.ColorName, bead.ColorIndex, bead.Red, bead.Green, bead.Blue)
|
bc := NewBeadColor(mw, bead.ColorName, bead.ColorIndex, bead.Red, bead.Green, bead.Blue, bead.IsGrayscale)
|
||||||
for _, s := range bead.Series.Serie {
|
for _, s := range bead.Series.Serie {
|
||||||
se := new(Serie)
|
se := new(Serie)
|
||||||
se.Name = s.Name
|
se.Name = s.Name
|
||||||
@@ -117,7 +118,7 @@ func LoadBeads(mw *MyMainWindow) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBeadColor(mw *MyMainWindow, name string, id int, red byte, green byte, blue byte) *BeadColor {
|
func NewBeadColor(mw *MyMainWindow, name string, id int, red byte, green byte, blue byte, greyscale bool) *BeadColor {
|
||||||
var err error
|
var err error
|
||||||
cm, _ := walk.NewComposite(mw.colors)
|
cm, _ := walk.NewComposite(mw.colors)
|
||||||
cm.SetAlignment(walk.AlignHNearVCenter)
|
cm.SetAlignment(walk.AlignHNearVCenter)
|
||||||
@@ -128,6 +129,7 @@ func NewBeadColor(mw *MyMainWindow, name string, id int, red byte, green byte, b
|
|||||||
color.Color = cm
|
color.Color = cm
|
||||||
color.SetBackgroundColor(walk.RGB(red, green, blue))
|
color.SetBackgroundColor(walk.RGB(red, green, blue))
|
||||||
color.SetColor(red, green, blue)
|
color.SetColor(red, green, blue)
|
||||||
|
color.SetGreyscale(greyscale)
|
||||||
color.SetTextColor()
|
color.SetTextColor()
|
||||||
lbl, _ := walk.NewLabel(cm)
|
lbl, _ := walk.NewLabel(cm)
|
||||||
lbl.SetTextColor(color.TextColor)
|
lbl.SetTextColor(color.TextColor)
|
||||||
@@ -243,6 +245,10 @@ func NewBeadColor(mw *MyMainWindow, name string, id int, red byte, green byte, b
|
|||||||
return color
|
return color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bc *BeadColor) SetGreyscale(grey bool) {
|
||||||
|
bc.GreyScale = grey
|
||||||
|
}
|
||||||
|
|
||||||
func (bc *BeadColor) SetBackgroundColor(col walk.Color) {
|
func (bc *BeadColor) SetBackgroundColor(col walk.Color) {
|
||||||
bc.backgroundColor, _ = walk.NewSolidColorBrush(col)
|
bc.backgroundColor, _ = walk.NewSolidColorBrush(col)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ type MyMainWindow struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AppName string = "BeadImager"
|
AppName string = "BeadImager"
|
||||||
Version string = "0.5.0"
|
Version string = "0.5.1"
|
||||||
CopyRight string = "©2022 Jan Lerking"
|
CopyRight string = "©2022-'23 Jan Lerking"
|
||||||
STD_MESS string = "Ready"
|
STD_MESS string = "Ready"
|
||||||
LogFile string = "BeadImager.log"
|
LogFile string = "BeadImager.log"
|
||||||
Sep string = "\\"
|
Sep string = "\\"
|
||||||
@@ -108,6 +108,22 @@ func main() {
|
|||||||
mw.brand_model = CreateBrandsList(mw)
|
mw.brand_model = CreateBrandsList(mw)
|
||||||
CreatePalletteGroup(mw)
|
CreatePalletteGroup(mw)
|
||||||
CreateBeadsGroup(mw)
|
CreateBeadsGroup(mw)
|
||||||
|
switch ConfigShowAll {
|
||||||
|
case "true":
|
||||||
|
//ShowAll(mw)
|
||||||
|
case "false":
|
||||||
|
//ShowGreyscale(mw)
|
||||||
|
}
|
||||||
|
switch ConfigGreyscale {
|
||||||
|
case "true":
|
||||||
|
//ShowGreyscale(mw)
|
||||||
|
case "false":
|
||||||
|
//ShowAll(mw)
|
||||||
|
}
|
||||||
|
switch ConfigInStock {
|
||||||
|
case "true":
|
||||||
|
//ShowInStock(mw)
|
||||||
|
}
|
||||||
CreateCanvasGroup(mw)
|
CreateCanvasGroup(mw)
|
||||||
CreateProperties(mw)
|
CreateProperties(mw)
|
||||||
|
|
||||||
|
|||||||
+77
-18
@@ -39,6 +39,72 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func ShowInStock(mw *MyMainWindow) {
|
||||||
|
for _, bead := range mw.beads {
|
||||||
|
for _, s := range bead.Series {
|
||||||
|
if s.Name == mw.serie_combo.Text() {
|
||||||
|
if s.inStock {
|
||||||
|
bead.Color.SetVisible(true)
|
||||||
|
} else {
|
||||||
|
bead.Color.SetVisible(false)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ShowGreyscale(mw *MyMainWindow) {
|
||||||
|
mw.properties.propBeads.showAll.SetChecked(false)
|
||||||
|
mw.properties.propBeads.greyScale.SetChecked(true)
|
||||||
|
for _, bead := range mw.beads {
|
||||||
|
if bead.GreyScale {
|
||||||
|
if mw.properties.propBeads.inStock.Checked() {
|
||||||
|
for _, s := range bead.Series {
|
||||||
|
if s.Name == mw.serie_combo.Text() {
|
||||||
|
if s.inStock {
|
||||||
|
bead.Color.SetVisible(true)
|
||||||
|
} else {
|
||||||
|
bead.Color.SetVisible(false)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
bead.Color.SetVisible(true)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bead.Color.SetVisible(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ShowAll(mw *MyMainWindow) {
|
||||||
|
mw.properties.propBeads.showAll.SetChecked(true)
|
||||||
|
mw.properties.propBeads.greyScale.SetChecked(false)
|
||||||
|
for _, bead := range mw.beads {
|
||||||
|
if mw.properties.propBeads.inStock.Checked() {
|
||||||
|
for _, s := range bead.Series {
|
||||||
|
if s.Name == mw.serie_combo.Text() {
|
||||||
|
if s.inStock {
|
||||||
|
bead.Color.SetVisible(true)
|
||||||
|
} else {
|
||||||
|
bead.Color.SetVisible(false)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
bead.Color.SetVisible(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func CreateProperties(mw *MyMainWindow) {
|
func CreateProperties(mw *MyMainWindow) {
|
||||||
mw.properties = new(properties)
|
mw.properties = new(properties)
|
||||||
mw.properties.propColor = new(PropColor)
|
mw.properties.propColor = new(PropColor)
|
||||||
@@ -413,16 +479,12 @@ func CreateBeadsProperties(mw *MyMainWindow) {
|
|||||||
mw.properties.propBeads.showAll.SetChecked(false)
|
mw.properties.propBeads.showAll.SetChecked(false)
|
||||||
}
|
}
|
||||||
mw.properties.propBeads.showAll.CheckedChanged().Attach(func() {
|
mw.properties.propBeads.showAll.CheckedChanged().Attach(func() {
|
||||||
log.Println("Show all changed")
|
log.Println("Show all checkbox changed")
|
||||||
if mw.properties.propBeads.showAll.Checked() && mw.properties.propBeads.greyScale.Checked() {
|
if mw.properties.propBeads.showAll.Checked() {
|
||||||
mw.properties.propBeads.greyScale.SetChecked(false)
|
|
||||||
}
|
|
||||||
if !mw.properties.propBeads.showAll.Checked() {
|
|
||||||
SetConfigShowAll("false")
|
|
||||||
mw.properties.propBeads.greyScale.SetChecked(true)
|
|
||||||
} else {
|
|
||||||
SetConfigShowAll("true")
|
SetConfigShowAll("true")
|
||||||
mw.properties.propBeads.greyScale.SetChecked(false)
|
SetConfigGreyscale("false")
|
||||||
|
mw.properties.propBeads.greyScale.SetChecked(!mw.properties.propBeads.showAll.Checked())
|
||||||
|
//ShowAll(mw)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
walk.NewHSpacer(grcom)
|
walk.NewHSpacer(grcom)
|
||||||
@@ -445,16 +507,12 @@ func CreateBeadsProperties(mw *MyMainWindow) {
|
|||||||
mw.properties.propBeads.greyScale.SetChecked(false)
|
mw.properties.propBeads.greyScale.SetChecked(false)
|
||||||
}
|
}
|
||||||
mw.properties.propBeads.greyScale.CheckedChanged().Attach(func() {
|
mw.properties.propBeads.greyScale.CheckedChanged().Attach(func() {
|
||||||
log.Println("Greyscale changed")
|
log.Println("Greyscale checkbox changed")
|
||||||
if mw.properties.propBeads.showAll.Checked() && mw.properties.propBeads.greyScale.Checked() {
|
if mw.properties.propBeads.greyScale.Checked() {
|
||||||
mw.properties.propBeads.showAll.SetChecked(false)
|
|
||||||
}
|
|
||||||
if !mw.properties.propBeads.greyScale.Checked() {
|
|
||||||
SetConfigGreyscale("false")
|
|
||||||
mw.properties.propBeads.showAll.SetChecked(true)
|
|
||||||
} else {
|
|
||||||
SetConfigGreyscale("true")
|
SetConfigGreyscale("true")
|
||||||
mw.properties.propBeads.showAll.SetChecked(false)
|
SetConfigShowAll("false")
|
||||||
|
mw.properties.propBeads.showAll.SetChecked(!mw.properties.propBeads.greyScale.Checked())
|
||||||
|
//ShowGreyscale(mw)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
mw.properties.propBeads.inStock, err = walk.NewCheckBox(mw.properties.propBeads.property)
|
mw.properties.propBeads.inStock, err = walk.NewCheckBox(mw.properties.propBeads.property)
|
||||||
@@ -481,6 +539,7 @@ func CreateBeadsProperties(mw *MyMainWindow) {
|
|||||||
mw.properties.propBeads.greyScale.SetChecked(false)
|
mw.properties.propBeads.greyScale.SetChecked(false)
|
||||||
}
|
}
|
||||||
if mw.properties.propBeads.inStock.Checked() {
|
if mw.properties.propBeads.inStock.Checked() {
|
||||||
|
//ShowInStock(mw)
|
||||||
SetConfigInStock("true")
|
SetConfigInStock("true")
|
||||||
} else {
|
} else {
|
||||||
SetConfigInStock("false")
|
SetConfigInStock("false")
|
||||||
|
|||||||
Reference in New Issue
Block a user