Commit Graph

46 Commits

Author SHA1 Message Date
Guillaume Munch
aedc6720c7 Toc: clean-up 2016-06-12 19:17:33 +01: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
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
Jean-Marc Lasgouttes
626f8d4448 Fix compilation error with clang's libc++
The bug is probably fixed for clang 3.7.1 or 3.8.0
2016-01-11 11:18:20 +01:00
Guillaume Munch
3c9b62a69d Layout format update: AddToToc, IsTocCaption, OutlinerName
Preliminary work for addressing #7790. Thanks to Richard for providing initial
files this is based on.

Adding to TextClass:
    OutlinerName <string> <string>
    (the second string is translated)
e.g.:
    OutlinerName thm "Definitions & Theorems"

Adding to Layout:
    AddToToc <string>     (default "", means no)
    IsTocCaption <bool>   (default 0)
e.g.:
    AddToToc thm
    IsTocCaption 1

Adding to InsetLayout:
    AddToToc <string>     (default "", means no)
    IsTocCaption <bool>   (default 0)
e.g.:
    AddToToc literate

Adding to inset arguments:
    IsTocCaption <bool>   (default 0)
2015-12-13 19:56:49 +00: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
8ea62f226b Amend d5a5fbb8e (cosmetic)
Bug #9579
2015-10-02 19:47:46 +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
Guillaume Munch
ec086243df Amend 94e992c5
Fix compilation with --disable-cxx11
2015-09-20 19:24:45 +02: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
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
Juergen Spitzmueller
4066d3818e whitespace 2014-02-24 16:40:57 +01: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
Richard Heck
ecef54500d Introduce max_length parameter for plaintext() output routines,
so we can write a limited amount when using this for TOC and
tooltip output.

This should solve the problem with slowness that Kornel noticed,
which was caused by our trying to write an entire plaintext
bibliography every time we updated the TOC. We did that because
he had a bibliography inside a branch, and we use plaintext for
creating the tooltip that goes with the branch list.

Other related bugs were fixed along the way. E.g., it turns out
that, if someone had an InsetInclude inside a branch, then we would
have been writing a *plaintext file* for that inset every time we
updated the TOC. I wonder if some of the other reports of slowness
we have received might be due to this kind of issue?
2013-03-08 15:12:58 -05: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
ed42a06abb TOC context menu (part 4)
* TocBackend: Give public access to the docIterator of the TocItem. In this way, the TocWidget can find the Inset which is related to the TocItem.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29164 a592a061-630c-0410-9148-cb99ea01b6c8
2009-04-09 18:42:59 +00:00
André Pönitz
6192345f60 add Buffer * member to DocIterator
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27603 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-17 11:46:07 +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
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
Abdelrazak Younes
5731e7faae Small cleanup in order to improve toc change detection within insets.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26574 a592a061-630c-0410-9148-cb99ea01b6c8
2008-09-26 10:37:24 +00:00
André Pönitz
5791f8a894 cosmetics; compile fix
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25239 a592a061-630c-0410-9148-cb99ea01b6c8
2008-06-12 16:46:46 +00:00
Abdelrazak Younes
6876ffa65b Simplify TocModel by using UserRole data.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25235 a592a061-630c-0410-9148-cb99ea01b6c8
2008-06-12 15:31:10 +00:00
Abdelrazak Younes
1e51e87f68 Inset::addToToc(): change signature. Use DocIterator instead of ParConstIterator. The idea is to have more accurate navigation in the paragraph. But this doesn't work yet.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24747 a592a061-630c-0410-9148-cb99ea01b6c8
2008-05-13 08:23:44 +00:00
Abdelrazak Younes
9398a1495a * Menu:
* general cleanup.
* convert free standing function to private methods.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23556 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-08 10:08:10 +00:00
André Pönitz
3c5f43af7d cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23294 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-27 22:33:10 +00:00
Abdelrazak Younes
c3a8b3a566 * Inset: Prepare for an eventual merge of updateLabels() and addToToc()
* TocBackend: add non const toc() and tocs() access methods.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23018 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-15 10:13:32 +00:00
André Pönitz
69d566afea cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22885 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-09 09:08:59 +00:00
André Pönitz
a8cd9a4b8f cosmetics. mainly replace #include "dostring.h" by #include "strfwd.h"
in header files when possible. Adjust .cpp files.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21358 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-01 22:17:22 +00:00
Lars Gullik Bjønnes
26f336769a Remove warnings reported with gcc 4.3:
- Modifier on return type ignored
	- Ambigous else
	- Ambigous logical operators
	- Semi-colon instead of empty block
	- Missing header files
	- Missing using std::XX
	- Initialization out of order


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20304 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-16 10:36:57 +00:00
Abdelrazak Younes
37333444c0 Cosmetics.
* TocItem:
  - add a default constructor instead of default initialisation.
  - delete unneeded and not really used isValid() method.

* TocBackend:
  - updateItem(): re-add debug info erased previously.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18749 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-12 12:29:19 +00:00
Lars Gullik Bjønnes
897436efbb Whitespace cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18550 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-28 22:27:45 +00:00
Abdelrazak Younes
9092bffc32 This patch solves this crash (due to an assertion):
1) Open EmbeddedObject.lyx
2) Open Toc
3) Click on section 7.2.2 which is in the second child document
4) assertion.

This commit adds proper support for multi-part documents. With this each child document has access to the _full_ TOC tree (including LOT and LOF). This enables to switch between master and child document using the TOC.

* buffer_funcs.cpp:
  - updateLabels(): do not emit Buffer::structureChanged() signal for child document
  - checkBufferStructure(): update the structure of the master document.

* ControlToc.cpp: always use the TocBackend of the master document.

* LyXView::connectBuffer(): connect structureChanged() of master document.

* TocBackend:
  - TocItem: get rid of child_ member.
  - TocBackend::item(): only compare items from the same document.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18386 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-17 19:19:37 +00:00
Abdelrazak Younes
d2649159ca Toc navigation doesn't work well with child document. This is the first part of the fix: the Toc item selection is properly done before the location of the child document.
Use case solved by this patch:
1) open EmbeddedObject.lyx
2) open the TOC widget (Uwe says it crashes there but I can't reproduce)
3) try to select an item previous to 6.2.2: crash because of an assertion:

Assertion triggered in bool __cdecl lyx::operator <(const class lyx::CursorSlice
 &,const class lyx::CursorSlice &) by failing check "false" in file D:\LyXSVN\ly
x-devel\src\CursorSlice.cpp:106

I think this patch will also solve bug 3616:
http://bugzilla.lyx.org/show_bug.cgi?id=3616 

* TocItem::child_: new member for child document; default to false.
* TocBackend::item(): skip DocIterator comparison if item is in child docuemt.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18370 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-16 16:43:14 +00:00
Bo Peng
00e305c9d9 Rename .C ==> .cpp for files in src, part one
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18018 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-26 04:41:58 +00:00
Abdelrazak Younes
35173d515b remove useless declaration
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17536 a592a061-630c-0410-9148-cb99ea01b6c8
2007-03-25 00:57:12 +00:00
Abdelrazak Younes
61dde5d797 Cleanup of the Toc model and controller: The objective is to let the View (TocWidget) decide which kind of list it want to show. The type given by InsetCommandParam() (as read by the controller (ControlToc) then just becomes a hint to the View. Most of the commit is about getting rid of the controller maintained list of types.
* TocBackend
  - addType(), types_, types(): deleted.

* ControlToc
  - tocs(): new
  - selectedType(): access to selected_type_
  - initialiseParams(): transfer code from QToc::update() and look for selected type.
  - getTypes(), getContents(): deleted

* QToc: do not maintain current type. Get the info from the View.
  - setTocModel(): deleted

* TocWidget: always pass the currently selected type to the model/controller.
  - setTocModel(): new slot.
  - updateGui(): transfer code to setTocModel().


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17455 a592a061-630c-0410-9148-cb99ea01b6c8
2007-03-16 14:14:55 +00:00
Abdelrazak Younes
bf61ecc2de Support code for advanced Toc management and bug correction.
* buffer.h:
  - structureChanged(): new boost signal. I intend to use that also when a text is changed in a section or caption item.

* buffer_funcs.C:
  - updateLabels(): emit Buffer::structureChanged() after TocBackend is updated.
  - checkBufferStructure(): new method for updating the TocBackend if needed.

* LyXView:
  - updateToc(): new slot for Buffer::structureChanged() signal.

* text.C:
  - call checkBufferStructure() whenever text is added or erased.

* TocBackend.[Ch]:
  - updateItem(): new method to update a specific item (called from checkBufferStructure()).



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17413 a592a061-630c-0410-9148-cb99ea01b6c8
2007-03-12 11:23:41 +00:00
Michael Schmitt
c5df681fe8 * insets/insetfloatlist.C:
* insets/insettoc.C:
	* TocBackend.C:
	* TocBackend.h: rename 'asciiTocList()' to '.writePlaintextTocList'

	* insets/insettext.C:
	* output_plaintext.C:
	* output_plaintext.h: rename 'asciiParagraph' to 'writePlaintextParagraph'

	* output_plaintext.C:
	* exporter.C:
	* output_plaintext.h: rename 'writeFileAscii' to 'writePlaintextFile'

	* lyxrc.C: change lyxrc section title (ASCII => PLAIN TEXT)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16756 a592a061-630c-0410-9148-cb99ea01b6c8
2007-01-18 22:29:50 +00:00
Georg Baum
2734cc1548 Extend the navigate menu to child docs
* src/buffer_funcs.h
	(updateLabels): Add bool childonly argument

	* src/insets/insetbase.h
	(addToToc): New virtual method

	* src/insets/insetinclude.[Ch]
	(addToToc): New virtual method
	(updateLabels): New method

	* src/TocBackend.h: reorganize classes so that we can forward
	declare TocList

	* src/insets/insetfloat.[Ch]
	* src/insets/insetwrap.[Ch]
	(addToToc): Adjust to type changes in TocBackend.h

	* src/frontends/qt4/TocModel.[Ch]: ditto

	* src/frontends/controllers/ControlToc.[Ch]: ditto

	* src/TocBackend.C: ditto
	(TocBackend::update) Remove test for float and wrap inset,
	call virtual method instead

	* src/BufferView.C
	(BufferView::dispatch): make LFUN_PARAGRAPH_GOTO work even if the
	target paragraph is in a different buffer

	* src/MenuBackend.C: Adjust to type changes in TocBackend.h
	(expandToc): Add an entry for the master doc in child docs

	* src/buffer_funcs.C
	(setLabel): Add text class parameter
	(updateLabels): handle included docs if requested by the caller


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15904 a592a061-630c-0410-9148-cb99ea01b6c8
2006-11-13 16:53:49 +00:00
Abdelrazak Younes
479e9054db * Buffer
- new pimpled TocBackend member and associated accessors.

* toc.[Ch]: delete all toc related methods except outline.

* TocBackend:
  - goTo(): deleted, this gets rid of the LyXView dependency
  - made all accessors const.

* ControlToc: 
  - rework the controller to work exclusively with TocBackend.
  - goTo(): now call LyXView::dispatch() directly

all other files: update with the TocBackend or ControlToc API changes.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15852 a592a061-630c-0410-9148-cb99ea01b6c8
2006-11-11 00:35:14 +00:00
André Pönitz
6c300f72a2 move everything into namespace lyx
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15422 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-21 00:16:43 +00:00
Georg Baum
34b7650cbb Introduce wide streams. This fixes the remaining problems of plain text
export (e.g. the ToC) and the navigate menu.

	* src/insets/insetbase.h
	(InsetBase::plaintext): output to a docstream
	(InsetBase::textString): ditto

	* src/mathed/TextPainter.h
	(TextPainter::show): ditto

	* src/support/docstream.[Ch] New file and string streams for
	docstring. The file streams convert to UTF8 on the fly.

	* many more files: Adjust to the changes above


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15301 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-11 19:40:50 +00:00
Martin Vermeer
71f356c372 Outlining improvements/fixes
* LyXAction.C
	(LyXAction::init): add LFUN_OUTLINE_(UP|DOWN|IN|OUT)

	* BufferView_pimpl.C
	(BufferView::Pimpl::getStatus):
	(BufferView::Pimpl::dispatch): handling of new LFUNS

	* frontends/controllers/ControlToc.C
	(ControlToc::canOutline): modify dispatch logic

	* lfuns.h
	(kb_action): add LFUNs

	* toc.[Ch]
	(outline): changes

	* TocBackend.h: modifify == operator for Item



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13751 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-26 17:43:03 +00:00
Abdelrazak Younes
9b19f9982a Get rid of dos end-of-lines
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13747 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-26 13:34:35 +00:00
Abdelrazak Younes
d57250330d Fix compile with enable-concept-check.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13714 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-22 21:46:32 +00:00
Abdelrazak Younes
8c0bd3a77b * TocBackend.[Ch]: new files defining class TocBackend. This class contains adapted code from former toc.C
* toc.[Ch]:
    - rewritten to take advantage of new TocBackend class. The toc
    cache is implemented as a static variable:
    static map<Buffer const *, lyx::TocBackend> toc_backend_;

* buffer_funcs.C:
    updateLabels(Buffer const & buf) now calls
    "lyx::toc::updateToc(buf);"

* pariterator.h: added default constructor
    ParConstIterator(): DocIterator() {}

* insetfloat.C: added pit parameter to TocItem construction

* insetwrap.C: added pit parameter to TocItem construction

* MenuBackend.C: use a const ref instead of a copy of TocList

* ControlToc.[Ch]: optimisation of the API by using const reference instead of copy.

* qt4/TocPanel.[Ch]:
    - optimisation of the API by using const reference instead of
    copy
    - directly use of TocBackend::TocIterator instead of identification by paragraph contents.

* qt4/QToc.C:
    - optimisation of the API by using const reference instead of
    copy
    - makes use of TocBackend::Item::uid()

* qt2/QToc.C:
    - use TocItem::depth() and TocItem::str() instead of public member access.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13713 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-22 18:48:28 +00:00