Merge all the (disconcertingly missing) track/region/etc height changes from 2.0.

Fix track y positioning and initial region size/location.
Fix automation click-to-add-points (i.e. points actually show up where you click).
Fancy whiz-bang dynamic resize 2.0 professional edition support for MIDI/CC/Automation tracks/regions.


git-svn-id: svn://localhost/ardour2/branches/3.0@3769 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2008-09-19 19:32:10 +00:00
parent 7aea02083a
commit b87ca000f8
23 changed files with 112 additions and 126 deletions

View File

@ -212,7 +212,7 @@ AudioRegionView::init (Gdk::Color& basic_color, bool wfd)
gain_line->reset (); gain_line->reset ();
set_y_position_and_height (0, trackview.current_height()); set_height (trackview.current_height());
region_muted (); region_muted ();
region_sync_changed (); region_sync_changed ();
@ -453,24 +453,24 @@ AudioRegionView::setup_fade_handle_positions()
} }
void 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; // FIXME: ick
_height = h; height -= 2;
const uint32_t wcnt = waves.size();
_height = height;
for (uint32_t n=0; n < wcnt; ++n) { for (uint32_t n=0; n < wcnt; ++n) {
gdouble ht; gdouble ht;
if ((h) < NAME_HIGHLIGHT_THRESH) { if ((height) < NAME_HIGHLIGHT_THRESH) {
ht = ((_height-2*wcnt) / (double) wcnt); ht = ((height-2*wcnt) / (double) wcnt);
} else { } else {
ht = (((_height-2*wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt); ht = (((height-2*wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
} }
gdouble yoff = n * (ht+1); gdouble yoff = n * (ht+1);
@ -480,14 +480,14 @@ AudioRegionView::set_y_position_and_height (double y, double h)
} }
if (gain_line) { if (gain_line) {
if ((_height/wcnt) < NAME_HIGHLIGHT_THRESH) { if ((height/wcnt) < NAME_HIGHLIGHT_THRESH) {
gain_line->hide (); gain_line->hide ();
} else { } else {
if (_flags & EnvelopeVisible) { if (_flags & EnvelopeVisible) {
gain_line->show (); 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 (); manage_zero_line ();

View File

@ -71,9 +71,9 @@ class AudioRegionView : public RegionView
boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const; boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const;
void set_y_position_and_height (double, double);
void create_waves (); void create_waves ();
void set_height (double);
void set_samples_per_unit (double); void set_samples_per_unit (double);
void set_amplitude_above_axis (gdouble spp); void set_amplitude_above_axis (gdouble spp);

View File

@ -452,12 +452,11 @@ AudioStreamView::redisplay_diskstream ()
xi = tmpx; xi = tmpx;
} }
/* now fix layering */
/* Fix canvas layering */ for (RegionViewList::iterator i = copy.begin(); i != copy.end(); ++i) {
for (RegionViewList::iterator j = copy.begin(); j != copy.end(); ++j) { region_layered (*i);
(*j)->enable_display(true);
(*j)->set_height (height);
region_layered (*j);
} }
} }
@ -814,14 +813,14 @@ AudioStreamView::color_handler ()
} }
void 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) { for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) {
if (layer_display == Overlaid) { if (layer_display == Overlaid) {
(*i)->show (); (*i)->show ();
(*i)->set_y_position_and_height (0, height); (*i)->set_height (height);
} else { } else {
(*i)->hide (); (*i)->hide ();
} }

View File

@ -98,7 +98,7 @@ class AudioStreamView : public StreamView
void color_handler (); void color_handler ();
void update_contents_y_position_and_height (); void update_contents_height ();
double _amplitude_above_axis; double _amplitude_above_axis;

View File

@ -68,7 +68,6 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv
no_draw = false; no_draw = false;
_visible = true; _visible = true;
terminal_points_can_slide = true; terminal_points_can_slide = true;
_y_position = 0;
_height = 0; _height = 0;
group = new ArdourCanvas::Group (parent); group = new ArdourCanvas::Group (parent);
@ -154,27 +153,17 @@ AutomationLine::control_point_box_size ()
} }
void 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) { 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) { for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->set_size (bsz); (*i)->set_size (bsz);
} }
changed = true;
}
if (changed) {
reset (); reset ();
} }
} }
@ -222,7 +211,7 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi
y = max (0.0, y); y = max (0.0, y);
y = min (1.0, y); y = min (1.0, y);
y = _y_position + _height - (y * _height); y = _height - (y * _height);
if (cp.can_slide()) { if (cp.can_slide()) {
@ -351,7 +340,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() - _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 */ /* if xval has not changed, set it directly from the model to avoid rounding errors */
@ -625,7 +614,7 @@ AutomationLine::get_verbose_cursor_string (double fraction)
} }
} else { } else {
view_to_model_y(fraction); view_to_model_y(fraction);
if (alist->parameter().type() == MidiCCAutomation) if (((ARDOUR::Parameter)alist->parameter()).is_integer())
snprintf (buf, sizeof (buf), "%d", (int)fraction); snprintf (buf, sizeof (buf), "%d", (int)fraction);
else else
snprintf (buf, sizeof (buf), "%.2f", fraction); snprintf (buf, sizeof (buf), "%.2f", fraction);
@ -697,7 +686,7 @@ AutomationLine::point_drag (ControlPoint& cp, nframes_t x, float fraction, bool
void void
AutomationLine::line_drag (uint32_t i1, uint32_t i2, float fraction, bool with_push) 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; did_push = with_push;
@ -710,7 +699,7 @@ AutomationLine::line_drag (uint32_t i1, uint32_t i2, float fraction, bool with_p
for (uint32_t i = i1 ; i <= i2; i++) { for (uint32_t i = i1 ; i <= i2; i++) {
cp = nth (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) { if (line_points.size() > 1) {
@ -908,8 +897,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 = _y_position + (1.0 - topfrac) * _height; bot = (1.0 - topfrac) * _height;
top = _y_position + (1.0 - botfrac) * _height; top = (1.0 - botfrac) * _height;
nstart = max_frames; nstart = max_frames;
nend = 0; nend = 0;
@ -975,8 +964,8 @@ AutomationLine::set_selected_points (PointSelection& points)
/* Curse X11 and its inverted coordinate system! */ /* Curse X11 and its inverted coordinate system! */
bot = _y_position + (1.0 - (*r).high_fract) * _height; bot = (1.0 - (*r).high_fract) * _height;
top = _y_position + (1.0 - (*r).low_fract) * _height; top = (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) {
@ -1069,13 +1058,20 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
double translated_y = (*ai)->value; double translated_y = (*ai)->value;
model_to_view_y (translated_y); model_to_view_y (translated_y);
tmp_points.push_back (ALPoint (trackview.editor.frame_to_unit ((*ai)->when), add_model_point (tmp_points, (*ai)->when, translated_y);
_y_position + _height - (translated_y * _height)));
} }
determine_visible_control_points (tmp_points); 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 void
AutomationLine::reset () AutomationLine::reset ()
{ {

View File

@ -85,7 +85,6 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
string name() const { return _name; } string name() const { return _name; }
bool visible() const { return _visible; } bool visible() const { return _visible; }
guint32 height() const { return _height; } guint32 height() const { return _height; }
guint32 y_position() const { return _y_position; }
void set_line_color (uint32_t); void set_line_color (uint32_t);
uint32_t get_line_color() const { return _line_color; } uint32_t get_line_color() const { return _line_color; }
@ -94,7 +93,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
void show (); void show ();
void hide (); void hide ();
void set_y_position_and_height (double, double); void set_height (guint32);
void set_verbose_cursor_uses_gain_mapping (bool yn); void set_verbose_cursor_uses_gain_mapping (bool yn);
TimeAxisView& trackview; TimeAxisView& trackview;
@ -128,7 +127,6 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
protected: protected:
string _name; string _name;
guint32 _y_position;
guint32 _height; guint32 _height;
uint32_t _line_color; uint32_t _line_color;
boost::shared_ptr<ARDOUR::AutomationList> alist; boost::shared_ptr<ARDOUR::AutomationList> alist;
@ -169,6 +167,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
void list_changed (); void list_changed ();
virtual bool event_handler (GdkEvent*); virtual bool event_handler (GdkEvent*);
virtual void add_model_point (ALPoints& tmp_points, double frame, double yfract);
private: private:
uint32_t drags; uint32_t drags;

View File

@ -69,8 +69,7 @@ AutomationRegionView::create_line (boost::shared_ptr<ARDOUR::AutomationList> lis
_line->set_colors(); _line->set_colors();
_line->show(); _line->show();
_line->show_all_control_points(); _line->show_all_control_points();
_line->set_y_position_and_height (trackview.y_position, _line->set_height ((uint32_t)rint(trackview.current_height() - NAME_HIGHLIGHT_SIZE));
(uint32_t)rint(trackview.current_height() - NAME_HIGHLIGHT_SIZE));
} }
bool bool
@ -124,24 +123,13 @@ AutomationRegionView::add_automation_event (GdkEvent* event, nframes_t when, dou
view->session().set_dirty (); 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 void
AutomationRegionView::set_height (double h) AutomationRegionView::set_height (double h)
{ {
cout << "ARV SET HEIGHT: " << h << endl;
RegionView::set_height(h); RegionView::set_height(h);
if (_line) if (_line)
_line->set_y_position_and_height (trackview.y_position - h, _line->set_height ((uint32_t)rint(h - NAME_HIGHLIGHT_SIZE));
(uint32_t)rint(h - NAME_HIGHLIGHT_SIZE));
} }
bool bool

View File

@ -65,7 +65,6 @@ public:
protected: protected:
void create_line(boost::shared_ptr<ARDOUR::AutomationList> list); void create_line(boost::shared_ptr<ARDOUR::AutomationList> list);
bool set_position(nframes_t pos, void* src, double* ignored); 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); void region_resized(ARDOUR::Change what_changed);
bool canvas_event(GdkEvent* ev); bool canvas_event(GdkEvent* ev);
void add_automation_event (GdkEvent* event, nframes_t when, double y); void add_automation_event (GdkEvent* event, nframes_t when, double y);

View File

@ -160,7 +160,7 @@ AutomationStreamView::redisplay_diskstream ()
region_views.erase (i); region_views.erase (i);
} else { } else {
(*i)->enable_display(true); (*i)->enable_display(true);
(*i)->set_y_position_and_height(0, height); (*i)->set_height(height);
} }
i = tmp; i = tmp;

View File

@ -387,11 +387,11 @@ AutomationTimeAxisView::set_height (uint32_t h)
_base_rect->property_y2() = h; _base_rect->property_y2() = h;
if (_line) if (_line)
_line->set_y_position_and_height (0, h); _line->set_height(h);
if (_view) { if (_view) {
_view->set_height(h); _view->set_height(h);
_view->update_contents_y_position_and_height(); _view->update_contents_height();
} }
char buf[32]; char buf[32];
@ -824,7 +824,7 @@ AutomationTimeAxisView::add_line (boost::shared_ptr<AutomationLine> line)
_line = line; _line = line;
//_controller = AutomationController::create(_session, line->the_list(), _control); //_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 */ /* pick up the current state */
automation_state_changed (); automation_state_changed ();

View File

@ -69,7 +69,7 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
fade_out->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeLine.get(); fade_out->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeLine.get();
fade_out->property_width_pixels() = 1; 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 */ /* no frame around the xfade or overlap rects */
@ -107,12 +107,12 @@ CrossfadeView::reset_width_dependent_items (double pixel_width)
} }
void void
CrossfadeView::set_y_position_and_height (double y, double h) CrossfadeView::set_height (double height)
{ {
if (h <= TimeAxisView::hSmaller) { if (height <= TimeAxisView::hSmaller) {
TimeAxisViewItem::set_y_position_and_height (y, h - 3); TimeAxisViewItem::set_height (height - 3);
} else { } else {
TimeAxisViewItem::set_y_position_and_height (y, h - NAME_HIGHLIGHT_SIZE - 3 ); TimeAxisViewItem::set_height (height - NAME_HIGHLIGHT_SIZE - 3 );
} }
redraw_curves (); redraw_curves ();

View File

@ -46,7 +46,7 @@ struct CrossfadeView : public TimeAxisViewItem
AudioRegionView& left_view; // and these too AudioRegionView& left_view; // and these too
AudioRegionView& right_view; AudioRegionView& right_view;
void set_y_position_and_height (double, double); void set_height (double);
bool valid() const { return _valid; } bool valid() const { return _valid; }
bool visible() const { return _visible; } bool visible() const { return _visible; }

View File

@ -2964,7 +2964,7 @@ Editor::start_control_point_grab (ArdourCanvas::Item* item, GdkEvent* event)
control_point->line().start_drag (control_point, drag_info.grab_frame, 0); 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), set_verbose_canvas_cursor (control_point->line().get_verbose_cursor_string (fraction),
drag_info.current_pointer_x + 20, drag_info.current_pointer_y + 20); drag_info.current_pointer_x + 20, drag_info.current_pointer_y + 20);
@ -3013,7 +3013,7 @@ Editor::control_point_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent*
cx = max (0.0, cx); cx = max (0.0, cx);
cy = max (0.0, cy); 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 //translate cx to frames
nframes64_t cx_frames = unit_to_frame (cx); nframes64_t cx_frames = unit_to_frame (cx);
@ -3022,7 +3022,7 @@ Editor::control_point_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent*
snap_to (cx_frames); 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; bool push;
@ -3113,7 +3113,7 @@ Editor::start_line_grab (AutomationLine* line, GdkEvent* event)
start_grab (event, fader_cursor); 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); line->start_drag (0, drag_info.grab_frame, fraction);
@ -3155,7 +3155,7 @@ Editor::line_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
cy = max (0.0, cy); cy = max (0.0, cy);
cy = min ((double) line->height(), 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; bool push;
@ -3881,7 +3881,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
tvp2 = trackview_by_y_position (iy1 + y_delta); tvp2 = trackview_by_y_position (iy1 + y_delta);
temp_rtv = dynamic_cast<RouteTimeAxisView*>(tvp2); 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, /* 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. personally, i think this can confuse things, but never mind.

View File

@ -352,7 +352,6 @@ Editor::redisplay_route_list ()
if (visible) { if (visible) {
tv->set_marked_for_display (true); tv->set_marked_for_display (true);
cerr << tv->name() << " will be at " << position << endl;
position += tv->show_at (position, n, &edit_controls_vbox); position += tv->show_at (position, n, &edit_controls_vbox);
} else { } else {
tv->hide (); tv->hide ();

View File

@ -107,7 +107,7 @@ MidiRegionView::init (Gdk::Color& basic_color, bool wfd)
compute_colors (basic_color); compute_colors (basic_color);
set_y_position_and_height (0, trackview.current_height()); set_height (trackview.current_height());
region_muted (); region_muted ();
region_sync_changed (); region_sync_changed ();
@ -611,14 +611,15 @@ MidiRegionView::reset_width_dependent_items (double pixel_width)
} }
void 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) { if (_enable_display) {
_model->read_lock(); _model->read_lock();

View File

@ -71,7 +71,7 @@ class MidiRegionView : public RegionView
inline MidiStreamView* midi_stream_view() const inline MidiStreamView* midi_stream_view() const
{ return midi_view()->midi_view(); } { return midi_view()->midi_view(); }
void set_y_position_and_height (double, double); void set_height (double);
void set_frame_color(); void set_frame_color();

View File

@ -218,7 +218,7 @@ MidiStreamView::redisplay_diskstream ()
continue; continue;
} else { } else {
(*i)->enable_display(true); (*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 () /* Sort regionviews by layer so that when we call region_layered ()
@ -256,8 +256,7 @@ MidiStreamView::redisplay_diskstream ()
/* Fix canvas layering */ /* Fix canvas layering */
for (RegionViewList::iterator j = copy.begin(); j != copy.end(); ++j) { for (RegionViewList::iterator j = copy.begin(); j != copy.end(); ++j) {
(*j)->enable_display(true); (*j)->enable_display(true); // FIXME: do this?
(*j)->set_height (height);
region_layered (*j); region_layered (*j);
} }
@ -270,9 +269,9 @@ MidiStreamView::redisplay_diskstream ()
void 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; _note_lines->property_y2() = height;
draw_note_lines(); draw_note_lines();
} }
@ -338,7 +337,7 @@ MidiStreamView::set_note_range(uint8_t lowest, uint8_t highest) {
list<RegionView *>::iterator i; list<RegionView *>::iterator i;
for (i = region_views.begin(); i != region_views.end(); ++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
} }
} }
@ -610,7 +609,7 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t
} }
if (update_range) if (update_range)
update_contents_y_position_and_height(); update_contents_height();
} }
} }

View File

@ -109,7 +109,7 @@ class MidiStreamView : public StreamView
void display_region(MidiRegionView* region_view, bool load_model); void display_region(MidiRegionView* region_view, bool load_model);
void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream> ds); 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 draw_note_lines();
void color_handler (); void color_handler ();

View File

@ -585,6 +585,8 @@ RegionView::get_fill_color ()
void void
RegionView::set_height (double h) RegionView::set_height (double h)
{ {
TimeAxisViewItem::set_height(h);
if (sync_line) { if (sync_line) {
Points points; Points points;
int sync_dir; int sync_dir;
@ -597,3 +599,4 @@ RegionView::set_height (double h)
sync_line->property_points().set_value (points); sync_line->property_points().set_value (points);
} }
} }

View File

@ -128,7 +128,7 @@ StreamView::set_height (double h)
} }
height = h; height = h;
update_contents_y_position_and_height (); update_contents_height ();
return 0; return 0;
} }
@ -230,7 +230,7 @@ StreamView::playlist_modified (boost::shared_ptr<Diskstream> ds)
/* update layers count and the y positions and heights of our regions */ /* update layers count and the y positions and heights of our regions */
if (ds->playlist()) { if (ds->playlist()) {
layers = ds->playlist()->top_layer() + 1; layers = ds->playlist()->top_layer() + 1;
update_contents_y_position_and_height (); update_contents_height ();
redisplay_diskstream (); redisplay_diskstream ();
} }
} }
@ -252,7 +252,7 @@ StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds)
/* update layers count and the y positions and heights of our regions */ /* update layers count and the y positions and heights of our regions */
layers = ds->playlist()->top_layer() + 1; layers = ds->playlist()->top_layer() + 1;
update_contents_y_position_and_height (); update_contents_height ();
/* draw it */ /* draw it */
redisplay_diskstream (); redisplay_diskstream ();
@ -422,7 +422,7 @@ StreamView::get_inverted_selectables (Selection& sel, list<Selectable*>& results
} }
void void
StreamView::update_contents_y_position_and_height () StreamView::update_contents_height ()
{ {
canvas_rect->property_y2() = height; canvas_rect->property_y2() = height;
@ -431,11 +431,12 @@ StreamView::update_contents_y_position_and_height ()
for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) { for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) {
switch (layer_display) { switch (layer_display) {
case Overlaid: case Overlaid:
(*i)->set_y_position_and_height (0, height); (*i)->set_height (height);
break; break;
case Stacked: case Stacked:
double const y = (*i)->region()->layer() * lh; cout << "FIXME: Stacked regions: set y position" << endl;
(*i)->set_y_position_and_height (y, lh); //double const y = (*i)->region()->layer() * lh;
(*i)->set_height (lh);
break; break;
} }
} }
@ -449,5 +450,5 @@ void
StreamView::set_layer_display (LayerDisplay d) StreamView::set_layer_display (LayerDisplay d)
{ {
layer_display = d; layer_display = d;
update_contents_y_position_and_height (); update_contents_height ();
} }

View File

@ -93,7 +93,7 @@ public:
void add_region_view (boost::shared_ptr<ARDOUR::Region>); void add_region_view (boost::shared_ptr<ARDOUR::Region>);
void region_layered (RegionView*); void region_layered (RegionView*);
virtual void update_contents_y_position_and_height (); virtual void update_contents_height ();
virtual void redisplay_diskstream () = 0; virtual void redisplay_diskstream () = 0;

View File

@ -572,16 +572,15 @@ TimeAxisViewItem::set_name_text(const ustring& new_name)
} }
/** /**
* 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 * @param h the new height
*/ */
void void
TimeAxisViewItem::set_y_position_and_height (double y, double h) TimeAxisViewItem::set_height (double height)
{ {
if (name_highlight) { if (name_highlight) {
if (h < NAME_HIGHLIGHT_THRESH) { if (height < NAME_HIGHLIGHT_THRESH) {
name_highlight->hide(); name_highlight->hide();
if (name_text) { if (name_text) {
name_text->hide(); name_text->hide();
@ -593,20 +592,20 @@ TimeAxisViewItem::set_y_position_and_height (double y, double h)
} }
} }
if (h > NAME_HIGHLIGHT_SIZE) { if (height > NAME_HIGHLIGHT_SIZE) {
name_highlight->property_y1() = (double) y + h + 1 - NAME_HIGHLIGHT_SIZE; name_highlight->property_y1() = (double) height+1 - NAME_HIGHLIGHT_SIZE;
name_highlight->property_y2() = (double) y + h; name_highlight->property_y2() = (double) height;
} }
else { else {
/* it gets hidden now anyway */ /* it gets hidden now anyway */
name_highlight->property_y1() = (double) y; name_highlight->property_y1() = (double) 1.0;
name_highlight->property_y2() = (double) y + h; name_highlight->property_y2() = (double) height;
} }
} }
if (name_text) { if (name_text) {
name_text->property_y() = y + h + 1 - NAME_Y_OFFSET; name_text->property_y() = height+1 - NAME_Y_OFFSET;
if (h < NAME_HIGHLIGHT_THRESH) { if (height < NAME_HIGHLIGHT_THRESH) {
name_text->property_fill_color_rgba() = fill_color; name_text->property_fill_color_rgba() = fill_color;
} }
else { else {
@ -615,12 +614,10 @@ TimeAxisViewItem::set_y_position_and_height (double y, double h)
} }
if (frame) { if (frame) {
frame->property_y1() = y; frame->property_y2() = height+1;
frame->property_y2() = y + h + 1;
} }
vestigial_frame->property_y1() = y; vestigial_frame->property_y2() = height+1;
vestigial_frame->property_y2() = y + h + 1;
} }
/** /**

View File

@ -38,7 +38,7 @@ class TimeAxisView;
class TimeAxisViewItem : public Selectable class TimeAxisViewItem : public Selectable
{ {
public: public:
virtual ~TimeAxisViewItem() ; virtual ~TimeAxisViewItem() ;
/** /**
* Set the position of this item upon the timeline to the specified value * Set the position of this item upon the timeline to the specified value
@ -201,7 +201,12 @@ class TimeAxisViewItem : public Selectable
*/ */
void set_name_text(const Glib::ustring& new_name) ; 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) ;
/** /**
* *