Am Dienstag, 30. November 2004 12:04 schrieb Georg Baum:
> Unfortunately the problem you tried to solve with the first patch is 
back
> :-((
> 
> - create new document
> - M-N
> 
> -> No status message "command disabled"

And I know now why: the statement

flag = view()->getStatus(cmd);

in LyXFunc::getStatus() cleared the message. I added it a second time (not 
very elegant, but I know no better solution). Is the attached patch ok?


Georg
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/ChangeLog lyx-1.4-cvs/src/ChangeLog
--- lyx-1.4-clean/src/ChangeLog	2004-11-30 18:44:21.000000000 +0100
+++ lyx-1.4-cvs/src/ChangeLog	2004-11-30 21:49:37.000000000 +0100
@@ -1,3 +1,49 @@
+2004-11-30  Georg Baum  <[EMAIL PROTECTED]>
+
+	* cursor.h (getStatus): add better comment from src/cursor.C
+	* lyxfunc.C (getStatus): set error message a second time for disabled
+	lfuns
+
 2004-11-29  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* broken_headers.h: remove
@@ -21,7 +67,7 @@
 
 	* bufferview_funcs.[Ch]: introduce coordOffset, getPos, status,
 	CurStatus enum.
-  	
+
 	* coordcache.[Ch]: add paragraph cache and helpers
 
 	* CursorSlice.[Ch]: rename CursorSlice::par to CursorSlice::pit,
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/cursor.h lyx-1.4-cvs/src/cursor.h
--- lyx-1.4-clean/src/cursor.h	2004-11-30 18:44:29.000000000 +0100
+++ lyx-1.4-cvs/src/cursor.h	2004-11-30 20:46:45.000000000 +0100
@@ -42,7 +42,12 @@ public:
 	void dispatch(FuncRequest const & cmd);
 	/// get the resut of the last dispatch
 	DispatchResult result() const;
-	/// are we willing to handle this event?
+        /**
+	 * \returns true if this function made a definitive decision on
+	 * whether the inset at this cursor position wants to handle the
+	 * request \p cmd or not. The result of this decision is put into
+	 * \p status.
+	 */
 	bool getStatus(FuncRequest const & cmd, FuncStatus & flag);
 
 	/// add a new cursor slice
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/insets/ChangeLog lyx-1.4-cvs/src/insets/ChangeLog
--- lyx-1.4-clean/src/insets/ChangeLog	2004-11-30 18:45:05.000000000 +0100
+++ lyx-1.4-cvs/src/insets/ChangeLog	2004-11-30 11:28:00.000000000 +0100
@@ -1,3 +1,7 @@
+2004-11-30  Georg Baum  <[EMAIL PROTECTED]>
+
+	* insetbase.h (getStatus): add better comment from src/cursor.C
+
 2004-11-26  Alfredo Braunstein  <[EMAIL PROTECTED]>
 
 	* insettabular.[Ch]: adjust, introduce "do not draw
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/insets/insetbase.h lyx-1.4-cvs/src/insets/insetbase.h
--- lyx-1.4-clean/src/insets/insetbase.h	2004-11-30 18:45:05.000000000 +0100
+++ lyx-1.4-cvs/src/insets/insetbase.h	2004-11-30 20:45:25.000000000 +0100
@@ -79,9 +83,13 @@ public:
 	/// true for 'math' math inset, but not for e.g. mbox
 	virtual bool inMathed() const { return false; }
 
-	// the real dispatcher
+	/// the real dispatcher
 	void dispatch(LCursor & cur, FuncRequest & cmd);
-	/// do we want to handle this event?
+	/**
+	 * \returns true if this function made a definitive decision on
+	 * whether the inset wants to handle the request \p cmd or not.
+	 * The result of this decision is put into \p status.
+	 */
 	virtual bool getStatus(LCursor & cur, FuncRequest const & cmd,
 		FuncStatus & status) const;
 
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/lyxfunc.C lyx-1.4-cvs/src/lyxfunc.C
--- lyx-1.4-clean/src/lyxfunc.C	2004-11-30 18:44:36.000000000 +0100
+++ lyx-1.4-cvs/src/lyxfunc.C	2004-11-30 22:03:35.000000000 +0100
@@ -309,7 +309,8 @@ FuncStatus LyXFunc::getStatus(FuncReques
 	}
 
 	// the default error message if we disable the command
-	flag.message(N_("Command disabled"));
+	if (!flag.message().empty())
+		flag.message(N_("Command disabled"));
 	if (!flag.enabled())
 		return flag;
 
@@ -537,6 +538,10 @@ FuncStatus LyXFunc::getStatus(FuncReques
 		flag.enabled(false);
 	}
 
+	// the default error message if we disable the command
+	if (!flag.enabled() && flag.message().empty())
+		flag.message(N_("Command disabled"));
+
 	//lyxerr << "LyXFunc::getStatus: got: " << flag.enabled() << endl;
 	return flag;
 }

Reply via email to