X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetListings.h;h=d307126fe7fecbdd3c8098385ee3bb28a6cfdc73;hb=5eb7add4092708a5a0dbabf303164be624aff72f;hp=8fb21957d0f26323cec47c860460144f13a6c3ed;hpb=601a8e0192b60274ab316c0bfa31811d236c972e;p=lyx.git diff --git a/src/insets/InsetListings.h b/src/insets/InsetListings.h index 8fb21957d0..d307126fe7 100644 --- a/src/insets/InsetListings.h +++ b/src/insets/InsetListings.h @@ -9,99 +9,82 @@ * 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; +///////////////////////////////////////////////////////////////////////// +// +// InsetListings +// +///////////////////////////////////////////////////////////////////////// -class InsetListings : public InsetERT { +/// A collapsable text inset for program listings. +class InsetListings : public InsetCollapsable +{ public: /// - InsetListings(BufferParams const &, InsetListingsParams const & par = InsetListingsParams()); + InsetListings(Buffer *, InsetListingsParams const & par = InsetListingsParams()); /// ~InsetListings(); /// - Inset::Code lyxCode() const { return Inset::LISTINGS_CODE; } + static void string2params(std::string const &, InsetListingsParams &); + /// + static std::string params2string(InsetListingsParams const &); +private: + /// + bool isLabeled() const { return true; } + /// + bool noFontChange() const { return true; } + /// + InsetCode lyxCode() const { return LISTINGS_CODE; } /// lstinline is inlined, normal listing is displayed - virtual DisplayType display() const; + DisplayType display() const; /// docstring name() const { return from_ascii("Listings"); } // Update the counters of this inset and of its contents - virtual void updateLabels(Buffer const &, ParIterator const &); + void updateBuffer(ParIterator const &, UpdateType); /// - void write(Buffer const & buf, std::ostream & os) const; + void write(std::ostream & os) const; /// - void read(Buffer const & buf, Lexer & lex); + void read(Lexer & lex); /// - virtual docstring const editMessage() const; + int latex(odocstream &, OutputParams const &) const; /// - int latex(Buffer const &, odocstream &, OutputParams const &) const; + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// void validate(LaTeXFeatures &) const; /// - bool metrics(MetricsInfo &, Dimension &) const; - /// - void draw(PainterInfo & pi, int x, int y) const; - /// bool showInsetDialog(BufferView *) const; /// - void getDrawFont(Font &) const; - /// InsetListingsParams const & params() const { return params_; } /// InsetListingsParams & params() { return params_; } -protected: - InsetListings(InsetListings const &); /// - virtual void doDispatch(Cursor & cur, FuncRequest & cmd); + docstring contextMenu(BufferView const & bv, int x, int y) 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; + docstring getCaption(OutputParams const &) const; /// - InsetListingsParams params_; -}; + bool insetAllowed(InsetCode c) const { return c == CAPTION_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