Audacity 3.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
17#include "widgets/wxPanelWrapper.h" // to inherit
18#include "ComponentInterface.h" // member variable
19
20class wxArrayString;
21class wxGridEvent;
22class AudacityProject;
23class ChoiceEditor;
24class Grid;
25class NumericEditor;
26class TrackList;
27class RowData;
28class EmptyLabelRenderer;
29class LabelTrack;
30class ViewInfo;
31class ShuttleGui;
32
33typedef std::vector<RowData> RowDataArray;
34
35class 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);
55
56 bool Show(bool show = true) override;
57
58 private:
59
60 void Populate();
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
int format
Definition: ExportPCM.cpp:53
#define _(s)
Definition: Internat.h:75
std::vector< RowData > RowDataArray
Definition: LabelDialog.h:31
#define S(N)
Definition: ToChars.cpp:64
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
Modified version of wxGridChoiceEditor using wxChoice instead of wxComboBox.
Definition: Grid.h:121
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:185
Dialog for editing labels.
Definition: LabelDialog.h:36
void OnChangeEtime(wxGridEvent &event, int row, RowData *rd)
bool Validate() override
void PopulateLabels()
void OnFreqUpdate(wxCommandEvent &event)
double mRate
Definition: LabelDialog.h:110
void OnChangeTrack(wxGridEvent &event, int row, RowData *rd)
void OnRemove(wxCommandEvent &event)
wxString TrackName(int &index, const wxString &dflt=_("Label Track"))
ChoiceEditor * mChoiceEditor
Definition: LabelDialog.h:99
bool TransferDataToWindow() override
void AddLabels(const LabelTrack *t)
void OnSelectCell(wxGridEvent &event)
void FindInitialRow()
void WriteSize()
ViewInfo * mViewInfo
Definition: LabelDialog.h:108
LabelTrack * mSelectedTrack
Definition: LabelDialog.h:106
void OnHelp(wxCommandEvent &event)
void OnOK(wxCommandEvent &event)
void OnCellChange(wxGridEvent &event)
Grid * mGrid
Definition: LabelDialog.h:98
TrackList * mTracks
Definition: LabelDialog.h:105
void OnChangeLabel(wxGridEvent &event, int row, RowData *rd)
void OnInsert(wxCommandEvent &event)
void OnChangeLfreq(wxGridEvent &event, int row, RowData *rd)
void FindAllLabels()
NumericEditor * mFrequencyEditor
Definition: LabelDialog.h:101
NumericFormatSymbol mFreqFormat
Definition: LabelDialog.h:111
wxArrayString mTrackNames
Definition: LabelDialog.h:109
RowDataArray mData
Definition: LabelDialog.h:103
void OnCancel(wxCommandEvent &event)
ManualPageID GetHelpPageName()
Definition: LabelDialog.h:64
AudacityProject & mProject
Definition: LabelDialog.h:96
bool TransferDataFromWindow() override
void OnExport(wxCommandEvent &event)
NumericFormatSymbol mFormat
Definition: LabelDialog.h:111
LabelDialog(wxWindow *parent, AudacityProject &project, TrackList *tracks, LabelTrack *selectedTrack, int index, ViewInfo &viewinfo, double rate, const NumericFormatSymbol &format, const NumericFormatSymbol &freqFormat)
void OnChangeStime(wxGridEvent &event, int row, RowData *rd)
void PopulateOrExchange(ShuttleGui &S)
void OnImport(wxCommandEvent &event)
void OnUpdate(wxCommandEvent &event)
NumericEditor * mTimeEditor
Definition: LabelDialog.h:100
bool Show(bool show=true) override
void OnChangeHfreq(wxGridEvent &event, int row, RowData *rd)
void ReadSize()
void Populate()
Creates the dialog and its contents.
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:87
wxGridCellEditor for the NumericTextCtrl.
Definition: Grid.h:38
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1338