2 Copyright (C) 2006 Paul Davis
3 Author: Sampo Savoleinen
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.
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.
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.
21 #ifndef __ardour_fft_graph_h
22 #define __ardour_fft_graph_h
24 #include "ardour/types.h"
27 #include <gtkmm/drawingarea.h>
28 #include <gtkmm/treemodel.h>
29 #include <gdkmm/color.h>
31 #include <glibmm/refptr.h>
35 #include "fft_result.h"
39 class FFTGraph : public Gtk::DrawingArea
43 FFTGraph (int windowSize);
46 void set_analysis_window (AnalysisWindow *a_window);
48 int windowSize () const { return _windowSize; }
49 void setWindowSize (int windowSize);
52 bool on_expose_event (GdkEventExpose* event);
53 bool on_motion_notify_event (GdkEventMotion*);
54 bool on_leave_notify_event (GdkEventCrossing*);
55 bool on_button_press_event (GdkEventButton*) { return true; }
57 void on_size_request (Gtk::Requisition* requisition);
58 void on_size_allocate (Gtk::Allocation & alloc);
59 FFTResult *prepareResult (Gdk::Color color, std::string trackname);
61 void set_show_minmax (bool v) { _show_minmax = v; redraw (); }
62 void set_show_normalized (bool v) { _show_normalized = v; redraw (); }
63 void set_show_proportioanl(bool v) { _show_proportional = v; redraw (); }
69 void setWindowSize_internal (int windowSize);
71 int draw_scales (cairo_t*);
73 static const int minScaleWidth = 512;
74 static const int minScaleHeight = 420;
76 static const int hl_margin = 40; // this should scale with font (dBFS labels)
77 static const int hr_margin = 12;
78 static const int v_margin = 12;
80 int currentScaleWidth;
88 cairo_rectangle_t _ann_area;
90 unsigned int _windowSize;
91 unsigned int _dataSize;
93 Glib::RefPtr<Pango::Layout> layout;
94 cairo_surface_t* _surface;
96 AnalysisWindow *_a_window;
106 bool _show_normalized;
107 bool _show_proportional;
113 friend class FFTResult;
116 #endif /* __ardour_fft_graph_h */