Commit Graph

8458 Commits

Author SHA1 Message Date
Enrico Forestieri
697580006e Bring window to front only for single-instance mode
A window manager could be configured such that to maintain a certain
stack order for the windows. It would be annoying that opening a new
file through menu brings up the window, so do this only if we are
loading a file through the lyx-server.
2016-07-05 01:01:02 +02:00
Stephan Witt
d246aa7af5 Fix missing include for endl after header cleanup in change 670efa8f64 2016-07-04 11:04:53 +02:00
Guillaume Munch
670efa8f64 Rationalise includes
Modifying TexRow.h or texstream.h no longer triggers the recompilation of the
complete source tree.
2016-07-04 02:42:17 +02:00
Enrico Forestieri
16ec606ab4 Bring window to front after loading a document
Fixes #7875.
2016-07-03 22:58:25 +02:00
Guillaume Munch
28f6c312a9 Painter: Add a line style to disable antialiasing
It is not possible to use opacity effects (such as drawing an antialiased line
to strike diagonally through an inset), until the painter is fixed so that it
does not redraw repeatedly over the same spot (otherwise, the usual aritfacs
appear).

For now, pixellated lines are OK.
2016-07-03 17:28:46 +02:00
Guillaume Munch
4089ff1ec3 Beautify ToolTips in work area
* Justification and nicer line breaks.

* Much nicer tooltip for lists of bibliographical references.

* Removed unnecessary iterated copies of the string buffer in
  InsetText::ToolTipText() which looked bad. This function used to be costly
  (cf64064), maybe it is quicker now.
2016-07-03 17:28:46 +02:00
Guillaume Munch
d1dddde6d8 Remove tooltips from the data of Toc Items
After the previous commit, tooltip in the outliner are formatted automatically,
along with the other tooltips. A previous commit had already removed the
expensive call to tooltipText() that, although it gave a better rendering, was
very expensive (cf64064). This patch finishes to remove the custom tooltip
from the model data in the outliner.

(It would be nice to reintroduce a tooltip based on tooltipText(), but there
seemed to be a consensus that in that case one would prefer a less expensive
approach that computes the tooltip on the fly.)
2016-07-03 17:28:46 +02:00
Guillaume Munch
8cf138e173 GuiDocument: some polishing of the list of modules.
* The tooltips in the list of modules now include the names of the modules.

* The tooltips of modules more consistent across the widgets.

* Sort the list of modules according to the locale (i.e. "É" comes before "F").

* Replace a hand-made sentence boundary finder by Qt's.
2016-07-03 17:28:46 +02:00
Guillaume Munch
ee72e9520a Remove manual line breaks.
Line breaks in tooltips are now done automatically, there is no more need to
break the strings explicitly.
2016-07-03 17:28:46 +02:00
Guillaume Munch
059ca0f691 Line breaks in tooltips
* New function formatToolTip(QString):

Format text for display as a ToolTip, breaking at lines of a certain
width. Note: this function is expensive. Better call it in a delayed manner,
i.e. not to fill in a model (see for instance the function
ToolTipFormatter::eventFilter).

* Install a global event filter that formats tooltips on-the-fly

Inspired from
3793fa09ff
but much improved.

When is formatToolTip called automatically? Whenever the tooltip is not already
rich text beginning with <html>, and is defined by the following functions:
 * QWidget::setToolTip(),
 * QAbstractItemModel::setData(..., Qt::ToolTipRole),
 * Inset::toolTip() (added in one of the subsequent patches)

In other words, tooltips can use Qt html and the tooltip will still be correctly
broken. Moreover, it is possible to specify an entirely custom tooltip (not
subject to automatic formatting) by giving it in its entirety, i.e. starting
with <html>.
2016-07-03 17:28:45 +02:00
Guillaume Munch
489dca71cd Simplifications, mainly removal of boost::function and useless std::bind 2016-07-03 01:39:32 +02:00
Richard Heck
fd4645c912 Whitespace only. 2016-06-27 18:54:14 -04:00
Richard Heck
4b64aaf4ce This patch does two closely related things.
The main thing it does is integrate mouse-modifiers into the
FuncRequest machinery. Previously, these had to be passed
separately, which led to some ugly function signatures.

There was also an unnecessary form of the constructor, which
can now be removed.

No change of behavior is intended.
2016-06-27 18:16:35 -04:00
Georg Baum
14fa2c7162 Remove using directives from headers
The only exceptions are:

- The purpose of the header is to drag in the used symbol, e.g. unique_ptr.h
- The used symbol is inside a class or a namespace other than lyx

The reason for this is that global 'using' statements effectively forbid to
use the used symbols in any other namespace in the whole program, since simply
adding or removing an #include of the corresponding header subtly changes the
name lookup. The namespace lyx is sort of global, so it should not have these
statements either.
2016-06-26 18:22:59 +02:00
Enrico Forestieri
458d2015dc Make command buffer icons same size as QLineEdit height
Part of bug #10125
2016-06-26 16:58:18 +02:00
Enrico Forestieri
f56ee1875c Make oultliner icons same size as the toolbar icons
Part of bug #10125
2016-06-26 16:53:00 +02:00
Georg Baum
deaaf9bfe2 remove unused declaration 2016-06-25 20:32:07 +02:00
Richard Heck
dafb1c5bb6 Fix for previous commit: We come right back through here from
exportBufferAs, so we need to make sure we haven't been given
an export location.
2016-06-25 00:38:27 -04:00
Scott Kostyshak
459a9d1a8f Whitespace 2016-06-24 22:27:29 -04:00
Richard Heck
b6d182b81a Fix bug #8814: Ask for place to export a file if it has not
yet been saved.
2016-06-25 03:05:42 +01:00
Stephan Witt
4bc2877e8a Always present Qt version info in LyX About dialog - not for developer version only 2016-06-19 11:53:20 +02:00
Richard Heck
066cc0c9c0 Fix typo, and also check if string is null. 2016-06-18 18:33:45 -04:00
Richard Heck
68b60ec529 Be a bit more careful about setting and restoring the last reference
when we go to and return from labels.
2016-06-18 18:27:51 -04:00
Georg Baum
bf49ea32c2 Do not distribute built sources
Implementation stolen from ff17b366a0
2016-06-16 21:34:38 +02:00
Guillaume Munch
c76e0f1153 Make latex highlighter colors compatible with dark theme
Partial fix for #8325
2016-06-15 19:42:06 +01:00
Richard Heck
ff4005de68 Whitespace. 2016-06-15 00:23:53 +01:00
Richard Heck
0fa905ceab Replace coverity comment with assertion. 2016-06-14 18:26:08 +01:00
Guillaume Munch
325c476bcb ScrollbarParameters: clean-up and document
Position is always 0.
2016-06-13 08:46:15 +01:00
Guillaume Munch
0e3c8ba627 Fix computation of scroll value 2016-06-13 08:46:15 +01:00
Guillaume Munch
0be52d3710 ShortcutOverride again
Re: fix for #9218 (not #10119)

Now it matches the example given in the docs. This time tested on qt4.
2016-06-13 08:46:15 +01:00
Guillaume Munch
881b7ec673 Remove that pesky broken window that pops up with Qt5 when saving preferences
It turns out this show event is not necessary (tested with Qt4.8 and Qt5)
2016-06-12 19:17:33 +01:00
Guillaume Munch
6144bbfbf8 Replace foreach with for
C++11 allows foreach-style iterations with the following syntax:

for (auto & element : container) {
 ...
}
2016-06-12 19:17:33 +01:00
Richard Heck
f19d650752 Add comment about coverity #102061. 2016-06-12 00:22:09 -04:00
Richard Heck
7b15ea393f Add a check to please coverity.
Fixes #23496.
2016-06-12 00:12:03 -04:00
Richard Heck
6675601147 Fix a number of other uninitialized members.
Fixes coverity #23392, 23394, 23397, 23403, 23414, 23424,
23448, 23477.
2016-06-11 23:59:55 -04:00
Richard Heck
d29732e138 Initialize a bunch of uninitialized members. It does not seem to
matter what they are initialized to. Fixes coverity #23391.
2016-06-11 23:39:43 -04:00
Richard Heck
1bd5ef9a75 Add some comments to fix coverity #23386. 2016-06-11 23:26:02 -04:00
Richard Heck
a637efca6e Add comment fixing coverity #23351. 2016-06-11 23:09:30 -04:00
Richard Heck
fd42194c7e Add comment to fix coverity #23308 2016-06-11 23:09:30 -04:00
Richard Heck
2cb6ed9376 Make sure we have a buffer in VC_COMPARE.
Fixes coverity #23304.
2016-06-11 23:09:30 -04:00
Richard Heck
edefef17b5 Add comment for coverity, fixing #23307. 2016-06-11 23:09:30 -04:00
Guillaume Munch
ab41c1d1ac Fix bug #10119
This makes Qt 5.4 as usable as Qt 5.5.1 in my experience. Otherwise, fix again
INSTALL.
2016-06-11 05:42:43 +01:00
Richard Heck
9d5ffa8e75 Restore last selected label when using the "go to label" feature
of the reference dialog.
2016-06-10 18:19:46 -04:00
Guillaume Munch
973618e1c1 Missing headers
Found by Jean-Marc
2016-06-09 19:16:44 +01:00
Jean-Marc Lasgouttes
725c66d20c Initialize GuiDocument:biblioChanged_ in constructor
Found by Coverity
2016-06-09 17:38:30 +02:00
Jean-Marc Lasgouttes
bad511f3fe Initialize correctly GuiErrorList::from_master_ in constructor
Found by Coverity
2016-06-09 16:58:13 +02:00
Jean-Marc Lasgouttes
e3d74ee935 Initialize GuiSendto::format_ in constructor
Found by Coverity.
2016-06-09 16:44:56 +02:00
Jean-Marc Lasgouttes
c056062d59 Initialize some GuiTabular members in constructor
Found by Coverity.
2016-06-09 16:38:32 +02:00
Guillaume Munch
b032e2dfaf Replace support/shared_ptr.h and boost::shared_ptr with std::shared_ptr
shared_ptrs now only require the <memory> header.
2016-06-09 15:21:39 +01:00
Guillaume Munch
557975a8de Replace auto_ptr with unique_ptr
This is a mechanical replacement. For now it seems that unique_ptrs are
essentially used for exception-safety. More could certainly be done to clarify
pointer ownership in general.
2016-06-09 15:21:39 +01:00
Georg Baum
273c67d8aa Require a C++11 compiler
As discussed on the list. If no C++11 compiler is found configuration stops
with an error. There are now unneeded parts of boost, the will be removed in
a second commit.
2016-06-07 20:34:52 +02:00
Georg Baum
6bd5263405 Work around limited SVG support (bug #9778)
Qt only supports SVG 1.2 tiny, so we prefer to convert on our own if an
explicit converter is defined and the converter cache is used (otherwise
the conversion would be too expensive).
2016-06-04 09:09:33 +02:00
Pavel Sanda
48c4763b86 typo 2016-06-03 11:19:02 -07:00
Pavel Sanda
ba2b86fa5d Introduce basic support for microtype.sty.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg192743.html
2016-06-02 22:48:58 -07:00
Georg Baum
8d255ced2a Do not duplicate jpg format
Some qt versions report both "jpeg" and "jpg" as loadable file extensions.
In this case the jpg format was added twice previously. This does not happen
anymore with the new code, and it works as well if only "jpg" or only "jpeg"
is reported.
2016-06-02 22:31:27 +02:00
Uwe Stöhr
b540bc1c42 ErrorListUi.ui: correct an expression 2016-05-31 23:15:07 +02:00
Jean-Marc Lasgouttes
51ee267c6e Allow automatic text direction in Painter::text()
It is wrong to assume that direction is left-to-right when no indication exist.

Add a new enum with values LtR, RtL and Auto to be used as argument of
the private text() methods. When direction is Auto, let Qt decide how
the string shall be layed out.

Fixes bug #10169.
2016-05-31 11:52:30 +02:00
Guillaume Munch
1cc14a31ca TocWidget: fix an erroneous collapse and optimise updates based on profiling
TocModels::reset() in GuiView::structureChanged() collapses the TocWidget, and
therefore requires an update right after, which was missing.

In fact, profiling TocWidget::updateView() shows that delaying the update is
good only for fast keypresses (essentially movement). It costs 5% of a
char-forward operation in a document with approx. 100 table of contents
items. The update optimisation has been rewritten to take this data into
account.
2016-05-31 00:14:13 +01:00
Guillaume Munch
78a5c87781 TocWidget: fix part of #9825 2016-05-31 00:14:13 +01:00
Guillaume Munch
6a662cbb27 TocModel: clean-up 2016-05-31 00:14:13 +01:00
Guillaume Munch
6aceb3558a GuiDelimiters: display at least (and at most?) 4 columns 2016-05-31 00:14:13 +01:00
Guillaume Munch
ef8b8ebcfd GuiDelimiter: Synchronise the vertical scrollbars 2016-05-31 00:14:13 +01:00
Guillaume Munch
8aaa79cfb6 ShortcutPrefs: hide empty lfuns for which there is already a binding 2016-05-31 00:14:13 +01:00
Guillaume Munch
b53d07897b ShortcutPrefs: clean-up 2016-05-31 00:14:13 +01:00
Guillaume Munch
2b6d0ae3de Show names of debug modes in the debug panel
Sometimes it's hard to know which is which from a translation of the description
alone.
2016-05-31 00:14:13 +01:00
Jean-Marc Lasgouttes
598f7e4a45 Cleanup Painter text() API
* remove optional arguments to the helpers that use a FontInfo
* add a textwidth argument to the text() methods that are used by rowpainter.

Now textwidth is only computed if a null value was passed to the
text() method. This means that in the use case of rowpainter, no
textwidth needs to be computed.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
333f6fcf07 Make the different Painter::text void methods
The textwidth value that was returned is not used anymore. Now in some
cases we can avoid to compute it at all.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
516d5d29dc Fix drawing of buttonText (enforce same left/right spacing)
The computation of the width of the button was wrong. If <--> stands for TEXT_TO_INSET_OFFSET/2 spacing, and if `[]' marks the button's limits, then the intent is
  <-->[<-->button text<-->]<-->

Therefore the physical grey rectangle width is
   width - Inset::TEXT_TO_INSET_OFFSET

With this change, the spacing on the right of the button is not larger than the  left one.

Fixes bug #10147.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
019fceda3f Remove variables set but not used
This was found by cppcheck.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
83d8e12cc1 Rename Cursor::setSelection(bool) to selection(bool)
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.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
5739433feb FindAndReplace: reorder includes 2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
68a1f9a44e Do not use of boost::tokenizer
It is easier to use instead getVectorFromString for the use we have of this tokenizer. The two places are environment.cpp (path stuff) and qt_helpers (file fileters). The new code is much shorter.

This allow to remove boost/tokenizer.hpp and friends from our boost tree.
2016-05-29 17:55:45 -04:00
Guillaume Munch
4002c6af72 fix #9826: Outline disclosure of subsection content disappears one second after
doubleclicking content item.

This is only meant as a workaround. See #6675 for more general issues regarding
unwanted collapse of the tree view.
2016-05-29 17:55:44 -04:00
Georg Baum
cfa0eea4b9 Fix compiler warnings 2016-05-29 17:55:44 -04:00
Stephan Witt
d5fb80ed87 Remove special code for Qt5 to manage HiDPI. It's not needed anymore and leads to strange icon scaling problems in mixed resolution environment.
For reference see the screen shots in bug tracker ticket #10114.
2016-05-29 17:55:43 -04:00
Guillaume Munch
ee18af67cd Show review toolbar when outputting changes
"Output changes" alters the preamble even in the absence of tracked
changes. Therefore, not being able to notice when it is activated can possibly
yield hard-to-debug compilation failures.
2016-05-29 17:55:43 -04:00
Georg Baum
08afc52c4c Configure included iconv with autotools
The included iconv should not be used on Linux or OS X, but (depending on
local configuration) it might be needed for crosscompiling a mingw target
from Linux. Now the user can choose whether to use the included iconv or not.
cmake does already support that.

eilseq.m4 was taken from the original libiconv 1.14 package.
2016-05-29 17:55:43 -04:00
Georg Baum
78e17b1579 Configure included zlib with autotools
The included zlib should not be used on Linux or OS X, but (depending on
local configuration) it might be needed for crosscompiling a mingw target
from Linux. Now the user can choose whether to use the included zlib or not.
cmake does already support that.

zconf.h.in was taken from the original zlib 1.2.8 package. The generation of
zconf.h was made equivalent to the one generated by cmake.
2016-05-29 17:55:43 -04:00
Guillaume Munch
4154e088b0 GuiChanges: provide feedback when there are no more changes
Remove FIXMEs: date and time localisation
2016-05-29 17:55:42 -04:00
Guillaume Munch
6d4e6aad24 Automatically show the review toolbar if the document has tracked changes
(#8738)

For efficiency, we add a new flag to the buffer indicating when changes are
present. This flag is updated at each buffer update, and also when explicitly
requested via a dispatch result flag.
2016-05-29 17:55:42 -04:00
Guillaume Munch
27607b76f5 TocWidget: clean-up the timer logic
The timer logic introduced to solve bug #7138 was not entirely reliable; in
particular it resulted in spurious updates (noticeable by the treeview
collapsing just after one opens a branch, in particular).

This commit cleans up the timer logic. I followed the original design decision
of having an immediate update followed by a delayed update. Now the updates are
appropriately compressed and done after a delay of 2s (as can be noticed with
the treeview still collapsing, unfortunately, but after a more predictable
delay...).
2016-05-29 17:55:42 -04:00
Guillaume Munch
2f9d323396 TocWidget: Fix perf regression
4d1ad336 fixed #9754 but caused perf issues by cancelling the gains of having a
timer (introduced after #7138). This introduces in GuiToc::enableView() a
lightweight check of whether the widget should be updated. The logic is inspired
from GuiViewSource::enableView().
2016-05-29 17:55:42 -04:00
Guillaume Munch
0e740018ff Whitespace 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Guillaume Munch
0c3643ada9 Set the preamble in fixed-width font and without line breaks (#9966) 2016-02-18 17:19:38 +00: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
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
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
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
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
Uwe Stöhr
2f98d3902c ViewSourceUi.ui: fix bug #4430 2016-01-21 23:01:10 +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
Guillaume Munch
b529a2ffe5 Amend fd4d23b4
http://mid.gmane.org/3790287.D9aVANvQPJ@linux-22mz
2016-01-12 21:25:34 +00: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
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
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
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
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
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
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
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
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
c01a533acc Whitespace. 2015-11-29 11:25:08 -05:00
Richard Heck
b4abecd99b Remove some gui remnants of print support. 2015-11-26 23:21:07 -05: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
Scott Kostyshak
82ef95043d Add comment 2015-11-23 22:14:14 -05: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
Guillaume Munch
dbce5cafcc Rewrite regexes in ECMAScript style (bug #9799) 2015-11-18 01:52:50 +00: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
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
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
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
Scott Kostyshak
358745d0e3 Revert "Update previews on preference change (#9507)"
The referenced commit lead to performance issues and possibly
crashes in some cases when saving preferences. Thanks to Guillaume
for discovering the issues. See #9828 for more discussion.

I hope to come up with a better fix for #9507.

This reverts commit 390ae05444.
2015-11-11 18:06:07 -05:00
Georg Baum
2fc430d5ae Store both sets of font selections
This is one part of bug 9744: If you toggle between TeX fonts and non-TeX
fonts, the settings of the other choice are no longer thrown away, but stored
and re-activated if you switch back. Most parts of the patch are purely
mechanical (duplicating some BufferParams members), the only non-mechanical
change is in the GUI logic.
2015-11-09 07:36:42 +01:00
Guillaume Munch
a0783e1527 Amend f441590c 2015-11-03 15:27:25 +00:00
Guillaume Munch
21eea1e77a Capitalization 2015-11-03 03:54:52 +00:00
Guillaume Munch
f441590c8e Add "Open Containing Directory" button to the log dialog (#9211, #9834)
It takes the place of the "Copy to Clipboard" button which was redundant.
2015-11-03 03:54:52 +00:00
Jean-Marc Lasgouttes
5e0e676530 Disable setting vertical lines when using a formal table
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
2015-11-02 15:58:40 +01:00
Stephan Witt
2a3b54d57b For Mac OS: Additional check for Control and Meta modifier swap state.
Starting with Qt 5 the modifiers aren't reported correctly for disabled swap.
Until this is fixed it is corrected by reverting the modifier mask to check for.
2015-10-24 21:08:10 +02:00
Georg Baum
d5ed835225 Revert the box alignment part of 8010b90c
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").
2015-10-23 22:08:38 +02:00
Jean-Marc Lasgouttes
1e075bdf55 Fix drawing with pixmap cache
The culprit was that the computation of textwidth did not take wordspacing in account.

Also fictor the code so that the pixmap path can use the special RTL handling.

It is not clear however that the handling of left and right bearing works correctly.
2015-10-19 16:38:05 +02:00
Guillaume Munch
73d3816e0f Improve the TexRow Cursor->Row algorithm for selections.
Selections were incorrect after the addition of math due to the invalidation of
an invariant.
2015-10-19 06:55:18 +01:00
Guillaume Munch
789745df7a TexRow info in source panel and gotoCursor() for debugging
These features are active in DEVEL_VERSION when Debug is set to LATEX.

1. The TexRow information is prepended to the source panel.

2. Clicking on any line in the source triggers reverse search. (This would be an
interesting feature to implement on the user side, but we need a proper LFUN.)
2015-10-19 06:55:17 +01:00
Stephan Witt
b6b263b9fc Correct early return position for if use_pixmap_cache_ check 2015-10-12 08:00:24 +02:00
Georg Baum
34bfad7f64 Remove C-style casts found by cppcheck 2015-10-10 21:44:08 +02:00
Georg Baum
d3b5260f45 Remove unused variables
Found by cppcheck: (style) Unused variable: x
2015-10-10 21:28:28 +02:00
Georg Baum
adfeb9637f Fix copy-paste leftover
Found by cppcheck: (style) Same expression on both sides of '&&'.
I deduced the correct if-condition from the other places where theLaTeXFonts()
is called.
2015-10-10 21:15:55 +02:00
Georg Baum
8a047a4112 Add missing intializations
These were found by cppcheck:
Member variable 'x' is not initialized in the constructor.
The crash #9788 would not have happened if this had been done earlier.
2015-10-10 21:04:28 +02:00
Stephan Witt
77cc2c7c8c Fix "dead store" warnings of Xcode analyze tool 2015-10-09 08:16:23 +02:00
Georg Baum
c3cdd9aea7 Fix cppcheck portability warning
(portability) Assigning a pointer to an integer is not portable.
2015-10-08 20:25:11 +02:00
Guillaume Munch
68be651e89 Add TOC of external materials. (#7790, partial)
Known issues (non-regressions):

* The TOC is not updated immediately after an external material inset is
  inserted. See TocBackend::updateItem().
2015-10-05 21:16:16 +01:00
Guillaume Munch
bb344452c8 Consistency of ellipses across the UI
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.
2015-10-05 21:16:16 +01:00
Guillaume Munch
39343d65af Fix compilation with MSVC in c++98 mode 2015-10-01 21:51:08 +01:00
Guillaume Munch
afed7d06fa Improvements to cursor highlighting in the source panel
* TexRow now computes rows from a DocIterator. In practice, the cursor
  highlighting is now correct inside insets, it is no longer restricted to the
  topmost level. It certainly also makes forward-search more precise.

* Added the option to disable a texrow when not needed, for perf.

* Fixed a bug where the last paragraph was not properly highlighted.

Limitations:

* TexRow still does not handle: math (e.g. multi-cell), sub-captions, inset
  arguments.
2015-10-01 21:51:08 +01:00
Guillaume Munch
d5a5fbb8ee Enhancements and bugfixes to the TOCs
* 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.
2015-10-01 21:44:22 +01:00
Jean-Marc Lasgouttes
b7909e7e6c Remove support for precompiled headers for autotools
This was turned off by default for a long time, and it does not seem
to have any use these days.
2015-09-25 12:05:40 +02:00
Georg Baum
b24664b0ac Remove unused variables found by cppcheck
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.
2015-09-20 21:39:59 +02:00
Georg Baum
1ad4d9e657 Forbid wrong compiler generated copy constructors
This fixes cppcheck warnings (style) 'class x' does not have a copy constructor
which is recommended since the class contains a pointer to allocated memory.
2015-09-20 19:43:06 +02:00
Richard Heck
720d8ae58e Add comment regarding fall through.
Coverity issue #111940.
2015-09-20 12:34:49 -04:00
Georg Baum
b6aed54c45 Fix cppcheck variable scope warnings
These were all flagged by "(style) The scope of the variable 'x' can be reduced."
Narowing the scope improves readability, and if it is in a loop then the
compiler will be clever enough to produce efficient code, we do not need
manual optimization for POD types.
2015-09-20 10:42:35 +02:00
Guillaume Munch
9b7ccbfc80 New class InsetCaptionable
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)
2015-09-15 15:25:33 +01:00
Guillaume Munch
94e992c5ed Better construction of the TOC for floats and captions
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
2015-09-15 15:25:33 +01:00
Guillaume Munch
c02f6bd8a7 Do not show subfigures in the menu (bug #9759)
* More consistent behavour (no 30 elements limit)
* Subfloats are given depth 1
* Only show depth 0
* Always show "Open outliner..."
2015-09-15 15:25:32 +01:00
Georg Baum
699a6db9fa Add some missing member variable initializations
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.
2015-09-13 19:47:21 +02:00
Guillaume Munch
fd7b13f5ae Improvements to the display of the source.
Fix bugs #6501 and #7359.

* Selection highlighting has been broken since a conflict with
  reverse-search was repaired (at 00a62b7c), is now fixed.

* The selection highlighting was not accurate, for LaTeX formats (in
  full source view), and meaningless, for non LaTeX formats.

* fix regression at cc00b9aa: force_getcontent_ was always true
  therefore the code to detect changes in the generated source was
  dead. The consequence is that the source view would jump to the
  beginning at each updateView() even if no change occurred. Cc00b9aa
  was meant to fix #5600, which I cannot reproduce with the new
  implementation.

* Various improvements:
  *  When the position-to-line conversion is unavailable (LyXHTML, LyX
     source, etc.) we focus on the first difference instead.
  *  Get some space around the cursor
  *  Respect the scrollbars
  *  Highlight with QTextEdit::ExtraSelections instead of cursor
     selection (the latter used to break syntax highlighting of the
     TeX code... which was not so much of an issue before because the
     wrong part was selected)

Known issues:
  * The highlighting is off by one line in very last paragraph of a
    document. This appears to be a bug in TexRow.cpp.
  * The highlighting is off for any kind of inset. This could be
    solved by adapting TexRow so that it accepts CursorSlices as
    and argument for the conversion to line number. (this is bug
    #4725)
2015-09-13 00:45:52 +01:00
Guillaume Munch
120c99ae60 Better session management for the source panel.
We now remember the previous GUI values across sessions.
2015-09-13 00:45:47 +01:00
Guillaume Munch
ba3e6cb2d2 Improve the performance of the source panel by using a QTimer.
Fix bug #9493. The source panel was very slow with auto-update on. Now
we use a timer that ensures that the source is generated only at
rest. The delay is short or long depending on whether we show the
source of a paragraph or the whole source.
2015-09-13 00:45:41 +01:00
Guillaume Munch
4d1ad336db Fix bug #9754
Don't delay the update of the TOC panel on switching documents
2015-09-13 00:45:22 +01:00
Jean-Marc Lasgouttes
cdeb425451 Initialize pointer members
Coverity issue 23387
2015-09-12 22:39:50 +02:00
Jean-Marc
915066f068 Add missing break statement
Coverity issue 23338
2015-09-12 20:02:32 +02:00
Jean-Marc
4e4b2e224e Add missing breaks
Coveity issues 23333, 23334 and 23348.
2015-09-12 19:58:15 +02:00
Jean-Marc
d786d98c36 Remove useless test
Coverity issue 23300.
2015-09-12 19:53:29 +02:00
Jean-Marc
92d5e7c11b Do not pass objects by value
Coverity issue 23372.
2015-09-12 19:22:51 +02:00
Jean-Marc
61f0271031 Add missing braces
Coverity issue 23506.
2015-09-12 18:40:52 +02:00
Jean-Marc Lasgouttes
cf6128caf6 Use QFontMetrics information for underlines (and friends) width and position
The width of the line is now dependent on the font size.

This new computation is applied to: underline, strikeout, double underline.
2015-09-08 10:44:03 +02:00
Guillaume Munch
d88e401589 Fix compilation with qt5 and c++11 combined. 2015-08-24 21:05:48 +02:00
Juergen Spitzmueller
7b1107d7f5 Decrease height of citation dialog by using a QToolBox
Fixes: #9618
2015-07-30 10:09:21 +02:00
Enrico Forestieri
0c093a6264 Fix bug #9684: Update previews after background color change 2015-07-22 00:56:34 +02:00
Jean-Marc
b63421b7dc Merge branch 'rowpainter2' 2015-07-21 23:47:12 +02:00
Jean-Marc Lasgouttes
b68f391232 Re-implement text justification
* GuiFontMetrics::pos2x, x2pos: add support for inter-word spacing.
* GuiPainter::text: idem

* Row::Element::countSeparators:
  Row::countSeparators: new methods that count spaces in strings.
  Row::setSeparatorExtraWidth: new method (code lifted from TextMetrics.cpp).

* TextMetrics::computeRowMetrics: rely on the above methods.

* RowPainter::paintMispelledMarked: pass only a Row::Element object reference
  RowPainter::paintStringAndSel: idem; do not rely on values returned by
      Painter::text (trailing spaces do not honor wordspacing value).
2015-07-20 23:43:05 +02:00
Jean-Marc Lasgouttes
f65f3adbf7 Do not break row elements at spaces
The goal of this commit is to make painting faster by reducing the
number of strings to paint. To this end, it is necessary to include
spaces in row elements.

Also importantly, this commit should fix existing problems with line
breaking in chinese text.

* TextMetrics::breakRow: do not do anything special for word separators.

* Row::add: when adding a character to a row element, keep the string
  width updated. If need be, it is possible to tweak this by updating
  every 10 characters, for example.

* GuiFontMetrics::breakAt (new): use QTextLayout to break text either
  at word boundary or at an arbitrary width.

* Row::Element::breakAt: use the above method.

* Row::shortenIfNeeded: simplify now that because there is no need for
  handling separator elements. This will be taken care of by the
  improved breakAt.

Two things remain to be done:

* remove all traces of separator row element

* re-implement text justification.
2015-07-20 21:22:53 +02:00
Georg Baum
dc6d201f8f Store InsetGraphics bounding box in parsed form
This is like InsetExternal does it, avoids some string parsing, reduces the
amount of code and makes it more robust.
2015-07-18 17:02:54 +02:00
Georg Baum
bf515425e1 Remove relative units from bounding box
When adding units to the external inset bounding box I overlooked that
InsetGraphics supports only bb, cm, mm and in. Therefore I added too many
units for the external insets. We are not as strict as the graphics inset
and allow all absolute units, but no relative ones.
2015-07-18 16:41:52 +02:00
Georg Baum
eaf70913ac LengthCombo does not depend on VSpace
so use the right include
2015-07-18 16:29:04 +02:00
Georg Baum
39c1fcb864 Devirtualize some methods
These do not need to be virtual, since no class inherits from LengthCombo.h,
and they do not exist in the base class either.
2015-07-18 16:23:24 +02:00
Georg Baum
81e592603d Support units in external inset bbox
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.
2015-07-16 22:06:35 +02:00
Georg Baum
0cbcc8a166 Remove InsetGraphics noUnzip parameter
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
2015-07-16 20:44:47 +02:00
Jean-Marc Lasgouttes
f51d7fdd2a Compilation fix for windows
Since commit 7ac70092, lyx::dispatch returns a DispatchResult const &,
which is ignored in the cases below. Nevertheless, the windows
compiler complains that it does not know this type. Gcc and clang can
deal with it without problem.
2015-07-16 09:48:57 +02:00
Jean-Marc Lasgouttes
7ac700920f Auto feature for minibuffer toolbar
Now the minibuffer toolbar is "auto" by default. It is opened by
command-execute (M-x) and closed when the command is executed without error.

* make lyx::dispatch return a DispatchResult struct

* there is a new MINIBUFFER type of toolbar, that can be used for this use.

* remove special handling of M-x in minnibuffer; Escape can be used instead. Fix focus in this case.

* when minibuffer toolbar is "auto", make the toolbar close itself after
  - a command has been executed without error
  - an empty command has been executed
  - the Escape key has been used

[this is actually commit fdcff02a, which was later reverted at dd61d8cf]
2015-07-15 17:41:09 +02:00
Jean-Marc Lasgouttes
a05b8be4bf Always use unicode override characters to enforce direction
There is a second solution in the code which uses some undocumented Qt
stuff, but it does not work in some cases. The best is to rely on the
documented way.
2015-07-14 23:19:26 +02:00
Jean-Marc Lasgouttes
463bd17d75 Use integer line thickness in painter
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.
2015-07-14 17:42:45 +02:00
Jean-Marc Lasgouttes
f41e423b30 Small clean-up to debug support 2015-07-08 11:03:42 +02:00
Stephan Witt
8a772549d7 Fix for #9659 - Qt may send more then one close event to a window. Therefore multiple calls to unregisterView for a GuiView are possible. The first one removes the view from the list of known views, subsequent calls do nothing. 2015-07-04 18:59:29 +02:00
Scott Kostyshak
0d52736061 Remove an incorrect horizontal size policy
This effectively makes the horizontal size policy "minimum", which
makes it clear that there is no advantage for this widget of
increasing the horizontal size past the minimum, allowing other
GUI elements to use the horizontal space if useful.

This change for caseCB is consistent with wordsCB and searchbackCB.
2015-07-02 10:33:38 -04:00
Jean-Marc Lasgouttes
dd61d8cf3f Revert "Auto feature for minibuffer toolbar"
This reverts commit fdcff02a31.

This was pushed too early, we are not ready yet.
2015-06-30 11:09:48 +02:00
Jean-Marc Lasgouttes
fdcff02a31 Auto feature for minibuffer toolbar
Now the minibuffer toolbar is "auto" by default. It is opened by
command-execute (M-x) and closed when the command is executed without error.

* make lyx::dispatch return a DispatchResult struct

* there is a new MINIBUFFER type of toolbar, that can be used for this use.

* remove special handling of M-x in minnibuffer; Escape can be used instead. Fix focus in this case.

* when minibuffer toolbar is "auto", make the toolbar close itself after
  - a command has been executed without error
  - an empty command has been executed
  - the Escape key has been used
2015-06-29 09:21:15 +02:00
Scott Kostyshak
6c3a6ea9bd Give Advanced Find a minimum size
The horizontal size policy is now set to "MinimumExpanding", which
means that sizeHint() is enforced as a minimum, but that the widget
can make use of extra available space.

Before, the size policy was ignored, and often resulted in a
scrunched pane that had to have its size manually increased.
2015-06-28 05:16:49 -04:00
Scott Kostyshak
8f1b7f47fa FindAndReplaceUi: update format 2015-06-28 05:16:14 -04:00
Juergen Spitzmueller
2a8db0a64b HSpace/VSpace: use a _signed_ length validator in the dialogs. 2015-06-26 13:19:12 +02:00
Scott Kostyshak
5e7cbc8f2c Fix setting of pref "hide scrollbar in fullscreen"
The symptom of the bug is that the preference could be incorrectly
displayed (based on the value of the statusbar preference).

This seems to have been a copy/paste mistake introduced in 214f7ed2.
2015-06-25 08:33:11 -04:00
Jean-Marc Lasgouttes
8b36c090b7 Simplify the code for "auto" toolbars handling
Instaead of passing a number of booleans, it make more sense to pass
the relevant visibility values in a single flag.
2015-06-18 15:51:53 +02:00
Juergen Spitzmueller
f0923ebadc GuiParagraph: Fix remaining glitch when entering custom line spread
while immediate apply is activated.
2015-06-13 12:31:03 +02:00
Juergen Spitzmueller
930fef9d8d GuiParagraph: fix thinko (bug #9621) 2015-06-13 12:17:11 +02:00
Jessica Hamilton
7cd2e55d1f Qt4: Prevent crash on Haiku when clicking in a document
Fixes bug #8595.
2015-06-11 18:12:35 +02:00
Juergen Spitzmueller
664ef2c459 Report missing characters on conversion with XeTeX or LuaTeX (bug #9610)
As discussed on trac, we treat this as error, since it severely
corrupts the output (dataloss).
2015-06-11 11:32:17 +02:00
Juergen Spitzmueller
7cce590390 GuiIndices: Improve widget disabling and account for read only status
(bug #9593)
2015-06-03 16:54:54 +02:00
Jean-Marc Lasgouttes
25913aaac6 When the document language is changed, update cursor language too
Actually, the change is done only if the cursor language was the
document language already.

This fixes an trivial but annoying problem: create a new file (in
English), change language to your favourite language, then start to
write. Before this fix, the words come out in English, which does not
make sense.

Fixes bug #9586.
2015-06-03 12:19:07 +02:00
Enrico Forestieri
bb4bef8994 Extend the fix for #5760 to the cygwin xcb backend. 2015-05-30 17:25:36 +02:00
Juergen Spitzmueller
abefdcaf30 Add comment 2015-05-28 13:34:58 +02:00
Stephan Witt
c25e8c50a7 #9574 check for valid focus (see ticket #1720) does not work on Linux and Windows 2015-05-28 13:27:59 +02:00
Stephan Witt
31ebb84486 improved positioning of version text in banner image 2015-05-28 08:01:58 +02:00
Richard Heck
3c2b3e6907 Remove printing support from LyX.
This was bug #6747.
2015-05-27 18:13:08 -04:00
Juergen Spitzmueller
5353172793 If there is an inset at cursor, connect the dialog with that, not the containing one
Fixes: #8716 ("minipage within minipage" Settings bug)

This is a potential candidate for branch, but only after some more testing.
2015-05-26 19:33:07 +02:00
Juergen Spitzmueller
5ceb82d4e4 GuiAbout: Detect and provide links to trac
Text in the form "bug #1234" is transformed to a link that points
to the respective trac entry.
2015-05-24 14:51:47 +02:00
Enrico Forestieri
260a98d295 Save the document directory path only if explicitly allowed.
A new preference is introduced for allowing the record of the document
directory path in the saved file. Without explicit consent, it is not saved.
If the origin tag contains an invalid/wrong path or garbage, LyX behaves
exactly as before, i.e., included files are simply not found.
2015-05-23 17:49:33 +02:00
Stephan Witt
89469a9e55 fix whitespace issue 2015-05-22 22:04:19 +02:00
Stephan Witt
43dd383073 avoid float-conversion warning and simplify size computation 2015-05-22 22:00:22 +02:00
Juergen Spitzmueller
47dd9189eb Add more Float tags to allow to disable wide and sideways feature
Fixes: #9557, #9558

This is amended to yesterday's layout format change.
2015-05-22 18:59:17 +02:00
Jean-Marc Lasgouttes
7760c5ccf2 Create proper undo groups for advanced find and replace
Create new helper class UndoGroupHelper, which simplifies a lot the
handling of undo groups in cases like this one. The class tracks open
undo buffers and allows to switch buffers transparently.

Using the class for advanced search and replace is trivial. THe class
may be useful in some other classes.

Fixes ticket #8658
2015-05-22 16:42:10 +02:00
Juergen Spitzmueller
1d266c8cfa Indicate read-only status in tabs (#6783) 2015-05-22 10:41:12 +02:00
Juergen Spitzmueller
7dc123b790 Add Float tag to determine allowed positioning options (#7752) 2015-05-22 10:37:14 +02:00
Jean-Marc Lasgouttes
88609b3984 Improve list of available languages for UI l10n.
Add a new tag HasGuiSupport to language file. Add it for all l10ns
that we currently ship. The po files that are unused are not currently
tagged as available, but this could be done, since the code later
checks that the translation is actually there.

This new information is used in GuiPrefs when populating the language
combox.

The new scheme implies that adding a new language is now a two-step
process:
* the language code has to be added to po/LINGUAS, as before;
* one of the entries of the lib/language file has to be selected as
  reference and be given the "HasGuiSupport true" property.
2015-05-21 10:48:38 +02:00
Juergen Spitzmueller
9e16608867 Fix problems with immediate apply and length validators
Fixes bugs #7022 and #7599.
2015-05-20 19:13:12 +02:00
Juergen Spitzmueller
8b86af7298 Fix LaTeX length export of big numbers, part 2 (bug #9416)
LaTeX lengths must not use scientific notation, since the + sign has a
different meaning (glue lengths). This is the GUI part of bug 9416,
on top of part 1 [59e4d16ab/lyxgit].
2015-05-20 09:35:57 +02:00
Stephan Witt
2ac45cc4d2 #9130 Text in main work area isn't rendered with high resolution
Try SVG version of banner with Qt4 too.
2015-05-20 08:46:26 +02:00
Stephan Witt
d392df30c0 #9130 Text in main work area isn't rendered with high resolution
Correctly guard Qt5 code introduced by change c053a9394d
2015-05-20 07:52:30 +02:00
Stephan Witt
c053a9394d #9130 Text in main work area isn't rendered with high resolution
Improved icon and pixmap handling with SVG images and high physical resolution displays.
This results in much better looking icons and splash banner.
2015-05-19 22:46:26 +02:00