]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GLog.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / gtk / GLog.C
1 /**
2  * \file GLog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Spray
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCXX_CONCEPT_CHECKS
15 #undef _GLIBCXX_CONCEPT_CHECKS
16 #endif
17 #ifdef _GLIBCPP_CONCEPT_CHECKS
18 #undef _GLIBCPP_CONCEPT_CHECKS
19 #endif
20
21 #include "GLog.h"
22 #include "ControlLog.h"
23
24 #include "ghelpers.h"
25
26 #include <sstream>
27
28 using std::string;
29
30 namespace lyx {
31 namespace frontend {
32
33 GLog::GLog(Dialog & parent)
34         : GViewCB<ControlLog, GViewGladeB>(parent, lyx::to_utf8(_("Log Viewer")), false)
35 {}
36
37
38 void GLog::doBuild()
39 {
40         string const gladeName = findGladeFile("log");
41         xml_ = Gnome::Glade::Xml::create(gladeName);
42
43         Gtk::Button * button;
44         xml_->get_widget("Close", button);
45         setCancel(button);
46
47         xml_->get_widget("Refresh", button);
48         button->signal_clicked().connect(
49                 sigc::mem_fun(*this, &GLog::update));
50
51         Gtk::TextView * contentview;
52         xml_->get_widget("ContentView", contentview);
53         contentbuffer_ = contentview->get_buffer();
54 }
55
56
57 void GLog::update()
58 {
59         string const title = controller().title();
60
61         if (!title.empty())
62                 setTitle(title);
63
64         std::ostringstream contents;
65         controller().getContents(contents);
66
67         if (!contents.str().empty())
68                 contentbuffer_->set_text(contents.str());
69         else
70                 contentbuffer_->set_text(lyx::to_utf8(_("Error reading file!")));
71 }
72
73 } // namespace frontend
74 } // namespace lyx