In fact having an extra parameter "bool cond" is no longer useful because it can
now always be emulated with a ternary operator:
Changers dummy = cond ? do_change() : Changer();
* Factor code for easier maintainance.
* Avoid computing metrics several times. This duplication explained the
exponential blowup during the metrics phase for nested fractions (see
b2b87330). This happened in particular when using lyxproofs which heavily uses
nested \dfracs for on-screen drawing.
* Call MetricsBase::changeScript instead of MetricsBase::changeFrac for
\nicefrac and \unitfrac.
Move math style to FontInfo and compute the font sizes for scriptstyle and
scriptscriptstyle according to standard proportions: 0.73 and 0.55.
This is simpler and more accurate. It also fixes the font size of
${\scriptscriptstyle {\textstyle A}}A$ which exposed the limitations of the
previous approach.
There is no reason to reserve pixel space in macros replacement text,
which is not editable. This makes macros more compact and eases the
writing of lib/symbols.
* introduce new InsetMath::drawMarkers and friends that do nothing
when nested inside a macro. This required to move macro_nesting
inside MetricsBase, and to pass MetricsInfo & to metricsMarkers.
* keep track of nesting when drawing rows or macros.
Empty insets should use a minimal amount of space, especially when
they are part of a built-in macro in lib/symbols.
With this change, blue rectangles signal actually editable places.
Empty macros in editable data are shown as grey boxes, but they do not
appear when further nested.
This is done by adding a new type BOX of MathRow::Element object and a
MetricsInfo::macro_nesting that keeps track of macros (and is reset to
0 in editable macro arguments).
* new MathRow class which contains the description of a MathData
object in terms of math class and spacing
+ macros and their arguments used in the MathData object are
linearized (replaced with their contents) so that all math insets
are typeset as a string together. To this end, we introduce a
method addToMathRow to InsetMath and MathData. This method allows
to linearize recursively a MathData object.
+ It is then necessary to set manually the dimension and position of
the macros and arguments.
+ the class class and spacing are computed using the MathClass helpers.
The MathRow data is cached in the MathData object in a bufferview-dependent
way (different dpi for different screens).
* delegate most of the work MathData::metrics/draw to MathRow metrics/draw.
The case of draw is trickier, since many draw() methods rely on their
metrics without any spacing added.
This implements the relevant math typography rules described in the
Appendix G of the TeXbook. More precisely, for each atom
+ the class is computed by implementing rules 5 and 6 of Appendix G
+ the spacing is computed according to the table p. 170
This code is not used at this point.
This done according to the TeXbook. This class replaces the individual
isMathXXX() methods. The mathClass() method (currently unused) is
provided for the following insets:
* InsetMathChar (with a revised list of affected characters)
* InsetMathSymbol: the class is given by the `extra' field
Operators defined in lib/symbols (e.g. \log) are MC_OP
* InsetMathFrac is MC_INNER (except nicefrac and units)
* InsetDelimiters is MC_INNER
* InsetStackrel is MC_REL
* The class of InsetScript is the class of the last element of its
nucleus (yes, it is a hack, but doing it right is more work).
Remove the explicit spacing that was done in the different insets. The spacing
will be reintroduced properly in a forthcoming commit.
* set up a replacement of *, -, and : by the adequate symbols (#9893)
* fix the wrong character selection and operator spacing in \text mode
* hide some internal symbols from the auto-completion.
* Fix spacing in lib/symbols after recent commits about math spacing, as well as
older spacing issues (e.g. \Join).
* InsetMathKern now uses the same em value as other math length commands.
What is nice is that the kerning amount now matches the ones found in the
packages definition (modulo 10mu that lyx currently adds between relations).
Testcase: $\CheckedBox\LEFTcircle\RIGHTcircle\photon\gluon\vcentcolon\dblcolon\Coloneqq\eqcolon\models\hookrightarrow\bowtie\hookleftarrow\Join\APLinv\neq$
This is a long wanted feature, although it does not go all the way to
fix#6604 (private-cut/private-paste).
Additionally, it fixes a crash that can happen when using undefined
branches. This is done by making the action when pasting unknown
branches configurable.
Fixes bug #6570.
An overlong word containing a hyphen could be broken anywhere, instead of after
the hyphen.
Example: compare the line breaking of
aaaaa-aaaaa-aaaaa-aaaaa
with
aaa aaaaa-aaaaa-aaaaa-aaaaa
(with a very narrow window)
This also improves Chinese text in some situations (#10299)
1) Distinguish expanding characters from separators, to fit with Qt's notion of
expanding character which comes from the Unicode std. CountExpanders() is moved
to FontMetrics to fix a discrepancy with the duplicate implementation from
598f7e4a.
2) Make these expanders stretch on-screen proportionally to the em of the font.
If a row mixes large and small text, LyX let us see which spaces are set in the
bigger font.
3) Now that the stretch is defined in ems, add a limit such that an expander
never stretches more than 1.5em to avoid weird and hard to read justified lines.
4) Add a return boolean to setSeparatorExtraWidth for future use.
When \multicolumn{ncol}{align}{content} is parsed and the ncol
parameter is not a numeric value, this parameter is swallowed
and replaced with '1'. Hence, if the file is subsequently saved
a dataloss would occur. With this commit, \multicolumn is not
interpreted when ncol is not a numeric value and is left as is.
See also #10466
It turns out that Cursor::getFont() does not return a fully realized
font in some cases. This patch uses real_current_font instead, which
seems better anyway.
I suspect that all uses of getFont() should be removed, but this is
not code that I know well.
Fixes bug #10478.
This means that, when a string contains high-plane Unicode characters,
the length of a docstring and the corresponding QString will be
different: Qt will encode these characters using several 16bit
characters.
We have additionally to take into account QTBUG-25536, which implies
that sometimes qstring_to_ucs4(toqstr(s)) !=s. It is not clear whether
this bug can be a problem in other places.
Fixes bug #10443.
1. We must always output all (diverging) options, including
default options; if not, default options might get overwritten.
2. Do not output options in \setotherlanguage, since we might have
multiple "other languages" varieties from the same language (such
as naustrian, nswissgerman). And the options are output for the
language switches anyway.
Hence, LaTeXFeatures::getPolyglossiaLanguages() does not have to record
varieties. This was not done correctly anyway, since the map allowed
for one entry per language only.
Math macros can be displayed on screen by providing a different
representation than the one used for latex output. This representation
is actually used by lyx even while it is being updated. This leads to
printing useless error messages on the terminal. For example, a macro
parameter has to be entered as \#1 and, if the macro is already used in
a math inset, lyx prints on terminal the error message "Math parse error:
missing token after \\" as soon as one hits the \ key, followed by
"MathMacroArgument::MathMacroArgument: wrong Argument id: -48" as soon as
one hits the # key. So, this is not a useful information and simply
clutters the terminal output. On the other hand, the input is sanitized
even if one stops input after hitting either \ or #, so that no further
messages are issued. Hence, those error messages are simply pointless.
1/ simplify logic that triggers margin selection painting
2/ fix logic for end of paragraph markers. They are now selected when
there is an end row margin selection.
3/ avoid rounding problems due to int/double conversions.
Also use the exact amount of vertical space TeX adds after a
math display (instead of 1ex) for vertically shifting the box.
We have to use \belowdisplayshortskip here, instead of
\belowdisplayskip, because the math formula is typeset by alone
in a box, and thus there is no following line.
This fixes two particular problems
* with Qt5, it seems that QFontMetrics::width does not return the
correct value for some Arabic text; this patch uses QTextLayout
instead to compute a string width
* Likewise, the undocumented layout flags TextForceRightToLeft and
TextForceLeftToRight do not work with Arabic text; this patch uses
unicode override characters instead.
It might be that the two issues are related. In any case, they do not
happen with latin text where right-to-left direction is enforced. And
they do not happen with Qt4.
Additionally, remove some dead code in GuiFontMetrics::pos2x().
Fixes bug #10436.
LyX assumes that everything in \lyxdeleted is struck out by ulem
and increases the corresponding counter. However, deleted display
math material is struck out using tikz. As we also take into
account the deletion of underlined display math (in order to
properly position such material vertically), we have to take
care that the count is correct.
No newline is written after \begin{document}, such that
the afterParbreak method would return false. This misleads
the code that outputs a display math in an ulem command
to emit a newline command instead of \noindent, causing
latex errors. This occurs only if the math is at the very
start of a document, without anything before it.
- fileformat change
- I could not update the tex2lyx test files because of bug #10440
- maybe the lyx2lyx routine could be improved but since a document can also begin with another layout than "Standard" I could not use the lyx2lyx function put_cmd_in_ert
It should be now possible underlining or striking out any kind
of math inset containing any math construct indigestible to ulem.
While this was already possible for inline math insets, they could
have break if an aligned environment was used, for example.
This is now possible also for diplay math. Even if this can be
nonsensical and not visually perfect, at least no latex errors
should be generated if one tries to.
This should avoid performance problems related to the window update machinery.
Moreover this fixes a crash introduced by 82808fea when closing a file.
Note that GuiWorkArea::Private already had a read_only_ member, but it
was unused.
Also rename LyXVC::vcname() to LyXVC::vcstatus() since it now contains
directly the UI string to be shown.
Font changes are brought inside the \lyxdeleted macro, just before
outputting the latex code for the math inset. The inset writes a
signature before itself and this is checked by \lyxsout for recognizing
a display math. So, the font changes confuse \lyxsout, which also
swallows the first macro at the very start of \lyxdeleted. The result
is that the font changing command is not seen by latex and \sout is also
used to further strike out the formula already striked out by tikz.
This commit makes sure that the expected signature actually appears
just after the opening brace of \lyxdeleted. It also accounts for a
paragraph break occurring just before the math inset, in order to not
introduce too much vertical space, which is noticeable when using
larger font sizes.
LaTeX refuses to break a line when it is empty. But we have to start
a new line here, otherwise the whole displayed equation would be
typeset as it were inline with previous content. The solution is to
put a zero-length space just before the line break. Moreover, this
is the right thing to do, as it simulates the extra space that is
normally added in this circumstance.
Showing deleted display math by enabling "Show Changes in Output" was
only possible with dvi (through dvipost). Although LyX strikes out
such formulas on screen, it was impossible obtaining an output
directly using pdflatex (or other engines producing pdf) because
ulem cannot cope with display math material and gives errors.
The solution is to strike out by ourselves such deleted formulas.
I took into account several options. One of them would produce
an output similar to dvipost (which strikes out each element), but
would have required much more changes in the output routines.
Eventually, I opted for using tikz, which gives a more clean
output (as it requires to simply adding a preamble and a postamble
to the latex code of any displayed math, instead of a mark up
tailored to each particular math construct). The look of the pdf
output is similar to the way LyX strikes out the equations on screen.
Now that there is a signal to inform the controller when the buffer view has
changed, it is no longer necessary to store a perishable pointer to a buffer
view in the dialog view. (Indeed, it was only really useful for checking whether
the new buffer view pointer was different from the old one.)
TODO: other dialogs should be audited for similar hazards.
This enables error reporting for the preamble, provided the preamble is written
using the new InPreamble layouts.
In the future, I find it preferable to deprecate the usual preamble in favour of
InPreamble layouts rather than implementing error reporting for the usual
preamble. This requires some improvements to code editing in the buffer view
first (line breaking behaviour, syntax highlighting).
texstring is a pair of a docstring and a corresponding TexRow. The row count in
the TexRow has to match the number of lines in the docstring.
otexstringstream is an output string stream that can be used to create
texstrings (i.e. it's an odocstringstream that records the TexRow information
and let us extract a texstring from it).
texstrings can be passed around and output to otexstream and otexrowstream,
which produces an accurate TexRow information by concatenating TexRows.
Note that the lyxrc.document_path variable corresponds to what we
call the "Working directory" in the GUI preferences dialog.
Setting document_path to "." makes it so when LyX is started from a
directory, that directory is the default path for many of LyX's
operations, such as the following:
- new file, new from template
- adding a custom BibTeX file
- GUI compare dialog
- local layout button in document settings
- external material file browser
- graphics browser, include browser
The best guess for where the user wants to save or find files is the
directory the user started LyX from. Before, the default was always
the home directory. If desired, the old behavior can be restored by
changing the default path in Preferences > "Working directory".
This commit takes advantage of 9b64d7bd, which allows the use of a
relative path for path preferences.
The limit of 10% is used in both getStatus() and dispatch() to set a
minimum zoom level. Having it centralized makes the code more
readable and makes changing the minimum less error-prone.
* New virtual functions leftMargin() and rightMargin() to get rid of
drawWithMargin()
* Factor and rewrite code for borders.
* Fix several offset calculations.
Known issues:
* Borders of multicols look too good and do not correspond to the pdf
output. (non-regression)
* Bounding box for Hull (Regexp) not pixel-perfect.
* Bounding boxes of Diagram, XYmatrix, are too tight when there are
borders. Also border should be disabled. (non-regression)
A better solution would be to entirely get rid of this borrowed pointer with
unclear lifetime, but this requires to introduce a new signal for when the
buffer view attached to the GuiView has changed.
Until now this was not done for essentially two reasons. The first
one is that local switches are used for short text insertions, so that
they are unlikely crossing environment boundaries. The second one
is that if we have to close a language at the end of an environment
we would be missing the right termination command. As this last
issue can be overcome by simply storing in the stack the current
nest level with a sign denoting the kind of switch, there is no
reason anymore not to track also local languages switches.
Also factor out some commonly used constructs in order to improve
readability.
If the document language is opened outside of any environement, we risk
not closing it if no other language switch occurs. Indeed, the stack is
emptied only at the end of an enviroment. We could of course also empty
it at the end of the document, but we would have an unnecessary language
switch.
Trying to spare a few cycles by avoiding computing metrics during
screen updates and export. See also 8f86ee74, 72cf7c8f, and e36a8903.
Guillaume will tell whether this also avoids crashing his documents ;)
Some macros defined in the lib/symbols file are classified are texmode.
But the MathMacro class was missing a currentMode method for returning
this information.
When using polyglossia, lyx was making a real mess when changing
language inside nested insets. The \begin{language} and
\end{language} commands were not well paired such that they could
easily occur just before and after the start or end of an
environment. Of course this was causing latex errors such that
"\begin{otherlanguage} ended by \end{environment}".
There may still be some cases I did not take into account.
TexRow now returns a range {start, end} when looking up a particular row.
Reverse-search now selects the whole range instead of simply moving the cursor.
Add an exception to the conversion of "missing character" warnings into errors.
The PGF package deliberately uses the dummy font "nullfont" to suppress output.
Therefore, warnings about missing characters in "nullfont" are really only warnings.
Also updated the comment: "Missing character" warnigns are especially widespread
in XeTeX/LuaTeX but can also happen with "classical" 8-bit TeX.
Feel free to port this to branch.
The title is changed to "LaTeX (pdflatex) Preview", etc. depending on the
format. The actual default format is computed.
The menu name "Source Pane" is replaced by "Code Preview Pane" to better reflect
its purpose.
When resolving biblatex's xdata references, consider that xdata fields
can contain a comma-separated list of keys, not just a single key like
crossref.
In addition to the classic crossref, biblatex introduces xdata
references in order to source-out common data of entries. Entries
that have "xdata = {somekey}" just inherit all fields from the
respective @xdata entry, if the field is not already defined in
the entry itself (just like crossref, with the exception that @xdata
entries themselves are _never_ output on their own). @xdata entries can
themselves inherit to other @xdata entries (ad infinitum). So you can,
for instance, setup an xdata entry for a book series with series name
that inherits an xdata entry with information of the publisher
(publisher, address). Any book of that series would just need to refer
to the series xdata and add the number.
BiblioInfo now checks, in addition to crossrefs, for such xdata
references and inherits missing fields.
Nte that biblatex also introduces an "xref" field as an alternative to
crossref. We must not care about that, since the point of xref is that
it does not inherit fields from the target (just cites that one if a
given number of refs to it exist)
Do not assume that the /systemlyxdir path prefix in \origin refers
to the system directory of the running instance, but check through
some heuristics what the real system dir is. In this way, a document
in the system dir of any other LyX installation is correctly spotted
and the \origin tag properly updated. For example, one can use an
installed version of lyx to edit a document in the lib/doc dir of a
git repo and obtain the same result as when running lyx in place.
Revert to the strategy used at 8f86ee74 but not using mathedWordList
because it may be still uninitialized at load time. Instead, use the
globalMacros method for getting the same info.
There was a thinko at 8ec91e80, because globalMacros always returns
null for user defined macros.
It may happen that mathedWordList is not still updated at load time,
so we would still be using a bogus pointer. Better fetching the
necessary info from the global macro table.
The math macros system is quite complex. Macros are updated during
metrics calculation, so a missing update is very likely to cause a
crash. This commit tries to assure that they are updated at export
time, which also happens when the table of contents is updated.
Moreover, in order to circumvent a possible missing update, when
a math macro is detected we try to avoid using the sym_ member
of the MacroData class, as it may contain bogus values.
Load required package textcomp.
Replace call to non-existent packages textcyr and textgreek with the backup definition of the commands as done by LyX export.
Do not load marvosym (clash with pifont) (LyX does not load the package either).
Remove invalid command \\ascii.
On export, a macro defined in ERT (or not defined at all) is left
in the same environment it is entered. So, don't explicitly insert
it in an ensuremath environment when it is entered in a textmode one.
From Günter [1]:
the difference is the textcommand for ETB which changed from
{\ascii\ETB} to
0x21a8 "\\ETB" "ascii" "force=utf8" # UP DOWN
ARROW WITH BASE
because the former resulted in
l.513 \ascii
\ETB{}
! Undefined control sequence.
[1]
https://www.mail-archive.com/search?l=mid&q=nr48qn%242gb%241%40blaine.gmane.org
Fix problems revealed by hand-compiling an examining the test samples in autotests/export/Unicode-characters/:
* new definitions
* fixed definitions
* "force=utf8" when required
* some IPA symbols fail without the "extraipa" package
* fix direction of "textcommaaboveright"
A math-mode command entered in a text-mode environment is wrapped
in an ensuremath inset, as well as a text-mode command entered in a
math-mode environment is wrapped in a text inset. Who doesn't like
the extra insets can always dissolve them and rely on the wrapping
performed on export.
If the first character in the first cell of an aligned math environment is
'[', and the environment does not use top or bottom vertical alignment,
then LyX did write the '[' unprotected so that it got misinterpreted as
optional argument, both when reading the .lyx file in LyX and when reading
the .tex file in LaTeX => data loss!
The fix is to output an empty optional argument in this case, which is
interpreted as default alignment both by LyX and LaTeX. It would also be
possible to output \[ in the first cell instead, but this would be more
difficult to implement.
The \multicolumn command allows to set vertical lines for individual rows.
These are not yet displayed, but if they are supported one day, the code in
a27ff13663 needs to be adjusted. This change hints at the adjustment.
This is a fixup to commit 39329935. The two fixes are
* add forgotten offset `y' when drawing the line
* in order to have a continuous vertical line, draw from the offset of
the previous row.
Fixes bug #10363.
The window title is built from the current file name and its
mofidication state. We use our own code instead of the automatic title
bar provided when windowFileName() is set because
1/ Qt does not keep the full path name
2/ Qt does not yield a nice application name
The "read only" and "version control" status are shown in the status bar:
* for read only we use the tab read only emblem (with the right size)
* for version control, we show the name of the backend (using a new
vcname() method of the backend).
The iconText() of the view is not updated anymore, since this is
deprecated in Qt5.
Now the external material file dialog shows the file types defined in the
template again. Before this fix it did only show "All files (*)".
I don't know what the old syntax was supposed to do or whether it ever worked
with boost::regex, but with std::regex the new one is correct.
As noted in the log, this commit was a bit radical and needs some
adjustments (which was expected, actually).
Let InsetText do their own background drawing.
Fixes bug #10359.
Before, it could have been the case that
lyx -e pdf2 file.lyx
had exit code 0 even though file.lyx includes a file that exits with
error. If compiled in the GUI a warning was given, but from the
command line exit code it would seem there was no problem. The exit
code for this case is now non-zero and the word "Warning" is now
removed from the message because it should be treated as an error.
An exception is thrown from InsetInclude and is caught in
Buffer::makeLaTeXFile() and added to the error list.
The (similar) use case at #8840 is also fixed by this commit.
buffer-zoom-out can actually zoom in (by giving a positive number as
the argument), so it should only be disabled at the minimum zoom
level if it is indeed zooming out.
Similarly, buffer-zoom-in can zoom out, so it should be disabled if
the user is at the minimum zoom and it is called to zoom out.
This commit amends 8884c404.
Replace the member reference to FuncRequest in Action.cpp with a
shared_ptr. Compared to copying the FuncRequest, the shared_ptr has two
advantages:
* Recreating the menu each time creates a lot of new actions, so we avoid a lot
of copies.
* FuncRequest can remain forward-declared in Action.h.
The field prettyname can accept Unicode and therefore must be parsed into a
docstring.
Little simplification of the code on the way.
* For other fields, either a validator should be set to prevent non-ascii input
in the preferences, or they should be transformed into docstring too.
When breaking paragraph in an empty top-level paragraph, nothing
happens on screen but yet there is an undo step because the layout is
reset to what it already was.
Avoid this case.
Fixes bug #10089.
Single quotes are special to our parser and must be either escaped or
quoted if they are part of a filename, otherwise they are stripped out.
See #10342.
Since we process layouts sequentially, we export LaTeX code for the
title once we arrive to a layout that has InTitle false. If the
document then later has a layout with InTitle true, we do not
(currently) go back to add it to the title and just output it
in-place. We previously warned with LYXERR0, but since this can
cause missing or unexpected output we now warn in the GUI.
For more information, see the following lyx-devel thread:
https://www.mail-archive.com/search?l=mid&q=a65ae226-d3bd-8fc5-a93b-7bb23f1cda82%40lyx.org
Now by default all insets paint their own background when needed. This
means that 63cf3297 and part of 9940acc5 can be reverted.
To avoid extra painting, background drawing is disabled for
InsetCommand and InsetCollapsable. These insets draw background as
part of their normal drawing activity.
This will avoid drawing artifacts with InsetNewpage, InsetVSpace and
probably some others.
Fix assertion with gcc 6: The comparison function must be a strict weak
orderings and not give x < x.
Fix assertion when a custom exportable document format is given a non-ASCII
name. Use qt_ to be consistent with the rest of the code.
Use Qt's locale-aware comparison for appropriate sorting.
There was an oddity in the manual that exposed a problem with the
test for the "special case" of an inset all by itself in a pargraph.
If a font change is applied to that inset, we still need to open the
paragraph.
File format change. On format reversion, we need to put some extra code
in the local layout that emulates the 2.3 behavior.
Simply Input'ing the respective layouts is unfortunately not enough,
due to the insertion order.
See #9977
"lyxclient -g" now calls the just implemented lyx-activate (see
previous commit) after server-goto-file-row. This allows the PDF
viewer to switch to LyX after executing a reverse search.
On Linux and Mac OS, this action brings the LyX window into focus.
Such behavior is not allowed by Windows OS so instead the color of
the taskbar entry is changed to indicate that the window has changed
in some way.
The action is hidden in the shortcuts menu because it would make
sense to assign a shortcut to it. The only way to execute shortcut
would be if the LyX window is already activated.
lyx-activate will be used (see next commit) to allow the PDF viewer
to switch to LyX after executing a reverse search.
* New constant LYXFILE_LAYOUT_FORMAT in src/TextClass.cpp. This determines the
layout format corresponding to the current lyx file format.
* The Local Layout pane is changed so that the "Convert" button does not convert
to the internal layout format but to the current lyx file format, to make sure
that the file does not become unreadable with a specified earlier version of
LyX.
* If LYXFILE_LAYOUT_FORMAT == LAYOUT_FORMAT then LyX behaves as before. This is
the value defined in master.
It is currently called on hundreds of files: settings, layouts, icons, cached
graphics files (incl. graphics from files that are not opened on startup).
According to callgrind, fixing the FIXME comments could speed up startup by more
than 30%.
A static local variable is guaranteed to be initialized only once, and in time.
Lambda expressions can be used to perform complex initialization of those static
variables on the spot.
(starting from: gcc >= 4.8, msvc >= 2015)
Prevent setRange() from causing a recursive call to scrollTo(). Reduces three
calls of scrollTo() to one call for all scrolling functions of the scroll bar
(e.g. clicking on the arrow, dragging, or clicking somewhere on the scrollbar).
The function is no longer used in LyX's sources (as of the previous
comit, 9b64d7bd) and is thus removed with this commit. Perhaps the
advantage this function had over other path functions we have has
disappeared over time (see e.g. 1a7b7f65).
Before this commit, in the paths preferences tab if you put a
relative path, LyX would convert it behind the scenes to an absolute
path by evaluating the relative path with respect to the working
directory of the LyX instance where the preference change is taking
place. This seems confusing because (1) it is done behind the scenes
(after the preferences dialog is closed) and (2) if the user chooses
to enter a relative path, the safest thing to do is to preserve it
as a relative path, instead of making the assumption that the user
intended for it to be expanded to an absolute path.
An explanation of how relative paths are handled is given at the
bottom of the paths tab. Note that the height/width of the
preferences window is not changed as a result of adding this
explanatory comment because the height of the preferences dialog is
already stretched by other tabs.
This commit improves consistency in the sense that the behavior of
LyX is now the same when a relative path is specified in the
preferences dialog as when it is manually specified in the
preferences file. Before, if the preferences file were manually
edited and a relative path were inserted, the next time the user
made a change to preferences with the GUI (even if the preference
change was a different preference, e.g. instant preview), the
relative path would be silently converted to an absolute path,
evaluated with respect to the working directory of that instance.
Beyond improving clarity and consistency (IMO), this commit allows
for a new feature to be implemented of using relative paths in the
paths preferences. For example, the user may now enter '.' as the
"Working directory" path and now whenever they start LyX from a
directory and create a new file, the default location of the file
will be the directory from which they started LyX, instead of the
user's home directory which is LyX's default and is less intuitive.
No prefs2prefs work is needed because if a relative path were
entered in the preferences dialog before this commit, it was
converted to an absolute path before being stored in preferences. If
a relative path were specified by manually editing the preferences
file, then (unless the path were already automatically converted to
an absolute path by a GUI preferences change, as described above)
the behavior will be the same (the path will be treated as a
relative path).
For related discussion, see the lyx-devel thread here:
https://www.mail-archive.com/search?l=mid&q=20160616003010.bnymtcouar7g55ti%40cotopaxi
This commit removes the last use of lyx::support::expandPath() in
LyX's sources.
The Qt documentation states that tabAt() returns -1 if the position
is not over a tab. This behavior has been consistent since Qt 4.3
[1]. This commit's improvement likely makes the code faster in two
ways:
(1) we do not need to loop through potentially all tabs
(2) we only need to look up the tab index corresponding with one
position
posIsTab() is not currently used intensively so no practical gain in
speed is achieved, but it protects against future use.
[1] https://doc.qt.io/archives/4.3/qtabbar.html#tabAt
This is the default behavior of Chromium and Firefox. The main
appeal is that instead of having to precisely click on the 'x' to
close a tab, one can more easily middle-click anywhere in the tab.
The tab is closed if the middle button is pressed on a tab and is
relased on the same tab. After pressing, the user may move the mouse
over other tabs but as long as they move it back to the tab where
they initiated the press before they release, the close will
execute. This is how the feature works in Chromium and Firefox.
Nothing is done if the user middle-clicks on the blank part of the
tab bar. This is consistent with Chromium. Firefox, on the other
hand, opens a new tab. In LyX one can already double-click the blank
part to open a new tab, and in feedback from lyx-users [1] most
expected and desired that nothing be done in this case.
[1] https://www.mail-archive.com/search?l=mid&q=20160720063306.6fyarf3kywexbxvd%40steph
A chunk of code in an event handler seems to be unnecessary to me
because the event that the situation handles never makes it this far
in the event handling hierarchy. I'm not sure why this is, and thus
I'm not sure if this is true in all cases (e.g. Qt version) and if
it will be true in the future so I leave this code for now.
In redoParagraph, this should be done before coping with the insets,
other wise some graphic gliches may occur. This is a better fix for
Fixes bug #10163.
With the commit cb0c881 we reference XSendEvent in X11-lib
if qt uses X11.
For QT5, this library is pulled by Qt5X11Extras, but
for QT4 we have to add it too.
Spotted by Scott Kostyshak.
For reference, the bug was that quote insets grew bolder because, when
painted over themselves, anti-aliasing made them darker.
It turned out that the fix there created others than were
painstakingly fixed: #7164, #7165, #7174, #7193... More recently, it
created other problems:
http://article.gmane.org/gmane.editors.lyx.devel/163471
We use the right fix here:
* draw background of quote inset when not doing full repaint
* draw background of math macro template when not doing full repaint
* remove hack that grew from #4889 fix.
The default for ZOOM_OUT is -20 from a user perspective. That is,
the following are equivalent:
buffer-zoom-out -20
buffer-zoom-out
The reason for this is that the argument to ZOOM_OUT is treated the
exact same way as ZOOM_IN. The only way they differ is how the
default case is handled.
This commit also clarifies that (1) the argument may be positive or
negative and that (2) the argument is interpreted as percentage
points, not percent.
The code that specializes for double elements in the display string
does not trigger anymore: displayString() returns a single unicode
value, plus some space for french guillemets.
Use a thin space for these french quotes instead of a plain space and
remove special case in metrics().
was not English: We return the the abbreviated author "One and Two",
but translated to the GUI language; then we search that for " and "
in order to pull the authors apart again.
I've just replaced the distinct routines with a single one that handles
both cases, depending upon whether a Buffer is provided as one argument.
* Fix bug #10261 : KDE smartly adds conflicting accelerators.
* Prevent bugs like #9495 in the future.
Issues (non-regression):
* It does not appear possible to prevent Ubuntu's Unity from grabbing the
accelerators for the menus. For instance Alt+A still opens _Affichage in the
French localization.
Add a new checkbox "Save transient properties" to the "Output" panel in the
document properties dialog (now renamed as "Format").
This provides the front-end for the change at 5c2d04999.
is output when a branch is NOT activated. Fixes bug #7698.
At the moment, inversion is controlled through the branch settings
dialog. There is no provision for inserting inverted insets directly,
or for changing them from the context menu. Both of these could be
done, of course. The latter would need LFUN_BRANCH_TOGGLE_INVERTED.
The differentiation of "xetex" and "platex" is not needed here,
is ambiguous and confusing (see #10013). The code that relies on
it can/should get its information otherwise.
Furthermore, polyglossia-exclusive languages now also work with
LuaTeX, since we support LuaTeX + polyglossia.
With both Qt4 and Qt5, when using a click-to-focus policy, the first
attempt to paste a selection by middle mouse in an external application
which has no focus may fail. It is not clear why this succeeds for some
applications and fails for others, but refreshing the timestamp of the
selection request cures the issue. The cmake part is by Kornel.
See also this thread:
http://thread.gmane.org/gmane.editors.lyx.devel/162491
dealing properly with the paragraph separator tag.
We really need to use that tag as a kind of general marker for which
tags we're responsible for in a given paragraph and which tags we are
not. So the changes to InsetText.cpp use the tag as that kind of marker.
Note that, as of this commit, the User Guide again exports without any
kind of error. I haven't yet checked the other manuals.
This fixes bug #8022.
A window manager could be configured such that to maintain a certain
stack order for the windows. It would be annoying that opening a new
file through menu brings up the window, so do this only if we are
loading a file through the lyx-server.
The line felt too thin.
Note: I am still sceptical with the principle of an increase at the rate of
1/200% instead of 1/100%.
Also, I am sceptical with changing painting dimensions to int when Qt supports
doubles for everything (see e.g. 463bd17d). If the goal is to force
integer-width solid lines then one could try to disable antialiasing on Qt's
side.
I think the painter should move in the other direction, towards more doubles and
fewer ints. For instance, for Hi-DPI, Qt could probably take advantage of the
increased precision even without AA. (Then one would have to fix the problem
regarding uneven lines, mentioned in the above commit, in another fashion.)
* Underline or strike through the label as if it was text (it is).
* Strike through deleted InsetText, but let RowPainter handle the case of
non-MultiPar text insets.
* Change the colour of the frame as a cue, unless its colour is customised (not
Color_foreground). (Essentially do the border of CharStyles like Tabular does
it already.)
* The change info needs to be reset when entering InsetText. Otherwise labels
are painted with the change of their n+1-th parent.
It is not possible to use opacity effects (such as drawing an antialiased line
to strike diagonally through an inset), until the painter is fixed so that it
does not redraw repeatedly over the same spot (otherwise, the usual aritfacs
appear).
For now, pixellated lines are OK.
* Justification and nicer line breaks.
* Much nicer tooltip for lists of bibliographical references.
* Removed unnecessary iterated copies of the string buffer in
InsetText::ToolTipText() which looked bad. This function used to be costly
(cf64064), maybe it is quicker now.
After the previous commit, tooltip in the outliner are formatted automatically,
along with the other tooltips. A previous commit had already removed the
expensive call to tooltipText() that, although it gave a better rendering, was
very expensive (cf64064). This patch finishes to remove the custom tooltip
from the model data in the outliner.
(It would be nice to reintroduce a tooltip based on tooltipText(), but there
seemed to be a consensus that in that case one would prefer a less expensive
approach that computes the tooltip on the fly.)
* The tooltips in the list of modules now include the names of the modules.
* The tooltips of modules more consistent across the widgets.
* Sort the list of modules according to the locale (i.e. "É" comes before "F").
* Replace a hand-made sentence boundary finder by Qt's.
* New function formatToolTip(QString):
Format text for display as a ToolTip, breaking at lines of a certain
width. Note: this function is expensive. Better call it in a delayed manner,
i.e. not to fill in a model (see for instance the function
ToolTipFormatter::eventFilter).
* Install a global event filter that formats tooltips on-the-fly
Inspired from
3793fa09ff
but much improved.
When is formatToolTip called automatically? Whenever the tooltip is not already
rich text beginning with <html>, and is defined by the following functions:
* QWidget::setToolTip(),
* QAbstractItemModel::setData(..., Qt::ToolTipRole),
* Inset::toolTip() (added in one of the subsequent patches)
In other words, tooltips can use Qt html and the tooltip will still be correctly
broken. Moreover, it is possible to specify an entirely custom tooltip (not
subject to automatic formatting) by giving it in its entirety, i.e. starting
with <html>.
This is the well known file locking problem: The TempFile class keeps the
created file locked for the own process, and this prevents the CAS to read it.
We need to invalidate the BibTeX cache when undoing or redoing. I do
not like having to do it for every undo or redo. We should only have
to do it if we restored or deleted an InsetBibTeX. But there is no
way, so far as I can see, to do it that way. I tried.
The main thing it does is integrate mouse-modifiers into the
FuncRequest machinery. Previously, these had to be passed
separately, which led to some ugly function signatures.
There was also an unnecessary form of the constructor, which
can now be removed.
No change of behavior is intended.
The only exceptions are:
- The purpose of the header is to drag in the used symbol, e.g. unique_ptr.h
- The used symbol is inside a class or a namespace other than lyx
The reason for this is that global 'using' statements effectively forbid to
use the used symbols in any other namespace in the whole program, since simply
adding or removing an #include of the corresponding header subtly changes the
name lookup. The namespace lyx is sort of global, so it should not have these
statements either.
Maxima uses \it as a markup for multiletter variables. However,
it has been reported that since texlive 2016 using \it in math
mode produces an error, even though I was not able to reproduce.
Anyway, this can be avoided by replacing the old-style construct
"{\it ...}" with the new-style one "\mathit{...}".
The problem has also been reported upstream:
https://sourceforge.net/p/maxima/bugs/3181/
but this workaround will hold whatever the resolution.
output of tags until we know they're needed. In the case of HTML
tables, empty cells should of course be output, so we need to force
the tags to be output.
The external date inset was implemented as a demonstrator for external insets
in general. It was never intended for production code. Now that we have several
external insets defined we do not need the demonstrator anymore. This fixes
bugs #4398 and #9948.
This was dead code that did never work, and most of it was boilerplate that
you can steel in 15 minutes from any existing math inset. Apart from that it
did contain a pointer to InsetXYMatrix which would create the same problems
we saw with the macros.
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).
Profiling of scrolling inside a document over macro-instensive areas:
Before the patch:
44,1% BufferView::updateMetrics()
-> 34,8% InsetMathHull::metrics()
-> 9,8% FontSetChanger::FontSetChanger()
28,4% BufferView::draw()
After the patch:
35,3% BufferView::updateMetrics()
-> 27,2% InsetMathHull::metrics
-> 0,4% FontSetChanger::FontSetChanger()
47,5% BufferView::draw()
FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
Replace the manual manipulation of a stack of RowEntries with a Changer
function. When I introduced the stack of RowEntries, I did not know about the
Changer mechanism.
* Inset::canTrackChange() had two meanings: can it deal with change tracking?
Will it paint its own CT status? The latter information is now given by
Inset::canPaintChange().
* Line thickness computation is moved from RowPainter to MetricsBase.
* Painting function for Changes moved to lyx::Change. (One new, that strikes
diagonally.)
RefChanger temporarily assigns a value to a non-const reference of any
kind. RefChanger provides a flexible and uniform generalisation of the various
scope guards previously derived from the old Changer class in MetricsInfo.h.
As before, a temporary assignment lasts as long as the Changer object lives. But
the new Changer is movable. In particular, contorsions are no longer needed to
change a private field. Special code can be moved into the appropriate classes,
and it is no longer necessary to create a new class for each specific use.
Syntax change:
FontSetChanger dummy(mi.base, value);
-> Changer dummy = mi.base.changeFontSet(value);
New function for generating arbitrary Changers:
Changer dummy = make_change(ref, val, condition);
Bugfix:
* Fix the display of \displaystyle{\substack{\frac{xyz}{}}} (missing style
change).