mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
send UpdatableInset down the way of the Dodo
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10228 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5d9e560f71
commit
282f86fbb1
@ -45,7 +45,6 @@
|
|||||||
#include "frontends/WorkArea.h"
|
#include "frontends/WorkArea.h"
|
||||||
|
|
||||||
#include "insets/insetcommand.h" // ChangeRefs
|
#include "insets/insetcommand.h" // ChangeRefs
|
||||||
#include "insets/updatableinset.h"
|
|
||||||
#include "insets/insettext.h"
|
#include "insets/insettext.h"
|
||||||
|
|
||||||
using lyx::support::bformat;
|
using lyx::support::bformat;
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "paragraph_funcs.h"
|
#include "paragraph_funcs.h"
|
||||||
#include "pariterator.h"
|
#include "pariterator.h"
|
||||||
|
|
||||||
#include "insets/updatableinset.h"
|
|
||||||
#include "insets/insettabular.h"
|
#include "insets/insettabular.h"
|
||||||
#include "insets/insettext.h"
|
#include "insets/insettext.h"
|
||||||
|
|
||||||
|
@ -21,9 +21,6 @@
|
|||||||
#include "mathed/math_inset.h"
|
#include "mathed/math_inset.h"
|
||||||
#include "mathed/math_data.h"
|
#include "mathed/math_data.h"
|
||||||
|
|
||||||
#include "insets/updatableinset.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@ -90,13 +87,6 @@ MathInset * CursorSlice::asMathInset() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset * CursorSlice::asUpdatableInset() const
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(inset_);
|
|
||||||
return inset_->asUpdatableInset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MathArray & CursorSlice::cell() const
|
MathArray & CursorSlice::cell() const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(asMathInset());
|
BOOST_ASSERT(asMathInset());
|
||||||
|
@ -28,13 +28,12 @@ class MathInset;
|
|||||||
class MathArray;
|
class MathArray;
|
||||||
class LyXText;
|
class LyXText;
|
||||||
class Paragraph;
|
class Paragraph;
|
||||||
class UpdatableInset;
|
|
||||||
|
|
||||||
|
|
||||||
/// This encapsulates a single slice of a document iterator as used e.g.
|
/// This encapsulates a single slice of a document iterator as used e.g.
|
||||||
/// for cursors.
|
/// for cursors.
|
||||||
|
|
||||||
// After IU, the distinction of MathInset and UpdatableInset as well as
|
// After IU, the distinction of MathInset and InsetOld as well as
|
||||||
// that of MathArray and LyXText should vanish. They are conceptually the
|
// that of MathArray and LyXText should vanish. They are conceptually the
|
||||||
// same (now...)
|
// same (now...)
|
||||||
|
|
||||||
@ -108,8 +107,6 @@ public:
|
|||||||
LyXText * text();
|
LyXText * text();
|
||||||
/// returns text corresponding to this position
|
/// returns text corresponding to this position
|
||||||
LyXText const * text() const;
|
LyXText const * text() const;
|
||||||
/// returns the owning inset if it is an UpdatableInset, else 0
|
|
||||||
UpdatableInset * asUpdatableInset() const;
|
|
||||||
/// paragraph in this cell
|
/// paragraph in this cell
|
||||||
Paragraph & paragraph();
|
Paragraph & paragraph();
|
||||||
/// paragraph in this cell
|
/// paragraph in this cell
|
||||||
|
@ -159,32 +159,28 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
|
|||||||
bv->getLyXText()->getStringToIndex(bv->cursor()) :
|
bv->getLyXText()->getStringToIndex(bv->cursor()) :
|
||||||
cmd.argument;
|
cmd.argument;
|
||||||
icp.setContents(contents);
|
icp.setContents(contents);
|
||||||
|
|
||||||
return new InsetIndex(icp);
|
return new InsetIndex(icp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_TABULAR_INSERT:
|
case LFUN_TABULAR_INSERT: {
|
||||||
if (!cmd.argument.empty()) {
|
if (!cmd.argument.empty())
|
||||||
std::istringstream ss(cmd.argument);
|
return 0;
|
||||||
int r = 0, c = 0;
|
std::istringstream ss(cmd.argument);
|
||||||
ss >> r >> c;
|
int r = 0, c = 0;
|
||||||
if (r <= 0) r = 2;
|
ss >> r >> c;
|
||||||
if (c <= 0) c = 2;
|
if (r <= 0)
|
||||||
return new InsetTabular(*bv->buffer(), r, c);
|
r = 2;
|
||||||
}
|
if (c <= 0)
|
||||||
return 0;
|
c = 2;
|
||||||
|
return new InsetTabular(*bv->buffer(), r, c);
|
||||||
|
}
|
||||||
|
|
||||||
case LFUN_INSET_CAPTION: {
|
case LFUN_INSET_CAPTION: {
|
||||||
UpdatableInset * up = bv->cursor().inset().asUpdatableInset();
|
auto_ptr<InsetCaption> inset(new InsetCaption(params));
|
||||||
if (!up) {
|
inset->setAutoBreakRows(true);
|
||||||
auto_ptr<InsetCaption> inset(new InsetCaption(params));
|
inset->setDrawFrame(true);
|
||||||
inset->setAutoBreakRows(true);
|
inset->setFrameColor(LColor::captionframe);
|
||||||
inset->setDrawFrame(true);
|
return inset.release();
|
||||||
inset->setFrameColor(LColor::captionframe);
|
|
||||||
return inset.release();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_INDEX_PRINT:
|
case LFUN_INDEX_PRINT:
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
#include "rowpainter.h"
|
#include "rowpainter.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include "insets/updatableinset.h"
|
|
||||||
|
|
||||||
#include "graphics/GraphicsImage.h"
|
#include "graphics/GraphicsImage.h"
|
||||||
#include "graphics/GraphicsLoader.h"
|
#include "graphics/GraphicsLoader.h"
|
||||||
|
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2005-07-15 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
|
* Makefile.am:
|
||||||
|
* inset.[Ch]:
|
||||||
|
* insetcollapsable.[Ch]:
|
||||||
|
* insettabular.[Ch]:
|
||||||
|
* updatableinset.[Ch]: remove UpdatableInset
|
||||||
|
|
||||||
2005-07-15 José Matos <jamatos@lyx.org>
|
2005-07-15 José Matos <jamatos@lyx.org>
|
||||||
|
|
||||||
* insettext.C (plaintext): fix call to asciiParagraph.
|
* insettext.C (plaintext): fix call to asciiParagraph.
|
||||||
|
@ -110,12 +110,12 @@ libinsets_la_SOURCES = \
|
|||||||
insetvspace.C \
|
insetvspace.C \
|
||||||
insetvspace.h \
|
insetvspace.h \
|
||||||
insetwrap.h \
|
insetwrap.h \
|
||||||
insetwrap.C \
|
insetwrap.C
|
||||||
updatableinset.C \
|
|
||||||
updatableinset.h
|
|
||||||
# insetlist.C \
|
# insetlist.C \
|
||||||
# insetlist.h \
|
# insetlist.h \
|
||||||
# insetsection.h \
|
# insetsection.h \
|
||||||
# insetsection.C \
|
# insetsection.C \
|
||||||
# insettheorem.C \
|
# insettheorem.C \
|
||||||
# insettheorem.h
|
# insettheorem.h
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "inset.h"
|
#include "inset.h"
|
||||||
#include "updatableinset.h"
|
|
||||||
|
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include "dimension.h"
|
#include "dimension.h"
|
||||||
|
|
||||||
class LColor_color;
|
class LColor_color;
|
||||||
class UpdatableInset;
|
|
||||||
|
|
||||||
|
|
||||||
/// Insets
|
/// Insets
|
||||||
|
@ -74,8 +74,6 @@ public:
|
|||||||
|
|
||||||
/// identification as math inset
|
/// identification as math inset
|
||||||
virtual MathInset * asMathInset() { return 0; }
|
virtual MathInset * asMathInset() { return 0; }
|
||||||
/// identification as non-math inset
|
|
||||||
virtual UpdatableInset * asUpdatableInset() { return 0; }
|
|
||||||
/// true for 'math' math inset, but not for e.g. mbox
|
/// true for 'math' math inset, but not for e.g. mbox
|
||||||
virtual bool inMathed() const { return false; }
|
virtual bool inMathed() const { return false; }
|
||||||
|
|
||||||
@ -116,6 +114,8 @@ public:
|
|||||||
virtual void drawSelection(PainterInfo &, int, int) const {}
|
virtual void drawSelection(PainterInfo &, int, int) const {}
|
||||||
///
|
///
|
||||||
virtual bool editing(BufferView * bv) const;
|
virtual bool editing(BufferView * bv) const;
|
||||||
|
///
|
||||||
|
virtual bool showInsetDialog(BufferView *) const { return false; }
|
||||||
/// draw four angular markers
|
/// draw four angular markers
|
||||||
void drawMarkers(PainterInfo & pi, int x, int y) const;
|
void drawMarkers(PainterInfo & pi, int x, int y) const;
|
||||||
/// draw two angular markers
|
/// draw two angular markers
|
||||||
|
@ -367,17 +367,6 @@ bool InsetCollapsable::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetCollapsable::scroll(bool recursive) const
|
|
||||||
{
|
|
||||||
int sx = UpdatableInset::scroll(false);
|
|
||||||
|
|
||||||
if (recursive)
|
|
||||||
sx += InsetText::scroll(false);
|
|
||||||
|
|
||||||
return sx;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::setLabel(string const & l)
|
void InsetCollapsable::setLabel(string const & l)
|
||||||
{
|
{
|
||||||
label = l;
|
label = l;
|
||||||
|
@ -65,8 +65,6 @@ public:
|
|||||||
///
|
///
|
||||||
void setLabelFont(LyXFont & f);
|
void setLabelFont(LyXFont & f);
|
||||||
///
|
///
|
||||||
int scroll(bool recursive = true) const;
|
|
||||||
///
|
|
||||||
bool isOpen() const { return status_ == Open || status_ == Inlined; }
|
bool isOpen() const { return status_ == Open || status_ == Inlined; }
|
||||||
///
|
///
|
||||||
bool inlined() const { return status_ == Inlined; }
|
bool inlined() const { return status_ == Inlined; }
|
||||||
@ -80,14 +78,11 @@ public:
|
|||||||
void setStatus(LCursor & cur, CollapseStatus st);
|
void setStatus(LCursor & cur, CollapseStatus st);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
///
|
///
|
||||||
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
|
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
|
||||||
///
|
///
|
||||||
Dimension dimensionCollapsed() const;
|
Dimension dimensionCollapsed() const;
|
||||||
///
|
///
|
||||||
int getMaxTextWidth(Painter & pain, UpdatableInset const *) const;
|
|
||||||
///
|
|
||||||
Box const & buttonDim() const;
|
Box const & buttonDim() const;
|
||||||
///
|
///
|
||||||
void edit(LCursor & cur, bool left);
|
void edit(LCursor & cur, bool left);
|
||||||
|
@ -164,13 +164,13 @@ bool InsetTabular::hasPasteBuffer() const
|
|||||||
InsetTabular::InsetTabular(Buffer const & buf, row_type rows,
|
InsetTabular::InsetTabular(Buffer const & buf, row_type rows,
|
||||||
col_type columns)
|
col_type columns)
|
||||||
: tabular(buf.params(), max(rows, row_type(1)),
|
: tabular(buf.params(), max(rows, row_type(1)),
|
||||||
max(columns, col_type(1))), buffer_(&buf), cursorx_(0)
|
max(columns, col_type(1))), buffer_(&buf), scx_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
InsetTabular::InsetTabular(InsetTabular const & tab)
|
InsetTabular::InsetTabular(InsetTabular const & tab)
|
||||||
: UpdatableInset(tab), tabular(tab.tabular),
|
: InsetOld(tab), tabular(tab.tabular),
|
||||||
buffer_(tab.buffer_), cursorx_(0)
|
buffer_(tab.buffer_), scx_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
|
|||||||
|
|
||||||
//resetPos(bv->cursor());
|
//resetPos(bv->cursor());
|
||||||
|
|
||||||
x += scroll();
|
x += scx_;
|
||||||
x += ADD_TO_TABULAR_WIDTH;
|
x += ADD_TO_TABULAR_WIDTH;
|
||||||
|
|
||||||
idx_type idx = 0;
|
idx_type idx = 0;
|
||||||
@ -329,8 +329,7 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const
|
|||||||
|
|
||||||
//resetPos(cur);
|
//resetPos(cur);
|
||||||
|
|
||||||
x += scroll();
|
x += scx_ + ADD_TO_TABULAR_WIDTH;
|
||||||
x += ADD_TO_TABULAR_WIDTH;
|
|
||||||
|
|
||||||
if (tablemode(cur)) {
|
if (tablemode(cur)) {
|
||||||
row_type rs, re;
|
row_type rs, re;
|
||||||
@ -772,6 +771,7 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
default:
|
default:
|
||||||
// we try to handle this event in the insets dispatch function.
|
// we try to handle this event in the insets dispatch function.
|
||||||
cell(cur.idx())->dispatch(cur, cmd);
|
cell(cur.idx())->dispatch(cur, cmd);
|
||||||
|
resetPos(cur);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1111,7 +1111,7 @@ void InsetTabular::cursorPos
|
|||||||
}
|
}
|
||||||
x += tabular.getBeginningOfTextInCell(idx);
|
x += tabular.getBeginningOfTextInCell(idx);
|
||||||
x += ADD_TO_TABULAR_WIDTH;
|
x += ADD_TO_TABULAR_WIDTH;
|
||||||
x += scroll();
|
x += scx_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1204,7 +1204,7 @@ void InsetTabular::resetPos(LCursor & cur) const
|
|||||||
int const maxwidth = bv.workWidth();
|
int const maxwidth = bv.workWidth();
|
||||||
|
|
||||||
if (&cur.inset() != this) {
|
if (&cur.inset() != this) {
|
||||||
//scx = 0;
|
scx_ = 0;
|
||||||
} else {
|
} else {
|
||||||
int const X1 = 0;
|
int const X1 = 0;
|
||||||
int const X2 = maxwidth;
|
int const X2 = maxwidth;
|
||||||
@ -1213,11 +1213,11 @@ void InsetTabular::resetPos(LCursor & cur) const
|
|||||||
int const x2 = x1 + tabular.getWidthOfColumn(cur.idx());
|
int const x2 = x1 + tabular.getWidthOfColumn(cur.idx());
|
||||||
|
|
||||||
if (x1 < X1)
|
if (x1 < X1)
|
||||||
scx = X1 + 20 - x1;
|
scx_ = X1 + 20 - x1;
|
||||||
else if (x2 > X2)
|
else if (x2 > X2)
|
||||||
scx = X2 - 20 - x2;
|
scx_ = X2 - 20 - x2;
|
||||||
else
|
else
|
||||||
scx = 0;
|
scx_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur.needsUpdate();
|
cur.needsUpdate();
|
||||||
|
@ -45,7 +45,7 @@ class Paragraph;
|
|||||||
class CursorSlice;
|
class CursorSlice;
|
||||||
|
|
||||||
|
|
||||||
class InsetTabular : public UpdatableInset {
|
class InsetTabular : public InsetOld {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
InsetTabular(Buffer const &, row_type rows = 1,
|
InsetTabular(Buffer const &, row_type rows = 1,
|
||||||
@ -65,6 +65,8 @@ public:
|
|||||||
///
|
///
|
||||||
std::string const editMessage() const;
|
std::string const editMessage() const;
|
||||||
///
|
///
|
||||||
|
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
||||||
|
///
|
||||||
bool insetAllowed(InsetBase::Code) const { return true; }
|
bool insetAllowed(InsetBase::Code) const { return true; }
|
||||||
///
|
///
|
||||||
bool isTextInset() const { return true; }
|
bool isTextInset() const { return true; }
|
||||||
@ -140,10 +142,10 @@ public:
|
|||||||
mutable LyXTabular tabular;
|
mutable LyXTabular tabular;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
///
|
||||||
InsetTabular(InsetTabular const &);
|
InsetTabular(InsetTabular const &);
|
||||||
|
///
|
||||||
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
|
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
|
||||||
|
|
||||||
///
|
///
|
||||||
bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
||||||
private:
|
private:
|
||||||
@ -191,9 +193,9 @@ private:
|
|||||||
///
|
///
|
||||||
Buffer const * buffer_;
|
Buffer const * buffer_;
|
||||||
///
|
///
|
||||||
mutable int cursorx_;
|
|
||||||
///
|
|
||||||
mutable idx_type first_visible_cell;
|
mutable idx_type first_visible_cell;
|
||||||
|
///
|
||||||
|
mutable int scx_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ InsetText::InsetText(BufferParams const & bp)
|
|||||||
|
|
||||||
|
|
||||||
InsetText::InsetText(InsetText const & in)
|
InsetText::InsetText(InsetText const & in)
|
||||||
: UpdatableInset(in), text_(in.text_.bv_owner)
|
: InsetOld(in), text_(in.text_.bv_owner)
|
||||||
{
|
{
|
||||||
text_.autoBreakRows_ = in.text_.autoBreakRows_;
|
text_.autoBreakRows_ = in.text_.autoBreakRows_;
|
||||||
drawFrame_ = in.drawFrame_;
|
drawFrame_ = in.drawFrame_;
|
||||||
@ -194,7 +194,6 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
|
|||||||
BufferView * bv = pi.base.bv;
|
BufferView * bv = pi.base.bv;
|
||||||
bv->hideCursor();
|
bv->hideCursor();
|
||||||
|
|
||||||
x += scroll();
|
|
||||||
text_.draw(pi, x + border_, y);
|
text_.draw(pi, x + border_, y);
|
||||||
|
|
||||||
if (drawFrame_)
|
if (drawFrame_)
|
||||||
@ -299,15 +298,10 @@ InsetBase * InsetText::editXY(LCursor & cur, int x, int y)
|
|||||||
|
|
||||||
void InsetText::doDispatch(LCursor & cur, FuncRequest & cmd)
|
void InsetText::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::DEBUG]
|
lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION
|
||||||
<< BOOST_CURRENT_FUNCTION
|
<< " [ cmd.action = " << cmd.action << ']' << endl;
|
||||||
<< " [ cmd.action = " << cmd.action << ']'
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
setViewCache(&cur.bv());
|
setViewCache(&cur.bv());
|
||||||
|
|
||||||
text_.dispatch(cur, cmd);
|
text_.dispatch(cur, cmd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#ifndef INSETTEXT_H
|
#ifndef INSETTEXT_H
|
||||||
#define INSETTEXT_H
|
#define INSETTEXT_H
|
||||||
|
|
||||||
#include "updatableinset.h"
|
#include "inset.h"
|
||||||
#include "RowList_fwd.h"
|
#include "RowList_fwd.h"
|
||||||
#include "lyxfont.h"
|
#include "lyxfont.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
@ -24,9 +24,9 @@
|
|||||||
class Buffer;
|
class Buffer;
|
||||||
class BufferParams;
|
class BufferParams;
|
||||||
class BufferView;
|
class BufferView;
|
||||||
|
class CursorSlice;
|
||||||
class Dimension;
|
class Dimension;
|
||||||
class LColor_color;
|
class LColor_color;
|
||||||
class CursorSlice;
|
|
||||||
class Painter;
|
class Painter;
|
||||||
class ParagraphList;
|
class ParagraphList;
|
||||||
class Row;
|
class Row;
|
||||||
@ -36,7 +36,7 @@ class Row;
|
|||||||
A text inset is like a TeX box to write full text
|
A text inset is like a TeX box to write full text
|
||||||
(including styles and other insets) in a given space.
|
(including styles and other insets) in a given space.
|
||||||
*/
|
*/
|
||||||
class InsetText : public UpdatableInset {
|
class InsetText : public InsetOld {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit InsetText(BufferParams const &);
|
explicit InsetText(BufferParams const &);
|
||||||
@ -57,6 +57,8 @@ public:
|
|||||||
///
|
///
|
||||||
std::string const editMessage() const;
|
std::string const editMessage() const;
|
||||||
///
|
///
|
||||||
|
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
||||||
|
///
|
||||||
bool isTextInset() const { return true; }
|
bool isTextInset() const { return true; }
|
||||||
///
|
///
|
||||||
int latex(Buffer const &, std::ostream &,
|
int latex(Buffer const &, std::ostream &,
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
/**
|
|
||||||
* \file updatableinset.C
|
|
||||||
* This file is part of LyX, the document processor.
|
|
||||||
* Licence details can be found in the file COPYING.
|
|
||||||
*
|
|
||||||
* \author Alejandro Aguilar Sierra
|
|
||||||
* \author Jürgen Vigna
|
|
||||||
* \author Lars Gullik Bjønnes
|
|
||||||
* \author Matthias Ettrich
|
|
||||||
*
|
|
||||||
* Full author contact details are available in file CREDITS.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include "updatableinset.h"
|
|
||||||
|
|
||||||
#include "BufferView.h"
|
|
||||||
#include "coordcache.h"
|
|
||||||
#include "cursor.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "dispatchresult.h"
|
|
||||||
#include "funcrequest.h"
|
|
||||||
#include "lyxtext.h"
|
|
||||||
|
|
||||||
#include "support/convert.h"
|
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
// An updatable inset is highly editable by definition
|
|
||||||
InsetBase::EDITABLE UpdatableInset::editable() const
|
|
||||||
{
|
|
||||||
return HIGHLY_EDITABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int UpdatableInset::scroll(bool) const
|
|
||||||
{
|
|
||||||
return scx;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpdatableInset::setScroll(int maxwidth, int pos) const
|
|
||||||
{
|
|
||||||
scx = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpdatableInset::getCursorDim(int &, int &) const
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(false);
|
|
||||||
}
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
/**
|
|
||||||
* \file updatableinset.h
|
|
||||||
* This file is part of LyX, the document processor.
|
|
||||||
* Licence details can be found in the file COPYING.
|
|
||||||
*
|
|
||||||
* \author Alejandro Aguilar Sierra
|
|
||||||
* \author Jürgen Vigna
|
|
||||||
* \author Lars Gullik Bjønnes
|
|
||||||
* \author Matthias Ettrich
|
|
||||||
*
|
|
||||||
* Full author contact details are available in file CREDITS.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef UPDATABLEINSET_H
|
|
||||||
#define UPDATABLEINSET_H
|
|
||||||
|
|
||||||
// Updatable Insets. These insets can receive directly user interaction.
|
|
||||||
// Note that all pure methods from Inset class are pure here too.
|
|
||||||
// [Alejandro 080596]
|
|
||||||
|
|
||||||
#include "inset.h"
|
|
||||||
|
|
||||||
class UpdatableInset : public InsetOld {
|
|
||||||
public:
|
|
||||||
///
|
|
||||||
UpdatableInset() : scx(0) {}
|
|
||||||
///
|
|
||||||
virtual EDITABLE editable() const;
|
|
||||||
/// identification as text inset in a cursor slice
|
|
||||||
UpdatableInset * asUpdatableInset() { return this; }
|
|
||||||
|
|
||||||
/// return the cursor dim
|
|
||||||
virtual void getCursorDim(int &, int &) const;
|
|
||||||
///
|
|
||||||
virtual bool showInsetDialog(BufferView *) const { return false; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/// scrolls offset pixels
|
|
||||||
void setScroll(int maxwidth, int offset) const;
|
|
||||||
/// returns the actual scroll value
|
|
||||||
virtual int scroll(bool recursive = true) const;
|
|
||||||
///
|
|
||||||
mutable int scx;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -428,12 +428,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
enable = false;
|
enable = false;
|
||||||
if (!cur)
|
if (!cur)
|
||||||
break;
|
break;
|
||||||
UpdatableInset * inset = cur.inset().asUpdatableInset();
|
InsetBase::Code code = cur.inset().lyxCode();
|
||||||
lyxerr << "inset: " << inset << endl;
|
|
||||||
if (!inset)
|
|
||||||
break;
|
|
||||||
|
|
||||||
InsetBase::Code code = inset->lyxCode();
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case InsetBase::TABULAR_CODE:
|
case InsetBase::TABULAR_CODE:
|
||||||
enable = cmd.argument == "tabular";
|
enable = cmd.argument == "tabular";
|
||||||
|
@ -1250,14 +1250,6 @@ string const MathHullInset::editMessage() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathHullInset::getCursorDim(int & asc, int & desc) const
|
|
||||||
{
|
|
||||||
asc = 10;
|
|
||||||
desc = 2;
|
|
||||||
//math_font_max_dim(font_, asc, des);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MathHullInset::revealCodes(LCursor & cur) const
|
void MathHullInset::revealCodes(LCursor & cur) const
|
||||||
{
|
{
|
||||||
if (!cur.inMathed())
|
if (!cur.inMathed())
|
||||||
|
@ -184,8 +184,6 @@ public:
|
|||||||
/// what appears in the minibuffer when opening
|
/// what appears in the minibuffer when opening
|
||||||
virtual std::string const editMessage() const;
|
virtual std::string const editMessage() const;
|
||||||
///
|
///
|
||||||
virtual void getCursorDim(int &, int &) const;
|
|
||||||
///
|
|
||||||
virtual bool isTextInset() const { return true; }
|
virtual bool isTextInset() const { return true; }
|
||||||
///
|
///
|
||||||
virtual void mutateToText();
|
virtual void mutateToText();
|
||||||
|
@ -521,7 +521,7 @@ void Paragraph::setFont(pos_type pos, LyXFont const & font)
|
|||||||
if (it->pos() >= pos)
|
if (it->pos() >= pos)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
unsigned int i = distance(beg, it);
|
size_t const i = distance(beg, it);
|
||||||
bool notfound = (it == endit);
|
bool notfound = (it == endit);
|
||||||
|
|
||||||
if (!notfound && pimpl_->fontlist[i].font() == font)
|
if (!notfound && pimpl_->fontlist[i].font() == font)
|
||||||
@ -1644,7 +1644,7 @@ string const Paragraph::asString(Buffer const & buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Paragraph::setInsetOwner(UpdatableInset * inset)
|
void Paragraph::setInsetOwner(InsetBase * inset)
|
||||||
{
|
{
|
||||||
pimpl_->inset_owner = inset;
|
pimpl_->inset_owner = inset;
|
||||||
}
|
}
|
||||||
@ -1742,7 +1742,7 @@ void Paragraph::layout(LyXLayout_ptr const & new_layout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset * Paragraph::inInset() const
|
InsetBase * Paragraph::inInset() const
|
||||||
{
|
{
|
||||||
return pimpl_->inset_owner;
|
return pimpl_->inset_owner;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class OutputParams;
|
|||||||
class PainterInfo;
|
class PainterInfo;
|
||||||
class ParagraphParameters;
|
class ParagraphParameters;
|
||||||
class TexRow;
|
class TexRow;
|
||||||
class UpdatableInset;
|
|
||||||
|
|
||||||
/// A Paragraph holds all text, attributes and insets in a text paragraph
|
/// A Paragraph holds all text, attributes and insets in a text paragraph
|
||||||
class Paragraph {
|
class Paragraph {
|
||||||
@ -76,7 +76,6 @@ public:
|
|||||||
Paragraph & operator=(Paragraph const &);
|
Paragraph & operator=(Paragraph const &);
|
||||||
///
|
///
|
||||||
~Paragraph();
|
~Paragraph();
|
||||||
|
|
||||||
///
|
///
|
||||||
int id() const;
|
int id() const;
|
||||||
|
|
||||||
@ -164,9 +163,9 @@ public:
|
|||||||
void makeSameLayout(Paragraph const & par);
|
void makeSameLayout(Paragraph const & par);
|
||||||
|
|
||||||
///
|
///
|
||||||
void setInsetOwner(UpdatableInset * inset);
|
void setInsetOwner(InsetBase * inset);
|
||||||
///
|
///
|
||||||
UpdatableInset * inInset() const;
|
InsetBase * inInset() const;
|
||||||
///
|
///
|
||||||
InsetBase::Code ownerCode() const;
|
InsetBase::Code ownerCode() const;
|
||||||
///
|
///
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
/// erase the given range
|
/// erase the given range
|
||||||
int erase(lyx::pos_type start, lyx::pos_type end);
|
int erase(lyx::pos_type start, lyx::pos_type end);
|
||||||
///
|
///
|
||||||
UpdatableInset * inset_owner;
|
InsetBase * inset_owner;
|
||||||
|
|
||||||
/** A font entry covers a range of positions. Notice that the
|
/** A font entry covers a range of positions. Notice that the
|
||||||
entries in the list are inserted in random order.
|
entries in the list are inserted in random order.
|
||||||
|
@ -727,8 +727,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_INSET_SETTINGS:
|
case LFUN_INSET_SETTINGS:
|
||||||
if (cur.inset().asUpdatableInset())
|
cur.inset().showInsetDialog(bv);
|
||||||
cur.inset().asUpdatableInset()->showInsetDialog(bv);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_NEXT_INSET_TOGGLE: {
|
case LFUN_NEXT_INSET_TOGGLE: {
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "paragraph.h"
|
#include "paragraph.h"
|
||||||
|
|
||||||
#include "mathed/math_support.h"
|
#include "mathed/math_support.h"
|
||||||
#include "insets/updatableinset.h"
|
#include "insets/inset.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -182,8 +182,7 @@ bool textUndoOrRedo(BufferView & bv,
|
|||||||
ParagraphList::const_iterator pit = undo.pars.begin();
|
ParagraphList::const_iterator pit = undo.pars.begin();
|
||||||
ParagraphList::const_iterator end = undo.pars.end();
|
ParagraphList::const_iterator end = undo.pars.end();
|
||||||
for (; pit != end; ++pit)
|
for (; pit != end; ++pit)
|
||||||
const_cast<Paragraph &>(*pit).setInsetOwner(
|
const_cast<Paragraph &>(*pit).setInsetOwner(&dit.inset());
|
||||||
dynamic_cast<UpdatableInset *>(&dit.inset()));
|
|
||||||
plist.insert(first, undo.pars.begin(), undo.pars.end());
|
plist.insert(first, undo.pars.begin(), undo.pars.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user