Reenable the correct sort column and type when redisplaying regions
[ardour.git] / gtk2_ardour / analysis_window.h
1 /*
2  * Copyright (C) 2006 Sampo Savolainen <v2@iki.fi>
3  * Copyright (C) 2008-2012 Paul Davis <paul@linuxaudiosystems.com>
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 along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19
20 #ifndef __ardour_analysis_window_h__
21 #define __ardour_analysis_window_h__
22
23 #include <glibmm.h>
24 #include <glibmm/refptr.h>
25
26 #include <gtkmm/radiobutton.h>
27 #include <gtkmm/dialog.h>
28 #include <gtkmm/layout.h>
29 #include <gtkmm/treeview.h>
30 #include <gtkmm/notebook.h>
31 #include <gtkmm/label.h>
32 #include <gtkmm/liststore.h>
33 #include <gtkmm/separator.h>
34 #include <gtkmm/window.h>
35
36 #include <gtkmm2ext/dndtreeview.h>
37
38 #include <glibmm/threads.h>
39
40 #include "ardour/session_handle.h"
41
42 #include "fft_graph.h"
43 #include "fft_result.h"
44
45 namespace ARDOUR {
46         class Session;
47 }
48
49 class AnalysisWindow : public Gtk::Window, public ARDOUR::SessionHandlePtr
50 {
51 public:
52         AnalysisWindow  ();
53         ~AnalysisWindow ();
54
55         void set_rangemode();
56         void set_regionmode();
57
58         void track_list_row_changed(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter);
59
60         void analyze ();
61
62 private:
63         void clear_tracklist();
64
65         void source_selection_changed (Gtk::RadioButton *);
66         void display_model_changed    (Gtk::RadioButton *);
67
68         void show_minmax_changed ();
69         void show_normalized_changed ();
70         void show_proportional_changed ();
71
72         void analyze_data (Gtk::Button *);
73
74         struct TrackListColumns : public Gtk::TreeModel::ColumnRecord {
75                 public:
76                         TrackListColumns () {
77                                 add (trackname);
78                                 add (visible);
79                                 add (color);
80                                 add (graph);
81                         }
82                         Gtk::TreeModelColumn<std::string> trackname;
83                         Gtk::TreeModelColumn<bool>        visible;
84                         Gtk::TreeModelColumn<Gdk::Color>  color;
85                         Gtk::TreeModelColumn<FFTResult *>  graph;
86         };
87
88         // Packing essentials
89         Gtk::HBox hbox;
90         Gtk::VBox vbox;
91
92         // Left  side
93         Glib::RefPtr<Gtk::ListStore> tlmodel;
94         TrackListColumns tlcols;
95         Gtk::TreeView track_list;
96
97         Gtk::Label source_selection_label;
98
99         Gtk::RadioButton source_selection_ranges_rb;
100         Gtk::RadioButton source_selection_regions_rb;
101
102         Gtk::HSeparator hseparator1;
103
104         Gtk::Button refresh_button;
105
106         Gtk::CheckButton show_minmax_button;
107         Gtk::CheckButton show_normalized_button;
108         Gtk::CheckButton show_proportional_button;
109
110         // The graph
111         FFTGraph fft_graph;
112
113         bool track_list_ready;
114         Glib::Threads::Mutex track_list_lock;
115
116         friend class FFTGraph;
117 };
118
119 #endif // __ardour_analysis_window_h
120