Commit Graph

53 Commits

Author SHA1 Message Date
Abdelrazak Younes
c3e3534148 * TextMetrics::draw(): withdraw first row ascent before drawing because the convention is that the baseline of a multirow text is the baseline of the first row.
All other files: adapt to above change.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20177 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-09 20:21:43 +00:00
Abdelrazak Younes
d1813ca269 * TextMetrics::draw(): get rid of the first par ascent offset.
* BufferView::draw(): adapt to above change.

* InsetCollapsable::draw(): ditto -> get rid of textdim_ member.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20068 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-05 13:45:58 +00:00
Abdelrazak Younes
762d087396 fix warning.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20067 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-05 13:29:31 +00:00
Abdelrazak Younes
eed6514dd0 Move selection painting closer to row painting. Single row painting is now possible for selection.
* 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
2007-09-05 13:04:05 +00:00
Abdelrazak Younes
bc6304d760 Don't save background color in Text. Hand it down at drawing time.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20002 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-02 14:34:15 +00:00
Abdelrazak Younes
af06ed5ff1 Transfer current_font and real_current_font from Text to Cursor.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19999 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-02 13:35:48 +00:00
Abdelrazak Younes
4048448236 Transfer metrics and screen related methods from Text to TextMetrics.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19991 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-02 09:44:08 +00:00
Abdelrazak Younes
4ed011dbd1 Improve painting debug info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19970 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-01 09:33:57 +00:00
Abdelrazak Younes
2bff0157b6 Transfer Text::drawSelection() to TextMetrics.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19940 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-31 10:05:12 +00:00
Abdelrazak Younes
b45bc7944d Fix DEPM crash within inset.
* 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
2007-08-30 16:48:47 +00:00
Abdelrazak Younes
a088c6754a Finally enable single row repainting within insets! The inset width needs to stay fixed of course.
* 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
2007-08-30 15:17:38 +00:00
Abdelrazak Younes
4590960f02 header cleanup.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19855 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-28 15:32:39 +00:00
Abdelrazak Younes
971c543b34 - Transfer rowpainter.cpp:paintPar() to TextMetrics::drawParagraph()
- 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
2007-08-28 08:57:13 +00:00
Abdelrazak Younes
a43e822c98 Transfer rowpainter.cpp:paintText() to BufferView::draw()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19843 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-27 22:53:16 +00:00
Abdelrazak Younes
91f8cbe204 * BufferView::workAreaResize(): renamed to resize.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19766 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-24 07:05:19 +00:00
Richard Heck
6e93e77f22 This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.
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
2007-08-23 16:41:13 +00:00
Abdelrazak Younes
65e16cdb27 add comments and remove dead code from revision 19721.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19726 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-22 14:44:34 +00:00
Abdelrazak Younes
7e6d5cb553 bug fix.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19725 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-22 14:38:25 +00:00
Abdelrazak Younes
e809647c77 simplify BufferView::moveToPosition() use for the external use (in LyXView and LyXFunc).
* 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
2007-08-22 14:25:51 +00:00
Abdelrazak Younes
5203c56db4 Fix bug 3427:
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
2007-08-22 14:14:52 +00:00
Abdelrazak Younes
8202f63160 transfer cursor position saving (in the session) from ~WorkArea to ~BufferView.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19719 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-22 09:06:13 +00:00
Abdelrazak Younes
0fcae6cc10 * BufferView::buffer() returns a reference instead of a pointer.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19691 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-21 13:03:55 +00:00
Abdelrazak Younes
1356543c45 The BufferView/WorkArea/LyXView reorg a.k.a Multiple WorkAreas:
* 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
2007-08-21 07:33:46 +00:00
Jean-Marc Lasgouttes
35fa399edd Syncronize with 1.5. This stuff was uncommitted in y tree actually.
* 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
2007-08-10 10:21:09 +00:00
Richard Heck
eacbcb3f3a Fix bug 4096. Don't disconnect the buffer until we're ready to connect again.
Also, clean up the code a little.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19287 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-03 14:07:39 +00:00
Abdelrazak Younes
ada0bd00f0 more std declaration fixes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19103 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-17 17:40:44 +00:00
Abdelrazak Younes
0b555eba87 * BufferView::setCursorFromRow(): reset the Cursor to the main InsetText because that is what is expected afterwards.
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
2007-07-17 08:37:47 +00:00
Jean-Marc Lasgouttes
1d51120eb4 Restore the persistent selection feature (disabled because of bug 3877)
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
2007-07-10 12:44:19 +00:00
Alfredo Braunstein
2932434aaa * Fix to Bug 3903
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
2007-06-21 21:56:43 +00:00
Stefan Schimanski
557521034f * Clear the paragraph metrics cache as well on redraw:
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
2007-06-21 06:41:55 +00:00
Michael Schmitt
7067c91137 * src/BufferView.cpp:
* 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
2007-06-19 21:48:04 +00:00
Abdelrazak Younes
608603a31d Fix bug 3171: switching document jumps always back to last saved bookmark
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
2007-06-19 17:57:40 +00:00
Abdelrazak Younes
144e721b65 Polish revision 18825 and fix some remaining issues with child documents. The diff is bigger than it should because of white space issues.
* 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
2007-06-19 16:03:47 +00:00
Richard Heck
88f3b206ed Trivial whitespace fix.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18826 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-19 14:59:34 +00:00
Richard Heck
d3003c1022 Polish the Toc and labels updating when loading a child document.
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
2007-06-19 14:56:52 +00:00
Stefan Schimanski
fd44c4ffdf * Dov's patch to make typing possible again if RTL support is disabled.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18761 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-13 06:27:33 +00:00
Dov Feldstern
6742e42e79 KeyMap is now switched (if necessary) only just before it is actually used
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
2007-06-11 22:05:44 +00:00
Jürgen Spitzmüller
db1d5b38dc Fix bug 3160 and 3812:
* src/lyxfind.cpp:
	- MatchString(), operator():
	- findForward:
	- findBackwards:
	- find: pass bool find_del

	- replace:
	- replaceAll: do not replace or find (after replace) deleted text

* src/BufferView.cpp:
	- getStatus: disable LFUN_WORD_REPLACE for deleted text.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18732 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-10 15:07:21 +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
Stefan Schimanski
03b14a403e * fix #3310: When you click on a line after the end of the text,
cursor jumps to the follwing math mode text


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18545 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-28 17:04:05 +00:00
Richard Heck
274b6182f3 Cleanup. Also added notes about how to fix bug 3440, which I do not propose to do now.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18525 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-26 17:35:54 +00:00
Abdelrazak Younes
3fdbf5b9c4 Sanitize cursor saving/restoring in a multi-view context.
* 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
2007-05-25 23:17:24 +00:00
Michael Schmitt
8684c07664 output changes by means of xcolor and soul
- 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
2007-05-13 15:17:57 +00:00
Jean-Marc Lasgouttes
5f7d6947e1 * BufferView.cpp (moveToPosition): do not use ParIterator, which moves
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
2007-05-10 07:53:00 +00:00
Michael Schmitt
038cc70650 change tracking:
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
2007-05-08 17:46:03 +00:00
André Pönitz
e0d54dd3b4 LyXText -> Text
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18103 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-29 23:33:02 +00:00
André Pönitz
6add1994c7 rename LyXTextClass* into TextClass*
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18097 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-29 19:53:54 +00:00
André Pönitz
0bf9ac02a8 rename LyXLayout into Layout
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18096 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-29 18:58:28 +00:00
André Pönitz
32871c1284 rename InsetBase to Inset
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18089 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-29 13:39:47 +00:00
Bo Peng
e36fba33ab Last (?) batch of renames:
src/frontends/Alert.h src/frontends/alert.h
src/frontends/Alert.cpp src/frontends/alert.cpp
src/frontends/Alert_pimpl.cpp src/frontends/alert_pimpl.cpp
src/frontends/qt4/Alert_pimpl.cpp src/frontends/qt4/alert_pimpl.cpp
src/frontends/controllers/ButtonPolicies.cpp src/frontends/controllers/ButtonPolicy.cpp
src/frontends/controllers/ButtonPolicies.h src/frontends/controllers/ButtonPolicy.h
src/insets/InsetEnv.cpp src/insets/InsetEnvironment.cpp
src/insets/InsetEnv.h src/insets/InsetEnvironment.h
src/mathed/MathMacroTable.h src/mathed/MacroTable.h
src/mathed/MathMacroTable.cpp src/mathed/MacroTable.cpp
src/lyx_cb.h src/callback.h
src/lyx_cb.cpp src/callback.cpp
src/UpdateFlags.h src/update_flags.h


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18076 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-28 20:44:46 +00:00