2001-02-07 16:44:49 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file Timeout_pimpl.C
|
|
|
|
|
* Copyright 2001 LyX Team
|
|
|
|
|
* Read COPYING
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma implementation
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-02-07 16:44:49 +00:00
|
|
|
|
#include "Timeout_pimpl.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
|
|
using std::endl;
|
|
|
|
|
|
2001-03-20 01:22:46 +00:00
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
|
void C_intern_timeout_cb(int, void * data)
|
|
|
|
|
{
|
|
|
|
|
Timeout * to = static_cast<Timeout *>(data);
|
|
|
|
|
to->emit();
|
2001-02-07 16:44:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-20 01:22:46 +00:00
|
|
|
|
} // namespace anon
|
|
|
|
|
|
2001-02-07 16:44:49 +00:00
|
|
|
|
|
|
|
|
|
Timeout::Pimpl::Pimpl(Timeout * owner)
|
|
|
|
|
: owner_(owner), timeout_id(-1)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Timeout::Pimpl::reset()
|
|
|
|
|
{
|
|
|
|
|
timeout_id = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Timeout::Pimpl::start()
|
|
|
|
|
{
|
|
|
|
|
if (timeout_id != -1)
|
|
|
|
|
lyxerr << "Timeout::start: already running!" << endl;
|
|
|
|
|
timeout_id = fl_add_timeout(owner_->timeout_ms,
|
|
|
|
|
C_intern_timeout_cb, owner_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Timeout::Pimpl::stop()
|
|
|
|
|
{
|
|
|
|
|
if (timeout_id != -1) {
|
|
|
|
|
fl_remove_timeout(timeout_id);
|
|
|
|
|
timeout_id = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|