Commit Graph

23453 Commits

Author SHA1 Message Date
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