]> git.lyx.org Git - features.git/blob - src/frontends/gnome/GAbout.C
change "support/std_sstream.h" to <sstream>
[features.git] / src / frontends / gnome / GAbout.C
1 /**
2  * \file GAbout.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Michael Koziarski
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11
12 #include <config.h>
13
14 #include "support/lstrings.h"
15
16 #include "gnome_helpers.h"
17 #include "gnomeBC.h"
18 #include "GAbout.h"
19
20 #include <gtkmm/button.h>
21 #include <gtkmm/textview.h>
22
23 #include <sstream>
24
25 using std::istringstream;
26
27
28 GAbout::GAbout()
29         : GnomeCB<ControlAboutlyx>("GAbout")
30 {}
31
32
33 GAbout::~GAbout()
34 {}
35
36
37 void GAbout::build()
38 {
39         // Connect the buttons.
40         close_btn()->signal_clicked().connect(SigC::slot(*this, &GAbout::CancelClicked));
41
42         // Manage the buttons state
43         bc().setCancel(close_btn());
44         bc().refresh();
45 }
46
47 void GAbout::apply()
48 {}
49
50
51 void GAbout::update()
52 {
53         using namespace std;
54
55         string cr;
56         cr += controller().getCopyright();
57         cr += "\n";
58         cr += controller().getLicense();
59         cr += "\n";
60         cr += controller().getDisclaimer();
61         copyright()->get_buffer()->set_text(cr);
62
63
64
65         version()->set_text(controller().getVersion());
66
67         stringstream in;
68         controller().getCredits(in);
69
70         istringstream ss(in.str());
71
72         string s;
73         Glib::RefPtr<Gtk::TextBuffer> buf = credits()->get_buffer();
74
75         addDefaultTags(buf);
76         while (getline(ss, s)) {
77
78                 if (prefixIs(s, "@b"))
79                         buf->insert_with_tag(buf->end(),
80                                              Glib::locale_to_utf8(s.substr(2)),
81                                              "bold");
82                 else if (prefixIs(s, "@i"))
83                         buf->insert_with_tag(buf->end(),
84                                              Glib::locale_to_utf8(s.substr(2)),
85                                              "italic");
86                 else
87                         buf->insert(buf->end(),
88                                     Glib::locale_to_utf8(s.substr(2)));
89                 buf->insert(buf->end(),"\n");
90
91         }
92
93 }
94
95
96
97 Gtk::Button * GAbout::close_btn() const
98 {
99         return getWidget<Gtk::Button>("r_close_btn");
100 }
101 Gtk::Label * GAbout::version() const
102 {
103         return getWidget<Gtk::Label>("r_version");
104 }
105 Gtk::TextView * GAbout::credits() const
106 {
107         return getWidget<Gtk::TextView>("r_credits");
108 }
109 Gtk::TextView * GAbout::copyright() const
110 {
111         return getWidget<Gtk::TextView>("r_copyright");
112 }