Commit Graph

22132 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
1e18ab586e Fixes to InsetCaption \protect-ion
* \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
2015-01-10 19:48:56 +01:00
Jean-Marc Lasgouttes
9c55af4a22 Merge remote-tracking branch 'features/scroll-reloaded'
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.
2015-01-10 18:39:09 +01:00
Georg Baum
ca6fba31fb Remove direct calls of exit()
This is a preparation for using QCoreApplication.
2015-01-09 21:43:45 +01:00
Georg Baum
8f2828197c Move otexstream out of support
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.
2015-01-09 21:07:59 +01:00
Georg Baum
9c1504a416 Update references after 706960eba
The generated output is correct, since the lyx2lyx forward conversion is empty.
2015-01-09 21:05:42 +01:00
Juergen Spitzmueller
706960eba4 Add Question and Question* theorem types (bug #9015)
File format change.
2015-01-09 11:24:45 +01:00
Georg Baum
ba045c0a68 Fix biblio regex test
Now it tests lyx::regex instead of boost::regex, so it works as well if
std::regex is used.
2015-01-08 20:46:54 +01:00
Georg Baum
aafb5138ab remove duplicated include 2015-01-08 19:55:40 +01:00
Jean-Marc Lasgouttes
52236503d3 Add marks to indicate when a row is too large
A dotted line is shown on the left or on the right to indicate that a part of the row is not visible.

Add a color code for the scroll indicator
2015-01-07 22:55:11 +01:00
Jean-Marc Lasgouttes
c6e1db7682 Fix some display glitches
* When doing a redraw with drawing disabled (to set inset positions properly), take horizontal scroll offset in account

* reset horizontal scroll offset when it is smaller than the left margin.

* when drawing a paragraph, do not modify x globally, only for the row that is offset.
2015-01-07 22:55:11 +01:00
Jean-Marc Lasgouttes
fcaf5b5fc8 Remove the special horizontal scrolling support in InsetTabular
It is not necessary anymore now that there is a global mechanism.

Also, fix the clearing of rows in SingleParUpdate mode.
2015-01-07 22:55:11 +01:00
Jean-Marc Lasgouttes
a7ba04dbaf Fine tune the scroll offset setting code
The new code should feel a bit more natural. It avoids explicit pixel values for the margins and does not scroll in some cases where it is not necessary.
2015-01-07 22:55:11 +01:00
Hashini Senaratne
5a361b35cf Keyboard based horizontal scrolling for wide insets
[This commit is the output of the "horizontal scrolling" GSoC 2013
 project, by Hashini Senaratne. The code has been cleaned up, some
 variables have been renamed and moved from the Cursor class to
 BufferView::Private. This is the base from which I (jmarc) will polish
 the feature for landing on master.

 Below is the original commit log of Hashini, updated to reflect the
 changes that have been done.]

This feature also applicable for other insets; graphics and labels.

This implementation is capable of scrolling a single row when reaching
its content which is beyond the screen limits, using left and right
arrow keys.

The attribute 'horiz_scroll_offset_' introduced in the
BufferView::Private class plays a main role in horizontal scrolling of
the wide rows that grow beyond the screen limits. This attribute
represents by how much pixels the current row that the text cursor
lies in should be get scrolled.

The main logic that is responsible for drawing the scrolled rows is
within the BufferView class, BufferView::checkCursorScrollOffset.

 * The main logic is called via BufferView::draw.

 * What this does is set the horiz_scroll_offset_ attribute in in order to
 show the position that the text cursor lies in.

 * To make sure that BufferView::draw gets involved when Update flag is
 FitCursor, necessary changes are made in BufferView::processUpdateFlags.

Basically what the logic that used to set the horiz_scroll_offset_
does is,

 * The row which the text cursor lies in is identified by a
 CursorSlice that points to the beginning of the row. This is the
 'rowSlice' variable used in BufferView::checkCursorScrollOffset. Acessors
 are added to obtain this variable. Here row objects were not used to
 identify the current row, because it appears that row objects can
 disappear when doing a decoration update for example. This means that
 comparing row pointers is not a good idea, because they can change
 without notice.

 * Stop calculations of horiz_scroll_offset_ variable, if metrics have not been
 computed yet. Otherwise the calls to TextMetrics::parMetrics, calls
 redoParagraph and may change the row heigths. Therefore vertical scrolling
 feature may get disturbed. This is avoided.

 * Using BufferView::::setCurrentRowSlice resets horiz_scroll_offset_
 when changing cursor row. This is done in order to prevent unwanted
 scrolling that happens when changing the selected row using up and
 down arrow keys.

 * Recompute inset positions before checking scoll offset of the row, by
 painting the row insets with drawing disabled. This is done because the
 position of insets is computed within the drawing procedure.

 * Current x position of the text cursor is compared with the
 horiz_scroll_offset_ value and the other variables like row.width(),
 bv.workWidth(). Compute the new horiz_scroll_offset_ value in order
 to show where the text cursor lies in. The basics conditions that we
 check before recomputing it are, if the text cursor lies rightward to
 the current right screen boundary, if the text cursor lies leftward
 to the current left screen boundary, if the text cursor lies within
 screen boundaries but the length of the row is less than the left
 boundary of the screen (this happens when we delete some content of
 the row using delete key or backspace key).

 * Change update strategy when scrooll offset has changed. This allows to
 redraw the row when no drawing was scheduled. By doing so, it was
 possible to redraw a wide row when moving to the leftmost position of the
 wide row, from the leftmost position of the row below, using the left
 arrow key.

In TextMetrics::drawParagraph it is checked whether the current row is
what is drawing now. If it is so, the value used to the x value of the row
for drawing is adapted according to BufferView::horizScrollOffset.

The method used to pass boundary() was fixed to get row when cursor was in
a nested inset. This matter is considered in Cursor::textRow and it is
modified accordingly.

GuiWorkArea::Private::showCursor() is modified to show the cursor position
in a scrolled row.
2015-01-07 22:55:11 +01:00
Jean-Marc Lasgouttes
38dc763e50 Turn a double variable into an int.
This is a better fix than 0ad9d46068, and was just as simple.
2015-01-07 22:42:14 +01:00
Jean-Marc Lasgouttes
0ad9d46068 Fix some warnings 2015-01-07 21:27:53 +01:00
Vincent van Ravesteijn
ad6c03fe26 InsetTabular.cpp: Remove commented code without a comment
This was a leftover of [b2246c4e/lyxgit].
2015-01-06 22:02:20 +01:00
Vincent van Ravesteijn
c313b1c8eb str_metrics: Prevent clipping of chars with negative bearing
This happens when part of the word is selected.

To reproduce:
1. Start a new document
2. Type "af"
3. Select 'a'
4. Observe that the right part of the 'f' is clipped away.

This patch uses QRegion to set a clip region that is everything except
the part that is drawn in another color.

Fixes: #9223.
2015-01-06 22:02:07 +01:00
Georg Baum
59b705dcd9 Move global variable to preamble
This will be needed in the future, when I need to parse the preamble twice
for detecting japanese encoding (bug #8218).
2015-01-06 19:21:34 +01:00
Juergen Spitzmueller
27a8abf768 Some casing fixes
English UI uses Title Casing for headers and sentence casing for normal widgets
2015-01-04 10:53:36 +01:00
Juergen Spitzmueller
3cd1d396ff Fix aspectratio UI
Fixes: #9357
2015-01-04 10:05:42 +01:00
Georg Baum
3f72a026cc Fix parsing of verbatim options (bug #9113)
Parser::verbatimOption() did swallow backslashes previously. The similar code
in Parser::verbatim_item() was already correct.
2015-01-03 20:45:06 +01:00
Georg Baum
b1bfbfb3f9 Adjust subfigure and subcaption options 2015-01-03 18:43:01 +01:00
Richard Heck
935646bf91 Cleanup of outliner moving code. 2015-01-03 11:33:11 -05:00
Georg Baum
1d4fb5ac7d Parse post command argument insets (bug #8473)
This is now very easy with the new InsetArgument infrastructure.
2014-12-30 18:37:08 +01:00
Georg Baum
d1e530cf5d Handle \textgreek commands from unicodesymbols
This is the second part of bug #8553: The symbols defined in unicodesymbols
are now detected correctly and converted to unicode, so no ERT anymore.
2014-12-30 18:12:35 +01:00
Georg Baum
bf1006a22c Fix misparsing of \textgreek without polyglossia
This is the first part of bug #8553. \textgreek was interpreted as the
polyglossia version even if polyglossia was not used. Now it is not recognized
at all and converted to ERT, but this ensures at least correct LaTeX output.
2014-12-30 17:44:08 +01:00
Georg Baum
33b059bd9d Make macro xhtml export more secure
Actually I wanted to do that in cc87f8100 but forgot to adjust the original
solution completely. Now we do not search for an arbitrary latexkeys instance
which just happens to have the same name as the macro, but we only use the
symbol that was explicitly set for global macros.
2014-12-30 13:30:40 +01:00
Georg Baum
b0361fb3c5 tex2lyx: Run configure.py if needed (bug #8539)
Since tex2lyx reads some LyX config files it needs to run configure.py if
they do not exist or are out of date.
2014-12-29 23:46:25 +01:00
Georg Baum
c1c439b94d Handle unknown table column specifiers (bug #9311)
Previously tex2lyx did ignore table columns if the column specifier was
unknown. This can lead to data loss, and now it does not ignore these columns,
but assumes that the column specifiers use only once character. This can still
lead to data loss, but less often.
2014-12-29 22:54:06 +01:00
Georg Baum
cd3b040a70 Write fixed encoding to LyX file (bug #9178)
If the user gave the -fixednec argument to tex2lyx then set that encoding as
LaTeX input encoding in the generated LyX file. Otherwise, included .bib files
could be interpreted using a wrong encoding.
2014-12-29 22:29:20 +01:00
Georg Baum
ff9b4a3834 Use new argument inset code for environments
This removes another instance of the limitation solved by file format 446:
The order of optional and required arguments is not fixed anymore.
2014-12-29 22:06:29 +01:00
Georg Baum
5bfd1c22d2 Skip missing optional argument insets in tex2lyx
Optional arguments are optional, so if one is missing, do not stop the parsing,
but continue with the next argument (it might be a required one).
2014-12-29 21:54:15 +01:00
Georg Baum
0a93c9b70f Store ASCII data in std::string
Math inset names and LaTeX requirements are always ASCII. This avoids some
conversions and makes math requirements more similar to text requirements.
2014-12-29 21:46:30 +01:00
Georg Baum
cc87f81002 Fix html export of \ne (second part of bug #9372)
The fix consists of two parts: The needed infrastructure to assign HTML
entities to global math macros, and the actual fix for \ne and \neq.
2014-12-29 21:13:42 +01:00
Stephan Witt
a88e6e1ea5 Add icon library to link target - needed on Mac OS X - thanks Kornel 2014-12-29 11:33:47 +01:00
Stephan Witt
74c9165190 whitespace again 2014-12-29 01:28:24 +01:00
Stephan Witt
2fbeb662b3 whitespace 2014-12-29 00:12:33 +01:00
Georg Baum
394e1bf99c Use std::regex if possible
It works with gcc >= 4.9.0 and clang (with libc++ or gcc libstdc++ from gcc
>= 4.9.0). The MSVC parg is missing, because I cannot test it, and the
autotools build still link against boost::regex even if it is not needed, but
I don't know how to fix that.
2014-12-28 18:08:18 +01:00
Georg Baum
dae8555234 Get rid of regex_constants::match_partial
As shown by the unit test this is not needed at all, even not for really
awkward input.
2014-12-28 17:46:33 +01:00
Georg Baum
449c766e03 Test invalid sanitizeLatexOption() input as well 2014-12-28 17:34:46 +01:00
Georg Baum
62ed0aeefb Use typedef for std::basic_string in trivstring
This fixes compilation for llvm-gcc-4.2 on OS X and makes the code a bit more
readable.
2014-12-28 17:06:34 +01:00
Kornel Benko
a50c0f2ab3 Add ExternalTransforms test also to cmake build 2014-12-28 14:20:17 +01:00
Georg Baum
1db9224cff Add unit test for sanitizeLatexOption()
This is a prerequisite for safe removal of regex::match_partial.
2014-12-28 13:23:35 +01:00
Georg Baum
59ab49846a Remove duplicated CMakeLists.txt from EXTRA_DIST 2014-12-28 13:20:20 +01:00
Georg Baum
9c375cb606 Add forgotten test to distribution 2014-12-28 12:53:18 +01:00
Georg Baum
e15d3d35cb Reduce caption hardcoding
Now we can handle all types of captions defined in layout files or modules.
This does also mean that \captionabove and \captionbelow are only recognized
in KOMA-classes and not always anymore, but this is correct, since these
captions would not work in other document classes anyway.
2014-12-27 18:15:07 +01:00
Georg Baum
eda5f69cc0 Revert e01886327d
Sorry, this was nonsense.
2014-12-27 17:03:39 +01:00
Georg Baum
e01886327d Output caption insets collapsed
Like all other collapsable insets, there is not reason to treat captions
specially.
2014-12-27 16:10:11 +01:00
Georg Baum
f4417e8125 Remove InsetArgument 999 workaround
Since we iterate through all arguments we can as well compute the correct id
directly.
2014-12-27 15:17:11 +01:00
Georg Baum
cb7ace9143 whitespace 2014-12-27 15:17:10 +01:00