allow zero-input (i.e. tone generator) processors to be added
[ardour2.git] / gtk2_ardour / port_matrix_grid.h
blobec7eb32b4bee90d4b571fd8559ee0d10468a4a00
1 /*
2 Copyright (C) 2002-2009 Paul Davis
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
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __gtk_ardour_port_matrix_grid_h__
21 #define __gtk_ardour_port_matrix_grid_h__
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 #include "port_group.h"
31 class PortMatrix;
32 class PortMatrixBody;
34 namespace ARDOUR {
35 class Bundle;
38 /** The grid part of the port matrix */
39 class PortMatrixGrid : public PortMatrixComponent
41 public:
42 PortMatrixGrid (PortMatrix *, PortMatrixBody *);
44 void button_press (double, double, int, uint32_t, guint);
45 void button_release (double, double, int, uint32_t, guint);
46 void motion (double, double);
48 double component_to_parent_x (double x) const;
49 double parent_to_component_x (double x) const;
50 double component_to_parent_y (double y) const;
51 double parent_to_component_y (double y) const;
52 void mouseover_changed (std::list<PortMatrixNode> const &);
53 void draw_extra (cairo_t *);
55 private:
57 void compute_dimensions ();
58 void render (cairo_t *);
59 void render_group_pair (cairo_t *, boost::shared_ptr<const PortGroup>, boost::shared_ptr<const PortGroup>, uint32_t, uint32_t);
61 PortMatrixNode position_to_node (double, double) const;
62 void queue_draw_for (std::list<PortMatrixNode> const &);
63 void draw_association_indicator (cairo_t *, uint32_t, uint32_t, double p = 1);
64 void draw_empty_square (cairo_t *, uint32_t, uint32_t);
65 void draw_non_connectable_indicator (cairo_t *, uint32_t, uint32_t);
66 std::list<PortMatrixNode> nodes_on_line (int, int, int, int) const;
67 void set_association (PortMatrixNode, bool);
68 bool toggle_state (PortMatrixNode::State) const;
70 bool _dragging;
71 bool _drag_valid;
72 bool _moved;
73 int _drag_start_x;
74 int _drag_start_y;
75 int _drag_x;
76 int _drag_y;
79 #endif