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.
14 #include "errorlist.h"
15 #include "FormErrorList.h"
17 #include "xforms_helpers.h"
18 #include "ControlErrorList.h"
19 #include "forms/form_errorlist.h"
20 #include "support/lstrings.h" // frontStrip, strip
23 #include "lyx_forms.h"
26 typedef FormController<ControlErrorList, FormView<FD_errorlist> > base_class;
28 FormErrorList::FormErrorList(Dialog & parent)
29 : base_class(parent, "")
33 int dumb_validator(FL_OBJECT *, const char *, const char *, int)
39 void FormErrorList::build()
41 dialog_.reset(build_errorlist(this));
42 fl_set_input_filter(dialog_->input_description, dumb_validator);
46 void FormErrorList::update()
48 setTitle(controller().name());
53 ButtonPolicy::SMInput FormErrorList::input(FL_OBJECT * ob, long)
55 if (ob == dialog_->browser_errors) {
56 //xforms return values 1..n
57 int const choice = int(fl_get_browser(dialog_->browser_errors)) - 1;
61 return ButtonPolicy::SMI_VALID;
65 void FormErrorList::goTo(int where)
67 ErrorList const & errors = controller().errorList();
69 if (0 <= where && where < int(errors.size())) {
70 controller().goTo(where);
71 fl_set_input(dialog_->input_description,
72 errors[where].description.c_str());
73 fl_set_input_topline(dialog_->input_description, 1);
78 void FormErrorList::updateContents()
80 fl_clear_browser(dialog_->browser_errors);
82 ErrorList const & errors = controller().errorList();
84 fl_add_browser_line(dialog_->browser_errors,
85 _("*** No Lists ***").c_str());
86 setEnabled(dialog_->browser_errors, false);
90 setEnabled(dialog_->browser_errors, true);
92 ErrorList::const_iterator cit = errors.begin();
93 ErrorList::const_iterator end = errors.end();
95 for (; cit != end; ++cit) {
96 fl_add_browser_line(dialog_->browser_errors,
100 fl_select_browser_line(dialog_->browser_errors, 1);