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

#include <AudioPasteDialog.h>

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

Public Types

enum  DialogResult { KEEP = wxID_HIGHEST + 1 , DISCARD }
 

Public Member Functions

 AudioPasteDialog (wxWindow *parent, wxULongLong nCopiedBytes, int winid=wxID_ANY)
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void PopulateOrExchange (ShuttleGui &S)
 
void OnContinue (wxCommandEvent &)
 
void OnCancel (wxCommandEvent &)
 

Private Attributes

wxCheckBox * mDontShowAgain { nullptr }
 
wxULongLong mCopiedBytesNum {}
 

Detailed Description

Definition at line 18 of file AudioPasteDialog.h.

Member Enumeration Documentation

◆ DialogResult

Enumerator
KEEP 
DISCARD 

Definition at line 27 of file AudioPasteDialog.h.

27 {
28 KEEP = wxID_HIGHEST + 1,
30 };

Constructor & Destructor Documentation

◆ AudioPasteDialog()

AudioPasteDialog::AudioPasteDialog ( wxWindow *  parent,
wxULongLong  nCopiedBytes,
int  winid = wxID_ANY 
)

Definition at line 50 of file AudioPasteDialog.cpp.

51 : wxDialogWrapper(parent, winid, XO("Paste audio")), mCopiedBytesNum(nCopiedBytes)
52{
55
56 SetInitialSize({520, -1});
57
58 Layout();
59 Fit();
60 Center();
61}
XO("Cut/Copy/Paste")
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
#define S(N)
Definition: ToChars.cpp:64
wxULongLong mCopiedBytesNum
void PopulateOrExchange(ShuttleGui &S)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640

References eIsCreatingFromPrefs, PopulateOrExchange(), and S.

Here is the call graph for this function:

Member Function Documentation

◆ OnCancel()

void AudioPasteDialog::OnCancel ( wxCommandEvent &  )
private

Definition at line 145 of file AudioPasteDialog.cpp.

146{
147 EndModal(wxID_CANCEL);
148}

◆ OnContinue()

void AudioPasteDialog::OnContinue ( wxCommandEvent &  )
private

Definition at line 131 of file AudioPasteDialog.cpp.

132{
135
136 auto pasteMode = AudioPasteDialogDefaultModeSetting.Read();
137 if(mDontShowAgain->IsChecked())
139
140 gPrefs->Flush();
141
142 EndModal(pasteMode == wxT("Discard") ? DISCARD : KEEP);
143}
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
ChoiceSetting TracksBehaviorsAudioTrackPastePolicy
wxCheckBox * mDontShowAgain
bool Write(const wxString &value)
Definition: Prefs.cpp:424
wxString Read() const
Definition: Prefs.cpp:388
virtual bool Flush() noexcept=0

References anonymous_namespace{AudioPasteDialog.cpp}::AudioPasteDialogDefaultModeSetting, DISCARD, eIsSavingToPrefs, audacity::BasicSettings::Flush(), gPrefs, KEEP, mDontShowAgain, PopulateOrExchange(), ChoiceSetting::Read(), S, TracksBehaviorsAudioTrackPastePolicy, ChoiceSetting::Write(), and wxT().

Here is the call graph for this function:

◆ PopulateOrExchange()

void AudioPasteDialog::PopulateOrExchange ( ShuttleGui S)
private

Definition at line 63 of file AudioPasteDialog.cpp.

64{
65 S.SetBorder(20);
66 S.AddFixedText(XO("How would you like to paste your audio?"));
67 S.AddSpace(10);
68 S.StartRadioButtonGroup(AudioPasteDialogDefaultModeSetting);
69 {
70 for(int i = 0, count =AudioPasteDialogDefaultModeSetting.GetSymbols().size();
71 i < count;
72 ++i)
73 {
74 S.StartHorizontalLay(wxALIGN_LEFT);
75 {
76 S.SetBorder(0);
77 S.AddSpace(20);
78 wxRadioButton* radioButton{};
79 S.StartVerticalLay(0);
80 {
81 radioButton =
82 S.Name(audioPasteModeText[i]).TieRadioButton();
83 S.AddSpace(0, 0, 1);
84 }
85 S.EndVerticalLay();
86
87 S.AddVariableText(audioPasteModeText[i])->Bind(
88 wxEVT_LEFT_UP, [=](auto)
89 {
90 radioButton->SetValue(true);
91 });
92 #if wxUSE_ACCESSIBILITY
93 safenew WindowAccessible(radioButton);
94 #endif
95 S.AddSpace(20, 0);
96 }
97 S.EndHorizontalLay();
98 if(i != count - 1)
99 S.AddSpace(0, 10);
100 }
101 }
102 S.EndRadioButtonGroup();
103
104 S.SetBorder(20);
105 S.AddFixedText(
106 /* i18n-hint: %s substitutes for a file size, e.g. "345 MB". A "smart clip" is an audio clip containing hidden trimmed data. */
107 XO("The full smart clip is %s. Larger sizes will take longer to paste.")
108 .Format(wxFileName::GetHumanReadableSize(mCopiedBytesNum))
109 );
110
111
112 S.SetBorder(0);
113 S.StartHorizontalLay(wxEXPAND);
114 {
115 S.AddSpace(20, 0);
117 .AddCheckBox(XO("Remember my choice and don't ask again"), false);
118 if(mDontShowAgain != nullptr)
119 mDontShowAgain->SetFont(wxFont(wxFontInfo().Bold()));
120 S.AddSpace(0, 0, 1);
121 S.Id(wxID_CANCEL).AddButton(XXO("Cancel"), wxALIGN_CENTER);
122 S.AddSpace(6, 0);
123 S.Id(wxID_OK).AddButton(XXO("Continue"), wxALIGN_CENTER, true);
124 S.AddSpace(20, 0);
125 }
126 S.EndHorizontalLay();
127
128 S.AddSpace(0, 10);
129}
XXO("&Cut/Copy/Paste Toolbar")
#define safenew
Definition: MemoryX.h:10
const EnumValueSymbols & GetSymbols() const
Definition: Prefs.h:441
Abstract base class used in importing a file.
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
const TranslatableString audioPasteModeText[]

References anonymous_namespace{AudioPasteDialog.cpp}::AudioPasteDialogDefaultModeSetting, anonymous_namespace{AudioPasteDialog.cpp}::audioPasteModeText, ChoiceSetting::GetSymbols(), mCopiedBytesNum, mDontShowAgain, S, safenew, XO(), and XXO().

Referenced by AudioPasteDialog(), and OnContinue().

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

Member Data Documentation

◆ mCopiedBytesNum

wxULongLong AudioPasteDialog::mCopiedBytesNum {}
private

Definition at line 21 of file AudioPasteDialog.h.

Referenced by PopulateOrExchange().

◆ mDontShowAgain

wxCheckBox* AudioPasteDialog::mDontShowAgain { nullptr }
private

Definition at line 20 of file AudioPasteDialog.h.

Referenced by OnContinue(), and PopulateOrExchange().


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