use CutAndPaste static methods directly

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2176 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-07-03 15:39:17 +00:00
parent b9d61343fc
commit 2292b739a2
6 changed files with 18 additions and 15 deletions

View File

@ -4,6 +4,9 @@
in NEW_INSETS
(redoDrawingOfParagraph): ditto
(redoParagraphs): ditto
(cutSelection): don't create a object for CutAndPaste use the
static method directly
(pasteSelection): ditto
* bufferview_funcs.[Ch]: move ProhibitInput and AllowInput to
LyXview (+ rename)

View File

@ -1,5 +1,8 @@
2001-07-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormDocument.C (class_apply): call CutAndPaste::'s staitc method
directly.
* Toolbar_pimpl.h: make owner be a XFormsView, small changes
because of this.

View File

@ -382,8 +382,7 @@ bool FormDocument::class_apply()
// successfully loaded
redo = true;
setMinibuffer(lv_, _("Converting document to new document class..."));
CutAndPaste cap;
int ret = cap.SwitchLayoutsBetweenClasses(
int ret = CutAndPaste::SwitchLayoutsBetweenClasses(
params.textclass, new_class,
lv_->buffer()->paragraph);
if (ret) {

View File

@ -1,3 +1,8 @@
2001-07-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insettext.C (localDispatch): call CutAndPaste::'s static method
directly.
2001-07-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* insetbib.C: no meed to include forms.h here.

View File

@ -993,9 +993,8 @@ InsetText::localDispatch(BufferView * bv,
}
case LFUN_PASTE:
if (!autoBreakRows) {
CutAndPaste cap;
if (cap.nrOfParagraphs() > 1) {
if (CutAndPaste::nrOfParagraphs() > 1) {
WriteAlert(_("Impossible operation"),
_("Cannot include more than one paragraph!"),
_("Sorry."));

View File

@ -1708,22 +1708,20 @@ void LyXText::cutSelection(BufferView * bview, bool doclear)
selection.start.par()->previous(),
undoendpar);
CutAndPaste cap;
// there are two cases: cut only within one paragraph or
// more than one paragraph
if (selection.start.par() == selection.end.par()) {
// only within one paragraph
endpar = selection.end.par();
int pos = selection.end.pos();
cap.cutSelection(selection.start.par(), &endpar,
CutAndPaste::cutSelection(selection.start.par(), &endpar,
selection.start.pos(), pos,
bview->buffer()->params.textclass, doclear);
selection.end.pos(pos);
} else {
endpar = selection.end.par();
int pos = selection.end.pos();
cap.cutSelection(selection.start.par(), &endpar,
CutAndPaste::cutSelection(selection.start.par(), &endpar,
selection.start.pos(), pos,
bview->buffer()->params.textclass, doclear);
cursor.par(endpar);
@ -1778,9 +1776,7 @@ void LyXText::copySelection(BufferView * bview)
|| selection.start.pos() < selection.end.pos()))
selection.start.pos(selection.start.pos() + 1);
CutAndPaste cap;
cap.copySelection(selection.start.par(), selection.end.par(),
CutAndPaste::copySelection(selection.start.par(), selection.end.par(),
selection.start.pos(), selection.end.pos(),
bview->buffer()->params.textclass);
}
@ -1788,10 +1784,8 @@ void LyXText::copySelection(BufferView * bview)
void LyXText::pasteSelection(BufferView * bview)
{
CutAndPaste cap;
// this does not make sense, if there is nothing to paste
if (!cap.checkPastePossible(cursor.par()))
if (!CutAndPaste::checkPastePossible(cursor.par()))
return;
setUndo(bview->buffer(), Undo::INSERT,
@ -1802,7 +1796,7 @@ void LyXText::pasteSelection(BufferView * bview)
Paragraph * actpar = cursor.par();
int pos = cursor.pos();
cap.pasteSelection(&actpar, &endpar, pos,
CutAndPaste::pasteSelection(&actpar, &endpar, pos,
bview->buffer()->params.textclass);
redoParagraphs(bview, cursor, endpar);