+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
}
+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);
///
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;
#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"
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;
}
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;
#include "math_symbolinset.h"
#include "math_support.h"
#include "math_unknowninset.h"
+#include "ref_inset.h"
#include "BufferView.h"
#include "CutAndPaste.h"
using lyx::cap::copySelection;
using lyx::cap::grabAndEraseSelection;
using lyx::cap::cutSelection;
-using lyx::cap::pasteSelection;
using lyx::cap::replaceSelection;
using lyx::cap::selClearOrDel;
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;
#include "cursor.h"
#include "debug.h"
#include "funcrequest.h"
+#include "FuncStatus.h"
#include "gettext.h"
#include "math_data.h"
#include "math_factory.h"
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;
}
+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;
///
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;