#include "lyxfont.h"
#include "BufferView.h"
#include "Painter.h"
-#include "insets/insettext.h"
-#include "support/LOstream.h"
-#include "support/lstrings.h"
#include "debug.h"
#include "lyxtext.h"
#include "font.h"
#include "lyxlex.h"
-class LyXText;
+#include "insets/insettext.h"
+#include "support/LOstream.h"
+#include "support/lstrings.h"
+
+using std::vector;
using std::ostream;
using std::endl;
using std::max;
+class LyXText;
+
+
InsetCollapsable::InsetCollapsable(bool collapsed)
: UpdatableInset(), collapsed_(collapsed),
button_length(0), button_top_y(0), button_bottom_y(0),
if (!isOpen()) {
draw_collapsed(pain, baseline, x);
- x += TEXT_TO_INSET_OFFSET;
return;
}
first_after_edit = true;
if (!bv->lockInset(this))
return;
- bv->updateInset(this, true);
+ bv->updateInset(this, false);
inset.edit(bv);
} else {
if (!bv->lockInset(this))
if (!bv->lockInset(this))
return;
inset.setUpdateStatus(bv, InsetText::FULL);
- bv->updateInset(this, true);
+ bv->updateInset(this, false);
inset.edit(bv, front);
} else {
if (!bv->lockInset(this))
}
-void InsetCollapsable::insetButtonRelease(BufferView * bv,
+bool InsetCollapsable::insetButtonRelease(BufferView * bv,
int x, int y, int button)
{
- if ((x >= 0) && (x < button_length) &&
+ bool ret = false;
+ if ((button != 3) && (x >= 0) && (x < button_length) &&
(y >= button_top_y) && (y <= button_bottom_y))
{
if (collapsed_) {
// should not be called on inset open!
// inset.insetButtonRelease(bv, 0, 0, button);
inset.setUpdateStatus(bv, InsetText::FULL);
- bv->updateInset(this, true);
+ bv->updateInset(this, false);
} else {
collapsed_ = true;
bv->unlockInset(this);
- bv->updateInset(this, true);
+ bv->updateInset(this, false);
}
} else if (!collapsed_ && (y > button_bottom_y)) {
LyXFont font(LyXFont::ALL_SANE);
(ascent_collapsed() +
descent_collapsed() +
inset.ascent(bv, font));
- inset.insetButtonRelease(bv, x, yy, button);
+ ret = inset.insetButtonRelease(bv, x, yy, button);
}
+ if ((button == 3) && !ret) {
+ return showInsetDialog(bv);
+ }
+ return false;
}
}
+int InsetCollapsable::ascii(Buffer const * buf, ostream & os, int ll) const
+{
+ return inset.ascii(buf, os, ll);
+}
+
+
+int InsetCollapsable::linuxdoc(Buffer const * buf, ostream & os) const
+{
+ return inset.linuxdoc(buf, os);
+}
+
+
+int InsetCollapsable::docbook(Buffer const * buf, ostream & os) const
+{
+ return inset.docbook(buf, os);
+}
+
+#if 0
int InsetCollapsable::getMaxWidth(BufferView * bv,
UpdatableInset const * in) const
{
return UpdatableInset::getMaxWidth(bv, in);
#endif
}
+#endif
void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
UpdatableInset::RESULT
InsetCollapsable::localDispatch(BufferView * bv, kb_action action,
- string const & arg)
+ string const & arg)
{
UpdatableInset::RESULT result = inset.localDispatch(bv, action, arg);
- if (result == FINISHED)
+ if (result >= FINISHED)
bv->unlockInset(this);
first_after_edit = false;
return result;
bool InsetCollapsable::unlockInsetInInset(BufferView * bv, UpdatableInset * in,
- bool lr)
+ bool lr)
{
if (&inset == in) {
bv->unlockInset(this);
bool InsetCollapsable::updateInsetInInset(BufferView * bv, Inset *in)
{
- if (&inset == in)
+ if (in == this)
return true;
return inset.updateInsetInInset(bv, in);
}
}
-std::vector<string> const InsetCollapsable::getLabelList() const
+vector<string> const InsetCollapsable::getLabelList() const
{
return inset.getLabelList();
}
}
+Paragraph * InsetCollapsable::getFirstParagraph(int i) const
+{
+ return inset.getFirstParagraph(i);
+}
+
+
LyXCursor const & InsetCollapsable::cursor(BufferView * bv) const
{
return inset.cursor(bv);
if (!collapsed_) return;
collapsed_ = false;
- bv->updateInset(this, true);
+ bv->updateInset(this, false);
}
return;
collapsed_ = true;
- bv->updateInset(const_cast<InsetCollapsable *>(this), true);
+ bv->updateInset(const_cast<InsetCollapsable *>(this), false);
}
bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
- bool const & cs, bool const & mw)
+ bool cs, bool mw)
{
bool found = inset.searchForward(bv, str, cs, mw);
if (first_after_edit && !found)
first_after_edit = false;
return found;
}
+
+
bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
- bool const & cs, bool const & mw)
+ bool cs, bool mw)
{
bool found = inset.searchBackward(bv, str, cs, mw);
if (first_after_edit && !found)
}
-string const InsetCollapsable::selectNextWord(BufferView * bv, float & value) const
+string const InsetCollapsable::selectNextWordToSpellcheck(BufferView * bv,
+ float & value) const
{
- string str = inset.selectNextWord(bv, value);
+ string const str = inset.selectNextWordToSpellcheck(bv, value);
if (first_after_edit && str.empty())
close(bv);
first_after_edit = false;