1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

Just a few more minor dependency severings

This commit is contained in:
Paul Licameli 2019-07-13 20:34:50 -04:00
commit 3f4ad05d37
15 changed files with 76 additions and 75 deletions

View File

@ -32,20 +32,6 @@ It is also a place to document colour usage policy in Audacity
#include "AllThemeResources.h"
void DCUnchanger::operator () (wxDC *pDC) const
{
if (pDC) {
pDC->SetPen(pen);
pDC->SetBrush(brush);
pDC->SetLogicalFunction(wxRasterOperationMode(logicalOperation));
}
}
ADCChanger::ADCChanger(wxDC *pDC)
: Base{ pDC, ::DCUnchanger{ pDC->GetBrush(), pDC->GetPen(),
long(pDC->GetLogicalFunction()) } }
{}
bool AColor::inited = false;
wxBrush AColor::lightBrush[2];
wxBrush AColor::mediumBrush[2];

View File

@ -22,32 +22,6 @@ class wxDC;
class wxGraphicsContext;
class wxRect;
/// Used to restore pen, brush and logical-op in a DC back to what they were.
struct DCUnchanger {
public:
DCUnchanger() {}
DCUnchanger(const wxBrush &brush_, const wxPen &pen_, long logicalOperation_)
: brush(brush_), pen(pen_), logicalOperation(logicalOperation_)
{}
void operator () (wxDC *pDC) const;
wxBrush brush {};
wxPen pen {};
long logicalOperation {};
};
/// Makes temporary drawing context changes that you back out of, RAII style
// It's like wxDCPenChanger, etc., but simple and general
class ADCChanger : public std::unique_ptr<wxDC, ::DCUnchanger>
{
using Base = std::unique_ptr<wxDC, ::DCUnchanger>;
public:
ADCChanger() : Base{} {}
ADCChanger(wxDC *pDC);
};
class AColor {
public:

View File

@ -77,7 +77,7 @@ It handles initialization and termination by subclassing wxApp.
#include "commands/AppCommandEvent.h"
#include "widgets/ASlider.h"
#include "FFmpeg.h"
#include "LangChoice.h"
//#include "LangChoice.h"
#include "Languages.h"
#include "Menus.h"
#include "MissingAliasFileDialog.h"

View File

@ -47,13 +47,14 @@ AliasedFile s.
#include <wx/choice.h>
#include <wx/clipbrd.h>
#include <wx/dataobj.h>
#include <wx/frame.h>
#include <wx/stattext.h>
#include "blockfile/SimpleBlockFile.h"
#include "DirManager.h"
#include "Prefs.h"
#include "Project.h"
#include "ProjectSettings.h"
#include "ProjectWindow.h"
#include "Sequence.h"
#include "ShuttleGui.h"
#include "WaveTrack.h"
@ -600,7 +601,7 @@ void DependencyDialog::SaveFutureActionChoice()
bool ShowDependencyDialogIfNeeded(AudacityProject *project,
bool isSaving)
{
auto pWindow = ProjectWindow::Find( project );
auto pWindow = FindProjectFrame( project );
AliasedFileArray aliasedFiles;
FindDependencies(project, aliasedFiles);

View File

@ -326,3 +326,8 @@ bool EnumSetting::WriteInt( int code ) // you flush gPrefs afterward
return false;
return Write( mSymbols[index].Internal() );
}
wxString WarningDialogKey(const wxString &internalDialogName)
{
return wxT("/Warnings/") + internalDialogName;
}

View File

@ -191,4 +191,9 @@ private:
std::unique_ptr<Impl> mpImpl;
};
/// Return the config file key associated with a warning dialog identified
/// by internalDialogName. When the box is checked, the value at the key
/// becomes false.
wxString WarningDialogKey(const wxString &internalDialogName);
#endif

View File

@ -19,6 +19,7 @@ Paul Licameli split from TrackPanel.cpp
#include "TrackPanelMouseEvent.h"
#include "HitTestResult.h"
#include "ViewInfo.h"
#include "widgets/OverlayPanel.h"
#include "tracks/ui/TrackView.h"

View File

@ -31,8 +31,6 @@
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../widgets/Warning.h"
using std::min;
enum {

View File

@ -85,22 +85,4 @@ private:
bool mSetInsertionPointEnd{};
};
/**************************************************************************//**
\brief Wrap wxMessageDialog so that caption IS translatable.
********************************************************************************/
class AudacityMessageDialog : public wxTabTraversalWrapper< wxMessageDialog >
{
public:
AudacityMessageDialog(
wxWindow *parent,
const wxString& message,
const wxString& caption, // don't use = wxMessageBoxCaptionStr,
long style = wxOK|wxCENTRE,
const wxPoint& pos = wxDefaultPosition)
: wxTabTraversalWrapper< wxMessageDialog>
( parent, message, caption, style, pos )
{}
};
#endif // __AUDACITY_ERRORDIALOG__

View File

@ -10,7 +10,6 @@
#include "OverlayPanel.h"
#include "Overlay.h"
#include "../AColor.h"
#include <algorithm>
#include <wx/dcclient.h>
@ -134,3 +133,18 @@ void OverlayPanel::Compress()
BEGIN_EVENT_TABLE(OverlayPanel, BackedPanel)
END_EVENT_TABLE()
// Maybe this class needs a better home
void DCUnchanger::operator () (wxDC *pDC) const
{
if (pDC) {
pDC->SetPen(pen);
pDC->SetBrush(brush);
pDC->SetLogicalFunction(wxRasterOperationMode(logicalOperation));
}
}
ADCChanger::ADCChanger(wxDC *pDC)
: Base{ pDC, ::DCUnchanger{ pDC->GetBrush(), pDC->GetPen(),
long(pDC->GetLogicalFunction()) } }
{}

View File

@ -50,4 +50,30 @@ private:
friend class GetInfoCommand;
};
/// Used to restore pen, brush and logical-op in a DC back to what they were.
struct DCUnchanger {
public:
DCUnchanger() {}
DCUnchanger(const wxBrush &brush_, const wxPen &pen_, long logicalOperation_)
: brush(brush_), pen(pen_), logicalOperation(logicalOperation_)
{}
void operator () (wxDC *pDC) const;
wxBrush brush {};
wxPen pen {};
long logicalOperation {};
};
/// Makes temporary drawing context changes that you back out of, RAII style
// It's like wxDCPenChanger, etc., but simple and general
class ADCChanger : public std::unique_ptr<wxDC, ::DCUnchanger>
{
using Base = std::unique_ptr<wxDC, ::DCUnchanger>;
public:
ADCChanger() : Base{} {}
ADCChanger(wxDC *pDC);
};
#endif

View File

@ -50,7 +50,6 @@
#include <wx/window.h>
#include <wx/stattext.h>
#include "ErrorDialog.h"
#include "../Prefs.h"
// This really should be a Preferences setting

View File

@ -109,8 +109,3 @@ int ShowWarningDialog(wxWindow *parent,
gPrefs->Flush();
return wxID_OK;
}
wxString WarningDialogKey(const wxString &internalDialogName)
{
return wxT("/Warnings/") + internalDialogName;
}

View File

@ -30,9 +30,4 @@ int ShowWarningDialog(wxWindow *parent,
// This message appears by the checkbox:
const wxString &footer = DefaultWarningFooter());
/// Return the config file key associated with a warning dialog identified
/// by internalDialogName. When the box is checked, the value at the key
/// becomes false.
wxString WarningDialogKey(const wxString &internalDialogName);
#endif // __AUDACITY_WARNING__

View File

@ -183,4 +183,24 @@ public:
}
};
#include <wx/msgdlg.h>
/**************************************************************************//**
\brief Wrap wxMessageDialog so that caption IS translatable.
********************************************************************************/
class AudacityMessageDialog : public wxTabTraversalWrapper< wxMessageDialog >
{
public:
AudacityMessageDialog(
wxWindow *parent,
const wxString& message,
const wxString& caption, // don't use = wxMessageBoxCaptionStr,
long style = wxOK|wxCENTRE,
const wxPoint& pos = wxDefaultPosition)
: wxTabTraversalWrapper< wxMessageDialog>
( parent, message, caption, style, pos )
{}
};
#endif