[ardour-dev] another automation patch (this time with the one line I forgot)

gerard van dongen gml at xs4all.nl
Fri Jul 16 15:28:37 PDT 2004


aargh, again

This one (hopefully) fixes bugs with line-dragging
(against current CVS btw)

cheers
Gerard



Index: gtk_ardour/automation_line.h
===================================================================
RCS file: /home/las/cvsroot/ardour/ardour/gtk_ardour/automation_line.h,v
retrieving revision 1.29
diff -u -r1.29 automation_line.h
--- gtk_ardour/automation_line.h        19 Jun 2004 13:36:10 -0000
1.29
+++ gtk_ardour/automation_line.h        16 Jul 2004 21:12:52 -0000
@@ -176,7 +176,7 @@
          void determine_visible_control_points (GtkCanvasPoints*);
          void sync_model_from (ControlPoint&);
          void sync_model_with_view_point (ControlPoint&);
-       void sync_model_with_view_line (ControlPoint&, ControlPoint&);
+       void sync_model_with_view_line (unsigned long, unsigned long);
          void modify_view (ControlPoint&, double, double, bool with_push);

          virtual void change_model (ARDOUR::AutomationList::iterator,
double x, double y);


Index: gtk_ardour/automation_line.cc
===================================================================
RCS file: /home/las/cvsroot/ardour/ardour/gtk_ardour/automation_line.cc,v
retrieving revision 1.59
diff -u -r1.59 automation_line.cc
--- gtk_ardour/automation_line.cc       9 Jul 2004 16:24:40 -0000
1.59
+++ gtk_ardour/automation_line.cc       16 Jul 2004 21:13:45 -0000
@@ -485,30 +485,17 @@
   }

   void
-AutomationLine::sync_model_with_view_line (ControlPoint& start,
ControlPoint& end)
+AutomationLine::sync_model_with_view_line (unsigned long start, unsigned
long end)
   {
-       double delta;
-       double first;
-       double last;
-
-       first = first_drag_fraction;
-       last = last_drag_fraction;
-
-       /* convert the visual position of the start and end of drag into
-          model coordinates.
-       */
-
-       view_to_model_y (first);
-       view_to_model_y (last);
-
-       /* how far did we move ? */
-
-       delta = last - first;

-       /* change all model points in the range by that amount */
+       ControlPoint *p;

         update_pending = true;
-       change_model_range (start.model, end.model, 0, delta);
+       for (unsigned long i = start; i <= end; ++i) {
+               p = nth(i);
+               sync_model_with_view_point(*p);
+       }
+
+
   }

   void
@@ -590,7 +577,7 @@

          update_pending = true;

-       while (!p->can_slide && p != &cp && lasti) {
+       while (p != &cp && lasti) {
                  sync_model_with_view_point (*p);
                  --lasti;
                  p = nth (lasti);
@@ -921,12 +908,11 @@

          ControlPoint *cp;

-       cp = nth (i1);
-       modify_view_point (*cp, trackview.editor.unit_to_frame
(cp->get_x()), ((_height - cp->get_y()) /_height) + ydelta, with_push);
+       for (unsigned long i = i1 ; i <= i2; i++) {
+               cp = nth (i);
+               modify_view_point (*cp, trackview.editor.unit_to_frame
(cp->get_x()), ((_height - cp->get_y()) /_height) + ydelta, with_push);
+       }

-       cp = nth (i2);
-       modify_view_point (*cp, trackview.editor.unit_to_frame
(cp->get_x()), ((_height - cp->get_y()) / _height) + ydelta, with_push);
-
          update_line ();

          drags++;
@@ -940,7 +926,7 @@
                  if (cp) {
                          sync_model_from (*cp);
                  } else {
-                       sync_model_with_view_line
(*control_points[line_drag_cp1], *control_points[line_drag_cp2]);
+                       sync_model_with_view_line (line_drag_cp1,
line_drag_cp2);
                  }

                  update_pending = false;



More information about the Ardour-Dev mailing list