Personally, as a reasonably heavy math use, I'd hate to have a windows
cluttered by differently colored insets all over.

You will not, because I will propose a background color that is the
same as buttonbg; and if you are willing to go a step further, the
attached patch implements mathhoverbg (the same as buttonhoverbg) so
mathed will have the same hover behavior as InsetCommand.

Try it yourself and let me know if you like it.

Bo
Index: src/Color.h
===================================================================
--- src/Color.h	(revision 18674)
+++ src/Color.h	(working copy)
@@ -121,6 +121,8 @@
 		math,
 		/// Math inset background color
 		mathbg,
+		/// Math inset background color under focus
+		mathhoverbg,
 		/// Macro math inset background color
 		mathmacrobg,
 		/// Math inset frame color under focus
Index: src/mathed/InsetMathHull.cpp
===================================================================
--- src/mathed/InsetMathHull.cpp	(revision 18674)
+++ src/mathed/InsetMathHull.cpp	(working copy)
@@ -159,7 +159,7 @@
 
 InsetMathHull::InsetMathHull()
 	: InsetMathGrid(1, 1), type_(hullNone), nonum_(1), label_(1),
-	  preview_(new RenderPreview(this))
+	  preview_(new RenderPreview(this)), mouse_hover_(false)
 {
 	//lyxerr << "sizeof InsetMath: " << sizeof(InsetMath) << endl;
 	//lyxerr << "sizeof MetricsInfo: " << sizeof(MetricsInfo) << endl;
@@ -172,7 +172,7 @@
 
 InsetMathHull::InsetMathHull(HullType type)
 	: InsetMathGrid(getCols(type), 1), type_(type), nonum_(1), label_(1),
-	  preview_(new RenderPreview(this))
+	  preview_(new RenderPreview(this)), mouse_hover_(false)
 {
 	initMath();
 	setDefaults();
@@ -182,7 +182,7 @@
 InsetMathHull::InsetMathHull(InsetMathHull const & other)
 	: InsetMathGrid(other),
 	  type_(other.type_), nonum_(other.nonum_), label_(other.label_),
-	  preview_(new RenderPreview(this))
+	  preview_(new RenderPreview(this)), mouse_hover_(false)
 {}
 
 
@@ -205,6 +205,7 @@
 	nonum_ = other.nonum_;
 	label_ = other.label_;
 	preview_.reset(new RenderPreview(*other.preview_, this));
+	mouse_hover_ = false;
 
 	return *this;
 }
@@ -333,6 +334,13 @@
 }
 
 
+bool InsetMathHull::setMouseHover(bool mouse_hover)
+{
+	mouse_hover_ = mouse_hover;
+	return true;
+}
+
+
 void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
 {
 	use_preview_ = previewState(pi.base.bv);
@@ -341,7 +349,8 @@
 	// selection at the top level of nested inset is difficult to handle.
 	if (!editing(pi.base.bv))
 		pi.pain.fillRectangle(x + 1, y - ascent() + 1, width() - 2,
-				ascent() + descent() - 1, Color::mathbg);
+				ascent() + descent() - 1, 
+				mouse_hover_ ? Color::mathhoverbg : Color::mathbg);
 
 	if (use_preview_) {
 		// one pixel gap in front
Index: src/mathed/InsetMathHull.h
===================================================================
--- src/mathed/InsetMathHull.h	(revision 18674)
+++ src/mathed/InsetMathHull.h	(working copy)
@@ -121,6 +121,9 @@
 	///
 	static int displayMargin() { return 12; }
 
+	///
+	bool setMouseHover(bool mouse_hover);
+
 protected:
 	InsetMathHull(InsetMathHull const &);
 
@@ -183,6 +186,8 @@
 	boost::scoped_ptr<RenderPreview> preview_;
 	///
 	mutable bool use_preview_;
+	///
+	bool mouse_hover_;
 //
 // Incorporate me
 //
Index: src/Color.cpp
===================================================================
--- src/Color.cpp	(revision 18674)
+++ src/Color.cpp	(working copy)
@@ -294,7 +294,8 @@
 	{ commandframe, N_("command inset frame"), "commandframe", "black", "commandframe" },
 	{ special, N_("special character"), "special", "RoyalBlue", "special" },
 	{ math, N_("math"), "math", "DarkBlue", "math" },
-	{ mathbg, N_("math background"), "mathbg", "linen", "mathbg" },
+	{ mathbg, N_("math background"), "mathbg", "#dcd2c8", "mathbg" },
+	{ mathhoverbg, N_("math background under focus"), "mathhoverbg", "#C7C7CA", "mathhoverbg" },
 	{ graphicsbg, N_("graphics background"), "graphicsbg", "linen", "graphicsbg" },
 	{ mathmacrobg, N_("Math macro background"), "mathmacrobg", "linen", "mathmacrobg" },
 	{ mathframe, N_("math frame"), "mathframe", "Magenta", "mathframe" },

Reply via email to