1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

ControlToolBar: Reorder icons

Although we expect that this change will probably put off long-time Audacity
users, we believe that it's easier to reach the buttons that are used the
most if they are placed on the right.

Controversial change is controversial, but better now than later.

Signed-off-by: Panagiotis Vasilopoulos <hello@alwayslivid.com>
Reference-to: https://github.com/tenacityteam/tenacity/pull/402
This commit is contained in:
Panagiotis Vasilopoulos 2021-09-23 10:00:17 +02:00 committed by GitHub
parent cf6ce76ce1
commit a1e7fd1aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 50 deletions

View File

@ -81,12 +81,12 @@ IMPLEMENT_CLASS(ControlToolBar, ToolBar);
BEGIN_EVENT_TABLE(ControlToolBar, ToolBar) BEGIN_EVENT_TABLE(ControlToolBar, ToolBar)
EVT_CHAR(ControlToolBar::OnKeyEvent) EVT_CHAR(ControlToolBar::OnKeyEvent)
EVT_BUTTON(ID_PLAY_BUTTON, ControlToolBar::OnPlay)
EVT_BUTTON(ID_STOP_BUTTON, ControlToolBar::OnStop)
EVT_BUTTON(ID_RECORD_BUTTON, ControlToolBar::OnRecord)
EVT_BUTTON(ID_REW_BUTTON, ControlToolBar::OnRewind) EVT_BUTTON(ID_REW_BUTTON, ControlToolBar::OnRewind)
EVT_BUTTON(ID_FF_BUTTON, ControlToolBar::OnFF) EVT_BUTTON(ID_FF_BUTTON, ControlToolBar::OnFF)
EVT_BUTTON(ID_STOP_BUTTON, ControlToolBar::OnStop)
EVT_BUTTON(ID_PLAY_BUTTON, ControlToolBar::OnPlay)
EVT_BUTTON(ID_PAUSE_BUTTON, ControlToolBar::OnPause) EVT_BUTTON(ID_PAUSE_BUTTON, ControlToolBar::OnPause)
EVT_BUTTON(ID_RECORD_BUTTON, ControlToolBar::OnRecord)
EVT_IDLE(ControlToolBar::OnIdle) EVT_IDLE(ControlToolBar::OnIdle)
END_EVENT_TABLE() END_EVENT_TABLE()
@ -193,9 +193,19 @@ void ControlToolBar::Populate()
SetBackgroundColour( theTheme.Colour( clrMedium ) ); SetBackgroundColour( theTheme.Colour( clrMedium ) );
MakeButtonBackgroundsLarge(); MakeButtonBackgroundsLarge();
mPause = MakeButton(this, bmpPause, bmpPause, bmpPauseDisabled, // Rewind button
ID_PAUSE_BUTTON, true, XO("Pause")); mRewind = MakeButton(this, bmpRewind, bmpRewind, bmpRewindDisabled,
ID_REW_BUTTON, false, XO("Skip to Start"));
// Fast-forward button
mFF = MakeButton(this, bmpFFwd, bmpFFwd, bmpFFwdDisabled,
ID_FF_BUTTON, false, XO("Skip to End"));
// Stop button
mStop = MakeButton(this, bmpStop, bmpStop, bmpStopDisabled ,
ID_STOP_BUTTON, false, XO("Stop"));
// Play button
mPlay = MakeButton(this, bmpPlay, bmpPlay, bmpPlayDisabled, mPlay = MakeButton(this, bmpPlay, bmpPlay, bmpPlayDisabled,
ID_PLAY_BUTTON, true, XO("Play")); ID_PLAY_BUTTON, true, XO("Play"));
MakeAlternateImages(*mPlay, 1, bmpLoop, bmpLoop, bmpLoopDisabled); MakeAlternateImages(*mPlay, 1, bmpLoop, bmpLoop, bmpLoopDisabled);
@ -207,15 +217,11 @@ void ControlToolBar::Populate()
bmpSeek, bmpSeek, bmpSeekDisabled); bmpSeek, bmpSeek, bmpSeekDisabled);
mPlay->FollowModifierKeys(); mPlay->FollowModifierKeys();
mStop = MakeButton(this, bmpStop, bmpStop, bmpStopDisabled , // Pause button
ID_STOP_BUTTON, false, XO("Stop")); mPause = MakeButton(this, bmpPause, bmpPause, bmpPauseDisabled,
ID_PAUSE_BUTTON, true, XO("Pause"));
mRewind = MakeButton(this, bmpRewind, bmpRewind, bmpRewindDisabled,
ID_REW_BUTTON, false, XO("Skip to Start"));
mFF = MakeButton(this, bmpFFwd, bmpFFwd, bmpFFwdDisabled,
ID_FF_BUTTON, false, XO("Skip to End"));
// Record button
mRecord = MakeButton(this, bmpRecord, bmpRecord, bmpRecordDisabled, mRecord = MakeButton(this, bmpRecord, bmpRecord, bmpRecordDisabled,
ID_RECORD_BUTTON, false, XO("Record")); ID_RECORD_BUTTON, false, XO("Record"));
@ -249,27 +255,27 @@ void ControlToolBar::RegenerateTooltips()
CommandID name; CommandID name;
switch (iWinID) switch (iWinID)
{ {
case ID_REW_BUTTON:
name = wxT("CursProjectStart");
break;
case ID_FF_BUTTON:
name = wxT("CursProjectEnd");
break;
case ID_STOP_BUTTON:
name = wxT("Stop");
break;
case ID_PLAY_BUTTON: case ID_PLAY_BUTTON:
// Without shift // Without shift
name = wxT("PlayStop"); name = wxT("PlayStop");
break; break;
case ID_PAUSE_BUTTON:
name = wxT("Pause");
break;
case ID_RECORD_BUTTON: case ID_RECORD_BUTTON:
// Without shift // Without shift
//name = wxT("Record"); //name = wxT("Record");
name = wxT("Record1stChoice"); name = wxT("Record1stChoice");
break; break;
case ID_PAUSE_BUTTON:
name = wxT("Pause");
break;
case ID_STOP_BUTTON:
name = wxT("Stop");
break;
case ID_FF_BUTTON:
name = wxT("CursProjectEnd");
break;
case ID_REW_BUTTON:
name = wxT("CursProjectStart");
break;
} }
std::vector<ComponentInterfaceSymbol> commands( std::vector<ComponentInterfaceSymbol> commands(
1u, { name, Verbatim( pCtrl->GetLabel() ) } ); 1u, { name, Verbatim( pCtrl->GetLabel() ) } );
@ -277,10 +283,24 @@ void ControlToolBar::RegenerateTooltips()
// Some have a second // Some have a second
switch (iWinID) switch (iWinID)
{ {
case ID_REW_BUTTON:
// With shift
commands.push_back( {
wxT("SelStart"), XO("Select to Start") } );
break;
case ID_FF_BUTTON:
// With shift
commands.push_back( {
wxT("SelEnd"), XO("Select to End") } );
break;
case ID_STOP_BUTTON:
break;
case ID_PLAY_BUTTON: case ID_PLAY_BUTTON:
// With shift // With shift
commands.push_back( { wxT("PlayLooped"), XO("Loop Play") } ); commands.push_back( { wxT("PlayLooped"), XO("Loop Play") } );
break; break;
case ID_PAUSE_BUTTON:
break;
case ID_RECORD_BUTTON: case ID_RECORD_BUTTON:
// With shift // With shift
{ bool bPreferNewTrack; { bool bPreferNewTrack;
@ -294,20 +314,6 @@ void ControlToolBar::RegenerateTooltips()
} ); } );
} }
break; break;
case ID_PAUSE_BUTTON:
break;
case ID_STOP_BUTTON:
break;
case ID_FF_BUTTON:
// With shift
commands.push_back( {
wxT("SelEnd"), XO("Select to End") } );
break;
case ID_REW_BUTTON:
// With shift
commands.push_back( {
wxT("SelStart"), XO("Select to Start") } );
break;
} }
ToolBar::SetButtonToolTip( ToolBar::SetButtonToolTip(
mProject, *pCtrl, commands.data(), commands.size()); mProject, *pCtrl, commands.data(), commands.size());
@ -377,11 +383,11 @@ void ControlToolBar::ArrangeButtons()
mRewind->MoveBeforeInTabOrder( mRecord ); mRewind->MoveBeforeInTabOrder( mRecord );
mFF->MoveBeforeInTabOrder( mRecord ); mFF->MoveBeforeInTabOrder( mRecord );
mSizer->Add( mPause, 0, flags, 2 );
mSizer->Add( mPlay, 0, flags, 2 );
mSizer->Add( mStop, 0, flags, 2 );
mSizer->Add( mRewind, 0, flags, 2 ); mSizer->Add( mRewind, 0, flags, 2 );
mSizer->Add( mFF, 0, flags, 10 ); mSizer->Add( mFF, 0, flags, 10 );
mSizer->Add( mStop, 0, flags, 2 );
mSizer->Add( mPlay, 0, flags, 2 );
mSizer->Add( mPause, 0, flags, 2 );
mSizer->Add( mRecord, 0, flags, 5 ); mSizer->Add( mRecord, 0, flags, 5 );
} }
else else

View File

@ -99,23 +99,25 @@ class TENACITY_DLL_API ControlToolBar final : public ToolBar {
void ArrangeButtons(); void ArrangeButtons();
TranslatableString StateForStatusBar(); TranslatableString StateForStatusBar();
// Sorted in order of appearance, not alphabetically
enum enum
{ {
ID_PAUSE_BUTTON = 11000,
ID_PLAY_BUTTON,
ID_STOP_BUTTON,
ID_FF_BUTTON,
ID_REW_BUTTON, ID_REW_BUTTON,
ID_FF_BUTTON,
ID_STOP_BUTTON,
ID_PLAY_BUTTON,
ID_PAUSE_BUTTON = 11000,
ID_RECORD_BUTTON, ID_RECORD_BUTTON,
BUTTON_COUNT, BUTTON_COUNT,
}; };
AButton *mRewind; AButton *mRewind;
AButton *mPlay;
AButton *mRecord;
AButton *mPause;
AButton *mStop;
AButton *mFF; AButton *mFF;
AButton *mStop;
AButton *mPlay;
AButton *mPause;
AButton *mRecord;
// Activate ergonomic order for transport buttons // Activate ergonomic order for transport buttons
bool mErgonomicTransportButtons; bool mErgonomicTransportButtons;