Commit Graph

4500 Commits

Author SHA1 Message Date
Scott Kostyshak
937a52b64d Do nothing if converting to the same type of Note
The advantage is that the buffer will no longer be
marked as dirty when converting to the same type.

A quick break here is done instead of disabling the
LFUN because disabling the LFUN would lead to a greyed out
entry, which might confuse users. In the future, we might
want to have a radio button for switching between notes.
2014-11-17 19:47:37 -05:00
Richard Heck
df7b0eb61d Get rid of boost::noncopyable. 2014-11-14 23:40:27 +00:00
Uwe Stöhr
af8ba5e069 InsetFootlike.cpp: disable listings inside footnotes
fixes bug #9321
2014-11-04 23:44:10 +01:00
Richard Heck
1f45e6527a Do not truncate references in outline pane (bug 9312). 2014-10-30 18:39:58 -04:00
Enrico Forestieri
498ab8ff23 Tweak the shape of the parbreak separator.
The shape of the parbreak separator is slightly changed in order to
better distinguish it from the forced newline. This allows using the
same color of the plain version without risk of confusion.
2014-10-25 23:38:52 +02:00
Richard Heck
2ca21d2c15 Update comment. 2014-10-16 16:50:03 -04:00
Alfredo Braunstein
b2246c4ea2 insets/InsetTabular.cpp (doDispatch): fix to #9291. The problem was simply that the default status for the cursor in the call to *::doDispatch is "dispatched".
insets/InsetTabular.cpp (edit): do not reset the selection
2014-10-14 12:04:19 +02:00
Alfredo Braunstein
25cf12d650 Text2.cpp (checkAndActivateInset, checkAndActivateInsetVisual): activate insets on selection if the anchor is inside the inset.
insets/InsetText.cpp (InsetText::edit): do not reset the selection
Fixes #2346.
2014-10-12 10:07:18 +02:00
Richard Heck
6490cdafbe Make BiblioInfo::collectCitedEntries private (since it can be),
and fix a comment referring to it.
2014-08-22 11:18:10 -04:00
Richard Heck
54c2ab2732 Possible fix for the mystery crash, which is bug #9049.
Investigation of bug #9236 showed that crash to be due to a Paragraph's
holding a dangling pointer to an old and deleted Layout after the
DocumentClass was reset. Since the backtraces look almost identical, it
seems likely that we have the same problem here.

Since this crash seems almost always to involve tables, I looked at the
code in switchBetweenClasses() and found that the Paragraphs that belong
to "hidden" table cells are not seen by the initial recursion using a
ParIterator: It skips right over them. This was confirmed by test code
suggested by Enrico, with results reported in Trac.

The present patch attempts to deal with this problem in the second
recursion, over Insets. When we see an InsetTabular, we call a new
routine that recurses through the cells, looking for hidden ones. If it
finds a hidden one, it then resets the Layout for the cell's Paragraphs
(there should be only one, but we do not make any assumptions) to the
PlainLayout that belongs to the new DocumentClass. This is good enough,
since such cells never have content.

There is extensive discussion of the patch here:
  https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg185095.html
Additional testing by Enrico and me confirmed the existence of the
dangling pointer.
2014-08-15 10:44:37 -04:00
Richard Heck
3a78422782 Add some comments about the behavior of cellInset and cellIndex. 2014-08-09 13:13:10 -04:00
Jean-Marc Lasgouttes
7f7dc5d314 Whitespace 2014-07-26 16:29:23 +02:00
Jean-Marc
41740ea915 Merge remote-tracking branch 'features/str-metrics'
This branch implements string-wise metrics computation. The goal is to
have both good metrics computation (and font with proper kerning and
ligatures) and better performance than what we have with
force_paint_single_char. Moreover there has been some code
factorization in TextMetrics, where the same row-breaking algorithm
was basically implemented 3 times.

Globally, the new code is a bit shorter than the existing one, and it
is much cleaner.  There is still a lot of potential for code removal,
especially in the RowPainter, which should be rewritten to use the new
Row information.

The bugs fixed and caused by this branch are tracked at ticket #9003:
http://www.lyx.org/trac/ticket/9003

What is done:

* Make TextMetrics methods operate on Row objects: breakRow and
  setRowHeight instead of rowBreakPoint and rowHeight.

* Change breakRow operation to operate at strings level to compute
  metrics The list of elements is stored in the row object in visual
  ordering, not logical. This will eventually allow to get rid of the
  Bidi class.

* rename getColumnNearX to getPosNearX (and change code accordingly).
  It does not make sense to return a position relative to the start of
  row, since nobody needs this.

* Re-implement cursorX and getPosNearX using row elements.

* Get rid of lyxrc.force_paint_single_char. This was a workaround that
  is not necessary anymore.

* Implement proper string metrics computation (with cache). Remove
  useless workarounds which disable kerning and ligatures.

* Draw also RtL text string-wise. This speeds-up drawing.

* Do not cut strings at selection boundary in RowPainter. This avoids
  ligature/kerning breaking in latin text, and bad rendering problems
  in Arabic.

* Remove homebrew Arabic and Hebrew support from Encoding.cpp. We now
  rely on Qt to do handle complex scripts.

* Get rid of LyXRC::rtl_support, which does not have a real use case.

* Fix display of [] and {} delimiters in Arabic scripts.
2014-07-25 20:10:55 +02:00
Jean-Marc
1fefbf5bdc Fix bad use of undo kind in Tabular inset. 2014-07-25 20:03:42 +02:00
Georg Baum
2c39859575 Remove unneeded swap() (thanks Jean-Marc)
std::swap() does exactly the same thing, and avoiding code duplication is
always good.
2014-07-07 21:16:10 +02:00
Jean-Marc
93a43742a5 Fix a bunch of small performance issues spotted by cppcheck
Most of these are about passing const strings parameters as references.
2014-07-05 19:13:10 +02:00
Georg Baum
50929b5b8a Make include and bibitem insets threadsafe
Using a mutex to ensure that the generated filenames and ids are still unique.
2014-07-05 12:09:49 +02:00
Georg Baum
0092b523c7 Fix Tabular::CellData::operator=()
Don't create an intermediate copy (found by Jean-Marc).
I doubt that this has anything to do with the mystery crash, but it works, and
following the standard patterns is better anyway.
2014-07-05 11:44:13 +02:00
Jean-Marc Lasgouttes
d32f76f7fe Small Inset isXXX methods cleanup
* rename isStretchableSpace to isHfill
 * inline a trivial method
 * remove InsetIPAMacro::isLineSeparator, which has the same value as default.
2014-06-25 17:54:26 +02:00
Jean-Marc Lasgouttes
01ba22efff Fix checkmark on current entry for InsetSeparator context menu
The code supposed to do that contained a typo and was not completely correct.
2014-06-13 10:30:25 +02:00
Georg Baum
f09a9fe2e6 Remove unsafe method FileName::tempName()
FileName::tempName() created a new temp file name by using qt to create a
temporary file with a unique name, and then deleting that file and returning
the name. This was unsafe, since other processes or even other threads of the
running LyX could create files with the same name between deletion and then
using the temp name.
This is fixed by using the TempFile class instead. As a side effect, a few
cases where the temp files were not deleted after usage were fixed as well.
The only place that is still unsafe is createTmpDir().
2014-06-09 13:05:50 +02:00
Richard Heck
5536b0c7fe Flush stream more often to help figure out where the mystery crash
originates.
2014-06-04 09:19:42 -04:00
Juergen Spitzmueller
95a7716998 Remove superfluous conversion 2014-05-31 10:46:49 +02:00
Juergen Spitzmueller
beb53ddbe2 Whitespace 2014-05-31 10:33:46 +02:00
Richard Heck
b992968a15 Fix bug #9131 for development branch. There are two parts to the fix.
The firs tinvolves a thinko in BibTeXInfo::expandFormat. We were previously
counting passes through this routine, which means: one for every character,
more or less. So long strings would hit the "recursion limit". But what
we are worried about is an infinite loop caused by misues of macros, so that
is what we need to count.

This prevents the error we were previously getting, but it reveals a huge
slowdown when one tries to open a citation inset with a large nubmer of keys.
So we also limit the number of keys we try to process, and the length of the
string we try to display, when we are generating citation information.

I'm convinced that there is a deeper problem in how citation information is
generated (see the bug tracker for more info), but that will require major
surgery and a file format change
2014-05-23 11:26:45 -04:00
Jean-Marc Lasgouttes
275b7af75e Code cleanup: get rid of RenderPreview::status()
This method is a proxy for LyXRC::preview that forces to forward
declare some wrapper around an enum...

Instead, two simple static methods previewMath() and previewText() are
introduced, that make the code much easier to follow.
2014-05-20 12:19:26 +02:00
Enrico Forestieri
1ad3f809a4 Prettify the output of InsetSeparator.
If a separator inset is used after an environment with NextNoIndent
set to false, a blank line was already output. So, avoid outputting
another blank line or an odd looking line with only a '%' character
(as the previous blank line provides already a visual separation).
2014-05-18 23:02:24 +02:00
Richard Heck
4d30b613ba Whitespace. 2014-05-18 11:27:54 -04:00
Scott Kostyshak
d863a76f45 Correct my previous comment (thanks Kornel) 2014-05-18 05:14:05 -04:00
Scott Kostyshak
10df612191 Add comment 2014-05-18 04:29:59 -04:00
Scott Kostyshak
4bd0941b4f Graphics only handle inset-modify graphics (#8262)
inset-modify tabular and others are now passed on.
2014-05-16 23:38:32 -04:00
Scott Kostyshak
43d464cca0 Fix alignment rendering of multirow in LyX (#8976)
Multirow cells now have the same alignment rendering in LyX
as in the output. The alignment of a multirow can change as
long as the column is not of fixed width. If the column is
of fixed width, the multirow is left-aligned.

When setting a multirow, the alignment is copied from
the last cell in the selection.
2014-05-16 23:38:26 -04:00
Jean-Marc Lasgouttes
f9e0d4a595 Remove unused parameter. 2014-05-16 15:25:17 +02:00
Enrico Forestieri
15e1f5eb39 Make use of otexstream also in external::writeExternal
This was not necessary when LyX was generously outputting newlines.
As it may happen that the output produced by writeExternal (the
result of an external inset) starts right at the beginning of a
line, if otexstream does not know that something is already on
the line, the iomanip-like variable 'breakln' fails to actually
break the line.
2014-05-16 14:40:09 +02:00
Enrico Forestieri
c668ebf611 Fix bugs #8546 and #9055, and introduce new separator inset.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.

Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.

Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
2014-05-10 23:25:11 +02:00
Juergen Spitzmueller
d7e9ab08a3 Listings: Validate skip amounts correctly.
Fixes: #7373.
2014-05-07 12:33:39 +02:00
Juergen Spitzmueller
5368645e70 Simplification 2014-05-07 08:09:04 +02:00
Juergen Spitzmueller
ef05f7cca9 Store InsetListingsParams in a vector of pairs, not a map, since order of insertion matters.
Fixes: #8144, #5203.
2014-05-06 20:22:25 +02:00
Juergen Spitzmueller
e43e4456ea Fix typos in InsetListingsParams validator 2014-05-06 20:17:03 +02:00
Juergen Spitzmueller
a4ea543f2f Bibtopic requires styles files to be passed via argument
Fixes: #9060
2014-04-22 09:25:58 +02:00
Jean-Marc Lasgouttes
5c32dc85d5 Fix various warnings issued by clang++.
* remove unused class TexStream.

* remove unused virtual method Inset::cellXOffset

* remove second argument of FileDialog constructor, which was actually
  not used

* remove some dead local code

* remove some unused private members of classes

* in InsetMathNest::updateBuffer, fix the logic of a test
2014-04-22 00:04:04 +02:00
Richard Heck
6021322c01 Update comment slightly. 2014-04-21 11:52:00 -04:00
Richard Heck
75aa0d61db Make some functions return const refs, and add a comment. 2014-04-21 11:52:00 -04:00
Richard Heck
065db68067 Fix a bunch of minor issues discovered by the cppcheck script. 2014-04-21 11:52:00 -04:00
Richard Heck
84d4d45daa Fix two thinkos caught by the cppcheck script. 2014-04-21 11:52:00 -04:00
Richard Heck
0a6ff99f28 Typos and style. 2014-04-21 11:51:59 -04:00
Richard Heck
8b00b355ca Change forToc() to forOutliner(), to avoid confusion. The old name
is left over from when the outliner really did just display a TOC.
2014-04-21 11:51:59 -04:00
Juergen Spitzmueller
9aa0fe91f6 ulem commands can be nested. 2014-04-21 11:51:58 -04:00
Juergen Spitzmueller
8e6d367f94 InsetListings: Rewrite C-ism in C++ and fix terminator bug.
The rewriting is completely done by JMarc. The terminator bug fix has been added to that by me.

Fixes: #8985
2014-04-21 11:51:57 -04:00
Richard Heck
fdbe775b9f This is the result of an audit of all static variables, looking
for possible thread conflicts, of the sort Georg resolved at
6a30211f. I have made static variables const where possible,
and marked cases that looked potentially problematic with the
comment:
	// FIXME THREAD
Many of these definitely are vulnerable to concurrent access, such
as the static variables declared at the start of output_latex.cpp.
Suppose, e.g., we were outputting latex and also displaying the
source of a different document.

I'd appreciate it if others could grep for "FIXME THREAD" and see
if some of these are harmless, or what.
2014-04-21 11:51:57 -04:00