]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetfloatlist.C
Enable convertDefault.sh to run even if its executable bit is not set.
[lyx.git] / src / insets / insetfloatlist.C
index c6075d5a98a9d76b7377ecc1b7b2f431a163df16..72289b435c5df1a19ec6b8d04914cb61a4d26e6b 100644 (file)
@@ -5,13 +5,14 @@
  *
  * \author Lars Gullik Bjønnes
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
 #include "insetfloatlist.h"
 #include "FloatList.h"
+#include "metricsinfo.h"
 #include "LaTeXFeatures.h"
 #include "lyxlex.h"
 #include "BufferView.h"
@@ -24,6 +25,8 @@
 
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 
@@ -47,9 +50,9 @@ InsetFloatList::~InsetFloatList()
 }
 
 
-string const InsetFloatList::getScreenLabel(Buffer const * buf) const
+string const InsetFloatList::getScreenLabel(Buffer const & buf) const
 {
-       FloatList const & floats = buf->params.getLyXTextClass().floats();
+       FloatList const & floats = buf.params.getLyXTextClass().floats();
        FloatList::const_iterator it = floats[getCmdName()];
        if (it != floats.end())
                return _(it->second.listName());
@@ -58,21 +61,21 @@ string const InsetFloatList::getScreenLabel(Buffer const * buf) const
 }
 
 
-Inset::Code InsetFloatList::lyxCode() const
+InsetOld::Code InsetFloatList::lyxCode() const
 {
-       return Inset::FLOAT_LIST_CODE;
+       return InsetOld::FLOAT_LIST_CODE;
 }
 
 
-void InsetFloatList::write(Buffer const *, ostream & os) const
+void InsetFloatList::write(Buffer const &, ostream & os) const
 {
        os << "FloatList " << getCmdName() << "\n";
 }
 
 
-void InsetFloatList::read(Buffer const * buf, LyXLex & lex)
+void InsetFloatList::read(Buffer const & buf, LyXLex & lex)
 {
-       FloatList const & floats = buf->params.getLyXTextClass().floats();
+       FloatList const & floats = buf.params.getLyXTextClass().floats();
        string token;
 
        if (lex.eatLine()) {
@@ -95,6 +98,21 @@ void InsetFloatList::read(Buffer const * buf, LyXLex & lex)
 }
 
 
+void InsetFloatList::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+       InsetCommand::metrics(mi, dim);
+       center_indent_ = (mi.base.textwidth - dim.wid) / 2;
+       dim.wid = mi.base.textwidth;
+       dim_ = dim;
+}
+
+
+void InsetFloatList::draw(PainterInfo & pi, int x, int y) const
+{
+       InsetCommand::draw(pi, x + center_indent_, y);
+}
+
+
 dispatch_result InsetFloatList::localDispatch(FuncRequest const & cmd)
 {
        switch (cmd.action) {
@@ -107,10 +125,10 @@ dispatch_result InsetFloatList::localDispatch(FuncRequest const & cmd)
 }
 
 
-int InsetFloatList::latex(Buffer const * buf, ostream & os, LatexRunParams const &,
-                         bool, bool) const
+int InsetFloatList::latex(Buffer const & buf, ostream & os,
+                         LatexRunParams const &) const
 {
-       FloatList const & floats = buf->params.getLyXTextClass().floats();
+       FloatList const & floats = buf.params.getLyXTextClass().floats();
        FloatList::const_iterator cit = floats[getCmdName()];
 
        if (cit != floats.end()) {
@@ -137,11 +155,11 @@ int InsetFloatList::latex(Buffer const * buf, ostream & os, LatexRunParams const
 }
 
 
-int InsetFloatList::ascii(Buffer const * buffer, ostream & os, int) const
+int InsetFloatList::ascii(Buffer const & buffer, ostream & os, int) const
 {
        os << getScreenLabel(buffer) << "\n\n";
 
-       toc::asciiTocList(getCmdName(), buffer, os);
+       lyx::toc::asciiTocList(getCmdName(), buffer, os);
 
        os << "\n";
        return 0;