Make Horus widgets 'shadow' effect an option (#5203)
* Add shadows to c++ widgets * Add BOOL zone option to Horus LUA * LUA widgets too
This commit is contained in:
@@ -39,6 +39,7 @@ const ZoneOption TextWidget::options[] = {
|
||||
{ "Text", ZoneOption::String, OPTION_VALUE_STRING(TEXT_WIDGET_DEFAULT_LABEL) },
|
||||
{ "Color", ZoneOption::Color, OPTION_VALUE_UNSIGNED(RED) },
|
||||
{ "Size", ZoneOption::TextSize, OPTION_VALUE_UNSIGNED(0) },
|
||||
{ "Shadow", ZoneOption::Bool, OPTION_VALUE_BOOL(false) },
|
||||
{ NULL, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
@@ -46,6 +47,9 @@ void TextWidget::refresh()
|
||||
{
|
||||
lcdSetColor(persistentData->options[1].unsignedValue);
|
||||
LcdFlags fontsize = FONTSIZE(persistentData->options[2].unsignedValue << 8);
|
||||
if(persistentData->options[3].boolValue) {
|
||||
lcdDrawSizedText(zone.x+1, zone.y+1, persistentData->options[0].stringValue, sizeof(persistentData->options[0].stringValue), ZCHAR|fontsize|BLACK);
|
||||
}
|
||||
lcdDrawSizedText(zone.x, zone.y, persistentData->options[0].stringValue, sizeof(persistentData->options[0].stringValue), ZCHAR|fontsize|CUSTOM_COLOR);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ class ValueWidget: public Widget
|
||||
const ZoneOption ValueWidget::options[] = {
|
||||
{ "Source", ZoneOption::Source, OPTION_VALUE_UNSIGNED(MIXSRC_Rud) },
|
||||
{ "Color", ZoneOption::Color, OPTION_VALUE_UNSIGNED(WHITE) },
|
||||
{ "Shadow", ZoneOption::Bool, OPTION_VALUE_BOOL(false) },
|
||||
{ NULL, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
@@ -45,12 +46,12 @@ void ValueWidget::refresh()
|
||||
|
||||
mixsrc_t field = persistentData->options[0].unsignedValue;
|
||||
lcdSetColor(persistentData->options[1].unsignedValue);
|
||||
|
||||
|
||||
int x = zone.x;
|
||||
int y = zone.y;
|
||||
|
||||
|
||||
// TRACE("w=%d, h=%d", zone.w, zone.h);
|
||||
|
||||
|
||||
// lcdDrawFilledRect(zone.x, zone.y, zone.w, zone.h, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5));
|
||||
|
||||
int xValue, yValue, xLabel, yLabel;
|
||||
@@ -111,11 +112,13 @@ void ValueWidget::refresh()
|
||||
}
|
||||
}
|
||||
|
||||
drawSource(xLabel + 1, yLabel + 1, field, attrLabel|BLACK);
|
||||
if(persistentData->options[2].boolValue) {
|
||||
drawSource(xLabel + 1, yLabel + 1, field, attrLabel|BLACK);
|
||||
drawSourceValue(xValue + 1, yValue + 1, field, attrValue|BLACK);
|
||||
}
|
||||
drawSource(xLabel, yLabel, field, attrLabel|CUSTOM_COLOR);
|
||||
drawSourceValue(xValue + 1, yValue + 1, field, attrValue|BLACK);
|
||||
drawSourceValue(xValue, yValue, field, attrValue|CUSTOM_COLOR);
|
||||
|
||||
|
||||
}
|
||||
|
||||
BaseWidgetFactory<ValueWidget> ValueWidget("Value", ValueWidget::options);
|
||||
|
||||
@@ -1240,6 +1240,7 @@ const luaR_value_entry opentxConstants[] = {
|
||||
#if defined(COLORLCD)
|
||||
{ "SHADOWED", SHADOWED },
|
||||
{ "COLOR", ZoneOption::Color },
|
||||
{ "BOOL", ZoneOption::Bool },
|
||||
{ "CUSTOM_COLOR", CUSTOM_COLOR },
|
||||
{ "TEXT_COLOR", TEXT_COLOR },
|
||||
{ "TEXT_BGCOLOR", TEXT_BGCOLOR },
|
||||
|
||||
Reference in New Issue
Block a user