feat(color): add FILE type for widget options (#5605)
This commit is contained in:
@@ -29,7 +29,7 @@ public:
|
||||
std::function<std::string()> getValue,
|
||||
std::function<void(std::string)> setValue,
|
||||
bool stripExtension = false,
|
||||
const char* title = nullptr);
|
||||
const char* title = "");
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override { return "FileChoice"; }
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "sourcechoice.h"
|
||||
#include "switchchoice.h"
|
||||
#include "view_main.h"
|
||||
#include "filechoice.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
@@ -191,6 +192,20 @@ WidgetSettings::WidgetSettings(Widget* w) :
|
||||
SET_DIRTY();
|
||||
});
|
||||
break;
|
||||
|
||||
case ZoneOption::File:
|
||||
new FileChoice(line, rect_t{}, opt->fileSelectPath, nullptr, LEN_ZONE_OPTION_STRING,
|
||||
[=]() {
|
||||
char s[LEN_ZONE_OPTION_STRING + 1];
|
||||
strncpy(s, optVal->stringValue, LEN_ZONE_OPTION_STRING);
|
||||
s[LEN_ZONE_OPTION_STRING] = 0;
|
||||
return std::string(s);
|
||||
},
|
||||
[=](std::string s) {
|
||||
strncpy(optVal->stringValue, s.c_str(), LEN_ZONE_OPTION_STRING);
|
||||
SET_DIRTY();
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
optIdx++;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "storage/yaml/yaml_defs.h"
|
||||
#include <vector>
|
||||
|
||||
#define LEN_ZONE_OPTION_STRING 8
|
||||
#define LEN_ZONE_OPTION_STRING 12
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define OPTION_VALUE_UNSIGNED(x) { uint32_t(x) }
|
||||
@@ -74,6 +74,7 @@ struct ZoneOption
|
||||
Align,
|
||||
Slider,
|
||||
Choice,
|
||||
File,
|
||||
};
|
||||
|
||||
const char * name;
|
||||
@@ -82,6 +83,7 @@ struct ZoneOption
|
||||
ZoneOptionValue min;
|
||||
ZoneOptionValue max;
|
||||
const char * displayName;
|
||||
std::string fileSelectPath;
|
||||
std::vector<std::string> choiceValues;
|
||||
};
|
||||
|
||||
@@ -105,6 +107,7 @@ inline ZoneOptionValueEnum zoneValueEnumFromType(ZoneOption::Type type)
|
||||
{
|
||||
switch(type) {
|
||||
case ZoneOption::String:
|
||||
case ZoneOption::File:
|
||||
return ZOV_String;
|
||||
|
||||
case ZoneOption::Integer:
|
||||
|
||||
Reference in New Issue
Block a user