mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
Various fixes to Tabular, InsetTabular and InsetText. Fixed left border for
multicolumn cells, fixed repaint and recalc issues of insets, fixed scrolling of large tabulars, ADDED settings of fonts on selections, more minor stuff I cannot remember right now, more to follow. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2027 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6b971d39b2
commit
4bcf99c809
@ -1,3 +1,26 @@
|
|||||||
|
2001-05-28 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* text.C (SetHeightOfRow): added the update() call again as it is
|
||||||
|
needed to initialize inset dimensions!
|
||||||
|
|
||||||
|
2001-05-16 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* text2.C (SetCharFont): Add new function with BufferView * and
|
||||||
|
bool toggleall parameters for setting insets internal fonts.
|
||||||
|
(SetFont): Freeze the undo as we may change fonts in Insets and
|
||||||
|
all this change should be inside only one Undo!
|
||||||
|
|
||||||
|
* bufferview_funcs.C (ToggleAndShow): fixed this functions for
|
||||||
|
setting font's in insets as for them we have the SetFont function!
|
||||||
|
|
||||||
|
2001-05-15 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* text2.C (ClearSelection): to be sure we REALLY don't have any
|
||||||
|
selection anymore!
|
||||||
|
|
||||||
|
* tabular.C (TeXCellPreamble): fixed the left border problem for
|
||||||
|
multicolumn cells.
|
||||||
|
|
||||||
2001-05-27 Dekel Tsur <dekelts@tau.ac.il>
|
2001-05-27 Dekel Tsur <dekelts@tau.ac.il>
|
||||||
|
|
||||||
* LaTeX.C (deplog): Make sure that the main .tex file is in the
|
* LaTeX.C (deplog): Make sure that the main .tex file is in the
|
||||||
|
@ -245,6 +245,10 @@ string const CurrentState(BufferView * bv)
|
|||||||
void ToggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
|
void ToggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
|
||||||
{
|
{
|
||||||
if (bv->available()) {
|
if (bv->available()) {
|
||||||
|
if (bv->theLockingInset()) {
|
||||||
|
bv->theLockingInset()->SetFont(bv, font, toggleall);
|
||||||
|
return;
|
||||||
|
}
|
||||||
LyXText * text = bv->getLyXText();
|
LyXText * text = bv->getLyXText();
|
||||||
|
|
||||||
bv->hideCursor();
|
bv->hideCursor();
|
||||||
@ -254,7 +258,8 @@ void ToggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
|
|||||||
|
|
||||||
if (font.language() != ignore_language ||
|
if (font.language() != ignore_language ||
|
||||||
font.latex() != LyXFont::IGNORE ||
|
font.latex() != LyXFont::IGNORE ||
|
||||||
font.number() != LyXFont::IGNORE) {
|
font.number() != LyXFont::IGNORE)
|
||||||
|
{
|
||||||
LyXCursor & cursor = text->cursor;
|
LyXCursor & cursor = text->cursor;
|
||||||
text->ComputeBidiTables(bv->buffer(), cursor.row());
|
text->ComputeBidiTables(bv->buffer(), cursor.row());
|
||||||
if (cursor.boundary() !=
|
if (cursor.boundary() !=
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
2001-05-28 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* insettext.C (resizeLyXText): clear LyXText ONLY if we don't have
|
||||||
|
a endless-width inset (maxWidth < 0).
|
||||||
|
(Edit): change language only if not equal.
|
||||||
|
|
||||||
|
* insettabular.C (resetPos): call UpdateLocal only on REAL scroll!
|
||||||
|
|
||||||
|
* insettext.C (draw): fixed draw/clear of InsetText-Frame
|
||||||
|
|
||||||
|
2001-05-16 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* insettext.C (selectAll): added
|
||||||
|
(clearSelection): added
|
||||||
|
|
||||||
|
* insettabular.C (SetFont): now we may set a font on a whole selection!
|
||||||
|
(getSelection): added helper function.
|
||||||
|
|
||||||
2001-05-27 Dekel Tsur <dekelts@tau.ac.il>
|
2001-05-27 Dekel Tsur <dekelts@tau.ac.il>
|
||||||
|
|
||||||
* insetcite.C (Ascii): Add method.
|
* insetcite.C (Ascii): Add method.
|
||||||
|
@ -149,7 +149,7 @@ void UpdatableInset::draw(BufferView *, LyXFont const &,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UpdatableInset::SetFont(BufferView *, LyXFont const &, bool )
|
void UpdatableInset::SetFont(BufferView *, LyXFont const &, bool, bool )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -442,10 +442,10 @@ UpdatableInset * InsetCollapsable::GetFirstLockingInsetOfType(Inset::Code c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::SetFont(BufferView * bv,
|
void InsetCollapsable::SetFont(BufferView * bv, LyXFont const & font,
|
||||||
LyXFont const & font, bool toggleall)
|
bool toggleall, bool selectall)
|
||||||
{
|
{
|
||||||
inset.SetFont(bv, font, toggleall);
|
inset.SetFont(bv, font, toggleall, selectall);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +109,8 @@ public:
|
|||||||
///
|
///
|
||||||
UpdatableInset * GetFirstLockingInsetOfType(Inset::Code);
|
UpdatableInset * GetFirstLockingInsetOfType(Inset::Code);
|
||||||
///
|
///
|
||||||
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
|
void SetFont(BufferView *, LyXFont const &, bool toggleall = false,
|
||||||
|
bool selectall = false);
|
||||||
///
|
///
|
||||||
void setLabel(string const & l) { label = l; }
|
void setLabel(string const & l) { label = l; }
|
||||||
///
|
///
|
||||||
|
@ -60,11 +60,14 @@ string const InsetERT::EditMessage() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::SetFont(BufferView *, LyXFont const &, bool)
|
void InsetERT::SetFont(BufferView *, LyXFont const &, bool, bool selectall)
|
||||||
{
|
{
|
||||||
WriteAlert(_("Impossible Operation!"),
|
// if selectall is activated then the fontchange was an outside general
|
||||||
_("Not permitted to change font-types inside ERT-insets!"),
|
// fontchange and this messages is not needed
|
||||||
_("Sorry."));
|
if (!selectall)
|
||||||
|
WriteAlert(_("Impossible Operation!"),
|
||||||
|
_("Not permitted to change font-types inside ERT-insets!"),
|
||||||
|
_("Sorry."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,8 @@ public:
|
|||||||
///
|
///
|
||||||
bool InsertInset(BufferView *, Inset *) { return false; }
|
bool InsertInset(BufferView *, Inset *) { return false; }
|
||||||
///
|
///
|
||||||
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
|
void SetFont(BufferView *, LyXFont const &, bool toggleall = false,
|
||||||
|
bool selectall = false);
|
||||||
///
|
///
|
||||||
void Edit(BufferView *, int, int, unsigned int);
|
void Edit(BufferView *, int, int, unsigned int);
|
||||||
};
|
};
|
||||||
|
@ -93,87 +93,84 @@ void InsetMinipage::Write(Buffer const * buf, ostream & os) const
|
|||||||
|
|
||||||
void InsetMinipage::Read(Buffer const * buf, LyXLex & lex)
|
void InsetMinipage::Read(Buffer const * buf, LyXLex & lex)
|
||||||
{
|
{
|
||||||
string token;
|
string token;
|
||||||
|
|
||||||
if (lex.IsOK()) {
|
if (lex.IsOK()) {
|
||||||
lex.next();
|
lex.next();
|
||||||
token = lex.GetString();
|
token = lex.GetString();
|
||||||
if (token == "position") {
|
if (token == "position") {
|
||||||
lex.next();
|
lex.next();
|
||||||
pos_ = static_cast<Position>(lex.GetInteger());
|
pos_ = static_cast<Position>(lex.GetInteger());
|
||||||
token = string();
|
token = string();
|
||||||
} else {
|
} else {
|
||||||
lyxerr << "InsetMinipage::Read: Missing 'position'-tag!"
|
lyxerr << "InsetMinipage::Read: Missing 'position'-tag!"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (lex.IsOK()) {
|
||||||
if (lex.IsOK()) {
|
if (token.empty()) {
|
||||||
if (token.empty()) {
|
lex.next();
|
||||||
lex.next();
|
token = lex.GetString();
|
||||||
token = lex.GetString();
|
}
|
||||||
|
if (token == "inner_position") {
|
||||||
|
lex.next();
|
||||||
|
inner_pos_ = static_cast<InnerPosition>(lex.GetInteger());
|
||||||
|
token = string();
|
||||||
|
} else {
|
||||||
|
lyxerr << "InsetMinipage::Read: Missing 'inner_position'-tag!"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (token == "inner_position") {
|
if (lex.IsOK()) {
|
||||||
lex.next();
|
if (token.empty()) {
|
||||||
inner_pos_ = static_cast<InnerPosition>(lex.GetInteger());
|
lex.next();
|
||||||
token = string();
|
token = lex.GetString();
|
||||||
} else {
|
}
|
||||||
lyxerr << "InsetMinipage::Read: Missing 'inner_position'-tag!"
|
if (token == "height") {
|
||||||
<< endl;
|
lex.next();
|
||||||
|
height_ = lex.GetString();
|
||||||
|
token = string();
|
||||||
|
} else {
|
||||||
|
lyxerr << "InsetMinipage::Read: Missing 'height'-tag!"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (lex.IsOK()) {
|
||||||
if (lex.IsOK()) {
|
if (token.empty()) {
|
||||||
if (token.empty()) {
|
lex.next();
|
||||||
lex.next();
|
token = lex.GetString();
|
||||||
token = lex.GetString();
|
}
|
||||||
|
if (token == "width") {
|
||||||
|
lex.next();
|
||||||
|
width_ = lex.GetString();
|
||||||
|
token = string();
|
||||||
|
} else {
|
||||||
|
lyxerr << "InsetMinipage::Read: Missing 'width'-tag!"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (token == "height") {
|
|
||||||
lex.next();
|
|
||||||
height_ = lex.GetString();
|
|
||||||
token = string();
|
|
||||||
} else {
|
|
||||||
lyxerr << "InsetMinipage::Read: Missing 'height'-tag!"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (lex.IsOK()) {
|
|
||||||
if (token.empty()) {
|
|
||||||
lex.next();
|
|
||||||
token = lex.GetString();
|
|
||||||
}
|
|
||||||
if (token == "width") {
|
|
||||||
lex.next();
|
|
||||||
width_ = lex.GetString();
|
|
||||||
token = string();
|
|
||||||
} else {
|
|
||||||
lyxerr << "InsetMinipage::Read: Missing 'width'-tag!"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef WITH_WARNINGS
|
#ifdef WITH_WARNINGS
|
||||||
#warning Remove me before final 1.2.0 (Jug)
|
#warning Remove me before final 1.2.0 (Jug)
|
||||||
#warning Can we please remove this as soon as possible? (Lgb)
|
#warning Can we please remove this as soon as possible? (Lgb)
|
||||||
#endif
|
#endif
|
||||||
// this is only for compatibility to the intermediate format and should
|
// this is only for compatibility to the intermediate format and should
|
||||||
// vanish till the final 1.2.0!
|
// vanish till the final 1.2.0!
|
||||||
if (lex.IsOK()) {
|
if (lex.IsOK()) {
|
||||||
if (token.empty()) {
|
if (token.empty()) {
|
||||||
lex.next();
|
lex.next();
|
||||||
token = lex.GetString();
|
token = lex.GetString();
|
||||||
|
}
|
||||||
|
if (token == "widthp") {
|
||||||
|
lex.next();
|
||||||
|
// only do this if the width_-string was not already set!
|
||||||
|
if (width_.empty())
|
||||||
|
width_ = lex.GetString() + "%";
|
||||||
|
token = string();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (token == "widthp") {
|
if (!token.empty())
|
||||||
lex.next();
|
lex.pushToken(token);
|
||||||
// only do this if the width_-string was not already set!
|
InsetCollapsable::Read(buf, lex);
|
||||||
if (width_.empty())
|
|
||||||
width_ = lex.GetString() + "%";
|
|
||||||
token = string();
|
|
||||||
} else {
|
|
||||||
lyxerr << "InsetMinipage::Read: Missing 'widthp_'-tag!"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!token.empty())
|
|
||||||
lex.pushToken(token);
|
|
||||||
InsetCollapsable::Read(buf, lex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -330,28 +327,28 @@ void InsetMinipage::width(string const & ll)
|
|||||||
|
|
||||||
bool InsetMinipage::ShowInsetDialog(BufferView * bv) const
|
bool InsetMinipage::ShowInsetDialog(BufferView * bv) const
|
||||||
{
|
{
|
||||||
if (!inset.ShowInsetDialog(bv))
|
if (!inset.ShowInsetDialog(bv))
|
||||||
bv->owner()->getDialogs()->showMinipage(const_cast<InsetMinipage *>(this));
|
bv->owner()->getDialogs()->showMinipage(const_cast<InsetMinipage *>(this));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetMinipage::InsetButtonRelease(BufferView * bv, int x, int y,
|
void InsetMinipage::InsetButtonRelease(BufferView * bv, int x, int y,
|
||||||
int button)
|
int button)
|
||||||
{
|
{
|
||||||
if (button == 3) {
|
if (button == 3) {
|
||||||
ShowInsetDialog(bv);
|
ShowInsetDialog(bv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InsetCollapsable::InsetButtonRelease(bv, x, y, button);
|
InsetCollapsable::InsetButtonRelease(bv, x, y, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
|
int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
if (!width_.empty())
|
if (!width_.empty())
|
||||||
return VSpace(width_).inPixels(bv);
|
return VSpace(width_).inPixels(bv);
|
||||||
// this should not happen!
|
// this should not happen!
|
||||||
return InsetCollapsable::getMaxWidth(bv, inset);
|
return InsetCollapsable::getMaxWidth(bv, inset);
|
||||||
}
|
}
|
||||||
|
@ -223,10 +223,13 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
{
|
{
|
||||||
if (nodraw())
|
if (nodraw())
|
||||||
return;
|
return;
|
||||||
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
|
#if 0
|
||||||
return;
|
if (need_update == INIT) {
|
||||||
|
if (calculate_dimensions_of_cells(bv, font, true))
|
||||||
// lyxerr << "InsetTabular::draw(" << need_update << ")\n";
|
bv->text->status = LyXText::CHANGED_IN_DRAW;
|
||||||
|
need_update = FULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
int i;
|
int i;
|
||||||
@ -346,8 +349,10 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
float cx = dx;
|
float cx = dx;
|
||||||
//cx = dx = nx + tabular->GetBeginningOfTextInCell(cell);
|
//cx = dx = nx + tabular->GetBeginningOfTextInCell(cell);
|
||||||
tabular->GetCellInset(cell)->draw(bv,font,baseline, dx, false);
|
tabular->GetCellInset(cell)->draw(bv,font,baseline, dx, false);
|
||||||
|
#if 0
|
||||||
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
|
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
// clear only if we didn't have a change
|
// clear only if we didn't have a change
|
||||||
if (need_update == CELL) {
|
if (need_update == CELL) {
|
||||||
// clear before the inset
|
// clear before the inset
|
||||||
@ -371,10 +376,15 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
}
|
}
|
||||||
x -= ADD_TO_TABULAR_WIDTH;
|
x -= ADD_TO_TABULAR_WIDTH;
|
||||||
x += width(bv, font);
|
x += width(bv, font);
|
||||||
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
|
if (bv->text->status == LyXText::CHANGED_IN_DRAW) {
|
||||||
need_update = INIT;
|
int i=0;
|
||||||
else
|
for(Inset * inset=owner();inset;++i)
|
||||||
|
inset = inset->owner();
|
||||||
|
if (calculate_dimensions_of_cells(bv, font, false))
|
||||||
|
need_update = INIT;
|
||||||
|
} else {
|
||||||
need_update = NONE;
|
need_update = NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -772,6 +782,8 @@ InsetTabular::LocalDispatch(BufferView * bv,
|
|||||||
case LFUN_SHIFT_TAB:
|
case LFUN_SHIFT_TAB:
|
||||||
case LFUN_TAB:
|
case LFUN_TAB:
|
||||||
{
|
{
|
||||||
|
if (GetFirstLockingInsetOfType(Inset::TABULAR_CODE))
|
||||||
|
break;
|
||||||
HideInsetCursor(bv);
|
HideInsetCursor(bv);
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
UnlockInsetInInset(bv, the_locking_inset);
|
UnlockInsetInInset(bv, the_locking_inset);
|
||||||
@ -1276,16 +1288,17 @@ void InsetTabular::resetPos(BufferView * bv) const
|
|||||||
} else if (the_locking_inset &&
|
} else if (the_locking_inset &&
|
||||||
(tabular->GetWidthOfColumn(actcell) > bv->workWidth()-20)) {
|
(tabular->GetWidthOfColumn(actcell) > bv->workWidth()-20)) {
|
||||||
int xx = cursor.x() - offset + bv->text->GetRealCursorX(bv);
|
int xx = cursor.x() - offset + bv->text->GetRealCursorX(bv);
|
||||||
if (xx > (bv->workWidth()-20))
|
if (xx > (bv->workWidth()-20)) {
|
||||||
scroll(bv, -(xx - bv->workWidth() + 60));
|
scroll(bv, -(xx - bv->workWidth() + 60));
|
||||||
else if (xx < 20) {
|
UpdateLocal(bv, FULL, false);
|
||||||
|
} else if (xx < 20) {
|
||||||
if (xx < 0)
|
if (xx < 0)
|
||||||
xx = -xx + 60;
|
xx = -xx + 60;
|
||||||
else
|
else
|
||||||
xx = 60;
|
xx = 60;
|
||||||
scroll(bv, xx);
|
scroll(bv, xx);
|
||||||
|
UpdateLocal(bv, FULL, false);
|
||||||
}
|
}
|
||||||
UpdateLocal(bv, FULL, false);
|
|
||||||
} else if ((cursor.x() - offset) > 20 &&
|
} else if ((cursor.x() - offset) > 20 &&
|
||||||
(cursor.x() - offset + tabular->GetWidthOfColumn(actcell))
|
(cursor.x() - offset + tabular->GetWidthOfColumn(actcell))
|
||||||
> (bv->workWidth() - 20)) {
|
> (bv->workWidth() - 20)) {
|
||||||
@ -1447,8 +1460,36 @@ bool InsetTabular::Delete()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::SetFont(BufferView * bv, LyXFont const & font, bool tall)
|
void InsetTabular::SetFont(BufferView * bv, LyXFont const & font, bool tall,
|
||||||
|
bool selectall)
|
||||||
{
|
{
|
||||||
|
if (selectall) {
|
||||||
|
sel_cell_start = 0;
|
||||||
|
sel_cell_end = tabular->GetNumberOfCells() - 1;
|
||||||
|
}
|
||||||
|
if (hasSelection()) {
|
||||||
|
bool frozen;
|
||||||
|
bv->text->SetUndo(bv->buffer(), Undo::EDIT,
|
||||||
|
bv->text->cursor.par()->previous(),
|
||||||
|
bv->text->cursor.par()->next());
|
||||||
|
frozen = bv->text->undo_frozen;
|
||||||
|
if (!frozen)
|
||||||
|
bv->text->FreezeUndo();
|
||||||
|
// apply the fontchange on the whole selection
|
||||||
|
int sel_row_start;
|
||||||
|
int sel_row_end;
|
||||||
|
int sel_col_start;
|
||||||
|
int sel_col_end;
|
||||||
|
getSelection(sel_row_start, sel_row_end, sel_col_start, sel_col_end);
|
||||||
|
for(int i=sel_row_start; i <= sel_row_end; ++i) {
|
||||||
|
for(int j=sel_col_start; j <= sel_col_end; ++j) {
|
||||||
|
tabular->GetCellInset(i, j)->SetFont(bv, font, tall, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!frozen)
|
||||||
|
bv->text->UnFreezeUndo();
|
||||||
|
UpdateLocal(bv, INIT, true);
|
||||||
|
}
|
||||||
if (the_locking_inset)
|
if (the_locking_inset)
|
||||||
the_locking_inset->SetFont(bv, font, tall);
|
the_locking_inset->SetFont(bv, font, tall);
|
||||||
}
|
}
|
||||||
@ -1524,23 +1565,7 @@ void InsetTabular::TabularFeatures(BufferView * bv,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (hasSelection()) {
|
if (hasSelection()) {
|
||||||
sel_col_start = tabular->column_of_cell(sel_cell_start);
|
getSelection(sel_row_start, sel_row_end, sel_col_start, sel_col_end);
|
||||||
sel_col_end = tabular->column_of_cell(sel_cell_end);
|
|
||||||
if (sel_col_start > sel_col_end) {
|
|
||||||
sel_col_end = sel_col_start;
|
|
||||||
sel_col_start = tabular->column_of_cell(sel_cell_end);
|
|
||||||
} else {
|
|
||||||
sel_col_end = tabular->right_column_of_cell(sel_cell_end);
|
|
||||||
}
|
|
||||||
|
|
||||||
sel_row_start = tabular->row_of_cell(sel_cell_start);
|
|
||||||
sel_row_end = tabular->row_of_cell(sel_cell_end);
|
|
||||||
if (sel_row_start > sel_row_end) {
|
|
||||||
//int tmp = sel_row_start;
|
|
||||||
//sel_row_start = sel_row_end;
|
|
||||||
//sel_row_end = tmp;
|
|
||||||
swap(sel_row_start, sel_row_end);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
sel_col_start = sel_col_end = tabular->column_of_cell(actcell);
|
sel_col_start = sel_col_end = tabular->column_of_cell(actcell);
|
||||||
sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
|
sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
|
||||||
@ -1952,14 +1977,7 @@ LyXFunc::func_status InsetTabular::getStatus(string const & what) const
|
|||||||
bool flag = true;
|
bool flag = true;
|
||||||
|
|
||||||
if (hasSelection()) {
|
if (hasSelection()) {
|
||||||
sel_row_start = tabular->row_of_cell(sel_cell_start);
|
getSelection(sel_row_start, sel_row_end, dummy, dummy);
|
||||||
sel_row_end = tabular->row_of_cell(sel_cell_end);
|
|
||||||
if (sel_row_start > sel_row_end) {
|
|
||||||
//int tmp = sel_row_start;
|
|
||||||
//sel_row_start = sel_row_end;
|
|
||||||
//sel_row_end = tmp;
|
|
||||||
swap(sel_row_start, sel_row_end);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
|
sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
|
||||||
}
|
}
|
||||||
@ -2309,6 +2327,22 @@ bool InsetTabular::doClearArea() const
|
|||||||
{
|
{
|
||||||
return !locked || (need_update & (FULL|INIT));
|
return !locked || (need_update & (FULL|INIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InsetTabular::getSelection(int & srow, int & erow, int & scol, int & ecol) const
|
||||||
|
{
|
||||||
|
srow = tabular->row_of_cell(sel_cell_start);
|
||||||
|
erow = tabular->row_of_cell(sel_cell_end);
|
||||||
|
if (srow > erow)
|
||||||
|
swap(srow, erow);
|
||||||
|
|
||||||
|
scol = tabular->column_of_cell(sel_cell_start);
|
||||||
|
ecol = tabular->column_of_cell(sel_cell_end);
|
||||||
|
if (scol > ecol)
|
||||||
|
swap(scol, ecol);
|
||||||
|
else
|
||||||
|
ecol = tabular->right_column_of_cell(sel_cell_end);
|
||||||
|
}
|
||||||
|
|
||||||
/* Emacs:
|
/* Emacs:
|
||||||
* Local variables:
|
* Local variables:
|
||||||
* tab-width: 4
|
* tab-width: 4
|
||||||
|
@ -160,7 +160,8 @@ public:
|
|||||||
///
|
///
|
||||||
int GetActCell() const { return actcell; }
|
int GetActCell() const { return actcell; }
|
||||||
///
|
///
|
||||||
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
|
void SetFont(BufferView *, LyXFont const &, bool toggleall = false,
|
||||||
|
bool selectall = false);
|
||||||
///
|
///
|
||||||
int getMaxWidth(BufferView *, UpdatableInset const *) const;
|
int getMaxWidth(BufferView *, UpdatableInset const *) const;
|
||||||
///
|
///
|
||||||
@ -265,6 +266,8 @@ private:
|
|||||||
bool cutSelection();
|
bool cutSelection();
|
||||||
///
|
///
|
||||||
bool isRightToLeft(BufferView *);
|
bool isRightToLeft(BufferView *);
|
||||||
|
///
|
||||||
|
void getSelection(int & scol, int & ecol, int & srow, int & erow) const;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private structures and variables
|
// Private structures and variables
|
||||||
|
@ -92,7 +92,7 @@ void InsetText::init(InsetText const * ins)
|
|||||||
insetDescent = 0;
|
insetDescent = 0;
|
||||||
insetWidth = 0;
|
insetWidth = 0;
|
||||||
the_locking_inset = 0;
|
the_locking_inset = 0;
|
||||||
interline_space = 1;
|
old_max_width = 0;
|
||||||
no_selection = false;
|
no_selection = false;
|
||||||
need_update = INIT;
|
need_update = INIT;
|
||||||
drawTextXOffset = 0;
|
drawTextXOffset = 0;
|
||||||
@ -259,6 +259,8 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
x += width(bv, f);
|
x += width(bv, f);
|
||||||
if (!cleared && (need_update & CLEAR_FRAME))
|
if (!cleared && (need_update & CLEAR_FRAME))
|
||||||
clearFrame(pain, cleared);
|
clearFrame(pain, cleared);
|
||||||
|
else if (cleared)
|
||||||
|
frame_is_visible = false;
|
||||||
need_update = NONE;
|
need_update = NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -270,10 +272,12 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
if (!owner())
|
if (!owner())
|
||||||
x += static_cast<float>(scroll());
|
x += static_cast<float>(scroll());
|
||||||
#endif
|
#endif
|
||||||
|
#if 0
|
||||||
// update insetWidth and insetHeight with dummy calls
|
// update insetWidth and insetHeight with dummy calls
|
||||||
(void)ascent(bv, f);
|
(void)ascent(bv, f);
|
||||||
(void)descent(bv, f);
|
(void)descent(bv, f);
|
||||||
(void)width(bv, f);
|
(void)width(bv, f);
|
||||||
|
#endif
|
||||||
|
|
||||||
// if top_x differs we have a rule down and we don't have to clear anything
|
// if top_x differs we have a rule down and we don't have to clear anything
|
||||||
if (!cleared && (top_x == int(x)) &&
|
if (!cleared && (top_x == int(x)) &&
|
||||||
@ -296,14 +300,25 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
cleared = true;
|
cleared = true;
|
||||||
need_update = FULL;
|
need_update = FULL;
|
||||||
}
|
}
|
||||||
|
if (cleared)
|
||||||
|
frame_is_visible = false;
|
||||||
|
|
||||||
if (!cleared && (need_update == NONE))
|
if (!cleared && (need_update == NONE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (top_x != int(x)) {
|
if (top_x != int(x)) {
|
||||||
need_update |= INIT;
|
if ((getMaxWidth(bv, this) > 0) && (TEXT(bv)->width != old_max_width)){
|
||||||
|
resizeLyXText(bv);
|
||||||
|
need_update |= FULL;
|
||||||
|
old_max_width = TEXT(bv)->width;
|
||||||
|
bv->text->status = LyXText::CHANGED_IN_DRAW;
|
||||||
|
}
|
||||||
top_x = int(x);
|
top_x = int(x);
|
||||||
bv->text->status = LyXText::CHANGED_IN_DRAW;
|
#if 1
|
||||||
|
cleared = true;
|
||||||
|
#else
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// lyxerr << "InsetText::draw[" << this << "](" << need_update << ":" << int(x) << ":" << top_x << ")\n";
|
// lyxerr << "InsetText::draw[" << this << "](" << need_update << ":" << int(x) << ":" << top_x << ")\n";
|
||||||
@ -355,10 +370,10 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
y = 0;
|
y = 0;
|
||||||
while ((row != 0) && (yf < ph)) {
|
while ((row != 0) && (yf < ph)) {
|
||||||
TEXT(bv)->GetVisibleRow(bv, y+y_offset, int(x), row,
|
TEXT(bv)->GetVisibleRow(bv, y+y_offset, int(x), row,
|
||||||
y+first, cleared);
|
y+first, cleared);
|
||||||
y += row->height();
|
y += row->height();
|
||||||
yf += row->height();
|
yf += row->height();
|
||||||
row = row->next();
|
row = row->next();
|
||||||
}
|
}
|
||||||
} else if (!locked) {
|
} else if (!locked) {
|
||||||
if (need_update & CURSOR) {
|
if (need_update & CURSOR) {
|
||||||
@ -525,8 +540,10 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
|
|||||||
UpdateLocal(bv, CURSOR, false);
|
UpdateLocal(bv, CURSOR, false);
|
||||||
|
|
||||||
// If the inset is empty set the language of the current font to the
|
// If the inset is empty set the language of the current font to the
|
||||||
// language to the surronding text.
|
// language to the surronding text (if different).
|
||||||
if (par->size() == 0 && !par->next()) {
|
if (par->size() == 0 && !par->next() &&
|
||||||
|
bv->getParentLanguage(this) != TEXT(bv)->current_font.language())
|
||||||
|
{
|
||||||
LyXFont font(LyXFont::ALL_IGNORE);
|
LyXFont font(LyXFont::ALL_IGNORE);
|
||||||
font.setLanguage(bv->getParentLanguage(this));
|
font.setLanguage(bv->getParentLanguage(this));
|
||||||
SetFont(bv, font, false);
|
SetFont(bv, font, false);
|
||||||
@ -543,12 +560,16 @@ void InsetText::InsetUnlock(BufferView * bv)
|
|||||||
HideInsetCursor(bv);
|
HideInsetCursor(bv);
|
||||||
no_selection = false;
|
no_selection = false;
|
||||||
locked = false;
|
locked = false;
|
||||||
UpdateLocal(bv, CLEAR_FRAME|CURSOR, false);
|
int code = CURSOR|CLEAR_FRAME;
|
||||||
if (owner())
|
if (TEXT(bv)->selection) {
|
||||||
|
TEXT(bv)->ClearSelection(bv);
|
||||||
|
code = FULL;
|
||||||
|
} else if (owner())
|
||||||
bv->owner()->setLayout(owner()->getLyXText(bv)
|
bv->owner()->setLayout(owner()->getLyXText(bv)
|
||||||
->cursor.par()->GetLayout());
|
->cursor.par()->GetLayout());
|
||||||
else
|
else
|
||||||
bv->owner()->setLayout(bv->text->cursor.par()->GetLayout());
|
bv->owner()->setLayout(bv->text->cursor.par()->GetLayout());
|
||||||
|
UpdateLocal(bv, code, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1370,16 +1391,24 @@ std::vector<string> const InsetText::getLabelList() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
|
void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall,
|
||||||
|
bool selectall)
|
||||||
{
|
{
|
||||||
if (TEXT(bv)->selection) {
|
if (TEXT(bv)->selection) {
|
||||||
bv->text->SetUndo(bv->buffer(), Undo::EDIT,
|
bv->text->SetUndo(bv->buffer(), Undo::EDIT,
|
||||||
bv->text->cursor.par()->previous(),
|
bv->text->cursor.par()->previous(),
|
||||||
bv->text->cursor.par()->next());
|
bv->text->cursor.par()->next());
|
||||||
}
|
}
|
||||||
|
if (selectall)
|
||||||
|
selectAll(bv);
|
||||||
TEXT(bv)->SetFont(bv, font, toggleall);
|
TEXT(bv)->SetFont(bv, font, toggleall);
|
||||||
|
if (selectall)
|
||||||
|
TEXT(bv)->ClearSelection(bv);
|
||||||
bv->fitCursor(TEXT(bv));
|
bv->fitCursor(TEXT(bv));
|
||||||
UpdateLocal(bv, CURSOR_PAR, true);
|
if (selectall || TEXT(bv)->selection)
|
||||||
|
UpdateLocal(bv, FULL, true);
|
||||||
|
else
|
||||||
|
UpdateLocal(bv, CURSOR_PAR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1612,7 +1641,9 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
|
|||||||
|
|
||||||
void InsetText::resizeLyXText(BufferView * bv) const
|
void InsetText::resizeLyXText(BufferView * bv) const
|
||||||
{
|
{
|
||||||
if (!par->next() && !par->size()) // resize not neccessary!
|
if (!par->next() && !par->size()) // no data, resize not neccessary!
|
||||||
|
return;
|
||||||
|
if (getMaxWidth(bv, this) < 0) // one endless line, no resize necessary
|
||||||
return;
|
return;
|
||||||
if ((cache.find(bv) == cache.end()) || !cache[bv])
|
if ((cache.find(bv) == cache.end()) || !cache[bv])
|
||||||
return;
|
return;
|
||||||
@ -1716,6 +1747,20 @@ bool InsetText::doClearArea() const
|
|||||||
{
|
{
|
||||||
return !locked || (need_update & (FULL|INIT));
|
return !locked || (need_update & (FULL|INIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InsetText::selectAll(BufferView * bv)
|
||||||
|
{
|
||||||
|
TEXT(bv)->CursorTop(bv);
|
||||||
|
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||||
|
TEXT(bv)->CursorBottom(bv);
|
||||||
|
TEXT(bv)->SetSelection(bv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InsetText::clearSelection(BufferView * bv)
|
||||||
|
{
|
||||||
|
TEXT(bv)->ClearSelection(bv);
|
||||||
|
}
|
||||||
|
|
||||||
/* Emacs:
|
/* Emacs:
|
||||||
* Local variables:
|
* Local variables:
|
||||||
* tab-width: 4
|
* tab-width: 4
|
||||||
|
@ -152,7 +152,8 @@ public:
|
|||||||
///
|
///
|
||||||
UpdatableInset * GetFirstLockingInsetOfType(Inset::Code);
|
UpdatableInset * GetFirstLockingInsetOfType(Inset::Code);
|
||||||
///
|
///
|
||||||
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
|
void SetFont(BufferView *, LyXFont const &, bool toggleall = false,
|
||||||
|
bool selectall = false);
|
||||||
///
|
///
|
||||||
int getMaxWidth(BufferView *, UpdatableInset const *) const;
|
int getMaxWidth(BufferView *, UpdatableInset const *) const;
|
||||||
///
|
///
|
||||||
@ -189,6 +190,10 @@ public:
|
|||||||
void scroll(BufferView *bv, int offset) const {
|
void scroll(BufferView *bv, int offset) const {
|
||||||
UpdatableInset::scroll(bv, offset);
|
UpdatableInset::scroll(bv, offset);
|
||||||
}
|
}
|
||||||
|
///
|
||||||
|
void selectAll(BufferView *bv);
|
||||||
|
///
|
||||||
|
void clearSelection(BufferView *bv);
|
||||||
|
|
||||||
LyXParagraph * par;
|
LyXParagraph * par;
|
||||||
///
|
///
|
||||||
@ -297,7 +302,7 @@ private:
|
|||||||
///
|
///
|
||||||
mutable int inset_y;
|
mutable int inset_y;
|
||||||
///
|
///
|
||||||
int interline_space;
|
mutable int old_max_width;
|
||||||
///
|
///
|
||||||
bool no_selection;
|
bool no_selection;
|
||||||
///
|
///
|
||||||
|
@ -336,7 +336,7 @@ public:
|
|||||||
int baseline, float & x, bool cleared) const;
|
int baseline, float & x, bool cleared) const;
|
||||||
///
|
///
|
||||||
virtual void SetFont(BufferView *, LyXFont const &,
|
virtual void SetFont(BufferView *, LyXFont const &,
|
||||||
bool toggleall = false);
|
bool toggleall = false, bool selectall = false);
|
||||||
///
|
///
|
||||||
virtual bool InsertInset(BufferView *, Inset *) { return false; }
|
virtual bool InsertInset(BufferView *, Inset *) { return false; }
|
||||||
///
|
///
|
||||||
|
@ -82,8 +82,10 @@ public:
|
|||||||
LyXParagraph::size_type pos) const;
|
LyXParagraph::size_type pos) const;
|
||||||
///
|
///
|
||||||
void SetCharFont(Buffer const *, LyXParagraph * par,
|
void SetCharFont(Buffer const *, LyXParagraph * par,
|
||||||
LyXParagraph::size_type pos,
|
LyXParagraph::size_type pos, LyXFont const & font);
|
||||||
LyXFont const & font);
|
void SetCharFont(BufferView *, LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos,
|
||||||
|
LyXFont const & font, bool toggleall);
|
||||||
/// returns a pointer to the very first LyXParagraph
|
/// returns a pointer to the very first LyXParagraph
|
||||||
LyXParagraph * FirstParagraph() const;
|
LyXParagraph * FirstParagraph() const;
|
||||||
|
|
||||||
@ -218,7 +220,7 @@ public:
|
|||||||
///
|
///
|
||||||
mutable LyXCursor sel_cursor;
|
mutable LyXCursor sel_cursor;
|
||||||
///
|
///
|
||||||
LyXCursor sel_start_cursor;
|
mutable LyXCursor sel_start_cursor;
|
||||||
///
|
///
|
||||||
mutable LyXCursor sel_end_cursor;
|
mutable LyXCursor sel_end_cursor;
|
||||||
/// needed for the toggling
|
/// needed for the toggling
|
||||||
|
@ -1967,8 +1967,13 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
|
|||||||
if (!cellinfo_of_cell(cell)->align_special.empty()) {
|
if (!cellinfo_of_cell(cell)->align_special.empty()) {
|
||||||
os << cellinfo_of_cell(cell)->align_special << "}{";
|
os << cellinfo_of_cell(cell)->align_special << "}{";
|
||||||
} else {
|
} else {
|
||||||
if (LeftLine(cell))
|
if (LeftLine(cell) &&
|
||||||
|
(IsFirstCellInRow(cell) ||
|
||||||
|
(!IsMultiColumn(cell-1) && !LeftLine(cell, true) &&
|
||||||
|
!RightLine(cell-1, true))))
|
||||||
|
{
|
||||||
os << '|';
|
os << '|';
|
||||||
|
}
|
||||||
if (!GetPWidth(cell).empty()) {
|
if (!GetPWidth(cell).empty()) {
|
||||||
switch (GetVAlignment(cell)) {
|
switch (GetVAlignment(cell)) {
|
||||||
case LYX_VALIGN_TOP:
|
case LYX_VALIGN_TOP:
|
||||||
@ -2517,7 +2522,7 @@ InsetText * LyXTabular::GetCellInset(int cell) const
|
|||||||
|
|
||||||
InsetText * LyXTabular::GetCellInset(int row, int column) const
|
InsetText * LyXTabular::GetCellInset(int row, int column) const
|
||||||
{
|
{
|
||||||
return GetCellInset(GetCellNumber(row, column));
|
return & cell_info[row][column].inset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
12
src/text.C
12
src/text.C
@ -157,7 +157,9 @@ int LyXText::SingleWidth(BufferView * bview, LyXParagraph * par,
|
|||||||
} else if (c == LyXParagraph::META_INSET) {
|
} else if (c == LyXParagraph::META_INSET) {
|
||||||
Inset * tmpinset = par->GetInset(pos);
|
Inset * tmpinset = par->GetInset(pos);
|
||||||
if (tmpinset) {
|
if (tmpinset) {
|
||||||
|
#if 0 // seems not to be needed, but ...
|
||||||
tmpinset->update(bview, font);
|
tmpinset->update(bview, font);
|
||||||
|
#endif
|
||||||
return tmpinset->width(bview, font);
|
return tmpinset->width(bview, font);
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
@ -428,9 +430,9 @@ void LyXText::draw(BufferView * bview, Row const * row,
|
|||||||
if (c == LyXParagraph::META_INSET) {
|
if (c == LyXParagraph::META_INSET) {
|
||||||
Inset * tmpinset = row->par()->GetInset(pos);
|
Inset * tmpinset = row->par()->GetInset(pos);
|
||||||
if (tmpinset) {
|
if (tmpinset) {
|
||||||
// tmpinset->update(bview, font, false);
|
tmpinset->update(bview, font, false);
|
||||||
tmpinset->draw(bview, font, offset+row->baseline(), x,
|
tmpinset->draw(bview, font, offset+row->baseline(), x,
|
||||||
cleared);
|
cleared);
|
||||||
#ifdef SEEMS_TO_BE_NOT_NEEDED
|
#ifdef SEEMS_TO_BE_NOT_NEEDED
|
||||||
if (status == CHANGED_IN_DRAW) {
|
if (status == CHANGED_IN_DRAW) {
|
||||||
UpdateInset(bview, tmpinset);
|
UpdateInset(bview, tmpinset);
|
||||||
@ -1217,7 +1219,9 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
|||||||
tmpfont = GetFont(bview->buffer(), row_ptr->par(), pos);
|
tmpfont = GetFont(bview->buffer(), row_ptr->par(), pos);
|
||||||
tmpinset = row_ptr->par()->GetInset(pos);
|
tmpinset = row_ptr->par()->GetInset(pos);
|
||||||
if (tmpinset) {
|
if (tmpinset) {
|
||||||
// tmpinset->update(bview, tmpfont);
|
#if 1 // this is needed for deep update on initialitation
|
||||||
|
tmpinset->update(bview, tmpfont);
|
||||||
|
#endif
|
||||||
asc = tmpinset->ascent(bview, tmpfont);
|
asc = tmpinset->ascent(bview, tmpfont);
|
||||||
desc = tmpinset->descent(bview, tmpfont);
|
desc = tmpinset->descent(bview, tmpfont);
|
||||||
maxwidth += tmpinset->width(bview, tmpfont);
|
maxwidth += tmpinset->width(bview, tmpfont);
|
||||||
@ -2784,7 +2788,7 @@ void LyXText::Backspace(BufferView * bview)
|
|||||||
|
|
||||||
|
|
||||||
void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||||
Row * row_ptr, int y, bool cleared)
|
Row * row_ptr, int y, bool cleared)
|
||||||
{
|
{
|
||||||
// returns a printed row
|
// returns a printed row
|
||||||
Painter & pain = bview->painter();
|
Painter & pain = bview->painter();
|
||||||
|
71
src/text2.C
71
src/text2.C
@ -138,6 +138,7 @@ void LyXText::init(BufferView * bview)
|
|||||||
SetCursorIntern(bview, firstrow->par(), 0);
|
SetCursorIntern(bview, firstrow->par(), 0);
|
||||||
sel_cursor = cursor;
|
sel_cursor = cursor;
|
||||||
#if 0
|
#if 0
|
||||||
|
printf("TP = %x\n",inset_owner->owner());
|
||||||
// Dump all rowinformation:
|
// Dump all rowinformation:
|
||||||
Row * tmprow = firstrow;
|
Row * tmprow = firstrow;
|
||||||
lyxerr << "Width = " << width << endl;
|
lyxerr << "Width = " << width << endl;
|
||||||
@ -247,15 +248,64 @@ LyXFont const LyXText::GetFont(Buffer const * buf, LyXParagraph * par,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LyXText::SetCharFont(BufferView * bv, LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos, LyXFont const & fnt,
|
||||||
|
bool toggleall)
|
||||||
|
{
|
||||||
|
Buffer const * buf = bv->buffer();
|
||||||
|
LyXFont font = GetFont(buf, par, pos);
|
||||||
|
font.update(fnt, buf->params.language, toggleall);
|
||||||
|
// Let the insets convert their font
|
||||||
|
if (par->GetChar(pos) == LyXParagraph::META_INSET) {
|
||||||
|
Inset * inset = par->GetInset(pos);
|
||||||
|
if (inset) {
|
||||||
|
if (inset->Editable()==Inset::HIGHLY_EDITABLE) {
|
||||||
|
UpdatableInset * uinset = static_cast<UpdatableInset *>(inset);
|
||||||
|
uinset->SetFont(bv, fnt, toggleall, true);
|
||||||
|
}
|
||||||
|
font = inset->ConvertFont(font);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LyXLayout const & layout =
|
||||||
|
textclasslist.Style(buf->params.textclass,
|
||||||
|
par->GetLayout());
|
||||||
|
|
||||||
|
// Get concrete layout font to reduce against
|
||||||
|
LyXFont layoutfont;
|
||||||
|
|
||||||
|
if (pos < BeginningOfMainBody(buf, par))
|
||||||
|
layoutfont = layout.labelfont;
|
||||||
|
else
|
||||||
|
layoutfont = layout.font;
|
||||||
|
|
||||||
|
// Realize against environment font information
|
||||||
|
if (par->GetDepth()){
|
||||||
|
LyXParagraph * tp = par;
|
||||||
|
while (!layoutfont.resolved() && tp && tp->GetDepth()) {
|
||||||
|
tp = tp->DepthHook(tp->GetDepth()-1);
|
||||||
|
if (tp)
|
||||||
|
layoutfont.realize(textclasslist.
|
||||||
|
Style(buf->params.textclass,
|
||||||
|
tp->GetLayout()).font);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
|
||||||
|
|
||||||
|
// Now, reduce font against full layout font
|
||||||
|
font.reduce(layoutfont);
|
||||||
|
|
||||||
|
par->SetFont(pos, font);
|
||||||
|
}
|
||||||
|
|
||||||
void LyXText::SetCharFont(Buffer const * buf, LyXParagraph * par,
|
void LyXText::SetCharFont(Buffer const * buf, LyXParagraph * par,
|
||||||
LyXParagraph::size_type pos,
|
LyXParagraph::size_type pos, LyXFont const & fnt)
|
||||||
LyXFont const & fnt)
|
|
||||||
{
|
{
|
||||||
LyXFont font(fnt);
|
LyXFont font(fnt);
|
||||||
// Let the insets convert their font
|
// Let the insets convert their font
|
||||||
if (par->GetChar(pos) == LyXParagraph::META_INSET) {
|
if (par->GetChar(pos) == LyXParagraph::META_INSET) {
|
||||||
if (par->GetInset(pos))
|
font = par->GetInset(pos)->ConvertFont(font);
|
||||||
font = par->GetInset(pos)->ConvertFont(font);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LyXLayout const & layout =
|
LyXLayout const & layout =
|
||||||
@ -676,25 +726,21 @@ void LyXText::SetFont(BufferView * bview, LyXFont const & font, bool toggleall)
|
|||||||
SetUndo(bview->buffer(), Undo::EDIT,
|
SetUndo(bview->buffer(), Undo::EDIT,
|
||||||
sel_start_cursor.par()->previous(),
|
sel_start_cursor.par()->previous(),
|
||||||
sel_end_cursor.par()->next());
|
sel_end_cursor.par()->next());
|
||||||
|
FreezeUndo();
|
||||||
cursor = sel_start_cursor;
|
cursor = sel_start_cursor;
|
||||||
while (cursor.par() != sel_end_cursor.par() ||
|
while (cursor.par() != sel_end_cursor.par() ||
|
||||||
(cursor.pos() < sel_end_cursor.pos())) {
|
(cursor.pos() < sel_end_cursor.pos())) {
|
||||||
if (cursor.pos() < cursor.par()->size()) {
|
if (cursor.pos() < cursor.par()->size()) {
|
||||||
// an open footnote should behave
|
// an open footnote should behave
|
||||||
// like a closed one
|
// like a closed one
|
||||||
LyXFont newfont = GetFont(bview->buffer(),
|
SetCharFont(bview, cursor.par(), cursor.pos(), font, toggleall);
|
||||||
cursor.par(), cursor.pos());
|
|
||||||
newfont.update(font,
|
|
||||||
bview->buffer()->params.language,
|
|
||||||
toggleall);
|
|
||||||
SetCharFont(bview->buffer(),
|
|
||||||
cursor.par(), cursor.pos(), newfont);
|
|
||||||
cursor.pos(cursor.pos() + 1);
|
cursor.pos(cursor.pos() + 1);
|
||||||
} else {
|
} else {
|
||||||
cursor.pos(0);
|
cursor.pos(0);
|
||||||
cursor.par(cursor.par()->next());
|
cursor.par(cursor.par()->next());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
UnFreezeUndo();
|
||||||
|
|
||||||
RedoParagraphs(bview, sel_start_cursor, sel_end_cursor.par()->next());
|
RedoParagraphs(bview, sel_start_cursor, sel_end_cursor.par()->next());
|
||||||
|
|
||||||
@ -971,6 +1017,7 @@ void LyXText::ClearSelection(BufferView * /*bview*/) const
|
|||||||
{
|
{
|
||||||
selection = false;
|
selection = false;
|
||||||
mark_set = false;
|
mark_set = false;
|
||||||
|
sel_end_cursor = sel_start_cursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1012,7 +1059,7 @@ void LyXText::CursorBottom(BufferView * bview) const
|
|||||||
|
|
||||||
|
|
||||||
void LyXText::ToggleFree(BufferView * bview,
|
void LyXText::ToggleFree(BufferView * bview,
|
||||||
LyXFont const & font, bool toggleall)
|
LyXFont const & font, bool toggleall)
|
||||||
{
|
{
|
||||||
// If the mask is completely neutral, tell user
|
// If the mask is completely neutral, tell user
|
||||||
if (font == LyXFont(LyXFont::ALL_IGNORE)) {
|
if (font == LyXFont(LyXFont::ALL_IGNORE)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user