Audacity 3.2.0
MousePrefs.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 MousePrefs.cpp
6
7 James Crook
8
9********************************************************************//********************************************************************/
34
35
36#include "MousePrefs.h"
37
38#include <wx/defs.h>
39#include <wx/listctrl.h>
40
41#include "Prefs.h"
42#include "ShuttleGui.h"
43
44// The numbers of the columns of the mList.
45enum
46{
51};
52
53#if defined(__WXMAC__)
54#define CTRL XO("Command")
55#else
56#define CTRL XO("Ctrl")
57#endif
58
60MousePrefs::MousePrefs(wxWindow * parent, wxWindowID winid)
61: PrefsPanel(parent, winid, XO("Mouse"))
62{
63 Populate();
64
65 // See bug #2315 for discussion. This should be reviewed
66 // and (possibly) removed after wx3.1.3.
67 Bind(wxEVT_SHOW, &MousePrefs::OnShow, this);
68}
69
71{
72}
73
75{
77}
78
80{
81 return XO("Preferences for Mouse");
82}
83
85{
86 return "Mouse_Preferences";
87}
88
91{
92 //------------------------- Main section --------------------
93 // Now construct the GUI itself.
94 // Use 'eIsCreatingFromPrefs' so that the GUI is
95 // initialised with values from gPrefs.
98 // ----------------------- End of main section --------------
99 CreateList();
100 if (mList->GetItemCount() > 0) {
101 // set first item to be selected (and the focus when the
102 // list first becomes the focus)
103 mList->SetItemState(0, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED,
104 wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
105 }
106}
107
110{
111 S.SetBorder(2);
112
113 S.StartStatic(XO("Mouse Bindings (default values, not configurable)"), 1);
114 {
115 mList = S.AddListControlReportMode();
116 }
117 S.EndStatic();
118}
119
122{
123 //A dummy first column, which is then deleted, is a workaround - under Windows the first column
124 //can't be right aligned.
125 mList->InsertColumn(0, wxT(""), wxLIST_FORMAT_LEFT);
126 mList->InsertColumn(ToolColumn + 1, _("Tool"), wxLIST_FORMAT_RIGHT);
127 mList->InsertColumn(ActionColumn + 1, _("Command Action"), wxLIST_FORMAT_RIGHT);
128 mList->InsertColumn(ButtonsColumn + 1, _("Buttons"), wxLIST_FORMAT_LEFT);
129 mList->InsertColumn(CommentColumn + 1, _("Comments"), wxLIST_FORMAT_LEFT);
130 mList->DeleteColumn(0);
131
132 AddItem(XO("Left-Click"), XO("Select"), XO("Set Selection Point"));
133 AddItem(XO("Left-Drag"), XO("Select"), XO("Set Selection Range"));
134 AddItem(XO("Shift-Left-Click"), XO("Select"), XO("Extend Selection Range"));
135 AddItem(XO("Left-Double-Click"), XO("Select"), XO("Select Clip or Entire Track"));
136#ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
137 AddItem(XO("Wheel-Rotate"), XO("Select"), XO("Change scrub speed"));
138#endif
139
140#ifdef EXPERIMENTAL_SPECTRAL_EDITING
141 // JKC: Prompt is disabled for now. It's a toggle rather than a drag modifier.
142 // more like Snap-to than anything else.
143 // Spectral selection
144 // AddItem(XO("ESC"), XO("Select"), XO("Toggle center snapping in spectrogram"));
145#endif
146
147 AddItem(XO("Left-Click"), XO("Zoom"), XO("Zoom in on Point"));
148 AddItem(XO("Left-Drag"), XO("Zoom"), XO("Zoom in on a Range"), XO("same as right-drag"));
149 AddItem(XO("Right-Click"), XO("Zoom"), XO("Zoom out one step"));
150 AddItem(XO("Right-Drag"), XO("Zoom"), XO("Zoom in on a Range"), XO("same as left-drag"));
151 AddItem(XO("Shift-Drag"), XO("Zoom"), XO("Zoom out on a Range"));
152 AddItem(XO("Middle-Click"), XO("Zoom"), XO("Zoom default"));
153
154
155 AddItem(XO("Left-Drag"),
156 /* i18n-hint: The envelope is a curve that controls the audio loudness.*/
157 XO("Envelope"),
158 /* i18n-hint: The envelope is a curve that controls the audio loudness.*/
159 XO("Change Amplification Envelope"));
160
161 AddItem(XO("Left-Click"), XO("Pencil"), XO("Change Sample"));
162 AddItem(XO("Alt-Left-Click"), XO("Pencil"), XO("Smooth at Sample"));
163 AddItem(XO("Left-Drag"), XO("Pencil"), XO("Change Several Samples"));
164 AddItem(CTRL + XO("-Left-Drag"),XO("Pencil"), XO("Change ONE Sample only"));
165
166 AddItem(XO("Left-Click"), XO("Multi"), XO("Set Selection Point"), XO("same as select tool"));
167 AddItem(XO("Left-Drag"), XO("Multi"), XO("Set Selection Range"), XO("same as select tool"));
168 AddItem(XO("Right-Click"), XO("Multi"), XO("Zoom out one step"), XO("same as zoom tool"));
169 AddItem(XO("Right-Drag"), XO("Multi"), XO("Zoom in on a Range"), XO("same as zoom tool"));
170
171#ifdef EXPERIMENTAL_SPECTRAL_EDITING
172 // JKC: Prompt is disabled for now. It's a toggle rather than a drag modifier.
173 // more like Snap-to than anything else.
174 // Spectral selection
175 // AddItem(XO("ESC"), XO("Select"), XO("Toggle center snapping in spectrogram"), XO("same as select tool"));
176#endif
177
178 AddItem(XO("Wheel-Rotate"), XO("Any"), XO("Scroll tracks up or down"));
179 AddItem(XO("Shift-Wheel-Rotate"), XO("Any"), XO("Scroll waveform"));
180 AddItem(CTRL + XO("-Wheel-Rotate"), XO("Any"), XO("Zoom waveform in or out"));
181 AddItem(CTRL + XO("-Shift-Wheel-Rotate"), XO("Any"), XO("Vertical Scale Waveform (dB) range"));
182
183 AddItem(XO("Shift-Left-Drag"), XO("Any"),XO("Move all clips in track left/right"), XO("using clip handles"));
184 AddItem(CTRL + XO("-Left-Drag"),XO("Any"),XO("Move clip up/down between tracks"), XO("using clip handles"));
185 AddItem(XO("Left-Drag"), XO("Any"),XO("Move clip left/right or between tracks"), XO("using clip handles"));
186
187 mList->SetColumnWidth(ToolColumn, wxLIST_AUTOSIZE);
188 mList->SetColumnWidth(ActionColumn, wxLIST_AUTOSIZE);
189 mList->SetColumnWidth(ButtonsColumn, wxLIST_AUTOSIZE);
190 mList->SetColumnWidth(CommentColumn, wxLIST_AUTOSIZE);
191
192// PRL commented out, didn't look good to me on Mac at least
193/*
194 // Not sure if this extra column is a good idea or not.
195 // Anyway, 5 pixels wide is wide enough that some people who are curious will drag it
196 // wider to see what's there (the comments show that the duplication of functions
197 // is for a reason, and not just random).
198 mList->SetColumnWidth(CommentColumn, 5);
199 */
200}
201
204 TranslatableString const & buttons, TranslatableString const & tool,
205 TranslatableString const & action, TranslatableString const & comment)
206{
207 int i = mList->GetItemCount();
208 mList->InsertItem(i, tool.Translation());
209 mList->SetItem(i, ActionColumn, action.Translation());
210 mList->SetItem(i, ButtonsColumn, buttons.Translation());
211
212 // Add a space before the text to work around a minor bug in the
213 // list control when showing narrow columns.
214 mList->SetItem(i, CommentColumn, wxT(" ") + comment.Translation());
215}
216
217// See bug #2315 for discussion. This should be reviewed
218// and (possibly) removed after wx3.1.3.
219void MousePrefs::OnShow(wxShowEvent &event)
220{
221 event.Skip();
222
223 if (event.IsShown())
224 {
225 mList->Refresh();
226 }
227}
228
232{
233// Not yet required...
234// ShuttleGui S(this, eIsSavingToPrefs);
235// PopulateOrExchange(S);
236 return true;
237}
238
239namespace{
241 [](wxWindow *parent, wxWindowID winid, AudacityProject *)
242 {
243 wxASSERT(parent); // to justify safenew
244 return safenew MousePrefs(parent, winid);
245 }
246};
247}
wxT("CloseDown"))
XO("Cut/Copy/Paste")
#define _(s)
Definition: Internat.h:73
#define safenew
Definition: MemoryX.h:10
#define CTRL
Definition: MousePrefs.cpp:54
@ ActionColumn
Definition: MousePrefs.cpp:48
@ ButtonsColumn
Definition: MousePrefs.cpp:49
@ CommentColumn
Definition: MousePrefs.cpp:50
@ ToolColumn
Definition: MousePrefs.cpp:47
#define MOUSE_PREFS_PLUGIN_SYMBOL
Definition: MousePrefs.h:20
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
#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
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
A PrefsPanel that presents an interface for user to view the default bindings of mouse buttons to com...
Definition: MousePrefs.h:23
void CreateList()
Creates the contents of mList.
Definition: MousePrefs.cpp:121
bool Commit() override
Definition: MousePrefs.cpp:231
wxListCtrl * mList
Definition: MousePrefs.h:46
void Populate()
Creates the dialog and its contents.
Definition: MousePrefs.cpp:90
TranslatableString GetDescription() const override
Definition: MousePrefs.cpp:79
ComponentInterfaceSymbol GetSymbol() const override
Definition: MousePrefs.cpp:74
void PopulateOrExchange(ShuttleGui &S) override
Places controls on the panel and also exchanges data with them.
Definition: MousePrefs.cpp:109
void OnShow(wxShowEvent &event)
Definition: MousePrefs.cpp:219
void AddItem(TranslatableString const &buttons, TranslatableString const &tool, TranslatableString const &action, TranslatableString const &comment={})
Adds an item to mList.
Definition: MousePrefs.cpp:203
MousePrefs(wxWindow *parent, wxWindowID winid)
Constructor.
Definition: MousePrefs.cpp:60
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
Definition: MousePrefs.cpp:84
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
Definition: PrefsPanel.h:51
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:630
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
PrefsPanel::Registration sAttachment
Definition: MousePrefs.cpp:240