* BufferView:
- new scroll(), scrollDown() and scrollUp() method for pixel scrolling.
- new LFUN_SCREEN_UP/DOWN handling.
* TextMetrics: new helper and access methods.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20283 a592a061-630c-0410-9148-cb99ea01b6c8
* ParagraphMetrics::position_: new private member (and associated access method).
* TextMetrics:
- origin_: new screen position cache.
- use origin_ and ParagraphMetrics::position() instead of the parPos cache.
* Cursor:
- comment out buggy bruteFind() method, will work on that later.
* BufferView::updateMetrics(): refactor and simplify to use new cache and to gather everything SinglePar related.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20214 a592a061-630c-0410-9148-cb99ea01b6c8
- implement edit function that opens the inset's dialog.
* src/BufferView.cpp (doDispatch):
- call inset->edit (i.e. open dialog) for EDITABLE insets on next-inset-toggle (bug 2907)
* src/Text3.cpp (doDispatch: INDEX_INSERT):
- move inset->edit to where it belongs.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20193 a592a061-630c-0410-9148-cb99ea01b6c8
* Row:
- setSelection(): set selection begin and end for this row.
- sel_beg, sel_end: new public members.
* BufferView::draw()
- do not trigger a full repaint for selection.
- use TextMetrics::draw() instead of hand calling TextMetrics::drawParagraph().
* InsetText::draw(): don't call TextMetrics::drawSelection().
* InsetMathMBox::drawSelection(): remove.
* TextMetrics:
- drawSelection(): simplify a bit. Now private.
- redoParagraph(): memorize Row selection status.
- x2pos(): fix crash when selecting with PageDown.
- draw(): fill-in the ParPos cache before everything else and not in drawParagraph().
- drawParagraph(): take care of row selection painting.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20066 a592a061-630c-0410-9148-cb99ea01b6c8
* BufferView::updateMetrics(): always clear the full text_metrics_ when doing a full update.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19919 a592a061-630c-0410-9148-cb99ea01b6c8
* BufferView::draw(): makes use of PainterInfo::full_repaint
* TextMetrics::drawParagraph(): ditto.
* InsetText::drawSelection(): don't fillRectangle() if there's no selection.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19918 a592a061-630c-0410-9148-cb99ea01b6c8
- move RowPainter class out of the anonymous namespace so that it can be used by TextMetrics::drawParagraph().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19848 a592a061-630c-0410-9148-cb99ea01b6c8
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This first patch does some reworking of the infrastructrue. We need to distinguish between the TextClass that a particular document is using and the layout of that document, since modules, in particular, can modify the layout. The solution adopted here is to add a TextClass pointer to BufferParams, which will hold the layout. The layout itself is then constructed from the TextClass the document is using. At present, this is completely trivial, but that will change when modules are added.
The pointer in question is a boost::shared_ptr. This is needed because CutAndPaste saves a copy of the layout with each cut or copied selection. We cannot assume the selection vanishes when the document is closed, so there are two options: (i) keep a list of all the layouts that have ever been used by any document; (ii) used some kind of smart pointer. The latter seems preferable, as the former would waste memory. More importantly, the use of a smart pointer allows modules to be modified on disk and then reloaded while LyX is running, and it will eventually allow the same for layout files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19756 a592a061-630c-0410-9148-cb99ea01b6c8
* BufferView::moveToPosition()
- now only return success boolean
- now schedule a screen centering
- now set the current font to the new position.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19722 a592a061-630c-0410-9148-cb99ea01b6c8
http://bugzilla.lyx.org/show_bug.cgi?id=3427
The problem was that offset_ref_ was calculated based on an empty metrics. The solution is delay the calculation up until the next metrics update.
* BufferView:
- center(): now just set the anchor_ref and program a new screen recentering.
- updateOffsetRef(): update the offset_ref_
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19721 a592a061-630c-0410-9148-cb99ea01b6c8
* Buffer:
- get rid of cursor_ and anchor_
- ~Buffer(): update the labels of its master buffer before closing
- closing(): pass the Buffer address.
* BufferView():
- BufferView(): needs a valid Buffer (should be const in the future.
- most of the change is about removing all test of buffer_ nullity.
- resize(): deleted.
- setBuffer(): deleted.
* Application:
- newLyXView(): simplification
- updated design description in Application.h
* Gui/GuiImplementation: remove all WorkAreas and BufferView creation/Deletion. Workareas are directly handled by LyXView/GuiView and BufferView is created/delete by WorkArea.
* LyXView/GuiView: implement the new design
What is not working yet:
- the close tab button: it is implemented but does not show up.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19686 a592a061-630c-0410-9148-cb99ea01b6c8
* src/BufferView.cpp (workAreaDispatch): set selection status here
* src/Text3.cpp (dispatch):
* src/InsetTabular.cpp (doDispatch): and not here
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19396 a592a061-630c-0410-9148-cb99ea01b6c8
This fixes this crash reported by Bennett:
I'm using pdfsync via lyxpipe to have LyX jump to where I click in the .pdf file of an open LyX document. Recently I've been getting crashes. Here's the console output:
Assertion triggered in void lyx::Text::setCursorIntern(lyx::Cursor&, lyx::pit_type, lyx::pos_type, bool, bool) by failing check "this == cur.text()" in file Text2.cpp:746
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19093 a592a061-630c-0410-9148-cb99ea01b6c8
See also http://www.lyx.org/trac/changeset/19003
* BufferView.cpp (setBuffer): save selection before switching buffer
(mouseSetCursor): save selection before resetting it
(putSelectionAt): no need to save selection
* Cursor.cpp (selHandle): save selection before resetting it
* CutAndPaste.cpp (cutSelection, eraseSelection): save selection before
deleting it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19026 a592a061-630c-0410-9148-cb99ea01b6c8
When moving the cursor with a mouse click, notify all left insets, not
just the top one
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18850 a592a061-630c-0410-9148-cb99ea01b6c8
On fullscreen redraw the metrics of all visible paragraphs are
recreated and stored in the TextMetrics object. If the number of
paragraphs on screen does not change everything is fine because the
paragraph metrics cache is just updated. But if the number decreases
it can happen that old paragraph metrics remain in the cache. If this
happened because e.g. a paragraph was deleted, it's possible that the
cached paragraph is longer than the one which is actually at the
position now. Using the Row objects from the cached paragraphs then
can trigger accesses to positions which would have been valid in the
old paragraph, but go over the end of the paragraph which is there
now.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18841 a592a061-630c-0410-9148-cb99ea01b6c8
* src/lyxfind.cpp:
* src/lyxfind.h: do not allow to replace texts that are
marked as deleted (fix by Jürgen Spitzmüller)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18836 a592a061-630c-0410-9148-cb99ea01b6c8
http://bugzilla.lyx.org/show_bug.cgi?id=3171
* LyXFunc::closeBuffer(): remove code that is already done on Buffer deletion thanks to the Buffer::closing() signal connection to LyXView. Setting the Buffer twice was part of the reason of the bug.
* BufferView::setBuffer(): properly update the metrics if we move to a saved cursor position.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18830 a592a061-630c-0410-9148-cb99ea01b6c8
* buffer_funcs.{h,cpp}: new checkAndLoadLyXFile() transferred from BufferView::loadLyXFile().
* BufferView::loadLyXFile(): deleted.
* LyXView::loadLyXFile(): simplify logic and fix some issues:
- buggy child document leads to crash due to error list dialog.
- ensure that we switch to buffer if there's some errors.
- use LyXView::setBuffer() instead of repeating code.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18828 a592a061-630c-0410-9148-cb99ea01b6c8
Fix Bug 3860: Toc crash when loading a child documents.
* BufferView::loadLyXFile(): simplify, transfer last part to
LyXView::loadLyXFile().
Change return value to Buffer created by load (or 0 if none).
Ultimately, this should all be moved to buffer_funcs.cpp, as it is no
longer needed here.
* Buffer::setParentName(): small fix to avoid recursive includes.
* LyXView:
- setBuffer(): properly update the labels and the Toc if this is [LOAD Child
Document] command. Move buffer connection and disconnection, simplifying
earlier code.
- loadLyXFile(): get some code from BufferView::loadLyXFile() and from
LyXFunc::LFUN_BUFFER_CHILD_OPEN, properly handle the child document case.
There's a lot of overlap with setBuffer() here. This needs cleaning.
* LyXFunc: add optional argument to LFUN_BUFFER_CHILD_OPEN to indicate if
the document is being opened by LyX itself rather than the user (as on
View>DVI, for example).
* LyX: adapt to loadLyXFile() API changes.
* insets/InsetInclude: use LFUN_BUFFER_CHILD_OPEN rather than calling
loadLyXFile() directly. Make use of new optional argument.
With this in place, the only thing missing for proper multipart document support is to automatically update the parent Buffer when switching from the parent Buffer. This would be very useful when you work with multiple document sharing the same child documents (as I often do).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18825 a592a061-630c-0410-9148-cb99ea01b6c8
for translating keystrokes. Up until now, the switching was done in advance
in all kinds of situations, but not just before translating was actually done
--- which resulted in the KeyMap not always being switched on time...
This solves bug #3811 (http://bugzilla.lyx.org/show_bug.cgi?id=3811)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18744 a592a061-630c-0410-9148-cb99ea01b6c8
* Inset: new destroyed signal (copy ctor and operator= needed because of a signal is not copiable)
* CursorSlice:
- connect to inset destructor wherever possible
- invalidate(), isValid(): new method.
- inset_: now private
* DocIterator::fixIfBroken(): new method for properly fixing cursors.
* StableDocIterator::asDocIterator(): verify cursor sanity before creating it.
* Cursor::fixIfBroken(): now a simple wrapper around DocIterator::fixIfBroken()
* BufferView::setBuffer(): verify cursor sanity before restoring it.
* WorkArea::redraw(): verify cursor sanity of concurrent BufferView display.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18516 a592a061-630c-0410-9148-cb99ea01b6c8
- when exporting with pdflatex
- when exporting with latex and dvipost is not available
rename two colors (strikeout => deletedtext, newtext => addedtext)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18284 a592a061-630c-0410-9148-cb99ea01b6c8
through nested insets; what we want here is much simpler (bug 3472)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18254 a592a061-630c-0410-9148-cb99ea01b6c8
introduce 'semantic' TeX commands \lyxinserted and \lyxdeleted in order to decouple change tracking
output from dvipost. Raise user warning if dvipost is not installed (i.e. no changes are shown in TeX output)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18237 a592a061-630c-0410-9148-cb99ea01b6c8