Jean-Marc Lasgouttes wrote:
> Pavel Sanda <[EMAIL PROTECTED]> writes:
> 
> > fyi this is the working code, when status check is put inside
> > LyXFunc::getStatus in LyXFunc.cpp
> >
> > when i put equivalent code inside Text::getStatus in text3.cpp
> > then flag settings are ignored.
> 
> Could you show us this code?

see the attached.

> The lfun is already handled in Text::getStatus right now.

where? havent you looked into dispatch instead of getStatus ;) ?

pavel
diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp
index 88cd8c4..cd573f6 100644
--- a/src/LyXFunc.cpp
+++ b/src/LyXFunc.cpp
@@ -453,20 +453,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
 			enable = false;
 		break;
 
-	// FIXME optimally this should be in Text::getStatus. In such a case the flags
-	// are not passed when using context menu. This way it works.
-	case LFUN_SET_GRAPHICS_GROUP: {
-		if (!view())
-			break;
-		InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(view()->cursor());
-		if (!ins)
-			break;
-		if (!cmd.argument().empty())
-			flag.setOnOff(to_utf8(cmd.argument()) == ins->getParams().groupId);
-		enable = true;
-		break;
-	}
-
 	case LFUN_TOOLBAR_TOGGLE:
 	case LFUN_INSET_APPLY:
 	case LFUN_BUFFER_WRITE:
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 9479755..f243d69 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -2178,6 +2178,16 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
 		enable = (cur.pos() > cur.paragraph().beginOfBody());
 		break;
 
+	case LFUN_SET_GRAPHICS_GROUP: {
+		InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(cur);
+		if (!ins)
+			break;
+		if (!cmd.argument().empty())
+			flag.setOnOff(to_utf8(cmd.argument()) == ins->getParams().groupId);
+		enable = true;
+		break;
+	}
+
 	case LFUN_WORD_DELETE_FORWARD:
 	case LFUN_WORD_DELETE_BACKWARD:
 	case LFUN_LINE_DELETE:

Reply via email to