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).
The command 'lualatex' can produce a DVI with the option
--output-format=dvi
It is best to keep things as is because it is better to guess a PDF
than to guess a DVI (we do not use that feature of the 'lualatex'
command internally; we use 'dvilualatex' instead). However, we
should ideally get this information in a more robust way.
Thanks to Günter for pointing this out.
XeTeX with TeX fonts is only safe with ASCII input encoding (see #9740)
and we therefore force "ascii" when exporting with XeTeX and 8-bit TeX-fonts.
However, "utf8-plain" is a "power-user" option, which allows to switch off LyX's
encoding of the LaTeX file:
keep this also for "XeTeX with TeX fonts".
The user is responsible to ensure all characters can be processed and are
correctly shown in the output. The provided test sample shows the problems
with this encoding without special measures (like loading fontspec in the
user-preamble or a document class).
Boost.Signals is deprecated. This fixes bug #9943.
The only thing left to do is to rewrite (or get rid of) the boost -mt test
in config/lyxinclude.m4 not to use signals anymore.
It is no longer needed to create fake copy constructors and assignment and to
deal with deletion by hand, thanks to unique_ptr, the inference of move
constructor and assignment operator, and the compatibility of standard
containers with movable objects.
Two better ways of making a class non-copyable in C++11:
* Store the p. impl. in a unique_ptr (for the cases of classes with p. impl.),
or:
* Define publicly the copy constructor and assignment as deleted
Lots of other classes could be cleaned up in this way.
This is a mechanical replacement. For now it seems that unique_ptrs are
essentially used for exception-safety. More could certainly be done to clarify
pointer ownership in general.
The parameter passed to allowDisplayMath will need to be copied, so it
made sense to pass it by value. Since Coverity complains about that,
the code is rewritten to make the copy explicit.
This code is signalled as a copy and paste error, but it is a false
positive.
According to the documentation, adding a comment starting with
// coverity[name_of_error]
should be enough to flag the false positive.
As discussed on the list. If no C++11 compiler is found configuration stops
with an error. There are now unneeded parts of boost, the will be removed in
a second commit.
Qt only supports SVG 1.2 tiny, so we prefer to convert on our own if an
explicit converter is defined and the converter cache is used (otherwise
the conversion would be too expensive).
The version of LuaTeX that ships with TeX Live 2016 now gives the
following message after processing a document that yields no pages
of output:
"warning (pdf backend): no pages of output."
The lowercase "n" in "no" is a change that caused our parser not to
pick up the message.
A few parts of our code depend on correctly identifying the output
format of LaTeX commands. One specific bug is that because the
output file was not correctly set, it was not removed after an
error. For example, this commit fixes the following bug:
1. Create a new document that contains "hello\blah" where \blah is
in an ERT box.
2. Compile with PDF (LuaTeX). You'll get an error because of \blah.
3. Close the error dialog.
4. Remove the text "hello" and compile again with PDF (LuaTeX).
The error dialog is shown and the "Show Output Anyway" button is
enabled. If you click it, it shows the previously compiled PDF (with
the text "hello"). With this commit, the button is correctly
disabled (and the output file is deleted).
Some qt versions report both "jpeg" and "jpg" as loadable file extensions.
In this case the jpg format was added twice previously. This does not happen
anymore with the new code, and it works as well if only "jpg" or only "jpeg"
is reported.
It is wrong to assume that direction is left-to-right when no indication exist.
Add a new enum with values LtR, RtL and Auto to be used as argument of
the private text() methods. When direction is Auto, let Qt decide how
the string shall be layed out.
Fixes bug #10169.
TocModels::reset() in GuiView::structureChanged() collapses the TocWidget, and
therefore requires an update right after, which was missing.
In fact, profiling TocWidget::updateView() shows that delaying the update is
good only for fast keypresses (essentially movement). It costs 5% of a
char-forward operation in a document with approx. 100 table of contents
items. The update optimisation has been rewritten to take this data into
account.
The new functions parBottomSpaging and parTopSapcing return below/above each paragraph.
This allows to remove the TopBottomSpace argument and makes the code a
bit clearer.
Now that Row has a pit() member, it is possible to use it instead of passing an extra pit_type parameter to a function which already has access to a Row.
Change the various paint* helpers to take a single row element as argument.
Do not update x_ in the various paint* helpers. Constify them. Update x_ in paintText and paintOnlyInsets instead.
Remove an empty call to paintForeignMark in paintInset (the call did nothing since orig_x == x_ at this point).
It is actually easier to set the 20 pixels margin in redoParagraph, since it is not necessary to take newlines in account when deciding what is the real last row of the paragraph.
Moreover this solves the following bug (present in 2.1.x too): when the document ends with a newling, the bottom margin disappears.
Update PAINTING_ANALYSIS with new tasks.
* remove optional arguments to the helpers that use a FontInfo
* add a textwidth argument to the text() methods that are used by rowpainter.
Now textwidth is only computed if a null value was passed to the
text() method. This means that in the use case of rowpainter, no
textwidth needs to be computed.
The initial values for maxasc and maxdes (renamed from maxdesc) is obtained as a maximum of max ascents/descents of all row elements.
This allows to get rid of Paragraph::highestFontInRange and FontList::highestInRange.
Some auxilliary variables declarations are also moved to where they are needed.
Let breakRow return a boolean indicating whether an additional row is
required (after a newline) and use that to replace the code that added
an extra row when a paragraph ends with a newline.
There are two main cases:
* when drawing is disabled from the start, use a simplified code that only paints insets (in order to cache positions).
* when the row is not visible, do the same.
The goal of this optimization is to be able to always run a no-drawing draw after the metrics have been computed.
This is a first cleanup step. More complex rules have to be
implemented on top of this.
Use proper spacing \thinmuskip, \medmuskip and \thickmuskip instead of
ad-hoc values.
Rename isRelOp to isMathRel and introduce isMathBin and isMathPunct
(for InsetMathChar and InsetMathSymbol). Update the categories of
characters in InsetMathChar according to LaTeX source (fontmath.ltx).
Set correctly the spacing around mathrel, mathbin and mathpunct
elements. Use \thinmuskip around MathDelim instead of a hardcoded 4.
This is related to bug #8883.
There is already a spacing of 2 pixels on each side of a button (e.g. collapsed inset). There is no need to add one extra pixel for command insets.
Fixes part of bug #10149.
The computation of the width of the button was wrong. If <--> stands for TEXT_TO_INSET_OFFSET/2 spacing, and if `[]' marks the button's limits, then the intent is
<-->[<-->button text<-->]<-->
Therefore the physical grey rectangle width is
width - Inset::TEXT_TO_INSET_OFFSET
With this change, the spacing on the right of the button is not larger than the left one.
Fixes bug #10147.
The way it works is:
* the inset defines allowParagraphCustomization() correctly
* Text::getStatus acts on it.
Note that, in Text::getStatus, testing for cur.inset().allowParagraphCustomization() does not make much sense, since one should pass the cursor idx as parameter. Actually, for some reason the safest bet is to use the owner of the Text object as inset.
The way it works is:
* the inset defines forcePlainLayout() correctly
* Text::getStatus acts on it.
Note that, in Text::getStatus, testing for cur.inset().forcePlainLayout() does not make much sense, since one should pass the cursor idx as parameter.
There are many other lfuns that do not have to be handled directly by insets. InsetScript in particular has tests for way too many lfuns.
This method did access more CursorSlice than Text. It is only a setter for
CursorSlice with some bound checking. The new signature is
setPitPos(pit_type, pos_type).
The old name would be confusing wrt setSelection(), which does additional checks.
This one is a pure acessor, and the more complete methods are
* setSelection(), which avoids empty selections
* clearSelection(), which resets anchor, and sets word selection and mark more to false.
Most of the code should use these two instead of selection(bool), but this is for later.