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"
22 typedef FormController<ControlErrorList, FormView<FD_errorlist> > base_class;
24 FormErrorList::FormErrorList(Dialog & parent)
25 : base_class(parent, "")
29 int dumb_validator(FL_OBJECT *, const char *, const char *, int)
35 void FormErrorList::build()
37 dialog_.reset(build_errorlist(this));
38 fl_set_input_filter(dialog_->input_description, dumb_validator);
42 void FormErrorList::update()
44 setTitle(controller().name());
49 ButtonPolicy::SMInput FormErrorList::input(FL_OBJECT * ob, long)
51 if (ob == dialog_->browser_errors) {
52 //xforms return values 1..n
53 int const choice = int(fl_get_browser(dialog_->browser_errors)) - 1;
57 return ButtonPolicy::SMI_VALID;
61 void FormErrorList::goTo(int where)
63 ErrorList const & errors = controller().errorList();
65 if (0 <= where && where < int(errors.size())) {
66 controller().goTo(where);
67 fl_set_input(dialog_->input_description,
68 errors[where].description.c_str());
69 fl_set_input_topline(dialog_->input_description, 1);
74 void FormErrorList::updateContents()
76 fl_clear_browser(dialog_->browser_errors);
78 ErrorList const & errors = controller().errorList();
80 fl_add_browser_line(dialog_->browser_errors,
81 _("*** No Lists ***").c_str());
82 setEnabled(dialog_->browser_errors, false);
86 setEnabled(dialog_->browser_errors, true);
88 ErrorList::const_iterator cit = errors.begin();
89 ErrorList::const_iterator end = errors.end();
91 for (; cit != end; ++cit) {
92 fl_add_browser_line(dialog_->browser_errors,
96 fl_select_browser_line(dialog_->browser_errors, 1);