first part of using appropriate .ext extensions for the current chosen native file...
[ardour2.git] / gtk2_ardour / session_import_dialog.h
blobebfd49f8c975ce6d519ae5000d06c24fde5624fa
1 /*
2 Copyright (C) 2008 Paul Davis
3 Author: Sakari Bergen
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
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __session_import_dialog_h__
22 #define __session_import_dialog_h__
24 #include <string>
25 #include <list>
26 #include <utility>
28 #include <boost/shared_ptr.hpp>
29 #include <gtkmm.h>
31 #include "pbd/xml++.h"
32 #include "ardour/element_importer.h"
33 #include "ardour/element_import_handler.h"
35 #include "ardour_dialog.h"
37 namespace ARDOUR {
38 class Session;
41 class SessionImportDialog : public ArdourDialog
43 private:
44 typedef boost::shared_ptr<ARDOUR::ElementImportHandler> HandlerPtr;
45 typedef std::list<HandlerPtr> HandlerList;
47 typedef boost::shared_ptr<ARDOUR::ElementImporter> ElementPtr;
48 typedef std::list<ElementPtr> ElementList;
50 public:
51 SessionImportDialog (ARDOUR::Session* target);
53 virtual Gtk::FileChooserAction browse_action() const { return Gtk::FILE_CHOOSER_ACTION_OPEN; }
55 private:
57 void load_session (const std::string& filename);
58 void fill_list ();
59 void browse ();
60 void do_merge ();
61 void end_dialog ();
62 void update (std::string path);
63 void show_info(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
65 std::pair<bool, std::string> open_rename_dialog (std::string text, std::string name);
66 bool open_prompt_dialog (std::string text);
68 // Data
69 HandlerList handlers;
70 XMLTree tree;
72 // GUI
73 Gtk::Frame file_frame;
74 Gtk::HBox file_hbox;
75 Gtk::Entry file_entry;
76 Gtk::Button file_browse_button;
78 struct SessionBrowserColumns : public Gtk::TreeModel::ColumnRecord
80 public:
81 Gtk::TreeModelColumn<std::string> name;
82 Gtk::TreeModelColumn<bool> queued;
83 Gtk::TreeModelColumn<ElementPtr> element;
84 Gtk::TreeModelColumn<std::string> info;
86 SessionBrowserColumns() { add (name); add (queued); add (element); add (info); }
89 SessionBrowserColumns sb_cols;
90 Glib::RefPtr<Gtk::TreeStore> session_tree;
91 Gtk::TreeView session_browser;
92 Gtk::ScrolledWindow session_scroll;
94 Gtk::Button* ok_button;
95 Gtk::Button* cancel_button;
97 PBD::ScopedConnectionList connections;
100 #endif