X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FFormErrorList.C;h=20b6db069b7128b1bde4b408e5822a632eb8cbed;hb=d5443737342903de489d527802cd2cdd38987d74;hp=03deb549e3c1cc3a1df486e662c767a5e1bfcec9;hpb=4c16922aad0477028c3725e115f369cbe9f7718f;p=lyx.git diff --git a/src/frontends/xforms/FormErrorList.C b/src/frontends/xforms/FormErrorList.C index 03deb549e3..20b6db069b 100644 --- a/src/frontends/xforms/FormErrorList.C +++ b/src/frontends/xforms/FormErrorList.C @@ -5,103 +5,99 @@ * * \author Alfredo Braunstein * - * Full author contact details are available in file CREDITS + * Full author contact details are available in file CREDITS. */ #include - #include "FormErrorList.h" -#include "xformsBC.h" -#include "xforms_helpers.h" #include "ControlErrorList.h" #include "forms/form_errorlist.h" -#include "support/lstrings.h" // frontStrip, strip -#include "debug.h" -#include "gettext.h" -#include "lyx_forms.h" -#include - -using std::vector; -using std::endl; +#include "xformsBC.h" +#include "xforms_helpers.h" +#include "lyx_forms.h" +namespace lyx { +namespace frontend { typedef FormController > base_class; FormErrorList::FormErrorList(Dialog & parent) - : base_class(parent, _("LaTeX error list")) + : base_class(parent, "") {} +int dumb_validator(FL_OBJECT *, const char *, const char *, int) +{ + return FL_INVALID; +} + + void FormErrorList::build() { dialog_.reset(build_errorlist(this)); - - // Manage the cancel/close button - bcview().setCancel(dialog_->button_close); - bcview().addReadOnly(dialog_->browser_errors); + fl_set_input_filter(dialog_->input_description, dumb_validator); } void FormErrorList::update() { + setTitle(controller().name()); updateContents(); } ButtonPolicy::SMInput FormErrorList::input(FL_OBJECT * ob, long) { - std::vector const & - Errors = controller().ErrorList(); - if (ob == dialog_->browser_errors) { //xforms return values 1..n int const choice = int(fl_get_browser(dialog_->browser_errors)) - 1; - if (0 <= choice && choice < int(Errors.size())) { - controller().goTo(choice); - fl_set_input(dialog_->input_description, - Errors[choice].description.c_str()); - } - return ButtonPolicy::SMI_VALID; + goTo(choice); } - updateContents(); - return ButtonPolicy::SMI_VALID; } +void FormErrorList::goTo(int where) +{ + ErrorList const & errors = controller().errorList(); + + if (0 <= where && where < int(errors.size())) { + controller().goTo(where); + fl_set_input(dialog_->input_description, + errors[where].description.c_str()); + fl_set_input_topline(dialog_->input_description, 1); + } +} + + void FormErrorList::updateContents() { - std::vector const & - Errors = controller().ErrorList(); + fl_clear_browser(dialog_->browser_errors); - if (Errors.empty()) { - fl_clear_browser(dialog_->browser_errors); + ErrorList const & errors = controller().errorList(); + if (errors.empty()) { fl_add_browser_line(dialog_->browser_errors, - _("*** No Lists ***")); + _("*** No Lists ***").c_str()); setEnabled(dialog_->browser_errors, false); return; } - unsigned int const topline = - fl_get_browser_topline(dialog_->browser_errors); - unsigned int const line = fl_get_browser(dialog_->browser_errors); - - fl_clear_browser(dialog_->browser_errors); setEnabled(dialog_->browser_errors, true); - std::vector::const_iterator - cit = Errors.begin(); - std::vector::const_iterator - end = Errors.end(); + ErrorList::const_iterator cit = errors.begin(); + ErrorList::const_iterator end = errors.end(); for (; cit != end; ++cit) { fl_add_browser_line(dialog_->browser_errors, cit->error.c_str()); } - fl_set_browser_topline(dialog_->browser_errors, topline); - fl_select_browser_line(dialog_->browser_errors, line); + fl_select_browser_line(dialog_->browser_errors, 1); + goTo(0); } + +} // namespace frontend +} // namespace lyx