This patch implements InsetCharStyle::getStatus as suggested by Jean-Marc. 
Furthermore, it draws a visual clue when the cursor is inside the inset (see 
attached screenshot).

Regards,
Jürgen
Index: insets/insetcharstyle.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcharstyle.C,v
retrieving revision 1.26
diff -u -r1.26 insetcharstyle.C
--- insets/insetcharstyle.C	2 Nov 2004 11:25:18 -0000	1.26
+++ insets/insetcharstyle.C	4 Nov 2004 09:39:17 -0000
@@ -17,6 +17,8 @@
 #include "BufferView.h"
 #include "dispatchresult.h"
 #include "funcrequest.h"
+#include "FuncStatus.h"
+#include "cursor.h"
 #include "gettext.h"
 #include "LaTeXFeatures.h"
 #include "LColor.h"
@@ -139,6 +141,17 @@
 		pi.pain.rectText(x + (dim_.wid - w) / 2, y + desc + a,
 			params_.type, font, LColor::none, LColor::none);
 	}
+	
+	LCursor & cur = pi.base.bv->cursor();
+	if (cur.isInside(this)) {
+		y -= ascent();
+		pi.pain.line(x, y + 4, x, y, params_.labelfont.color());
+		pi.pain.line(x + 4, y, x, y, params_.labelfont.color());
+		pi.pain.line(x + dim_.wid - 2, y + 4, x + dim_.wid - 2, y, 
+			params_.labelfont.color());
+		pi.pain.line(x + dim_.wid - 6, y, x + dim_.wid - 2, y, 
+			params_.labelfont.color());
+	}
 }
 
 
@@ -158,17 +171,31 @@
 			else
 				InsetText::priv_dispatch(cur, cmd);
 			break;
+
+		default:
+			InsetCollapsable::priv_dispatch(cur, cmd);
+			break;
+	}
+}
+
+
+bool InsetCharStyle::getStatus(LCursor & cur, FuncRequest const & cmd,
+	FuncStatus & status) const
+{
+	switch (cmd.action) {
 		// supress these
 		// paragraph breaks not allowed in charstyle insets!
 		case LFUN_BREAKPARAGRAPH:
 		case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
 		case LFUN_BREAKPARAGRAPH_SKIP:
+			status.enabled(false);
 			break;
-
+			
 		default:
-			InsetCollapsable::priv_dispatch(cur, cmd);
+			InsetText::getStatus(cur, cmd, status);
 			break;
-	}
+		}
+	return true;
 }
 
 
Index: insets/insetcharstyle.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcharstyle.h,v
retrieving revision 1.8
diff -u -r1.8 insetcharstyle.h
--- insets/insetcharstyle.h	25 Mar 2004 09:16:27 -0000	1.8
+++ insets/insetcharstyle.h	4 Nov 2004 09:39:17 -0000
@@ -83,6 +83,8 @@
 protected:
 	///
 	virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
+	///
+	bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
 
 private:
 	///

<<attachment: chst.png>>

Reply via email to