Commit Graph

23321 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
5aa342ed75 Fix cursor position after redo
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.
2016-05-29 17:55:42 -04:00
Guillaume Munch
c47bfee231 Amend d7d4f65b
Thanks Richard
2016-05-29 17:55:42 -04:00
Guillaume Munch
e3540f33e1 Simplify class structure in TocBackend
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.
2016-05-29 17:55:42 -04:00
Jean-Marc Lasgouttes
d48d426c72 Rename InsetMathHull::isTable to allowsTabularFeatures
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.
2016-05-29 17:55:42 -04:00
Jean-Marc Lasgouttes
a879bc2575 Fix horizontal scrolling in full-width collapsable insets
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.
2016-05-29 17:55:42 -04:00
Guillaume Munch
6bd70011e9 LyXToolBox: a QToolBox with minimum size management
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.
2016-05-29 17:55:41 -04:00
Stephan Witt
6799032e77 factor out lookup of loaded hunspell checkers and use it to reduce file system accesses when checking for available dictionaries 2016-05-29 21:17:08 +02:00
Juergen Spitzmueller
8ed362fda7 Implement some forgotten context menu items for arguments
* Dissolve context menu
* Label toggle (for conglomerate-styled arguments)

Fixes: #10150
2016-05-29 12:32:53 +02:00
Richard Heck
0e1834f2d9 Updates to splitting of consecutive environments.
From Enrico.
2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
625e7609f0 Cleanup bv-dependent variables in InsetCollapsable
It makes sense to group all the variables in a common struct instead of having four maps.
2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
1ec605cbb2 amend 5b7be5eb (typo+spacing) 2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
d8f6e65ec7 Make inset-select-all select all cells only in tables
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.
2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
fd3a41e035 Change mouse cursor on tabular selection zones
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.
2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
fd6ae3539b Fix display of InsetCollapsable with split views
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.
2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
f23a8fed80 whitespace only 2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
ffe1d53cdb Pass a BufferView to Inset::clickable 2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
890a1efe47 Make monolithic build code portable to Mac OS
"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.
2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
aef78c821f Avoid narrow boxes when using \width as box width unit
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.
2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
72e038f03e When a counter is stepped, reset recursively all slaves
Fixes bug #10063.
2016-05-28 17:43:01 -04:00
Guillaume Munch
efbc297b95 Include config.h in LyXToolBox.cpp
Amend 367a7a6dd.
2016-05-28 17:43:01 -04:00
Guillaume Munch
7e9d0a938b Fix compilation with qt5
Amend 367a7a6d.
2016-05-28 17:42:32 -04:00
Guillaume Munch
4e50cd809b Amend a5db05ae
Restore tabstops. I was mistaken about what tabstops are and thought they were
useless in this context.
2016-05-28 17:42:32 -04:00
Guillaume Munch
26c12dba8f CitationUi.ui: Align "Selected citations" label to the left 2016-05-28 17:42:32 -04:00
Guillaume Munch
576cb5df77 LyXToolBox: a QToolBox with minimum size management
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.
2016-05-28 17:42:32 -04:00
Guillaume Munch
70fe2c618e Correct strange FIXME 2016-05-28 17:42:31 -04:00
Guillaume Munch
7faafd037e Improvements to the shortcuts preference dialog (#9174)
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.
2016-05-28 17:42:31 -04:00
Guillaume Munch
935588f2de Sanitize InsetMathHull and add a check for mutability in LFUN_MATH_MUTATE
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.)
2016-05-28 17:42:31 -04:00
Guillaume Munch
1840b5992c Correct col spacing in Cases environment 2016-05-28 17:42:31 -04:00
Guillaume Munch
d4b56646b4 Fix the display of column spacing in AMS environments
AMS align environment should have some spacing between odd and even columns.

Add a new virtual method displayColSpace() to InsetMathGrid, InsetMathHull and
InsetMathSplit.
2016-05-28 17:42:31 -04:00
Guillaume Munch
f3b70fd2cd Display the correct horizontal alignment in AMS environments
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.)
2016-05-28 17:42:31 -04:00
Guillaume Munch
3a4af5a3e1 Do not omit the starting space when copying (#9995)
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.
2016-05-28 17:42:31 -04:00
Guillaume Munch
77714e6db7 Raise the maxlastfiles cap
This only changes the maximum value that the user can choose in the UI, not the
default value.
2016-05-28 17:42:31 -04:00
Scott Kostyshak
594748374b Fix using system theme icons with Qt 5 (#10052)
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.
2016-05-22 20:56:12 -04:00
Georg Baum
ff4668621b Fxy typo in XHTML output (bug #10124)
There was a simple typo that did ouput the slash before the closing tag
instead of inside the closing tag.
2016-05-22 17:32:04 +02:00
Stephan Witt
1719fa6c6a Handle activateWindow in LFUN_BUFFER_SWITCH like in saveBufferIfNeeded() and doShowDialog() methods.
This is a requirement on Mac to get the current buffer view topmost after buffer switch.
2016-05-21 22:17:03 -04:00
Guillaume Munch
9a1afbf3ff Do not float the outliner in OSX (#9825)
There are focus issues in qt5 when the outliner is floating.
2016-05-21 18:54:38 +01:00
Guillaume Munch
a70f053a62 Use bilinear filtering when resizing graphics
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).
2016-05-20 21:19:31 +01:00
Guillaume Munch
791ef98016 GuiDelimiter: Workaround symbols alignment problem #10118 2016-05-20 19:32:35 +01:00
Guillaume Munch
a645d7f4e5 ShortcutWidget: override shortcuts in the way they are meant to be (#10075)
I would say "by the books" but the documentation was not really clear.

Problems with the logic of the previous implementation were exposed in Qt 5.6 by
commit <https://codereview.qt-project.org/125142>.

<http://mid.gmane.org/20160510070413.wzjpk4w4turnx6pr@cotopaxi>

Note that ShortcutOverride events are used elsewhere in the code where they may
need to be corrected in the same way.
2016-05-20 19:14:35 +01:00
Guillaume Munch
df86a4b8f0 Allow inset-forall to match separators (#10090)
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.
2016-05-17 00:48:26 +01:00
Guillaume Munch
1b4728b5e2 amend 660a43ec 2016-05-07 01:53:04 +01:00
Scott Kostyshak
262dfd3826 Move some unsigned validators to signed (#10095)
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
2016-05-06 15:43:41 -04:00
Guillaume Munch
660a43ecf4 Clipboard: Retry on_dataChanged() after a delay on windows (#10109)
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.
2016-05-04 19:20:56 +01:00
Guillaume Munch
8fd223146b Whitespace 2016-05-04 18:59:36 +01:00
Jean-Marc Lasgouttes
ff17b366a0 Resources.cpp is a built source, it should not be in SOURCEFILES
We want to avoid that Resources.cpp be distributed in the tar file.
2016-04-27 00:59:30 +02:00
Stephan Witt
21e4e939be Revert part of c053a9394d
This change introduced a regression and is not needed anymore.

(cherry picked from commit 1cbabdf8d51b26dd80677ddfeb64d13df91fefc0)
2016-04-25 20:59:25 +02:00
Georg Baum
dc38ae873a Fix bug 10074 (regression)
This was a regression of 8aa37c43. I did not take into account that end_pos
could be -1, so the code that checked whether a pair of braces needs to be
inserted between two hyphens did not work for that case. Now we check for
the length of text_, which should be done anyway, and only take end_pos into
account when it is not -1.
2016-04-24 20:12:43 +02:00
Guillaume Munch
86227b196d Citation dialog: Fix trouble with openbox, fluxbox
http://thread.gmane.org/gmane.editors.lyx.devel/161725

These wms have trouble with the fix at b5a2f1c7, probably more precisely with
the trick to force the calculation of the actual sizes before the display
(layout->invalidate() and the code around it).

This patch gets rid of the code that forces the calculation. As a consequence,
the minimum sizes are again incorrect the first time the window is shown. They
are only correct the second time the window is shown. Now here is the trick: LyX
remembers the sizes of windows between sessions. Therefore, as soon as the good
minimum size has been set, the good size is remembered for the next
session. Thus, in the following sessions, even though the minimum size is
incorrect the first time, the dialog still opens with the good size. So the user
does not see the problem in practice, apart from the very first time.

This is meant as a temporary workaround.
2016-04-24 14:05:54 +01:00
Guillaume Munch
744f6e3cd8 Compute the highlighting color from AlternateBase and Highlight roles (#10073) 2016-04-15 14:13:50 +01:00
Stephan Witt
87c85303c5 Improved fix for #9966
* provide GuiApplication::typewriterSystemFont() to get a fixed font consistently
* enlarge fixed font on Mac because of the too small default Qt system font
* use it in source pane, progress view, log view and document preamble editor
2016-04-15 11:49:04 +02:00
Guillaume Munch
f180e813fe Fix dataloss when flex inset is undefined.
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.
2016-04-11 21:02:06 +01:00
Enrico Forestieri
d4ca8d7404 Introduce the latexpar separator.
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.
2016-04-06 05:25:27 +02:00
Guillaume Munch
b5a2f1c7e5 Fix broken layout of the citation dialog (#10019)
7b1107d7 introduced the following inconveniences which are regressions to 2.1:

* The citation dialog can open with vertical scroll bars in the options

* The citation dialog can open with horizontal scroll bars, especially if the
  translated text is longer than the original text (e.g. in FR)

* Resizing the dialog is inconvenient because it increases the gap between the
  options. This is unlike before when the dialog could let us see more of the
  reference list when enlarging.

This is because the QToolbox that the above commit introduced is not natively
aware of the sizes of its page sub-widgets. The widget is not conceived for this
use, where the space is scarce.

Geometry values provided in the ui file (automatically computed by qtcreator I
suppose) somehow gave the illusion that it worked, but relying on such values is
not portable : it does not take into account the specific theme, font sizes and
localization. This explains why it failed on my side and will probably fail in
other settings too.

Luckily, there is a simple way to make QToolbox suitable for the current use,
which is to add the "missing link" which computes its size based on the minimal
sizes of its pages. The result looks very nice and intuitive. It solves all the
aforementioned issues.
2016-04-04 17:58:16 +02:00
Peter Kümmel
a0a472c16e msvc2015: always incude strfwd.h first, to prevent crashes of our
typedefed streams.
2016-04-02 11:03:17 +02:00
Peter Kümmel
44c57bb9d8 msvc2015: _wgetmainargs is not available ony more 2016-04-02 11:00:42 +02:00
Jean-Marc Lasgouttes
fd1ee3b424 Rename Caption:LongTableNoNumber to Caption:Unnumbered
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.
2016-03-30 16:07:00 +02:00
Richard Heck
f7fdf49f64 Const. 2016-03-28 12:40:18 -04:00
Richard Heck
82c3a44337 More informative name for backups of files from older versions. 2016-03-27 19:40:02 -04:00
Richard Heck
23f6c1c962 Fix problem reported by Kornel in this thread:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg193248.html
The static InsetLayout could be initialized before its members were, as
JMarc realized here:
		https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg193293.html
2016-03-27 16:56:17 -04:00
Jean-Marc Lasgouttes
ba7e2113f3 Fix some display bugs related to end of paragraph markers
There are two regressions that are fixed here:

 * empty rows at the end of a paragraph (think after newline at end of
   paragraph or empty line in Verbatim) do not have an end-of-par
   marker. This is fixed by removing the early return in breakRow and
   letting the whole function be executed. This requires to relax an
   assertion in Paragraph::fontSpan. It makes sense here to query
   position at the end of the paragraph.

 * a newline at the end of a paragraph will be followed by and
   end-of-par marker. This is fixed by skipping the end-of-par marker
   when a new row has been requested.
2016-03-25 22:22:45 +01:00
Jean-Marc Lasgouttes
ecd7dee5ea Make thin lines exactly 1 pixel wide
The setting of 0 (minimal possible width) was too thin for Mac Retina displays.

Fixes bug #10031.
2016-03-25 16:53:37 +01:00
Jean-Marc Lasgouttes
0aaa930a5c Do not assert when cursor is deeper than anchor
This works around bug #9917 and might give us an occasion of obtaining a recipe for reproducing it.
2016-03-22 13:48:15 +01:00
Jean-Marc Lasgouttes
98883304e2 When handling mouse events, make the undo group a bit larger
notifyCursorLeave can delete empty insets in mathed.

Fixes bug #10022.
2016-03-16 18:33:39 +01:00
Jean-Marc Lasgouttes
be7e89a29b In mathed, only select current cell on double-click
Keep the behavior of split selection with triple click.

Fixes part of #9747. The remainder was fixed at f58d9f27, AFAICS.
2016-03-16 10:23:23 +01:00
Georg Baum
4bab2ab5f8 Fix regression of 359aef92f8
The context menu of newline insets was completely greyed out if one clicked
at the right of the inset. Thanks Scott for finding this. The fix is to undo
the cursor movement also for insets without settings, but with a context menu.
2016-03-15 21:35:50 +01:00
Guillaume Munch
0434f5676a Fix perf issue when displaying the symbols gui (#9968)
According to callgrind, the time taken to display the symbol dialog is spent in
updateSymbolsList. No longer translate strings for every symbol. This speeds
it up more or less by a factor two.
2016-03-13 07:19:13 +00:00
Enrico Forestieri
0430132aa0 Circumvent odd stmary font metrics (part of #9990).
The stmary font has an unusual large descent that was causing a large
gap between lines in the math delimiter dialog because of the \llbracket
and \rrbracket delimiters. The solution is to force Qt using the same
size for all elements of the QlistWidget widget instead of letting it
compute the size of each element.
2016-03-13 01:51:15 +01:00
Jean-Marc Lasgouttes
8d088df4df When using pixmap cache, add word spacing to signature
Fixes bug #9971.
2016-03-12 12:57:49 +01:00
Jean-Marc Lasgouttes
3b6919217b Do not set cursor to the right of newline with mouse
When a row is broken by for example a display math inset, it is
possible to put the cursor at the end of the previous line using the
boundary setting of cursor.

For newline insets and separator insets, we want to force the cursor
to be before this inset. Also, in the other cases, do not force
boundary property (effectively reverts part of f29e7803).
2016-03-12 12:49:00 +01:00
Jean-Marc Lasgouttes
e8e97d67d9 Fix Cursor::inCoordCache: the root inset is never in the cache
Fixes bug #10007.
2016-03-11 16:55:03 +01:00
Enrico Forestieri
bb6130eea1 Fix bug #9990: Oversized & Incorrect Glyphs in Math Delimiter Dialog
The TeX fonts ditributed with LyX are now used for displaying the
delimiters. This assures a uniform look and that no symbol is missing.
2016-03-11 11:37:15 +01:00
Guillaume Munch
b3bed2927e Fix perf issues and crash when showing 1'100'000 items (#9968) 2016-03-11 01:15:47 +00:00
Jean-Marc Lasgouttes
31eba79b09 Fix dist target when configured with monolithic build. 2016-03-10 14:53:26 +01:00
Jean-Marc Lasgouttes
5f9053d6d3 Reset right_boundary row property when row is shortened
Fixes bug #10003.
2016-03-09 09:57:14 +01:00
Jean-Marc Lasgouttes
ffc693c87f Better handling of different int sizes when computing row crc 2016-03-05 23:18:12 +01:00
Jean-Marc Lasgouttes
b4d85944a6 Set margins correctly for empty rows
Calling breakRow ensures that everything is set correctly.
2016-03-05 14:10:02 +01:00
Jean-Marc Lasgouttes
b87946c11d Revert "Better handling of different int sizes when computing row crc"
This reverts commit 7d163d4e78.
The commit got pushed by mistake and needs improvements anyway.
2016-03-04 00:14:56 +01:00
Jean-Marc Lasgouttes
8009edd3d4 Avoid endless loop when the window is too narrow
* breakRow: remove wrong condition that would silently eat the contents of the
   paragraph when the window is narrower than left margin

 * breakRow: make sure that there is at least one element in each row

 * breakAt: when force-breaking a row element, make sure it is not empty. Doing
   so may create empty rows and therefore a endless loop.

Fixes bugs #9962 and #10001.
2016-03-03 18:08:11 +01:00
Jean-Marc Lasgouttes
7d163d4e78 Better handling of different int sizes when computing row crc 2016-02-29 13:12:16 +01:00
Guillaume Munch
bd56ed38e8 Delete .out files after compilation errors (#9963)
This treats the symptom, not the bug.
2016-02-28 19:09:21 +00:00
Jean-Marc Lasgouttes
b01d7b2262 Do not merge consecutive hyphens in LyX-Code
The existing code already avoids merging with typewriter font, but it does not work with LyX-Code, where the typewriter family is inherited. Therefore it is Cursor::real_current_font that must be tested.

Fixes bug #9987.
2016-02-26 12:02:37 +01:00
Uwe Stöhr
229d7fafd5 ErrorListUi.ui: make 2 strings compilable
fixes bug #9988
2016-02-26 02:04:49 +01:00
Guillaume Munch
20a9c7a381 Fix SIGSEGV when introducing a new shortcut (#9869)
removeShortcut() restores default settings, therefore was used incorrectly. I
introduce deactivateShortcuts() which only removes assignments.

Clean up a bit the lack of view / model distinction (getting rid of the crashing
code at the same time).

Repair inconsistency of the selection in the "modify" case. (regression at
717d19d3c)

Make the test for existing bindings a bit more robust. (Not perfect yet.)

Focus on the item that has just been added/modified. (cosmetic)
2016-02-23 22:08:25 +00:00
Richard Heck
efd1af6789 Whoops on the last commit. This is the right patch. 2016-02-20 22:19:03 -05:00
Richard Heck
c498adf4db Fix bug reported on the list by Philip Pirrip. It is possible that
paramsToDialog is called when we do not have a BufferView and so do
not have a Buffer.
2016-02-20 22:16:36 -05:00
Stephan Witt
89985bebf9 #9940 VCS now toggles buffer read-only state if locking is not active and it is enabled by VC backend 2016-02-20 07:32:56 +01:00
Stephan Witt
63e982191e correct whitespace 2016-02-20 06:39:32 +01:00
Guillaume Munch
0c3643ada9 Set the preamble in fixed-width font and without line breaks (#9966) 2016-02-18 17:19:38 +00:00
Georg Baum
c0ce79452f Introduce proper integer rounding function
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.
2016-02-17 21:42:37 +01:00
Guillaume Munch
e56820bea4 Do not save \origin when \save_transient_properties is false (#9958)
\origin is a transient property in the sense that in a collaborative context
each co-author is going to have a different value for it. Moreover, \save_origin
is a global (lyxrc) setting that cannot yet be deactivated for a single file,
but one author's setting is going to impact other authors, even those who have
set save_origin=false.

There is only one location where lyxrc.save_origin produces an effect, modified
by this patch. With this patch, everything happens as if lyxrc.save_origin was
false whenever save_transient_properties=false.

This is not a file format change. When a file has
save_transient_properties=false but an origin is set (for instance a file
produced before this patch) then the origin produces its effect before the file
is saved. This produces the same effect as if the user decided to disable
save_origin between two sessions.
2016-02-09 17:48:16 +00:00
Jean-Marc Lasgouttes
2804011957 Get rid of use_preview_ in various insets
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.
2016-02-09 09:54:14 +01:00
Jean-Marc Lasgouttes
a3b19c60a7 Do not record undo in the tabularFeatures helper
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.
2016-02-09 09:18:56 +01:00
Uwe Stöhr
28e6174be7 InsetBox.cpp: fix bug #8712 2016-02-05 00:49:17 +01:00
Jean-Marc Lasgouttes
31471496fd Allow breaking a row element at a leading/trailing space
When an inset is separated from the adjacent string by a space, it is
reasonable to be able to break the string after the space.
Unfortunately, QTextLayout does not do that.

This patch reverts the workaround inserted in 71378268 and replaces it
with a different trick: the string is enlosed between a pair of
zero-width non breaking space characters, so that the leading/trailing
spaces are now normal spaces, where QTextLayout will agree to break
the string.

    Fixes bug #9921 for good.
2016-02-04 08:45:27 +01:00
Jean-Marc Lasgouttes
169cf7c24d When selecting whole row, reset properly the pit()
Since different cells in a row can have different number of paragraph, take care of setting cur.pit() when selecting a row/column.

Fixes bug #9955
2016-02-03 09:48:29 +01:00
Guillaume Munch
bcfa3547be minor cleanup 2016-01-31 16:02:18 +00:00
Georg Baum
de3e5280f6 Open tex2lyx input files with correct encoding
We open the input file now twice: The first time in latin1 encoding to read
the document encoding from the preamble. This does always work, since
traditional TeX does not allow non-ASCII contents without an encoding changing
command (except for comments, but we do not need them, and using latin1 rather
than utf8 ensures that they do not produce an iconv exception, but are simply
recored with wrong characters), and we do detect the utf8 based TeX engines
XeTeX and LuaTeX as well. The second time we open the file directly with the
document encoding.

This fixes a few tex2lyx tests on OS X, since changing the encoding of an
open file steam does not work with clang on OS X. Files using more than one
encoding are still broken, but all single-encoding files are fixed now.
2016-01-31 12:54:59 +01:00
Georg Baum
92d0835e14 Avoid encoding changes of open streams if possible
Changing the codecvt_facet of a file stream after the file has been opened
does not work with clang on OS X. Therefore we avoid it if possible (i. e. the
new encoding is the same as the old one).
2016-01-31 12:49:17 +01:00
Georg Baum
250b058192 Do not use static objects in Preamble
This does not make any difference currently, since the only instance of the
Preamble class is a global one, but it is cleaner and will be needed for
parsing the encoding with a second Preamble instance.
2016-01-31 12:37:22 +01:00
Uwe Stöhr
4dce8d4da4 tex2lyx testfiles: update fileformat 2016-01-30 02:17:45 +01:00
Georg Baum
5727cb2d43 Use consistent iconv encoding names
We should stick to the names used in lib/encodings. iconv has many aliases,
but fi we ever compare names it is better to use only one variant.
2016-01-29 20:38:40 +01:00
Jean-Marc Lasgouttes
8d091cfe78 Avoid making tabular too large when using a caption in longtable mode
This is a fixup to commit cdb9f043, which fixed bug #9757.

It is necessary to make a special case for inserting an InsetCaption
in a tabular cell, because this commonly happens in longtable mode.

Fixes bug #9945.
2016-01-29 10:05:48 +01:00
Enrico Forestieri
9edbeef7b7 Make sure the cursor is in texted 2016-01-28 14:13:17 +01:00
Guillaume Munch
2c08848700 Let tabular-feature commands fall through non-table math insets. (#4189) 2016-01-27 18:36:07 +01:00
Guillaume Munch
f58638c704 New LFUN tabular-feature: convert "inset-modify tabular" in LyX files
* Increase LyX format

* New function convert_info_insets in lyx2lyx_tools.py
  Use this function in the future for future updates of info insets

* Convert "inset-modify tabular" to "tabular-feature" in info insets

* Remove icon naming hack regarding "inset-modify tabular"
2016-01-27 18:33:09 +01:00
Guillaume Munch
366b319e42 New LFUN tabular-feature: update prefs2prefs.py 2016-01-27 18:20:53 +01:00
Guillaume Munch
c9f7ce0a7a New LFUN tabular-feature (#9794)
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
2016-01-27 18:20:37 +01:00
Uwe Stöhr
c1e0b24304 acmsiggraph.layout: update layout for ACM siggraph 0.92
fileformat change: update fileformat for all files
2016-01-27 01:58:13 +01:00
Georg Baum
8171272d1f Fix file locking problem on windows (bug 9925)
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.
2016-01-26 21:49:08 +01:00
Georg Baum
4ab1d77577 Fix regression of 0bf8b8a1 (bug 9884)
Unfortunately the footmisc package does not work together with hyperref:
Before 0bf8b8a1, a footnote in a section title was created as a link in pdf
outpout, after 0bf8b8a1 ist was no link anymore. For now we revert to the old
code, and wait until the footmisc and hyperref packages are made compatible.
2016-01-26 21:33:46 +01:00
Uwe Stöhr
854ec56419 PrefOutputUi.ui: the official program name is "dvips"
(We used this also in LyX 2.1.x so there is no need to rename it to DVI-PS.)
2016-01-25 02:06:10 +01:00
Scott Kostyshak
58730c73d4 Ammend 20addbbf
These two signals were not QProcess::error().
2016-01-24 13:05:51 -05:00
Scott Kostyshak
20addbbf36 Qt 5.6 renames signal QProcesss::error()
QProcesss::error() was renamed to QProcesss::errorOccurred().

The renaming was done to avoid confusion from overloading (see the
documentation for the signal before the renaming [1]).

For more details, see this Qt bug report [2].

[1] http://doc.qt.io/qt-5/qprocess.html#error-1
[2] https://codereview.qt-project.org/#/c/114451/
2016-01-24 12:07:52 -05:00
Georg Baum
dc8c4f3eab Fix date inset except on windows (bug 9925)
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.
2016-01-24 17:11:31 +01:00
Stephan Witt
3d00aef3ac use QStandardPaths::GenericDataLocation instead of QStandardPaths::DataLocation to get common user_support_dir path for all LyX binaries (LyX, tex2lyx and lyxclient) 2016-01-24 15:19:54 +01:00
Enrico Forestieri
80e2c85474 Change the shape of the parbreak separator
As per request, this makes it better distinguishable from the
neline inset. For posterity, see this thread:
http://thread.gmane.org/gmane.editors.lyx.devel/159267
2016-01-24 12:49:02 +01:00
Stephan Witt
1440ae2e13 pass values for @executable_path and @loader_path to instruct the dyld where to find the Qt frameworks 2016-01-23 07:16:09 +01:00
Uwe Stöhr
2f98d3902c ViewSourceUi.ui: fix bug #4430 2016-01-21 23:01:10 +01:00
Jean-Marc Lasgouttes
76eebf5707 typo 2016-01-20 17:40:47 +01:00
Jean-Marc Lasgouttes
82b6dc8aa9 Update all paragraphs layouts when undoing bufferparams
When undo restores a previous BufferParams instance, it should also
update all the layout pointers in the document's paragraphs.

Fixes #9916.
2016-01-20 15:20:51 +01:00
Uwe Stöhr
bcbeeebe63 ViewSourceUi.ui: correct wrong property number
Just save the file with Qt Designer of Qt 4.8 or Qt 5.5 version and this change will be made by designer automatically
2016-01-20 01:33:42 +01:00
Enrico Forestieri
8998b88370 Make sure cursor is in texted after clicking
Fixes #9936.
2016-01-20 01:18:42 +01:00
Uwe Stöhr
764a2163bb Revert "Revert "Fix the display of column spacing in AMS environments""
This reverts commit f1a388584f.

# Conflicts:
#	src/mathed/InsetMathGrid.cpp
#	src/mathed/InsetMathSplit.cpp
2016-01-19 23:20:53 +01:00
Uwe Stöhr
641a1cc1a2 Revert "Fix the display of column spacing in AMS environments"
This reverts commit 1676b69cf7.
2016-01-19 23:01:44 +01:00
Guillaume Munch
1676b69cf7 Fix the display of column spacing in AMS environments
AMS align environment should have some spacing between odd and even columns.

Add a new virtual method displayColSpace() to InsetMathGrid, InsetMathHull and
InsetMathSplit.
2016-01-19 22:45:04 +01:00
Uwe Stöhr
360992cb9f Revert "Fix the display of column spacing in AMS environments"
This reverts commit bb5470b5d1.

I have no clue what is with my GIT. I apologize. Can anybody please check if it is now OK again?
2016-01-19 22:40:38 +01:00
Uwe Stöhr
f1a388584f Revert "Fix the display of column spacing in AMS environments"
I have no clue why this was automatically committed, I just applied the path, nothing more.

This reverts commit bb5470b5d1.

# Conflicts:
#	src/mathed/InsetMathGrid.cpp
#	src/mathed/InsetMathSplit.cpp
2016-01-19 22:35:24 +01:00
Uwe Stöhr
c7ad447f98 InsetMath: normalize the line endings of 2 files 2016-01-19 22:30:36 +01:00
Guillaume Munch
bb5470b5d1 Fix the display of column spacing in AMS environments
AMS align environment should have some spacing between odd and even columns.

Add a new virtual method displayColSpace() to InsetMathGrid, InsetMathHull and
InsetMathSplit.
2016-01-19 22:22:23 +01:00
Guillaume Munch
0b733507da Display the correct horizontal alignment in AMS environments
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.)
2016-01-19 22:22:22 +01:00
Jean-Marc Lasgouttes
7137826896 Allow breaking a row element at a leading space
When an inset is separated from the next strng by a space, it is reasonable to be able to break the string after its leading space.

Fixes bug #9921
2016-01-19 09:55:31 +01:00
Pavel Sanda
555b08c325 Comment only. 2016-01-18 14:29:37 -08:00
Stephan Witt
faef2f93dd fix GIT - version control for LyX documents not detected 2016-01-17 08:03:57 +01:00
Enrico Forestieri
5c891242f3 Don't merge next paragraph when removing a separator inset 2016-01-16 16:44:26 +01:00
Enrico Forestieri
55b3374f3e Always place the cursor before a separator inset when clicking 2016-01-16 16:41:04 +01:00
Enrico Forestieri
1c3b6807db Insert a plain separator instead of a parbreak one.
When hitting Enter after a non-standard layout a plain separator is
now inserted. This seems to be preferred and more in line with what
is obtained with the "Alt+M P" shortcut.
2016-01-14 20:57:52 +01:00
Enrico Forestieri
a8ab3379d9 Insert a separator only when the paragraph is empty. 2016-01-13 22:49:33 +01:00
Guillaume Munch
467bc27aea Update tex2lyx tests
Just add \save_transient_properties as expected.
2016-01-12 21:25:34 +00:00
Guillaume Munch
5c2d049996 Add \save_transient_properties parameter (#9841)
Increment LyX format to 504.

With this new parameter, the user can indicate that some other parameters that
are frequently switched must not be recorded in the file (as if they were a
setting specific to the user or transient, rather than a document setting). This
will play nicer with version control systems.

See the discussion, e.g.:
http://thread.gmane.org/gmane.editors.lyx.devel/157824/focus=157993 (third
solution mentioned)

TODO:
* The interface remains to be set up. We cannot change this setting from LyX
  for now.
* If save_transient_properties is false, we should read the user setting as a
  per-user-per-document (session) setting (e.g. like the cursor position).
* Once the above is done, we can treat \justification the same way (but it would
  be even better if \justification was moved to lyxrc).
2016-01-12 21:25:34 +00:00
Guillaume Munch
f475795b92 Revert "Work around bug #9841"
This reverts commit dc016de34e.

See discussion at http://mid.gmane.org/n53ar8$1tj$1@ger.gmane.org
2016-01-12 21:25:34 +00:00
Guillaume Munch
b529a2ffe5 Amend fd4d23b4
http://mid.gmane.org/3790287.D9aVANvQPJ@linux-22mz
2016-01-12 21:25:34 +00:00
Jean-Marc Lasgouttes
626f8d4448 Fix compilation error with clang's libc++
The bug is probably fixed for clang 3.7.1 or 3.8.0
2016-01-11 11:18:20 +01:00
Enrico Forestieri
71ff50b753 Make sure the origin tag is properly terminated. 2016-01-10 23:17:59 +01:00
Georg Baum
d80fa17175 Do not apply \origin at existing files
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.
2016-01-10 19:46:01 +01:00
Stephan Witt
7e72c1d0d3 Call lyx::next and lyx::prev explicitely. In case libc++ provides
std::next even when not in C++11 mode this is necessary. E.g. with
clang from Xcode7 on Mac OS X.
2016-01-10 18:06:15 +01:00
Stephan Witt
34cbec9074 remove unused minizip include; avoid putting zlib include dir before others, this causes use of external boost headers if they are at the same location 2016-01-10 18:06:15 +01:00
Enrico Forestieri
bbb5a1a28f Always place the cursor before a separator inset when moving up or down. 2016-01-10 00:08:10 +01:00
Enrico Forestieri
c8aaaff15a Avoid inserting multiple consecutive parbreak separators. 2016-01-10 00:05:24 +01:00
Günter Milde
3a70340a95 Use polyglossia also with DVI (LuaTeX).
Simplify the logic for language package selection and make it more consistent:

Use polyglossia with non-TeX fonts (system fonts/Unicode fonts) for all
export flavours (XeTeX, LuaTeX, DVI-LuaTeX), if the language package setting
is "auto" and there is no language not supported by Babel and no package
providing Babel.

This solves some Babel-related autotest cases and leads to some new failures
due to the polyglossia language nesting problem.
2016-01-08 22:52:28 +01:00
Georg Baum
f35ed0c168 Improve \AA and \aa tex2lyx import
The lib/unicodesymbols part is based on work by Günter Milde:

Both, \r{A} and \AA (rsp. \r{a} and \aa) are equivalent standard LICR macros
for Aring/aring  as well as the deprecated "angstrom sign" character (212B).

However, with \AA for 212B and \r{A} for 00C5, tex2lyx converts \AA to the
deprecated "angstrom sign" which is missing in many fonts including the
Unicode version of Latin Modern.

I added the normalize_c() calls so that tex2lyx prefers the precomposed forms
(these are better editable in LyX) and the deprecated flag.
2016-01-08 21:06:24 +01:00
Georg Baum
ac1cd1ad9a Add symbol tests for A WITH RING ABOVE
The conversion is not completely correct yet, but adding the test before the
fix has the advantage that the fix can easily be documented by changing the
test reference.
2016-01-06 22:34:12 +01:00
Peter Kümmel
936ec66124 fix merged build 2016-01-06 13:07:59 +01:00
Richard Heck
0407364392 Fix bug #9907: We get a crash if we first close a master buffer one of
whose children is also a child of another buffer, then try to close that
one.

The problem is that we do not check properly to make sure that the child
is not a child of some other buffer. Now we do.
2016-01-05 09:59:31 -05:00
Richard Heck
e8ffb0c97a Rewrite the BufferList::releaseChild method so that it only checks
whether a given child Buffer is also a child of some other parent.
Then do the releasing or resetting where this method is called.

There should be no change of behavior with this patch.
2016-01-05 09:59:31 -05:00
Jean-Marc Lasgouttes
01fc62b78e When moving cursor, always reset anchor
This applies to BufferView::moveToPosition, which is used for bookmarks and initial cursor position (on loading).

Fixes bug #9912.
2016-01-05 15:05:27 +01:00
Jean-Marc Lasgouttes
d3c0044617 Fix entering inset in visual cursor mode
Improve the test whether cursor has moved in Cursor::posVisLeft. The code for posVisRight had already been fixed for #5764 at 0730c923, but this replaces both tests by the proper == operator.

Fixes bug #9913.
2016-01-05 15:03:30 +01:00
Guillaume Munch
18918f1c1b Amend bb344452 2016-01-04 03:43:08 +00:00
Scott Kostyshak
752c67ada9 Do not initialize a var to a val that's never used
By initializing 'to' to a value, the code made it seem like that
value mattered. But the value is overwritten in getWord().

Further, now if 'to' is used before it is initialized, there might
be a useful compiler warning that could point to a bug.
2016-01-03 11:57:19 -05:00
Stephan Witt
f1a21f8250 #9889 slightly improved layout management to avoid too small popup window for advanced F&R 2015-12-28 10:36:25 +01:00
Jean-Marc Lasgouttes
30cf941cb3 Avoid swapping a cell with itself
Gcc STL debugging feature asserts when swapping an object with itself. This happens in some cases with math grids that have only one column.

A quick review of other uses of swap() in the code base did not reveal any other dubious case.

Fixes bug #9902.
2015-12-26 13:59:25 +01:00
Peter Kümmel
e1c893127f boost dir is used for out-of-source build detection 2015-12-20 14:00:04 +01:00
Peter Kümmel
3c3141dc23 3rdparty/boost: build with cmake 2015-12-20 13:41:00 +01:00
Guillaume Munch
fd4d23b448 Amend f441590c
Remove runtime warning "QMetaObject::connectSlotsByName: No matching signal for
on_copyPB_clicked()".
2015-12-19 23:54:42 +00:00
Georg Baum
5e3165e9cc Improve directory name juggling
The old code did not ensure that the path was only broken into parts at
directory separators. The new code ensures it.
2015-12-19 16:49:52 +01:00
Guillaume Munch
54a28ca2dc Hide OptSubmenus (#9717) (for real this time)
Amend 6cc69343 and d449e7e6. See the latter for the rationale behind this
change.
2015-12-17 23:48:47 +00:00
Guillaume Munch
6cc6934378 Hide OptSubmenus (#9717)
At d449e7e6 it has been decided that submenus are going to be displayed even if
all their items are disabled. Here we make an exception for OptSubmenus.

Example of submenu no longer shown: Insert > Insert Regexp
Example of submenu always shown: Edit > Math > Limit Type, Macro Definition
2015-12-17 21:54:41 +00:00
Guillaume Munch
dc016de34e Work around bug #9841
\output_changes is now output at a distance from \tracking_changes.

Since both parameters can be seen as per-user preferences, they can cause
undesirable merge conflicts, in a multi-author setting, were it treated as a
single block by the version control system, as was the case before this patch.
2015-12-17 20:40:54 +00:00
Guillaume Munch
2dfb5f80ce Limit the size of navigation menus for performance.
After d5a5fbb8, as indicated in the commit log, it remained to make sure that
the sub-menus of the navigation menu showing the TOCs are generated in a delayed
fashion, to avoid corner cases regarding performance when documents have very
lengthy tocs (e.g. in a document with 1000 sections it takes a few hundreds
milliseconds for the menu to be refreshed). But this idea actually requires
substantial changes to the way menus are computed, so it is not for now.

In the meanwhile, I reintroduce a max size for menus, after which it is cut
off. This differs from the one that I removed at d5a5fbb8 in two ways: 1) if
there are more items than the max size, then we still show something instead of
nothing, 2) we allow ourselves to rely on qt's scrollable menus and therefore
allow bigger menus than before the above commit. The philosophy is that it is
better to show something than nothing, that it's better to show a scrollable
menu than to cut the menu to fit the screen, and that beyond a certain size the
scrollable menu becomes useless anyways.
2015-12-17 20:38:04 +00:00
Jean-Marc Lasgouttes
91b385166d Do not use a static variable as QTextLayout cache
It is a bad idea to have a QObject variable that oulives the main QApplication object. See for example:
https://www.ics.com/designpatterns/book/globals.html

Here the QTextLayout object was static to the anonymous namespace getTextLayout function, and got destroyed after the freetype renderer had been disposed of by QApplication.

This causes segmentation faults when quitting LyX on some systems.

This patch moves the cache together with other GuiFontMetrics caches. It means that one will have one such QTextLayout per font type, but this will not change much.
2015-12-16 10:34:43 +01:00
Peter Kümmel
3bd2cfecf0 move 3rdparty dir out of src/ 2015-12-15 13:20:13 +01:00
Peter Kümmel
6cc83c5072 bundled iconv uses const 2015-12-15 13:20:11 +01:00
Peter Kümmel
584c3a6f7b build with msvc2013 2015-12-15 13:20:10 +01:00
Peter Kümmel
b46ea7fac0 integrate 3rdparty libs 2015-12-15 13:20:10 +01:00
Peter Kümmel
31b5da479d build zlib with cmake 2015-12-15 13:20:09 +01:00
Peter Kümmel
a34b5376c2 add stripped down zlib 1.2.8 2015-12-15 13:20:08 +01:00
Peter Kümmel
72540e8b87 build libiconv with cmake 2015-12-15 13:20:08 +01:00
Peter Kümmel
69be7ebfa2 add stripped down libiconv 1.4 2015-12-15 13:20:08 +01:00
Peter Kümmel
34c822cf65 build hunspell with cmake 2015-12-15 13:20:07 +01:00
Peter Kümmel
37b951c77a add stripped down hunspell 1.3.3 2015-12-15 13:20:06 +01:00
Stephan Witt
4fd4c31bb6 #9875 disable the modifier check for LFUN_SELF_INSERT on Mac 2015-12-15 01:24:31 +01:00
Stephan Witt
6bac894042 #9875 add checks for having a current_view_ before using it 2015-12-15 01:14:53 +01:00
Guillaume Munch
3c9b62a69d Layout format update: AddToToc, IsTocCaption, OutlinerName
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)
2015-12-13 19:56:49 +00:00
Kornel Benko
f7a8c5b4eb \origin handling. Use realPath() intead of absFileName()
This change avoids misinterpreting paths containing symbolic parts.
Without this, lyx may not find its own sysdir.
2015-12-13 12:25:32 +01:00
Richard Heck
947aaf7a57 There does not appear to be any need to update the entire Buffer
after each entry into mathed. Instead, we just update the TOC for
anything the mathed happens to be inside.
2015-12-12 17:19:33 -05:00
Richard Heck
cf64064db7 Use the much faster forOutliner also to get the tooltip text. 2015-12-12 17:19:33 -05:00
Richard Heck
a5ea77410e Do not try even to hide buffers that are being processed by LyX.
Should fix #9711.
2015-12-12 13:00:20 -05:00
Richard Heck
394fc5cf15 Simplify logic. 2015-12-12 13:00:20 -05:00
Guillaume Munch
87861bc6d5 Use AMS align instead of eqnarray on newline-insert by default (#2543) 2015-12-11 19:28:32 +00:00
Jean-Marc Lasgouttes
9c43747cc9 Make text margin size dependent on zoom and dpi
The default hardcoded value of 10 corresponds to 2.5mm at 100dpi, but does not make much sense on a HiDpi screen.
2015-12-11 12:26:07 +01:00
Enrico Forestieri
b6880470b3 Fix bug #9898: inset info cannot show specified icon 2015-12-11 08:51:37 +01:00
Georg Baum
92573c9ddc Fix crash in info inset dialog apply (bug 9896)
posBackward() is the exact inverse of posForward(), not backwardPos().
2015-12-10 20:21:20 +01:00
Uwe Stöhr
219b5645c2 Inset files: add includes to compile with cxx11
see the list thread "Re: use FindCXX11Compiler.cmake also for MSVC"
2015-12-10 01:15:16 +01:00
Jean-Marc Lasgouttes
7dbd63e2b9 When counting hfills, make sure that they are active
The active/inactive status of hfills was not checked in numberOfHFills.

The code is reorganized a bit, but the important part is the change in the above function.

Part of bug #9870.
2015-12-09 17:16:00 +01:00
Peter Kümmel
8028110578 qtmain also needed for Qt5 on Windows 2015-12-09 16:45:15 +01:00
Jean-Marc Lasgouttes
f3cdf74e68 Remember the last used QTextLayout object
This crude caching mecanism is useful in the particular case of a screen with many misspelling dotted lines. In this case, it is necessary to build a QTextLayout in order to know where to put the start/end of the spell line. Since rows typically contains text snippets longer than a word, we may be in a situation where the same QTextLayout is constructed repeatedly.

This commit is useful in this particular use case, and should not be costly in other cases. A better fix would be to remember the QTextLayout associated to each row element. This is a bit more work, so this fix should be sufficient for now.

Additionally, do not paint misspelled marks when painting is disabled.

Fixes bug #9890.
2015-12-09 11:57:52 +01:00
Enrico Forestieri
db363ab19f Remove unneeded png images.
Fixes #9857.
2015-12-07 19:14:44 +01:00
Jean-Marc Lasgouttes
79bb97b1ba Detect properly when cursor position cannot be computed
Replace old ad-hoc test by a better one that inspects the coordcache to see whether all the insets in the cursor are known.

Fixes bug #9881.
2015-12-07 13:25:10 +01:00
Scott Kostyshak
acadb4d608 Fix a debug comment 2015-12-07 02:02:04 -05:00
Scott Kostyshak
6631e736bd Revert "InsetFootlike.cpp: disable listings inside footnotes"
Although af8ba5e0 fixed #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.
2015-12-07 01:52:11 -05:00
Richard Heck
4d94460ce3 Add new ProvideStyle tag, which adds a new style only if it does not already
exist. This will allow for a proper fix for bug #8796, though that may or may
not get fixed before 2.2.0.

Also, change the InStyle tag to ModifyStyle, per a suggestion of Jurgen's.
2015-12-05 18:11:46 -05:00
Guillaume Munch
400703aff1 Convert remaining C++ files to UTF-8 2015-12-05 19:33:24 +00:00
Guillaume Munch
d9524321d7 Simplify Unicode symbols for old systems
(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.
2015-12-04 17:29:39 +00:00
Jean-Marc Lasgouttes
1546b91f27 Make spellchecker dotted underlines thicker. 2015-12-02 21:49:54 +01:00
Jean-Marc Lasgouttes
39e33d5138 Fix width of row when there are active hfills
It is important to make sure in computeRowMetrics that the row width
is correct at the end, because we rely on it in several places.

Fixes bug #9870.
2015-12-01 09:14:22 +01:00
Scott Kostyshak
d887b2a5dc Update previews when turned on in prefs (#9507)
Previews are now generated when previews are turned on in
preferences. This change ensures that when users activate previews
for the first time, they are not confused by no previews showing up
(a restart of LyX or a triggering of each individual preview would
be required).

There was a previously attempted fix for #9507 at 390ae054 which was
reverted at 358745d0 for performance reasons: it updated previews
after every preference change and updating previews is costly (even
if the cache signals there are no changes needed).

This implementation is consistent with what we do for updating the
system fonts in preferences.
2015-11-30 18:51:05 -05:00
Richard Heck
a8f57334e2 Fix bug #9096: Load all the files specified on the command line, and then dispatch whatever commands we are given to those Buffers.
Original patch due to Benjamin Piwowarski. Updated for 2.2 by Richard Heck.
2015-11-29 11:25:21 -05:00
Richard Heck
c01a533acc Whitespace. 2015-11-29 11:25:08 -05:00
Georg Baum
5c35ebcd24 Simplify logic
The old code was more complicated than needed, we have unstarred_name to make
our live easier. The test proves that the new code works as before.
2015-11-27 20:35:13 +01:00
Georg Baum
8ac43f2e04 Add tex2lyx test for verbatim* 2015-11-27 20:30:41 +01:00
Richard Heck
f791b2d3ea Remove "dialog-show print" from various UI locations. 2015-11-26 23:21:07 -05:00
Richard Heck
b4abecd99b Remove some gui remnants of print support. 2015-11-26 23:21:07 -05:00
Uwe Stöhr
bfc749eb23 stdlayouts.inc: support for verbatim*
fileformat change
2015-11-24 23:56:26 +01:00
Georg Baum
e8211fb931 Fix C++11 std::regex incompatibility
boost::regex supports escape sequences starting with a backslash in format
strings of regex_replace, but std::regex does not. Therefore format strings
involving literal backslashes have to be written differently for both flavours.

The special MSVC handling in regex.h is removed, since it is not needed
anymore, and using grep syntax would definitely be wrong.
2015-11-24 20:31:14 +01:00
Jean-Marc Lasgouttes
1f0305509b Fix length of hfills
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.
2015-11-24 10:11:17 +01:00
Scott Kostyshak
82ef95043d Add comment 2015-11-23 22:14:14 -05:00
Jean-Marc Lasgouttes
d8719ade59 Implement on screen rendering of alignment in LR boxes.
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.
2015-11-23 11:40:36 +01:00
Kornel Benko
af5ec069c7 Removed doubled code in CMakeLists.txt 2015-11-22 19:20:32 +01:00
Georg Baum
dfe3a7d9fc Fix InsetListings::getCaption() for std::regex
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.
2015-11-22 17:43:10 +01:00
Georg Baum
3b842d5a62 Add unit test for InsetListings::getCaption()
The regex in InsetListings::getCaption() does not work with C++11 and
std::regex. This can now be checked easily by this new unit test.
2015-11-22 17:36:32 +01:00
Georg Baum
08317ecc0b Fix some thinkos in MSVC regex hack
The changed code is not used, but I tried to use a similar approach for
boost::regex, and found some problems:
- regex_replace and regex_search are implemented in the replacement, so they
  must not be used directly
- an smatch object must be given by reference (as in the called methods),
  otherwise an exception would be thrown at runtime
- the commented out regex_replace version is actually needed

This code is supposed to be deleted, but nevertheless I wanted to record here
how it had to be modified if it was actually needed.
2015-11-22 13:02:39 +01:00
Günter Milde
faadac9f4a Remove wrong FIXME.
Code at this place calls "switchEncoding" which takes care of not-switching
if there is only one inputenc used in the document.
2015-11-21 23:08:54 +01:00
Jean-Marc Lasgouttes
46ca4e9aa6 Improve debug message 2015-11-20 22:43:45 +01:00
Stephan Witt
dd6b5cc67c improved data types for prefix length and pointer diff 2015-11-20 20:48:56 +01:00
Scott Kostyshak
1bd56c8730 Clear the error list before second LaTeX run
It was possible for errors that occured in the first run to be shown
in the error list after the second run. Now, the errors are cleared
before the second run.

Although I do not have a reproducible example at hand, I imagine
this situation would occur if a rerun is required and there is still
an error after the rerun.

Related to #9765.
2015-11-20 13:47:11 -05:00
Scott Kostyshak
0a91abbc9f Update exit code on second LaTeX run (#9765)
Before, the exit code for the first LaTeX run was used to set the
flag, which caused an error to be reported when in fact there was no
error on the second run.

This fix ammends 1dbf0e5a.
2015-11-20 13:40:37 -05:00
Scott Kostyshak
6f207b37ed Add comment 2015-11-20 13:40:37 -05:00
Jean-Marc Lasgouttes
2811f76039 tex2lyx: Add a newline at the end of comment if not at the end of a paragraph.
When importing TeX code like
  %comment
  TEXT
the LyX document currently becomes
  [ERT %comment] TEXT
so that TEXT is now part of the comment.

Now output_comment adds a trailing newline if the token after the
comment is not a newline. Note that the newline that marks the end of
the comment has already been parsed at this point.

tex2lyx tests have been checked manually and updated.

Fixes ticket #9551.
2015-11-20 15:07:21 +01:00
Juergen Spitzmueller
d0aa1d250c Disable Apply button in InsetParams dialogs if there is no inset to apply to.
Fixes: #9386
2015-11-19 15:48:49 +01:00
Kornel Benko
492d44a284 Correct tex2lyx/roundtrip/test-structure.tex test. 2015-11-18 18:35:54 +01:00
Guillaume Munch
355f9a0efc Remove trailing space at the end of \author
Checked that the change is compatible with lyx2lyx (relevant lines are in
lyx_2_0.py).
2015-11-18 02:50:25 +00:00
Guillaume Munch
86bd1cd641 Fix bug #9854 "Dataloss after git merge with change tracking"
A plausible scenario is that change tracking is used together with a versioning
system. In this case, parallel modifications might remove an \author line on one
side, and add another change of this author on the other side. This scenario
causes a bad merge after which the added change has no associated author. In
this case, LyX used to display a list of errors on opening and deliberately
removed the corresponding change tracking information.

* If ever a tracked change refers to an author that does not exist, then add a
  dummy author. This dummy author is not saved to the file afterwards.

* Have a very clear error message on opening such a corrupt file.
2015-11-18 02:50:25 +00:00
Guillaume Munch
dbce5cafcc Rewrite regexes in ECMAScript style (bug #9799) 2015-11-18 01:52:50 +00:00
Uwe Stöhr
cc6c86ff3b theorems.inc: add environment "solution"
fileformat change, fixes bug #6363
2015-11-18 01:14:30 +01:00
Kornel Benko
c9f6ed309f Cmake monolithic build: Some corrections.
In the src/support directory do not use src/support/AppleScriptProxy.cpp if not APPLE.
In the src/client directory remove inclusion of src/TexRow.cpp
2015-11-17 21:21:00 +01:00
Juergen Spitzmueller
dd6340cfcc Do not switch listings to singlebyte encoding with pLateX/Japanese
Also improve Listings warning about uncodable characters
if the encoding has been switched by LyX.

Fixes: #8439
2015-11-17 10:30:03 +01:00
Jean-Marc Lasgouttes
b26b90ae0e Use a QCache for string metrics
This is better because it implements a LRU cache. Indeed, while editing in particular, width of many different strings has to be computed. This is different from the previous situation where only width of single characters was computed and cached.
2015-11-17 09:38:16 +01:00
Jean-Marc Lasgouttes
735c10d039 Update documentation for tabular features 2015-11-17 09:26:29 +01:00
Jean-Marc Lasgouttes
68217b1e4a Implement toggling for longtabular and booktabs tabular features
This is needed for the tabular context menu. This menu is updated accordingly.
2015-11-17 09:18:50 +01:00
Jean-Marc Lasgouttes
0f5886b856 Disable LFUN_LAYOUT when layout cannot be found
Fixes bug #8077
2015-11-17 08:48:55 +01:00
Georg Baum
0c97d6edc0 Fix wrong forward declaration
This popped up in cmake monolithic build once. It looks like BufferView is
included indirectly by some of the other headers (otherwise we would have seen
compile errors for other build configurations as well), bu I'll keep the
forward declaration since we don't want to depend on this indirect header
inclusion.
2015-11-16 21:51:30 +01:00
Georg Baum
1900eb2834 Fix a cmake monolithic build error
N_() is a preprocessor macro to mark translatable static strings. It is not a
good idea to also name a class member variable N_: It did only work in the
other build configurations because gettext.h was not included.
2015-11-16 21:39:03 +01:00
Kornel Benko
5c796730b2 Replace the translatable latexism 'longtable' with 'multi-page table' in UI. 2015-11-16 10:29:53 +01:00
Juergen Spitzmueller
78c706e02d Assure we use docstring.
Cures another monolithic build error with CMake.
2015-11-16 08:21:53 +01:00
Juergen Spitzmueller
2a223b0933 Rename function that was ambiguous from a monolithic perspective.
Cures one monolithic build issue with CMake.
2015-11-16 08:20:54 +01:00
Juergen Spitzmueller
b423c59d3c Factor out multiply used ColorSorter.
This cures one problem of monolithic build (where the function was
ambiguous)
2015-11-16 08:19:16 +01:00
Richard Heck
fb2c558f67 We need to show the error message in the case in which we copied the
file due to a format change, as well.
2015-11-15 12:32:26 -05:00
Richard Heck
9efa43d2be Simplify use of Buffer::getBackupName().
Previous versions of this code used the string in a different way,
but now it is sufficient just to return a FileName.
2015-11-15 12:19:17 -05:00
Guillaume Munch
7b07788278 Amend 789745df
Remove warning. Actually the auxiliary function is not necessary since its
actual contents have been relocated as TexRow::prepend() during dev.
2015-11-15 12:18:47 +00:00
Richard Heck
5afe6cf947 Fix stupid error in cc83dfa887. 2015-11-13 17:03:40 -05:00
Günter Milde
8021c0b0dc Update comments after solving #9740. 2015-11-13 13:59:17 +01:00