2008-09-26 04:29:30 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2008 Paul Davis
|
|
|
|
Author: Sakari Bergen
|
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __session_import_dialog_h__
|
|
|
|
#define __session_import_dialog_h__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <list>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#include <gtkmm.h>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/xml++.h"
|
|
|
|
#include "ardour/element_importer.h"
|
|
|
|
#include "ardour/element_import_handler.h"
|
2008-09-26 04:29:30 -04:00
|
|
|
|
|
|
|
#include "ardour_dialog.h"
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
|
|
|
}
|
|
|
|
|
|
|
|
class SessionImportDialog : public ArdourDialog
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
typedef boost::shared_ptr<ARDOUR::ElementImportHandler> HandlerPtr;
|
|
|
|
typedef std::list<HandlerPtr> HandlerList;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-26 04:29:30 -04:00
|
|
|
typedef boost::shared_ptr<ARDOUR::ElementImporter> ElementPtr;
|
|
|
|
typedef std::list<ElementPtr> ElementList;
|
|
|
|
|
|
|
|
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
|
|
|
|
2008-09-26 04:29:30 -04:00
|
|
|
private:
|
|
|
|
|
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
|
|
|
|
Gtk::Frame file_frame;
|
|
|
|
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:
|
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
|
|
|
Gtk::TreeModelColumn<bool> queued;
|
|
|
|
Gtk::TreeModelColumn<ElementPtr> element;
|
2009-05-02 16:26:11 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> info;
|
2008-09-26 04:29:30 -04:00
|
|
|
|
2009-05-02 16:26:11 -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;
|
2009-12-19 15:26:31 -05:00
|
|
|
|
|
|
|
PBD::ScopedConnectionList connections;
|
2008-09-26 04:29:30 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|