]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/gnomeTimeout.C
fix math fonts with LyX/Mac
[lyx.git] / src / frontends / gnome / gnomeTimeout.C
1 /**
2  * \file gnomeTimeout.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Baruch Even
7  * \author Michael Koziarski
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include <glibmm/main.h>
15 #include "gnomeTimeout.h"
16 #include "debug.h"
17
18
19 Timeout::Timeout(unsigned int msec, Type t)
20         : pimpl_(new gnomeTimeout(*this)), type(t), timeout_ms(msec)
21 {}
22
23
24 gnomeTimeout::(gnomeTimeoutTimeout * owner)
25         : Timeout::Impl(owner), timeout_id(-1)
26 {}
27
28
29 void gnomeTimeout::reset()
30 {
31         stop();
32 }
33
34
35 bool gnomeTimeout::running() const
36 {
37         return running_;
38 }
39
40
41 void gnomeTimeout::start()
42 {
43         if (conn_.connected()) {
44                 lyxerr << "Timeout::start: already running!" << std::endl;
45                 stop();
46         }
47
48         conn_ = Glib::signal_timeout().connect(
49                          SigC::slot(*this, &Timeout::Pimpl::timeoutEvent),
50                          timeout_ms()
51                         );
52         running_ = true;
53 }
54
55
56 void gnomeTimeout::stop()
57 {
58         conn_.disconnect();
59         running_ = false;
60 }
61
62
63 bool gnomeTimeout::timeoutEvent()
64 {
65         emit();
66         return false; // discontinue emitting timeouts.
67 }