Jean-Marc Lasgouttes wrote:
> And what about moving this from BufferView (which is for all
> highly editable insets == text+math) to Text3.cpp (which is only for text)?

Like this?

Jürgen
Index: src/BufferView.cpp
===================================================================
--- src/BufferView.cpp	(Revision 21446)
+++ src/BufferView.cpp	(Arbeitskopie)
@@ -49,7 +49,6 @@
 #include "ParagraphParameters.h"
 #include "ParIterator.h"
 #include "TexRow.h"
-#include "toc.h"
 #include "Undo.h"
 #include "VSpace.h"
 #include "WordLangTuple.h"
@@ -645,11 +644,6 @@
 	case LFUN_FONT_STATE:
 	case LFUN_LABEL_INSERT:
 	case LFUN_PARAGRAPH_GOTO:
-	// FIXME handle non-trivially
-	case LFUN_OUTLINE_UP:
-	case LFUN_OUTLINE_DOWN:
-	case LFUN_OUTLINE_IN:
-	case LFUN_OUTLINE_OUT:
 	case LFUN_NOTE_NEXT:
 	case LFUN_REFERENCE_NEXT:
 	case LFUN_WORD_FIND:
@@ -820,25 +814,6 @@
 		break;
 	}
 
-	case LFUN_OUTLINE_UP:
-		toc::outline(toc::Up, cursor_);
-		cursor_.text()->setCursor(cursor_, cursor_.pit(), 0);
-		updateLabels(*buffer_);
-		break;
-	case LFUN_OUTLINE_DOWN:
-		toc::outline(toc::Down, cursor_);
-		cursor_.text()->setCursor(cursor_, cursor_.pit(), 0);
-		updateLabels(*buffer_);
-		break;
-	case LFUN_OUTLINE_IN:
-		toc::outline(toc::In, cursor_);
-		updateLabels(*buffer_);
-		break;
-	case LFUN_OUTLINE_OUT:
-		toc::outline(toc::Out, cursor_);
-		updateLabels(*buffer_);
-		break;
-
 	case LFUN_NOTE_NEXT:
 		bv_funcs::gotoInset(this, Inset::NOTE_CODE, false);
 		break;
Index: src/Text3.cpp
===================================================================
--- src/Text3.cpp	(Revision 21446)
+++ src/Text3.cpp	(Arbeitskopie)
@@ -44,6 +44,7 @@
 #include "Paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
+#include "toc.h"
 #include "Undo.h"
 #include "VSpace.h"
 #include "ParIterator.h"
@@ -1605,6 +1606,36 @@
 		}
 		break;
 
+	case LFUN_OUTLINE_UP: {
+		toc::outline(toc::Up, cur);
+		setCursor(cur, cur.pit(), 0);
+		updateLabels(cur.buffer());
+		needsUpdate = true;
+		break;
+	}
+
+	case LFUN_OUTLINE_DOWN: {
+		toc::outline(toc::Down, cur);
+		setCursor(cur, cur.pit(), 0);
+		updateLabels(cur.buffer());
+		needsUpdate = true;
+		break;
+	}
+
+	case LFUN_OUTLINE_IN: {
+		toc::outline(toc::In, cur);
+		updateLabels(cur.buffer());
+		needsUpdate = true;
+		break;
+	}
+
+	case LFUN_OUTLINE_OUT: {
+		toc::outline(toc::Out, cur);
+		updateLabels(cur.buffer());
+		needsUpdate = true;
+		break;
+	}
+
 	default:
 		LYXERR(Debug::ACTION)
 			<< BOOST_CURRENT_FUNCTION
@@ -1919,6 +1950,13 @@
 		enable = true;
 		break;
 
+	case LFUN_OUTLINE_UP:
+	case LFUN_OUTLINE_DOWN:
+	case LFUN_OUTLINE_IN:
+	case LFUN_OUTLINE_OUT:
+		enable = (cur.innerParagraph().layout()->toclevel != Layout::NOT_IN_TOC);
+		break;
+
 	case LFUN_WORD_DELETE_FORWARD:
 	case LFUN_WORD_DELETE_BACKWARD:
 	case LFUN_LINE_DELETE:

Reply via email to