diff --git a/src/ChangeLog b/src/ChangeLog index ee5808eac9..2402ab1531 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2006-09-19 Jürgen Spitzmüller + + * 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 * text.C (setCursorFromCoordinates): diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index ea94d4dc17..f111bf21e4 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -116,11 +116,14 @@ bool checkPastePossible(int index) pair -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(); diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 89ac6b3333..458011944a 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2006-09-19 Jürgen Spitzmüller + + * 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 * insetcite.C (getNatbibLabel): prevent filesystem exception diff --git a/src/insets/insetcharstyle.C b/src/insets/insetcharstyle.C index ba4a13c208..8b7962e1a1 100644 --- a/src/insets/insetcharstyle.C +++ b/src/insets/insetcharstyle.C @@ -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; } } diff --git a/src/insets/insetert.C b/src/insets/insetert.C index fa7533093b..0ff3e8da98 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -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(); diff --git a/status.14x b/status.14x index de53156993..57f1793695 100644 --- a/status.14x +++ b/status.14x @@ -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).