1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-14 09:03:54 +01:00

Improve sizing of apply macros file progress dialog

Previously it could come out really tiny far too easily.
This commit is contained in:
James Crook
2020-05-25 11:20:21 +01:00
parent 5bb1152fe9
commit 7c1f443882

View File

@@ -362,13 +362,15 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
files.Sort(); files.Sort();
wxDialogWrapper activityWin(this, wxID_ANY, Verbatim( GetTitle() ) ); wxDialogWrapper activityWin(this, wxID_ANY, Verbatim( GetTitle() ),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
);
activityWin.SetName(); activityWin.SetName();
ShuttleGui S(&activityWin, eIsCreating); ShuttleGui S(&activityWin, eIsCreating);
wxListCtrl * fileList = NULL; wxListCtrl * fileList = NULL;
S.StartVerticalLay(false); S.StartVerticalLay(1);
{ {
S.StartStatic(XO("Applying..."), 1); S.StartStatic(XO("Applying..."), 1);
{ {
@@ -385,7 +387,7 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
} }
S.EndStatic(); S.EndStatic();
S.StartHorizontalLay(wxCENTER, false); S.StartHorizontalLay(wxCENTER, 0);
{ {
S.Id(wxID_CANCEL).AddButton(XXO("&Cancel")); S.Id(wxID_CANCEL).AddButton(XXO("&Cancel"));
} }
@@ -401,10 +403,12 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
// Set the column size for the files list. // Set the column size for the files list.
fileList->SetColumnWidth(0, wxLIST_AUTOSIZE); fileList->SetColumnWidth(0, wxLIST_AUTOSIZE);
int width = fileList->GetColumnWidth(0); int width = wxMin( fileList->GetColumnWidth(0), 1000);
wxSize sz = fileList->GetClientSize(); wxSize sz = fileList->GetClientSize();
if (width > sz.GetWidth() && width < 500) { if (sz.GetWidth() < width ) {
sz.SetWidth(width); sz.SetWidth(width);
if (sz.GetHeight() < width *0.7)
sz.SetHeight(width * 0.7);
fileList->SetInitialSize(sz); fileList->SetInitialSize(sz);
} }
@@ -423,33 +427,35 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
// and hiding this one temporarily has some advantages. // and hiding this one temporarily has some advantages.
Hide(); Hide();
mMacroCommands.ReadMacro(name); mMacroCommands.ReadMacro(name);
for (i = 0; i < (int)files.size(); i++) { {
wxWindowDisabler wd(&activityWin); wxWindowDisabler wd(&activityWin);
if (i > 0) { for (i = 0; i < (int)files.size(); i++) {
//Clear the arrow in previous item. if (i > 0) {
fileList->SetItemImage(i - 1, 0, 0); //Clear the arrow in previous item.
fileList->SetItemImage(i - 1, 0, 0);
}
fileList->SetItemImage(i, 1, 1);
fileList->EnsureVisible(i);
auto success = GuardedCall< bool >([&] {
ProjectFileManager::Get(*project).Import(files[i]);
ProjectWindow::Get(*project).ZoomAfterImport(nullptr);
SelectUtilities::DoSelectAll(*project);
if (!mMacroCommands.ApplyMacro(mCatalog))
return false;
if (!activityWin.IsShown() || mAbort)
return false;
return true;
});
if (!success)
break;
ProjectManager::Get(*project).ResetProjectToEmpty();
} }
fileList->SetItemImage(i, 1, 1);
fileList->EnsureVisible(i);
auto success = GuardedCall< bool >( [&] {
ProjectFileManager::Get( *project ).Import(files[i]);
ProjectWindow::Get( *project ).ZoomAfterImport(nullptr);
SelectUtilities::DoSelectAll(*project);
if (!mMacroCommands.ApplyMacro(mCatalog))
return false;
if (!activityWin.IsShown() || mAbort)
return false;
return true;
} );
if (!success)
break;
ProjectManager::Get( *project ).ResetProjectToEmpty();
} }
Show(); Show();