Fix formatting samplecnt_t (aka int64_t aka long long int)
[ardour.git] / gtk2_ardour / port_matrix_grid.h
1 /*
2  * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
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 along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19 #ifndef  __gtk_ardour_port_matrix_grid_h__
20 #define  __gtk_ardour_port_matrix_grid_h__
21
22 #include <string>
23 #include <vector>
24 #include <boost/shared_ptr.hpp>
25 #include "ardour/types.h"
26 #include "port_matrix_component.h"
27 #include "port_matrix_types.h"
28 #include "port_group.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, GdkEventButton *);
44         void button_release (double, double, GdkEventButton *);
45         void motion (double, double);
46
47         double component_to_parent_x (double x) const;
48         double parent_to_component_x (double x) const;
49         double component_to_parent_y (double y) const;
50         double parent_to_component_y (double y) const;
51         void mouseover_changed (std::list<PortMatrixNode> const &);
52         void draw_extra (cairo_t *);
53
54 private:
55
56         void compute_dimensions ();
57         void render (cairo_t *);
58         void render_group_pair (cairo_t *, boost::shared_ptr<const PortGroup>, boost::shared_ptr<const PortGroup>, uint32_t, uint32_t);
59
60         PortMatrixNode position_to_node (double, double) const;
61         void queue_draw_for (std::list<PortMatrixNode> const &);
62         void draw_association_indicator (cairo_t *, uint32_t, uint32_t, double p = 1);
63         void draw_empty_square (cairo_t *, uint32_t, uint32_t);
64         void draw_non_connectable_indicator (cairo_t *, uint32_t, uint32_t);
65         std::list<PortMatrixNode> nodes_on_line (int, int, int, int) const;
66         void set_association (PortMatrixNode, bool);
67         bool toggle_state (PortMatrixNode::State) const;
68
69         bool _dragging;
70         bool _drag_valid;
71         bool _moved;
72         int _drag_start_x;
73         int _drag_start_y;
74         int _drag_x;
75         int _drag_y;
76 };
77
78 #endif