Audacity  3.0.3
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 () override
 
TranslatableString GetDescription () 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 PluginPath GetPath ()
 
virtual VendorSymbol GetVendor ()
 
virtual wxString GetVersion ()
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
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 61 of file MousePrefs.cpp.

62 : PrefsPanel(parent, winid, XO("Mouse"))
63 {
64  Populate();
65 
66  // See bug #2315 for discussion. This should be reviewed
67  // and (possibly) removed after wx3.1.3.
68  Bind(wxEVT_SHOW, &MousePrefs::OnShow, this);
69 }

References OnShow(), and Populate().

Here is the call graph for this function:

◆ ~MousePrefs()

MousePrefs::~MousePrefs ( )

Definition at line 71 of file MousePrefs.cpp.

72 {
73 }

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 203 of file MousePrefs.cpp.

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 }

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

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 231 of file MousePrefs.cpp.

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

◆ CreateList()

void MousePrefs::CreateList ( )
private

Creates the contents of mList.

Definition at line 122 of file MousePrefs.cpp.

123 {
124  //A dummy first column, which is then deleted, is a workaround - under Windows the first column
125  //can't be right aligned.
126  mList->InsertColumn(0, wxT(""), wxLIST_FORMAT_LEFT);
127  mList->InsertColumn(ToolColumn + 1, _("Tool"), wxLIST_FORMAT_RIGHT);
128  mList->InsertColumn(ActionColumn + 1, _("Command Action"), wxLIST_FORMAT_RIGHT);
129  mList->InsertColumn(ButtonsColumn + 1, _("Buttons"), wxLIST_FORMAT_LEFT);
130  mList->InsertColumn(CommentColumn + 1, _("Comments"), wxLIST_FORMAT_LEFT);
131  mList->DeleteColumn(0);
132 
133  AddItem(XO("Left-Click"), XO("Select"), XO("Set Selection Point"));
134  AddItem(XO("Left-Drag"), XO("Select"), XO("Set Selection Range"));
135  AddItem(XO("Shift-Left-Click"), XO("Select"), XO("Extend Selection Range"));
136  AddItem(XO("Left-Double-Click"), XO("Select"), XO("Select Clip or Entire Track"));
137 #ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
138  AddItem(XO("Wheel-Rotate"), XO("Select"), XO("Change scrub speed"));
139 #endif
140 
141 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
142  // JKC: Prompt is disabled for now. It's a toggle rather than a drag modifier.
143  // more like Snap-to than anything else.
144  // Spectral selection
145  // AddItem(XO("ESC"), XO("Select"), XO("Toggle center snapping in spectrogram"));
146 #endif
147 
148  AddItem(XO("Left-Click"), XO("Zoom"), XO("Zoom in on Point"));
149  AddItem(XO("Left-Drag"), XO("Zoom"), XO("Zoom in on a Range"), XO("same as right-drag"));
150  AddItem(XO("Right-Click"), XO("Zoom"), XO("Zoom out one step"));
151  AddItem(XO("Right-Drag"), XO("Zoom"), XO("Zoom in on a Range"), XO("same as left-drag"));
152  AddItem(XO("Shift-Drag"), XO("Zoom"), XO("Zoom out on a Range"));
153  AddItem(XO("Middle-Click"), XO("Zoom"), XO("Zoom default"));
154 
155  AddItem(XO("Left-Drag"), XO("Time-Shift"),XO("Move clip left/right or between tracks"));
156  AddItem(XO("Shift-Left-Drag"), XO("Time-Shift"),XO("Move all clips in track left/right"));
157  AddItem(CTRL + XO("-Left-Drag"),XO("Time-Shift"),XO("Move clip up/down between tracks"));
158 
159  AddItem(XO("Left-Drag"),
160  /* i18n-hint: The envelope is a curve that controls the audio loudness.*/
161  XO("Envelope"),
162  /* i18n-hint: The envelope is a curve that controls the audio loudness.*/
163  XO("Change Amplification Envelope"));
164 
165  AddItem(XO("Left-Click"), XO("Pencil"), XO("Change Sample"));
166  AddItem(XO("Alt-Left-Click"), XO("Pencil"), XO("Smooth at Sample"));
167  AddItem(XO("Left-Drag"), XO("Pencil"), XO("Change Several Samples"));
168  AddItem(CTRL + XO("-Left-Drag"),XO("Pencil"), XO("Change ONE Sample only"));
169 
170  AddItem(XO("Left-Click"), XO("Multi"), XO("Set Selection Point"), XO("same as select tool"));
171  AddItem(XO("Left-Drag"), XO("Multi"), XO("Set Selection Range"), XO("same as select tool"));
172  AddItem(XO("Right-Click"), XO("Multi"), XO("Zoom out one step"), XO("same as zoom tool"));
173  AddItem(XO("Right-Drag"), XO("Multi"), XO("Zoom in on a Range"), XO("same as zoom tool"));
174 
175 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
176  // JKC: Prompt is disabled for now. It's a toggle rather than a drag modifier.
177  // more like Snap-to than anything else.
178  // Spectral selection
179  // AddItem(XO("ESC"), XO("Select"), XO("Toggle center snapping in spectrogram"), XO("same as select tool"));
180 #endif
181 
182  AddItem(XO("Wheel-Rotate"), XO("Any"), XO("Scroll tracks up or down"));
183  AddItem(XO("Shift-Wheel-Rotate"), XO("Any"), XO("Scroll waveform"));
184  AddItem(CTRL + XO("-Wheel-Rotate"), XO("Any"), XO("Zoom waveform in or out"));
185  AddItem(CTRL + XO("-Shift-Wheel-Rotate"), XO("Any"), XO("Vertical Scale Waveform (dB) range"));
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 }

References _, ActionColumn, AddItem(), ButtonsColumn, CommentColumn, CTRL, mList, ToolColumn, 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 ( )
overridevirtual

Implements ComponentInterface.

Definition at line 80 of file MousePrefs.cpp.

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

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol MousePrefs::GetSymbol ( )
overridevirtual

Implements ComponentInterface.

Definition at line 75 of file MousePrefs.cpp.

76 {
78 }

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 85 of file MousePrefs.cpp.

86 {
87  return "Mouse_Preferences";
88 }

◆ OnShow()

void MousePrefs::OnShow ( wxShowEvent &  event)
private

Definition at line 219 of file MousePrefs.cpp.

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

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 91 of file MousePrefs.cpp.

92 {
93  //------------------------- Main section --------------------
94  // Now construct the GUI itself.
95  // Use 'eIsCreatingFromPrefs' so that the GUI is
96  // initialised with values from gPrefs.
99  // ----------------------- End of main section --------------
100  CreateList();
101  if (mList->GetItemCount() > 0) {
102  // set first item to be selected (and the focus when the
103  // list first becomes the focus)
104  mList->SetItemState(0, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED,
105  wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
106  }
107 }

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

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 110 of file MousePrefs.cpp.

111 {
112  S.SetBorder(2);
113 
114  S.StartStatic(XO("Mouse Bindings (default values, not configurable)"), 1);
115  {
117  }
118  S.EndStatic();
119 }

References ShuttleGuiBase::AddListControlReportMode(), ShuttleGuiBase::EndStatic(), mList, ShuttleGuiBase::SetBorder(), ShuttleGuiBase::StartStatic(), 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:
MousePrefs::Populate
void Populate()
Creates the dialog and its contents.
Definition: MousePrefs.cpp:91
CTRL
#define CTRL
Definition: MousePrefs.cpp:57
ActionColumn
@ ActionColumn
Definition: MousePrefs.cpp:49
CommentColumn
@ CommentColumn
Definition: MousePrefs.cpp:51
XO
#define XO(s)
Definition: Internat.h:31
MOUSE_PREFS_PLUGIN_SYMBOL
#define MOUSE_PREFS_PLUGIN_SYMBOL
Definition: MousePrefs.h:20
ToolColumn
@ ToolColumn
Definition: MousePrefs.cpp:48
ButtonsColumn
@ ButtonsColumn
Definition: MousePrefs.cpp:50
ShuttleGuiBase::StartStatic
wxStaticBox * StartStatic(const TranslatableString &Str, int iProp=0)
Definition: ShuttleGui.cpp:893
MousePrefs::AddItem
void AddItem(TranslatableString const &buttons, TranslatableString const &tool, TranslatableString const &action, TranslatableString const &comment={})
Adds an item to mList.
Definition: MousePrefs.cpp:203
MousePrefs::mList
wxListCtrl * mList
Definition: MousePrefs.h:46
_
#define _(s)
Definition: Internat.h:75
ShuttleGuiBase::AddListControlReportMode
wxListCtrl * AddListControlReportMode(std::initializer_list< const ListControlColumn > columns={}, long listControlStyles=0)
Definition: ShuttleGui.cpp:802
MousePrefs::CreateList
void CreateList()
Creates the contents of mList.
Definition: MousePrefs.cpp:122
ShuttleGuiBase::SetBorder
void SetBorder(int Border)
Definition: ShuttleGui.h:489
eIsCreatingFromPrefs
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:47
ShuttleGuiBase::EndStatic
void EndStatic()
Definition: ShuttleGui.cpp:922
MousePrefs::OnShow
void OnShow(wxShowEvent &event)
Definition: MousePrefs.cpp:219
MousePrefs::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Places controls on the panel and also exchanges data with them.
Definition: MousePrefs.cpp:110
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
PrefsPanel::PrefsPanel
PrefsPanel(wxWindow *parent, wxWindowID winid, const TranslatableString &title)
Definition: PrefsPanel.h:90