Added dialog to allow adding any Midi CC track.
[ardour.git] / gtk2_ardour / automation_time_axis.cc
index 0da3a38fdc64ffbb9790e750ba38d50239ddfbdb..04ac1ee0763835d54c0c2415b29bb49073d7df8f 100644 (file)
@@ -1,3 +1,22 @@
+/*
+    Copyright (C) 2000-2007 Paul Davis 
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
 #include <ardour/route.h>
 #include <pbd/memento_command.h>
 
@@ -54,12 +73,12 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
        base_rect = new SimpleRect(*canvas_display);
        base_rect->property_x1() = 0.0;
        base_rect->property_y1() = 0.0;
-       base_rect->property_x2() = max_frames;
-       base_rect->property_outline_color_rgba() = color_map[cAutomationTrackOutline];
+       base_rect->property_x2() = editor.frame_to_pixel (max_frames);
+       base_rect->property_outline_color_rgba() = Config->canvasvar_AutomationTrackOutline.get();
        /* outline ends and bottom */
        base_rect->property_outline_what() = (guint32) (0x1|0x2|0x8);
-       base_rect->property_fill_color_rgba() = color_map[cAutomationTrackFill];
-       //base_rect->property_fill_color_rgba() = color_map[cEnteredControlPoint];
+       base_rect->property_fill_color_rgba() = Config->canvasvar_AutomationTrackFill.get();
+       //base_rect->property_fill_color_rgba() = Config->canvasvar_EnteredControlPoint.get();
        
        base_rect->set_data ("trackview", this);
 
@@ -163,7 +182,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
        /* make sure labels etc. are correct */
 
        automation_state_changed ();
-       ColorChanged.connect (mem_fun (*this, &AutomationTimeAxisView::color_handler));
+       ColorsChanged.connect (mem_fun (*this, &AutomationTimeAxisView::color_handler));
 }
 
 AutomationTimeAxisView::~AutomationTimeAxisView ()
@@ -294,7 +313,7 @@ AutomationTimeAxisView::set_height (TrackHeight ht)
        base_rect->property_y2() = h;
 
        for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) {
-               (*i)->set_height (h);
+               (*i)->set_y_position_and_height (0, h);
        }
 
        for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
@@ -752,7 +771,7 @@ AutomationTimeAxisView::add_line (AutomationLine& line)
        }
 
        lines.push_back (&line);
-       line.set_height (height);
+       line.set_y_position_and_height (0, height);
 
        if (get) {
                /* pick up the current state */
@@ -802,24 +821,19 @@ AutomationTimeAxisView::set_colors () {
 }
 
 void
-AutomationTimeAxisView::color_handler (ColorID id, uint32_t val) {
+AutomationTimeAxisView::color_handler () 
+{
     
-       switch (id) {
-       case cGhostTrackWave:
-       case cGhostTrackWaveClip:
-       case cGhostTrackZeroLine:
-
-       case cControlPoint:
-       case cControlPointFill:
-       case cControlPointOutline:
-       case cAutomationLine:
-               set_colors ();
+       //case cGhostTrackWave:
+       //case cGhostTrackWaveClip:
+       //case cGhostTrackZeroLine:
 
-               break;
+       //case cControlPoint:
+       //case cControlPointFill:
+       //case cControlPointOutline:
+       //case cAutomationLine:
+       set_colors ();
 
-       default: 
-               break;
-       }
 }