close any opened dialogs when closing the main window

This commit is contained in:
Arisotura 2019-05-25 20:58:32 +02:00
parent af581513fb
commit eb6fe823f8
11 changed files with 54 additions and 0 deletions

View File

@ -180,4 +180,11 @@ void Open()
uiControlShow(uiControl(win));
}
void Close()
{
if (!opened) return;
uiControlDestroy(uiControl(win));
opened = false;
}
}

View File

@ -23,6 +23,7 @@ namespace DlgAudioSettings
{
void Open();
void Close();
}

View File

@ -107,4 +107,11 @@ void Open()
uiControlShow(uiControl(win));
}
void Close()
{
if (!opened) return;
uiControlDestroy(uiControl(win));
opened = false;
}
}

View File

@ -23,6 +23,7 @@ namespace DlgEmuSettings
{
void Open();
void Close();
}

View File

@ -450,5 +450,13 @@ void Open(int type)
uiControlShow(uiControl(dlg->win));
}
void Close(int type)
{
if (openedmask & (1<<type))
uiControlDestroy(uiControl(inputdlg[type].win));
openedmask &= ~(1<<type);
}
}

View File

@ -23,6 +23,7 @@ namespace DlgInputConfig
{
void Open(int type);
void Close(int type);
}

View File

@ -306,4 +306,11 @@ void Open()
uiControlShow(uiControl(win));
}
void Close()
{
if (!opened) return;
uiControlDestroy(uiControl(win));
opened = false;
}
}

View File

@ -23,6 +23,7 @@ namespace DlgVideoSettings
{
void Open();
void Close();
}

View File

@ -261,4 +261,11 @@ void Open()
uiControlShow(uiControl(win));
}
void Close()
{
if (!opened) return;
uiControlDestroy(uiControl(win));
opened = false;
}
}

View File

@ -23,6 +23,7 @@ namespace DlgWifiSettings
{
void Open();
void Close();
}

View File

@ -1637,11 +1637,23 @@ void UndoStateLoad()
}
void CloseAllDialogs()
{
DlgAudioSettings::Close();
DlgEmuSettings::Close();
DlgInputConfig::Close(0);
DlgInputConfig::Close(1);
DlgVideoSettings::Close();
DlgWifiSettings::Close();
}
int OnCloseWindow(uiWindow* window, void* blarg)
{
EmuRunning = 3;
while (EmuStatus != 3);
CloseAllDialogs();
uiQuit();
return 1;
}
@ -1678,6 +1690,7 @@ void OnCloseByMenu(uiMenuItem* item, uiWindow* window, void* blarg)
EmuRunning = 3;
while (EmuStatus != 3);
CloseAllDialogs();
DestroyMainWindow();
uiQuit();
}