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.
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
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.
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.
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.
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.
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.
Regression at cfeddb929. If a flex inset has no layout upon saving (e.g. if a
module has been deleted) then its name became lost. This checks whether the name
resolution, introduced with the ObsoletedBy tag, comes back empty-handed (which
it will if the layout is not defined). In this case, we do as was done before
cfeddb929.
In addition, the use of support::token to strip "Flex:" off the beginning of the
name introduces a regression if somebody used a name containing ":". This
replaces it with support::split.
This is the same as the parbreak separator and is represented on screen
as the old parbreak. Old parbreak separators are converted to latexpar
separators when they are used for introducing blank lines in the
latex output rather than for separating environments.
Instead, parbreak separators are now represented on screen by a
double line. In essence, latexpar and parbreak separators produce
the same output but are represented differently on screen.
The context menu does not account for latexpar separators and only
"true" separators can be turned each into the other one.
The term LongTable has been deprecated and moreover the renaming makes the interface easier to the eye.
File format updated to 507. (conversion based on jamatos patch)
Layout format updated to 60.
tex2ylx tests updated.
Document EmbeddedObjects.lyx has been updated.
This fixes a failing unit test with 32bit gcc 4.9.3 and -O2 optimization:
It computed 9953 instead of 9954 for Length::inPixels() of value 2342.
The reason for this is probably different rounding behaviour caused by storing
the unrounded value in a processor register (uses 80bit accuracy) vs. writing
it back to memory (uses 64bit accuracy). The unrounded value is very close to
9953.5 (which is not representable as an exact IEEE floating point value).
Apart from that, having a proper function for rounding makes the code more
readable, and has the nice side effect to make Length::inPB() work for
negative lengths as well.
This concerns InsetPreview, InsetIPA and InsetMathHull.
Caching such a value is bad when opening the same buffer in two views.
In this case, it is not necessary to remember use_preview_ at all,
actually.
Also remove private member dim_ which is not used and remove some trailing whitespace.
Fixes bugs #9085 abd #9957.
Since the low-level version of tabular features is only called by the high-level one, it does not make sense to record undo there. It is much better to do it once in the high-level handler, rather than 37 times (yes!) at lower level when the tabular GUI calls tabular-feature with all the settings at once.
With large tables, this avoids to keep 37 copies of the table in Undo stack.
As an added bonus, this fixes bug #9960.
The tabular-features LFUN was merged with "inset-modify tabular" when
simplifying the tabular dialog at b5049e7. This choice later indirectly caused a
few regressions (#7308, #9794).
I reintroduce tabular-feature to allow more flexibility for user
commands, whereas "inset-modify tabular" is now reserved for the tabular
dialog. In particular, inset-modify tabular is no longer caught by math grid
insets. The name tabular-feature is kept to avoid renaming icons.
Known issues:
* After successfully applying a tabular command, the cursor is truncated to the
table.
* Note that the tabular dialog still has similar issues that are inherited from
the achitecture of the dialog menu. For instance the pref change can be
mis-dispatched to an inset inside a cell and cause an error, for instance:
Lexer.cpp (934): Missing 'Note'-tag in InsetNote::string2params. Got
tabular instead. Line: 0
Maybe the inset-modify LFUN should be modified to treat commands coming from
the wrong dialog (by checking the type) as unknown and undispatched so that
the parent can get it. In that case a non AtPoint variant of inset-modify
could be reintroduced in order to generalise tabular-feature. See:
http://mid.gmane.org/n4rdk1$efj$1@ger.gmane.org
External processes cannot access files which are open in LyX. Therefore the
temp files created by the external inset need to be closed right after
creation. The symptom was that the date inset did not produce any outout on
windows (bug 9925). This change reverts a small part of f09a9fe2.
Although the date inset is unimportant and will probably be removed, this
change is important for all external insets that make use of temp files.
The important thing is actually not the date inset, but the converter
machinery, which did convert the time stamps of two unused freshly created
temp files, which does not make sense, and did work before f09a9fe2 only by
accident.
This fixes the date inset on linuy, but not on windows, probably due to
different file locking semantics.
The current behaviour of the \origin parameter replaces relative file names
with the absolute original names if a document has been moved even if the
files have been moved as well. This behaviour is annoying e.g. for editing the
LyX docs in a git checkout.
Now file names are only replaced if the referenced file sdo not exist.
Preliminary work for addressing #7790. Thanks to Richard for providing initial
files this is based on.
Adding to TextClass:
OutlinerName <string> <string>
(the second string is translated)
e.g.:
OutlinerName thm "Definitions & Theorems"
Adding to Layout:
AddToToc <string> (default "", means no)
IsTocCaption <bool> (default 0)
e.g.:
AddToToc thm
IsTocCaption 1
Adding to InsetLayout:
AddToToc <string> (default "", means no)
IsTocCaption <bool> (default 0)
e.g.:
AddToToc literate
Adding to inset arguments:
IsTocCaption <bool> (default 0)
Although af8ba5e0fixed#9321, it broke a valid use case that was
reported by a user at #9785. Hopefully we can come up with a better
fix for #9321.
This reverts commit af8ba5e069.
(http://mid.gmane.org/565E17DD.7090008@clear.net.nz)
Fix the pilcrow and the cross in the outliner for Windows and old Ubuntus.
The thin space after the cross is based on aesthetics (in Ubuntu at least) after
trying both with and without a normal space. A thin space is already used for
display in BiblioInfo.cpp, so I presume it is safe.
Ideally, I prefer ❌ (CROSS MARK), whose description fits the purpose, over ✖
(HEAVY MULTIPLICATION X), which looks too bold in the UI. Whereas ✕
(MULTIPLICATION X, successfully tested in Windows by Andrew) looks too dim. But
❌ (CROSS MARK) is next to ❎ (NEGATIVE SQUARED CROSS MARK) so it might be as
problematic as the latter.
Do not output the cross on the author name in the toc of tracked changes.
The computation of the legth of expanded hfills did not take into account their unexpanded size. This is done now by increasing the dimension (+=) instead of merely setting it.
Moreover, since the insets sizes are integer number, rounding effects have to be taken in account. To this end, the extra number of pixels is added to the last hfill in the row.
This fixes part of bug #9860.
Note not everything is fixed by this patch: the logic of ParagraphMetrics::hfillExpansion seems bogus to me. I do not see why consecutive hfills at the beginning of a row should not be all expanded. Since I do not know what are the peculiarities of hfill handling in LaTeX, I did not change it (yet).
I did not either try to investigate the label hfill part, because I do not even know what is so special about it. I think there is a lot of old logic that nobody ever tried to question.
This is done by implementing contentAlignment() for this inset.
In order to display properly 'stretch' alignment, the code for TextMetrics::getAlign is rewritten to include some code that was in computeRowMetrics.
Back references in the format string of regex_replace use the syntax $n both
in std::regex and in boost::regex for the default format. Boost seems to
support the syntax \n in addition, but it is not documented at
http://www.boost.org/doc/libs/master/libs/regex/doc/html/boost_regex/format.html.
Therefore it is a good idea to use $n also for boost.
The code in InsetTabular disables the toolbar icons and menu entries related to vertical lines.
The code in GuiTabular disables vertical lines in the Settings dialog.
Note that there was a bug in
GuiSetBorders::set(Left|Right|Top|Bottom)Enabled, where the borders
did not get drawn correctly.
Fixes bug #9816
The horizontal alignment changes caused a regression for documents in older
formats. This could have been fixed by adding the following lines to the
format entry for 489 in development/FORMAT:
Previously, the horizontal position was ignored except for the
following parameter combinations:
- fixed width and type Boxed and without inner box
- fixed width and any type and with inner box and with makebox
Now, it is also used for the parameter combination below:
- makebox is not used and not (type Boxed and without inner box)
and a corresponding conversion to convert_BoxFeatures() in
lib/lyx2lyx/lyx_2_2.py. However, it was decided to revert the box alignment
changes instead: The box alignment can contradict the paragraph alignment. A
better way to avoid the additional space that can be created by paragraph
alignment (which was the motivation for implementing box alignment) is the
same as for table cells (see noTrivlistCentering() in src/Paragraph.cpp).
This would be a file format change and it is too late now for 2.2.0.
See http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg188147.html for the
complete discussion (subject "Regression in lyx2lyx box alignment").
Please use the new function otexstream.append(str, texrow) to append an
odocstringstream with texrow information to the output when outputing to a
string buffer (e.g. case of subcaptions).
This was made visible by aab1b145a5, since xhtml export for
lib/doc/Additional.lyx caused an exception. However, the cause for this was
already present earlier: All attempts to output a std::string to an
odocstream resulted in trying to change the encoding of the stream instead,
since there is no operator<<(odocstream &, std::string) defined, and an
implicit conversion to SetEnc happened instead.
This is fixed by making the SetEnc constructor explicit and adjusting all
code parts that did not compile anymore after that. The parts of the code
that did use the wrong output operator were the std::string version of
htmlize() from output_xhtml.cpp and all changed parts in the other .cpp files.
I also removed the std::string versions of html::htmlize() and
html::cleanAttr(), since it was difficult to see which encodings were used
with these. Now we are always explcit when using html::cleanAttr() and
html::htmlize().
The rule-of-three says that if any of virtual destructor, copy constructor
or assignment operator needs to be manually implemented, then all three
should be implemented. Otherwise you can get subtle bugs which can be
difficult to find. In the changed classes, changing a copy-construction to
an assignment would have had surprising effects. Now they all behave
consistently.
Use the function support:truncateWithEllipsis() to shorten a docstring with
... at the end. Actually we use U+2026 HORIZONTAL ELLIPSIS instead of "..." when
automatically shortening strings. This is to be consistent with Qt's own
truncation and is much nicer on the screen.
This includes the bugs #9575 and #9572 regarding broken text elision in the
outliner.
Known issues (non-regressions):
* TocBackend::updateItem() should be rewritten to update all TOCs. (#8386)
* "..." should be replaced with … everywhere else on the interface (including
translation strings).
* We should prefer to rely on QFontMetrics::elidedText() to truncate strings
with an ellipsis whenever possible, or an equivalent for the buffer view
dependent on the font metrics. See the warning in src/support/lstrings.h.
* New TOC "math-macro". This means that math macros can now be accessed in the
outline pane in their order of appearance or in alphabetical order, and can be
searched using the filter.
* Lists of floats now show subfloats deeper in the navigation menu
* The arbitrary 30 element cut-off after which nothing is shown except "Open
Navigator..." is removed. Menus now have no limit in size, so Qt may display
them scrollable. In exchange, we always show "Open outliner..." at the
beginning. I tested for performance issues with a rather complex document and
it is fine; but this does not exclude corner cases with lots of TOC entries of
a certain kind. If necessary, populating the navigation sub-menu should be
delayed like the main menu.
* Elements that do not contribute to the output (e.g. in a note, a disabled
branch) are now preceded with a symbol indicating this status. (The machinery
was already there; I wonder why it was not implemented already.) I have chosen
U+274E NEGATIVE SQUARED CROSS MARK.
* Fix the contextual menus in the outliner (bug introduced at 94e992c5).
* Toc item now move to the caption when present, but first center on the float,
to prevent the situation where the caption is at the top of the screen and the
contents of the float is off-screen above the caption.
(Internally, the action of the toc items can now be customised)
* Fix the LyXHTML output. Disabled captions no longer appear in the list of
figures.
There are still a few warnings of the kind
(style) Variable 'x' is assigned a value that is never used.
since I did not touch code where I was not sure whether there might be a real
bug, and I kept some for symmetry reasons as well.
This generalises the new use of TocBuilder (97e8101) to listings and wraps and
removes some duplicate code.
Make sure that we will never write an empty float type again in the future
(#9760)
We introduce TocBuilder for building TOCs that take into account both float
insets and their captions.
* Floats without caption are shown with their content.
* Floats with a caption are shown with their caption, but clicking the entry now
correctly moves to the float and not to the caption.
* Subsequent captions produce additional entries in the TOC.
* Figures and subfigures are correctly ordered in the outliner.
* New TOC "senseless" for captions appearing alone (a bit like broken references
are still displayed in the menu and outliner).
* Disable LFUN_CAPTION_INSERT if there is already a caption in a listing
Known issues:
* Inconsistent output for includes located inside floats
* We should record the end of the float in addition of the beginning for a more
accurate cursor -> outliner entry conversion
These were all found by cppcheck. Even in constructors that are there "only
because of std containers" the class should be initialized correctly. You can
never know whether such an object does not get used, and then a nice crash
caused by dereferencing a NULL-pointer is better than undefined behaviour.
Actually photos (i.e. .jpg files) where supported previously, but for pdflatex
output an unneeded conversion to png was done. The RasterImage templates
behaves now exactly as InsetGraphics for these files: If the input format is
jpg, use that for pdflatex, else convert to png.
This brings the external inset on par with the graphics insets as far as the
clipping option is concerned. The graphicxs package supports both: A bounding
box without units (which means that bp ia assumed), and a bounding box with
units, so we can simply output the values including the units.
Being able to compile document with zipped .eps files was a useful feature of
the graphicxs package 20 years ago, but the LyX support is no longer relevant:
- The flag is ignored if preview is on
- If pdflatex is used then uncompressing happens during the compilation anyway
- If set, the flag prevents LyX from issuing proper error messages if
something with the image is wrong
- For hard disk capacities from 20 years ago not uncompressing is a useful
feature, but for current hard disk capacities it does not matter
- The external inset does not have it, and if we want to merge both insets
one day we would need to implement it there, which is even more difficult
than in InsetGraphics
There is no need for real-valued line width in painters. Actually, this even leads to uneven dashes for continuous spell checker.
The new code is supposed to be equivalent to the old one, just more readable. From this, we can try to see whether some lines need to be made thicker on HiDPI screens.
The strategy adopted in bc47054b had some drawbacks related to the way
instant preview snippets are generated. See the subthread starting at
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg187916.html
for details.
The strategy adopted in this commit is that of adding macro definitions
only for the macros actually used in a preview snippet, independently
of whether some macro was already used in a previous snippet. In this way
the snippets don't need to be changed according to whether they are
compiled as a whole or separately from each other. This fact was causing
the regeneration of a preview snippet whenever the cursor entered the
corresponding inset, even if the generated image would have not changed.
The problem of defining or redefining a macro is taken care by the
python scripts.
* Provide for vector fonts only if needed.
* Make sure microtype doesn't throw a trantum in dvi mode.
* Use correct macro definition in preview insets.
- the idea is to color the box inset frame according to the fame color of the box (if there is any). To keep the WYSIWYM principle the frame thickness and box separation are not taken into account. However this should be possible if anybody would like that.
- besides this, use the correct conversion command for the background color
It is now possible opening documents that where manually moved to a
different location after they were saved and still produce an output.
Indeed, (hopefully) all needed included files are now still found.
When the moved document is saved again, all paths are accordingly updated.
Of course, for this to work, a document has to be saved in Format 490,
at least.
As an example, after converting the user guide to the last format, it can
be copied anywhere and opened without the need of adapting the paths of
included files or moving them to a proper place.
There is one glitch I am aware of. When moving a child document (but not
the master) the path to the master is correctly updated but it won't be
recognized as such. This is because LyX checks that the parent actually
includes this document but, of course, being the parent document not
touched, it appears not including this child. Anyway, it will also occur
when saving the child to a different location and the user is warned
on the terminal about this fact when the moved child is loaded.
However, there is no problem when it is the master that has been moved.
Avoid that \newcommand[x] definitions of math macros are pushed multiple
times to the preview loader.
Redefinitions (via \renewcommand[x]) are properly handled.
* Remove the UndoKind parameter in the general interface
* move recordUndoInset to Cursor
* remove one variant of Undo::recordUndo.
* get rid of Text::recUndo.
The only real user was Text::insertStringAsLine, but this got changed
in commit 2c7152ab.
While not other place did read the value, there is a side effect of
setAutobreakRow that merges exiting paragraphs. However, this is used
in two situations
* some constructors, where the inset is empty;
* InsetTabular::toggleFixedWidth, which actually contains itself some
code to merge paragraphs.
Therefore the member and all associated code can be removed safely.
Rely only on InsetText::allowMultipar() to get this information.
Implement this method for InsetTabular and InsetBox.
Also rely on this method for disabling LFUN_PARAGRAPH_BREAK.
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
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.
Using fraction of points is a reasonable way to avoid warnings with fussy compilers.
Moreover, this fixes the output of PHRASE_LATEX2E to use the proper form \LaTeXe.
The file format still uses the questionnable form \\LaTeX2e.
Previously, LyX did replace some words with typeset logos, and there was no
way to prvent this except putting them, in ERT (bug #4752). Now we have
special insets for these words, and standard text is left alone.
For exports based on LaTeX, consecutive hyphens are only converted to endash
and emdash if the current font family is not typewriter, and if none of the
parent insets is an IPA inset. Now this is done for XHTML export as well.
Rename recordUndoFullDocument to recordUndoFullBuffer.
Separate the notion of recording changes to paragraphs and recording changes in buffer parameters.
Audit every user of recordUndoFullDocument and replace it with either recordUndoBufferParams or recordUndoFullBuffer. Add comments to identify remaining work.
The listings package employs some dirty tricks internally, therefore it does
not work with utf8 encoding, but requires fixed width encodings. This version
of the fix uses ugly hardcoding instead of a layout file format change, so it
could be backported if needed.
* \caption does not need to be protected in general
* the contents of \caption arguments need to be protected, though.
All styles related to caoption inset have been audited and updated.
The special casing of captions in longtables has been removed, since there is no special case.
Fixes bug: #9177
This implement horizontal scrolling of rows to allow editing insets
(math, tabular...) that are larger then the screen. The scrolling happens
as the cursor moves, in order to make sure that the cursor is always visible.
This effectively closes an 11 years old bug.
This feature is the result of the work of Hashini Senaratne as part of
Google Summer of Code 2013. The code has been cleaned-up for inclusion
and remaining bugs have been fixed.
Fixes bug: #1083.
This resolves a dependency of src/support/docstream.cpp on src/TexRow.cpp,
which is the wrong way round. This fixes the linking
src/tests/check_ExternalTransforms with MSVC where the linker is not clever
enough to detect that the whole otexstream class is unused.
This allows to address two main issues
* \thanks does only accept one paragraph, while \footnote allows several (ticket #2666)
* footnotes in titling environments were not numbered on screen.
Moreover, the code reduces hardcoding of features, which is always a good thing.
There are several pieces in this commit:
* new numbering type \fnsymbol for counters
* the Foot inset changes its layoutName() to Foot:InTitle when inside a paragraph with InTitle property. This is set when running updateBuffer.
* Foot:intitle uses the \thanks command, does not allow multiple paragraphs and marks its contents as moving argument.
* The InsetLayouts for Foot now have properLaTeXName/Type, so that InsetFoot::latex can be removed; further code simplification is probably possible.
Fixes: #2666
The advantage is that the buffer will no longer be
marked as dirty when converting to the same type.
A quick break here is done instead of disabling the
LFUN because disabling the LFUN would lead to a greyed out
entry, which might confuse users. In the future, we might
want to have a radio button for switching between notes.
The shape of the parbreak separator is slightly changed in order to
better distinguish it from the forced newline. This allows using the
same color of the plain version without risk of confusion.
Investigation of bug #9236 showed that crash to be due to a Paragraph's
holding a dangling pointer to an old and deleted Layout after the
DocumentClass was reset. Since the backtraces look almost identical, it
seems likely that we have the same problem here.
Since this crash seems almost always to involve tables, I looked at the
code in switchBetweenClasses() and found that the Paragraphs that belong
to "hidden" table cells are not seen by the initial recursion using a
ParIterator: It skips right over them. This was confirmed by test code
suggested by Enrico, with results reported in Trac.
The present patch attempts to deal with this problem in the second
recursion, over Insets. When we see an InsetTabular, we call a new
routine that recurses through the cells, looking for hidden ones. If it
finds a hidden one, it then resets the Layout for the cell's Paragraphs
(there should be only one, but we do not make any assumptions) to the
PlainLayout that belongs to the new DocumentClass. This is good enough,
since such cells never have content.
There is extensive discussion of the patch here:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg185095.html
Additional testing by Enrico and me confirmed the existence of the
dangling pointer.
This branch implements string-wise metrics computation. The goal is to
have both good metrics computation (and font with proper kerning and
ligatures) and better performance than what we have with
force_paint_single_char. Moreover there has been some code
factorization in TextMetrics, where the same row-breaking algorithm
was basically implemented 3 times.
Globally, the new code is a bit shorter than the existing one, and it
is much cleaner. There is still a lot of potential for code removal,
especially in the RowPainter, which should be rewritten to use the new
Row information.
The bugs fixed and caused by this branch are tracked at ticket #9003:
http://www.lyx.org/trac/ticket/9003
What is done:
* Make TextMetrics methods operate on Row objects: breakRow and
setRowHeight instead of rowBreakPoint and rowHeight.
* Change breakRow operation to operate at strings level to compute
metrics The list of elements is stored in the row object in visual
ordering, not logical. This will eventually allow to get rid of the
Bidi class.
* rename getColumnNearX to getPosNearX (and change code accordingly).
It does not make sense to return a position relative to the start of
row, since nobody needs this.
* Re-implement cursorX and getPosNearX using row elements.
* Get rid of lyxrc.force_paint_single_char. This was a workaround that
is not necessary anymore.
* Implement proper string metrics computation (with cache). Remove
useless workarounds which disable kerning and ligatures.
* Draw also RtL text string-wise. This speeds-up drawing.
* Do not cut strings at selection boundary in RowPainter. This avoids
ligature/kerning breaking in latin text, and bad rendering problems
in Arabic.
* Remove homebrew Arabic and Hebrew support from Encoding.cpp. We now
rely on Qt to do handle complex scripts.
* Get rid of LyXRC::rtl_support, which does not have a real use case.
* Fix display of [] and {} delimiters in Arabic scripts.
Don't create an intermediate copy (found by Jean-Marc).
I doubt that this has anything to do with the mystery crash, but it works, and
following the standard patterns is better anyway.
FileName::tempName() created a new temp file name by using qt to create a
temporary file with a unique name, and then deleting that file and returning
the name. This was unsafe, since other processes or even other threads of the
running LyX could create files with the same name between deletion and then
using the temp name.
This is fixed by using the TempFile class instead. As a side effect, a few
cases where the temp files were not deleted after usage were fixed as well.
The only place that is still unsafe is createTmpDir().
The firs tinvolves a thinko in BibTeXInfo::expandFormat. We were previously
counting passes through this routine, which means: one for every character,
more or less. So long strings would hit the "recursion limit". But what
we are worried about is an infinite loop caused by misues of macros, so that
is what we need to count.
This prevents the error we were previously getting, but it reveals a huge
slowdown when one tries to open a citation inset with a large nubmer of keys.
So we also limit the number of keys we try to process, and the length of the
string we try to display, when we are generating citation information.
I'm convinced that there is a deeper problem in how citation information is
generated (see the bug tracker for more info), but that will require major
surgery and a file format change
This method is a proxy for LyXRC::preview that forces to forward
declare some wrapper around an enum...
Instead, two simple static methods previewMath() and previewText() are
introduced, that make the code much easier to follow.
If a separator inset is used after an environment with NextNoIndent
set to false, a blank line was already output. So, avoid outputting
another blank line or an odd looking line with only a '%' character
(as the previous blank line provides already a visual separation).
Multirow cells now have the same alignment rendering in LyX
as in the output. The alignment of a multirow can change as
long as the column is not of fixed width. If the column is
of fixed width, the multirow is left-aligned.
When setting a multirow, the alignment is copied from
the last cell in the selection.
This was not necessary when LyX was generously outputting newlines.
As it may happen that the output produced by writeExternal (the
result of an external inset) starts right at the beginning of a
line, if otexstream does not know that something is already on
the line, the iomanip-like variable 'breakln' fails to actually
break the line.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.
Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.
Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
* remove unused class TexStream.
* remove unused virtual method Inset::cellXOffset
* remove second argument of FileDialog constructor, which was actually
not used
* remove some dead local code
* remove some unused private members of classes
* in InsetMathNest::updateBuffer, fix the logic of a test
for possible thread conflicts, of the sort Georg resolved at
6a30211f. I have made static variables const where possible,
and marked cases that looked potentially problematic with the
comment:
// FIXME THREAD
Many of these definitely are vulnerable to concurrent access, such
as the static variables declared at the start of output_latex.cpp.
Suppose, e.g., we were outputting latex and also displaying the
source of a different document.
I'd appreciate it if others could grep for "FIXME THREAD" and see
if some of these are harmless, or what.
This code was commented out at [ad94e7bd/lyxgit], since we thought it was not necessary anymore and then removed at [5aede959/lyxgit]. Bug #9042 is the evidence that we were wrong.
and Cursors. So just calling InsetText::addToToc for the cells causes
problems, because InsetText::addToToc then adds the cell inset itself
as part of the DocIterator. This then leads to assertions, such as bug
The solution is to refactor InsetText::addToToc so that we can call the
iterating part without adding the inset.
The problem was that collectBibKeys() was called before the recursive include
check was done. Now collectBibKeys() works even for recursive includes, and
your get a proper error message if you try to change the file name to the
parent file.
At efa0f198 I introduced a more flexible caption handling for long tables.
This was needed to fix tex2lyx bug #7412. Unfortunately this created bug #8933,
since I forgot to output captions to LaTeX which are not in any header or
footer. This was fixed at 2b941da7f, but this introduced bug #8992 (duplicate
caption output).
This commit is hopefully the final fix: Captions which are in header or footer
lines are output with the header or footer line, and captions in standard
lines are output standalone.
This makes the defaults of Inset::inheritFont() and Inset::resetFontEdit()
compatible. There is no user visible change except for the Chunk inset which
does not produce invalid LaTeX after editing operations anymore.
This is the safe version for 2.1.0, for later there are still open questions:
- All insets with ResetsFont true should be audited: Is this really needed,
or do they show similar editing problems as the Chunk inset?
- Does inheritFont() need to be customizable in the layout file as well?
- Is resetFontEdit() != !inheritFont() needed at all?
I did not use change tracking for the docs, since I updated all existing
translations.
This commit fixes a bug uncovered by the fix to #8082:
If you create a table, select all columns in a row,
and set as multicolumn, the right border used to be unset.
The new HTML clipboard export could cause error message boxes on copying
data to the clipboard (bug #8866). These are now suppressed, like all other
errors which might occur for preparing the clipboard data.
The main part of the fix (unicodesymbols) is from Jürgen. This commit fixes
tree problems:
- \; etc. were also used in text mode, but are math only
- all of those glyphs need to be forced with utf8
- actually, \; etc. are not the correct macros, since the encoded spaces are
breakable, but the math spaces are all protected. The sapce symbols are not
defined in the utf8 encodings.
- InsetBox.cpp:
a framebox without inner box and without a width is \fbox
a framebox with inner box is also \fbox
a framebox without inner box and with width is \framebox
- GuiBox.cpp: the width checkbox must be checked if there is width
* InsetBox and GuiBox: Use proper empty length instead of the broken -9.99col% trick
* some slight changes to the logic of GuiBox to make sure that values are set as needed.
* lengthToWidget(): handle properly the empty length case. All the other related Qt helpers did it already, it was probably an oversight. Also set the default_unit parameter as optional (not needed in this patch actually, but I got carried away :)
* allow generating LaTeX code for an empty length, since some broken code does that.
InsetInfos of the type ICON have a graphics Inset in their paragraph.
These insets were inserted without a font. This lead to an assertion in
Paragraph::fontSpan because the fontlist_ of the paragraph is empty.
This is mostly unused private class members.
There are also a few unused functions that got #if'ed out. I never know in this case whether the code should be nuked.
each failure.
There are several places I was not sure what to do. These are marked
by comments beginning "LASSERT:" so they can be found easily. At the
moment, they are at:
Author.cpp:105: // LASSERT: What should we do here?
Author.cpp:121: // LASSERT: What should we do here?
Buffer.cpp:4525: // LASSERT: Is it safe to continue here, or should we just return?
Cursor.cpp:345: // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:403: // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:1143: // LASSERT: There have been several bugs around this code, that seem
CursorSlice.cpp:83: // LASSERT: This should only ever be called from an InsetMath.
CursorSlice.cpp:92: // LASSERT: This should only ever be called from an InsetMath.
LayoutFile.cpp:303: // LASSERT: Why would this fail?
Text.cpp:995: // LASSERT: Is it safe to continue here?
As discussed on the list. No automatic contents detection is done, the user
needs to use the special paste menu instead. I used the new TempFile class
for safe temporary file handling.
The documentation would go into section 2.2 of UserGuide.lyx, but I am not
allowed to edit that document.
output, due to failure to clean the ids in the new citation stuff.
I've solved this by allowing the citation format information to contain
keys of the form "clean:key". This signals that we are to apply the
html::cleanAttr() function to the key before returning it. I.e., we
strip non-alphanumeric stuff, basically.