Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
ViewActions::Handler Struct Referencefinal
Inheritance diagram for ViewActions::Handler:
[legend]
Collaboration diagram for ViewActions::Handler:
[legend]

Public Member Functions

void OnZoomIn (const CommandContext &context)
 
void OnZoomNormal (const CommandContext &context)
 
void OnZoomOut (const CommandContext &context)
 
void OnZoomSel (const CommandContext &context)
 
void OnZoomToggle (const CommandContext &context)
 
void OnZoomFit (const CommandContext &context)
 
void OnZoomFitV (const CommandContext &context)
 
void OnAdvancedVZoom (const CommandContext &context)
 
void OnCollapseAllTracks (const CommandContext &context)
 
void OnExpandAllTracks (const CommandContext &context)
 
void OnGoSelStart (const CommandContext &context)
 
void OnGoSelEnd (const CommandContext &context)
 
void OnShowExtraMenus (const CommandContext &context)
 
void OnShowClipping (const CommandContext &context)
 
void OnShowNameOverlay (const CommandContext &context)
 
void OnUndoPushed (UndoRedoMessage message)
 
 Handler (AudacityProject &project)
 
 Handler (const Handler &) PROHIBITED
 
Handleroperator= (const Handler &) PROHIBITED
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Public Attributes

Observer::Subscription mUndoSubscription
 
AudacityProjectmProject
 

Detailed Description

Definition at line 161 of file ViewMenus.cpp.

Constructor & Destructor Documentation

◆ Handler() [1/2]

ViewActions::Handler::Handler ( AudacityProject project)
inline

Definition at line 362 of file ViewMenus.cpp.

363 : mProject{ project }
364{
367}
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:67
void OnUndoPushed(UndoRedoMessage message)
Definition: ViewMenus.cpp:353
AudacityProject & mProject
Definition: ViewMenus.cpp:373
Observer::Subscription mUndoSubscription
Definition: ViewMenus.cpp:372

References UndoManager::Get(), mProject, mUndoSubscription, OnUndoPushed(), and Observer::Publisher< Message, NotifyAll >::Subscribe().

Here is the call graph for this function:

◆ Handler() [2/2]

ViewActions::Handler::Handler ( const Handler )

Member Function Documentation

◆ OnAdvancedVZoom()

void ViewActions::Handler::OnAdvancedVZoom ( const CommandContext context)
inline

Definition at line 244 of file ViewMenus.cpp.

245{
246 auto &project = context.project;
247 auto &commandManager = CommandManager::Get( project );
248
249 bool checked = !gPrefs->Read(wxT("/GUI/VerticalZooming"), 0L);
250 gPrefs->Write(wxT("/GUI/VerticalZooming"), checked);
251 gPrefs->Flush();
252 commandManager.Check(wxT("AdvancedVZoom"), checked);
254}
wxT("CloseDown"))
FileConfig * gPrefs
Definition: Prefs.cpp:70
AudacityProject & project
static CommandManager & Get(AudacityProject &project)
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
static void RebuildAllMenuBars()
Definition: Menus.cpp:619

References FileConfig::Flush(), CommandManager::Get(), gPrefs, CommandContext::project, MenuCreator::RebuildAllMenuBars(), and wxT().

Here is the call graph for this function:

◆ OnCollapseAllTracks()

void ViewActions::Handler::OnCollapseAllTracks ( const CommandContext context)
inline

Definition at line 256 of file ViewMenus.cpp.

257{
258 auto &project = context.project;
259 auto &tracks = TrackList::Get( project );
260 auto &window = ProjectWindow::Get( project );
261
262 for (auto t : tracks.Any())
263 TrackView::Get( *t ).SetMinimized(true);
264
265 ProjectHistory::Get( project ).ModifyState(true);
266}
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
static ProjectWindow & Get(AudacityProject &project)
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:486
void SetMinimized(bool minimized)
Definition: TrackView.cpp:93
static TrackView & Get(Track &)
Definition: TrackView.cpp:69

References ProjectHistory::Get(), TrackList::Get(), ProjectWindow::Get(), TrackView::Get(), ProjectHistory::ModifyState(), CommandContext::project, and TrackView::SetMinimized().

Here is the call graph for this function:

◆ OnExpandAllTracks()

void ViewActions::Handler::OnExpandAllTracks ( const CommandContext context)
inline

Definition at line 268 of file ViewMenus.cpp.

269{
270 auto &project = context.project;
271 auto &tracks = TrackList::Get( project );
272 auto &window = ProjectWindow::Get( project );
273
274 for (auto t : tracks.Any())
275 TrackView::Get( *t ).SetMinimized(false);
276
277 ProjectHistory::Get( project ).ModifyState(true);
278}

References ProjectHistory::Get(), TrackList::Get(), ProjectWindow::Get(), TrackView::Get(), ProjectHistory::ModifyState(), CommandContext::project, and TrackView::SetMinimized().

Here is the call graph for this function:

◆ OnGoSelEnd()

void ViewActions::Handler::OnGoSelEnd ( const CommandContext context)
inline

Definition at line 294 of file ViewMenus.cpp.

295{
296 auto &project = context.project;
297 auto &viewInfo = ViewInfo::Get( project );
298 auto &selectedRegion = viewInfo.selectedRegion;
299 auto &window = ProjectWindow::Get( project );
300
301 if (selectedRegion.isPoint())
302 return;
303
304 window.TP_ScrollWindow(
305 selectedRegion.t1() - ((viewInfo.GetScreenEndTime() - viewInfo.h) / 2));
306}
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:234

References ViewInfo::Get(), ProjectWindow::Get(), and CommandContext::project.

Here is the call graph for this function:

◆ OnGoSelStart()

void ViewActions::Handler::OnGoSelStart ( const CommandContext context)
inline

Definition at line 280 of file ViewMenus.cpp.

281{
282 auto &project = context.project;
283 auto &viewInfo = ViewInfo::Get( project );
284 auto &selectedRegion = viewInfo.selectedRegion;
285 auto &window = ProjectWindow::Get( project );
286
287 if (selectedRegion.isPoint())
288 return;
289
290 window.TP_ScrollWindow(
291 selectedRegion.t0() - ((viewInfo.GetScreenEndTime() - viewInfo.h) / 2));
292}

References ViewInfo::Get(), ProjectWindow::Get(), and CommandContext::project.

Here is the call graph for this function:

◆ OnShowClipping()

void ViewActions::Handler::OnShowClipping ( const CommandContext context)
inline

Definition at line 320 of file ViewMenus.cpp.

321{
322 auto &project = context.project;
323 auto &commandManager = CommandManager::Get( project );
324 auto &trackPanel = TrackPanel::Get( project );
325
326 bool checked = !gPrefs->Read(wxT("/GUI/ShowClipping"), 0L);
327 gPrefs->Write(wxT("/GUI/ShowClipping"), checked);
328 gPrefs->Flush();
329 commandManager.Check(wxT("ShowClipping"), checked);
330
332
333 trackPanel.Refresh(false);
334}
int ShowClippingPrefsID()
Definition: GUIPrefs.cpp:247
static void Broadcast(int id=0)
Call this static function to notify all PrefsListener objects.
Definition: Prefs.cpp:97
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:230

References PrefsListener::Broadcast(), FileConfig::Flush(), CommandManager::Get(), TrackPanel::Get(), gPrefs, CommandContext::project, ShowClippingPrefsID(), and wxT().

Here is the call graph for this function:

◆ OnShowExtraMenus()

void ViewActions::Handler::OnShowExtraMenus ( const CommandContext context)
inline

Definition at line 308 of file ViewMenus.cpp.

309{
310 auto &project = context.project;
311 auto &commandManager = CommandManager::Get( project );
312
313 bool checked = !gPrefs->Read(wxT("/GUI/ShowExtraMenus"), 0L);
314 gPrefs->Write(wxT("/GUI/ShowExtraMenus"), checked);
315 gPrefs->Flush();
316 commandManager.Check(wxT("ShowExtraMenus"), checked);
318}

References FileConfig::Flush(), CommandManager::Get(), gPrefs, CommandContext::project, MenuCreator::RebuildAllMenuBars(), and wxT().

Here is the call graph for this function:

◆ OnShowNameOverlay()

void ViewActions::Handler::OnShowNameOverlay ( const CommandContext context)
inline

Definition at line 336 of file ViewMenus.cpp.

337{
338 auto &project = context.project;
339 auto &commandManager = CommandManager::Get( project );
340 auto &trackPanel = TrackPanel::Get( project );
341
342 bool checked = !gPrefs->Read(wxT("/GUI/ShowTrackNameInWaveform"), 0L);
343 gPrefs->Write(wxT("/GUI/ShowTrackNameInWaveform"), checked);
344 gPrefs->Flush();
345 commandManager.Check(wxT("ShowTrackNameInWaveform"), checked);
346
348
349 trackPanel.Refresh(false);
350}
int ShowTrackNameInWaveformPrefsID()
Definition: GUIPrefs.cpp:253

References PrefsListener::Broadcast(), FileConfig::Flush(), CommandManager::Get(), TrackPanel::Get(), gPrefs, CommandContext::project, ShowTrackNameInWaveformPrefsID(), and wxT().

Here is the call graph for this function:

◆ OnUndoPushed()

void ViewActions::Handler::OnUndoPushed ( UndoRedoMessage  message)
inline

Definition at line 353 of file ViewMenus.cpp.

354{
355 if (message.type == UndoRedoMessage::Pushed) {
356 const auto &settings = ProjectSettings::Get( mProject );
357 if (settings.GetTracksFitVerticallyZoomed())
359 }
360}
static Settings & settings()
Definition: TrackInfo.cpp:87
static ProjectSettings & Get(AudacityProject &project)
void DoZoomFitV(AudacityProject &project)
Definition: ViewMenus.cpp:121
enum UndoRedoMessage::Type type

References anonymous_namespace{ViewMenus.cpp}::DoZoomFitV(), ProjectSettings::Get(), mProject, UndoRedoMessage::Pushed, settings(), and UndoRedoMessage::type.

Referenced by Handler().

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

◆ OnZoomFit()

void ViewActions::Handler::OnZoomFit ( const CommandContext context)
inline

Definition at line 226 of file ViewMenus.cpp.

227{
228 auto &project = context.project;
229 auto &window = ProjectWindow::Get( project );
230 window.DoZoomFit();
231}

References ProjectWindow::Get(), and CommandContext::project.

Here is the call graph for this function:

◆ OnZoomFitV()

void ViewActions::Handler::OnZoomFitV ( const CommandContext context)
inline

Definition at line 233 of file ViewMenus.cpp.

234{
235 auto &project = context.project;
236 auto &window = ProjectWindow::Get( project );
237
238 DoZoomFitV(project);
239
240 window.GetVerticalScrollBar().SetThumbPosition(0);
241 ProjectHistory::Get( project ).ModifyState(true);
242}

References anonymous_namespace{ViewMenus.cpp}::DoZoomFitV(), ProjectHistory::Get(), ProjectWindow::Get(), ProjectHistory::ModifyState(), and CommandContext::project.

Here is the call graph for this function:

◆ OnZoomIn()

void ViewActions::Handler::OnZoomIn ( const CommandContext context)
inline

Definition at line 166 of file ViewMenus.cpp.

167{
168 auto &project = context.project;
169 auto &trackPanel = TrackPanel::Get( project );
170 auto &window = ProjectWindow::Get( project );
171 window.ZoomInByFactor( 2.0 );
172 trackPanel.Refresh(false);
173}

References ProjectWindow::Get(), TrackPanel::Get(), and CommandContext::project.

Here is the call graph for this function:

◆ OnZoomNormal()

void ViewActions::Handler::OnZoomNormal ( const CommandContext context)
inline

Definition at line 175 of file ViewMenus.cpp.

176{
177 auto &project = context.project;
178 auto &trackPanel = TrackPanel::Get( project );
179 auto &window = ProjectWindow::Get( project );
180
181 window.Zoom(ZoomInfo::GetDefaultZoom());
182 trackPanel.Refresh(false);
183}
static double GetDefaultZoom()
Definition: ZoomInfo.h:117

References ProjectWindow::Get(), TrackPanel::Get(), ZoomInfo::GetDefaultZoom(), and CommandContext::project.

Here is the call graph for this function:

◆ OnZoomOut()

void ViewActions::Handler::OnZoomOut ( const CommandContext context)
inline

Definition at line 185 of file ViewMenus.cpp.

186{
187 auto &project = context.project;
188 auto &window = ProjectWindow::Get( project );
189 window.ZoomOutByFactor( 1 /2.0 );
190}

References ProjectWindow::Get(), and CommandContext::project.

Here is the call graph for this function:

◆ OnZoomSel()

void ViewActions::Handler::OnZoomSel ( const CommandContext context)
inline

Definition at line 192 of file ViewMenus.cpp.

193{
194 auto &project = context.project;
195 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
196 auto &window = ProjectWindow::Get( project );
197
198 window.Zoom( GetZoomOfSelection( project ) );
199 window.TP_ScrollWindow(selectedRegion.t0());
200}
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:217
double GetZoomOfSelection(const AudacityProject &project)
Definition: ViewMenus.cpp:26

References ViewInfo::Get(), ProjectWindow::Get(), anonymous_namespace{ViewMenus.cpp}::GetZoomOfSelection(), CommandContext::project, and ViewInfo::selectedRegion.

Here is the call graph for this function:

◆ OnZoomToggle()

void ViewActions::Handler::OnZoomToggle ( const CommandContext context)
inline

Definition at line 202 of file ViewMenus.cpp.

203{
204 auto &project = context.project;
205 auto &viewInfo = ViewInfo::Get( project );
206 auto &trackPanel = TrackPanel::Get( project );
207 auto &window = ProjectWindow::Get( project );
208
209// const double origLeft = viewInfo.h;
210// const double origWidth = viewInfo.GetScreenEndTime() - origLeft;
211
212 // Choose the zoom that is most different to the current zoom.
213 double Zoom1 = GetZoomOfPreset( project, TracksPrefs::Zoom1Choice() );
214 double Zoom2 = GetZoomOfPreset( project, TracksPrefs::Zoom2Choice() );
215 double Z = viewInfo.GetZoom();// Current Zoom.
216 double ChosenZoom =
217 fabs(log(Zoom1 / Z)) > fabs(log( Z / Zoom2)) ? Zoom1:Zoom2;
218
219 window.Zoom(ChosenZoom);
220 trackPanel.Refresh(false);
221// const double newWidth = GetScreenEndTime() - viewInfo.h;
222// const double newh = origLeft + (origWidth - newWidth) / 2;
223// TP_ScrollWindow(newh);
224}
static WaveTrackViewConstants::ZoomPresets Zoom1Choice()
static WaveTrackViewConstants::ZoomPresets Zoom2Choice()
double GetZoomOfPreset(const AudacityProject &project, int preset)
Definition: ViewMenus.cpp:53

References ViewInfo::Get(), ProjectWindow::Get(), TrackPanel::Get(), anonymous_namespace{ViewMenus.cpp}::GetZoomOfPreset(), CommandContext::project, TracksPrefs::Zoom1Choice(), and TracksPrefs::Zoom2Choice().

Here is the call graph for this function:

◆ operator=()

Handler & ViewActions::Handler::operator= ( const Handler )

Member Data Documentation

◆ mProject

AudacityProject& ViewActions::Handler::mProject

Definition at line 373 of file ViewMenus.cpp.

Referenced by Handler(), and OnUndoPushed().

◆ mUndoSubscription

Observer::Subscription ViewActions::Handler::mUndoSubscription

Definition at line 372 of file ViewMenus.cpp.

Referenced by Handler().


The documentation for this struct was generated from the following file: