launcher: add editable option for resolution dropdowns

This commit is contained in:
somewhatlurker
2019-08-30 00:16:35 +10:00
parent fb7e51f38d
commit ef49abfc65
5 changed files with 17 additions and 6 deletions
@@ -131,6 +131,7 @@ namespace PluginConfig
LPCWSTR description;
resolution defaultVal;
std::vector<resolution> valueResolutions;
bool editable;
};
struct PluginConfigGroupData
@@ -834,8 +834,9 @@ public:
LPCWSTR _iniVarName2;
resolution _defaultVal;
std::vector<resolution> _valueResolutions;
bool _editable;
ResolutionOption(LPCWSTR iniVarName, LPCWSTR iniVarName2, LPCWSTR iniSectionName, LPCWSTR iniFilePath, LPCWSTR friendlyName, LPCWSTR description, resolution defaultVal, std::vector<resolution> valueResolutions)
ResolutionOption(LPCWSTR iniVarName, LPCWSTR iniVarName2, LPCWSTR iniSectionName, LPCWSTR iniFilePath, LPCWSTR friendlyName, LPCWSTR description, resolution defaultVal, std::vector<resolution> valueResolutions, bool editable)
{
_iniVarName = iniVarName;
_iniVarName2 = iniVarName2;
@@ -845,6 +846,7 @@ public:
_description = description;
_defaultVal = defaultVal;
_valueResolutions = valueResolutions;
_editable = editable;
}
virtual int AddToPanel(Panel^ panel, unsigned int left, unsigned int top, ToolTip^ tooltip)
@@ -882,7 +884,11 @@ public:
combobox->Width = Col2Width;
combobox->AutoSize = true;
combobox->FlatStyle = System::Windows::Forms::FlatStyle::Flat;
combobox->DropDownStyle = ComboBoxStyle::DropDown;
if (_editable)
combobox->DropDownStyle = ComboBoxStyle::DropDown;
else
combobox->DropDownStyle = ComboBoxStyle::DropDownList;
Form^ RootForm = panel->FindForm();
float ScaleWidth = 1.0f;
@@ -902,7 +908,10 @@ public:
if (hasChanged == nullptr)
hasChanged = new bool(false);
ChangeHandler^ changehandler = gcnew ChangeHandler(hasChanged);
combobox->TextChanged += gcnew System::EventHandler(changehandler, &ChangeHandler::SetChanged);
if (_editable)
combobox->TextChanged += gcnew System::EventHandler(changehandler, &ChangeHandler::SetChanged);
else
combobox->SelectedIndexChanged += gcnew System::EventHandler(changehandler, &ChangeHandler::SetChanged);
ComboboxValidation^ validation = gcnew ComboboxValidation(combobox);
combobox->Leave += gcnew System::EventHandler(validation, &ComboboxValidation::CheckResolutionLeave);
@@ -30,7 +30,7 @@ namespace PluginConfig
case CONFIG_DROPDOWN_NUMBER:
return new DropdownNumberOption(ddNumberData->iniVarName, ddNumberData->iniSectionName, ddNumberData->iniFilePath, ddNumberData->friendlyName, ddNumberData->description, ddNumberData->defaultVal, ddNumberData->valueInts, ddNumberData->editable);
case CONFIG_RESOLUTION:
return new ResolutionOption(resData->iniVarName, resData->iniVarName2, resData->iniSectionName, resData->iniFilePath, resData->friendlyName, resData->description, resData->defaultVal, resData->valueResolutions);
return new ResolutionOption(resData->iniVarName, resData->iniVarName2, resData->iniSectionName, resData->iniFilePath, resData->friendlyName, resData->description, resData->defaultVal, resData->valueResolutions, resData->editable);
case CONFIG_GROUP_START:
return new OptionMetaGroupStart(groupData->name, groupData->height);
case CONFIG_GROUP_END:
@@ -131,6 +131,7 @@ namespace PluginConfig
LPCWSTR description;
resolution defaultVal;
std::vector<resolution> valueResolutions;
bool editable;
};
struct PluginConfigGroupData
@@ -127,7 +127,7 @@ std::vector<DEVMODEW> screenModes = getScreenModes();
DropdownOption* DisplayModeDropdown = new DropdownOption(L"display", RESOLUTION_SECTION, CONFIG_FILE, L"Display:", L"Sets the window/screen mode.", 0, std::vector<LPCWSTR>({ L"Windowed", L"Borderless", L"Fullscreen" }));
ResolutionOption* DisplayResolutionOption = new ResolutionOption(L"width", L"height", RESOLUTION_SECTION, CONFIG_FILE, L"Resolution:", L"Sets the display resolution.", resolution(1280, 720), getScreenResolutionsVec(screenModes));
ResolutionOption* DisplayResolutionOption = new ResolutionOption(L"width", L"height", RESOLUTION_SECTION, CONFIG_FILE, L"Resolution:", L"Sets the display resolution.", resolution(1280, 720), getScreenResolutionsVec(screenModes), true);
ConfigOptionBase* screenResolutionArray[] = {
DisplayModeDropdown,
@@ -137,7 +137,7 @@ ConfigOptionBase* screenResolutionArray[] = {
};
BooleanOption* InternalResolutionCheckbox = new BooleanOption(L"r.enable", RESOLUTION_SECTION, CONFIG_FILE, L"Enable", L"Enable or disable custom internal resolution.", false, false);
ResolutionOption* InternalResolutionOption = new ResolutionOption(L"r.width", L"r.height", RESOLUTION_SECTION, CONFIG_FILE, L"Resolution:", L"Sets the internal resolution.", resolution(1280, 720), std::vector<resolution>({ resolution(640,480), resolution(800,600), resolution(960,720), resolution(1280,720), resolution(1600,900), resolution(1920,1080), resolution(2560,1440), resolution(3200,1800), resolution(3840,2160), resolution(5120,2880), resolution(6400,3600), resolution(7680,4320) }));
ResolutionOption* InternalResolutionOption = new ResolutionOption(L"r.width", L"r.height", RESOLUTION_SECTION, CONFIG_FILE, L"Resolution:", L"Sets the internal resolution.", resolution(1280, 720), std::vector<resolution>({ resolution(640,480), resolution(800,600), resolution(960,720), resolution(1280,720), resolution(1600,900), resolution(1920,1080), resolution(2560,1440), resolution(3200,1800), resolution(3840,2160), resolution(5120,2880), resolution(6400,3600), resolution(7680,4320) }), true);
ConfigOptionBase* internalResolutionArray[] = {
InternalResolutionCheckbox,