minimal, so not ideal. But I think it will do !

thanks
john

-- 
"All this just amounts to more grist for the mill of the ill."
        - Elizabeth Wurtzel
Index: src/frontends/controllers/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v
retrieving revision 1.102
diff -u -r1.102 ChangeLog
--- src/frontends/controllers/ChangeLog 2001/10/23 16:32:16     1.102
+++ src/frontends/controllers/ChangeLog 2001/11/04 01:23:04
@@ -1,3 +1,7 @@
+2001-11-04  John Levon  <[EMAIL PROTECTED]>
+
+       * ControlToc.C: changes for floatlist
+ 
 2001-10-23  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
        * ControlSpellchecker.C: include <sys/types.h> since FreeBSD needs
Index: src/frontends/controllers/ControlToc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlToc.C,v
retrieving revision 1.10
diff -u -r1.10 ControlToc.C
--- src/frontends/controllers/ControlToc.C      2001/07/16 15:42:56     1.10
+++ src/frontends/controllers/ControlToc.C      2001/11/04 01:23:05
@@ -89,14 +89,13 @@
 
 string const getType(string const & cmdName)
 {
-       string type;
+       string type = cmdName;
 
-       // It would be nice to have a map to extract this info.
-       // Does one already exist, Lars?
-       if (cmdName == "tableofcontents" )
+       // special case
+       if (cmdName == "tableofcontents")
                type = "TOC";
 
-       return cmdName;
+       return type;
 }
  
 } // namespace toc 
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.192
diff -u -r1.192 ChangeLog
--- src/frontends/xforms/ChangeLog      2001/10/24 15:07:39     1.192
+++ src/frontends/xforms/ChangeLog      2001/11/04 01:23:11
@@ -1,3 +1,7 @@
+2001-11-04  John Levon  <[EMAIL PROTECTED]>
+
+       * FormToc.C: fixes to make floatlists work
+ 
 2001-10-24  Juergen Vigna  <[EMAIL PROTECTED]>
 
        * FormTabular.C: changed calls for footer/headers of longtabulars.
Index: src/frontends/xforms/FormToc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormToc.C,v
retrieving revision 1.28
diff -u -r1.28 FormToc.C
--- src/frontends/xforms/FormToc.C      2001/07/29 11:57:09     1.28
+++ src/frontends/xforms/FormToc.C      2001/11/04 01:23:16
@@ -73,8 +73,7 @@
 {
        // Update the choice list from scratch
        fl_clear_choice(dialog_->choice_toc_type);
-       string const choice =
-               " " + getStringFromVector(controller().getTypes(), " | ") + " ";
+       string const choice = getStringFromVector(controller().getTypes(), "|");
        fl_addto_choice(dialog_->choice_toc_type, choice.c_str());
 
        // And select the correct one
diff -u -r1.216 ChangeLog
--- src/insets/ChangeLog        2001/11/02 16:18:07     1.216
+++ src/insets/ChangeLog        2001/11/04 01:23:25
@@ -1,3 +1,9 @@
+2001-11-04  John Levon  <[EMAIL PROTECTED]>
+
+       * insetfloatlist.h:
+       * insetfloatlist.C: derive from InsetCommand so gui can use it
+         easily
+ 
 2001-11-02  Dekel Tsur  <[EMAIL PROTECTED]>
 
        * insetexternal.C (updateExternal): Do not run update command if
Index: src/insets/insetfloatlist.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetfloatlist.C,v
retrieving revision 1.10
diff -u -r1.10 insetfloatlist.C
--- src/insets/insetfloatlist.C 2001/09/20 10:16:24     1.10
+++ src/insets/insetfloatlist.C 2001/11/04 01:23:25
@@ -6,15 +6,31 @@
 
 #include "insetfloatlist.h"
 #include "FloatList.h"
+#include "frontends/Dialogs.h"
+#include "LyXView.h"
+#include "BufferView.h"
 #include "buffer.h"
 #include "gettext.h"
 #include "debug.h"
 
 using std::endl;
 
+InsetFloatList::InsetFloatList()
+       : InsetCommand(InsetCommandParams())
+{
+}
+
+ 
+InsetFloatList::InsetFloatList(string const & type)
+       : InsetCommand(InsetCommandParams())
+{
+       setCmdName(type);
+}
+
+
 string const InsetFloatList::getScreenLabel(Buffer const *) const 
 {
-       string const guiName = floatList[float_type]->second.name();
+       string const guiName = floatList[getCmdName()]->second.name();
        if (!guiName.empty()) {
                string const res = guiName + _(" List");
                return res;
@@ -31,7 +47,7 @@
 
 void InsetFloatList::write(Buffer const *, std::ostream & os) const
 {
-       os << "FloatList " << float_type << "\n";
+       os << "FloatList " << getCmdName() << "\n";
 }
 
 
@@ -40,8 +56,8 @@
        string token;
 
        if (lex.eatLine()) {
-               float_type = lex.getString();
-               lyxerr << "FloatList::float_type: " << float_type << endl;
+               setCmdName(lex.getString());
+               lyxerr << "FloatList::float_type: " << getCmdName() << endl;
        } else
                lex.printError("InsetFloatList: Parse error: `$$Token'");
        while (lex.isOK()) {
@@ -57,12 +73,9 @@
 }
 
 
-void InsetFloatList::edit(BufferView *, int, int, unsigned int)
+void InsetFloatList::edit(BufferView * bv, int, int, unsigned int)
 {
-       // FIX: Implement me please.
-#if 0
-       bv->owner()->getDialogs()->showFloatList(this);
-#endif
+       bv->owner()->getDialogs()->showTOC(this);
 }
 
 
@@ -74,9 +87,8 @@
 
 int InsetFloatList::latex(Buffer const *, std::ostream & os, bool, bool) const
 {
-       FloatList::const_iterator cit = floatList[float_type];
+       FloatList::const_iterator cit = floatList[getCmdName()];
 
-       
        if (cit != floatList.end()) {
                if (cit->second.builtin()) {
                        // Only two different types allowed here:
@@ -89,11 +101,11 @@
                                os << "%% unknown builtin float\n";
                        }
                } else {
-                       os << "\\listof{" << float_type << "}{"
+                       os << "\\listof{" << getCmdName() << "}{"
                           << _("List of ") << cit->second.name() << "}\n";
                }
        } else {
-               os << "%%\\listof{" << float_type << "}{"
+               os << "%%\\listof{" << getCmdName() << "}{"
                   << _("List of ") << cit->second.name() << "}\n";
        }
        return 1;
@@ -106,7 +118,7 @@
 
        Buffer::Lists const toc_list = buffer->getLists();
        Buffer::Lists::const_iterator cit =
-               toc_list.find(float_type);
+               toc_list.find(getCmdName());
        if (cit != toc_list.end()) {
                Buffer::SingleList::const_iterator ccit = cit->second.begin();
                Buffer::SingleList::const_iterator end = cit->second.end();
Index: src/insets/insetfloatlist.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetfloatlist.h,v
retrieving revision 1.8
diff -u -r1.8 insetfloatlist.h
--- src/insets/insetfloatlist.h 2001/09/04 11:02:06     1.8
+++ src/insets/insetfloatlist.h 2001/11/04 01:23:25
@@ -16,20 +16,19 @@
 #pragma interface
 #endif
 
-#include "insetbutton.h"
+#include "insetcommand.h"
 
 /** Used to insert table of contents
  */
-class InsetFloatList : public InsetButton {
+class InsetFloatList : public InsetCommand {
 public:
        ///
-       InsetFloatList() {}
+       InsetFloatList();
        ///
-       InsetFloatList(string const & type) 
-               : float_type(type) {}
+       InsetFloatList(string const & type);
        ///
        Inset * clone(Buffer const &, bool = false) const {
-               return new InsetFloatList(*this);
+               return new InsetFloatList(getCmdName());
        }
        ///
        string const getScreenLabel(Buffer const *) const;
@@ -55,8 +54,6 @@
        int docbook(Buffer const *, std::ostream &) const { return 0; }
        ///
        int ascii(Buffer const *, std::ostream &, int linelen) const;
-private:
-       string float_type;
 };
 
 #endif

Reply via email to