2000-03-08 13:52:57 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2001-03-14 14:53:55 +00:00
|
|
|
* Copyright 1998-2001 The LyX Team.
|
2000-03-08 13:52:57 +00:00
|
|
|
*
|
2000-06-28 16:03:01 +00:00
|
|
|
* ======================================================
|
|
|
|
*/
|
2000-03-08 13:52:57 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "insetcollapsable.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
#include "lyxfont.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "Painter.h"
|
2000-07-04 11:30:07 +00:00
|
|
|
#include "insets/insettext.h"
|
2000-04-24 20:58:23 +00:00
|
|
|
#include "support/LOstream.h"
|
2000-06-28 13:35:52 +00:00
|
|
|
#include "support/lstrings.h"
|
2000-07-04 19:16:35 +00:00
|
|
|
#include "debug.h"
|
2000-07-07 07:46:37 +00:00
|
|
|
#include "lyxtext.h"
|
2000-03-08 13:52:57 +00:00
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
class LyXText;
|
|
|
|
|
2000-04-24 20:58:23 +00:00
|
|
|
using std::ostream;
|
2000-07-05 14:57:48 +00:00
|
|
|
using std::endl;
|
2000-07-17 18:27:53 +00:00
|
|
|
using std::max;
|
2000-03-08 13:52:57 +00:00
|
|
|
|
2000-06-28 16:03:01 +00:00
|
|
|
InsetCollapsable::InsetCollapsable()
|
2001-03-14 14:53:55 +00:00
|
|
|
: UpdatableInset(), inset(new InsetText)
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2001-03-14 14:53:55 +00:00
|
|
|
//inset = new InsetText;
|
2000-07-04 11:30:07 +00:00
|
|
|
inset->setOwner(this);
|
2000-03-08 13:52:57 +00:00
|
|
|
collapsed = true;
|
|
|
|
label = "Label";
|
2000-04-19 14:42:19 +00:00
|
|
|
autocollapse = true;
|
2000-07-04 11:30:07 +00:00
|
|
|
inset->SetAutoBreakRows(true);
|
|
|
|
inset->SetDrawFrame(0, InsetText::ALWAYS);
|
|
|
|
inset->SetFrameColor(0, LColor::footnoteframe);
|
2000-04-19 14:42:19 +00:00
|
|
|
button_length = button_top_y = button_bottom_y = 0;
|
|
|
|
setInsetName("Collapsable");
|
2000-07-04 11:30:07 +00:00
|
|
|
widthCollapsed = oldWidth = 0;
|
|
|
|
need_update = FULL;
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-10 11:50:43 +00:00
|
|
|
Inset * InsetCollapsable::Clone(Buffer const &) const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-06-12 11:27:15 +00:00
|
|
|
InsetCollapsable * result = new InsetCollapsable();
|
2000-07-04 11:30:07 +00:00
|
|
|
result->inset->init(inset);
|
|
|
|
result->inset->setOwner(result);
|
2000-03-28 16:18:02 +00:00
|
|
|
|
2000-03-31 10:35:53 +00:00
|
|
|
result->collapsed = collapsed;
|
2000-03-08 13:52:57 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2000-06-28 13:35:52 +00:00
|
|
|
|
2000-07-04 19:16:35 +00:00
|
|
|
bool InsetCollapsable::InsertInset(BufferView * bv, Inset * in)
|
|
|
|
{
|
|
|
|
if (!InsertInsetAllowed(in)) {
|
|
|
|
lyxerr << "InsetCollapsable::InsertInset: "
|
|
|
|
"Unable to insert inset." << endl;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return inset->InsertInset(bv, in);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
void InsetCollapsable::Write(Buffer const * buf, ostream & os) const
|
2000-04-19 14:42:19 +00:00
|
|
|
{
|
2000-07-04 11:30:07 +00:00
|
|
|
os << "collapsed " << tostr(collapsed) << "\n";
|
|
|
|
inset->WriteParagraphData(buf, os);
|
2000-04-19 14:42:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
|
2000-04-19 14:42:19 +00:00
|
|
|
{
|
|
|
|
if (lex.IsOK()) {
|
|
|
|
lex.next();
|
2001-03-14 14:53:55 +00:00
|
|
|
string const token = lex.GetString();
|
2000-04-19 14:42:19 +00:00
|
|
|
if (token == "collapsed") {
|
|
|
|
lex.next();
|
|
|
|
collapsed = lex.GetBool();
|
2000-07-17 18:27:53 +00:00
|
|
|
} else {
|
|
|
|
lyxerr << "InsetCollapsable::Read: Missing collapsed!"
|
|
|
|
<< endl;
|
2000-04-19 14:42:19 +00:00
|
|
|
}
|
|
|
|
}
|
2000-07-04 11:30:07 +00:00
|
|
|
inset->Read(buf, lex);
|
2000-04-19 14:42:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-08 13:52:57 +00:00
|
|
|
int InsetCollapsable::ascent_collapsed(Painter & pain, LyXFont const &) const
|
|
|
|
{
|
2001-02-16 09:25:43 +00:00
|
|
|
int width = 0;
|
|
|
|
int ascent = 0;
|
|
|
|
int descent = 0;
|
2000-09-26 13:54:57 +00:00
|
|
|
pain.buttonText(0, 0, label, labelfont, false,
|
2000-03-08 13:52:57 +00:00
|
|
|
width, ascent, descent);
|
|
|
|
return ascent;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int InsetCollapsable::descent_collapsed(Painter & pain, LyXFont const &) const
|
|
|
|
{
|
2001-02-16 09:25:43 +00:00
|
|
|
int width = 0;
|
|
|
|
int ascent = 0;
|
|
|
|
int descent = 0;
|
2000-09-26 13:54:57 +00:00
|
|
|
pain.buttonText(0, 0, label, labelfont, false,
|
2000-03-08 13:52:57 +00:00
|
|
|
width, ascent, descent);
|
|
|
|
return descent;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int InsetCollapsable::width_collapsed(Painter & pain, LyXFont const &) const
|
|
|
|
{
|
2001-02-16 09:25:43 +00:00
|
|
|
int width;
|
|
|
|
int ascent;
|
|
|
|
int descent;
|
2000-09-26 13:54:57 +00:00
|
|
|
pain.buttonText(TEXT_TO_INSET_OFFSET, 0, label, labelfont, false,
|
2000-03-08 13:52:57 +00:00
|
|
|
width, ascent, descent);
|
|
|
|
return width + (2*TEXT_TO_INSET_OFFSET);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-05 14:57:48 +00:00
|
|
|
int InsetCollapsable::ascent(BufferView * bv, LyXFont const & font) const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
|
|
|
if (collapsed)
|
2000-07-05 14:57:48 +00:00
|
|
|
return ascent_collapsed(bv->painter(), font);
|
2000-03-08 13:52:57 +00:00
|
|
|
else
|
2000-07-05 14:57:48 +00:00
|
|
|
return inset->ascent(bv, font) + TEXT_TO_TOP_OFFSET;
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-05 14:57:48 +00:00
|
|
|
int InsetCollapsable::descent(BufferView * bv, LyXFont const & font) const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
|
|
|
if (collapsed)
|
2000-07-05 14:57:48 +00:00
|
|
|
return descent_collapsed(bv->painter(), font);
|
2000-03-08 13:52:57 +00:00
|
|
|
else
|
2000-07-05 14:57:48 +00:00
|
|
|
return inset->descent(bv, font) + TEXT_TO_BOTTOM_OFFSET;
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-05 14:57:48 +00:00
|
|
|
int InsetCollapsable::width(BufferView * bv, LyXFont const & font) const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
|
|
|
if (collapsed)
|
2000-07-04 11:30:07 +00:00
|
|
|
return widthCollapsed;
|
2000-03-08 13:52:57 +00:00
|
|
|
|
2000-07-05 14:57:48 +00:00
|
|
|
return inset->width(bv, font) + widthCollapsed;
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
void InsetCollapsable::draw_collapsed(Painter & pain, LyXFont const &,
|
2000-03-08 13:52:57 +00:00
|
|
|
int baseline, float & x) const
|
|
|
|
{
|
|
|
|
int width = 0;
|
2000-05-15 14:49:36 +00:00
|
|
|
pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET,
|
2000-09-26 13:54:57 +00:00
|
|
|
baseline, label, labelfont, true, width);
|
2000-07-04 11:30:07 +00:00
|
|
|
x += width + TEXT_TO_INSET_OFFSET;
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-21 15:07:57 +00:00
|
|
|
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
2000-06-23 15:02:46 +00:00
|
|
|
int baseline, float & x, bool cleared) const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-06-21 15:07:57 +00:00
|
|
|
Painter & pain = bv->painter();
|
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
button_length = widthCollapsed;
|
2000-04-19 14:42:19 +00:00
|
|
|
button_top_y = -ascent_collapsed(pain, f);
|
|
|
|
button_bottom_y = descent_collapsed(pain, f);
|
2000-03-08 13:52:57 +00:00
|
|
|
if (collapsed) {
|
|
|
|
draw_collapsed(pain, f, baseline, x);
|
2000-07-04 11:30:07 +00:00
|
|
|
x += TEXT_TO_INSET_OFFSET;
|
2000-03-08 13:52:57 +00:00
|
|
|
return;
|
|
|
|
}
|
2000-04-19 14:42:19 +00:00
|
|
|
|
2000-07-04 15:46:55 +00:00
|
|
|
if (!cleared && ((inset->need_update == InsetText::FULL) ||
|
2000-07-05 14:57:48 +00:00
|
|
|
(inset->need_update == InsetText::INIT) ||
|
2000-07-04 11:30:07 +00:00
|
|
|
(top_x!=int(x)) || (top_baseline!=baseline))) {
|
2000-07-17 18:27:53 +00:00
|
|
|
int w = owner() ? width(bv, f) : pain.paperWidth();
|
|
|
|
int h = ascent(bv, f) + descent(bv, f);
|
|
|
|
int tx = (needFullRow() && !owner()) ? 0 : int(x);
|
|
|
|
int ty = max(0, baseline - ascent(bv, f));
|
2000-06-28 15:12:29 +00:00
|
|
|
|
|
|
|
if ((ty + h) > pain.paperHeight())
|
|
|
|
h = pain.paperHeight();
|
2000-07-04 11:30:07 +00:00
|
|
|
if ((top_x + w) > pain.paperWidth())
|
2000-06-28 15:12:29 +00:00
|
|
|
w = pain.paperWidth();
|
2000-11-03 15:56:33 +00:00
|
|
|
if (baseline < 0)
|
|
|
|
h += (baseline - ascent(bv, f));
|
2000-07-17 18:27:53 +00:00
|
|
|
pain.fillRectangle(tx, ty - 1, w, h + 2);
|
2000-06-28 15:12:29 +00:00
|
|
|
cleared = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// not needed if collapsed
|
2000-07-04 11:30:07 +00:00
|
|
|
top_x = int(x);
|
|
|
|
top_baseline = baseline;
|
2000-06-28 15:12:29 +00:00
|
|
|
|
|
|
|
draw_collapsed(pain, f, baseline, x);
|
2000-07-04 11:30:07 +00:00
|
|
|
inset->draw(bv, f, baseline, x, cleared);
|
|
|
|
need_update = NONE;
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-24 20:58:23 +00:00
|
|
|
void InsetCollapsable::Edit(BufferView * bv, int x, int y, unsigned int button)
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-07-04 11:30:07 +00:00
|
|
|
UpdatableInset::Edit(bv, x, y, button);
|
|
|
|
|
2000-04-19 14:42:19 +00:00
|
|
|
if (collapsed && autocollapse) {
|
2000-03-08 13:52:57 +00:00
|
|
|
collapsed = false;
|
2000-07-04 11:30:07 +00:00
|
|
|
if (!bv->lockInset(this))
|
|
|
|
return;
|
|
|
|
bv->updateInset(this, false);
|
|
|
|
inset->Edit(bv, 0, 0, button);
|
2000-04-19 14:42:19 +00:00
|
|
|
} else if (!collapsed) {
|
2000-07-04 11:30:07 +00:00
|
|
|
if (!bv->lockInset(this))
|
|
|
|
return;
|
2001-03-14 14:53:55 +00:00
|
|
|
inset->Edit(bv, x - widthCollapsed, y, button);
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Inset::EDITABLE InsetCollapsable::Editable() const
|
|
|
|
{
|
|
|
|
if (collapsed)
|
|
|
|
return IS_EDITABLE;
|
|
|
|
return HIGHLY_EDITABLE;
|
|
|
|
}
|
|
|
|
|
2000-04-24 20:58:23 +00:00
|
|
|
|
|
|
|
void InsetCollapsable::InsetUnlock(BufferView * bv)
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-04-19 14:42:19 +00:00
|
|
|
if (autocollapse) {
|
2000-03-08 13:52:57 +00:00
|
|
|
collapsed = true;
|
|
|
|
}
|
2000-07-04 11:30:07 +00:00
|
|
|
inset->InsetUnlock(bv);
|
|
|
|
bv->updateInset(this, false);
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-24 20:58:23 +00:00
|
|
|
void InsetCollapsable::InsetButtonPress(BufferView * bv,int x,int y,int button)
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-04-19 14:42:19 +00:00
|
|
|
if (!collapsed && (x >= button_length)) {
|
2001-03-14 14:53:55 +00:00
|
|
|
inset->InsetButtonPress(bv, x - widthCollapsed, y, button);
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-24 20:58:23 +00:00
|
|
|
void InsetCollapsable::InsetButtonRelease(BufferView * bv,
|
|
|
|
int x, int y, int button)
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-04-19 14:42:19 +00:00
|
|
|
if ((x >= 0) && (x < button_length) &&
|
|
|
|
(y >= button_top_y) && (y < button_bottom_y)) {
|
|
|
|
if (collapsed) {
|
|
|
|
collapsed = false;
|
2000-07-04 11:30:07 +00:00
|
|
|
inset->InsetButtonRelease(bv, 0, 0, button);
|
|
|
|
bv->updateInset(this, false);
|
2000-04-19 14:42:19 +00:00
|
|
|
} else {
|
|
|
|
collapsed = true;
|
|
|
|
bv->unlockInset(this);
|
2000-07-04 11:30:07 +00:00
|
|
|
bv->updateInset(this, false);
|
2000-04-19 14:42:19 +00:00
|
|
|
}
|
|
|
|
} else if (!collapsed && (x >= button_length) && (y >= button_top_y)) {
|
2001-03-14 14:53:55 +00:00
|
|
|
inset->InsetButtonRelease(bv, x - widthCollapsed, y, button);
|
2000-03-09 16:04:28 +00:00
|
|
|
}
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
2000-04-24 20:58:23 +00:00
|
|
|
|
|
|
|
void InsetCollapsable::InsetMotionNotify(BufferView * bv,
|
|
|
|
int x, int y, int state)
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-04-19 14:42:19 +00:00
|
|
|
if (x >= button_length) {
|
2000-07-04 11:30:07 +00:00
|
|
|
inset->InsetMotionNotify(bv, x-widthCollapsed, y, state);
|
2000-03-09 16:04:28 +00:00
|
|
|
}
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
2000-04-19 14:42:19 +00:00
|
|
|
|
2000-04-24 20:58:23 +00:00
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
void InsetCollapsable::InsetKeyPress(XKeyEvent * xke)
|
|
|
|
{
|
|
|
|
inset->InsetKeyPress(xke);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
int InsetCollapsable::Latex(Buffer const * buf, ostream & os,
|
|
|
|
bool fragile, bool free_spc) const
|
2000-07-04 11:30:07 +00:00
|
|
|
{
|
|
|
|
return inset->Latex(buf, os, fragile, free_spc);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-24 20:58:23 +00:00
|
|
|
int InsetCollapsable::getMaxWidth(Painter & pain,
|
|
|
|
UpdatableInset const * inset) const
|
2000-04-19 14:42:19 +00:00
|
|
|
{
|
2001-02-16 09:25:43 +00:00
|
|
|
int const w = UpdatableInset::getMaxWidth(pain, inset);
|
2000-04-19 14:42:19 +00:00
|
|
|
|
2000-07-05 14:57:48 +00:00
|
|
|
if (w < 0) {
|
2000-07-17 18:27:53 +00:00
|
|
|
// What does a negative max width signify? (Lgb)
|
2000-07-04 11:30:07 +00:00
|
|
|
return w;
|
2000-07-05 14:57:48 +00:00
|
|
|
}
|
|
|
|
// should be at least 30 pixels !!!
|
2000-07-17 18:27:53 +00:00
|
|
|
return max(30, w - widthCollapsed);
|
2000-04-19 14:42:19 +00:00
|
|
|
}
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
2000-07-05 14:57:48 +00:00
|
|
|
#if 0
|
2000-04-19 14:42:19 +00:00
|
|
|
int InsetCollapsable::getMaxTextWidth(Painter & pain,
|
2000-05-15 14:49:36 +00:00
|
|
|
UpdatableInset const * inset) const
|
2000-04-19 14:42:19 +00:00
|
|
|
{
|
2000-07-04 11:30:07 +00:00
|
|
|
return getMaxWidth(pain, inset) - widthCollapsed;
|
2000-04-19 14:42:19 +00:00
|
|
|
}
|
2000-07-05 14:57:48 +00:00
|
|
|
#endif
|
2000-06-28 13:35:52 +00:00
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
2000-07-04 15:46:55 +00:00
|
|
|
void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
2000-07-07 07:46:37 +00:00
|
|
|
bool reinit)
|
2000-06-26 15:10:49 +00:00
|
|
|
{
|
2000-07-07 07:46:37 +00:00
|
|
|
if (reinit) {
|
|
|
|
need_update = FULL;
|
|
|
|
if (owner())
|
|
|
|
owner()->update(bv, font, true);
|
|
|
|
return;
|
|
|
|
}
|
2000-07-04 11:30:07 +00:00
|
|
|
if (!widthCollapsed) {
|
|
|
|
widthCollapsed = width_collapsed(bv->painter(), font);
|
2000-07-14 14:57:20 +00:00
|
|
|
inset->resizeLyXText(bv);
|
2000-07-04 11:30:07 +00:00
|
|
|
need_update = FULL;
|
|
|
|
if (owner()) {
|
2000-07-07 07:46:37 +00:00
|
|
|
owner()->update(bv, font);
|
2000-07-04 11:30:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2000-07-05 14:57:48 +00:00
|
|
|
if (oldWidth != width(bv, font)) {
|
|
|
|
oldWidth = width(bv, font);
|
2000-07-14 14:57:20 +00:00
|
|
|
inset->resizeLyXText(bv);
|
2000-07-04 11:30:07 +00:00
|
|
|
need_update = FULL;
|
|
|
|
if (owner()) {
|
2000-07-07 07:46:37 +00:00
|
|
|
owner()->update(bv, font);
|
2000-07-04 11:30:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2000-07-07 07:46:37 +00:00
|
|
|
inset->update(bv, font);
|
2000-07-04 11:30:07 +00:00
|
|
|
}
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
UpdatableInset::RESULT
|
2001-02-23 16:10:03 +00:00
|
|
|
InsetCollapsable::LocalDispatch(BufferView * bv, kb_action action,
|
2000-07-15 23:51:46 +00:00
|
|
|
string const & arg)
|
2000-07-04 11:30:07 +00:00
|
|
|
{
|
|
|
|
UpdatableInset::RESULT result = inset->LocalDispatch(bv, action, arg);
|
|
|
|
if (result == FINISHED)
|
|
|
|
bv->unlockInset(this);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
bool InsetCollapsable::LockInsetInInset(BufferView * bv, UpdatableInset * in)
|
|
|
|
{
|
|
|
|
if (inset == in)
|
|
|
|
return true;
|
|
|
|
return inset->LockInsetInInset(bv, in);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool InsetCollapsable::UnlockInsetInInset(BufferView * bv, UpdatableInset * in,
|
|
|
|
bool lr)
|
|
|
|
{
|
|
|
|
if (inset == in) {
|
|
|
|
bv->unlockInset(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return inset->UnlockInsetInInset(bv, in, lr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool InsetCollapsable::UpdateInsetInInset(BufferView * bv, Inset *in)
|
|
|
|
{
|
|
|
|
if (in == inset)
|
|
|
|
return true;
|
|
|
|
return inset->UpdateInsetInInset(bv, in);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-29 18:44:07 +00:00
|
|
|
unsigned int InsetCollapsable::InsetInInsetY()
|
2000-07-04 11:30:07 +00:00
|
|
|
{
|
|
|
|
return inset->InsetInInsetY();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetCollapsable::Validate(LaTeXFeatures & features) const
|
|
|
|
{
|
|
|
|
inset->Validate(features);
|
2000-06-26 15:10:49 +00:00
|
|
|
}
|
2000-07-04 11:30:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
void InsetCollapsable::GetCursorPos(BufferView * bv, int & x, int & y) const
|
|
|
|
{
|
|
|
|
inset->GetCursorPos(bv, x , y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetCollapsable::ToggleInsetCursor(BufferView * bv)
|
|
|
|
{
|
|
|
|
inset->ToggleInsetCursor(bv);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UpdatableInset * InsetCollapsable::GetLockingInset()
|
|
|
|
{
|
2000-07-04 19:16:35 +00:00
|
|
|
UpdatableInset * in = inset->GetLockingInset();
|
2000-07-04 11:30:07 +00:00
|
|
|
if (inset == in)
|
|
|
|
return this;
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UpdatableInset * InsetCollapsable::GetFirstLockingInsetOfType(Inset::Code c)
|
|
|
|
{
|
|
|
|
if (c == LyxCode())
|
|
|
|
return this;
|
|
|
|
return inset->GetFirstLockingInsetOfType(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-04 19:16:35 +00:00
|
|
|
void InsetCollapsable::SetFont(BufferView * bv,
|
|
|
|
LyXFont const & font, bool toggleall)
|
2000-07-04 11:30:07 +00:00
|
|
|
{
|
|
|
|
inset->SetFont(bv, font, toggleall);
|
|
|
|
}
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
bool InsetCollapsable::doClearArea() const
|
|
|
|
{
|
|
|
|
return inset->doClearArea();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-22 15:07:07 +00:00
|
|
|
LyXText * InsetCollapsable::getLyXText(BufferView const * bv,
|
|
|
|
bool const recursive) const
|
2000-07-04 11:30:07 +00:00
|
|
|
{
|
2001-02-22 14:09:20 +00:00
|
|
|
return inset->getLyXText(bv, recursive);
|
2000-07-04 11:30:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-14 14:57:20 +00:00
|
|
|
void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const
|
2000-07-04 11:30:07 +00:00
|
|
|
{
|
2000-07-14 14:57:20 +00:00
|
|
|
inset->deleteLyXText(bv, recursive);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetCollapsable::resizeLyXText(BufferView * bv) const
|
|
|
|
{
|
|
|
|
inset->resizeLyXText(bv);
|
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
|
|
|
oldWidth = width(bv, font);
|
2000-07-04 11:30:07 +00:00
|
|
|
}
|