mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
add RAII DisplaySuspender
This commit is contained in:
parent
fd7cddb847
commit
77216ac468
4 changed files with 41 additions and 0 deletions
|
|
@ -4803,6 +4803,22 @@ Editor::axis_views_from_routes (boost::shared_ptr<RouteList> r) const
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Editor::suspend_route_redisplay ()
|
||||||
|
{
|
||||||
|
if (_routes) {
|
||||||
|
_routes->suspend_redisplay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Editor::resume_route_redisplay ()
|
||||||
|
{
|
||||||
|
if (_routes) {
|
||||||
|
_routes->resume_redisplay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::add_routes (RouteList& routes)
|
Editor::add_routes (RouteList& routes)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -476,6 +476,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
|
|
||||||
void on_realize();
|
void on_realize();
|
||||||
|
|
||||||
|
void suspend_route_redisplay ();
|
||||||
|
void resume_route_redisplay ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void color_handler ();
|
void color_handler ();
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ sigc::signal<void> PublicEditor::DropDownKeys;
|
||||||
PublicEditor::PublicEditor ()
|
PublicEditor::PublicEditor ()
|
||||||
: Window (Gtk::WINDOW_TOPLEVEL)
|
: Window (Gtk::WINDOW_TOPLEVEL)
|
||||||
, VisibilityTracker (*((Gtk::Window*)this))
|
, VisibilityTracker (*((Gtk::Window*)this))
|
||||||
|
, _suspend_route_redisplay_counter (0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,8 @@ class VerboseCursor;
|
||||||
class XMLNode;
|
class XMLNode;
|
||||||
struct SelectionRect;
|
struct SelectionRect;
|
||||||
|
|
||||||
|
class DisplaySuspender;
|
||||||
|
|
||||||
namespace ARDOUR_UI_UTILS {
|
namespace ARDOUR_UI_UTILS {
|
||||||
bool relay_key_press (GdkEventKey* ev, Gtk::Window* win);
|
bool relay_key_press (GdkEventKey* ev, Gtk::Window* win);
|
||||||
bool forward_key_press (GdkEventKey* ev);
|
bool forward_key_press (GdkEventKey* ev);
|
||||||
|
|
@ -428,6 +430,25 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
|
||||||
(and protected) method here does not have a default value.
|
(and protected) method here does not have a default value.
|
||||||
*/
|
*/
|
||||||
virtual void _ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top) = 0;
|
virtual void _ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top) = 0;
|
||||||
|
|
||||||
|
friend class DisplaySuspender;
|
||||||
|
virtual void suspend_route_redisplay () = 0;
|
||||||
|
virtual void resume_route_redisplay () = 0;
|
||||||
|
gint _suspend_route_redisplay_counter;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DisplaySuspender {
|
||||||
|
public:
|
||||||
|
DisplaySuspender() {
|
||||||
|
if (g_atomic_int_add(&PublicEditor::instance()._suspend_route_redisplay_counter, 1) == 0) {
|
||||||
|
PublicEditor::instance().suspend_route_redisplay ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~DisplaySuspender () {
|
||||||
|
if (g_atomic_int_dec_and_test (&PublicEditor::instance()._suspend_route_redisplay_counter)) {
|
||||||
|
PublicEditor::instance().resume_route_redisplay ();
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __gtk_ardour_public_editor_h__
|
#endif // __gtk_ardour_public_editor_h__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue