Audacity  3.0.3
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 
17 #include "widgets/wxPanelWrapper.h" // to inherit
18 #include "ComponentInterface.h" // member variable
19 
20 class wxArrayString;
21 class wxGridEvent;
22 class AudacityProject;
23 class ChoiceEditor;
24 class Grid;
25 class NumericEditor;
26 class TrackList;
27 class RowData;
28 class EmptyLabelRenderer;
29 class LabelTrack;
30 class ViewInfo;
31 class ShuttleGui;
32 
33 typedef std::vector<RowData> RowDataArray;
34 
35 class LabelDialog final : public wxDialogWrapper
36 {
37  public:
38 
39  LabelDialog(wxWindow *parent,
40  AudacityProject &project,
41  TrackList *tracks,
42 
43  // if NULL edit all tracks, else this one only:
44  LabelTrack *selectedTrack,
45 
46  // This is nonnegative only if selectedTrack is not NULL
47  // and is the unique label to edit
48  int index,
49 
50  ViewInfo &viewinfo,
51  double rate,
53  const NumericFormatSymbol &freqFormat);
54  ~LabelDialog();
55 
56  bool Show(bool show = true) override;
57 
58  private:
59 
60  void Populate();
61  void PopulateOrExchange( ShuttleGui & S );
62  void PopulateLabels();
63  void OnHelp(wxCommandEvent & event);
64  ManualPageID GetHelpPageName() {return "Labels_Editor";}
65 
66  bool TransferDataToWindow() override;
67  bool TransferDataFromWindow() override;
68  bool Validate() override;
69  void FindAllLabels();
70  void AddLabels(const LabelTrack *t);
71  void FindInitialRow();
72  wxString TrackName(int & index, const wxString &dflt = _("Label Track"));
73 
74  void OnUpdate(wxCommandEvent &event);
75  void OnFreqUpdate(wxCommandEvent &event);
76  void OnInsert(wxCommandEvent &event);
77  void OnRemove(wxCommandEvent &event);
78  void OnImport(wxCommandEvent &event);
79  void OnExport(wxCommandEvent &event);
80  void OnSelectCell(wxGridEvent &event);
81  void OnCellChange(wxGridEvent &event);
82  void OnChangeTrack(wxGridEvent &event, int row, RowData *rd);
83  void OnChangeLabel(wxGridEvent &event, int row, RowData *rd);
84  void OnChangeStime(wxGridEvent &event, int row, RowData *rd);
85  void OnChangeEtime(wxGridEvent &event, int row, RowData *rd);
86  void OnChangeLfreq(wxGridEvent &event, int row, RowData *rd);
87  void OnChangeHfreq(wxGridEvent &event, int row, RowData *rd);
88  void OnOK(wxCommandEvent &event);
89  void OnCancel(wxCommandEvent &event);
90 
91  void ReadSize();
92  void WriteSize();
93 
94  private:
95 
97 
102 
104 
107  int mIndex { -1 };
109  wxArrayString mTrackNames;
110  double mRate;
112 
114 
115  DECLARE_EVENT_TABLE()
116 };
117 
118 #endif
LabelDialog::mGrid
Grid * mGrid
Definition: LabelDialog.h:98
LabelDialog::OnChangeLfreq
void OnChangeLfreq(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:879
LabelDialog::OnChangeHfreq
void OnChangeHfreq(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:891
LabelDialog::OnSelectCell
void OnSelectCell(wxGridEvent &event)
Definition: LabelDialog.cpp:746
LabelDialog
Dialog for editing labels.
Definition: LabelDialog.h:36
LabelDialog::PopulateLabels
void PopulateLabels()
Definition: LabelDialog.cpp:129
LabelDialog::TrackName
wxString TrackName(int &index, const wxString &dflt=_("Label Track"))
Definition: LabelDialog.cpp:446
LabelDialog::OnChangeLabel
void OnChangeLabel(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:847
LabelDialog::mData
RowDataArray mData
Definition: LabelDialog.h:103
LabelDialog::~LabelDialog
~LabelDialog()
Definition: LabelDialog.cpp:125
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1280
ViewInfo
Definition: ViewInfo.h:202
Grid
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:185
LabelDialog::FindAllLabels
void FindAllLabels()
Definition: LabelDialog.cpp:458
LabelDialog::mViewInfo
ViewInfo * mViewInfo
Definition: LabelDialog.h:108
wxPanelWrapper.h
LabelDialog::OnExport
void OnExport(wxCommandEvent &event)
Definition: LabelDialog.cpp:671
LabelDialog::mSelectedTrack
LabelTrack * mSelectedTrack
Definition: LabelDialog.h:106
LabelDialog::OnHelp
void OnHelp(wxCommandEvent &event)
Definition: LabelDialog.cpp:287
LabelDialog::OnInsert
void OnInsert(wxCommandEvent &event)
Definition: LabelDialog.cpp:553
LabelTrack
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:88
LabelDialog::OnOK
void OnOK(wxCommandEvent &event)
Definition: LabelDialog.cpp:922
LabelDialog::mFrequencyEditor
NumericEditor * mFrequencyEditor
Definition: LabelDialog.h:101
LabelDialog::Validate
bool Validate() override
Definition: LabelDialog.cpp:436
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
LabelDialog::AddLabels
void AddLabels(const LabelTrack *t)
Definition: LabelDialog.cpp:473
LabelDialog::TransferDataToWindow
bool TransferDataToWindow() override
Definition: LabelDialog.cpp:294
ComponentInterface.h
LabelDialog::OnCellChange
void OnCellChange(wxGridEvent &event)
Definition: LabelDialog.cpp:762
LabelDialog::mIndex
int mIndex
Definition: LabelDialog.h:107
LabelDialog::mFreqFormat
NumericFormatSymbol mFreqFormat
Definition: LabelDialog.h:111
format
int format
Definition: ExportPCM.cpp:56
RowDataArray
std::vector< RowData > RowDataArray
Definition: LabelDialog.h:31
LabelDialog::mTimeEditor
NumericEditor * mTimeEditor
Definition: LabelDialog.h:100
LabelDialog::FindInitialRow
void FindInitialRow()
Definition: LabelDialog.cpp:493
LabelDialog::Populate
void Populate()
Creates the dialog and its contents.
Definition: LabelDialog.cpp:216
LabelDialog::OnChangeStime
void OnChangeStime(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:855
NumericEditor
wxGridCellEditor for the NumericTextCtrl.
Definition: Grid.h:38
wxDialogWrapper
Definition: wxPanelWrapper.h:81
LabelDialog::Show
bool Show(bool show=true) override
Definition: LabelDialog.cpp:357
LabelDialog::mProject
AudacityProject & mProject
Definition: LabelDialog.h:96
LabelDialog::OnChangeEtime
void OnChangeEtime(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:867
RowData
Definition: LabelDialog.cpp:62
TaggedIdentifier< ManualPageIDTag >
_
#define _(s)
Definition: Internat.h:75
ChoiceEditor
Modified version of wxGridChoiceEditor using wxChoice instead of wxComboBox.
Definition: Grid.h:121
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
LabelDialog::OnFreqUpdate
void OnFreqUpdate(wxCommandEvent &event)
Definition: LabelDialog.cpp:543
LabelDialog::OnImport
void OnImport(wxCommandEvent &event)
Definition: LabelDialog.cpp:631
LabelDialog::GetHelpPageName
ManualPageID GetHelpPageName()
Definition: LabelDialog.h:64
LabelDialog::OnRemove
void OnRemove(wxCommandEvent &event)
Definition: LabelDialog.cpp:593
LabelDialog::LabelDialog
LabelDialog(wxWindow *parent, AudacityProject &project, TrackList *tracks, LabelTrack *selectedTrack, int index, ViewInfo &viewinfo, double rate, const NumericFormatSymbol &format, const NumericFormatSymbol &freqFormat)
LabelDialog::ReadSize
void ReadSize()
Definition: LabelDialog.cpp:903
LabelDialog::OnUpdate
void OnUpdate(wxCommandEvent &event)
Definition: LabelDialog.cpp:533
LabelDialog::OnChangeTrack
void OnChangeTrack(wxGridEvent &event, int row, RowData *rd)
Definition: LabelDialog.cpp:813
LabelDialog::mRate
double mRate
Definition: LabelDialog.h:110
LabelDialog::OnCancel
void OnCancel(wxCommandEvent &event)
Definition: LabelDialog.cpp:939
LabelDialog::WriteSize
void WriteSize()
Definition: LabelDialog.cpp:915
LabelDialog::mChoiceEditor
ChoiceEditor * mChoiceEditor
Definition: LabelDialog.h:99
LabelDialog::mInitialRow
int mInitialRow
Definition: LabelDialog.h:113
LabelDialog::mTrackNames
wxArrayString mTrackNames
Definition: LabelDialog.h:109
LabelDialog::mFormat
NumericFormatSymbol mFormat
Definition: LabelDialog.h:111
LabelDialog::mTracks
TrackList * mTracks
Definition: LabelDialog.h:105
LabelDialog::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: LabelDialog.cpp:376
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
LabelDialog::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: LabelDialog.cpp:256