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 "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,
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 const NumericFormatID & format,
52 const NumericFormatID &freqFormat);
54
55 bool Show(bool show = true) override;
56
57 private:
58
59 void Populate();
61 void PopulateLabels();
62 void OnHelp(wxCommandEvent & event);
63 ManualPageID 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
96
101
103
106 int mIndex { -1 };
108 wxArrayString mTrackNames;
110
112
113 DECLARE_EVENT_TABLE()
114};
115
116#endif
#define _(s)
Definition: Internat.h:73
std::vector< RowData > RowDataArray
Definition: LabelDialog.h:31
const auto tracks
const auto project
#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:127
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:190
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)
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:98
bool TransferDataToWindow() override
void AddLabels(const LabelTrack *t)
void OnSelectCell(wxGridEvent &event)
void FindInitialRow()
void WriteSize()
ViewInfo * mViewInfo
Definition: LabelDialog.h:107
LabelTrack * mSelectedTrack
Definition: LabelDialog.h:105
void OnHelp(wxCommandEvent &event)
void OnOK(wxCommandEvent &event)
void OnCellChange(wxGridEvent &event)
NumericFormatID mFormat
Definition: LabelDialog.h:109
Grid * mGrid
Definition: LabelDialog.h:97
TrackList * mTracks
Definition: LabelDialog.h:104
void OnChangeLabel(wxGridEvent &event, int row, RowData *rd)
void OnInsert(wxCommandEvent &event)
void OnChangeLfreq(wxGridEvent &event, int row, RowData *rd)
NumericFormatID mFreqFormat
Definition: LabelDialog.h:109
void FindAllLabels()
NumericEditor * mFrequencyEditor
Definition: LabelDialog.h:100
wxArrayString mTrackNames
Definition: LabelDialog.h:108
RowDataArray mData
Definition: LabelDialog.h:102
void OnCancel(wxCommandEvent &event)
LabelDialog(wxWindow *parent, AudacityProject &project, TrackList *tracks, LabelTrack *selectedTrack, int index, ViewInfo &viewinfo, const NumericFormatID &format, const NumericFormatID &freqFormat)
ManualPageID GetHelpPageName()
Definition: LabelDialog.h:63
AudacityProject & mProject
Definition: LabelDialog.h:95
bool TransferDataFromWindow() override
void OnExport(wxCommandEvent &event)
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:99
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:40
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:630
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:993