X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetListings.h;h=902fa0437e64009770293859e2540322c3b53fd9;hb=239b9919ffe28338d789e6dc9122228f77ab77a7;hp=8fb21957d0f26323cec47c860460144f13a6c3ed;hpb=601a8e0192b60274ab316c0bfa31811d236c972e;p=lyx.git diff --git a/src/insets/InsetListings.h b/src/insets/InsetListings.h index 8fb21957d0..902fa0437e 100644 --- a/src/insets/InsetListings.h +++ b/src/insets/InsetListings.h @@ -9,99 +9,81 @@ * Full author contact details are available in file CREDITS. */ -#ifndef INSETLISTINGS_H -#define INSETLISTINGS_H +#ifndef INSET_LISTINGS_H +#define INSET_LISTINGS_H -#include "LaTeXFeatures.h" -#include "InsetERT.h" #include "InsetListingsParams.h" -#include "MailInset.h" namespace lyx { -/** A collapsable text inset for program listings. - */ +class LaTeXFeatures; +struct TexString; +///////////////////////////////////////////////////////////////////////// +// +// InsetListings +// +///////////////////////////////////////////////////////////////////////// -class InsetListings : public InsetERT { +/// A captionable and collapsable text inset for program listings. +class InsetListings : public InsetCaptionable +{ public: /// - InsetListings(BufferParams const &, InsetListingsParams const & par = InsetListingsParams()); + InsetListings(Buffer *, InsetListingsParams const & par = InsetListingsParams()); /// ~InsetListings(); /// - Inset::Code lyxCode() const { return Inset::LISTINGS_CODE; } - /// lstinline is inlined, normal listing is displayed - virtual DisplayType display() const; + static void string2params(std::string const &, InsetListingsParams &); /// - docstring name() const { return from_ascii("Listings"); } - // Update the counters of this inset and of its contents - virtual void updateLabels(Buffer const &, ParIterator const &); + static std::string params2string(InsetListingsParams const &); +private: /// - void write(Buffer const & buf, std::ostream & os) const; + bool isLabeled() const { return true; } + /// false is needed since listings do their own font handling. + bool inheritFont() const { return false; } /// - void read(Buffer const & buf, Lexer & lex); + InsetCode lyxCode() const { return LISTINGS_CODE; } + /// lstinline is inlined, normal listing is displayed + DisplayType display() const; /// - virtual docstring const editMessage() const; + docstring layoutName() const { return from_ascii("Listings"); } /// - int latex(Buffer const &, odocstream &, OutputParams const &) const; + void write(std::ostream & os) const; /// - void validate(LaTeXFeatures &) const; + void read(Lexer & lex); /// - bool metrics(MetricsInfo &, Dimension &) const; + void latex(otexstream &, OutputParams const &) const; /// - void draw(PainterInfo & pi, int x, int y) const; + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// - bool showInsetDialog(BufferView *) const; + void validate(LaTeXFeatures &) const; /// - void getDrawFont(Font &) const; + bool showInsetDialog(BufferView *) const; /// InsetListingsParams const & params() const { return params_; } /// InsetListingsParams & params() { return params_; } -protected: - InsetListings(InsetListings const &); /// - virtual void doDispatch(Cursor & cur, FuncRequest & cmd); + std::string contextMenuName() const; + /// + void doDispatch(Cursor & cur, FuncRequest & cmd); /// bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const; -private: - virtual std::auto_ptr doClone() const; /// - void init(); + Inset * clone() const { return new InsetListings(*this); } /// - void setButtonLabel(); + docstring const buttonLabel(BufferView const & bv) const; /// - docstring getCaption(Buffer const &, OutputParams const &) const; + TexString getCaption(OutputParams const &) const; /// - InsetListingsParams params_; -}; + bool insetAllowed(InsetCode c) const { return c == CAPTION_CODE || c == QUOTE_CODE; } - -class InsetListingsMailer : public MailInset { -public: - /// - InsetListingsMailer(InsetListings & inset); - /// - virtual Inset & inset() const { return inset_; } - /// - virtual std::string const & name() const { return name_; } - /// - virtual std::string const inset2string(Buffer const &) const; /// - static void string2params(std::string const &, - InsetListingsParams &); - /// - static std::string const params2string(InsetListingsParams const &); -private: - /// - static std::string const name_; - /// - InsetListings & inset_; + InsetListingsParams params_; }; - } // namespace lyx -#endif +#endif // INSET_LISTINGS_H