]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/GChanges.C
Minipage is no more (long live the box inset)
[lyx.git] / src / frontends / gnome / GChanges.C
1 /**
2  * \file GChanges.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 #include <config.h>
12
13 #include "gnomeBC.h"
14 #include "GChanges.h"
15
16 #include <gtkmm/button.h>
17 #include <gtkmm/textview.h>
18 #include <string>
19
20 GChanges::GChanges()
21         : GnomeCB<ControlChanges>("GChanges")
22 {}
23
24
25 GChanges::~GChanges()
26 {}
27
28
29 void GChanges::build()
30 {
31         // Connect the buttons.
32         cancel_btn()->signal_clicked().connect(SigC::slot(*this, &GChanges::CancelClicked));
33         accept_btn()->signal_clicked().connect(SigC::slot(*this, &GChanges::accept));
34         reject_btn()->signal_clicked().connect(SigC::slot(*this, &GChanges::reject));
35
36         bc().setCancel(cancel_btn());
37
38         // Manage the read-only aware widgets.
39         bc().addReadOnly(accept_btn());
40         bc().addReadOnly(cancel_btn());
41         bc().addReadOnly(reject_btn());
42
43         // Make sure everything is in the correct state.
44         bc().refresh();
45 }
46
47
48 void GChanges::connect_signals()
49 {}
50
51
52 void GChanges::disconnect_signals()
53 {}
54
55 void GChanges::accept()
56 {
57         controller().accept();
58 }
59
60 void GChanges::reject()
61 {
62         controller().reject();
63 }
64
65 void GChanges::apply()
66 {}
67
68
69 void GChanges::update()
70 {
71         using std::string;
72         disconnect_signals();
73         controller().find();
74
75         string text;
76         string author(controller().getChangeAuthor());
77         string date(controller().getChangeDate());
78
79         if (!author.empty())
80                 text += "Change by " + author + "\n\n";
81         if (!date.empty())
82                 text += "Change made at " + date + "\n";
83
84         changes()->get_buffer()->set_text(Glib::locale_to_utf8(text));
85
86         connect_signals();
87 }
88
89
90 bool GChanges::validate() const
91 {
92         return true;
93 }
94 Gtk::Button * GChanges::next_btn() const
95 {
96         return getWidget<Gtk::Button>("r_next_btn");
97 }
98 Gtk::Button * GChanges::cancel_btn() const
99 {
100         return getWidget<Gtk::Button>("r_cancel_btn");
101 }
102 Gtk::TextView * GChanges::changes() const
103 {
104         return getWidget<Gtk::TextView>("r_changes");
105 }
106 Gtk::Button * GChanges::accept_btn() const
107 {
108         return getWidget<Gtk::Button>("r_accept_btn");
109 }
110 Gtk::Button * GChanges::reject_btn() const
111 {
112         return getWidget<Gtk::Button>("r_reject_btn");
113 }