Fixed poping up of Layout-Dialogs on Mouse-Button-3 press.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3225 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2001-12-17 13:33:22 +00:00
parent d17bd7cce9
commit bc20177045
17 changed files with 87 additions and 94 deletions

View File

@ -1,3 +1,21 @@
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

View File

@ -164,10 +164,11 @@ void UpdatableInset::insetButtonPress(BufferView *, int x, int y, int button)
}
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;
}

View File

@ -159,7 +159,12 @@ public:
/// 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) {}
///
@ -430,8 +435,12 @@ public:
///
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);
///

View File

@ -322,10 +322,11 @@ void InsetCollapsable::insetButtonPress(BufferView * bv,
}
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_) {
@ -345,8 +346,12 @@ void InsetCollapsable::insetButtonRelease(BufferView * bv,
(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;
}

View File

@ -89,7 +89,7 @@ public:
///
unsigned int insetInInsetY();
///
void insetButtonRelease(BufferView *, int, int, int);
bool insetButtonRelease(BufferView *, int, int, int);
///
void insetButtonPress(BufferView *, int, int, int);
///

View File

@ -126,6 +126,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
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()) {
@ -139,6 +140,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
lex.pushToken(token);
}
}
#endif
inset.read(buf, lex);
#ifndef INHERIT_LANG
@ -299,11 +301,11 @@ void InsetERT::insetButtonPress(BufferView * bv,
}
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) &&
@ -322,6 +324,7 @@ void InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
inset.insetButtonRelease(bv, x, yy, button);
}
}
return false;
}

View File

@ -73,7 +73,7 @@ public:
///
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);
///

View File

@ -271,26 +271,6 @@ bool InsetFloat::showInsetDialog(BufferView * bv) const
}
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_;

View File

@ -51,8 +51,6 @@ public:
///
bool insetAllowed(Inset::Code) const;
///
void insetButtonRelease(BufferView * bv, int x, int y, int button);
///
string const & type() const;
///
void placement(string const & p);

View File

@ -324,17 +324,6 @@ bool InsetMinipage::showInsetDialog(BufferView * bv) const
}
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
{

View File

@ -81,8 +81,6 @@ public:
///
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; }

View File

@ -745,6 +745,7 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
if (actrow != orow)
updateLocal(bv, NONE, false);
clearSelection();
#if 0
if (button == 3) {
if ((ocell != actcell) && the_locking_inset) {
the_locking_inset->insetUnlock(bv);
@ -753,6 +754,7 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
showInsetCursor(bv);
return;
}
#endif
bool const inset_hit = insetHit(bv, x, y);
@ -782,26 +784,17 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
}
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;
}

View File

@ -131,7 +131,7 @@ public:
///
bool display() const { return tabular->IsLongTabular(); }
///
void insetButtonRelease(BufferView *, int, int, int);
bool insetButtonRelease(BufferView *, int, int, int);
///
void insetButtonPress(BufferView *, int, int, int);
///

View File

@ -995,34 +995,32 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
}
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);
}
no_selection = false;
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);
}
return ret;
}

View File

@ -122,7 +122,7 @@ public:
///
bool updateInsetInInset(BufferView *, Inset *);
///
void insetButtonRelease(BufferView *, int, int, int);
bool insetButtonRelease(BufferView *, int, int, int);
///
void insetButtonPress(BufferView *, int, int, int);
///

View File

@ -252,15 +252,16 @@ void InsetFormulaBase::updateLocal(BufferView * bv, bool dirty)
}
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;
}

View File

@ -80,7 +80,7 @@ public:
///
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);
///