]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormChanges.C
dont use pragma impementation and interface anymore
[lyx.git] / src / frontends / xforms / FormChanges.C
1 /**
2  * \file FormChanges.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #include "xformsBC.h"
14 #include "ControlChanges.h"
15 #include "FormChanges.h"
16 #include "forms/form_changes.h"
17
18 #include FORMS_H_LOCATION
19
20 typedef FormCB<ControlChanges, FormDB<FD_changes> > base_class;
21
22 FormChanges::FormChanges()
23         : base_class(_("LyX: Merge changes"))
24 {}
25
26
27 void FormChanges::build()
28 {
29         dialog_.reset(build_changes(this));
30
31         bc().setCancel(dialog_->button_close);
32         bc().addReadOnly(dialog_->button_accept);
33         bc().addReadOnly(dialog_->button_reject);
34 }
35
36
37 void FormChanges::update()
38 {
39         fl_set_object_label(dialog_->author, "");
40         fl_set_object_label(dialog_->date, "");
41         // FIXME: enable/disable accept/reject
42 }
43
44
45 ButtonPolicy::SMInput FormChanges::input(FL_OBJECT * obj, long)
46 {
47         if (obj == dialog_->button_accept) {
48                 controller().accept();
49                 return ButtonPolicy::SMI_VALID;
50         }
51
52         if (obj == dialog_->button_reject) {
53                 controller().reject();
54                 return ButtonPolicy::SMI_VALID;
55         }
56
57         if (obj != dialog_->button_next)
58                 return ButtonPolicy::SMI_VALID;
59
60         controller().find();
61
62         string author(controller().getChangeAuthor());
63         string date(controller().getChangeDate());
64         if (!date.empty()) {
65                 date = _("Changed at : ") + date;
66         }
67         if (!author.empty()) {
68                 author = _("Change made by : ") + author;
69         }
70         fl_set_object_label(dialog_->author, author.c_str());
71         fl_set_object_label(dialog_->date, date.c_str());
72
73         // Yes, this is needed.
74         fl_redraw_form(form());
75
76         return ButtonPolicy::SMI_VALID;
77 }