Commit Graph

63 Commits

Author SHA1 Message Date
Christian Ridderström
e30f3d76d2 Bulk cleanup/fix incorrect annotation at the end of namespaces.
This commit does a bulk fix of incorrect annotations (comments) at the
end of namespaces.

The commit was generated by initially running clang-format, and then
from the diff of the result extracting the hunks corresponding to
fixes of namespace comments. The changes being applied and all the
results have been manually reviewed. The source code successfully
builds on macOS.

Further details on the steps below, in case they're of interest to
someone else in the future.

1. Checkout a fresh and up to date version of src/

    git pull && git checkout -- src && git status src

2. Ensure there's a suitable .clang-format in place, i.e. with options
   to fix the comment at the end of namespaces, including:

    FixNamespaceComments:                           true
    SpacesBeforeTrailingComments:                   1

and that clang-format is >= 5.0.0, by doing e.g.:

    clang-format -dump-config | grep Comments:
    clang-format --version

3. Apply clang-format to the source:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")

4. Create and filter out hunks related to fixing the namespace

    git diff -U0 src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace.patch

5. Filter out hunks corresponding to simple fixes into to a separate patch:

    pcregrep -M -e '^diff[^\n]+\nindex[^\n]+\n--- [^\n]+\n\+\+\+ [^\n]+\n'  \
        -e '^@@ -[0-9]+ \+[0-9]+ @@[^\n]*\n-\}[^\n]*\n\+\}[^\n]*\n'         \
        fix_namespace.patch > fix_namespace_simple.patch

6. Manually review the simple patch and then apply it, after first
   restoring the source.

    git checkout -- src
    patch -p1 < fix_namespace_simple.path

7. Manually review the (simple) changes and then stage the changes

    git diff src
    git add src

8. Again apply clang-format and filter out hunks related to any
   remaining fixes to the namespace, this time filter with more
   context. There will be fewer hunks as all the simple cases have
   already been handled:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")
    git diff src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace2.patch

9. Manually review/edit the resulting patch file to remove hunks for files
   which need to be dealt with manually, noting the file names and
   line numbers. Then restore files to as before applying clang-format
   and apply the patch:

    git checkout src
    patch -p1 < fix_namespace2.patch

10. Manually fix the files noted in the previous step. Stage files,
    review changes and commit.
2017-07-23 13:11:54 +02:00
Richard Heck
75bfed5507 Fix trailing whitespace in cpp files. 2017-07-03 13:53:14 -04:00
Guillaume Munch
3391fed36a Make the generation of children's tocs more robust
Let the children directly access the TocBuilders, instead of concatenating
after the fact.
2017-01-14 23:13:14 +01:00
Guillaume Munch
54f5100e74 Simplify
The main point is the flag which is much simpler now.
2017-01-14 23:13:14 +01:00
Enrico Forestieri
dea5ba16de Correctly track ulem commands with change tracking
LyX assumes that everything in \lyxdeleted is struck out by ulem
and increases the corresponding counter. However, deleted display
math material is struck out using tikz. As we also take into
account the deletion of underlined display math (in order to
properly position such material vertically), we have to take
care that the count is correct.
2016-10-23 18:23:41 +02:00
Enrico Forestieri
8d5899aaf3 Fortify math insets against ulem commands
It should be now possible underlining or striking out any kind
of math inset containing any math construct indigestible to ulem.
While this was already possible for inline math insets, they could
have break if an aligned environment was used, for example.
This is now possible also for diplay math. Even if this can be
nonsensical and not visually perfect, at least no latex errors
should be generated if one tries to.
2016-10-21 01:35:39 +02:00
Enrico Forestieri
d48bc4e4ae Remove a now unnecessary \mbox 2016-10-19 01:32:29 +02:00
Enrico Forestieri
129459a71b Take into account font changes when striking out display math formulas
Font changes are brought inside the \lyxdeleted macro, just before
outputting the latex code for the math inset. The inset writes a
signature before itself and this is checked by \lyxsout for recognizing
a display math. So, the font changes confuse \lyxsout, which also
swallows the first macro at the very start of \lyxdeleted. The result
is that the font changing command is not seen by latex and \sout is also
used to further strike out the formula already striked out by tikz.
This commit makes sure that the expected signature actually appears
just after the opening brace of \lyxdeleted. It also accounts for a
paragraph break occurring just before the math inset, in order to not
introduce too much vertical space, which is noticeable when using
larger font sizes.
2016-10-18 03:29: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
Guillaume Munch
de786bfcdf Change tracking cue: for display() math insets
Strike through deleted display math insets.
2016-07-03 17:28:46 +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
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
Richard Heck
bc1672f6a0 Squash some warnings. 2016-07-02 14:12:49 -04:00
Guillaume Munch
760bca8265 Change tracking cue: paint over labels in text and prepare for further work
* Inset::canTrackChange() had two meanings: can it deal with change tracking?
  Will it paint its own CT status? The latter information is now given by
  Inset::canPaintChange().

* Line thickness computation is moved from RowPainter to MetricsBase.

* Painting function for Changes moved to lyx::Change. (One new, that strikes
  diagonally.)
2016-06-13 08:46:15 +01:00
Guillaume Munch
395d9e09e2 Disable certain change tracking commands when there are no changes
Fix TODO
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
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
d9524321d7 Simplify Unicode symbols for old systems
(http://mid.gmane.org/565E17DD.7090008@clear.net.nz)

Fix the pilcrow and the cross in the outliner for Windows and old Ubuntus.

The thin space after the cross is based on aesthetics (in Ubuntu at least) after
trying both with and without a normal space. A thin space is already used for
display in BiblioInfo.cpp, so I presume it is safe.

Ideally, I prefer  (CROSS MARK), whose description fits the purpose, over ✖
(HEAVY MULTIPLICATION X), which looks too bold in the UI. Whereas ✕
(MULTIPLICATION X, successfully tested in Windows by Andrew) looks too dim. But
 (CROSS MARK) is next to  (NEGATIVE SQUARED CROSS MARK) so it might be as
problematic as the latter.

Do not output the cross on the author name in the toc of tracked changes.
2015-12-04 17:29:39 +00:00
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
Georg Baum
2a677592a5 Fix uncodable author warning
The old code was not threadsafe, and the restriction to one message box per
author name did not work if more than two authors were uncodable.
2014-07-05 14:49:51 +02:00
Richard Heck
0a6ff99f28 Typos and style. 2014-04-21 11:51:59 -04:00
Juergen Spitzmueller
5a4363c0f5 \lyxdeleted uses an ulem command.
Therefore we need to put \cite and \ref into \mboxes, as in our native ulem commands.

Fixes: #8806.
2014-04-21 11:51:58 -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
Richard Heck
86994bf753 Add a member to TocItem that tells us whether the item in question
is included in output.
2013-03-08 16:38:18 -05:00
Kornel Benko
e04523f77b Make change tracking in export to latex be independent of timezone 2013-01-07 15:46:47 +01:00
Lars Gullik Bjønnes
6b2232a29c src/*.cpp: reformatting to increase consistency 2012-10-28 17:42:07 +01:00
Juergen Spitzmueller
51d591d168 Factor out method to get a properly encoded latex string 2012-06-30 13:30:48 +02:00
Georg Baum
1a6c599917 Extend the notermination flag to math as well.
Math commands need it as well as text commands. At the same time, this
further unifies the checking for termination and fixes cases of wrong
output (e.g. for 0x2005).
2012-03-25 15:57:38 +02:00
Enrico Forestieri
1ef605f625 Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
Vincent van Ravesteijn
e1398a66d8 Author: more cosmetics. Forgot these in previous commit.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36342 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-17 16:13:59 +00:00
Vincent van Ravesteijn
c6c0559be0 Fix bug #6672 (part 2): Add tooltips to the outliner.
At some point we should implement that the tooltips are only shown when they are not completely shown in the outliner. However, this requires extending the QTreeView class. 

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34287 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-26 00:43:08 +00:00
Vincent van Ravesteijn
fd507aecf4 Fix typos.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33693 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-10 15:09:44 +00:00
Pavel Sanda
89bdacdeec Typos, patch from Sven.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32371 a592a061-630c-0410-9148-cb99ea01b6c8
2009-12-05 23:18:21 +00:00
Jürgen Spitzmüller
cb815e4045 * Changes.cpp (getLaTeXMarkup):
- pass references, not copies.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31606 a592a061-630c-0410-9148-cb99ea01b6c8
2009-10-13 07:30:46 +00:00
Jürgen Spitzmüller
3b6931719a Assure the author is encoded correctly in the LaTeX output of change tracking markup (bug 6225).
Patch reviewed by Jean-Marc.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31602 a592a061-630c-0410-9148-cb99ea01b6c8
2009-10-12 16:22:05 +00:00
Vincent van Ravesteijn
b86942b4f4 Uniform naming of functions.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30865 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-04 22:50:36 +00:00
Vincent van Ravesteijn
966687d98b Fix bug #6058: Change tracking not usable in version control.
This patch makes sure that there are minimal changes when loading and saving a file with change tracking.

- the authors are assigned a buffer_id, such that when the file is saved, they get the same id,
- the authorlist is sorted according to the buffer_id,
- the buffer_id is written to the file in the author list (file format change)
- the ids start with 1, because 0 is internally reserved for the current Author,
- when writing the file, the current author is assigned an id if he didn't already have it.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30756 a592a061-630c-0410-9148-cb99ea01b6c8
2009-07-23 20:08:05 +00:00
Vincent van Ravesteijn
f05504f5ef Fix bug #5390. Copy from a deleted section with change tracking.
Do not accept the changes in the selection, if it is completely deleted.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29672 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-14 22:21:05 +00:00
Vincent van Ravesteijn
26c5e8a83b Fix bug 5629: http://bugzilla.lyx.org/show_bug.cgi?id=5629.
Hard to distinguish between added and deleted text.

* Changes.cpp/h: add a merge_color for deletions and change the return type to Color.

* ColorCode.h/Color.cpp: add a new customizable color that indicates the merge color for deletion.

See: 
http://thread.gmane.org/gmane.editors.lyx.devel/114189 


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28423 a592a061-630c-0410-9148-cb99ea01b6c8
2009-02-09 20:47:32 +00:00
Vincent van Ravesteijn
814a8411eb Reverse unwanted commits.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28388 a592a061-630c-0410-9148-cb99ea01b6c8
2009-02-08 01:11:27 +00:00
Vincent van Ravesteijn
f694cf7135 * InsetMathNest.cpp: Cosmetics.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28387 a592a061-630c-0410-9148-cb99ea01b6c8
2009-02-08 01:01:15 +00:00
Richard Heck
605ce88938 Fix Abdel's FIXME.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26708 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-03 23:16:51 +00:00
Richard Heck
e852600e61 Typo, from Vincent.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26707 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-03 22:58:29 +00:00
Abdelrazak Younes
4f878b3566 stupid me...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26702 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-03 19:57:13 +00:00
Abdelrazak Younes
448f715831 Fix assertion with imaginary end-of-par in Changes::addToToc().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26701 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-03 19:53:53 +00:00
Abdelrazak Younes
b54b51c694 gcc compile fix: vector::insert() requires an iterator, not a const_iterator.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26642 a592a061-630c-0410-9148-cb99ea01b6c8
2008-09-30 12:34:36 +00:00
Abdelrazak Younes
f40a74eae2 Fix the order of changes in the Navigator. They appeared backwards.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26641 a592a061-630c-0410-9148-cb99ea01b6c8
2008-09-30 11:26:40 +00:00
Abdelrazak Younes
5ce39aa8b5 Add a "List of Changes" in the Navigator. The list is updated only when the document structure is reset or when the update button is clicked. Some work is needed to track more finely individual changes as we do for sections.
Changes::addToToc(): New method to insert changes sorted by authors. The symbols 0x2702 and 0x270d are used to represent deletion and insertion.

TocBackend::item(): new method to lookup for a given item.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26639 a592a061-630c-0410-9148-cb99ea01b6c8
2008-09-30 11:06:34 +00:00
Pavel Sanda
29e02eff76 Colors for multi-author track changes.
Patch by Vincent.

http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg143215.html


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26497 a592a061-630c-0410-9148-cb99ea01b6c8
2008-09-22 15:30:26 +00:00
Jean-Marc Lasgouttes
9b4a26a252 rename assert.h to lassert.h
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24559 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-30 08:26:40 +00:00