Fix thinkos in cubasish theme
[ardour.git] / gtk2_ardour / session_import_dialog.h
1 /*
2  * Copyright (C) 2008-2009 Sakari Bergen <sakari.bergen@beatwaves.net>
3  * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
4  * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef __session_import_dialog_h__
23 #define __session_import_dialog_h__
24
25 #include <string>
26 #include <list>
27 #include <utility>
28
29 #include <boost/shared_ptr.hpp>
30
31 #include <gtkmm/box.h>
32 #include <gtkmm/button.h>
33 #include <gtkmm/entry.h>
34 #include <gtkmm/filechooserdialog.h>
35 #include <gtkmm/frame.h>
36 #include <gtkmm/scrolledwindow.h>
37 #include <gtkmm/treemodel.h>
38 #include <gtkmm/treestore.h>
39 #include <gtkmm/treeview.h>
40
41 #include "pbd/xml++.h"
42
43 #include "ardour_dialog.h"
44 namespace ARDOUR {
45         class ElementImportHandler;
46         class ElementImporter;
47         class Session;
48 }
49
50 class SessionImportDialog : public ArdourDialog
51 {
52 private:
53         typedef boost::shared_ptr<ARDOUR::ElementImportHandler> HandlerPtr;
54         typedef std::list<HandlerPtr> HandlerList;
55
56         typedef boost::shared_ptr<ARDOUR::ElementImporter> ElementPtr;
57         typedef std::list<ElementPtr> ElementList;
58
59 public:
60         SessionImportDialog (ARDOUR::Session* target);
61
62         virtual Gtk::FileChooserAction browse_action() const { return Gtk::FILE_CHOOSER_ACTION_OPEN; }
63
64 private:
65
66         void load_session (const std::string& filename);
67         void fill_list ();
68         void browse ();
69         void do_merge ();
70         void end_dialog ();
71         void update (std::string path);
72         void show_info(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
73
74         std::pair<bool, std::string> open_rename_dialog (std::string text, std::string name);
75         bool open_prompt_dialog (std::string text);
76
77         // Data
78         HandlerList        handlers;
79         XMLTree            tree;
80
81         // GUI
82         Gtk::Frame                    file_frame;
83         Gtk::HBox                     file_hbox;
84         Gtk::Entry                    file_entry;
85         Gtk::Button                   file_browse_button;
86
87         struct SessionBrowserColumns : public Gtk::TreeModel::ColumnRecord
88         {
89         public:
90                 Gtk::TreeModelColumn<std::string>    name;
91                 Gtk::TreeModelColumn<bool>           queued;
92                 Gtk::TreeModelColumn<ElementPtr>     element;
93                 Gtk::TreeModelColumn<std::string>    info;
94
95                 SessionBrowserColumns() { add (name); add (queued); add (element); add (info); }
96         };
97
98         SessionBrowserColumns         sb_cols;
99         Glib::RefPtr<Gtk::TreeStore>  session_tree;
100         Gtk::TreeView                 session_browser;
101         Gtk::ScrolledWindow           session_scroll;
102
103         Gtk::Button*                  ok_button;
104         Gtk::Button*                  cancel_button;
105
106         PBD::ScopedConnectionList connections;
107 };
108
109 #endif