]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/GAbout.C
fix tooltips in toolbar
[lyx.git] / src / frontends / gnome / GAbout.C
1 /**
2  * \file GAbout.C
3  * Copyright 2001 The LyX Team.
4  * See the file COPYING.
5  *
6  * \author Michael Koziarski <michael@koziarski.org>
7  */
8
9 #ifdef __GNUG__
10 #pragma implementation
11 #endif
12
13 #include <config.h>
14
15 #include "support/lstrings.h"
16 #include "Lsstream.h"
17
18
19 #include "gnomeBC.h"
20 #include "GAbout.h"
21
22 #include <gtkmm/button.h>
23 #include <gtkmm/textview.h>
24
25 GAbout::GAbout(ControlAboutlyx & c)
26         : FormCB<ControlAboutlyx>(c, "GAbout")
27 {}
28
29
30 GAbout::~GAbout()
31 {}
32
33
34 void GAbout::build()
35 {
36         // Connect the buttons.
37         close_btn()->signal_clicked().connect(SigC::slot(*this, &GAbout::CancelClicked));
38
39         // Manage the buttons state
40         bc().setCancel(close_btn());
41         bc().refresh();
42 }
43
44 void GAbout::apply()
45 {}
46
47
48 void GAbout::update()
49 {
50         using namespace std;
51
52         string cr;
53         cr += controller().getCopyright();
54         cr += "\n";
55         cr += controller().getLicense();
56         cr += "\n";
57         cr += controller().getDisclaimer();
58         copyright()->get_buffer()->set_text(cr);
59
60         
61
62         version()->set_text(controller().getVersion());
63
64         stringstream in;
65         controller().getCredits(in);
66
67         istringstream ss(in.str().c_str());
68
69         string s;
70         string out;
71         Gtk::TextIter  e;
72
73         while (getline(ss, s)) {
74         
75                 if (prefixIs(s, "@b"))
76                         out += s.substr(2);
77                 else if (prefixIs(s, "@i"))
78                         out += s.substr(2);
79                 else
80                         out += s.substr(2);
81
82                 out += "\n";
83         }
84         credits()->get_buffer()->set_text(out);
85 }
86
87
88
89 Gtk::Button * GAbout::close_btn() const 
90 {
91         return getWidget<Gtk::Button>("r_close_btn");
92 }
93 Gtk::Label * GAbout::version() const 
94 {
95         return getWidget<Gtk::Label>("r_version");
96 }
97 Gtk::TextView * GAbout::credits() const 
98 {
99         return getWidget<Gtk::TextView>("r_credits");
100 }
101 Gtk::TextView * GAbout::copyright() const 
102 {
103         return getWidget<Gtk::TextView>("r_copyright");
104 }