Commit Graph

25 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
601a8e0192 Rewrite the label numbering code.
* buffer_funcs.cpp (updateLabels): new function taking a buffer and
	a ParIterator as arguments. This one is used to update labels
	into an InsetText. Cleanup the code to reset depth. Call setLabel
	for each paragraph, and then updateLabel on each inset it contains.
	(setCaptionLabels, setCaptions): removed.
	(setLabel): use Counters::current_float to make caption paragraphs
	labels.

	* insets/Inset.h (updateLabels): new virtual method, empty by
	default; this numbers the inset itself (if relevant) and then all
	the paragraphs it may contain.

	* insets/InsetText.cpp (updateLabels): basically calls
	lyx::updateLabels from buffer_func.cpp.

	* insets/InsetCaption.cpp (addToToc): use the label constructed by
	updateLabels.
	(computeFullLabel): removed.
	(metrics, plaintext): don't use computeFullLabel.
	(updateLabels): new method; set the label from
	Counters::current_float.

	* insets/InsetWrap.cpp (updateLabels):
	* insets/InsetFloat.cpp (updateLabel): new method; sets
	Counters::current_float to the float type.

	* insets/InsetBranch.cpp (updateLabels): new method; the numbering
	is reset afterwards if the branch is inactive. (bug 2671)

	* insets/InsetNote.cpp (updateLabels): new method; the numbering
	is reset after the underlying InsetText has been numbered.
	(bug 2671)

	* insets/InsetTabular.cpp (updateLabels): new method (also handles
	longtable)

	* insets/InsetListings.cpp (updateLabels): new method; mimics what
	is done for Floats (although Listings are not floats technically)

	* insets/InsetInclude.cpp (getScreenLabel): in the listings case,
	use the computed label.
	(updateLabels): new method; that either renumbers the child
	document or number the current listing.

	* LyXFunc.cpp (menuNew): do not updateLabels on empty documents
	(why do we do that at all?)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19482 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-12 21:43:58 +00:00
Jürgen Spitzmüller
3993a0498b * src/insets/Inset.h: fix encoding of author names
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19110 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-18 09:30:38 +00:00
Alfredo Braunstein
fb963c2587 const correctness
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18852 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-22 13:33:51 +00:00
Stefan Schimanski
98fb638d61 * the old cursor is stored before dispatch and then used after moving
up/down to tell the insets that the cursor left them. The
  notifyCursorLeaves methods can set updateFlags to trigger a redraw.
* leave mathed with cursor up/down and get the math redrawn for the
  decorations



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18773 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-14 20:32:28 +00:00
Jean-Marc Lasgouttes
4ba4d701f7 Remove background_color_ in Insets: it takes a lot of unnecessary memory,
especially in math where each equation has many insets.

	* src/Insets.cpp: remove background_color_ member
	(setBackgroundColor): remove
	(backgroundColor): make virtual

	* insets/InsetBranch.cpp:
	* insets/InsetNote.cpp: move color setting code from setButtonLabel to 
	backgroundColor.

	* insets/InsetBox.cpp (setButtonLabel): remove call to setBackgroundColor.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18750 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-12 13:45:49 +00:00
Stefan Schimanski
82c2fbf81a * they are conceptionally the same and should be merged
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18743 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-11 18:29:11 +00:00
Abdelrazak Younes
bb8df6cc00 following rev. 18724 boost/signal is not needed.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18725 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-09 13:12:23 +00:00
Abdelrazak Younes
8f65acf693 Following revision 18723, Inset::destroyed() signal is not needed anymore.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18724 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-09 13:08:44 +00:00
Bo Peng
358e7136f2 Fix compiling errors caused by r18701 (moving drawMarkers and drawMarkers2 back to Inset)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18708 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-07 21:36:42 +00:00
Bo Peng
8153ea8fa7 Show corners of mathed with mouse hover, details see bug 3825
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18701 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-07 18:08:03 +00:00
Bo Peng
8aa6a50e69 remove pit from addToToc definition in Inset.h, as reminded by Andre
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18683 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-05 18:58:07 +00:00
Bo Peng
d3e30f8d9b addToToc, pass parent ParConstIterator, fix bug 3711
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18680 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-05 17:24:11 +00:00
Abdelrazak Younes
d075cb25b8 This patch transfer Inset::destroyed signal to InsetText and InsetMathNest thus freeing some memory as normal math chars and symbols won't have it.
It also solve a crash with non disconnect boost::signal and gcc-3.3 or 3.4.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18592 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-31 12:30:17 +00:00
Stefan Schimanski
880b6c4d6e 1. switch LFUN_UP/DOWN handling to a structural approach, i.e. the
dispatchers in mathed and text only do local work, i.e. only try to
move the cursor with their local knowledge, not globally as before in
the Cursor::goUpDown function before. The old approach used one of
brutefind functions as a last way out to really move the cursor up or
down. The result was some strange behavior that the nearest inset was
selected when jumping from math to text, not one in the next line. 
2. removed LFUN_FINISHED_UP/DOWN, as there seem to be no effect and it
seems to be obsolete.
3. target_x is working again, mainly by adding a textTargetOffset_
member to the Cursor which keeps the difference between the target_x
and the actual position of the cursor on screen. As long as
pos+offset=target is fulfilled the target_x is not touched and the
cursor keep the column while going up/down.
4. moved the text cursor up/down code to the Cursor class, in analogy
to the mathed code.
5. For 1 it is necessary to know the cursor position before the
dispatch. So this data is added to the Cursor.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18569 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-29 20:53:32 +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
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
Bo Peng
73849af5df InsetListings: change the interface of diaplay function and allow AlignLeft. Applied to InsetListings. Fixes bug 3617, 3618
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18404 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-18 14:32:29 +00:00
Bo Peng
e44fc571cc revert wrongly committed patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18263 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-11 02:34:56 +00:00
Bo Peng
a8e9fe82d0 lib/lyx2lyx/lyx_1_5.py: fix revert of listings insets
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18262 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-11 02:28:14 +00:00
Bo Peng
4ce743a0a7 Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
	* src/insets/Inset.h,cpp: LISTINGS_CODE
	* src/insets/InsetInclude.cpp: handle \lstinputlisting
	* src/insets/InsetListings.h,cpp: new listings inset
	* src/insets/InsetListingsParams.h,cpp: parameters from listings package
	* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
	* src/Bidi.cpp: handle LISTINGS_CODE
	* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
	* src/frontends/qt4/ui/ListingsUi.ui: new dialog
	* src/frontends/qt4/ui/IncludeUi.ui: update UI
	* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
	* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
	* src/frontends/qt4/QListings.h,cpp: new listings inset
	* src/frontends/qt4/Dialogs.cpp: new listings dialog
	* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
	* src/frontends/controllers/ControlListings.h,cpp: new listings inset
	* src/LyXFunc.cpp: handle LISTING_CODE
	* src/Paragraph.cpp: handle LISTING_CODE
	* src/factory.cpp: new listings inset
	* src/CutAndPaste.cpp: handle LISTINGS_CODE
	* src/LaTeXFeatures.cpp: require listings
	* src/Text3.cpp: Handle LISTINGS_CODE
	* src/lfuns.h: add LFUN_LISTING_INSERT
	* src/Buffer.cpp: change lyx file format to 269
	* src/BufferParams.h,cpp: add listings_params to preamble
	* lib/lyx2lyx/LyX.py: lyx2lyx 
	* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
	* lib/ui/stdmenus.inc: new menu item (no shortcut!)
	* src/insets/Makefile.am: update autotools
	* src/frontends/controllers/Makefile.am
	* src/frontends/qt4/Makefile.dialogs
	* src/frontends/qt4/Makefile.am
	* po/POTFILES.in: a few more translatable files.
	* development/scons/scons_manifest.py: scons build system
	* development/FORMAT: document format changes


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
Abdelrazak Younes
2640b21228 * Inset and derivatives: insetName() -> name()
* InsetMath::name(): deleted.

* buffer_funcs.cpp:setCaptions() fix potential bug by using docstring copy instead of reference while using Inset::name.





git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18119 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-30 14:39:09 +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
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
André Pönitz
51fbea02a8 Remove InsetOld
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18087 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-29 12:32:14 +00:00
Bo Peng
c8d00ed127 Rename insets/insetxxx to insets/InsetXxx, part 2
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17965 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-25 01:25:51 +00:00