mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 00:34:59 +01:00
small class rearrangement for ViewBackground and derived classes related to geometry management
This commit is contained in:
parent
80a34fc3ec
commit
08f77136b9
5 changed files with 45 additions and 27 deletions
|
|
@ -531,8 +531,3 @@ MidiStreamView::record_layer_check (std::shared_ptr<ARDOUR::Region> r, samplepos
|
|||
check_record_layers (r, t);
|
||||
}
|
||||
|
||||
int
|
||||
MidiStreamView::y_position () const
|
||||
{
|
||||
return _trackview.y_position();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,18 +63,15 @@ public:
|
|||
MidiStreamView (MidiTimeAxisView&);
|
||||
~MidiStreamView ();
|
||||
|
||||
int contents_height() const { return StreamView::contents_height(); }
|
||||
int y_position() const { return StreamView::y_position(); }
|
||||
|
||||
void get_regions_with_selected_data (RegionSelection&);
|
||||
|
||||
void set_layer_display (LayerDisplay);
|
||||
//bool can_change_layer_display() const { return false; } // revert this change for now. Although stacked view is weirdly implemented wrt the "scroomer", it is still necessary to be able to manage layered regions.
|
||||
void redisplay_track ();
|
||||
|
||||
int contents_height() const {
|
||||
return child_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2;
|
||||
}
|
||||
|
||||
int y_position () const;
|
||||
|
||||
RegionView* create_region_view (std::shared_ptr<ARDOUR::Region>, bool, bool);
|
||||
|
||||
bool paste (Temporal::timepos_t const & pos, const Selection& selection, PasteContext& ctx);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Container* canvas_g
|
|||
, stream_base_color(0xFFFFFFFF)
|
||||
, _layers (1)
|
||||
, _layer_display (Overlaid)
|
||||
, height (tv.height)
|
||||
, _height (tv.height)
|
||||
, last_rec_data_sample(0)
|
||||
{
|
||||
CANVAS_DEBUG_NAME (_canvas_group, string_compose ("SV canvas group %1", _trackview.name()));
|
||||
|
|
@ -123,12 +123,12 @@ StreamView::set_height (double h)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (height == h) {
|
||||
if (_height == h) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
height = h;
|
||||
canvas_rect->set_y1 (height);
|
||||
_height = h;
|
||||
canvas_rect->set_y1 (_height);
|
||||
update_contents_height ();
|
||||
|
||||
return 0;
|
||||
|
|
@ -625,7 +625,7 @@ StreamView::_get_selectables (timepos_t const & start, timepos_t const & end, do
|
|||
/* Note: EditorAutomationLine::get_selectables() uses trackview.current_height (),
|
||||
* disregarding Stacked layer display height
|
||||
*/
|
||||
double const c = height; // child_height (); // XXX
|
||||
double const c = _height; // child_height (); // XXX
|
||||
double const y = (*i)->get_canvas_group ()->position().y;
|
||||
double t = 1.0 - std::min (1.0, std::max (0., (top - _trackview.y_position () - y) / c));
|
||||
double b = 1.0 - std::min (1.0, std::max (0., (bottom - _trackview.y_position () - y) / c));
|
||||
|
|
@ -664,15 +664,15 @@ StreamView::child_height () const
|
|||
{
|
||||
switch (_layer_display) {
|
||||
case Overlaid:
|
||||
return height;
|
||||
return _height;
|
||||
case Stacked:
|
||||
return height / _layers;
|
||||
return _height / _layers;
|
||||
case Expanded:
|
||||
return height / (_layers * 2 + 1);
|
||||
return _height / (_layers * 2 + 1);
|
||||
}
|
||||
|
||||
abort(); /* NOTREACHED */
|
||||
return height;
|
||||
return _height;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -686,10 +686,10 @@ StreamView::update_contents_height ()
|
|||
(*i)->set_y (0);
|
||||
break;
|
||||
case Stacked:
|
||||
(*i)->set_y (height - ((*i)->region()->layer() + 1) * h);
|
||||
(*i)->set_y (_height - ((*i)->region()->layer() + 1) * h);
|
||||
break;
|
||||
case Expanded:
|
||||
(*i)->set_y (height - ((*i)->region()->layer() + 1) * 2 * h);
|
||||
(*i)->set_y (_height - ((*i)->region()->layer() + 1) * 2 * h);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -699,7 +699,7 @@ StreamView::update_contents_height ()
|
|||
for (vector<RecBoxInfo>::iterator i = rec_rects.begin(); i != rec_rects.end(); ++i) {
|
||||
switch (_layer_display) {
|
||||
case Overlaid:
|
||||
i->rectangle->set_y1 (height);
|
||||
i->rectangle->set_y1 (_height);
|
||||
break;
|
||||
case Stacked:
|
||||
case Expanded:
|
||||
|
|
@ -781,3 +781,21 @@ StreamView::parameter_changed (string const & what)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
StreamView::y_position () const
|
||||
{
|
||||
return _trackview.y_position();
|
||||
}
|
||||
|
||||
int
|
||||
StreamView::height() const
|
||||
{
|
||||
return _height;
|
||||
}
|
||||
|
||||
int
|
||||
StreamView::width () const
|
||||
{
|
||||
return (int) ArdourCanvas::COORD_MAX;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "enums.h"
|
||||
#include "selectable.h"
|
||||
#include "time_axis_view_item.h"
|
||||
#include "view_background.h"
|
||||
|
||||
namespace Gdk {
|
||||
|
|
@ -77,6 +78,13 @@ public:
|
|||
|
||||
void set_zoom_all();
|
||||
|
||||
int height() const;
|
||||
int width() const;
|
||||
int contents_height() const {
|
||||
return child_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2;
|
||||
}
|
||||
int y_position () const;
|
||||
|
||||
int set_position (gdouble x, gdouble y);
|
||||
virtual int set_height (double);
|
||||
|
||||
|
|
@ -185,7 +193,7 @@ protected:
|
|||
ARDOUR::layer_t _layers;
|
||||
LayerDisplay _layer_display;
|
||||
|
||||
double height;
|
||||
double _height;
|
||||
|
||||
PBD::ScopedConnectionList rec_data_ready_connections;
|
||||
samplepos_t last_rec_data_sample;
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ class ViewBackground : public sigc::trackable
|
|||
ViewBackground ();
|
||||
virtual ~ViewBackground ();
|
||||
|
||||
virtual int height() const { return 0; }
|
||||
virtual int width() const { return 0; }
|
||||
virtual int contents_height() const { return 0; }
|
||||
virtual int height() const = 0;
|
||||
virtual int width() const = 0;
|
||||
virtual int contents_height() const = 0;
|
||||
|
||||
/** @return y position, or -1 if hidden */
|
||||
virtual int y_position () const { return 0; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue