mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
* In the process of fixing the math background color bug, this commit transfer backgroundColor() management from InsetOld to InsetBase; because this will be needed for InsetMath based insets.
* Also transfer InsetBase ctors from .h to .C git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17913 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ee9782c624
commit
bc92746781
@ -19,7 +19,6 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "LColor.h"
|
|
||||||
#include "metricsinfo.h"
|
#include "metricsinfo.h"
|
||||||
#include "coordcache.h"
|
#include "coordcache.h"
|
||||||
|
|
||||||
@ -30,29 +29,14 @@ using std::string;
|
|||||||
|
|
||||||
|
|
||||||
InsetOld::InsetOld()
|
InsetOld::InsetOld()
|
||||||
: //background_color_(LColor::inherit)
|
|
||||||
background_color_(LColor::background)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
InsetOld::InsetOld(InsetOld const & in)
|
InsetOld::InsetOld(InsetOld const & in)
|
||||||
: InsetBase(in), name_(in.name_),
|
: InsetBase(in), name_(in.name_)
|
||||||
background_color_(in.background_color_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void InsetOld::setBackgroundColor(LColor_color color)
|
|
||||||
{
|
|
||||||
background_color_ = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LColor_color InsetOld::backgroundColor() const
|
|
||||||
{
|
|
||||||
return LColor::color(background_color_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetOld::setPosCache(PainterInfo const & pi, int x, int y) const
|
void InsetOld::setPosCache(PainterInfo const & pi, int x, int y) const
|
||||||
{
|
{
|
||||||
//lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl;
|
//lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl;
|
||||||
|
@ -16,14 +16,10 @@
|
|||||||
#define INSETOLD_H
|
#define INSETOLD_H
|
||||||
|
|
||||||
#include "insetbase.h"
|
#include "insetbase.h"
|
||||||
#include "dimension.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
class LColor_color;
|
|
||||||
|
|
||||||
|
|
||||||
/// Insets
|
/// Insets
|
||||||
class InsetOld : public InsetBase {
|
class InsetOld : public InsetBase {
|
||||||
public:
|
public:
|
||||||
@ -40,10 +36,6 @@ public:
|
|||||||
void setInsetName(docstring const & s) { name_ = s; }
|
void setInsetName(docstring const & s) { name_ = s; }
|
||||||
///
|
///
|
||||||
virtual docstring const & getInsetName() const { return name_; }
|
virtual docstring const & getInsetName() const { return name_; }
|
||||||
///
|
|
||||||
virtual void setBackgroundColor(LColor_color);
|
|
||||||
///
|
|
||||||
LColor_color backgroundColor() const;
|
|
||||||
/// set x/y drawing position cache
|
/// set x/y drawing position cache
|
||||||
void setPosCache(PainterInfo const &, int, int) const;
|
void setPosCache(PainterInfo const &, int, int) const;
|
||||||
|
|
||||||
@ -56,10 +48,6 @@ private:
|
|||||||
|
|
||||||
///
|
///
|
||||||
docstring name_;
|
docstring name_;
|
||||||
/** We store the LColor::color value as an int to get LColor.h out
|
|
||||||
* of the header file.
|
|
||||||
*/
|
|
||||||
int background_color_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,6 +108,16 @@ static TranslatorMap const build_translator()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// pretty arbitrary dimensions
|
||||||
|
InsetBase::InsetBase(): dim_(10, 10, 10), background_color_(LColor::background)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
InsetBase::InsetBase(InsetBase const & i)
|
||||||
|
: dim_(i.dim_), background_color_(i.background_color_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
std::auto_ptr<InsetBase> InsetBase::clone() const
|
std::auto_ptr<InsetBase> InsetBase::clone() const
|
||||||
{
|
{
|
||||||
std::auto_ptr<InsetBase> b = doClone();
|
std::auto_ptr<InsetBase> b = doClone();
|
||||||
@ -345,6 +355,18 @@ void InsetBase::dump() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InsetBase::setBackgroundColor(LColor_color color)
|
||||||
|
{
|
||||||
|
background_color_ = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LColor_color InsetBase::backgroundColor() const
|
||||||
|
{
|
||||||
|
return LColor::color(background_color_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
|
|
||||||
bool isEditableInset(InsetBase const * inset)
|
bool isEditableInset(InsetBase const * inset)
|
||||||
|
@ -31,6 +31,7 @@ class FuncStatus;
|
|||||||
class InsetMath;
|
class InsetMath;
|
||||||
class InsetText;
|
class InsetText;
|
||||||
class LaTeXFeatures;
|
class LaTeXFeatures;
|
||||||
|
class LColor_color;
|
||||||
class LCursor;
|
class LCursor;
|
||||||
class LyXLex;
|
class LyXLex;
|
||||||
class LyXText;
|
class LyXText;
|
||||||
@ -445,6 +446,10 @@ public:
|
|||||||
///
|
///
|
||||||
int scroll() const { return 0; }
|
int scroll() const { return 0; }
|
||||||
///
|
///
|
||||||
|
void setBackgroundColor(LColor_color);
|
||||||
|
///
|
||||||
|
LColor_color backgroundColor() const;
|
||||||
|
///
|
||||||
enum CollapseStatus {
|
enum CollapseStatus {
|
||||||
Collapsed,
|
Collapsed,
|
||||||
Inlined,
|
Inlined,
|
||||||
@ -453,9 +458,8 @@ public:
|
|||||||
///
|
///
|
||||||
virtual void setStatus(LCursor &, CollapseStatus) {}
|
virtual void setStatus(LCursor &, CollapseStatus) {}
|
||||||
protected:
|
protected:
|
||||||
/// pretty arbitrary dimensions
|
InsetBase();
|
||||||
InsetBase(): dim_(10, 10, 10) {}
|
InsetBase(InsetBase const & i);
|
||||||
InsetBase(InsetBase const & i): dim_(i.dim_) {}
|
|
||||||
/** The real dispatcher.
|
/** The real dispatcher.
|
||||||
* Gets normally called from LCursor::dispatch(). LCursor::dispatch()
|
* Gets normally called from LCursor::dispatch(). LCursor::dispatch()
|
||||||
* assumes the common case of 'LFUN handled, need update'.
|
* assumes the common case of 'LFUN handled, need update'.
|
||||||
@ -473,6 +477,10 @@ protected:
|
|||||||
mutable Dimension dim_;
|
mutable Dimension dim_;
|
||||||
private:
|
private:
|
||||||
virtual std::auto_ptr<InsetBase> doClone() const = 0;
|
virtual std::auto_ptr<InsetBase> doClone() const = 0;
|
||||||
|
/** We store the LColor::color value as an int to get LColor.h out
|
||||||
|
* of the header file.
|
||||||
|
*/
|
||||||
|
int background_color_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user