Rearrange Macros buttons

- Allows Macro dialogs to be smaller.
- Order is more logical.
- Layout is neater (better aligned).
- Height stays stable on Expand/Shrink.
This commit is contained in:
James Crook 2018-03-14 16:37:15 +00:00
parent 1ccd2678b6
commit b1862d2b11
2 changed files with 92 additions and 106 deletions

View File

@ -103,53 +103,49 @@ void ApplyMacroDialog::Populate()
Layout(); Layout();
Fit(); Fit();
SetSizeHints(GetSize()); wxSize sz = GetSize();
SetSizeHints( sz );
// Size and place window
SetSize(std::min(wxSystemSettings::GetMetric(wxSYS_SCREEN_X) * 3 / 4, sz.GetWidth()),
std::min(wxSystemSettings::GetMetric(wxSYS_SCREEN_Y) * 4 / 5, 400));
Center(); Center();
// Set the column size for the macros list. // Set the column size for the macros list.
wxSize sz = mMacros->GetClientSize(); sz = mMacros->GetClientSize();
mMacros->SetColumnWidth(0, sz.x); mMacros->SetColumnWidth(0, sz.x);
} }
/// Defines the dialog and does data exchange with it. /// Defines the dialog and does data exchange with it.
void ApplyMacroDialog::PopulateOrExchange(ShuttleGui &S) void ApplyMacroDialog::PopulateOrExchange(ShuttleGui &S)
{ {
S.StartVerticalLay(true); /*i18n-hint: A macro is a sequence of commands that can be applied
* to one or more audio files.*/
S.StartStatic(_("&Select Macro"), 1);
{ {
/*i18n-hint: A macro is a sequence of commands that can be applied S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES |
* to one or more audio files.*/ wxLC_SINGLE_SEL);
mMacros = S.Id(MacrosListID).Prop(1).AddListControlReportMode();
S.StartHorizontalLay(wxALIGN_RIGHT, false); mMacros->InsertColumn(0, _("Macro"), wxLIST_FORMAT_LEFT);
{
mResize = S.Id(ExpandID).AddButton(_("&Expand"));
}
S.EndHorizontalLay();
S.StartStatic(_("&Select Macro"), true);
{
S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES |
wxLC_SINGLE_SEL);
mMacros = S.Id(MacrosListID).AddListControlReportMode();
mMacros->InsertColumn(0, _("Macro"), wxLIST_FORMAT_LEFT);
}
S.EndStatic();
S.StartHorizontalLay(wxALIGN_RIGHT, false);
{
S.AddSpace( 40 );
S.AddPrompt( _("Apply Macro to:") );
S.Id(ApplyToProjectID).AddButton(_("&Project"));
S.Id(ApplyToFilesID).AddButton(_("&Files..."));
}
S.EndHorizontalLay();
S.StartHorizontalLay(wxALIGN_RIGHT, false);
{
S.AddStandardButtons( eCancelButton | eHelpButton);
}
S.EndHorizontalLay();
} }
S.EndVerticalLay(); S.EndStatic();
S.StartHorizontalLay(wxEXPAND, 0);
{
S.AddPrompt( _("Apply Macro to:") );
S.Id(ApplyToProjectID).AddButton(_("&Project"));
S.Id(ApplyToFilesID).AddButton(_("&Files..."));
}
S.EndHorizontalLay();
S.StartHorizontalLay(wxEXPAND, 0);
{
mResize = S.Id(ExpandID).AddButton(_("&Expand"));
S.Prop(1).AddSpace( 10 );
S.AddStandardButtons( eCancelButton | eHelpButton);
}
S.EndHorizontalLay();
} }
/// This clears and updates the contents of mMacros, the list of macros. /// This clears and updates the contents of mMacros, the list of macros.
@ -567,8 +563,8 @@ void MacrosWindow::Populate()
SetSizeHints(GetSize()); SetSizeHints(GetSize());
// Size and place window // Size and place window
SetSize(wxSystemSettings::GetMetric(wxSYS_SCREEN_X) * 3 / 4, SetSize(std::min(wxSystemSettings::GetMetric(wxSYS_SCREEN_X) * 3 / 4, 800),
wxSystemSettings::GetMetric(wxSYS_SCREEN_Y) * 4 / 5); std::min(wxSystemSettings::GetMetric(wxSYS_SCREEN_Y) * 4 / 5, 400));
Center(); Center();
// Set the column size for the macros list. // Set the column size for the macros list.
@ -584,86 +580,76 @@ void MacrosWindow::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartHorizontalLay(wxEXPAND, 1); S.StartHorizontalLay(wxEXPAND, 1);
{ {
S.StartVerticalLay( wxEXPAND, 0 ); S.StartStatic(_("&Select Macro"),0);
{ {
S.Prop(0).StartHorizontalLay(wxALIGN_RIGHT, false); S.StartHorizontalLay(wxEXPAND,1);
{
mResize = S.Id(ShrinkID).AddButton(_("Shrin&k"));
}
S.EndHorizontalLay();
S.StartStatic(_("&Select Macro"),1);
{ {
S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_SINGLE_SEL | S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_SINGLE_SEL |
wxLC_EDIT_LABELS); wxLC_EDIT_LABELS);
mMacros = S.Id(MacrosListID).Prop(1).AddListControlReportMode(); mMacros = S.Id(MacrosListID).Prop(1).AddListControlReportMode();
// i18n-hint: This is the heading for a column in the edit macros dialog // i18n-hint: This is the heading for a column in the edit macros dialog
mMacros->InsertColumn(0, _("Macro"), wxLIST_FORMAT_LEFT); mMacros->InsertColumn(0, _("Macro"), wxLIST_FORMAT_LEFT);
} S.StartVerticalLay(wxALIGN_TOP, 0);
S.EndStatic();
S.StartHorizontalLay(wxALIGN_RIGHT, false);
{ S.AddSpace( 40 );
S.SetBorder( 12 );
S.AddPrompt( _("Apply Macro to:") );
S.SetBorder( 5 );
S.Id(ApplyToProjectID).AddButton(_("&Project"));
S.Id(ApplyToFilesID).AddButton(_("&Files..."));
}
S.EndHorizontalLay();
}
S.EndVerticalLay();
S.StartVerticalLay( 1 );
{
S.StartStatic(_("&Macro (Double-Click or press SPACE to edit)"), true);
{
S.StartHorizontalLay(wxEXPAND,1);
{ {
S.Id(AddButtonID).AddButton(_("&New"));
S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | mRemove = S.Id(RemoveButtonID).AddButton(_("Remo&ve"));
wxLC_SINGLE_SEL); mRename = S.Id(RenameButtonID).AddButton(_("&Rename..."));
mList = S.Id(CommandsListID).AddListControlReportMode(); S.Id(ImportButtonID).AddButton(_("I&mport..."))->Enable( false);
S.Id(ExportButtonID).AddButton(_("E&xport..."))->Enable( false);
//An empty first column is a workaround - under Win98 the first column
//can't be right aligned.
mList->InsertColumn(BlankColumn, wxT(""), wxLIST_FORMAT_LEFT);
/* i18n-hint: This is the number of the command in the list */
mList->InsertColumn(ItemNumberColumn, _("Num"), wxLIST_FORMAT_RIGHT);
mList->InsertColumn(ActionColumn, _("Command "), wxLIST_FORMAT_RIGHT);
mList->InsertColumn(ParamsColumn, _("Parameters"), wxLIST_FORMAT_LEFT);
S.StartVerticalLay(wxALIGN_TOP, 0);
{
S.AddPrompt( _("Command") );
S.Id(InsertButtonID).AddButton(_("&Insert"), wxALIGN_LEFT);
S.Id(EditButtonID).AddButton(_("&Edit..."), wxALIGN_LEFT);
S.Id(DeleteButtonID).AddButton(_("De&lete"), wxALIGN_LEFT);
S.Id(UpButtonID).AddButton(_("Move &Up"), wxALIGN_LEFT);
S.Id(DownButtonID).AddButton(_("Move &Down"), wxALIGN_LEFT);
mDefaults = S.Id(DefaultsButtonID).AddButton(_("De&faults"));
S.AddSpace( 30 );
S.AddPrompt( _("Macro") );
S.Id(AddButtonID).AddButton(_("&New"));
mRemove = S.Id(RemoveButtonID).AddButton(_("Remo&ve"));
mRename = S.Id(RenameButtonID).AddButton(_("&Rename..."));
S.Id(ImportButtonID).AddButton(_("I&mport..."))->Enable( false);
S.Id(ExportButtonID).AddButton(_("E&xport..."))->Enable( false);
}
S.EndVerticalLay();
} }
S.EndHorizontalLay(); S.EndVerticalLay();
}
S.EndStatic();
S.StartHorizontalLay(wxALIGN_RIGHT, false);
{
S.AddStandardButtons( eOkButton | eCancelButton | eHelpButton);
} }
S.EndHorizontalLay(); S.EndHorizontalLay();
} }
S.EndVerticalLay(); S.EndStatic();
S.StartStatic(_("Edit S&teps"), true);
{
S.StartHorizontalLay(wxEXPAND,1);
{
S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES |
wxLC_SINGLE_SEL);
mList = S.Id(CommandsListID).AddListControlReportMode();
//An empty first column is a workaround - under Win98 the first column
//can't be right aligned.
mList->InsertColumn(BlankColumn, wxT(""), wxLIST_FORMAT_LEFT);
/* i18n-hint: This is the number of the command in the list */
mList->InsertColumn(ItemNumberColumn, _("Num"), wxLIST_FORMAT_RIGHT);
mList->InsertColumn(ActionColumn, _("Command "), wxLIST_FORMAT_RIGHT);
mList->InsertColumn(ParamsColumn, _("Parameters"), wxLIST_FORMAT_LEFT);
S.StartVerticalLay(wxALIGN_TOP, 0);
{
S.Id(InsertButtonID).AddButton(_("&Insert"), wxALIGN_LEFT);
S.Id(EditButtonID).AddButton(_("&Edit..."), wxALIGN_LEFT);
S.Id(DeleteButtonID).AddButton(_("De&lete"), wxALIGN_LEFT);
S.Id(UpButtonID).AddButton(_("Move &Up"), wxALIGN_LEFT);
S.Id(DownButtonID).AddButton(_("Move &Down"), wxALIGN_LEFT);
mDefaults = S.Id(DefaultsButtonID).AddButton(_("De&faults"));
}
S.EndVerticalLay();
}
S.EndHorizontalLay();
}
S.EndStatic();
} }
S.EndHorizontalLay(); S.EndHorizontalLay();
S.StartHorizontalLay(wxEXPAND, 0);
{
mResize = S.Id(ShrinkID).AddButton(_("Shrin&k"));
// Using variable text just to get the positioning options.
S.Prop(0).AddVariableText( _("Apply Macro to:"), false, wxALL | wxALIGN_CENTRE_VERTICAL );
S.Id(ApplyToProjectID).AddButton(_("&Project"));
S.Id(ApplyToFilesID).AddButton(_("&Files..."));
S.Prop(1).AddSpace( 10 );
S.AddStandardButtons( eOkButton | eCancelButton | eHelpButton);
}
S.EndHorizontalLay();
return; return;
} }

View File

@ -2261,8 +2261,8 @@ wxSizerItem * ShuttleGui::AddSpace( int width, int height )
{ {
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return NULL; return NULL;
SetProportions(0);
return mpSizer->Add( width, height, 0); return mpSizer->Add( width, height, miProp);
} }
void ShuttleGui::SetSizeHints( wxWindow *window, const wxArrayString & items ) void ShuttleGui::SetSizeHints( wxWindow *window, const wxArrayString & items )