First cut at mouseovers for the port matrix.
[ardour.git] / gtk2_ardour / port_matrix_grid.h
1 /*
2     Copyright (C) 2002-2009 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  __gtk_ardour_port_matrix_grid_h__ 
21 #define  __gtk_ardour_port_matrix_grid_h__ 
22
23 #include <string>
24 #include <vector>
25 #include <boost/shared_ptr.hpp>
26 #include "ardour/types.h"
27 #include "port_matrix_component.h"
28 #include "port_matrix_types.h"
29
30 class PortMatrix;
31 class PortMatrixBody;
32
33 namespace ARDOUR {
34         class Bundle;
35 }
36
37 /// The grid part of the port matrix
38 class PortMatrixGrid : public PortMatrixComponent
39 {
40 public:
41         PortMatrixGrid (PortMatrix *, PortMatrixBody *);
42
43         void button_press (double, double, int);
44         void mouseover_event (double, double);
45
46         double component_to_parent_x (double x) const;
47         double parent_to_component_x (double x) const;
48         double component_to_parent_y (double y) const;
49         double parent_to_component_y (double y) const;
50         void mouseover_changed (PortMatrixNode const &);
51         void draw_extra (cairo_t *);
52
53 private:
54         
55         void compute_dimensions ();
56         void render (cairo_t *);
57
58         double channel_position (PortMatrixBundleChannel, ARDOUR::BundleList const &, double) const;
59         PortMatrixNode position_to_node (double, double) const;
60         PortMatrixBundleChannel position_to_channel (double, ARDOUR::BundleList const &, double) const;
61         void queue_draw_for (PortMatrixNode const &);
62
63         PortMatrix* _port_matrix;
64 };
65
66 #endif