projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove unused variable and the accessor methods for it from ARDOUR_UI
[ardour.git]
/
gtk2_ardour
/
automation_line.cc
diff --git
a/gtk2_ardour/automation_line.cc
b/gtk2_ardour/automation_line.cc
index 116a3e63ba02540a51c4fafeef21d0789706b3a1..a72916191173a202609b0e388837dc3b450c006d 100644
(file)
--- a/
gtk2_ardour/automation_line.cc
+++ b/
gtk2_ardour/automation_line.cc
@@
-15,7
+15,6
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
#include <cmath>
*/
#include <cmath>
@@
-25,6
+24,7
@@
#include <pbd/stl_delete.h>
#include <pbd/memento_command.h>
#include <pbd/stl_delete.h>
#include <pbd/memento_command.h>
+#include <pbd/stacktrace.h>
#include <ardour/automation_event.h>
#include <ardour/curve.h>
#include <ardour/automation_event.h>
#include <ardour/curve.h>
@@
-232,6
+232,7
@@
AutomationLine::AutomationLine (const string & name, TimeAxisView& tv, ArdourCan
no_draw = false;
_visible = true;
terminal_points_can_slide = true;
no_draw = false;
_visible = true;
terminal_points_can_slide = true;
+ _y_position = 0;
_height = 0;
group = new ArdourCanvas::Group (parent);
_height = 0;
group = new ArdourCanvas::Group (parent);
@@
-307,17
+308,27
@@
AutomationLine::control_point_box_size ()
}
void
}
void
-AutomationLine::set_
height (
guint32 h)
+AutomationLine::set_
y_position_and_height (guint32 y,
guint32 h)
{
{
+ bool changed = false;
+
+ if (y != _y_position) {
+ _y_position = y;
+ changed = true;
+ }
+
if (h != _height) {
_height = h;
if (h != _height) {
_height = h;
- double bsz = control_point_box_size();
+ double
const
bsz = control_point_box_size();
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->set_size (bsz);
}
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->set_size (bsz);
}
+ changed = true;
+ }
+ if (changed) {
reset ();
}
}
reset ();
}
}
@@
-365,7
+376,7
@@
AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi
y = max (0.0, y);
y = min (1.0, y);
y = max (0.0, y);
y = min (1.0, y);
- y = _height - (y * _height);
+ y = _
y_position + _
height - (y * _height);
if (cp.can_slide) {
if (cp.can_slide) {
@@
-465,8
+476,10
@@
AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi
void
AutomationLine::reset_line_coords (ControlPoint& cp)
{
void
AutomationLine::reset_line_coords (ControlPoint& cp)
{
- line_points[cp.view_index].set_x (cp.get_x());
- line_points[cp.view_index].set_y (cp.get_y());
+ if (cp.view_index < line_points.size()) {
+ line_points[cp.view_index].set_x (cp.get_x());
+ line_points[cp.view_index].set_y (cp.get_y());
+ }
}
void
}
void
@@
-492,7
+505,7
@@
AutomationLine::model_representation (ControlPoint& cp, ModelRepresentation& mr)
*/
mr.xval = (nframes_t) floor (cp.get_x());
*/
mr.xval = (nframes_t) floor (cp.get_x());
- mr.yval = 1.0 - (
cp.get_y(
) / _height);
+ mr.yval = 1.0 - (
(cp.get_y() - _y_position
) / _height);
/* if xval has not changed, set it directly from the model to avoid rounding errors */
/* if xval has not changed, set it directly from the model to avoid rounding errors */
@@
-599,15
+612,11
@@
AutomationLine::determine_visible_control_points (ALPoints& points)
view_index = 0;
view_index = 0;
- ofstream oout ("orig_coordinates");
-
for (model = alist.begin(), pi = 0; pi < npoints; ++model, ++pi) {
double tx = points[pi].x;
double ty = points[pi].y;
for (model = alist.begin(), pi = 0; pi < npoints; ++model, ++pi) {
double tx = points[pi].x;
double ty = points[pi].y;
- oout << tx << ' ' << ty << endl;
-
/* now ensure that the control_points vector reflects the current curve
state, but don't plot control points too close together. also, don't
plot a series of points all with the same value.
/* now ensure that the control_points vector reflects the current curve
state, but don't plot control points too close together. also, don't
plot a series of points all with the same value.
@@
-644,11
+653,10
@@
AutomationLine::determine_visible_control_points (ALPoints& points)
if (view_index && pi != npoints && /* not the first, not the last */
(((this_rx == prev_rx) && (this_ry == prev_ry)) || /* same point */
if (view_index && pi != npoints && /* not the first, not the last */
(((this_rx == prev_rx) && (this_ry == prev_ry)) || /* same point */
- (this_rx == prev_rx) || /* identical x coordinate */
(((this_rx - prev_rx) < (box_size + 2)) && /* not identical, but still too close horizontally */
(((this_rx - prev_rx) < (box_size + 2)) && /* not identical, but still too close horizontally */
- (
(abs ((int)(this_ry - prev_ry)) < (int) (box_size + 2)
))))) { /* too close vertically */
+ (
abs ((int)(this_ry - prev_ry)) < (int) (box_size + 2
))))) { /* too close vertically */
continue;
continue;
- }
+ }
/* ok, we should display this point */
/* ok, we should display this point */
@@
-708,8
+716,6
@@
AutomationLine::determine_visible_control_points (ALPoints& points)
view_index++;
}
view_index++;
}
- oout.close ();
-
/* discard extra CP's to avoid confusing ourselves */
while (control_points.size() > view_index) {
/* discard extra CP's to avoid confusing ourselves */
while (control_points.size() > view_index) {
@@
-836,7
+842,7
@@
AutomationLine::point_drag (ControlPoint& cp, nframes_t x, float fraction, bool
void
AutomationLine::line_drag (uint32_t i1, uint32_t i2, float fraction, bool with_push)
{
void
AutomationLine::line_drag (uint32_t i1, uint32_t i2, float fraction, bool with_push)
{
- double ydelta = fraction - last_drag_fraction;
+ double
const
ydelta = fraction - last_drag_fraction;
did_push = with_push;
did_push = with_push;
@@
-849,7
+855,7
@@
AutomationLine::line_drag (uint32_t i1, uint32_t i2, float fraction, bool with_p
for (uint32_t i = i1 ; i <= i2; i++) {
cp = nth (i);
for (uint32_t 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);
+ modify_view_point (*cp, trackview.editor.unit_to_frame (cp->get_x()), ((_height - cp->get_y()
+ _y_position
) /_height) + ydelta, with_push);
}
if (line_points.size() > 1) {
}
if (line_points.size() > 1) {
@@
-1046,8
+1052,8
@@
AutomationLine::get_selectables (nframes_t& start, nframes_t& end,
/* Curse X11 and its inverted coordinate system! */
/* Curse X11 and its inverted coordinate system! */
- bot = (1.0 - topfrac) * _height;
- top = (1.0 - botfrac) * _height;
+ bot =
_y_position +
(1.0 - topfrac) * _height;
+ top =
_y_position +
(1.0 - botfrac) * _height;
nstart = max_frames;
nend = 0;
nstart = max_frames;
nend = 0;
@@
-1113,8
+1119,8
@@
AutomationLine::set_selected_points (PointSelection& points)
/* Curse X11 and its inverted coordinate system! */
/* Curse X11 and its inverted coordinate system! */
- bot = (1.0 - (*r).high_fract) * _height;
- top = (1.0 - (*r).low_fract) * _height;
+ bot =
_y_position +
(1.0 - (*r).high_fract) * _height;
+ top =
_y_position +
(1.0 - (*r).low_fract) * _height;
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
@@
-1141,6
+1147,13
@@
AutomationLine::set_selected_points (PointSelection& points)
}
}
+void AutomationLine::set_colors() {
+ set_line_color( color_map[cAutomationLine] );
+ for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
+ (*i)->show_color (false, !points_visible);
+ }
+}
+
void
AutomationLine::show_selection ()
{
void
AutomationLine::show_selection ()
{
@@
-1201,7
+1214,7
@@
AutomationLine::reset_callback (const AutomationList& events)
model_to_view_y (translated_y);
tmp_points.push_back (ALPoint (trackview.editor.frame_to_unit ((*ai)->when),
model_to_view_y (translated_y);
tmp_points.push_back (ALPoint (trackview.editor.frame_to_unit ((*ai)->when),
- _height - (translated_y * _height)));
+ _
y_position + _
height - (translated_y * _height)));
}
determine_visible_control_points (tmp_points);
}
determine_visible_control_points (tmp_points);