make code look a bit more uniform

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23468 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-03-05 00:21:05 +00:00
parent 7108582cbf
commit 75999ba650
48 changed files with 150 additions and 506 deletions

View File

@ -478,10 +478,6 @@ endif
noinst_LTLIBRARIES += liblyxinsets.la noinst_LTLIBRARIES += liblyxinsets.la
EXTRA_DIST += \
insets/InsetTheorem.cpp \
insets/InsetTheorem.h
SOURCEFILESINSETS = \ SOURCEFILESINSETS = \
insets/MailInset.cpp \ insets/MailInset.cpp \
insets/ExternalSupport.cpp \ insets/ExternalSupport.cpp \
@ -595,9 +591,7 @@ HEADERFILESINSETS = \
# insets/InsetList.cpp \ # insets/InsetList.cpp \
# insets/InsetList.h \ # insets/InsetList.h \
# insets/InsetSection.h \ # insets/InsetSection.h \
# insets/InsetSection.cpp \ # insets/InsetSection.cpp
# insets/InsetTheorem.cpp \
# insets/InsetTheorem.h
lyxinsets.cpp: lyxinsets.cpp:
@echo -e '$(SOURCEFILESINSETS:%=\n#include "%")\n' > $@ @echo -e '$(SOURCEFILESINSETS:%=\n#include "%")\n' > $@

View File

@ -211,10 +211,6 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
case LFUN_INFO_INSERT: case LFUN_INFO_INSERT:
return new InsetInfo(buf, to_utf8(cmd.argument())); return new InsetInfo(buf, to_utf8(cmd.argument()));
#if 0
case LFUN_THEOREM_INSERT:
return new InsetTheorem;
#endif
case LFUN_INSET_INSERT: { case LFUN_INSET_INSERT: {
string const name = cmd.getArg(0); string const name = cmd.getArg(0);

View File

@ -36,7 +36,6 @@
#include "support/Path.h" #include "support/Path.h"
#include "support/textutils.h" #include "support/textutils.h"
#include <boost/tokenizer.hpp>
#include <limits> #include <limits>
using namespace std; using namespace std;
@ -66,12 +65,6 @@ ParamInfo const & InsetBibtex::findInfo(string const & /* cmdName */)
} }
Inset * InsetBibtex::clone() const
{
return new InsetBibtex(*this);
}
void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd) void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd)
{ {
switch (cmd.action) { switch (cmd.action) {

View File

@ -54,16 +54,15 @@ public:
/// ///
static bool isCompatibleCommand(std::string const & s) static bool isCompatibleCommand(std::string const & s)
{ return s == "bibtex"; } { return s == "bibtex"; }
private:
/// ///
void registerEmbeddedFiles(EmbeddedFileList &) const; void registerEmbeddedFiles(EmbeddedFileList &) const;
/// ///
void updateEmbeddedFile(EmbeddedFile const & file); void updateEmbeddedFile(EmbeddedFile const & file);
protected:
/// ///
void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
/// ///
Inset * clone() const; Inset * clone() const { return new InsetBibtex(*this); }
}; };

View File

@ -93,23 +93,12 @@ InsetBox::InsetBox(Buffer const & buffer, string const & label)
} }
InsetBox::InsetBox(InsetBox const & in)
: InsetCollapsable(in), params_(in.params_)
{}
InsetBox::~InsetBox() InsetBox::~InsetBox()
{ {
InsetBoxMailer(*this).hideDialog(); InsetBoxMailer(*this).hideDialog();
} }
Inset * InsetBox::clone() const
{
return new InsetBox(*this);
}
docstring InsetBox::editMessage() const docstring InsetBox::editMessage() const
{ {
return _("Opened Box Inset"); return _("Opened Box Inset");
@ -119,7 +108,7 @@ docstring InsetBox::editMessage() const
docstring InsetBox::name() const docstring InsetBox::name() const
{ {
// FIXME: UNICODE // FIXME: UNICODE
string name = string("Box"); string name = "Box";
if (boxtranslator().find(params_.type) == Shaded) if (boxtranslator().find(params_.type) == Shaded)
name += string(":Shaded"); name += string(":Shaded");
return from_ascii(name); return from_ascii(name);

View File

@ -57,10 +57,25 @@ public:
*/ */
class InsetBox : public InsetCollapsable { class InsetBox : public InsetCollapsable {
public: public:
///
enum BoxType {
Frameless,
Boxed,
Framed,
ovalbox,
Ovalbox,
Shadowbox,
Shaded,
Doublebox
};
/// ///
InsetBox(Buffer const &, std::string const &); InsetBox(Buffer const &, std::string const &);
/// ///
~InsetBox(); ~InsetBox();
private:
///
friend class InsetBoxParams;
friend class InsetBoxMailer;
/// ///
docstring editMessage() const; docstring editMessage() const;
/// ///
@ -82,7 +97,7 @@ public:
//FIXME Is this the one we want? or is it: //FIXME Is this the one we want? or is it:
//allowParagraphCustomization(idx_type)? //allowParagraphCustomization(idx_type)?
/// ///
virtual bool forceEmptyLayout() const; bool forceEmptyLayout() const;
/// ///
bool neverIndent() const { return true; } bool neverIndent() const { return true; }
/// ///
@ -102,28 +117,14 @@ public:
/// ///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
/// ///
enum BoxType { void doDispatch(Cursor & cur, FuncRequest & cmd);
Frameless,
Boxed,
Framed,
ovalbox,
Ovalbox,
Shadowbox,
Shaded,
Doublebox
};
protected:
InsetBox(InsetBox const &);
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
/// Is the width forced to some value? /// Is the width forced to some value?
virtual bool hasFixedWidth() const; bool hasFixedWidth() const;
private: ///
friend class InsetBoxParams; Inset * clone() const { return new InsetBox(*this); }
virtual Inset * clone() const;
/// used by the constructors /// used by the constructors
void init(); void init();
/// ///
InsetBoxParams params_; InsetBoxParams params_;
}; };

View File

@ -47,15 +47,6 @@ using namespace lyx::support;
namespace lyx { namespace lyx {
InsetCaption::InsetCaption(InsetCaption const & ic)
: InsetText(ic)
{
setAutoBreakRows(true);
setDrawFrame(true);
setFrameColor(Color_captionframe);
}
InsetCaption::InsetCaption(Buffer const & buf) InsetCaption::InsetCaption(Buffer const & buf)
: InsetText(buf) : InsetText(buf)
{ {
@ -315,10 +306,4 @@ void InsetCaption::updateLabels(ParIterator const & it)
} }
Inset * InsetCaption::clone() const
{
return new InsetCaption(*this);
}
} // namespace lyx } // namespace lyx

View File

@ -21,65 +21,62 @@ namespace lyx {
class InsetCaption : public InsetText { class InsetCaption : public InsetText {
public: public:
/// ///
InsetCaption(InsetCaption const &);
InsetCaption(Buffer const &); InsetCaption(Buffer const &);
/// ///
virtual ~InsetCaption() {} std::string const & type() const { return type_; }
/// return the mandatory argument (LaTeX format) only
int getArgument(odocstream & os, OutputParams const &) const;
/// return the optional argument(s) only
int getOptArg(odocstream & os, OutputParams const &) const;
private:
/// ///
void write(std::ostream & os) const; void write(std::ostream & os) const;
/// ///
void read(Lexer & lex); void read(Lexer & lex);
/// ///
virtual DisplayType display() const; DisplayType display() const { return AlignCenter; }
/// ///
virtual bool neverIndent() const { return true; } bool neverIndent() const { return true; }
/// ///
virtual InsetCode lyxCode() const; InsetCode lyxCode() const { return CAPTION_CODE; }
/// ///
docstring editMessage() const; docstring editMessage() const;
/// ///
virtual void cursorPos(BufferView const & bv, void cursorPos(BufferView const & bv,
CursorSlice const & sl, bool boundary, int & x, int & y) const; CursorSlice const & sl, bool boundary, int & x, int & y) const;
/// ///
bool descendable() const { return true; } bool descendable() const { return true; }
/// ///
virtual void metrics(MetricsInfo & mi, Dimension & dim) const; void metrics(MetricsInfo & mi, Dimension & dim) const;
/// ///
virtual void draw(PainterInfo & pi, int x, int y) const; void draw(PainterInfo & pi, int x, int y) const;
/// ///
virtual void edit(Cursor & cur, bool front, EntryDirection entry_from); void edit(Cursor & cur, bool front, EntryDirection entry_from);
/// ///
virtual Inset * editXY(Cursor & cur, int x, int y); Inset * editXY(Cursor & cur, int x, int y);
/// ///
bool insetAllowed(InsetCode code) const; bool insetAllowed(InsetCode code) const;
/// ///
virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const; bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
// Update the counters of this inset and of its contents // Update the counters of this inset and of its contents
virtual void updateLabels(ParIterator const &); void updateLabels(ParIterator const &);
/// ///
int latex(odocstream & os, OutputParams const &) const; int latex(odocstream & os, OutputParams const &) const;
/// ///
int plaintext(odocstream & os, OutputParams const & runparams) const; int plaintext(odocstream & os, OutputParams const & runparams) const;
/// ///
int docbook(odocstream & os, OutputParams const & runparams) const; int docbook(odocstream & os, OutputParams const & runparams) const;
/// return the mandatory argument (LaTeX format) only
int getArgument(odocstream & os, OutputParams const &) const;
/// return the optional argument(s) only
int getOptArg(odocstream & os, OutputParams const &) const;
///
std::string const & type() const { return type_; }
/// ///
void setCustomLabel(docstring const & label); void setCustomLabel(docstring const & label);
/// ///
void addToToc(ParConstIterator const &) const; void addToToc(ParConstIterator const &) const;
/// ///
virtual bool forceEmptyLayout() const { return true; } bool forceEmptyLayout() const { return true; }
/// Captions don't accept alignment, spacing, etc. /// Captions don't accept alignment, spacing, etc.
virtual bool allowParagraphCustomization(idx_type) const { return false; } bool allowParagraphCustomization(idx_type) const { return false; }
private:
/// ///
virtual Inset * clone() const; Inset * clone() const { return new InsetCaption(*this); }
/// ///
mutable docstring full_label_; mutable docstring full_label_;
/// ///
@ -93,20 +90,6 @@ private:
}; };
inline
Inset::DisplayType InsetCaption::display() const
{
return AlignCenter;
}
inline
InsetCode InsetCaption::lyxCode() const
{
return CAPTION_CODE;
}
} // namespace lyx } // namespace lyx
#endif #endif

View File

@ -53,12 +53,8 @@ InsetCollapsable::Geometry InsetCollapsable::geometry() const
{ {
switch (decoration()) { switch (decoration()) {
case InsetLayout::Classic: case InsetLayout::Classic:
if (status() == Open) { if (status() == Open)
if (openinlined_) return openinlined_ ? LeftButton : TopButton;
return LeftButton;
else
return TopButton;
} else
return ButtonOnly; return ButtonOnly;
case InsetLayout::Minimalistic: case InsetLayout::Minimalistic:
@ -130,7 +126,7 @@ void InsetCollapsable::setLayout(BufferParams const & bp)
void InsetCollapsable::setLayout(DocumentClass const * const dc) void InsetCollapsable::setLayout(DocumentClass const * const dc)
{ {
if (dc != 0) { if (dc) {
layout_ = &(dc->insetLayout(name())); layout_ = &(dc->insetLayout(name()));
labelstring_ = layout_->labelstring(); labelstring_ = layout_->labelstring();
} else { } else {

View File

@ -20,15 +20,10 @@
#include "Box.h" #include "Box.h"
#include "TextClass.h" #include "TextClass.h"
#include <string>
namespace lyx { namespace lyx {
class CursorSlice; class CursorSlice;
class FontInfo;
class InsetLayout; class InsetLayout;
class Paragraph;
class Text;
namespace frontend { class Painter; } namespace frontend { class Painter; }
@ -137,13 +132,13 @@ public:
/// ///
bool setMouseHover(bool mouse_hover); bool setMouseHover(bool mouse_hover);
/// ///
virtual ColorCode backgroundColor() const {return layout_->bgcolor(); } ColorCode backgroundColor() const { return layout_->bgcolor(); }
/// ///
int latex(odocstream &, OutputParams const &) const; int latex(odocstream &, OutputParams const &) const;
/// ///
void validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;
/// ///
virtual InsetCode lyxCode() const { return COLLAPSABLE_CODE; } InsetCode lyxCode() const { return COLLAPSABLE_CODE; }
/// Allow multiple blanks /// Allow multiple blanks
virtual bool isFreeSpacing() const { return layout_->isFreeSpacing(); } virtual bool isFreeSpacing() const { return layout_->isFreeSpacing(); }
@ -158,7 +153,7 @@ public:
bool undefined() const; bool undefined() const;
protected: protected:
/// ///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
/// ///
void edit(Cursor & cur, bool front, void edit(Cursor & cur, bool front,
EntryDirection entry_from = ENTRY_DIRECTION_IGNORE); EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);

View File

@ -48,17 +48,6 @@ InsetERT::InsetERT(Buffer const & buf, CollapseStatus status)
{} {}
InsetERT::InsetERT(InsetERT const & in)
: InsetCollapsable(in)
{}
Inset * InsetERT::clone() const
{
return new InsetERT(*this);
}
InsetERT::~InsetERT() InsetERT::~InsetERT()
{ {
InsetERTMailer(*this).hideDialog(); InsetERTMailer(*this).hideDialog();

View File

@ -34,13 +34,9 @@ class InsetERT : public InsetCollapsable {
public: public:
/// ///
InsetERT(Buffer const &, CollapseStatus status = Open); InsetERT(Buffer const &, CollapseStatus status = Open);
#if 0
///
InsetERT(BufferParams const &,
Language const *, std::string const & contents, CollapseStatus status);
#endif
/// ///
~InsetERT(); ~InsetERT();
private:
/// ///
InsetCode lyxCode() const { return ERT_CODE; } InsetCode lyxCode() const { return ERT_CODE; }
/// ///
@ -64,20 +60,17 @@ public:
/// ///
bool showInsetDialog(BufferView *) const; bool showInsetDialog(BufferView *) const;
/// ///
virtual bool forceEmptyLayout() const { return true; } bool forceEmptyLayout() const { return true; }
/// ///
virtual bool allowParagraphCustomization(idx_type) const { return false; } bool allowParagraphCustomization(idx_type) const { return false; }
/// should paragraph indendation be omitted in any case? /// should paragraph indendation be omitted in any case?
bool neverIndent() const { return true; } bool neverIndent() const { return true; }
protected:
InsetERT(InsetERT const &);
/// ///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
/// ///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const; bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
///
private: Inset * clone() const { return new InsetERT(*this); }
virtual Inset * clone() const;
/// ///
void setButtonLabel(); void setButtonLabel();
/// ///

View File

@ -35,11 +35,6 @@ InsetEnvironment::InsetEnvironment(Buffer const & buf, docstring const & name)
} }
InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
: InsetText(in), layout_(in.layout_)
{}
void InsetEnvironment::write(ostream & os) const void InsetEnvironment::write(ostream & os) const
{ {
os << "Environment " << to_utf8(name()) << "\n"; os << "Environment " << to_utf8(name()) << "\n";

View File

@ -44,8 +44,6 @@ public:
be closed before generating this inset. This is needed for be closed before generating this inset. This is needed for
insets that may contain several paragraphs */ insets that may contain several paragraphs */
bool noFontChange() const { return true; } bool noFontChange() const { return true; }
protected:
InsetEnvironment(InsetEnvironment const &);
private: private:
/// ///
Inset * clone() const { return new InsetEnvironment(*this); } Inset * clone() const { return new InsetEnvironment(*this); }

View File

@ -418,12 +418,6 @@ InsetExternal::InsetExternal(InsetExternal const & other)
{} {}
Inset * InsetExternal::clone() const
{
return new InsetExternal(*this);
}
InsetExternal::~InsetExternal() InsetExternal::~InsetExternal()
{ {
InsetExternalMailer(*this).hideDialog(); InsetExternalMailer(*this).hideDialog();

View File

@ -155,7 +155,8 @@ protected:
/// ///
void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
private: private:
Inset * clone() const; ///
Inset * clone() const { return new InsetExternal(*this); }
/** This method is connected to the graphics loader, so we are /** This method is connected to the graphics loader, so we are
* informed when the image has been loaded. * informed when the image has been loaded.

View File

@ -273,9 +273,8 @@ void InsetFloat::read(Lexer & lex)
void InsetFloat::validate(LaTeXFeatures & features) const void InsetFloat::validate(LaTeXFeatures & features) const
{ {
if (support::contains(params_.placement, 'H')) { if (support::contains(params_.placement, 'H'))
features.require("float"); features.require("float");
}
if (params_.sideways) if (params_.sideways)
features.require("rotfloat"); features.require("rotfloat");
@ -288,12 +287,6 @@ void InsetFloat::validate(LaTeXFeatures & features) const
} }
Inset * InsetFloat::clone() const
{
return new InsetFloat(*this);
}
docstring InsetFloat::editMessage() const docstring InsetFloat::editMessage() const
{ {
return _("Opened Float Inset"); return _("Opened Float Inset");

View File

@ -86,15 +86,15 @@ public:
bool showInsetDialog(BufferView *) const; bool showInsetDialog(BufferView *) const;
/// ///
InsetFloatParams const & params() const { return params_; } InsetFloatParams const & params() const { return params_; }
private:
/// ///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
// Update the counters of this inset and of its contents // Update the counters of this inset and of its contents
void updateLabels(ParIterator const &); void updateLabels(ParIterator const &);
protected:
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
/// ///
virtual Inset * clone() const; void doDispatch(Cursor & cur, FuncRequest & cmd);
///
Inset * clone() const { return new InsetFloat(*this); }
/// ///
docstring getCaption(OutputParams const &) const; docstring getCaption(OutputParams const &) const;
/// ///

View File

@ -40,11 +40,6 @@ InsetFoot::InsetFoot(Buffer const & buf)
{} {}
InsetFoot::InsetFoot(InsetFoot const & in)
: InsetFootlike(in)
{}
docstring InsetFoot::editMessage() const docstring InsetFoot::editMessage() const
{ {
return _("Opened Footnote Inset"); return _("Opened Footnote Inset");

View File

@ -21,10 +21,12 @@ namespace lyx {
/** The footnote inset /** The footnote inset
*/ */
class InsetFoot : public InsetFootlike { class InsetFoot : public InsetFootlike
{
public: public:
/// ///
InsetFoot(Buffer const &); InsetFoot(Buffer const &);
private:
/// ///
InsetCode lyxCode() const { return FOOT_CODE; } InsetCode lyxCode() const { return FOOT_CODE; }
/// ///
@ -41,10 +43,7 @@ public:
void updateLabels(ParIterator const &); void updateLabels(ParIterator const &);
/// ///
void addToToc(ParConstIterator const &) const; void addToToc(ParConstIterator const &) const;
///
protected:
InsetFoot(InsetFoot const &);
private:
Inset * clone() const { return new InsetFoot(*this); } Inset * clone() const { return new InsetFoot(*this); }
}; };

View File

@ -29,11 +29,6 @@ InsetFootlike::InsetFootlike(Buffer const & buf)
{} {}
InsetFootlike::InsetFootlike(InsetFootlike const & in)
: InsetCollapsable(in)
{}
void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
FontInfo tmpfont = mi.base.font; FontInfo tmpfont = mi.base.font;

View File

@ -24,8 +24,7 @@ class InsetFootlike : public InsetCollapsable {
public: public:
/// ///
InsetFootlike(Buffer const &); InsetFootlike(Buffer const &);
/// private:
InsetFootlike(InsetFootlike const &);
/// ///
void metrics(MetricsInfo &, Dimension &) const; void metrics(MetricsInfo &, Dimension &) const;
/// ///

View File

@ -37,12 +37,6 @@ ParamInfo const & InsetHFill::findInfo(string const & /* cmdName */)
} }
Inset * InsetHFill::clone() const
{
return new InsetHFill;
}
void InsetHFill::metrics(MetricsInfo &, Dimension & dim) const void InsetHFill::metrics(MetricsInfo &, Dimension & dim) const
{ {
// The metrics for this inset are calculated externally in // The metrics for this inset are calculated externally in

View File

@ -50,7 +50,7 @@ public:
{ return s == "hfill"; } { return s == "hfill"; }
private: private:
/// ///
virtual Inset * clone() const; Inset * clone() const { return new InsetHFill(*this); }
}; };

View File

@ -250,12 +250,6 @@ void InsetInclude::setParams(InsetCommandParams const & p)
} }
Inset * InsetInclude::clone() const
{
return new InsetInclude(*this);
}
docstring InsetInclude::screenLabel() const docstring InsetInclude::screenLabel() const
{ {
docstring temp; docstring temp;

View File

@ -41,7 +41,7 @@ public:
/// ///
void draw(PainterInfo & pi, int x, int y) const; void draw(PainterInfo & pi, int x, int y) const;
/// ///
virtual DisplayType display() const; DisplayType display() const;
/// ///
InsetCode lyxCode() const { return INCLUDE_CODE; } InsetCode lyxCode() const { return INCLUDE_CODE; }
/** Fills \c list /** Fills \c list
@ -101,7 +101,7 @@ protected:
/// ///
void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
private: private:
Inset * clone() const; Inset * clone() const { return new InsetInclude(*this); }
/** Slot receiving a signal that the external file has changed /** Slot receiving a signal that the external file has changed
* and the preview should be regenerated. * and the preview should be regenerated.

View File

@ -28,17 +28,18 @@ using namespace std;
namespace lyx { namespace lyx {
/////////////////////////////////////////////////////////////////////
//
// InsetIndex
//
///////////////////////////////////////////////////////////////////////
InsetIndex::InsetIndex(Buffer const & buf) InsetIndex::InsetIndex(Buffer const & buf)
: InsetCollapsable(buf) : InsetCollapsable(buf)
{} {}
InsetIndex::InsetIndex(InsetIndex const & in)
: InsetCollapsable(in)
{}
int InsetIndex::docbook(odocstream & os, OutputParams const & runparams) const int InsetIndex::docbook(odocstream & os, OutputParams const & runparams) const
{ {
os << "<indexterm><primary>"; os << "<indexterm><primary>";
@ -48,12 +49,6 @@ int InsetIndex::docbook(odocstream & os, OutputParams const & runparams) const
} }
Inset * InsetIndex::clone() const
{
return new InsetIndex(*this);
}
void InsetIndex::write(ostream & os) const void InsetIndex::write(ostream & os) const
{ {
os << to_utf8(name()) << "\n"; os << to_utf8(name()) << "\n";
@ -73,6 +68,12 @@ void InsetIndex::addToToc(ParConstIterator const & cpit) const
} }
/////////////////////////////////////////////////////////////////////
//
// InsetPrintIndex
//
///////////////////////////////////////////////////////////////////////
InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p) InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
: InsetCommand(p, string()) : InsetCommand(p, string())
{} {}
@ -81,9 +82,8 @@ InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
ParamInfo const & InsetPrintIndex::findInfo(string const & /* cmdName */) ParamInfo const & InsetPrintIndex::findInfo(string const & /* cmdName */)
{ {
static ParamInfo param_info_; static ParamInfo param_info_;
if (param_info_.empty()) { if (param_info_.empty())
param_info_.add("name", ParamInfo::LATEX_REQUIRED); param_info_.add("name", ParamInfo::LATEX_REQUIRED);
}
return param_info_; return param_info_;
} }

View File

@ -19,16 +19,13 @@
namespace lyx { namespace lyx {
class LaTeXFeatures;
/** Used to insert index labels /** Used to insert index labels
*/ */
class InsetIndex : public InsetCollapsable { class InsetIndex : public InsetCollapsable {
public: public:
/// ///
InsetIndex(Buffer const &); InsetIndex(Buffer const &);
/// private:
InsetIndex(InsetIndex const &);
/// ///
EDITABLE editable() const { return IS_EDITABLE; } EDITABLE editable() const { return IS_EDITABLE; }
/// ///
@ -43,9 +40,8 @@ public:
bool neverIndent() const { return true; } bool neverIndent() const { return true; }
/// ///
void addToToc(ParConstIterator const &) const; void addToToc(ParConstIterator const &) const;
private:
/// ///
Inset * clone() const; Inset * clone() const { return new InsetIndex(*this); }
}; };
@ -53,6 +49,15 @@ class InsetPrintIndex : public InsetCommand {
public: public:
/// ///
InsetPrintIndex(InsetCommandParams const &); InsetPrintIndex(InsetCommandParams const &);
///
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "printindex"; };
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "printindex"; }
private:
/// Updates needed features for this inset. /// Updates needed features for this inset.
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
/// ///
@ -64,14 +69,7 @@ public:
/// ///
docstring screenLabel() const; docstring screenLabel() const;
/// ///
static ParamInfo const & findInfo(std::string const &); Inset * clone() const { return new InsetPrintIndex(*this); }
///
static std::string defaultCommand() { return "printindex"; };
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "printindex"; }
private:
Inset * clone() const { return new InsetPrintIndex(params()); }
}; };

View File

@ -46,17 +46,6 @@ InsetListings::InsetListings(Buffer const & buf, InsetListingsParams const & par
{} {}
InsetListings::InsetListings(InsetListings const & in)
: InsetCollapsable(in), params_(in.params_)
{}
Inset * InsetListings::clone() const
{
return new InsetListings(*this);
}
InsetListings::~InsetListings() InsetListings::~InsetListings()
{ {
InsetListingsMailer(*this).hideDialog(); InsetListingsMailer(*this).hideDialog();

View File

@ -33,7 +33,7 @@ public:
/// ///
InsetCode lyxCode() const { return LISTINGS_CODE; } InsetCode lyxCode() const { return LISTINGS_CODE; }
/// lstinline is inlined, normal listing is displayed /// lstinline is inlined, normal listing is displayed
virtual DisplayType display() const; DisplayType display() const;
/// ///
docstring name() const { return from_ascii("Listings"); } docstring name() const { return from_ascii("Listings"); }
// Update the counters of this inset and of its contents // Update the counters of this inset and of its contents
@ -56,14 +56,13 @@ public:
InsetListingsParams const & params() const { return params_; } InsetListingsParams const & params() const { return params_; }
/// ///
InsetListingsParams & params() { return params_; } InsetListingsParams & params() { return params_; }
protected: private:
InsetListings(InsetListings const &);
/// ///
void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
/// ///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const; bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private: ///
virtual Inset * clone() const; Inset * clone() const { return new InsetListings(*this); }
/// ///
void setButtonLabel(); void setButtonLabel();
/// ///

View File

@ -30,17 +30,6 @@ InsetMarginal::InsetMarginal(Buffer const & buf)
{} {}
InsetMarginal::InsetMarginal(InsetMarginal const & in)
: InsetFootlike(in)
{}
Inset * InsetMarginal::clone() const
{
return new InsetMarginal(*this);
}
docstring InsetMarginal::editMessage() const docstring InsetMarginal::editMessage() const
{ {
return _("Opened Marginal Note Inset"); return _("Opened Marginal Note Inset");

View File

@ -40,10 +40,9 @@ public:
docstring editMessage() const; docstring editMessage() const;
/// ///
void addToToc(ParConstIterator const &) const; void addToToc(ParConstIterator const &) const;
protected:
InsetMarginal(InsetMarginal const &);
private: private:
Inset * clone() const; ///
Inset * clone() const { return new InsetMarginal(*this); }
}; };

View File

@ -106,6 +106,12 @@ void InsetNoteParams::read(Lexer & lex)
} }
/////////////////////////////////////////////////////////////////////
//
// InsetNode
//
/////////////////////////////////////////////////////////////////////
InsetNote::InsetNote(Buffer const & buf, string const & label) InsetNote::InsetNote(Buffer const & buf, string const & label)
: InsetCollapsable(buf) : InsetCollapsable(buf)
{ {
@ -113,23 +119,12 @@ InsetNote::InsetNote(Buffer const & buf, string const & label)
} }
InsetNote::InsetNote(InsetNote const & in)
: InsetCollapsable(in), params_(in.params_)
{}
InsetNote::~InsetNote() InsetNote::~InsetNote()
{ {
InsetNoteMailer(*this).hideDialog(); InsetNoteMailer(*this).hideDialog();
} }
Inset * InsetNote::clone() const
{
return new InsetNote(*this);
}
docstring InsetNote::editMessage() const docstring InsetNote::editMessage() const
{ {
return _("Opened Note Inset"); return _("Opened Note Inset");

View File

@ -45,6 +45,9 @@ public:
InsetNote(Buffer const &, std::string const &); InsetNote(Buffer const &, std::string const &);
/// ///
~InsetNote(); ~InsetNote();
///
InsetNoteParams const & params() const { return params_; }
private:
/// ///
docstring editMessage() const; docstring editMessage() const;
/// ///
@ -72,23 +75,20 @@ public:
/// ///
void validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;
/// ///
InsetNoteParams const & params() const { return params_; }
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
// Update the counters of this inset and of its contents // Update the counters of this inset and of its contents
void updateLabels(ParIterator const &); void updateLabels(ParIterator const &);
/// ///
void addToToc(ParConstIterator const &) const; void addToToc(ParConstIterator const &) const;
protected:
InsetNote(InsetNote const &);
/// ///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
friend class InsetNoteParams;
/// ///
Inset * clone() const; Inset * clone() const { return new InsetNote(*this); }
/// used by the constructors /// used by the constructors
void init(); void init();
///
friend class InsetNoteParams;
/// ///
InsetNoteParams params_; InsetNoteParams params_;
}; };

View File

@ -26,17 +26,6 @@ InsetOptArg::InsetOptArg(Buffer const & buf)
{} {}
InsetOptArg::InsetOptArg(InsetOptArg const & in)
: InsetCollapsable(in)
{}
Inset * InsetOptArg::clone() const
{
return new InsetOptArg(*this);
}
docstring InsetOptArg::editMessage() const docstring InsetOptArg::editMessage() const
{ {
return _("Opened Optional Argument Inset"); return _("Opened Optional Argument Inset");

View File

@ -23,10 +23,16 @@ namespace lyx {
* InsetOptArg. Used to insert a short version of sectioning header etc. * InsetOptArg. Used to insert a short version of sectioning header etc.
* automatically, or other optional LaTeX arguments * automatically, or other optional LaTeX arguments
*/ */
class InsetOptArg : public InsetCollapsable { class InsetOptArg : public InsetCollapsable
{
public: public:
///
InsetOptArg(Buffer const &); InsetOptArg(Buffer const &);
/// Outputting the optional parameter of a LaTeX command
int latexOptional(odocstream &, OutputParams const &) const;
private:
/// code of the inset /// code of the inset
InsetCode lyxCode() const { return OPTARG_CODE; } InsetCode lyxCode() const { return OPTARG_CODE; }
/// ///
@ -41,17 +47,13 @@ public:
/// Standard DocBook output -- short-circuited /// Standard DocBook output -- short-circuited
int docbook(odocstream &, OutputParams const &) const; int docbook(odocstream &, OutputParams const &) const;
/// Outputting the optional parameter of a LaTeX command
int latexOptional(odocstream &, OutputParams const &) const;
/// Write out to the .lyx file /// Write out to the .lyx file
void write(std::ostream & os) const; void write(std::ostream & os) const;
/// should paragraph indendation be ommitted in any case? /// should paragraph indendation be ommitted in any case?
bool neverIndent() const { return true; } bool neverIndent() const { return true; }
protected: ///
InsetOptArg(InsetOptArg const &); Inset * clone() const { return new InsetOptArg(*this); }
private:
Inset * clone() const;
}; };

View File

@ -42,12 +42,6 @@ ParamInfo const & InsetTOC::findInfo(string const & /* cmdName */)
} }
Inset * InsetTOC::clone() const
{
return new InsetTOC(*this);
}
docstring InsetTOC::screenLabel() const docstring InsetTOC::screenLabel() const
{ {
if (getCmdName() == "tableofcontents") if (getCmdName() == "tableofcontents")

View File

@ -43,7 +43,7 @@ public:
static bool isCompatibleCommand(std::string const & cmd) static bool isCompatibleCommand(std::string const & cmd)
{ return cmd == defaultCommand(); } { return cmd == defaultCommand(); }
private: private:
virtual Inset * clone() const; Inset * clone() const { return new InsetTOC(*this); }
}; };

View File

@ -2886,12 +2886,6 @@ InsetTabular::~InsetTabular()
} }
Inset * InsetTabular::clone() const
{
return new InsetTabular(*this);
}
bool InsetTabular::insetAllowed(InsetCode code) const bool InsetTabular::insetAllowed(InsetCode code) const
{ {
if (code == MATHMACRO_CODE) if (code == MATHMACRO_CODE)

View File

@ -755,18 +755,17 @@ public:
/// ///
mutable Tabular tabular; mutable Tabular tabular;
protected: private:
/// ///
InsetTabular(InsetTabular const &); InsetTabular(InsetTabular const &);
/// ///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
/// ///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const; bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
/// ///
int scroll() const { return scx_; } int scroll() const { return scx_; }
///
private: Inset * clone() const { return new InsetTabular(*this); }
Inset * clone() const;
/// ///
void drawCellLines(frontend::Painter &, int x, int y, row_type row, void drawCellLines(frontend::Painter &, int x, int y, row_type row,

View File

@ -151,12 +151,6 @@ void InsetText::clear()
} }
Inset * InsetText::clone() const
{
return new InsetText(*this);
}
Dimension const InsetText::dimension(BufferView const & bv) const Dimension const InsetText::dimension(BufferView const & bv) const
{ {
TextMetrics const & tm = bv.textMetrics(&text_); TextMetrics const & tm = bv.textMetrics(&text_);

View File

@ -138,9 +138,9 @@ public:
// Update the counters of this inset and of its contents // Update the counters of this inset and of its contents
void updateLabels(ParIterator const &); void updateLabels(ParIterator const &);
/// ///
Inset * clone() const; Inset * clone() const { return new InsetText(*this); }
/// ///
virtual bool notifyCursorLeaves(Cursor const & old, Cursor & cur); bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
/// ///
bool completionSupported(Cursor const &) const; bool completionSupported(Cursor const &) const;
@ -159,10 +159,8 @@ public:
/// ///
void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const; void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const;
protected:
/// ///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
private: private:
/// ///
void setParagraphOwner(); void setParagraphOwner();

View File

@ -1,96 +0,0 @@
#if 0
/**
* \file InsetTheorem.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "InsetTheorem.h"
#include "insets/InsetText.h"
#include "support/debug.h"
#include "support/gettext.h"
#include "FontInfo.h"
#include "Text.h"
#include "MetricsInfo.h"
#include <ostream>
using namespace std;
namespace lyx {
/*
The intention is to be able to create arbitrary theorem like environments
sing this class and some helper/container classes. It should be possible
to create these theorems both from layout file and interactively by the
user.
*/
Inset.heorem::InsetTheorem()
: InsetCollapsable()
{
setLabel(_("theorem"));
#if 0
setAutoCollapse(false);
#endif
setInsetName("Theorem");
}
void Inset.heorem::write(ostream & os) const
{
os << name() << "\n";
InsetCollapsable::write(buf, os);
}
Inset * InsetTheorem::clone() const
{
// FIXME: Is this inset used? If YES this is WRONG!!! (Jug)
InsetTheorem * result = new InsetTheorem;
result->setCollapsed(!isOpen());
return result;
}
void Inset.heorem::metrics(MetricsInfo & mi, Dimension & dim) const
{
InsetCollapsable::metrics(mi, dim);
center_indent_ = (mi.base.textwidth - dim.wid) / 2;
dim.wid = mi.base.textwidth;
}
void InsetTheorem::draw(PainterInfo & pi, int x, int y) const
{
InsetCollapsable::draw(pi, x + center_indent_, y);
}
string const Inset.heorem::editMessage() const
{
return _("Opened Theorem Inset");
}
int Inset.heorem::latex(odocstream & os, OutputParams const & runparams) const
{
os << "\\begin{theorem}%\n";
int i = inset.latex(buf, os, runparams);
os << "\\end{theorem}%\n";
return i + 2;
}
} // namespace lyx
#endif

View File

@ -1,55 +0,0 @@
// -*- C++ -*-
/**
* \file Inset.heorem.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
#if 0
#ifndef INSETTHEOREM_H
#define INSETTHEOREM_H
#include "InsetCollapsable.h"
namespace lyx {
/** The theorem inset
*/
class Inset.heorem : public InsetCollapsable {
public:
///
Inset.heorem();
///
void write(std::ostream & os) const;
///
InsetCode lyxCode() const { return THEOREM_CODE; }
///
void metrics(MetricsInfo &, Dimension &) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
bool isMacroScope() const { return true; }
///
int latex(odocstream &, OutputParams const &) const;
///
docstring editMessage() const;
private:
Inset * clone() const;
///
mutable unsigned int center_indent_;
};
} // namespace lyx
#endif
#endif

View File

@ -51,12 +51,6 @@ InsetVSpace::~InsetVSpace()
} }
Inset * InsetVSpace::clone() const
{
return new InsetVSpace(*this);
}
void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd) void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
{ {
switch (cmd.action) { switch (cmd.action) {

View File

@ -28,6 +28,9 @@ public:
InsetVSpace(VSpace const &); InsetVSpace(VSpace const &);
/// ///
~InsetVSpace(); ~InsetVSpace();
/// How much?
VSpace const & space() const { return space_; }
private:
/// ///
void metrics(MetricsInfo & mi, Dimension & dim) const; void metrics(MetricsInfo & mi, Dimension & dim) const;
/// ///
@ -44,15 +47,10 @@ public:
void write(std::ostream & os) const; void write(std::ostream & os) const;
/// ///
DisplayType display() const { return AlignCenter; } DisplayType display() const { return AlignCenter; }
/// How much?
VSpace const & space() const { return space_; }
protected:
/// ///
void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
///
private: Inset * clone() const { return new InsetVSpace(*this); }
virtual Inset * clone() const;
/// ///
docstring const label() const; docstring const label() const;

View File

@ -200,12 +200,6 @@ void InsetWrap::validate(LaTeXFeatures & features) const
} }
Inset * InsetWrap::clone() const
{
return new InsetWrap(*this);
}
docstring InsetWrap::editMessage() const docstring InsetWrap::editMessage() const
{ {
return _("Opened Wrap Inset"); return _("Opened Wrap Inset");

View File

@ -48,6 +48,9 @@ public:
InsetWrap(Buffer const &, std::string const &); InsetWrap(Buffer const &, std::string const &);
/// ///
~InsetWrap(); ~InsetWrap();
///
InsetWrapParams const & params() const { return params_; }
private:
/// ///
void write(std::ostream & os) const; void write(std::ostream & os) const;
/// ///
@ -71,18 +74,15 @@ public:
/// ///
bool showInsetDialog(BufferView *) const; bool showInsetDialog(BufferView *) const;
/// ///
InsetWrapParams const & params() const { return params_; }
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
// Update the counters of this inset and of its contents // Update the counters of this inset and of its contents
void updateLabels(ParIterator const &); void updateLabels(ParIterator const &);
protected:
/// ///
void doDispatch(Cursor & cur, FuncRequest & cmd); void doDispatch(Cursor & cur, FuncRequest & cmd);
/// ///
docstring name() const { return name_; } docstring name() const { return name_; }
private: ///
Inset * clone() const; Inset * clone() const { return new InsetWrap(*this); }
/// ///
InsetWrapParams params_; InsetWrapParams params_;