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_body_h__
21 #define __gtk_ardour_port_matrix_body_h__
23 #include <gtkmm/eventbox.h>
24 #include "port_group.h"
25 #include "port_matrix_types.h"
28 class PortMatrixColumnLabels;
29 class PortMatrixRowLabels;
32 /** The main body of the port matrix. It is made up of three parts:
33 * column labels, grid and row labels, each drawn using cairo.
35 class PortMatrixBody : public Gtk::EventBox
38 PortMatrixBody (PortMatrix *);
43 uint32_t full_scroll_width ();
44 uint32_t alloc_scroll_width ();
45 uint32_t full_scroll_height ();
46 uint32_t alloc_scroll_height ();
48 uint32_t xoffset () const {
51 void set_xoffset (uint32_t);
52 uint32_t yoffset () const {
55 void set_yoffset (uint32_t);
57 void rebuild_and_draw_grid ();
59 void set_mouseover (PortMatrixNode const &);
60 PortMatrixNode mouseover () const {
64 void highlight_associated_channels (int, uint32_t);
65 void component_size_changed ();
68 bool on_expose_event (GdkEventExpose *);
69 void on_size_request (Gtk::Requisition *);
70 void on_size_allocate (Gtk::Allocation &);
71 bool on_button_press_event (GdkEventButton *);
72 bool on_button_release_event (GdkEventButton *);
73 bool on_leave_notify_event (GdkEventCrossing *);
74 bool on_motion_notify_event (GdkEventMotion *);
77 void compute_rectangles ();
78 void rebuild_and_draw_column_labels ();
79 void rebuild_and_draw_row_labels ();
80 void update_bundles ();
81 void set_cairo_clip (cairo_t *, Gdk::Rectangle const &) const;
84 PortMatrixColumnLabels* _column_labels;
85 PortMatrixRowLabels* _row_labels;
86 PortMatrixGrid* _grid;
88 uint32_t _alloc_width; ///< allocated width
89 uint32_t _alloc_height; ///< allocated height
90 Gdk::Rectangle _column_labels_rect;
91 Gdk::Rectangle _row_labels_rect;
92 Gdk::Rectangle _grid_rect;
96 PortMatrixNode _mouseover;
97 bool _mouse_over_grid;
99 std::list<sigc::connection> _bundle_connections;