Merge pull request #799 from redtide/palette-rename
UI: changed Theme naming convetion
This commit is contained in:
commit
8ba3b4e917
4 changed files with 90 additions and 90 deletions
|
|
@ -11,7 +11,7 @@ widget_class mainView {open
|
||||||
class Background
|
class Background
|
||||||
}
|
}
|
||||||
Fl_Group {} {
|
Fl_Group {} {
|
||||||
comment {theme=darkTheme} open
|
comment {palette=invertedPalette} open
|
||||||
xywh {0 0 800 110}
|
xywh {0 0 800 110}
|
||||||
class LogicalGroup
|
class LogicalGroup
|
||||||
} {
|
} {
|
||||||
|
|
|
||||||
|
|
@ -566,7 +566,7 @@ void Editor::Impl::createFrameContents()
|
||||||
{
|
{
|
||||||
const CColor frameBackground = { 0xd3, 0xd7, 0xcf };
|
const CColor frameBackground = { 0xd3, 0xd7, 0xcf };
|
||||||
|
|
||||||
struct Theme {
|
struct Palette {
|
||||||
CColor boxBackground;
|
CColor boxBackground;
|
||||||
CColor text;
|
CColor text;
|
||||||
CColor inactiveText;
|
CColor inactiveText;
|
||||||
|
|
@ -582,56 +582,56 @@ void Editor::Impl::createFrameContents()
|
||||||
CColor knobLineIndicatorColor;
|
CColor knobLineIndicatorColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
Theme lightTheme;
|
Palette normalPalette;
|
||||||
lightTheme.boxBackground = { 0xba, 0xbd, 0xb6 };
|
normalPalette.boxBackground = { 0xba, 0xbd, 0xb6 };
|
||||||
lightTheme.text = { 0x00, 0x00, 0x00 };
|
normalPalette.text = { 0x00, 0x00, 0x00 };
|
||||||
lightTheme.inactiveText = { 0xb2, 0xb2, 0xb2 };
|
normalPalette.inactiveText = { 0xb2, 0xb2, 0xb2 };
|
||||||
lightTheme.highlightedText = { 0xfd, 0x98, 0x00 };
|
normalPalette.highlightedText = { 0xfd, 0x98, 0x00 };
|
||||||
lightTheme.titleBoxText = { 0xff, 0xff, 0xff };
|
normalPalette.titleBoxText = { 0xff, 0xff, 0xff };
|
||||||
lightTheme.titleBoxBackground = { 0x2e, 0x34, 0x36 };
|
normalPalette.titleBoxBackground = { 0x2e, 0x34, 0x36 };
|
||||||
lightTheme.icon = lightTheme.text;
|
normalPalette.icon = normalPalette.text;
|
||||||
lightTheme.iconHighlight = { 0xfd, 0x98, 0x00 };
|
normalPalette.iconHighlight = { 0xfd, 0x98, 0x00 };
|
||||||
lightTheme.valueText = { 0xff, 0xff, 0xff };
|
normalPalette.valueText = { 0xff, 0xff, 0xff };
|
||||||
lightTheme.valueBackground = { 0x2e, 0x34, 0x36 };
|
normalPalette.valueBackground = { 0x2e, 0x34, 0x36 };
|
||||||
lightTheme.knobActiveTrackColor = { 0x00, 0xb6, 0x2a };
|
normalPalette.knobActiveTrackColor = { 0x00, 0xb6, 0x2a };
|
||||||
lightTheme.knobInactiveTrackColor = { 0x30, 0x30, 0x30 };
|
normalPalette.knobInactiveTrackColor = { 0x30, 0x30, 0x30 };
|
||||||
lightTheme.knobLineIndicatorColor = { 0x00, 0x00, 0x00 };
|
normalPalette.knobLineIndicatorColor = { 0x00, 0x00, 0x00 };
|
||||||
Theme darkTheme;
|
Palette invertedPalette;
|
||||||
darkTheme.boxBackground = { 0x2e, 0x34, 0x36 };
|
invertedPalette.boxBackground = { 0x2e, 0x34, 0x36 };
|
||||||
darkTheme.text = { 0xff, 0xff, 0xff };
|
invertedPalette.text = { 0xff, 0xff, 0xff };
|
||||||
darkTheme.inactiveText = { 0xb2, 0xb2, 0xb2 };
|
invertedPalette.inactiveText = { 0xb2, 0xb2, 0xb2 };
|
||||||
darkTheme.highlightedText = { 0xfd, 0x98, 0x00 };
|
invertedPalette.highlightedText = { 0xfd, 0x98, 0x00 };
|
||||||
darkTheme.titleBoxText = { 0x00, 0x00, 0x00 };
|
invertedPalette.titleBoxText = { 0x00, 0x00, 0x00 };
|
||||||
darkTheme.titleBoxBackground = { 0xba, 0xbd, 0xb6 };
|
invertedPalette.titleBoxBackground = { 0xba, 0xbd, 0xb6 };
|
||||||
darkTheme.icon = { 0xb2, 0xb2, 0xb2 };
|
invertedPalette.icon = { 0xb2, 0xb2, 0xb2 };
|
||||||
darkTheme.iconHighlight = { 0xfd, 0x98, 0x00 };
|
invertedPalette.iconHighlight = { 0xfd, 0x98, 0x00 };
|
||||||
darkTheme.valueText = { 0x00, 0x00, 0x00 };
|
invertedPalette.valueText = { 0x00, 0x00, 0x00 };
|
||||||
darkTheme.valueBackground = { 0x9a, 0x9a, 0x9a };
|
invertedPalette.valueBackground = { 0x9a, 0x9a, 0x9a };
|
||||||
darkTheme.knobActiveTrackColor = { 0x00, 0xb6, 0x2a };
|
invertedPalette.knobActiveTrackColor = { 0x00, 0xb6, 0x2a };
|
||||||
darkTheme.knobInactiveTrackColor = { 0x60, 0x60, 0x60 };
|
invertedPalette.knobInactiveTrackColor = { 0x60, 0x60, 0x60 };
|
||||||
darkTheme.knobLineIndicatorColor = { 0xff, 0xff, 0xff };
|
invertedPalette.knobLineIndicatorColor = { 0xff, 0xff, 0xff };
|
||||||
Theme& defaultTheme = lightTheme;
|
Palette& defaultPalette = normalPalette;
|
||||||
|
|
||||||
Theme* theme = &defaultTheme;
|
Palette* palette = &defaultPalette;
|
||||||
auto enterTheme = [&theme](Theme& t) { theme = &t; };
|
auto enterPalette = [&palette](Palette& p) { palette = &p; };
|
||||||
|
|
||||||
auto createLogicalGroup = [](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
|
auto createLogicalGroup = [](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
|
||||||
CViewContainer* container = new CViewContainer(bounds);
|
CViewContainer* container = new CViewContainer(bounds);
|
||||||
container->setBackgroundColor(CColor(0x00, 0x00, 0x00, 0x00));
|
container->setBackgroundColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
return container;
|
return container;
|
||||||
};
|
};
|
||||||
auto createRoundedGroup = [&theme](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
|
auto createRoundedGroup = [&palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
|
||||||
auto* box = new SBoxContainer(bounds);
|
auto* box = new SBoxContainer(bounds);
|
||||||
box->setCornerRadius(10.0);
|
box->setCornerRadius(10.0);
|
||||||
box->setBackgroundColor(theme->boxBackground);
|
box->setBackgroundColor(palette->boxBackground);
|
||||||
return box;
|
return box;
|
||||||
};
|
};
|
||||||
auto createTitleGroup = [&theme](const CRect& bounds, int, const char* label, CHoriTxtAlign, int fontsize) {
|
auto createTitleGroup = [&palette](const CRect& bounds, int, const char* label, CHoriTxtAlign, int fontsize) {
|
||||||
auto* box = new STitleContainer(bounds, label);
|
auto* box = new STitleContainer(bounds, label);
|
||||||
box->setCornerRadius(10.0);
|
box->setCornerRadius(10.0);
|
||||||
box->setBackgroundColor(theme->boxBackground);
|
box->setBackgroundColor(palette->boxBackground);
|
||||||
box->setTitleFontColor(theme->titleBoxText);
|
box->setTitleFontColor(palette->titleBoxText);
|
||||||
box->setTitleBackgroundColor(theme->titleBoxBackground);
|
box->setTitleBackgroundColor(palette->titleBoxBackground);
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
||||||
box->setTitleFont(font);
|
box->setTitleFont(font);
|
||||||
return box;
|
return box;
|
||||||
|
|
@ -639,21 +639,21 @@ void Editor::Impl::createFrameContents()
|
||||||
auto createAboutButton = [this, &iconShaded](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
|
auto createAboutButton = [this, &iconShaded](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
|
||||||
return new CKickButton(bounds, this, tag, iconShaded);
|
return new CKickButton(bounds, this, tag, iconShaded);
|
||||||
};
|
};
|
||||||
auto createLabel = [&theme](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
auto createLabel = [&palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
||||||
CTextLabel* lbl = new CTextLabel(bounds, label);
|
CTextLabel* lbl = new CTextLabel(bounds, label);
|
||||||
lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
lbl->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
lbl->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
lbl->setFontColor(theme->text);
|
lbl->setFontColor(palette->text);
|
||||||
lbl->setHoriAlign(align);
|
lbl->setHoriAlign(align);
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
||||||
lbl->setFont(font);
|
lbl->setFont(font);
|
||||||
return lbl;
|
return lbl;
|
||||||
};
|
};
|
||||||
auto createInactiveLabel = [&theme](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
auto createInactiveLabel = [&palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
||||||
CTextLabel* lbl = new CTextLabel(bounds, label);
|
CTextLabel* lbl = new CTextLabel(bounds, label);
|
||||||
lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
lbl->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
lbl->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
lbl->setFontColor(theme->inactiveText);
|
lbl->setFontColor(palette->inactiveText);
|
||||||
lbl->setHoriAlign(align);
|
lbl->setHoriAlign(align);
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
||||||
lbl->setFont(font);
|
lbl->setFont(font);
|
||||||
|
|
@ -669,28 +669,28 @@ void Editor::Impl::createFrameContents()
|
||||||
auto createKnob48 = [this, &knob48](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
|
auto createKnob48 = [this, &knob48](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
|
||||||
return new CAnimKnob(bounds, this, tag, 31, 48, knob48);
|
return new CAnimKnob(bounds, this, tag, 31, 48, knob48);
|
||||||
};
|
};
|
||||||
auto createStyledKnob = [this, &theme](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
|
auto createStyledKnob = [this, &palette](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
|
||||||
SStyledKnob* knob = new SStyledKnob(bounds, this, tag);
|
SStyledKnob* knob = new SStyledKnob(bounds, this, tag);
|
||||||
knob->setActiveTrackColor(theme->knobActiveTrackColor);
|
knob->setActiveTrackColor(palette->knobActiveTrackColor);
|
||||||
knob->setInactiveTrackColor(theme->knobInactiveTrackColor);
|
knob->setInactiveTrackColor(palette->knobInactiveTrackColor);
|
||||||
knob->setLineIndicatorColor(theme->knobLineIndicatorColor);
|
knob->setLineIndicatorColor(palette->knobLineIndicatorColor);
|
||||||
return knob;
|
return knob;
|
||||||
};
|
};
|
||||||
auto createValueLabel = [&theme](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
auto createValueLabel = [&palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
||||||
CTextLabel* lbl = new CTextLabel(bounds, label);
|
CTextLabel* lbl = new CTextLabel(bounds, label);
|
||||||
lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
lbl->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
lbl->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
lbl->setFontColor(theme->text);
|
lbl->setFontColor(palette->text);
|
||||||
lbl->setHoriAlign(align);
|
lbl->setHoriAlign(align);
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
||||||
lbl->setFont(font);
|
lbl->setFont(font);
|
||||||
return lbl;
|
return lbl;
|
||||||
};
|
};
|
||||||
auto createBadge = [&theme](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
auto createBadge = [&palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
||||||
CTextLabel* lbl = new CTextLabel(bounds, label);
|
CTextLabel* lbl = new CTextLabel(bounds, label);
|
||||||
lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
lbl->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
lbl->setBackColor(theme->valueBackground);
|
lbl->setBackColor(palette->valueBackground);
|
||||||
lbl->setFontColor(theme->valueText);
|
lbl->setFontColor(palette->valueText);
|
||||||
lbl->setHoriAlign(align);
|
lbl->setHoriAlign(align);
|
||||||
lbl->setStyle(CParamDisplay::kRoundRectStyle);
|
lbl->setStyle(CParamDisplay::kRoundRectStyle);
|
||||||
lbl->setRoundRectRadius(5.0);
|
lbl->setRoundRectRadius(5.0);
|
||||||
|
|
@ -713,14 +713,14 @@ void Editor::Impl::createFrameContents()
|
||||||
return button;
|
return button;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
auto createClickableLabel = [this, &theme](const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) {
|
auto createClickableLabel = [this, &palette](const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) {
|
||||||
STextButton* button = new STextButton(bounds, this, tag, label);
|
STextButton* button = new STextButton(bounds, this, tag, label);
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
||||||
button->setFont(font);
|
button->setFont(font);
|
||||||
button->setTextAlignment(align);
|
button->setTextAlignment(align);
|
||||||
button->setTextColor(theme->text);
|
button->setTextColor(palette->text);
|
||||||
button->setInactiveColor(theme->inactiveText);
|
button->setInactiveColor(palette->inactiveText);
|
||||||
button->setHoverColor(theme->highlightedText);
|
button->setHoverColor(palette->highlightedText);
|
||||||
button->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
button->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
button->setFrameColorHighlighted(CColor(0x00, 0x00, 0x00, 0x00));
|
button->setFrameColorHighlighted(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
SharedPointer<CGradient> gradient = owned(CGradient::create(0.0, 1.0, CColor(0x00, 0x00, 0x00, 0x00), CColor(0x00, 0x00, 0x00, 0x00)));
|
SharedPointer<CGradient> gradient = owned(CGradient::create(0.0, 1.0, CColor(0x00, 0x00, 0x00, 0x00), CColor(0x00, 0x00, 0x00, 0x00)));
|
||||||
|
|
@ -728,38 +728,38 @@ void Editor::Impl::createFrameContents()
|
||||||
button->setGradientHighlighted(gradient);
|
button->setGradientHighlighted(gradient);
|
||||||
return button;
|
return button;
|
||||||
};
|
};
|
||||||
auto createValueButton = [this, &theme](const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) {
|
auto createValueButton = [this, &palette](const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) {
|
||||||
STextButton* button = new STextButton(bounds, this, tag, label);
|
STextButton* button = new STextButton(bounds, this, tag, label);
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
||||||
button->setFont(font);
|
button->setFont(font);
|
||||||
button->setTextAlignment(align);
|
button->setTextAlignment(align);
|
||||||
button->setTextColor(theme->valueText);
|
button->setTextColor(palette->valueText);
|
||||||
button->setInactiveColor(theme->inactiveText);
|
button->setInactiveColor(palette->inactiveText);
|
||||||
button->setHoverColor(theme->highlightedText);
|
button->setHoverColor(palette->highlightedText);
|
||||||
button->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
button->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
button->setFrameColorHighlighted(CColor(0x00, 0x00, 0x00, 0x00));
|
button->setFrameColorHighlighted(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
SharedPointer<CGradient> gradient = owned(CGradient::create(0.0, 1.0, theme->valueBackground, theme->valueBackground));
|
SharedPointer<CGradient> gradient = owned(CGradient::create(0.0, 1.0, palette->valueBackground, palette->valueBackground));
|
||||||
button->setGradient(gradient);
|
button->setGradient(gradient);
|
||||||
button->setGradientHighlighted(gradient);
|
button->setGradientHighlighted(gradient);
|
||||||
return button;
|
return button;
|
||||||
};
|
};
|
||||||
auto createValueMenu = [this, &theme](const CRect& bounds, int tag, const char*, CHoriTxtAlign align, int fontsize) {
|
auto createValueMenu = [this, &palette](const CRect& bounds, int tag, const char*, CHoriTxtAlign align, int fontsize) {
|
||||||
SValueMenu* vm = new SValueMenu(bounds, this, tag);
|
SValueMenu* vm = new SValueMenu(bounds, this, tag);
|
||||||
vm->setHoriAlign(align);
|
vm->setHoriAlign(align);
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
||||||
vm->setFont(font);
|
vm->setFont(font);
|
||||||
vm->setFontColor(theme->valueText);
|
vm->setFontColor(palette->valueText);
|
||||||
vm->setBackColor(theme->valueBackground);
|
vm->setBackColor(palette->valueBackground);
|
||||||
vm->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
vm->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
vm->setStyle(CParamDisplay::kRoundRectStyle);
|
vm->setStyle(CParamDisplay::kRoundRectStyle);
|
||||||
vm->setRoundRectRadius(5.0);
|
vm->setRoundRectRadius(5.0);
|
||||||
return vm;
|
return vm;
|
||||||
};
|
};
|
||||||
auto createGlyphButton = [this, &theme](UTF8StringPtr glyph, const CRect& bounds, int tag, int fontsize) {
|
auto createGlyphButton = [this, &palette](UTF8StringPtr glyph, const CRect& bounds, int tag, int fontsize) {
|
||||||
STextButton* btn = new STextButton(bounds, this, tag, glyph);
|
STextButton* btn = new STextButton(bounds, this, tag, glyph);
|
||||||
btn->setFont(makeOwned<CFontDesc>("Sfizz Fluent System F20", fontsize));
|
btn->setFont(makeOwned<CFontDesc>("Sfizz Fluent System F20", fontsize));
|
||||||
btn->setTextColor(theme->icon);
|
btn->setTextColor(palette->icon);
|
||||||
btn->setHoverColor(theme->iconHighlight);
|
btn->setHoverColor(palette->iconHighlight);
|
||||||
btn->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
btn->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
btn->setFrameColorHighlighted(CColor(0x00, 0x00, 0x00, 0x00));
|
btn->setFrameColorHighlighted(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
btn->setGradient(nullptr);
|
btn->setGradient(nullptr);
|
||||||
|
|
@ -801,38 +801,38 @@ void Editor::Impl::createFrameContents()
|
||||||
piano->setFont(font);
|
piano->setFont(font);
|
||||||
return piano;
|
return piano;
|
||||||
};
|
};
|
||||||
auto createChevronDropDown = [this, &theme](const CRect& bounds, int, const char*, CHoriTxtAlign, int fontsize) {
|
auto createChevronDropDown = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int fontsize) {
|
||||||
SActionMenu* menu = new SActionMenu(bounds, this);
|
SActionMenu* menu = new SActionMenu(bounds, this);
|
||||||
menu->setTitle(u8"\ue0d7");
|
menu->setTitle(u8"\ue0d7");
|
||||||
menu->setFont(makeOwned<CFontDesc>("Sfizz Fluent System F20", fontsize));
|
menu->setFont(makeOwned<CFontDesc>("Sfizz Fluent System F20", fontsize));
|
||||||
menu->setFontColor(theme->icon);
|
menu->setFontColor(palette->icon);
|
||||||
menu->setHoverColor(theme->iconHighlight);
|
menu->setHoverColor(palette->iconHighlight);
|
||||||
menu->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
menu->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
menu->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
menu->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
return menu;
|
return menu;
|
||||||
};
|
};
|
||||||
auto createChevronValueDropDown = [this, &theme](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
|
auto createChevronValueDropDown = [this, &palette](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
|
||||||
SValueMenu* menu = new SValueMenu(bounds, this, tag);
|
SValueMenu* menu = new SValueMenu(bounds, this, tag);
|
||||||
menu->setValueToStringFunction2([](float, std::string& result, CParamDisplay*) -> bool {
|
menu->setValueToStringFunction2([](float, std::string& result, CParamDisplay*) -> bool {
|
||||||
result = u8"\ue0d7";
|
result = u8"\ue0d7";
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
menu->setFont(makeOwned<CFontDesc>("Sfizz Fluent System F20", fontsize));
|
menu->setFont(makeOwned<CFontDesc>("Sfizz Fluent System F20", fontsize));
|
||||||
menu->setFontColor(theme->icon);
|
menu->setFontColor(palette->icon);
|
||||||
menu->setHoverColor(theme->iconHighlight);
|
menu->setHoverColor(palette->iconHighlight);
|
||||||
menu->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
menu->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
menu->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
menu->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
return menu;
|
return menu;
|
||||||
};
|
};
|
||||||
auto createKnobCCBox = [this, &theme](const CRect& bounds, int tag, const char* label, CHoriTxtAlign, int fontsize) {
|
auto createKnobCCBox = [this, &palette](const CRect& bounds, int tag, const char* label, CHoriTxtAlign, int fontsize) {
|
||||||
SKnobCCBox* box = new SKnobCCBox(bounds, this, tag);
|
SKnobCCBox* box = new SKnobCCBox(bounds, this, tag);
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
||||||
box->setNameLabelText(label);
|
box->setNameLabelText(label);
|
||||||
box->setNameLabelFont(font);
|
box->setNameLabelFont(font);
|
||||||
box->setNameLabelFontColor(theme->text);
|
box->setNameLabelFontColor(palette->text);
|
||||||
box->setKnobFont(font);
|
box->setKnobFont(font);
|
||||||
box->setKnobFontColor(theme->text);
|
box->setKnobFontColor(palette->text);
|
||||||
box->setKnobLineIndicatorColor(theme->knobLineIndicatorColor);
|
box->setKnobLineIndicatorColor(palette->knobLineIndicatorColor);
|
||||||
box->setValueToStringFunction([](float value, std::string& text) -> bool {
|
box->setValueToStringFunction([](float value, std::string& text) -> bool {
|
||||||
text = std::to_string(std::lround(value * 127));
|
text = std::to_string(std::lround(value * 127));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ mainView = view__0;
|
||||||
auto* const view__1 = createBackground(CRect(190, 110, 790, 390), -1, "", kCenterText, 14);
|
auto* const view__1 = createBackground(CRect(190, 110, 790, 390), -1, "", kCenterText, 14);
|
||||||
imageContainer_ = view__1;
|
imageContainer_ = view__1;
|
||||||
view__0->addView(view__1);
|
view__0->addView(view__1);
|
||||||
enterTheme(darkTheme);
|
enterPalette(invertedPalette);
|
||||||
auto* const view__2 = createLogicalGroup(CRect(0, 0, 800, 110), -1, "", kCenterText, 14);
|
auto* const view__2 = createLogicalGroup(CRect(0, 0, 800, 110), -1, "", kCenterText, 14);
|
||||||
view__0->addView(view__2);
|
view__0->addView(view__2);
|
||||||
auto* const view__3 = createRoundedGroup(CRect(5, 4, 180, 105), -1, "", kCenterText, 14);
|
auto* const view__3 = createRoundedGroup(CRect(5, 4, 180, 105), -1, "", kCenterText, 14);
|
||||||
|
|
@ -77,7 +77,7 @@ view__25->addView(view__29);
|
||||||
auto* const view__30 = createKnobCCBox(CRect(85, 5, 155, 95), kTagSetCCPan, "Pan", kCenterText, 12);
|
auto* const view__30 = createKnobCCBox(CRect(85, 5, 155, 95), kTagSetCCPan, "Pan", kCenterText, 12);
|
||||||
panCCKnob_ = view__30;
|
panCCKnob_ = view__30;
|
||||||
view__25->addView(view__30);
|
view__25->addView(view__30);
|
||||||
enterTheme(defaultTheme);
|
enterPalette(defaultPalette);
|
||||||
auto* const view__31 = createLogicalGroup(CRect(5, 110, 796, 395), -1, "", kCenterText, 14);
|
auto* const view__31 = createLogicalGroup(CRect(5, 110, 796, 395), -1, "", kCenterText, 14);
|
||||||
subPanels_[kPanelGeneral] = view__31;
|
subPanels_[kPanelGeneral] = view__31;
|
||||||
view__0->addView(view__31);
|
view__0->addView(view__31);
|
||||||
|
|
|
||||||
|
|
@ -99,22 +99,22 @@ static std::string cstrQuote(absl::string_view text)
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
static void codegen_item(int& idCounter, int parentId, int parentX, int parentY, const LayoutItem& item, absl::string_view oldTheme)
|
static void codegen_item(int& idCounter, int parentId, int parentX, int parentY, const LayoutItem& item, absl::string_view oldPalette)
|
||||||
{
|
{
|
||||||
const Metadata md = metadata_from_comment(item.comment);
|
const Metadata md = metadata_from_comment(item.comment);
|
||||||
|
|
||||||
absl::string_view tag = "-1";
|
absl::string_view tag = "-1";
|
||||||
absl::string_view newTheme;
|
absl::string_view newPalette;
|
||||||
|
|
||||||
Metadata::const_iterator it;
|
Metadata::const_iterator it;
|
||||||
it = md.find("tag");
|
it = md.find("tag");
|
||||||
if (it != md.end())
|
if (it != md.end())
|
||||||
tag = it->second;
|
tag = it->second;
|
||||||
it = md.find("theme");
|
it = md.find("palette");
|
||||||
if (it != md.end())
|
if (it != md.end())
|
||||||
newTheme = it->second;
|
newPalette = it->second;
|
||||||
|
|
||||||
absl::string_view currentTheme = newTheme.empty() ? oldTheme : newTheme;
|
absl::string_view currentPalette = newPalette.empty() ? oldPalette : newPalette;
|
||||||
|
|
||||||
int id = idCounter++;
|
int id = idCounter++;
|
||||||
int myX = item.x;
|
int myX = item.x;
|
||||||
|
|
@ -128,8 +128,8 @@ static void codegen_item(int& idCounter, int parentId, int parentX, int parentY,
|
||||||
|
|
||||||
//std::cout << "// Begin " << id << " " << item.classname << " {" << item.label << "}" << "\n";
|
//std::cout << "// Begin " << id << " " << item.classname << " {" << item.label << "}" << "\n";
|
||||||
|
|
||||||
if (!newTheme.empty())
|
if (!newPalette.empty())
|
||||||
std::cout << "enterTheme(" << newTheme << ");\n";
|
std::cout << "enterPalette(" << newPalette << ");\n";
|
||||||
|
|
||||||
absl::string_view label;
|
absl::string_view label;
|
||||||
if (!item.label.empty() && item.labeltype != "NO_LABEL")
|
if (!item.label.empty() && item.labeltype != "NO_LABEL")
|
||||||
|
|
@ -153,10 +153,10 @@ static void codegen_item(int& idCounter, int parentId, int parentX, int parentY,
|
||||||
std::cout << "view__" << id << "->setVisible(false);\n";
|
std::cout << "view__" << id << "->setVisible(false);\n";
|
||||||
|
|
||||||
for (const LayoutItem& subItem : item.items)
|
for (const LayoutItem& subItem : item.items)
|
||||||
codegen_item(idCounter, id, myX, myY, subItem, currentTheme);
|
codegen_item(idCounter, id, myX, myY, subItem, currentPalette);
|
||||||
|
|
||||||
if (!newTheme.empty())
|
if (!newPalette.empty())
|
||||||
std::cout << "enterTheme(" << oldTheme << ");\n";
|
std::cout << "enterPalette(" << oldPalette << ");\n";
|
||||||
|
|
||||||
//std::cout << "// End " << id << " " << item.classname << " {" << item.label << "}" << "\n";
|
//std::cout << "// End " << id << " " << item.classname << " {" << item.label << "}" << "\n";
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +164,7 @@ static void codegen_item(int& idCounter, int parentId, int parentX, int parentY,
|
||||||
static void codegen_layout(const LayoutItem& item)
|
static void codegen_layout(const LayoutItem& item)
|
||||||
{
|
{
|
||||||
int idCounter = 0;
|
int idCounter = 0;
|
||||||
codegen_item(idCounter, -1, 0, 0, item, "defaultTheme");
|
codegen_item(idCounter, -1, 0, 0, item, "defaultPalette");
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue