mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-28 23:15:19 +00:00
IU of drawing phase one without 'semantic changes' as requested by John
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7079 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
628e77468b
commit
285952e130
@ -20,6 +20,7 @@
|
|||||||
#include "lyxfont.h"
|
#include "lyxfont.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "dimension.h"
|
#include "dimension.h"
|
||||||
|
#include "metricsinfo.h"
|
||||||
|
|
||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
#include "frontends/mouse_state.h"
|
#include "frontends/mouse_state.h"
|
||||||
@ -146,7 +147,10 @@ int Inset::latexTextWidth(BufferView * bv) const
|
|||||||
int Inset::ascent(BufferView * bv, LyXFont const & font) const
|
int Inset::ascent(BufferView * bv, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
dimension(bv, font, dim);
|
MetricsInfo mi;
|
||||||
|
mi.base.bv = bv;
|
||||||
|
mi.base.font = font;
|
||||||
|
metrics(mi, dim);
|
||||||
return dim.ascent();
|
return dim.ascent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +158,10 @@ int Inset::ascent(BufferView * bv, LyXFont const & font) const
|
|||||||
int Inset::descent(BufferView * bv, LyXFont const & font) const
|
int Inset::descent(BufferView * bv, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
dimension(bv, font, dim);
|
MetricsInfo mi;
|
||||||
|
mi.base.bv = bv;
|
||||||
|
mi.base.font = font;
|
||||||
|
metrics(mi, dim);
|
||||||
return dim.descent();
|
return dim.descent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +169,9 @@ int Inset::descent(BufferView * bv, LyXFont const & font) const
|
|||||||
int Inset::width(BufferView * bv, LyXFont const & font) const
|
int Inset::width(BufferView * bv, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
dimension(bv, font, dim);
|
MetricsInfo mi;
|
||||||
|
mi.base.bv = bv;
|
||||||
|
mi.base.font = font;
|
||||||
|
metrics(mi, dim);
|
||||||
return dim.width();
|
return dim.width();
|
||||||
}
|
}
|
||||||
|
@ -160,8 +160,6 @@ public:
|
|||||||
///
|
///
|
||||||
Inset(Inset const & in);
|
Inset(Inset const & in);
|
||||||
///
|
///
|
||||||
virtual void dimension(BufferView *, LyXFont const &, Dimension &) const = 0;
|
|
||||||
///
|
|
||||||
int ascent(BufferView *, LyXFont const &) const;
|
int ascent(BufferView *, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
int descent(BufferView *, LyXFont const &) const;
|
int descent(BufferView *, LyXFont const &) const;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
class BufferView;
|
class BufferView;
|
||||||
class FuncRequest;
|
class FuncRequest;
|
||||||
class MetricsInfo;
|
class MetricsInfo;
|
||||||
|
class Dimension;
|
||||||
class PainterInfo;
|
class PainterInfo;
|
||||||
|
|
||||||
/** Dispatch result codes
|
/** Dispatch result codes
|
||||||
@ -49,14 +50,18 @@ enum dispatch_result {
|
|||||||
/// Common base class to all insets
|
/// Common base class to all insets
|
||||||
class InsetBase {
|
class InsetBase {
|
||||||
public:
|
public:
|
||||||
|
///
|
||||||
|
typedef int difference_type;
|
||||||
|
/// short of anything else reasonable
|
||||||
|
typedef size_t size_type;
|
||||||
/// type for cell indices
|
/// type for cell indices
|
||||||
typedef size_t idx_type;
|
typedef size_t idx_type;
|
||||||
/// type for cursor positions
|
/// type for cursor positions
|
||||||
typedef size_t pos_type;
|
typedef size_t pos_type;
|
||||||
/// type for row numbers
|
/// type for row numbers
|
||||||
typedef size_t row_type;
|
typedef size_t row_type;
|
||||||
/// type for column numbers
|
/// type for column numbers
|
||||||
typedef size_t col_type;
|
typedef size_t col_type;
|
||||||
|
|
||||||
// the real dispatcher
|
// the real dispatcher
|
||||||
virtual dispatch_result dispatch
|
virtual dispatch_result dispatch
|
||||||
@ -64,7 +69,9 @@ public:
|
|||||||
|
|
||||||
/// small wrapper for the time being
|
/// small wrapper for the time being
|
||||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||||
///
|
/// compute the size of the object returned in dim
|
||||||
|
virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
|
||||||
|
/// draw inset and update (xo, yo)-cache
|
||||||
virtual void draw(PainterInfo & pi, int x, int y) const = 0;
|
virtual void draw(PainterInfo & pi, int x, int y) const = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS
|
* Full author contact details are available in file CREDITS
|
||||||
*/
|
*/
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
#include "insetbibtex.h"
|
#include "insetbibtex.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
@ -40,15 +40,9 @@ InsetBibtex::InsetBibtex(InsetCommandParams const & p)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// InsetBibtex::InsetBibtex(InsetCommandParams const & p, bool)
|
|
||||||
// : InsetCommand(p, false)
|
|
||||||
// {}
|
|
||||||
|
|
||||||
|
|
||||||
InsetBibtex::~InsetBibtex()
|
InsetBibtex::~InsetBibtex()
|
||||||
{
|
{
|
||||||
InsetCommandMailer mailer("bibtex", *this);
|
InsetCommandMailer("bibtex", *this).hideDialog();
|
||||||
mailer.hideDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,15 +28,14 @@ using std::ostream;
|
|||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
|
|
||||||
void InsetButton::dimension(BufferView * bv, LyXFont const &,
|
void InsetButton::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
lyx::Assert(bv);
|
lyx::Assert(mi.base.bv);
|
||||||
|
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
font.decSize();
|
font.decSize();
|
||||||
|
|
||||||
string const s = getScreenLabel(bv->buffer());
|
string const s = getScreenLabel(mi.base.bv->buffer());
|
||||||
|
|
||||||
if (editable())
|
if (editable())
|
||||||
font_metrics::buttonText(s, font, dim.wid, dim.asc, dim.des);
|
font_metrics::buttonText(s, font, dim.wid, dim.asc, dim.des);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
class InsetButton: public Inset {
|
class InsetButton: public Inset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
using std::ostream;
|
using std::ostream;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
|
|
||||||
InsetCaption::InsetCaption(BufferParams const & bp)
|
InsetCaption::InsetCaption(BufferParams const & bp)
|
||||||
: InsetText(bp)
|
: InsetText(bp)
|
||||||
{
|
{
|
||||||
@ -45,7 +46,6 @@ void InsetCaption::write(Buffer const * buf, ostream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void InsetCaption::read(Buffer const * buf, LyXLex & lex)
|
void InsetCaption::read(Buffer const * buf, LyXLex & lex)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -124,16 +124,15 @@ int InsetCollapsable::height_collapsed() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::dimension(BufferView * bv, LyXFont const & font,
|
void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
dimension_collapsed(dim);
|
dimension_collapsed(dim);
|
||||||
if (collapsed_)
|
if (collapsed_)
|
||||||
return;
|
return;
|
||||||
Dimension insetdim;
|
Dimension insetdim;
|
||||||
inset.dimension(bv, font, insetdim);
|
inset.metrics(mi, insetdim);
|
||||||
dim.des += insetdim.height() + TEXT_TO_BOTTOM_OFFSET;
|
dim.des += insetdim.height() + TEXT_TO_BOTTOM_OFFSET;
|
||||||
dim.wid = max(dim.wid, insetdim.width());
|
dim.wid = max(dim.wid, insetdim.wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
///
|
///
|
||||||
void write(Buffer const *, std::ostream &) const;
|
void write(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
/// draw, either inlined (no button) or collapsed/open
|
/// draw, either inlined (no button) or collapsed/open
|
||||||
|
@ -61,14 +61,14 @@ dispatch_result InsetError::localDispatch(FuncRequest const & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetError::dimension(BufferView *, LyXFont const & font,
|
void InsetError::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
LyXFont efont;
|
LyXFont efont;
|
||||||
efont.setSize(font.size()).decSize();
|
efont.setSize(mi.base.font.size()).decSize();
|
||||||
dim.asc = font_metrics::maxAscent(efont) + 1;
|
dim_.asc = font_metrics::maxAscent(efont) + 1;
|
||||||
dim.des = font_metrics::maxDescent(efont) + 1;
|
dim_.des = font_metrics::maxDescent(efont) + 1;
|
||||||
dim.wid = 6 + font_metrics::width(_("Error"), efont);
|
dim_.wid = 6 + font_metrics::width(_("Error"), efont);
|
||||||
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,7 +84,11 @@ void InsetError::draw(PainterInfo & pi, int x, int y) const
|
|||||||
// Draw as "Error" in a framed box
|
// Draw as "Error" in a framed box
|
||||||
x += 1;
|
x += 1;
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
dimension(pi.base.bv, pi.base.font, dim);
|
MetricsInfo mi;
|
||||||
|
mi.base.bv = pi.base.bv;
|
||||||
|
mi.base.font = pi.base.font;
|
||||||
|
metrics(mi, dim);
|
||||||
|
dim_ = dim;
|
||||||
pi.pain.fillRectangle(x, y - dim.asc + 1,
|
pi.pain.fillRectangle(x, y - dim.asc + 1,
|
||||||
dim.wid - 2, dim.asc + dim.des - 2, LColor::insetbg);
|
dim.wid - 2, dim.asc + dim.des - 2, LColor::insetbg);
|
||||||
pi.pain.rectangle(x, y - dim.asc + 1,
|
pi.pain.rectangle(x, y - dim.asc + 1,
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "inset.h"
|
#include "inset.h"
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
#include "dimension.h"
|
||||||
|
|
||||||
/** Used for error messages from LaTeX runs.
|
/** Used for error messages from LaTeX runs.
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ public:
|
|||||||
///
|
///
|
||||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
@ -65,5 +66,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
string contents;
|
string contents;
|
||||||
|
///
|
||||||
|
mutable Dimension dim_;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -552,13 +552,12 @@ bool InsetERT::checkInsertChar(LyXFont & /* font */)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::dimension(BufferView * bv, LyXFont const & font,
|
void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
if (inlined())
|
if (inlined())
|
||||||
inset.dimension(bv, font, dim);
|
inset.metrics(mi, dim);
|
||||||
else
|
else
|
||||||
InsetCollapsable::dimension(bv, font, dim);
|
InsetCollapsable::metrics(mi, dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public:
|
|||||||
WordLangTuple const
|
WordLangTuple const
|
||||||
selectNextWordToSpellcheck(BufferView *, float &) const;
|
selectNextWordToSpellcheck(BufferView *, float &) const;
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
/// set the status of the inset
|
/// set the status of the inset
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
|
||||||
#include "insetfootlike.h"
|
#include "insetfootlike.h"
|
||||||
#include "lyxfont.h"
|
#include "lyxfont.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
@ -285,8 +285,7 @@ bool InsetGraphics::imageIsDrawable() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetGraphics::dimension(BufferView *, LyXFont const & font,
|
void InsetGraphics::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
cache_->old_ascent = 50;
|
cache_->old_ascent = 50;
|
||||||
if (imageIsDrawable())
|
if (imageIsDrawable())
|
||||||
@ -298,7 +297,7 @@ void InsetGraphics::dimension(BufferView *, LyXFont const & font,
|
|||||||
else {
|
else {
|
||||||
int font_width = 0;
|
int font_width = 0;
|
||||||
|
|
||||||
LyXFont msgFont(font);
|
LyXFont msgFont(mi.base.font);
|
||||||
msgFont.setFamily(LyXFont::SANS_FAMILY);
|
msgFont.setFamily(LyXFont::SANS_FAMILY);
|
||||||
|
|
||||||
string const justname = OnlyFilename(params().filename);
|
string const justname = OnlyFilename(params().filename);
|
||||||
@ -315,6 +314,7 @@ void InsetGraphics::dimension(BufferView *, LyXFont const & font,
|
|||||||
|
|
||||||
dim.wid = std::max(50, font_width + 15);
|
dim.wid = std::max(50, font_width + 15);
|
||||||
}
|
}
|
||||||
|
dim_ = dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -343,7 +343,11 @@ void InsetGraphics::draw(PainterInfo & pi, int x, int y) const
|
|||||||
int oasc = cache_->old_ascent;
|
int oasc = cache_->old_ascent;
|
||||||
|
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
dimension(bv, pi.base.font, dim);
|
MetricsInfo mi;
|
||||||
|
mi.base.bv = pi.base.bv;
|
||||||
|
mi.base.font = pi.base.font;
|
||||||
|
metrics(mi, dim);
|
||||||
|
dim_ = dim;
|
||||||
|
|
||||||
// we may have changed while someone other was drawing us so better
|
// we may have changed while someone other was drawing us so better
|
||||||
// to not draw anything as we surely call to redraw ourself soon.
|
// to not draw anything as we surely call to redraw ourself soon.
|
||||||
@ -367,14 +371,14 @@ void InsetGraphics::draw(PainterInfo & pi, int x, int y) const
|
|||||||
// we draw just a rectangle.
|
// we draw just a rectangle.
|
||||||
|
|
||||||
if (imageIsDrawable()) {
|
if (imageIsDrawable()) {
|
||||||
pi.pain.image(x + TEXT_TO_INSET_OFFSET, y - dim.asc,
|
pi.pain.image(x + TEXT_TO_INSET_OFFSET, y - dim_.asc,
|
||||||
dim.wid - 2 * TEXT_TO_INSET_OFFSET, dim.asc + dim.des,
|
dim_.wid - 2 * TEXT_TO_INSET_OFFSET, dim_.asc + dim_.des,
|
||||||
*cache_->loader.image());
|
*cache_->loader.image());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
pi.pain.rectangle(x + TEXT_TO_INSET_OFFSET, y - dim.asc,
|
pi.pain.rectangle(x + TEXT_TO_INSET_OFFSET, y - dim_.asc,
|
||||||
dim.wid - 2 * TEXT_TO_INSET_OFFSET, dim.asc + dim.des);
|
dim_.wid - 2 * TEXT_TO_INSET_OFFSET, dim_.asc + dim_.des);
|
||||||
|
|
||||||
// Print the file name.
|
// Print the file name.
|
||||||
LyXFont msgFont = pi.base.font;
|
LyXFont msgFont = pi.base.font;
|
||||||
|
@ -13,8 +13,9 @@
|
|||||||
#ifndef INSET_GRAPHICS_H
|
#ifndef INSET_GRAPHICS_H
|
||||||
#define INSET_GRAPHICS_H
|
#define INSET_GRAPHICS_H
|
||||||
|
|
||||||
#include "insets/inset.h"
|
#include "inset.h"
|
||||||
#include "insets/insetgraphicsParams.h"
|
#include "insetgraphicsParams.h"
|
||||||
|
#include "dimension.h"
|
||||||
|
|
||||||
#include <boost/signals/trackable.hpp>
|
#include <boost/signals/trackable.hpp>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
@ -34,7 +35,7 @@ public:
|
|||||||
///
|
///
|
||||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
@ -113,6 +114,8 @@ private:
|
|||||||
friend class Cache;
|
friend class Cache;
|
||||||
/// The pointer never changes although *cache_'s contents may.
|
/// The pointer never changes although *cache_'s contents may.
|
||||||
boost::scoped_ptr<Cache> const cache_;
|
boost::scoped_ptr<Cache> const cache_;
|
||||||
|
/// dimension cache
|
||||||
|
mutable Dimension dim_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -512,24 +512,16 @@ void InsetInclude::fillWithBibKeys(vector<pair<string,string> > & keys) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetInclude::ascent(BufferView * bv, LyXFont const & font) const
|
void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
return preview_->previewReady() ?
|
if (preview_->previewReady()) {
|
||||||
preview_->pimage()->ascent() : InsetButton::ascent(bv, font);
|
dim.asc = preview_->pimage()->ascent();
|
||||||
}
|
dim.des = preview_->pimage()->descent();
|
||||||
|
dim.wid = preview_->pimage()->width();
|
||||||
|
} else {
|
||||||
int InsetInclude::descent(BufferView * bv, LyXFont const & font) const
|
InsetButton::metrics(mi, dim);
|
||||||
{
|
}
|
||||||
return preview_->previewReady() ?
|
dim_ = dim;
|
||||||
preview_->pimage()->descent() : InsetButton::descent(bv, font);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int InsetInclude::width(BufferView * bv, LyXFont const & font) const
|
|
||||||
{
|
|
||||||
return preview_->previewReady() ?
|
|
||||||
preview_->pimage()->width() : InsetButton::width(bv, font);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -545,7 +537,11 @@ void InsetInclude::draw(PainterInfo & pi, int x, int y) const
|
|||||||
preview_->startMonitoring();
|
preview_->startMonitoring();
|
||||||
|
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
dimension(pi.base.bv, pi.base.font, dim);
|
MetricsInfo mi;
|
||||||
|
mi.base.bv = pi.base.bv;
|
||||||
|
mi.base.font = pi.base.font;
|
||||||
|
metrics(mi, dim);
|
||||||
|
dim_ = dim;
|
||||||
|
|
||||||
pi.pain.image(x, y - dim.asc, dim.wid, dim.height(),
|
pi.pain.image(x, y - dim.asc, dim.wid, dim.height(),
|
||||||
*(preview_->pimage()->image()));
|
*(preview_->pimage()->image()));
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#define INSET_INCLUDE_H
|
#define INSET_INCLUDE_H
|
||||||
|
|
||||||
#include "insetcommand.h"
|
#include "insetcommand.h"
|
||||||
|
#include "dimension.h"
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
@ -60,11 +61,7 @@ public:
|
|||||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||||
|
|
||||||
/// Override these InsetButton methods if Previewing
|
/// Override these InsetButton methods if Previewing
|
||||||
int ascent(BufferView *, LyXFont const &) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
|
||||||
int descent(BufferView *, LyXFont const &) const;
|
|
||||||
///
|
|
||||||
int width(BufferView *, LyXFont const &) const;
|
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
|
|
||||||
@ -131,6 +128,9 @@ private:
|
|||||||
friend class PreviewImpl;
|
friend class PreviewImpl;
|
||||||
/// The pointer never changes although *preview_'s contents may.
|
/// The pointer never changes although *preview_'s contents may.
|
||||||
boost::scoped_ptr<PreviewImpl> const preview_;
|
boost::scoped_ptr<PreviewImpl> const preview_;
|
||||||
|
|
||||||
|
/// cache
|
||||||
|
mutable Dimension dim_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include "insetlatexaccent.h"
|
#include "insetlatexaccent.h"
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "dimension.h"
|
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
@ -264,9 +263,9 @@ void InsetLatexAccent::checkContents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetLatexAccent::dimension(BufferView *, LyXFont const & font,
|
void InsetLatexAccent::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
|
LyXFont & font = mi.base.font;
|
||||||
// This function is a bit too simplistic and is just a
|
// This function is a bit too simplistic and is just a
|
||||||
// "try to make a fit for all accents" approach, to
|
// "try to make a fit for all accents" approach, to
|
||||||
// make it better we need to know what kind of accent is
|
// make it better we need to know what kind of accent is
|
||||||
@ -292,6 +291,7 @@ void InsetLatexAccent::dimension(BufferView *, LyXFont const & font,
|
|||||||
dim.des = font_metrics::maxDescent(font) + 4;
|
dim.des = font_metrics::maxDescent(font) + 4;
|
||||||
dim.wid = font_metrics::width(contents, font) + 4;
|
dim.wid = font_metrics::width(contents, font) + 4;
|
||||||
}
|
}
|
||||||
|
dim_ = dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -363,7 +363,11 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
|
|||||||
font.setLanguage(english_language);
|
font.setLanguage(english_language);
|
||||||
|
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
dimension(bv, font, dim);
|
MetricsInfo mi;
|
||||||
|
mi.base.bv = pi.base.bv;
|
||||||
|
mi.base.font = pi.base.font;
|
||||||
|
metrics(mi, dim);
|
||||||
|
dim_ = dim;
|
||||||
|
|
||||||
if (candisp) {
|
if (candisp) {
|
||||||
float x2 = x + (rbearing(font) - lbearing(font)) / 2.0;
|
float x2 = x + (rbearing(font) - lbearing(font)) / 2.0;
|
||||||
@ -372,13 +376,13 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
|
|||||||
if (plusasc) {
|
if (plusasc) {
|
||||||
// mark at the top
|
// mark at the top
|
||||||
hg = font_metrics::maxDescent(font);
|
hg = font_metrics::maxDescent(font);
|
||||||
y = baseline - dim.asc;
|
y = baseline - dim_.asc;
|
||||||
|
|
||||||
if (font.shape() == LyXFont::ITALIC_SHAPE)
|
if (font.shape() == LyXFont::ITALIC_SHAPE)
|
||||||
x2 += (4.0 * hg) / 5.0; // italic
|
x2 += (4.0 * hg) / 5.0; // italic
|
||||||
} else {
|
} else {
|
||||||
// at the bottom
|
// at the bottom
|
||||||
hg = dim.des;
|
hg = dim_.des;
|
||||||
y = baseline;
|
y = baseline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +399,7 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
|
|||||||
tmpx += int(0.8 * hg); // italic
|
tmpx += int(0.8 * hg); // italic
|
||||||
lyxerr[Debug::KEY] << "Removing dot." << endl;
|
lyxerr[Debug::KEY] << "Removing dot." << endl;
|
||||||
// remove the dot first
|
// remove the dot first
|
||||||
pi.pain.fillRectangle(x + tmpx, tmpvar, dim.wid,
|
pi.pain.fillRectangle(x + tmpx, tmpvar, dim_.wid,
|
||||||
font_metrics::ascent('i', pi.base.font) -
|
font_metrics::ascent('i', pi.base.font) -
|
||||||
font_metrics::ascent('x', pi.base.font) - 1,
|
font_metrics::ascent('x', pi.base.font) - 1,
|
||||||
backgroundColor());
|
backgroundColor());
|
||||||
@ -506,17 +510,17 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
|
|||||||
case SPECIAL_CARON: // special caron
|
case SPECIAL_CARON: // special caron
|
||||||
{
|
{
|
||||||
switch (ic) {
|
switch (ic) {
|
||||||
case 'L': dim.wid = int(4.0 * dim.wid / 5.0); break;
|
case 'L': dim_.wid = int(4.0 * dim_.wid / 5.0); break;
|
||||||
case 't': y -= int(hg35 / 2.0); break;
|
case 't': y -= int(hg35 / 2.0); break;
|
||||||
}
|
}
|
||||||
int xp[3], yp[3];
|
int xp[3], yp[3];
|
||||||
xp[0] = int(x + dim.wid);
|
xp[0] = int(x + dim_.wid);
|
||||||
yp[0] = int(y + hg35 + hg);
|
yp[0] = int(y + hg35 + hg);
|
||||||
|
|
||||||
xp[1] = int(x + dim.wid + (hg35 / 2.0));
|
xp[1] = int(x + dim_.wid + (hg35 / 2.0));
|
||||||
yp[1] = int(y + hg + (hg35 / 2.0));
|
yp[1] = int(y + hg + (hg35 / 2.0));
|
||||||
|
|
||||||
xp[2] = int(x + dim.wid + (hg35 / 2.0));
|
xp[2] = int(x + dim_.wid + (hg35 / 2.0));
|
||||||
yp[2] = y + int(hg);
|
yp[2] = y + int(hg);
|
||||||
|
|
||||||
pi.pain.lines(xp, yp, 3);
|
pi.pain.lines(xp, yp, 3);
|
||||||
@ -577,7 +581,7 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
|
|||||||
xp[0] = int(x);
|
xp[0] = int(x);
|
||||||
yp[0] = y + int(3.0 * hg);
|
yp[0] = y + int(3.0 * hg);
|
||||||
|
|
||||||
xp[1] = int(x + float(dim.wid) * 0.75);
|
xp[1] = int(x + float(dim_.wid) * 0.75);
|
||||||
yp[1] = y + int(hg);
|
yp[1] = y + int(hg);
|
||||||
|
|
||||||
pi.pain.lines(xp, yp, 2);
|
pi.pain.lines(xp, yp, 2);
|
||||||
@ -592,10 +596,10 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pi.pain.fillRectangle(x + 1,
|
pi.pain.fillRectangle(x + 1,
|
||||||
baseline - dim.asc + 1, dim.wid - 2,
|
baseline - dim_.asc + 1, dim_.wid - 2,
|
||||||
dim.asc + dim.des - 2, backgroundColor());
|
dim_.asc + dim_.des - 2, backgroundColor());
|
||||||
pi.pain.rectangle(x + 1, baseline - dim.asc + 1,
|
pi.pain.rectangle(x + 1, baseline - dim_.asc + 1,
|
||||||
dim.wid - 2, dim.asc + dim.des - 2);
|
dim_.wid - 2, dim_.asc + dim_.des - 2);
|
||||||
pi.pain.text(x + 2, baseline, contents, font);
|
pi.pain.text(x + 2, baseline, contents, font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,11 +12,9 @@
|
|||||||
#ifndef INSET_LATEX_ACCENT_H
|
#ifndef INSET_LATEX_ACCENT_H
|
||||||
#define INSET_LATEX_ACCENT_H
|
#define INSET_LATEX_ACCENT_H
|
||||||
|
|
||||||
|
|
||||||
#include "inset.h"
|
#include "inset.h"
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
#include "dimension.h"
|
||||||
class LyXLex;
|
|
||||||
|
|
||||||
/** Insertion of accents
|
/** Insertion of accents
|
||||||
|
|
||||||
@ -34,7 +32,7 @@ public:
|
|||||||
explicit
|
explicit
|
||||||
InsetLatexAccent(string const & string);
|
InsetLatexAccent(string const & string);
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
@ -131,6 +129,8 @@ private:
|
|||||||
bool plusdesc;
|
bool plusdesc;
|
||||||
/// international char
|
/// international char
|
||||||
mutable char ic;
|
mutable char ic;
|
||||||
|
///
|
||||||
|
mutable Dimension dim_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,14 +218,13 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetMinipage::dimension(BufferView * bv, LyXFont const & font,
|
void InsetMinipage::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
if (collapsed_)
|
if (collapsed_)
|
||||||
dimension_collapsed(dim);
|
dimension_collapsed(dim);
|
||||||
else {
|
else {
|
||||||
Dimension d;
|
Dimension d;
|
||||||
InsetCollapsable::dimension(bv, font, d);
|
InsetCollapsable::metrics(mi, d);
|
||||||
switch (params_.pos) {
|
switch (params_.pos) {
|
||||||
case top:
|
case top:
|
||||||
dim.asc = d.asc;
|
dim.asc = d.asc;
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
///
|
///
|
||||||
Inset * clone(Buffer const &) const;
|
Inset * clone(Buffer const &) const;
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
Inset::Code lyxCode() const { return Inset::MINIPAGE_CODE; }
|
Inset::Code lyxCode() const { return Inset::MINIPAGE_CODE; }
|
||||||
///
|
///
|
||||||
|
@ -38,9 +38,9 @@ void InsetNewline::write(Buffer const *, ostream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetNewline::dimension(BufferView *, LyXFont const & font,
|
void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
|
LyXFont & font = mi.base.font;
|
||||||
dim.asc = font_metrics::maxAscent(font);
|
dim.asc = font_metrics::maxAscent(font);
|
||||||
dim.des = font_metrics::maxDescent(font);
|
dim.des = font_metrics::maxDescent(font);
|
||||||
dim.wid = font_metrics::width('n', font);
|
dim.wid = font_metrics::width('n', font);
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
Inset::Code lyxCode() const { return Inset::NEWLINE_CODE; }
|
Inset::Code lyxCode() const { return Inset::NEWLINE_CODE; }
|
||||||
|
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
|
|
||||||
virtual void draw(PainterInfo & pi, int x, int y) const;
|
virtual void draw(PainterInfo & pi, int x, int y) const;
|
||||||
|
|
||||||
|
@ -171,9 +171,9 @@ string const InsetQuotes::dispString(Language const * loclang) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetQuotes::dimension(BufferView *, LyXFont const & font,
|
void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
|
LyXFont & font = mi.base.font;
|
||||||
dim.asc = font_metrics::maxAscent(font);
|
dim.asc = font_metrics::maxAscent(font);
|
||||||
dim.des = font_metrics::maxDescent(font);
|
dim.des = font_metrics::maxDescent(font);
|
||||||
dim.wid = 0;
|
dim.wid = 0;
|
||||||
|
@ -69,8 +69,9 @@ public:
|
|||||||
InsetQuotes(char c, BufferParams const & params);
|
InsetQuotes(char c, BufferParams const & params);
|
||||||
///
|
///
|
||||||
Inset * clone(Buffer const &) const;
|
Inset * clone(Buffer const &) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -45,9 +45,9 @@ InsetSpace::Kind InsetSpace::kind() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetSpace::dimension(BufferView *, LyXFont const & font,
|
void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
|
LyXFont & font = mi.base.font;
|
||||||
dim.asc = font_metrics::maxAscent(font);
|
dim.asc = font_metrics::maxAscent(font);
|
||||||
dim.des = font_metrics::maxDescent(font);
|
dim.des = font_metrics::maxDescent(font);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
///
|
///
|
||||||
Kind kind() const;
|
Kind kind() const;
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -39,9 +39,9 @@ InsetSpecialChar::Kind InsetSpecialChar::kind() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetSpecialChar::dimension(BufferView *, LyXFont const & font,
|
void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
|
LyXFont & font = mi.base.font;
|
||||||
dim.asc = font_metrics::maxAscent(font);
|
dim.asc = font_metrics::maxAscent(font);
|
||||||
dim.des = font_metrics::maxDescent(font);
|
dim.des = font_metrics::maxDescent(font);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
///
|
///
|
||||||
Kind kind() const;
|
Kind kind() const;
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -243,7 +243,7 @@ void InsetTabular::read(Buffer const * buf, LyXLex & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::dimension(BufferView *, LyXFont const &,
|
void InsetTabular::metrics(MetricsInfo &,
|
||||||
Dimension & dim) const
|
Dimension & dim) const
|
||||||
{
|
{
|
||||||
dim.asc = tabular->GetAscentOfRow(0);
|
dim.asc = tabular->GetAscentOfRow(0);
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
///
|
///
|
||||||
void write(Buffer const *, std::ostream &) const;
|
void write(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -293,15 +293,14 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetText::dimension(BufferView * bv, LyXFont const &,
|
void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
|
BufferView * bv = mi.base.bv;
|
||||||
LyXText * text = getLyXText(bv);
|
LyXText * text = getLyXText(bv);
|
||||||
dim.asc = text->rows().begin()->ascent_of_text() + TEXT_TO_INSET_OFFSET;
|
dim.asc = text->rows().begin()->ascent_of_text() + TEXT_TO_INSET_OFFSET;
|
||||||
dim.des = text->height - dim.asc + TEXT_TO_INSET_OFFSET;
|
dim.des = text->height - dim.asc + TEXT_TO_INSET_OFFSET;
|
||||||
dim.wid = max(textWidth(bv), int(text->width)) + 2 * TEXT_TO_INSET_OFFSET;
|
dim.wid = max(textWidth(bv), int(text->width)) + 2 * TEXT_TO_INSET_OFFSET;
|
||||||
dim.wid = max(dim.wid, 10);
|
dim.wid = max(dim.wid, 10);
|
||||||
// cache it
|
|
||||||
dim_ = dim;
|
dim_ = dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,9 +335,6 @@ void InsetText::draw(PainterInfo & pi, int x, int baseline) const
|
|||||||
BufferView * bv = pi.base.bv;
|
BufferView * bv = pi.base.bv;
|
||||||
Painter & pain = pi.pain;
|
Painter & pain = pi.pain;
|
||||||
|
|
||||||
// call this method so that dim_ has the right value
|
|
||||||
dimension(bv, pi.base.font, dim_);
|
|
||||||
|
|
||||||
// repaint the background if needed
|
// repaint the background if needed
|
||||||
if (backgroundColor() != LColor::background)
|
if (backgroundColor() != LColor::background)
|
||||||
clearInset(bv, start_x + TEXT_TO_INSET_OFFSET, baseline);
|
clearInset(bv, start_x + TEXT_TO_INSET_OFFSET, baseline);
|
||||||
|
@ -87,7 +87,7 @@ public:
|
|||||||
///
|
///
|
||||||
void write(Buffer const *, std::ostream &) const;
|
void write(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
int textWidth(BufferView *, bool fordraw = false) const;
|
int textWidth(BufferView *, bool fordraw = false) const;
|
||||||
///
|
///
|
||||||
|
@ -16,7 +16,7 @@ ButtonInset::ButtonInset()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Dimension ButtonInset::metrics(MetricsInfo & mi) const
|
void ButtonInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
FontSetChanger dummy(mi.base, "textnormal");
|
FontSetChanger dummy(mi.base, "textnormal");
|
||||||
if (editing()) {
|
if (editing()) {
|
||||||
@ -28,7 +28,7 @@ Dimension ButtonInset::metrics(MetricsInfo & mi) const
|
|||||||
mathed_string_dim(mi.base.font, screenLabel(), dim_);
|
mathed_string_dim(mi.base.font, screenLabel(), dim_);
|
||||||
dim_.wid += 10;
|
dim_.wid += 10;
|
||||||
}
|
}
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public:
|
|||||||
///
|
///
|
||||||
ButtonInset();
|
ButtonInset();
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
|
|
||||||
|
@ -89,11 +89,11 @@ InsetFormula::InsetFormula(InsetFormula const & other)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
InsetFormula::InsetFormula(BufferView * bv)
|
InsetFormula::InsetFormula(BufferView *)
|
||||||
: par_(MathAtom(new MathHullInset)),
|
: par_(MathAtom(new MathHullInset)),
|
||||||
preview_(new PreviewImpl(*this))
|
preview_(new PreviewImpl(*this))
|
||||||
{
|
{
|
||||||
view_ = bv->owner()->view();
|
//view_ = bv->owner()->view();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ int InsetFormula::ascii(Buffer const *, ostream & os, int) const
|
|||||||
par()->drawT(tpain, 0, dim.ascent());
|
par()->drawT(tpain, 0, dim.ascent());
|
||||||
tpain.show(os, 3);
|
tpain.show(os, 3);
|
||||||
// reset metrics cache to "real" values
|
// reset metrics cache to "real" values
|
||||||
metrics();
|
//metrics();
|
||||||
return tpain.textheight();
|
return tpain.textheight();
|
||||||
} else {
|
} else {
|
||||||
WriteStream wi(os, false, true);
|
WriteStream wi(os, false, true);
|
||||||
@ -201,7 +201,7 @@ void InsetFormula::read(Buffer const *, LyXLex & lex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
metrics();
|
//metrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -220,7 +220,11 @@ void InsetFormula::draw(PainterInfo & pi, int x, int y) const
|
|||||||
bool const use_preview = preview_->previewReady();
|
bool const use_preview = preview_->previewReady();
|
||||||
|
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
dimension(pi.base.bv, pi.base.font, dim);
|
MetricsInfo mi;
|
||||||
|
mi.base.bv = pi.base.bv;
|
||||||
|
mi.base.font = pi.base.font;
|
||||||
|
metrics(mi, dim);
|
||||||
|
dim_ = dim;
|
||||||
int const w = dim.wid;
|
int const w = dim.wid;
|
||||||
int const d = dim.des;
|
int const d = dim.des;
|
||||||
int const a = dim.asc;
|
int const a = dim.asc;
|
||||||
@ -282,23 +286,25 @@ bool InsetFormula::insetAllowed(Inset::Code code) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetFormula::dimension(BufferView * bv, LyXFont const & font,
|
void InsetFormula::metrics(MetricsInfo & m, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
metrics(bv, font, dim);
|
view_ = m.base.bv;
|
||||||
if (preview_->previewReady()) {
|
if (preview_->previewReady()) {
|
||||||
dim.asc = preview_->pimage()->ascent();
|
dim_.asc = preview_->pimage()->ascent();
|
||||||
int const descent = preview_->pimage()->descent();
|
dim_.des = preview_->pimage()->descent();
|
||||||
dim.des = display() ? descent + 12 : descent;
|
|
||||||
// insert a one pixel gap in front of the formula
|
// insert a one pixel gap in front of the formula
|
||||||
dim.wid = 1 + preview_->pimage()->width();
|
dim_.wid = 1 + preview_->pimage()->width();
|
||||||
|
if (display())
|
||||||
|
dim_.des += 12;
|
||||||
} else {
|
} else {
|
||||||
MetricsInfo mi;
|
MetricsInfo mi = m;
|
||||||
mi.base.bv = bv;
|
mi.base.style = LM_ST_TEXT;
|
||||||
dim = par()->metrics(mi);
|
mi.base.font.setColor(LColor::math);
|
||||||
dim.asc += 1;
|
par()->metrics(mi, dim_);
|
||||||
dim.des += 1;
|
dim_.asc += 1;
|
||||||
|
dim_.des += 1;
|
||||||
}
|
}
|
||||||
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,12 +15,12 @@
|
|||||||
#ifndef INSET_FORMULA_H
|
#ifndef INSET_FORMULA_H
|
||||||
#define INSET_FORMULA_H
|
#define INSET_FORMULA_H
|
||||||
|
|
||||||
|
|
||||||
#include "formulabase.h"
|
#include "formulabase.h"
|
||||||
#include "math_atom.h"
|
#include "math_atom.h"
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
|
|
||||||
/// The main LyX math inset
|
/// The main LyX math inset
|
||||||
class InsetFormula : public InsetFormulaBase {
|
class InsetFormula : public InsetFormulaBase {
|
||||||
public:
|
public:
|
||||||
@ -35,7 +35,7 @@ public:
|
|||||||
///
|
///
|
||||||
~InsetFormula();
|
~InsetFormula();
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "math_support.h"
|
#include "math_support.h"
|
||||||
#include "metricsinfo.h"
|
#include "metricsinfo.h"
|
||||||
|
#include "math_data.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
#include "frontends/font_metrics.h"
|
#include "frontends/font_metrics.h"
|
||||||
#include "frontends/mouse_state.h"
|
#include "frontends/mouse_state.h"
|
||||||
#include "Lsstream.h"
|
|
||||||
#include "math_arrayinset.h"
|
#include "math_arrayinset.h"
|
||||||
#include "math_charinset.h"
|
#include "math_charinset.h"
|
||||||
#include "math_deliminset.h"
|
#include "math_deliminset.h"
|
||||||
@ -83,7 +83,7 @@ bool openNewInset(BufferView * bv, UpdatableInset * new_inset)
|
|||||||
|
|
||||||
|
|
||||||
InsetFormulaBase::InsetFormulaBase()
|
InsetFormulaBase::InsetFormulaBase()
|
||||||
: font_(), xo_(0), yo_(0)
|
: xo_(0), yo_(0)
|
||||||
{
|
{
|
||||||
// This is needed as long the math parser is not re-entrant
|
// This is needed as long the math parser is not re-entrant
|
||||||
initMath();
|
initMath();
|
||||||
@ -133,7 +133,7 @@ void InsetFormulaBase::handleFont
|
|||||||
|
|
||||||
BufferView * InsetFormulaBase::view() const
|
BufferView * InsetFormulaBase::view() const
|
||||||
{
|
{
|
||||||
return view_.lock().get();
|
return view_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,27 +141,6 @@ void InsetFormulaBase::validate(LaTeXFeatures &) const
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void InsetFormulaBase::metrics(BufferView * bv, LyXFont const & f,
|
|
||||||
Dimension & /*dim*/) const
|
|
||||||
{
|
|
||||||
font_ = f;
|
|
||||||
metrics(bv);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetFormulaBase::metrics(BufferView * bv) const
|
|
||||||
{
|
|
||||||
if (bv)
|
|
||||||
view_ = bv->owner()->view();
|
|
||||||
MetricsInfo mi;
|
|
||||||
mi.base.bv = bv;
|
|
||||||
mi.base.style = LM_ST_TEXT;
|
|
||||||
mi.base.font = font_;
|
|
||||||
mi.base.font.setColor(LColor::math);
|
|
||||||
par()->metrics(mi);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
string const InsetFormulaBase::editMessage() const
|
string const InsetFormulaBase::editMessage() const
|
||||||
{
|
{
|
||||||
return _("Math editor mode");
|
return _("Math editor mode");
|
||||||
@ -211,7 +190,9 @@ void InsetFormulaBase::fitInsetCursor(BufferView * bv) const
|
|||||||
if (!mathcursor)
|
if (!mathcursor)
|
||||||
return;
|
return;
|
||||||
int x, y, asc, des;
|
int x, y, asc, des;
|
||||||
math_font_max_dim(font_, asc, des);
|
asc = 10;
|
||||||
|
des = 2;
|
||||||
|
//math_font_max_dim(font_, asc, des);
|
||||||
getCursorPos(bv, x, y);
|
getCursorPos(bv, x, y);
|
||||||
//y += yo_;
|
//y += yo_;
|
||||||
//lyxerr << "fitInsetCursor: x: " << x << " y: " << y << " yo: " << yo_ << endl;
|
//lyxerr << "fitInsetCursor: x: " << x << " y: " << y << " yo: " << yo_ << endl;
|
||||||
@ -252,9 +233,11 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cmd.button() == mouse_button::button2) {
|
if (cmd.button() == mouse_button::button2) {
|
||||||
|
MathArray ar;
|
||||||
|
asArray(bv->getClipboard(), ar);
|
||||||
mathcursor->selClear();
|
mathcursor->selClear();
|
||||||
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
|
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
|
||||||
mathcursor->insert(asArray(bv->getClipboard()));
|
mathcursor->insert(ar);
|
||||||
bv->updateInset(this);
|
bv->updateInset(this);
|
||||||
return DISPATCHED;
|
return DISPATCHED;
|
||||||
}
|
}
|
||||||
@ -284,7 +267,7 @@ dispatch_result InsetFormulaBase::lfunMousePress(FuncRequest const & cmd)
|
|||||||
lyxerr[Debug::MATHED] << "re-create cursor" << endl;
|
lyxerr[Debug::MATHED] << "re-create cursor" << endl;
|
||||||
releaseMathCursor(bv);
|
releaseMathCursor(bv);
|
||||||
mathcursor = new MathCursor(this, cmd.x == 0);
|
mathcursor = new MathCursor(this, cmd.x == 0);
|
||||||
metrics(bv);
|
//metrics(bv);
|
||||||
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
|
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,10 +339,10 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
|||||||
releaseMathCursor(bv);
|
releaseMathCursor(bv);
|
||||||
if (!cmd.argument.empty()) {
|
if (!cmd.argument.empty()) {
|
||||||
mathcursor = new MathCursor(this, cmd.argument == "left");
|
mathcursor = new MathCursor(this, cmd.argument == "left");
|
||||||
metrics(bv);
|
//metrics(bv);
|
||||||
} else {
|
} else {
|
||||||
mathcursor = new MathCursor(this, true);
|
mathcursor = new MathCursor(this, true);
|
||||||
metrics(bv);
|
//metrics(bv);
|
||||||
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
|
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
|
||||||
}
|
}
|
||||||
// if that is removed, we won't get the magenta box when entering an
|
// if that is removed, we won't get the magenta box when entering an
|
||||||
@ -682,7 +665,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
|||||||
if (argument.size() == 1)
|
if (argument.size() == 1)
|
||||||
result = mathcursor->interpret(argument[0]) ? DISPATCHED : FINISHED_RIGHT;
|
result = mathcursor->interpret(argument[0]) ? DISPATCHED : FINISHED_RIGHT;
|
||||||
else
|
else
|
||||||
mathcursor->insert(asArray(argument));
|
mathcursor->insert(argument);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -811,13 +794,13 @@ Inset::Code InsetFormulaBase::lyxCode() const
|
|||||||
|
|
||||||
int InsetFormulaBase::ylow() const
|
int InsetFormulaBase::ylow() const
|
||||||
{
|
{
|
||||||
return yo_ - ascent(view(), font_);
|
return yo_ - dim_.asc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetFormulaBase::yhigh() const
|
int InsetFormulaBase::yhigh() const
|
||||||
{
|
{
|
||||||
return yo_ + descent(view(), font_);
|
return yo_ + dim_.des;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -829,7 +812,7 @@ int InsetFormulaBase::xlow() const
|
|||||||
|
|
||||||
int InsetFormulaBase::xhigh() const
|
int InsetFormulaBase::xhigh() const
|
||||||
{
|
{
|
||||||
return xo_ + width(view(), font_);
|
return xo_ + dim_.wid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -868,7 +851,7 @@ bool InsetFormulaBase::searchForward(BufferView * bv, string const & str,
|
|||||||
}
|
}
|
||||||
delete mathcursor;
|
delete mathcursor;
|
||||||
mathcursor = new MathCursor(this, true);
|
mathcursor = new MathCursor(this, true);
|
||||||
metrics(bv);
|
//metrics(bv);
|
||||||
mathcursor->setSelection(it, ar.size());
|
mathcursor->setSelection(it, ar.size());
|
||||||
current = it;
|
current = it;
|
||||||
it.jump(ar.size());
|
it.jump(ar.size());
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#define INSET_FORMULABASE_H
|
#define INSET_FORMULABASE_H
|
||||||
|
|
||||||
#include "insets/updatableinset.h"
|
#include "insets/updatableinset.h"
|
||||||
#include "lyxfont.h"
|
#include "dimension.h"
|
||||||
|
|
||||||
#include <boost/weak_ptr.hpp>
|
#include <boost/weak_ptr.hpp>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
@ -108,15 +108,10 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
mutable boost::weak_ptr<BufferView> view_;
|
//mutable boost::weak_ptr<BufferView> view_;
|
||||||
///
|
mutable BufferView * view_;
|
||||||
mutable LyXFont font_;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///
|
|
||||||
void metrics(BufferView * bv, LyXFont const & font, Dimension & dim) const;
|
|
||||||
///
|
|
||||||
void metrics(BufferView * bv = 0) const;
|
|
||||||
///
|
///
|
||||||
void handleFont(BufferView * bv, string const & arg, string const & font);
|
void handleFont(BufferView * bv, string const & arg, string const & font);
|
||||||
|
|
||||||
@ -124,6 +119,8 @@ protected:
|
|||||||
mutable int xo_;
|
mutable int xo_;
|
||||||
///
|
///
|
||||||
mutable int yo_;
|
mutable int yo_;
|
||||||
|
///
|
||||||
|
mutable Dimension dim_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// We don't really mess want around with mathed stuff outside mathed.
|
// We don't really mess want around with mathed stuff outside mathed.
|
||||||
|
@ -29,16 +29,13 @@
|
|||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
#include "frontends/font_metrics.h"
|
#include "frontends/font_metrics.h"
|
||||||
#include "support/lyxlib.h"
|
#include "support/lyxlib.h"
|
||||||
|
#include "support/lstrings.h"
|
||||||
#include "support/LOstream.h"
|
#include "support/LOstream.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyxlex.h"
|
#include "lyxlex.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "lyxfont.h"
|
|
||||||
|
|
||||||
#include "Lsstream.h"
|
#include "Lsstream.h"
|
||||||
|
|
||||||
#include "support/BoostFormat.h"
|
|
||||||
|
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
|
|
||||||
extern MathCursor * mathcursor;
|
extern MathCursor * mathcursor;
|
||||||
@ -125,31 +122,24 @@ void InsetFormulaMacro::read(std::istream & is)
|
|||||||
MathMacroTemplate * p = new MathMacroTemplate(is);
|
MathMacroTemplate * p = new MathMacroTemplate(is);
|
||||||
setInsetName(p->name());
|
setInsetName(p->name());
|
||||||
MathMacroTable::create(MathAtom(p));
|
MathMacroTable::create(MathAtom(p));
|
||||||
metrics();
|
//metrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string InsetFormulaMacro::prefix() const
|
string InsetFormulaMacro::prefix() const
|
||||||
{
|
{
|
||||||
#if USE_BOOST_FORMAT
|
return bformat(_(" Macro: %s: "), getInsetName());
|
||||||
return STRCONV(boost::io::str(boost::format(_(" Macro: %s: ")) %
|
|
||||||
STRCONV(getInsetName())));
|
|
||||||
#else
|
|
||||||
return _(" Macro: ") + getInsetName() + ": ";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetFormulaMacro::dimension(BufferView * bv, LyXFont const & font,
|
void InsetFormulaMacro::metrics(MetricsInfo & m, Dimension & dim) const
|
||||||
Dimension & dim) const
|
|
||||||
{
|
{
|
||||||
MetricsInfo mi;
|
MetricsInfo mi = m;
|
||||||
mi.base.bv = bv;
|
par()->metrics(mi, dim_);
|
||||||
mi.base.font = font;
|
dim_.asc += 5;
|
||||||
dim = par()->metrics(mi);
|
dim_.des += 5;
|
||||||
dim.asc += 5;
|
dim_.wid += 10 + font_metrics::width(prefix(), mi.base.font);
|
||||||
dim.des += 5;
|
dim = dim_;
|
||||||
dim.wid += 10 + font_metrics::width(prefix(), font);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -182,7 +172,11 @@ void InsetFormulaMacro::draw(PainterInfo & p, int x, int y) const
|
|||||||
pi.base.font = font;
|
pi.base.font = font;
|
||||||
|
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
dimension(pi.base.bv, font, dim);
|
MetricsInfo mi;
|
||||||
|
mi.base.bv = pi.base.bv;
|
||||||
|
mi.base.font = pi.base.font;
|
||||||
|
metrics(mi, dim);
|
||||||
|
dim_ = dim;
|
||||||
int const a = y - dim.asc + 1;
|
int const a = y - dim.asc + 1;
|
||||||
int const w = dim.wid - 2;
|
int const w = dim.wid - 2;
|
||||||
int const h = dim.height() - 2;
|
int const h = dim.height() - 2;
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
/// constructs a mocro from its LaTeX definition
|
/// constructs a mocro from its LaTeX definition
|
||||||
explicit InsetFormulaMacro(string const & s);
|
explicit InsetFormulaMacro(string const & s);
|
||||||
///
|
///
|
||||||
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include "math_amsarrayinset.h"
|
#include "math_amsarrayinset.h"
|
||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
#include "metricsinfo.h"
|
#include "metricsinfo.h"
|
||||||
#include "math_support.h"
|
|
||||||
#include "math_streamstr.h"
|
#include "math_streamstr.h"
|
||||||
#include "math_support.h"
|
#include "math_support.h"
|
||||||
#include "Lsstream.h"
|
#include "Lsstream.h"
|
||||||
@ -57,14 +56,14 @@ char const * MathAMSArrayInset::name_right() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathAMSArrayInset::metrics(MetricsInfo & mi) const
|
void MathAMSArrayInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
MetricsInfo m = mi;
|
MetricsInfo m = mi;
|
||||||
if (m.base.style == LM_ST_DISPLAY)
|
if (m.base.style == LM_ST_DISPLAY)
|
||||||
m.base.style = LM_ST_TEXT;
|
m.base.style = LM_ST_TEXT;
|
||||||
MathGridInset::metrics(m);
|
MathGridInset::metrics(m);
|
||||||
dim_.wid += 12;
|
dim_.wid += 12;
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pain, int x, int y) const;
|
void draw(PainterInfo & pain, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -63,12 +63,12 @@ MathInset * MathArrayInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathArrayInset::metrics(MetricsInfo & mi) const
|
void MathArrayInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
ArrayChanger dummy(mi.base);
|
ArrayChanger dummy(mi.base);
|
||||||
MathGridInset::metrics(mi);
|
MathGridInset::metrics(mi);
|
||||||
metricsMarkers2();
|
metricsMarkers2();
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -35,14 +35,14 @@ double MathBigInset::increase() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathBigInset::metrics(MetricsInfo & mi) const
|
void MathBigInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
double const h = mathed_char_ascent(mi.base.font, 'I');
|
double const h = mathed_char_ascent(mi.base.font, 'I');
|
||||||
double const f = increase();
|
double const f = increase();
|
||||||
dim_.wid = 6;
|
dim_.wid = 6;
|
||||||
dim_.asc = int(h + f * h);
|
dim_.asc = int(h + f * h);
|
||||||
dim_.des = int(f * h);
|
dim_.des = int(f * h);
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -28,7 +28,7 @@ int MathBinaryOpInset::opwidth() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathBinaryOpInset::metrics(MetricsInfo & mi) const
|
void MathBinaryOpInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
mi_ = mi;
|
mi_ = mi;
|
||||||
cell(0).metrics(mi);
|
cell(0).metrics(mi);
|
||||||
|
@ -31,7 +31,7 @@ int MathBinomInset::dw() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathBinomInset::metrics(MetricsInfo & mi) const
|
void MathBinomInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
ScriptChanger dummy(mi.base);
|
ScriptChanger dummy(mi.base);
|
||||||
cell(0).metrics(mi);
|
cell(0).metrics(mi);
|
||||||
@ -39,7 +39,7 @@ Dimension MathBinomInset::metrics(MetricsInfo & mi) const
|
|||||||
dim_.asc = cell(0).height() + 4 + 5;
|
dim_.asc = cell(0).height() + 4 + 5;
|
||||||
dim_.des = cell(1).height() + 4 - 5;
|
dim_.des = cell(1).height() + 4 - 5;
|
||||||
dim_.wid = max(cell(0).width(), cell(1).width()) + 2 * dw() + 4;
|
dim_.wid = max(cell(0).width(), cell(1).width()) + 2 * dw() + 4;
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
///
|
///
|
||||||
void normalize(NormalStream &) const;
|
void normalize(NormalStream &) const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo &, int x, int y) const;
|
void draw(PainterInfo &, int x, int y) const;
|
||||||
private:
|
private:
|
||||||
|
@ -32,12 +32,12 @@ void MathBoxInset::normalize(NormalStream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathBoxInset::metrics(MetricsInfo & mi) const
|
void MathBoxInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
FontSetChanger dummy(mi.base, "textnormal");
|
FontSetChanger dummy(mi.base, "textnormal");
|
||||||
cell(0).metrics(mi, dim_);
|
cell(0).metrics(mi, dim_);
|
||||||
metricsMarkers();
|
metricsMarkers();
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
///
|
///
|
||||||
mode_type currentMode() const { return TEXT_MODE; }
|
mode_type currentMode() const { return TEXT_MODE; }
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -27,7 +27,7 @@ MathInset * MathBraceInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathBraceInset::metrics(MetricsInfo & mi) const
|
void MathBraceInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
cell(0).metrics(mi);
|
cell(0).metrics(mi);
|
||||||
Dimension t;
|
Dimension t;
|
||||||
@ -36,7 +36,7 @@ Dimension MathBraceInset::metrics(MetricsInfo & mi) const
|
|||||||
dim_.asc = max(cell(0).ascent(), t.asc);
|
dim_.asc = max(cell(0).ascent(), t.asc);
|
||||||
dim_.des = max(cell(0).descent(), t.des);
|
dim_.des = max(cell(0).descent(), t.des);
|
||||||
dim_.wid = cell(0).width() + 2 * wid_;
|
dim_.wid = cell(0).width() + 2 * wid_;
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
/// we write extra braces in any case...
|
/// we write extra braces in any case...
|
||||||
bool extraBraces() const { return true; }
|
bool extraBraces() const { return true; }
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo &, int x, int y) const;
|
void draw(PainterInfo &, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -20,11 +20,11 @@ MathInset * MathCasesInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathCasesInset::metrics(MetricsInfo & mi) const
|
void MathCasesInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
MathGridInset::metrics(mi);
|
MathGridInset::metrics(mi);
|
||||||
dim_.wid += 8;
|
dim_.wid += 8;
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pain, int x, int y) const;
|
void draw(PainterInfo & pain, int x, int y) const;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "math_charinset.h"
|
#include "math_charinset.h"
|
||||||
#include "LColor.h"
|
#include "LColor.h"
|
||||||
|
#include "dimension.h"
|
||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
#include "frontends/font_metrics.h"
|
#include "frontends/font_metrics.h"
|
||||||
#include "support/LOstream.h"
|
#include "support/LOstream.h"
|
||||||
@ -54,9 +55,8 @@ MathInset * MathCharInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathCharInset::metrics(MetricsInfo & mi) const
|
void MathCharInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
Dimension dim;
|
|
||||||
#if 1
|
#if 1
|
||||||
if (char_ == '=' && has_math_fonts) {
|
if (char_ == '=' && has_math_fonts) {
|
||||||
FontSetChanger dummy(mi.base, "cmr");
|
FontSetChanger dummy(mi.base, "cmr");
|
||||||
@ -82,7 +82,6 @@ Dimension MathCharInset::metrics(MetricsInfo & mi) const
|
|||||||
width_ += 2 * font_metrics::width(' ', font_);
|
width_ += 2 * font_metrics::width(' ', font_);
|
||||||
lyxerr << "MathCharInset::metrics: " << dim << "\n";
|
lyxerr << "MathCharInset::metrics: " << dim << "\n";
|
||||||
#endif
|
#endif
|
||||||
return dim;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
|
||||||
#include "math_commentinset.h"
|
#include "math_commentinset.h"
|
||||||
|
#include "math_data.h"
|
||||||
|
#include "math_support.h"
|
||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
#include "LaTeXFeatures.h"
|
#include "LaTeXFeatures.h"
|
||||||
#include "support/LOstream.h"
|
#include "support/LOstream.h"
|
||||||
#include "textpainter.h"
|
#include "textpainter.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MathCommentInset::MathCommentInset()
|
MathCommentInset::MathCommentInset()
|
||||||
: MathNestInset(1)
|
: MathNestInset(1)
|
||||||
{}
|
{}
|
||||||
@ -17,7 +17,7 @@ MathCommentInset::MathCommentInset()
|
|||||||
MathCommentInset::MathCommentInset(string const & str)
|
MathCommentInset::MathCommentInset(string const & str)
|
||||||
: MathNestInset(1)
|
: MathNestInset(1)
|
||||||
{
|
{
|
||||||
cell(0) = asArray(str);
|
asArray(str, cell(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -27,11 +27,11 @@ MathInset * MathCommentInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathCommentInset::metrics(MetricsInfo & mi) const
|
void MathCommentInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
cell(0).metrics(mi);
|
cell(0).metrics(mi);
|
||||||
metricsMarkers();
|
metricsMarkers();
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -346,6 +346,14 @@ void MathCursor::plainInsert(MathAtom const & t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MathCursor::insert2(string const & str)
|
||||||
|
{
|
||||||
|
MathArray ar;
|
||||||
|
asArray(str, ar);
|
||||||
|
insert(ar);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathCursor::insert(string const & str)
|
void MathCursor::insert(string const & str)
|
||||||
{
|
{
|
||||||
//lyxerr << "inserting '" << str << "'\n";
|
//lyxerr << "inserting '" << str << "'\n";
|
||||||
@ -373,7 +381,8 @@ void MathCursor::insert(MathAtom const & t)
|
|||||||
|
|
||||||
void MathCursor::niceInsert(string const & t)
|
void MathCursor::niceInsert(string const & t)
|
||||||
{
|
{
|
||||||
MathArray ar = asArray(t);
|
MathArray ar;
|
||||||
|
asArray(t, ar);
|
||||||
if (ar.size() == 1)
|
if (ar.size() == 1)
|
||||||
niceInsert(ar[0]);
|
niceInsert(ar[0]);
|
||||||
else
|
else
|
||||||
@ -624,7 +633,7 @@ void MathCursor::drawSelection(PainterInfo & pi) const
|
|||||||
void MathCursor::handleNest(MathAtom const & a)
|
void MathCursor::handleNest(MathAtom const & a)
|
||||||
{
|
{
|
||||||
MathAtom at = a;
|
MathAtom at = a;
|
||||||
at.nucleus()->cell(0) = asArray(grabAndEraseSelection());
|
asArray(grabAndEraseSelection(), at.nucleus()->cell(0));
|
||||||
insert(at);
|
insert(at);
|
||||||
pushRight(prevAtom());
|
pushRight(prevAtom());
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,8 @@ public:
|
|||||||
///
|
///
|
||||||
void insert(MathArray const &);
|
void insert(MathArray const &);
|
||||||
///
|
///
|
||||||
|
void insert2(string const &);
|
||||||
|
///
|
||||||
void paste(string const & data);
|
void paste(string const & data);
|
||||||
/// return false for empty math insets
|
/// return false for empty math insets
|
||||||
bool erase();
|
bool erase();
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "support/LAssert.h"
|
#include "support/LAssert.h"
|
||||||
#include "metricsinfo.h"
|
#include "metricsinfo.h"
|
||||||
|
#include "math_data.h"
|
||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
#include "textpainter.h"
|
#include "textpainter.h"
|
||||||
|
|
||||||
@ -220,8 +221,9 @@ void MathArray::metrics(MetricsInfo & mi) const
|
|||||||
|
|
||||||
if (!empty()) {
|
if (!empty()) {
|
||||||
dim_.wid = 0;
|
dim_.wid = 0;
|
||||||
|
Dimension d;
|
||||||
for (const_iterator it = begin(), et = end(); it != et; ++it) {
|
for (const_iterator it = begin(), et = end(); it != et; ++it) {
|
||||||
Dimension d = (*it)->metrics(mi);
|
(*it)->metrics(mi, d);
|
||||||
dim_ += d;
|
dim_ += d;
|
||||||
it->width_ = d.wid;
|
it->width_ = d.wid;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ bool MathDecorationInset::wide() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathDecorationInset::metrics(MetricsInfo & mi) const
|
void MathDecorationInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
cell(0).metrics(mi);
|
cell(0).metrics(mi);
|
||||||
dim_ = cell(0).dim();
|
dim_ = cell(0).dim();
|
||||||
@ -89,7 +89,7 @@ Dimension MathDecorationInset::metrics(MetricsInfo & mi) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
metricsMarkers();
|
metricsMarkers();
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public:
|
|||||||
///
|
///
|
||||||
void write(WriteStream & os) const;
|
void write(WriteStream & os) const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void normalize(NormalStream & os) const;
|
void normalize(NormalStream & os) const;
|
||||||
///
|
///
|
||||||
|
@ -72,7 +72,7 @@ void MathDelimInset::normalize(NormalStream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathDelimInset::metrics(MetricsInfo & mi) const
|
void MathDelimInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
cell(0).metrics(mi);
|
cell(0).metrics(mi);
|
||||||
Dimension t;
|
Dimension t;
|
||||||
@ -88,7 +88,7 @@ Dimension MathDelimInset::metrics(MetricsInfo & mi) const
|
|||||||
dim_.wid = cell(0).width() + 2 * dw_ + 8;
|
dim_.wid = cell(0).width() + 2 * dw_ + 8;
|
||||||
dim_.asc = max(a0, d0) + h0;
|
dim_.asc = max(a0, d0) + h0;
|
||||||
dim_.des = max(a0, d0) - h0;
|
dim_.des = max(a0, d0) - h0;
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
/// is it |...|?
|
/// is it |...|?
|
||||||
bool isAbs() const;
|
bool isAbs() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo &, int x, int y) const;
|
void draw(PainterInfo &, int x, int y) const;
|
||||||
|
|
||||||
|
@ -32,10 +32,9 @@ void MathDiffInset::normalize(NormalStream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathDiffInset::metrics(MetricsInfo &) const
|
void MathDiffInset::metrics(MetricsInfo &, Dimension &) const
|
||||||
{
|
{
|
||||||
lyxerr << "should not happen\n";
|
lyxerr << "should not happen\n";
|
||||||
return Dimension();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
///
|
///
|
||||||
void addDer(MathArray const & der);
|
void addDer(MathArray const & der);
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ MathInset * MathDotsInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathDotsInset::metrics(MetricsInfo & mi) const
|
void MathDotsInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
mathed_char_dim(mi.base.font, 'M', dim_);
|
mathed_char_dim(mi.base.font, 'M', dim_);
|
||||||
dh_ = 0;
|
dh_ = 0;
|
||||||
@ -33,7 +33,7 @@ Dimension MathDotsInset::metrics(MetricsInfo & mi) const
|
|||||||
}
|
}
|
||||||
else if (key_->name == "ddots")
|
else if (key_->name == "ddots")
|
||||||
dh_ = dim_.asc;
|
dh_ = dim_.asc;
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
|
||||||
#include "math_envinset.h"
|
#include "math_envinset.h"
|
||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
#include "math_streamstr.h"
|
#include "math_streamstr.h"
|
||||||
@ -18,11 +17,11 @@ MathInset * MathEnvInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathEnvInset::metrics(MetricsInfo & mi) const
|
void MathEnvInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
cell(0).metrics(mi, dim_);
|
cell(0).metrics(mi, dim_);
|
||||||
metricsMarkers();
|
metricsMarkers();
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public:
|
|||||||
/// write normalized content
|
/// write normalized content
|
||||||
void normalize(NormalStream & ns) const;
|
void normalize(NormalStream & ns) const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void infoize(std::ostream & os) const;
|
void infoize(std::ostream & os) const;
|
||||||
|
|
||||||
|
@ -12,13 +12,13 @@ MathInset * MathErtInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathErtInset::metrics(MetricsInfo & mi) const
|
void MathErtInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
FontSetChanger dummy(mi.base, "lyxert");
|
FontSetChanger dummy(mi.base, "lyxert");
|
||||||
MathTextInset::metrics(mi);
|
MathTextInset::metrics(mi, dim_);
|
||||||
cache_.colinfo_[0].align_ = 'l';
|
cache_.colinfo_[0].align_ = 'l';
|
||||||
metricsMarkers();
|
metricsMarkers();
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public:
|
|||||||
///
|
///
|
||||||
mode_type currentMode() const { return TEXT_MODE; }
|
mode_type currentMode() const { return TEXT_MODE; }
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -25,7 +25,7 @@ MathInset * MathExFuncInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathExFuncInset::metrics(MetricsInfo & mi) const
|
void MathExFuncInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
mathed_string_dim(mi.base.font, name_, dim_);
|
mathed_string_dim(mi.base.font, name_, dim_);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -48,10 +48,9 @@ void MathExIntInset::normalize(NormalStream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathExIntInset::metrics(MetricsInfo &) const
|
void MathExIntInset::metrics(MetricsInfo &, Dimension &) const
|
||||||
{
|
{
|
||||||
lyxerr << "should not happen\n";
|
lyxerr << "should not happen\n";
|
||||||
return Dimension();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
///
|
///
|
||||||
void symbol(string const &);
|
void symbol(string const &);
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo &, int x, int y) const;
|
void draw(PainterInfo &, int x, int y) const;
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "ref_inset.h"
|
#include "ref_inset.h"
|
||||||
|
|
||||||
#include "metricsinfo.h"
|
#include "metricsinfo.h"
|
||||||
|
#include "math_data.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "math_support.h"
|
#include "math_support.h"
|
||||||
#include "Lsstream.h"
|
#include "Lsstream.h"
|
||||||
|
@ -28,7 +28,7 @@ MathInset::mode_type MathFboxInset::currentMode() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathFboxInset::metrics(MetricsInfo & mi) const
|
void MathFboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
if (key_->name == "fbox") {
|
if (key_->name == "fbox") {
|
||||||
FontSetChanger dummy(mi.base, "textnormal");
|
FontSetChanger dummy(mi.base, "textnormal");
|
||||||
@ -37,7 +37,7 @@ Dimension MathFboxInset::metrics(MetricsInfo & mi) const
|
|||||||
cell(0).metrics(mi, dim_);
|
cell(0).metrics(mi, dim_);
|
||||||
}
|
}
|
||||||
metricsMarkers(5); // 5 pixels margin
|
metricsMarkers(5); // 5 pixels margin
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public:
|
|||||||
///
|
///
|
||||||
mode_type currentMode() const;
|
mode_type currentMode() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -32,12 +32,12 @@ MathInset::mode_type MathFontInset::currentMode() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathFontInset::metrics(MetricsInfo & mi) const
|
void MathFontInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
FontSetChanger dummy(mi.base, key_->name.c_str());
|
FontSetChanger dummy(mi.base, key_->name.c_str());
|
||||||
cell(0).metrics(mi, dim_);
|
cell(0).metrics(mi, dim_);
|
||||||
metricsMarkers(1);
|
metricsMarkers(1);
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
///
|
///
|
||||||
string name() const;
|
string name() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -25,12 +25,12 @@ MathInset * MathFontOldInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathFontOldInset::metrics(MetricsInfo & mi) const
|
void MathFontOldInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
FontSetChanger dummy(mi.base, key_->name.c_str());
|
FontSetChanger dummy(mi.base, key_->name.c_str());
|
||||||
cell(0).metrics(mi, dim_);
|
cell(0).metrics(mi, dim_);
|
||||||
metricsMarkers(1);
|
metricsMarkers(1);
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
/// we write extra braces in any case...
|
/// we write extra braces in any case...
|
||||||
bool extraBraces() const { return true; }
|
bool extraBraces() const { return true; }
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -32,7 +32,7 @@ MathFracInset const * MathFracInset::asFracInset() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathFracInset::metrics(MetricsInfo & mi) const
|
void MathFracInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
FracChanger dummy(mi.base);
|
FracChanger dummy(mi.base);
|
||||||
cell(0).metrics(mi);
|
cell(0).metrics(mi);
|
||||||
@ -40,7 +40,7 @@ Dimension MathFracInset::metrics(MetricsInfo & mi) const
|
|||||||
dim_.wid = max(cell(0).width(), cell(1).width()) + 2;
|
dim_.wid = max(cell(0).width(), cell(1).width()) + 2;
|
||||||
dim_.asc = cell(0).height() + 2 + 5;
|
dim_.asc = cell(0).height() + 2 + 5;
|
||||||
dim_.des = cell(1).height() + 2 - 5;
|
dim_.des = cell(1).height() + 2 - 5;
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ void MathFracInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
|
|||||||
dim.wid = max(cell(0).width(), cell(1).width());
|
dim.wid = max(cell(0).width(), cell(1).width());
|
||||||
dim.asc = cell(0).height() + 1;
|
dim.asc = cell(0).height() + 1;
|
||||||
dim.des = cell(1).height();
|
dim.des = cell(1).height();
|
||||||
//return dim_;
|
//dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo &, int x, int y) const;
|
void draw(PainterInfo &, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -18,7 +18,7 @@ MathInset * MathFrameboxInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathFrameboxInset::metrics(MetricsInfo & mi) const
|
void MathFrameboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
FontSetChanger dummy(mi.base, "textnormal");
|
FontSetChanger dummy(mi.base, "textnormal");
|
||||||
w_ = mathed_char_width(mi.base.font, '[');
|
w_ = mathed_char_width(mi.base.font, '[');
|
||||||
@ -27,7 +27,7 @@ Dimension MathFrameboxInset::metrics(MetricsInfo & mi) const
|
|||||||
dim_ += cell(1).dim();
|
dim_ += cell(1).dim();
|
||||||
dim_ += cell(2).dim();
|
dim_ += cell(2).dim();
|
||||||
metricsMarkers();
|
metricsMarkers();
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -298,7 +298,7 @@ LyXLength MathGridInset::vcrskip(row_type row) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathGridInset::metrics(MetricsInfo & mi) const
|
void MathGridInset::metrics(MetricsInfo & mi) const
|
||||||
{
|
{
|
||||||
// let the cells adjust themselves
|
// let the cells adjust themselves
|
||||||
MathNestInset::metrics(mi);
|
MathNestInset::metrics(mi);
|
||||||
@ -434,7 +434,13 @@ Dimension MathGridInset::metrics(MetricsInfo & mi) const
|
|||||||
cxrow->setBaseline(cxrow->getBaseline() - ascent);
|
cxrow->setBaseline(cxrow->getBaseline() - ascent);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
return dim_;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MathGridInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
|
{
|
||||||
|
metrics(mi);
|
||||||
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1020,17 +1026,14 @@ dispatch_result MathGridInset::dispatch
|
|||||||
|
|
||||||
case LFUN_MOUSE_RELEASE:
|
case LFUN_MOUSE_RELEASE:
|
||||||
//if (cmd.button() == mouse_button::button3) {
|
//if (cmd.button() == mouse_button::button3) {
|
||||||
// GridInsetMailer mailer(*this);
|
// GridInsetMailer(*this).showDialog();
|
||||||
// mailer.showDialog();
|
|
||||||
// return DISPATCHED;
|
// return DISPATCHED;
|
||||||
//}
|
//}
|
||||||
break;
|
return UNDISPATCHED;
|
||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE:
|
||||||
GridInsetMailer mailer(*this);
|
GridInsetMailer(*this).updateDialog(cmd.view());
|
||||||
mailer.updateDialog(cmd.view());
|
return UNDISPATCHED;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// insert file functions
|
// insert file functions
|
||||||
case LFUN_DELETE_LINE_FORWARD:
|
case LFUN_DELETE_LINE_FORWARD:
|
||||||
@ -1164,5 +1167,4 @@ dispatch_result MathGridInset::dispatch
|
|||||||
default:
|
default:
|
||||||
return MathNestInset::dispatch(cmd, idx, pos);
|
return MathNestInset::dispatch(cmd, idx, pos);
|
||||||
}
|
}
|
||||||
return UNDISPATCHED;
|
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,9 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi) const;
|
||||||
|
///
|
||||||
|
void metrics(MetricsInfo & mi, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -165,7 +165,7 @@ char const * MathHullInset::standardFont() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathHullInset::metrics(MetricsInfo & mi) const
|
void MathHullInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
FontSetChanger dummy1(mi.base, standardFont());
|
FontSetChanger dummy1(mi.base, standardFont());
|
||||||
StyleChanger dummy2(mi.base, display() ? LM_ST_DISPLAY : LM_ST_TEXT);
|
StyleChanger dummy2(mi.base, display() ? LM_ST_DISPLAY : LM_ST_TEXT);
|
||||||
@ -197,7 +197,7 @@ Dimension MathHullInset::metrics(MetricsInfo & mi) const
|
|||||||
|
|
||||||
// for markers
|
// for markers
|
||||||
metricsMarkers2();
|
metricsMarkers2();
|
||||||
return dim_;
|
dim = dim_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -697,7 +697,7 @@ void MathHullInset::doExtern
|
|||||||
size_type pos = cell(idx).find_last(eq);
|
size_type pos = cell(idx).find_last(eq);
|
||||||
MathArray ar;
|
MathArray ar;
|
||||||
if (mathcursor && mathcursor->selection()) {
|
if (mathcursor && mathcursor->selection()) {
|
||||||
ar = asArray(mathcursor->grabAndEraseSelection());
|
asArray(mathcursor->grabAndEraseSelection(), ar);
|
||||||
} else if (pos == cell(idx).size()) {
|
} else if (pos == cell(idx).size()) {
|
||||||
ar = cell(idx);
|
ar = cell(idx);
|
||||||
lyxerr << "use whole cell: " << ar << "\n";
|
lyxerr << "use whole cell: " << ar << "\n";
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
///
|
///
|
||||||
mode_type currentMode() const;
|
mode_type currentMode() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo &, int x, int y) const;
|
void draw(PainterInfo &, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -17,9 +17,8 @@ MathInset * MathInferInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathInferInset::metrics(MetricsInfo &) const
|
void MathInferInset::metrics(MetricsInfo &, Dimension &) const
|
||||||
{
|
{
|
||||||
return Dimension();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
Dimension metrics(MetricsInfo & mi) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
@ -18,11 +18,9 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "math_inset.h"
|
#include "math_inset.h"
|
||||||
#include "Lsstream.h"
|
|
||||||
#include "math_scriptinset.h"
|
#include "math_scriptinset.h"
|
||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
#include "math_cursor.h"
|
#include "math_cursor.h"
|
||||||
#include "math_parser.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
@ -35,9 +33,7 @@ using std::ostream;
|
|||||||
|
|
||||||
BufferView * MathInset::view() const
|
BufferView * MathInset::view() const
|
||||||
{
|
{
|
||||||
if (!mathcursor)
|
return mathcursor ? mathcursor->formula()->view() : 0;
|
||||||
return 0;
|
|
||||||
return mathcursor->formula()->view();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,12 +154,6 @@ bool MathInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathInset::draw(PainterInfo &, int, int) const
|
|
||||||
{
|
|
||||||
lyxerr << "MathInset::draw() called directly!\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MathInset::drawSelection(PainterInfo &,
|
void MathInset::drawSelection(PainterInfo &,
|
||||||
idx_type, pos_type, idx_type, pos_type) const
|
idx_type, pos_type, idx_type, pos_type) const
|
||||||
{
|
{
|
||||||
@ -267,23 +257,6 @@ string MathInset::name() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string asString(MathArray const & ar)
|
|
||||||
{
|
|
||||||
std::ostringstream os;
|
|
||||||
WriteStream ws(os);
|
|
||||||
ws << ar;
|
|
||||||
return STRCONV(os.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MathArray asArray(string const & str)
|
|
||||||
{
|
|
||||||
MathArray ar;
|
|
||||||
mathed_parse_cell(ar, str);
|
|
||||||
return ar;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ostream & operator<<(ostream & os, MathAtom const & at)
|
ostream & operator<<(ostream & os, MathAtom const & at)
|
||||||
{
|
{
|
||||||
WriteStream wi(os, false, false);
|
WriteStream wi(os, false, false);
|
||||||
|
@ -16,9 +16,6 @@
|
|||||||
* the GNU General Public Licence version 2 or later.
|
* the GNU General Public Licence version 2 or later.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Note: These math insets are internal to Math and are not derived
|
|
||||||
// from lyx inset.
|
|
||||||
|
|
||||||
#ifndef MATH_INSET_H
|
#ifndef MATH_INSET_H
|
||||||
#define MATH_INSET_H
|
#define MATH_INSET_H
|
||||||
|
|
||||||
@ -26,7 +23,6 @@
|
|||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include "insets/insetbase.h"
|
#include "insets/insetbase.h"
|
||||||
#include "math_data.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -36,8 +32,8 @@ the math objects.
|
|||||||
|
|
||||||
Math insets do not know there parents, a cursor position or things
|
Math insets do not know there parents, a cursor position or things
|
||||||
like that. The are dumb object that are contained in other math insets
|
like that. The are dumb object that are contained in other math insets
|
||||||
(mathNestInsets, in fact) thus forming a tree. The root of this tree is
|
(MathNestInsets, in fact) thus forming a tree. The root of this tree is
|
||||||
always a mathHullInset, which provides an interface to the Outer World by
|
always a MathHullInset, which provides an interface to the Outer World by
|
||||||
inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset.
|
inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -47,9 +43,9 @@ class MathArrayInset;
|
|||||||
class MathAMSArrayInset;
|
class MathAMSArrayInset;
|
||||||
class MathCharInset;
|
class MathCharInset;
|
||||||
class MathDelimInset;
|
class MathDelimInset;
|
||||||
class MathGridInset;
|
|
||||||
class MathFracInset;
|
class MathFracInset;
|
||||||
class MathFontInset;
|
class MathFontInset;
|
||||||
|
class MathGridInset;
|
||||||
class MathHullInset;
|
class MathHullInset;
|
||||||
class MathMatrixInset;
|
class MathMatrixInset;
|
||||||
class MathNestInset;
|
class MathNestInset;
|
||||||
@ -62,6 +58,9 @@ class MathUnknownInset;
|
|||||||
|
|
||||||
class RefInset;
|
class RefInset;
|
||||||
|
|
||||||
|
class MathArray;
|
||||||
|
class MathAtom;
|
||||||
|
|
||||||
class NormalStream;
|
class NormalStream;
|
||||||
class OctaveStream;
|
class OctaveStream;
|
||||||
class MapleStream;
|
class MapleStream;
|
||||||
@ -70,32 +69,22 @@ class MathematicaStream;
|
|||||||
class MathMLStream;
|
class MathMLStream;
|
||||||
class WriteStream;
|
class WriteStream;
|
||||||
class InfoStream;
|
class InfoStream;
|
||||||
class MathArray;
|
|
||||||
|
|
||||||
class LaTeXFeatures;
|
class LaTeXFeatures;
|
||||||
class BufferView;
|
class BufferView;
|
||||||
class UpdatableInset;
|
class UpdatableInset;
|
||||||
class MathMacroTemplate;
|
class MathMacroTemplate;
|
||||||
|
class MathMacro;
|
||||||
class MathPosFinder;
|
class MathPosFinder;
|
||||||
class Dimension;
|
class Dimension;
|
||||||
class FuncRequest;
|
class FuncRequest;
|
||||||
|
class TextPainter;
|
||||||
|
class TextMetricsInfo;
|
||||||
|
class ReplaceData;
|
||||||
|
|
||||||
|
|
||||||
class MathInset : public InsetBase {
|
class MathInset : public InsetBase {
|
||||||
public:
|
public:
|
||||||
/// short of anything else reasonable
|
|
||||||
typedef MathArray::size_type size_type;
|
|
||||||
/// type for cursor positions differences within a cell
|
|
||||||
typedef MathArray::difference_type difference_type;
|
|
||||||
/// type for cursor positions within a cell
|
|
||||||
typedef MathArray::size_type pos_type;
|
|
||||||
/// type for cell indices
|
|
||||||
typedef size_type idx_type;
|
|
||||||
/// type for row numbers
|
|
||||||
typedef size_type row_type;
|
|
||||||
/// type for column numbers
|
|
||||||
typedef size_type col_type;
|
|
||||||
|
|
||||||
/// our members behave nicely...
|
/// our members behave nicely...
|
||||||
MathInset() {}
|
MathInset() {}
|
||||||
|
|
||||||
@ -103,11 +92,6 @@ public:
|
|||||||
virtual MathInset * clone() const = 0;
|
virtual MathInset * clone() const = 0;
|
||||||
/// substitutes macro arguments if necessary
|
/// substitutes macro arguments if necessary
|
||||||
virtual void substitute(MathMacro const & macro);
|
virtual void substitute(MathMacro const & macro);
|
||||||
/// compute the size of the object returned in dim
|
|
||||||
virtual Dimension metrics(MetricsInfo & mi) const = 0;
|
|
||||||
/// draw the object
|
|
||||||
// updates the (xo,yo)-caches of all contained cells
|
|
||||||
virtual void draw(PainterInfo & pi, int x, int y) const;
|
|
||||||
/// draw selection between two positions
|
/// draw selection between two positions
|
||||||
virtual void drawSelection(PainterInfo & pi,
|
virtual void drawSelection(PainterInfo & pi,
|
||||||
idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const;
|
idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const;
|
||||||
@ -295,11 +279,6 @@ protected:
|
|||||||
|
|
||||||
std::ostream & operator<<(std::ostream &, MathAtom const &);
|
std::ostream & operator<<(std::ostream &, MathAtom const &);
|
||||||
|
|
||||||
// converts single cell to string
|
|
||||||
string asString(MathArray const & ar);
|
|
||||||
// converts string to single cell
|
|
||||||
MathArray asArray(string const & str);
|
|
||||||
|
|
||||||
// initialize math
|
// initialize math
|
||||||
void initMath();
|
void initMath();
|
||||||
|
|
||||||
|
@ -28,13 +28,11 @@ MathInset * MathKernInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dimension MathKernInset::metrics(MetricsInfo & mi) const
|
void MathKernInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
Dimension dim;
|
|
||||||
dim.wid = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M'));
|
dim.wid = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M'));
|
||||||
dim.asc = 0;
|
dim.asc = 0;
|
||||||
dim.des = 0;
|
dim.des = 0;
|
||||||
return dim;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user