From: Lars Gullik Bjønnes Date: Mon, 11 Jun 2001 17:20:17 +0000 (+0000) Subject: fix toc bug X-Git-Tag: 1.6.10~21195 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=358a19aca826ef7f09a64fbef19887f448e4efc7;p=features.git fix toc bug git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2102 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/po/POTFILES.in b/po/POTFILES.in index 04b1702eba..53c323e68c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -24,7 +24,6 @@ src/frontends/controllers/ControlInclude.C src/frontends/controllers/ControlPreamble.C src/frontends/controllers/ControlPrint.C src/frontends/controllers/ControlSearch.C -src/frontends/controllers/ControlToc.C src/frontends/controllers/helper_funcs.C src/frontends/gnome/FormCitation.C src/frontends/gnome/FormIndex.C diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 405537d7f7..127c096ba7 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,7 @@ +2001-06-11 Lars Gullik Bjønnes + + * Makefile.am: make the dependencies work for the sub libs. + 2001-05-31 Lars Gullik Bjønnes * Makefile.am (libfrontends_la_LIBADD): new var, add all subdirs diff --git a/src/frontends/Makefile.am b/src/frontends/Makefile.am index 011562e318..808367f678 100644 --- a/src/frontends/Makefile.am +++ b/src/frontends/Makefile.am @@ -15,6 +15,10 @@ libfrontends_la_LIBADD= @FRONTEND_GUILIB@ \ support/libfrontendsupport.la \ controllers/libcontrollers.la +libfrontends_la_DEPENDENCIES = @FRONTEND_GUILIB@ \ + support/libfrontendsupport.la \ + controllers/libcontrollers.la + libfrontends_la_SOURCES=\ Dialogs.C \ Dialogs.h \ diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index fb09eee6a0..5f2681a497 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,8 @@ +2001-06-11 Lars Gullik Bjønnes + + * ControlToc.C (getContents): don't add anything to the list if it + is supposed to be empty. + 2001-06-01 Angus Leeming * helper_funcs.C (getVectorFromString): bug fix. diff --git a/src/frontends/controllers/ControlToc.C b/src/frontends/controllers/ControlToc.C index 855c13d7ea..235d043c9d 100644 --- a/src/frontends/controllers/ControlToc.C +++ b/src/frontends/controllers/ControlToc.C @@ -64,15 +64,11 @@ vector const ControlToc::getTypes() const Buffer::SingleList const ControlToc::getContents(string const & type) const { - Buffer::SingleList contents; - - Buffer::TocItem noContent(0, 0, string()); + Buffer::SingleList empty_list; // This shouldn't be possible... if (!lv_.view()->available()) { - noContent.str = _("*** No Document ***"); - contents.push_back(noContent); - return contents; + return empty_list; } Buffer::Lists tmp = lv_.view()->buffer()->getLists(); @@ -80,9 +76,7 @@ Buffer::SingleList const ControlToc::getContents(string const & type) const Buffer::Lists::iterator it = tmp.find(type); if (it == tmp.end()) { - noContent.str = _("*** No Lists ***"); - contents.push_back(noContent); - return contents; + return empty_list; } return it->second; diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 94d3e8ca23..f73a0e10ba 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2001-06-11 Lars Gullik Bjønnes + + * FormToc.C (input): change test slightly. + (updateContents): clear list if empty and add no list msg. + 2001-05-30 Angus Leeming * FormParagraph.C (update, general_update): enabling the align buttons diff --git a/src/frontends/xforms/FormToc.C b/src/frontends/xforms/FormToc.C index 2971305078..8691bfa3b2 100644 --- a/src/frontends/xforms/FormToc.C +++ b/src/frontends/xforms/FormToc.C @@ -24,6 +24,8 @@ #include "form_toc.h" #include "helper_funcs.h" // getStringFromVector #include "support/lstrings.h" // frontStrip, strip +#include "debug.h" +#include "gettext.h" typedef FormCB > base_class; @@ -58,8 +60,9 @@ ButtonPolicy::SMInput FormToc::input(FL_OBJECT *, long) updateContents(); unsigned int const choice = fl_get_browser( dialog_->browser_toc ); - if (0 < choice && choice - 1 < toclist_.size()) { - controller().Goto(toclist_[choice-1].par->id()); + + if (choice - 1 < toclist_.size() && choice >= 1) { + controller().Goto(toclist_[choice - 1].par->id()); } return ButtonPolicy::SMI_VALID; @@ -91,6 +94,12 @@ void FormToc::updateContents() Buffer::SingleList const contents = controller().getContents(type); + if (contents.empty()) { + fl_clear_browser(dialog_->browser_toc); + fl_add_browser_line(dialog_->browser_toc, + _("*** No Lists ***")); + } + // Check if all elements are the same. if (toclist_ == contents) { return;