Clean up checks.
[ardour.git] / gtk2_ardour / port_matrix_component.h
index a041c807e86b2e27cf443b7a33d0dda6f874a902..9eb2c566a5e56406c45868c96acd22d916aabd1c 100644 (file)
@@ -22,7 +22,9 @@
 
 #include <gtkmm/eventbox.h>
 
+class PortMatrix;
 class PortMatrixBody;
+class PortMatrixNode;
 
 /** One component of the PortMatrix.  This is a cairo-rendered
  *  Pixmap.
@@ -30,15 +32,36 @@ class PortMatrixBody;
 class PortMatrixComponent
 {
 public:
-       PortMatrixComponent (PortMatrixBody *);
+       PortMatrixComponent (PortMatrix *, 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 ();
+
        void require_render () {
                _render_required = true;
        }
+       
+       void require_rebuild () {
+               _dimension_computation_required = true;
+               _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 () {
@@ -77,6 +100,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;
@@ -84,26 +111,41 @@ protected:
 
        /* XXX I guess these colours should come from a theme, or something */
 
-       /* @return background colour */
+       /** @return background colour */
        static Gdk::Color background_colour () {
                return Gdk::Color ("#000000");
        }
 
-       /* @return text colour */
+       /** @return text colour */
        static Gdk::Color text_colour () {
                return Gdk::Color ("#ffffff");
        }
 
-       /* @return grid line colour */
+       /** @return grid line colour */
        static Gdk::Color grid_colour () {
                return Gdk::Color ("#333333");
        }
 
-       /* @return colour of association blobs */
+       /** @return colour of association blobs */
        static Gdk::Color association_colour () {
                return Gdk::Color ("#00ff00");
        }
 
+       /** @return colour to paint grid squares when they can't be associated */
+       static Gdk::Color unknown_colour () {
+               return Gdk::Color ("#cccccc");
+       }
+
+       /** @return colour to paint mouseover lines */
+       static Gdk::Color mouseover_line_colour () {
+               return Gdk::Color ("#ff0000");
+       }
+
+       /** @return colour to paint channel highlights */
+       static Gdk::Color highlighted_channel_colour () {
+               return Gdk::Color ("#777777");
+       }
+
        /* XXX */
        static Gdk::Color get_a_bundle_colour (int x) {
                if ((x % 2) == 0) {
@@ -113,8 +155,18 @@ protected:
                }
        }
 
+       /* XXX */
+       static Gdk::Color get_a_group_colour (int x) {
+               if ((x % 2) == 0) {
+                       return Gdk::Color ("#222222");
+               } else {
+                       return Gdk::Color ("#444444");
+               }
+       }
+       
        void set_source_rgb (cairo_t *, Gdk::Color const &);
        void set_source_rgba (cairo_t *, Gdk::Color const &, double);
+       std::pair<std::string, double> display_port_name (cairo_t*, std::string const &, double) const;
 
        /** Render the complete component to a cairo context. */
        virtual void render (cairo_t *) = 0;
@@ -123,9 +175,11 @@ protected:
         */
        virtual void compute_dimensions () = 0;
 
+       PortMatrix* _matrix;
        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