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