Re: Crash when opening the tutorial with cursor at line with icon

2015-03-21 Thread Stephan Witt
Am 21.03.2015 um 00:19 schrieb Enrico Forestieri for...@lyx.org:

 On Fri, Mar 20, 2015 at 03:15:58PM +0100, Stephan Witt wrote:
 
 Am 20.03.2015 um 11:55 schrieb Kornel Benko kor...@lyx.org:
 
 Am Freitag, 20. März 2015 um 11:45:43, schrieb Stephan Witt 
 st.w...@gmx.net
 This is lyx-build/LyX-2.2.0dev-7416064 (git commit hash
 74160640337b63b1fb21c9690289f0ebb29c0820)
 
 After quit LyX with the cursor at a line containing an icon and restart it
 I get a crash on load of the mentioned LyX file.
 I tried to activate malloc debug but this did not help to pin point the
 problem. I cannot interpret the state of the stack trace and of the local
 variables. The ParagraphMetrics instance in TextMetrics::redoParagraph
 (stack frame 4) is corrupt. The call stack is:
 
 Could not reproduce on ubuntu. Maybe a specific icon? Which line, if yes?
 Which icon-set? (Classic, Oxygen)? Lang env?
 
 
 The debugger is running with LANG=de_DE.UTF-8
 
 I tried to create a minimal example and this does not crash. But it possibly
 answers your questions. I'll have to investigate if QtSession settings are
 the problem here.
 
 I have seen this strange behavior, although it does not seem to occur
 anymore for me. Once LyX starts crashing, one cannot effectively load that
 document anymore. I did not understand why that happens and the only
 workaround I found is editing the ~/.lyx/session file and deleting the
 line with cursor info for that particualr document. After doing that,
 LyX doesn't crash anymore, even placing the cursor at the same
 position that initially triggered the crash.

Yes, I did remember vaguely. So, there is no hope to fix it? I'm afraid I cannot
reproduce it anymore after deleting the session state.

Stephan

Re: [patch] Prefer svg icons

2015-03-21 Thread Stephan Witt
Am 20.03.2015 um 23:45 schrieb Enrico Forestieri for...@lyx.org:

 On Fri, Mar 20, 2015 at 10:15:18AM +0100, Stephan Witt wrote:
 
 Ok, here's the patch to improve the display of icons on Mac. I made a
 snapshot of the resulting on-screen display.
 
 The GraphicsLoader.cpp change needs hard coded values. I didn't find a better
 solution, ATM. Any comments are welcome.
 
 So, the trick is rendering the svg icons at double resolution, if I
 undestand correctly. Does it mean that you actually have to use the
 larger sizes to have resonably sized icons?

Yes, the QIcon e.g. needs higher physical resolution pixmaps for HiDPI on mac.
The logical resolution is the lower one in this scenario.

 
 diff --git a/src/graphics/GraphicsLoader.cpp 
 b/src/graphics/GraphicsLoader.cpp
 index 23ebb62..6b53774 100644
 --- a/src/graphics/GraphicsLoader.cpp
 +++ b/src/graphics/GraphicsLoader.cpp
 @@ -460,6 +460,10 @@ void Loader::Impl::createPixmap()
  if (idx != string::npos  idx  3) {
  if (filename.substr(idx - 3, 3) == @2x) {
  params_.pixel_ratio = 2.0;
 +} else if (cached_item_-filename().extension() == 
 svgz) {
 +params_.pixel_ratio = 2.0;
 +} else if (cached_item_-filename().extension() == 
 svg) {
 +params_.pixel_ratio = 2.0;
 
 Here you set params_.pixel_ratio simply based on the extension. Should not
 you check whether the display is actually a HiDPI one?

In fact the pixel_ratio of an real vector based SVG image is infinite. 
A proper value would be the result of theGuiApp()-pixelRatio().
But I don't know how to get this information from inside the GraphicsLoader.
Perhaps it isn't the best solution to make this decision here.

Stephan

Hebrew Translation

2015-03-21 Thread Guy Rutenberg
Hi All,

I've made some update to the Hebrew translation of LyX (in the 2.2dev
branch) and translated ~500 strings.

Whats the preferable way to submit the changes (patch? whole .po file?) and
to whom?

Thanks,

Guy


Re: Crash when opening the tutorial with cursor at line with icon

2015-03-21 Thread Enrico Forestieri
On Sat, Mar 21, 2015 at 09:35:32AM +0100, Stephan Witt wrote:
 Am 21.03.2015 um 00:19 schrieb Enrico Forestieri for...@lyx.org:
  
  I have seen this strange behavior, although it does not seem to occur
  anymore for me. Once LyX starts crashing, one cannot effectively load that
  document anymore. I did not understand why that happens and the only
  workaround I found is editing the ~/.lyx/session file and deleting the
  line with cursor info for that particualr document. After doing that,
  LyX doesn't crash anymore, even placing the cursor at the same
  position that initially triggered the crash.
 
 Yes, I did remember vaguely. So, there is no hope to fix it?

I could not make any sense of the backtrace and, once deleting the
session info (note that you can simply remove the entry for the
cursor position for that document, no need to remove the file), the
bug does not occur anymore. So, seemingly, there is something fishy
that triggers the crash when the following occurs:
1) You previously used pngs.
2) You close a document when the cursor was near (same paragraph, maybe?)
   an info inset.
3) You switch to svg icons.
4) You load the previously closed document.

 I'm afraid I cannot reproduce it anymore after deleting the session state.

Same here. It would be worth understanding the reason, but given that
it seems a one-shot bug, I am not motivated to spend time on this.

-- 
Enrico


Re: [ugly patch] fix bug 9418

2015-03-21 Thread Jean-Marc Lasgouttes

Le 20/03/15 21:53, Georg Baum a écrit :

The real cause for the bug is that ArgumentProxy::mathMacro_ is a reference
to an object which is stored in a MathData, which is a std::vector storing
MathAtoms by value (not pointers). Therefore, each time when the MathData
object which contains a math macro instance is resized, the
ArgumentProxy::mathMacro_ members of its arguments may become invalid. In
case of bug 9418 the resizing happens because only macro \a is copied to the
clipboard, and macro \b is not, therefore \b is converted to an unknown
inset and its argument is put as a separate inset after \b.


What about using a std::list or our own RandomAccessList instead of 
std::vector?


JMarc



Re: Re: Python 2 and 3 simultaneous support (1st step)

2015-03-21 Thread José Matos
On Saturday 14 March 2015 14:53:17 Ian Wilder wrote:
 have you guys thought about using Python 2to3?
 
 https://docs.python.org/2/library/2to3.html
 
 even if you don't use the result, it may give a good direction for 
 problems that arise.

Bah.. too 2010... ;-)
http://marc.info/?l=lyx-develm=136836775010034w=2

A better option, and one that I have been using is to use python-modernize that 
uses 2to3 to highlight the places where the code should be changed while at the 
same time remaining compatible between python 2 and python 3.

The ideas are sketched here
http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/

and python-modernize can be found here
https://github.com/mitsuhiko/python-modernize

Some other points regarding the conversion can be found here
http://www.lyx.org/trac/ticket/9006

-- 
José Abílio


Re: Re: new compiler warnings in master

2015-03-21 Thread José Matos
On Friday 20 March 2015 21:57:43 Georg Baum wrote:
 OK, I will change it. But since the LyX file format really has nothing to do 
 with LaTeX (except for math), I will remove all backslashes and {} pairs 
 from InsetSpecialChar. BTW, LaTeX2E is not the only one which is different.
 
 
 Georg

+1

:-)
-- 
José Abílio


Re: [LyX/master] Check that DocIterator::sanitize only adds editable insets

2015-03-21 Thread Scott Kostyshak
On Tue, Mar 10, 2015 at 11:17 AM, Jean-Marc Lasgouttes
lasgout...@lyx.org wrote:
 commit 17e435c47e36effd36d25cec900369e04f6acb4e
 Author: Jean-Marc Lasgouttes lasgout...@lyx.org
 Date:   Mon Mar 9 11:14:26 2015 +0100

 Check that DocIterator::sanitize only adds editable insets

 This fixes the crash on ticket #9432, but the bug there has other causes.

This causes a new crash for me:

1. start a new LyX document
2. alt+m f to create a fraction
3. alt+m r to insert a root
4. undo

I get a SIGSEGV with the following bt:

(  1) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::frontend::Alert::doError(std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, bool)
(  2) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2: void
std::_Bindvoid (*(std::reference_wrapperstd::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::reference_wrapperstd::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::reference_wrapperbool))(std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, bool)::__callvoid, , 0ul, 1ul,
2ul(std::tuple, std::_Index_tuple0ul, 1ul, 2ul)
(  3) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2: void
std::_Bindvoid (*(std::reference_wrapperstd::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::reference_wrapperstd::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::reference_wrapperbool))(std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, bool)::operator(), void()
(  4) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
std::_Function_handlervoid (), std::_Bindvoid
(*(std::reference_wrapperstd::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::reference_wrapperstd::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::reference_wrapperbool))(std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, bool) ::_M_invoke(std::_Any_data
const)
(  5) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
std::functionvoid ()::operator()() const
(  6) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::frontend::InGuiThreadvoid::synchronousFunctionCall()
(  7) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::frontend::IntoGuiThreadMover::callInGuiThread()
(  8) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2: void
lyx::frontend::InGuiThreadvoid::callstd::_Bindvoid
(*(std::reference_wrapperstd::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::reference_wrapperstd::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::reference_wrapperbool))(std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, bool) (std::_Bindvoid
(*(std::reference_wrapperstd::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::reference_wrapperstd::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::reference_wrapperbool))(std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, bool))
(  9) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2: void
lyx::frontend::InGuiThreadvoid::callvoid
(*)(std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const, bool),
std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const, bool(void
(*)(std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const, bool),
std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const, bool)
( 10) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::frontend::Alert::error(std::basic_stringwchar_t,
std::char_traitswchar_t, std::allocatorwchar_t  const,
std::basic_stringwchar_t, std::char_traitswchar_t,
std::allocatorwchar_t  const, bool)
( 11) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
/home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2() [0xcbbe4b]
( 12) /lib/x86_64-linux-gnu/libc.so.6:
/lib/x86_64-linux-gnu/libc.so.6(+0x36eb0) [0x7fa36d4aeeb0]
( 13) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:

Re: Changing trac defaults

2015-03-21 Thread Scott Kostyshak
On Mon, Mar 16, 2015 at 9:02 PM, Richard Heck rgh...@lyx.org wrote:
 On 03/16/2015 07:43 PM, Scott Kostyshak wrote:

 2. version. Currently it defaults to 2.1.3. I propose to have it
 default to blank.
 - I prefer to have the user choose the version. Otherwise they might
 just have skipped choosing it or did not want or know how to find the
 version they are using.


 Same issue. If there has to be a default, then current version makes sense.

 If there's some way to have a blank default that I'm not seeing, I'm not
 opposed.

How about unspecified (which is already an option)? In fact I wonder
if at some point it was the default.

Scott


Re: Crash when opening the tutorial with cursor at line with icon

2015-03-21 Thread Stephan Witt
Am 21.03.2015 um 13:18 schrieb Enrico Forestieri for...@lyx.org:

 On Sat, Mar 21, 2015 at 09:35:32AM +0100, Stephan Witt wrote:
 Am 21.03.2015 um 00:19 schrieb Enrico Forestieri for...@lyx.org:
 
 I have seen this strange behavior, although it does not seem to occur
 anymore for me. Once LyX starts crashing, one cannot effectively load that
 document anymore. I did not understand why that happens and the only
 workaround I found is editing the ~/.lyx/session file and deleting the
 line with cursor info for that particualr document. After doing that,
 LyX doesn't crash anymore, even placing the cursor at the same
 position that initially triggered the crash.
 
 Yes, I did remember vaguely. So, there is no hope to fix it?
 
 I could not make any sense of the backtrace and, once deleting the
 session info (note that you can simply remove the entry for the
 cursor position for that document, no need to remove the file), the
 bug does not occur anymore. So, seemingly, there is something fishy
 that triggers the crash when the following occurs:
 1) You previously used pngs.
 2) You close a document when the cursor was near (same paragraph, maybe?)
   an info inset.
 3) You switch to svg icons.
 4) You load the previously closed document.
 
 I'm afraid I cannot reproduce it anymore after deleting the session state.
 
 Same here. It would be worth understanding the reason, but given that
 it seems a one-shot bug, I am not motivated to spend time on this.

I found a way to reproduce it:
1) Open a document with info inset included.
2) Go to a line with info inset to display (some text to scroll down).
3) Position the cursor near the inset.
4) Quit LyX and restart.
5) Load the previously closed document - crash on cursor positioning.

To solve that issue one has to remove the offending line in section 
[cursor positions] of the session state.

After the removal I can reproduce it again with the same document and the
same procedure. I'll attach my example document.

To trigger the crash the info inset has to be visible and it must be some
scroll down involved to show the cursor position on startup.

Stephan



IconCrashTest.lyx
Description: Binary data


Re: Changing trac defaults

2015-03-21 Thread Richard Heck

On 03/21/2015 05:59 PM, Scott Kostyshak wrote:

On Mon, Mar 16, 2015 at 9:02 PM, Richard Heck rgh...@lyx.org wrote:

On 03/16/2015 07:43 PM, Scott Kostyshak wrote:

2. version. Currently it defaults to 2.1.3. I propose to have it
default to blank.
- I prefer to have the user choose the version. Otherwise they might
just have skipped choosing it or did not want or know how to find the
version they are using.


Same issue. If there has to be a default, then current version makes sense.

If there's some way to have a blank default that I'm not seeing, I'm not
opposed.

How about unspecified (which is already an option)? In fact I wonder
if at some point it was the default.


Not an option, either, in the Admin panel that allows one to set such 
things. Only the milestones we've created are choices.


Richard



Re: Re: Python 2 and 3 simultaneous support (1st step)

2015-03-21 Thread José Matos
On Wednesday 11 March 2015 15:08:32 Jean-Marc Lasgouttes wrote:
 Dear José,
 
 I took a quick look and I need help. The complicated macro for python 
 eventually calls:
 
 # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], 
 [ACTION-IF-FALSE])
 # 
 ---
 # Run ACTION-IF-TRUE if the Python interpreter PROG has version = VERSION.
 # Run ACTION-IF-FALSE otherwise.
 # This test uses sys.hexversion instead of the string equivalent (first
 # word of sys.version), in order to cope with versions such as 2.2c1.
 # This supports Python 2.0 or higher. (2.0 was released on October 16, 
 2000).
 AC_DEFUN([AM_PYTHON_CHECK_VERSION],
   [prog=import sys
 # split strings by '.' and convert to numeric.  Append some zeros
 # because we need at least 4 digits for the hex conversion.
 # map returns an iterator in Python 3.0 and a list in 2.x
 minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
 minverhex = 0
 # xrange is not present in Python 3.0 and range returns an iterator
 for i in list(range(0, 4)): minverhex = (minverhex  8) + minver[[i]]
 sys.exit(sys.hexversion  minverhex)
AS_IF([AM_RUN_LOG([$1 -c $prog])], [$3], [$4])])
 
 
 Of course this is horrible autoconf code, but in the middle your can see 
 some nice python code, that returns true or false depending on whether 
 the version is greater in $2 (the one in the python code).
 
 Now, assume that I want to define
 # AM_PYTHON23_CHECK_VERSION(PROG, VERSION2, VERSION3, [ACTION-IF-TRUE], 
 [ACTION-IF-FALSE])
 
 Could you give me the python code (that now relies on $2 and $3) that 
 will return the right result? If you prefer to check by function (is 
 such or such feature available?), I will probably be able to do 
 something with it too.
 
 JMarc

The code attached does this. For the moment I am ignoring the arguments $2 and 
$3.

The plan is to have code that supports both versions either 2.7.x (eventually 
2.6 if some kind soul tests thoroughly) and 3.3+.

So the code returns 1 if the python version is in the needed range and 0 if it 
is not.

Regards, 
-- 
José Abílioimport sys
version = sys.version_info[:3]

sys.exit((2,7,0) = version  (3,0,0) or version = (3,3,0))


Re: Changing trac defaults

2015-03-21 Thread Scott Kostyshak
On Sat, Mar 21, 2015 at 6:27 PM, Richard Heck rgh...@lyx.org wrote:
 On 03/21/2015 05:59 PM, Scott Kostyshak wrote:

 Not an option, either, in the Admin panel that allows one to set such
 things. Only the milestones we've created are choices.

Ah, I see. Would creating an unspecified milestone be an option we
should consider, both in its own right (addressing issue 1) and for
allowing us to set unspecified as default for version (addressing
issue 2)?

Scott


Re: Re: Python 2 and 3 simultaneous support (1st step)

2015-03-21 Thread José Matos
On Wednesday 11 March 2015 20:57:43 Kornel Benko wrote:
 Thank you José. If I understood correctly, the opposite of 'open(..,r)' 
 should be 'open(..,w)'.
 (See development/cmake/po/dos2unix.py:15)
 With also this extra change the script worked too.
 
 Kornel

Note that as you found later in python 3 the text files are assumed to be in 
utf-8. If this restriction is reasonable then this code will work as it is.

Even better in python 3 all text files have support for universal end of lines, 
that all end of lines are immediately converted to \n.

In the python 2 versions that support is available optionally, that is python 
can be built without it. That is the reason why lyx2lyx code does not rely on 
it, because it can not be available. In python 3 is there.

Regards,
-- 
José Abílio


Re: Crash when opening the tutorial with cursor at line with icon

2015-03-21 Thread Stephan Witt
Am 21.03.2015 um 00:19 schrieb Enrico Forestieri :

> On Fri, Mar 20, 2015 at 03:15:58PM +0100, Stephan Witt wrote:
> 
>> Am 20.03.2015 um 11:55 schrieb Kornel Benko :
>> 
>>> Am Freitag, 20. März 2015 um 11:45:43, schrieb Stephan Witt 
>>> 
 This is lyx-build/LyX-2.2.0dev-7416064 (git commit hash
 74160640337b63b1fb21c9690289f0ebb29c0820)
 
 After quit LyX with the cursor at a line containing an icon and restart it
 I get a crash on load of the mentioned LyX file.
 I tried to activate malloc debug but this did not help to pin point the
 problem. I cannot interpret the state of the stack trace and of the local
 variables. The ParagraphMetrics instance in TextMetrics::redoParagraph
 (stack frame 4) is corrupt. The call stack is:
>>> 
>>> Could not reproduce on ubuntu. Maybe a specific icon? Which line, if yes?
>>> Which icon-set? (Classic, Oxygen)? Lang env?
>> 
>> 
>> The debugger is running with LANG=de_DE.UTF-8
>> 
>> I tried to create a minimal example and this does not crash. But it possibly
>> answers your questions. I'll have to investigate if QtSession settings are
>> the problem here.
> 
> I have seen this strange behavior, although it does not seem to occur
> anymore for me. Once LyX starts crashing, one cannot effectively load that
> document anymore. I did not understand why that happens and the only
> workaround I found is editing the ~/.lyx/session file and deleting the
> line with cursor info for that particualr document. After doing that,
> LyX doesn't crash anymore, even placing the cursor at the same
> position that initially triggered the crash.

Yes, I did remember vaguely. So, there is no hope to fix it? I'm afraid I cannot
reproduce it anymore after deleting the session state.

Stephan

Re: [patch] Prefer svg icons

2015-03-21 Thread Stephan Witt
Am 20.03.2015 um 23:45 schrieb Enrico Forestieri :

> On Fri, Mar 20, 2015 at 10:15:18AM +0100, Stephan Witt wrote:
>> 
>> Ok, here's the patch to improve the display of icons on Mac. I made a
>> snapshot of the resulting on-screen display.
>> 
>> The GraphicsLoader.cpp change needs hard coded values. I didn't find a better
>> solution, ATM. Any comments are welcome.
> 
> So, the trick is rendering the svg icons at double resolution, if I
> undestand correctly. Does it mean that you actually have to use the
> larger sizes to have resonably sized icons?

Yes, the QIcon e.g. needs higher physical resolution pixmaps for HiDPI on mac.
The logical resolution is the lower one in this scenario.

> 
>> diff --git a/src/graphics/GraphicsLoader.cpp 
>> b/src/graphics/GraphicsLoader.cpp
>> index 23ebb62..6b53774 100644
>> --- a/src/graphics/GraphicsLoader.cpp
>> +++ b/src/graphics/GraphicsLoader.cpp
>> @@ -460,6 +460,10 @@ void Loader::Impl::createPixmap()
>>  if (idx != string::npos && idx > 3) {
>>  if (filename.substr(idx - 3, 3) == "@2x") {
>>  params_.pixel_ratio = 2.0;
>> +} else if (cached_item_->filename().extension() == 
>> "svgz") {
>> +params_.pixel_ratio = 2.0;
>> +} else if (cached_item_->filename().extension() == 
>> "svg") {
>> +params_.pixel_ratio = 2.0;
> 
> Here you set params_.pixel_ratio simply based on the extension. Should not
> you check whether the display is actually a HiDPI one?

In fact the pixel_ratio of an real vector based SVG image is infinite. 
A proper value would be the result of theGuiApp()->pixelRatio().
But I don't know how to get this information from inside the GraphicsLoader.
Perhaps it isn't the best solution to make this decision here.

Stephan

Re: [ugly patch] fix bug 9418

2015-03-21 Thread Jean-Marc Lasgouttes

Le 20/03/15 21:53, Georg Baum a écrit :

The real cause for the bug is that ArgumentProxy::mathMacro_ is a reference
to an object which is stored in a MathData, which is a std::vector storing
MathAtoms by value (not pointers). Therefore, each time when the MathData
object which contains a math macro instance is resized, the
ArgumentProxy::mathMacro_ members of its arguments may become invalid. In
case of bug 9418 the resizing happens because only macro \a is copied to the
clipboard, and macro \b is not, therefore \b is converted to an unknown
inset and its argument is put as a separate inset after \b.


What about using a std::list or our own RandomAccessList instead of 
std::vector?


JMarc



Re: Crash when opening the tutorial with cursor at line with icon

2015-03-21 Thread Enrico Forestieri
On Sat, Mar 21, 2015 at 09:35:32AM +0100, Stephan Witt wrote:
> Am 21.03.2015 um 00:19 schrieb Enrico Forestieri :
> > 
> > I have seen this strange behavior, although it does not seem to occur
> > anymore for me. Once LyX starts crashing, one cannot effectively load that
> > document anymore. I did not understand why that happens and the only
> > workaround I found is editing the ~/.lyx/session file and deleting the
> > line with cursor info for that particualr document. After doing that,
> > LyX doesn't crash anymore, even placing the cursor at the same
> > position that initially triggered the crash.
> 
> Yes, I did remember vaguely. So, there is no hope to fix it?

I could not make any sense of the backtrace and, once deleting the
session info (note that you can simply remove the entry for the
cursor position for that document, no need to remove the file), the
bug does not occur anymore. So, seemingly, there is something fishy
that triggers the crash when the following occurs:
1) You previously used pngs.
2) You close a document when the cursor was near (same paragraph, maybe?)
   an info inset.
3) You switch to svg icons.
4) You load the previously closed document.

> I'm afraid I cannot reproduce it anymore after deleting the session state.

Same here. It would be worth understanding the reason, but given that
it seems a one-shot bug, I am not motivated to spend time on this.

-- 
Enrico


Hebrew Translation

2015-03-21 Thread Guy Rutenberg
Hi All,

I've made some update to the Hebrew translation of LyX (in the 2.2dev
branch) and translated ~500 strings.

Whats the preferable way to submit the changes (patch? whole .po file?) and
to whom?

Thanks,

Guy


Re: Re: new compiler warnings in master

2015-03-21 Thread José Matos
On Friday 20 March 2015 21:57:43 Georg Baum wrote:
> OK, I will change it. But since the LyX file format really has nothing to do 
> with LaTeX (except for math), I will remove all backslashes and {} pairs 
> from InsetSpecialChar. BTW, LaTeX2E is not the only one which is different.
> 
> 
> Georg

+1

:-)
-- 
José Abílio


Re: Re: Python 2 and 3 simultaneous support (1st step)

2015-03-21 Thread José Matos
On Saturday 14 March 2015 14:53:17 Ian Wilder wrote:
> have you guys thought about using Python 2to3?
> 
> https://docs.python.org/2/library/2to3.html
> 
> even if you don't use the result, it may give a good direction for 
> problems that arise.

Bah.. too 2010... ;-)
http://marc.info/?l=lyx-devel=136836775010034=2

A better option, and one that I have been using is to use python-modernize that 
uses 2to3 to highlight the places where the code should be changed while at the 
same time remaining compatible between python 2 and python 3.

The ideas are sketched here
http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/

and python-modernize can be found here
https://github.com/mitsuhiko/python-modernize

Some other points regarding the conversion can be found here
http://www.lyx.org/trac/ticket/9006

-- 
José Abílio


Re: [LyX/master] Check that DocIterator::sanitize only adds editable insets

2015-03-21 Thread Scott Kostyshak
On Tue, Mar 10, 2015 at 11:17 AM, Jean-Marc Lasgouttes
 wrote:
> commit 17e435c47e36effd36d25cec900369e04f6acb4e
> Author: Jean-Marc Lasgouttes 
> Date:   Mon Mar 9 11:14:26 2015 +0100
>
> Check that DocIterator::sanitize only adds editable insets
>
> This fixes the crash on ticket #9432, but the bug there has other causes.

This causes a new crash for me:

1. start a new LyX document
2. alt+m f to create a fraction
3. alt+m r to insert a root
4. undo

I get a SIGSEGV with the following bt:

(  1) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::frontend::Alert::doError(std::basic_string const&,
std::basic_string const&, bool)
(  2) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2: void
std::_Bind, std::allocator > const>,
std::reference_wrapper const>,
std::reference_wrapper))(std::basic_string const&,
std::basic_string const&, bool)>::__call(std::tuple<>&&, std::_Index_tuple<0ul, 1ul, 2ul>)
(  3) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2: void
std::_Bind, std::allocator > const>,
std::reference_wrapper const>,
std::reference_wrapper))(std::basic_string const&,
std::basic_string const&, bool)>::operator()<, void>()
(  4) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
std::_Function_handler, std::allocator > const>,
std::reference_wrapper const>,
std::reference_wrapper))(std::basic_string const&,
std::basic_string const&, bool)> >::_M_invoke(std::_Any_data
const&)
(  5) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
std::function::operator()() const
(  6) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::frontend::InGuiThread::synchronousFunctionCall()
(  7) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::frontend::IntoGuiThreadMover::callInGuiThread()
(  8) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2: void
lyx::frontend::InGuiThread::call const>,
std::reference_wrapper const>,
std::reference_wrapper))(std::basic_string const&,
std::basic_string const&, bool)> >(std::_Bind, std::allocator > const>,
std::reference_wrapper const>,
std::reference_wrapper))(std::basic_string const&,
std::basic_string const&, bool)>)
(  9) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2: void
lyx::frontend::InGuiThread::call,
std::allocator > const&, std::basic_string const&, bool),
std::basic_string const, std::basic_string const, bool>(void
(*)(std::basic_string const&, std::basic_string const&, bool),
std::basic_string const&, std::basic_string const&, bool&)
( 10) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::frontend::Alert::error(std::basic_string const&,
std::basic_string const&, bool)
( 11) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
/home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2() [0xcbbe4b]
( 12) /lib/x86_64-linux-gnu/libc.so.6:
/lib/x86_64-linux-gnu/libc.so.6(+0x36eb0) [0x7fa36d4aeeb0]
( 13) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::CursorSlice::lastpos() const
( 14) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::DocIterator::sanitize()
( 15) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::Cursor::sanitize()
( 16) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::Cursor::textUndo()
( 17) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::BufferView::dispatch(lyx::FuncRequest const&,
lyx::DispatchResult&)
( 18) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::frontend::GuiView::dispatchToBufferView(lyx::FuncRequest const&,
lyx::DispatchResult&)
( 19) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:
lyx::frontend::GuiView::dispatch(lyx::FuncRequest const&,
lyx::DispatchResult&)
( 20) /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx2.2:

Re: Changing trac defaults

2015-03-21 Thread Scott Kostyshak
On Mon, Mar 16, 2015 at 9:02 PM, Richard Heck  wrote:
> On 03/16/2015 07:43 PM, Scott Kostyshak wrote:

>> 2. version. Currently it defaults to 2.1.3. I propose to have it
>> default to blank.
>> - I prefer to have the user choose the version. Otherwise they might
>> just have skipped choosing it or did not want or know how to find the
>> version they are using.
>
>
> Same issue. If there has to be a default, then current version makes sense.
>
> If there's some way to have a "blank" default that I'm not seeing, I'm not
> opposed.

How about "unspecified" (which is already an option)? In fact I wonder
if at some point it was the default.

Scott


Re: Crash when opening the tutorial with cursor at line with icon

2015-03-21 Thread Stephan Witt
Am 21.03.2015 um 13:18 schrieb Enrico Forestieri :

> On Sat, Mar 21, 2015 at 09:35:32AM +0100, Stephan Witt wrote:
>> Am 21.03.2015 um 00:19 schrieb Enrico Forestieri :
>>> 
>>> I have seen this strange behavior, although it does not seem to occur
>>> anymore for me. Once LyX starts crashing, one cannot effectively load that
>>> document anymore. I did not understand why that happens and the only
>>> workaround I found is editing the ~/.lyx/session file and deleting the
>>> line with cursor info for that particualr document. After doing that,
>>> LyX doesn't crash anymore, even placing the cursor at the same
>>> position that initially triggered the crash.
>> 
>> Yes, I did remember vaguely. So, there is no hope to fix it?
> 
> I could not make any sense of the backtrace and, once deleting the
> session info (note that you can simply remove the entry for the
> cursor position for that document, no need to remove the file), the
> bug does not occur anymore. So, seemingly, there is something fishy
> that triggers the crash when the following occurs:
> 1) You previously used pngs.
> 2) You close a document when the cursor was near (same paragraph, maybe?)
>   an info inset.
> 3) You switch to svg icons.
> 4) You load the previously closed document.
> 
>> I'm afraid I cannot reproduce it anymore after deleting the session state.
> 
> Same here. It would be worth understanding the reason, but given that
> it seems a one-shot bug, I am not motivated to spend time on this.

I found a way to reproduce it:
1) Open a document with info inset included.
2) Go to a line with info inset to display (some text to scroll down).
3) Position the cursor near the inset.
4) Quit LyX and restart.
5) Load the previously closed document -> crash on cursor positioning.

To solve that issue one has to remove the offending line in section 
[cursor positions] of the session state.

After the removal I can reproduce it again with the same document and the
same procedure. I'll attach my example document.

To trigger the crash the info inset has to be visible and it must be some
scroll down involved to show the cursor position on startup.

Stephan



IconCrashTest.lyx
Description: Binary data


Re: Changing trac defaults

2015-03-21 Thread Richard Heck

On 03/21/2015 05:59 PM, Scott Kostyshak wrote:

On Mon, Mar 16, 2015 at 9:02 PM, Richard Heck  wrote:

On 03/16/2015 07:43 PM, Scott Kostyshak wrote:

2. version. Currently it defaults to 2.1.3. I propose to have it
default to blank.
- I prefer to have the user choose the version. Otherwise they might
just have skipped choosing it or did not want or know how to find the
version they are using.


Same issue. If there has to be a default, then current version makes sense.

If there's some way to have a "blank" default that I'm not seeing, I'm not
opposed.

How about "unspecified" (which is already an option)? In fact I wonder
if at some point it was the default.


Not an option, either, in the Admin panel that allows one to set such 
things. Only the milestones we've created are choices.


Richard



Re: Changing trac defaults

2015-03-21 Thread Scott Kostyshak
On Sat, Mar 21, 2015 at 6:27 PM, Richard Heck  wrote:
> On 03/21/2015 05:59 PM, Scott Kostyshak wrote:

> Not an option, either, in the Admin panel that allows one to set such
> things. Only the milestones we've created are choices.

Ah, I see. Would creating an "unspecified" milestone be an option we
should consider, both in its own right (addressing issue 1) and for
allowing us to set "unspecified" as default for version (addressing
issue 2)?

Scott


Re: Re: Python 2 and 3 simultaneous support (1st step)

2015-03-21 Thread José Matos
On Wednesday 11 March 2015 15:08:32 Jean-Marc Lasgouttes wrote:
> Dear José,
> 
> I took a quick look and I need help. The complicated macro for python 
> eventually calls:
> 
> # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], 
> [ACTION-IF-FALSE])
> # 
> ---
> # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
> # Run ACTION-IF-FALSE otherwise.
> # This test uses sys.hexversion instead of the string equivalent (first
> # word of sys.version), in order to cope with versions such as 2.2c1.
> # This supports Python 2.0 or higher. (2.0 was released on October 16, 
> 2000).
> AC_DEFUN([AM_PYTHON_CHECK_VERSION],
>   [prog="import sys
> # split strings by '.' and convert to numeric.  Append some zeros
> # because we need at least 4 digits for the hex conversion.
> # map returns an iterator in Python 3.0 and a list in 2.x
> minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
> minverhex = 0
> # xrange is not present in Python 3.0 and range returns an iterator
> for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
> sys.exit(sys.hexversion < minverhex)"
>AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
> 
> 
> Of course this is horrible autoconf code, but in the middle your can see 
> some nice python code, that returns true or false depending on whether 
> the version is greater in $2 (the one in the python code).
> 
> Now, assume that I want to define
> # AM_PYTHON23_CHECK_VERSION(PROG, VERSION2, VERSION3, [ACTION-IF-TRUE], 
> [ACTION-IF-FALSE])
> 
> Could you give me the python code (that now relies on $2 and $3) that 
> will return the right result? If you prefer to check by function (is 
> such or such feature available?), I will probably be able to do 
> something with it too.
> 
> JMarc

The code attached does this. For the moment I am ignoring the arguments $2 and 
$3.

The plan is to have code that supports both versions either 2.7.x (eventually 
2.6 if some kind soul tests thoroughly) and 3.3+.

So the code returns 1 if the python version is in the needed range and 0 if it 
is not.

Regards, 
-- 
José Abílioimport sys
version = sys.version_info[:3]

sys.exit((2,7,0) <= version < (3,0,0) or version >= (3,3,0))


Re: Re: Python 2 and 3 simultaneous support (1st step)

2015-03-21 Thread José Matos
On Wednesday 11 March 2015 20:57:43 Kornel Benko wrote:
> Thank you José. If I understood correctly, the opposite of 'open(..,"r")' 
> should be 'open(..,"w")'.
> (See development/cmake/po/dos2unix.py:15)
> With also this extra change the script worked too.
> 
> Kornel

Note that as you found later in python 3 the text files are assumed to be in 
utf-8. If this restriction is reasonable then this code will work as it is.

Even better in python 3 all text files have support for universal end of lines, 
that all end of lines are immediately converted to \n.

In the python 2 versions that support is available optionally, that is python 
can be built without it. That is the reason why lyx2lyx code does not rely on 
it, because it can not be available. In python 3 is there.

Regards,
-- 
José Abílio