X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetListings.cpp;h=0c6b472da86d171f4f73db9d0686dc52fcaa8fb2;hb=237c132c1e6fc720b87f2fea6deb18a8395cbe0a;hp=e3f10b3f763ed1c1d6276dab18c397f4bbe62a11;hpb=5ae54ddafb0f8a9dd1a71d7a26549b31b6516e14;p=lyx.git diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index e3f10b3f76..0c6b472da8 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -14,6 +14,9 @@ #include "InsetListings.h" #include "InsetCaption.h" +#include "Buffer.h" +#include "BufferParams.h" +#include "Counters.h" #include "Language.h" #include "gettext.h" #include "DispatchResult.h" @@ -31,13 +34,13 @@ using support::token; 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() { @@ -47,8 +50,9 @@ 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); } @@ -66,9 +70,9 @@ InsetListings::InsetListings(InsetListings const & in) } -auto_ptr InsetListings::doClone() const +Inset * InsetListings::clone() const { - return auto_ptr(new InsetListings(*this)); + return new InsetListings(*this); } @@ -84,6 +88,21 @@ Inset::DisplayType InsetListings::display() const } +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"; @@ -250,16 +269,13 @@ void InsetListings::setButtonLabel() } -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; }