ardour
midi_export_dialog.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #include <gtkmm/stock.h>
21 
22 #include "pbd/compose.h"
23 
24 #include "ardour/directory_names.h"
25 #include "ardour/midi_region.h"
26 #include "ardour/session.h"
27 
28 #include "midi_export_dialog.h"
29 
30 #include "i18n.h"
31 
32 using namespace ARDOUR;
33 
35  : ArdourDialog (string_compose (_("Export MIDI: %1"), region->name()))
36  , file_chooser (Gtk::FILE_CHOOSER_ACTION_SAVE)
37 {
38  set_border_width (12);
39 
40  add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
41  add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
42 
43  get_vbox()->set_border_width (12);
44  get_vbox()->pack_start (file_chooser);
45 
46  set_default_response (Gtk::RESPONSE_ACCEPT);
47 
48  file_chooser.set_current_name (region->name() + ".mid");
49  file_chooser.show ();
50 
51  file_chooser.signal_file_activated().connect (sigc::bind (sigc::mem_fun (*this, &MidiExportDialog::response), Gtk::RESPONSE_ACCEPT));
52 }
53 
55 {
56 }
57 
58 void
60 {
62 
63  file_chooser.set_current_folder (Glib::build_filename (Glib::path_get_dirname (s->path()), ARDOUR::export_dir_name));
64 }
65 
66 std::string
68 {
69  return file_chooser.get_filename ();
70 
71 }
Definition: ardour_ui.h:130
LIBARDOUR_API const char *const export_dir_name
Representation of the interface of the Editor class.
void set_session(ARDOUR::Session *)
Gtk::FileChooserWidget file_chooser
#define _(Text)
Definition: i18n.h:11
MidiExportDialog(PublicEditor &editor, boost::shared_ptr< ARDOUR::MidiRegion >)
std::string get_path() const
Definition: amp.h:29
std::string path() const
Definition: session.h:165
const char * name
std::string name() const
virtual void set_session(ARDOUR::Session *)
std::string string_compose(const std::string &fmt, const T1 &o1)
Definition: compose.h:208