AllenDang / giu

Cross platform rapid GUI framework for golang based on Dear ImGui.
MIT License
2.16k stars 128 forks source link

[bug] Style Var ID conversions missing #729

Closed damntourists closed 6 months ago

damntourists commented 8 months ago

What happend?

Hi there, I'm continuing my work on porting over theming from https://github.com/Patitotective/ImThemes/blob/main/themes.toml and previously I reported missing style var ids, so i apologize if some of these are redundant to my previous posts. What's different this time is it seems you all have identified string values that map perfectly if the keys in this particular theme file are converted to hyphenated snakecase values, and by itterating over the key/values, I came up with a few more missing items. It appears that the following can't be converted using giu.StyleVarIDFromString(), and so I tried finding alternatives to setting these values which I made note of in the code. Anyway, I'm including it here in case this is helpful. Previously you weren't able to find references to a couple @ https://github.com/AllenDang/giu/issues/725, so perhaps this naming could help?

    var skipme = make([]string, 0)
    skipme = append(skipme, "columns-min-spacing")            // ??
    skipme = append(skipme, "cell-padding")                   // StyleVarCellPadding = StyleVarID(imgui.StyleVarCellPadding) https://github.com/search?q=repo%3AAllenDang%2Fgiu%20cell&type=code
    skipme = append(skipme, "window-menu-button-position")    // ??
    skipme = append(skipme, "tab-min-width-for-close-button") // ??
    skipme = append(skipme, "tab-border-size")                // missing. maybe 93? https://github.com/search?q=repo%3AAllenDang%2Fgiu+border-size&type=code
    skipme = append(skipme, "color-button-position")          // ?? *-button-position appears to be missing.

    for _, n := range skipme {
        if n == p.imguiVar {
            return nil
        }
    }
    _id := giu.StyleVarIDFromString(p.imguiVar)

Code example

main.go ```golang // put your code here! ```

To Reproduce

  1. Run my demo
  2. will see the crash...

Version

master

OS

ubuntu

gucio321 commented 6 months ago

@damntourists In reference to these constants: https://github.com/AllenDang/cimgui-go/blob/3a75e488e5d36560d5c0f3064488b075e730ad38/cimgui_enums.go#L1498 (they are mirrored from imgui upstream) I can't find any of the style vars You've mentioned.

I Suppose that ButtonPadding is StyleVarFramePadding.

Let me know if you still need help!