mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
add API to suspend timers signal emission.
This commit is contained in:
parent
3e63439637
commit
7abfe85498
2 changed files with 14 additions and 2 deletions
|
|
@ -46,6 +46,9 @@ public:
|
||||||
|
|
||||||
virtual unsigned int connection_count () const = 0;
|
virtual unsigned int connection_count () const = 0;
|
||||||
|
|
||||||
|
void suspend () { m_suspended = true; }
|
||||||
|
void resume () { m_suspended = false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual ~Timer() { }
|
virtual ~Timer() { }
|
||||||
|
|
@ -56,6 +59,8 @@ protected:
|
||||||
|
|
||||||
virtual bool on_elapsed () = 0;
|
virtual bool on_elapsed () = 0;
|
||||||
|
|
||||||
|
bool suspended () const { return m_suspended; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Timer(const Timer&);
|
Timer(const Timer&);
|
||||||
|
|
@ -73,6 +78,8 @@ private:
|
||||||
|
|
||||||
const Glib::RefPtr<Glib::MainContext> m_main_context;
|
const Glib::RefPtr<Glib::MainContext> m_main_context;
|
||||||
|
|
||||||
|
bool m_suspended;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LIBPBD_API StandardTimer : public Timer
|
class LIBPBD_API StandardTimer : public Timer
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ Timer::Timer (unsigned int interval,
|
||||||
: m_timeout_source(NULL)
|
: m_timeout_source(NULL)
|
||||||
, m_timeout_interval(interval)
|
, m_timeout_interval(interval)
|
||||||
, m_main_context(main_context)
|
, m_main_context(main_context)
|
||||||
|
, m_suspended(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +122,9 @@ StandardTimer::on_elapsed()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_signal();
|
if (!suspended ()) {
|
||||||
|
m_signal();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,7 +152,9 @@ BlinkTimer::on_elapsed()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_blink_signal(blink_on = !blink_on);
|
if (!suspended ()) {
|
||||||
|
m_blink_signal(blink_on = !blink_on);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue