Audacity 3.2.0
ExtImportPrefs.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 ExtImportPrefs.h
6
7 LRN
8
9**********************************************************************/
10
11#ifndef __AUDACITY_EXT_IMPORT_PREFS__
12#define __AUDACITY_EXT_IMPORT_PREFS__
13
14#include <wx/defs.h>
15#include <wx/dnd.h> // to inherit wxDropTarget
16
17#include "PrefsPanel.h"
18
19#include "ImportPlugin.h"
20
21class wxButton;
22class wxGridEvent;
23class wxGridRangeSelectEvent;
24class wxListCtrl;
25class wxListEvent;
26class ExtImportItem;
27class ExtImportPrefs;
28class Grid;
29class ShuttleGui;
30
31#define EXT_IMPORT_PREFS_PLUGIN_SYMBOL ComponentInterfaceSymbol{ XO("Ext Import") }
32
33class ExtImportPrefsDropTarget final : public wxDropTarget
34{
35public:
36 // Takes ownership of the argument
37 ExtImportPrefsDropTarget(wxDataObject* dataObject = nullptr);
39 wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
40 bool OnDrop(wxCoord x, wxCoord y);
41 wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
42 wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
43 void OnLeave();
45private:
47};
48
49class ExtImportPrefs final : public PrefsPanel
50{
51 public:
52 ExtImportPrefs(wxWindow * parent, wxWindowID winid);
54 ComponentInterfaceSymbol GetSymbol() const override;
55 TranslatableString GetDescription() const override;
56
57 bool Commit() override;
58 ManualPageID HelpPageName() override;
59 void PopulateOrExchange(ShuttleGui & S) override;
60
61 // See bug #2315 for discussion. This should be reviewed
62 // and (possibly) removed after wx3.1.3.
63 void OnShow(wxShowEvent& event);
64
65 void OnPluginKeyDown(wxListEvent& event);
66 void OnPluginBeginDrag(wxListEvent& event);
67 void OnRuleTableKeyDown(wxKeyEvent& event);
68 void OnRuleTableSelect(wxGridEvent& event);
69 void OnRuleTableEdit(wxGridEvent& event);
70 void OnRuleTableSelectRange(wxGridRangeSelectEvent& event);
71 void OnRuleTableCellClick(wxGridEvent& event);
72 void OnAddRule(wxCommandEvent& event);
73 void OnDelRule(wxCommandEvent& event);
74 void OnRuleMoveUp(wxCommandEvent& event);
75 void OnRuleMoveDown(wxCommandEvent& event);
76 void OnFilterMoveUp(wxCommandEvent& event);
77 void OnFilterMoveDown(wxCommandEvent& event);
78
79 void OnNavKey (wxNavigationKeyEvent& event);
80
81 void SwapRows (int row1, int row2);
82 void SwapPluginRows (int row1, int row2);
83
85 wxListCtrl *GetPluginList() { return PluginList; }
86
87 wxWindow *GetDragFocus() { return mDragFocus; }
88
89 private:
90
92 wxListCtrl *PluginList;
93
94 wxButton *AddRule;
95 wxButton *DelRule;
96 wxButton *MoveRuleUp;
97 wxButton *MoveRuleDown;
98 wxButton *MoveFilterUp;
99 wxButton *MoveFilterDown;
100
101 wxTextDataObject *dragtext1 {};
102 wxTextDataObject *dragtext2 {};
103
105 wxWindow *mDragFocus;
108
110
111 void FakeOnPluginKeyDown (int keycode);
112 void DoOnRuleTableKeyDown (int keycode);
113 bool DoOnPluginKeyDown (int code);
114 void DoOnRuleTableSelect (int toprow);
115 void AddItemToTable (int index, const ExtImportItem *item);
116 void Populate();
117 DECLARE_EVENT_TABLE()
118};
119
120#endif
The interface that all file import "plugins" (if you want to call them that) must implement....
MockedPrefs prefs
#define S(N)
Definition: ToChars.cpp:64
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
ExtImportPrefsDropTarget(wxDataObject *dataObject=nullptr)
void SetPrefs(ExtImportPrefs *prefs)
wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def)
ExtImportPrefs * mPrefs
wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def)
bool OnDrop(wxCoord x, wxCoord y)
A PrefsPanel used to select extended import filter options.
wxButton * MoveFilterUp
Grid * GetRuleTable()
wxButton * MoveRuleUp
ExtImportPrefs(wxWindow *parent, wxWindowID winid)
wxTextDataObject * dragtext2
void OnAddRule(wxCommandEvent &event)
wxTextDataObject * dragtext1
wxButton * MoveFilterDown
void OnRuleTableCellClick(wxGridEvent &event)
void OnFilterMoveDown(wxCommandEvent &event)
bool DoOnPluginKeyDown(int code)
void DoOnRuleTableKeyDown(int keycode)
TranslatableString GetDescription() const override
wxListCtrl * GetPluginList()
wxWindow * GetDragFocus()
void OnDelRule(wxCommandEvent &event)
wxButton * DelRule
void SwapPluginRows(int row1, int row2)
bool Commit() override
void OnRuleMoveUp(wxCommandEvent &event)
void OnRuleTableSelect(wxGridEvent &event)
void Populate()
Creates the dialog and its contents.
wxButton * MoveRuleDown
void PopulateOrExchange(ShuttleGui &S) override
void OnRuleTableKeyDown(wxKeyEvent &event)
void OnNavKey(wxNavigationKeyEvent &event)
void OnShow(wxShowEvent &event)
void OnPluginKeyDown(wxListEvent &event)
bool mStopRecursiveSelection
void OnPluginBeginDrag(wxListEvent &event)
void FakeOnPluginKeyDown(int keycode)
void OnRuleTableEdit(wxGridEvent &event)
wxButton * AddRule
void DoOnRuleTableSelect(int toprow)
void AddItemToTable(int index, const ExtImportItem *item)
void OnRuleTableSelectRange(wxGridRangeSelectEvent &event)
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
void SwapRows(int row1, int row2)
void OnFilterMoveUp(wxCommandEvent &event)
wxListCtrl * PluginList
ComponentInterfaceSymbol GetSymbol() const override
void OnRuleMoveDown(wxCommandEvent &event)
wxWindow * mDragFocus
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:190
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
Definition: PrefsPanel.h:51
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.