]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormChanges.C
reverse last change
[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 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "xformsBC.h"
18 #include "ControlChanges.h"
19 #include "FormChanges.h"
20 #include "forms/form_changes.h"
21
22 #include FORMS_H_LOCATION
23  
24 typedef FormCB<ControlChanges, FormDB<FD_changes> > base_class;
25
26 FormChanges::FormChanges()
27         : base_class(_("LyX: Merge changes"))
28 {}
29
30
31 void FormChanges::build()
32 {
33         dialog_.reset(build_changes(this));
34
35         bc().setCancel(dialog_->button_close);
36         bc().addReadOnly(dialog_->button_accept);
37         bc().addReadOnly(dialog_->button_reject);
38 }
39
40
41 void FormChanges::update()
42 {
43         fl_set_object_label(dialog_->author, "");
44         fl_set_object_label(dialog_->date, "");
45         // FIXME: enable/disable accept/reject 
46 }
47
48  
49 ButtonPolicy::SMInput FormChanges::input(FL_OBJECT * obj, long)
50 {
51         if (obj == dialog_->button_accept) {
52                 controller().accept();
53                 return ButtonPolicy::SMI_VALID;
54         }
55  
56         if (obj == dialog_->button_reject) {
57                 controller().reject();
58                 return ButtonPolicy::SMI_VALID;
59         }
60  
61         if (obj != dialog_->button_next)
62                 return ButtonPolicy::SMI_VALID;
63  
64         controller().find();
65  
66         string author(controller().getChangeAuthor());
67         string date(controller().getChangeDate());
68         if (!date.empty()) {
69                 date = _("Changed at : ") + date;
70         }
71         if (!author.empty()) {
72                 author = _("Change made by : ") + author;
73         }
74         fl_set_object_label(dialog_->author, author.c_str());
75         fl_set_object_label(dialog_->date, date.c_str());
76
77         // Yes, this is needed. 
78         fl_redraw_form(form());
79
80         return ButtonPolicy::SMI_VALID;
81 }