First cut at mouseovers for the port matrix.

git-svn-id: svn://localhost/ardour2/branches/3.0@4446 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-01-27 04:21:13 +00:00
parent 7e1b86acee
commit 9cc7b452eb
14 changed files with 742 additions and 203 deletions

View file

@ -23,6 +23,7 @@
#include <gtkmm/eventbox.h>
class PortMatrixBody;
class PortMatrixNode;
/** One component of the PortMatrix. This is a cairo-rendered
* Pixmap.
@ -33,6 +34,13 @@ public:
PortMatrixComponent (PortMatrixBody *);
virtual ~PortMatrixComponent ();
virtual double component_to_parent_x (double x) const = 0;
virtual double parent_to_component_x (double x) const = 0;
virtual double component_to_parent_y (double y) const = 0;
virtual double parent_to_component_y (double y) const = 0;
virtual void mouseover_changed (PortMatrixNode const &) = 0;
virtual void draw_extra (cairo_t *) = 0;
void setup ();
GdkPixmap* get_pixmap (GdkDrawable *);
std::pair<uint32_t, uint32_t> dimensions ();
@ -46,6 +54,14 @@ public:
_render_required = true;
}
void set_parent_rectangle (Gdk::Rectangle const & r) {
_parent_rectangle = r;
}
Gdk::Rectangle parent_rectangle () const {
return _parent_rectangle;
}
/** @return width of columns in the grid */
static uint32_t column_width () {
return 32;
@ -83,6 +99,10 @@ protected:
return 8;
}
static uint32_t mouseover_line_width () {
return 4;
}
/** @return angle of column labels, in radians */
static double angle () {
return M_PI / 4;
@ -115,6 +135,16 @@ protected:
return Gdk::Color ("#cccccc");
}
/** @return colour to paint mouseover lines */
static Gdk::Color mouseover_line_colour () {
return Gdk::Color ("#ff0000");
}
/** @return colour to paint mouseover lines */
static Gdk::Color mouseover_port_colour () {
return Gdk::Color ("#777777");
}
/* XXX */
static Gdk::Color get_a_bundle_colour (int x) {
if ((x % 2) == 0) {
@ -147,6 +177,7 @@ protected:
PortMatrixBody* _body; ///< the PortMatrixBody that we're in
uint32_t _width; ///< full width of the contents
uint32_t _height; ///< full height of the contents
Gdk::Rectangle _parent_rectangle;
private:
GdkPixmap* _pixmap; ///< pixmap