* Fix tooltips in the session import dialog
[ardour.git] / gtk2_ardour / session_import_dialog.h
1 /*
2     Copyright (C) 2008 Paul Davis
3     Author: Sakari Bergen
4
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.
9
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.
14
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.
18
19 */
20
21 #ifndef __session_import_dialog_h__
22 #define __session_import_dialog_h__
23
24 #include <string>
25 #include <list>
26 #include <utility>
27
28 #include <boost/shared_ptr.hpp>
29 #include <gtkmm.h>
30
31 #include "pbd/xml++.h"
32 #include "ardour/element_importer.h"
33 #include "ardour/element_import_handler.h"
34
35 #include "ardour_dialog.h"
36
37 using std::string;
38
39 namespace ARDOUR {
40         class Session;
41 }
42
43 class SessionImportDialog : public ArdourDialog
44 {
45   private:
46         typedef boost::shared_ptr<ARDOUR::ElementImportHandler> HandlerPtr;
47         typedef std::list<HandlerPtr> HandlerList;
48         
49         typedef boost::shared_ptr<ARDOUR::ElementImporter> ElementPtr;
50         typedef std::list<ElementPtr> ElementList;
51
52   public:
53         SessionImportDialog (ARDOUR::Session & target);
54         
55         virtual Gtk::FileChooserAction browse_action() const { return Gtk::FILE_CHOOSER_ACTION_OPEN; }
56         
57   private:
58
59         void load_session (const string& filename);
60         void fill_list ();
61         void browse ();
62         void do_merge ();
63         void end_dialog ();
64         void update (string path);
65         void show_info(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
66         
67         std::pair<bool, string> open_rename_dialog (string text, string name);
68         bool open_prompt_dialog (string text);
69
70         // Data
71         HandlerList        handlers;
72         XMLTree            tree;
73         ARDOUR::Session   &target;
74
75         // GUI
76         Gtk::Frame                    file_frame;
77         Gtk::HBox                     file_hbox;
78         Gtk::Entry                    file_entry;
79         Gtk::Button                   file_browse_button;
80         
81         struct SessionBrowserColumns : public Gtk::TreeModel::ColumnRecord
82         {
83         public:
84           Gtk::TreeModelColumn<std::string>    name;
85           Gtk::TreeModelColumn<bool>           queued;
86           Gtk::TreeModelColumn<ElementPtr>     element;
87           Gtk::TreeModelColumn<std::string>    info;
88
89           SessionBrowserColumns() { add (name); add (queued); add (element); add (info); }
90         };
91         
92         SessionBrowserColumns         sb_cols;
93         Glib::RefPtr<Gtk::TreeStore>  session_tree;
94         Gtk::TreeView                 session_browser;
95         Gtk::ScrolledWindow           session_scroll;
96         
97         Gtk::Button*                  ok_button;
98         Gtk::Button*                  cancel_button;
99 };
100
101 #endif