for config dialogs that reflect changes instantly, make behavior of window close button consistent with that of Cancel button
This commit is contained in:
parent
eb6fe823f8
commit
dd14a3e88e
|
@ -44,8 +44,15 @@ uiEntry* txMicWavPath;
|
|||
int oldvolume;
|
||||
|
||||
|
||||
void RevertSettings()
|
||||
{
|
||||
Config::AudioVolume = oldvolume;
|
||||
}
|
||||
|
||||
|
||||
int OnCloseWindow(uiWindow* window, void* blarg)
|
||||
{
|
||||
RevertSettings();
|
||||
opened = false;
|
||||
return 1;
|
||||
}
|
||||
|
@ -69,7 +76,7 @@ void OnMicWavBrowse(uiButton* btn, void* blarg)
|
|||
|
||||
void OnCancel(uiButton* btn, void* blarg)
|
||||
{
|
||||
Config::AudioVolume = oldvolume;
|
||||
RevertSettings();
|
||||
|
||||
uiControlDestroy(uiControl(win));
|
||||
opened = false;
|
||||
|
|
|
@ -70,9 +70,53 @@ void UpdateControls()
|
|||
}
|
||||
}
|
||||
|
||||
void RevertSettings()
|
||||
{
|
||||
bool apply0 = false;
|
||||
bool apply2 = false;
|
||||
bool apply3 = false;
|
||||
|
||||
bool old_usegl = (old_gldisplay != 0) || (old_renderer != 0);
|
||||
bool new_usegl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
||||
|
||||
if (old_renderer != Config::_3DRenderer)
|
||||
{
|
||||
Config::_3DRenderer = old_renderer;
|
||||
apply3 = true;
|
||||
}
|
||||
|
||||
if (old_gldisplay != Config::ScreenUseGL)
|
||||
{
|
||||
Config::ScreenUseGL = old_gldisplay;
|
||||
}
|
||||
if (old_usegl != new_usegl)
|
||||
{
|
||||
apply2 = true;
|
||||
}
|
||||
|
||||
if (old_threaded3D != Config::Threaded3D)
|
||||
{
|
||||
Config::Threaded3D = old_threaded3D;
|
||||
apply0 = true;
|
||||
}
|
||||
|
||||
if (old_resolution != Config::GL_ScaleFactor ||
|
||||
old_antialias != Config::GL_Antialias)
|
||||
{
|
||||
Config::GL_ScaleFactor = old_resolution;
|
||||
Config::GL_Antialias = old_antialias;
|
||||
apply0 = true;
|
||||
}
|
||||
|
||||
if (apply2) ApplyNewSettings(2);
|
||||
else if (apply3) ApplyNewSettings(3);
|
||||
if (apply0) ApplyNewSettings(0);
|
||||
}
|
||||
|
||||
|
||||
int OnCloseWindow(uiWindow* window, void* blarg)
|
||||
{
|
||||
RevertSettings();
|
||||
opened = false;
|
||||
return 1;
|
||||
}
|
||||
|
@ -121,45 +165,7 @@ void OnAntialiasChanged(uiCheckbox* cb, void* blarg)
|
|||
|
||||
void OnCancel(uiButton* btn, void* blarg)
|
||||
{
|
||||
bool apply0 = false;
|
||||
bool apply2 = false;
|
||||
bool apply3 = false;
|
||||
|
||||
bool old_usegl = (old_gldisplay != 0) || (old_renderer != 0);
|
||||
bool new_usegl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
||||
|
||||
if (old_renderer != Config::_3DRenderer)
|
||||
{
|
||||
Config::_3DRenderer = old_renderer;
|
||||
apply3 = true;
|
||||
}
|
||||
|
||||
if (old_gldisplay != Config::ScreenUseGL)
|
||||
{
|
||||
Config::ScreenUseGL = old_gldisplay;
|
||||
}
|
||||
if (old_usegl != new_usegl)
|
||||
{
|
||||
apply2 = true;
|
||||
}
|
||||
|
||||
if (old_threaded3D != Config::Threaded3D)
|
||||
{
|
||||
Config::Threaded3D = old_threaded3D;
|
||||
apply0 = true;
|
||||
}
|
||||
|
||||
if (old_resolution != Config::GL_ScaleFactor ||
|
||||
old_antialias != Config::GL_Antialias)
|
||||
{
|
||||
Config::GL_ScaleFactor = old_resolution;
|
||||
Config::GL_Antialias = old_antialias;
|
||||
apply0 = true;
|
||||
}
|
||||
|
||||
if (apply2) ApplyNewSettings(2);
|
||||
else if (apply3) ApplyNewSettings(3);
|
||||
if (apply0) ApplyNewSettings(0);
|
||||
RevertSettings();
|
||||
|
||||
uiControlDestroy(uiControl(win));
|
||||
opened = false;
|
||||
|
|
Loading…
Reference in New Issue