Add preference for Record being to new track.

This commit is contained in:
James Crook 2017-05-01 11:46:12 +01:00
parent 623d0f29bf
commit 9d501f69d6
9 changed files with 66 additions and 31 deletions

View File

@ -65,12 +65,14 @@ from there. Audacity will look for a file called "Pause.png".
DEFINE_IMAGE( bmpRecordDisabled, wxImage( 16, 16 ), wxT("RecordDisabled"));
DEFINE_IMAGE( bmpCutPreview, wxImage( 16, 16 ), wxT("CutPreview"));
DEFINE_IMAGE( bmpCutPreviewDisabled, wxImage( 16, 16 ), wxT("CutPreviewDisabled"));
DEFINE_IMAGE( bmpAppendRecord, wxImage( 16, 16 ), wxT("AppendRecord"));
DEFINE_IMAGE( bmpAppendRecordDisabled, wxImage( 16, 16 ), wxT("AppendRecordDisabled"));
DEFINE_IMAGE( bmpRecordBelow, wxImage( 16, 16 ), wxT("RecordBelow"));
DEFINE_IMAGE( bmpRecordBelowDisabled, wxImage( 16, 16 ), wxT("RecordBelowDisabled"));
DEFINE_IMAGE( bmpScrub, wxImage( 18, 16 ), wxT("Scrub"));
DEFINE_IMAGE( bmpScrubDisabled, wxImage( 18, 16 ), wxT("ScrubDisabled"));
DEFINE_IMAGE( bmpSeek, wxImage( 26, 16 ), wxT("Seek"));
DEFINE_IMAGE( bmpSeekDisabled, wxImage( 26, 16 ), wxT("SeekDisabled"));
DEFINE_IMAGE( bmpRecordBeside, wxImage( 16, 16 ), wxT("RecordBeside"));
DEFINE_IMAGE( bmpRecordBesideDisabled, wxImage( 16, 16 ), wxT("RecordBesideDisabled"));
SET_THEME_FLAGS( resFlagNone );

View File

@ -819,18 +819,19 @@ void AudacityProject::CreateMenusAndCommands()
c->SetDefaultFlags(AudioIONotBusyFlag | CanStopAudioStreamFlag,
AudioIONotBusyFlag | CanStopAudioStreamFlag);
/* i18n-hint: (verb)*/
c->AddItem(wxT("RecordBeside"), _("&Record"), FN(OnRecord), wxT("R"));
// The OnRecordBelow function is actually 'record-other', i.e. if normal record records beside,
c->AddItem(wxT("Record1stChoice"), _("&Record"), FN(OnRecord), wxT("R"));
// The OnRecord2ndChoice function is: if normal record records beside,
// it records below, if normal record records below, it records beside.
// TODO: fix the naming, and also check we do 'the right thing' with other options like
// TimerRecord.
// PREFER_NEW_TRACKS is defined if we want the old behaviour of by default adding a new track on
// every new recording.
#ifndef PREFER_NEW_TRACKS
c->AddItem(wxT("RecordBelow"), _("Record &New Track"), FN(OnRecordBelow), wxT("Shift+R"));
#else
c->AddItem(wxT("RecordBelow"), _("Record Beside"), FN(OnRecordBelow), wxT("Shift+R"));
#endif
// TODO: Do 'the right thing' with other options like TimerRecord.
bool bPreferAppend;
gPrefs->Read("/GUI/PreferAppendRecord",&bPreferAppend, true);
c->AddItem( wxT("Record2ndChoice"),
// Our first choice is bound to R (by default) and gets the prime position.
// We supply the name for the 'other one' here. It should be bound to Shift+R
bPreferAppend ? _("Record &New Track") : _("&Append Record"),
FN(OnRecord2ndChoice),
wxT("Shift+R")
);
c->AddItem(wxT("TimerRecord"), _("&Timer Record..."), FN(OnTimerRecord), wxT("Shift+T"));
// JKC: I decided to duplicate this between play and record, rather than put it
@ -2592,7 +2593,9 @@ void AudacityProject::OnRecord()
GetControlToolBar()->OnRecord(evt);
}
void AudacityProject::OnRecordBelow()
// If first choice is record same track 2nd choice is record new track
// and vice versa.
void AudacityProject::OnRecord2ndChoice()
{
wxCommandEvent evt;
evt.SetInt(1); // 0 is default, use 1 to set shift on, 2 to clear it

View File

@ -70,7 +70,7 @@ public:
void OnStop();
void OnPause();
void OnRecord();
void OnRecordBelow();
void OnRecord2ndChoice();
void OnStopSelect();
void OnSkipStart();
void OnSkipEnd();

View File

@ -231,6 +231,7 @@ void Theme::EnsureInitialised()
#endif
LoadPreferredTheme();
}
bool ThemeBase::LoadPreferredTheme()
@ -323,6 +324,9 @@ void ThemeBase::LoadTheme( teThemeType Theme )
#endif
}
RotateImageInto( bmpRecordBeside, bmpRecordBelow, false );
RotateImageInto( bmpRecordBesideDisabled, bmpRecordBelowDisabled, false );
if( bRecolourOnLoad )
RecolourTheme();
@ -1220,4 +1224,9 @@ void ThemeBase::ReplaceImage( int iIndex, wxImage * pImage )
Bitmap( iIndex ) = wxBitmap( *pImage );
}
void ThemeBase::RotateImageInto( int iTo, int iFrom, bool bClockwise )
{
wxImage img(theTheme.Bitmap( iFrom ).ConvertToImage() );
wxImage img2 = img.Rotate90( bClockwise );
ReplaceImage( iTo, &img2 );
}

View File

@ -132,6 +132,7 @@ public:
bool bIsUsingSystemTextColour;
void ReplaceImage( int iIndex, wxImage * pImage );
void RotateImageInto( int iTo, int iFrom, bool bClockwise );
void SetBrushColour( wxBrush & Brush, int iIndex );
void SetPenColour( wxPen & Pen, int iIndex );

View File

@ -220,9 +220,7 @@ bool GUIPrefs::Apply()
gPrefs->Write(wxT("/Locale/Language"), usedLang);
gPrefs->Flush();
}
// Reads preference /GUI/Theme
theTheme.LoadPreferredTheme();
theTheme.ApplyUpdatedImages();
return true;
}

View File

@ -69,6 +69,8 @@
#include "MidiIOPrefs.h"
#endif
#include "../Theme.h"
BEGIN_EVENT_TABLE(PrefsDialog, wxDialogWrapper)
EVT_BUTTON(wxID_OK, PrefsDialog::OnOK)
EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel)
@ -412,6 +414,10 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
gPrefs->Flush();
// Reads preference /GUI/Theme
theTheme.LoadPreferredTheme();
theTheme.ApplyUpdatedImages();
SavePreferredPage();
#if USE_PORTMIXER

View File

@ -63,6 +63,9 @@ void TracksBehaviorsPrefs::PopulateOrExchange(ShuttleGui & S)
S.TieCheckBox(_("&Select then act on entire project, if no audio selected"),
wxT("/GUI/SelectAllOnNone"),
true);
S.TieCheckBox(_("Append recordings to same track, by default"),
wxT("/GUI/PreferAppendRecord"),
true);
/* i18n-hint: cut-lines are a lines indicating where to cut.*/
S.TieCheckBox(_("Enable cut &lines"),
wxT("/GUI/EnableCutLines"),

View File

@ -193,8 +193,16 @@ void ControlToolBar::Populate()
mRecord = MakeButton(bmpRecord, bmpRecord, bmpRecordDisabled,
ID_RECORD_BUTTON, true, _("Record"));
MakeAlternateImages(*mRecord, 1, bmpAppendRecord, bmpAppendRecord,
bmpAppendRecordDisabled);
bool bPreferAppend;
gPrefs->Read("/GUI/PreferAppendRecord",&bPreferAppend, true);
if( bPreferAppend )
MakeAlternateImages(*mRecord, 1, bmpRecordBelow, bmpRecordBelow,
bmpRecordBelowDisabled);
else
MakeAlternateImages(*mRecord, 1, bmpRecordBeside, bmpRecordBeside,
bmpRecordBesideDisabled);
mRecord->FollowModifierKeys();
#if wxUSE_TOOLTIPS
@ -228,13 +236,16 @@ void ControlToolBar::RegenerateTooltips()
case ID_RECORD_BUTTON:
// Without shift
commands.push_back(wxT("Record"));
#ifdef PREFER_NEW_TRACKS
commands.push_back(_("Append Record"));
commands.push_back(wxT("RecordAppend"));
#else
commands.push_back(_("Record New Track"));
commands.push_back(wxT("RecordBelow"));
#endif
{ bool bPreferAppend;
gPrefs->Read("/GUI/PreferAppendRecord",&bPreferAppend, true);
if( bPreferAppend ){
commands.push_back(_("Record New Track"));
commands.push_back(wxT("RecordBelow"));
} else {
commands.push_back(_("Append Record"));
commands.push_back(wxT("RecordAppend"));
}
}
break;
case ID_PAUSE_BUTTON:
commands.push_back(wxT("Pause"));
@ -874,9 +885,11 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
bool success = false;
bool shifted = mRecord->WasShiftDown();
#ifndef PREFER_NEW_TRACKS
shifted = !shifted;
#endif
bool bPreferAppend;
gPrefs->Read("/GUI/PreferAppendRecord",&bPreferAppend, true);
if( bPreferAppend )
shifted = !shifted;
TrackList *trackList = p->GetTracks();
TrackList tracksCopy{};