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