-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Begin GUI globals, component library, design system #38
Comments
This one is right near the top in terms of priority... I can't/won't officially increment any versions and cut a release until I've done a real deep dive on the panels and widgets. Any visitors building our modules will find some interesting semi-transparent, perspex-like behaviour, which is due to missing resources but kinda has it's own charm :D totally aware of it, and must start a discovery branch for the panels and widgets ASAP. |
I guess struct ThemedScrew : app::ThemedSvgScrew {
ThemedScrew() {
setSvg(Svg::load(asset::system("res/ComponentLibrary/ScrewSilver.svg")), Svg::load(asset::system("res/ComponentLibrary/ScrewBlack.svg")));
}
}; So, I'm guessing then that This bodes real well for my intentions; really appreciating the solid GUI framework in the Rack API the more I look into it. I even prefer it over the web component style appearing elsewhere. So, we can make a ton of themed panel BG's, widgets, and such forth. We can define SVG-alike codeblobs using NanoSVG which encapsulate things like screws, gradients, etc. The EDIT: Here's the parent class: struct ThemedSvgScrew : SvgScrew {
std::shared_ptr<window::Svg> lightSvg;
std::shared_ptr<window::Svg> darkSvg;
void setSvg(std::shared_ptr<window::Svg> lightSvg, std::shared_ptr<window::Svg> darkSvg) {
this->lightSvg = lightSvg;
this->darkSvg = darkSvg;
SvgScrew::setSvg(settings::preferDarkPanels ? darkSvg : lightSvg);
}
void step() override {
SvgScrew::setSvg(settings::preferDarkPanels ? darkSvg : lightSvg);
SvgScrew::step();
}
}; Hmmm... so it's just This right here is the clue to how to work with themes, I think: settings::preferDarkPanels ? darkSvg : lightSvg |
Not quite. I've gotten confident with nanovg/nanosvg, as well as subscribing to Rack events; meanwhile, I really do not want to use Inkscape or Figma on this project. I'm a front-end web developer... I don't want to mix the day job in with my "fun" stuff. And those Inkscape SVG files are a nightmare, as is their GUI... So, I'm considering in terms of design system:
As an aside, I'm entirely skeptical about the widespread use of SVG's and |
Let's do some psuedo-code, before-I-forget style: void addScrewsToWidget(rack::widget::Widget* widget)
{
rack::componentlibrary::ThemedScrew* screws [] = {
::rack::createWidgetCentered<::rack::componentlibrary::ThemedScrew>(/** Top Left */),
::rack::createWidgetCentered<::rack::componentlibrary::ThemedScrew>(/** Top Right */),
// etc...
};
for(auto screw : screws) {
widget->addChild(screw);
}
} We can grub some additional logic by querying
Another, less weildy approach is to use class inheritance;
I'm more a fan of the first option, but may experiment with the latter to observe what benefits this approach may have, as well as drawbacks. EDIT: thoughts on making a function vs. making a base class
|
Maybe we could template it: template <type T>
void addCenteredChildToWidget(rack::widget::Widget* widget)
{
T* children [] = {
::rack::createWidgetCentered<T>(/** Top Left */),
::rack::createWidgetCentered<T>(/** Top Right */),
// etc...
};
for(auto child : children) {
widget->addChild(child);
}
} A constraint would be needed to ensure that |
Ok, latest:
About to start the themed knobs (the text labels and ringed line around the widget will respond to theme changes). I found a gotcha: There are too many, conflicting, types of knob widgets in the Rack factory component library. Sizes named "big", "large", and "huge" don't really give a clear idea of hierarchy, to boot. I've found that I've been using a size that is not present on any Core or Fundamental v2 modules - the "big" size. Thus, I cannot find any matching instances of the knob I've used on my VCA in the factory modules, and therefore don't have a reference for dimensions and other requirements I'd need to put the ring and label on it. Using the "Large" size, which is smaller than "big", looks kinda small on the VCA panel and makes me wonder if I should make my module less wide. The "Huge" one is just too big for such a basic module. I still really like using a slider, but this takes even less horizontal space and again makes me wonder if I should make my VCA thinner along In any case, I'll bounce straight on to the LFO and then other modules, where even more components will be needed. But I'll need to be aware which knob sizes not to use, if I plan on using factory modules as references. |
Chore
Describe the chore
I have started the blank panels which will encompass the eventual 0.1 release. Immediately, I'm finding things that I want to set globally (probably from
plugin.hpp
) so that I can enact global themes and such on the GUI front.Here's a function which calls some colors - a black and a white - and paints the BG of the module widget:
I don't want to update those vars in a million places when I decide to make adjustments to my theme.
This type of thing will crop up a lot - my intention is to perhaps also add a component library for things like themed screws... There will probably be DSP templates and stuff also.
The blank panel modules are an excellent starting point, as I can resolve lots of concerns that will affect the entire library, before getting deep into DSP and weird ideas.
Additional context
I'll start a branch when the time is right, but while the module count is low, a branch isn't a priority at this time.
Tasks
onThemeChanged
" events, if possible, to mark framebuffer widgets asdirty()
#263The text was updated successfully, but these errors were encountered: