2 * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
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.
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.
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.
19 #ifndef __gtk_ardour_port_matrix_grid_h__
20 #define __gtk_ardour_port_matrix_grid_h__
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"
37 /** The grid part of the port matrix */
38 class PortMatrixGrid : public PortMatrixComponent
41 PortMatrixGrid (PortMatrix *, PortMatrixBody *);
43 void button_press (double, double, GdkEventButton *);
44 void button_release (double, double, GdkEventButton *);
45 void motion (double, double);
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 *);
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);
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;