diff options
author | David Robillard <d@drobilla.net> | 2008-09-19 19:32:10 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-09-19 19:32:10 +0000 |
commit | b87ca000f86fdfc210c08056ae8e921236ea96c7 (patch) | |
tree | 54b47b7e50baecca54c6392067ff9a3e05f6f25d | |
parent | 7aea02083a207402405cc4869b892dd63da191b6 (diff) |
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
-rw-r--r-- | gtk2_ardour/audio_region_view.cc | 26 | ||||
-rw-r--r-- | gtk2_ardour/audio_region_view.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/audio_streamview.cc | 15 | ||||
-rw-r--r-- | gtk2_ardour/audio_streamview.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_line.cc | 46 | ||||
-rw-r--r-- | gtk2_ardour/automation_line.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/automation_region_view.cc | 18 | ||||
-rw-r--r-- | gtk2_ardour/automation_region_view.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/automation_streamview.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/crossfade_view.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/crossfade_view.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/editor_route_list.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 15 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/midi_streamview.cc | 13 | ||||
-rw-r--r-- | gtk2_ardour/midi_streamview.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/region_view.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/streamview.cc | 17 | ||||
-rw-r--r-- | gtk2_ardour/streamview.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view_item.cc | 27 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view_item.h | 9 |
23 files changed, 112 insertions, 126 deletions
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index e855065631..5f781937dc 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -212,7 +212,7 @@ AudioRegionView::init (Gdk::Color& basic_color, bool wfd) gain_line->reset (); - set_y_position_and_height (0, trackview.current_height()); + set_height (trackview.current_height()); region_muted (); region_sync_changed (); @@ -453,24 +453,24 @@ AudioRegionView::setup_fade_handle_positions() } 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); @@ -480,14 +480,14 @@ AudioRegionView::set_y_position_and_height (double y, double h) } 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 (); diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index d93534cff7..79adbd0b62 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -71,9 +71,9 @@ class AudioRegionView : public RegionView 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); diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 53e182c8d6..caaa5744f1 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -452,12 +452,11 @@ AudioStreamView::redisplay_diskstream () 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); } } @@ -814,14 +813,14 @@ AudioStreamView::color_handler () } 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 (); } diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h index 74868ea1a2..c4db364618 100644 --- a/gtk2_ardour/audio_streamview.h +++ b/gtk2_ardour/audio_streamview.h @@ -98,7 +98,7 @@ class AudioStreamView : public StreamView void color_handler (); - void update_contents_y_position_and_height (); + void update_contents_height (); double _amplitude_above_axis; diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index dd6990b17d..27da5e5c1f 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -68,7 +68,6 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv no_draw = false; _visible = true; terminal_points_can_slide = true; - _y_position = 0; _height = 0; group = new ArdourCanvas::Group (parent); @@ -154,27 +153,17 @@ AutomationLine::control_point_box_size () } 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 (); } } @@ -222,7 +211,7 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi y = max (0.0, y); y = min (1.0, y); - y = _y_position + _height - (y * _height); + y = _height - (y * _height); if (cp.can_slide()) { @@ -351,7 +340,7 @@ AutomationLine::model_representation (ControlPoint& cp, ModelRepresentation& mr) */ 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 */ @@ -625,7 +614,7 @@ AutomationLine::get_verbose_cursor_string (double fraction) } } 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); @@ -697,7 +686,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) { - double const ydelta = fraction - last_drag_fraction; + double ydelta = fraction - last_drag_fraction; 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++) { 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) { @@ -908,8 +897,8 @@ AutomationLine::get_selectables (nframes_t& start, nframes_t& end, /* 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; @@ -975,8 +964,8 @@ AutomationLine::set_selected_points (PointSelection& points) /* 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) { @@ -1069,13 +1058,20 @@ AutomationLine::reset_callback (const Evoral::ControlList& events) 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 () { diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 5a1b63740b..92c012fc82 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -85,7 +85,6 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin 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; } @@ -94,7 +93,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin 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; @@ -128,7 +127,6 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin protected: string _name; - guint32 _y_position; guint32 _height; uint32_t _line_color; boost::shared_ptr<ARDOUR::AutomationList> alist; @@ -169,6 +167,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin void list_changed (); virtual bool event_handler (GdkEvent*); + virtual void add_model_point (ALPoints& tmp_points, double frame, double yfract); private: uint32_t drags; diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index 7b43f2f0af..c213b3feeb 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -69,8 +69,7 @@ AutomationRegionView::create_line (boost::shared_ptr<ARDOUR::AutomationList> lis _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 @@ -125,23 +124,12 @@ AutomationRegionView::add_automation_event (GdkEvent* event, nframes_t when, dou } 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 diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h index 90fa9f3e44..33c6a6c7e6 100644 --- a/gtk2_ardour/automation_region_view.h +++ b/gtk2_ardour/automation_region_view.h @@ -65,7 +65,6 @@ public: 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); diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index 206dc3753b..9bce718fce 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -160,7 +160,7 @@ AutomationStreamView::redisplay_diskstream () region_views.erase (i); } else { (*i)->enable_display(true); - (*i)->set_y_position_and_height(0, height); + (*i)->set_height(height); } i = tmp; diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 7ef763c235..daf0a01b95 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -387,11 +387,11 @@ AutomationTimeAxisView::set_height (uint32_t h) _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]; @@ -824,7 +824,7 @@ AutomationTimeAxisView::add_line (boost::shared_ptr<AutomationLine> line) _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 (); diff --git a/gtk2_ardour/crossfade_view.cc b/gtk2_ardour/crossfade_view.cc index 1b5f4d886a..8507d5e4d9 100644 --- a/gtk2_ardour/crossfade_view.cc +++ b/gtk2_ardour/crossfade_view.cc @@ -69,7 +69,7 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent, 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 */ @@ -107,12 +107,12 @@ CrossfadeView::reset_width_dependent_items (double pixel_width) } 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 (); diff --git a/gtk2_ardour/crossfade_view.h b/gtk2_ardour/crossfade_view.h index 39ca8bf1c3..01e1672a35 100644 --- a/gtk2_ardour/crossfade_view.h +++ b/gtk2_ardour/crossfade_view.h @@ -46,7 +46,7 @@ struct CrossfadeView : public TimeAxisViewItem 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; } diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index ed7f46df08..6574af5ecf 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -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); - 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); @@ -3013,7 +3013,7 @@ Editor::control_point_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* 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); @@ -3022,7 +3022,7 @@ Editor::control_point_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* 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; @@ -3113,7 +3113,7 @@ Editor::start_line_grab (AutomationLine* line, GdkEvent* event) 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); @@ -3155,7 +3155,7 @@ Editor::line_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) 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; @@ -3881,7 +3881,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) 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. diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index 1dd9a44e80..8fdc1ce110 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -352,7 +352,6 @@ Editor::redisplay_route_list () 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 (); diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 63117beee2..3184bd104b 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -107,7 +107,7 @@ MidiRegionView::init (Gdk::Color& basic_color, bool wfd) compute_colors (basic_color); - set_y_position_and_height (0, trackview.current_height()); + set_height (trackview.current_height()); region_muted (); region_sync_changed (); @@ -611,14 +611,15 @@ MidiRegionView::reset_width_dependent_items (double pixel_width) } 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(); diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index 1bdccd4986..cb5789ab41 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -71,7 +71,7 @@ class MidiRegionView : public RegionView 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(); diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 2266ddd064..8d2986b6de 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -218,7 +218,7 @@ MidiStreamView::redisplay_diskstream () 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 () @@ -256,8 +256,7 @@ MidiStreamView::redisplay_diskstream () /* 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); } @@ -270,9 +269,9 @@ MidiStreamView::redisplay_diskstream () 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(); } @@ -338,7 +337,7 @@ MidiStreamView::set_note_range(uint8_t lowest, uint8_t highest) { 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 } } @@ -610,7 +609,7 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t } if (update_range) - update_contents_y_position_and_height(); + update_contents_height(); } } diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h index 1caad34819..33eb9e5b7d 100644 --- a/gtk2_ardour/midi_streamview.h +++ b/gtk2_ardour/midi_streamview.h @@ -109,7 +109,7 @@ class MidiStreamView : public StreamView 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 (); diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index a7d6c04e71..ec6d0dcefc 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -585,6 +585,8 @@ RegionView::get_fill_color () void RegionView::set_height (double h) { + TimeAxisViewItem::set_height(h); + if (sync_line) { Points points; int sync_dir; @@ -597,3 +599,4 @@ RegionView::set_height (double h) sync_line->property_points().set_value (points); } } + diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 5623394d94..8730c55f58 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -128,7 +128,7 @@ StreamView::set_height (double h) } height = h; - update_contents_y_position_and_height (); + update_contents_height (); 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 */ if (ds->playlist()) { layers = ds->playlist()->top_layer() + 1; - update_contents_y_position_and_height (); + update_contents_height (); 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 */ layers = ds->playlist()->top_layer() + 1; - update_contents_y_position_and_height (); + update_contents_height (); /* draw it */ redisplay_diskstream (); @@ -422,7 +422,7 @@ StreamView::get_inverted_selectables (Selection& sel, list<Selectable*>& results } void -StreamView::update_contents_y_position_and_height () +StreamView::update_contents_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) { 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; } } @@ -449,5 +450,5 @@ void StreamView::set_layer_display (LayerDisplay d) { layer_display = d; - update_contents_y_position_and_height (); + update_contents_height (); } diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index e8acb7cd48..3b1b4cb12b 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -93,7 +93,7 @@ public: 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; diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 6f25f1e6b5..0ee000a141 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -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 */ 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(); @@ -593,20 +592,20 @@ TimeAxisViewItem::set_y_position_and_height (double y, double h) } } - 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 { @@ -615,12 +614,10 @@ TimeAxisViewItem::set_y_position_and_height (double y, double h) } 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; } /** diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index cc1c641f57..0101995ca8 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -38,7 +38,7 @@ class TimeAxisView; class TimeAxisViewItem : public Selectable { public: - virtual ~TimeAxisViewItem() ; + virtual ~TimeAxisViewItem() ; /** * 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_y_position_and_height (double, double); + /** + * Set the height of this item + * + * @param h the new height + */ + virtual void set_height(double h) ; /** * |