Re: Some inset offset fine tuning

2016-10-27 Thread racoon

On 18.10.2016 09:37, Jean-Marc Lasgouttes wrote:

Le 17/10/2016 à 01:28, racoon a écrit :

I just tried to do some fine tuning on the inset offsets (minimalistic
and classic so far).


Hi racoon,

I am glad you are looking at this. I agree that small offsets are better.


Though I have a non-high resolution display. Maybe it does not look as
good on a high-res display. If so, maybe there should be an adjustment
for high-res displays?


I had a go earlier to replace TEXT_TO_INSET_OFFSET with a function that
computes the length according to current zoom and screen resolution. I
abandonned the patch (attached) for now because it created problems for
vertical spacing. You are welcome to borrow parts of it (the margins are
already in).

You would be welcome to have a look at it. Another option would be to
have a length in em, that is relative to the current font. That would
make the inset spacing comparable to normal spacing in the enclosing
space. This is the best solution IMO, but I am not sure that the font
information is available when we need it.


Hi JMarc,

I did have a look and the attached patch is the current result (again 
only buttons and frames for now). There is also a simple test example. 
Since I did not touch the vertical spacing, only inner and outer side 
offsets, that should be fine still. (Though there was something wrong 
with the vertical spacing to begin with since, for example, the inner 
text runs over the upper and lower boundaries on higher zoom levels.) 
For some reason the frames scale a bit different different and maybe 
nicer than the buttons.


Daniel
From 313b32c0ca5b5619010169097aca6a9a29511276 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Ram=C3=83=3F=3F=3F=3F=3F=C3=83=3F=3F=3F=3F=C3=83?=
 =?UTF-8?q?=3F=3F=3F=C3=83=3F=3F=C3=83=3F=C3=82=C2=B6ller?= 
Date: Mon, 17 Oct 2016 01:21:01 +0200
Subject: [PATCH] Some inset offset fine tuning: - Make outer inset offset
 independent of inner. - Reduced the outer offset. - Make it scale with the
 zoom.

---
 src/frontends/qt4/GuiFontMetrics.cpp |  4 ++--
 src/frontends/qt4/GuiPainter.cpp |  6 +++---
 src/insets/Inset.cpp | 16 
 src/insets/Inset.h   |  6 +-
 src/insets/InsetText.cpp | 13 -
 5 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/src/frontends/qt4/GuiFontMetrics.cpp 
b/src/frontends/qt4/GuiFontMetrics.cpp
index eade8cc..2ed3db4 100644
--- a/src/frontends/qt4/GuiFontMetrics.cpp
+++ b/src/frontends/qt4/GuiFontMetrics.cpp
@@ -254,7 +254,7 @@ void GuiFontMetrics::rectText(docstring const & str,
 {
static int const d = Inset::TEXT_TO_INSET_OFFSET / 2;
 
-   w = width(str) + Inset::TEXT_TO_INSET_OFFSET;
+   w = Inset::textToInsetOffsetInside() + width(str) + 
Inset::textToInsetOffsetInside();
ascent = metrics_.ascent() + d;
descent = metrics_.descent() + d;
 }
@@ -265,7 +265,7 @@ void GuiFontMetrics::buttonText(docstring const & str,
int & w, int & ascent, int & descent) const
 {
rectText(str, w, ascent, descent);
-   w += Inset::TEXT_TO_INSET_OFFSET;
+   w += Inset::textToInsetOffsetInside() + 2;
 }
 
 
diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp
index e613f3f..10d3dfa 100644
--- a/src/frontends/qt4/GuiPainter.cpp
+++ b/src/frontends/qt4/GuiPainter.cpp
@@ -593,10 +593,10 @@ void GuiPainter::buttonText(int x, int y, docstring const 
& str,
FontMetrics const & fm = theFontMetrics(font);
fm.buttonText(str, width, ascent, descent);
 
-   static int const d = Inset::TEXT_TO_INSET_OFFSET / 2;
+   static int const d = Inset::textToInsetOffsetOutside();
 
-   button(x + d, y - ascent, width - Inset::TEXT_TO_INSET_OFFSET, descent 
+ ascent, mouseHover);
-   text(x + Inset::TEXT_TO_INSET_OFFSET, y, str, font);
+   button(x + Inset::textToInsetOffsetOutside(), y - ascent, width - 
2*Inset::textToInsetOffsetOutside(), descent + ascent, mouseHover);
+   text(x + Inset::textToInsetOffsetInside() + 
Inset::textToInsetOffsetOutside() + 1, y, str, font);
 }
 
 
diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index 6e2e4a0..c9bf77e 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -27,6 +27,7 @@
 #include "DispatchResult.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "Length.h"
 #include "MetricsInfo.h"
 #include "output_xhtml.h"
 #include "Text.h"
@@ -621,6 +622,21 @@ ColorCode Inset::labelColor() const
 }
 
 
+int Inset::textToInsetOffsetInside()
+{
+   // 2 pixel at 100dpi default resolution is
+   // equivalent to .5 millimeter.
+   return Length(.5, Length::MM).inPixels(0);
+}
+
+int Inset::textToInsetOffsetOutside()
+{
+   // 1 pixel at 100dpi default resolution is
+   // equivalent to .25 millimeter.
+   return Length(.25, Length::MM).inPixels(0);
+}
+
+
 void Inset::setPosCache(PainterInfo const & pi, int x, int y) const
 {
//LYXERR("Inset: set 

Re: Some inset offset fine tuning

2016-10-27 Thread racoon

On 27.10.2016 10:15, racoon wrote:

On 18.10.2016 09:37, Jean-Marc Lasgouttes wrote:

Le 17/10/2016 à 01:28, racoon a écrit :

I just tried to do some fine tuning on the inset offsets (minimalistic
and classic so far).


Hi racoon,

I am glad you are looking at this. I agree that small offsets are better.


Though I have a non-high resolution display. Maybe it does not look as
good on a high-res display. If so, maybe there should be an adjustment
for high-res displays?


I had a go earlier to replace TEXT_TO_INSET_OFFSET with a function that
computes the length according to current zoom and screen resolution. I
abandonned the patch (attached) for now because it created problems for
vertical spacing. You are welcome to borrow parts of it (the margins are
already in).

You would be welcome to have a look at it. Another option would be to
have a length in em, that is relative to the current font. That would
make the inset spacing comparable to normal spacing in the enclosing
space. This is the best solution IMO, but I am not sure that the font
information is available when we need it.


Hi JMarc,

I did have a look and the attached patch is the current result (again
only buttons and frames for now). There is also a simple test example.
Since I did not touch the vertical spacing, only inner and outer side
offsets, that should be fine still. (Though there was something wrong
with the vertical spacing to begin with since, for example, the inner
text runs over the upper and lower boundaries on higher zoom levels.)
For some reason the frames scale a bit different different and maybe
nicer than the buttons.


ps. And I did not do anything about the interactive area. So it is still 
a bit off to the right and includes the outer spaces (same as in LyX 
2.2.2). The translation might be possible to solve easily. I am a bit 
more uncertain about the outer space.


Re: Some inset offset fine tuning

2016-10-27 Thread racoon

On 27.10.2016 10:21, racoon wrote:

On 27.10.2016 10:15, racoon wrote:

On 18.10.2016 09:37, Jean-Marc Lasgouttes wrote:

Le 17/10/2016 à 01:28, racoon a écrit :

I just tried to do some fine tuning on the inset offsets (minimalistic
and classic so far).


Hi racoon,

I am glad you are looking at this. I agree that small offsets are
better.


Though I have a non-high resolution display. Maybe it does not look as
good on a high-res display. If so, maybe there should be an adjustment
for high-res displays?


I had a go earlier to replace TEXT_TO_INSET_OFFSET with a function that
computes the length according to current zoom and screen resolution. I
abandonned the patch (attached) for now because it created problems for
vertical spacing. You are welcome to borrow parts of it (the margins are
already in).

You would be welcome to have a look at it. Another option would be to
have a length in em, that is relative to the current font. That would
make the inset spacing comparable to normal spacing in the enclosing
space. This is the best solution IMO, but I am not sure that the font
information is available when we need it.


Hi JMarc,

I did have a look and the attached patch is the current result (again
only buttons and frames for now). There is also a simple test example.
Since I did not touch the vertical spacing, only inner and outer side
offsets, that should be fine still. (Though there was something wrong
with the vertical spacing to begin with since, for example, the inner
text runs over the upper and lower boundaries on higher zoom levels.)
For some reason the frames scale a bit different different and maybe
nicer than the buttons.


ps. And I did not do anything about the interactive area. So it is still
a bit off to the right and includes the outer spaces (same as in LyX
2.2.2). The translation might be possible to solve easily. I am a bit
more uncertain about the outer space.


ps2. Oh, I forgot to comment on the added pixels. They are for the 
non-sizable frames. Patch commented appropriately. Though I am not fully 
sure I understood all of them properly.
From 5fc9359ece762af2792868ba6beeac278f9bde74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Ram=C3=83=3F=3F=3F=3F=3F=3F=C3=83=3F=3F=3F=3F=3F?=
 =?UTF-8?q?=C3=83=3F=3F=3F=3F=C3=83=3F=3F=3F=C3=83=3F=3F=C3=83=3F=C3=82?=
 =?UTF-8?q?=C2=B6ller?= 
Date: Mon, 17 Oct 2016 01:21:01 +0200
Subject: [PATCH] Some inset offset fine tuning: - Make outer inset offset
 independent of inner. - Reduced the outer offset. - Make it scale with the
 zoom.

---
 src/frontends/qt4/GuiFontMetrics.cpp |  5 +++--
 src/frontends/qt4/GuiPainter.cpp |  7 ---
 src/insets/Inset.cpp | 16 
 src/insets/Inset.h   |  6 +-
 src/insets/InsetText.cpp | 15 ++-
 5 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/src/frontends/qt4/GuiFontMetrics.cpp 
b/src/frontends/qt4/GuiFontMetrics.cpp
index eade8cc..46c7dc2 100644
--- a/src/frontends/qt4/GuiFontMetrics.cpp
+++ b/src/frontends/qt4/GuiFontMetrics.cpp
@@ -254,7 +254,7 @@ void GuiFontMetrics::rectText(docstring const & str,
 {
static int const d = Inset::TEXT_TO_INSET_OFFSET / 2;
 
-   w = width(str) + Inset::TEXT_TO_INSET_OFFSET;
+   w = width(str) + 2 * Inset::textToInsetOffsetInside();
ascent = metrics_.ascent() + d;
descent = metrics_.descent() + d;
 }
@@ -265,7 +265,8 @@ void GuiFontMetrics::buttonText(docstring const & str,
int & w, int & ascent, int & descent) const
 {
rectText(str, w, ascent, descent);
-   w += Inset::TEXT_TO_INSET_OFFSET;
+   // 2 added pixels for the frame
+   w += Inset::textToInsetOffsetInside() + 2;
 }
 
 
diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp
index e613f3f..1cf5575 100644
--- a/src/frontends/qt4/GuiPainter.cpp
+++ b/src/frontends/qt4/GuiPainter.cpp
@@ -593,10 +593,11 @@ void GuiPainter::buttonText(int x, int y, docstring const 
& str,
FontMetrics const & fm = theFontMetrics(font);
fm.buttonText(str, width, ascent, descent);
 
-   static int const d = Inset::TEXT_TO_INSET_OFFSET / 2;
+   static int const d = Inset::textToInsetOffsetOutside();
 
-   button(x + d, y - ascent, width - Inset::TEXT_TO_INSET_OFFSET, descent 
+ ascent, mouseHover);
-   text(x + Inset::TEXT_TO_INSET_OFFSET, y, str, font);
+   button(x + Inset::textToInsetOffsetOutside(), y - ascent, width - 
2*Inset::textToInsetOffsetOutside(), descent + ascent, mouseHover);
+   // 1 pixel added for the frame
+   text(x + Inset::textToInsetOffsetInside() + 
Inset::textToInsetOffsetOutside() + 1, y, str, font);
 }
 
 
diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index 6e2e4a0..c9bf77e 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -27,6 +27,7 @@
 #include "DispatchResult.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "Length.h"
 #include "MetricsInfo.h"
 #include "

Re: Supposed to be bolded page number not bolded in index

2016-10-27 Thread Jürgen Spitzmüller
Am Montag, den 24.10.2016, 18:10 +0200 schrieb Jean-Marc Lasgouttes:
> Le 23/10/2016 à 11:34, Jürgen Spitzmüller a écrit :
> > In the long term, I think the ideal solution would be that all of
> > these
> > special characters are escaped by default (so @, | and ! really
> > output
> > these glyphs), and that the functions they provide in indexes (sort
> > key, indexical hierarchy, page number formatting) are natively
> > implemented via sub-insets. But this requires major UI work and
> > lyx2lyx
> >  conversion/reversion.
> > 
> > So, for the time being, I would apply the patch.
> 
> That makes sense to me.

Committed to master now.

Richard, what about stable?

Jürgen 

> 
> JMarc

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


plain-text export of nomenclature entries

2016-10-27 Thread Tommaso Cucinotta

... as arising from #10459, currently nomenclature entries are exported to plain-text as 
a wonderful "[LaTeX Command: nomenclature]", regardless of what entry is being 
defined and its description. Would it make sense to change that to something else? Any 
proposal?

Thanks,

T.



Re: Some inset offset fine tuning

2016-10-27 Thread racoon

On 27.10.2016 12:41, racoon wrote:

On 27.10.2016 10:21, racoon wrote:

On 27.10.2016 10:15, racoon wrote:

On 18.10.2016 09:37, Jean-Marc Lasgouttes wrote:

Le 17/10/2016 à 01:28, racoon a écrit :

I just tried to do some fine tuning on the inset offsets (minimalistic
and classic so far).


Hi racoon,

I am glad you are looking at this. I agree that small offsets are
better.


Though I have a non-high resolution display. Maybe it does not look as
good on a high-res display. If so, maybe there should be an adjustment
for high-res displays?


I had a go earlier to replace TEXT_TO_INSET_OFFSET with a function that
computes the length according to current zoom and screen resolution. I
abandonned the patch (attached) for now because it created problems for
vertical spacing. You are welcome to borrow parts of it (the margins
are
already in).

You would be welcome to have a look at it. Another option would be to
have a length in em, that is relative to the current font. That would
make the inset spacing comparable to normal spacing in the enclosing
space. This is the best solution IMO, but I am not sure that the font
information is available when we need it.


Hi JMarc,

I did have a look and the attached patch is the current result (again
only buttons and frames for now). There is also a simple test example.
Since I did not touch the vertical spacing, only inner and outer side
offsets, that should be fine still. (Though there was something wrong
with the vertical spacing to begin with since, for example, the inner
text runs over the upper and lower boundaries on higher zoom levels.)
For some reason the frames scale a bit different different and maybe
nicer than the buttons.


ps. And I did not do anything about the interactive area. So it is still
a bit off to the right and includes the outer spaces (same as in LyX
2.2.2). The translation might be possible to solve easily. I am a bit
more uncertain about the outer space.


ps2. Oh, I forgot to comment on the added pixels. They are for the
non-sizable frames. Patch commented appropriately. Though I am not fully
sure I understood all of them properly.


For some reason the scaling of the frames is nicer than the one of the 
buttons. I see this especially on very low zoom levels. I don't know why 
this is though.


Re: new warnings in master

2016-10-27 Thread Uwe Stöhr

Am 27.10.2016 um 00:11 schrieb Jean-Marc Lasgouttes:


Thanks, Confirmed that they are now gone.


Sorry, I have overseen this one:

D:\LyXGit\Master\src\RowPainter.cpp(656): warning C4244: 'argument': 
conversion from 'double' to 'int', possible loss of data 
[D:\LyXGit\Master\compile-2015\src\LyX.vcxproj]


regards Uwe


Re: [patch] support for Urdu

2016-10-27 Thread Uwe Stöhr

Am 27.10.2016 um 00:12 schrieb Jean-Marc Lasgouttes:


I dis not have time to look at it but I guess it is actually fine if 
polyglossia does the work.


OK, it is in now.

regards Uwe