Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows GUI: Prevent repeated execution of certain code #853

Merged
merged 2 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions Source/GUI/VCL/GUI_Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,31 +332,34 @@ void __fastcall TMainF::GUI_Configure()
void __fastcall TMainF::FormShow(TObject *Sender)
{
//Configuration of MediaInfoLib
if (I==NULL)
I=new MediaInfoList;
if (I == NULL)
{
I = new MediaInfoList;

//Load GUI preferences
GUI_Configure();
//Load GUI preferences
GUI_Configure();

//File(s) in command line
#ifdef UNICODE
if (IsWin9X())
{
for (int I1=1; I1<=ParamCount(); I1++)
I->Open(ParamStr(I1).c_str());
}
else
{
int argc;
MediaInfoNameSpace::Char** argv=CommandLineToArgvW(GetCommandLineW(), &argc);
for (int I1=1; I1<argc; I1++)
I->Open(argv[I1]);
}
#else
for (int I1=1; I1<ParamCount(); I1++)
I->Open(Ztring().From_Local(ParamStr(I1).c_str()));
#endif
Refresh();
//File(s) in command line
#ifdef UNICODE
if (IsWin9X())
{
for (int I1 = 1; I1 <= ParamCount(); I1++)
I->Open(ParamStr(I1).c_str());
}
else
{
int argc;
MediaInfoNameSpace::Char** argv = CommandLineToArgvW(GetCommandLineW(), &argc);
for (int I1 = 1; I1 < argc; I1++)
I->Open(argv[I1]);
}
#else
for (int I1 = 1; I1 < ParamCount(); I1++)
I->Open(Ztring().From_Local(ParamStr(I1).c_str()));
#endif

Refresh();
}
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -2047,7 +2050,6 @@ void __fastcall TMainF::Footer_ButtonClick(TObject *Sender)
//---------------------------------------------------------------------------
void __fastcall TMainF::M_Options_DarkmodeClick(TObject* Sender)
{
M_View_EasyClick(NULL); // This is for avoiding a popup "Cannot focus a disabled or invisible window when another view is selected. TODO: better handle of this issue
if (M_Options_Darkmode->Checked) {
TStyleManager::TrySetStyle(LIGHT_MODE_STYLE, false);
M_Options_Darkmode->Checked = false;
Expand All @@ -2062,8 +2064,7 @@ void __fastcall TMainF::ApplicationEvents1OnSettingChange(
TObject* Sender, int Flag, const UnicodeString Section, int &Result)
{
if (Section == "ImmersiveColorSet") {
M_View_EasyClick(NULL); // This is for avoiding a popup "Cannot focus a disabled or invisible window when another view is selected. TODO: better handle of this issue
if (WindowsDarkModeEnabled()) {
if (WindowsDarkModeEnabled()) {
TStyleManager::TrySetStyle(DARK_MODE_STYLE, false);
M_Options_Darkmode->Checked = true;
} else {
Expand Down
Loading