mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-01 06:33:53 +01:00
Bug 1872 - Most Non-Modal dialogs do not update buttons when language changed
This commit is contained in:
@@ -294,3 +294,16 @@ void AudacityLogger::OnSave(wxCommandEvent & WXUNUSED(e))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudacityLogger::UpdatePrefs()
|
||||||
|
{
|
||||||
|
if (mFrame) {
|
||||||
|
bool shown = mFrame->IsShown();
|
||||||
|
if (shown) {
|
||||||
|
Show(false);
|
||||||
|
}
|
||||||
|
mFrame.reset();
|
||||||
|
if (shown) {
|
||||||
|
Show(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,13 +19,17 @@
|
|||||||
#include "Experimental.h"
|
#include "Experimental.h"
|
||||||
|
|
||||||
#include "MemoryX.h"
|
#include "MemoryX.h"
|
||||||
|
#include "Prefs.h"
|
||||||
#include <wx/log.h> // to inherit
|
#include <wx/log.h> // to inherit
|
||||||
#include <wx/event.h> // to inherit wxEvtHandler
|
#include <wx/event.h> // to inherit wxEvtHandler
|
||||||
|
|
||||||
class wxFrame;
|
class wxFrame;
|
||||||
class wxTextCtrl;
|
class wxTextCtrl;
|
||||||
|
|
||||||
class AudacityLogger final : public wxEvtHandler, public wxLog {
|
class AudacityLogger final : public wxEvtHandler,
|
||||||
|
public wxLog,
|
||||||
|
public PrefsListener
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Get the singleton instance or null
|
// Get the singleton instance or null
|
||||||
@@ -52,6 +56,9 @@ class AudacityLogger final : public wxEvtHandler, public wxLog {
|
|||||||
void OnClear(wxCommandEvent & e);
|
void OnClear(wxCommandEvent & e);
|
||||||
void OnSave(wxCommandEvent & e);
|
void OnSave(wxCommandEvent & e);
|
||||||
|
|
||||||
|
// PrefsListener implementation
|
||||||
|
void UpdatePrefs() override;
|
||||||
|
|
||||||
Destroy_ptr<wxFrame> mFrame;
|
Destroy_ptr<wxFrame> mFrame;
|
||||||
wxTextCtrl *mText;
|
wxTextCtrl *mText;
|
||||||
wxString mBuffer;
|
wxString mBuffer;
|
||||||
|
|||||||
@@ -66,6 +66,9 @@
|
|||||||
#include "widgets/WindowAccessible.h"
|
#include "widgets/WindowAccessible.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MacrosPaletteTitle XO("Macros Palette")
|
||||||
|
#define ManageMacrosTitle XO("Manage Macros")
|
||||||
|
|
||||||
#define MacrosListID 7001
|
#define MacrosListID 7001
|
||||||
#define CommandsListID 7002
|
#define CommandsListID 7002
|
||||||
#define ApplyToProjectID 7003
|
#define ApplyToProjectID 7003
|
||||||
@@ -82,7 +85,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
ApplyMacroDialog::ApplyMacroDialog(
|
ApplyMacroDialog::ApplyMacroDialog(
|
||||||
wxWindow * parent, AudacityProject &project, bool bInherited):
|
wxWindow * parent, AudacityProject &project, bool bInherited):
|
||||||
wxDialogWrapper(parent, wxID_ANY, XO("Macros Palette"),
|
wxDialogWrapper(parent, wxID_ANY, MacrosPaletteTitle,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
, mMacroCommands{ project }
|
, mMacroCommands{ project }
|
||||||
@@ -93,8 +96,8 @@ ApplyMacroDialog::ApplyMacroDialog(
|
|||||||
mbExpanded = false;
|
mbExpanded = false;
|
||||||
if( bInherited )
|
if( bInherited )
|
||||||
return;
|
return;
|
||||||
SetLabel(XO("Macros Palette")); // Provide visual label
|
SetLabel(MacrosPaletteTitle); // Provide visual label
|
||||||
SetName(XO("Macros Palette")); // Provide audible label
|
SetName(MacrosPaletteTitle); // Provide audible label
|
||||||
Populate();
|
Populate();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -758,9 +761,6 @@ void MacrosWindow::UpdateMenus()
|
|||||||
|
|
||||||
void MacrosWindow::UpdateDisplay( bool bExpanded )
|
void MacrosWindow::UpdateDisplay( bool bExpanded )
|
||||||
{
|
{
|
||||||
if( bExpanded == mbExpanded )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( !SaveChanges() )
|
if( !SaveChanges() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1318,5 +1318,11 @@ void MacrosWindow::OnKeyDown(wxKeyEvent &event)
|
|||||||
|
|
||||||
TranslatableString MacrosWindow::WindowTitle() const
|
TranslatableString MacrosWindow::WindowTitle() const
|
||||||
{
|
{
|
||||||
return mbExpanded ? XO("Manage Macros") : XO("Macros Palette");
|
return mbExpanded ? ManageMacrosTitle : MacrosPaletteTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PrefsListener implementation
|
||||||
|
void MacrosWindow::UpdatePrefs()
|
||||||
|
{
|
||||||
|
UpdateDisplay(mbExpanded);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
|
|
||||||
#include "BatchCommands.h"
|
#include "BatchCommands.h"
|
||||||
|
#include "Prefs.h"
|
||||||
|
|
||||||
class wxWindow;
|
class wxWindow;
|
||||||
class wxTextCtrl;
|
class wxTextCtrl;
|
||||||
@@ -47,7 +48,6 @@ class ApplyMacroDialog : public wxDialogWrapper {
|
|||||||
void ApplyMacroToProject( int iMacro, bool bHasGui=true );
|
void ApplyMacroToProject( int iMacro, bool bHasGui=true );
|
||||||
void ApplyMacroToProject( const CommandID & MacroID, bool bHasGui=true );
|
void ApplyMacroToProject( const CommandID & MacroID, bool bHasGui=true );
|
||||||
|
|
||||||
|
|
||||||
// These will be reused in the derived class...
|
// These will be reused in the derived class...
|
||||||
wxListCtrl *mList;
|
wxListCtrl *mList;
|
||||||
wxListCtrl *mMacros;
|
wxListCtrl *mMacros;
|
||||||
@@ -69,7 +69,8 @@ protected:
|
|||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacrosWindow final : public ApplyMacroDialog
|
class MacrosWindow final : public ApplyMacroDialog,
|
||||||
|
public PrefsListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MacrosWindow(
|
MacrosWindow(
|
||||||
@@ -125,6 +126,9 @@ private:
|
|||||||
void InsertCommandAt(int item);
|
void InsertCommandAt(int item);
|
||||||
bool SaveChanges();
|
bool SaveChanges();
|
||||||
|
|
||||||
|
// PrefsListener implementation
|
||||||
|
void UpdatePrefs() override;
|
||||||
|
|
||||||
AudacityProject &mProject;
|
AudacityProject &mProject;
|
||||||
|
|
||||||
wxButton *mRemove;
|
wxButton *mRemove;
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ the mouse around.
|
|||||||
#include "widgets/WindowAccessible.h"
|
#include "widgets/WindowAccessible.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define FrequencyAnalysisTitle XO("Frequency Analysis")
|
||||||
|
|
||||||
DEFINE_EVENT_TYPE(EVT_FREQWINDOW_RECALC);
|
DEFINE_EVENT_TYPE(EVT_FREQWINDOW_RECALC);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -197,6 +199,27 @@ FrequencyPlotDialog::FrequencyPlotDialog(wxWindow * parent, wxWindowID id,
|
|||||||
mRate = 0;
|
mRate = 0;
|
||||||
mDataLen = 0;
|
mDataLen = 0;
|
||||||
|
|
||||||
|
gPrefs->Read(wxT("/FrequencyPlotDialog/DrawGrid"), &mDrawGrid, true);
|
||||||
|
gPrefs->Read(wxT("/FrequencyPlotDialog/SizeChoice"), &mSize, 3);
|
||||||
|
|
||||||
|
int alg;
|
||||||
|
gPrefs->Read(wxT("/FrequencyPlotDialog/AlgChoice"), &alg, 0);
|
||||||
|
mAlg = static_cast<SpectrumAnalyst::Algorithm>(alg);
|
||||||
|
|
||||||
|
gPrefs->Read(wxT("/FrequencyPlotDialog/FuncChoice"), &mFunc, 3);
|
||||||
|
gPrefs->Read(wxT("/FrequencyPlotDialog/AxisChoice"), &mAxis, 1);
|
||||||
|
|
||||||
|
Populate();
|
||||||
|
}
|
||||||
|
|
||||||
|
FrequencyPlotDialog::~FrequencyPlotDialog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrequencyPlotDialog::Populate()
|
||||||
|
{
|
||||||
|
SetTitle(FrequencyAnalysisTitle);
|
||||||
|
|
||||||
TranslatableStrings algChoices{
|
TranslatableStrings algChoices{
|
||||||
XO("Spectrum") ,
|
XO("Spectrum") ,
|
||||||
XO("Standard Autocorrelation") ,
|
XO("Standard Autocorrelation") ,
|
||||||
@@ -240,20 +263,11 @@ FrequencyPlotDialog::FrequencyPlotDialog(wxWindow * parent, wxWindowID id,
|
|||||||
mArrowCursor = std::make_unique<wxCursor>(wxCURSOR_ARROW);
|
mArrowCursor = std::make_unique<wxCursor>(wxCURSOR_ARROW);
|
||||||
mCrossCursor = std::make_unique<wxCursor>(wxCURSOR_CROSS);
|
mCrossCursor = std::make_unique<wxCursor>(wxCURSOR_CROSS);
|
||||||
|
|
||||||
gPrefs->Read(wxT("/FrequencyPlotDialog/DrawGrid"), &mDrawGrid, true);
|
|
||||||
|
|
||||||
long size;
|
long size;
|
||||||
gPrefs->Read(wxT("/FrequencyPlotDialog/SizeChoice"), &mSize, 3);
|
|
||||||
// reinterpret one of the verbatim strings above as a number
|
// reinterpret one of the verbatim strings above as a number
|
||||||
sizeChoices[mSize].MSGID().GET().ToLong(&size);
|
sizeChoices[mSize].MSGID().GET().ToLong(&size);
|
||||||
mWindowSize = size;
|
mWindowSize = size;
|
||||||
|
|
||||||
int alg;
|
|
||||||
gPrefs->Read(wxT("/FrequencyPlotDialog/AlgChoice"), &alg, 0);
|
|
||||||
mAlg = static_cast<SpectrumAnalyst::Algorithm>(alg);
|
|
||||||
|
|
||||||
gPrefs->Read(wxT("/FrequencyPlotDialog/FuncChoice"), &mFunc, 3);
|
|
||||||
gPrefs->Read(wxT("/FrequencyPlotDialog/AxisChoice"), &mAxis, 1);
|
|
||||||
gPrefs->Read(ENV_DB_KEY, &dBRange, ENV_DB_RANGE);
|
gPrefs->Read(ENV_DB_KEY, &dBRange, ENV_DB_RANGE);
|
||||||
if(dBRange < 90.)
|
if(dBRange < 90.)
|
||||||
dBRange = 90.;
|
dBRange = 90.;
|
||||||
@@ -532,10 +546,6 @@ FrequencyPlotDialog::FrequencyPlotDialog(wxWindow * parent, wxWindowID id,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FrequencyPlotDialog::~FrequencyPlotDialog()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void FrequencyPlotDialog::OnGetURL(wxCommandEvent & WXUNUSED(event))
|
void FrequencyPlotDialog::OnGetURL(wxCommandEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
// Original help page is back on-line (March 2016), but the manual should be more reliable.
|
// Original help page is back on-line (March 2016), but the manual should be more reliable.
|
||||||
@@ -1106,6 +1116,49 @@ void FrequencyPlotDialog::OnRecalc(wxCommandEvent & WXUNUSED(event))
|
|||||||
Recalc();
|
Recalc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FrequencyPlotDialog::UpdatePrefs()
|
||||||
|
{
|
||||||
|
bool shown = IsShown();
|
||||||
|
if (shown) {
|
||||||
|
Show(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto zoomSlider = mZoomSlider->GetValue();
|
||||||
|
auto drawGrid = mGridOnOff->GetValue();
|
||||||
|
auto sizeChoice = mSizeChoice->GetStringSelection();
|
||||||
|
auto algChoice = mAlgChoice->GetSelection();
|
||||||
|
auto funcChoice = mFuncChoice->GetSelection();
|
||||||
|
auto axisChoice = mAxisChoice->GetSelection();
|
||||||
|
|
||||||
|
SetSizer(nullptr);
|
||||||
|
DestroyChildren();
|
||||||
|
|
||||||
|
Populate();
|
||||||
|
|
||||||
|
mZoomSlider->SetValue(zoomSlider);
|
||||||
|
|
||||||
|
mDrawGrid = drawGrid;
|
||||||
|
mGridOnOff->SetValue(drawGrid);
|
||||||
|
|
||||||
|
long windowSize = 0;
|
||||||
|
sizeChoice.ToLong(&windowSize);
|
||||||
|
mWindowSize = windowSize;
|
||||||
|
mSizeChoice->SetStringSelection(sizeChoice);
|
||||||
|
|
||||||
|
mAlg = static_cast<SpectrumAnalyst::Algorithm>(algChoice);
|
||||||
|
mAlgChoice->SetSelection(algChoice);
|
||||||
|
|
||||||
|
mFunc = funcChoice;
|
||||||
|
mFuncChoice->SetSelection(funcChoice);
|
||||||
|
|
||||||
|
mAxis = axisChoice;
|
||||||
|
mAxisChoice->SetSelection(axisChoice);
|
||||||
|
|
||||||
|
if (shown) {
|
||||||
|
Show(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(FreqPlot, wxWindow)
|
BEGIN_EVENT_TABLE(FreqPlot, wxWindow)
|
||||||
EVT_ERASE_BACKGROUND(FreqPlot::OnErase)
|
EVT_ERASE_BACKGROUND(FreqPlot::OnErase)
|
||||||
EVT_PAINT(FreqPlot::OnPaint)
|
EVT_PAINT(FreqPlot::OnPaint)
|
||||||
@@ -1149,7 +1202,7 @@ AudacityProject::AttachedWindows::RegisteredFactory sFrequencyWindowKey{
|
|||||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||||
auto &window = ProjectWindow::Get( parent );
|
auto &window = ProjectWindow::Get( parent );
|
||||||
return safenew FrequencyPlotDialog(
|
return safenew FrequencyPlotDialog(
|
||||||
&window, -1, parent, XO("Frequency Analysis"),
|
&window, -1, parent, FrequencyAnalysisTitle,
|
||||||
wxPoint{ 150, 150 }
|
wxPoint{ 150, 150 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wx/font.h> // member variable
|
#include <wx/font.h> // member variable
|
||||||
#include <wx/statusbr.h> // to inherit
|
#include <wx/statusbr.h> // to inherit
|
||||||
|
#include "Prefs.h"
|
||||||
#include "SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
#include "SpectrumAnalyst.h"
|
#include "SpectrumAnalyst.h"
|
||||||
#include "widgets/wxPanelWrapper.h" // to inherit
|
#include "widgets/wxPanelWrapper.h" // to inherit
|
||||||
@@ -52,7 +53,8 @@ private:
|
|||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
class FrequencyPlotDialog final : public wxDialogWrapper
|
class FrequencyPlotDialog final : public wxDialogWrapper,
|
||||||
|
public PrefsListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FrequencyPlotDialog(wxWindow *parent, wxWindowID id,
|
FrequencyPlotDialog(wxWindow *parent, wxWindowID id,
|
||||||
@@ -63,6 +65,8 @@ public:
|
|||||||
bool Show( bool show = true ) override;
|
bool Show( bool show = true ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Populate();
|
||||||
|
|
||||||
void GetAudio();
|
void GetAudio();
|
||||||
|
|
||||||
void PlotMouseEvent(wxMouseEvent & event);
|
void PlotMouseEvent(wxMouseEvent & event);
|
||||||
@@ -88,6 +92,9 @@ private:
|
|||||||
void DrawPlot();
|
void DrawPlot();
|
||||||
void DrawBackground(wxMemoryDC & dc);
|
void DrawBackground(wxMemoryDC & dc);
|
||||||
|
|
||||||
|
// PrefsListener implementation
|
||||||
|
void UpdatePrefs() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mDrawGrid;
|
bool mDrawGrid;
|
||||||
int mSize;
|
int mSize;
|
||||||
|
|||||||
@@ -67,8 +67,10 @@ BEGIN_EVENT_TABLE(HistoryDialog, wxDialogWrapper)
|
|||||||
EVT_BUTTON(wxID_HELP, HistoryDialog::OnGetURL)
|
EVT_BUTTON(wxID_HELP, HistoryDialog::OnGetURL)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
#define HistoryTitle XO("History")
|
||||||
|
|
||||||
HistoryDialog::HistoryDialog(AudacityProject *parent, UndoManager *manager):
|
HistoryDialog::HistoryDialog(AudacityProject *parent, UndoManager *manager):
|
||||||
wxDialogWrapper(FindProjectFrame( parent ), wxID_ANY, XO("History"),
|
wxDialogWrapper(FindProjectFrame( parent ), wxID_ANY, HistoryTitle,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
|
||||||
{
|
{
|
||||||
@@ -79,13 +81,33 @@ HistoryDialog::HistoryDialog(AudacityProject *parent, UndoManager *manager):
|
|||||||
mSelected = 0;
|
mSelected = 0;
|
||||||
mAudioIOBusy = false;
|
mAudioIOBusy = false;
|
||||||
|
|
||||||
auto imageList = std::make_unique<wxImageList>(9, 16);
|
|
||||||
imageList->Add(wxIcon(empty9x16_xpm));
|
|
||||||
imageList->Add(wxIcon(arrow_xpm));
|
|
||||||
|
|
||||||
//------------------------- Main section --------------------
|
//------------------------- Main section --------------------
|
||||||
// Construct the GUI.
|
// Construct the GUI.
|
||||||
ShuttleGui S(this, eIsCreating);
|
ShuttleGui S(this, eIsCreating);
|
||||||
|
Populate(S);
|
||||||
|
|
||||||
|
wxTheApp->Bind(EVT_AUDIOIO_PLAYBACK,
|
||||||
|
&HistoryDialog::OnAudioIO,
|
||||||
|
this);
|
||||||
|
|
||||||
|
wxTheApp->Bind(EVT_AUDIOIO_CAPTURE,
|
||||||
|
&HistoryDialog::OnAudioIO,
|
||||||
|
this);
|
||||||
|
|
||||||
|
Clipboard::Get().Bind(
|
||||||
|
EVT_CLIPBOARD_CHANGE, &HistoryDialog::UpdateDisplay, this);
|
||||||
|
parent->Bind(EVT_UNDO_PUSHED, &HistoryDialog::UpdateDisplay, this);
|
||||||
|
parent->Bind(EVT_UNDO_MODIFIED, &HistoryDialog::UpdateDisplay, this);
|
||||||
|
parent->Bind(EVT_UNDO_OR_REDO, &HistoryDialog::UpdateDisplay, this);
|
||||||
|
parent->Bind(EVT_UNDO_RESET, &HistoryDialog::UpdateDisplay, this);
|
||||||
|
parent->Bind(EVT_UNDO_PURGE, &HistoryDialog::UpdateDisplay, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HistoryDialog::Populate(ShuttleGui & S)
|
||||||
|
{
|
||||||
|
auto imageList = std::make_unique<wxImageList>(9, 16);
|
||||||
|
imageList->Add(wxIcon(empty9x16_xpm));
|
||||||
|
imageList->Add(wxIcon(arrow_xpm));
|
||||||
|
|
||||||
S.SetBorder(5);
|
S.SetBorder(5);
|
||||||
S.StartVerticalLay(true);
|
S.StartVerticalLay(true);
|
||||||
@@ -150,26 +172,11 @@ HistoryDialog::HistoryDialog(AudacityProject *parent, UndoManager *manager):
|
|||||||
S.EndVerticalLay();
|
S.EndVerticalLay();
|
||||||
// ----------------------- End of main section --------------
|
// ----------------------- End of main section --------------
|
||||||
|
|
||||||
|
Layout();
|
||||||
Fit();
|
Fit();
|
||||||
SetMinSize(GetSize());
|
SetMinSize(GetSize());
|
||||||
mList->SetColumnWidth(0, mList->GetClientSize().x - mList->GetColumnWidth(1));
|
mList->SetColumnWidth(0, mList->GetClientSize().x - mList->GetColumnWidth(1));
|
||||||
mList->SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
mList->SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||||
|
|
||||||
wxTheApp->Bind(EVT_AUDIOIO_PLAYBACK,
|
|
||||||
&HistoryDialog::OnAudioIO,
|
|
||||||
this);
|
|
||||||
|
|
||||||
wxTheApp->Bind(EVT_AUDIOIO_CAPTURE,
|
|
||||||
&HistoryDialog::OnAudioIO,
|
|
||||||
this);
|
|
||||||
|
|
||||||
Clipboard::Get().Bind(
|
|
||||||
EVT_CLIPBOARD_CHANGE, &HistoryDialog::UpdateDisplay, this);
|
|
||||||
parent->Bind(EVT_UNDO_PUSHED, &HistoryDialog::UpdateDisplay, this);
|
|
||||||
parent->Bind(EVT_UNDO_MODIFIED, &HistoryDialog::UpdateDisplay, this);
|
|
||||||
parent->Bind(EVT_UNDO_OR_REDO, &HistoryDialog::UpdateDisplay, this);
|
|
||||||
parent->Bind(EVT_UNDO_RESET, &HistoryDialog::UpdateDisplay, this);
|
|
||||||
parent->Bind(EVT_UNDO_PURGE, &HistoryDialog::UpdateDisplay, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryDialog::OnAudioIO(wxCommandEvent& evt)
|
void HistoryDialog::OnAudioIO(wxCommandEvent& evt)
|
||||||
@@ -378,6 +385,26 @@ void HistoryDialog::OnSize(wxSizeEvent & WXUNUSED(event))
|
|||||||
mList->EnsureVisible(mSelected);
|
mList->EnsureVisible(mSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PrefsListener implementation
|
||||||
|
void HistoryDialog::UpdatePrefs()
|
||||||
|
{
|
||||||
|
bool shown = IsShown();
|
||||||
|
if (shown) {
|
||||||
|
Show(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSizer(nullptr);
|
||||||
|
DestroyChildren();
|
||||||
|
|
||||||
|
SetTitle(HistoryTitle);
|
||||||
|
ShuttleGui S(this, eIsCreating);
|
||||||
|
Populate(S);
|
||||||
|
|
||||||
|
if (shown) {
|
||||||
|
Show(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remaining code hooks this add-on into the application
|
// Remaining code hooks this add-on into the application
|
||||||
#include "commands/CommandContext.h"
|
#include "commands/CommandContext.h"
|
||||||
#include "commands/CommandManager.h"
|
#include "commands/CommandManager.h"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#ifndef __AUDACITY_HISTORY_WINDOW__
|
#ifndef __AUDACITY_HISTORY_WINDOW__
|
||||||
#define __AUDACITY_HISTORY_WINDOW__
|
#define __AUDACITY_HISTORY_WINDOW__
|
||||||
|
|
||||||
|
#include "Prefs.h"
|
||||||
#include "widgets/wxPanelWrapper.h" // to inherit
|
#include "widgets/wxPanelWrapper.h" // to inherit
|
||||||
|
|
||||||
class wxButton;
|
class wxButton;
|
||||||
@@ -22,7 +23,9 @@ class AudacityProject;
|
|||||||
class ShuttleGui;
|
class ShuttleGui;
|
||||||
class UndoManager;
|
class UndoManager;
|
||||||
|
|
||||||
class HistoryDialog final : public wxDialogWrapper {
|
class HistoryDialog final : public wxDialogWrapper,
|
||||||
|
public PrefsListener
|
||||||
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HistoryDialog(AudacityProject * parent, UndoManager *manager);
|
HistoryDialog(AudacityProject * parent, UndoManager *manager);
|
||||||
@@ -32,6 +35,8 @@ class HistoryDialog final : public wxDialogWrapper {
|
|||||||
bool Show( bool show = true ) override;
|
bool Show( bool show = true ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Populate(ShuttleGui & S);
|
||||||
|
|
||||||
void OnAudioIO(wxCommandEvent & evt);
|
void OnAudioIO(wxCommandEvent & evt);
|
||||||
void DoUpdate();
|
void DoUpdate();
|
||||||
void UpdateLevels();
|
void UpdateLevels();
|
||||||
@@ -46,6 +51,9 @@ class HistoryDialog final : public wxDialogWrapper {
|
|||||||
void OnCompact(wxCommandEvent & event);
|
void OnCompact(wxCommandEvent & event);
|
||||||
void OnGetURL(wxCommandEvent & event);
|
void OnGetURL(wxCommandEvent & event);
|
||||||
|
|
||||||
|
// PrefsListener implementation
|
||||||
|
void UpdatePrefs() override;
|
||||||
|
|
||||||
AudacityProject *mProject;
|
AudacityProject *mProject;
|
||||||
UndoManager *mManager;
|
UndoManager *mManager;
|
||||||
wxListCtrl *mList;
|
wxListCtrl *mList;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "Prefs.h" // for RTL_WORKAROUND
|
#include "Prefs.h" // for RTL_WORKAROUND
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
#include "ProjectAudioIO.h"
|
#include "ProjectAudioIO.h"
|
||||||
|
#include "ProjectFileIO.h"
|
||||||
#include "ViewInfo.h"
|
#include "ViewInfo.h"
|
||||||
|
|
||||||
#include <wx/radiobut.h>
|
#include <wx/radiobut.h>
|
||||||
@@ -32,6 +33,8 @@
|
|||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define AudacityKaraokeTitle XO("Audacity Karaoke%s")
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kID_RadioButton_BouncingBall = 10101,
|
kID_RadioButton_BouncingBall = 10101,
|
||||||
kID_RadioButton_Highlight,
|
kID_RadioButton_Highlight,
|
||||||
@@ -46,13 +49,7 @@ END_EVENT_TABLE()
|
|||||||
const wxSize gSize = wxSize(LYRICS_DEFAULT_WIDTH, LYRICS_DEFAULT_HEIGHT);
|
const wxSize gSize = wxSize(LYRICS_DEFAULT_WIDTH, LYRICS_DEFAULT_HEIGHT);
|
||||||
|
|
||||||
LyricsWindow::LyricsWindow(AudacityProject *parent)
|
LyricsWindow::LyricsWindow(AudacityProject *parent)
|
||||||
: wxFrame( &GetProjectFrame( *parent ), -1,
|
: wxFrame( &GetProjectFrame( *parent ), -1, {},
|
||||||
wxString::Format(_("Audacity Karaoke%s"),
|
|
||||||
((parent->GetProjectName().empty()) ?
|
|
||||||
wxT("") :
|
|
||||||
wxString::Format(
|
|
||||||
wxT(" - %s"),
|
|
||||||
parent->GetProjectName()))),
|
|
||||||
wxPoint(100, 300), gSize,
|
wxPoint(100, 300), gSize,
|
||||||
//v Bug in wxFRAME_FLOAT_ON_PARENT:
|
//v Bug in wxFRAME_FLOAT_ON_PARENT:
|
||||||
// If both the project frame and LyricsWindow are minimized and you restore LyricsWindow,
|
// If both the project frame and LyricsWindow are minimized and you restore LyricsWindow,
|
||||||
@@ -68,6 +65,14 @@ LyricsWindow::LyricsWindow(AudacityProject *parent)
|
|||||||
// #endif
|
// #endif
|
||||||
mProject = parent;
|
mProject = parent;
|
||||||
|
|
||||||
|
SetWindowTitle();
|
||||||
|
auto titleChanged = [&](wxCommandEvent &evt)
|
||||||
|
{
|
||||||
|
SetWindowTitle();
|
||||||
|
evt.Skip();
|
||||||
|
};
|
||||||
|
wxTheApp->Bind( EVT_PROJECT_TITLE_CHANGE, titleChanged );
|
||||||
|
|
||||||
// loads either the XPM or the windows resource, depending on the platform
|
// loads either the XPM or the windows resource, depending on the platform
|
||||||
#if !defined(__WXMAC__) && !defined(__WXX11__)
|
#if !defined(__WXMAC__) && !defined(__WXX11__)
|
||||||
{
|
{
|
||||||
@@ -169,6 +174,22 @@ void LyricsWindow::OnTimer(wxCommandEvent &event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LyricsWindow::SetWindowTitle()
|
||||||
|
{
|
||||||
|
wxString name = mProject->GetProjectName();
|
||||||
|
if (!name.empty())
|
||||||
|
{
|
||||||
|
name.Prepend(wxT(" - "));
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTitle(AudacityKaraokeTitle.Format(name).Translation());
|
||||||
|
}
|
||||||
|
|
||||||
|
void LyricsWindow::UpdatePrefs()
|
||||||
|
{
|
||||||
|
SetWindowTitle();
|
||||||
|
}
|
||||||
|
|
||||||
// Remaining code hooks this add-on into the application
|
// Remaining code hooks this add-on into the application
|
||||||
#include "commands/CommandContext.h"
|
#include "commands/CommandContext.h"
|
||||||
#include "commands/CommandManager.h"
|
#include "commands/CommandManager.h"
|
||||||
|
|||||||
@@ -14,10 +14,14 @@
|
|||||||
|
|
||||||
#include <wx/frame.h> // to inherit
|
#include <wx/frame.h> // to inherit
|
||||||
|
|
||||||
|
#include "Prefs.h"
|
||||||
|
|
||||||
class AudacityProject;
|
class AudacityProject;
|
||||||
class LyricsPanel;
|
class LyricsPanel;
|
||||||
|
|
||||||
class LyricsWindow final : public wxFrame {
|
class LyricsWindow final : public wxFrame,
|
||||||
|
public PrefsListener
|
||||||
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LyricsWindow(AudacityProject* parent);
|
LyricsWindow(AudacityProject* parent);
|
||||||
@@ -31,6 +35,11 @@ class LyricsWindow final : public wxFrame {
|
|||||||
void OnStyle_Highlight(wxCommandEvent &evt);
|
void OnStyle_Highlight(wxCommandEvent &evt);
|
||||||
void OnTimer(wxCommandEvent &event);
|
void OnTimer(wxCommandEvent &event);
|
||||||
|
|
||||||
|
void SetWindowTitle();
|
||||||
|
|
||||||
|
// PrefsListener implementation
|
||||||
|
void UpdatePrefs() override;
|
||||||
|
|
||||||
AudacityProject *mProject;
|
AudacityProject *mProject;
|
||||||
LyricsPanel *mLyricsPanel;
|
LyricsPanel *mLyricsPanel;
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "ProjectAudioIO.h"
|
#include "ProjectAudioIO.h"
|
||||||
#include "ProjectAudioManager.h"
|
#include "ProjectAudioManager.h"
|
||||||
#include "ProjectHistory.h"
|
#include "ProjectHistory.h"
|
||||||
|
#include "ProjectFileIO.h"
|
||||||
#include "ProjectSettings.h"
|
#include "ProjectSettings.h"
|
||||||
#include "ProjectWindow.h"
|
#include "ProjectWindow.h"
|
||||||
#include "SelectUtilities.h"
|
#include "SelectUtilities.h"
|
||||||
@@ -61,6 +62,8 @@
|
|||||||
|
|
||||||
#include "commands/CommandManager.h"
|
#include "commands/CommandManager.h"
|
||||||
|
|
||||||
|
#define AudacityMixerBoardTitle XO("Audacity Mixer Board%s")
|
||||||
|
|
||||||
// class MixerTrackSlider
|
// class MixerTrackSlider
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MixerTrackSlider, ASlider)
|
BEGIN_EVENT_TABLE(MixerTrackSlider, ASlider)
|
||||||
@@ -1405,15 +1408,19 @@ const wxSize kDefaultSize =
|
|||||||
wxSize(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT);
|
wxSize(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT);
|
||||||
|
|
||||||
MixerBoardFrame::MixerBoardFrame(AudacityProject* parent)
|
MixerBoardFrame::MixerBoardFrame(AudacityProject* parent)
|
||||||
: wxFrame( &GetProjectFrame( *parent ), -1,
|
: wxFrame( &GetProjectFrame( *parent ), -1, {},
|
||||||
wxString::Format(_("Audacity Mixer Board%s"),
|
|
||||||
((parent->GetProjectName().empty()) ?
|
|
||||||
wxT("") :
|
|
||||||
wxString::Format(wxT(" - %s"),
|
|
||||||
parent->GetProjectName()))),
|
|
||||||
wxDefaultPosition, kDefaultSize,
|
wxDefaultPosition, kDefaultSize,
|
||||||
wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT)
|
wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT)
|
||||||
|
, mProject(parent)
|
||||||
{
|
{
|
||||||
|
SetWindowTitle();
|
||||||
|
auto titleChanged = [&](wxCommandEvent &evt)
|
||||||
|
{
|
||||||
|
SetWindowTitle();
|
||||||
|
evt.Skip();
|
||||||
|
};
|
||||||
|
wxTheApp->Bind( EVT_PROJECT_TITLE_CHANGE, titleChanged );
|
||||||
|
|
||||||
mMixerBoard = safenew MixerBoard(parent, this, wxDefaultPosition, kDefaultSize);
|
mMixerBoard = safenew MixerBoard(parent, this, wxDefaultPosition, kDefaultSize);
|
||||||
|
|
||||||
this->SetSizeHints(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT);
|
this->SetSizeHints(MIXER_BOARD_MIN_WIDTH, MIXER_BOARD_MIN_HEIGHT);
|
||||||
@@ -1487,6 +1494,18 @@ void MixerBoardFrame::Recreate( AudacityProject *pProject )
|
|||||||
mMixerBoard->SetSize( siz );
|
mMixerBoard->SetSize( siz );
|
||||||
|
|
||||||
this->SetSize( siz2 );
|
this->SetSize( siz2 );
|
||||||
|
SetWindowTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MixerBoardFrame::SetWindowTitle()
|
||||||
|
{
|
||||||
|
wxString name = mProject->GetProjectName();
|
||||||
|
if (!name.empty())
|
||||||
|
{
|
||||||
|
name.Prepend(wxT(" - "));
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTitle(AudacityMixerBoardTitle.Format(name).Translation());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remaining code hooks this add-on into the application
|
// Remaining code hooks this add-on into the application
|
||||||
|
|||||||
@@ -279,6 +279,9 @@ private:
|
|||||||
void OnSize(wxSizeEvent &evt);
|
void OnSize(wxSizeEvent &evt);
|
||||||
void OnKeyEvent(wxKeyEvent &evt);
|
void OnKeyEvent(wxKeyEvent &evt);
|
||||||
|
|
||||||
|
void SetWindowTitle();
|
||||||
|
|
||||||
|
AudacityProject *mProject;
|
||||||
public:
|
public:
|
||||||
MixerBoard* mMixerBoard;
|
MixerBoard* mMixerBoard;
|
||||||
|
|
||||||
|
|||||||
@@ -52,11 +52,14 @@ class OldStyleCommandType;
|
|||||||
class ScreenFrameTimer;
|
class ScreenFrameTimer;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
#define ScreenCaptureFrameTitle XO("Screen Capture Frame")
|
||||||
|
|
||||||
// ANSWER-ME: Should this derive from wxDialogWrapper instead?
|
// ANSWER-ME: Should this derive from wxDialogWrapper instead?
|
||||||
class ScreenshotBigDialog final : public wxFrame
|
class ScreenshotBigDialog final : public wxFrame,
|
||||||
|
public PrefsListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructors and destructors
|
// constructors and destructors
|
||||||
ScreenshotBigDialog(
|
ScreenshotBigDialog(
|
||||||
wxWindow *parent, wxWindowID id, AudacityProject &project);
|
wxWindow *parent, wxWindowID id, AudacityProject &project);
|
||||||
@@ -96,6 +99,9 @@ class ScreenshotBigDialog final : public wxFrame
|
|||||||
void OnMedTracks(wxCommandEvent & event);
|
void OnMedTracks(wxCommandEvent & event);
|
||||||
void OnTallTracks(wxCommandEvent & event);
|
void OnTallTracks(wxCommandEvent & event);
|
||||||
|
|
||||||
|
// PrefsListener implementation
|
||||||
|
void UpdatePrefs() override;
|
||||||
|
|
||||||
AudacityProject &mProject;
|
AudacityProject &mProject;
|
||||||
|
|
||||||
std::unique_ptr<ScreenshotCommand> CreateCommand();
|
std::unique_ptr<ScreenshotCommand> CreateCommand();
|
||||||
@@ -278,7 +284,7 @@ std::unique_ptr<ScreenshotCommand> ScreenshotBigDialog::CreateCommand()
|
|||||||
|
|
||||||
ScreenshotBigDialog::ScreenshotBigDialog(
|
ScreenshotBigDialog::ScreenshotBigDialog(
|
||||||
wxWindow * parent, wxWindowID id, AudacityProject &project)
|
wxWindow * parent, wxWindowID id, AudacityProject &project)
|
||||||
: wxFrame(parent, id, _("Screen Capture Frame"),
|
: wxFrame(parent, id, ScreenCaptureFrameTitle.Translation(),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
|
|
||||||
#if !defined(__WXMSW__)
|
#if !defined(__WXMSW__)
|
||||||
@@ -503,26 +509,30 @@ void ScreenshotBigDialog::PopulateOrExchange(ShuttleGui & S)
|
|||||||
|
|
||||||
bool ScreenshotBigDialog::ProcessEvent(wxEvent & e)
|
bool ScreenshotBigDialog::ProcessEvent(wxEvent & e)
|
||||||
{
|
{
|
||||||
int id = e.GetId();
|
if (!IsFrozen())
|
||||||
|
|
||||||
// If split into two parts to make for easier breakpoint
|
|
||||||
// when testing timer.
|
|
||||||
if (mDelayCheckBox &&
|
|
||||||
mDelayCheckBox->GetValue() &&
|
|
||||||
e.IsCommandEvent() &&
|
|
||||||
e.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED)
|
|
||||||
{
|
{
|
||||||
if( id >= IdAllDelayedEvents && id <= IdLastDelayedEvent &&
|
int id = e.GetId();
|
||||||
e.GetEventObject() != NULL) {
|
|
||||||
mTimer = std::make_unique<ScreenFrameTimer>(this, e);
|
// If split into two parts to make for easier breakpoint
|
||||||
mTimer->Start(5000, true);
|
// when testing timer.
|
||||||
return true;
|
if (mDelayCheckBox &&
|
||||||
|
mDelayCheckBox->GetValue() &&
|
||||||
|
e.IsCommandEvent() &&
|
||||||
|
e.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED)
|
||||||
|
{
|
||||||
|
if( id >= IdAllDelayedEvents && id <= IdLastDelayedEvent &&
|
||||||
|
e.GetEventObject() != NULL) {
|
||||||
|
mTimer = std::make_unique<ScreenFrameTimer>(this, e);
|
||||||
|
mTimer->Start(5000, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.IsCommandEvent() && e.GetEventObject() == NULL) {
|
||||||
|
e.SetEventObject(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.IsCommandEvent() && e.GetEventObject() == NULL) {
|
|
||||||
e.SetEventObject(this);
|
|
||||||
}
|
|
||||||
return wxFrame::ProcessEvent(e);
|
return wxFrame::ProcessEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -790,3 +800,16 @@ void ScreenshotBigDialog::OnTallTracks(wxCommandEvent & WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
SizeTracks(85);
|
SizeTracks(85);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenshotBigDialog::UpdatePrefs()
|
||||||
|
{
|
||||||
|
Freeze();
|
||||||
|
|
||||||
|
SetSizer(nullptr);
|
||||||
|
DestroyChildren();
|
||||||
|
|
||||||
|
SetTitle(ScreenCaptureFrameTitle.Translation());
|
||||||
|
Populate();
|
||||||
|
|
||||||
|
Thaw();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user