Merge all the (disconcertingly missing) track/region/etc height changes from 2.0.
authorDavid Robillard <d@drobilla.net>
Fri, 19 Sep 2008 19:32:10 +0000 (19:32 +0000)
committerDavid Robillard <d@drobilla.net>
Fri, 19 Sep 2008 19:32:10 +0000 (19:32 +0000)
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

23 files changed:
gtk2_ardour/audio_region_view.cc
gtk2_ardour/audio_region_view.h
gtk2_ardour/audio_streamview.cc
gtk2_ardour/audio_streamview.h
gtk2_ardour/automation_line.cc
gtk2_ardour/automation_line.h
gtk2_ardour/automation_region_view.cc
gtk2_ardour/automation_region_view.h
gtk2_ardour/automation_streamview.cc
gtk2_ardour/automation_time_axis.cc
gtk2_ardour/crossfade_view.cc
gtk2_ardour/crossfade_view.h
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_route_list.cc
gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_region_view.h
gtk2_ardour/midi_streamview.cc
gtk2_ardour/midi_streamview.h
gtk2_ardour/region_view.cc
gtk2_ardour/streamview.cc
gtk2_ardour/streamview.h
gtk2_ardour/time_axis_view_item.cc
gtk2_ardour/time_axis_view_item.h

index e8550656318d21eb362b6948fc447a17002e7796..5f781937dcf405a73fe0725a3e8a6fbdaa0c5cf4 100644 (file)
@@ -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 ();
index d93534cff79dfd1b3ea69244583bac6e5e4e8400..79adbd0b6272aecd7d5c6bc4590e2c405efb7738 100644 (file)
@@ -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);
index 53e182c8d69327c32e45aca1e8f4df7b119bdf52..caaa5744f1c9161e941cef84197608f31fec185f 100644 (file)
@@ -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 ();
                }
index 74868ea1a27457d8c20fb8adb5efa1c54d6135fd..c4db364618adb0206859e4d2fc8ec971a9415baa 100644 (file)
@@ -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;
        
index dd6990b17d51bd33e0e346ca61eac8d20e7069b9..27da5e5c1f99881cbaa92d53758c5375d6642a00 100644 (file)
@@ -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 ()
 {
index 5a1b63740b41e5790641ccb6394620dfcf3642aa..92c012fc821d808a22e726d7a96e48897352bcd2 100644 (file)
@@ -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;
index 7b43f2f0af772884c8806cf87c0e4b8409c2c91d..c213b3feeb3137152871fc298f8171735ae82693 100644 (file)
@@ -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
@@ -124,24 +123,13 @@ AutomationRegionView::add_automation_event (GdkEvent* event, nframes_t when, dou
        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
index 90fa9f3e44282984c789313ae862dd7260a3cad7..33c6a6c7e65cdbdd2ffb49ef7a244b3b742ac18a 100644 (file)
@@ -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);
index 206dc3753b61028ec24c5a7a2fd565ace864a1e3..9bce718fce99c8a6d336af86263b1acb2f21e488 100644 (file)
@@ -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;
index 7ef763c23524c8ef326394ba1e820a2f841661f4..daf0a01b95483180a260b9f49998e5d81e7c6eff 100644 (file)
@@ -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 ();
index 1b5f4d886a516d80c0381be0b6c7698639f0b825..8507d5e4d9eca8c5047248c8faa29c7621caa480 100644 (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_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 ();
index 39ca8bf1c3e9ef31980a34b62df25d15a213f8fa..01e1672a353137f169b222533bcd8d36aad3b9ce 100644 (file)
@@ -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; }
index ed7f46df082a80311c4eb99c54d18f1bb87d4f7e..6574af5ecf409a939337c4751505a3cf540170d8 100644 (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);
 
-       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.
index 1dd9a44e801bcd4c53d715b5dd90fc80ae1aa46c..8fdc1ce1109332d3a0b60f262e4a38c6beb4dbf4 100644 (file)
@@ -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 ();
index 63117beee2c3ecaf2755a99d322c719f63b8d484..3184bd104bd04d346db6973d5ab209d6e295f65d 100644 (file)
@@ -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();
index 1bdccd4986fb20a9ee56b353e58c25d0d006b07a..cb5789ab41ce4c22313316ebc0219e7dd14ec729 100644 (file)
@@ -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();
 
index 2266ddd064714735e64e487dccf701ed9fd22c6e..8d2986b6de672d1bd39d6f230a024a3aff17d20d 100644 (file)
@@ -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();
        }
 }
 
index 1caad3481999a6d416d5ebb12bf8d5704c9411e2..33eb9e5b7d952a64f40d8aae146731e35454717e 100644 (file)
@@ -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 ();
index a7d6c04e71dd8b3828ea9ca705bb8218a01a927b..ec6d0dcefc1c3a8c41514ae8229398360cd68ebe 100644 (file)
@@ -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);
        }
 }
+
index 5623394d9413b9d32290579b0fbf68914945edad..8730c55f58fd16dec9ece4063d7c760d8f2c890d 100644 (file)
@@ -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 ();
 }
index e8acb7cd48168777bd64ffa0e29559eefb469457..3b1b4cb12b81271c06fe50e5f5db34d21405fcf8 100644 (file)
@@ -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;
        
index 6f25f1e6b5373e6507e04d2d092538fd139dd182..0ee000a141e44fd3abc11a3ccb22a7e4634e22af 100644 (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
  */            
 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;
 }
 
 /**
index cc1c641f57de372906ade0ceb1cd6599d7b75b78..0101995ca83d6eadd740549fd0f8f982910c5040 100644 (file)
@@ -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) ;
 
     /**
      *