Reindent files with tab-stops (instead of 4 spaces). It is allowed to change

now the indent in files owned by myself to tabstops if I did miss some!
(but please set your tab-width to 4 ;)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1872 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2001-04-02 14:02:58 +00:00
parent 9a75180e35
commit 63d5070bc3
9 changed files with 3985 additions and 4009 deletions

View File

@ -24,9 +24,9 @@ src/frontends/controllers/ControlInclude.C
src/frontends/controllers/ControlPreamble.C src/frontends/controllers/ControlPreamble.C
src/frontends/controllers/ControlPrint.C src/frontends/controllers/ControlPrint.C
src/frontends/controllers/ControlSearch.C src/frontends/controllers/ControlSearch.C
src/frontends/controllers/ControlToc.C
src/frontends/controllers/helper_funcs.C src/frontends/controllers/helper_funcs.C
src/frontends/gnome/FormCitation.C src/frontends/gnome/FormCitation.C
src/frontends/gnome/FormCopyright.C
src/frontends/gnome/FormError.C src/frontends/gnome/FormError.C
src/frontends/gnome/FormIndex.C src/frontends/gnome/FormIndex.C
src/frontends/gnome/FormPrint.C src/frontends/gnome/FormPrint.C

View File

@ -34,199 +34,198 @@ using std::max;
InsetCollapsable::InsetCollapsable() InsetCollapsable::InsetCollapsable()
: UpdatableInset() : UpdatableInset()
{ {
inset.setOwner(this); inset.setOwner(this);
collapsed = false; collapsed = false;
label = "Label"; label = "Label";
autocollapse = true; autocollapse = true;
inset.SetAutoBreakRows(true); inset.SetAutoBreakRows(true);
inset.SetDrawFrame(0, InsetText::ALWAYS); inset.SetDrawFrame(0, InsetText::ALWAYS);
inset.SetFrameColor(0, LColor::footnoteframe); inset.SetFrameColor(0, LColor::footnoteframe);
button_length = button_top_y = button_bottom_y = 0; button_length = button_top_y = button_bottom_y = 0;
setInsetName("Collapsable"); setInsetName("Collapsable");
widthCollapsed = oldWidth = 0; widthCollapsed = oldWidth = 0;
need_update = FULL; need_update = FULL;
} }
Inset * InsetCollapsable::Clone(Buffer const &) const Inset * InsetCollapsable::Clone(Buffer const &) const
{ {
InsetCollapsable * result = new InsetCollapsable(); InsetCollapsable * result = new InsetCollapsable();
result->inset.init(&inset); result->inset.init(&inset);
result->inset.setOwner(result); result->inset.setOwner(result);
result->collapsed = collapsed; result->collapsed = collapsed;
return result; return result;
} }
bool InsetCollapsable::InsertInset(BufferView * bv, Inset * in) bool InsetCollapsable::InsertInset(BufferView * bv, Inset * in)
{ {
if (!InsertInsetAllowed(in)) { if (!InsertInsetAllowed(in)) {
lyxerr << "InsetCollapsable::InsertInset: " lyxerr << "InsetCollapsable::InsertInset: "
"Unable to insert inset." << endl; "Unable to insert inset." << endl;
return false; return false;
} }
return inset.InsertInset(bv, in);
return inset.InsertInset(bv, in);
} }
void InsetCollapsable::Write(Buffer const * buf, ostream & os) const void InsetCollapsable::Write(Buffer const * buf, ostream & os) const
{ {
os << "collapsed " << tostr(collapsed) << "\n"; os << "collapsed " << tostr(collapsed) << "\n";
inset.WriteParagraphData(buf, os); inset.WriteParagraphData(buf, os);
} }
void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex) void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
{ {
if (lex.IsOK()) { if (lex.IsOK()) {
lex.next(); lex.next();
string const token = lex.GetString(); string const token = lex.GetString();
if (token == "collapsed") { if (token == "collapsed") {
lex.next(); lex.next();
collapsed = lex.GetBool(); collapsed = lex.GetBool();
} else { } else {
lyxerr << "InsetCollapsable::Read: Missing collapsed!" lyxerr << "InsetCollapsable::Read: Missing collapsed!"
<< endl; << endl;
}
} }
} inset.Read(buf, lex);
inset.Read(buf, lex);
} }
int InsetCollapsable::ascent_collapsed(Painter & pain, LyXFont const &) const int InsetCollapsable::ascent_collapsed(Painter & pain, LyXFont const &) const
{ {
int width = 0; int width = 0;
int ascent = 0; int ascent = 0;
int descent = 0; int descent = 0;
pain.buttonText(0, 0, label, labelfont, false, pain.buttonText(0, 0, label, labelfont, false,
width, ascent, descent); width, ascent, descent);
return ascent; return ascent;
} }
int InsetCollapsable::descent_collapsed(Painter & pain, LyXFont const &) const int InsetCollapsable::descent_collapsed(Painter & pain, LyXFont const &) const
{ {
int width = 0; int width = 0;
int ascent = 0; int ascent = 0;
int descent = 0; int descent = 0;
pain.buttonText(0, 0, label, labelfont, false, pain.buttonText(0, 0, label, labelfont, false,
width, ascent, descent); width, ascent, descent);
return descent; return descent;
} }
int InsetCollapsable::width_collapsed(Painter & pain, LyXFont const &) const int InsetCollapsable::width_collapsed(Painter & pain, LyXFont const &) const
{ {
int width; int width;
int ascent; int ascent;
int descent; int descent;
pain.buttonText(TEXT_TO_INSET_OFFSET, 0, label, labelfont, false, pain.buttonText(TEXT_TO_INSET_OFFSET, 0, label, labelfont, false,
width, ascent, descent); width, ascent, descent);
return width + (2*TEXT_TO_INSET_OFFSET); return width + (2*TEXT_TO_INSET_OFFSET);
} }
int InsetCollapsable::ascent(BufferView * bv, LyXFont const & font) const int InsetCollapsable::ascent(BufferView * bv, LyXFont const & font) const
{ {
return ascent_collapsed(bv->painter(), font); return ascent_collapsed(bv->painter(), font);
} }
int InsetCollapsable::descent(BufferView * bv, LyXFont const & font) const int InsetCollapsable::descent(BufferView * bv, LyXFont const & font) const
{ {
if (collapsed) if (collapsed)
return descent_collapsed(bv->painter(), font); return descent_collapsed(bv->painter(), font);
return descent_collapsed(bv->painter(), font) + inset.descent(bv, font) + return descent_collapsed(bv->painter(), font) + inset.descent(bv, font) +
inset.ascent(bv, font) + TEXT_TO_BOTTOM_OFFSET; inset.ascent(bv, font) + TEXT_TO_BOTTOM_OFFSET;
} }
int InsetCollapsable::width(BufferView * bv, LyXFont const & font) const int InsetCollapsable::width(BufferView * bv, LyXFont const & font) const
{ {
if (collapsed) if (collapsed)
return widthCollapsed; return widthCollapsed;
return (inset.width(bv, font) > widthCollapsed) ? return (inset.width(bv, font) > widthCollapsed) ?
inset.width(bv, font) : widthCollapsed; inset.width(bv, font) : widthCollapsed;
} }
void InsetCollapsable::draw_collapsed(Painter & pain, LyXFont const &, void InsetCollapsable::draw_collapsed(Painter & pain, LyXFont const &,
int baseline, float & x) const int baseline, float & x) const
{ {
int width = 0; int width = 0;
pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET, pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
baseline, label, labelfont, true, width); baseline, label, labelfont, true, width);
x += width + TEXT_TO_INSET_OFFSET; x += width + TEXT_TO_INSET_OFFSET;
} }
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f, void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const int baseline, float & x, bool cleared) const
{ {
Painter & pain = bv->painter(); Painter & pain = bv->painter();
button_length = widthCollapsed; button_length = widthCollapsed;
button_top_y = -ascent(bv, f); button_top_y = -ascent(bv, f);
button_bottom_y = -ascent(bv, f) + ascent_collapsed(pain,f) + button_bottom_y = -ascent(bv, f) + ascent_collapsed(pain,f) +
descent_collapsed(pain, f); descent_collapsed(pain, f);
if (collapsed) { if (collapsed) {
draw_collapsed(pain, f, baseline, x); draw_collapsed(pain, f, baseline, x);
x += TEXT_TO_INSET_OFFSET; x += TEXT_TO_INSET_OFFSET;
return; return;
} }
if (!cleared && ((inset.need_update == InsetText::FULL) || if (!cleared && ((inset.need_update == InsetText::FULL) ||
(inset.need_update == InsetText::INIT) || (inset.need_update == InsetText::INIT) ||
(top_x != int(x)) || (top_baseline != baseline))) { (top_x != int(x)) || (top_baseline != baseline))) {
int w = owner() ? width(bv, f) : pain.paperWidth(); int w = owner() ? width(bv, f) : pain.paperWidth();
int h = ascent(bv, f) + descent(bv, f); int h = ascent(bv, f) + descent(bv, f);
int tx = (needFullRow() && !owner()) ? 0 : int(x); int tx = (needFullRow() && !owner()) ? 0 : int(x);
int ty = max(0, baseline - ascent(bv, f)); int ty = max(0, baseline - ascent(bv, f));
if ((ty + h) > pain.paperHeight()) if ((ty + h) > pain.paperHeight())
h = pain.paperHeight(); h = pain.paperHeight();
if ((top_x + w) > pain.paperWidth()) if ((top_x + w) > pain.paperWidth())
w = pain.paperWidth(); w = pain.paperWidth();
if (baseline < 0) if (baseline < 0)
h += (baseline - ascent(bv, f)); h += (baseline - ascent(bv, f));
pain.fillRectangle(tx, ty - 1, w, h + 2); pain.fillRectangle(tx, ty - 1, w, h + 2);
cleared = true; cleared = true;
} }
top_x = int(x); top_x = int(x);
top_baseline = baseline; top_baseline = baseline;
float dummy = x; float dummy = x;
int bl = baseline - ascent(bv, f) + ascent_collapsed(pain, f); int bl = baseline - ascent(bv, f) + ascent_collapsed(pain, f);
draw_collapsed(pain, f, bl, dummy); draw_collapsed(pain, f, bl, dummy);
inset.draw(bv, f, inset.draw(bv, f,
bl + descent_collapsed(pain, f) + inset.ascent(bv, f), bl + descent_collapsed(pain, f) + inset.ascent(bv, f),
x, cleared); x, cleared);
need_update = NONE; need_update = NONE;
} }
void InsetCollapsable::Edit(BufferView * bv, int xp, int yp, unsigned int button) void InsetCollapsable::Edit(BufferView * bv, int xp, int yp, unsigned int button)
{ {
UpdatableInset::Edit(bv, xp, yp, button); UpdatableInset::Edit(bv, xp, yp, button);
if (collapsed && autocollapse) { if (collapsed && autocollapse) {
collapsed = false; collapsed = false;
if (!bv->lockInset(this)) if (!bv->lockInset(this))
return; return;
bv->updateInset(this, false); bv->updateInset(this, false);
inset.Edit(bv, 0, 0, button); inset.Edit(bv, 0, 0, button);
} else if (!collapsed) { } else if (!collapsed) {
if (!bv->lockInset(this)) if (!bv->lockInset(this))
return; return;
inset.Edit(bv, xp, yp+(top_baseline - inset.y()), button); inset.Edit(bv, xp, yp+(top_baseline - inset.y()), button);
} }
} }
@ -240,107 +239,107 @@ Inset::EDITABLE InsetCollapsable::Editable() const
void InsetCollapsable::InsetUnlock(BufferView * bv) void InsetCollapsable::InsetUnlock(BufferView * bv)
{ {
if (autocollapse) { if (autocollapse) {
collapsed = true; collapsed = true;
} }
inset.InsetUnlock(bv); inset.InsetUnlock(bv);
bv->updateInset(this, false); bv->updateInset(this, false);
} }
void InsetCollapsable::InsetButtonPress(BufferView * bv,int x,int y,int button) void InsetCollapsable::InsetButtonPress(BufferView * bv,int x,int y,int button)
{ {
if (!collapsed && (y > button_bottom_y)) { if (!collapsed && (y > button_bottom_y)) {
inset.InsetButtonPress(bv, x, y+(top_baseline - inset.y()), button); inset.InsetButtonPress(bv, x, y+(top_baseline - inset.y()), button);
} }
} }
void InsetCollapsable::InsetButtonRelease(BufferView * bv, void InsetCollapsable::InsetButtonRelease(BufferView * bv,
int x, int y, int button) int x, int y, int button)
{ {
if ((x >= 0) && (x < button_length) && if ((x >= 0) && (x < button_length) &&
(y >= button_top_y) && (y <= button_bottom_y)) { (y >= button_top_y) && (y <= button_bottom_y)) {
if (collapsed) { if (collapsed) {
collapsed = false; collapsed = false;
inset.InsetButtonRelease(bv, 0, 0, button); inset.InsetButtonRelease(bv, 0, 0, button);
bv->updateInset(this, false); bv->updateInset(this, false);
} else { } else {
collapsed = true; collapsed = true;
bv->unlockInset(this); bv->unlockInset(this);
bv->updateInset(this, false); bv->updateInset(this, false);
}
} else if (!collapsed && (y > button_top_y)) {
inset.InsetButtonRelease(bv, x, y+(top_baseline-inset.y()), button);
} }
} else if (!collapsed && (y > button_top_y)) {
inset.InsetButtonRelease(bv, x, y+(top_baseline-inset.y()), button);
}
} }
void InsetCollapsable::InsetMotionNotify(BufferView * bv, void InsetCollapsable::InsetMotionNotify(BufferView * bv,
int x, int y, int state) int x, int y, int state)
{ {
if (x > button_bottom_y) { if (x > button_bottom_y) {
inset.InsetMotionNotify(bv, x, y+(top_baseline - inset.y()), state); inset.InsetMotionNotify(bv, x, y+(top_baseline - inset.y()), state);
} }
} }
void InsetCollapsable::InsetKeyPress(XKeyEvent * xke) void InsetCollapsable::InsetKeyPress(XKeyEvent * xke)
{ {
inset.InsetKeyPress(xke); inset.InsetKeyPress(xke);
} }
int InsetCollapsable::Latex(Buffer const * buf, ostream & os, int InsetCollapsable::Latex(Buffer const * buf, ostream & os,
bool fragile, bool free_spc) const bool fragile, bool free_spc) const
{ {
return inset.Latex(buf, os, fragile, free_spc); return inset.Latex(buf, os, fragile, free_spc);
} }
int InsetCollapsable::getMaxWidth(BufferView * bv, int InsetCollapsable::getMaxWidth(BufferView * bv,
UpdatableInset const * inset) const UpdatableInset const * inset) const
{ {
int const w = UpdatableInset::getMaxWidth(bv, inset); int const w = UpdatableInset::getMaxWidth(bv, inset);
if (w < 0) { if (w < 0) {
// What does a negative max width signify? (Lgb) // What does a negative max width signify? (Lgb)
// Use the max width of the draw-area (Jug) // Use the max width of the draw-area (Jug)
return w; return w;
} }
// should be at least 30 pixels !!! // should be at least 30 pixels !!!
return max(30, w - widthCollapsed); return max(30, w - widthCollapsed);
} }
void InsetCollapsable::update(BufferView * bv, LyXFont const & font, void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
bool reinit) bool reinit)
{ {
if (reinit) { if (reinit) {
need_update = FULL; need_update = FULL;
if (owner()) if (owner())
owner()->update(bv, font, true); owner()->update(bv, font, true);
return;
}
if (!widthCollapsed) {
widthCollapsed = width_collapsed(bv->painter(), font);
inset.resizeLyXText(bv);
need_update = FULL;
if (owner()) {
owner()->update(bv, font);
return; return;
} }
} if (!widthCollapsed) {
if (oldWidth != width(bv, font)) { widthCollapsed = width_collapsed(bv->painter(), font);
oldWidth = width(bv, font); inset.resizeLyXText(bv);
inset.resizeLyXText(bv); need_update = FULL;
need_update = FULL; if (owner()) {
if (owner()) { owner()->update(bv, font);
owner()->update(bv, font); return;
return; }
} }
} if (oldWidth != width(bv, font)) {
inset.update(bv, font); oldWidth = width(bv, font);
inset.resizeLyXText(bv);
need_update = FULL;
if (owner()) {
owner()->update(bv, font);
return;
}
}
inset.update(bv, font);
} }
@ -348,110 +347,110 @@ UpdatableInset::RESULT
InsetCollapsable::LocalDispatch(BufferView * bv, kb_action action, InsetCollapsable::LocalDispatch(BufferView * bv, kb_action action,
string const & arg) string const & arg)
{ {
UpdatableInset::RESULT result = inset.LocalDispatch(bv, action, arg); UpdatableInset::RESULT result = inset.LocalDispatch(bv, action, arg);
if (result == FINISHED) if (result == FINISHED)
bv->unlockInset(this); bv->unlockInset(this);
return result; return result;
} }
bool InsetCollapsable::LockInsetInInset(BufferView * bv, UpdatableInset * in) bool InsetCollapsable::LockInsetInInset(BufferView * bv, UpdatableInset * in)
{ {
if (&inset == in) if (&inset == in)
return true; return true;
return inset.LockInsetInInset(bv, in); return inset.LockInsetInInset(bv, in);
} }
bool InsetCollapsable::UnlockInsetInInset(BufferView * bv, UpdatableInset * in, bool InsetCollapsable::UnlockInsetInInset(BufferView * bv, UpdatableInset * in,
bool lr) bool lr)
{ {
if (&inset == in) { if (&inset == in) {
bv->unlockInset(this); bv->unlockInset(this);
return true; return true;
} }
return inset.UnlockInsetInInset(bv, in, lr); return inset.UnlockInsetInInset(bv, in, lr);
} }
bool InsetCollapsable::UpdateInsetInInset(BufferView * bv, Inset *in) bool InsetCollapsable::UpdateInsetInInset(BufferView * bv, Inset *in)
{ {
if (&inset == in) if (&inset == in)
return true; return true;
return inset.UpdateInsetInInset(bv, in); return inset.UpdateInsetInInset(bv, in);
} }
unsigned int InsetCollapsable::InsetInInsetY() unsigned int InsetCollapsable::InsetInInsetY()
{ {
return inset.InsetInInsetY() - (top_baseline - inset.y()); return inset.InsetInInsetY() - (top_baseline - inset.y());
} }
void InsetCollapsable::Validate(LaTeXFeatures & features) const void InsetCollapsable::Validate(LaTeXFeatures & features) const
{ {
inset.Validate(features); inset.Validate(features);
} }
void InsetCollapsable::GetCursorPos(BufferView * bv, int & x, int & y) const void InsetCollapsable::GetCursorPos(BufferView * bv, int & x, int & y) const
{ {
inset.GetCursorPos(bv, x , y); inset.GetCursorPos(bv, x , y);
} }
void InsetCollapsable::ToggleInsetCursor(BufferView * bv) void InsetCollapsable::ToggleInsetCursor(BufferView * bv)
{ {
inset.ToggleInsetCursor(bv); inset.ToggleInsetCursor(bv);
} }
UpdatableInset * InsetCollapsable::GetLockingInset() UpdatableInset * InsetCollapsable::GetLockingInset()
{ {
UpdatableInset * in = inset.GetLockingInset(); UpdatableInset * in = inset.GetLockingInset();
if (&inset == in) if (&inset == in)
return this; return this;
return in; return in;
} }
UpdatableInset * InsetCollapsable::GetFirstLockingInsetOfType(Inset::Code c) UpdatableInset * InsetCollapsable::GetFirstLockingInsetOfType(Inset::Code c)
{ {
if (c == LyxCode()) if (c == LyxCode())
return this; return this;
return inset.GetFirstLockingInsetOfType(c); return inset.GetFirstLockingInsetOfType(c);
} }
void InsetCollapsable::SetFont(BufferView * bv, void InsetCollapsable::SetFont(BufferView * bv,
LyXFont const & font, bool toggleall) LyXFont const & font, bool toggleall)
{ {
inset.SetFont(bv, font, toggleall); inset.SetFont(bv, font, toggleall);
} }
bool InsetCollapsable::doClearArea() const bool InsetCollapsable::doClearArea() const
{ {
return inset.doClearArea(); return inset.doClearArea();
} }
LyXText * InsetCollapsable::getLyXText(BufferView const * bv, LyXText * InsetCollapsable::getLyXText(BufferView const * bv,
bool const recursive) const bool const recursive) const
{ {
return inset.getLyXText(bv, recursive); return inset.getLyXText(bv, recursive);
} }
void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const
{ {
inset.deleteLyXText(bv, recursive); inset.deleteLyXText(bv, recursive);
} }
void InsetCollapsable::resizeLyXText(BufferView * bv) const void InsetCollapsable::resizeLyXText(BufferView * bv) const
{ {
inset.resizeLyXText(bv); inset.resizeLyXText(bv);
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
oldWidth = width(bv, font); oldWidth = width(bv, font);
} }

View File

@ -33,146 +33,146 @@ class LyXText;
*/ */
class InsetCollapsable : public UpdatableInset { class InsetCollapsable : public UpdatableInset {
public: public:
/// ///
enum UpdateCodes { enum UpdateCodes {
NONE = 0, NONE = 0,
FULL FULL
}; };
/// ///
static int const TEXT_TO_TOP_OFFSET = 2; static int const TEXT_TO_TOP_OFFSET = 2;
/// ///
static int const TEXT_TO_BOTTOM_OFFSET = 2; static int const TEXT_TO_BOTTOM_OFFSET = 2;
/// ///
InsetCollapsable(); InsetCollapsable();
/// ///
Inset * Clone(Buffer const &) const; Inset * Clone(Buffer const &) const;
/// ///
void Read(Buffer const *, LyXLex &); void Read(Buffer const *, LyXLex &);
/// ///
void Write(Buffer const *, std::ostream &) const; void Write(Buffer const *, std::ostream &) const;
/// ///
int ascent(BufferView *, LyXFont const &) const; int ascent(BufferView *, LyXFont const &) const;
/// ///
int descent(BufferView *, LyXFont const &) const; int descent(BufferView *, LyXFont const &) const;
/// ///
int width(BufferView *, LyXFont const & f) const; int width(BufferView *, LyXFont const & f) const;
/// ///
void draw(BufferView *, const LyXFont &, int , float &, bool) const; void draw(BufferView *, const LyXFont &, int , float &, bool) const;
/// ///
void update(BufferView *, LyXFont const &, bool =false); void update(BufferView *, LyXFont const &, bool =false);
/// ///
void Edit(BufferView *, int, int, unsigned int); void Edit(BufferView *, int, int, unsigned int);
/// ///
EDITABLE Editable() const; EDITABLE Editable() const;
/// ///
bool InsertInset(BufferView *, Inset * inset); bool InsertInset(BufferView *, Inset * inset);
/// ///
bool IsTextInset() const { return true; } bool IsTextInset() const { return true; }
/// ///
bool doClearArea() const; bool doClearArea() const;
/// ///
void InsetUnlock(BufferView *); void InsetUnlock(BufferView *);
/// ///
bool needFullRow() const { return !collapsed; } bool needFullRow() const { return !collapsed; }
/// ///
bool LockInsetInInset(BufferView *, UpdatableInset *); bool LockInsetInInset(BufferView *, UpdatableInset *);
/// ///
bool UnlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false); bool UnlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false);
/// ///
bool UpdateInsetInInset(BufferView *, Inset *); bool UpdateInsetInInset(BufferView *, Inset *);
/// ///
unsigned int InsetInInsetY(); unsigned int InsetInInsetY();
/// ///
void InsetButtonRelease(BufferView *, int, int, int); void InsetButtonRelease(BufferView *, int, int, int);
/// ///
void InsetButtonPress(BufferView *, int, int, int); void InsetButtonPress(BufferView *, int, int, int);
/// ///
void InsetMotionNotify(BufferView *, int, int, int); void InsetMotionNotify(BufferView *, int, int, int);
/// ///
void InsetKeyPress(XKeyEvent *); void InsetKeyPress(XKeyEvent *);
/// ///
UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action, UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action,
string const &); string const &);
/// ///
int Latex(Buffer const *, std::ostream &, int Latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const; bool fragile, bool free_spc) const;
/// ///
int Ascii(Buffer const *, std::ostream &, int) const { return 0; } int Ascii(Buffer const *, std::ostream &, int) const { return 0; }
/// ///
int Linuxdoc(Buffer const *, std::ostream &) const { return 0; } int Linuxdoc(Buffer const *, std::ostream &) const { return 0; }
/// ///
int DocBook(Buffer const *, std::ostream &) const { return 0; } int DocBook(Buffer const *, std::ostream &) const { return 0; }
/// ///
void Validate(LaTeXFeatures & features) const; void Validate(LaTeXFeatures & features) const;
/// ///
void GetCursorPos(BufferView *, int & x, int & y) const; void GetCursorPos(BufferView *, int & x, int & y) const;
/// ///
void ToggleInsetCursor(BufferView *); void ToggleInsetCursor(BufferView *);
/// ///
UpdatableInset * GetLockingInset(); UpdatableInset * GetLockingInset();
/// ///
UpdatableInset * GetFirstLockingInsetOfType(Inset::Code); UpdatableInset * GetFirstLockingInsetOfType(Inset::Code);
/// ///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false); void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
/// ///
void setLabel(string const & l) { label = l; } void setLabel(string const & l) { label = l; }
/// ///
void setLabelFont(LyXFont & f) { labelfont = f; } void setLabelFont(LyXFont & f) { labelfont = f; }
/// ///
void setAutoCollapse(bool f) { autocollapse = f; } void setAutoCollapse(bool f) { autocollapse = f; }
/// ///
int getMaxWidth(BufferView *, UpdatableInset const *) const; int getMaxWidth(BufferView *, UpdatableInset const *) const;
/// ///
LyXText * getLyXText(BufferView const *, bool const recursive) const; LyXText * getLyXText(BufferView const *, bool const recursive) const;
/// ///
void deleteLyXText(BufferView *, bool recursive=true) const; void deleteLyXText(BufferView *, bool recursive=true) const;
/// ///
void resizeLyXText(BufferView *) const; void resizeLyXText(BufferView *) const;
protected: protected:
/// ///
int ascent_collapsed(Painter &, LyXFont const &) const; int ascent_collapsed(Painter &, LyXFont const &) const;
/// ///
int descent_collapsed(Painter &, LyXFont const &) const; int descent_collapsed(Painter &, LyXFont const &) const;
/// ///
int width_collapsed(Painter &, LyXFont const & f) const; int width_collapsed(Painter &, LyXFont const & f) const;
/// ///
void draw_collapsed(Painter & pain, const LyXFont &, int , float &) const; void draw_collapsed(Painter & pain, const LyXFont &, int , float &) const;
/// ///
int getMaxTextWidth(Painter & pain, UpdatableInset const *) const; int getMaxTextWidth(Painter & pain, UpdatableInset const *) const;
/// ///
bool collapsed; bool collapsed;
/// ///
LColor::color framecolor; LColor::color framecolor;
/// ///
LyXFont labelfont; LyXFont labelfont;
#ifdef NEW_INSETS #ifdef NEW_INSETS
public: public:
#endif #endif
/// ///
InsetText inset; InsetText inset;
protected: protected:
/// ///
mutable int button_length; mutable int button_length;
/// ///
mutable int button_top_y; mutable int button_top_y;
/// ///
mutable int button_bottom_y; mutable int button_bottom_y;
private: private:
/// ///
string label; string label;
/// ///
bool autocollapse; bool autocollapse;
/// ///
int widthCollapsed; int widthCollapsed;
/// ///
mutable int oldWidth; mutable int oldWidth;
/// ///
mutable int topx; mutable int topx;
mutable int topbaseline; mutable int topbaseline;
mutable UpdateCodes need_update; mutable UpdateCodes need_update;
}; };
#endif #endif

View File

@ -25,52 +25,52 @@ using std::ostream;
InsetERT::InsetERT() : InsetCollapsable() InsetERT::InsetERT() : InsetCollapsable()
{ {
setLabel(_("ERT")); setLabel(_("ERT"));
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON); font.setLatex (LyXFont::ON);
labelfont = LyXFont(LyXFont::ALL_SANE); labelfont = LyXFont(LyXFont::ALL_SANE);
labelfont.decSize(); labelfont.decSize();
labelfont.decSize(); labelfont.decSize();
labelfont.setColor(LColor::ert); labelfont.setColor(LColor::ert);
setAutoCollapse(false); setAutoCollapse(false);
setInsetName("ERT"); setInsetName("ERT");
} }
void InsetERT::Write(Buffer const * buf, ostream & os) const void InsetERT::Write(Buffer const * buf, ostream & os) const
{ {
os << getInsetName() << "\n"; os << getInsetName() << "\n";
InsetCollapsable::Write(buf, os); InsetCollapsable::Write(buf, os);
} }
Inset * InsetERT::Clone(Buffer const &) const Inset * InsetERT::Clone(Buffer const &) const
{ {
InsetERT * result = new InsetERT; InsetERT * result = new InsetERT;
result->inset.init(&inset); result->inset.init(&inset);
result->collapsed = collapsed; result->collapsed = collapsed;
return result; return result;
} }
string const InsetERT::EditMessage() const string const InsetERT::EditMessage() const
{ {
return _("Opened ERT Inset"); return _("Opened ERT Inset");
} }
void InsetERT::SetFont(BufferView *, LyXFont const &, bool) void InsetERT::SetFont(BufferView *, LyXFont const &, bool)
{ {
WriteAlert(_("Impossible Operation!"), WriteAlert(_("Impossible Operation!"),
_("Not permitted to change font-types inside ERT-insets!"), _("Not permitted to change font-types inside ERT-insets!"),
_("Sorry.")); _("Sorry."));
} }
void InsetERT::Edit(BufferView * bv, int x, int y, unsigned int button) void InsetERT::Edit(BufferView * bv, int x, int y, unsigned int button)
{ {
InsetCollapsable::Edit(bv, x, y, button); InsetCollapsable::Edit(bv, x, y, button);
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON); font.setLatex (LyXFont::ON);
} }

View File

@ -29,44 +29,44 @@ using std::ostream;
InsetFoot::InsetFoot() InsetFoot::InsetFoot()
: InsetFootlike() : InsetFootlike()
{ {
setLabel(_("foot")); setLabel(_("foot"));
setInsetName("Foot"); setInsetName("Foot");
} }
Inset * InsetFoot::Clone(Buffer const &) const Inset * InsetFoot::Clone(Buffer const &) const
{ {
InsetFoot * result = new InsetFoot; InsetFoot * result = new InsetFoot;
result->inset.init(&inset); result->inset.init(&inset);
result->collapsed = collapsed; result->collapsed = collapsed;
return result; return result;
} }
string const InsetFoot::EditMessage() const string const InsetFoot::EditMessage() const
{ {
return _("Opened Footnote Inset"); return _("Opened Footnote Inset");
} }
int InsetFoot::Latex(Buffer const * buf, int InsetFoot::Latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const ostream & os, bool fragile, bool fp) const
{ {
os << "\\footnote{%\n"; os << "\\footnote{%\n";
int const i = inset.Latex(buf, os, fragile, fp); int const i = inset.Latex(buf, os, fragile, fp);
os << "}%\n"; os << "}%\n";
return i + 2; return i + 2;
} }
bool InsetFoot::InsertInsetAllowed(Inset * in) const bool InsetFoot::InsertInsetAllowed(Inset * in) const
{ {
if ((in->LyxCode() == Inset::FOOT_CODE) || if ((in->LyxCode() == Inset::FOOT_CODE) ||
(in->LyxCode() == Inset::MARGIN_CODE)) { (in->LyxCode() == Inset::MARGIN_CODE)) {
return false; return false;
} }
return true; return true;
} }

File diff suppressed because it is too large Load Diff

View File

@ -39,260 +39,260 @@ class LyXScreen;
*/ */
class InsetText : public UpdatableInset { class InsetText : public UpdatableInset {
public: public:
///
/// numbers need because of test if codeA < codeB
///
enum UpdateCodes {
/// ///
NONE = 0, /// numbers need because of test if codeA < codeB
/// ///
CURSOR = 1, enum UpdateCodes {
///
NONE = 0,
///
CURSOR = 1,
///
CLEAR_FRAME = 2,
///
DRAW_FRAME = 4,
///
SELECTION = 8,
///
CURSOR_PAR = 16,
///
FULL = 32,
///
INIT = 64
};
/// ///
CLEAR_FRAME = 2, enum DrawFrame {
///
NEVER = 0,
///
LOCKED,
///
ALWAYS
};
/// ///
DRAW_FRAME = 4, InsetText();
/// ///
SELECTION = 8, explicit
InsetText(InsetText const &);
/// ///
CURSOR_PAR = 16, ~InsetText();
/// ///
FULL = 32, Inset * Clone(Buffer const &) const;
/// ///
INIT = 64 InsetText & operator=(InsetText const & it);
};
///
enum DrawFrame {
/// ///
NEVER = 0, void clear();
/// ///
LOCKED, void Read(Buffer const *, LyXLex &);
/// ///
ALWAYS void Write(Buffer const *, std::ostream &) const;
}; ///
/// int ascent(BufferView *, LyXFont const &) const;
InsetText(); ///
/// int descent(BufferView *, LyXFont const &) const;
explicit ///
InsetText(InsetText const &); int width(BufferView *, LyXFont const & f) const;
/// ///
~InsetText(); int textWidth(BufferView *) const;
/// ///
Inset * Clone(Buffer const &) const; void draw(BufferView *, LyXFont const &, int , float &, bool) const;
/// ///
InsetText & operator=(InsetText const & it); void update(BufferView *, LyXFont const &, bool =false);
/// ///
void clear(); void SetUpdateStatus(BufferView *, int what);
/// ///
void Read(Buffer const *, LyXLex &); string const EditMessage() const;
/// ///
void Write(Buffer const *, std::ostream &) const; void Edit(BufferView *, int, int, unsigned int);
/// ///
int ascent(BufferView *, LyXFont const &) const; bool IsTextInset() const { return true; }
/// ///
int descent(BufferView *, LyXFont const &) const; bool doClearArea() const { return !locked; }
/// ///
int width(BufferView *, LyXFont const & f) const; void InsetUnlock(BufferView *);
/// ///
int textWidth(BufferView *) const; bool LockInsetInInset(BufferView *, UpdatableInset *);
/// ///
void draw(BufferView *, LyXFont const &, int , float &, bool) const; bool UnlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false);
/// ///
void update(BufferView *, LyXFont const &, bool =false); bool UpdateInsetInInset(BufferView *, Inset *);
/// ///
void SetUpdateStatus(BufferView *, int what); void InsetButtonRelease(BufferView *, int, int, int);
/// ///
string const EditMessage() const; void InsetButtonPress(BufferView *, int, int, int);
/// ///
void Edit(BufferView *, int, int, unsigned int); void InsetMotionNotify(BufferView *, int, int, int);
/// ///
bool IsTextInset() const { return true; } void InsetKeyPress(XKeyEvent *);
/// ///
bool doClearArea() const { return !locked; } UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action, string const &);
/// ///
void InsetUnlock(BufferView *); int Latex(Buffer const *, std::ostream &,
/// bool fragile, bool free_spc) const;
bool LockInsetInInset(BufferView *, UpdatableInset *); ///
/// int Ascii(Buffer const *, std::ostream &, int linelen) const;
bool UnlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false); ///
/// int Linuxdoc(Buffer const *, std::ostream &) const { return 0; }
bool UpdateInsetInInset(BufferView *, Inset *); ///
/// int DocBook(Buffer const *, std::ostream &) const ;
void InsetButtonRelease(BufferView *, int, int, int); ///
/// void Validate(LaTeXFeatures & features) const;
void InsetButtonPress(BufferView *, int, int, int); ///
/// Inset::Code LyxCode() const { return Inset::TEXT_CODE; }
void InsetMotionNotify(BufferView *, int, int, int); ///
/// void GetCursorPos(BufferView *, int & x, int & y) const;
void InsetKeyPress(XKeyEvent *); ///
/// unsigned int InsetInInsetY();
UpdatableInset::RESULT LocalDispatch(BufferView *, kb_action, string const &); ///
/// void ToggleInsetCursor(BufferView *);
int Latex(Buffer const *, std::ostream &, ///
bool fragile, bool free_spc) const; bool InsertInset(BufferView *, Inset *);
/// ///
int Ascii(Buffer const *, std::ostream &, int linelen) const; UpdatableInset * GetLockingInset();
/// ///
int Linuxdoc(Buffer const *, std::ostream &) const { return 0; } UpdatableInset * GetFirstLockingInsetOfType(Inset::Code);
/// ///
int DocBook(Buffer const *, std::ostream &) const ; void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
/// ///
void Validate(LaTeXFeatures & features) const; int getMaxWidth(BufferView *, UpdatableInset const *) const;
/// ///
Inset::Code LyxCode() const { return Inset::TEXT_CODE; } void init(InsetText const * ins = 0);
/// ///
void GetCursorPos(BufferView *, int & x, int & y) const; void WriteParagraphData(Buffer const *, std::ostream &) const;
/// ///
unsigned int InsetInInsetY(); void SetParagraphData(LyXParagraph *);
/// ///
void ToggleInsetCursor(BufferView *); void SetText(string const &);
/// ///
bool InsertInset(BufferView *, Inset *); void SetAutoBreakRows(bool);
/// ///
UpdatableInset * GetLockingInset(); void SetDrawFrame(BufferView *, DrawFrame);
/// ///
UpdatableInset * GetFirstLockingInsetOfType(Inset::Code); void SetFrameColor(BufferView *, LColor::color);
/// ///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false); LyXText * getLyXText(BufferView const *, bool const recursive=false) const;
/// ///
int getMaxWidth(BufferView *, UpdatableInset const *) const; void deleteLyXText(BufferView *, bool recursive=true) const;
/// ///
void init(InsetText const * ins = 0); void resizeLyXText(BufferView *) const;
/// ///
void WriteParagraphData(Buffer const *, std::ostream &) const; bool ShowInsetDialog(BufferView *) const;
/// ///
void SetParagraphData(LyXParagraph *); LyXParagraph * par;
/// ///
void SetText(string const &); mutable int need_update;
///
void SetAutoBreakRows(bool);
///
void SetDrawFrame(BufferView *, DrawFrame);
///
void SetFrameColor(BufferView *, LColor::color);
///
LyXText * getLyXText(BufferView const *, bool const recursive=false) const;
///
void deleteLyXText(BufferView *, bool recursive=true) const;
///
void resizeLyXText(BufferView *) const;
///
bool ShowInsetDialog(BufferView *) const;
///
LyXParagraph * par;
///
mutable int need_update;
protected: protected:
/// ///
void UpdateLocal(BufferView *, int what, bool mark_dirty); void UpdateLocal(BufferView *, int what, bool mark_dirty);
/// ///
mutable int drawTextXOffset; mutable int drawTextXOffset;
/// ///
mutable int drawTextYOffset; mutable int drawTextYOffset;
/// ///
bool autoBreakRows; bool autoBreakRows;
/// ///
DrawFrame drawFrame; DrawFrame drawFrame;
/// ///
LColor::color frame_color; LColor::color frame_color;
private: private:
/// ///
typedef std::map<BufferView *, LyXText *> Cache; typedef std::map<BufferView *, LyXText *> Cache;
/// ///
typedef Cache::value_type value_type; typedef Cache::value_type value_type;
/// ///
int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const; int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const;
/// ///
void ShowInsetCursor(BufferView *, bool show=true); void ShowInsetCursor(BufferView *, bool show=true);
/// ///
void HideInsetCursor(BufferView *); void HideInsetCursor(BufferView *);
/// ///
UpdatableInset::RESULT moveRight(BufferView *, bool activate_inset = true, UpdatableInset::RESULT moveRight(BufferView *, bool activate_inset = true,
bool selecting = false); bool selecting = false);
/// ///
UpdatableInset::RESULT moveLeft(BufferView *, bool activate_inset = true, UpdatableInset::RESULT moveLeft(BufferView *, bool activate_inset = true,
bool selecting = false); bool selecting = false);
/// ///
UpdatableInset::RESULT moveRightIntern(BufferView *, bool behind, UpdatableInset::RESULT moveRightIntern(BufferView *, bool behind,
bool activate_inset = true, bool activate_inset = true,
bool selecting = false); bool selecting = false);
/// ///
UpdatableInset::RESULT moveLeftIntern(BufferView *, bool behind, UpdatableInset::RESULT moveLeftIntern(BufferView *, bool behind,
bool activate_inset = true, bool activate_inset = true,
bool selecting = false); bool selecting = false);
/// ///
UpdatableInset::RESULT moveUp(BufferView *); UpdatableInset::RESULT moveUp(BufferView *);
/// ///
UpdatableInset::RESULT moveDown(BufferView *); UpdatableInset::RESULT moveDown(BufferView *);
/// ///
void SetCharFont(Buffer const *, int pos, LyXFont const & font); void SetCharFont(Buffer const *, int pos, LyXFont const & font);
/// ///
string const getText(int); string const getText(int);
/// ///
bool checkAndActivateInset(BufferView * bv, bool behind); bool checkAndActivateInset(BufferView * bv, bool behind);
/// ///
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0, bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
int button = 0); int button = 0);
void removeNewlines(); void removeNewlines();
/// ///
int cx(BufferView *) const; int cx(BufferView *) const;
/// ///
int cy(BufferView *) const; int cy(BufferView *) const;
/// ///
LyXParagraph::size_type cpos(BufferView *) const; LyXParagraph::size_type cpos(BufferView *) const;
/// ///
LyXParagraph * cpar(BufferView *) const; LyXParagraph * cpar(BufferView *) const;
/// ///
bool cboundary(BufferView *) const; bool cboundary(BufferView *) const;
/// ///
Row * crow(BufferView *) const; Row * crow(BufferView *) const;
/// This instead of a macro /// This instead of a macro
LyXText * TEXT(BufferView * bv) const { LyXText * TEXT(BufferView * bv) const {
return getLyXText(bv); return getLyXText(bv);
} }
/* Private structures and variables */ /* Private structures and variables */
/// ///
mutable bool locked; mutable bool locked;
/// ///
mutable int insetAscent; mutable int insetAscent;
/// ///
mutable int insetDescent; mutable int insetDescent;
/// ///
mutable int insetWidth; mutable int insetWidth;
/// ///
mutable int last_width; mutable int last_width;
/// ///
mutable int last_height; mutable int last_height;
/// ///
mutable int top_y; mutable int top_y;
/// ///
LyXParagraph * inset_par; LyXParagraph * inset_par;
/// ///
LyXParagraph::size_type inset_pos; LyXParagraph::size_type inset_pos;
/// ///
bool inset_boundary; bool inset_boundary;
/// ///
mutable int inset_x; mutable int inset_x;
/// ///
mutable int inset_y; mutable int inset_y;
/// ///
int interline_space; int interline_space;
/// ///
bool no_selection; bool no_selection;
/// ///
mutable float xpos; mutable float xpos;
/// ///
UpdatableInset * the_locking_inset; UpdatableInset * the_locking_inset;
/// ///
LyXParagraph * old_par; LyXParagraph * old_par;
/// The cache. /// The cache.
mutable Cache cache; mutable Cache cache;
/// ///
mutable int last_drawn_width; mutable int last_drawn_width;
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -32,485 +32,485 @@ class Buffer;
/// ///
class LyXTabular { class LyXTabular {
public: public:
///
enum Feature {
/// ///
APPEND_ROW = 0, enum Feature {
///
APPEND_ROW = 0,
///
APPEND_COLUMN,
///
DELETE_ROW,
///
DELETE_COLUMN,
///
TOGGLE_LINE_TOP,
///
TOGGLE_LINE_BOTTOM,
///
TOGGLE_LINE_LEFT,
///
TOGGLE_LINE_RIGHT,
///
ALIGN_LEFT,
///
ALIGN_RIGHT,
///
ALIGN_CENTER,
///
VALIGN_TOP,
///
VALIGN_BOTTOM,
///
VALIGN_CENTER,
///
M_TOGGLE_LINE_TOP,
///
M_TOGGLE_LINE_BOTTOM,
///
M_TOGGLE_LINE_LEFT,
///
M_TOGGLE_LINE_RIGHT,
///
M_ALIGN_LEFT,
///
M_ALIGN_RIGHT,
///
M_ALIGN_CENTER,
///
M_VALIGN_TOP,
///
M_VALIGN_BOTTOM,
///
M_VALIGN_CENTER,
///
MULTICOLUMN,
///
SET_ALL_LINES,
///
UNSET_ALL_LINES,
///
SET_LONGTABULAR,
///
UNSET_LONGTABULAR,
///
SET_PWIDTH,
///
SET_MPWIDTH,
///
SET_ROTATE_TABULAR,
///
UNSET_ROTATE_TABULAR,
///
SET_ROTATE_CELL,
///
UNSET_ROTATE_CELL,
///
SET_USEBOX,
///
SET_LTHEAD,
///
SET_LTFIRSTHEAD,
///
SET_LTFOOT,
///
SET_LTLASTFOOT,
///
SET_LTNEWPAGE,
///
SET_SPECIAL_COLUMN,
///
SET_SPECIAL_MULTI,
///
LAST_ACTION
};
/// ///
APPEND_COLUMN, enum {
/// ///
DELETE_ROW, CELL_NORMAL = 0,
/// ///
DELETE_COLUMN, CELL_BEGIN_OF_MULTICOLUMN,
/// ///
TOGGLE_LINE_TOP, CELL_PART_OF_MULTICOLUMN
/// };
TOGGLE_LINE_BOTTOM,
///
TOGGLE_LINE_LEFT,
///
TOGGLE_LINE_RIGHT,
///
ALIGN_LEFT,
///
ALIGN_RIGHT,
///
ALIGN_CENTER,
///
VALIGN_TOP,
///
VALIGN_BOTTOM,
///
VALIGN_CENTER,
///
M_TOGGLE_LINE_TOP,
///
M_TOGGLE_LINE_BOTTOM,
///
M_TOGGLE_LINE_LEFT,
///
M_TOGGLE_LINE_RIGHT,
///
M_ALIGN_LEFT,
///
M_ALIGN_RIGHT,
///
M_ALIGN_CENTER,
///
M_VALIGN_TOP,
///
M_VALIGN_BOTTOM,
///
M_VALIGN_CENTER,
///
MULTICOLUMN,
///
SET_ALL_LINES,
///
UNSET_ALL_LINES,
///
SET_LONGTABULAR,
///
UNSET_LONGTABULAR,
///
SET_PWIDTH,
///
SET_MPWIDTH,
///
SET_ROTATE_TABULAR,
///
UNSET_ROTATE_TABULAR,
///
SET_ROTATE_CELL,
///
UNSET_ROTATE_CELL,
///
SET_USEBOX,
///
SET_LTHEAD,
///
SET_LTFIRSTHEAD,
///
SET_LTFOOT,
///
SET_LTLASTFOOT,
///
SET_LTNEWPAGE,
///
SET_SPECIAL_COLUMN,
///
SET_SPECIAL_MULTI,
///
LAST_ACTION
};
///
enum {
///
CELL_NORMAL = 0,
///
CELL_BEGIN_OF_MULTICOLUMN,
///
CELL_PART_OF_MULTICOLUMN
};
///
enum VAlignment {
/// ///
LYX_VALIGN_TOP = 0, enum VAlignment {
/// ///
LYX_VALIGN_BOTTOM = 1, LYX_VALIGN_TOP = 0,
/// ///
LYX_VALIGN_CENTER = 2 LYX_VALIGN_BOTTOM = 1,
}; ///
LYX_VALIGN_CENTER = 2
};
enum BoxType { enum BoxType {
/// ///
BOX_NONE = 0, BOX_NONE = 0,
/// ///
BOX_PARBOX = 1, BOX_PARBOX = 1,
/// ///
BOX_MINIPAGE = 2 BOX_MINIPAGE = 2
}; };
/* konstruktor */ /* konstruktor */
/// ///
LyXTabular(InsetTabular *, int columns_arg, int rows_arg); LyXTabular(InsetTabular *, int columns_arg, int rows_arg);
/// ///
LyXTabular(InsetTabular *, LyXTabular const &); LyXTabular(InsetTabular *, LyXTabular const &);
/// ///
explicit explicit
LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex); LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
/// ///
LyXTabular & operator=(LyXTabular const &); LyXTabular & operator=(LyXTabular const &);
/// ///
LyXTabular * Clone(InsetTabular *); LyXTabular * Clone(InsetTabular *);
/// Returns true if there is a topline, returns false if not /// Returns true if there is a topline, returns false if not
bool TopLine(int cell, bool onlycolumn = false) const; bool TopLine(int cell, bool onlycolumn = false) const;
/// Returns true if there is a topline, returns false if not /// Returns true if there is a topline, returns false if not
bool BottomLine(int cell, bool onlycolumn = false) const; bool BottomLine(int cell, bool onlycolumn = false) const;
/// Returns true if there is a topline, returns false if not /// Returns true if there is a topline, returns false if not
bool LeftLine(int cell, bool onlycolumn = false) const; bool LeftLine(int cell, bool onlycolumn = false) const;
/// Returns true if there is a topline, returns false if not /// Returns true if there is a topline, returns false if not
bool RightLine(int cell, bool onlycolumn = false) const; bool RightLine(int cell, bool onlycolumn = false) const;
/// ///
bool TopAlreadyDrawed(int cell) const; bool TopAlreadyDrawed(int cell) const;
/// ///
bool LeftAlreadyDrawed(int cell) const; bool LeftAlreadyDrawed(int cell) const;
/// ///
bool IsLastRow(int cell) const; bool IsLastRow(int cell) const;
/// ///
int GetAdditionalHeight(int cell) const; int GetAdditionalHeight(int cell) const;
/// ///
int GetAdditionalWidth(int cell) const; int GetAdditionalWidth(int cell) const;
/* returns the maximum over all rows */ /* returns the maximum over all rows */
/// ///
int GetWidthOfColumn(int cell) const; int GetWidthOfColumn(int cell) const;
/// ///
int GetWidthOfTabular() const; int GetWidthOfTabular() const;
/// ///
int GetAscentOfRow(int row) const; int GetAscentOfRow(int row) const;
/// ///
int GetDescentOfRow(int row) const; int GetDescentOfRow(int row) const;
/// ///
int GetHeightOfTabular() const; int GetHeightOfTabular() const;
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetAscentOfRow(int row, int height); bool SetAscentOfRow(int row, int height);
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetDescentOfRow(int row, int height); bool SetDescentOfRow(int row, int height);
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetWidthOfCell(int cell, int new_width); bool SetWidthOfCell(int cell, int new_width);
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetAllLines(int cell, bool line); bool SetAllLines(int cell, bool line);
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetTopLine(int cell, bool line, bool onlycolumn=false); bool SetTopLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetBottomLine(int cell, bool line, bool onlycolumn=false); bool SetBottomLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetLeftLine(int cell, bool line, bool onlycolumn=false); bool SetLeftLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetRightLine(int cell, bool line, bool onlycolumn=false); bool SetRightLine(int cell, bool line, bool onlycolumn=false);
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetAlignment(int cell, LyXAlignment align, bool onlycolumn = false); bool SetAlignment(int cell, LyXAlignment align, bool onlycolumn = false);
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetVAlignment(int cell, VAlignment align, bool onlycolumn = false); bool SetVAlignment(int cell, VAlignment align, bool onlycolumn = false);
/// ///
bool SetColumnPWidth(int cell, string const & width); bool SetColumnPWidth(int cell, string const & width);
/// ///
bool SetMColumnPWidth(int cell, string const & width); bool SetMColumnPWidth(int cell, string const & width);
/// ///
bool SetAlignSpecial(int cell, string const & special, Feature what); bool SetAlignSpecial(int cell, string const & special, Feature what);
/// ///
LyXAlignment GetAlignment(int cell, bool onlycolumn = false) const; LyXAlignment GetAlignment(int cell, bool onlycolumn = false) const;
/// ///
VAlignment GetVAlignment(int cell, bool onlycolumn = false) const; VAlignment GetVAlignment(int cell, bool onlycolumn = false) const;
/// ///
string const GetPWidth(int cell) const; string const GetPWidth(int cell) const;
/// ///
string const GetColumnPWidth(int cell) const; string const GetColumnPWidth(int cell) const;
/// ///
string const GetMColumnPWidth(int cell) const; string const GetMColumnPWidth(int cell) const;
/// ///
string const GetAlignSpecial(int cell, int what) const; string const GetAlignSpecial(int cell, int what) const;
/// ///
int GetWidthOfCell(int cell) const; int GetWidthOfCell(int cell) const;
/// ///
int GetBeginningOfTextInCell(int cell) const; int GetBeginningOfTextInCell(int cell) const;
/// ///
void AppendRow(int cell); void AppendRow(int cell);
/// ///
void DeleteRow(int row); void DeleteRow(int row);
/// ///
void AppendColumn(int cell); void AppendColumn(int cell);
/// ///
void DeleteColumn(int column); void DeleteColumn(int column);
/// ///
bool IsFirstCellInRow(int cell) const; bool IsFirstCellInRow(int cell) const;
/// ///
int GetFirstCellInRow(int row) const; int GetFirstCellInRow(int row) const;
/// ///
bool IsLastCellInRow(int cell) const; bool IsLastCellInRow(int cell) const;
/// ///
int GetLastCellInRow(int row) const; int GetLastCellInRow(int row) const;
/// ///
int GetNumberOfCells() const; int GetNumberOfCells() const;
/// ///
int NumberOfCellsInRow(int cell) const; int NumberOfCellsInRow(int cell) const;
/// ///
void Write(Buffer const *, std::ostream &) const; void Write(Buffer const *, std::ostream &) const;
/// ///
void Read(Buffer const *, LyXLex &); void Read(Buffer const *, LyXLex &);
/// ///
void OldFormatRead(LyXLex &, string const &); void OldFormatRead(LyXLex &, string const &);
// //
// helper function for Latex returns number of newlines // helper function for Latex returns number of newlines
/// ///
int TeXTopHLine(std::ostream &, int row) const; int TeXTopHLine(std::ostream &, int row) const;
/// ///
int TeXBottomHLine(std::ostream &, int row) const; int TeXBottomHLine(std::ostream &, int row) const;
/// ///
int TeXCellPreamble(std::ostream &, int cell) const; int TeXCellPreamble(std::ostream &, int cell) const;
/// ///
int TeXCellPostamble(std::ostream &, int cell) const; int TeXCellPostamble(std::ostream &, int cell) const;
/// ///
int Latex(Buffer const *, std::ostream &, bool, bool) const; int Latex(Buffer const *, std::ostream &, bool, bool) const;
/// ///
int DocBook(Buffer const * buf, std::ostream & os) const; int DocBook(Buffer const * buf, std::ostream & os) const;
/// ///
// helper function for Latex returns number of newlines // helper function for Latex returns number of newlines
/// ///
int AsciiTopHLine(std::ostream &, int row, int AsciiTopHLine(std::ostream &, int row,
std::vector<unsigned int> const &) const; std::vector<unsigned int> const &) const;
/// ///
int AsciiBottomHLine(std::ostream &, int row, int AsciiBottomHLine(std::ostream &, int row,
std::vector<unsigned int> const &) const; std::vector<unsigned int> const &) const;
/// ///
int AsciiPrintCell(Buffer const *, std::ostream &, int cell, int row, int AsciiPrintCell(Buffer const *, std::ostream &, int cell, int row,
int column, std::vector<unsigned int> const &) const; int column, std::vector<unsigned int> const &) const;
/// ///
int Ascii(Buffer const *, std::ostream &) const; int Ascii(Buffer const *, std::ostream &) const;
/// ///
bool IsMultiColumn(int cell, bool real = false) const; bool IsMultiColumn(int cell, bool real = false) const;
/// ///
void SetMultiColumn(int cell, int number); void SetMultiColumn(int cell, int number);
/// ///
int UnsetMultiColumn(int cell); // returns number of new cells int UnsetMultiColumn(int cell); // returns number of new cells
/// ///
bool IsPartOfMultiColumn(int row, int column) const; bool IsPartOfMultiColumn(int row, int column) const;
/// ///
int row_of_cell(int cell) const; int row_of_cell(int cell) const;
/// ///
int column_of_cell(int cell) const; int column_of_cell(int cell) const;
/// ///
int right_column_of_cell(int cell) const; int right_column_of_cell(int cell) const;
/// ///
void SetLongTabular(bool); void SetLongTabular(bool);
/// ///
bool IsLongTabular() const; bool IsLongTabular() const;
/// ///
void SetRotateTabular(bool); void SetRotateTabular(bool);
/// ///
bool GetRotateTabular() const; bool GetRotateTabular() const;
/// ///
void SetRotateCell(int cell, bool); void SetRotateCell(int cell, bool);
/// ///
bool GetRotateCell(int cell) const; bool GetRotateCell(int cell) const;
/// ///
bool NeedRotating() const; bool NeedRotating() const;
/// ///
bool IsLastCell(int cell) const; bool IsLastCell(int cell) const;
/// ///
int GetCellAbove(int cell) const; int GetCellAbove(int cell) const;
/// ///
int GetCellBelow(int cell) const; int GetCellBelow(int cell) const;
/// ///
int GetLastCellAbove(int cell) const; int GetLastCellAbove(int cell) const;
/// ///
int GetLastCellBelow(int cell) const; int GetLastCellBelow(int cell) const;
/// ///
int GetCellNumber(int row, int column) const; int GetCellNumber(int row, int column) const;
/// ///
void SetUsebox(int cell, BoxType); void SetUsebox(int cell, BoxType);
/// ///
BoxType GetUsebox(int cell) const; BoxType GetUsebox(int cell) const;
// //
// Long Tabular Options // Long Tabular Options
/// ///
void SetLTHead(int cell, bool first); void SetLTHead(int cell, bool first);
/// ///
bool GetRowOfLTHead(int cell, int & row) const; bool GetRowOfLTHead(int cell, int & row) const;
/// ///
bool GetRowOfLTFirstHead(int cell, int & row) const; bool GetRowOfLTFirstHead(int cell, int & row) const;
/// ///
void SetLTFoot(int cell, bool last); void SetLTFoot(int cell, bool last);
/// ///
bool GetRowOfLTFoot(int cell, int & row) const; bool GetRowOfLTFoot(int cell, int & row) const;
/// ///
bool GetRowOfLTLastFoot(int cell, int & row) const; bool GetRowOfLTLastFoot(int cell, int & row) const;
/// ///
void SetLTNewPage(int cell, bool what); void SetLTNewPage(int cell, bool what);
/// ///
bool GetLTNewPage(int cell) const; bool GetLTNewPage(int cell) const;
/// ///
InsetText * GetCellInset(int cell) const; InsetText * GetCellInset(int cell) const;
/// ///
InsetText * GetCellInset(int row, int column) const; InsetText * GetCellInset(int row, int column) const;
/// ///
int rows() const { return rows_; } int rows() const { return rows_; }
/// ///
int columns() const { return columns_;} int columns() const { return columns_;}
/// ///
InsetTabular * owner() const { return owner_; } InsetTabular * owner() const { return owner_; }
/// ///
void Validate(LaTeXFeatures &) const; void Validate(LaTeXFeatures &) const;
private: ////////////////////////////////////////////////////////////////// private: //////////////////////////////////////////////////////////////////
///
struct cellstruct {
/// ///
cellstruct(); struct cellstruct {
///
cellstruct();
///
int cellno;
///
int width_of_cell;
///
int multicolumn;
///
LyXAlignment alignment;
///
VAlignment valignment;
///
bool top_line;
///
bool bottom_line;
///
bool left_line;
///
bool right_line;
///
BoxType usebox;
///
bool rotate;
///
string align_special;
///
string p_width; // this is only set for multicolumn!!!
///
InsetText inset;
};
/// ///
int cellno; typedef std::vector<cellstruct> cell_vector;
/// ///
int width_of_cell; typedef std::vector<cell_vector> cell_vvector;
/// ///
int multicolumn; struct rowstruct {
///
rowstruct();
///
bool top_line;
///
bool bottom_line;
///
int ascent_of_row;
///
int descent_of_row;
/// This are for longtabulars only
bool newpage;
};
/// ///
LyXAlignment alignment; typedef std::vector<rowstruct> row_vector;
/// ///
VAlignment valignment; struct columnstruct {
///
columnstruct();
///
LyXAlignment alignment;
///
VAlignment valignment;
///
bool left_line;
///
bool right_line;
///
int width_of_column;
///
string p_width;
///
string align_special;
};
/// ///
bool top_line; typedef std::vector<columnstruct> column_vector;
/// ///
bool bottom_line; void ReadNew(Buffer const * buf, std::istream & is,
LyXLex & lex, string const & l);
/// ///
bool left_line; void ReadOld(Buffer const * buf, std::istream & is,
LyXLex & lex, string const & l);
/// ///
bool right_line; int rows_;
/// ///
BoxType usebox; int columns_;
///
int numberofcells;
///
std::vector<int> rowofcell;
///
std::vector<int> columnofcell;
///
row_vector row_info;
///
column_vector column_info;
///
mutable cell_vvector cell_info;
///
int width_of_tabular;
/// ///
bool rotate; bool rotate;
//
// for long tabulars
/// ///
string align_special; bool is_long_tabular;
/// row of endhead
int endhead;
/// row of endfirsthead
int endfirsthead;
/// row of endfoot
int endfoot;
/// row of endlastfoot
int endlastfoot;
/// ///
string p_width; // this is only set for multicolumn!!! InsetTabular * owner_;
///
InsetText inset;
};
///
typedef std::vector<cellstruct> cell_vector;
///
typedef std::vector<cell_vector> cell_vvector;
///
struct rowstruct {
///
rowstruct();
///
bool top_line;
///
bool bottom_line;
///
int ascent_of_row;
///
int descent_of_row;
/// This are for longtabulars only
bool newpage;
};
///
typedef std::vector<rowstruct> row_vector;
///
struct columnstruct {
///
columnstruct();
///
LyXAlignment alignment;
///
VAlignment valignment;
///
bool left_line;
///
bool right_line;
///
int width_of_column;
///
string p_width;
///
string align_special;
};
///
typedef std::vector<columnstruct> column_vector;
///
void ReadNew(Buffer const * buf, std::istream & is,
LyXLex & lex, string const & l);
///
void ReadOld(Buffer const * buf, std::istream & is,
LyXLex & lex, string const & l);
///
int rows_;
///
int columns_;
///
int numberofcells;
///
std::vector<int> rowofcell;
///
std::vector<int> columnofcell;
///
row_vector row_info;
///
column_vector column_info;
///
mutable cell_vvector cell_info;
///
int width_of_tabular;
///
bool rotate;
//
// for long tabulars
///
bool is_long_tabular;
/// row of endhead
int endhead;
/// row of endfirsthead
int endfirsthead;
/// row of endfoot
int endfoot;
/// row of endlastfoot
int endlastfoot;
///
InsetTabular * owner_;
/// ///
void Init(int columns_arg, int rows_arg); void Init(int columns_arg, int rows_arg);
/// ///
void Reinit(); void Reinit();
/// ///
void set_row_column_number_info(bool oldformat = false); void set_row_column_number_info(bool oldformat = false);
/// Returns true if a complete update is necessary, otherwise false /// Returns true if a complete update is necessary, otherwise false
bool SetWidthOfMulticolCell(int cell, int new_width); bool SetWidthOfMulticolCell(int cell, int new_width);
/// ///
void recalculateMulticolCells(int cell, int new_width); void recalculateMulticolCells(int cell, int new_width);
/// Returns true if change /// Returns true if change
bool calculate_width_of_column(int column); bool calculate_width_of_column(int column);
/// ///
bool calculate_width_of_column_NMC(int column); // no multi cells bool calculate_width_of_column_NMC(int column); // no multi cells
/// ///
void calculate_width_of_tabular(); void calculate_width_of_tabular();
/// ///
cellstruct * cellinfo_of_cell(int cell) const; cellstruct * cellinfo_of_cell(int cell) const;
/// ///
void delete_column(int column); void delete_column(int column);
/// ///
int cells_in_multicolumn(int cell) const; int cells_in_multicolumn(int cell) const;
/// ///
BoxType UseParbox(int cell) const; BoxType UseParbox(int cell) const;
}; };
#endif #endif