+2001-12-17 Juergen Vigna <jug@sad.it>
+
+ * insetert.C (read): removed piece of compatibility code only needed
+ for 1.2.0.
+
+ * insettabular.C (insetButtonRelease): fixed so that sub-dialogs
+ can be opened.
+
+ * insetcollapsable.C (insetButtonRelease): changed so that it can
+ open evetual existing popup dialogs on mousebutton==3.
+
+ * insetfloat.C (insetButtonRelease): removed not needed anymore!
+
+ * insetminipage.C (insetButtonRelease): removed not needed anymore!
+
+ * inset.C (insetButtonRelease): return a bool for telling the outer
+ world that we opened a dialog.
+
2001-12-07 Juergen Vigna <jug@sad.it>
* insettext.C (paragraph): remove the deleteing of paragraphs as
}
-void UpdatableInset::insetButtonRelease(BufferView *, int x, int y, int button)
+bool UpdatableInset::insetButtonRelease(BufferView *, int x, int y, int button)
{
lyxerr[Debug::INFO] << "Inset Button Release x=" << x
<< ", y=" << y << ", button=" << button << endl;
+ return false;
}
/// This is called when the user clicks inside an inset
virtual void insetButtonPress(BufferView *, int, int, int) {}
/// This is called when the user releases the button inside an inset
- virtual void insetButtonRelease(BufferView *, int, int, int) {}
+ // the bool return is used to see if we opened a dialog so that we can
+ // check this from an outer inset and open the dialog of the outer inset
+ // if that one has one!
+ ///
+ virtual bool insetButtonRelease(BufferView *, int, int, int)
+ { return false; }
/// This is called when the user moves the mouse inside an inset
virtual void insetMotionNotify(BufferView *, int , int , int) {}
///
///
virtual void insetButtonPress(BufferView *, int x, int y, int button);
///
- virtual void insetButtonRelease(BufferView *,
- int x, int y, int button);
+ // the bool return is used to see if we opened a dialog so that we can
+ // check this from an outer inset and open the dialog of the outer inset
+ // if that one has one!
+ ///
+ virtual bool insetButtonRelease(BufferView *,
+ int x, int y, int button);
///
virtual void insetKeyPress(XKeyEvent * ev);
///
}
-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_) {
(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;
}
///
unsigned int insetInInsetY();
///
- void insetButtonRelease(BufferView *, int, int, int);
+ bool insetButtonRelease(BufferView *, int, int, int);
///
void insetButtonPress(BufferView *, int, int, int);
///
lex.pushToken(token);
}
}
+#if 0
#warning this should be really short lived only for compatibility to
#warning files written 07/08/2001 so this has to go before 1.2.0! (Jug)
if (lex.isOK()) {
lex.pushToken(token);
}
}
+#endif
inset.read(buf, lex);
#ifndef INHERIT_LANG
}
-void InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
+bool InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
{
if (button == 3) {
showInsetDialog(bv);
- return;
+ return true;
}
if (status_ != Inlined && (x >= 0) && (x < button_length) &&
inset.insetButtonRelease(bv, x, yy, button);
}
}
+ return false;
}
///
void insetButtonPress(BufferView *, int x, int y, int button);
///
- void insetButtonRelease(BufferView * bv, int x, int y, int button);
+ bool insetButtonRelease(BufferView * bv, int x, int y, int button);
///
void insetMotionNotify(BufferView *, int x, int y, int state);
///
}
-void InsetFloat::insetButtonRelease(BufferView * bv, int x, int y, int button)
-{
-#if 1
- if ((x >= 0) && (x < button_length) &&
- (y >= button_top_y) && (y <= button_bottom_y) &&
- (button == 3))
- {
- showInsetDialog(bv);
- return;
- }
-#else
- if (button == 3) {
- showInsetDialog(bv);
- return;
- }
-#endif
- InsetCollapsable::insetButtonRelease(bv, x, y, button);
-}
-
-
string const & InsetFloat::type() const
{
return floatType_;
///
bool insetAllowed(Inset::Code) const;
///
- void insetButtonRelease(BufferView * bv, int x, int y, int button);
- ///
string const & type() const;
///
void placement(string const & p);
}
-void InsetMinipage::insetButtonRelease(BufferView * bv, int x, int y,
- int button)
-{
- if (button == 3) {
- showInsetDialog(bv);
- return;
- }
- InsetCollapsable::insetButtonRelease(bv, x, y, button);
-}
-
-
int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
const
{
///
SigC::Signal0<void> hideDialog;
///
- void insetButtonRelease(BufferView * bv, int x, int y, int button);
- ///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
bool needFullRow() const { return false; }
if (actrow != orow)
updateLocal(bv, NONE, false);
clearSelection();
+#if 0
if (button == 3) {
if ((ocell != actcell) && the_locking_inset) {
the_locking_inset->insetUnlock(bv);
showInsetCursor(bv);
return;
}
+#endif
bool const inset_hit = insetHit(bv, x, y);
}
-void InsetTabular::insetButtonRelease(BufferView * bv,
- int x, int y, int button)
+bool InsetTabular::insetButtonRelease(BufferView * bv,
+ int x, int y, int button)
{
- if (button == 3) {
- if (the_locking_inset) {
- UpdatableInset * i;
- if ((i = the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE))) {
- i->insetButtonRelease(bv, x, y, button);
- return;
- }
- }
+ bool ret = false;
+ if (the_locking_inset)
+ ret = the_locking_inset->insetButtonRelease(bv, x, y, button);
+ if (button == 3 && !ret) {
bv->owner()->getDialogs()->showTabular(this);
- return;
- }
- if (the_locking_inset) {
- the_locking_inset->insetButtonRelease(bv,
- x - inset_x, y - inset_y,
- button);
- return;
+ return true;
}
+ return ret;
}
///
bool display() const { return tabular->IsLongTabular(); }
///
- void insetButtonRelease(BufferView *, int, int, int);
+ bool insetButtonRelease(BufferView *, int, int, int);
///
void insetButtonPress(BufferView *, int, int, int);
///
}
-void InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
+bool InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
{
- UpdatableInset * inset = 0;
-
if (the_locking_inset) {
- the_locking_inset->insetButtonRelease(bv,
- x - inset_x, y - inset_y,
- button);
- } else {
- if (cpar(bv)->isInset(cpos(bv))) {
- inset = static_cast<UpdatableInset*>(cpar(bv)->getInset(cpos(bv)));
- if (isHighlyEditableInset(inset)) {
- inset->insetButtonRelease(bv,
- x - inset_x,
- y - inset_y, button);
- } else {
- inset_x = cx(bv) - top_x + drawTextXOffset;
- inset_y = cy(bv) + drawTextYOffset;
- inset->insetButtonRelease(bv,
- x - inset_x,
- y - inset_y, button);
- inset->edit(bv,
- x - inset_x, y - inset_y, button);
- }
- updateLocal(bv, CURSOR_PAR, false);
+ return the_locking_inset->insetButtonRelease(bv,
+ x - inset_x, y - inset_y,
+ button);
+ }
+ int tmp_x = x - drawTextXOffset;
+ int tmp_y = y + insetAscent - getLyXText(bv)->first;
+ Inset * inset = bv->checkInsetHit(getLyXText(bv), tmp_x, tmp_y, button);
+ bool ret = false;
+ if (inset) {
+ if (isHighlyEditableInset(inset)) {
+ ret = inset->insetButtonRelease(bv, x - inset_x,
+ y - inset_y, button);
+ } else {
+ inset_x = cx(bv) - top_x + drawTextXOffset;
+ inset_y = cy(bv) + drawTextYOffset;
+ ret = inset->insetButtonRelease(bv, x - inset_x,
+ y - inset_y, button);
+ inset->edit(bv, x - inset_x,
+ y - inset_y, button);
}
+ updateLocal(bv, CURSOR_PAR, false);
}
- no_selection = false;
+ return ret;
}
///
bool updateInsetInInset(BufferView *, Inset *);
///
- void insetButtonRelease(BufferView *, int, int, int);
+ bool insetButtonRelease(BufferView *, int, int, int);
///
void insetButtonPress(BufferView *, int, int, int);
///
}
-void InsetFormulaBase::insetButtonRelease(BufferView * bv,
- int /*x*/, int /*y*/, int /*button*/)
+bool InsetFormulaBase::insetButtonRelease(BufferView * bv,
+ int /*x*/, int /*y*/, int /*button*/)
{
if (!mathcursor)
- return;
+ return false;
//lyxerr << "insetButtonRelease: " << x << " " << y << "\n";
hideInsetCursor(bv);
showInsetCursor(bv);
bv->updateInset(this, false);
+ return false;
}
///
virtual void insetButtonPress(BufferView *, int x, int y, int button);
///
- virtual void insetButtonRelease(BufferView *, int x, int y, int button);
+ virtual bool insetButtonRelease(BufferView *, int x, int y, int button);
///
virtual void insetKeyPress(XKeyEvent * ev);
///