new files from sakari, missed last time
[ardour.git] / gtk2_ardour / export_multiplicator.h
1 /* This file is not used at the moment. It includes code related to export a
2  * multiplication graph system that can be used together with the code in
3  * libs/ardour/export_multiplication.cc and libs/ardour/ardour/export_multiplication.h
4  * - Sakari Bergen 6.8.2008 -
5  */
6
7 /*
8     Copyright (C) 2008 Paul Davis
9     Author: Sakari Bergen
10
11     This program is free software; you can redistribute it and/or modify
12     it under the terms of the GNU General Public License as published by
13     the Free Software Foundation; either version 2 of the License, or
14     (at your option) any later version.
15
16     This program is distributed in the hope that it will be useful,
17     but WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19     GNU General Public License for more details.
20
21     You should have received a copy of the GNU General Public License
22     along with this program; if not, write to the Free Software
23     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
25 */
26
27 #ifndef __export_multiplicator_h__
28 #define __export_multiplicator_h__
29
30 #include <utility>
31 #include <map>
32
33 #include <ardour/export_profile_manager.h>
34
35 #include <gtkmm.h>
36 #include <boost/shared_ptr.hpp>
37
38 using std::list;
39 using ARDOUR::ExportProfileManager;
40
41 class ExportMultiplicator : public Gtk::EventBox {
42   public:
43
44         ExportMultiplicator ();
45         ~ExportMultiplicator ();
46         
47         void set_manager (boost::shared_ptr<ExportProfileManager> _manager);
48
49   private:
50
51         boost::shared_ptr<ExportProfileManager>  manager;
52         ExportProfileManager::MultiplicationGraph const * graph;
53
54         /* Drawing stuff */
55
56         Gtk::Table table;
57
58         void redraw ();
59         
60         enum GraphLevel {
61                 NoLevel = 0,
62                 Timespans = 1,
63                 ChannelConfigs = 2,
64                 Formats = 3,
65                 Filenames = 4
66         };
67         
68         std::pair<uint32_t, uint32_t> get_bounds (ExportProfileManager::GraphNode * node, GraphLevel current_level, GraphLevel max_level) const;
69         
70         void draw_timespan (ExportProfileManager::TimespanNodePtr node, std::pair<uint32_t, uint32_t> bounds);
71         void draw_channel_config (ExportProfileManager::ChannelConfigNodePtr node, std::pair<uint32_t, uint32_t> bounds);
72         void draw_format (ExportProfileManager::FormatNodePtr node, std::pair<uint32_t, uint32_t> bounds);
73         void draw_filename (ExportProfileManager::FilenameNodePtr node, std::pair<uint32_t, uint32_t> bounds);
74
75         struct TablePosition {
76                 uint32_t left;
77                 uint32_t right;
78                 uint32_t row;
79                 
80                 TablePosition (uint32_t left, uint32_t right, uint32_t row) :
81                   left (left), right (right), row (row) {}
82                 
83                 bool operator== (TablePosition const & other) const { return (row == other.row && left == other.left && right == other.right); }
84                 bool operator< (TablePosition const & other) const { return (row < other.row || left < other.left || right < other.right); }
85         };
86         
87         typedef std::map<TablePosition, boost::shared_ptr<Gtk::HBox> > WidgetMap;
88         typedef std::pair<TablePosition, boost::shared_ptr<Gtk::HBox> > WidgetPair;
89         
90         boost::shared_ptr<Gtk::HBox> get_hbox (TablePosition position);
91         WidgetMap widget_map;
92         
93         /* Button Widget */
94         
95         class ButtonWidget : public Gtk::EventBox {
96           public:
97                 ButtonWidget (Glib::ustring name, boost::shared_ptr<ExportProfileManager> m, ExportProfileManager::GraphNode * node);
98         
99           private:
100         
101                 Gtk::Label label;
102                 Gtk::VBox  vbox;
103         
104                 bool on_button_press_event (GdkEventButton* event);
105                 
106                 void split ();
107                 void remove ();
108                 
109                 boost::shared_ptr<ExportProfileManager> manager;
110                 ExportProfileManager::GraphNode * node;
111                 float split_position;
112                 
113                 /* Context menu */
114         
115                 Glib::RefPtr<Gtk::ActionGroup> menu_actions;
116                 Glib::RefPtr<Gtk::UIManager>   ui_manager;
117                 Gtk::Menu *                    menu;
118         };
119 };
120
121 #endif /* __export_multiplicator_h__ */