2008-09-26 04:29:30 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2008-2009 Sakari Bergen <sakari.bergen@beatwaves.net>
|
|
|
|
* Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2017 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.
|
|
|
|
*/
|
2008-09-26 04:29:30 -04:00
|
|
|
|
2024-09-25 20:38:59 -04:00
|
|
|
#pragma once
|
2008-09-26 04:29:30 -04:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <list>
|
2023-02-16 12:59:41 -05:00
|
|
|
#include <memory>
|
2008-09-26 04:29:30 -04:00
|
|
|
#include <utility>
|
|
|
|
|
2017-07-16 21:48:18 -04:00
|
|
|
|
|
|
|
#include <gtkmm/box.h>
|
|
|
|
#include <gtkmm/button.h>
|
|
|
|
#include <gtkmm/entry.h>
|
|
|
|
#include <gtkmm/filechooserdialog.h>
|
|
|
|
#include <gtkmm/frame.h>
|
|
|
|
#include <gtkmm/scrolledwindow.h>
|
|
|
|
#include <gtkmm/treemodel.h>
|
|
|
|
#include <gtkmm/treestore.h>
|
|
|
|
#include <gtkmm/treeview.h>
|
2008-09-26 04:29:30 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/xml++.h"
|
2008-09-26 04:29:30 -04:00
|
|
|
|
|
|
|
#include "ardour_dialog.h"
|
|
|
|
namespace ARDOUR {
|
2012-05-24 02:09:29 -04:00
|
|
|
class ElementImportHandler;
|
|
|
|
class ElementImporter;
|
2008-09-26 04:29:30 -04:00
|
|
|
class Session;
|
|
|
|
}
|
|
|
|
|
|
|
|
class SessionImportDialog : public ArdourDialog
|
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
private:
|
2023-02-16 18:33:28 -05:00
|
|
|
typedef std::shared_ptr<ARDOUR::ElementImportHandler> HandlerPtr;
|
2008-09-26 04:29:30 -04:00
|
|
|
typedef std::list<HandlerPtr> HandlerList;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
typedef std::shared_ptr<ARDOUR::ElementImporter> ElementPtr;
|
2008-09-26 04:29:30 -04:00
|
|
|
typedef std::list<ElementPtr> ElementList;
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2009-12-17 13:24:23 -05:00
|
|
|
SessionImportDialog (ARDOUR::Session* target);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-26 04:29:30 -04:00
|
|
|
virtual Gtk::FileChooserAction browse_action() const { return Gtk::FILE_CHOOSER_ACTION_OPEN; }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
private:
|
2008-09-26 04:29:30 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
void load_session (const std::string& filename);
|
2008-09-26 04:29:30 -04:00
|
|
|
void fill_list ();
|
|
|
|
void browse ();
|
|
|
|
void do_merge ();
|
|
|
|
void end_dialog ();
|
2009-05-12 13:03:42 -04:00
|
|
|
void update (std::string path);
|
2008-09-26 04:29:30 -04:00
|
|
|
void show_info(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
std::pair<bool, std::string> open_rename_dialog (std::string text, std::string name);
|
|
|
|
bool open_prompt_dialog (std::string text);
|
2008-09-26 04:29:30 -04:00
|
|
|
|
|
|
|
// Data
|
|
|
|
HandlerList handlers;
|
|
|
|
XMLTree tree;
|
|
|
|
|
|
|
|
// GUI
|
2017-09-18 14:45:56 -04:00
|
|
|
Gtk::Frame file_frame;
|
2008-09-26 04:29:30 -04:00
|
|
|
Gtk::HBox file_hbox;
|
|
|
|
Gtk::Entry file_entry;
|
|
|
|
Gtk::Button file_browse_button;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-26 04:29:30 -04:00
|
|
|
struct SessionBrowserColumns : public Gtk::TreeModel::ColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
2017-07-01 15:11:14 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
|
|
|
Gtk::TreeModelColumn<bool> queued;
|
|
|
|
Gtk::TreeModelColumn<ElementPtr> element;
|
|
|
|
Gtk::TreeModelColumn<std::string> info;
|
2008-09-26 04:29:30 -04:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
SessionBrowserColumns() { add (name); add (queued); add (element); add (info); }
|
2008-09-26 04:29:30 -04:00
|
|
|
};
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-26 04:29:30 -04:00
|
|
|
SessionBrowserColumns sb_cols;
|
|
|
|
Glib::RefPtr<Gtk::TreeStore> session_tree;
|
|
|
|
Gtk::TreeView session_browser;
|
|
|
|
Gtk::ScrolledWindow session_scroll;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-26 04:29:30 -04:00
|
|
|
Gtk::Button* ok_button;
|
|
|
|
Gtk::Button* cancel_button;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-12-19 15:26:31 -05:00
|
|
|
PBD::ScopedConnectionList connections;
|
2008-09-26 04:29:30 -04:00
|
|
|
};
|
|
|
|
|