Audacity  2.2.2
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 #include "../Audacity.h"
36 #include "../Experimental.h"
37 #include "MousePrefs.h"
38 
39 #include <wx/defs.h>
40 #include <wx/intl.h>
41 #include <wx/listctrl.h>
42 
43 #include "../Prefs.h"
44 #include "../ShuttleGui.h"
45 #include "../Internat.h"
46 
47 // The numbers of the columns of the mList.
48 enum
49 {
55 };
56 
57 #if defined(__WXMAC__)
58 #define CTRL _("Command")
59 #else
60 #define CTRL _("Ctrl")
61 #endif
62 
64 MousePrefs::MousePrefs(wxWindow * parent, wxWindowID winid)
65 : PrefsPanel(parent, winid, _("Mouse"))
66 {
67  Populate();
68 }
69 
71 {
72 }
73 
76 {
77  //------------------------- Main section --------------------
78  // Now construct the GUI itself.
79  // Use 'eIsCreatingFromPrefs' so that the GUI is
80  // initialised with values from gPrefs.
83  // ----------------------- End of main section --------------
84  CreateList();
85 }
86 
89 {
90  S.SetBorder(2);
91 
92  S.StartStatic(_("Mouse Bindings (default values, not configurable)"), 1);
93  {
95  }
96  S.EndStatic();
97 }
98 
101 {
102  //An empty first column is a workaround - under Win98 the first column
103  //can't be right aligned.
104  mList->InsertColumn(BlankColumn, wxT(""), wxLIST_FORMAT_LEFT);
105  mList->InsertColumn(ToolColumn, _("Tool"), wxLIST_FORMAT_RIGHT);
106  mList->InsertColumn(ActionColumn, _("Command Action"), wxLIST_FORMAT_RIGHT);
107  mList->InsertColumn(ButtonsColumn, _("Buttons"), wxLIST_FORMAT_LEFT);
108  mList->InsertColumn(CommentColumn, _("Comments"), wxLIST_FORMAT_LEFT);
109 
110  AddItem(_("Left-Click"), _("Select"), _("Set Selection Point"));
111  AddItem(_("Left-Drag"), _("Select"), _("Set Selection Range"));
112  AddItem(_("Shift-Left-Click"), _("Select"), _("Extend Selection Range"));
113  AddItem(_("Left-Double-Click"), _("Select"), _("Select Clip or Entire Track"));
114 #ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
115  AddItem(_("Wheel-Rotate"), _("Select"), _("Change scrub speed"));
116 #endif
117 
118 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
119  // JKC: Prompt is disabled for now. It's a toggle rather than a drag modifier.
120  // more like Snap-to than anything else.
121  // Spectral selection
122  // AddItem(_("ESC"), _("Select"), _("Toggle center snapping in spectrogram"));
123 #endif
124 
125  AddItem(_("Left-Click"), _("Zoom"), _("Zoom in on Point"));
126  AddItem(_("Left-Drag"), _("Zoom"), _("Zoom in on a Range"), _("same as right-drag"));
127  AddItem(_("Right-Click"), _("Zoom"), _("Zoom out one step"));
128  AddItem(_("Right-Drag"), _("Zoom"), _("Zoom in on a Range"), _("same as left-drag"));
129  AddItem(_("Shift-Drag"), _("Zoom"), _("Zoom out on a Range"));
130  AddItem(_("Middle-Click"), _("Zoom"), _("Zoom default"));
131 
132  AddItem(_("Left-Drag"), _("Time-Shift"),_("Move clip left/right or between tracks"));
133  AddItem(_("Shift-Left-Drag"), _("Time-Shift"),_("Move all clips in track left/right"));
134  AddItem(CTRL + _("-Left-Drag"),_("Time-Shift"),_("Move clip up/down between tracks"));
135 
136  AddItem(_("Left-Drag"),
137  /* i18n-hint: The envelope is a curve that controls the audio loudness.*/
138  _("Envelope"),
139  _("Change Amplification Envelope"));
140 
141  AddItem(_("Left-Click"), _("Pencil"), _("Change Sample"));
142  AddItem(_("Alt-Left-Click"), _("Pencil"), _("Smooth at Sample"));
143  AddItem(_("Left-Drag"), _("Pencil"), _("Change Several Samples"));
144  AddItem(CTRL + _("-Left-Drag"),_("Pencil"), _("Change ONE Sample only"));
145 
146  AddItem(_("Left-Click"), _("Multi"), _("Set Selection Point"), _("same as select tool"));
147  AddItem(_("Left-Drag"), _("Multi"), _("Set Selection Range"), _("same as select tool"));
148  AddItem(_("Right-Click"), _("Multi"), _("Zoom out one step"), _("same as zoom tool"));
149  AddItem(_("Right-Drag"), _("Multi"), _("Zoom in on a Range"), _("same as zoom tool"));
150 
151 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
152  // JKC: Prompt is disabled for now. It's a toggle rather than a drag modifier.
153  // more like Snap-to than anything else.
154  // Spectral selection
155  // AddItem(_("ESC"), _("Select"), _("Toggle center snapping in spectrogram"), _("same as select tool"));
156 #endif
157 
158  AddItem(_("Wheel-Rotate"), _("Any"), _("Scroll tracks up or down"));
159  AddItem(_("Shift-Wheel-Rotate"), _("Any"), _("Scroll waveform"));
160  AddItem(CTRL + _("-Wheel-Rotate"), _("Any"), _("Zoom waveform in or out"));
161  AddItem(CTRL + _("-Shift-Wheel-Rotate"), _("Any"), _("Vertical Scale Waveform (dB) range"));
162 
163  mList->SetColumnWidth(BlankColumn, 0);
164  mList->SetColumnWidth(ToolColumn, wxLIST_AUTOSIZE);
165  mList->SetColumnWidth(ActionColumn, wxLIST_AUTOSIZE);
166  mList->SetColumnWidth(ButtonsColumn, wxLIST_AUTOSIZE);
167 
168  // Not sure if this extra column is a good idea or not.
169  // Anyway, 5 pixels wide is wide enough that some people who are curious will drag it
170  // wider to see what's there (the comments show that the duplication of functions
171  // is for a reason, and not just random).
172  mList->SetColumnWidth(CommentColumn, 5);
173 }
174 
176 void MousePrefs::AddItem(wxString const & buttons, wxString const & tool,
177  wxString const & action, wxString const & comment)
178 {
179  int i = mList->GetItemCount();
180  mList->InsertItem(i, wxT(""));
181  mList->SetItem(i, ToolColumn, tool);
182  mList->SetItem(i, ActionColumn, action);
183  mList->SetItem(i, ButtonsColumn, buttons);
184 
185  // Add a space before the text to work around a minor bug in the
186  // list control when showing narrow columns.
187  mList->SetItem(i, CommentColumn, wxT(" ") + comment);
188 }
189 
190 
194 {
195 // Not yet required...
196 // ShuttleGui S(this, eIsSavingToPrefs);
197 // PopulateOrExchange(S);
198  return true;
199 }
200 
202 {
203  return "Mouse_Preferences";
204 }
205 
206 PrefsPanel *MousePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
207 {
208  wxASSERT(parent); // to justify safenew
209  return safenew MousePrefs(parent, winid);
210 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:366
#define CTRL
Definition: MousePrefs.cpp:60
MousePrefs(wxWindow *parent, wxWindowID winid)
Constructor.
Definition: MousePrefs.cpp:64
bool Commit() override
Definition: MousePrefs.cpp:193
void AddItem(wxString const &buttons, wxString const &tool, wxString const &action, wxString const &comment=wxEmptyString)
Adds an item to mList.
Definition: MousePrefs.cpp:176
void PopulateOrExchange(ShuttleGui &S)
Places controls on the panel and also exchanges data with them.
Definition: MousePrefs.cpp:88
#define safenew
Definition: Audacity.h:223
wxString HelpPageName() override
Definition: MousePrefs.cpp:201
void CreateList()
Creates the contents of mList.
Definition: MousePrefs.cpp:100
wxListCtrl * AddListControlReportMode()
Definition: ShuttleGui.cpp:627
wxListCtrl * mList
Definition: MousePrefs.h:39
Used within the PrefsDialog, classes derived from this class include AudioIOPrefs, BatchPrefs, DirectoriesPrefs, FileFormatPrefs, GUIPrefs, KeyConfigPrefs, MousePrefs, QualityPrefs, SpectrumPrefs and ThemePrefs.
Definition: PrefsPanel.h:43
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
void Populate()
Creates the dialog and its contents.
Definition: MousePrefs.cpp:75
A PrefsPanel that presents an interface for user to view the default bindings of mouse buttons to com...
Definition: MousePrefs.h:22
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:701
PrefsPanel * operator()(wxWindow *parent, wxWindowID winid) override
Definition: MousePrefs.cpp:206
void SetBorder(int Border)
Definition: ShuttleGui.h:251