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 AddItem(XO("Left-Drag"), XO("Time-Shift"),XO("Move clip left/right or between tracks"));
155 AddItem(XO("Shift-Left-Drag"), XO("Time-Shift"),XO("Move all clips in track left/right"));
156 AddItem(CTRL + XO("-Left-Drag"),XO("Time-Shift"),XO("Move clip up/down between tracks"));
157
158 AddItem(XO("Left-Drag"),
159 /* i18n-hint: The envelope is a curve that controls the audio loudness.*/
160 XO("Envelope"),
161 /* i18n-hint: The envelope is a curve that controls the audio loudness.*/
162 XO("Change Amplification Envelope"));
163
164 AddItem(XO("Left-Click"), XO("Pencil"), XO("Change Sample"));
165 AddItem(XO("Alt-Left-Click"), XO("Pencil"), XO("Smooth at Sample"));
166 AddItem(XO("Left-Drag"), XO("Pencil"), XO("Change Several Samples"));
167 AddItem(CTRL + XO("-Left-Drag"),XO("Pencil"), XO("Change ONE Sample only"));
168
169 AddItem(XO("Left-Click"), XO("Multi"), XO("Set Selection Point"), XO("same as select tool"));
170 AddItem(XO("Left-Drag"), XO("Multi"), XO("Set Selection Range"), XO("same as select tool"));
171 AddItem(XO("Right-Click"), XO("Multi"), XO("Zoom out one step"), XO("same as zoom tool"));
172 AddItem(XO("Right-Drag"), XO("Multi"), XO("Zoom in on a Range"), XO("same as zoom tool"));
173
174#ifdef EXPERIMENTAL_SPECTRAL_EDITING
175 // JKC: Prompt is disabled for now. It's a toggle rather than a drag modifier.
176 // more like Snap-to than anything else.
177 // Spectral selection
178 // AddItem(XO("ESC"), XO("Select"), XO("Toggle center snapping in spectrogram"), XO("same as select tool"));
179#endif
180
181 AddItem(XO("Wheel-Rotate"), XO("Any"), XO("Scroll tracks up or down"));
182 AddItem(XO("Shift-Wheel-Rotate"), XO("Any"), XO("Scroll waveform"));
183 AddItem(CTRL + XO("-Wheel-Rotate"), XO("Any"), XO("Zoom waveform in or out"));
184 AddItem(CTRL + XO("-Shift-Wheel-Rotate"), XO("Any"), XO("Vertical Scale Waveform (dB) range"));
185
186 mList->SetColumnWidth(ToolColumn, wxLIST_AUTOSIZE);
187 mList->SetColumnWidth(ActionColumn, wxLIST_AUTOSIZE);
188 mList->SetColumnWidth(ButtonsColumn, wxLIST_AUTOSIZE);
189 mList->SetColumnWidth(CommentColumn, wxLIST_AUTOSIZE);
190
191// PRL commented out, didn't look good to me on Mac at least
192/*
193 // Not sure if this extra column is a good idea or not.
194 // Anyway, 5 pixels wide is wide enough that some people who are curious will drag it
195 // wider to see what's there (the comments show that the duplication of functions
196 // is for a reason, and not just random).
197 mList->SetColumnWidth(CommentColumn, 5);
198 */
199}
200
203 TranslatableString const & buttons, TranslatableString const & tool,
204 TranslatableString const & action, TranslatableString const & comment)
205{
206 int i = mList->GetItemCount();
207 mList->InsertItem(i, tool.Translation());
208 mList->SetItem(i, ActionColumn, action.Translation());
209 mList->SetItem(i, ButtonsColumn, buttons.Translation());
210
211 // Add a space before the text to work around a minor bug in the
212 // list control when showing narrow columns.
213 mList->SetItem(i, CommentColumn, wxT(" ") + comment.Translation());
214}
215
216// See bug #2315 for discussion. This should be reviewed
217// and (possibly) removed after wx3.1.3.
218void MousePrefs::OnShow(wxShowEvent &event)
219{
220 event.Skip();
221
222 if (event.IsShown())
223 {
224 mList->Refresh();
225 }
226}
227
231{
232// Not yet required...
233// ShuttleGui S(this, eIsSavingToPrefs);
234// PopulateOrExchange(S);
235 return true;
236}
237
238namespace{
240 [](wxWindow *parent, wxWindowID winid, AudacityProject *)
241 {
242 wxASSERT(parent); // to justify safenew
243 return safenew MousePrefs(parent, winid);
244 }
245};
246}
wxT("CloseDown"))
XO("Cut/Copy/Paste")
#define _(s)
Definition: Internat.h:73
#define safenew
Definition: MemoryX.h:10
@ ActionColumn
Definition: MousePrefs.cpp:48
@ ButtonsColumn
Definition: MousePrefs.cpp:49
@ CommentColumn
Definition: MousePrefs.cpp:50
@ ToolColumn
Definition: MousePrefs.cpp:47
#define CTRL
Definition: MousePrefs.cpp:54
#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:230
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:218
void AddItem(TranslatableString const &buttons, TranslatableString const &tool, TranslatableString const &action, TranslatableString const &comment={})
Adds an item to mList.
Definition: MousePrefs.cpp:202
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:625
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
PrefsPanel::Registration sAttachment
Definition: MousePrefs.cpp:239