git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6973 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-05-16 14:48:33 +00:00
parent df05987d84
commit 356e26b3c1
6 changed files with 40 additions and 59 deletions

View File

@ -1,4 +1,9 @@
2003-05-16 André Pönitz <poenitz@gmx.net>
* insetcommand.C:
* insetminimpage.[Ch]:
* insetcollapsable.[Ch]: fix #832
2003-05-16 André Pönitz <poenitz@gmx.net>

View File

@ -231,9 +231,7 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
Inset::EDITABLE InsetCollapsable::editable() const
{
if (collapsed_)
return IS_EDITABLE;
return HIGHLY_EDITABLE;
return collapsed_ ? IS_EDITABLE : HIGHLY_EDITABLE;
}
@ -256,31 +254,36 @@ void InsetCollapsable::insetUnlock(BufferView * bv)
}
void InsetCollapsable::lfunMousePress(FuncRequest const & cmd)
FuncRequest InsetCollapsable::adjustCommand(FuncRequest const & cmd)
{
if (!collapsed_ && (cmd.y > button_bottom_y)) {
LyXFont font(LyXFont::ALL_SANE);
FuncRequest cmd1 = cmd;
cmd1.y = ascent(cmd.view(), font) + cmd.y -
(ascent_collapsed() +
descent_collapsed() +
inset.ascent(cmd.view(), font));
inset.localDispatch(cmd1);
}
return cmd1;
}
bool InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
{
bool ret = false;
BufferView * bv = cmd.view();
if (collapsed_ && cmd.button() != mouse_button::button3) {
collapsed_ = false;
inset.setUpdateStatus(bv, InsetText::FULL);
bv->updateInset(this);
bv->buffer()->markDirty();
return;
}
if ((cmd.button() != mouse_button::button3) && (cmd.x < button_length) &&
(cmd.y >= button_top_y) && (cmd.y <= button_bottom_y))
{
if (collapsed_) {
collapsed_ = false;
// should not be called on inset open!
// inset.insetButtonRelease(bv, 0, 0, button);
inset.setUpdateStatus(bv, InsetText::FULL);
bv->updateInset(this);
bv->buffer()->markDirty();
@ -291,31 +294,10 @@ bool InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
bv->buffer()->markDirty();
}
} else if (!collapsed_ && (cmd.y > button_bottom_y)) {
LyXFont font(LyXFont::ALL_SANE);
FuncRequest cmd1 = cmd;
cmd1.y = ascent(cmd.view(), font) + cmd.y -
(ascent_collapsed() +
descent_collapsed() +
inset.ascent(cmd.view(), font));
ret = (inset.localDispatch(cmd1) == DISPATCHED);
ret = (inset.localDispatch(adjustCommand(cmd)) == DISPATCHED);
}
if (cmd.button() == mouse_button::button3 && !ret)
return showInsetDialog(bv);
return ret;
}
void InsetCollapsable::lfunMouseMotion(FuncRequest const & cmd)
{
if (cmd.y > button_bottom_y) {
LyXFont font(LyXFont::ALL_SANE);
FuncRequest cmd1 = cmd;
cmd1.y = ascent(cmd.view(), font) + cmd.y -
(ascent_collapsed() +
descent_collapsed() +
inset.ascent(cmd.view(), font));
inset.localDispatch(cmd1);
}
showInsetDialog(bv);
}
@ -363,6 +345,7 @@ void InsetCollapsable::update(BufferView * bv, bool reinit)
Inset::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
{
//lyxerr << "InsetCollapsable::localDispatch: " << cmd.action << "\n";
BufferView * bv = cmd.view();
switch (cmd.action) {
case LFUN_INSET_EDIT: {
@ -421,11 +404,13 @@ Inset::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
}
case LFUN_MOUSE_PRESS:
lfunMousePress(cmd);
if (!collapsed_ && cmd.y > button_bottom_y)
inset.localDispatch(adjustCommand(cmd));
return DISPATCHED;
case LFUN_MOUSE_MOTION:
lfunMouseMotion(cmd);
if (!collapsed_ && cmd.y > button_bottom_y)
inset.localDispatch(adjustCommand(cmd));
return DISPATCHED;
case LFUN_MOUSE_RELEASE:

View File

@ -17,6 +17,7 @@
#include "inset.h"
#include "insettext.h"
#include "lyxfont.h"
#include "funcrequest.h" // for adjustCommand
#include "LColor.h"
#include <boost/weak_ptr.hpp>
@ -212,11 +213,9 @@ protected:
private:
///
void lfunMousePress(FuncRequest const &);
void lfunMouseRelease(FuncRequest const &);
///
bool lfunMouseRelease(FuncRequest const &);
///
void lfunMouseMotion(FuncRequest const &);
FuncRequest adjustCommand(FuncRequest const &);
///
mutable string label;

View File

@ -67,7 +67,7 @@ int InsetCommand::docbook(Buffer const *, ostream &, bool) const
dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
{
lyxerr << "insetCommand::localDispatch\n";
lyxerr << "InsetCommand::localDispatch: " << cmd.action << "\n";
switch (cmd.action) {
case LFUN_INSET_MODIFY: {
InsetCommandParams p;

View File

@ -107,8 +107,6 @@ InsetMinipage::~InsetMinipage()
dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
{
Inset::RESULT result = UNDISPATCHED;
switch (cmd.action) {
case LFUN_INSET_MODIFY: {
InsetMinipage::Params params;
@ -125,21 +123,16 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
inset.update(cmd.view(), true);
t->setCursorIntern(t->cursor.par(), t->cursor.pos());
cmd.view()->updateInset(this);
result = DISPATCHED;
return DISPATCHED;
}
break;
case LFUN_INSET_DIALOG_UPDATE: {
InsetMinipageMailer mailer(*this);
mailer.updateDialog(cmd.view());
}
break;
case LFUN_INSET_DIALOG_UPDATE:
InsetMinipageMailer(*this).updateDialog(cmd.view());
return DISPATCHED;
default:
result = InsetCollapsable::localDispatch(cmd);
return InsetCollapsable::localDispatch(cmd);
}
return result;
}

View File

@ -13,7 +13,6 @@
#ifndef INSETMINIPAGE_H
#define INSETMINIPAGE_H
#include "insetcollapsable.h"
#include "lyxlength.h"