]> git.lyx.org Git - features.git/commitdiff
fix toc bug
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 11 Jun 2001 17:20:17 +0000 (17:20 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 11 Jun 2001 17:20:17 +0000 (17:20 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2102 a592a061-630c-0410-9148-cb99ea01b6c8

po/POTFILES.in
src/frontends/ChangeLog
src/frontends/Makefile.am
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlToc.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormToc.C

index 04b1702eba515a409336ddf63aeb0bf7a4422ead..53c323e68cbdc6e5eaf0f6424b13199f2eae1389 100644 (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
index 405537d7f740f5ec8ce598bb9a3ac90882b794b3..127c096ba7986ad534017d5b7911db9e5a92d5a9 100644 (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
index 011562e3184928568a8141b1bcef95398d5e66bf..808367f678094abd4cf02a7eba60c9be28eff6ae 100644 (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 \
index fb09eee6a021a53cc3d24196c6d1dc824f0529e6..5f2681a4975f992172974ab1edf651f3ef1229c0 100644 (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.
index 855c13d7ea2c220987df32d5f8b694038e64e489..235d043c9d1e4d52cc705c930bd2f63d3ec01ce8 100644 (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;
index 94d3e8ca235ac1099a6e905fb9932246b371193f..f73a0e10ba00bdc0305fb04443b3867d7dc90626 100644 (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
index 2971305078bf91a8a11482088739722ddedba0f9..8691bfa3b2986fb4a3f40493acb27dc75d7dfa84 100644 (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;