#include "InsetListings.h"
#include "InsetCaption.h"
+#include "Buffer.h"
+#include "BufferParams.h"
+#include "Counters.h"
#include "Language.h"
#include "gettext.h"
#include "DispatchResult.h"
using support::contains;
using support::subst;
-using std::auto_ptr;
using std::istringstream;
using std::ostream;
using std::ostringstream;
using std::string;
-char const lstinline_delimiters[] = "!*()-=+|;:'\"`,<.>/?QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm";
+char const lstinline_delimiters[] =
+ "!*()-=+|;:'\"`,<.>/?QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm";
void InsetListings::init()
{
font.decSize();
font.setColor(Color::none);
setLabelFont(font);
- text_.current_font.setLanguage(latex_language);
- text_.real_current_font.setLanguage(latex_language);
+ // FIXME: what to do with those?
+ //text_.current_font.setLanguage(latex_language);
+ //text_.real_current_font.setLanguage(latex_language);
}
}
-auto_ptr<Inset> InsetListings::doClone() const
+Inset * InsetListings::clone() const
{
- return auto_ptr<Inset>(new InsetListings(*this));
+ return new InsetListings(*this);
}
}
+void InsetListings::updateLabels(Buffer const & buf, ParIterator const & it)
+{
+ Counters & cnts = buf.params().getTextClass().counters();
+ string const saveflt = cnts.current_float();
+
+ // Tell to captions what the current float is
+ cnts.current_float("listing");
+
+ InsetCollapsable::updateLabels(buf, it);
+
+ //reset afterwards
+ cnts.current_float(saveflt);
+}
+
+
void InsetListings::write(Buffer const & buf, ostream & os) const
{
os << "listings" << "\n";
}
-bool InsetListings::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetListings::metrics(MetricsInfo & mi, Dimension & dim) const
{
Font tmpfont = mi.base.font;
getDrawFont(mi.base.font);
mi.base.font.realize(tmpfont);
InsetCollapsable::metrics(mi, dim);
mi.base.font = tmpfont;
- bool const changed = dim_ != dim;
- dim_ = dim;
- return changed;
}