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 void FormErrorList::build()
35 dialog_.reset(build_errorlist(this));
36 setEnabled(dialog_->input_description, false);
40 void FormErrorList::update()
42 setTitle(controller().name());
47 ButtonPolicy::SMInput FormErrorList::input(FL_OBJECT * ob, long)
49 if (ob == dialog_->browser_errors) {
50 //xforms return values 1..n
51 int const choice = int(fl_get_browser(dialog_->browser_errors)) - 1;
53 return ButtonPolicy::SMI_VALID;
56 return ButtonPolicy::SMI_VALID;
60 void FormErrorList::goTo(int where)
62 ErrorList const & errors = controller().errorList();
64 if (0 <= where && where < int(errors.size())) {
65 controller().goTo(where);
66 fl_set_input(dialog_->input_description,
67 errors[where].description.c_str());
68 setEnabled(dialog_->input_description, false);
73 void FormErrorList::updateContents()
75 fl_clear_browser(dialog_->browser_errors);
77 ErrorList const & errors = controller().errorList();
79 fl_add_browser_line(dialog_->browser_errors,
80 _("*** No Lists ***").c_str());
81 setEnabled(dialog_->browser_errors, false);
85 setEnabled(dialog_->browser_errors, true);
87 ErrorList::const_iterator cit = errors.begin();
88 ErrorList::const_iterator end = errors.end();
90 for (; cit != end; ++cit) {
91 fl_add_browser_line(dialog_->browser_errors,
95 fl_select_browser_line(dialog_->browser_errors, 1);