move pasteParagraph to global scope

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5062 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-08-21 17:35:24 +00:00
parent 78dc5c62c7
commit fd1a4f75e8
10 changed files with 50 additions and 70 deletions

View File

@ -1,3 +1,12 @@
2002-08-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* text.C (backspace): pasteParagraph now in global scipe
* CutAndPaste.C (cutSelection): pasteParagraph now in global scope
(pasteSelection): ditto
* paragraph.[Ch] (pasteParagraph): move function to global scope ...
* paragraph_funcs.C (pasteParagraph): ... here
2002-08-20 André Pönitz <poenitz@gmx.net>
@ -8,7 +17,7 @@
2002-08-21 Lars Gullik Bjønnes <larsbj@gullik.net>
* tabular.C:
* tabular.C:
* buffer.[Ch]: remove NO_COMPABILITY stuff
2002-08-20 Lars Gullik Bjønnes <larsbj@gullik.net>

View File

@ -149,7 +149,7 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar,
startpar->next()->stripLeadingSpaces();
if (startpar->hasSameLayout(startpar->next()) ||
startpar->next()->empty()) {
startpar->pasteParagraph(current_view->buffer()->params);
pasteParagraph(current_view->buffer()->params, startpar);
(*endpar) = startpar; // this because endpar gets deleted here!
}
// this paragraph's are of noone's owner!
@ -365,20 +365,20 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar,
if ((*par)->next() == lastbuffer)
lastbuffer = *par;
(*par)->pasteParagraph(current_view->buffer()->params);
pasteParagraph(current_view->buffer()->params, *par);
// store the new cursor position
*par = lastbuffer;
pos = lastbuffer->size();
// maybe some pasting
if (lastbuffer->next() && paste_the_end) {
if (lastbuffer->next()->hasSameLayout(lastbuffer)) {
lastbuffer->pasteParagraph(current_view->buffer()->params);
pasteParagraph(current_view->buffer()->params, lastbuffer);
} else if (lastbuffer->next()->empty()) {
lastbuffer->next()->makeSameLayout(lastbuffer);
lastbuffer->pasteParagraph(current_view->buffer()->params);
pasteParagraph(current_view->buffer()->params, lastbuffer);
} else if (lastbuffer->empty()) {
lastbuffer->makeSameLayout(lastbuffer->next());
lastbuffer->pasteParagraph(current_view->buffer()->params);
pasteParagraph(current_view->buffer()->params, lastbuffer);
} else
lastbuffer->next()->stripLeadingSpaces();
}

View File

@ -1,3 +1,9 @@
2002-08-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insettext.C (collapseParagraphs): pasteParagraph now in global
scope
(appendParagraphs): ditto
2002-08-21 Dekel Tsur <dekelts@tau.ac.il>
* insetcite.C (latex): Remove spaces only after commmas.

View File

@ -37,6 +37,7 @@
#include "trans_mgr.h"
#include "undo_funcs.h"
#include "WordLangTuple.h"
#include "paragraph_funcs.h"
#include "frontends/Alert.h"
#include "frontends/Dialogs.h"
@ -2729,7 +2730,7 @@ void InsetText::collapseParagraphs(BufferView * bv) const
llt->selection.end.pos() + paragraphs.begin()->size());
}
}
paragraphs.begin()->pasteParagraph(bparams);
pasteParagraph(bparams, &*paragraphs.begin());
}
reinitLyXText();
}
@ -2771,7 +2772,7 @@ void InsetText::appendParagraphs(BufferParams const & bparams,
// paste it!
lastbuffer->next(buf);
buf->previous(lastbuffer);
lastbuffer->pasteParagraph(bparams);
pasteParagraph(bparams, lastbuffer);
reinitLyXText();
}

View File

@ -765,37 +765,6 @@ bool Paragraph::hasSameLayout(Paragraph const * par) const
}
// Be carefull, this does not make any check at all.
// This method has wrong name, it combined this par with the next par.
// In that sense it is the reverse of break paragraph. (Lgb)
void Paragraph::pasteParagraph(BufferParams const & bparams)
{
// copy the next paragraph to this one
Paragraph * the_next = next();
// first the DTP-stuff
params().lineBottom(the_next->params().lineBottom());
params().spaceBottom(the_next->params().spaceBottom());
params().pagebreakBottom(the_next->params().pagebreakBottom());
pos_type pos_end = the_next->pimpl_->size() - 1;
pos_type pos_insert = size();
// ok, now copy the paragraph
for (pos_type i = 0, j = 0; i <= pos_end; ++i) {
the_next->cutIntoMinibuffer(bparams, i);
if (insertFromMinibuffer(pos_insert + j))
++j;
}
// delete the next paragraph
Paragraph * ppar = the_next->previous_;
Paragraph * npar = the_next->next_;
delete the_next;
ppar->next(npar);
}
int Paragraph::getEndLabel() const
{
Paragraph const * par = this;

View File

@ -273,11 +273,6 @@ public:
///
bool isWord(lyx::pos_type pos) const;
/** paste this paragraph with the next one
be carefull, this doesent make any check at all
*/
void pasteParagraph(BufferParams const &);
/// returns -1 if inset not found
int getPositionOfInset(Inset const * inset) const;

View File

@ -1,10 +1,10 @@
/* This file is part of
* ======================================================
*
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
* Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
@ -33,10 +33,10 @@ void breakParagraph(BufferParams const & bparams,
tmp->layout(bparams.getLyXTextClass().defaultLayout());
// remember to set the inset_owner
tmp->setInsetOwner(par->inInset());
// this is an idea for a more userfriendly layout handling, I will
// see what the users say
// layout stays the same with latex-environments
if (flag) {
tmp->layout(par->layout());
@ -44,22 +44,22 @@ void breakParagraph(BufferParams const & bparams,
}
bool isempty = (par->layout()->keepempty && par->empty());
if (!isempty && (par->size() > pos || par->empty() || flag == 2)) {
tmp->layout(par->layout());
tmp->params().align(par->params().align());
tmp->setLabelWidthString(par->params().labelWidthString());
tmp->params().lineBottom(par->params().lineBottom());
par->params().lineBottom(false);
tmp->params().pagebreakBottom(par->params().pagebreakBottom());
par->params().pagebreakBottom(false);
tmp->params().spaceBottom(par->params().spaceBottom());
par->params().spaceBottom(VSpace(VSpace::NONE));
tmp->params().depth(par->params().depth());
tmp->params().noindent(par->params().noindent());
// copy everything behind the break-position
// to the new paragraph
pos_type pos_end = par->size() - 1;
@ -74,7 +74,7 @@ void breakParagraph(BufferParams const & bparams,
par->erase(i);
}
}
// just an idea of me
if (!pos) {
tmp->params().lineTop(par->params().lineTop());
@ -86,7 +86,7 @@ void breakParagraph(BufferParams const & bparams,
par->params().clear();
par->layout(bparams.getLyXTextClass().defaultLayout());
// layout stays the same with latex-environments
if (flag) {
par->layout(tmp->layout());
@ -117,7 +117,7 @@ void breakParagraphConservative(BufferParams const & bparams,
if (tmp->insertFromMinibuffer(j - pos))
++j;
}
for (pos_type k = pos_end; k >= pos; --k) {
par->erase(k);
}
@ -125,7 +125,6 @@ void breakParagraphConservative(BufferParams const & bparams,
}
#if 0
// Be carefull, this does not make any check at all.
// This method has wrong name, it combined this par with the next par.
// In that sense it is the reverse of break paragraph. (Lgb)
@ -158,6 +157,7 @@ void pasteParagraph(BufferParams const & bparams,
}
#if 0
Paragraph * depthHook(Paragraph * par, Paragraph::depth_type depth)
{
Paragraph * newpar = par;
@ -176,7 +176,7 @@ Paragraph * depthHook(Paragraph * par, Paragraph::depth_type depth)
}
Paragraph * outerHook(Paragraph * par)
Paragraph * outerHook(Paragraph * par)
{
if (!par->getDepth())
return 0;

View File

@ -1,11 +1,11 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
* Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
@ -30,14 +30,14 @@ void breakParagraphConservative(BufferParams const & bparams,
Paragraph *,
lyx::pos_type pos);
#if 0
/** Paste this paragraph with the next one.
Be carefull, this doesent make any check at all.
*/
*/
void pasteParagraph(BufferParams const & bparams,
Paragraph *);
#if 0
/// for the environments
Paragraph * depthHook(Paragraph * par, Paragraph::depth_type depth);

View File

@ -2796,7 +2796,7 @@ void LyXText::backspace(BufferView * bview)
&& cursor.par()->getAlign() == tmppar->getAlign()) {
removeParagraph(tmprow);
removeRow(tmprow);
cursor.par()->pasteParagraph(bview->buffer()->params);
pasteParagraph(bview->buffer()->params, cursor.par());
if (!cursor.pos() || !cursor.par()->isSeparator(cursor.pos() - 1))
; //cursor.par()->insertChar(cursor.pos(), ' ');

View File

@ -382,8 +382,8 @@ void LyXText::removeParagraph(Row * row) const
void LyXText::insertParagraph(BufferView * bview, Paragraph * par,
Row * row) const
{
// insert a new row, starting at position 0
insertRow(row, par, 0);
// insert a new row, starting at position 0
insertRow(row, par, 0);
// set the counters
setCounter(bview->buffer(), par);
@ -1362,7 +1362,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
s = o.str();
} else {
// par->SetLayout(0);
// s = layout->labelstring;
// s = layout->labelstring;
s = (par->getParLanguage(buf->params)->lang() == "hebrew")
? " :úåòîùî øñç" : "Senseless: ";
}
@ -1370,7 +1370,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
par->params().labelString(s);
// reset the enumeration counter. They are always resetted
// when there is any other layout between
// when there is any other layout between
for (int i = par->enumdepth + 1; i < 4; i++) {
buf->counters().set(buf->counters().enums[i], 0);
}