Remove InsetOld

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18087 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-04-29 12:32:14 +00:00
parent 7df0e803ef
commit 51fbea02a8
54 changed files with 163 additions and 231 deletions

View File

@ -58,8 +58,9 @@ Point CoordCache::get(LyXText const * text, pit_type pit) const
return posit->second;
}
void
CoordCache::dump() const {
void CoordCache::dump() const
{
lyxerr << "ParPosCache contains:" << std::endl;
for (ParPosCache::const_iterator i = getParPos().begin(); i != getParPos().end(); ++i) {
LyXText const * lt = (*i).first;

View File

@ -15,7 +15,7 @@
#include "Paragraph.h"
#include "LyXText.h"
#include "insets/Inset.h"
#include "insets/InsetBase.h"
namespace lyx {
@ -24,7 +24,8 @@ namespace lyx {
/// ParIterator
///
ParIterator::ParIterator(DocIterator const & cur) : DocIterator(cur)
ParIterator::ParIterator(DocIterator const & cur)
: DocIterator(cur)
{}

View File

@ -28,7 +28,7 @@
#include "mathed/MathSupport.h"
#include "mathed/MathData.h"
#include "insets/Inset.h"
#include "insets/InsetBase.h"
#include <algorithm>

View File

@ -26,7 +26,7 @@
#include "frontends/Application.h" // hexName
#include "insets/Inset.h"
#include "insets/InsetBase.h"
#include "support/filetools.h"
#include "support/Forkedcall.h"

View File

@ -18,7 +18,7 @@
#include "LyXRC.h"
#include "Paragraph.h"
#include "insets/Inset.h"
#include "insets/InsetBase.h"
namespace lyx {

View File

@ -1,47 +0,0 @@
/**
* \file Inset.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
* \author Jürgen Vigna
* \author Lars Gullik Bjønnes
* \author Matthias Ettrich
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "Inset.h"
#include "BufferView.h"
#include "debug.h"
#include "gettext.h"
#include "LyXText.h"
#include "MetricsInfo.h"
#include "CoordCache.h"
namespace lyx {
using std::string;
InsetOld::InsetOld()
{}
InsetOld::InsetOld(InsetOld const & in)
: InsetBase(in), name_(in.name_)
{}
void InsetOld::setPosCache(PainterInfo const & pi, int x, int y) const
{
//lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl;
pi.base.bv->coordCache().insets().add(this, x, y);
}
} // namespace lyx

View File

@ -1,68 +0,0 @@
// -*- C++ -*-
/**
* \file Inset.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
* \author Jürgen Vigna
* \author Lars Gullik Bjønnes
* \author Matthias Ettrich
*
* Full author contact details are available in file CREDITS.
*/
#ifndef INSETOLD_H
#define INSETOLD_H
#include "InsetBase.h"
namespace lyx {
/// Insets
class InsetOld : public InsetBase {
public:
///
enum {
///
TEXT_TO_INSET_OFFSET = 4
};
///
InsetOld();
///
void setInsetName(docstring const & s) { name_ = s; }
///
virtual docstring const & getInsetName() const { return name_; }
/// set x/y drawing position cache
void setPosCache(PainterInfo const &, int, int) const;
protected:
///
InsetOld(InsetOld const & in);
private:
InsetOld & operator=(InsetOld const &) const;
///
docstring name_;
};
/** \c InsetBase_code is a wrapper for InsetBase::Code.
* It can be forward-declared and passed as a function argument without
* having to expose Inset.h.
*/
class InsetBase_code {
InsetBase::Code val_;
public:
InsetBase_code(InsetBase::Code val) : val_(val) {}
operator InsetBase::Code() const { return val_; }
};
} // namespace lyx
#endif

View File

@ -3,6 +3,10 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
* \author Jürgen Vigna
* \author Lars Gullik Bjønnes
* \author Matthias Ettrich
* \author André Pönitz
*
* Full author contact details are available in file CREDITS.
@ -13,11 +17,12 @@
#include "InsetBase.h"
#include "Buffer.h"
#include "CoordCache.h"
#include "BufferView.h"
#include "Color.h"
#include "CoordCache.h"
#include "Cursor.h"
#include "debug.h"
#include "debug.h"
#include "Dimension.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
@ -25,6 +30,7 @@
#include "gettext.h"
#include "LyXText.h"
#include "MetricsInfo.h"
#include "MetricsInfo.h"
#include "frontends/Painter.h"
@ -109,12 +115,13 @@ static TranslatorMap const build_translator()
/// pretty arbitrary dimensions
InsetBase::InsetBase(): dim_(10, 10, 10), background_color_(Color::background)
InsetBase::InsetBase()
: dim_(10, 10, 10), background_color_(Color::background)
{}
InsetBase::InsetBase(InsetBase const & i)
: dim_(i.dim_), background_color_(i.background_color_)
InsetBase::InsetBase(InsetBase const & inset)
: dim_(inset.dim_), background_color_(inset.background_color_)
{}
@ -126,6 +133,12 @@ std::auto_ptr<InsetBase> InsetBase::clone() const
}
docstring InsetBase::getInsetName() const
{
return from_ascii("unknown");
}
InsetBase::Code InsetBase::translate(std::string const & name)
{
static TranslatorMap const translator = build_translator();
@ -253,13 +266,6 @@ docstring const InsetBase::editMessage() const
}
docstring const & InsetBase::getInsetName() const
{
static docstring const name = from_ascii("unknown");
return name;
}
void InsetBase::cursorPos(BufferView const & /*bv*/, CursorSlice const &,
bool, int & x, int & y) const
{
@ -367,6 +373,13 @@ Color_color InsetBase::backgroundColor() const
}
void InsetBase::setPosCache(PainterInfo const & pi, int x, int y) const
{
//lyxerr << "InsetBase:: position cache to " << x << " " << y << std::endl;
pi.base.bv->coordCache().insets().add(this, x, y);
}
/////////////////////////////////////////
bool isEditableInset(InsetBase const * inset)

View File

@ -4,7 +4,10 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author none
* \author Alejandro Aguilar Sierra
* \author Jürgen Vigna
* \author Lars Gullik Bjønnes
* \author Matthias Ettrich
*
* Full author contact details are available in file CREDITS.
*/
@ -133,7 +136,7 @@ public:
/// last drawn position for 'important' insets
int yo(BufferView const & bv) const;
/// set x/y drawing position cache if available
virtual void setPosCache(PainterInfo const &, int, int) const {}
virtual void setPosCache(PainterInfo const &, int, int) const;
/// do we cover screen position x/y?
virtual bool covers(BufferView const & bv, int x, int y) const;
/// get the screen positions of the cursor (see note in Cursor.cpp)
@ -362,7 +365,7 @@ public:
virtual bool hasFixedWidth() const { return false; }
///
virtual docstring const & getInsetName() const;
virtual docstring getInsetName() const;
/// used to toggle insets
/// is the inset open?
/// should this inset be handled like a normal charater
@ -457,6 +460,9 @@ public:
};
///
virtual void setStatus(Cursor &, CollapseStatus) {}
//
enum { TEXT_TO_INSET_OFFSET = 4 };
protected:
InsetBase();
InsetBase(InsetBase const & i);
@ -497,6 +503,20 @@ bool isEditableInset(InsetBase const * inset);
*/
bool isHighlyEditableInset(InsetBase const * inset);
/** \c InsetBase_code is a wrapper for InsetBase::Code.
* It can be forward-declared and passed as a function argument without
* having to expose InsetBase.h.
*/
class InsetBase_code {
InsetBase::Code val_;
public:
InsetBase_code(InsetBase::Code val) : val_(val) {}
operator InsetBase::Code() const { return val_; }
};
} // namespace lyx
#endif

View File

@ -90,7 +90,6 @@ BoxTranslatorLoc const & boxtranslator_loc()
void InsetBox::init()
{
setInsetName(from_ascii("Box"));
setButtonLabel();
}

View File

@ -109,6 +109,8 @@ protected:
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
/// Is the width forced to some value?
virtual bool hasFixedWidth() const;
///
virtual docstring getInsetName() const { return from_ascii("Box"); }
private:
friend class InsetBoxParams;

View File

@ -39,7 +39,6 @@ using std::ostringstream;
void InsetBranch::init()
{
setInsetName(from_utf8("Branch"));
setButtonLabel();
}

View File

@ -80,8 +80,12 @@ public:
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
protected:
///
InsetBranch(InsetBranch const &);
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
///
docstring getInsetName() const { return from_ascii("Branch"); }
private:
friend class InsetBranchParams;

View File

@ -51,7 +51,6 @@ using std::ostringstream;
void InsetCharStyle::init()
{
setInsetName(from_utf8("CharStyle"));
setInlined();
setDrawFrame(false);
}

View File

@ -52,6 +52,8 @@ public:
InsetCharStyle(BufferParams const &, std::string const);
///
InsetCharStyle(BufferParams const &, CharStyles::iterator);
///
docstring getInsetName() const { return from_ascii("CharStyle"); }
/// Is this character style defined in the document's textclass?
/// May be wrong after textclass change or paste from another document
bool undefined() const;

View File

@ -58,24 +58,23 @@ InsetCollapsable::InsetCollapsable
setAutoBreakRows(true);
setDrawFrame(true);
setFrameColor(Color::collapsableframe);
setInsetName(from_ascii("Collapsable"));
setButtonLabel();
}
InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs):
InsetText(rhs),
labelfont_(rhs.labelfont_),
button_dim(rhs.button_dim),
topx(rhs.topx),
topbaseline(rhs.topbaseline),
label(rhs.label),
status_(rhs.status_),
openinlined_(rhs.openinlined_),
autoOpen_(rhs.autoOpen_),
textdim_(rhs.textdim_),
// the sole purpose of this copy constructor
mouse_hover_(false)
InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs)
: InsetText(rhs),
labelfont_(rhs.labelfont_),
button_dim(rhs.button_dim),
topx(rhs.topx),
topbaseline(rhs.topbaseline),
label(rhs.label),
status_(rhs.status_),
openinlined_(rhs.openinlined_),
autoOpen_(rhs.autoOpen_),
textdim_(rhs.textdim_),
// the sole purpose of this copy constructor
mouse_hover_(false)
{
}

View File

@ -14,7 +14,7 @@
#ifndef INSETCOLLAPSABLE_H
#define INSETCOLLAPSABLE_H
#include "Inset.h"
#include "InsetBase.h"
#include "InsetText.h"
#include "Box.h"
@ -44,6 +44,8 @@ public:
///
InsetCollapsable(InsetCollapsable const & rhs);
///
docstring getInsetName() const { return from_ascii("Collapsable"); }
///
void read(Buffer const &, Lexer &);
///
void write(Buffer const &, std::ostream &) const;

View File

@ -13,7 +13,7 @@
#ifndef INSET_LATEXCOMMAND_H
#define INSET_LATEXCOMMAND_H
#include "Inset.h"
#include "InsetBase.h"
#include "InsetCommandParams.h"
#include "RenderButton.h"
#include "MailInset.h"
@ -31,7 +31,7 @@ namespace lyx {
*/
///
class InsetCommand : public InsetOld {
class InsetCommand : public InsetBase {
public:
///
InsetCommand(InsetCommandParams const &, std::string const & mailer_name);
@ -109,10 +109,13 @@ protected:
private:
///
InsetCommandParams p_;
///
std::string mailer_name_;
/// changes color when mouse enters/leaves this inset
bool mouse_hover_;
///
mutable bool updateButtonLabel_;
///
mutable RenderButton button_;
};

View File

@ -53,7 +53,6 @@ using std::string;
void InsetERT::init()
{
setButtonLabel();
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
font.decSize();
@ -61,8 +60,6 @@ void InsetERT::init()
setLabelFont(font);
text_.current_font.setLanguage(latex_language);
text_.real_current_font.setLanguage(latex_language);
setInsetName(from_ascii("ERT"));
}

View File

@ -44,6 +44,8 @@ public:
///
InsetBase::Code lyxCode() const { return InsetBase::ERT_CODE; }
///
docstring getInsetName() const { return from_ascii("ERT"); }
///
void write(Buffer const & buf, std::ostream & os) const;
///
void read(Buffer const & buf, Lexer & lex);

View File

@ -29,9 +29,8 @@ using std::ostream;
InsetEnvironment::InsetEnvironment
(BufferParams const & bp, string const & name)
: InsetText(bp), layout_(bp.getLyXTextClass()[name])
: InsetText(bp), layout_(bp.getLyXTextClass()[name]), name_(from_utf8(name))
{
setInsetName(from_utf8(name));
setAutoBreakRows(true);
setDrawFrame(true);
}

View File

@ -23,6 +23,8 @@ public:
///
InsetEnvironment(BufferParams const &, std::string const & name);
///
docstring getInsetName() const { return name_; }
///
void write(Buffer const & buf, std::ostream & os) const;
///
void read(Buffer const & buf, Lexer & lex);
@ -50,6 +52,8 @@ private:
virtual std::auto_ptr<InsetBase> doClone() const;
/// the layout
LyXLayout_ptr layout_;
///
docstring name_;
};

View File

@ -400,7 +400,7 @@ InsetExternal::InsetExternal()
InsetExternal::InsetExternal(InsetExternal const & other)
: InsetOld(other),
: InsetBase(other),
boost::signals::trackable(),
params_(other.params_),
renderer_(other.renderer_->clone(this))

View File

@ -12,7 +12,7 @@
#ifndef INSET_EXTERNAL_H
#define INSET_EXTERNAL_H
#include "Inset.h"
#include "InsetBase.h"
#include "ExternalTransforms.h"
#include "support/FileName.h"
@ -104,7 +104,7 @@ private:
class RenderBase;
///
class InsetExternal : public InsetOld, public boost::signals::trackable
class InsetExternal : public InsetBase, public boost::signals::trackable
{
public:
InsetExternal();

View File

@ -116,7 +116,7 @@ using std::ostringstream;
InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
: InsetCollapsable(bp)
: InsetCollapsable(bp), name_(from_utf8(type))
{
setLabel(_("float: ") + floatName(type, bp));
LyXFont font(LyXFont::ALL_SANE);
@ -125,7 +125,6 @@ InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
font.setColor(Color::collapsable);
setLabelFont(font);
params_.type = type;
setInsetName(from_utf8(type));
}

View File

@ -49,6 +49,8 @@ public:
///
~InsetFloat();
///
docstring getInsetName() const { return name_; }
///
void write(Buffer const & buf, std::ostream & os) const;
///
void read(Buffer const & buf, Lexer & lex);
@ -90,10 +92,12 @@ public:
protected:
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
///
virtual std::auto_ptr<InsetBase> doClone() const;
///
InsetFloatParams params_;
///
docstring name_;
};

View File

@ -35,7 +35,6 @@ InsetFoot::InsetFoot(BufferParams const & bp)
: InsetFootlike(bp)
{
setLabel(_("foot"));
setInsetName(from_ascii("Foot"));
}
@ -43,7 +42,6 @@ InsetFoot::InsetFoot(InsetFoot const & in)
: InsetFootlike(in)
{
setLabel(_("foot"));
setInsetName(from_ascii("Foot"));
}

View File

@ -28,6 +28,8 @@ public:
///
InsetBase::Code lyxCode() const { return InsetBase::FOOT_CODE; }
///
docstring getInsetName() const { return from_ascii("Foot"); }
///
int latex(Buffer const &, odocstream &,
OutputParams const &) const;
///

View File

@ -153,7 +153,7 @@ InsetGraphics::InsetGraphics()
InsetGraphics::InsetGraphics(InsetGraphics const & ig)
: InsetOld(ig),
: InsetBase(ig),
boost::signals::trackable(),
graphic_label(sgml::uniqueID(from_ascii("graph"))),
graphic_(new RenderGraphic(*ig.graphic_, this))

View File

@ -13,7 +13,7 @@
#ifndef INSET_GRAPHICS_H
#define INSET_GRAPHICS_H
#include "Inset.h"
#include "InsetBase.h"
#include "InsetGraphicsParams.h"
#include "MailInset.h"
@ -28,7 +28,7 @@ class RenderGraphic;
class LaTeXFeatures;
///
class InsetGraphics : public InsetOld, public boost::signals::trackable {
class InsetGraphics : public InsetBase, public boost::signals::trackable {
public:
///
InsetGraphics();

View File

@ -104,7 +104,7 @@ InsetInclude::InsetInclude(InsetCommandParams const & p)
InsetInclude::InsetInclude(InsetInclude const & other)
: InsetOld(other),
: InsetBase(other),
params_(other.params_),
include_label(other.include_label),
preview_(new RenderMonitoredPreview(this)),

View File

@ -12,7 +12,7 @@
#ifndef INSET_INCLUDE_H
#define INSET_INCLUDE_H
#include "Inset.h"
#include "InsetBase.h"
#include "InsetCommandParams.h"
#include "RenderButton.h"
#include "MailInset.h"
@ -30,7 +30,7 @@ class RenderMonitoredPreview;
/// for including tex/lyx files
class InsetInclude : public InsetOld {
class InsetInclude : public InsetBase {
public:
///
InsetInclude(InsetCommandParams const &);

View File

@ -13,12 +13,12 @@
#define INSET_LINE_H
#include "Inset.h"
#include "InsetBase.h"
namespace lyx {
class InsetLine : public InsetOld {
class InsetLine : public InsetBase {
public:
InsetLine() {}

View File

@ -31,7 +31,6 @@ InsetMarginal::InsetMarginal(BufferParams const & bp)
: InsetFootlike(bp)
{
setLabel(_("margin"));
setInsetName(from_ascii("Marginal"));
}
@ -39,7 +38,6 @@ InsetMarginal::InsetMarginal(InsetMarginal const & in)
: InsetFootlike(in)
{
setLabel(_("margin"));
setInsetName(from_ascii("Marginal"));
}

View File

@ -13,12 +13,12 @@
#define INSET_NEWLINE_H
#include "Inset.h"
#include "InsetBase.h"
namespace lyx {
class InsetNewline : public InsetOld {
class InsetNewline : public InsetBase {
public:
InsetNewline() {}

View File

@ -112,7 +112,6 @@ void InsetNoteParams::read(Lexer & lex)
void InsetNote::init()
{
setInsetName(from_ascii("Note"));
setButtonLabel();
}

View File

@ -52,6 +52,8 @@ public:
///
InsetBase::Code lyxCode() const { return InsetBase::NOTE_CODE; }
///
docstring getInsetName() const { return from_ascii("Note"); }
///
void write(Buffer const &, std::ostream &) const;
///
void read(Buffer const & buf, Lexer & lex);

View File

@ -13,13 +13,13 @@
#define INSET_PAGEBREAK_H
#include "Inset.h"
#include "InsetBase.h"
#include "gettext.h"
namespace lyx {
class InsetPagebreak : public InsetOld {
class InsetPagebreak : public InsetBase {
public:
InsetPagebreak() {}

View File

@ -85,14 +85,12 @@ char const * const latex_quote_babel[2][5] =
InsetQuotes::InsetQuotes(string const & str)
{
parseString(str);
setInsetName(from_utf8("InsetQuotes"));
}
InsetQuotes::InsetQuotes(quote_language l, quote_side s, quote_times t)
: language_(l), side_(s), times_(t)
{
setInsetName(from_utf8("InsetQuotes"));
}
@ -100,7 +98,6 @@ InsetQuotes::InsetQuotes(char_type c, BufferParams const & params)
: language_(params.quotes_language), times_(params.quotes_times)
{
getPosition(c);
setInsetName(from_utf8("InsetQuotes"));
}
@ -108,7 +105,6 @@ InsetQuotes::InsetQuotes(char_type c, quote_language l, quote_times t)
: language_(l), times_(t)
{
getPosition(c);
setInsetName(from_utf8("InsetQuotes"));
}

View File

@ -13,7 +13,7 @@
#define INSET_QUOTES_H
#include "Inset.h"
#include "InsetBase.h"
#include "support/types.h"
@ -28,7 +28,7 @@ class LaTeXFeatures;
/** Quotes.
Used for the various quotes. German, English, French, all either
double or single **/
class InsetQuotes : public InsetOld {
class InsetQuotes : public InsetBase {
public:
///
enum quote_language {
@ -74,6 +74,8 @@ public:
/// Direct access to inner/outer quotation marks
InsetQuotes(char_type c, quote_language l, quote_times t);
///
docstring getInsetName() const { return from_ascii("Quotes"); }
///
bool metrics(MetricsInfo &, Dimension &) const;
///
void draw(PainterInfo & pi, int x, int y) const;

View File

@ -16,7 +16,7 @@
#define INSET_SPACE_H
#include "Inset.h"
#include "InsetBase.h"
namespace lyx {
@ -24,7 +24,7 @@ namespace lyx {
class LaTeXFeatures;
/// Used to insert different kinds of spaces
class InsetSpace : public InsetOld {
class InsetSpace : public InsetBase {
public:
/// The different kinds of spaces we support

View File

@ -15,7 +15,7 @@
#define INSET_SPECIALCHAR_H
#include "Inset.h"
#include "InsetBase.h"
namespace lyx {
@ -23,7 +23,7 @@ namespace lyx {
class LaTeXFeatures;
/// Used to insert special chars
class InsetSpecialChar : public InsetOld {
class InsetSpecialChar : public InsetBase {
public:
/// The different kinds of special chars we support

View File

@ -2874,7 +2874,7 @@ InsetTabular::InsetTabular(Buffer const & buf, row_type rows,
InsetTabular::InsetTabular(InsetTabular const & tab)
: InsetOld(tab), tabular(tab.tabular),
: InsetBase(tab), tabular(tab.tabular),
buffer_(tab.buffer_), scx_(0), is_deleted_(false)
{}

View File

@ -36,7 +36,7 @@
#ifndef INSETTABULAR_H
#define INSETTABULAR_H
#include "Inset.h"
#include "InsetBase.h"
#include "MailInset.h"
#include "Length.h"
#include "InsetText.h"
@ -661,7 +661,7 @@ private:
class InsetTabular : public InsetOld {
class InsetTabular : public InsetBase {
public:
///
InsetTabular(Buffer const &, row_type rows = 1,

View File

@ -89,7 +89,7 @@ InsetText::InsetText(BufferParams const & bp)
InsetText::InsetText(InsetText const & in)
: InsetOld(in), text_()
: InsetBase(in), text_()
{
text_.autoBreakRows_ = in.text_.autoBreakRows_;
drawFrame_ = in.drawFrame_;

View File

@ -12,7 +12,7 @@
#ifndef INSETTEXT_H
#define INSETTEXT_H
#include "Inset.h"
#include "InsetBase.h"
#include "RowList_fwd.h"
#include "LyXFont.h"
#include "LyXText.h"
@ -37,7 +37,7 @@ class ParagraphList;
A text inset is like a TeX box to write full text
(including styles and other insets) in a given space.
*/
class InsetText : public InsetOld {
class InsetText : public InsetBase {
public:
///
explicit InsetText(BufferParams const &);

View File

@ -1,5 +1,5 @@
/**
* \file InsetTheorem.cpp
* \file InsetBase.heorem.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -10,7 +10,7 @@
#include <config.h>
#include "InsetTheorem.h"
#include "InsetBase.heorem.h"
#include "insets/InsetText.h"
#include "debug.h"
@ -35,7 +35,7 @@ using std::ostream;
user.
*/
InsetTheorem::InsetTheorem()
InsetBase.heorem::InsetTheorem()
: InsetCollapsable()
{
setLabel(_("theorem"));
@ -51,25 +51,25 @@ InsetTheorem::InsetTheorem()
}
void InsetTheorem::write(Buffer const * buf, ostream & os) const
void InsetBase.heorem::write(Buffer const * buf, ostream & os) const
{
os << getInsetName() << "\n";
InsetCollapsable::write(buf, os);
}
auto_ptr<InsetBase> InsetTheorem::doClone() const
auto_ptr<InsetBase> InsetBase.heorem::doClone() const
{
#ifdef WITH_WARNINGS
#warning Is this inset used? If YES this is WRONG!!! (Jug)
#endif
auto_ptr<InsetTheorem> result(new InsetTheorem);
auto_ptr<InsetBase.heorem> result(new InsetTheorem);
result->setCollapsed(!isOpen());
return result;
}
bool InsetTheorem::metrics(MetricsInfo & mi, Dimension & dim) const
bool InsetBase.heorem::metrics(MetricsInfo & mi, Dimension & dim) const
{
InsetCollapsable::metrics(mi, dim);
center_indent_ = (mi.base.textwidth - dim.wid) / 2;
@ -86,13 +86,13 @@ void InsetTOC::draw(PainterInfo & pi, int x, int y) const
}
string const InsetTheorem::editMessage() const
string const InsetBase.heorem::editMessage() const
{
return _("Opened Theorem Inset");
}
int InsetTheorem::latex(Buffer const * buf, odocstream & os,
int InsetBase.heorem::latex(Buffer const * buf, odocstream & os,
OutputParams const & runparams) const
{
os << "\\begin{theorem}%\n";

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
/**
* \file InsetTheorem.h
* \file InsetBase.heorem.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -9,8 +9,8 @@
* Full author contact details are available in file CREDITS.
*/
#ifndef InsetTheorem_H
#define InsetTheorem_H
#ifndef InsetBase.heorem_H
#define InsetBase.heorem_H
#include "InsetCollapsable.h"
@ -21,10 +21,10 @@ namespace lyx {
/** The theorem inset
*/
class InsetTheorem : public InsetCollapsable {
class InsetBase.heorem : public InsetCollapsable {
public:
///
InsetTheorem();
InsetBase.heorem();
///
void write(Buffer const & buf, std::ostream & os) const;
///

View File

@ -13,14 +13,14 @@
#define INSET_VSPACE_H
#include "Inset.h"
#include "InsetBase.h"
#include "VSpace.h"
#include "MailInset.h"
namespace lyx {
class InsetVSpace : public InsetOld {
class InsetVSpace : public InsetBase {
public:
///
InsetVSpace() {}

View File

@ -44,7 +44,7 @@ using std::ostringstream;
InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
: InsetCollapsable(bp)
: InsetCollapsable(bp), name_(from_utf8(type))
{
setLabel(_("wrap: ") + floatName(type, bp));
LyXFont font(LyXFont::ALL_SANE);
@ -54,7 +54,6 @@ InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
setLabelFont(font);
params_.type = type;
params_.width = Length(50, Length::PCW);
setInsetName(from_utf8(type));
}

View File

@ -76,11 +76,15 @@ public:
protected:
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
///
virtual docstring getInsetName() const { return name_; }
private:
virtual std::auto_ptr<InsetBase> doClone() const;
///
InsetWrapParams params_;
///
docstring name_;
};

View File

@ -27,8 +27,6 @@ libinsets_la_SOURCES = \
RenderGraphic.h \
RenderPreview.cpp \
RenderPreview.h \
Inset.cpp \
Inset.h \
InsetBase.h \
InsetBase.cpp \
InsetBibitem.cpp \

View File

@ -12,7 +12,7 @@
#include "RenderGraphic.h"
#include "insets/Inset.h"
#include "insets/InsetBase.h"
#include "gettext.h"
#include "Color.h"
@ -149,7 +149,7 @@ bool RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const
if (image_ready) {
dim.wid = loader_.image()->getWidth() +
2 * InsetOld::TEXT_TO_INSET_OFFSET;
2 * InsetBase::TEXT_TO_INSET_OFFSET;
} else {
int font_width = 0;
@ -194,16 +194,16 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y) const
// loaded yet, we draw just a rectangle.
if (displayGraphic(params_) && readyToDisplay(loader_)) {
pi.pain.image(x + InsetOld::TEXT_TO_INSET_OFFSET,
pi.pain.image(x + InsetBase::TEXT_TO_INSET_OFFSET,
y - dim_.asc,
dim_.wid - 2 * InsetOld::TEXT_TO_INSET_OFFSET,
dim_.wid - 2 * InsetBase::TEXT_TO_INSET_OFFSET,
dim_.asc + dim_.des,
*loader_.image());
} else {
pi.pain.rectangle(x + InsetOld::TEXT_TO_INSET_OFFSET,
pi.pain.rectangle(x + InsetBase::TEXT_TO_INSET_OFFSET,
y - dim_.asc,
dim_.wid - 2 * InsetOld::TEXT_TO_INSET_OFFSET,
dim_.wid - 2 * InsetBase::TEXT_TO_INSET_OFFSET,
dim_.asc + dim_.des,
Color::foreground);
@ -214,7 +214,7 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y) const
if (!justname.empty()) {
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
pi.pain.text(x + InsetOld::TEXT_TO_INSET_OFFSET + 6,
pi.pain.text(x + InsetBase::TEXT_TO_INSET_OFFSET + 6,
y - theFontMetrics(msgFont).maxAscent() - 4,
from_utf8(justname), msgFont);
}
@ -223,7 +223,7 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y) const
docstring const msg = statusMessage(params_, loader_.status());
if (!msg.empty()) {
msgFont.setSize(LyXFont::SIZE_TINY);
pi.pain.text(x + InsetOld::TEXT_TO_INSET_OFFSET + 6,
pi.pain.text(x + InsetBase::TEXT_TO_INSET_OFFSET + 6,
y - 4, msg, msgFont);
}
}

View File

@ -11,12 +11,12 @@
#include <config.h>
#include "insets/RenderPreview.h"
#include "insets/Inset.h"
#include "insets/InsetBase.h"
#include "BufferView.h"
#include "Color.h"
#include "Dimension.h"
#include "gettext.h"
#include "Color.h"
#include "LyX.h"
#include "LyXRC.h"
#include "MetricsInfo.h"
@ -154,7 +154,7 @@ void RenderPreview::draw(PainterInfo & pi, int x, int y) const
*image);
} else {
int const offset = InsetOld::TEXT_TO_INSET_OFFSET;
int const offset = InsetBase::TEXT_TO_INSET_OFFSET;
pi.pain.rectangle(x + offset,
y - dim_.asc,