1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-21 15:08:01 +02:00
audacity/src/widgets/wxPanelWrapper.h
James Crook cf5ec042f3 Automation: AudacityCommand
This is a squash of 50 commits.

This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class.  AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.

- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
   - Tested with Zoom Toggle.

- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.

We abuse EffectsManager.  It handles both Effects and
AudacityCommands now.  In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.

- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.

This way we can search for related types at the same time.

- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason.  They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.

- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
  which are now better handled by other commands.

- JSONify "GetInfo: Commands" output, i.e. commas in the right places.

- General work on better Doxygen.
    - Lyrics -> LyricsPanel
    - Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
  previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-02-21 20:29:52 -05:00

179 lines
5.3 KiB
C++

//
// wxPanelWrapper.h
// Audacity
//
// Created by Paul Licameli on 6/25/16.
//
//
#ifndef __AUDACITY_WXPANEL_WRAPPER__
#define __AUDACITY_WXPANEL_WRAPPER__
#include "../MemoryX.h"
#include <wx/panel.h>
#include <wx/dialog.h>
#include "../Internat.h"
void wxTabTraversalWrapperCharHook(wxKeyEvent &event);
template <typename Base>
class AUDACITY_DLL_API wxTabTraversalWrapper : public Base
{
public:
template <typename... Args>
wxTabTraversalWrapper(Args&&... args)
: Base( std::forward<Args>(args)... )
{
this->Bind(wxEVT_CHAR_HOOK, wxTabTraversalWrapperCharHook);
}
};
class AUDACITY_DLL_API wxPanelWrapper : public wxTabTraversalWrapper<wxPanel>
{
public:
// Constructors
wxPanelWrapper() {}
wxPanelWrapper(
wxWindow *parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
// Important: default window name localizes!
const wxString& name = _("Panel"))
: wxTabTraversalWrapper<wxPanel> ( parent, winid, pos, size, style, name )
{}
// Pseudo ctor
bool Create(
wxWindow *parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
// Important: default window name localizes!
const wxString& name = _("Panel"))
{
return wxTabTraversalWrapper<wxPanel>::Create(
parent, winid, pos, size, style, name
);
}
};
class AUDACITY_DLL_API wxDialogWrapper : public wxTabTraversalWrapper<wxDialog>
{
public:
// Constructors
wxDialogWrapper() {}
// Constructor with no modal flag - the new convention.
wxDialogWrapper(
wxWindow *parent, wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
// Important: default window name localizes!
const wxString& name = _("Dialog"))
: wxTabTraversalWrapper<wxDialog>
( parent, id, title, pos, size, style, name )
{}
// Pseudo ctor
bool Create(
wxWindow *parent, wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
// Important: default window name localizes!
const wxString& name = _("Dialog"))
{
return wxTabTraversalWrapper<wxDialog>::Create(
parent, id, title, pos, size, style, name
);
}
};
#include <wx/dirdlg.h>
class AUDACITY_DLL_API wxDirDialogWrapper : public wxTabTraversalWrapper<wxDirDialog>
{
public:
// Constructor with no modal flag - the new convention.
wxDirDialogWrapper(
wxWindow *parent,
const wxString& message = _("Select a directory"),
const wxString& defaultPath = wxT(""),
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
// Important: default window name localizes!
const wxString& name = _("Directory Dialog"))
: wxTabTraversalWrapper<wxDirDialog>
( parent, message, defaultPath, style, pos, size, name )
{}
// Pseudo ctor
void Create(
wxWindow *parent,
const wxString& message = _("Select a directory"),
const wxString& defaultPath = wxT(""),
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
// Important: default window name localizes!
const wxString& name = _("Directory Dialog"))
{
wxTabTraversalWrapper<wxDirDialog>::Create(
parent, message, defaultPath, style, pos, size, name
);
}
};
#include "../lib-src/FileDialog/FileDialog.h"
class AUDACITY_DLL_API FileDialogWrapper : public wxTabTraversalWrapper<FileDialog>
{
public:
FileDialogWrapper() {}
// Constructor with no modal flag - the new convention.
FileDialogWrapper(
wxWindow *parent,
const wxString& message = _("Select a file"),
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
// Important: default window name localizes!
const wxString& name = _("File Dialog"))
: wxTabTraversalWrapper<FileDialog>
( parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name )
{}
// Pseudo ctor
void Create(
wxWindow *parent,
const wxString& message = _("Select a file"),
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
// Important: default window name localizes!
const wxString& name = _("File Dialog"))
{
wxTabTraversalWrapper<FileDialog>::Create(
parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name
);
}
};
#endif