* 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.
It turns out that it did not take off since introduced in 2011. It is better to remove it and the associated boost headers (extract.sh was run against boost 1.60 to do the update).
Since we will move away from several boost classes when transitioning to C++11, it is good to start by removing lesser used ones.
It is easier to use instead getVectorFromString for the use we have of this tokenizer. The two places are environment.cpp (path stuff) and qt_helpers (file fileters). The new code is much shorter.
This allow to remove boost/tokenizer.hpp and friends from our boost tree.
Some headers contain
class Foo;
whereas there is no class Foo.
The list of class statements is given by
classes=`git grep '^\(class\|struct\) [a-zA-Z_:]*;' src | sed 's/^.* \(.*\);/\1/'|sort -u`
The ones that are useless are:
for c in $classes ; do grep -r "\\<$c\\>" src| grep -vq '^[^:]*:\(class\|struct\) [a-zA-Z_:]*;' || echo "$c"; done
Those two functions used two different hackish and buggy
implementation to know when the function is disabled. Replace that by
asking the containing inset whether it accepts inserting display math
inset.
Fixes bug #10033.
When in a tabular cell, "this" is just a lone InsetText, while cur.inset() is the whole tabular. This makes a big difference, especially when one wants to count cells.
Fixes bug "9954.
Compiling different parts of the sources with different WINVER may lead to
subtle and hard to detect problems. Better use the same value everywhere.
The existing error message suggests that this was wanted anyway, and it
fixes a compiler warning when cross-compiling for mingw on linux. Our code
does not require a specific value, only a minimum value of 0x5000, which
means the resulting executable will require at least Windows 2000.
Only the ones I understand (DWORD is always unsigned). There are more:
../../src/Server.cpp: In member function ‘bool lyx::LyXComm::pipeServer()’:
../../src/Server.cpp:280:10: warning: enumeration value ‘CONNECTING_STATE’ not handled in switch [-Wswitch]
switch (pipe_[i].state) {
^
../../src/Server.cpp:347:8: warning: ‘success’ may be used uninitialized in this function [-Wmaybe-uninitialized]
&& status == pipe_[i].iobuf.length()) {
^
Use the standard way to check for the resource compiler, as e.g.
libtool does it: AC_CHECK_TOOL does already provide some cross compiling
magic, and we do also get an error now at configure time if windres is not
found.
"Output changes" alters the preamble even in the absence of tracked
changes. Therefore, not being able to notice when it is activated can possibly
yield hard-to-debug compilation failures.
The windres program is typically not called windres for cross compilation.
Now you can call configure with the argument
WINDRES=x86_64-w64-mingw32-windres
in order to use the windres program on a standard debian installation.
The included iconv should not be used on Linux or OS X, but (depending on
local configuration) it might be needed for crosscompiling a mingw target
from Linux. Now the user can choose whether to use the included iconv or not.
cmake does already support that.
eilseq.m4 was taken from the original libiconv 1.14 package.
On mingw-w64, long long (64bit wide) is larger than long (32bit wide).
Therefore we need some more specializations for string, docstring,
otextstream and << overloaded ostream functions. The configuration code
is by me, the source code changes by Shankar Giri Venkita Giri (bug 10053).
This is needed for warning-free compilation with mingw-w64, and does not hurt
for other build configurations. Patch by Shankar Giri Venkita Giri (bug 10053).
The included zlib should not be used on Linux or OS X, but (depending on
local configuration) it might be needed for crosscompiling a mingw target
from Linux. Now the user can choose whether to use the included zlib or not.
cmake does already support that.
zconf.h.in was taken from the original zlib 1.2.8 package. The generation of
zconf.h was made equivalent to the one generated by cmake.
(#8738)
For efficiency, we add a new flag to the buffer indicating when changes are
present. This flag is updated at each buffer update, and also when explicitly
requested via a dispatch result flag.
If we do not do that, it is not possible to position the cursor after
a long inset with the mouse.
To do this, it is necessary to add the pit information to the Row
object. This is a good idea in any case, and will allow to simplify
some code later on.
Fixes bug #10094.
The timer logic introduced to solve bug #7138 was not entirely reliable; in
particular it resulted in spurious updates (noticeable by the treeview
collapsing just after one opens a branch, in particular).
This commit cleans up the timer logic. I followed the original design decision
of having an immediate update followed by a delayed update. Now the updates are
appropriately compressed and done after a delay of 2s (as can be noticed with
the treeview still collapsing, unfortunately, but after a more predictable
delay...).
4d1ad336fixed#9754 but caused perf issues by cancelling the gains of having a
timer (introduced after #7138). This introduces in GuiToc::enableView() a
lightweight check of whether the widget should be updated. The logic is inspired
from GuiViewSource::enableView().
When document settings are modified, a command
inset-forall Branch inset-toggle asign
is run to open as needed all branches. At the end of the said loop,
the cursor is reset to where it was. However, the cur_after undo
element member is not set because it already had a value.
To make this work as expected, it is necessary in LFUN_INSET_FORALL to
reset the cursor before ending the undo group and to insert a dummy
recordUndo call.
Fixes bug #10097.
Deriving from std::vector to provide helper functions appears a touch
excessive. Use typedef instead and move helper functions to the base class. New
header Toc.h provided to replace forward-declarations.
Remove TocIterator which is useless.
The old name conflicted with the newly introduced Inset::isTable.
Now the meaning is as follows.
* Inset::isTable() is true when the inset is composed of lines and columns
* InsetMathHull::allowsTabularFeatures is true when the current type of hull allows for tabular-like functions.
While a one paragraph large collapsable inset (containing for example a tabular) could be very wide and trigger horizontal scrolling, the code that makes collapsable insets wide when they contain several paragraphs would actually make them narrower in this case.
Typical example is a wide tabular and a caption in a table float, where horizontal scrolling would not trigger.
The purpose of this custom widget is to allow the use of a QToolBox in a limited
area. The stock QToolBox does not provide a minimum size hint that depends on
the size of the pages; it assumes that there is enough room. This subclass sets
the minimal size of the QToolbox. Without this, the size of the QToolbox is only
determined by values in the ui file and therefore causes portability and
localisation issues. Note that the computation of the minimum size hint depends
on the minimum size hints of the page widgets. Therefore page widgets must have
a layout with layoutSizeContraint = SetMinimumSize or similar.
inset-select-all has 3 levels
1. select current cell
2. select all cells
3. select inset from outside.
The second level makes sense for tables (text and math), but not for things like a math fraction.
Introduce a new method Inset::isTable() that allows to detect this case properly and skip level 2.
This is done by implementing the clickable method. It is not possible yet to have the usual left and down arrows, because Qt does not implement them as far as I can see.
Factor the code that triggers row/column selection and fix the logic. Now it is possible to select also at the right of the tabular inset.
When several bufferviews exist for the same inset, the data that depends on the view width have to be BufferView-dependent. While this is the case for several mutable members of InsetCollapsable, some were missing.
This commit makes button_dim_ (renamed from button_dim) and openinlined_ bv-dependent.
Get rid of the hitButton function.
Remove the bv-independent geometry() method and implement editable() explicitely instead.
Fixes bug #9756.
"echo -e" is definitely not portable. Use a plain loop instead.
Also use the automake silent rule mechanism to make the generation of monolithic source files visible.
When the box has a special width, one should not consider that as a fixed width. Otherwise, due to implementation quirks, the width will be set on screen as 1 inch.
A better solution would be to actually set the width by taking in account the contents width, height ans total height. This is not very difficult, but I do not know whether it would workout well in the work area.
Fixes bug #10048.
The purpose of this custom widget is to allow the use of a QToolBox in a limited
area. The stock QToolBox does not provide a minimum size hint that depends on
the size of the pages; it assumes that there is enough room. This subclass sets
the minimal size of the QToolbox. Without this, the size of the QToolbox is only
determined by values in the ui file and therefore causes portability and
localisation issues. Note that the computation of the minimum size hint depends
on the minimum size hints of the page widgets. Therefore page widgets must have
a layout with layoutSizeContraint = SetMinimumSize or similar.
Ask the user for removing bindings when using the "restore" button (#9174).
Fix the already-bound-key detection logic.
Don't forget to trigger the search when initializing the search LineEdit with
its former value.
Remove in particular all comparisons < and >= involving HullType.
Add a guard to make sure that mutate() only operates on types it has been
designed for. Then I figured I could use this new knowledge to give feedback
when math-mutate is not implemented via getStatus(). (To test this, insert a
regexp in Advanced Search & Replace and try to change it into a standard
equation via the contextual menu.)
AMS align environment should have some spacing between odd and even columns.
Add a new virtual method displayColSpace() to InsetMathGrid, InsetMathHull and
InsetMathSplit.
A longstanding problem... (related: #1861)
The columns in AMS math environments have a fixed alignment (colAlign() in
InsetMathGrid.cpp). We set this alignment for display (Georg's
displayColAlign()) in InsetMathHull and InsetMathSplit. This is done according
to tests and documentation for the various environments.
There is also some mechanical code factoring via colAlign().
Finally, I disable setting the horizontal alignment in InsetMathSplit, which has
no impact on the LaTeX output, and has no longer any impact on the screen. (As
for vertical alignment I discovered that it was in fact customisable for
\aligned & friends! I hope that the more faithful interface will let other
users discover that too.)
The offending code appears to have been introduced a long time ago. My
understanding is that it is no longer relevant. Notably, it only appears on copy
and not on cut, which tells us that: 1) it should be safe to remove it, 2) we
should remove it for consistency.
With Qt 5, our code did not correctly detect when icons were
available and thus tried to use nonexistent icons.
QIcon::hasThemeIcon(theme_icon) returns true when theme_icon is
empty. We now rely on the behavior that QIcon::isNull() returns true
if the icon is empty.
The same code is used with Qt 4 and Qt 5.
This is used when scaling graphics previews. It is also used on a rare occasion
to scale instant previews when the user's configuration mixes low-dpi and
high-dpi monitors (#10114).
With this change, it becomes possible to run the following commands:
inset-forall Separator:latexpar char-delete-forward
inset-forall Separator:parbreak inset-modify separator plain
The first one deletes all latexpar separators. The second one turns parbreak
separators into plain separators. This is safe, flexible, and avoids adding a
new LFUN.
2.1.x allows some document settings to have negative values where
2.2.0rc1 does not (because of the bug fix at 9e166088). If a user of
2.2.0rc1 opens a document from 2.1.x that contains one such negative
value, it will appear as though no change to the document settings
can be saved because 2.2.0rc1 treats the document settings as
invalid immediately on opening the dialog. Further, unless the user
manually goes through each tab they will not see the red text next
to the input that is now considered invalid. This could lead to
confusion for users. One example of such confusion is [1].
The following settings now allow negative values, which is
consistent with 2.1.x. Negative values in these settings do not lead
to LaTeX errors:
- Text Layout tab: the two line edits enabled with "Custom"
- Page Margins tab: all eight line edits
The following settings are not changed by this commit, so they now
(with 2.2.0) do not allow negative values that 2.1.x allowed. This
change makes sense because negative values lead to LaTeX errors in
these cases:
- Page Layout tab: the "Height" and "Width" line edits, which are
enabled when "Custom" is selected
[1] https://www.mail-archive.com/search?l=mid&q=CAGZ2pgXqf27UaAaQ%3De_wFz1fGTa6Yv0iFyS97qu1C7B5R59irg%40mail.gmail.com
An undocumented behaviour of QClipboard::mimeData() is that it can fail on
windows due to the specificities of the windows API that allow a race condition.
In particular it seems that querying the clipboard as soon as the dataChanged()
signal is received favourises this race condition.
Thanks to Trac user bquistorff for the explanation and a proof of concept patch.