2012-05-23 16:32:55 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2012-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2015-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2012-05-23 16:32:55 -04:00
|
|
|
|
|
|
|
#include <gtkmm/stock.h>
|
|
|
|
|
2012-08-10 11:56:25 -04:00
|
|
|
#include "pbd/compose.h"
|
|
|
|
|
2012-05-23 17:12:07 -04:00
|
|
|
#include "ardour/directory_names.h"
|
2012-05-23 16:32:55 -04:00
|
|
|
#include "ardour/midi_region.h"
|
2012-05-23 17:12:07 -04:00
|
|
|
#include "ardour/session.h"
|
2012-05-23 16:32:55 -04:00
|
|
|
|
2019-01-02 11:37:03 -05:00
|
|
|
#include "gtkmm2ext/utils.h"
|
|
|
|
|
2012-05-23 16:32:55 -04:00
|
|
|
#include "midi_export_dialog.h"
|
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2012-08-10 11:56:25 -04:00
|
|
|
|
2012-05-23 16:32:55 -04:00
|
|
|
using namespace ARDOUR;
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
MidiExportDialog::MidiExportDialog (PublicEditor&, std::shared_ptr<MidiRegion> region)
|
2012-05-23 16:32:55 -04:00
|
|
|
: ArdourDialog (string_compose (_("Export MIDI: %1"), region->name()))
|
|
|
|
, file_chooser (Gtk::FILE_CHOOSER_ACTION_SAVE)
|
|
|
|
{
|
2012-05-23 17:12:07 -04:00
|
|
|
set_border_width (12);
|
|
|
|
|
2012-05-23 16:32:55 -04:00
|
|
|
add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
2015-11-01 16:23:01 -05:00
|
|
|
add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
|
2012-05-23 17:12:07 -04:00
|
|
|
|
|
|
|
get_vbox()->set_border_width (12);
|
2012-05-23 16:32:55 -04:00
|
|
|
get_vbox()->pack_start (file_chooser);
|
2012-05-23 17:12:07 -04:00
|
|
|
|
|
|
|
set_default_response (Gtk::RESPONSE_ACCEPT);
|
|
|
|
|
2019-01-02 11:37:03 -05:00
|
|
|
Gtkmm2ext::add_volume_shortcuts (file_chooser);
|
2012-05-23 17:12:07 -04:00
|
|
|
file_chooser.set_current_name (region->name() + ".mid");
|
2012-05-23 16:32:55 -04:00
|
|
|
file_chooser.show ();
|
2012-05-23 17:12:07 -04:00
|
|
|
|
|
|
|
file_chooser.signal_file_activated().connect (sigc::bind (sigc::mem_fun (*this, &MidiExportDialog::response), Gtk::RESPONSE_ACCEPT));
|
2012-05-23 16:32:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
MidiExportDialog::~MidiExportDialog ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-05-23 17:12:07 -04:00
|
|
|
void
|
|
|
|
MidiExportDialog::set_session (Session* s)
|
|
|
|
{
|
|
|
|
ArdourDialog::set_session (s);
|
|
|
|
|
|
|
|
file_chooser.set_current_folder (Glib::build_filename (Glib::path_get_dirname (s->path()), ARDOUR::export_dir_name));
|
|
|
|
}
|
|
|
|
|
2012-05-23 16:32:55 -04:00
|
|
|
std::string
|
|
|
|
MidiExportDialog::get_path () const
|
|
|
|
{
|
|
|
|
return file_chooser.get_filename ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-05-23 16:32:55 -04:00
|
|
|
}
|