Audacity  2.2.0
LabelDialog.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  LabelDialog.h
6 
7  Dominic Mazzoni
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_LABELDIALOG__
12 #define __AUDACITY_LABELDIALOG__
13 
14 #include <vector>
15 #include <wx/defs.h>
16 #include <wx/event.h>
17 #include <wx/grid.h>
18 #include <wx/string.h>
19 
20 #include "Internat.h"
21 #include "widgets/Grid.h"
22 #include "widgets/wxPanelWrapper.h"
23 
24 class TrackFactory;
25 class TrackList;
26 class RowData;
27 class EmptyLabelRenderer;
28 class LabelTrack;
29 class ViewInfo;
30 
31 typedef std::vector<RowData> RowDataArray;
32 
33 class LabelDialog final : public wxDialogWrapper
34 {
35  public:
36 
37  LabelDialog(wxWindow *parent,
38  TrackFactory &factory,
39  TrackList *tracks,
40 
41  // if NULL edit all tracks, else this one only:
42  LabelTrack *selectedTrack,
43 
44  // This is nonnegative only if selectedTrack is not NULL
45  // and is the unique label to edit
46  int index,
47 
48  ViewInfo &viewinfo,
49  double rate,
50  const wxString & format, const wxString &freqFormat);
51  ~LabelDialog();
52 
53  bool Show(bool show = true) override;
54 
55  private:
56 
57  bool TransferDataToWindow();
59  bool Validate();
60  void FindAllLabels();
61  void AddLabels(const LabelTrack *t);
62  void FindInitialRow();
63  wxString TrackName(int & index, const wxString &dflt = _("Label Track"));
64 
65  void OnUpdate(wxCommandEvent &event);
66  void OnFreqUpdate(wxCommandEvent &event);
67  void OnInsert(wxCommandEvent &event);
68  void OnRemove(wxCommandEvent &event);
69  void OnImport(wxCommandEvent &event);
70  void OnExport(wxCommandEvent &event);
71  void OnSelectCell(wxGridEvent &event);
72  void OnCellChange(wxGridEvent &event);
73  void OnChangeTrack(wxGridEvent &event, int row, RowData *rd);
74  void OnChangeLabel(wxGridEvent &event, int row, RowData *rd);
75  void OnChangeStime(wxGridEvent &event, int row, RowData *rd);
76  void OnChangeEtime(wxGridEvent &event, int row, RowData *rd);
77  void OnChangeLfreq(wxGridEvent &event, int row, RowData *rd);
78  void OnChangeHfreq(wxGridEvent &event, int row, RowData *rd);
79  void OnOK(wxCommandEvent &event);
80  void OnCancel(wxCommandEvent &event);
81 
82  private:
83 
88 
90 
94  int mIndex { -1 };
96  wxArrayString mTrackNames;
97  double mRate;
98  wxString mFormat;
99  wxString mFreqFormat;
100 
102 
103  DECLARE_EVENT_TABLE()
104 };
105 
106 #endif
bool Show(bool show=true) override
Definition: LabelDialog.cpp:314
wxArrayString mTrackNames
Definition: LabelDialog.h:96
A list of TrackListNode items.
Definition: Track.h:532
void FindAllLabels()
Definition: LabelDialog.cpp:412
Definition: Grid.h:126
ViewInfo is used mainly to hold the zooming, selection and scroll information. It also has some statu...
Definition: ViewInfo.h:138
LabelTrack * mSelectedTrack
Definition: LabelDialog.h:93
void OnRemove(wxCommandEvent &event)
Definition: LabelDialog.cpp:548
void OnOK(wxCommandEvent &event)
Definition: LabelDialog.cpp:861
void OnChangeLfreq(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:837
double mRate
Definition: LabelDialog.h:97
void OnChangeLabel(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:805
void OnCancel(wxCommandEvent &event)
Definition: LabelDialog.cpp:877
NumericEditor * mFrequencyEditor
Definition: LabelDialog.h:87
LabelDialog(wxWindow *parent, TrackFactory &factory, TrackList *tracks, LabelTrack *selectedTrack, int index, ViewInfo &viewinfo, double rate, const wxString &format, const wxString &freqFormat)
~LabelDialog()
Definition: LabelDialog.cpp:247
void OnExport(wxCommandEvent &event)
Definition: LabelDialog.cpp:625
RowDataArray mData
Definition: LabelDialog.h:89
Definition: wxPanelWrapper.h:19
void OnCellChange(wxGridEvent &event)
Definition: LabelDialog.cpp:720
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:676
void OnChangeEtime(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:825
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:114
void AddLabels(const LabelTrack *t)
Definition: LabelDialog.cpp:432
bool TransferDataToWindow()
Definition: LabelDialog.cpp:251
void OnFreqUpdate(wxCommandEvent &event)
Definition: LabelDialog.cpp:501
void OnImport(wxCommandEvent &event)
Definition: LabelDialog.cpp:586
void FindInitialRow()
Definition: LabelDialog.cpp:452
int format
Definition: ExportPCM.cpp:56
wxString mFormat
Definition: LabelDialog.h:98
void OnChangeTrack(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:771
ViewInfo * mViewInfo
Definition: LabelDialog.h:95
Dialog for editing labels.
Definition: LabelDialog.h:33
Definition: LabelDialog.cpp:57
int mInitialRow
Definition: LabelDialog.h:101
void OnInsert(wxCommandEvent &event)
Definition: LabelDialog.cpp:510
bool TransferDataFromWindow()
Definition: LabelDialog.cpp:327
wxString mFreqFormat
Definition: LabelDialog.h:99
Definition: Grid.h:42
std::vector< RowData > RowDataArray
Definition: LabelDialog.h:29
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
Definition: TrackControls.cpp:137
void OnChangeHfreq(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:849
ChoiceEditor * mChoiceEditor
Definition: LabelDialog.h:85
int mIndex
Definition: LabelDialog.h:94
TrackList * mTracks
Definition: LabelDialog.h:92
bool Validate()
Definition: LabelDialog.cpp:390
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:193
Grid * mGrid
Definition: LabelDialog.h:84
NumericEditor * mTimeEditor
Definition: LabelDialog.h:86
void OnSelectCell(wxGridEvent &event)
Definition: LabelDialog.cpp:699
void OnChangeStime(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:813
wxString TrackName(int &index, const wxString &dflt=_("Label Track"))
Definition: LabelDialog.cpp:400
void OnUpdate(wxCommandEvent &event)
Definition: LabelDialog.cpp:492
TrackFactory & mFactory
Definition: LabelDialog.h:91