3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
14 #include "ControlChanges.h"
15 #include "FormChanges.h"
16 #include "forms/form_changes.h"
18 #include FORMS_H_LOCATION
20 typedef FormController<ControlChanges, FormView<FD_changes> > base_class;
22 FormChanges::FormChanges(Dialog & parent)
23 : base_class(parent, _("LyX: Merge changes"))
27 void FormChanges::build()
29 dialog_.reset(build_changes(this));
31 bc().setCancel(dialog_->button_close);
32 bc().addReadOnly(dialog_->button_accept);
33 bc().addReadOnly(dialog_->button_reject);
37 void FormChanges::update()
39 fl_set_object_label(dialog_->author, "");
40 fl_set_object_label(dialog_->date, "");
41 // FIXME: enable/disable accept/reject
45 ButtonPolicy::SMInput FormChanges::input(FL_OBJECT * obj, long)
47 if (obj == dialog_->button_accept) {
48 controller().accept();
49 return ButtonPolicy::SMI_VALID;
52 if (obj == dialog_->button_reject) {
53 controller().reject();
54 return ButtonPolicy::SMI_VALID;
57 if (obj != dialog_->button_next)
58 return ButtonPolicy::SMI_VALID;
62 string author(controller().getChangeAuthor());
63 string date(controller().getChangeDate());
65 date = _("Changed at : ") + date;
67 if (!author.empty()) {
68 author = _("Change made by : ") + author;
70 fl_set_object_label(dialog_->author, author.c_str());
71 fl_set_object_label(dialog_->date, date.c_str());
73 // Yes, this is needed.
74 fl_redraw_form(form());
76 return ButtonPolicy::SMI_VALID;