regionviews: use integer counter instead of boolean to control redisplay of contents
This commit is contained in:
parent
1be72e7a4e
commit
ae8c043fe1
|
@ -161,7 +161,6 @@ AudioStreamView::redisplay_track ()
|
|||
// Flag region views as invalid and disable drawing
|
||||
for (i = region_views.begin(); i != region_views.end(); ++i) {
|
||||
(*i)->set_valid (false);
|
||||
(*i)->enable_display (false);
|
||||
}
|
||||
|
||||
// Add and display views, and flag them as valid
|
||||
|
|
|
@ -79,8 +79,6 @@ AutomationRegionView::~AutomationRegionView ()
|
|||
void
|
||||
AutomationRegionView::init (bool /*wfd*/)
|
||||
{
|
||||
_enable_display = false;
|
||||
|
||||
RegionView::init (false);
|
||||
|
||||
reset_width_dependent_items ((double) _region->length_samples() / samples_per_pixel);
|
||||
|
@ -90,7 +88,7 @@ AutomationRegionView::init (bool /*wfd*/)
|
|||
fill_color_name = "midi frame base";
|
||||
set_colors ();
|
||||
|
||||
_enable_display = true;
|
||||
enable_display ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -105,7 +105,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
|
|||
arv->line()->set_list (list);
|
||||
}
|
||||
(*i)->set_valid (true);
|
||||
(*i)->enable_display (wait_for_data);
|
||||
(*i)->enable_display ();
|
||||
display_region(arv);
|
||||
|
||||
return 0;
|
||||
|
@ -123,11 +123,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
|
|||
|
||||
/* follow global waveform setting */
|
||||
|
||||
if (wait_for_data) {
|
||||
region_view->enable_display(true);
|
||||
// region_view->midi_region()->midi_source(0)->load_model();
|
||||
}
|
||||
|
||||
region_view->enable_display();
|
||||
display_region (region_view);
|
||||
|
||||
/* catch regionview going away */
|
||||
|
@ -174,7 +170,7 @@ AutomationStreamView::redisplay_track ()
|
|||
// Flag region views as invalid and disable drawing
|
||||
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
||||
(*i)->set_valid (false);
|
||||
(*i)->enable_display(false);
|
||||
(*i)->disable_display ();
|
||||
}
|
||||
|
||||
// Add and display region views, and flag them as valid
|
||||
|
|
|
@ -3323,7 +3323,6 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
} else {
|
||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||
i->view->thaw_after_trim ();
|
||||
i->view->enable_display (true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ MidiRegionView::parameter_changed (std::string const & p)
|
|||
{
|
||||
RegionView::parameter_changed (p);
|
||||
if (p == "display-first-midi-bank-as-zero") {
|
||||
if (_enable_display) {
|
||||
if (display_enabled()) {
|
||||
redisplay_model();
|
||||
}
|
||||
} else if (p == "color-regions-using-track-color") {
|
||||
|
@ -253,12 +253,13 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptr<M
|
|||
}
|
||||
|
||||
void
|
||||
MidiRegionView::init (bool wfd)
|
||||
MidiRegionView::init (bool /*wfd*/)
|
||||
{
|
||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
||||
|
||||
_model = midi_region()->midi_source(0)->model();
|
||||
_enable_display = false;
|
||||
assert (_model);
|
||||
|
||||
fill_color_name = "midi frame base";
|
||||
|
||||
RegionView::init (false);
|
||||
|
@ -270,16 +271,12 @@ MidiRegionView::init (bool wfd)
|
|||
region_resized (ARDOUR::bounds_change);
|
||||
//region_locked ();
|
||||
|
||||
disable_display ();
|
||||
set_colors ();
|
||||
|
||||
_enable_display = true;
|
||||
if (_model) {
|
||||
if (wfd) {
|
||||
display_model (_model);
|
||||
}
|
||||
}
|
||||
|
||||
reset_width_dependent_items (_pixel_width);
|
||||
enable_display ();
|
||||
|
||||
display_model (_model);
|
||||
|
||||
group->raise_to_top();
|
||||
|
||||
|
@ -907,9 +904,7 @@ MidiRegionView::display_model(boost::shared_ptr<MidiModel> model)
|
|||
/* Don't signal as nobody else needs to know until selection has been altered. */
|
||||
clear_events();
|
||||
|
||||
if (_enable_display) {
|
||||
redisplay_model();
|
||||
}
|
||||
redisplay_model ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1378,14 +1373,16 @@ MidiRegionView::region_resized (const PropertyChange& what_changed)
|
|||
{
|
||||
RegionView::region_resized(what_changed); // calls RegionView::set_duration()
|
||||
|
||||
#if 0
|
||||
/* catch end and start trim so we can update the view*/
|
||||
if (!what_changed.contains (ARDOUR::Properties::start) &&
|
||||
what_changed.contains (ARDOUR::Properties::length)) {
|
||||
enable_display (true);
|
||||
enable_display ();
|
||||
} else if (what_changed.contains (ARDOUR::Properties::start) &&
|
||||
what_changed.contains (ARDOUR::Properties::length)) {
|
||||
enable_display (true);
|
||||
enable_display ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1393,7 +1390,7 @@ MidiRegionView::reset_width_dependent_items (double pixel_width)
|
|||
{
|
||||
RegionView::reset_width_dependent_items(pixel_width);
|
||||
|
||||
if (_enable_display) {
|
||||
if (display_enabled()) {
|
||||
redisplay_model();
|
||||
}
|
||||
|
||||
|
@ -1443,10 +1440,6 @@ MidiRegionView::set_height (double height)
|
|||
void
|
||||
MidiRegionView::apply_note_range (uint8_t min, uint8_t max, bool force)
|
||||
{
|
||||
if (!_enable_display) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!force && _current_range_min == min && _current_range_max == max) {
|
||||
return;
|
||||
}
|
||||
|
@ -1482,7 +1475,6 @@ MidiRegionView::add_ghost (TimeAxisView& tv)
|
|||
}
|
||||
|
||||
ghosts.push_back (ghost);
|
||||
enable_display (true);
|
||||
return ghost;
|
||||
}
|
||||
|
||||
|
@ -4022,9 +4014,15 @@ MidiRegionView::color_handler ()
|
|||
}
|
||||
|
||||
void
|
||||
MidiRegionView::enable_display (bool yn)
|
||||
MidiRegionView::enable_display ()
|
||||
{
|
||||
RegionView::enable_display (yn);
|
||||
bool was_disabled = !display_enabled();
|
||||
|
||||
RegionView::enable_display ();
|
||||
|
||||
if (was_disabled && display_enabled()) {
|
||||
redisplay_model ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -297,7 +297,7 @@ public:
|
|||
|
||||
void selection_as_notelist (Notes& selected, bool allow_all_if_none_selected = false);
|
||||
|
||||
void enable_display (bool);
|
||||
void enable_display ();
|
||||
|
||||
void set_channel_selector_scoped_note(NoteBase* note){ _channel_selection_scoped_note = note; }
|
||||
NoteBase* channel_selector_scoped_note(){ return _channel_selection_scoped_note; }
|
||||
|
|
|
@ -158,15 +158,20 @@ MidiStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wait
|
|||
}
|
||||
|
||||
region_views.push_front (region_view);
|
||||
|
||||
/* display events and find note range */
|
||||
region_view->disable_display ();
|
||||
display_region (region_view, wait_for_data);
|
||||
|
||||
/* fit note range if we are importing */
|
||||
if (_trackview.session()->operation_in_progress (Operations::insert_file)) {
|
||||
/* this will call display_region() */
|
||||
set_note_range (ContentsRange);
|
||||
} else {
|
||||
/* display events and find note range */
|
||||
region_view->redisplay_model ();
|
||||
}
|
||||
|
||||
region_view->enable_display ();
|
||||
|
||||
/* catch regionview going away */
|
||||
boost::weak_ptr<Region> wr (region); // make this explicit
|
||||
region->DropReferences.connect (*this, invalidator (*this), boost::bind (&MidiStreamView::remove_region_view, this, wr), gui_context());
|
||||
|
@ -177,13 +182,13 @@ MidiStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wait
|
|||
}
|
||||
|
||||
void
|
||||
MidiStreamView::display_region(MidiRegionView* region_view, bool load_model)
|
||||
MidiStreamView::display_region (MidiRegionView* region_view, bool load_model)
|
||||
{
|
||||
if (!region_view) {
|
||||
return;
|
||||
}
|
||||
|
||||
region_view->enable_display (true);
|
||||
region_view->disable_display ();
|
||||
region_view->set_height (child_height());
|
||||
|
||||
boost::shared_ptr<MidiSource> source (region_view->midi_region()->midi_source(0));
|
||||
|
@ -201,7 +206,8 @@ MidiStreamView::display_region(MidiRegionView* region_view, bool load_model)
|
|||
_range_dirty = update_data_note_range (source->model()->lowest_note(), source->model()->highest_note());
|
||||
|
||||
// Display region contents
|
||||
region_view->display_model(source->model());
|
||||
region_view->enable_display ();
|
||||
region_view->display_model (source->model());
|
||||
}
|
||||
|
||||
|
||||
|
@ -278,7 +284,7 @@ MidiStreamView::redisplay_track ()
|
|||
// Flag region views as invalid and disable drawing
|
||||
for (i = region_views.begin(); i != region_views.end(); ++i) {
|
||||
(*i)->set_valid(false);
|
||||
(*i)->enable_display(false);
|
||||
(*i)->disable_display ();
|
||||
}
|
||||
|
||||
// Add and display region views, and flag them as valid
|
||||
|
|
|
@ -89,7 +89,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent,
|
|||
, editor(0)
|
||||
, current_visible_sync_position(0.0)
|
||||
, valid(false)
|
||||
, _enable_display(false)
|
||||
, _disable_display (1)
|
||||
, _pixel_width(1.0)
|
||||
, in_destructor(false)
|
||||
, wait_for_data(false)
|
||||
|
@ -170,7 +170,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent,
|
|||
, editor(0)
|
||||
, current_visible_sync_position(0.0)
|
||||
, valid(false)
|
||||
, _enable_display(false)
|
||||
, _disable_display (1)
|
||||
, _pixel_width(1.0)
|
||||
, in_destructor(false)
|
||||
, wait_for_data(false)
|
||||
|
@ -239,7 +239,7 @@ RegionView::init (bool wfd)
|
|||
update_cue_markers ();
|
||||
|
||||
if (wfd) {
|
||||
_enable_display = true;
|
||||
enable_display ();
|
||||
}
|
||||
|
||||
/* derived class calls set_height () including RegionView::set_height() in ::init() */
|
||||
|
@ -1256,3 +1256,26 @@ RegionView::drop_cue_marker (ArdourMarker* m)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionView::enable_display ()
|
||||
{
|
||||
std::cerr << "EnableDisplay " << this << " currently " << _disable_display << std::endl;
|
||||
if (_disable_display) {
|
||||
_disable_display--;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionView::disable_display ()
|
||||
{
|
||||
std::cerr << "DisableDisplay " << this << " currently " << _disable_display << std::endl;
|
||||
_disable_display++;
|
||||
}
|
||||
|
||||
bool
|
||||
RegionView::display_enabled() const
|
||||
{
|
||||
return !_disable_display;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,9 @@ public:
|
|||
virtual void entered () {}
|
||||
virtual void exited () {}
|
||||
|
||||
virtual void enable_display(bool yn) { _enable_display = yn; }
|
||||
virtual void enable_display();
|
||||
virtual void disable_display();
|
||||
bool display_enabled() const;
|
||||
virtual void update_coverage_frame (LayerDisplay);
|
||||
|
||||
static PBD::Signal1<void,RegionView*> RegionViewGoingAway;
|
||||
|
@ -184,10 +186,10 @@ protected:
|
|||
std::vector<ControlPoint *> control_points;
|
||||
double current_visible_sync_position;
|
||||
|
||||
bool valid; ///< see StreamView::redisplay_diskstream()
|
||||
bool _enable_display; ///< see StreamView::redisplay_diskstream()
|
||||
double _pixel_width;
|
||||
bool in_destructor;
|
||||
bool valid; ///< see StreamView::redisplay_diskstream()
|
||||
uint32_t _disable_display; ///< see StreamView::redisplay_diskstream()
|
||||
double _pixel_width;
|
||||
bool in_destructor;
|
||||
|
||||
bool wait_for_data;
|
||||
|
||||
|
|
|
@ -247,8 +247,6 @@ StreamView::layer_regions()
|
|||
region_views.erase (i);
|
||||
i = tmp;
|
||||
continue;
|
||||
} else {
|
||||
(*i)->enable_display(true);
|
||||
}
|
||||
|
||||
if (copy.size() == 0) {
|
||||
|
|
Loading…
Reference in New Issue