2 * Copyright (C) 2012-2016 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2015-2019 Robin Gareus <robin@gareus.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include <gtkmm/stock.h>
22 #include "pbd/compose.h"
24 #include "ardour/directory_names.h"
25 #include "ardour/midi_region.h"
26 #include "ardour/session.h"
28 #include "gtkmm2ext/utils.h"
30 #include "midi_export_dialog.h"
34 using namespace ARDOUR;
36 MidiExportDialog::MidiExportDialog (PublicEditor&, boost::shared_ptr<MidiRegion> region)
37 : ArdourDialog (string_compose (_("Export MIDI: %1"), region->name()))
38 , file_chooser (Gtk::FILE_CHOOSER_ACTION_SAVE)
40 set_border_width (12);
42 add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
43 add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
45 get_vbox()->set_border_width (12);
46 get_vbox()->pack_start (file_chooser);
48 set_default_response (Gtk::RESPONSE_ACCEPT);
50 Gtkmm2ext::add_volume_shortcuts (file_chooser);
51 file_chooser.set_current_name (region->name() + ".mid");
54 file_chooser.signal_file_activated().connect (sigc::bind (sigc::mem_fun (*this, &MidiExportDialog::response), Gtk::RESPONSE_ACCEPT));
57 MidiExportDialog::~MidiExportDialog ()
62 MidiExportDialog::set_session (Session* s)
64 ArdourDialog::set_session (s);
66 file_chooser.set_current_folder (Glib::build_filename (Glib::path_get_dirname (s->path()), ARDOUR::export_dir_name));
70 MidiExportDialog::get_path () const
72 return file_chooser.get_filename ();