Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MousePrefs Class Referencefinal

A PrefsPanel that presents an interface for user to view the default bindings of mouse buttons to commands. More...

#include <MousePrefs.h>

Inheritance diagram for MousePrefs:
[legend]
Collaboration diagram for MousePrefs:
[legend]

Public Member Functions

 MousePrefs (wxWindow *parent, wxWindowID winid)
 Constructor. More...
 
 ~MousePrefs ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
bool Commit () override
 
ManualPageID HelpPageName () override
 If not empty string, the Help button is added below the panel. More...
 
void PopulateOrExchange (ShuttleGui &S) override
 Places controls on the panel and also exchanges data with them. More...
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const TranslatableString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool Commit ()=0
 
virtual PluginPath GetPath () const override
 
virtual VendorSymbol GetVendor () const override
 
virtual wxString GetVersion () const override
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual ManualPageID HelpPageName ()
 If not empty string, the Help button is added below the panel. More...
 
virtual void Cancel ()
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void Populate ()
 Creates the dialog and its contents. More...
 
void CreateList ()
 Creates the contents of mList. More...
 
void AddItem (TranslatableString const &buttons, TranslatableString const &tool, TranslatableString const &action, TranslatableString const &comment={})
 Adds an item to mList. More...
 
void OnShow (wxShowEvent &event)
 

Private Attributes

wxListCtrl * mList
 

Additional Inherited Members

- Public Types inherited from PrefsPanel
using Factories = std::vector< PrefsPanel::PrefsNode >
 
using Factory = std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) >
 
- Static Public Member Functions inherited from PrefsPanel
static FactoriesDefaultFactories ()
 

Detailed Description

A PrefsPanel that presents an interface for user to view the default bindings of mouse buttons to commands.

April/2003: These are default bindings and are not yet configurable. They are provided to give information about what the bindings are.

Configuration when available will be mostly used by power users who are unlikely to change the default bindings, but will add bindings (e.g. for cut, play, and their own nyquist filters) using currently unused combinations.

Unlike key-bindings which are parameterless, mouse bindings provide parameters:

If we allow a nyquist filter to be bound to the mouse, instead of being applied to the current selection it would be applied to the start and end points of the drag.

Definition at line 22 of file MousePrefs.h.

Constructor & Destructor Documentation

◆ MousePrefs()

MousePrefs::MousePrefs ( wxWindow *  parent,
wxWindowID  winid 
)

Constructor.

Definition at line 60 of file MousePrefs.cpp.

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}
XO("Cut/Copy/Paste")
void Populate()
Creates the dialog and its contents.
Definition: MousePrefs.cpp:90
void OnShow(wxShowEvent &event)
Definition: MousePrefs.cpp:218
PrefsPanel(wxWindow *parent, wxWindowID winid, const TranslatableString &title)
Definition: PrefsPanel.h:94

References OnShow(), and Populate().

Here is the call graph for this function:

◆ ~MousePrefs()

MousePrefs::~MousePrefs ( )

Definition at line 70 of file MousePrefs.cpp.

71{
72}

Member Function Documentation

◆ AddItem()

void MousePrefs::AddItem ( TranslatableString const &  buttons,
TranslatableString const &  tool,
TranslatableString const &  action,
TranslatableString const &  comment = {} 
)
private

Adds an item to mList.

Definition at line 202 of file MousePrefs.cpp.

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}
wxT("CloseDown"))
@ ActionColumn
Definition: MousePrefs.cpp:48
@ ButtonsColumn
Definition: MousePrefs.cpp:49
@ CommentColumn
Definition: MousePrefs.cpp:50
wxListCtrl * mList
Definition: MousePrefs.h:46

References ActionColumn, ButtonsColumn, CommentColumn, mList, TranslatableString::Translation(), and wxT().

Referenced by CreateList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Commit()

bool MousePrefs::Commit ( )
overridevirtual

Update the preferences stored on disk. Currently does nothing as Mouse Preferences don't change.

Implements PrefsPanel.

Definition at line 230 of file MousePrefs.cpp.

231{
232// Not yet required...
233// ShuttleGui S(this, eIsSavingToPrefs);
234// PopulateOrExchange(S);
235 return true;
236}

◆ CreateList()

void MousePrefs::CreateList ( )
private

Creates the contents of mList.

Definition at line 121 of file MousePrefs.cpp.

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}
#define _(s)
Definition: Internat.h:73
@ ToolColumn
Definition: MousePrefs.cpp:47
#define CTRL
Definition: MousePrefs.cpp:54
void AddItem(TranslatableString const &buttons, TranslatableString const &tool, TranslatableString const &action, TranslatableString const &comment={})
Adds an item to mList.
Definition: MousePrefs.cpp:202

References _, ActionColumn, AddItem(), ButtonsColumn, CommentColumn, CTRL, mList, ToolColumn, wxT(), and XO().

Referenced by Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDescription()

TranslatableString MousePrefs::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 79 of file MousePrefs.cpp.

80{
81 return XO("Preferences for Mouse");
82}

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol MousePrefs::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 74 of file MousePrefs.cpp.

75{
77}
#define MOUSE_PREFS_PLUGIN_SYMBOL
Definition: MousePrefs.h:20

References MOUSE_PREFS_PLUGIN_SYMBOL.

◆ HelpPageName()

ManualPageID MousePrefs::HelpPageName ( )
overridevirtual

If not empty string, the Help button is added below the panel.

Default returns empty string.

Reimplemented from PrefsPanel.

Definition at line 84 of file MousePrefs.cpp.

85{
86 return "Mouse_Preferences";
87}

◆ OnShow()

void MousePrefs::OnShow ( wxShowEvent &  event)
private

Definition at line 218 of file MousePrefs.cpp.

219{
220 event.Skip();
221
222 if (event.IsShown())
223 {
224 mList->Refresh();
225 }
226}

References mList.

Referenced by MousePrefs().

Here is the caller graph for this function:

◆ Populate()

void MousePrefs::Populate ( )
private

Creates the dialog and its contents.

Definition at line 90 of file MousePrefs.cpp.

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}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
#define S(N)
Definition: ToChars.cpp:64
void CreateList()
Creates the contents of mList.
Definition: MousePrefs.cpp:121
void PopulateOrExchange(ShuttleGui &S) override
Places controls on the panel and also exchanges data with them.
Definition: MousePrefs.cpp:109
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:625

References CreateList(), eIsCreatingFromPrefs, mList, PopulateOrExchange(), and S.

Referenced by MousePrefs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PopulateOrExchange()

void MousePrefs::PopulateOrExchange ( ShuttleGui S)
override

Places controls on the panel and also exchanges data with them.

Definition at line 109 of file MousePrefs.cpp.

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}

References mList, S, and XO().

Referenced by Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mList

wxListCtrl* MousePrefs::mList
private

Definition at line 46 of file MousePrefs.h.

Referenced by AddItem(), CreateList(), OnShow(), Populate(), and PopulateOrExchange().


The documentation for this class was generated from the following files: