Audacity  2.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>
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);
51  bool Commit() override;
52  wxString HelpPageName() override;
53 
54  void OnPluginKeyDown(wxListEvent& event);
55  void OnPluginBeginDrag(wxListEvent& event);
56  void OnRuleTableKeyDown(wxKeyEvent& event);
57  void OnRuleTableSelect(wxGridEvent& event);
58  void OnRuleTableEdit(wxGridEvent& event);
59  void OnRuleTableSelectRange(wxGridRangeSelectEvent& event);
60  void OnRuleTableCellClick(wxGridEvent& event);
61  void OnAddRule(wxCommandEvent& event);
62  void OnDelRule(wxCommandEvent& event);
63  void OnRuleMoveUp(wxCommandEvent& event);
64  void OnRuleMoveDown(wxCommandEvent& event);
65  void OnFilterMoveUp(wxCommandEvent& event);
66  void OnFilterMoveDown(wxCommandEvent& event);
67 
68  void OnNavKey (wxNavigationKeyEvent& event);
69 
70  void SwapRows (int row1, int row2);
71  void SwapPluginRows (int row1, int row2);
72 
73  Grid *GetRuleTable() { return RuleTable; }
74  wxListCtrl *GetPluginList() { return PluginList; }
75 
76  wxWindow *GetDragFocus() { return mDragFocus; }
77 
78  private:
79 
81  wxListCtrl *PluginList;
82 
83  wxButton *AddRule;
84  wxButton *DelRule;
85  wxButton *MoveRuleUp;
86  wxButton *MoveRuleDown;
87  wxButton *MoveFilterUp;
88  wxButton *MoveFilterDown;
89 
90  wxTextDataObject *dragtext1 {};
91  wxTextDataObject *dragtext2 {};
92 
94  wxWindow *mDragFocus;
97 
99 
100  void FakeOnPluginKeyDown (int keycode);
101  void DoOnRuleTableKeyDown (int keycode);
102  bool DoOnPluginKeyDown (int code);
103  void DoOnRuleTableSelect (int toprow);
104  void AddItemToTable (int index, const ExtImportItem *item);
105  void Populate();
106  void PopulateOrExchange(ShuttleGui & S);
107  DECLARE_EVENT_TABLE()
108 };
109 
110 
112 {
113 public:
114  PrefsPanel *Create(wxWindow *parent) override;
115 };
116 #endif
Definition: ExtImportPrefs.h:30
bool DoOnPluginKeyDown(int code)
Definition: ExtImportPrefs.cpp:261
void SwapRows(int row1, int row2)
Definition: ExtImportPrefs.cpp:310
void OnAddRule(wxCommandEvent &event)
Definition: ExtImportPrefs.cpp:581
~ExtImportPrefsDropTarget()
Definition: ExtImportPrefs.cpp:684
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:366
void OnDelRule(wxCommandEvent &event)
Definition: ExtImportPrefs.cpp:594
void AddItemToTable(int index, const ExtImportItem *item)
Definition: ExtImportPrefs.cpp:551
ExtImportPrefsDropTarget(wxDataObject *dataObject=nullptr)
Definition: ExtImportPrefs.cpp:678
void OnLeave()
Definition: ExtImportPrefs.cpp:806
Grid * RuleTable
Definition: ExtImportPrefs.h:80
wxButton * MoveRuleDown
Definition: ExtImportPrefs.h:86
wxButton * MoveFilterDown
Definition: ExtImportPrefs.h:88
bool Commit() override
Definition: ExtImportPrefs.cpp:190
void OnRuleMoveUp(wxCommandEvent &event)
Definition: ExtImportPrefs.cpp:617
void OnRuleTableCellClick(wxGridEvent &event)
Definition: ExtImportPrefs.cpp:648
wxWindow * mDragFocus
Definition: ExtImportPrefs.h:94
Grid * GetRuleTable()
Definition: ExtImportPrefs.h:73
void OnRuleTableEdit(wxGridEvent &event)
Definition: ExtImportPrefs.cpp:476
A PrefsPanel used to select extended import filter options.
Definition: ExtImportPrefs.h:46
bool mCreateTable
Definition: ExtImportPrefs.h:93
bool mStopRecursiveSelection
Definition: ExtImportPrefs.h:96
wxTextDataObject * dragtext2
Definition: ExtImportPrefs.h:91
void FakeOnPluginKeyDown(int keycode)
Definition: ExtImportPrefs.cpp:627
void DoOnRuleTableSelect(int toprow)
Definition: ExtImportPrefs.cpp:426
void Populate()
Creates the dialog and its contents.
Definition: ExtImportPrefs.cpp:74
void OnRuleTableSelect(wxGridEvent &event)
Definition: ExtImportPrefs.cpp:394
wxButton * AddRule
Definition: ExtImportPrefs.h:83
wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def)
Definition: ExtImportPrefs.cpp:755
void OnRuleTableSelectRange(wxGridRangeSelectEvent &event)
Definition: ExtImportPrefs.cpp:408
bool mFakeKeyEvent
Definition: ExtImportPrefs.h:95
void SwapPluginRows(int row1, int row2)
Definition: ExtImportPrefs.cpp:215
ExtImportPrefs * mPrefs
Definition: ExtImportPrefs.h:43
void PopulateOrExchange(ShuttleGui &S)
Definition: ExtImportPrefs.cpp:85
void OnRuleMoveDown(wxCommandEvent &event)
Definition: ExtImportPrefs.cpp:622
void DoOnRuleTableKeyDown(int keycode)
Definition: ExtImportPrefs.cpp:372
~ExtImportPrefs()
Definition: ExtImportPrefs.cpp:69
wxButton * MoveFilterUp
Definition: ExtImportPrefs.h:87
int last_selected
Definition: ExtImportPrefs.h:98
wxString HelpPageName() override
Definition: ExtImportPrefs.cpp:673
void OnFilterMoveUp(wxCommandEvent &event)
Definition: ExtImportPrefs.cpp:637
void OnFilterMoveDown(wxCommandEvent &event)
Definition: ExtImportPrefs.cpp:642
wxListCtrl * GetPluginList()
Definition: ExtImportPrefs.h:74
wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
Definition: ExtImportPrefs.cpp:693
wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def)
Definition: ExtImportPrefs.cpp:749
Used within the PrefsDialog, classes derived from this class include AudioIOPrefs, BatchPrefs, DirectoriesPrefs, FileFormatPrefs, GUIPrefs, KeyConfigPrefs, MousePrefs, QualityPrefs, SpectrumPrefs and ThemePrefs.
Definition: PrefsPanel.h:43
Definition: ExtImportPrefs.h:111
void OnPluginKeyDown(wxListEvent &event)
Definition: ExtImportPrefs.cpp:198
void SetPrefs(ExtImportPrefs *prefs)
Definition: ExtImportPrefs.cpp:688
void OnNavKey(wxNavigationKeyEvent &event)
void OnPluginBeginDrag(wxListEvent &event)
Definition: ExtImportPrefs.cpp:336
wxListCtrl * PluginList
Definition: ExtImportPrefs.h:81
ExtImportPrefs(wxWindow *parent)
Definition: ExtImportPrefs.cpp:59
wxButton * MoveRuleUp
Definition: ExtImportPrefs.h:85
Definition: Import.h:50
wxWindow * GetDragFocus()
Definition: ExtImportPrefs.h:76
Definition: PrefsPanel.h:70
bool OnDrop(wxCoord x, wxCoord y)
Definition: ExtImportPrefs.cpp:722
wxTextDataObject * dragtext1
Definition: ExtImportPrefs.h:90
wxButton * DelRule
Definition: ExtImportPrefs.h:84
void OnRuleTableKeyDown(wxKeyEvent &event)
Definition: ExtImportPrefs.cpp:358
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:193
PrefsPanel * Create(wxWindow *parent) override
Definition: ExtImportPrefs.cpp:810