Fix bug 2382:

* src/CutAndPaste.C (pasteSelectionHelper): pass Cursor 
	as argument, remove cursor-dependent arguments, 	
	implement method to reset layout in insets which
	forceParagraphsToDefault.

	* CutAndPaste.C (pasteParagraphList): adapt call of 
	pasteSelectionHelper.

	* insetert.C (doDispatch):
	* insetcharstyle.C (doDispatch): remove ad-hoc-Code to 
	reset paragraph layout. 
	This is now done generally in CutAndPaste.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@15061 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2006-09-19 09:34:42 +00:00
parent 4b4d394fbf
commit 18dc22d2dc
6 changed files with 42 additions and 25 deletions

View File

@ -1,3 +1,11 @@
2006-09-19 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* CutAndPaste.C (pasteSelectionHelper): pass Cursor as argument,
remove cursor-dependent arguments, inplement method to reset layout
in insets which forceParagraphsToDefault (fixes bug 2382).
* CutAndPaste.C (pasteParagraphList): adapt call of
pasteSelectionHelper.
2006-09-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text.C (setCursorFromCoordinates):

View File

@ -116,11 +116,14 @@ bool checkPastePossible(int index)
pair<PitPosPair, pit_type>
pasteSelectionHelper(Buffer const & buffer,
ParagraphList & pars, pit_type pit, int pos,
ParagraphList const & parlist, textclass_type textclass,
ErrorList & errorlist)
pasteSelectionHelper(LCursor & cur, ParagraphList const & parlist,
textclass_type textclass, ErrorList & errorlist)
{
Buffer const & buffer = cur.buffer();
pit_type pit = cur.pit();
pos_type pos = cur.pos();
ParagraphList & pars = cur.text()->paragraphs();
if (parlist.empty())
return make_pair(PitPosPair(pit, pos), pit);
@ -149,6 +152,19 @@ pasteSelectionHelper(Buffer const & buffer,
}
}
// If we are in an inset which returns forceDefaultParagraphs,
// set the paragraphs to default
// FIXME: pars[pit].forceDefaultParagraphs() should be enough,
// but returns the wrong values for tabular cells!
if (cur.inset().forceDefaultParagraphs(cur.idx())) {
LyXLayout_ptr const layout =
buffer.params().getLyXTextClass().defaultLayout();
ParagraphList::iterator const end = insertion.end();
for (ParagraphList::iterator par = insertion.begin();
par != end; ++par)
par->layout(layout);
}
// Make sure there is no class difference.
InsetText in;
// This works without copying any paragraph data because we have
@ -603,7 +619,7 @@ std::string getSelection(Buffer const & buf, size_t sel_index)
}
void pasteParagraphList(LCursor & cur, ParagraphList const & parlist,
void pasteParagraphList(LCursor & cur, ParagraphList const & parlist,
textclass_type textclass)
{
if (cur.inTexted()) {
@ -617,11 +633,7 @@ void pasteParagraphList(LCursor & cur, ParagraphList const & parlist,
ErrorList el;
boost::tie(ppp, endpit) =
pasteSelectionHelper(cur.buffer(),
text->paragraphs(),
cur.pit(), cur.pos(),
parlist, textclass,
el);
pasteSelectionHelper(cur, parlist, textclass, el);
bufferErrors(cur.buffer(), el);
updateCounters(cur.buffer());
cur.clearSelection();

View File

@ -1,3 +1,9 @@
2006-09-19 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetert.C (doDispatch):
* insetcharstyle.C (doDispatch): remove ad-hoc-Code to reset
pargraph layout. This is now done generally in CutAndPaste.
2006-08-19 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetcite.C (getNatbibLabel): prevent filesystem exception

View File

@ -229,27 +229,16 @@ void InsetCharStyle::doDispatch(LCursor & cur, FuncRequest & cmd)
{
setInlined();
switch (cmd.action) {
case LFUN_MOUSE_PRESS:
case LFUN_MOUSE_PRESS:
if (cmd.button() == mouse_button::button3)
has_label_ = !has_label_;
else
InsetText::doDispatch(cur, cmd);
break;
case LFUN_PASTE:
case LFUN_PASTESELECTION: {
default:
InsetCollapsable::doDispatch(cur, cmd);
BufferParams const & bp = cur.buffer().params();
LyXLayout_ptr const layout =
bp.getLyXTextClass().defaultLayout();
ParagraphList::iterator const end = paragraphs().end();
for (ParagraphList::iterator par = paragraphs().begin();
par != end; ++par)
par->layout(layout);
break;
}
default:
InsetCollapsable::doDispatch(cur, cmd);
break;
}
}

View File

@ -255,7 +255,6 @@ void InsetERT::doDispatch(LCursor & cur, FuncRequest & cmd)
ParagraphList::iterator const end = paragraphs().end();
for (ParagraphList::iterator par = paragraphs().begin();
par != end; ++par) {
par->layout(layout);
// in case par had a manual label
par->setBeginOfBody();
pos_type const siz = par->size();

View File

@ -106,6 +106,9 @@ What's new
- When inserting an inset (footnote etc.) over an existing selection,
don't copy the layout of the source paragraph to the inset (bug 2802).
- When pasting some text in an environment that does not allow the given
paragraph layout, reset the layout (bug 2382).
- Fix the disabling of some toolbar icons after closing a dialog (bug 2423).
- Fix the editing of a document while Error List dialog is open (bug 2179).