Commit Graph

23510 Commits

Author SHA1 Message Date
Richard Heck
0c1dd609f3 Debugging code. 2016-08-04 22:00:24 -04:00
Richard Heck
0a603c5d0e We don't need to crash here, but can try to continue in release
mode.
2016-08-04 22:00:18 -04:00
Richard Heck
f15c4159aa Special characters should be output to the TOC. 2016-08-04 21:09:32 -04:00
Richard Heck
8d65a6d277 Fix bug #10320.
Layout::write needs to allow for the possility that the name of the
style may contain a space. It seems sufficient just always to quote it.
2016-08-04 17:45:40 -04:00
Jean-Marc Lasgouttes
63cf3297f8 Let InsetSpecialChar draw its background when necessary
This is the same fix as in 9940acc5 for auote inset and math macro template.
2016-08-04 23:21:33 +02:00
Guillaume Munch
0e672fed21 Partially revert "Replace static with thread_local when used for caching"
As noticed by Stephan, clang on Mac is nowhere near to support thread_local for
some reason:
http://stackoverflow.com/questions/28094794/why-does-apple-clang-disallow-c11-thread-local-when-official-clang-supports

It does not look realistic to me to provide a configure-based alternative. The
solution is to not use thread_local until it is reasonably supported on
Mac. According to sources, this means requiring Xcode >= 8.

This reverts commit 82d4f1a446 partially.
2016-08-04 13:39:27 +01:00
Juergen Spitzmueller
90f6eb01a4 Include all [scr]article styles in beamer article layouts.
File format change. On format reversion, we need to put some extra code
in the local layout that emulates the 2.3 behavior.
Simply Input'ing the respective layouts is unfortunately not enough,
due to the insertion order.

See #9977
2016-08-04 11:42:06 +02:00
Juergen Spitzmueller
b9b9ad3f9e Correct backends() allocation with japanese encoding
Fixes error introduced by ad9887da9c.
2016-08-04 10:01:06 +02:00
Scott Kostyshak
52ae8fb22b Activate LyX window after reverse search (#10196)
"lyxclient -g" now calls the just implemented lyx-activate (see
previous commit) after server-goto-file-row. This allows the PDF
viewer to switch to LyX after executing a reverse search.
2016-08-04 01:46:15 -04:00
Scott Kostyshak
60515b996b New LFUN lyx-activate to focus LyX window
On Linux and Mac OS, this action brings the LyX window into focus.
Such behavior is not allowed by Windows OS so instead the color of
the taskbar entry is changed to indicate that the window has changed
in some way.

The action is hidden in the shortcuts menu because it would make
sense to assign a shortcut to it. The only way to execute shortcut
would be if the LyX window is already activated.

lyx-activate will be used (see next commit) to allow the PDF viewer
to switch to LyX after executing a reverse search.
2016-08-04 01:46:13 -04:00
Guillaume Munch
096afc733b Fix embarrassing logic mistake
Thanks Richard for pointing at it.
2016-08-03 22:17:26 +01:00
Richard Heck
16d39b1f83 Fix problem noticed by Scott. 2016-08-02 18:54:31 -04:00
Richard Heck
f1b748e42b No need to display contents of the branch when it is open.
Thanks to Vincent for noticing.
2016-08-02 16:33:18 -04:00
Guillaume Munch
82d4f1a446 Replace static with thread_local when used for caching
thread_local is a per-thread static variable, so it is thread-safe and can be
used for caching purpose.

Remove the cache for parameter lists as discussed on the list
http://mid.gmane.org/6e871431-0e87-ed2a-3e31-b63356c2391e@lyx.org.

(requires gcc >= 4.8)
2016-08-01 23:44:16 +01:00
Guillaume Munch
0090af19d3 Fix aliasing logic for polylines 2016-08-01 20:50:46 +01:00
Guillaume Munch
a584c8176d Enable to specify the target format for converting the local layout
* New constant LYXFILE_LAYOUT_FORMAT in src/TextClass.cpp. This determines the
  layout format corresponding to the current lyx file format.

* The Local Layout pane is changed so that the "Convert" button does not convert
  to the internal layout format but to the current lyx file format, to make sure
  that the file does not become unreadable with a specified earlier version of
  LyX.

* If LYXFILE_LAYOUT_FORMAT == LAYOUT_FORMAT then LyX behaves as before. This is
  the value defined in master.
2016-07-31 18:34:33 +01:00
Guillaume Munch
0a8b7f6a57 Perf comments: getFormatFromFile slows LyX startup considerably
It is currently called on hundreds of files: settings, layouts, icons, cached
graphics files (incl. graphics from files that are not opened on startup).

According to callgrind, fixing the FIXME comments could speed up startup by more
than 30%.
2016-07-31 18:34:33 +01:00
Guillaume Munch
22d7ba6424 Use call_once to ensure something is only called once
This is thread-safe.
2016-07-31 18:34:33 +01:00
Guillaume Munch
46d8dfc6c2 Make static counters atomic
This ensures thread-safety

(requires: gcc >= 4.6, MSVC >= 2015)
2016-07-31 18:34:33 +01:00
Guillaume Munch
2fd2e65745 C++11 supports thread-safe initialization of statics
A static local variable is guaranteed to be initialized only once, and in time.

Lambda expressions can be used to perform complex initialization of those static
variables on the spot.

(starting from: gcc >= 4.8, msvc >= 2015)
2016-07-31 18:34:33 +01:00
Guillaume Munch
4d7b912ca1 Fix "scroll here" feature of scrollbar (#10311)
Prevent setRange() from causing a recursive call to scrollTo(). Reduces three
calls of scrollTo() to one call for all scrolling functions of the scroll bar
(e.g. clicking on the arrow, dragging, or clicking somewhere on the scrollbar).
2016-07-31 18:34:33 +01:00
Guillaume Munch
bc8eb059db Basic implementation of QSignalBlocker for qt4 2016-07-31 18:34:33 +01:00
Richard Heck
98feadd61e Fix output of floats, etc, inside environments.
Fixes bug #9094.
2016-07-31 03:18:32 -04:00
Richard Heck
9e5a42edbf Rename, for a little clarity. 2016-07-31 03:03:26 -04:00
Richard Heck
07dcb1c525 Add 'dir="auto"' to the body tag for XHTML export. This should take
care of much of what we need to do for RTL languages. It does not
take care of inline language changes, probably.
2016-07-31 02:52:30 -04:00
Richard Heck
6fe499509a Alignment 2016-07-31 02:49:38 -04:00
Richard Heck
ab3a49973f Fix display of code listings in XHTML.
Fixes bug #8362.
2016-07-31 01:47:30 -04:00
Richard Heck
daf7cd4c05 Activate export of external material for XHTML.
As of this commit, this is ineffective, since no changes have been
made to external_templates.
2016-07-31 01:26:15 -04:00
Richard Heck
6b97f2c075 Fix substitution for $$Contents.
The second argument here is the length of the string to replace,
not the position of the final character.
2016-07-31 00:15:48 -04:00
Richard Heck
93a612220e Fix preview of external material with plaintext and DocBook. 2016-07-30 23:48:27 -04:00
Richard Heck
47c52db13e Use scaling factor in XHTML output. 2016-07-30 21:57:52 -04:00
Richard Heck
e1f597e3da If we cannot find the input format for a graphic, we cannot convert it.
Also includes some minor code cleanup.
2016-07-30 21:51:25 -04:00
Richard Heck
e2fa3cb6ef Fix output of table borders for XHTML. Fixes bug #10154. 2016-07-30 20:15:12 -04:00
Richard Heck
eeb6b5b153 Revert most of dd7863b6.
I did not mean to commit the caption-related stuff.
2016-07-30 01:42:08 -04:00
Richard Heck
aad0802b53 Whitespace. 2016-07-30 01:35:22 -04:00
Richard Heck
dd7863b6ac Fix thinko from earlier commit.
We need to output the deferred material AFTER the paragraph is closed.
2016-07-30 01:29:06 -04:00
Richard Heck
60ce2b7570 Fix HTML display of math matrices. 2016-07-30 00:25:09 -04:00
Richard Heck
752c89ae13 Fix CSS for math cases.
Fixes bug #8755.
2016-07-30 00:15:47 -04:00
Richard Heck
50c1391950 Simplify CSS classes for floats.
Fixes bug #8605 and probably parts of #8755 and #9328.
2016-07-30 00:03:35 -04:00
Richard Heck
f1cd24243f Be more careful with braces, due to comments. 2016-07-29 23:59:24 -04:00
Richard Heck
76e6c77825 Simplify and unify code for special handling in argument insets. 2016-07-29 23:38:51 -04:00
Richard Heck
96a8156557 Fix display of colors in labels of arguments.
We need to handle this specially, just as we do the main font.
2016-07-29 23:36:48 -04:00
Richard Heck
cbbae06c9b Fix display of branch buttons and tooltips. 2016-07-29 22:58:03 -04:00
Scott Kostyshak
c659fd4f74 Remove the now unused lyx::support::expandPath()
The function is no longer used in LyX's sources (as of the previous
comit, 9b64d7bd) and is thus removed with this commit. Perhaps the
advantage this function had over other path functions we have has
disappeared over time (see e.g. 1a7b7f65).
2016-07-29 13:17:09 -04:00
Scott Kostyshak
9b64d7bd24 Rel. path in paths prefs preserved as rel. paths
Before this commit, in the paths preferences tab if you put a
relative path, LyX would convert it behind the scenes to an absolute
path by evaluating the relative path with respect to the working
directory of the LyX instance where the preference change is taking
place. This seems confusing because (1) it is done behind the scenes
(after the preferences dialog is closed) and (2) if the user chooses
to enter a relative path, the safest thing to do is to preserve it
as a relative path, instead of making the assumption that the user
intended for it to be expanded to an absolute path.

An explanation of how relative paths are handled is given at the
bottom of the paths tab. Note that the height/width of the
preferences window is not changed as a result of adding this
explanatory comment because the height of the preferences dialog is
already stretched by other tabs.

This commit improves consistency in the sense that the behavior of
LyX is now the same when a relative path is specified in the
preferences dialog as when it is manually specified in the
preferences file. Before, if the preferences file were manually
edited and a relative path were inserted, the next time the user
made a change to preferences with the GUI (even if the preference
change was a different preference, e.g. instant preview), the
relative path would be silently converted to an absolute path,
evaluated with respect to the working directory of that instance.

Beyond improving clarity and consistency (IMO), this commit allows
for a new feature to be implemented of using relative paths in the
paths preferences. For example, the user may now enter '.' as the
"Working directory" path and now whenever they start LyX from a
directory and create a new file, the default location of the file
will be the directory from which they started LyX, instead of the
user's home directory which is LyX's default and is less intuitive.

No prefs2prefs work is needed because if a relative path were
entered in the preferences dialog before this commit, it was
converted to an absolute path before being stored in preferences. If
a relative path were specified by manually editing the preferences
file, then (unless the path were already automatically converted to
an absolute path by a GUI preferences change, as described above)
the behavior will be the same (the path will be treated as a
relative path).

For related discussion, see the lyx-devel thread here:
https://www.mail-archive.com/search?l=mid&q=20160616003010.bnymtcouar7g55ti%40cotopaxi

This commit removes the last use of lyx::support::expandPath() in
LyX's sources.
2016-07-29 13:13:55 -04:00
Scott Kostyshak
60e8921349 Const a function parameter 2016-07-29 13:09:54 -04:00
Scott Kostyshak
badb0bb96c Improve implementation of TabWorkArea::posIsTab()
The Qt documentation states that tabAt() returns -1 if the position
is not over a tab. This behavior has been consistent since Qt 4.3
[1]. This commit's improvement likely makes the code faster in two
ways:

(1) we do not need to loop through potentially all tabs
(2) we only need to look up the tab index corresponding with one
position

posIsTab() is not currently used intensively so no practical gain in
speed is achieved, but it protects against future use.

[1] https://doc.qt.io/archives/4.3/qtabbar.html#tabAt
2016-07-29 13:09:48 -04:00
Scott Kostyshak
4803c7697b Close a tab on middle-click (#10288)
This is the default behavior of Chromium and Firefox. The main
appeal is that instead of having to precisely click on the 'x' to
close a tab, one can more easily middle-click anywhere in the tab.

The tab is closed if the middle button is pressed on a tab and is
relased on the same tab. After pressing, the user may move the mouse
over other tabs but as long as they move it back to the tab where
they initiated the press before they release, the close will
execute. This is how the feature works in Chromium and Firefox.

Nothing is done if the user middle-clicks on the blank part of the
tab bar. This is consistent with Chromium. Firefox, on the other
hand, opens a new tab. In LyX one can already double-click the blank
part to open a new tab, and in feedback from lyx-users [1] most
expected and desired that nothing be done in this case.

[1] https://www.mail-archive.com/search?l=mid&q=20160720063306.6fyarf3kywexbxvd%40steph
2016-07-21 22:31:29 -04:00
Scott Kostyshak
b236450e61 Factor out useful code into a function
This code will be shared by TabWorkArea::mouseReleaseEvent,
which will be implemented shortly.
2016-07-21 22:31:29 -04:00
Scott Kostyshak
07be240ebe Add comment that a code chunk is unnecessary
A chunk of code in an event handler seems to be unnecessary to me
because the event that the situation handles never makes it this far
in the event handling hierarchy. I'm not sure why this is, and thus
I'm not sure if this is true in all cases (e.g. Qt version) and if
it will be true in the future so I leave this code for now.
2016-07-21 22:31:29 -04:00
Jean-Marc Lasgouttes
71374b38c2 Recompute Paragraph::beginOfBody() earlier
In redoParagraph, this should be done before coping with the insets,
other wise some graphic gliches may occur. This is a better fix for

Fixes bug #10163.
2016-07-21 10:21:45 +02:00
Jean-Marc Lasgouttes
b9c7594167 Revert "Reset beginOfBody() when changing paragraph layout"
This reverts commit ef8e499821.
2016-07-21 10:15:39 +02:00
Jean-Marc Lasgouttes
ef8e499821 Reset beginOfBody() when changing paragraph layout
This looks like a trivial thing to do, and it avoids some drawing problems.

Fixes bug #10163.
2016-07-21 01:56:22 +02:00
Jean-Marc Lasgouttes
c73923c519 When painting only insets, paint also change and language marks
Fixes bug #8133.
2016-07-20 23:25:17 +02:00
Kornel Benko
64b2989020 Cmake build with Qt4: Link lyx executable also to X11 library
With the commit cb0c881 we reference XSendEvent in X11-lib
if qt uses X11.
For QT5, this library is pulled by Qt5X11Extras, but
for QT4 we have to add it too.

Spotted by Scott Kostyshak.
2016-07-20 02:10:23 +02:00
Jean-Marc Lasgouttes
9940acc506 Try to fix #4889 in the right way
For reference, the bug was that quote insets grew bolder because, when
painted over themselves, anti-aliasing made them darker.

It turned out that the fix there created others than were
painstakingly fixed: #7164, #7165, #7174, #7193... More recently, it
created other problems:
http://article.gmane.org/gmane.editors.lyx.devel/163471

We use the right fix here:
* draw background of quote inset when not doing full repaint
* draw background of math macro template when not doing full repaint
* remove hack that grew from #4889 fix.
2016-07-20 00:24:24 +02:00
Jean-Marc Lasgouttes
e35110eab7 Realize inset argument label font before using it 2016-07-19 22:29:57 +02:00
Scott Kostyshak
3826ff6434 Improve documentation of LFUN_BUFFER_ZOOM_{IN,OUT}
The default for ZOOM_OUT is -20 from a user perspective. That is,
the following are equivalent:

  buffer-zoom-out -20
  buffer-zoom-out

The reason for this is that the argument to ZOOM_OUT is treated the
exact same way as ZOOM_IN. The only way they differ is how the
default case is handled.

This commit also clarifies that (1) the argument may be positive or
negative and that (2) the argument is interpreted as percentage
points, not percent.
2016-07-19 02:11:27 -04:00
Richard Heck
b0963b1b60 Fix cut and paste error in last commit.
Also, we can just realize the font ourselves here.
2016-07-18 13:53:40 -04:00
Richard Heck
3203fb1c5f Do not crash is release mode if we stumble across an unrealized font. 2016-07-18 13:01:42 -04:00
Richard Heck
7575ad159b Revert "Do not crash is release mode if we stumble across an unrealized font."
This reverts commit c560e6b3a6.

I did not mean to comit the changes to the gmo files.
2016-07-18 12:59:32 -04:00
Richard Heck
c560e6b3a6 Do not crash is release mode if we stumble across an unrealized font. 2016-07-18 12:56:20 -04:00
Jean-Marc Lasgouttes
8884c4044d Add feedback in status bar when zooming
Moreover enforce better the lower limit of 10 and avoid overflow due
to unsigned int.

Fixes bug #10212.
2016-07-18 17:03:54 +02:00
Juergen Spitzmueller
858f6b6c7b Whitespace. 2016-07-18 16:28:12 +02:00
Jean-Marc Lasgouttes
d654c4782a Typo 2016-07-18 16:24:06 +02:00
Jean-Marc Lasgouttes
7e997c193e Remove obviously wrong documentation in Painter.h 2016-07-18 16:17:38 +02:00
Jean-Marc Lasgouttes
2306fca659 Some things did not need to be mutable after all 2016-07-18 14:34:08 +02:00
Jean-Marc Lasgouttes
097ab41c49 Remove mutable variable InsetTabular::offset_valign_
Introduce instead a function Tabular::offsetVAlignment() that does the
same thing.
2016-07-18 12:37:14 +02:00
Jean-Marc Lasgouttes
31120694d9 Get rid of InsetTabular::first_visible_cell_
The code that uses it has been commented out since 2004. It is time to
delete it.
2016-07-18 12:26:06 +02:00
Jean-Marc Lasgouttes
61188464b4 Simplify display of InsetQuote
The code that specializes for double elements in the display string
does not trigger anymore: displayString() returns a single unicode
value, plus some space for french guillemets.

Use a thin space for these french quotes instead of a plain space and
remove special case in metrics().
2016-07-18 12:17:01 +02:00
Richard Heck
fb84ccd9fb The way this was previously, it had to fail if the GUI language
was not English: We return the the abbreviated author "One and Two",
but translated to the GUI language; then we search that for " and "
in order to pull the authors apart again.

I've just replaced the distinct routines with a single one that handles
both cases, depending upon whether a Buffer is provided as one argument.
2016-07-17 22:50:17 -04:00
Richard Heck
d5633f17e5 Fix thinko that led 2-authors citations to be displayed with "et al." 2016-07-17 22:31:54 -04:00
Guillaume Munch
10f6eb2e7e LaTeX highlighter: make at a letter in the user preamble
Syntax highlighting now provides the appropriate cue that the user preamble is
inside \makeatletter…\makeatother.
2016-07-15 17:51:18 +01:00
Guillaume Munch
1f2d7f4db9 Better error message when try to bind a Hidden LFUN 2016-07-14 20:53:12 +01:00
Guillaume Munch
eb8c5905f6 Prioritize the shortcuts from the work areas
* Fix bug #10261 : KDE smartly adds conflicting accelerators.

* Prevent bugs like #9495 in the future.

Issues (non-regression):

* It does not appear possible to prevent Ubuntu's Unity from grabbing the
  accelerators for the menus. For instance Alt+A still opens _Affichage in the
  French localization.
2016-07-14 20:50:10 +01:00
Richard Heck
c4ef96c030 Citation commands do not absolutely have to start with "c". 2016-07-13 14:25:46 -04:00
José Matos
b41300d819 Fix typo 2016-07-13 16:46:52 +01:00
Guillaume Munch
3099248115 Branch-invert: Fix discrepancy with the outliner and document statistics 2016-07-12 14:28:12 +01:00
Guillaume Munch
0fba5c4e8b Branch-invert: Record undo and update Toc 2016-07-12 14:27:40 +01:00
Guillaume Munch
6f97684d56 Branch-invert: Add a check mark to the switch in the contextual menu. 2016-07-12 14:27:08 +01:00
Guillaume Munch
5d292fce2d UI for save_transient_properties
Add a new checkbox "Save transient properties" to the "Output" panel in the
document properties dialog (now renamed as "Format").

This provides the front-end for the change at 5c2d04999.
2016-07-12 11:27:11 +01:00
Richard Heck
e1ca7733c3 LFUN to toggle branch inversion status, now available from the
context menu.
2016-07-12 00:19:40 -04:00
Richard Heck
5df323a0dd Introduce "inverted" branch insets: These are branches whose content
is output when a branch is NOT activated. Fixes bug #7698.

At the moment, inversion is controlled through the branch settings
dialog. There is no provision for inserting inverted insets directly,
or for changing them from the context menu. Both of these could be
done, of course. The latter would need LFUN_BRANCH_TOGGLE_INVERTED.
2016-07-11 23:56:32 -04:00
Kornel Benko
59ac7ce660 Cmake build: Add needed libraries if using QT5_Extras
Commit cb0c881 does this already for automake.
2016-07-11 19:08:11 +02:00
Juergen Spitzmueller
ad9887da9c Simplify BufferParams::bufferFormat()
The differentiation of "xetex" and "platex" is not needed here,
is ambiguous and confusing (see #10013). The code that relies on
it can/should get its information otherwise.

Furthermore, polyglossia-exclusive languages now also work with
LuaTeX, since we support LuaTeX + polyglossia.
2016-07-11 11:18:55 +02:00
Enrico Forestieri
cb0c881b02 Fix paste of selection to (unfocused) external applications
With both Qt4 and Qt5, when using a click-to-focus policy, the first
attempt to paste a selection by middle mouse in an external application
which has no focus may fail. It is not clear why this succeeds for some
applications and fails for others, but refreshing the timestamp of the
selection request cures the issue. The cmake part is by Kornel.

See also this thread:
http://thread.gmane.org/gmane.editors.lyx.devel/162491
2016-07-10 19:31:32 +02:00
Juergen Spitzmueller
65173b26d5 Generate a proper error dialog title for XeTeX/LuaTeX
(see bug #10013)

Candidate for stable
2016-07-10 11:14:03 +02:00
Juergen Spitzmueller
6bcbd907a4 Clarify some comments wrt XeTeX/LuaTeX (see bug #10013) 2016-07-10 11:13:13 +02:00
Richard Heck
74809e53a7 Delete obsolete comment: We no longer support Qt < 4.4. 2016-07-10 01:43:56 -04:00
Richard Heck
2104d41f71 Simplify logic a bit. (This was meant to be part of a previous
commit.)
2016-07-10 01:43:19 -04:00
Richard Heck
d8aab4af9e Fix thinko in Buffer::preview. It is possible for this routine to
be called when we do not have a cloned Buffer, namely, if we do not
have EXPORT_in_THREAD defined.
2016-07-10 01:12:42 -04:00
Richard Heck
b3ab0190c1 Rename some variables and routines. 2016-07-10 00:00:03 -04:00
Richard Heck
31e25c8ec6 Fix problem with branch handling. The problem was that we were not
dealing properly with the paragraph separator tag.

We really need to use that tag as a kind of general marker for which
tags we're responsible for in a given paragraph and which tags we are
not. So the changes to InsetText.cpp use the tag as that kind of marker.

Note that, as of this commit, the User Guide again exports without any
kind of error. I haven't yet checked the other manuals.

This fixes bug #8022.
2016-07-09 23:58:34 -04:00
Richard Heck
2b87026bf9 Update XHTML debugging code a bit. 2016-07-09 23:54:44 -04:00
Richard Heck
db954caf8b Write magic paragraph label to main paragraph tag. 2016-07-09 23:54:44 -04:00
Juergen Spitzmueller
97b9e81cee Fix for recent luatex versions. 2016-07-09 16:45:27 +02:00
Guillaume Munch
3e6df97963 Accessibility of document class combo box (#10035)
* Access it with tab

* Access it with the accelerator from the title of the group
2016-07-08 13:27:06 +02:00
Jean-Marc Lasgouttes
5a3401c66e Revert "Skip all drawing with NoScreenUpdate strategy"
This reverts commit b874bdfd40.

It was commited by mistake and actually does not seem to improve
performance.
2016-07-07 14:22:08 +02:00
Jean-Marc Lasgouttes
b874bdfd40 Skip all drawing with NoScreenUpdate strategy
It seems that it was needed in 0b0c27ef, but nowadays the metrics are
not touched when we set this strategy.
2016-07-06 11:32:54 +02:00
Jean-Marc Lasgouttes
86c33c96a0 Record undo when deleting end of paragraph in change tracking mode
Fixes bug #10253.
2016-07-05 16:26:11 +02:00