mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-08 15:52:53 +02:00
Merge branch 'master' of https://github.com/audacity/audacity
This commit is contained in:
commit
c699bbda78
@ -36,6 +36,7 @@ exec( inner( 'envelopes' ) )
|
||||
exec( inner( 'cut_n_paste' ) )
|
||||
exec( inner( 'clip_boundaries' ) )
|
||||
exec( inner( 'oddments' ) )
|
||||
exec( inner( 'named_tracks' ) )
|
||||
|
||||
#report on timing.
|
||||
inner( "" )
|
||||
|
92
scripts/piped-work/docimages_named_tracks.py
Normal file
92
scripts/piped-work/docimages_named_tracks.py
Normal file
@ -0,0 +1,92 @@
|
||||
# docimages_named_tracks.py
|
||||
# Sends commands to get images for the manual.
|
||||
# Images for https://alphamanual.audacityteam.org/man/Audio_Tracks
|
||||
|
||||
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
||||
# before running this script.
|
||||
|
||||
|
||||
#load and run the common core.
|
||||
exec( open("docimages_core.py" ).read() )
|
||||
|
||||
import time
|
||||
|
||||
|
||||
def ntrack_stereo() :
|
||||
loadStereoTrack()
|
||||
# A stereo track, with its name on the track
|
||||
capture( 'AutoTracks002.png', 'First_Track' )
|
||||
# A stereo track, with different sized channels
|
||||
do( 'SetTrack: Channel=0 Height=80')
|
||||
do( 'SetTrack: Channel=1 Height=80')
|
||||
do( 'SetTrack: Name="Voodoo Child (Slight Return)' )
|
||||
capture( 'Audio Track with track name superimposed.png', 'All_Tracks' )
|
||||
|
||||
# Four colours of track
|
||||
def ntrack_colour() :
|
||||
loadMonoTracks( 4 )
|
||||
do( 'SetTrack: Track=0 Name="Instrument 1 colorway" Height=90 Color=Color0')
|
||||
do( 'SetTrack: Track=1 Name="Instrument 2 colorway" Height=90 Color=Color1')
|
||||
do( 'SetTrack: Track=2 Name="Instrument 3 colorway" Height=90 Color=Color2')
|
||||
do( 'SetTrack: Track=3 Name="Instrument 4 colorway" Height=90 Color=Color3')
|
||||
do( 'Select: First=0 Last=3 Start=50 End=70')
|
||||
capture( 'Waveform colorways.png', 'All_Tracks' )
|
||||
|
||||
# Showing the pin...
|
||||
def ntrack_pinned() :
|
||||
loadMonoTracks( 1 )
|
||||
do( 'SetTrack: Name="Waveform moving this way <==' )
|
||||
do( 'SetPreference: Name="/AudioIO/PinnedHead" Value=1 Reload=1')
|
||||
do( 'Play' )
|
||||
time.sleep( 1 )
|
||||
capture( 'Pinned head playback annotated trackname.png', 'All_Tracks_Plus' )
|
||||
do( 'Stop')
|
||||
do( 'SetPreference: Name="/AudioIO/PinnedHead" Value=0 Reload=1')
|
||||
|
||||
def ntrack_punch():
|
||||
loadMonoTracks(2)
|
||||
do( 'AddLabelTrack' )
|
||||
|
||||
#create the end result
|
||||
do('Select: First=1 Last=1 Start=50 End=70')
|
||||
do('SplitNew')
|
||||
|
||||
do( 'SetTrack: Track=0 Name="Backup of Original" Height=90')
|
||||
do( 'SetTrack: Track=1 Name="Original Recording" Height=90')
|
||||
do( 'Select: First=0 Last=0' )
|
||||
#show a messed up original...
|
||||
do( 'Distortion' )
|
||||
do( 'WahWah' )
|
||||
|
||||
do( 'Select: First=2 Last=2 Start=40 End=80' )
|
||||
do( 'Duplicate' )
|
||||
do( 'Select: First=2 Last=2 Start=40 End=80' )
|
||||
do( 'Silence' )
|
||||
# Just to get silence before and after.
|
||||
do( 'Select: First=2 Last=3 Start=40 End=80' )
|
||||
do( 'MixAndRender' )
|
||||
do( 'SetTrack: Track=2 Name="Punched in" Height=90')
|
||||
do( 'Select: First=2 Last=2 Start=50 End=70' )
|
||||
do( 'AddLabel' )
|
||||
do( 'SetTrack: Track=3 Focused=1')
|
||||
do( 'TrackMoveUp' )
|
||||
do( 'SetTrack: Track=0 Mute=1')
|
||||
do( 'SetLabel: Text="Bad Part" Selected=0')
|
||||
do( 'Select: First=1 Last=1 Start=40 End=80' )
|
||||
|
||||
#work backwards from the end result...
|
||||
capture( 'Punch-in tracks002.png', 'All_Tracks' )
|
||||
do( 'Select: First=3 Last=3 Start=40 End=80' )
|
||||
do( 'RemoveTracks')
|
||||
do( 'SetTrack: Track=1 Solo=1')
|
||||
do( 'Select: First=1 Last=1 Start=40 End=80' )
|
||||
capture( 'Punch-in tracks001.png', 'All_Tracks' )
|
||||
do( 'Select: First=1 Last=1 Start=50 End=70' )
|
||||
capture( 'Punch-in tracks000.png', 'All_Tracks' )
|
||||
|
||||
imageSet("NamedTracks")
|
||||
do( 'SetPreference: Name="/GUI/ShowTrackNameInWaveform" Value=1')
|
||||
ntrack_stereo()
|
||||
ntrack_colour()
|
||||
ntrack_pinned()
|
||||
ntrack_punch()
|
@ -87,19 +87,13 @@ static const std::pair<const wxChar*, const wxChar*> SpecialCommands[] = {
|
||||
};
|
||||
// end CLEANSPEECH remnant
|
||||
|
||||
static const wxString MP3Conversion = wxT("MP3 Conversion");
|
||||
static const wxString FadeEnds = wxT("Fade Ends");
|
||||
|
||||
MacroCommands::MacroCommands()
|
||||
{
|
||||
mMessage = "";
|
||||
ResetMacro();
|
||||
|
||||
wxArrayString names = GetNames();
|
||||
|
||||
wxArrayString defaults;
|
||||
defaults.Add( MP3Conversion );
|
||||
defaults.Add( FadeEnds );
|
||||
wxArrayString defaults = GetNamesOfDefaultMacros();
|
||||
|
||||
for( size_t i = 0;i<defaults.Count();i++){
|
||||
wxString name = defaults[i];
|
||||
@ -111,6 +105,18 @@ MacroCommands::MacroCommands()
|
||||
}
|
||||
}
|
||||
|
||||
static const wxString MP3Conversion = wxT("MP3 Conversion");
|
||||
static const wxString FadeEnds = wxT("Fade Ends");
|
||||
|
||||
|
||||
wxArrayString MacroCommands::GetNamesOfDefaultMacros()
|
||||
{
|
||||
wxArrayString defaults;
|
||||
defaults.Add( MP3Conversion );
|
||||
defaults.Add( FadeEnds );
|
||||
return defaults;
|
||||
}
|
||||
|
||||
void MacroCommands::RestoreMacro(const wxString & name)
|
||||
{
|
||||
// TIDY-ME: Effects change their name with localisation.
|
||||
@ -120,11 +126,11 @@ void MacroCommands::RestoreMacro(const wxString & name)
|
||||
AddToMacro( wxT("Normalize") );
|
||||
AddToMacro( wxT("ExportMP3") );
|
||||
} else if (name == FadeEnds ){
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"1\"") );
|
||||
AddToMacro( wxT("Select"), wxT("Start=\"0\" End=\"1\"") );
|
||||
AddToMacro( wxT("FadeIn") );
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"1\" FromEnd=\"1\"") );
|
||||
AddToMacro( wxT("Select"), wxT("Start=\"0\" End=\"1\" FromEnd=\"1\"") );
|
||||
AddToMacro( wxT("FadeOut") );
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"0\"") );
|
||||
AddToMacro( wxT("Select"), wxT("Start=\"0\" End=\"0\"") );
|
||||
}
|
||||
}
|
||||
|
||||
@ -745,16 +751,27 @@ bool MacroCommands::ApplyCommandInBatchMode(const wxString & command, const wxSt
|
||||
return ApplyCommand( command, params );
|
||||
}
|
||||
|
||||
static int MacroReentryCount = 0;
|
||||
// ApplyMacro returns true on success, false otherwise.
|
||||
// Any error reporting to the user in setting up the chain
|
||||
// has already been done.
|
||||
bool MacroCommands::ApplyMacro(const wxString & filename)
|
||||
{
|
||||
// Check for reentrant ApplyMacro commands.
|
||||
// We'll allow 1 level of reentry, but not more.
|
||||
// And we treat ignoring deeper levels as a success.
|
||||
if( MacroReentryCount > 1 )
|
||||
return true;
|
||||
|
||||
// Restore the reentry counter (to zero) when we exit.
|
||||
auto cleanup1 = valueRestorer( MacroReentryCount);
|
||||
MacroReentryCount++;
|
||||
|
||||
mFileName = filename;
|
||||
|
||||
AudacityProject *proj = GetActiveProject();
|
||||
bool res = false;
|
||||
auto cleanup = finally( [&] {
|
||||
auto cleanup2 = finally( [&] {
|
||||
if (!res) {
|
||||
if(proj) {
|
||||
// Macro failed or was cancelled; revert to the previous state
|
||||
@ -795,7 +812,8 @@ bool MacroCommands::ApplyMacro(const wxString & filename)
|
||||
|
||||
if (!proj)
|
||||
return false;
|
||||
proj->PushState(longDesc, shortDesc);
|
||||
if( MacroReentryCount <= 1 )
|
||||
proj->PushState(longDesc, shortDesc);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -877,13 +895,12 @@ wxArrayString MacroCommands::GetNames()
|
||||
|
||||
bool MacroCommands::IsFixed(const wxString & name)
|
||||
{
|
||||
if (name == MP3Conversion)
|
||||
wxArrayString defaults = GetNamesOfDefaultMacros();
|
||||
if( defaults.Index( name ) != wxNOT_FOUND )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MacroCommands::Split(const wxString & str, wxString & command, wxString & param)
|
||||
{
|
||||
int splitAt;
|
||||
|
@ -42,6 +42,7 @@ class MacroCommands final {
|
||||
|
||||
// These commands do not depend on the command list.
|
||||
static wxArrayString GetNames();
|
||||
static wxArrayString GetNamesOfDefaultMacros();
|
||||
|
||||
// A triple of user-visible name, internal string identifier and type/help string.
|
||||
using CommandName = std::tuple<wxString, wxString, wxString>;
|
||||
|
@ -123,6 +123,14 @@ void ApplyMacroDialog::PopulateOrExchange(ShuttleGui &S)
|
||||
S.Id(ExpandID).AddButton(_("&Expand"));
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
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.StartStatic(_("&Select Macro"), true);
|
||||
{
|
||||
@ -132,14 +140,8 @@ void ApplyMacroDialog::PopulateOrExchange(ShuttleGui &S)
|
||||
mMacros->InsertColumn(0, _("Macro"), wxLIST_FORMAT_LEFT);
|
||||
}
|
||||
S.EndStatic();
|
||||
|
||||
S.StartHorizontalLay(wxALIGN_RIGHT, false);
|
||||
{
|
||||
S.SetBorder(10);
|
||||
S.AddPrompt( _("Apply Macro to:") );
|
||||
S.Id(ApplyToProjectID).AddButton(_("&Project"));
|
||||
S.Id(ApplyToFilesID).AddButton(_("&Files..."));
|
||||
S.AddSpace( 40 );
|
||||
S.AddStandardButtons( eCancelButton | eHelpButton);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
@ -190,6 +192,28 @@ void ApplyMacroDialog::OnApplyToProject(wxCommandEvent & WXUNUSED(event))
|
||||
ApplyMacroToProject( item );
|
||||
}
|
||||
|
||||
wxString ApplyMacroDialog::MacroIdOfName( const wxString & MacroName )
|
||||
{
|
||||
wxString Temp = MacroName;
|
||||
Temp.Replace(" ","");
|
||||
Temp = wxString( "Macro_" ) + Temp;
|
||||
return Temp;
|
||||
}
|
||||
|
||||
// Apply macro, given its ID.
|
||||
// Does nothing if not found, rather than returning an error.
|
||||
void ApplyMacroDialog::ApplyMacroToProject( const wxString & MacroID, bool bHasGui )
|
||||
{
|
||||
for( size_t i=0;i<mMacros->GetItemCount();i++){
|
||||
wxString name = mMacros->GetItemText(i);
|
||||
if( MacroIdOfName( name ) == MacroID ){
|
||||
ApplyMacroToProject( i, bHasGui );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply macro, given its number in the list.
|
||||
void ApplyMacroDialog::ApplyMacroToProject( int iMacro, bool bHasGui )
|
||||
{
|
||||
wxString name = mMacros->GetItemText(iMacro);
|
||||
@ -501,9 +525,9 @@ MacrosWindow::MacrosWindow(wxWindow * parent, bool bExpanded):
|
||||
ApplyMacroDialog(parent, true)
|
||||
{
|
||||
mbExpanded = bExpanded;
|
||||
SetLabel(_("Macros")); // Provide visual label
|
||||
SetName(_("Macros")); // Provide audible label
|
||||
SetTitle(_("Macros"));
|
||||
SetLabel(_("Edit Macros")); // Provide visual label
|
||||
SetName(_("Edit Macros")); // Provide audible label
|
||||
SetTitle(_("Edit Macros"));
|
||||
|
||||
mChanged = false;
|
||||
mSelectedCommand = 0;
|
||||
@ -563,10 +587,18 @@ void MacrosWindow::PopulateOrExchange(ShuttleGui & S)
|
||||
{
|
||||
S.Prop(0).StartHorizontalLay(wxALIGN_RIGHT, false);
|
||||
{
|
||||
S.Id(ShrinkID).AddButton(_("&Shrink"));
|
||||
S.Id(ShrinkID).AddButton(_("Shrin&k"));
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
S.StartStatic(_("&Macros"),1);
|
||||
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.StartStatic(_("&Select Macros"),1);
|
||||
{
|
||||
S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_SINGLE_SEL |
|
||||
wxLC_EDIT_LABELS);
|
||||
@ -587,7 +619,7 @@ void MacrosWindow::PopulateOrExchange(ShuttleGui & S)
|
||||
|
||||
S.StartVerticalLay( 1 );
|
||||
{
|
||||
S.StartStatic(_("Ma&cro (Double-Click or press SPACE to edit)"), true);
|
||||
S.StartStatic(_("&Macro (Double-Click or press SPACE to edit)"), true);
|
||||
{
|
||||
S.StartHorizontalLay(wxEXPAND,1);
|
||||
{
|
||||
@ -620,10 +652,6 @@ void MacrosWindow::PopulateOrExchange(ShuttleGui & S)
|
||||
S.EndStatic();
|
||||
S.StartHorizontalLay(wxALIGN_RIGHT, false);
|
||||
{
|
||||
S.AddPrompt( _("Apply Macro to:") );
|
||||
S.Id(ApplyToProjectButtonID).AddButton(_("&Project"), wxALIGN_LEFT);
|
||||
S.Id(ApplyToFilesButtonID).AddButton(_("&Files..."), wxALIGN_LEFT);
|
||||
S.AddSpace( 40 );
|
||||
S.AddStandardButtons( eOkButton | eCancelButton | eHelpButton);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
@ -684,6 +712,10 @@ void MacrosWindow::UpdateDisplay( bool bExpanded )
|
||||
{
|
||||
if( bExpanded == mbExpanded )
|
||||
return;
|
||||
|
||||
if( !SaveChanges() )
|
||||
return;
|
||||
|
||||
mbExpanded = bExpanded;
|
||||
DestroyChildren();
|
||||
SetSizer( nullptr );
|
||||
@ -692,10 +724,22 @@ void MacrosWindow::UpdateDisplay( bool bExpanded )
|
||||
mSelectedCommand = 0;
|
||||
SetMinSize( wxSize( 200,200 ));
|
||||
|
||||
// Get and set position for optical stability.
|
||||
// Expanded and shrunk dialogs 'stay where they were'.
|
||||
// That's OK , and what we want, even if we exapnd off-screen.
|
||||
// We won't shrink to being off-screen, since the shrink button
|
||||
// was clicked, so must have been on screen.
|
||||
wxPoint p = GetPosition( );
|
||||
if( mbExpanded )
|
||||
Populate();
|
||||
else
|
||||
ApplyMacroDialog::Populate();
|
||||
SetPosition( p );
|
||||
|
||||
wxString Title = mbExpanded ? _("Edit Macros") : _("Apply Macro");
|
||||
SetLabel( Title ); // Provide visual label
|
||||
SetName( Title ); // Provide audible label
|
||||
SetTitle( Title );
|
||||
}
|
||||
|
||||
void MacrosWindow::OnExpand(wxCommandEvent &WXUNUSED(event))
|
||||
|
@ -56,7 +56,9 @@ class ApplyMacroDialog : public wxDialogWrapper {
|
||||
virtual wxString GetHelpPageName() {return "Tools_Menu#macros_compact_dialog";};
|
||||
|
||||
void PopulateMacros();
|
||||
static wxString MacroIdOfName( const wxString & MacroName );
|
||||
void ApplyMacroToProject( int iMacro, bool bHasGui=true );
|
||||
void ApplyMacroToProject( const wxString & MacroID, bool bHasGui=true );
|
||||
|
||||
|
||||
// These will be reused in the derived class...
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "ViewInfo.h"
|
||||
#include "widgets/NumericTextCtrl.h"
|
||||
#include "widgets/ErrorDialog.h"
|
||||
#include "widgets/HelpSystem.h"
|
||||
|
||||
#include "FileNames.h"
|
||||
#include <limits>
|
||||
@ -87,6 +88,7 @@ BEGIN_EVENT_TABLE(LabelDialog, wxDialogWrapper)
|
||||
EVT_COMMAND(wxID_ANY, EVT_TIMETEXTCTRL_UPDATED, LabelDialog::OnUpdate)
|
||||
EVT_COMMAND(wxID_ANY, EVT_FREQUENCYTEXTCTRL_UPDATED,
|
||||
LabelDialog::OnFreqUpdate)
|
||||
EVT_BUTTON(wxID_HELP, LabelDialog::OnHelp)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
LabelDialog::LabelDialog(wxWindow *parent,
|
||||
@ -113,44 +115,15 @@ LabelDialog::LabelDialog(wxWindow *parent,
|
||||
, mFreqFormat(freqFormat)
|
||||
{
|
||||
SetName(GetTitle());
|
||||
Populate();
|
||||
}
|
||||
|
||||
{
|
||||
// Create the main sizer
|
||||
auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
|
||||
// A little instruction
|
||||
wxStaticText *instruct =
|
||||
safenew wxStaticText(this,
|
||||
wxID_ANY,
|
||||
_("Press F2 or double click to edit cell contents."));
|
||||
instruct->SetName(instruct->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
|
||||
vs->Add(instruct,
|
||||
0,
|
||||
wxALIGN_LEFT | wxALL,
|
||||
5);
|
||||
|
||||
// Create the main sizer
|
||||
mGrid = safenew Grid(this, wxID_ANY);
|
||||
vs->Add(mGrid, 1, wxEXPAND | wxALL, 5);
|
||||
|
||||
// Create the action buttons
|
||||
{
|
||||
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
hs->Add(safenew wxButton(this, ID_INSERTA, _("Insert &After")), 1, wxCENTER | wxALL, 5);
|
||||
hs->Add(safenew wxButton(this, ID_INSERTB, _("Insert &Before")), 1, wxCENTER | wxALL, 5);
|
||||
hs->Add(safenew wxButton(this, ID_REMOVE, _("&Remove")), 1, wxCENTER | wxALL, 5);
|
||||
hs->Add(safenew wxButton(this, ID_IMPORT, _("&Import...")), 1, wxCENTER | wxALL, 5);
|
||||
hs->Add(safenew wxButton(this, ID_EXPORT, _("&Export...")), 1, wxCENTER | wxALL, 5);
|
||||
vs->Add(hs.release(), 0, wxEXPAND | wxCENTER | wxALL, 5);
|
||||
}
|
||||
|
||||
// Create the exit buttons
|
||||
vs->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND);
|
||||
|
||||
// Make it so
|
||||
SetSizer(vs.release());
|
||||
}
|
||||
LabelDialog::~LabelDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void LabelDialog::PopulateLabels()
|
||||
{
|
||||
// Build the initial (empty) grid
|
||||
mGrid->CreateGrid(0, Col_Max);
|
||||
mGrid->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
|
||||
@ -227,13 +200,36 @@ LabelDialog::LabelDialog(wxWindow *parent,
|
||||
mGrid->SetColSize(Col_Label, wxMax(150, mGrid->GetColSize(Col_Label)));
|
||||
mGrid->SetColMinimalWidth(Col_Label, mGrid->GetColSize(Col_Label));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Creates the dialog and its contents.
|
||||
void LabelDialog::Populate()
|
||||
{
|
||||
|
||||
//------------------------- Main section --------------------
|
||||
ShuttleGui S(this, eIsCreating);
|
||||
PopulateOrExchange(S);
|
||||
// ----------------------- End of main section --------------
|
||||
|
||||
// Go populate the macros list.
|
||||
PopulateLabels();
|
||||
|
||||
// Layout the works
|
||||
Layout();
|
||||
//Fit();
|
||||
|
||||
// Resize width based on width of columns and the vertical scrollbar
|
||||
wxRect r = mGrid->GetGridColLabelWindow()->GetRect();
|
||||
wxScrollBar sb(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL);
|
||||
r.width += sb.GetSize().GetWidth() + 6;
|
||||
|
||||
// Add the size of the right column of buttons too...
|
||||
wxWindow * w = FindWindowById( ID_IMPORT, this );
|
||||
wxASSERT( w );
|
||||
if( w )
|
||||
r.width += w->GetSize().GetWidth();
|
||||
|
||||
SetClientSize(r.width, 300);
|
||||
|
||||
// Make sure it doesn't go below this size
|
||||
@ -242,12 +238,52 @@ LabelDialog::LabelDialog(wxWindow *parent,
|
||||
|
||||
// Center on display
|
||||
Center();
|
||||
|
||||
// Size and place window
|
||||
// SetSize(wxSystemSettings::GetMetric(wxSYS_SCREEN_X) * 3 / 4,
|
||||
// wxSystemSettings::GetMetric(wxSYS_SCREEN_Y) * 4 / 5);
|
||||
// Center();
|
||||
|
||||
}
|
||||
|
||||
LabelDialog::~LabelDialog()
|
||||
void LabelDialog::PopulateOrExchange( ShuttleGui & S )
|
||||
{
|
||||
S.AddFixedText(_("Press F2 or double click to edit cell contents."));
|
||||
S.StartHorizontalLay(wxEXPAND,1);
|
||||
{
|
||||
S.StartVerticalLay(wxEXPAND,1);
|
||||
{
|
||||
mGrid = safenew Grid(this, wxID_ANY);
|
||||
S.Prop(1).AddWindow( mGrid );
|
||||
}
|
||||
S.EndVerticalLay();
|
||||
S.StartVerticalLay(0);
|
||||
{
|
||||
//S.Id(ID_INSERTA).AddButton(_("&Insert"), wxALIGN_LEFT);
|
||||
S.Id(ID_INSERTB).AddButton(_("&Insert"), wxALIGN_LEFT);
|
||||
//S.Id(EditButtonID).AddButton(_("&Edit"), wxALIGN_LEFT);
|
||||
S.Id(ID_REMOVE).AddButton(_("De&lete"), wxALIGN_LEFT);
|
||||
S.Id(ID_IMPORT).AddButton(_("I&mport..."), wxALIGN_LEFT);
|
||||
S.Id(ID_EXPORT).AddButton(_("&Export..."), wxALIGN_LEFT);
|
||||
}
|
||||
S.EndVerticalLay();
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
|
||||
S.StartHorizontalLay(wxALIGN_RIGHT, false);
|
||||
{
|
||||
S.AddStandardButtons( eOkButton | eCancelButton | eHelpButton);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
}
|
||||
|
||||
void LabelDialog::OnHelp(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
wxString page = GetHelpPageName();
|
||||
HelpSystem::ShowHelp(this, page, true);
|
||||
}
|
||||
|
||||
|
||||
bool LabelDialog::TransferDataToWindow()
|
||||
{
|
||||
int cnt = mData.size();
|
||||
|
@ -27,6 +27,7 @@ class RowData;
|
||||
class EmptyLabelRenderer;
|
||||
class LabelTrack;
|
||||
class ViewInfo;
|
||||
class ShuttleGui;
|
||||
|
||||
typedef std::vector<RowData> RowDataArray;
|
||||
|
||||
@ -54,6 +55,12 @@ class LabelDialog final : public wxDialogWrapper
|
||||
|
||||
private:
|
||||
|
||||
void Populate();
|
||||
void PopulateOrExchange( ShuttleGui & S );
|
||||
void PopulateLabels();
|
||||
virtual void OnHelp(wxCommandEvent & event);
|
||||
virtual wxString GetHelpPageName() {return "Labels_Editor";};
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
bool Validate();
|
||||
|
@ -1713,7 +1713,8 @@ void AudacityProject::PopulateMacrosMenu( CommandManager* c, CommandFlag flags
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (int)names.GetCount(); i++) {
|
||||
c->AddItem(wxString::Format("Macro%03i", i ), names[i], FN(OnApplyMacroDirectly),
|
||||
wxString MacroID = ApplyMacroDialog::MacroIdOfName( names[i] );
|
||||
c->AddItem(MacroID, names[i], FN(OnApplyMacroDirectly),
|
||||
flags,
|
||||
flags);
|
||||
}
|
||||
@ -6860,10 +6861,17 @@ void AudacityProject::OnApplyMacroDirectly(const CommandContext &context )
|
||||
//wxLogDebug( "Macro was: %s", context.parameter);
|
||||
ApplyMacroDialog dlg(this);
|
||||
wxString Name = context.parameter;
|
||||
|
||||
// We used numbers previously, but macros could get renumbered, making
|
||||
// macros containing macros unpredictable.
|
||||
#ifdef MACROS_BY_NUMBERS
|
||||
long item=0;
|
||||
// Take last three letters (of e.g. Macro007) and convert to a number.
|
||||
Name.Mid( Name.Length() - 3 ).ToLong( &item, 10 );
|
||||
dlg.ApplyMacroToProject( item, false );
|
||||
#else
|
||||
dlg.ApplyMacroToProject( Name, false );
|
||||
#endif
|
||||
ModifyUndoMenuItems();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user