Audacity 3.2.0
ImportStreamDialog.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 ImportStreamDialog.cpp
6
7 Dominic Mazzoni
8
9 Vitaly Sverchinsky split from Import.cpp
10
11**********************************************************************/
12#include "ImportStreamDialog.h"
13
14#include <wx/listbox.h>
15#include <wx/sizer.h>
16
17#include "ShuttleGui.h"
18
19#include "ImportPlugin.h"
20#include "IteratorX.h"
21
22BEGIN_EVENT_TABLE( ImportStreamDialog, wxDialogWrapper )
26
27ImportStreamDialog::ImportStreamDialog( ImportFileHandle *_mFile, wxWindow *parent, wxWindowID id, const TranslatableString &title,
28 const wxPoint &position, const wxSize& size, long style ):
29wxDialogWrapper( parent, id, title, position, size, style | wxRESIZE_BORDER )
30{
31 SetName();
32
33 mFile = _mFile;
34 scount = mFile->GetStreamCount();
35 for (wxInt32 i = 0; i < scount; i++)
36 mFile->SetStreamUsage(i, FALSE);
37
38 ShuttleGui S{ this, eIsCreating };
39 {
40 S.SetBorder( 5 );
41
42 StreamList =
43 S
44 .Prop(1)
45 .Position(wxEXPAND | wxALIGN_LEFT | wxALL)
46 .Style(wxLB_EXTENDED | wxLB_ALWAYS_SB)
47 .AddListBox(
48 transform_container<wxArrayStringEx>(
49 mFile->GetStreamInfo(),
50 std::mem_fn( &TranslatableString::Translation ) ) );
51
52 S.AddStandardButtons();
53 }
54
55 SetAutoLayout(true);
56 GetSizer()->Fit( this );
57
58 SetSize( 400, 200 );
59}
60
62{
63
64}
65
66void ImportStreamDialog::OnOk(wxCommandEvent & WXUNUSED(event))
67{
68 wxArrayInt selitems;
69 int sels = StreamList->GetSelections(selitems);
70 for (wxInt32 i = 0; i < sels; i++)
71 mFile->SetStreamUsage(selitems[i],TRUE);
72 EndModal( wxID_OK );
73}
74
75void ImportStreamDialog::OnCancel(wxCommandEvent & WXUNUSED(event))
76{
77 EndModal( wxID_CANCEL );
78}
END_EVENT_TABLE()
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
The interface that all file import "plugins" (if you want to call them that) must implement....
static const auto title
@ eIsCreating
Definition: ShuttleGui.h:37
#define S(N)
Definition: ToChars.cpp:64
Base class for FlacImportFileHandle, LOFImportFileHandle, MP3ImportFileHandle, OggImportFileHandle an...
Definition: ImportPlugin.h:111
virtual void SetStreamUsage(wxInt32 StreamID, bool Use)=0
void OnOk(wxCommandEvent &event)
ImportFileHandle * mFile
void OnCancel(wxCommandEvent &event)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const