mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Lot's of updates for new update handling of text-insets
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@831 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
572556e94f
commit
b744c6ed9f
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
2000-06-23 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* src/lyxtext.h: added a 'cleared' flag to draw() function.
|
||||||
|
|
||||||
|
* src/buffer.C (resize): delete the LyXText of textinsets.
|
||||||
|
|
||||||
|
* src/paragraph.C (SetInsetOwner): set the owner in the insets too.
|
||||||
|
|
||||||
|
* src/insets/lyxinset.h: added another parameter 'cleared' to
|
||||||
|
the draw() function.
|
||||||
|
|
||||||
|
* src/lyxfunc.C (processKeyEvent): move cursor to the right of the
|
||||||
|
unlocking inset in inset.
|
||||||
|
|
||||||
2000-06-22 Juergen Vigna <jug@sad.it>
|
2000-06-22 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* src/lyxscreen.h: added some y_offset/x_offset parameters for drawings
|
* src/lyxscreen.h: added some y_offset/x_offset parameters for drawings
|
||||||
|
14
src/buffer.C
14
src/buffer.C
@ -3801,6 +3801,20 @@ bool Buffer::Dispatch(int action, string const & argument)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Buffer::resize()
|
||||||
|
{
|
||||||
|
/// first resize the BufferViews!
|
||||||
|
if (users) {
|
||||||
|
users->resize();
|
||||||
|
}
|
||||||
|
/// then remove all LyXText in text-insets
|
||||||
|
LyXParagraph * par = paragraph;
|
||||||
|
for(;par;par = par->next) {
|
||||||
|
par->deleteInsetsLyXText(users);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Buffer::ChangeLanguage(Language const * from, Language const * to)
|
void Buffer::ChangeLanguage(Language const * from, Language const * to)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -88,11 +88,7 @@ public:
|
|||||||
bool Dispatch(int, auto_mem_buffer &);
|
bool Dispatch(int, auto_mem_buffer &);
|
||||||
|
|
||||||
/// should be changed to work for a list.
|
/// should be changed to work for a list.
|
||||||
void resize() {
|
void resize();
|
||||||
if (users) {
|
|
||||||
users->resize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Update window titles of all users
|
/// Update window titles of all users
|
||||||
void updateTitles() const;
|
void updateTitles() const;
|
||||||
|
@ -1035,7 +1035,7 @@ int InsetFig::width(Painter &, LyXFont const &) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetFig::draw(BufferView * bv, LyXFont const & f,
|
void InsetFig::draw(BufferView * bv, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
LyXFont font(f);
|
LyXFont font(f);
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
|
@ -30,8 +30,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const & font) const;
|
int width(Painter &, LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, LyXFont const & font,
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||||
int baseline, float & x) const;
|
|
||||||
///
|
///
|
||||||
void Write(Buffer const *, std::ostream &) const;
|
void Write(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
|
@ -88,7 +88,7 @@ int InsetButton::width(Painter & pain, LyXFont const &) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetButton::draw(BufferView * bv, LyXFont const &,
|
void InsetButton::draw(BufferView * bv, LyXFont const &,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
// Draw it as a box with the LaTeX text
|
// Draw it as a box with the LaTeX text
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, LyXFont const &, int baseline, float & x) const;
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// This should provide the text for the button
|
/// This should provide the text for the button
|
||||||
|
@ -136,7 +136,7 @@ void InsetCollapsable::draw_collapsed(Painter & pain, LyXFont const & font,
|
|||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool cleared) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
|
|
||||||
@ -155,12 +155,11 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
|||||||
|
|
||||||
int w = InsetText::width(pain, f) + 2 * TEXT_TO_INSET_OFFSET;
|
int w = InsetText::width(pain, f) + 2 * TEXT_TO_INSET_OFFSET;
|
||||||
int h = ascent(pain,f) + descent(pain, f);
|
int h = ascent(pain,f) + descent(pain, f);
|
||||||
|
int save_x = static_cast<int>(x);
|
||||||
pain.rectangle(int(x), baseline - ascent(pain, f), w, h, framecolor);
|
|
||||||
|
|
||||||
x += TEXT_TO_INSET_OFFSET;
|
x += TEXT_TO_INSET_OFFSET;
|
||||||
drawTextXOffset = int(x) - top_x;
|
drawTextXOffset = int(x) - top_x;
|
||||||
InsetText::draw(bv, f, baseline, x);
|
InsetText::draw(bv, f, baseline, x, cleared);
|
||||||
|
pain.rectangle(save_x, baseline - ascent(pain, f), w, h, framecolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const & f) const;
|
int width(Painter &, LyXFont const & f) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, const LyXFont &, int , float &) const;
|
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
|
||||||
///
|
///
|
||||||
void Edit(BufferView *, int, int, unsigned int);
|
void Edit(BufferView *, int, int, unsigned int);
|
||||||
///
|
///
|
||||||
|
@ -73,7 +73,7 @@ int InsetError::width(Painter &, LyXFont const & font) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetError::draw(BufferView * bv, LyXFont const & font,
|
void InsetError::draw(BufferView * bv, LyXFont const & font,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
LyXFont efont;
|
LyXFont efont;
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const & font) const;
|
int width(Painter &, LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, LyXFont const & font, int baseline, float & x) const;
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||||
///
|
///
|
||||||
void Write(Buffer const *, std::ostream &) const;
|
void Write(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
|
@ -135,7 +135,7 @@ int InsetGraphics::width(Painter &, LyXFont const &) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
|
|
||||||
|
@ -35,8 +35,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, LyXFont const &,
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||||
int baseline, float & x) const;
|
|
||||||
///
|
///
|
||||||
void Edit(BufferView *, int, int, unsigned int);
|
void Edit(BufferView *, int, int, unsigned int);
|
||||||
///
|
///
|
||||||
|
@ -76,7 +76,7 @@ int InsetInfo::width(Painter &, LyXFont const & font) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetInfo::draw(BufferView * bv, LyXFont const & f,
|
void InsetInfo::draw(BufferView * bv, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
LyXFont font(f);
|
LyXFont font(f);
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, LyXFont const &, int baseline, float & x) const;
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||||
///
|
///
|
||||||
void Write(Buffer const *, std::ostream &) const;
|
void Write(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
|
@ -356,7 +356,7 @@ bool InsetLatexAccent::DisplayISO8859_9(Painter & pain, LyXFont const & font,
|
|||||||
|
|
||||||
|
|
||||||
void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font,
|
void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, LyXFont const &, int baseline, float & x) const;
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||||
///
|
///
|
||||||
int Lbearing(LyXFont const & font) const;
|
int Lbearing(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
|
@ -198,7 +198,7 @@ LyXFont InsetQuotes::ConvertFont(LyXFont font)
|
|||||||
|
|
||||||
|
|
||||||
void InsetQuotes::draw(BufferView * bv, LyXFont const & font,
|
void InsetQuotes::draw(BufferView * bv, LyXFont const & font,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
string text = DispString();
|
string text = DispString();
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, LyXFont const &, int baseline, float & x) const;
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||||
///
|
///
|
||||||
LyXFont ConvertFont(LyXFont font);
|
LyXFont ConvertFont(LyXFont font);
|
||||||
///
|
///
|
||||||
|
@ -73,7 +73,7 @@ int InsetSpecialChar::width(Painter &, LyXFont const & font) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
|
void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
LyXFont font(f);
|
LyXFont font(f);
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, LyXFont const &, int baseline, float & x) const;
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||||
///
|
///
|
||||||
void Write(Buffer const *, std::ostream &) const;
|
void Write(Buffer const *, std::ostream &) const;
|
||||||
/// Will not be used when lyxf3
|
/// Will not be used when lyxf3
|
||||||
|
@ -63,7 +63,7 @@ InsetTabular::InsetTabular(Buffer * buf, int rows, int columns)
|
|||||||
actcell = 0;
|
actcell = 0;
|
||||||
cursor.pos(0);
|
cursor.pos(0);
|
||||||
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
|
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
|
||||||
init_inset = true;
|
need_update = INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer * buf)
|
|||||||
actcell = 0;
|
actcell = 0;
|
||||||
cursor.pos(0);
|
cursor.pos(0);
|
||||||
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
|
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
|
||||||
init_inset = true;
|
need_update = INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ void InsetTabular::Read(Buffer const * buf, LyXLex & lex)
|
|||||||
delete tabular;
|
delete tabular;
|
||||||
tabular = new LyXTabular(buf, this, lex);
|
tabular = new LyXTabular(buf, this, lex);
|
||||||
|
|
||||||
init_inset = true;
|
need_update = INIT;
|
||||||
|
|
||||||
if (old_format)
|
if (old_format)
|
||||||
return;
|
return;
|
||||||
@ -150,7 +150,7 @@ int InsetTabular::width(Painter &, LyXFont const &) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
||||||
float & x) const
|
float & x, bool cleared) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
int i, j, cell=0;
|
int i, j, cell=0;
|
||||||
@ -158,8 +158,8 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
float cx;
|
float cx;
|
||||||
|
|
||||||
UpdatableInset::draw(bv,font,baseline,x);
|
UpdatableInset::draw(bv,font,baseline,x);
|
||||||
if (init_inset || (top_x != int(x)) || (top_baseline != baseline)) {
|
if ((need_update == INIT)|| (top_x != int(x)) || (top_baseline != baseline)) {
|
||||||
init_inset = false;
|
need_update = FULL;
|
||||||
top_x = int(x);
|
top_x = int(x);
|
||||||
top_baseline = baseline;
|
top_baseline = baseline;
|
||||||
resetPos(pain);
|
resetPos(pain);
|
||||||
@ -172,35 +172,39 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool dodraw;
|
||||||
x += ADD_TO_TABULAR_WIDTH;
|
x += ADD_TO_TABULAR_WIDTH;
|
||||||
|
if (cleared || !locked || (need_update == FULL) || (need_update == CELL)) {
|
||||||
for(i=0;i<tabular->rows();++i) {
|
for(i=0;i<tabular->rows();++i) {
|
||||||
nx = int(x);
|
nx = int(x);
|
||||||
|
dodraw = ((baseline+tabular->GetDescentOfRow(i)) > 0) &&
|
||||||
|
(baseline-tabular->GetAscentOfRow(i)) < pain.paperHeight();
|
||||||
for(j=0;j<tabular->columns();++j) {
|
for(j=0;j<tabular->columns();++j) {
|
||||||
if (tabular->IsPartOfMultiColumn(i,j))
|
if (tabular->IsPartOfMultiColumn(i,j))
|
||||||
continue;
|
continue;
|
||||||
cx = nx + tabular->GetBeginningOfTextInCell(cell);
|
cx = nx + tabular->GetBeginningOfTextInCell(cell);
|
||||||
if (hasSelection())
|
if (hasSelection())
|
||||||
DrawCellSelection(pain, nx, baseline, i, j, cell);
|
DrawCellSelection(pain, nx, baseline, i, j, cell);
|
||||||
tabular->GetCellInset(cell)->draw(bv, font, baseline, cx);
|
if (dodraw && !cleared && locked && the_locking_inset) {
|
||||||
|
if (the_locking_inset == tabular->GetCellInset(cell))
|
||||||
|
tabular->GetCellInset(cell)->draw(bv, font,
|
||||||
|
baseline, cx,
|
||||||
|
cleared);
|
||||||
|
} else if (dodraw) {
|
||||||
|
tabular->GetCellInset(cell)->draw(bv, font, baseline, cx,
|
||||||
|
cleared);
|
||||||
DrawCellLines(pain, nx, baseline, i, cell);
|
DrawCellLines(pain, nx, baseline, i, cell);
|
||||||
|
}
|
||||||
nx += tabular->GetWidthOfColumn(cell);
|
nx += tabular->GetWidthOfColumn(cell);
|
||||||
++cell;
|
++cell;
|
||||||
}
|
}
|
||||||
baseline += tabular->GetDescentOfRow(i) + tabular->GetAscentOfRow(i+1)
|
baseline += tabular->GetDescentOfRow(i) +
|
||||||
+ tabular->GetAdditionalHeight(cell+1);
|
tabular->GetAscentOfRow(i+1)+
|
||||||
|
tabular->GetAdditionalHeight(cell+1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
x += width(pain, font);
|
x += width(pain, font);
|
||||||
}
|
need_update = NONE;
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::update(BufferView * bv, LyXFont const & font, bool dodraw)
|
|
||||||
{
|
|
||||||
if (the_locking_inset)
|
|
||||||
the_locking_inset->update(bv, font, dodraw);
|
|
||||||
if (init_inset) {
|
|
||||||
// calculate_dimensions_of_cells(bv, font, dodraw);
|
|
||||||
init_inset = calculate_dimensions_of_cells(bv, font, dodraw) || init_inset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -270,6 +274,26 @@ void InsetTabular::DrawCellSelection(Painter & pain, int x, int baseline,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InsetTabular::update(BufferView * bv, LyXFont const & font, bool dodraw)
|
||||||
|
{
|
||||||
|
if (the_locking_inset)
|
||||||
|
the_locking_inset->update(bv, font, dodraw);
|
||||||
|
switch(need_update) {
|
||||||
|
case INIT:
|
||||||
|
case FULL:
|
||||||
|
case CELL:
|
||||||
|
if (calculate_dimensions_of_cells(bv, font, dodraw))
|
||||||
|
need_update = INIT;
|
||||||
|
break;
|
||||||
|
case SELECTION:
|
||||||
|
need_update = INIT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char const * InsetTabular::EditMessage() const
|
char const * InsetTabular::EditMessage() const
|
||||||
{
|
{
|
||||||
return _("Opened Tabular Inset");
|
return _("Opened Tabular Inset");
|
||||||
@ -294,7 +318,7 @@ void InsetTabular::Edit(BufferView * bv, int x, int y, unsigned int button)
|
|||||||
if (InsetHit(bv, x, y)) {
|
if (InsetHit(bv, x, y)) {
|
||||||
ActivateCellInset(bv, x, y, button);
|
ActivateCellInset(bv, x, y, button);
|
||||||
}
|
}
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, NONE, false);
|
||||||
// bv->getOwner()->getPopups().updateFormTabular();
|
// bv->getOwner()->getPopups().updateFormTabular();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,20 +332,21 @@ void InsetTabular::InsetUnlock(BufferView * bv)
|
|||||||
}
|
}
|
||||||
HideInsetCursor(bv);
|
HideInsetCursor(bv);
|
||||||
if (hasSelection()) {
|
if (hasSelection()) {
|
||||||
sel_pos_start = sel_pos_end = cursor.pos();
|
sel_pos_start = sel_pos_end = 0;
|
||||||
sel_cell_start = sel_cell_end = actcell;
|
sel_cell_start = sel_cell_end = 0;
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, FULL, false);
|
||||||
}
|
}
|
||||||
no_selection = false;
|
no_selection = false;
|
||||||
oldcell = -1;
|
oldcell = -1;
|
||||||
locked = false;
|
locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsetTabular::UpdateLocal(BufferView * bv, bool what, bool mark_dirty)
|
void InsetTabular::UpdateLocal(BufferView * bv, UpdateCodes what,
|
||||||
|
bool mark_dirty)
|
||||||
{
|
{
|
||||||
init_inset = what;
|
need_update = what;
|
||||||
bv->updateInset(this, mark_dirty);
|
bv->updateInset(this, mark_dirty);
|
||||||
if (what)
|
if (what != NONE)
|
||||||
resetPos(bv->painter());
|
resetPos(bv->painter());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +391,7 @@ bool InsetTabular::UnlockInsetInInset(BufferView * bv, UpdatableInset * inset,
|
|||||||
the_locking_inset = 0;
|
the_locking_inset = 0;
|
||||||
if (lr)
|
if (lr)
|
||||||
moveRight(bv, false);
|
moveRight(bv, false);
|
||||||
UpdateLocal(bv, true, false);
|
UpdateLocal(bv, CELL, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (the_locking_inset->UnlockInsetInInset(bv, inset, lr)) {
|
if (the_locking_inset->UnlockInsetInInset(bv, inset, lr)) {
|
||||||
@ -387,7 +412,7 @@ bool InsetTabular::UpdateInsetInInset(BufferView * bv, Inset * inset)
|
|||||||
return false;
|
return false;
|
||||||
if (the_locking_inset != inset)
|
if (the_locking_inset != inset)
|
||||||
return the_locking_inset->UpdateInsetInInset(bv, inset);
|
return the_locking_inset->UpdateInsetInInset(bv, inset);
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, CELL, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +476,7 @@ void InsetTabular::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
|||||||
{
|
{
|
||||||
if (hasSelection()) {
|
if (hasSelection()) {
|
||||||
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
|
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, SELECTION, false);
|
||||||
}
|
}
|
||||||
no_selection = false;
|
no_selection = false;
|
||||||
|
|
||||||
@ -499,7 +524,7 @@ void InsetTabular::InsetMotionNotify(BufferView * bv, int x, int y, int button)
|
|||||||
sel_pos_end = cursor.pos();
|
sel_pos_end = cursor.pos();
|
||||||
sel_cell_end = actcell;
|
sel_cell_end = actcell;
|
||||||
if (old != sel_pos_end)
|
if (old != sel_pos_end)
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, SELECTION, false);
|
||||||
#if 0
|
#if 0
|
||||||
if (ocell != actcell)
|
if (ocell != actcell)
|
||||||
bview->getOwner()->getPopups().updateFormTabular();
|
bview->getOwner()->getPopups().updateFormTabular();
|
||||||
@ -544,9 +569,8 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
|||||||
if (result == DISPATCHED_NOUPDATE)
|
if (result == DISPATCHED_NOUPDATE)
|
||||||
return result;
|
return result;
|
||||||
else if (result == DISPATCHED) {
|
else if (result == DISPATCHED) {
|
||||||
bool upd = SetCellDimensions(bv->painter(), actcell, actrow);
|
|
||||||
the_locking_inset->ToggleInsetCursor(bv);
|
the_locking_inset->ToggleInsetCursor(bv);
|
||||||
UpdateLocal(bv, upd, false);
|
UpdateLocal(bv, CELL, false);
|
||||||
the_locking_inset->ToggleInsetCursor(bv);
|
the_locking_inset->ToggleInsetCursor(bv);
|
||||||
return result;
|
return result;
|
||||||
} else if (result == FINISHED) {
|
} else if (result == FINISHED) {
|
||||||
@ -581,14 +605,14 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
|||||||
else
|
else
|
||||||
sel_cell_end = actcell;
|
sel_cell_end = actcell;
|
||||||
}
|
}
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, SELECTION, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_RIGHT:
|
case LFUN_RIGHT:
|
||||||
result = moveRight(bv);
|
result = moveRight(bv);
|
||||||
sel_pos_start = sel_pos_end = cursor.pos();
|
sel_pos_start = sel_pos_end = cursor.pos();
|
||||||
sel_cell_start = sel_cell_end = actcell;
|
sel_cell_start = sel_cell_end = actcell;
|
||||||
if (hs)
|
if (hs)
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_LEFTSEL:
|
case LFUN_LEFTSEL:
|
||||||
if (tabular->IsFirstCellInRow(actcell) && cellstart(cursor.pos()))
|
if (tabular->IsFirstCellInRow(actcell) && cellstart(cursor.pos()))
|
||||||
@ -602,14 +626,14 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
|||||||
else
|
else
|
||||||
sel_cell_end = actcell-1;
|
sel_cell_end = actcell-1;
|
||||||
}
|
}
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, SELECTION, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_LEFT:
|
case LFUN_LEFT:
|
||||||
result = moveLeft(bv);
|
result = moveLeft(bv);
|
||||||
sel_pos_start = sel_pos_end = cursor.pos();
|
sel_pos_start = sel_pos_end = cursor.pos();
|
||||||
sel_cell_start = sel_cell_end = actcell;
|
sel_cell_start = sel_cell_end = actcell;
|
||||||
if (hs)
|
if (hs)
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_DOWNSEL:
|
case LFUN_DOWNSEL:
|
||||||
{
|
{
|
||||||
@ -621,7 +645,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
|||||||
sel_cell_end = tabular->GetCellBelow(sel_cell_end);
|
sel_cell_end = tabular->GetCellBelow(sel_cell_end);
|
||||||
else
|
else
|
||||||
sel_cell_end = tabular->GetLastCellBelow(sel_cell_end);
|
sel_cell_end = tabular->GetLastCellBelow(sel_cell_end);
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, SELECTION, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LFUN_DOWN:
|
case LFUN_DOWN:
|
||||||
@ -629,7 +653,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
|||||||
sel_pos_start = sel_pos_end = cursor.pos();
|
sel_pos_start = sel_pos_end = cursor.pos();
|
||||||
sel_cell_start = sel_cell_end = actcell;
|
sel_cell_start = sel_cell_end = actcell;
|
||||||
if (hs)
|
if (hs)
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_UPSEL:
|
case LFUN_UPSEL:
|
||||||
{
|
{
|
||||||
@ -641,7 +665,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
|||||||
sel_cell_end = tabular->GetCellAbove(sel_cell_end);
|
sel_cell_end = tabular->GetCellAbove(sel_cell_end);
|
||||||
else
|
else
|
||||||
sel_cell_end = tabular->GetLastCellAbove(sel_cell_end);
|
sel_cell_end = tabular->GetLastCellAbove(sel_cell_end);
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, SELECTION, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LFUN_UP:
|
case LFUN_UP:
|
||||||
@ -649,7 +673,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
|||||||
sel_pos_start = sel_pos_end = cursor.pos();
|
sel_pos_start = sel_pos_end = cursor.pos();
|
||||||
sel_cell_start = sel_cell_end = actcell;
|
sel_cell_start = sel_cell_end = actcell;
|
||||||
if (hs)
|
if (hs)
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_BACKSPACE:
|
case LFUN_BACKSPACE:
|
||||||
break;
|
break;
|
||||||
@ -672,7 +696,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
|||||||
sel_pos_start = sel_pos_end = cursor.pos();
|
sel_pos_start = sel_pos_end = cursor.pos();
|
||||||
sel_cell_start = sel_cell_end = actcell;
|
sel_cell_start = sel_cell_end = actcell;
|
||||||
if (hs)
|
if (hs)
|
||||||
UpdateLocal(bv, false, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_LAYOUT_TABLE:
|
case LFUN_LAYOUT_TABLE:
|
||||||
{
|
{
|
||||||
@ -885,28 +909,6 @@ void InsetTabular::resetPos(Painter & pain) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetTabular::SetCellDimensions(Painter & pain, int cell, int row)
|
|
||||||
{
|
|
||||||
InsetText * inset = tabular->GetCellInset(cell);
|
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
|
||||||
int asc = inset->ascent(pain, font) + ADD_TO_HEIGHT;
|
|
||||||
int desc = inset->descent(pain, font) + ADD_TO_HEIGHT;
|
|
||||||
int maxAsc = tabular->GetAscentOfRow(row);
|
|
||||||
int maxDesc = tabular->GetDescentOfRow(row);
|
|
||||||
bool ret = tabular->SetWidthOfCell(cell, inset->width(pain, font));
|
|
||||||
|
|
||||||
if (maxAsc < asc) {
|
|
||||||
ret = true;
|
|
||||||
tabular->SetAscentOfRow(row, asc);
|
|
||||||
}
|
|
||||||
if (maxDesc < desc) {
|
|
||||||
ret = true;
|
|
||||||
tabular->SetDescentOfRow(row, desc);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT InsetTabular::moveRight(BufferView * bv, bool lock)
|
UpdatableInset::RESULT InsetTabular::moveRight(BufferView * bv, bool lock)
|
||||||
{
|
{
|
||||||
if (!cellstart(cursor.pos())) {
|
if (!cellstart(cursor.pos())) {
|
||||||
@ -1066,8 +1068,13 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
|||||||
{
|
{
|
||||||
bool update = (tabular->GetPWidth(actcell) != val);
|
bool update = (tabular->GetPWidth(actcell) != val);
|
||||||
tabular->SetPWidth(actcell,val);
|
tabular->SetPWidth(actcell,val);
|
||||||
if (update)
|
if (update) {
|
||||||
UpdateLocal(bv, true, true);
|
for (int i=0; i < tabular->rows(); ++i) {
|
||||||
|
tabular->GetCellInset(tabular->GetCellNumber(i, column))->
|
||||||
|
deleteLyXText(bv);
|
||||||
|
}
|
||||||
|
UpdateLocal(bv, INIT, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_SPECIAL_COLUMN:
|
case LyXTabular::SET_SPECIAL_COLUMN:
|
||||||
@ -1078,34 +1085,34 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
|||||||
// append the row into the tabular
|
// append the row into the tabular
|
||||||
UnlockInsetInInset(bv, the_locking_inset);
|
UnlockInsetInInset(bv, the_locking_inset);
|
||||||
tabular->AppendRow(actcell);
|
tabular->AppendRow(actcell);
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
case LyXTabular::APPEND_COLUMN:
|
case LyXTabular::APPEND_COLUMN:
|
||||||
// append the column into the tabular
|
// append the column into the tabular
|
||||||
tabular->AppendColumn(actcell);
|
tabular->AppendColumn(actcell);
|
||||||
actcell = tabular->GetCellNumber(row, column);
|
actcell = tabular->GetCellNumber(row, column);
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
case LyXTabular::DELETE_ROW:
|
case LyXTabular::DELETE_ROW:
|
||||||
tabular->DeleteRow(tabular->row_of_cell(actcell));
|
tabular->DeleteRow(tabular->row_of_cell(actcell));
|
||||||
if ((row+1) > tabular->rows())
|
if ((row+1) > tabular->rows())
|
||||||
--row;
|
--row;
|
||||||
actcell = tabular->GetCellNumber(row, column);
|
actcell = tabular->GetCellNumber(row, column);
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
case LyXTabular::DELETE_COLUMN:
|
case LyXTabular::DELETE_COLUMN:
|
||||||
tabular->DeleteColumn(tabular->column_of_cell(actcell));
|
tabular->DeleteColumn(tabular->column_of_cell(actcell));
|
||||||
if ((column+1) > tabular->columns())
|
if ((column+1) > tabular->columns())
|
||||||
--column;
|
--column;
|
||||||
actcell = tabular->GetCellNumber(row, column);
|
actcell = tabular->GetCellNumber(row, column);
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
case LyXTabular::TOGGLE_LINE_TOP:
|
case LyXTabular::TOGGLE_LINE_TOP:
|
||||||
lineSet = !tabular->TopLine(actcell);
|
lineSet = !tabular->TopLine(actcell);
|
||||||
for(i=sel_row_start; i<=sel_row_end; ++i)
|
for(i=sel_row_start; i<=sel_row_end; ++i)
|
||||||
for(j=sel_col_start; j<=sel_col_end; ++j)
|
for(j=sel_col_start; j<=sel_col_end; ++j)
|
||||||
tabular->SetTopLine(tabular->GetCellNumber(i,j),lineSet);
|
tabular->SetTopLine(tabular->GetCellNumber(i,j),lineSet);
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LyXTabular::TOGGLE_LINE_BOTTOM:
|
case LyXTabular::TOGGLE_LINE_BOTTOM:
|
||||||
@ -1113,7 +1120,7 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
|||||||
for(i=sel_row_start; i<=sel_row_end; ++i)
|
for(i=sel_row_start; i<=sel_row_end; ++i)
|
||||||
for(j=sel_col_start; j<=sel_col_end; ++j)
|
for(j=sel_col_start; j<=sel_col_end; ++j)
|
||||||
tabular->SetBottomLine(tabular->GetCellNumber(i,j),lineSet);
|
tabular->SetBottomLine(tabular->GetCellNumber(i,j),lineSet);
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LyXTabular::TOGGLE_LINE_LEFT:
|
case LyXTabular::TOGGLE_LINE_LEFT:
|
||||||
@ -1121,7 +1128,7 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
|||||||
for(i=sel_row_start; i<=sel_row_end; ++i)
|
for(i=sel_row_start; i<=sel_row_end; ++i)
|
||||||
for(j=sel_col_start; j<=sel_col_end; ++j)
|
for(j=sel_col_start; j<=sel_col_end; ++j)
|
||||||
tabular->SetLeftLine(tabular->GetCellNumber(i,j),lineSet);
|
tabular->SetLeftLine(tabular->GetCellNumber(i,j),lineSet);
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LyXTabular::TOGGLE_LINE_RIGHT:
|
case LyXTabular::TOGGLE_LINE_RIGHT:
|
||||||
@ -1129,7 +1136,7 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
|||||||
for(i=sel_row_start; i<=sel_row_end; ++i)
|
for(i=sel_row_start; i<=sel_row_end; ++i)
|
||||||
for(j=sel_col_start; j<=sel_col_end; ++j)
|
for(j=sel_col_start; j<=sel_col_end; ++j)
|
||||||
tabular->SetRightLine(tabular->GetCellNumber(i,j),lineSet);
|
tabular->SetRightLine(tabular->GetCellNumber(i,j),lineSet);
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
case LyXTabular::ALIGN_LEFT:
|
case LyXTabular::ALIGN_LEFT:
|
||||||
case LyXTabular::ALIGN_RIGHT:
|
case LyXTabular::ALIGN_RIGHT:
|
||||||
@ -1137,7 +1144,10 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
|||||||
for(i=sel_row_start; i<=sel_row_end; ++i)
|
for(i=sel_row_start; i<=sel_row_end; ++i)
|
||||||
for(j=sel_col_start; j<=sel_col_end; ++j)
|
for(j=sel_col_start; j<=sel_col_end; ++j)
|
||||||
tabular->SetAlignment(tabular->GetCellNumber(i,j),setAlign);
|
tabular->SetAlignment(tabular->GetCellNumber(i,j),setAlign);
|
||||||
UpdateLocal(bv, true, true);
|
if (hasSelection())
|
||||||
|
UpdateLocal(bv, INIT, true);
|
||||||
|
else
|
||||||
|
UpdateLocal(bv, CELL, true);
|
||||||
break;
|
break;
|
||||||
case LyXTabular::MULTICOLUMN:
|
case LyXTabular::MULTICOLUMN:
|
||||||
{
|
{
|
||||||
@ -1152,10 +1162,10 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
|||||||
// check wether we are completly in a multicol
|
// check wether we are completly in a multicol
|
||||||
if (tabular->IsMultiColumn(actcell)) {
|
if (tabular->IsMultiColumn(actcell)) {
|
||||||
tabular->UnsetMultiColumn(actcell);
|
tabular->UnsetMultiColumn(actcell);
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
} else {
|
} else {
|
||||||
tabular->SetMultiColumn(actcell, 1);
|
tabular->SetMultiColumn(actcell, 1);
|
||||||
UpdateLocal(bv, false, true);
|
UpdateLocal(bv, CELL, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1176,7 +1186,7 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
|||||||
cursor.pos(0);
|
cursor.pos(0);
|
||||||
sel_cell_end = sel_cell_start;
|
sel_cell_end = sel_cell_start;
|
||||||
sel_pos_end = sel_pos_start;
|
sel_pos_end = sel_pos_start;
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LyXTabular::SET_ALL_LINES:
|
case LyXTabular::SET_ALL_LINES:
|
||||||
@ -1185,15 +1195,15 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
|
|||||||
for(i=sel_row_start; i<=sel_row_end; ++i)
|
for(i=sel_row_start; i<=sel_row_end; ++i)
|
||||||
for(j=sel_col_start; j<=sel_col_end; ++j)
|
for(j=sel_col_start; j<=sel_col_end; ++j)
|
||||||
tabular->SetAllLines(tabular->GetCellNumber(i,j), setLines);
|
tabular->SetAllLines(tabular->GetCellNumber(i,j), setLines);
|
||||||
UpdateLocal(bv, true, true);
|
UpdateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_LONGTABULAR:
|
case LyXTabular::SET_LONGTABULAR:
|
||||||
tabular->SetLongTabular(true);
|
tabular->SetLongTabular(true);
|
||||||
UpdateLocal(bv, true, true); // because this toggles displayed
|
UpdateLocal(bv, INIT, true); // because this toggles displayed
|
||||||
break;
|
break;
|
||||||
case LyXTabular::UNSET_LONGTABULAR:
|
case LyXTabular::UNSET_LONGTABULAR:
|
||||||
tabular->SetLongTabular(false);
|
tabular->SetLongTabular(false);
|
||||||
UpdateLocal(bv, true, true); // because this toggles displayed
|
UpdateLocal(bv, INIT, true); // because this toggles displayed
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_ROTATE_TABULAR:
|
case LyXTabular::SET_ROTATE_TABULAR:
|
||||||
tabular->SetRotateTabular(true);
|
tabular->SetRotateTabular(true);
|
||||||
@ -1257,7 +1267,7 @@ bool InsetTabular::ActivateCellInset(BufferView * bv, int x, int y, int button,
|
|||||||
inset->Edit(bv, x - inset_x, y - inset_y, button);
|
inset->Edit(bv, x - inset_x, y - inset_y, button);
|
||||||
if (!the_locking_inset)
|
if (!the_locking_inset)
|
||||||
return false;
|
return false;
|
||||||
UpdateLocal(bv, true, false);
|
UpdateLocal(bv, CELL, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,15 @@ class Buffer;
|
|||||||
|
|
||||||
class InsetTabular : public UpdatableInset {
|
class InsetTabular : public UpdatableInset {
|
||||||
public:
|
public:
|
||||||
|
///
|
||||||
|
enum UpdateCodes {
|
||||||
|
NONE = 0,
|
||||||
|
INIT,
|
||||||
|
FULL,
|
||||||
|
CELL,
|
||||||
|
CURSOR,
|
||||||
|
SELECTION
|
||||||
|
};
|
||||||
///
|
///
|
||||||
InsetTabular(Buffer *, int rows=1, int columns=1);
|
InsetTabular(Buffer *, int rows=1, int columns=1);
|
||||||
///
|
///
|
||||||
@ -80,7 +89,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const & f) const;
|
int width(Painter &, LyXFont const & f) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, const LyXFont &, int , float &) const;
|
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
|
||||||
///
|
///
|
||||||
void update(BufferView *, LyXFont const &, bool);
|
void update(BufferView *, LyXFont const &, bool);
|
||||||
///
|
///
|
||||||
@ -92,7 +101,7 @@ public:
|
|||||||
///
|
///
|
||||||
void InsetUnlock(BufferView *);
|
void InsetUnlock(BufferView *);
|
||||||
///
|
///
|
||||||
void UpdateLocal(BufferView *, bool what, bool mark_dirty);
|
void UpdateLocal(BufferView *, UpdateCodes, bool mark_dirty);
|
||||||
///
|
///
|
||||||
bool LockInsetInInset(BufferView *, UpdatableInset *);
|
bool LockInsetInInset(BufferView *, UpdatableInset *);
|
||||||
///
|
///
|
||||||
@ -166,8 +175,6 @@ private:
|
|||||||
///
|
///
|
||||||
void setPos(Painter &, int x, int y) const;
|
void setPos(Painter &, int x, int y) const;
|
||||||
///
|
///
|
||||||
bool SetCellDimensions(Painter & pain, int cell, int row);
|
|
||||||
///
|
|
||||||
UpdatableInset::RESULT moveRight(BufferView *, bool lock=true);
|
UpdatableInset::RESULT moveRight(BufferView *, bool lock=true);
|
||||||
UpdatableInset::RESULT moveLeft(BufferView *, bool lock=true);
|
UpdatableInset::RESULT moveLeft(BufferView *, bool lock=true);
|
||||||
UpdatableInset::RESULT moveUp(BufferView *);
|
UpdatableInset::RESULT moveUp(BufferView *);
|
||||||
@ -216,6 +223,6 @@ private:
|
|||||||
actrow;
|
actrow;
|
||||||
bool no_selection;
|
bool no_selection;
|
||||||
mutable bool locked;
|
mutable bool locked;
|
||||||
mutable bool init_inset;
|
mutable UpdateCodes need_update;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -205,16 +205,21 @@ int InsetText::width(Painter &, LyXFont const &) const
|
|||||||
return insetWidth;
|
return insetWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InsetText::textWidth(Painter & pain) const
|
||||||
|
{
|
||||||
|
return getMaxTextWidth(pain, this) - drawTextXOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetText::draw(BufferView * bv, LyXFont const & f,
|
void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool cleared) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
|
|
||||||
xpos = x;
|
xpos = x;
|
||||||
UpdatableInset::draw(bv, f, baseline, x);
|
UpdatableInset::draw(bv, f, baseline, x);
|
||||||
|
|
||||||
if (locked && ((need_update==FULL) || (top_x!=int(x)) ||
|
if (!cleared && locked && ((need_update==FULL) || (top_x!=int(x)) ||
|
||||||
(top_baseline!=baseline))) {
|
(top_baseline!=baseline))) {
|
||||||
need_update = NONE;
|
need_update = NONE;
|
||||||
top_x = int(x);
|
top_x = int(x);
|
||||||
@ -235,11 +240,16 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
inset_x = cx(bv) - top_x + drawTextXOffset;
|
inset_x = cx(bv) - top_x + drawTextXOffset;
|
||||||
inset_y = cy(bv) + drawTextYOffset;
|
inset_y = cy(bv) + drawTextYOffset;
|
||||||
}
|
}
|
||||||
|
if (need_update == CURSOR) {
|
||||||
|
x += width(pain, f);
|
||||||
|
need_update = NONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
x += TEXT_TO_INSET_OFFSET; // place for border
|
x += TEXT_TO_INSET_OFFSET; // place for border
|
||||||
long int y = 0;
|
long int y = 0;
|
||||||
Row * row = TEXT(bv)->GetRowNearY(y);
|
Row * row = TEXT(bv)->GetRowNearY(y);
|
||||||
y += baseline - row->ascent_of_text() + 1;
|
y += baseline - row->ascent_of_text() + 1;
|
||||||
if (!locked || (need_update == FULL)) {
|
if (cleared || !locked || (need_update == FULL)) {
|
||||||
while (row != 0) {
|
while (row != 0) {
|
||||||
TEXT(bv)->GetVisibleRow(bv, y, x, row, y);
|
TEXT(bv)->GetVisibleRow(bv, y, x, row, y);
|
||||||
y += row->height();
|
y += row->height();
|
||||||
@ -252,9 +262,15 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
bv->screen()->Update(TEXT(bv), y, x);
|
bv->screen()->Update(TEXT(bv), y, x);
|
||||||
locked = true;
|
locked = true;
|
||||||
}
|
}
|
||||||
|
TEXT(bv)->refresh_y = 0;
|
||||||
|
TEXT(bv)->status = LyXText::UNCHANGED;
|
||||||
if (drawLockedFrame && locked) {
|
if (drawLockedFrame && locked) {
|
||||||
pain.rectangle(top_x, baseline - ascent(pain, f), width(pain, f),
|
pain.rectangle(top_x, baseline - ascent(pain, f), width(pain, f),
|
||||||
ascent(pain,f) + descent(pain, f), frame_color);
|
ascent(pain,f) + descent(pain, f), frame_color);
|
||||||
|
} else {
|
||||||
|
pain.rectangle(top_x, baseline - ascent(pain, f), width(pain, f),
|
||||||
|
ascent(pain,f) + descent(pain, f),
|
||||||
|
LColor::background);
|
||||||
}
|
}
|
||||||
x += width(pain, f) - TEXT_TO_INSET_OFFSET;
|
x += width(pain, f) - TEXT_TO_INSET_OFFSET;
|
||||||
need_update = NONE;
|
need_update = NONE;
|
||||||
@ -269,16 +285,18 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool dodraw)
|
|||||||
deleteLyXText(bv);
|
deleteLyXText(bv);
|
||||||
need_update = FULL;
|
need_update = FULL;
|
||||||
}
|
}
|
||||||
if (dodraw)
|
if (dodraw && (need_update != CURSOR))
|
||||||
need_update = FULL;
|
need_update = FULL;
|
||||||
|
|
||||||
TEXT(bv)->FullRebreak(bv);
|
TEXT(bv)->FullRebreak(bv);
|
||||||
|
|
||||||
long int y_temp = 0;
|
long int y_temp = 0;
|
||||||
Row * row = TEXT(bv)->GetRowNearY(y_temp);
|
Row * row = TEXT(bv)->GetRowNearY(y_temp);
|
||||||
insetAscent = row->ascent_of_text() + 2;
|
insetAscent = row->ascent_of_text() + TEXT_TO_INSET_OFFSET;
|
||||||
insetDescent = TEXT(bv)->height - row->ascent_of_text() + 2;
|
insetDescent = TEXT(bv)->height - row->ascent_of_text() +
|
||||||
insetWidth = max(getMaxTextWidth(bv->painter(), this), TEXT(bv)->width);
|
TEXT_TO_INSET_OFFSET;
|
||||||
|
insetWidth = max(textWidth(bv->painter()), TEXT(bv)->width) +
|
||||||
|
(2 * TEXT_TO_INSET_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -300,6 +318,8 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
|
|||||||
locked = true;
|
locked = true;
|
||||||
the_locking_inset = 0;
|
the_locking_inset = 0;
|
||||||
inset_pos = inset_x = inset_y = 0;
|
inset_pos = inset_x = inset_y = 0;
|
||||||
|
#warning Fix cursor setting here!!! (Jug)
|
||||||
|
TEXT(bv)->SetCursor(bv, par, 0);
|
||||||
// setPos(bv->painter(), x, y);
|
// setPos(bv->painter(), x, y);
|
||||||
checkAndActivateInset(bv, x, y, button);
|
checkAndActivateInset(bv, x, y, button);
|
||||||
// selection_start_cursor = selection_end_cursor = cursor;
|
// selection_start_cursor = selection_end_cursor = cursor;
|
||||||
@ -397,8 +417,6 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
|||||||
UpdateLocal(bv, FULL, false);
|
UpdateLocal(bv, FULL, false);
|
||||||
}
|
}
|
||||||
no_selection = false;
|
no_selection = false;
|
||||||
// setPos(bv->painter(), x, y);
|
|
||||||
// cursor.x_fix(-1);
|
|
||||||
TEXT(bv)->SetCursorFromCoordinates(bv, x, y+TEXT(bv)->first);
|
TEXT(bv)->SetCursorFromCoordinates(bv, x, y+TEXT(bv)->first);
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
UpdatableInset * inset = 0;
|
UpdatableInset * inset = 0;
|
||||||
@ -575,7 +593,7 @@ InsetText::LocalDispatch(BufferView * bv,
|
|||||||
result = moveRight(bv);
|
result = moveRight(bv);
|
||||||
TEXT(bv)->selection = 0;
|
TEXT(bv)->selection = 0;
|
||||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||||
UpdateLocal(bv, CURSOR_PAR, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_LEFTSEL:
|
case LFUN_LEFTSEL:
|
||||||
bv->text->FinishUndo();
|
bv->text->FinishUndo();
|
||||||
@ -588,7 +606,7 @@ InsetText::LocalDispatch(BufferView * bv,
|
|||||||
result= moveLeft(bv);
|
result= moveLeft(bv);
|
||||||
TEXT(bv)->selection = 0;
|
TEXT(bv)->selection = 0;
|
||||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||||
UpdateLocal(bv, CURSOR_PAR, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_DOWNSEL:
|
case LFUN_DOWNSEL:
|
||||||
bv->text->FinishUndo();
|
bv->text->FinishUndo();
|
||||||
@ -601,7 +619,7 @@ InsetText::LocalDispatch(BufferView * bv,
|
|||||||
result = moveDown(bv);
|
result = moveDown(bv);
|
||||||
TEXT(bv)->selection = 0;
|
TEXT(bv)->selection = 0;
|
||||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||||
UpdateLocal(bv, CURSOR_PAR, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_UPSEL:
|
case LFUN_UPSEL:
|
||||||
bv->text->FinishUndo();
|
bv->text->FinishUndo();
|
||||||
@ -614,20 +632,20 @@ InsetText::LocalDispatch(BufferView * bv,
|
|||||||
result = moveUp(bv);
|
result = moveUp(bv);
|
||||||
TEXT(bv)->selection = 0;
|
TEXT(bv)->selection = 0;
|
||||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||||
UpdateLocal(bv, CURSOR_PAR, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_HOME:
|
case LFUN_HOME:
|
||||||
bv->text->FinishUndo();
|
bv->text->FinishUndo();
|
||||||
TEXT(bv)->CursorHome(bv);
|
TEXT(bv)->CursorHome(bv);
|
||||||
TEXT(bv)->selection = 0;
|
TEXT(bv)->selection = 0;
|
||||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||||
UpdateLocal(bv, CURSOR_PAR, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_END:
|
case LFUN_END:
|
||||||
TEXT(bv)->CursorEnd(bv);
|
TEXT(bv)->CursorEnd(bv);
|
||||||
TEXT(bv)->selection = 0;
|
TEXT(bv)->selection = 0;
|
||||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||||
UpdateLocal(bv, CURSOR_PAR, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
break;
|
break;
|
||||||
case LFUN_BACKSPACE:
|
case LFUN_BACKSPACE:
|
||||||
bv->text->SetUndo(bv->buffer(), Undo::DELETE,
|
bv->text->SetUndo(bv->buffer(), Undo::DELETE,
|
||||||
@ -913,7 +931,11 @@ void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
|
|||||||
|
|
||||||
void InsetText::UpdateLocal(BufferView * bv, UpdateCodes what, bool mark_dirty)
|
void InsetText::UpdateLocal(BufferView * bv, UpdateCodes what, bool mark_dirty)
|
||||||
{
|
{
|
||||||
|
if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH)
|
||||||
|
need_update = FULL;
|
||||||
|
else
|
||||||
need_update = what;
|
need_update = what;
|
||||||
|
if ((need_update != CURSOR) || (TEXT(bv)->status != LyXText::UNCHANGED))
|
||||||
bv->updateInset(this, mark_dirty);
|
bv->updateInset(this, mark_dirty);
|
||||||
if (old_par != cpar(bv)) {
|
if (old_par != cpar(bv)) {
|
||||||
bv->owner()->getToolbar()->combox->select(cpar(bv)->GetLayout()+1);
|
bv->owner()->getToolbar()->combox->select(cpar(bv)->GetLayout()+1);
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
INIT,
|
INIT,
|
||||||
FULL,
|
FULL,
|
||||||
CURSOR_PAR,
|
CURSOR_PAR,
|
||||||
|
CURSOR,
|
||||||
SELECTION
|
SELECTION
|
||||||
};
|
};
|
||||||
///
|
///
|
||||||
@ -71,7 +72,9 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const & f) const;
|
int width(Painter &, LyXFont const & f) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, LyXFont const &, int , float &) const;
|
int textWidth(Painter &) const;
|
||||||
|
///
|
||||||
|
void draw(BufferView *, LyXFont const &, int , float &, bool) const;
|
||||||
///
|
///
|
||||||
void update(BufferView *, LyXFont const &, bool =false);
|
void update(BufferView *, LyXFont const &, bool =false);
|
||||||
///
|
///
|
||||||
|
@ -116,7 +116,7 @@ public:
|
|||||||
virtual int width(Painter &, LyXFont const &) const = 0;
|
virtual int width(Painter &, LyXFont const &) const = 0;
|
||||||
///
|
///
|
||||||
virtual void draw(BufferView *, LyXFont const &,
|
virtual void draw(BufferView *, LyXFont const &,
|
||||||
int baseline, float & x) const = 0;
|
int baseline, float & x, bool cleared) const = 0;
|
||||||
/// update the inset representation
|
/// update the inset representation
|
||||||
virtual void update(BufferView *, LyXFont const &, bool =false)
|
virtual void update(BufferView *, LyXFont const &, bool =false)
|
||||||
{}
|
{}
|
||||||
|
@ -215,7 +215,7 @@ int LyXFunc::processKeyEvent(XEvent * ev)
|
|||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
||||||
} else {
|
} else {
|
||||||
tli->UnlockInsetInInset(owner->view(),
|
tli->UnlockInsetInInset(owner->view(),
|
||||||
tli->GetLockingInset());
|
tli->GetLockingInset(),true);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ class LyXBuffer;
|
|||||||
class TexRow;
|
class TexRow;
|
||||||
struct LaTeXFeatures;
|
struct LaTeXFeatures;
|
||||||
class InsetBibKey;
|
class InsetBibKey;
|
||||||
|
class BufferView;
|
||||||
|
|
||||||
/// A LyXParagraph holds all text, attributes and insets in a text paragraph
|
/// A LyXParagraph holds all text, attributes and insets in a text paragraph
|
||||||
class LyXParagraph {
|
class LyXParagraph {
|
||||||
@ -195,7 +196,9 @@ public:
|
|||||||
///
|
///
|
||||||
Inset * InInset() { return inset_owner; }
|
Inset * InInset() { return inset_owner; }
|
||||||
///
|
///
|
||||||
void SetInsetOwner(Inset * i) { inset_owner = i; }
|
void SetInsetOwner(Inset * i);
|
||||||
|
///
|
||||||
|
void deleteInsetsLyXText(BufferView *);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
TextContainer text;
|
TextContainer text;
|
||||||
|
@ -610,7 +610,7 @@ private:
|
|||||||
///
|
///
|
||||||
void draw(BufferView *, Row const * row,
|
void draw(BufferView *, Row const * row,
|
||||||
LyXParagraph::size_type & pos,
|
LyXParagraph::size_type & pos,
|
||||||
int offset, float & x);
|
int offset, float & x, bool cleared);
|
||||||
|
|
||||||
/// get the next breakpoint in a given paragraph
|
/// get the next breakpoint in a given paragraph
|
||||||
LyXParagraph::size_type NextBreakPoint(BufferView *, Row const * row,
|
LyXParagraph::size_type NextBreakPoint(BufferView *, Row const * row,
|
||||||
|
@ -404,7 +404,7 @@ int InsetFormula::width(Painter &, LyXFont const & f) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetFormula::draw(BufferView * bv, LyXFont const & f,
|
void InsetFormula::draw(BufferView * bv, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
// Seems commenting out solves a problem.
|
// Seems commenting out solves a problem.
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *,LyXFont const &, int baseline, float & x) const;
|
void draw(BufferView *,LyXFont const &, int, float &, bool) const;
|
||||||
///
|
///
|
||||||
void Write(Buffer const *, std::ostream &) const;
|
void Write(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
|
@ -147,14 +147,14 @@ int InsetFormulaMacro::width(Painter & pain, LyXFont const & f) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f,
|
void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f,
|
||||||
int baseline, float & x) const
|
int baseline, float & x, bool cleared) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
LyXFont font(f);
|
LyXFont font(f);
|
||||||
tmacro->update();
|
tmacro->update();
|
||||||
if (opened) {
|
if (opened) {
|
||||||
tmacro->setEditMode(true);
|
tmacro->setEditMode(true);
|
||||||
InsetFormula::draw(bv, font, baseline, x);
|
InsetFormula::draw(bv, font, baseline, x, cleared);
|
||||||
tmacro->setEditMode(false);
|
tmacro->setEditMode(false);
|
||||||
} else {
|
} else {
|
||||||
font.setColor(LColor::math);
|
font.setColor(LColor::math);
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
///
|
///
|
||||||
int width(Painter &, LyXFont const &) const;
|
int width(Painter &, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *,LyXFont const &, int baseline, float & x) const;
|
void draw(BufferView *,LyXFont const &, int, float &, bool) const;
|
||||||
///
|
///
|
||||||
void Read(Buffer const *, LyXLex & lex);
|
void Read(Buffer const *, LyXLex & lex);
|
||||||
///
|
///
|
||||||
|
@ -29,10 +29,12 @@
|
|||||||
#include "LaTeXFeatures.h"
|
#include "LaTeXFeatures.h"
|
||||||
#include "insets/insetinclude.h"
|
#include "insets/insetinclude.h"
|
||||||
#include "insets/insetbib.h"
|
#include "insets/insetbib.h"
|
||||||
|
#include "insets/insettext.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
#include "texrow.h"
|
#include "texrow.h"
|
||||||
#include "support/lyxmanip.h"
|
#include "support/lyxmanip.h"
|
||||||
|
#include "BufferView.h"
|
||||||
|
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@ -4373,3 +4375,29 @@ string LyXParagraph::String(Buffer const * buffer,
|
|||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LyXParagraph::SetInsetOwner(Inset *i)
|
||||||
|
{
|
||||||
|
inset_owner = i;
|
||||||
|
for (InsetList::const_iterator cit = insetlist.begin();
|
||||||
|
cit != insetlist.end(); ++cit) {
|
||||||
|
if ((*cit).inset)
|
||||||
|
(*cit).inset->setOwner(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LyXParagraph::deleteInsetsLyXText(BufferView * bv)
|
||||||
|
{
|
||||||
|
// then the insets
|
||||||
|
for (InsetList::const_iterator cit = insetlist.begin();
|
||||||
|
cit != insetlist.end(); ++cit) {
|
||||||
|
if ((*cit).inset) {
|
||||||
|
if ((*cit).inset->IsTextInset()) {
|
||||||
|
static_cast<InsetText *>((*cit).inset)->
|
||||||
|
deleteLyXText(bv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -54,51 +54,8 @@ LyXTabular::cellstruct::cellstruct()
|
|||||||
bottom_line = false;
|
bottom_line = false;
|
||||||
rotate = false;
|
rotate = false;
|
||||||
linebreaks = false;
|
linebreaks = false;
|
||||||
#ifdef INSET_POINTER
|
|
||||||
inset = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef INSET_POINTER
|
|
||||||
LyXTabular::cellstruct::~cellstruct()
|
|
||||||
{
|
|
||||||
delete inset;
|
|
||||||
}
|
|
||||||
|
|
||||||
LyXTabular::cellstruct::cellstruct(cellstruct const & cs)
|
|
||||||
{
|
|
||||||
cellno = cs.cellno;
|
|
||||||
width_of_cell = cs.width_of_cell;
|
|
||||||
multicolumn = cs.multicolumn;
|
|
||||||
alignment = cs.alignment;
|
|
||||||
top_line = cs.top_line;
|
|
||||||
bottom_line = cs.bottom_line;
|
|
||||||
rotate = cs.rotate;
|
|
||||||
linebreaks = cs.linebreaks;
|
|
||||||
inset = cs.inset;
|
|
||||||
#if 0
|
|
||||||
if (cs.inset)
|
|
||||||
inset = static_cast<InsetText *>(cs.inset->Clone());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
LyXTabular::cellstruct &
|
|
||||||
LyXTabular::cellstruct::operator=(cellstruct const & cs)
|
|
||||||
{
|
|
||||||
cellno = cs.cellno;
|
|
||||||
width_of_cell = cs.width_of_cell;
|
|
||||||
multicolumn = cs.multicolumn;
|
|
||||||
alignment = cs.alignment;
|
|
||||||
top_line = cs.top_line;
|
|
||||||
bottom_line = cs.bottom_line;
|
|
||||||
rotate = cs.rotate;
|
|
||||||
linebreaks = cs.linebreaks;
|
|
||||||
if (cs.inset)
|
|
||||||
inset = static_cast<InsetText *>(cs.inset->Clone());
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
LyXTabular::rowstruct::rowstruct()
|
LyXTabular::rowstruct::rowstruct()
|
||||||
{
|
{
|
||||||
@ -186,12 +143,7 @@ LyXTabular * LyXTabular::Clone(InsetTabular * inset)
|
|||||||
int i,j;
|
int i,j;
|
||||||
for(i=0; i < rows_; ++i) {
|
for(i=0; i < rows_; ++i) {
|
||||||
for(j=0; j < columns_; ++j) {
|
for(j=0; j < columns_; ++j) {
|
||||||
#ifdef INSET_POINTER
|
|
||||||
delete result->cell_info[i][j].inset;
|
|
||||||
result->cell_info[i][j].inset=new InsetText(*cell_info[i][j].inset);
|
|
||||||
#else
|
|
||||||
result->cell_info[i][j].inset = cell_info[i][j].inset;
|
result->cell_info[i][j].inset = cell_info[i][j].inset;
|
||||||
#endif
|
|
||||||
result->cell_info[i][j].inset.setOwner(inset);
|
result->cell_info[i][j].inset.setOwner(inset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,10 +167,6 @@ void LyXTabular::Init(int rows_arg, int columns_arg)
|
|||||||
// Jürgen, use iterators.
|
// Jürgen, use iterators.
|
||||||
for (i = 0; i < rows_; ++i) {
|
for (i = 0; i < rows_; ++i) {
|
||||||
for (j = 0; j < columns_; ++j) {
|
for (j = 0; j < columns_; ++j) {
|
||||||
#ifdef INSET_POINTER
|
|
||||||
if (!cell_info[i][j].inset)
|
|
||||||
cell_info[i][j].inset = new InsetText();
|
|
||||||
#endif
|
|
||||||
cell_info[i][j].inset.setOwner(owner_);
|
cell_info[i][j].inset.setOwner(owner_);
|
||||||
cell_info[i][j].inset.SetDrawLockedFrame(true);
|
cell_info[i][j].inset.SetDrawLockedFrame(true);
|
||||||
cell_info[i][j].cellno = cellno++;
|
cell_info[i][j].cellno = cellno++;
|
||||||
@ -255,7 +203,7 @@ void LyXTabular::AppendRow(int cell )
|
|||||||
row_vector::iterator rit = row_info.begin() + row;
|
row_vector::iterator rit = row_info.begin() + row;
|
||||||
row_info.insert(rit, rowstruct());
|
row_info.insert(rit, rowstruct());
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
cell_vvector::iterator cit = cell_info.begin() + row;
|
cell_vvector::iterator cit = cell_info.begin() + row;
|
||||||
cell_info.insert(cit, vector<cellstruct>(columns_, cellstruct()));
|
cell_info.insert(cit, vector<cellstruct>(columns_, cellstruct()));
|
||||||
#else
|
#else
|
||||||
@ -273,14 +221,6 @@ void LyXTabular::AppendRow(int cell )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cell_info = c_info;
|
cell_info = c_info;
|
||||||
#ifdef INSET_POINTER
|
|
||||||
for(int i = 0; i < rows_; ++i) {
|
|
||||||
for(int j = 0; j < columns_; ++j) {
|
|
||||||
if (!cell_info[i][j].inset)
|
|
||||||
cell_info[i][j].inset = static_cast<InsetText *>(c_info[i][j].inset->Clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
++row;
|
++row;
|
||||||
for (int j = 0; j < columns_; ++j) {
|
for (int j = 0; j < columns_; ++j) {
|
||||||
cell_info[row][j].inset.clear();
|
cell_info[row][j].inset.clear();
|
||||||
@ -329,13 +269,6 @@ void LyXTabular::AppendColumn(int cell)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cell_info = c_info;
|
cell_info = c_info;
|
||||||
#ifdef INSET_POINTER
|
|
||||||
for(i = 0; i < rows_; ++i) {
|
|
||||||
for(j = 0; j < columns_; ++j) {
|
|
||||||
cell_info[i][j].inset = static_cast<InsetText *>(c_info[i][j].inset->Clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
++column;
|
++column;
|
||||||
for (i = 0; i < rows_; ++i) {
|
for (i = 0; i < rows_; ++i) {
|
||||||
cell_info[i][column].inset.clear();
|
cell_info[i][column].inset.clear();
|
||||||
|
31
src/text.C
31
src/text.C
@ -117,12 +117,7 @@ bool is_nikud(unsigned char c)
|
|||||||
int LyXText::workWidth(BufferView * bview) const
|
int LyXText::workWidth(BufferView * bview) const
|
||||||
{
|
{
|
||||||
if (inset_owner) {
|
if (inset_owner) {
|
||||||
#if 1
|
return inset_owner->textWidth(bview->painter());
|
||||||
return inset_owner->getMaxWidth(bview->painter(), inset_owner);
|
|
||||||
#else
|
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
|
||||||
return inset_owner->width(bview->painter(), font);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return bview->workWidth();
|
return bview->workWidth();
|
||||||
}
|
}
|
||||||
@ -445,7 +440,7 @@ bool LyXText::IsBoundary(Buffer const * buf, LyXParagraph * par,
|
|||||||
|
|
||||||
void LyXText::draw(BufferView * bview, Row const * row,
|
void LyXText::draw(BufferView * bview, Row const * row,
|
||||||
LyXParagraph::size_type & vpos,
|
LyXParagraph::size_type & vpos,
|
||||||
int offset, float & x)
|
int offset, float & x, bool cleared)
|
||||||
{
|
{
|
||||||
Painter & pain = bview->painter();
|
Painter & pain = bview->painter();
|
||||||
|
|
||||||
@ -567,7 +562,8 @@ void LyXText::draw(BufferView * bview, Row const * row,
|
|||||||
} else if (c == LyXParagraph::META_INSET) {
|
} else if (c == LyXParagraph::META_INSET) {
|
||||||
Inset const * tmpinset = row->par()->GetInset(pos);
|
Inset const * tmpinset = row->par()->GetInset(pos);
|
||||||
if (tmpinset) {
|
if (tmpinset) {
|
||||||
tmpinset->draw(bview, font, offset+row->baseline(), x);
|
tmpinset->draw(bview, font, offset+row->baseline(), x,
|
||||||
|
cleared);
|
||||||
}
|
}
|
||||||
++vpos;
|
++vpos;
|
||||||
|
|
||||||
@ -3794,9 +3790,6 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
|
|
||||||
// clear the area where we want to paint/print
|
// clear the area where we want to paint/print
|
||||||
int ww;
|
int ww;
|
||||||
if (inset_owner)
|
|
||||||
ww = inset_owner->width(bview->painter(), font) - 1;
|
|
||||||
else
|
|
||||||
ww = bview->workWidth();
|
ww = bview->workWidth();
|
||||||
|
|
||||||
bool clear_area = true;
|
bool clear_area = true;
|
||||||
@ -3807,8 +3800,14 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
{
|
{
|
||||||
clear_area = row_ptr->par()->GetInset(row_ptr->pos())->doClearArea();
|
clear_area = row_ptr->par()->GetInset(row_ptr->pos())->doClearArea();
|
||||||
}
|
}
|
||||||
if (clear_area)
|
if (clear_area) {
|
||||||
pain.fillRectangle(x_offset, y_offset, ww, row_ptr->height());
|
int w;
|
||||||
|
if (inset_owner)
|
||||||
|
w = inset_owner->width(bview->painter(), font);
|
||||||
|
else
|
||||||
|
w = ww;
|
||||||
|
pain.fillRectangle(x_offset, y_offset, w, row_ptr->height());
|
||||||
|
}
|
||||||
|
|
||||||
if (selection) {
|
if (selection) {
|
||||||
/* selection code */
|
/* selection code */
|
||||||
@ -4324,7 +4323,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
- row_ptr->par()->bibkey->width(bview->painter(), font);
|
- row_ptr->par()->bibkey->width(bview->painter(), font);
|
||||||
row_ptr->par()->bibkey->draw(bview, font,
|
row_ptr->par()->bibkey->draw(bview, font,
|
||||||
y_offset + row_ptr->baseline(),
|
y_offset + row_ptr->baseline(),
|
||||||
tmpx);
|
tmpx, clear_area);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4528,7 +4527,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
row_ptr->par(), pos);
|
row_ptr->par(), pos);
|
||||||
++vpos;
|
++vpos;
|
||||||
} else
|
} else
|
||||||
draw(bview, row_ptr, vpos, y_offset, x);
|
draw(bview, row_ptr, vpos, y_offset, x, clear_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do not forget the very last cell. This has no NEWLINE so
|
/* do not forget the very last cell. This has no NEWLINE so
|
||||||
@ -4640,7 +4639,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
x += fill_separator;
|
x += fill_separator;
|
||||||
++vpos;
|
++vpos;
|
||||||
} else
|
} else
|
||||||
draw(bview, row_ptr, vpos, y_offset, x);
|
draw(bview, row_ptr, vpos, y_offset, x, clear_area);
|
||||||
}
|
}
|
||||||
#ifndef NEW_TABULAR
|
#ifndef NEW_TABULAR
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,8 @@ void LyXText::init()
|
|||||||
lastrow = 0;
|
lastrow = 0;
|
||||||
number_of_rows = 0;
|
number_of_rows = 0;
|
||||||
refresh_y = 0;
|
refresh_y = 0;
|
||||||
height = width = 0;
|
height = 0;
|
||||||
|
width = -1;
|
||||||
first = 0;
|
first = 0;
|
||||||
status = LyXText::UNCHANGED;
|
status = LyXText::UNCHANGED;
|
||||||
// set cursor at the very top position
|
// set cursor at the very top position
|
||||||
@ -131,7 +132,7 @@ void LyXText::init(BufferView * bview)
|
|||||||
par = par->Next();
|
par = par->Next();
|
||||||
}
|
}
|
||||||
SetCursorIntern(bview, firstrow->par(), 0);
|
SetCursorIntern(bview, firstrow->par(), 0);
|
||||||
#if 1
|
#if 0
|
||||||
// Dump all rowinformation:
|
// Dump all rowinformation:
|
||||||
Row * tmprow = firstrow;
|
Row * tmprow = firstrow;
|
||||||
lyxerr << "Width = " << width << endl;
|
lyxerr << "Width = " << width << endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user