Audacity  2.2.2
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>
16 #include <wx/window.h>
17 #include "../widgets/Grid.h"
18 
19 #include "PrefsPanel.h"
20 
21 #include "../import/Import.h"
22 #include "../import/ImportPlugin.h"
23 
24 class wxButton;
25 class wxListCtrl;
26 class wxListEvent;
27 class ExtImportPrefs;
28 class ShuttleGui;
29 
30 class ExtImportPrefsDropTarget final : public wxDropTarget
31 {
32 public:
33  // Takes ownership of the argument
34  ExtImportPrefsDropTarget(wxDataObject* dataObject = nullptr);
36  wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
37  bool OnDrop(wxCoord x, wxCoord y);
38  wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
39  wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
40  void OnLeave();
41  void SetPrefs (ExtImportPrefs *prefs);
42 private:
44 };
45 
46 class ExtImportPrefs final : public PrefsPanel
47 {
48  public:
49  ExtImportPrefs(wxWindow * parent, wxWindowID winid);
51  bool Commit() override;
52  wxString HelpPageName() override;
53  void PopulateOrExchange(ShuttleGui & S) override;
54 
55  void OnPluginKeyDown(wxListEvent& event);
56  void OnPluginBeginDrag(wxListEvent& event);
57  void OnRuleTableKeyDown(wxKeyEvent& event);
58  void OnRuleTableSelect(wxGridEvent& event);
59  void OnRuleTableEdit(wxGridEvent& event);
60  void OnRuleTableSelectRange(wxGridRangeSelectEvent& event);
61  void OnRuleTableCellClick(wxGridEvent& event);
62  void OnAddRule(wxCommandEvent& event);
63  void OnDelRule(wxCommandEvent& event);
64  void OnRuleMoveUp(wxCommandEvent& event);
65  void OnRuleMoveDown(wxCommandEvent& event);
66  void OnFilterMoveUp(wxCommandEvent& event);
67  void OnFilterMoveDown(wxCommandEvent& event);
68 
69  void OnNavKey (wxNavigationKeyEvent& event);
70 
71  void SwapRows (int row1, int row2);
72  void SwapPluginRows (int row1, int row2);
73 
74  Grid *GetRuleTable() { return RuleTable; }
75  wxListCtrl *GetPluginList() { return PluginList; }
76 
77  wxWindow *GetDragFocus() { return mDragFocus; }
78 
79  private:
80 
82  wxListCtrl *PluginList;
83 
84  wxButton *AddRule;
85  wxButton *DelRule;
86  wxButton *MoveRuleUp;
87  wxButton *MoveRuleDown;
88  wxButton *MoveFilterUp;
89  wxButton *MoveFilterDown;
90 
91  wxTextDataObject *dragtext1 {};
92  wxTextDataObject *dragtext2 {};
93 
95  wxWindow *mDragFocus;
98 
100 
101  void FakeOnPluginKeyDown (int keycode);
102  void DoOnRuleTableKeyDown (int keycode);
103  bool DoOnPluginKeyDown (int code);
104  void DoOnRuleTableSelect (int toprow);
105  void AddItemToTable (int index, const ExtImportItem *item);
106  void Populate();
107  DECLARE_EVENT_TABLE()
108 };
109 
110 
112 {
113 public:
114  PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
115 };
116 #endif
bool DoOnPluginKeyDown(int code)
void SwapRows(int row1, int row2)
void OnAddRule(wxCommandEvent &event)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void OnDelRule(wxCommandEvent &event)
void AddItemToTable(int index, const ExtImportItem *item)
ExtImportPrefsDropTarget(wxDataObject *dataObject=nullptr)
wxButton * MoveRuleDown
wxButton * MoveFilterDown
bool Commit() override
ExtImportPrefs(wxWindow *parent, wxWindowID winid)
void OnRuleMoveUp(wxCommandEvent &event)
void OnRuleTableCellClick(wxGridEvent &event)
wxWindow * mDragFocus
Grid * GetRuleTable()
void OnRuleTableEdit(wxGridEvent &event)
A PrefsPanel used to select extended import filter options.
bool mStopRecursiveSelection
wxTextDataObject * dragtext2
void FakeOnPluginKeyDown(int keycode)
void DoOnRuleTableSelect(int toprow)
PrefsPanel * operator()(wxWindow *parent, wxWindowID winid) override
void Populate()
Creates the dialog and its contents.
void OnRuleTableSelect(wxGridEvent &event)
void PopulateOrExchange(ShuttleGui &S) override
wxButton * AddRule
wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def)
void OnRuleTableSelectRange(wxGridRangeSelectEvent &event)
void SwapPluginRows(int row1, int row2)
ExtImportPrefs * mPrefs
void OnRuleMoveDown(wxCommandEvent &event)
void DoOnRuleTableKeyDown(int keycode)
wxButton * MoveFilterUp
wxString HelpPageName() override
void OnFilterMoveUp(wxCommandEvent &event)
void OnFilterMoveDown(wxCommandEvent &event)
wxListCtrl * GetPluginList()
wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def)
Used within the PrefsDialog, classes derived from this class include AudioIOPrefs, BatchPrefs, DirectoriesPrefs, FileFormatPrefs, GUIPrefs, KeyConfigPrefs, MousePrefs, QualityPrefs, SpectrumPrefs and ThemePrefs.
Definition: PrefsPanel.h:45
void OnPluginKeyDown(wxListEvent &event)
void SetPrefs(ExtImportPrefs *prefs)
void OnNavKey(wxNavigationKeyEvent &event)
void OnPluginBeginDrag(wxListEvent &event)
wxListCtrl * PluginList
wxButton * MoveRuleUp
wxWindow * GetDragFocus()
bool OnDrop(wxCoord x, wxCoord y)
wxTextDataObject * dragtext1
wxButton * DelRule
void OnRuleTableKeyDown(wxKeyEvent &event)
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:193