Audacity  2.2.2
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 class ShuttleGui;
31 
32 typedef std::vector<RowData> RowDataArray;
33 
34 class LabelDialog final : public wxDialogWrapper
35 {
36  public:
37 
38  LabelDialog(wxWindow *parent,
39  TrackFactory &factory,
40  TrackList *tracks,
41 
42  // if NULL edit all tracks, else this one only:
43  LabelTrack *selectedTrack,
44 
45  // This is nonnegative only if selectedTrack is not NULL
46  // and is the unique label to edit
47  int index,
48 
49  ViewInfo &viewinfo,
50  double rate,
51  const NumericFormatId & format,
52  const NumericFormatId &freqFormat);
53  ~LabelDialog();
54 
55  bool Show(bool show = true) override;
56 
57  private:
58 
59  void Populate();
60  void PopulateOrExchange( ShuttleGui & S );
61  void PopulateLabels();
62  virtual void OnHelp(wxCommandEvent & event);
63  virtual wxString GetHelpPageName() {return "Labels_Editor";};
64 
65  bool TransferDataToWindow() override;
66  bool TransferDataFromWindow() override;
67  bool Validate() override;
68  void FindAllLabels();
69  void AddLabels(const LabelTrack *t);
70  void FindInitialRow();
71  wxString TrackName(int & index, const wxString &dflt = _("Label Track"));
72 
73  void OnUpdate(wxCommandEvent &event);
74  void OnFreqUpdate(wxCommandEvent &event);
75  void OnInsert(wxCommandEvent &event);
76  void OnRemove(wxCommandEvent &event);
77  void OnImport(wxCommandEvent &event);
78  void OnExport(wxCommandEvent &event);
79  void OnSelectCell(wxGridEvent &event);
80  void OnCellChange(wxGridEvent &event);
81  void OnChangeTrack(wxGridEvent &event, int row, RowData *rd);
82  void OnChangeLabel(wxGridEvent &event, int row, RowData *rd);
83  void OnChangeStime(wxGridEvent &event, int row, RowData *rd);
84  void OnChangeEtime(wxGridEvent &event, int row, RowData *rd);
85  void OnChangeLfreq(wxGridEvent &event, int row, RowData *rd);
86  void OnChangeHfreq(wxGridEvent &event, int row, RowData *rd);
87  void OnOK(wxCommandEvent &event);
88  void OnCancel(wxCommandEvent &event);
89 
90  void ReadSize();
91  void WriteSize();
92 
93  private:
94 
99 
101 
105  int mIndex { -1 };
107  wxArrayString mTrackNames;
108  double mRate;
110 
112 
113  DECLARE_EVENT_TABLE()
114 };
115 
116 #endif
bool Show(bool show=true) override
wxArrayString mTrackNames
Definition: LabelDialog.h:107
A list of TrackListNode items.
Definition: Track.h:618
void FindAllLabels()
ViewInfo is used mainly to hold the zooming, selection and scroll information. It also has some statu...
Definition: ViewInfo.h:141
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
LabelTrack * mSelectedTrack
Definition: LabelDialog.h:104
void OnRemove(wxCommandEvent &event)
void OnOK(wxCommandEvent &event)
void PopulateOrExchange(ShuttleGui &S)
NumericFormatId mFreqFormat
Definition: LabelDialog.h:109
void OnChangeLfreq(wxGridEvent &event, int row, RowData *rd)
double mRate
Definition: LabelDialog.h:108
void OnChangeLabel(wxGridEvent &event, int row, RowData *rd)
bool Validate() override
void OnCancel(wxCommandEvent &event)
NumericEditor * mFrequencyEditor
Definition: LabelDialog.h:98
void PopulateLabels()
LabelDialog(wxWindow *parent, TrackFactory &factory, TrackList *tracks, LabelTrack *selectedTrack, int index, ViewInfo &viewinfo, double rate, const NumericFormatId &format, const NumericFormatId &freqFormat)
NumericFormatId mFormat
Definition: LabelDialog.h:109
void OnExport(wxCommandEvent &event)
RowDataArray mData
Definition: LabelDialog.h:100
void OnCellChange(wxGridEvent &event)
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:862
void OnChangeEtime(wxGridEvent &event, int row, RowData *rd)
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:113
void AddLabels(const LabelTrack *t)
bool TransferDataToWindow() override
void OnFreqUpdate(wxCommandEvent &event)
void OnImport(wxCommandEvent &event)
void FindInitialRow()
int format
Definition: ExportPCM.cpp:56
void OnChangeTrack(wxGridEvent &event, int row, RowData *rd)
ViewInfo * mViewInfo
Definition: LabelDialog.h:106
Dialog for editing labels.
Definition: LabelDialog.h:34
void OnInsert(wxCommandEvent &event)
IdentInterfaceSymbol pairs a persistent string identifier used internally with an optional...
std::vector< RowData > RowDataArray
Definition: LabelDialog.h:30
bool TransferDataFromWindow() override
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void OnChangeHfreq(wxGridEvent &event, int row, RowData *rd)
ChoiceEditor * mChoiceEditor
Definition: LabelDialog.h:96
void WriteSize()
void Populate()
Creates the dialog and its contents.
virtual wxString GetHelpPageName()
Definition: LabelDialog.h:63
TrackList * mTracks
Definition: LabelDialog.h:103
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:193
Grid * mGrid
Definition: LabelDialog.h:95
NumericEditor * mTimeEditor
Definition: LabelDialog.h:97
virtual void OnHelp(wxCommandEvent &event)
void OnSelectCell(wxGridEvent &event)
void OnChangeStime(wxGridEvent &event, int row, RowData *rd)
void ReadSize()
wxString TrackName(int &index, const wxString &dflt=_("Label Track"))
void OnUpdate(wxCommandEvent &event)
TrackFactory & mFactory
Definition: LabelDialog.h:102