* Disable "New Inset" button
* Do not disable line edits, but use setReadOnly instead (this allows copying contents)
Fixes: #9408
Note that some dialogs still need some care.
The expanded cells of a mathmacro were previously stored in an InsetMathSqrt.
This was only used as a container for the MathData object in the first cell
of the sqrt inset, which contained the actual expanded arguments.
Funny enough, the only place were the inset property of expanded_ was really
used cannot be seen in the diff. It was MathMacro::kerning(), and this usage
was wrong, since InsetMathSqrt::kerning() always returns 0. Threfore, using
the correct type (MathData) for expanded_ does not only make the code more
readable, gets rid of an unneeded dependency, but also fixes a bug: Now the
correct kerning is returned for expanded cells. Also, expanded_ and
definition_ use the same type now, which looks nicely symmetric.
Previously, things like [ name ] where exported for computer algebra systems.
Now, the expanded macros are exported, which may still be wrong, but now the
CAS has at least a chance to understand what was meant.
Currently, only lfun names are accepeted but there are cases in which
the lfun name does not map directly to an icon. Fore example, in the
outliner, the icon named "promote" is used for the lfun outline-out.
As a result, a graphics inset is used in the documentation for describing
the corresponding icon. Now one can also use an icon name. The argument
of "info-isert icon" is firstly lookep up as an lfun. If no corresponding
icon is found, the argument is taken as the name of the icon. If no such
icon exists, the "unknown" icon is used.
The computation of length on screen depend in particular of the computation of the size of an em. Many places of the code used to rely on the width of the M character, which is not really correct:
http://en.wikipedia.org/wiki/Em_%28typography%29
In digital typography, the best value to use is the point size of the font.
* Implement FontMetrics::em(), which returns the value in pixels of the EM unit.
Convert code to use it.
* Introduce Length::inPixel(MetricsBase const &), which takes the textwidth and em information from the MetricsBase object. Convert code to use it.
* Fix several places where Length::inPixel is used without a proper em value.
* add mathed_font_em() helper function. It should eventually be removed like some other functions in MathSupport.
* Add dummy implementation of FontMetrics to tex2lyx for linking purposes.
I am moving the corresponding code directly to InsetInfo.cpp.
Moreover, the size of the image displayed by the info inset is
now dynamically set according to the text size.
This is a bug reported and fixed by Edwin Leuven.
Here is how Edwin described it in his inimitable minimalist style:
first i merge the top-left two cells in a small, say 3x3, table
if i then merge this multicolumn cell with the remaining cell in the first row
my table ends up all bonkers
A new macro adapted from AM_PROG_PYTHON is defined. It does the dual version testing for python 2 and python 3. The rest of the functionnality of AM_PROG_PYTHON has been stripped off.
Once our special macro has been invoked, we use the usual AM_PROG_PYTHON.
This is the rersult of a discussion on the list. Now all special characters
have meaningful names, and it is clear that the LyX file syntax is not LaTeX.
Fixes crash introduced in [17e435c4/lyxgit].
editable() is more related to Texted. It is false for closed collapsable insets
Eventually the two methods should be merged.
When closing a document with the cursor near an icon info inset, LyX
may crash on loading again the same document. This is most probably due
to the fact that compressed svg icons are first uncompressed to a
temporary file before being used. The temporary file is then deleted
but something still expects to find it in place. The exact circumstances
that lead to the crash are unknown, and maybe there is also a race entering
the picture here. However, a document that always leads to a crash can be
found attached here: http://article.gmane.org/gmane.editors.lyx.devel/154566
This commit does not fix the cause of the crash but rather avoids it.
As a bonus, the svg icons used by LyX are not uncompressed anymore before
being used, speeding up startup time. This is not a problem, because Qt
can deal with compressed svg images.
According to fix#9432, Scott found a new crash
1. start a new LyX document, english GUI
2. alt+m f to create a fraction
3. alt+m r to insert a root
4. undo
Imagemagick detects the inut file format based on contents. Therefore it does
not make sense that we prefix the to be converted file name with the extension
(assuming that the file extension matches the imagemagick format name). This
breaks formats where the extension used by LyX does not match the imagemagick
format name.
- Restore proportion between icons, such that, for example, \imath
is not confused with a lower case 'l' or \textdegree with \circ
- Use real \mathbb and \mathcal TeX icons
I'll revise also the other sets in the Math Panels toolbar along
these lines. It is important to see whether a symbol has ascendents
or descendents or what is their relative size.
I thought I would need it to fix bug #9418, but once backwardInset() worked
it turned out that it is not needed. However, since it took me some time to
figure out the correct implementation I do not want to throw the result away.
The concept of rows and cols is no longer unique to mathed.
Each inset decides itself whether it is grid like or not, so we should not
interfere with this in the cursor slice.
If LyX thinks the export was successful but no output file was
produced for preview, then something is wrong (most likely LyX
did not detect an error that occurred during export).
Also clean up some logic.
A PDF is often still produced after a LaTeX error.
If there was an error when exporting a PDF, we now give an error
and the PDF (if it exists), where before we gave the error and
not the PDF. The GUI and command line behaviors are consistent:
in the GUI an error is given and the PDF is viewed; on the
command line, a non-zero exit code is given and a PDF is created.
This also solves what was in my mind an inconsistency: if the user
"updated" a document and there was an error, the resulting
PDF would be shown; but if the user viewed a document and there
was an error, the document would not be shown.
Note that this applies to all output formats, not just PDF.
For discussion, see:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg186454.html
When scanning the LaTeX log, previously we only looked ahead 10 lines
after a "!" line and if we did not find a line number we did not count
an error. This lead to the problem that templates/ACM-sigplan.lyx was
showing a successful export and the PDF was shown (it is still
created despite the error). Now that the exit code of the latex
command is checked (as of the previous commit), an error is correctly
given, but by parsing the log better with this commit, a more
informative error is given.
Increasing the look-ahead to 15 lines leads to correct parsing of
the ACM-sigplan log. The excerpt in the log file where there are more
than 10 lines in-between the "!" line and the line number is below:
! Undefined control sequence.
\@toappear ...ent http://dx.doi.org/10.1145/\@doi
<argument> ...n is removed.]\par \else \@toappear
\fi \if \@reprint
\noinden...
\@begin@tempboxa ...mpboxa #1{\color@begingroup #2
\color@endgroup }\def
\wid...
\@iiiparbox ...tempdima \@parboxrestore #5\@@par }
\ifx \relax #2\else
\setle...
\@copyrightspace ...planconf@finalpage}.\par \fi }
}\end@float
\maketitle ... \@copyrightwanted \@copyrightspace
\fi
l.34 \maketitle
Another example is posted here:
http://tex.stackexchange.com/questions/231655/lyx-cannot-output-to-pdflatex-for-a-specific-file
Systemcall::startscript returns the exit code of the LaTeX command
that is run, but the return value was not being checked by
LaTeX::run. Instead, we relied on parsing log files. However, this
parsing is not perfect.
The return value is now checked and if the exit code of the command
is non-zero, an enum value is added to the return and the user is
notified of the error.
At a higher level, if the LaTeX command returns a non-zero exit code,
in the GUI a message such as
"Error while exporting format: PDF (LuaTeX)" will be given instead of
"Successful preview of format: PDF (LuaTeX)".
When run on the commandline, lyx -e lualatex example.lyx
will give "Error: LaTeX failed" and a non-zero exit code
where before it gave a zero exit code.
A real example of the bug this commit fixes is LyX's (as of this commit)
ACM-sigplan.lyx template.
Before this commit:
$ lyx -e pdf2 ACM-sigplan.lyx
[...snip...]
support/Systemcall.cpp (288): Systemcall: 'pdflatex "ACM-sigplan.tex"'
finished with exit code 1
$ echo $?
0
Starting with this commit:
$ mylyx master -e pdf2 ACM-sigplan.lyx
support/Systemcall.cpp (288): Systemcall: 'pdflatex "ACM-sigplan.tex"'
finished with exit code 1
Error: LaTeX failed
----------------------------------------
LaTeX did not run successfully. The command that was run exited with
error.
$ echo $?
1
This was disabled in 2009 in bea0925f but it is now safe.
From Richard:
"I am pretty sure that all the work that Peter Kümmel did with the
InGuiThread classes dealt with this issue."
This commit solves two issues:
(1) A PDF from a previous run could have been the result of a command
that exited with error (e.g. sometimes pdflatex still produces a PDF if
it exits with error). If the "View" button were clicked a second time
without changing the .lyx file, then the checksum of the .tex file would
not have changed so LyX would show the PDF (which was created from the
first run that exited with error), and this time LyX would not report
the error (because the parsing of the logs only happens when the .tex
file is compiled).
(2) A myfile.tex that results in no output does not yield a myfile.pdf.
Thus, Any myfile.pdf in the temporary directory will not be overwritten.
Before this commit, the following scenario was possible: LyX runs
pdflatex which processes myfile.tex and no error is given so LyX opens
myfile.pdf. However, it could have been the scenario that pdflatex did
not exit with error and did not create myfile.pdf, in which case
whichever myfile.pdf is being shown is not correct. To see this bug in
action, start a new document, type "abc", view the PDF, delete "abc",
view the PDF (this correctly gives an error that empty output was
created), view the PDF again (this does not give an error because the
checksum has not changed). The PDF shown will contain "abc".
Note that the above also applies to DVI files and that the fix is
general.