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 &)=delete
 
Handleroperator= (const Handler &)=delete
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Public Attributes

Observer::Subscription mUndoSubscription
 
AudacityProjectmProject
 

Detailed Description

Definition at line 165 of file ViewMenus.cpp.

Constructor & Destructor Documentation

◆ Handler() [1/2]

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

Definition at line 368 of file ViewMenus.cpp.

369 : mProject{ project }
370{
373}
const auto project
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:71
void OnUndoPushed(UndoRedoMessage message)
Definition: ViewMenus.cpp:359
AudacityProject & mProject
Definition: ViewMenus.cpp:379
Observer::Subscription mUndoSubscription
Definition: ViewMenus.cpp:378

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 )
delete

Member Function Documentation

◆ OnAdvancedVZoom()

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

Definition at line 248 of file ViewMenus.cpp.

249{
250 auto &project = context.project;
251 auto &commandManager = CommandManager::Get( project );
252
253 bool checked = !gPrefs->Read(wxT("/GUI/VerticalZooming"), 0L);
254 gPrefs->Write(wxT("/GUI/VerticalZooming"), checked);
255 gPrefs->Flush();
256 commandManager.Check(wxT("AdvancedVZoom"), checked);
258}
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
AudacityProject & project
static CommandManager & Get(AudacityProject &project)
static void RebuildAllMenuBars()
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0
virtual bool Read(const wxString &key, bool *value) const =0

References audacity::BasicSettings::Flush(), CommandManager::Get(), gPrefs, CommandContext::project, project, audacity::BasicSettings::Read(), MenuCreator::RebuildAllMenuBars(), audacity::BasicSettings::Write(), and wxT().

Here is the call graph for this function:

◆ OnCollapseAllTracks()

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

Definition at line 260 of file ViewMenus.cpp.

261{
262 auto &project = context.project;
263 auto &tracks = TrackList::Get( project );
264 auto &window = ProjectWindow::Get( project );
265
266 for (auto t : tracks)
267 for (auto pChannel : t->Channels())
268 ChannelView::Get(*pChannel).SetMinimized(true);
269
271}
const auto tracks
static ChannelView & Get(Channel &channel)
void SetMinimized(bool minimized)
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
static ProjectWindow & Get(AudacityProject &project)
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:354

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

Here is the call graph for this function:

◆ OnExpandAllTracks()

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

Definition at line 273 of file ViewMenus.cpp.

274{
275 auto &project = context.project;
276 auto &tracks = TrackList::Get( project );
277 auto &window = ProjectWindow::Get( project );
278
279 for (auto t : tracks)
280 for (auto pChannel : t->Channels())
281 ChannelView::Get(*pChannel).SetMinimized(false);
282
284}

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

Here is the call graph for this function:

◆ OnGoSelEnd()

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

Definition at line 300 of file ViewMenus.cpp.

301{
302 auto &project = context.project;
303 auto &viewInfo = ViewInfo::Get( project );
304 auto &selectedRegion = viewInfo.selectedRegion;
305 auto &window = ProjectWindow::Get( project );
306
307 if (selectedRegion.isPoint())
308 return;
309
310 window.TP_ScrollWindow(
311 selectedRegion.t1() - ((viewInfo.GetScreenEndTime() - viewInfo.h) / 2));
312}
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

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

Here is the call graph for this function:

◆ OnGoSelStart()

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

Definition at line 286 of file ViewMenus.cpp.

287{
288 auto &project = context.project;
289 auto &viewInfo = ViewInfo::Get( project );
290 auto &selectedRegion = viewInfo.selectedRegion;
291 auto &window = ProjectWindow::Get( project );
292
293 if (selectedRegion.isPoint())
294 return;
295
296 window.TP_ScrollWindow(
297 selectedRegion.t0() - ((viewInfo.GetScreenEndTime() - viewInfo.h) / 2));
298}

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

Here is the call graph for this function:

◆ OnShowClipping()

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

Definition at line 326 of file ViewMenus.cpp.

327{
328 auto &project = context.project;
329 auto &commandManager = CommandManager::Get( project );
330 auto &trackPanel = TrackPanel::Get( project );
331
332 bool checked = !gPrefs->Read(wxT("/GUI/ShowClipping"), 0L);
333 gPrefs->Write(wxT("/GUI/ShowClipping"), checked);
334 gPrefs->Flush();
335 commandManager.Check(wxT("ShowClipping"), checked);
336
338
339 trackPanel.Refresh(false);
340}
int ShowClippingPrefsID()
Definition: GUIPrefs.cpp:239
static void Broadcast(int id=0)
Call this static function to notify all PrefsListener objects.
Definition: Prefs.cpp:99
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:232

References PrefsListener::Broadcast(), audacity::BasicSettings::Flush(), CommandManager::Get(), TrackPanel::Get(), gPrefs, CommandContext::project, project, audacity::BasicSettings::Read(), ShowClippingPrefsID(), audacity::BasicSettings::Write(), and wxT().

Here is the call graph for this function:

◆ OnShowExtraMenus()

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

Definition at line 314 of file ViewMenus.cpp.

315{
316 auto &project = context.project;
317 auto &commandManager = CommandManager::Get( project );
318
319 bool checked = !gPrefs->Read(wxT("/GUI/ShowExtraMenus"), 0L);
320 gPrefs->Write(wxT("/GUI/ShowExtraMenus"), checked);
321 gPrefs->Flush();
322 commandManager.Check(wxT("ShowExtraMenus"), checked);
324}

References audacity::BasicSettings::Flush(), CommandManager::Get(), gPrefs, CommandContext::project, project, audacity::BasicSettings::Read(), MenuCreator::RebuildAllMenuBars(), audacity::BasicSettings::Write(), and wxT().

Here is the call graph for this function:

◆ OnShowNameOverlay()

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

Definition at line 342 of file ViewMenus.cpp.

343{
344 auto &project = context.project;
345 auto &commandManager = CommandManager::Get( project );
346 auto &trackPanel = TrackPanel::Get( project );
347
348 bool checked = !gPrefs->Read(wxT("/GUI/ShowTrackNameInWaveform"), 0L);
349 gPrefs->Write(wxT("/GUI/ShowTrackNameInWaveform"), checked);
350 gPrefs->Flush();
351 commandManager.Check(wxT("ShowTrackNameInWaveform"), checked);
352
354
355 trackPanel.Refresh(false);
356}
int ShowTrackNameInWaveformPrefsID()
Definition: GUIPrefs.cpp:245

References PrefsListener::Broadcast(), audacity::BasicSettings::Flush(), CommandManager::Get(), TrackPanel::Get(), gPrefs, CommandContext::project, project, audacity::BasicSettings::Read(), ShowTrackNameInWaveformPrefsID(), audacity::BasicSettings::Write(), and wxT().

Here is the call graph for this function:

◆ OnUndoPushed()

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

Definition at line 359 of file ViewMenus.cpp.

360{
361 if (message.type == UndoRedoMessage::Pushed) {
362 const auto &settings = ProjectSettings::Get( mProject );
363 if (settings.GetTracksFitVerticallyZoomed())
365 }
366}
static Settings & settings()
Definition: TrackInfo.cpp:69
static ProjectSettings & Get(AudacityProject &project)
void DoZoomFitV(AudacityProject &project)
Definition: ViewMenus.cpp:123
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 230 of file ViewMenus.cpp.

231{
232 auto &project = context.project;
233 auto &window = ProjectWindow::Get( project );
234 window.DoZoomFit();
235}

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

Here is the call graph for this function:

◆ OnZoomFitV()

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

Definition at line 237 of file ViewMenus.cpp.

238{
239 auto &project = context.project;
240 auto &window = ProjectWindow::Get( project );
241
243
244 window.GetVerticalScrollBar().SetThumbPosition(0);
246}

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

Here is the call graph for this function:

◆ OnZoomIn()

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

Definition at line 170 of file ViewMenus.cpp.

171{
172 auto &project = context.project;
173 auto &trackPanel = TrackPanel::Get( project );
174 auto &window = ProjectWindow::Get( project );
175 window.ZoomInByFactor( 2.0 );
176 trackPanel.Refresh(false);
177}

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

Here is the call graph for this function:

◆ OnZoomNormal()

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

Definition at line 179 of file ViewMenus.cpp.

180{
181 auto &project = context.project;
182 auto &trackPanel = TrackPanel::Get( project );
183 auto &window = ProjectWindow::Get( project );
184
185 window.Zoom(ZoomInfo::GetDefaultZoom());
186 trackPanel.Refresh(false);
187}
static double GetDefaultZoom()
Definition: ZoomInfo.h:113

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

Here is the call graph for this function:

◆ OnZoomOut()

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

Definition at line 189 of file ViewMenus.cpp.

190{
191 auto &project = context.project;
192 auto &window = ProjectWindow::Get( project );
193 window.ZoomOutByFactor( 1 /2.0 );
194}

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

Here is the call graph for this function:

◆ OnZoomSel()

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

Definition at line 196 of file ViewMenus.cpp.

197{
198 auto &project = context.project;
199 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
200 auto &window = ProjectWindow::Get( project );
201
202 window.Zoom( GetZoomOfSelection( project ) );
203 window.TP_ScrollWindow(selectedRegion.t0());
204}
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:219
double GetZoomOfSelection(const AudacityProject &project)
Definition: ViewMenus.cpp:28

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

Here is the call graph for this function:

◆ OnZoomToggle()

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

Definition at line 206 of file ViewMenus.cpp.

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

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

Here is the call graph for this function:

◆ operator=()

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

Member Data Documentation

◆ mProject

AudacityProject& ViewActions::Handler::mProject

Definition at line 379 of file ViewMenus.cpp.

Referenced by Handler(), and OnUndoPushed().

◆ mUndoSubscription

Observer::Subscription ViewActions::Handler::mUndoSubscription

Definition at line 378 of file ViewMenus.cpp.

Referenced by Handler().


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