Ardour  9.0-pre0-582-g084a23a80d
port_matrix_grid.h
Go to the documentation of this file.
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 #pragma once
20 
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
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 
35 {
36 public:
38 
39  void button_press (double, double, GdkEventButton *);
40  void button_release (double, double, GdkEventButton *);
41  void motion (double, double);
42 
43  double component_to_parent_x (double x) const;
44  double parent_to_component_x (double x) const;
45  double component_to_parent_y (double y) const;
46  double parent_to_component_y (double y) const;
47  void mouseover_changed (std::list<PortMatrixNode> const &);
48  void draw_extra (cairo_t *);
49 
50 private:
51 
53  void render (cairo_t *);
54  void render_group_pair (cairo_t *, std::shared_ptr<const PortGroup>, std::shared_ptr<const PortGroup>, uint32_t, uint32_t);
55 
56  PortMatrixNode position_to_node (double, double) const;
57  void queue_draw_for (std::list<PortMatrixNode> const &);
58  void draw_association_indicator (cairo_t *, uint32_t, uint32_t, double p = 1);
59  void draw_empty_square (cairo_t *, uint32_t, uint32_t);
60  void draw_non_connectable_indicator (cairo_t *, uint32_t, uint32_t);
61  std::list<PortMatrixNode> nodes_on_line (int, int, int, int) const;
64 
65  bool _dragging;
67  bool _moved;
70  int _drag_x;
71  int _drag_y;
72 };
73 
double component_to_parent_y(double y) const
void motion(double, double)
std::list< PortMatrixNode > nodes_on_line(int, int, int, int) const
void button_press(double, double, GdkEventButton *)
void draw_extra(cairo_t *)
void button_release(double, double, GdkEventButton *)
double parent_to_component_x(double x) const
double parent_to_component_y(double y) const
bool toggle_state(PortMatrixNode::State) const
void draw_empty_square(cairo_t *, uint32_t, uint32_t)
void mouseover_changed(std::list< PortMatrixNode > const &)
void render_group_pair(cairo_t *, std::shared_ptr< const PortGroup >, std::shared_ptr< const PortGroup >, uint32_t, uint32_t)
double component_to_parent_x(double x) const
void set_association(PortMatrixNode, bool)
void queue_draw_for(std::list< PortMatrixNode > const &)
void compute_dimensions()
PortMatrixGrid(PortMatrix *, PortMatrixBody *)
void render(cairo_t *)
void draw_non_connectable_indicator(cairo_t *, uint32_t, uint32_t)
void draw_association_indicator(cairo_t *, uint32_t, uint32_t, double p=1)
PortMatrixNode position_to_node(double, double) const