2 * \file FormErrorList.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alfredo Braunstein
8 * Full author contact details are available in file CREDITS.
13 #include "FormErrorList.h"
14 #include "ControlErrorList.h"
15 #include "forms/form_errorlist.h"
18 #include "xforms_helpers.h"
19 #include "lyx_forms.h"
24 typedef FormController<ControlErrorList, FormView<FD_errorlist> > base_class;
26 FormErrorList::FormErrorList(Dialog & parent)
27 : base_class(parent, "")
31 int dumb_validator(FL_OBJECT *, const char *, const char *, int)
37 void FormErrorList::build()
39 dialog_.reset(build_errorlist(this));
40 fl_set_input_filter(dialog_->input_description, dumb_validator);
44 void FormErrorList::update()
46 setTitle(controller().name());
51 ButtonPolicy::SMInput FormErrorList::input(FL_OBJECT * ob, long)
53 if (ob == dialog_->browser_errors) {
54 //xforms return values 1..n
55 int const choice = int(fl_get_browser(dialog_->browser_errors)) - 1;
59 return ButtonPolicy::SMI_VALID;
63 void FormErrorList::goTo(int where)
65 ErrorList const & errors = controller().errorList();
67 if (0 <= where && where < int(errors.size())) {
68 controller().goTo(where);
69 fl_set_input(dialog_->input_description,
70 errors[where].description.c_str());
71 fl_set_input_topline(dialog_->input_description, 1);
76 void FormErrorList::updateContents()
78 fl_clear_browser(dialog_->browser_errors);
80 ErrorList const & errors = controller().errorList();
82 fl_add_browser_line(dialog_->browser_errors,
83 _("*** No Lists ***").c_str());
84 setEnabled(dialog_->browser_errors, false);
88 setEnabled(dialog_->browser_errors, true);
90 ErrorList::const_iterator cit = errors.begin();
91 ErrorList::const_iterator end = errors.end();
93 for (; cit != end; ++cit) {
94 fl_add_browser_line(dialog_->browser_errors,
98 fl_select_browser_line(dialog_->browser_errors, 1);
102 } // namespace frontend