mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-13 20:09:59 +00:00
fix bug 2126 (references in math)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10616 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8dd52d17f1
commit
2fdc606248
@ -1,3 +1,17 @@
|
||||
2005-11-15 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* command_inset.[Ch] (editXY): implement, since MathNestInset::editXY
|
||||
loops through the cells and that is not possible here because they are
|
||||
not visible
|
||||
* math_hullinset.C (getStatus): allow reference and label in
|
||||
LFUN_INSET_INSERT
|
||||
* math_hullinset.C (doDispatch): create ref inset in LFUN_INSET_INSERT
|
||||
* math_nestinset.C (doDispatch): allow references
|
||||
* math_nestinset.C (doDispatch): remove never reached code for
|
||||
LFUN_INSET_APPLY
|
||||
* ref_inset.[Ch] (getStatus): implement, otherwise we'll trigger an
|
||||
assertion in LyXFunc::getStatus
|
||||
|
||||
2005-11-08 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* math_parser.C (delEmptyLastRow): Don't delete the dummy row, but
|
||||
|
@ -47,6 +47,13 @@ void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
}
|
||||
|
||||
|
||||
InsetBase * CommandInset::editXY(LCursor & cur, int x, int y)
|
||||
{
|
||||
edit(cur, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
void CommandInset::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
button_.draw(pi, x, y);
|
||||
|
@ -28,6 +28,8 @@ public:
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
InsetBase * editXY(LCursor &, int, int);
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
//
|
||||
// void infoize(std::ostream & os) const;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "math_colorinset.h"
|
||||
#include "math_data.h"
|
||||
#include "math_extern.h"
|
||||
#include "math_factory.h"
|
||||
#include "math_hullinset.h"
|
||||
#include "math_mathmlstream.h"
|
||||
#include "math_streamstr.h"
|
||||
@ -1075,7 +1076,14 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
cur.bv().buffer()->changeRefsIfUnique(old, str);
|
||||
label(r, str);
|
||||
}
|
||||
break;
|
||||
}
|
||||
MathArray ar;
|
||||
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
|
||||
recordUndo(cur);
|
||||
cur.insert(ar);
|
||||
} else
|
||||
cur.undispatched();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1138,6 +1146,15 @@ bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_INSERT_LABEL:
|
||||
status.enabled(type_ != "simple");
|
||||
return true;
|
||||
case LFUN_INSET_INSERT: {
|
||||
// Don't test createMathInset_fromDialogStr(), since
|
||||
// getStatus is not called with a valid reference and the
|
||||
// dialog would not be applyable.
|
||||
string const name = cmd.getArg(0);
|
||||
status.enabled(name == "ref" ||
|
||||
(name == "label" && type_ != "simple"));
|
||||
break;
|
||||
}
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
istringstream is(cmd.argument);
|
||||
string s;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "math_symbolinset.h"
|
||||
#include "math_support.h"
|
||||
#include "math_unknowninset.h"
|
||||
#include "ref_inset.h"
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "CutAndPaste.h"
|
||||
@ -56,7 +57,6 @@
|
||||
using lyx::cap::copySelection;
|
||||
using lyx::cap::grabAndEraseSelection;
|
||||
using lyx::cap::cutSelection;
|
||||
using lyx::cap::pasteSelection;
|
||||
using lyx::cap::replaceSelection;
|
||||
using lyx::cap::selClearOrDel;
|
||||
|
||||
@ -885,34 +885,14 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
||||
string const & name = cmd.argument;
|
||||
string data;
|
||||
#if 0
|
||||
if (name == "ref") {
|
||||
RefInset tmp(name);
|
||||
data = tmp.createDialogStr(name);
|
||||
}
|
||||
#endif
|
||||
cur.bv().owner()->getDialogs().show(name, data, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_INSET_APPLY: {
|
||||
string const name = cmd.getArg(0);
|
||||
InsetBase * base = cur.bv().owner()->getDialogs().getOpenInset(name);
|
||||
|
||||
if (base) {
|
||||
FuncRequest fr(LFUN_INSET_MODIFY, cmd.argument);
|
||||
base->dispatch(cur, fr);
|
||||
break;
|
||||
}
|
||||
MathArray ar;
|
||||
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
|
||||
cur.insert(ar);
|
||||
break;
|
||||
}
|
||||
cur.undispatched();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
MathDimInset::doDispatch(cur, cmd);
|
||||
break;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "cursor.h"
|
||||
#include "debug.h"
|
||||
#include "funcrequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "gettext.h"
|
||||
#include "math_data.h"
|
||||
#include "math_factory.h"
|
||||
@ -70,6 +71,14 @@ void RefInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
cur.undispatched();
|
||||
break;
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE: {
|
||||
string const data = createDialogStr("ref");
|
||||
if (cur.bv().owner()->getDialogs().visible("ref"))
|
||||
cur.bv().owner()->getDialogs().update("ref", data);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_INSET_DIALOG_SHOW:
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
if (cmd.button() == mouse_button::button3) {
|
||||
lyxerr << "trying to goto ref '" << asString(cell(0)) << "'" << endl;
|
||||
@ -97,6 +106,25 @@ void RefInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
|
||||
|
||||
bool RefInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & status) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
// we handle these
|
||||
case LFUN_INSET_MODIFY:
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
case LFUN_INSET_DIALOG_SHOW:
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
case LFUN_MOUSE_PRESS:
|
||||
case LFUN_MOUSE_MOTION:
|
||||
status.enabled(true);
|
||||
return true;
|
||||
default:
|
||||
return CommandInset::getStatus(cur, cmd, status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string const RefInset::screenLabel() const
|
||||
{
|
||||
string str;
|
||||
|
@ -55,7 +55,10 @@ public:
|
||||
///
|
||||
static std::string const & getName(int type);
|
||||
protected:
|
||||
///
|
||||
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
|
||||
private:
|
||||
///
|
||||
virtual std::auto_ptr<InsetBase> doClone() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user