fix toc bug

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2102 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-06-11 17:20:17 +00:00
parent 5cc00f4bcd
commit 358a19aca8
7 changed files with 32 additions and 12 deletions

View File

@ -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

View File

@ -1,3 +1,7 @@
2001-06-11 Lars Gullik Bjønnes <larsbj@birdstep.com>
* Makefile.am: make the dependencies work for the sub libs.
2001-05-31 Lars Gullik Bjønnes <larsbj@birdstep.com>
* Makefile.am (libfrontends_la_LIBADD): new var, add all subdirs

View File

@ -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 \

View File

@ -1,3 +1,8 @@
2001-06-11 Lars Gullik Bjønnes <larsbj@birdstep.com>
* ControlToc.C (getContents): don't add anything to the list if it
is supposed to be empty.
2001-06-01 Angus Leeming <a.leeming@ic.ac.uk>
* helper_funcs.C (getVectorFromString): bug fix.

View File

@ -64,15 +64,11 @@ vector<string> 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;

View File

@ -1,3 +1,8 @@
2001-06-11 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormToc.C (input): change test slightly.
(updateContents): clear list if empty and add no list msg.
2001-05-30 Angus Leeming <a.leeming@ic.ac.uk>
* FormParagraph.C (update, general_update): enabling the align buttons

View File

@ -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<ControlToc, FormDB<FD_form_toc> > 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;