First commit on FFT analysis window. Still some functionality missing,
[ardour.git] / gtk2_ardour / analysis_window.h
1 /*
2     Copyright (C) 2006 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
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
35 #include <gtkmm2ext/dndtreeview.h>
36
37 #include <pbd/lockmonitor.h>
38
39
40 #include "ardour_dialog.h"
41 #include "fft_graph.h"
42 #include "fft_result.h"
43
44
45 class AnalysisWindow : public ArdourDialog
46 {
47   public:
48           AnalysisWindow  ();
49           ~AnalysisWindow ();
50
51           void set_rangemode();
52           void set_regionmode();
53           
54           void track_list_row_changed(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter);
55
56
57   private:
58           
59           void clear_tracklist();
60
61           void source_selection_changed (Gtk::RadioButton *);
62           void display_model_changed    (Gtk::RadioButton *);
63
64           void analyze_data                             (Gtk::Button *);
65           
66           struct TrackListColumns : public Gtk::TreeModel::ColumnRecord {
67                   public:
68                   TrackListColumns () {
69                                 add (trackname);
70                                 add (visible);
71                                 add (color);
72                                 add (graph);
73                   }
74                   Gtk::TreeModelColumn<std::string> trackname;
75                   Gtk::TreeModelColumn<bool>        visible;
76           Gtk::TreeModelColumn<Gdk::Color>  color;
77                   Gtk::TreeModelColumn<FFTResult *>  graph;
78           };
79
80           // Packing essentials
81           Gtk::HBox hbox;
82           Gtk::VBox vbox;
83           
84           // Left  side
85           Glib::RefPtr<Gtk::ListStore> tlmodel;
86           TrackListColumns tlcols;
87           Gtk::TreeView track_list;
88           
89           Gtk::Label source_selection_label;
90           
91           Gtk::RadioButton source_selection_ranges_rb;
92           Gtk::RadioButton source_selection_regions_rb;
93
94           Gtk::HSeparator hseparator1;
95           
96           Gtk::Label display_model_label;
97           Gtk::RadioButton display_model_composite_separate_rb;
98           Gtk::RadioButton display_model_composite_all_tracks_rb;
99           
100           Gtk::HSeparator hseparator2;
101
102           Gtk::Button refresh_button;
103           
104           // The graph
105           FFTGraph fft_graph;
106
107           bool track_list_ready;
108           PBD::Lock track_list_lock;
109
110           friend class FFTGraph;
111 };
112
113 #endif // __ardour_analysis_window_h
114