Re: [PATCH][RFC] Make "devel mode" configurable at run time

2017-07-24 Thread Jean-Marc Lasgouttes

Le 24/07/2017 à 21:17, Jean-Marc Lasgouttes a écrit :

Le 24/07/2017 à 18:16, Jean-Marc Lasgouttes a écrit :

I could do that indeed. I'll propose another iteration.


Here it is. I also removed all traces of (LYX_)DEVEL_VERSION in cmake. 
Kornel, does it look OK?


Can I apply this?


I put it in.

JMarc


Re: [PATCH][RFC] Make "devel mode" configurable at run time

2017-07-24 Thread Kornel Benko
Am Montag, 24. Juli 2017 um 22:00:06, schrieb Jean-Marc Lasgouttes 

> Le 24/07/2017 à 21:38, Kornel Benko a écrit :
> > Looks OK for cmake. I miss the patch of config.h.in (for automake)
> 
> This one is autogenerated by autoheader (as is written at the top) and 
> not in the git repo.
> 
> JMarc

Yes, I should have git-checked.

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: [PATCH][RFC] Make "devel mode" configurable at run time

2017-07-24 Thread Jean-Marc Lasgouttes

Le 24/07/2017 à 21:38, Kornel Benko a écrit :

Looks OK for cmake. I miss the patch of config.h.in (for automake)


This one is autogenerated by autoheader (as is written at the top) and 
not in the git repo.


JMarc



Re: [PATCH][RFC] Make "devel mode" configurable at run time

2017-07-24 Thread Kornel Benko
Am Montag, 24. Juli 2017 um 21:17:10, schrieb Jean-Marc Lasgouttes 

> Le 24/07/2017 à 18:16, Jean-Marc Lasgouttes a écrit :
> > I could do that indeed. I'll propose another iteration.
> 
> Here it is. I also removed all traces of (LYX_)DEVEL_VERSION in cmake. 
> Kornel, does it look OK?
> 
> Can I apply this?
> 
> JMarc
> 

Looks OK for cmake. I miss the patch of config.h.in (for automake)

Kornel

signature.asc
Description: This is a digitally signed message part.


Re: [PATCH][RFC] Make "devel mode" configurable at run time

2017-07-24 Thread Jean-Marc Lasgouttes

Le 24/07/2017 à 18:16, Jean-Marc Lasgouttes a écrit :

I could do that indeed. I'll propose another iteration.


Here it is. I also removed all traces of (LYX_)DEVEL_VERSION in cmake. 
Kornel, does it look OK?


Can I apply this?

JMarc



>From 18da500ecfdd70fea22bc385ab1a68fc57818633 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Mon, 24 Jul 2017 00:21:43 +0200
Subject: [PATCH] Make "devel mode" configurable at run time

Traditionally LyX behaves differently when the directive DEVEL_VERSION
is defined at compile time. This covers
* more detailed description of current position in status bar
* the help files are open in read/write mode
* more detailed debug output in the View Source panel

This patch introduces the new function devel-mode-toggle that allows
to use devel mode in stable releases, and vice versa.

The information is saved in the session file. The default is to
disable devel mode.

Remove all traces of DEVEL_VERSION in autoconf and cmake
---
 CMakeLists.txt |  1 -
 INSTALL.cmake  |  1 -
 config/lyxinclude.m4   |  1 -
 development/cmake/TODO.txt |  2 --
 development/cmake/config.h.cmake   |  6 --
 src/BufferView.cpp |  2 +-
 src/Cursor.cpp | 23 ---
 src/Cursor.h   |  4 ++--
 src/FuncCode.h |  1 +
 src/LyXAction.cpp  | 13 +
 src/Text.cpp   | 34 +-
 src/Text.h |  4 ++--
 src/frontends/qt4/GuiApplication.cpp   |  7 +--
 src/frontends/qt4/GuiCommandBuffer.cpp |  6 --
 src/frontends/qt4/GuiCommandBuffer.h   |  3 ---
 src/frontends/qt4/GuiView.cpp  | 18 --
 src/frontends/qt4/GuiView.h|  5 +
 src/frontends/qt4/GuiViewSource.cpp| 27 ++-
 src/mathed/InsetMathHull.cpp   |  2 +-
 19 files changed, 85 insertions(+), 75 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c737c7ba2..7490545c1d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,7 +117,6 @@ LYX_OPTION(REQUIRE_SPELLCHECK "Abort if no spellchecker available" OFF ALL)
 LYX_OPTION(ASPELL   "Require aspell" OFF ALL)
 LYX_OPTION(ENCHANT  "Require Enchant" OFF ALL)
 LYX_OPTION(HUNSPELL "Require Hunspell" OFF ALL)
-LYX_OPTION(DEVEL_VERSION"Build developer version" OFF ALL)
 LYX_OPTION(RELEASE  "Build release version, build debug when disabled" OFF ALL)
 LYX_OPTION(DEBUG"Enforce debug build"  OFF ALL)
 LYX_OPTION(NO_OPTIMIZE  "Don't use any optimization/debug flags"  OFF ALL)
diff --git a/INSTALL.cmake b/INSTALL.cmake
index ffe5866b00..4c8d4789f3 100644
--- a/INSTALL.cmake
+++ b/INSTALL.cmake
@@ -141,7 +141,6 @@ Build options
 -- LYX_ASPELL   = OFF: Require aspell
 -- LYX_ENCHANT  = OFF: Require Enchant
 -- LYX_HUNSPELL = OFF: Require Hunspell
--- LYX_DEVEL_VERSION= OFF: Build developer version
 -- LYX_RELEASE  = OFF: Build release version, build debug when disabled
 -- LYX_PACKAGE_SUFFIX   = ON : Use version suffix for packaging
 -- LYX_PCH  = OFF: Use precompiled headers
diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4
index b07bf38f24..ead704b166 100644
--- a/config/lyxinclude.m4
+++ b/config/lyxinclude.m4
@@ -33,7 +33,6 @@ AC_MSG_RESULT([$build_type])
 lyx_flags="$lyx_flags build=$build_type"
 case $build_type in
 development) lyx_devel_version=yes
- AC_DEFINE(DEVEL_VERSION, 1, [Define if you are building a development version of LyX])
 		 LYX_DATE="not released yet" ;;
 prerelease) lyx_prerelease=yes ;;
 esac
diff --git a/development/cmake/TODO.txt b/development/cmake/TODO.txt
index 45c1e0df84..32cf54b292 100644
--- a/development/cmake/TODO.txt
+++ b/development/cmake/TODO.txt
@@ -26,8 +26,6 @@ Bug fixing
 
 Documentation
   * Better documentation, variable naming, more automake-like
-  * what does LYX_DEVEL_VERSION do?
-  * What is the difference with LYX_RELEASE=OFF?
   * how do I specify whether I want debug informations (-g flag) for unix?
 
 
diff --git a/development/cmake/config.h.cmake b/development/cmake/config.h.cmake
index f0a504a81a..7fac0b00b5 100644
--- a/development/cmake/config.h.cmake
+++ b/development/cmake/config.h.cmake
@@ -24,12 +24,6 @@
 #endif
 
 
-#cmakedefine LYX_DEVEL_VERSION 1
-#if defined(LYX_DEVEL_VERSION)
-	#define DEVEL_VERSION 1
-#else
-	#undef DEVEL_VERSION
-#endif
 #cmakedefine PACKAGE "${PACKAGE}"
 #cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}"
 #define PACKAGE_STRING "LyX ${PACKAGE_VERSION}"
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 2f256369f6..03e7723fd1 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1391,7 +1391,7 @@ void 

Re: [PATCH][RFC] Make "devel mode" configurable at run time

2017-07-24 Thread Jean-Marc Lasgouttes

Le 24/07/2017 à 17:40, Guillaume MM a écrit :

The information is saved in the session file. Only the default value
depends on the compile-time #define.


It makes sense to me to entirely remove the compile-time switch.


I could do that indeed. I'll propose another iteration.

JMarc


Re: [PATCH][RFC] Make "devel mode" configurable at run time

2017-07-24 Thread Guillaume MM

Le 24/07/2017 à 16:23, Jean-Marc Lasgouttes a écrit :

Hi,

Anyone against putting this in master?

JMarc


0001-Make-devel-mode-configurable-at-run-time.patch


 From 5488f8f06eae75bf2265e88a344be246130b9ada Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes
Date: Mon, 24 Jul 2017 00:21:43 +0200
Subject: [PATCH] Make "devel mode" configurable at run time

Traditionally LyX behaves differently when the directive DEVEL_VERSION
is defined at compile time. This covers
* more detailed description of current position in status bar
* the help files are open in read/write mode
* more detailed debug output in the View Source panel

This patch introduces the new function devel-mode-toggle that allows
to use devel mode in stable releases, and vice versa.


Sounds good.



The information is saved in the session file. Only the default value
depends on the compile-time #define.


It makes sense to me to entirely remove the compile-time switch.

Guillaume



[PATCH][RFC] Make "devel mode" configurable at run time

2017-07-24 Thread Jean-Marc Lasgouttes

Hi,

Anyone against putting this in master?

JMarc

>From 5488f8f06eae75bf2265e88a344be246130b9ada Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Mon, 24 Jul 2017 00:21:43 +0200
Subject: [PATCH] Make "devel mode" configurable at run time

Traditionally LyX behaves differently when the directive DEVEL_VERSION
is defined at compile time. This covers
* more detailed description of current position in status bar
* the help files are open in read/write mode
* more detailed debug output in the View Source panel

This patch introduces the new function devel-mode-toggle that allows
to use devel mode in stable releases, and vice versa.

The information is saved in the session file. Only the default value
depends on the compile-time #define.
---
 src/BufferView.cpp |  2 +-
 src/Cursor.cpp | 23 ---
 src/Cursor.h   |  4 ++--
 src/FuncCode.h |  1 +
 src/LyXAction.cpp  | 13 +
 src/Text.cpp   | 34 +-
 src/Text.h |  4 ++--
 src/frontends/qt4/GuiApplication.cpp   |  7 +--
 src/frontends/qt4/GuiCommandBuffer.cpp |  6 --
 src/frontends/qt4/GuiCommandBuffer.h   |  3 ---
 src/frontends/qt4/GuiView.cpp  | 28 +---
 src/frontends/qt4/GuiView.h|  5 +
 src/frontends/qt4/GuiViewSource.cpp| 27 ++-
 src/mathed/InsetMathHull.cpp   |  2 +-
 14 files changed, 94 insertions(+), 65 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 2f256369f6..03e7723fd1 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1391,7 +1391,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 		break;
 
 	case LFUN_FONT_STATE:
-		dr.setMessage(cur.currentState());
+		dr.setMessage(cur.currentState(false));
 		break;
 
 	case LFUN_BOOKMARK_SAVE:
diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index 1223782c35..b99ab6cb53 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -1057,7 +1057,7 @@ void Cursor::updateTextTargetOffset()
 }
 
 
-void Cursor::info(odocstream & os) const
+void Cursor::info(odocstream & os, bool devel_mode) const
 {
 	for (int i = 1, n = depth(); i < n; ++i) {
 		operator[](i).inset().infoize(os);
@@ -1069,6 +1069,14 @@ void Cursor::info(odocstream & os) const
 		if (inset)
 			prevInset()->infoize2(os);
 	}
+	if (devel_mode) {
+		InsetMath * math = inset().asInsetMath();
+		if (math)
+			os << _(", Inset: ") << math->id();
+		os << _(", Cell: ") << idx();
+		os << _(", Position: ") << pos();
+	}
+
 }
 
 
@@ -2106,23 +2114,16 @@ docstring Cursor::selectionAsString(bool with_label) const
 }
 
 
-docstring Cursor::currentState() const
+docstring Cursor::currentState(bool devel_mode) const
 {
 	if (inMathed()) {
 		odocstringstream os;
-		info(os);
-#ifdef DEVEL_VERSION
-		InsetMath * math = inset().asInsetMath();
-		if (math)
-			os << _(", Inset: ") << math->id();
-		os << _(", Cell: ") << idx();
-		os << _(", Position: ") << pos();
-#endif
+		info(os, devel_mode);
 		return os.str();
 	}
 
 	if (inTexted())
-		return text()->currentState(*this);
+		return text()->currentState(*this, devel_mode);
 
 	return docstring();
 }
diff --git a/src/Cursor.h b/src/Cursor.h
index d1e13f684e..5c675c493a 100644
--- a/src/Cursor.h
+++ b/src/Cursor.h
@@ -205,7 +205,7 @@ public:
 	///
 	docstring selectionAsString(bool with_label) const;
 	///
-	docstring currentState() const;
+	docstring currentState(bool devel_mode) const;
 
 	/// auto-correct mode
 	bool autocorrect() const { return autocorrect_; }
@@ -300,7 +300,7 @@ public:
 	/// access to owning BufferView
 	BufferView & bv() const;
 	/// get some interesting description of top position
-	void info(odocstream & os) const;
+	void info(odocstream & os, bool devel_mode) const;
 	/// are we in math mode (2), text mode (1) or unsure (0)?
 	int currentMode();
 	/// reset cursor bottom to the beginning of the top inset
diff --git a/src/FuncCode.h b/src/FuncCode.h
index 7949bce41a..92d5e35268 100644
--- a/src/FuncCode.h
+++ b/src/FuncCode.h
@@ -473,6 +473,7 @@ enum FuncCode
 	LFUN_BUFFER_ZOOM,   // daniel, 20161028
 	LFUN_TOOLBAR_MOVABLE,   // daniel, 20160712
 	LFUN_FONT_CROSSOUT, // uwestoehr 20170404
+	LFUN_DEVEL_MODE_TOGGLE, // lasgouttes 20170723
 	LFUN_LASTACTION // end of the table
 };
 
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 56b810306e..6aaec92428 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -1396,6 +1396,19 @@ void LyXAction::init()
 
 
 /*!
+ * \var lyx::FuncCode lyx::LFUN_DEVEL_MODE_TOGGLE
+ * \li Action: toggle a mode where more information is given in UI
+ * \li Syntax: devel-mode-toggle
+ * \li Notion: in so called "devel" mode, the information given in the
+ * status bar is more precise, and the help