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

ScreenshotBigDialog provides an alternative Gui for ScreenshotCommand. It adds a timer that allows a delay before taking a screenshot, provides lots of one-click buttons, options to resize the screen. It forwards the actual work of doing the commands to the ScreenshotCommand. More...

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

Public Member Functions

 ScreenshotBigDialog (wxWindow *parent, wxWindowID id, AudacityProject &project)
 
virtual ~ScreenshotBigDialog ()
 
bool ProcessEvent (wxEvent &event) override
 
- Public Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 

Private Member Functions

void Populate ()
 
void PopulateOrExchange (ShuttleGui &S)
 
void OnCloseWindow (wxCloseEvent &event)
 
void OnUIUpdate (wxUpdateUIEvent &event)
 
void OnDirChoose (wxCommandEvent &event)
 
void OnGetURL (wxCommandEvent &event)
 
void OnClose (wxCommandEvent &event)
 
void SizeMainWindow (int w, int h)
 
void OnMainWindowSmall (wxCommandEvent &event)
 
void OnMainWindowLarge (wxCommandEvent &event)
 
void OnToggleBackgroundBlue (wxCommandEvent &event)
 
void OnToggleBackgroundWhite (wxCommandEvent &event)
 
void DoCapture (int captureMode)
 
void OnCaptureSomething (wxCommandEvent &event)
 
void TimeZoom (double seconds)
 
void OnOneSec (wxCommandEvent &event)
 
void OnTenSec (wxCommandEvent &event)
 
void OnOneMin (wxCommandEvent &event)
 
void OnFiveMin (wxCommandEvent &event)
 
void OnOneHour (wxCommandEvent &event)
 
void SizeTracks (int h)
 
void OnShortTracks (wxCommandEvent &event)
 
void OnMedTracks (wxCommandEvent &event)
 
void OnTallTracks (wxCommandEvent &event)
 
void UpdatePrefs () override
 
std::unique_ptr< ScreenshotCommandCreateCommand ()
 

Private Attributes

AudacityProjectmProject
 
wxCheckBox * mDelayCheckBox
 
wxTextCtrl * mDirectoryTextBox
 
wxToggleButton * mBlue
 
wxToggleButton * mWhite
 
wxStatusBar * mStatus
 
std::unique_ptr< ScreenFrameTimermTimer
 
std::unique_ptr< ScreenshotCommandmCommand
 
const CommandContext mContext
 
int mFirstUnusedId = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 
- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 

Detailed Description

ScreenshotBigDialog provides an alternative Gui for ScreenshotCommand. It adds a timer that allows a delay before taking a screenshot, provides lots of one-click buttons, options to resize the screen. It forwards the actual work of doing the commands to the ScreenshotCommand.

Definition at line 58 of file Screenshot.cpp.

Constructor & Destructor Documentation

◆ ScreenshotBigDialog()

ScreenshotBigDialog::ScreenshotBigDialog ( wxWindow *  parent,
wxWindowID  id,
AudacityProject project 
)

Definition at line 270 of file Screenshot.cpp.

272: wxFrame(parent, id, ScreenCaptureFrameTitle.Translation(),
273 wxDefaultPosition, wxDefaultSize,
274
275#if !defined(__WXMSW__)
276
277 #if !defined(__WXMAC__) // bug1358
278 wxFRAME_TOOL_WINDOW |
279 #endif
280
281#else
282
283 wxSTAY_ON_TOP|
284
285#endif
286
287 wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX)
288 , mProject{ project }
289 , mContext( project )
290{
291 mDelayCheckBox = NULL;
292 mDirectoryTextBox = NULL;
293
294 mStatus = CreateStatusBar(3);
296
297 Populate();
298
299 // Reset the toolbars to a known state.
300 // Note that the audio could be playing.
301 // The monitoring will switch off temporarily
302 // because we've switched monitor mid play.
303 // Bug 383 - Resetting the toolbars is not wanted.
304 // Any that are invisible will be amde visible as/when needed.
305 //ToolManager::Get( mContext.project ).Reset();
306 Center();
307}
#define ScreenCaptureFrameTitle
Definition: Screenshot.cpp:55
const auto project
AudacityProject & mProject
Definition: Screenshot.cpp:105
const CommandContext mContext
Definition: Screenshot.cpp:118
std::unique_ptr< ScreenshotCommand > mCommand
Definition: Screenshot.cpp:117
std::unique_ptr< ScreenshotCommand > CreateCommand()
Definition: Screenshot.cpp:260
wxTextCtrl * mDirectoryTextBox
Definition: Screenshot.cpp:110
wxStatusBar * mStatus
Definition: Screenshot.cpp:113
wxCheckBox * mDelayCheckBox
Definition: Screenshot.cpp:109

References CreateCommand(), mCommand, mDelayCheckBox, mDirectoryTextBox, mStatus, and Populate().

Here is the call graph for this function:

◆ ~ScreenshotBigDialog()

ScreenshotBigDialog::~ScreenshotBigDialog ( )
virtual

Definition at line 309 of file Screenshot.cpp.

310{
311 if (this == mFrame)
312 mFrame = nullptr;
313 else
314 // There should only be one!
315 wxASSERT(false);
316}
ScreenshotBigDialogPtr mFrame
Definition: Screenshot.cpp:130

References mFrame.

Member Function Documentation

◆ CreateCommand()

std::unique_ptr< ScreenshotCommand > ScreenshotBigDialog::CreateCommand ( )
private

Definition at line 260 of file Screenshot.cpp.

261{
262 wxASSERT(mStatus != NULL);
263 auto output =
264 std::make_unique<CommandOutputTargets>(std::make_unique<NullProgressTarget>(),
265 std::make_shared<StatusBarTarget>(*mStatus),
266 std::make_shared<MessageBoxTarget>());
267 return std::make_unique<ScreenshotCommand>();//*type, std::move(output), this);
268}

Referenced by ScreenshotBigDialog().

Here is the caller graph for this function:

◆ DoCapture()

void ScreenshotBigDialog::DoCapture ( int  captureMode)
private

Definition at line 632 of file Screenshot.cpp.

633{
634 Hide();
635 wxYieldIfNeeded();
636 //mCommand->SetParameter(wxT("FilePath"), mDirectoryTextBox->GetValue());
637 //mCommand->SetParameter(wxT("CaptureMode"), captureMode);
638 mCommand->mBack = mWhite->GetValue()
640 : mBlue->GetValue()
642 mCommand->mPath = mDirectoryTextBox->GetValue();
643 mCommand->mWhat = captureMode;
644 if (!mCommand->Apply(mContext))
645 mStatus->SetStatusText(_("Capture failed!"), mainStatusBarField);
646
647 // Bug 2323: (100% hackage alert) Since the command target dialog is not
648 // accessible from outside the command, this seems to be the only way we
649 // can get the window on top of this dialog.
650 auto w = static_cast<wxDialogWrapper *>(wxFindWindowByLabel(XO("Long Message").Translation()));
651 if (w) {
652 auto endmodal = [w](wxCommandEvent &evt)
653 {
654 w->EndModal(0);
655 };
656 w->Bind(wxEVT_BUTTON, endmodal);
657 w->ShowModal();
658 }
659
660 Show();
661}
XO("Cut/Copy/Paste")
#define _(s)
Definition: Internat.h:73
@ mainStatusBarField
Definition: ProjectStatus.h:26
wxToggleButton * mWhite
Definition: Screenshot.cpp:112
wxToggleButton * mBlue
Definition: Screenshot.cpp:111
ExportResult Show(ExportTask exportTask)

References _, ScreenshotCommand::kBlue, ScreenshotCommand::kNone, ScreenshotCommand::kWhite, mainStatusBarField, mBlue, mCommand, mContext, mDirectoryTextBox, mStatus, mWhite, ExportProgressUI::Show(), and XO().

Referenced by OnCaptureSomething().

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

◆ OnCaptureSomething()

void ScreenshotBigDialog::OnCaptureSomething ( wxCommandEvent &  event)
private

Definition at line 663 of file Screenshot.cpp.

664{
665 int i = event.GetId();
666
667 /*
668 IdCaptureEffects= IdCaptureFirst,
669 IdCaptureScriptables,
670 IdCapturePreferences,
671 IdCaptureToolbars,
672
673 // Put all events that need delay between AllDelayed and LastDelayed.
674 IdAllDelayedEvents,
675 IdCaptureWindowContents=IdAllDelayedEvents,
676 IdCaptureFullWindow,
677 IdCaptureWindowPlus,
678 IdCaptureFullScreen,
679
680 IdCaptureSelectionBar,
681 IdCaptureSpectralSelection,
682 IdCaptureTools,
683 IdCaptureTransport,
684 IdCaptureMixer,
685 IdCaptureMeter,
686 IdCapturePlayMeter,
687 IdCaptureRecordMeter,
688 IdCaptureEdit,
689 IdCaptureDevice,
690 IdCaptureTranscription,
691 IdCaptureScrub,
692
693 IdCaptureTrackPanel,
694 IdCaptureRuler,
695 IdCaptureTracks,
696 IdCaptureFirstTrack,
697 IdCaptureSecondTrack,
698 IdCaptureLast = IdCaptureSecondTrack,
699 */
700
701 static const int codes[] = {
706
716 };
717
718 int code;
719 if (i >= IdFirstToolbar)
721 else
722 code = codes[i - IdCaptureFirst];
723 DoCapture(code);
724}
@ IdFirstToolbar
Definition: Screenshot.cpp:230
@ IdCaptureFirst
Definition: Screenshot.cpp:206
void DoCapture(int captureMode)
Definition: Screenshot.cpp:632

References DoCapture(), IdCaptureFirst, IdFirstToolbar, ScreenshotCommand::keffects, ScreenshotCommand::kfirsttrack, ScreenshotCommand::kfullscreen, ScreenshotCommand::kfullwindow, ScreenshotCommand::kpreferences, ScreenshotCommand::kruler, ScreenshotCommand::kscriptables, ScreenshotCommand::ksecondtrack, ScreenshotCommand::ktoolbars, ScreenshotCommand::ktrackpanel, ScreenshotCommand::ktracks, ScreenshotCommand::kwindow, ScreenshotCommand::kwindowplus, and ScreenshotCommand::nCaptureWhats.

Here is the call graph for this function:

◆ OnClose()

void ScreenshotBigDialog::OnClose ( wxCommandEvent &  event)
private

Definition at line 537 of file Screenshot.cpp.

538{
539 if (mDirectoryTextBox->IsModified()) {
540 gPrefs->Write(wxT("/ScreenshotPath"), mDirectoryTextBox->GetValue());
541 gPrefs->Flush();
542 }
543
544 Destroy();
545}
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0

References audacity::BasicSettings::Flush(), gPrefs, mDirectoryTextBox, audacity::BasicSettings::Write(), and wxT().

Here is the call graph for this function:

◆ OnCloseWindow()

void ScreenshotBigDialog::OnCloseWindow ( wxCloseEvent &  event)
private

Definition at line 527 of file Screenshot.cpp.

528{
529 if (mDirectoryTextBox->IsModified()) {
530 gPrefs->Write(wxT("/ScreenshotPath"), mDirectoryTextBox->GetValue());
531 gPrefs->Flush();
532 }
533
534 Destroy();
535}

References audacity::BasicSettings::Flush(), gPrefs, mDirectoryTextBox, audacity::BasicSettings::Write(), and wxT().

Here is the call graph for this function:

◆ OnDirChoose()

void ScreenshotBigDialog::OnDirChoose ( wxCommandEvent &  event)
private

Definition at line 581 of file Screenshot.cpp.

582{
583 wxString current = mDirectoryTextBox->GetValue();
584
585 wxDirDialogWrapper dlog(this,
586 XO("Choose a location to save screenshot images"),
587 current);
588
589 dlog.ShowModal();
590 if (!dlog.GetPath().empty()) {
591 wxFileName tmpDirPath;
592 tmpDirPath.AssignDir(dlog.GetPath());
593 wxString path = tmpDirPath.GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR);
594 mDirectoryTextBox->SetValue(path);
595 gPrefs->Write(wxT("/ScreenshotPath"), path);
596 gPrefs->Flush();
597 mCommand->mPath = path;
598 }
599}

References audacity::BasicSettings::Flush(), gPrefs, mCommand, mDirectoryTextBox, audacity::BasicSettings::Write(), wxT(), and XO().

Here is the call graph for this function:

◆ OnFiveMin()

void ScreenshotBigDialog::OnFiveMin ( wxCommandEvent &  event)
private

Definition at line 752 of file Screenshot.cpp.

753{
754 TimeZoom(300.0);
755}
void TimeZoom(double seconds)
Definition: Screenshot.cpp:726

References TimeZoom().

Here is the call graph for this function:

◆ OnGetURL()

void ScreenshotBigDialog::OnGetURL ( wxCommandEvent &  event)
private

Definition at line 547 of file Screenshot.cpp.

548{
549 HelpSystem::ShowHelp(this, L"Screenshot");
550}
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:233

References HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnMainWindowLarge()

void ScreenshotBigDialog::OnMainWindowLarge ( wxCommandEvent &  event)
private

Definition at line 627 of file Screenshot.cpp.

628{
629 SizeMainWindow(900, 600);
630}
void SizeMainWindow(int w, int h)
Definition: Screenshot.cpp:611

References SizeMainWindow().

Here is the call graph for this function:

◆ OnMainWindowSmall()

void ScreenshotBigDialog::OnMainWindowSmall ( wxCommandEvent &  event)
private

Definition at line 622 of file Screenshot.cpp.

623{
624 SizeMainWindow(680, 450);
625}

References SizeMainWindow().

Here is the call graph for this function:

◆ OnMedTracks()

void ScreenshotBigDialog::OnMedTracks ( wxCommandEvent &  event)
private

Definition at line 796 of file Screenshot.cpp.

797{
798 SizeTracks(60);
799}
void SizeTracks(int h)
Definition: Screenshot.cpp:762

References SizeTracks().

Here is the call graph for this function:

◆ OnOneHour()

void ScreenshotBigDialog::OnOneHour ( wxCommandEvent &  event)
private

Definition at line 757 of file Screenshot.cpp.

758{
759 TimeZoom(3600.0);
760}

References TimeZoom().

Here is the call graph for this function:

◆ OnOneMin()

void ScreenshotBigDialog::OnOneMin ( wxCommandEvent &  event)
private

Definition at line 747 of file Screenshot.cpp.

748{
749 TimeZoom(60.0);
750}

References TimeZoom().

Here is the call graph for this function:

◆ OnOneSec()

void ScreenshotBigDialog::OnOneSec ( wxCommandEvent &  event)
private

Definition at line 737 of file Screenshot.cpp.

738{
739 TimeZoom(1.0);
740}

References TimeZoom().

Here is the call graph for this function:

◆ OnShortTracks()

void ScreenshotBigDialog::OnShortTracks ( wxCommandEvent &  event)
private

Definition at line 783 of file Screenshot.cpp.

784{
785 auto &project = mContext.project;
786 for (auto t : TrackList::Get(project).Any<WaveTrack>()) {
787 for (auto pChannel : t->Channels()) {
788 auto &view = ChannelView::Get(*pChannel);
789 view.SetExpandedHeight(view.GetMinimizedHeight());
790 }
791 }
792
794}
static ChannelView & Get(Channel &channel)
AudacityProject & project
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:347
void Redraw()
Definition: Viewport.cpp:776
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:32

References TrackList::Get(), Viewport::Get(), ChannelView::Get(), mContext, CommandContext::project, project, and Viewport::Redraw().

Here is the call graph for this function:

◆ OnTallTracks()

void ScreenshotBigDialog::OnTallTracks ( wxCommandEvent &  event)
private

Definition at line 801 of file Screenshot.cpp.

802{
803 SizeTracks(85);
804}

References SizeTracks().

Here is the call graph for this function:

◆ OnTenSec()

void ScreenshotBigDialog::OnTenSec ( wxCommandEvent &  event)
private

Definition at line 742 of file Screenshot.cpp.

743{
744 TimeZoom(10.0);
745}

References TimeZoom().

Here is the call graph for this function:

◆ OnToggleBackgroundBlue()

void ScreenshotBigDialog::OnToggleBackgroundBlue ( wxCommandEvent &  event)
private

Definition at line 601 of file Screenshot.cpp.

602{
603 mWhite->SetValue(false);
604}

References mWhite.

◆ OnToggleBackgroundWhite()

void ScreenshotBigDialog::OnToggleBackgroundWhite ( wxCommandEvent &  event)
private

Definition at line 606 of file Screenshot.cpp.

607{
608 mBlue->SetValue(false);
609}

References mBlue.

◆ OnUIUpdate()

void ScreenshotBigDialog::OnUIUpdate ( wxUpdateUIEvent &  event)
private

Definition at line 552 of file Screenshot.cpp.

553{
554#ifdef __WXMAC__
555 wxTopLevelWindow *top = mCommand->GetFrontWindow(&mProject);
556 bool needupdate = false;
557 bool enable = false;
558
559 if ((!top || top->IsIconized()) && mDirectoryTextBox->IsEnabled()) {
560 needupdate = true;
561 enable = false;
562 }
563 else if ((top && !top->IsIconized()) && !mDirectoryTextBox->IsEnabled()) {
564 needupdate = true;
565 enable = true;
566 }
567
568 if (needupdate) {
569 for (int i = IdMainWindowSmall; i < mFirstUnusedId; i++) {
571 continue;
572 wxWindow *w = wxWindow::FindWindowById(i, this);
573 if (w) {
574 w->Enable(enable);
575 }
576 }
577 }
578#endif
579}
@ IdToggleBackgroundWhite
Definition: Screenshot.cpp:204
@ IdMainWindowSmall
Definition: Screenshot.cpp:185
@ IdToggleBackgroundBlue
Definition: Screenshot.cpp:203

References IdMainWindowSmall, IdToggleBackgroundBlue, IdToggleBackgroundWhite, mCommand, mDirectoryTextBox, mFirstUnusedId, and mProject.

◆ Populate()

void ScreenshotBigDialog::Populate ( )
private

Definition at line 318 of file Screenshot.cpp.

319{
320 ShuttleGui S(this, eIsCreating);
322}
@ eIsCreating
Definition: ShuttleGui.h:37
#define S(N)
Definition: ToChars.cpp:64
void PopulateOrExchange(ShuttleGui &S)
Definition: Screenshot.cpp:324
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:630

References eIsCreating, PopulateOrExchange(), and S.

Referenced by ScreenshotBigDialog(), and UpdatePrefs().

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

◆ PopulateOrExchange()

void ScreenshotBigDialog::PopulateOrExchange ( ShuttleGui S)
private

Definition at line 324 of file Screenshot.cpp.

325{
326 wxPanel *p = S.StartPanel();
328 {
329 S.SetBorder(3);
330
331 S.StartStatic(XO("Choose location to save files"));
332 {
333 S.StartMultiColumn(3, wxEXPAND);
334 {
335 S.SetStretchyCol(1);
336
338 S.Id(IdDirectory).AddTextBox(
339 XXO("Save images to:"),
340 gPrefs->Read(wxT("/ScreenshotPath"), wxFileName::GetHomeDir()),
341 30
342 );
343 S.Id(IdDirChoose).AddButton(XXO("Choose..."));
344 }
345 S.EndMultiColumn();
346 }
347 S.EndStatic();
348
349 S.StartStatic(XO("Capture entire window or screen"));
350 {
351 S.StartHorizontalLay();
352 {
353 S.Id(IdMainWindowSmall).AddButton(XXO("Resize Small"));
354 S.Id(IdMainWindowLarge).AddButton(XXO("Resize Large"));
355 mBlue = safenew wxToggleButton(S.GetParent(),
357 /* i18n-hint: Bkgnd is short for background and appears on a small button
358 * It is OK to just translate this item as if it said 'Blue' */
359 _("Blue Bkgnd"));
360 S.AddWindow(mBlue);
361 mWhite = safenew wxToggleButton(S.GetParent(),
363 /* i18n-hint: Bkgnd is short for background and appears on a small button
364 * It is OK to just translate this item as if it said 'White' */
365 _("White Bkgnd"));
366 S.AddWindow(mWhite);
367 }
368 S.EndHorizontalLay();
369
370 S.StartHorizontalLay();
371 {
372 S.Id(IdCaptureWindowContents).AddButton(XXO("Capture Window Only"));
373 S.Id(IdCaptureFullWindow).AddButton(XXO("Capture Full Window"));
374 S.Id(IdCaptureWindowPlus).AddButton(XXO("Capture Window Plus"));
375 }
376 S.EndHorizontalLay();
377
378 S.StartHorizontalLay();
379 {
380 S.Id(IdCaptureFullScreen).AddButton(XXO("Capture Full Screen"));
381 }
382 S.EndHorizontalLay();
383
384 S.StartHorizontalLay();
385 {
386 mDelayCheckBox = S.Id(IdDelayCheckBox).AddCheckBox(
387 XXO("Wait 5 seconds and capture frontmost window/dialog"),
388 false);
389 }
390 S.EndHorizontalLay();
391 }
392 S.EndStatic();
393
394 S.StartStatic(XO("Capture part of a project window"));
395 {
396 S.StartHorizontalLay();
397 {
398 S.Id(IdCaptureToolbars).AddButton(XXO("All Toolbars"));
399 S.Id(IdCaptureEffects).AddButton(XXO("All Effects"));
400 S.Id(IdCaptureScriptables).AddButton(XXO("All Scriptables"));
401 S.Id(IdCapturePreferences).AddButton(XXO("All Preferences"));
402 }
403 S.EndHorizontalLay();
404
405 {
406 // Discover the available toolbars and make rows of buttons
407 int id = IdFirstToolbar;
408 size_t ii = 0;
409 S.StartHorizontalLay();
410 std::vector<ToolBar *> bars;
412 bars.emplace_back(pBar);
413 });
414 // Sort by translation, for determinacy (per language) of the
415 // sequence
416 static const auto comp = [](ToolBar *a, ToolBar *b){
417 return a->GetLabel().Translation() < b->GetLabel().Translation();
418 };
419 sort(bars.begin(), bars.end(), comp);
420 for_each(bars.begin(), bars.end(), [&](ToolBar *pBar){
421 S.Id(id).AddButton(pBar->GetLabel());
422 Bind(wxEVT_BUTTON,
423 &ScreenshotBigDialog::OnCaptureSomething, this, id);
424 ++id;
425 // Start a new row at every fourth one
426 if (++ii == 4) {
427 ii = 0;
428 S.EndHorizontalLay();
429 S.StartHorizontalLay();
430 }
431 });
433 S.EndHorizontalLay();
434 }
435
436 S.StartHorizontalLay();
437 {
438 S.Id(IdCaptureTrackPanel).AddButton(XXO("Track Panel"));
439 S.Id(IdCaptureRuler).AddButton(XXO("Ruler"));
440 S.Id(IdCaptureTracks).AddButton(XXO("Tracks"));
441 S.Id(IdCaptureFirstTrack).AddButton(XXO("First Track"));
442 S.Id(IdCaptureSecondTrack).AddButton(XXO("Second Track"));
443 }
444 S.EndHorizontalLay();
445 }
446 S.EndStatic();
447
448 S.StartStatic(XO("Scale"));
449 {
450 S.StartHorizontalLay();
451 {
452 S.Id(IdOneSec).AddButton(XXO("One Sec"));
453 S.Id(IdTenSec).AddButton(XXO("Ten Sec"));
454 S.Id(IdOneMin).AddButton(XXO("One Min"));
455 S.Id(IdFiveMin).AddButton(XXO("Five Min"));
456 S.Id(IdOneHour).AddButton(XXO("One Hour"));
457 }
458 S.EndHorizontalLay();
459
460 S.StartHorizontalLay();
461 {
462 S.Id(IdShortTracks).AddButton(XXO("Short Tracks"));
463 S.Id(IdMedTracks).AddButton(XXO("Medium Tracks"));
464 S.Id(IdTallTracks).AddButton(XXO("Tall Tracks"));
465 }
466 S.EndHorizontalLay();
467 }
468 S.EndStatic();
469 S.AddStandardButtons(eCloseButton |eHelpButton);
470 }
471 S.EndPanel();
472
473 Layout();
474 GetSizer()->Fit(this);
475 SetMinSize(GetSize());
476
477 int top = 0;
478#ifdef __WXMAC__
479 // Allow for Mac menu bar
480 top += 20;
481#endif
482
483 int width, height;
484 GetSize(&width, &height);
485 int displayWidth, displayHeight;
486 wxDisplaySize(&displayWidth, &displayHeight);
487
488 if (width > 100) {
489 Move(displayWidth - width - 16, top + 16);
490 }
491 else {
492 CentreOnParent();
493 }
494
495 SetIcon( GetProjectFrame( mContext.project ).GetIcon() );
496}
XXO("&Cut/Copy/Paste Toolbar")
#define RTL_WORKAROUND(pWnd)
Definition: GUISettings.h:20
#define safenew
Definition: MemoryX.h:10
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
@ IdTallTracks
Definition: Screenshot.cpp:199
@ IdFiveMin
Definition: Screenshot.cpp:194
@ IdCaptureEffects
Definition: Screenshot.cpp:209
@ IdMainWindowLarge
Definition: Screenshot.cpp:186
@ IdCaptureToolbars
Definition: Screenshot.cpp:213
@ IdTenSec
Definition: Screenshot.cpp:192
@ IdCaptureFirstTrack
Definition: Screenshot.cpp:225
@ IdCaptureWindowContents
Definition: Screenshot.cpp:217
@ IdCaptureRuler
Definition: Screenshot.cpp:223
@ IdOneMin
Definition: Screenshot.cpp:193
@ IdDirectory
Definition: Screenshot.cpp:188
@ IdOneHour
Definition: Screenshot.cpp:195
@ IdDirChoose
Definition: Screenshot.cpp:189
@ IdCaptureSecondTrack
Definition: Screenshot.cpp:226
@ IdCaptureTracks
Definition: Screenshot.cpp:224
@ IdCaptureFullScreen
Definition: Screenshot.cpp:220
@ IdOneSec
Definition: Screenshot.cpp:191
@ IdCaptureWindowPlus
Definition: Screenshot.cpp:219
@ IdCaptureScriptables
Definition: Screenshot.cpp:210
@ IdDelayCheckBox
Definition: Screenshot.cpp:201
@ IdCaptureTrackPanel
Definition: Screenshot.cpp:222
@ IdCaptureFullWindow
Definition: Screenshot.cpp:218
@ IdShortTracks
Definition: Screenshot.cpp:197
@ IdMedTracks
Definition: Screenshot.cpp:198
@ IdCapturePreferences
Definition: Screenshot.cpp:211
@ eCloseButton
Definition: ShuttleGui.h:609
@ eHelpButton
Definition: ShuttleGui.h:603
int id
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:74
TranslatableString GetLabel()
Definition: ToolBar.cpp:392
static ToolManager & Get(AudacityProject &project)
void ForEach(F &&fun)
Visit bars, lexicographically by their textual ids.
Definition: ToolManager.h:102
wxString Translation() const
virtual bool Read(const wxString &key, bool *value) const =0

References _, eCloseButton, eHelpButton, ToolManager::ForEach(), ToolManager::Get(), ToolBar::GetLabel(), gPrefs, id, IdCaptureEffects, IdCaptureFirstTrack, IdCaptureFullScreen, IdCaptureFullWindow, IdCapturePreferences, IdCaptureRuler, IdCaptureScriptables, IdCaptureSecondTrack, IdCaptureToolbars, IdCaptureTrackPanel, IdCaptureTracks, IdCaptureWindowContents, IdCaptureWindowPlus, IdDelayCheckBox, IdDirChoose, IdDirectory, IdFirstToolbar, IdFiveMin, IdMainWindowLarge, IdMainWindowSmall, IdMedTracks, IdOneHour, IdOneMin, IdOneSec, IdShortTracks, IdTallTracks, IdTenSec, IdToggleBackgroundBlue, IdToggleBackgroundWhite, mBlue, mDelayCheckBox, mDirectoryTextBox, mFirstUnusedId, mProject, mWhite, audacity::BasicSettings::Read(), RTL_WORKAROUND, S, safenew, TranslatableString::Translation(), wxT(), XO(), and XXO().

Referenced by Populate().

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

◆ ProcessEvent()

bool ScreenshotBigDialog::ProcessEvent ( wxEvent &  event)
override

Definition at line 498 of file Screenshot.cpp.

499{
500 if (!IsFrozen())
501 {
502 int id = e.GetId();
503
504 // If split into two parts to make for easier breakpoint
505 // when testing timer.
506 if (mDelayCheckBox &&
507 mDelayCheckBox->GetValue() &&
508 e.IsCommandEvent() &&
509 e.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED)
510 {
511 if( id >= IdAllDelayedEvents &&
512 e.GetEventObject() != NULL) {
513 mTimer = std::make_unique<ScreenFrameTimer>(this, e);
514 mTimer->Start(5000, true);
515 return true;
516 }
517 }
518
519 if (e.IsCommandEvent() && e.GetEventObject() == NULL) {
520 e.SetEventObject(this);
521 }
522 }
523
524 return wxFrame::ProcessEvent(e);
525}
wxEVT_COMMAND_BUTTON_CLICKED
@ IdAllDelayedEvents
Definition: Screenshot.cpp:216
std::unique_ptr< ScreenFrameTimer > mTimer
Definition: Screenshot.cpp:115

References IdAllDelayedEvents, mDelayCheckBox, mTimer, and wxEVT_COMMAND_BUTTON_CLICKED.

Referenced by ScreenFrameTimer::Notify().

Here is the caller graph for this function:

◆ SizeMainWindow()

void ScreenshotBigDialog::SizeMainWindow ( int  w,
int  h 
)
private

Definition at line 611 of file Screenshot.cpp.

612{
613 int top = 20;
614
615 auto &window = GetProjectFrame( mContext.project );
616 window.Maximize(false);
617 window.SetSize(16, 16 + top, w, h);
618 //Bug383 - Toolbar Resets not wanted.
619 //ToolManager::Get( mContext.project ).Reset();
620}

References GetProjectFrame(), mContext, and CommandContext::project.

Referenced by OnMainWindowLarge(), and OnMainWindowSmall().

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

◆ SizeTracks()

void ScreenshotBigDialog::SizeTracks ( int  h)
private

Definition at line 762 of file Screenshot.cpp.

763{
764 // h is the height for a channel
765 // Set the height of a mono track twice as high
766
767 // TODO: more-than-two-channels
768 // If there should be more-than-stereo tracks, this makes
769 // each channel as high as for a stereo channel
770
771 auto &project = mContext.project;
773 for (auto t : tracks.Any<WaveTrack>()) {
774 auto channels = t->Channels();
775 auto nChannels = channels.size();
776 auto height = nChannels == 1 ? 2 * h : h;
777 for (auto pChannel : channels)
778 ChannelView::Get(*pChannel).SetExpandedHeight(height);
779 }
781}
const auto tracks
void SetExpandedHeight(int height)
A Track that contains audio waveform data.
Definition: WaveTrack.h:222

References TrackList::Get(), Viewport::Get(), ChannelView::Get(), mContext, CommandContext::project, project, Viewport::Redraw(), ChannelView::SetExpandedHeight(), and tracks.

Referenced by OnMedTracks(), and OnTallTracks().

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

◆ TimeZoom()

void ScreenshotBigDialog::TimeZoom ( double  seconds)
private

Definition at line 726 of file Screenshot.cpp.

727{
728 auto &project = mContext.project;
729 auto &viewInfo = ViewInfo::Get(project);
730 auto &window = GetProjectFrame(project);
731 int width, height;
732 window.GetClientSize(&width, &height);
733 viewInfo.SetZoom((0.75 * width) / seconds);
735}
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References ViewInfo::Get(), Viewport::Get(), GetProjectFrame(), mContext, CommandContext::project, project, and Viewport::Redraw().

Referenced by OnFiveMin(), OnOneHour(), OnOneMin(), OnOneSec(), and OnTenSec().

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

◆ UpdatePrefs()

void ScreenshotBigDialog::UpdatePrefs ( )
overrideprivatevirtual

Implements PrefsListener.

Definition at line 806 of file Screenshot.cpp.

807{
808 Freeze();
809
810 SetSizer(nullptr);
811 DestroyChildren();
812
813 SetTitle(ScreenCaptureFrameTitle.Translation());
814 Populate();
815
816 Thaw();
817}

References Populate(), and ScreenCaptureFrameTitle.

Here is the call graph for this function:

Member Data Documentation

◆ mBlue

wxToggleButton* ScreenshotBigDialog::mBlue
private

Definition at line 111 of file Screenshot.cpp.

Referenced by DoCapture(), OnToggleBackgroundWhite(), and PopulateOrExchange().

◆ mCommand

std::unique_ptr<ScreenshotCommand> ScreenshotBigDialog::mCommand
private

Definition at line 117 of file Screenshot.cpp.

Referenced by DoCapture(), OnDirChoose(), OnUIUpdate(), and ScreenshotBigDialog().

◆ mContext

const CommandContext ScreenshotBigDialog::mContext
private

Definition at line 118 of file Screenshot.cpp.

Referenced by DoCapture(), OnShortTracks(), SizeMainWindow(), SizeTracks(), and TimeZoom().

◆ mDelayCheckBox

wxCheckBox* ScreenshotBigDialog::mDelayCheckBox
private

Definition at line 109 of file Screenshot.cpp.

Referenced by PopulateOrExchange(), ProcessEvent(), and ScreenshotBigDialog().

◆ mDirectoryTextBox

wxTextCtrl* ScreenshotBigDialog::mDirectoryTextBox
private

◆ mFirstUnusedId

int ScreenshotBigDialog::mFirstUnusedId = 0
private

Definition at line 120 of file Screenshot.cpp.

Referenced by OnUIUpdate(), and PopulateOrExchange().

◆ mProject

AudacityProject& ScreenshotBigDialog::mProject
private

Definition at line 105 of file Screenshot.cpp.

Referenced by OnUIUpdate(), and PopulateOrExchange().

◆ mStatus

wxStatusBar* ScreenshotBigDialog::mStatus
private

Definition at line 113 of file Screenshot.cpp.

Referenced by DoCapture(), and ScreenshotBigDialog().

◆ mTimer

std::unique_ptr<ScreenFrameTimer> ScreenshotBigDialog::mTimer
private

Definition at line 115 of file Screenshot.cpp.

Referenced by ProcessEvent().

◆ mWhite

wxToggleButton* ScreenshotBigDialog::mWhite
private

Definition at line 112 of file Screenshot.cpp.

Referenced by DoCapture(), OnToggleBackgroundBlue(), and PopulateOrExchange().


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