launcher: fix default values of some options,
restore "are you sure" save message when an option has been changed, remove "are you sure" save message on apply button
This commit is contained in:
@@ -178,6 +178,22 @@ public:
|
||||
|
||||
};
|
||||
|
||||
static ref class ChangeHandler
|
||||
{
|
||||
public:
|
||||
bool* changebool;
|
||||
|
||||
ChangeHandler(bool* onchangebool)
|
||||
{
|
||||
changebool = onchangebool;
|
||||
}
|
||||
|
||||
System::Void SetChanged(System::Object^ sender, System::EventArgs^ e)
|
||||
{
|
||||
*changebool = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ConfigOptionBase
|
||||
{
|
||||
@@ -188,8 +204,9 @@ public:
|
||||
|
||||
LPCWSTR _friendlyName;
|
||||
LPCWSTR _description;
|
||||
|
||||
|
||||
System::IntPtr mainControlHandle;
|
||||
bool* hasChanged;
|
||||
|
||||
virtual int AddToPanel(Panel^ panel, unsigned int left, unsigned int top, ToolTip^ tooltip)
|
||||
{
|
||||
@@ -242,6 +259,11 @@ public:
|
||||
|
||||
tooltip->SetToolTip(cb, gcnew String(_description));
|
||||
|
||||
if (hasChanged == nullptr)
|
||||
hasChanged = new bool;
|
||||
ChangeHandler^ changehandler = gcnew ChangeHandler(hasChanged);
|
||||
cb->CheckedChanged += gcnew System::EventHandler(changehandler, &ChangeHandler::SetChanged);
|
||||
|
||||
panel->Controls->Add(cb);
|
||||
mainControlHandle = cb->Handle;
|
||||
|
||||
@@ -312,6 +334,11 @@ public:
|
||||
tooltip->SetToolTip(label, gcnew String(_description));
|
||||
tooltip->SetToolTip(numberbox, gcnew String(_description));
|
||||
|
||||
if (hasChanged == nullptr)
|
||||
hasChanged = new bool;
|
||||
ChangeHandler^ changehandler = gcnew ChangeHandler(hasChanged);
|
||||
numberbox->ValueChanged += gcnew System::EventHandler(changehandler, &ChangeHandler::SetChanged);
|
||||
|
||||
panel->Controls->Add(label);
|
||||
panel->Controls->Add(numberbox);
|
||||
mainControlHandle = numberbox->Handle;
|
||||
@@ -391,6 +418,11 @@ public:
|
||||
tooltip->SetToolTip(label, gcnew String(_description));
|
||||
tooltip->SetToolTip(textbox, gcnew String(_description));
|
||||
|
||||
if (hasChanged == nullptr)
|
||||
hasChanged = new bool;
|
||||
ChangeHandler^ changehandler = gcnew ChangeHandler(hasChanged);
|
||||
textbox->TextChanged += gcnew System::EventHandler(changehandler, &ChangeHandler::SetChanged);
|
||||
|
||||
panel->Controls->Add(label);
|
||||
panel->Controls->Add(textbox);
|
||||
mainControlHandle = textbox->Handle;
|
||||
@@ -475,6 +507,11 @@ public:
|
||||
tooltip->SetToolTip(label, gcnew String(_description));
|
||||
tooltip->SetToolTip(combobox, gcnew String(_description));
|
||||
|
||||
if (hasChanged == nullptr)
|
||||
hasChanged = new bool;
|
||||
ChangeHandler^ changehandler = gcnew ChangeHandler(hasChanged);
|
||||
combobox->SelectedIndexChanged += gcnew System::EventHandler(changehandler, &ChangeHandler::SetChanged);
|
||||
|
||||
panel->Controls->Add(label);
|
||||
panel->Controls->Add(combobox);
|
||||
mainControlHandle = combobox->Handle;
|
||||
@@ -563,6 +600,11 @@ public:
|
||||
tooltip->SetToolTip(label, gcnew String(_description));
|
||||
tooltip->SetToolTip(combobox, gcnew String(_description));
|
||||
|
||||
if (hasChanged == nullptr)
|
||||
hasChanged = new bool;
|
||||
ChangeHandler^ changehandler = gcnew ChangeHandler(hasChanged);
|
||||
combobox->TextChanged += gcnew System::EventHandler(changehandler, &ChangeHandler::SetChanged);
|
||||
|
||||
panel->Controls->Add(label);
|
||||
panel->Controls->Add(combobox);
|
||||
mainControlHandle = combobox->Handle;
|
||||
@@ -655,6 +697,11 @@ public:
|
||||
ComboboxValidation^ validation = gcnew ComboboxValidation(combobox);
|
||||
combobox->Leave += gcnew System::EventHandler(validation, &ComboboxValidation::CheckNumberLeave);
|
||||
|
||||
if (hasChanged == nullptr)
|
||||
hasChanged = new bool;
|
||||
ChangeHandler^ changehandler = gcnew ChangeHandler(hasChanged);
|
||||
combobox->TextChanged += gcnew System::EventHandler(changehandler, &ChangeHandler::SetChanged);
|
||||
|
||||
panel->Controls->Add(label);
|
||||
panel->Controls->Add(combobox);
|
||||
mainControlHandle = combobox->Handle;
|
||||
@@ -742,6 +789,11 @@ public:
|
||||
tooltip->SetToolTip(label, gcnew String(_description));
|
||||
tooltip->SetToolTip(combobox, gcnew String(_description));
|
||||
|
||||
if (hasChanged == nullptr)
|
||||
hasChanged = new bool;
|
||||
ChangeHandler^ changehandler = gcnew ChangeHandler(hasChanged);
|
||||
combobox->TextChanged += gcnew System::EventHandler(changehandler, &ChangeHandler::SetChanged);
|
||||
|
||||
ComboboxValidation^ validation = gcnew ComboboxValidation(combobox);
|
||||
combobox->Leave += gcnew System::EventHandler(validation, &ComboboxValidation::CheckResolutionLeave);
|
||||
|
||||
|
||||
@@ -147,12 +147,12 @@ ConfigOptionBase* optionsArray[] = {
|
||||
new BooleanOption(L"TAA", GRAPHICS_SECTION, CONFIG_FILE, L"TAA", L"Temporal Anti-Aliasing", true, false),
|
||||
new BooleanOption(L"MLAA", GRAPHICS_SECTION, CONFIG_FILE, L"MLAA", L"Morphological Anti-Aliasing", true, false),
|
||||
|
||||
new BooleanOption(L"hide_freeplay", PATCHES_SECTION, CONFIG_FILE, L"Hide \"CREDIT(S)\"", L"Hide the \"CREDIT(S)\" text.", false, false),
|
||||
new BooleanOption(L"freeplay", PATCHES_SECTION, CONFIG_FILE, L"FREE PLAY", L"Show \"FREE PLAY\" instead of \"CREDIT(S)\".", false, false),
|
||||
new BooleanOption(L"pdloadertext", PATCHES_SECTION, CONFIG_FILE, L"PD Loader FREE PLAY", L"Show the version of PD Loader instead of \"FREE PLAY\".", false, false),
|
||||
new BooleanOption(L"hide_freeplay", PATCHES_SECTION, CONFIG_FILE, L"Hide \"FREE PLAY\"/\"CREDIT(S)\"", L"Hide the \"FREE PLAY\"/\"CREDIT(S)\" text.", false, false),
|
||||
new BooleanOption(L"freeplay", PATCHES_SECTION, CONFIG_FILE, L"FREE PLAY", L"Show \"FREE PLAY\" instead of \"CREDIT(S)\".", true, false),
|
||||
new BooleanOption(L"pdloadertext", PATCHES_SECTION, CONFIG_FILE, L"PD Loader FREE PLAY", L"Show the version of PD Loader instead of \"FREE PLAY\".", true, false),
|
||||
new BooleanOption(L"hide_volume", PATCHES_SECTION, CONFIG_FILE, L"Hide Volume Buttons", L"Hide the volume and SE control buttons.", false, false),
|
||||
new BooleanOption(L"no_movies", PATCHES_SECTION, CONFIG_FILE, L"Disable Movies", L"Disable movies (enable this if the game hangs when loading certain PVs).", false, false),
|
||||
new BooleanOption(L"mp4_movies", PATCHES_SECTION, CONFIG_FILE, L"Custom MP4 Adv Movies", L"Enable custom MP4 adv movies (experimental).", false, false),
|
||||
new BooleanOption(L"mp4_movies", PATCHES_SECTION, CONFIG_FILE, L"Custom MP4 Adv Movies", L"Enable MP4 (instead of WMV) advertise/attract movies.", false, false),
|
||||
new BooleanOption(L"no_pv_ui", PATCHES_SECTION, CONFIG_FILE, L"Disable PV UI", L"Remove the photo controls during PV playback.", false, false),
|
||||
new BooleanOption(L"no_lyrics", PATCHES_SECTION, CONFIG_FILE, L"Disable Lyrics", L"Disable showing lyrics.", false, false),
|
||||
new BooleanOption(L"hide_pv_watermark", PATCHES_SECTION, CONFIG_FILE, L"Hide PV Watermark", L"Hide the watermark that's usually shown in PV viewing mode.", false, false),
|
||||
@@ -160,7 +160,7 @@ ConfigOptionBase* optionsArray[] = {
|
||||
new BooleanOption(L"hardware_slider", PATCHES_SECTION, CONFIG_FILE, L"Use Hardware Slider", L"Enable this if using a real arcade slider.\n(set the slider to port COM11)", false, false),
|
||||
|
||||
new NumericOption(L"Enhanced_Stage_Manager", GRAPHICS_SECTION, CONFIG_FILE, L"Number of stages:", L"Set the number of stages (0 = default).", 0, 0, INT_MAX),
|
||||
new BooleanOption(L"Enhanced_Stage_Manager_Encore", PATCHES_SECTION, CONFIG_FILE, L"Encore", L"Enable the Encore stage.", false, false),
|
||||
new BooleanOption(L"Enhanced_Stage_Manager_Encore", PATCHES_SECTION, CONFIG_FILE, L"Encore", L"Enable encore stages.", true, false),
|
||||
|
||||
new BooleanOption(L"skip", LAUNCHER_SECTION, CONFIG_FILE, L"Skip Launcher", L"Forces the launcher to be skipped, you can also use the --launch parameter instead of this.", false, false),
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace Launcher {
|
||||
int screenresY = 3;
|
||||
for (ConfigOptionBase* option : screenResolutionArray)
|
||||
{
|
||||
option->hasChanged = ConfigHasChanged;
|
||||
screenresY += option->AddToPanel(panel_ScreenRes, 12, screenresY, toolTip1);
|
||||
}
|
||||
((ComboBox^)ComboBox::FromHandle(DisplayModeDropdown->mainControlHandle))->SelectedIndexChanged += gcnew System::EventHandler(this, &ui::DisplayTypeChangedHandler);
|
||||
@@ -66,6 +67,7 @@ namespace Launcher {
|
||||
int intresY = 3;
|
||||
for (ConfigOptionBase* option : internalResolutionArray)
|
||||
{
|
||||
option->hasChanged = ConfigHasChanged;
|
||||
intresY += option->AddToPanel(panel_IntRes, 12, intresY, toolTip1);
|
||||
}
|
||||
((CheckBox^)CheckBox::FromHandle(InternalResolutionCheckbox->mainControlHandle))->CheckedChanged += gcnew System::EventHandler(this, &ui::InternalResEnabledChangedHandler);
|
||||
@@ -81,6 +83,7 @@ namespace Launcher {
|
||||
int optionsY = 3;
|
||||
for (ConfigOptionBase* option : optionsArray)
|
||||
{
|
||||
option->hasChanged = ConfigHasChanged;
|
||||
optionsY += option->AddToPanel(panel_Patches, 12, optionsY, toolTip1);
|
||||
}
|
||||
this->panel_Patches->ResumeLayout(false);
|
||||
@@ -94,6 +97,7 @@ namespace Launcher {
|
||||
int playerdataY = 3;
|
||||
for (ConfigOptionBase* option : playerdataArray)
|
||||
{
|
||||
option->hasChanged = ConfigHasChanged;
|
||||
playerdataY += option->AddToPanel(panel_Playerdata, 12, playerdataY, toolTip1);
|
||||
}
|
||||
this->panel_Playerdata->ResumeLayout(false);
|
||||
@@ -107,6 +111,7 @@ namespace Launcher {
|
||||
int componentsY = 3;
|
||||
for (ConfigOptionBase* component : componentsArray)
|
||||
{
|
||||
component->hasChanged = ConfigHasChanged;
|
||||
componentsY += component->AddToPanel(panel_Components, 12, componentsY, toolTip1);
|
||||
}
|
||||
this->panel_Components->ResumeLayout(false);
|
||||
@@ -488,6 +493,8 @@ namespace Launcher {
|
||||
this->Name = L"ui";
|
||||
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
|
||||
this->Text = L"PD Launcher";
|
||||
this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &ui::Ui_FormClosing);
|
||||
this->FormClosed += gcnew System::Windows::Forms::FormClosedEventHandler(this, &ui::Ui_FormClosed);
|
||||
this->Load += gcnew System::EventHandler(this, &ui::Ui_Load);
|
||||
this->groupBox_ScreenRes->ResumeLayout(false);
|
||||
this->tabControl->ResumeLayout(false);
|
||||
@@ -589,6 +596,24 @@ private: System::Void DisplayTypeChangedHandler(System::Object^ sender, System::
|
||||
}
|
||||
}
|
||||
}
|
||||
private: System::Void Ui_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) {
|
||||
if (!*ConfigHasChanged)
|
||||
return;
|
||||
|
||||
switch (SkinnedMessageBox::Show(this, "Do you want to save your settings?", "PD Launcher", MessageBoxButtons::YesNoCancel, MessageBoxIcon::Question))
|
||||
{
|
||||
case System::Windows::Forms::DialogResult::Yes:
|
||||
SaveSettings();
|
||||
break;
|
||||
|
||||
case System::Windows::Forms::DialogResult::No:
|
||||
break;
|
||||
|
||||
case System::Windows::Forms::DialogResult::Cancel:
|
||||
e->Cancel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
private: System::Void Ui_FormClosed(System::Object^ sender, System::Windows::Forms::FormClosedEventArgs^ e) {
|
||||
// Prevents abnormal termination messages, remember that the game is still technically running and must be killed!
|
||||
TerminateProcess(GetCurrentProcess(), EXIT_SUCCESS);
|
||||
@@ -600,10 +625,16 @@ private: System::Void button_github_Click(System::Object^ sender, System::EventA
|
||||
System::Diagnostics::Process::Start("https://notabug.org/nastys/PD-Loader");
|
||||
}
|
||||
private: System::Void button_Apply_Click(System::Object^ sender, System::EventArgs^ e) {
|
||||
if (SkinnedMessageBox::Show(this, "Do you want to save your settings?", "PD Launcher", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::Yes) SaveSettings();
|
||||
SaveSettings();
|
||||
}
|
||||
private: System::Void Ui_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) {
|
||||
if (e->KeyCode == Keys::Escape) this->Close();
|
||||
}
|
||||
|
||||
private: bool* ConfigHasChanged = new bool(false);/*
|
||||
|
||||
private: System::Void ConfigChanged(System::Object^ sender, System::EventArgs^ e) {
|
||||
*ConfigHasChanged = true;
|
||||
}*/
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user