gain_line->reset ();
- set_y_position_and_height (0, trackview.current_height());
+ set_height (trackview.current_height());
region_muted ();
region_sync_changed ();
}
void
-AudioRegionView::set_y_position_and_height (double y, double h)
+AudioRegionView::set_height (gdouble height)
{
- RegionView::set_y_position_and_height (y, h - 1);
+ RegionView::set_height (height);
- /* XXX why is this code here */
+ uint32_t wcnt = waves.size();
- _y_position = y;
- _height = h;
-
- const uint32_t wcnt = waves.size();
+ // FIXME: ick
+ height -= 2;
+ _height = height;
+
for (uint32_t n=0; n < wcnt; ++n) {
gdouble ht;
- if ((h) < NAME_HIGHLIGHT_THRESH) {
- ht = ((_height-2*wcnt) / (double) wcnt);
+ if ((height) < NAME_HIGHLIGHT_THRESH) {
+ ht = ((height-2*wcnt) / (double) wcnt);
} else {
- ht = (((_height-2*wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
+ ht = (((height-2*wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
}
gdouble yoff = n * (ht+1);
}
if (gain_line) {
- if ((_height/wcnt) < NAME_HIGHLIGHT_THRESH) {
+ if ((height/wcnt) < NAME_HIGHLIGHT_THRESH) {
gain_line->hide ();
} else {
if (_flags & EnvelopeVisible) {
gain_line->show ();
}
}
- gain_line->set_y_position_and_height ((uint32_t) _y_position, (uint32_t) rint (_height - NAME_HIGHLIGHT_SIZE));
+ gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE));
}
manage_zero_line ();
boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const;
- void set_y_position_and_height (double, double);
void create_waves ();
+ void set_height (double);
void set_samples_per_unit (double);
void set_amplitude_above_axis (gdouble spp);
xi = tmpx;
}
+
+ /* now fix layering */
- /* Fix canvas layering */
- for (RegionViewList::iterator j = copy.begin(); j != copy.end(); ++j) {
- (*j)->enable_display(true);
- (*j)->set_height (height);
- region_layered (*j);
+ for (RegionViewList::iterator i = copy.begin(); i != copy.end(); ++i) {
+ region_layered (*i);
}
}
}
void
-AudioStreamView::update_contents_y_position_and_height ()
+AudioStreamView::update_contents_height ()
{
- StreamView::update_contents_y_position_and_height ();
+ StreamView::update_contents_height ();
for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) {
if (layer_display == Overlaid) {
(*i)->show ();
- (*i)->set_y_position_and_height (0, height);
+ (*i)->set_height (height);
} else {
(*i)->hide ();
}
void color_handler ();
- void update_contents_y_position_and_height ();
+ void update_contents_height ();
double _amplitude_above_axis;
no_draw = false;
_visible = true;
terminal_points_can_slide = true;
- _y_position = 0;
_height = 0;
group = new ArdourCanvas::Group (parent);
}
void
-AutomationLine::set_y_position_and_height (double y, double h)
+AutomationLine::set_height (guint32 h)
{
- bool changed = false;
-
- if (y != _y_position) {
- _y_position = (guint32) floor (y);
- changed = true;
- }
-
if (h != _height) {
- _height = (guint32) floor (h);
+ _height = h;
- double const bsz = control_point_box_size();
+ double bsz = control_point_box_size();
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->set_size (bsz);
}
- changed = true;
- }
- if (changed) {
reset ();
}
}
y = max (0.0, y);
y = min (1.0, y);
- y = _y_position + _height - (y * _height);
+ y = _height - (y * _height);
if (cp.can_slide()) {
*/
mr.xval = (nframes_t) floor (cp.get_x());
- mr.yval = 1.0 - ( (cp.get_y() - _y_position) / _height);
+ mr.yval = 1.0 - (cp.get_y() / _height);
/* if xval has not changed, set it directly from the model to avoid rounding errors */
}
} else {
view_to_model_y(fraction);
- if (alist->parameter().type() == MidiCCAutomation)
+ if (((ARDOUR::Parameter)alist->parameter()).is_integer())
snprintf (buf, sizeof (buf), "%d", (int)fraction);
else
snprintf (buf, sizeof (buf), "%.2f", fraction);
void
AutomationLine::line_drag (uint32_t i1, uint32_t i2, float fraction, bool with_push)
{
- double const ydelta = fraction - last_drag_fraction;
+ double ydelta = fraction - last_drag_fraction;
did_push = with_push;
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() + _y_position) /_height) + ydelta, with_push);
+ modify_view_point (*cp, trackview.editor.unit_to_frame (cp->get_x()), ((_height - cp->get_y()) /_height) + ydelta, with_push);
}
if (line_points.size() > 1) {
/* Curse X11 and its inverted coordinate system! */
- bot = _y_position + (1.0 - topfrac) * _height;
- top = _y_position + (1.0 - botfrac) * _height;
+ bot = (1.0 - topfrac) * _height;
+ top = (1.0 - botfrac) * _height;
nstart = max_frames;
nend = 0;
/* Curse X11 and its inverted coordinate system! */
- bot = _y_position + (1.0 - (*r).high_fract) * _height;
- top = _y_position + (1.0 - (*r).low_fract) * _height;
+ bot = (1.0 - (*r).high_fract) * _height;
+ top = (1.0 - (*r).low_fract) * _height;
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
double translated_y = (*ai)->value;
model_to_view_y (translated_y);
- tmp_points.push_back (ALPoint (trackview.editor.frame_to_unit ((*ai)->when),
- _y_position + _height - (translated_y * _height)));
+ add_model_point (tmp_points, (*ai)->when, translated_y);
}
determine_visible_control_points (tmp_points);
}
+
+void
+AutomationLine::add_model_point (ALPoints& tmp_points, double frame, double yfract)
+{
+ tmp_points.push_back (ALPoint (trackview.editor.frame_to_unit (frame),
+ _height - (yfract * _height)));
+}
+
void
AutomationLine::reset ()
{
string name() const { return _name; }
bool visible() const { return _visible; }
guint32 height() const { return _height; }
- guint32 y_position() const { return _y_position; }
void set_line_color (uint32_t);
uint32_t get_line_color() const { return _line_color; }
void show ();
void hide ();
- void set_y_position_and_height (double, double);
+ void set_height (guint32);
void set_verbose_cursor_uses_gain_mapping (bool yn);
TimeAxisView& trackview;
protected:
string _name;
- guint32 _y_position;
guint32 _height;
uint32_t _line_color;
boost::shared_ptr<ARDOUR::AutomationList> alist;
void list_changed ();
virtual bool event_handler (GdkEvent*);
+ virtual void add_model_point (ALPoints& tmp_points, double frame, double yfract);
private:
uint32_t drags;
_line->set_colors();
_line->show();
_line->show_all_control_points();
- _line->set_y_position_and_height (trackview.y_position,
- (uint32_t)rint(trackview.current_height() - NAME_HIGHLIGHT_SIZE));
+ _line->set_height ((uint32_t)rint(trackview.current_height() - NAME_HIGHLIGHT_SIZE));
}
bool
view->session().set_dirty ();
}
-void
-AutomationRegionView::set_y_position_and_height (double y, double h)
-{
- cout << "ARV SET Y POSITION AND HEIGHT: " << y << ", " << h << endl;
- RegionView::set_y_position_and_height(y, h - 1);
-
- if (_line)
- _line->set_y_position_and_height (y, h - NAME_HIGHLIGHT_SIZE);
-}
-
void
AutomationRegionView::set_height (double h)
{
- cout << "ARV SET HEIGHT: " << h << endl;
RegionView::set_height(h);
+
if (_line)
- _line->set_y_position_and_height (trackview.y_position - h,
- (uint32_t)rint(h - NAME_HIGHLIGHT_SIZE));
+ _line->set_height ((uint32_t)rint(h - NAME_HIGHLIGHT_SIZE));
}
bool
protected:
void create_line(boost::shared_ptr<ARDOUR::AutomationList> list);
bool set_position(nframes_t pos, void* src, double* ignored);
- void set_y_position_and_height(double y, double h);
void region_resized(ARDOUR::Change what_changed);
bool canvas_event(GdkEvent* ev);
void add_automation_event (GdkEvent* event, nframes_t when, double y);
region_views.erase (i);
} else {
(*i)->enable_display(true);
- (*i)->set_y_position_and_height(0, height);
+ (*i)->set_height(height);
}
i = tmp;
_base_rect->property_y2() = h;
if (_line)
- _line->set_y_position_and_height (0, h);
+ _line->set_height(h);
if (_view) {
_view->set_height(h);
- _view->update_contents_y_position_and_height();
+ _view->update_contents_height();
}
char buf[32];
_line = line;
//_controller = AutomationController::create(_session, line->the_list(), _control);
- line->set_y_position_and_height (0, height);
+ line->set_height (height);
/* pick up the current state */
automation_state_changed ();
fade_out->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeLine.get();
fade_out->property_width_pixels() = 1;
- set_y_position_and_height (0, get_time_axis_view().current_height());
+ set_height (get_time_axis_view().current_height());
/* no frame around the xfade or overlap rects */
}
void
-CrossfadeView::set_y_position_and_height (double y, double h)
+CrossfadeView::set_height (double height)
{
- if (h <= TimeAxisView::hSmaller) {
- TimeAxisViewItem::set_y_position_and_height (y, h - 3);
+ if (height <= TimeAxisView::hSmaller) {
+ TimeAxisViewItem::set_height (height - 3);
} else {
- TimeAxisViewItem::set_y_position_and_height (y, h - NAME_HIGHLIGHT_SIZE - 3 );
+ TimeAxisViewItem::set_height (height - NAME_HIGHLIGHT_SIZE - 3 );
}
redraw_curves ();
AudioRegionView& left_view; // and these too
AudioRegionView& right_view;
- void set_y_position_and_height (double, double);
+ void set_height (double);
bool valid() const { return _valid; }
bool visible() const { return _visible; }
control_point->line().start_drag (control_point, drag_info.grab_frame, 0);
- double fraction = 1.0 - ((control_point->get_y() - control_point->line().y_position()) / (double)control_point->line().height());
+ float fraction = 1.0 - (control_point->get_y() / control_point->line().height());
set_verbose_canvas_cursor (control_point->line().get_verbose_cursor_string (fraction),
drag_info.current_pointer_x + 20, drag_info.current_pointer_y + 20);
cx = max (0.0, cx);
cy = max (0.0, cy);
- cy = min ((double) (cp->line().y_position() + cp->line().height()), cy);
+ cy = min ((double) cp->line().height(), cy);
//translate cx to frames
nframes64_t cx_frames = unit_to_frame (cx);
snap_to (cx_frames);
}
- const double fraction = 1.0 - ((cy - cp->line().y_position()) / (double)cp->line().height());
+ float fraction = 1.0 - (cy / cp->line().height());
bool push;
start_grab (event, fader_cursor);
- const double fraction = 1.0 - ((cy - line->y_position()) / (double)line->height());
+ double fraction = 1.0 - (cy / line->height());
line->start_drag (0, drag_info.grab_frame, fraction);
cy = max (0.0, cy);
cy = min ((double) line->height(), cy);
- const double fraction = 1.0 - ((cy - line->y_position()) / (double)line->height());
+ double fraction = 1.0 - (cy / line->height());
bool push;
tvp2 = trackview_by_y_position (iy1 + y_delta);
temp_rtv = dynamic_cast<RouteTimeAxisView*>(tvp2);
- rv->set_y_position_and_height (0, temp_rtv->current_height());
+ rv->set_height (temp_rtv->current_height());
/* if you un-comment the following, the region colours will follow the track colours whilst dragging,
personally, i think this can confuse things, but never mind.
if (visible) {
tv->set_marked_for_display (true);
- cerr << tv->name() << " will be at " << position << endl;
position += tv->show_at (position, n, &edit_controls_vbox);
} else {
tv->hide ();
compute_colors (basic_color);
- set_y_position_and_height (0, trackview.current_height());
+ set_height (trackview.current_height());
region_muted ();
region_sync_changed ();
}
void
-MidiRegionView::set_y_position_and_height (double y, double h)
+MidiRegionView::set_height (gdouble height)
{
- RegionView::set_y_position_and_height(y, h - 1);
+ RegionView::set_height(height);
+
+ // FIXME: ick
+ height -= 2;
+
+ _height = height;
- /* XXX why is this code here */
-
- _height = h;
-
if (_enable_display) {
_model->read_lock();
inline MidiStreamView* midi_stream_view() const
{ return midi_view()->midi_view(); }
- void set_y_position_and_height (double, double);
+ void set_height (double);
void set_frame_color();
continue;
} else {
(*i)->enable_display(true);
- (*i)->set_y_position_and_height(0, height); // apply note range
+ (*i)->set_height(height); // apply note range
}
/* Sort regionviews by layer so that when we call region_layered ()
/* Fix canvas layering */
for (RegionViewList::iterator j = copy.begin(); j != copy.end(); ++j) {
- (*j)->enable_display(true);
- (*j)->set_height (height);
+ (*j)->enable_display(true); // FIXME: do this?
region_layered (*j);
}
void
-MidiStreamView::update_contents_y_position_and_height ()
+MidiStreamView::update_contents_height ()
{
- StreamView::update_contents_y_position_and_height();
+ StreamView::update_contents_height();
_note_lines->property_y2() = height;
draw_note_lines();
}
list<RegionView *>::iterator i;
for (i = region_views.begin(); i != region_views.end(); ++i) {
- (*i)->set_y_position_and_height(0, height); // apply note range
+ (*i)->set_height(height); // apply note range
}
}
}
if (update_range)
- update_contents_y_position_and_height();
+ update_contents_height();
}
}
void display_region(MidiRegionView* region_view, bool load_model);
void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream> ds);
- void update_contents_y_position_and_height ();
+ void update_contents_height ();
void draw_note_lines();
void color_handler ();
void
RegionView::set_height (double h)
{
+ TimeAxisViewItem::set_height(h);
+
if (sync_line) {
Points points;
int sync_dir;
sync_line->property_points().set_value (points);
}
}
+
}
height = h;
- update_contents_y_position_and_height ();
+ update_contents_height ();
return 0;
}
/* update layers count and the y positions and heights of our regions */
if (ds->playlist()) {
layers = ds->playlist()->top_layer() + 1;
- update_contents_y_position_and_height ();
+ update_contents_height ();
redisplay_diskstream ();
}
}
/* update layers count and the y positions and heights of our regions */
layers = ds->playlist()->top_layer() + 1;
- update_contents_y_position_and_height ();
+ update_contents_height ();
/* draw it */
redisplay_diskstream ();
}
void
-StreamView::update_contents_y_position_and_height ()
+StreamView::update_contents_height ()
{
canvas_rect->property_y2() = height;
for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) {
switch (layer_display) {
case Overlaid:
- (*i)->set_y_position_and_height (0, height);
+ (*i)->set_height (height);
break;
case Stacked:
- double const y = (*i)->region()->layer() * lh;
- (*i)->set_y_position_and_height (y, lh);
+ cout << "FIXME: Stacked regions: set y position" << endl;
+ //double const y = (*i)->region()->layer() * lh;
+ (*i)->set_height (lh);
break;
}
}
StreamView::set_layer_display (LayerDisplay d)
{
layer_display = d;
- update_contents_y_position_and_height ();
+ update_contents_height ();
}
void add_region_view (boost::shared_ptr<ARDOUR::Region>);
void region_layered (RegionView*);
- virtual void update_contents_y_position_and_height ();
+ virtual void update_contents_height ();
virtual void redisplay_diskstream () = 0;
}
/**
- * Set the y position and height of this item.
+ * Set the height of this item
*
- * @param y the new y position
* @param h the new height
*/
void
-TimeAxisViewItem::set_y_position_and_height (double y, double h)
+TimeAxisViewItem::set_height (double height)
{
if (name_highlight) {
- if (h < NAME_HIGHLIGHT_THRESH) {
+ if (height < NAME_HIGHLIGHT_THRESH) {
name_highlight->hide();
if (name_text) {
name_text->hide();
}
}
- if (h > NAME_HIGHLIGHT_SIZE) {
- name_highlight->property_y1() = (double) y + h + 1 - NAME_HIGHLIGHT_SIZE;
- name_highlight->property_y2() = (double) y + h;
+ if (height > NAME_HIGHLIGHT_SIZE) {
+ name_highlight->property_y1() = (double) height+1 - NAME_HIGHLIGHT_SIZE;
+ name_highlight->property_y2() = (double) height;
}
else {
/* it gets hidden now anyway */
- name_highlight->property_y1() = (double) y;
- name_highlight->property_y2() = (double) y + h;
+ name_highlight->property_y1() = (double) 1.0;
+ name_highlight->property_y2() = (double) height;
}
}
if (name_text) {
- name_text->property_y() = y + h + 1 - NAME_Y_OFFSET;
- if (h < NAME_HIGHLIGHT_THRESH) {
+ name_text->property_y() = height+1 - NAME_Y_OFFSET;
+ if (height < NAME_HIGHLIGHT_THRESH) {
name_text->property_fill_color_rgba() = fill_color;
}
else {
}
if (frame) {
- frame->property_y1() = y;
- frame->property_y2() = y + h + 1;
+ frame->property_y2() = height+1;
}
- vestigial_frame->property_y1() = y;
- vestigial_frame->property_y2() = y + h + 1;
+ vestigial_frame->property_y2() = height+1;
}
/**
class TimeAxisViewItem : public Selectable
{
public:
- virtual ~TimeAxisViewItem() ;
+ virtual ~TimeAxisViewItem() ;
/**
* Set the position of this item upon the timeline to the specified value
*/
void set_name_text(const Glib::ustring& new_name) ;
- void set_y_position_and_height (double, double);
+ /**
+ * Set the height of this item
+ *
+ * @param h the new height
+ */
+ virtual void set_height(double h) ;
/**
*