Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 7736 → Rev 7735

/branches/Version13x/Scribus/scribus/scribusview.cpp
1793,7 → 1793,7
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx;
double ny = gy;
if (!Doc->ApplyGuides(&nx, &ny))
if (!ApplyGuides(&nx, &ny))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
1805,7 → 1805,7
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
nx = gx+gw;
ny = gy+gh;
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
moveGroup(nx-(gx+gw), ny-(gy+gh), false);
Doc->m_Selection->setGroupRect();
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
1828,7 → 1828,7
{
double nx = currItem->xPos();
double ny = currItem->yPos();
if (!Doc->ApplyGuides(&nx, &ny))
if (!ApplyGuides(&nx, &ny))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
1835,7 → 1835,7
nx = npx.x();
ny = npx.y();
}
Doc->MoveItem(nx-currItem->xPos(), ny-currItem->yPos(), currItem);
MoveItem(nx-currItem->xPos(), ny-currItem->yPos(), currItem);
}
}
updateContents();
2200,9 → 2200,9
currItem->setXYPos(tp2.x(), tp2.y(), true);
currItem->PoLine.translate(-tp2.x(), -tp2.y());
FPoint tp(getMaxClipF(&currItem->PoLine));
Doc->SizeItem(tp.x(), tp.y(), currItem->ItemNr, false, false, false);
SizeItem(tp.x(), tp.y(), currItem->ItemNr, false, false, false);
currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
Doc->m_Selection->clear();
Doc->m_Selection->addItem(currItem);
currItem->ClipEdited = true;
2297,7 → 2297,7
currItem->OldH2 = currItem->height();
double nx = m->x()/Scale + Doc->minCanvasCoordinate.x();
double ny = m->y()/Scale + Doc->minCanvasCoordinate.y();
if (!Doc->ApplyGuides(&nx, &ny))
if (!ApplyGuides(&nx, &ny))
{
FPoint npg(ApplyGridF(FPoint(nx, ny)));
nx = npg.x();
2306,7 → 2306,7
FPoint np(nx, ny, currItem->xPos(), currItem->yPos(), currItem->rotation(), 1, 1, true);
MoveClipPoint(currItem, np);
}
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
emit DocChanged();
updateContents();
operItemMoving = false;
2341,7 → 2341,7
}
}
 
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
emit DocChanged();
updateContents();
if (oldClip)
2960,15 → 2960,15
currItem->PoLine.putPoints(currItem->PoLine.size(), 2, np.x(), np.y(), np.x(), np.y());
FPoint tp2(getMinClipF(&currItem->PoLine));
if ((tp2.x() > -1) || (tp2.y() > -1))
Doc->SizeItem(currItem->width() - tp2.x(), currItem->height() - tp2.y(), currItem->ItemNr, false, false, false);
SizeItem(currItem->width() - tp2.x(), currItem->height() - tp2.y(), currItem->ItemNr, false, false, false);
FPoint tp(getMaxClipF(&currItem->PoLine));
Doc->SizeItem(tp.x(), tp.y(), currItem->ItemNr, false, false, false);
SizeItem(tp.x(), tp.y(), currItem->ItemNr, false, false, false);
currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
}
else
{
Doc->SizeItem(xSize, ySize, currItem->ItemNr, false, false, false);
SizeItem(xSize, ySize, currItem->ItemNr, false, false, false);
currItem->updateClip();
}
currItem->ContourLine = currItem->PoLine.copy();
2978,21 → 2978,21
break;
case 1:
if (lmode == 0)
Doc->MoveItem(-currItem->width(), 0.0, currItem, false);
MoveItem(-currItem->width(), 0.0, currItem, false);
else
Doc->MoveRotated(currItem, FPoint(-currItem->width() / 2.0, 0.0), false);
MoveRotated(currItem, FPoint(-currItem->width() / 2.0, 0.0), false);
break;
case 2:
if (lmode == 0)
Doc->MoveItem(-currItem->width() / 2.0, -currItem->height() / 2.0, currItem, false);
MoveItem(-currItem->width() / 2.0, -currItem->height() / 2.0, currItem, false);
else
Doc->MoveRotated(currItem, FPoint(-currItem->width(), 0.0), false);
MoveRotated(currItem, FPoint(-currItem->width(), 0.0), false);
break;
case 3:
Doc->MoveItem(0.0, -currItem->height(), currItem, false);
MoveItem(0.0, -currItem->height(), currItem, false);
break;
case 4:
Doc->MoveItem(-currItem->width(), -currItem->height(), currItem, false);
MoveItem(-currItem->width(), -currItem->height(), currItem, false);
break;
}
Doc->setRedrawBounding(currItem);
3089,12 → 3089,12
FPoint tp2(getMinClipF(&currItem->PoLine));
if ((tp2.x() > -1) || (tp2.y() > -1))
{
Doc->SizeItem(currItem->width() - tp2.x(), currItem->height() - tp2.y(), currItem->ItemNr, false, false, false);
SizeItem(currItem->width() - tp2.x(), currItem->height() - tp2.y(), currItem->ItemNr, false, false, false);
}
FPoint tp(getMaxClipF(&currItem->PoLine));
Doc->SizeItem(tp.x(), tp.y(), currItem->ItemNr, false, false, false);
SizeItem(tp.x(), tp.y(), currItem->ItemNr, false, false, false);
currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
currItem->ContourLine = currItem->PoLine.copy();
Doc->setRedrawBounding(currItem);
currItem->OwnPage = Doc->OnPage(currItem);
3122,7 → 3122,7
np2 = QPoint(qRound(newXF), qRound(newYF));
nx = np2.x();
ny = np2.y();
if (!Doc->ApplyGuides(&nx, &ny))
if (!ApplyGuides(&nx, &ny))
{
np2 = Doc->ApplyGrid(np2);
nx = np2.x();
3193,13 → 3193,13
double ny = translateToDoc(m->x(), m->y()).y();
if (Doc->SnapGuides)
{
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
npx = FPoint(nx, ny, currItem->xPos(), currItem->yPos(), currItem->rotation(), 1, 1, true);
}
else
npx = Doc->ApplyGridF(FPoint(nx, ny, currItem->xPos(), currItem->yPos(), currItem->rotation(), 1, 1, true));
if ((frameResizeHandle == 1) && !(currItem->asLine()) && (Doc->SnapGuides))
Doc->SizeItem(npx.x(), npx.y(), currItem->ItemNr);
SizeItem(npx.x(), npx.y(), currItem->ItemNr);
bool sav = Doc->SnapGuides;
Doc->SnapGuides = false;
if (UndoManager::undoEnabled())
3232,21 → 3232,21
bb2 = bb;
while (bb2->BottomLink != 0)
{
Doc->MoveRotated(bb2->BottomLink, FPoint(0, dist));
MoveRotated(bb2->BottomLink, FPoint(0, dist));
bb2 = bb2->BottomLink;
}
if (bb != currItem)
Doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
bb = bb->RightLink;
}
bb2 = bb;
while (bb2->BottomLink != 0)
{
Doc->MoveRotated(bb2->BottomLink, FPoint(0, dist));
MoveRotated(bb2->BottomLink, FPoint(0, dist));
bb2 = bb2->BottomLink;
}
if (bb != currItem)
Doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
bb = currItem;
if (currItem->TopLink != 0)
dist = npx.x() - currItem->TopLink->width();
3263,21 → 3263,21
bb2 = bb;
while (bb2->RightLink != 0)
{
Doc->MoveRotated(bb2->RightLink, FPoint(dist, 0));
MoveRotated(bb2->RightLink, FPoint(dist, 0));
bb2 = bb2->RightLink;
}
if (bb != currItem)
Doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
bb = bb->BottomLink;
}
bb2 = bb;
while (bb2->RightLink != 0)
{
Doc->MoveRotated(bb2->RightLink, FPoint(dist, 0));
MoveRotated(bb2->RightLink, FPoint(dist, 0));
bb2 = bb2->RightLink;
}
if (bb != currItem)
Doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
}
//<<Swap location if width/height is <0
if (currItem->width()<0)
3309,12 → 3309,12
ny = ra.y();
}
Doc->SnapGuides = sav;
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
Doc->SnapGuides = false;
double r = atan2(ny - currItem->yPos(), nx - currItem->xPos())*(180.0/M_PI);
Doc->RotateItem(r, currItem->ItemNr);
RotateItem(r, currItem->ItemNr);
double w = sqrt(pow(nx - currItem->xPos(), 2) + pow(ny - currItem->yPos(),2));
Doc->SizeItem(w, currItem->height(), currItem->ItemNr, true);
SizeItem(w, currItem->height(), currItem->ItemNr, true);
}
}
currItem->Sizing = false;
3335,19 → 3335,19
bb2 = bb;
while (bb2->LeftLink != 0)
{
Doc->MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
bb2 = bb2->LeftLink;
}
Doc->MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
bb = bb->BottomLink;
}
bb2 = bb;
while (bb2->LeftLink != 0)
{
Doc->MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
bb2 = bb2->LeftLink;
}
Doc->MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
bb = currItem;
while (bb->LeftLink != 0)
{
3358,22 → 3358,22
bb2 = bb;
while (bb2->TopLink != 0)
{
Doc->MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
bb2 = bb2->TopLink;
}
Doc->MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
bb = bb->RightLink;
}
bb2 = bb;
while (bb2->TopLink != 0)
{
Doc->MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
bb2 = bb2->TopLink;
}
Doc->MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
}
else
Doc->MoveSizeItem(npx, npx, currItem->ItemNr);
MoveSizeItem(npx, npx, currItem->ItemNr);
//<<Swap location if width/height is <0
if (currItem->width()<0)
3413,7 → 3413,7
ny = ra.y();
}
Doc->SnapGuides = sav;
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
Doc->SnapGuides = false;
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
3422,9 → 3422,9
double my = ma.m22() * currItem->height() + ma.m12() * currItem->width() + ma.dy();
double r = atan2(my-ny,mx-nx)*(180.0/M_PI);
double w = sqrt(pow(mx-nx,2)+pow(my-ny,2));
Doc->MoveItem(nx - currItem->xPos(), ny - currItem->yPos(), currItem, true);
Doc->SizeItem(w, currItem->height(), currItem->ItemNr, true);
Doc->RotateItem(r, currItem->ItemNr);
MoveItem(nx - currItem->xPos(), ny - currItem->yPos(), currItem, true);
SizeItem(w, currItem->height(), currItem->ItemNr, true);
RotateItem(r, currItem->ItemNr);
currItem->Sizing = false;
}
}
3444,19 → 3444,19
bb2 = bb;
while (bb2->RightLink != 0)
{
Doc->MoveRotated(bb2->RightLink, FPoint(dist, 0));
MoveRotated(bb2->RightLink, FPoint(dist, 0));
bb2 = bb2->RightLink;
}
Doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
bb = bb->BottomLink;
}
bb2 = bb;
while (bb2->RightLink != 0)
{
Doc->MoveRotated(bb2->RightLink, FPoint(dist, 0));
MoveRotated(bb2->RightLink, FPoint(dist, 0));
bb2 = bb2->RightLink;
}
Doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
bb = currItem;
while (bb->LeftLink != 0)
{
3467,22 → 3467,22
bb2 = bb;
while (bb2->TopLink != 0)
{
Doc->MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
bb2 = bb2->TopLink;
}
Doc->MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
bb = bb->RightLink;
}
bb2 = bb;
while (bb2->TopLink != 0)
{
Doc->MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
bb2 = bb2->TopLink;
}
Doc->MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
}
else
Doc->MoveSizeItem(FPoint(0, npx.y()), FPoint(currItem->width() - npx.x(), npx.y()), currItem->ItemNr);
MoveSizeItem(FPoint(0, npx.y()), FPoint(currItem->width() - npx.x(), npx.y()), currItem->ItemNr);
//<<Swap location if width/height is <0
if (currItem->width()<0)
3519,19 → 3519,19
bb2 = bb;
while (bb2->BottomLink != 0)
{
Doc->MoveRotated(bb2->BottomLink, FPoint(0, dist));
MoveRotated(bb2->BottomLink, FPoint(0, dist));
bb2 = bb2->BottomLink;
}
Doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
bb = bb->RightLink;
}
bb2 = bb;
while (bb2->BottomLink != 0)
{
Doc->MoveRotated(bb2->BottomLink, FPoint(0, dist));
MoveRotated(bb2->BottomLink, FPoint(0, dist));
bb2 = bb2->BottomLink;
}
Doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
bb = currItem;
while (bb->TopLink != 0)
{
3542,22 → 3542,22
bb2 = bb;
while (bb2->LeftLink != 0)
{
Doc->MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
bb2 = bb2->LeftLink;
}
Doc->MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
bb = bb->BottomLink;
}
bb2 = bb;
while (bb2->LeftLink != 0)
{
Doc->MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
bb2 = bb2->LeftLink;
}
Doc->MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
}
else
Doc->MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), currItem->height() - npx.y()), currItem->ItemNr);
MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), currItem->height() - npx.y()), currItem->ItemNr);
//<<Swap location if width/height is <0
if (currItem->width()<0)
3593,22 → 3593,22
bb2 = bb;
while (bb2->BottomLink != 0)
{
Doc->MoveRotated(bb2->BottomLink, FPoint(0, dist));
MoveRotated(bb2->BottomLink, FPoint(0, dist));
bb2 = bb2->BottomLink;
}
Doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
bb = bb->RightLink;
}
bb2 = bb;
while (bb2->BottomLink != 0)
{
Doc->MoveRotated(bb2->BottomLink, FPoint(0, dist));
MoveRotated(bb2->BottomLink, FPoint(0, dist));
bb2 = bb2->BottomLink;
}
Doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr);
}
else
Doc->MoveSizeItem(FPoint(0, 0), FPoint(0, currItem->height() - npx.y()), currItem->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(0, currItem->height() - npx.y()), currItem->ItemNr);
if (currItem->imageFlippedV())
currItem->moveImageInFrame(0, -(currItem->height() - currItem->OldH2)/currItem->imageYScale());
3642,22 → 3642,22
bb2 = bb;
while (bb2->RightLink != 0)
{
Doc->MoveRotated(bb2->RightLink, FPoint(dist, 0));
MoveRotated(bb2->RightLink, FPoint(dist, 0));
bb2 = bb2->RightLink;
}
Doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
bb = bb->BottomLink;
}
bb2 = bb;
while (bb2->RightLink != 0)
{
Doc->MoveRotated(bb2->RightLink, FPoint(dist, 0));
MoveRotated(bb2->RightLink, FPoint(dist, 0));
bb2 = bb2->RightLink;
}
Doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr);
}
else
Doc->MoveSizeItem(FPoint(0, 0), FPoint(currItem->width() - npx.x(), 0), currItem->ItemNr);
MoveSizeItem(FPoint(0, 0), FPoint(currItem->width() - npx.x(), 0), currItem->ItemNr);
if (currItem->imageFlippedH())
currItem->moveImageInFrame(-(currItem->width() - currItem->OldB2)/currItem->imageXScale(), 0);
3690,22 → 3690,22
bb2 = bb;
while (bb2->LeftLink != 0)
{
Doc->MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
bb2 = bb2->LeftLink;
}
Doc->MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
bb = bb->BottomLink;
}
bb2 = bb;
while (bb2->LeftLink != 0)
{
Doc->MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
MoveRotated(bb2->LeftLink, FPoint(npx.x(), 0));
bb2 = bb2->LeftLink;
}
Doc->MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), bb->ItemNr);
}
else
Doc->MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), currItem->ItemNr);
MoveSizeItem(FPoint(npx.x(), 0), FPoint(npx.x(), 0), currItem->ItemNr);
//<<Swap location if width/height is <0
if (currItem->width()<0)
3740,22 → 3740,22
bb2 = bb;
while (bb2->TopLink != 0)
{
Doc->MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
bb2 = bb2->TopLink;
}
Doc->MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
bb = bb->RightLink;
}
bb2 = bb;
while (bb2->TopLink != 0)
{
Doc->MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
MoveRotated(bb2->TopLink, FPoint(0, npx.y()));
bb2 = bb2->TopLink;
}
Doc->MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), bb->ItemNr);
}
else
Doc->MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), currItem->ItemNr);
MoveSizeItem(FPoint(0, npx.y()), FPoint(0, npx.y()), currItem->ItemNr);
//<<Swap location if width/height is <0
if (currItem->width()<0)
3855,7 → 3855,7
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx;
double ny = gy;
if (!Doc->ApplyGuides(&nx, &ny))
if (!ApplyGuides(&nx, &ny))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
3867,7 → 3867,7
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
nx = gx+gw;
ny = gy+gh;
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
moveGroup(nx-(gx+gw), ny-(gy+gh), false);
Doc->m_Selection->setGroupRect();
}
3885,7 → 3885,7
{
double nx = currItem->xPos();
double ny = currItem->yPos();
if (!Doc->ApplyGuides(&nx, &ny))
if (!ApplyGuides(&nx, &ny))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
3892,10 → 3892,10
nx = npx.x();
ny = npx.y();
}
Doc->MoveItem(nx-currItem->xPos(), ny-currItem->yPos(), currItem);
MoveItem(nx-currItem->xPos(), ny-currItem->yPos(), currItem);
}
else
Doc->MoveItem(0, 0, currItem, false);
MoveItem(0, 0, currItem, false);
}
operItemMoving = false;
if (Doc->m_Selection->isMultipleSelection())
4142,12 → 4142,12
if (np2.x() < 0)
{
currItem->PoLine.translate(-np2.x(), 0);
Doc->MoveItem(np2.x(), 0, currItem);
MoveItem(np2.x(), 0, currItem);
}
if (np2.y() < 0)
{
currItem->PoLine.translate(0, -np2.y());
Doc->MoveItem(0, np2.y(), currItem);
MoveItem(0, np2.y(), currItem);
}
if (FirstPoly)
{
4156,9 → 4156,9
}
else
{
Doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false, false);
SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false, false);
currItem->setPolyClip(qRound(QMAX(currItem->lineWidth() / 2, 1)));
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
currItem->Sizing = ssiz;
currItem->ContourLine = currItem->PoLine.copy();
RefreshItem(currItem);
4180,9 → 4180,9
}
else
{
Doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false);
SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false);
currItem->setPolyClip(qRound(QMAX(currItem->lineWidth() / 2.0, 1)));
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
currItem->ContourLine = currItem->PoLine.copy();
}
}
4443,7 → 4443,7
if (Doc->m_Selection->isMultipleSelection())
RotateGroup(newW-oldW);
else
Doc->RotateItem(newW, currItem->ItemNr);
RotateItem(newW, currItem->ItemNr);
}
else
{
4450,7 → 4450,7
if (Doc->m_Selection->isMultipleSelection())
RotateGroup(newW - oldW);
else
Doc->RotateItem(currItem->rotation() - (oldW - newW), currItem->ItemNr);
RotateItem(currItem->rotation() - (oldW - newW), currItem->ItemNr);
}
oldW = newW;
emit DocChanged();
4702,7 → 4702,7
np2 = Doc->ApplyGrid(np2);
double nx = np2.x();
double ny = np2.y();
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
np2 = QPoint(qRound(nx*sc), qRound(ny*sc));
p.begin(viewport());
ToView(&p);
4716,7 → 4716,7
np2 = Doc->ApplyGrid(np2);
nx = np2.x();
ny = np2.y();
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
np2 = QPoint(qRound(nx*sc), qRound(ny*sc));
PaintSizeRect(&p, QRect(QPoint(qRound(gx*sc), qRound(gy*sc)), np2));
break;
4804,14 → 4804,14
{
nx += currItem->xPos();
ny += currItem->yPos();
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
nx -= currItem->xPos();
ny -= currItem->yPos();
}
if ((m->state() & ControlButton) || ((m->state() & ShiftButton)))
erf = Doc->SizeItem(nx, nh, currItem->ItemNr);
erf = SizeItem(nx, nh, currItem->ItemNr);
else
erf = Doc->SizeItem(nx, ny, currItem->ItemNr);
erf = SizeItem(nx, ny, currItem->ItemNr);
}
else
{
4834,7 → 4834,7
}
currItem->setRotation(rba);
np = Doc->ApplyGrid(np);
erf = Doc->SizeItem(sizeItemX, sizeItemY, currItem->ItemNr);
erf = SizeItem(sizeItemX, sizeItemY, currItem->ItemNr);
if (Doc->SnapGuides)
{
p.begin(viewport());
4855,7 → 4855,7
double sav = Doc->SnapGuides;
npf2 = FPoint(newX-Mxp, newY-Myp);
//Constrain rotation on left point move, disabled for now in movesizeitem
erf = Doc->MoveSizeItem(npf2, FPoint(0, 0), currItem->ItemNr, false, (m->state() & ControlButton));
erf = MoveSizeItem(npf2, FPoint(0, 0), currItem->ItemNr, false, (m->state() & ControlButton));
Doc->SnapGuides = sav;
if (sav)
currItem->Sizing = true;
4869,7 → 4869,7
np2 = Doc->ApplyGrid(np2);
double nx = np2.x();
double ny = np2.y();
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
p.translate(static_cast<int>(currItem->xPos()), static_cast<int>(currItem->yPos()));
p.rotate(currItem->rotation());
np2 = p.xFormDev(QPoint(qRound(nx), qRound(ny)));
4890,7 → 4890,7
np2 = Doc->ApplyGrid(np2);
double nx = np2.x();
double ny = np2.y();
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
p.translate(static_cast<int>(currItem->xPos() - Doc->minCanvasCoordinate.x()), static_cast<int>(currItem->yPos() - Doc->minCanvasCoordinate.y()));
p.rotate(currItem->rotation());
np2 = p.xFormDev(QPoint(qRound(nx), qRound(ny)));
4971,11 → 4971,11
{
double nx = currItem->xPos();
double ny = currItem->yPos();
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
moveGroup(nx-currItem->xPos(), ny-currItem->yPos(), false);
nx = currItem->xPos()+currItem->width();
ny = currItem->yPos()+currItem->height();
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
moveGroup(nx-(currItem->xPos()+currItem->width()), ny-(currItem->yPos()+currItem->height()), false);
}
}
5007,13 → 5007,13
{
double nx = gx;
double ny = gy;
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
moveGroup(nx-gx, ny-gy, false);
Doc->m_Selection->setGroupRect();
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
nx = gx+gw;
ny = gy+gh;
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
moveGroup(nx-(gx+gw), ny-(gy+gh), false);
}
Doc->m_Selection->setGroupRect();
5500,7 → 5500,7
bb->PoLine.putPoints(0, Clip.size()-EndInd-4, Clip, EndInd+4);
}
bb->setRotation(currItem->rotation());
Doc->AdjustItemSize(bb);
AdjustItemSize(bb);
bb->ClipEdited = true;
PageItem *bx = Doc->Items->take(bb->ItemNr);
Doc->Items->insert(bb->ItemNr-1, bx);
5528,7 → 5528,7
else
bb->PoLine.putPoints(0, Clip.size()-(ClRe+2), Clip, ClRe+2);
bb->setRotation(currItem->rotation());
Doc->AdjustItemSize(bb);
AdjustItemSize(bb);
bb->ClipEdited = true;
cli.resize(0);
cli.putPoints(0, ClRe+2, Clip);
5618,7 → 5618,7
currItem->FrameType = 3;
if (!currItem->asPolyLine())
currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
updateContents();
if (EditContour)
MarkClip(currItem, currItem->ContourLine, true);
6238,14 → 6238,14
if (npf2.x() < 0)
{
currItem->PoLine.translate(-npf2.x(), 0);
Doc->MoveItem(npf2.x(), 0, currItem);
MoveItem(npf2.x(), 0, currItem);
}
if (npf2.y() < 0)
{
currItem->PoLine.translate(0, -npf2.y());
Doc->MoveItem(0, npf2.y(), currItem);
MoveItem(0, npf2.y(), currItem);
}
Doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false, false);
SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false, false);
currItem->setPolyClip(qRound(QMAX(currItem->lineWidth() / 2, 1)));
currItem->paintObj();
break;
6355,165 → 6355,165
}
}
 
// void ScribusView::getClosestGuides(double xin, double yin, double *xout, double *yout)
// {
// GxM = -1;
// GyM = -1;
// QMap<double, uint> tmpGuidesSel;
// Guides tmpGuides = Doc->currentPage()->guides.horizontals(GuideManagerCore::Standard);
// Guides::iterator it;
// uint yg = 0;
// uint xg = 0;
// for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
// {
// if (((*it)+Doc->currentPage()->yOffset()< (yin+Doc->guidesSettings.guideRad / scale())) && ((*it)+Doc->currentPage()->yOffset()> (yin-Doc->guidesSettings.guideRad / scale())))
// tmpGuidesSel.insert(fabs(((*it)+Doc->currentPage()->yOffset()) - yin), yg);
// }
// if (tmpGuidesSel.count() != 0)
// {
// GyM = tmpGuidesSel.begin().data();
// *yout = tmpGuides[GyM];
// }
// tmpGuidesSel.clear();
// tmpGuides = Doc->currentPage()->guides.verticals(GuideManagerCore::Standard);
// for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
// {
// if (((*it)+Doc->currentPage()->xOffset()< (xin+Doc->guidesSettings.guideRad / scale())) && ((*it)+Doc->currentPage()->xOffset()> (xin-Doc->guidesSettings.guideRad / scale())))
// tmpGuidesSel.insert(fabs(((*it)+Doc->currentPage()->xOffset()) - xin), xg);
// }
// if (tmpGuidesSel.count() != 0)
// {
// GxM = tmpGuidesSel.begin().data();
// *xout = tmpGuides[GxM];
// }
// yg = 0;
// xg = 0;
// tmpGuidesSel.clear();
// tmpGuides = Doc->currentPage()->guides.horizontals(GuideManagerCore::Auto);
// for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
// {
// if (((*it)+Doc->currentPage()->yOffset()< (yin+Doc->guidesSettings.guideRad / scale())) && ((*it)+Doc->currentPage()->yOffset()> (yin-Doc->guidesSettings.guideRad / scale())))
// tmpGuidesSel.insert(fabs(((*it)+Doc->currentPage()->yOffset()) - yin), yg);
// }
// if (tmpGuidesSel.count() != 0)
// {
// GyM = tmpGuidesSel.begin().data();
// *yout = tmpGuides[GyM];
// }
// tmpGuidesSel.clear();
// tmpGuides = Doc->currentPage()->guides.verticals(GuideManagerCore::Auto);
// for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
// {
// if (((*it)+Doc->currentPage()->xOffset()< (xin+Doc->guidesSettings.guideRad / scale())) && ((*it)+Doc->currentPage()->xOffset()> (xin-Doc->guidesSettings.guideRad / scale())))
// tmpGuidesSel.insert(fabs(((*it)+Doc->currentPage()->xOffset()) - xin), xg);
// }
// if (tmpGuidesSel.count() != 0)
// {
// GxM = tmpGuidesSel.begin().data();
// *xout = tmpGuides[GxM];
// }
// }
void ScribusView::getClosestGuides(double xin, double yin, double *xout, double *yout)
{
GxM = -1;
GyM = -1;
QMap<double, uint> tmpGuidesSel;
Guides tmpGuides = Doc->currentPage()->guides.horizontals(GuideManagerCore::Standard);
Guides::iterator it;
uint yg = 0;
uint xg = 0;
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
{
if (((*it)+Doc->currentPage()->yOffset()< (yin+Doc->guidesSettings.guideRad / scale())) && ((*it)+Doc->currentPage()->yOffset()> (yin-Doc->guidesSettings.guideRad / scale())))
tmpGuidesSel.insert(fabs(((*it)+Doc->currentPage()->yOffset()) - yin), yg);
}
if (tmpGuidesSel.count() != 0)
{
GyM = tmpGuidesSel.begin().data();
*yout = tmpGuides[GyM];
}
tmpGuidesSel.clear();
tmpGuides = Doc->currentPage()->guides.verticals(GuideManagerCore::Standard);
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
{
if (((*it)+Doc->currentPage()->xOffset()< (xin+Doc->guidesSettings.guideRad / scale())) && ((*it)+Doc->currentPage()->xOffset()> (xin-Doc->guidesSettings.guideRad / scale())))
tmpGuidesSel.insert(fabs(((*it)+Doc->currentPage()->xOffset()) - xin), xg);
}
if (tmpGuidesSel.count() != 0)
{
GxM = tmpGuidesSel.begin().data();
*xout = tmpGuides[GxM];
}
yg = 0;
xg = 0;
tmpGuidesSel.clear();
tmpGuides = Doc->currentPage()->guides.horizontals(GuideManagerCore::Auto);
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
{
if (((*it)+Doc->currentPage()->yOffset()< (yin+Doc->guidesSettings.guideRad / scale())) && ((*it)+Doc->currentPage()->yOffset()> (yin-Doc->guidesSettings.guideRad / scale())))
tmpGuidesSel.insert(fabs(((*it)+Doc->currentPage()->yOffset()) - yin), yg);
}
if (tmpGuidesSel.count() != 0)
{
GyM = tmpGuidesSel.begin().data();
*yout = tmpGuides[GyM];
}
tmpGuidesSel.clear();
tmpGuides = Doc->currentPage()->guides.verticals(GuideManagerCore::Auto);
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
{
if (((*it)+Doc->currentPage()->xOffset()< (xin+Doc->guidesSettings.guideRad / scale())) && ((*it)+Doc->currentPage()->xOffset()> (xin-Doc->guidesSettings.guideRad / scale())))
tmpGuidesSel.insert(fabs(((*it)+Doc->currentPage()->xOffset()) - xin), xg);
}
if (tmpGuidesSel.count() != 0)
{
GxM = tmpGuidesSel.begin().data();
*xout = tmpGuides[GxM];
}
}
 
// //CB-->Doc?
// bool ScribusView::ApplyGuides(double *x, double *y)
// {
// // m_SnapCounter++;
// bool ret = false;
// double xout, yout;
// int pg = Doc->OnPage(*x, *y);
// if (pg == -1)
// return ret;
// Page* page = Doc->Pages->at(pg);
// // if ((Doc->SnapGuides) && (m_SnapCounter > 1))
// if (Doc->SnapGuides)
// {
// // m_SnapCounter = 0;
// Doc->getClosestGuides(*x, *y, &xout, &yout, &GxM, &GyM, scale());
// if (GxM != -1)
// {
// *x = xout+page->xOffset();
// ret = true;
// }
// if (GyM != -1)
// {
// *y = yout+page->yOffset();
// ret = true;
// }
// if ((page->Margins.Left+page->xOffset() < (*x+Doc->guidesSettings.guideRad / scale())) && (page->Margins.Left+page->xOffset() > (*x-Doc->guidesSettings.guideRad / scale())))
// {
// *x = page->Margins.Left+page->xOffset();
// ret = true;
// }
// if (((page->width() - page->Margins.Right)+page->xOffset() < (*x+Doc->guidesSettings.guideRad / scale())) && ((page->width() - page->Margins.Right)+page->xOffset() > (*x-Doc->guidesSettings.guideRad / scale())))
// {
// *x = page->width() - page->Margins.Right+page->xOffset();
// ret = true;
// }
// if ((page->Margins.Top+page->yOffset() < (*y+Doc->guidesSettings.guideRad / scale())) && (page->Margins.Top+page->yOffset() > (*y-Doc->guidesSettings.guideRad / scale())))
// {
// *y = page->Margins.Top+page->yOffset();
// ret = true;
// }
// if (((page->height() - page->Margins.Bottom)+page->yOffset() < (*y+Doc->guidesSettings.guideRad / scale())) && ((page->height() - page->Margins.Bottom)+page->yOffset() > (*y-Doc->guidesSettings.guideRad / scale())))
// {
// *y = page->height() - page->Margins.Bottom+page->yOffset();
// ret = true;
// }
// }
// // if (m_SnapCounter > 10)
// // m_SnapCounter = 0;
// return ret;
// }
//CB-->Doc?
bool ScribusView::ApplyGuides(double *x, double *y)
{
// m_SnapCounter++;
bool ret = false;
double xout, yout;
int pg = Doc->OnPage(*x, *y);
if (pg == -1)
return ret;
Page* page = Doc->Pages->at(pg);
// if ((Doc->SnapGuides) && (m_SnapCounter > 1))
if (Doc->SnapGuides)
{
// m_SnapCounter = 0;
getClosestGuides(*x, *y, &xout, &yout);
if (GxM != -1)
{
*x = xout+page->xOffset();
ret = true;
}
if (GyM != -1)
{
*y = yout+page->yOffset();
ret = true;
}
if ((page->Margins.Left+page->xOffset() < (*x+Doc->guidesSettings.guideRad / scale())) && (page->Margins.Left+page->xOffset() > (*x-Doc->guidesSettings.guideRad / scale())))
{
*x = page->Margins.Left+page->xOffset();
ret = true;
}
if (((page->width() - page->Margins.Right)+page->xOffset() < (*x+Doc->guidesSettings.guideRad / scale())) && ((page->width() - page->Margins.Right)+page->xOffset() > (*x-Doc->guidesSettings.guideRad / scale())))
{
*x = page->width() - page->Margins.Right+page->xOffset();
ret = true;
}
if ((page->Margins.Top+page->yOffset() < (*y+Doc->guidesSettings.guideRad / scale())) && (page->Margins.Top+page->yOffset() > (*y-Doc->guidesSettings.guideRad / scale())))
{
*y = page->Margins.Top+page->yOffset();
ret = true;
}
if (((page->height() - page->Margins.Bottom)+page->yOffset() < (*y+Doc->guidesSettings.guideRad / scale())) && ((page->height() - page->Margins.Bottom)+page->yOffset() > (*y-Doc->guidesSettings.guideRad / scale())))
{
*y = page->height() - page->Margins.Bottom+page->yOffset();
ret = true;
}
}
// if (m_SnapCounter > 10)
// m_SnapCounter = 0;
return ret;
}
 
// //CB-->Doc
// void ScribusView::SnapToGuides(PageItem *currItem)
// {
// int pg = Doc->OnPage(currItem);
// double xout, yout;
// if (pg == -1)
// return;
// Page* page = Doc->Pages->at(pg);
//
// Doc->getClosestGuides(0, currItem->yPos(), &xout, &yout, &GxM, &GyM, scale());
// if (GyM != -1)
// currItem->setYPos(yout+page->yOffset());
// if (currItem->asLine())
// {
// QWMatrix ma;
// ma.translate(currItem->xPos(), currItem->yPos());
// ma.rotate(currItem->rotation());
// double my = ma.m22() * currItem->height() + ma.m12() * currItem->width() + ma.dy();
// Doc->getClosestGuides(0, my, &xout, &yout, &GxM, &GyM, scale());
// if (GyM != -1)
// currItem->moveBy(0.0, yout - my + page->yOffset());
// }
// else
// {
// Doc->getClosestGuides(0, currItem->yPos()+currItem->height(), &xout, &yout, &GxM, &GyM, scale());
// if (GyM != -1)
// currItem->setYPos(yout-currItem->height()+page->yOffset());
// }
// Doc->getClosestGuides(currItem->xPos(), 0, &xout, &yout, &GxM, &GyM, scale());
// if (GxM != -1)
// currItem->setXPos(xout+page->xOffset());
// if (currItem->asLine())
// {
// QWMatrix ma;
// ma.translate(currItem->xPos(), currItem->yPos());
// ma.rotate(currItem->rotation());
// double mx = ma.m11() * currItem->width() + ma.m21() * currItem->height() + ma.dx();
// Doc->getClosestGuides(mx, 0, &xout, &yout, &GxM, &GyM, scale());
// if (GxM != -1)
// currItem->moveBy(xout - mx + page->xOffset(), 0.0);
// }
// else
// {
// Doc->getClosestGuides(currItem->xPos()+currItem->width(), 0, &xout, &yout, &GxM, &GyM, scale());
// if (GxM != -1)
// currItem->setXPos(xout-currItem->width()+page->xOffset());
// }
// }
//CB-->Doc
void ScribusView::SnapToGuides(PageItem *currItem)
{
int pg = Doc->OnPage(currItem);
double xout, yout;
if (pg == -1)
return;
Page* page = Doc->Pages->at(pg);
 
getClosestGuides(0, currItem->yPos(), &xout, &yout);
if (GyM != -1)
currItem->setYPos(yout+page->yOffset());
if (currItem->asLine())
{
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
ma.rotate(currItem->rotation());
double my = ma.m22() * currItem->height() + ma.m12() * currItem->width() + ma.dy();
getClosestGuides(0, my, &xout, &yout);
if (GyM != -1)
currItem->moveBy(0.0, yout - my + page->yOffset());
}
else
{
getClosestGuides(0, currItem->yPos()+currItem->height(), &xout, &yout);
if (GyM != -1)
currItem->setYPos(yout-currItem->height()+page->yOffset());
}
getClosestGuides(currItem->xPos(), 0, &xout, &yout);
if (GxM != -1)
currItem->setXPos(xout+page->xOffset());
if (currItem->asLine())
{
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
ma.rotate(currItem->rotation());
double mx = ma.m11() * currItem->width() + ma.m21() * currItem->height() + ma.dx();
getClosestGuides(mx, 0, &xout, &yout);
if (GxM != -1)
currItem->moveBy(xout - mx + page->xOffset(), 0.0);
}
else
{
getClosestGuides(currItem->xPos()+currItem->width(), 0, &xout, &yout);
if (GxM != -1)
currItem->setXPos(xout-currItem->width()+page->xOffset());
}
}
 
// //CB-->Doc/selection
// void ScribusView::setGroupRect()
// {
6669,47 → 6669,47
updateContents(rect);
}
 
// //CB-->Doc
// bool ScribusView::MoveItem(double newX, double newY, PageItem* currItem, bool fromMP)
// {
// if (currItem->locked())
// return false;
// bool retw = false;
// double oldx = currItem->xPos();
// double oldy = currItem->yPos();
// currItem->moveBy(newX, newY);
// if ((Doc->useRaster) && (!operItemMoving) && (!fromMP) && (static_cast<int>(Doc->currentPage()->pageNr()) == currItem->OwnPage))
// {
// currItem->setXYPos(qRound(currItem->xPos() / Doc->guidesSettings.minorGrid) * Doc->guidesSettings.minorGrid, qRound(currItem->yPos() / Doc->guidesSettings.minorGrid) * Doc->guidesSettings.minorGrid);
// }
// if ((Doc->SnapGuides) && (!operItemMoving) && (Doc->appMode == modeNormal) && (!Doc->EditClip) && (!fromMP))
// Doc->SnapToGuides(currItem);
// if ((currItem->xPos() != oldx) || (currItem->yPos() != oldy))
// retw = true;
// if (!fromMP)
// {
// /* if (GroupSel)
// {
// double gx, gy, gh, gw;
// setGroupRect();
// getGroupRect(&gx, &gy, &gw, &gh);
// emit ItemPos(gx, gy);
// }
// else */
// //CB if (!GroupSel)
// //CB emit ItemPos(currItem->xPos(), currItem->yPos());
// //CB qDebug("if (!GroupSel) emit ItemPos(currItem->xPos(), currItem->yPos());");
// }
// /* if (!Doc->loading)
// emit UpdtObj(Doc->currentPage->pageNr(), b->ItemNr); */
// QRect oldR(currItem->getRedrawBounding(Scale));
// Doc->setRedrawBounding(currItem);
// QRect newR(currItem->getRedrawBounding(Scale));
// if ((!operItemMoving) && (!currItem->Sizing))
// updateContents(newR.unite(oldR));
// currItem->OwnPage = Doc->OnPage(currItem);
// return retw;
// }
//CB-->Doc
bool ScribusView::MoveItem(double newX, double newY, PageItem* currItem, bool fromMP)
{
if (currItem->locked())
return false;
bool retw = false;
double oldx = currItem->xPos();
double oldy = currItem->yPos();
currItem->moveBy(newX, newY);
if ((Doc->useRaster) && (!operItemMoving) && (!fromMP) && (static_cast<int>(Doc->currentPage()->pageNr()) == currItem->OwnPage))
{
currItem->setXYPos(qRound(currItem->xPos() / Doc->guidesSettings.minorGrid) * Doc->guidesSettings.minorGrid, qRound(currItem->yPos() / Doc->guidesSettings.minorGrid) * Doc->guidesSettings.minorGrid);
}
if ((Doc->SnapGuides) && (!operItemMoving) && (Doc->appMode == modeNormal) && (!Doc->EditClip) && (!fromMP))
SnapToGuides(currItem);
if ((currItem->xPos() != oldx) || (currItem->yPos() != oldy))
retw = true;
if (!fromMP)
{
/* if (GroupSel)
{
double gx, gy, gh, gw;
setGroupRect();
getGroupRect(&gx, &gy, &gw, &gh);
emit ItemPos(gx, gy);
}
else */
//CB if (!GroupSel)
//CB emit ItemPos(currItem->xPos(), currItem->yPos());
//CB qDebug("if (!GroupSel) emit ItemPos(currItem->xPos(), currItem->yPos());");
}
/* if (!Doc->loading)
emit UpdtObj(Doc->currentPage->pageNr(), b->ItemNr); */
QRect oldR(currItem->getRedrawBounding(Scale));
Doc->setRedrawBounding(currItem);
QRect newR(currItem->getRedrawBounding(Scale));
if ((!operItemMoving) && (!currItem->Sizing))
updateContents(newR.unite(oldR));
currItem->OwnPage = Doc->OnPage(currItem);
return retw;
}
 
void ScribusView::MarkClip(PageItem *currItem, FPointArray cli, bool once)
{
7037,7 → 7037,7
}
currItem->PoLine.map(ma);
currItem->PoLine.translate(offsX, offsY);
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
QWMatrix ma2;
ma2.translate(oldPos.x(), oldPos.y());
ma2.scale(1, 1);
7078,7 → 7078,7
}
double x = ma2.m11() * n.x() + ma2.m21() * n.y() + ma2.dx();
double y = ma2.m22() * n.y() + ma2.m12() * n.x() + ma2.dy();
Doc->MoveItem(x-oldPos.x(), y-oldPos.y(), currItem);
MoveItem(x-oldPos.x(), y-oldPos.y(), currItem);
if (currItem->asPathText())
currItem->updatePolyClip();
Doc->setRedrawBounding(currItem);
7132,7 → 7132,7
else
{
currItem->PoLine.setPoint(ClRe, np);
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
}
FPointArray cli;
if ((EditContour) && (currItem->ContourLine.size() != 0))
7203,7 → 7203,7
}
}
if (!EditContour)
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
else
{
updateContents();
7281,14 → 7281,14
{
if ((np.x() < 0) && (!EditContour))
{
Doc->SizeItem(currItem->width() - np.x(), currItem->height(), currItem->ItemNr, false, false);
SizeItem(currItem->width() - np.x(), currItem->height(), currItem->ItemNr, false, false);
if (currItem->rotation() != 0)
{
FPoint npv(np.x(), 0);
Doc->MoveRotated(currItem, npv);
MoveRotated(currItem, npv);
}
else
Doc->MoveItem(np.x(), 0, currItem);
MoveItem(np.x(), 0, currItem);
Clip.translate(-np.x(), 0);
if (!currItem->imageFlippedH())
currItem->moveImageInFrame(-np.x()/currItem->imageXScale(), 0);
7296,14 → 7296,14
}
if ((np.y() < 0) && (!EditContour))
{
Doc->SizeItem(currItem->width(), currItem->height() - np.y(), currItem->ItemNr, false, false);
SizeItem(currItem->width(), currItem->height() - np.y(), currItem->ItemNr, false, false);
if (currItem->rotation() != 0)
{
FPoint npv(0, np.y());
Doc->MoveRotated(currItem, npv);
MoveRotated(currItem, npv);
}
else
Doc->MoveItem(0, np.y(), currItem);
MoveItem(0, np.y(), currItem);
Clip.translate(0, -np.y());
if (!currItem->imageFlippedV())
currItem->moveImageInFrame(0, -np.y()/currItem->imageYScale());
7419,218 → 7419,218
}
}
 
// //CB-->Doc
// bool ScribusView::SizeItem(double newX, double newY, int ite, bool fromMP, bool DoUpdateClip, bool redraw)
// {
// return SizeItem(newX, newY, Doc->Items->at(ite), fromMP, DoUpdateClip, redraw);
// }
//
// //CB-->Doc
// bool ScribusView::SizeItem(double newX, double newY, PageItem *pi, bool fromMP, bool DoUpdateClip, bool redraw)
// {
// PageItem *currItem = pi;
// if (currItem->locked())
// return false;
// QPainter p;
// QRect oldR(currItem->getRedrawBounding(Scale));
// //Uncomment for stopping resize in any direction
// //and remove the height/width <0 tests in item sizing switch
// /*
// if (!currItem->asLine())
// {
// newX = QMAX(newX, 1);
// newY = QMAX(newY, 1);
// }
// */
// int ph = static_cast<int>(QMAX(1.0, currItem->lineWidth() / 2.0));
// QWMatrix ma;
// ma.rotate(currItem->rotation());
// double dX = ma.m11() * (currItem->width() - newX) + ma.m21() * (currItem->height() - newY) + ma.dx();
// double dY = ma.m22() * (currItem->height() - newY) + ma.m12() * (currItem->width() - newX) + ma.dy();
// currItem->setWidthHeight(newX, newY);
// if ((Doc->RotMode != 0) && (fromMP) && (!Doc->isLoading()) && (Doc->appMode == modeNormal))
// {
// double moveX=dX, moveY=dY;
// if (Doc->RotMode==2)
// {
// moveX/=2.0;
// moveY/=2.0;
// }
// else if (Doc->RotMode==3)
// moveX=0.0;
// else if (Doc->RotMode==1)
// moveY=0.0;
// Doc->MoveItem(moveX, moveY, currItem);
// }
// currItem->setCornerRadius(QMIN(currItem->cornerRadius(), QMIN(currItem->width(),currItem->height())/2));
// if ((currItem->asImageFrame()) && (!currItem->Sizing) && (!Doc->EditClip))
// {
// currItem->AdjustPictScale();
// }
// if (currItem->asLine())
// {
// if (!fromMP)
// {
// currItem->setRotation(atan2(currItem->height(),currItem->width())*(180.0/M_PI));
// currItem->setWidthHeight(sqrt(pow(currItem->width(),2)+pow(currItem->height(),2)), 1.0);
// }
// currItem->Clip.setPoints(4, -ph,-ph, static_cast<int>(currItem->width()+ph),-ph,
// static_cast<int>(currItem->width()+ph),static_cast<int>(currItem->height()+ph),
// -ph,static_cast<int>(currItem->height()+ph));
// }
// Doc->setRedrawBounding(currItem);
// currItem->OwnPage = Doc->OnPage(currItem);
// if (currItem->Sizing)
// {
// currItem->FrameOnly = true;
// currItem->Tinput = true;
// if ((frameResizeHandle == 1) && !(currItem->asLine()))
// currItem->paintObj();
// if ((currItem->FrameType == 0) || (currItem->asLine()) || (frameResizeHandle != 1))
// return true;
// QPainter p;
// p.begin(viewport());
// QPoint in(qRound((currItem->xPos()-Doc->minCanvasCoordinate.x())*Scale), qRound((currItem->yPos()-Doc->minCanvasCoordinate.y())*Scale));
// QPoint out(contentsToViewport(in));
// p.translate(out.x(), out.y());
// p.scale(Scale, Scale);
// p.rotate(currItem->rotation());
// p.setRasterOp(XorROP);
// p.setBrush(NoBrush);
// p.setPen(QPen(white, 1, DotLine, FlatCap, MiterJoin));
// p.save();
// if (currItem->OldB2 < 0.0)
// {
// p.scale(-1, 1);
// p.translate(qRound(-currItem->OldB2), 0);
// }
// if (currItem->OldH2 < 0.0)
// {
// p.scale(1, -1);
// p.translate(0, qRound(-currItem->OldH2));
// }
// currItem->DrawPolyL(&p, currItem->Clip);
// p.restore();
// currItem->updateClip();
// currItem->updateGradientVectors();
// p.save();
// if (currItem->width() < 0.0)
// {
// p.scale(-1, 1);
// p.translate(qRound(-currItem->width()), 0);
// }
// if (currItem->height() < 0.0)
// {
// p.scale(1, -1);
// p.translate(0, qRound(-currItem->height()));
// }
// currItem->DrawPolyL(&p, currItem->Clip);
// p.restore();
// p.end();
// return true;
// }
// if (DoUpdateClip)
// {
// double nX=0.0, nY=0.0;
// if (fromMP)
// {
// if (currItem->imageFlippedH())
// nX=-(currItem->width() - currItem->OldB2)/currItem->imageXScale();
// if (currItem->imageFlippedV())
// nY=-(currItem->height() - currItem->OldH2)/currItem->imageYScale();
// }
// else
// {
// if (!currItem->imageFlippedH())
// nX=(currItem->width() - currItem->OldB2)/currItem->imageXScale();
// if (!currItem->imageFlippedV())
// nY=(currItem->height() - currItem->OldH2)/currItem->imageYScale();
// }
// if (nX!=0.0 || nY!=0.0)
// currItem->moveImageInFrame(dX,dY);
// currItem->updateClip();
// }
// currItem->updateGradientVectors();
// if (redraw)
// {
// QRect newR(currItem->getRedrawBounding(Scale));
// updateContents(newR.unite(oldR));
// }
// if (!fromMP)
// {
// if (Doc->m_Selection->isMultipleSelection())
// {
// double gx, gy, gh, gw;
// Doc->m_Selection->setGroupRect();
// Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
// emit ItemGeom(gw, gh);
// }
// }
// return true;
// }
//CB-->Doc
bool ScribusView::SizeItem(double newX, double newY, int ite, bool fromMP, bool DoUpdateClip, bool redraw)
{
return SizeItem(newX, newY, Doc->Items->at(ite), fromMP, DoUpdateClip, redraw);
}
 
// //CB-->Doc
// void ScribusView::MoveRotated(PageItem *currItem, FPoint npv, bool fromMP)
// {
// QWMatrix ma;
// ma.translate(currItem->xPos(), currItem->yPos());
// ma.rotate(currItem->rotation());
// double mxc = currItem->xPos() - (ma.m11() * npv.x() + ma.m21() * npv.y() + ma.dx());
// double myc = currItem->yPos() - (ma.m22() * npv.y() + ma.m12() * npv.x() + ma.dy());
// Doc->MoveItem(-mxc, -myc, currItem, fromMP);
// }
//CB-->Doc
bool ScribusView::SizeItem(double newX, double newY, PageItem *pi, bool fromMP, bool DoUpdateClip, bool redraw)
{
PageItem *currItem = pi;
if (currItem->locked())
return false;
QPainter p;
QRect oldR(currItem->getRedrawBounding(Scale));
//Uncomment for stopping resize in any direction
//and remove the height/width <0 tests in item sizing switch
/*
if (!currItem->asLine())
{
newX = QMAX(newX, 1);
newY = QMAX(newY, 1);
}
*/
int ph = static_cast<int>(QMAX(1.0, currItem->lineWidth() / 2.0));
QWMatrix ma;
ma.rotate(currItem->rotation());
double dX = ma.m11() * (currItem->width() - newX) + ma.m21() * (currItem->height() - newY) + ma.dx();
double dY = ma.m22() * (currItem->height() - newY) + ma.m12() * (currItem->width() - newX) + ma.dy();
currItem->setWidthHeight(newX, newY);
if ((Doc->RotMode != 0) && (fromMP) && (!Doc->isLoading()) && (Doc->appMode == modeNormal))
{
double moveX=dX, moveY=dY;
if (Doc->RotMode==2)
{
moveX/=2.0;
moveY/=2.0;
}
else if (Doc->RotMode==3)
moveX=0.0;
else if (Doc->RotMode==1)
moveY=0.0;
MoveItem(moveX, moveY, currItem);
}
currItem->setCornerRadius(QMIN(currItem->cornerRadius(), QMIN(currItem->width(),currItem->height())/2));
if ((currItem->asImageFrame()) && (!currItem->Sizing) && (!Doc->EditClip))
{
currItem->AdjustPictScale();
}
if (currItem->asLine())
{
if (!fromMP)
{
currItem->setRotation(atan2(currItem->height(),currItem->width())*(180.0/M_PI));
currItem->setWidthHeight(sqrt(pow(currItem->width(),2)+pow(currItem->height(),2)), 1.0);
}
currItem->Clip.setPoints(4, -ph,-ph, static_cast<int>(currItem->width()+ph),-ph,
static_cast<int>(currItem->width()+ph),static_cast<int>(currItem->height()+ph),
-ph,static_cast<int>(currItem->height()+ph));
}
Doc->setRedrawBounding(currItem);
currItem->OwnPage = Doc->OnPage(currItem);
if (currItem->Sizing)
{
currItem->FrameOnly = true;
currItem->Tinput = true;
if ((frameResizeHandle == 1) && !(currItem->asLine()))
currItem->paintObj();
if ((currItem->FrameType == 0) || (currItem->asLine()) || (frameResizeHandle != 1))
return true;
QPainter p;
p.begin(viewport());
QPoint in(qRound((currItem->xPos()-Doc->minCanvasCoordinate.x())*Scale), qRound((currItem->yPos()-Doc->minCanvasCoordinate.y())*Scale));
QPoint out(contentsToViewport(in));
p.translate(out.x(), out.y());
p.scale(Scale, Scale);
p.rotate(currItem->rotation());
p.setRasterOp(XorROP);
p.setBrush(NoBrush);
p.setPen(QPen(white, 1, DotLine, FlatCap, MiterJoin));
p.save();
if (currItem->OldB2 < 0.0)
{
p.scale(-1, 1);
p.translate(qRound(-currItem->OldB2), 0);
}
if (currItem->OldH2 < 0.0)
{
p.scale(1, -1);
p.translate(0, qRound(-currItem->OldH2));
}
currItem->DrawPolyL(&p, currItem->Clip);
p.restore();
currItem->updateClip();
currItem->updateGradientVectors();
p.save();
if (currItem->width() < 0.0)
{
p.scale(-1, 1);
p.translate(qRound(-currItem->width()), 0);
}
if (currItem->height() < 0.0)
{
p.scale(1, -1);
p.translate(0, qRound(-currItem->height()));
}
currItem->DrawPolyL(&p, currItem->Clip);
p.restore();
p.end();
return true;
}
if (DoUpdateClip)
{
double nX=0.0, nY=0.0;
if (fromMP)
{
if (currItem->imageFlippedH())
nX=-(currItem->width() - currItem->OldB2)/currItem->imageXScale();
if (currItem->imageFlippedV())
nY=-(currItem->height() - currItem->OldH2)/currItem->imageYScale();
}
else
{
if (!currItem->imageFlippedH())
nX=(currItem->width() - currItem->OldB2)/currItem->imageXScale();
if (!currItem->imageFlippedV())
nY=(currItem->height() - currItem->OldH2)/currItem->imageYScale();
}
if (nX!=0.0 || nY!=0.0)
currItem->moveImageInFrame(dX,dY);
currItem->updateClip();
}
currItem->updateGradientVectors();
if (redraw)
{
QRect newR(currItem->getRedrawBounding(Scale));
updateContents(newR.unite(oldR));
}
if (!fromMP)
{
if (Doc->m_Selection->isMultipleSelection())
{
double gx, gy, gh, gw;
Doc->m_Selection->setGroupRect();
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
emit ItemGeom(gw, gh);
}
}
return true;
}
 
// //CB-->Doc
// bool ScribusView::MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP, bool constrainRotation)
// {
// PageItem *currItem = Doc->Items->at(ite);
// QRect oldR(currItem->getRedrawBounding(Scale));
// if (currItem->asLine())
// {
// QWMatrix ma;
// ma.translate(currItem->xPos(), currItem->yPos());
// ma.rotate(currItem->rotation());
// double mx = ma.m11() * currItem->width() + ma.dx();
// double my = ma.m12() * currItem->width() + ma.dy();
// Doc->MoveItem(newX.x(), newX.y(), currItem, fromMP);
// double newRot=xy2Deg(mx - currItem->xPos(), my - currItem->yPos());
// //CB Hmm should work, doesnt. (constraining on the first point of a line)
// //if (constrainRotation)
// // qDebug(QString("%1").arg(constrainAngle(newRot)));
// currItem->setRotation(newRot);
// currItem->setWidthHeight(sqrt(pow(mx - currItem->xPos(),2)+pow(my - currItem->yPos(),2)), 1.0);
// currItem->updateClip();
// Doc->setRedrawBounding(currItem);
// QRect newR(currItem->getRedrawBounding(Scale));
// updateContents(oldR);
// updateContents(newR);
// // updateContents(newR.unite(oldR));
// }
// else
// {
// currItem->OldB2 = currItem->width();
// currItem->OldH2 = currItem->height();
// if (currItem->rotation() != 0)
// {
// FPoint npv(newX.x(), newX.y());
// QWMatrix ma3;
// ma3.translate(currItem->xPos(), currItem->yPos());
// ma3.rotate(currItem->rotation());
// double mxc3 = currItem->xPos() - (ma3.m11() * npv.x() + ma3.m21() * npv.y() + ma3.dx());
// double myc3 = currItem->yPos() - (ma3.m22() * npv.y() + ma3.m12() * npv.x() + ma3.dy());
// Doc->SizeItem(currItem->width() - newY.x(), currItem->height() - newY.y(), ite, fromMP, true, false);
// Doc->MoveItem(-mxc3, -myc3, currItem, fromMP);
// }
// else
// {
// Doc->SizeItem(currItem->width() - newY.x(), currItem->height() - newY.y(), ite, fromMP, true, false);
// Doc->MoveItem(newX.x(), newX.y(), currItem, fromMP);
// }
// }
// return true;
// }
//CB-->Doc
void ScribusView::MoveRotated(PageItem *currItem, FPoint npv, bool fromMP)
{
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
ma.rotate(currItem->rotation());
double mxc = currItem->xPos() - (ma.m11() * npv.x() + ma.m21() * npv.y() + ma.dx());
double myc = currItem->yPos() - (ma.m22() * npv.y() + ma.m12() * npv.x() + ma.dy());
MoveItem(-mxc, -myc, currItem, fromMP);
}
 
//CB-->Doc
bool ScribusView::MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP, bool constrainRotation)
{
PageItem *currItem = Doc->Items->at(ite);
QRect oldR(currItem->getRedrawBounding(Scale));
if (currItem->asLine())
{
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
ma.rotate(currItem->rotation());
double mx = ma.m11() * currItem->width() + ma.dx();
double my = ma.m12() * currItem->width() + ma.dy();
MoveItem(newX.x(), newX.y(), currItem, fromMP);
double newRot=xy2Deg(mx - currItem->xPos(), my - currItem->yPos());
//CB Hmm should work, doesnt. (constraining on the first point of a line)
//if (constrainRotation)
// qDebug(QString("%1").arg(constrainAngle(newRot)));
currItem->setRotation(newRot);
currItem->setWidthHeight(sqrt(pow(mx - currItem->xPos(),2)+pow(my - currItem->yPos(),2)), 1.0);
currItem->updateClip();
Doc->setRedrawBounding(currItem);
QRect newR(currItem->getRedrawBounding(Scale));
updateContents(oldR);
updateContents(newR);
// updateContents(newR.unite(oldR));
}
else
{
currItem->OldB2 = currItem->width();
currItem->OldH2 = currItem->height();
if (currItem->rotation() != 0)
{
FPoint npv(newX.x(), newX.y());
QWMatrix ma3;
ma3.translate(currItem->xPos(), currItem->yPos());
ma3.rotate(currItem->rotation());
double mxc3 = currItem->xPos() - (ma3.m11() * npv.x() + ma3.m21() * npv.y() + ma3.dx());
double myc3 = currItem->yPos() - (ma3.m22() * npv.y() + ma3.m12() * npv.x() + ma3.dy());
SizeItem(currItem->width() - newY.x(), currItem->height() - newY.y(), ite, fromMP, true, false);
MoveItem(-mxc3, -myc3, currItem, fromMP);
}
else
{
SizeItem(currItem->width() - newY.x(), currItem->height() - newY.y(), ite, fromMP, true, false);
MoveItem(newX.x(), newX.y(), currItem, fromMP);
}
}
return true;
}
 
//CB-->Doc
void ScribusView::moveGroup(double x, double y, bool fromMP, Selection* customSelection)
{
Selection* itemSelection = (customSelection!=0) ? customSelection : Doc->m_Selection;
7700,7 → 7700,7
p.drawRect(0, 0, static_cast<int>(currItem->width())+1, static_cast<int>(currItem->height())+1);
p.end();
}
Doc->MoveItem(x, y, currItem, fromMP);
MoveItem(x, y, currItem, fromMP);
if ((!fromMP) && (itemSelection->count() < moveWithBoxesOnlyThreshold))
{
p.begin(viewport());
7903,7 → 7903,7
bb->PoLine.map(ma2);
bb->setRotation(0.0);
bb->ClipEdited = true;
Doc->AdjustItemSize(bb);
AdjustItemSize(bb);
QWMatrix ma3;
ma3.translate(gx, gy);
ma3.scale(scx, scy);
7910,7 → 7910,7
FPoint n(gx-oldPos.x(), gy-oldPos.y());
x = ma3.m11() * n.x() + ma3.m21() * n.y() + ma3.dx();
y = ma3.m22() * n.y() + ma3.m12() * n.x() + ma3.dy();
Doc->MoveItem(gx-x, gy-y, bb, true);
MoveItem(gx-x, gy-y, bb, true);
if (oldRot != 0)
{
bb->setRotation(atan2(t1.y()-b1.y(),t1.x()-b1.x())*(180.0/M_PI));
7917,7 → 7917,7
QWMatrix ma;
ma.rotate(-bb->rotation());
bb->PoLine.map(ma);
Doc->AdjustItemSize(bb);
AdjustItemSize(bb);
}
}
if (scaleText)
7988,101 → 7988,101
emit DocChanged();
}
 
// //CB-->Doc
// void ScribusView::RotateItem(double win, int ite)
// {
// RotateItem(win, Doc->Items->at(ite));
// }
//
// //CB-->Doc
// void ScribusView::RotateItem(double win, PageItem *currItem)
// {
// if (currItem->locked())
// return;
// QRect oldR(currItem->getRedrawBounding(Scale));
// // if ((Doc->RotMode != 0) && (m_MouseButtonPressed))
// if (Doc->RotMode != 0)
// {
// QWMatrix ma;
// ma.translate(currItem->xPos(), currItem->yPos());
// ma.scale(1, 1);
// ma.rotate(currItem->rotation());
// double ro = win-currItem->rotation();
// currItem->setRotation(win);
// FPoint n(0,0);
// switch (Doc->RotMode)
// {
// case 2:
// ma.translate(currItem->width()/2, currItem->height()/2);
// n = FPoint(-currItem->width()/2, -currItem->height()/2);
// break;
// case 4:
// ma.translate(currItem->width(), currItem->height());
// n = FPoint(-currItem->width(), -currItem->height());
// break;
// case 3:
// ma.translate(0, currItem->height());
// n = FPoint(0, -currItem->height());
// break;
// case 1:
// ma.translate(currItem->width(), 0);
// n = FPoint(-currItem->width(), 0);
// break;
// }
// ma.rotate(ro);
// double x = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
// double y = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
// bool oldS = currItem->Sizing;
// currItem->Sizing = true;
// Doc->MoveItem(x-currItem->xPos(), y-currItem->yPos(), currItem);
// currItem->Sizing = oldS;
// }
// else
// {
// currItem->setRotation(win);
// Doc->setRedrawBounding(currItem);
// }
// QRect newR(currItem->getRedrawBounding(Scale));
// updateContents(newR.unite(oldR));
// //emit SetAngle(currItem->rotation());
// }
//CB-->Doc
void ScribusView::RotateItem(double win, int ite)
{
RotateItem(win, Doc->Items->at(ite));
}
 
// //CB-->Doc
// void ScribusView::AdjustItemSize(PageItem *currItem)
// {
// bool siz = currItem->Sizing;
// currItem->Sizing = false;
// FPointArray Clip;
// Clip = currItem->PoLine;
// FPoint tp2(getMinClipF(&Clip));
// Doc->SizeItem(currItem->width() - tp2.x(), currItem->height() - tp2.y(), currItem, true, false, false);
// Clip.translate(-tp2.x(), -tp2.y());
// if (currItem->rotation() != 0)
// {
// FPoint npv(tp2.x(), tp2.y());
// Doc->MoveRotated(currItem, npv, true);
// }
// else
// Doc->MoveItem(tp2.x(), tp2.y(), currItem, true);
// if (!currItem->imageFlippedH())
// currItem->moveImageInFrame(-tp2.x()/currItem->imageXScale(), 0);
// if (!currItem->imageFlippedV())
// currItem->moveImageInFrame(0, -tp2.y()/currItem->imageYScale());
// FPoint tp(getMaxClipF(&Clip));
// if (currItem->imageFlippedH())
// currItem->moveImageInFrame((currItem->width() - tp.x())/currItem->imageXScale(), 0);
// if (currItem->imageFlippedV())
// currItem->moveImageInFrame(0, (currItem->height() - tp.y())/currItem->imageYScale());
// Doc->SizeItem(tp.x(), tp.y(), currItem, true, false);
// currItem->ClipEdited = true;
// currItem->PoLine = Clip.copy();
// if (currItem->asPolyLine())
// currItem->setPolyClip(qRound(QMAX(currItem->lineWidth() / 2, 1)));
// else
// currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
// currItem->Sizing = siz;
// }
//CB-->Doc
void ScribusView::RotateItem(double win, PageItem *currItem)
{
if (currItem->locked())
return;
QRect oldR(currItem->getRedrawBounding(Scale));
// if ((Doc->RotMode != 0) && (m_MouseButtonPressed))
if (Doc->RotMode != 0)
{
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
ma.scale(1, 1);
ma.rotate(currItem->rotation());
double ro = win-currItem->rotation();
currItem->setRotation(win);
FPoint n(0,0);
switch (Doc->RotMode)
{
case 2:
ma.translate(currItem->width()/2, currItem->height()/2);
n = FPoint(-currItem->width()/2, -currItem->height()/2);
break;
case 4:
ma.translate(currItem->width(), currItem->height());
n = FPoint(-currItem->width(), -currItem->height());
break;
case 3:
ma.translate(0, currItem->height());
n = FPoint(0, -currItem->height());
break;
case 1:
ma.translate(currItem->width(), 0);
n = FPoint(-currItem->width(), 0);
break;
}
ma.rotate(ro);
double x = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
double y = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
bool oldS = currItem->Sizing;
currItem->Sizing = true;
MoveItem(x-currItem->xPos(), y-currItem->yPos(), currItem);
currItem->Sizing = oldS;
}
else
{
currItem->setRotation(win);
Doc->setRedrawBounding(currItem);
}
QRect newR(currItem->getRedrawBounding(Scale));
updateContents(newR.unite(oldR));
//emit SetAngle(currItem->rotation());
}
 
//CB-->Doc
void ScribusView::AdjustItemSize(PageItem *currItem)
{
bool siz = currItem->Sizing;
currItem->Sizing = false;
FPointArray Clip;
Clip = currItem->PoLine;
FPoint tp2(getMinClipF(&Clip));
SizeItem(currItem->width() - tp2.x(), currItem->height() - tp2.y(), currItem, true, false, false);
Clip.translate(-tp2.x(), -tp2.y());
if (currItem->rotation() != 0)
{
FPoint npv(tp2.x(), tp2.y());
MoveRotated(currItem, npv, true);
}
else
MoveItem(tp2.x(), tp2.y(), currItem, true);
if (!currItem->imageFlippedH())
currItem->moveImageInFrame(-tp2.x()/currItem->imageXScale(), 0);
if (!currItem->imageFlippedV())
currItem->moveImageInFrame(0, -tp2.y()/currItem->imageYScale());
FPoint tp(getMaxClipF(&Clip));
if (currItem->imageFlippedH())
currItem->moveImageInFrame((currItem->width() - tp.x())/currItem->imageXScale(), 0);
if (currItem->imageFlippedV())
currItem->moveImageInFrame(0, (currItem->height() - tp.y())/currItem->imageYScale());
SizeItem(tp.x(), tp.y(), currItem, true, false);
currItem->ClipEdited = true;
currItem->PoLine = Clip.copy();
if (currItem->asPolyLine())
currItem->setPolyClip(qRound(QMAX(currItem->lineWidth() / 2, 1)));
else
currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
currItem->Sizing = siz;
}
 
/*/CB Unused
void ScribusView::AdvanceSel(PageItem *currItem, int oldPos, int len, int dir, int expandSel, int state)
{
9498,7 → 9498,7
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx;
double ny = gy;
if (!Doc->ApplyGuides(&nx, &ny))
if (!ApplyGuides(&nx, &ny))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
9510,7 → 9510,7
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
nx = gx+gw;
ny = gy+gh;
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
moveGroup(nx-(gx+gw), ny-(gy+gh), false);
Doc->m_Selection->setGroupRect();
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
9525,7 → 9525,7
{
double nx = currItem->xPos();
double ny = currItem->yPos();
if (!Doc->ApplyGuides(&nx, &ny))
if (!ApplyGuides(&nx, &ny))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
9532,7 → 9532,7
nx = npx.x();
ny = npx.y();
}
Doc->MoveItem(nx-currItem->xPos(), ny-currItem->yPos(), currItem);
MoveItem(nx-currItem->xPos(), ny-currItem->yPos(), currItem);
}
currItem->emitAllToGUI();
}
9588,7 → 9588,7
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx;
double ny = gy;
if (!Doc->ApplyGuides(&nx, &ny))
if (!ApplyGuides(&nx, &ny))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
9600,7 → 9600,7
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
nx = gx+gw;
ny = gy+gh;
Doc->ApplyGuides(&nx, &ny);
ApplyGuides(&nx, &ny);
moveGroup(nx-(gx+gw), ny-(gy+gh), false);
Doc->m_Selection->setGroupRect();
Doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
9615,7 → 9615,7
{
double nx = currItem->xPos();
double ny = currItem->yPos();
if (!Doc->ApplyGuides(&nx, &ny))
if (!ApplyGuides(&nx, &ny))
{
FPoint npx;
npx = Doc->ApplyGridF(FPoint(nx, ny));
9622,7 → 9622,7
nx = npx.x();
ny = npx.y();
}
Doc->MoveItem(nx-currItem->xPos(), ny-currItem->yPos(), currItem);
MoveItem(nx-currItem->xPos(), ny-currItem->yPos(), currItem);
}
currItem->emitAllToGUI();
}
10491,8 → 10491,8
h = currItem->OrigH * currItem->imageYScale();
x = currItem->imageXOffset() * currItem->imageXScale();
y = currItem->imageYOffset() * currItem->imageYScale();
Doc->SizeItem(w, h, currItem->ItemNr);
Doc->MoveItem(x, y, currItem);
SizeItem(w, h, currItem->ItemNr);
MoveItem(x, y, currItem);
currItem->setImageXYOffset(0.0, 0.0);
toUpdate=true;
}
10659,9 → 10659,6
case PageItem::PolyLine:
z = Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2, !m_MouseButtonPressed);
break;
case PageItem::Multiple:
Q_ASSERT(false);
break;
}
PageItem *currItem = Doc->Items->at(z);
/*FIXME
11181,7 → 11178,7
}
bb->setLineWidth(chs * hl->outlineWidth() / 10000.0);
if (currItem->asPathText())
Doc->AdjustItemSize(bb);
AdjustItemSize(bb);
else
{
FPoint tp2(getMinClipF(&bb->PoLine));
11221,7 → 11218,7
bb->FrameType = 3;
bb->setRotation(currItem->rotation());
bb->setPolyClip(qRound(QMAX(bb->lineWidth() / 2, 1)));
Doc->AdjustItemSize(bb);
AdjustItemSize(bb);
newGroupedItems.append(Doc->Items->take(z));
}
delItems.append(Doc->m_Selection->takeItem(offset));
11286,7 → 11283,7
currItem->PoLine.putPoints(currItem->PoLine.size(), bb->PoLine.size(), bb->PoLine);
}
currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
currItem->ContourLine = currItem->PoLine.copy();
Deselect(true);
for (uint c = 0; c < toDel.count(); ++c)
11313,7 → 11310,7
bb->PoLine.resize(0);
bb->PoLine.putPoints(0, EndInd - StartInd, currItem->PoLine, StartInd);
bb->setRotation(currItem->rotation());
Doc->AdjustItemSize(bb);
AdjustItemSize(bb);
bb->ContourLine = bb->PoLine.copy();
bb->ClipEdited = true;
a -= 3;
11321,7 → 11318,7
}
}
currItem->PoLine.resize(StartInd-4);
Doc->AdjustItemSize(currItem);
AdjustItemSize(currItem);
currItem->ContourLine = currItem->PoLine.copy();
currItem->ClipEdited = true;
Deselect(true);
/branches/Version13x/Scribus/scribus/multiline.cpp
432,8 → 432,7
disconnect(Shade, SIGNAL(valueChanged(int)), this, SLOT(NewLShade()));
Styles->setSelected(i, true);
CurLin = i;
int tvs=static_cast<int>(TempVorl.size());
if (i >=0 && i < tvs)
if (i >=0 && i < TempVorl.size())
{
LWidth->setValue(TempVorl[i].Width);
Color->setCurrentText(TempVorl[i].Color);
/branches/Version13x/Scribus/scribus/scribus.cpp
1247,9 → 1247,9
}
else
{
doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false);
view->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false);
currItem->setPolyClip(qRound(QMAX(currItem->lineWidth() / 2.0, 1)));
doc->AdjustItemSize(currItem);
view->AdjustItemSize(currItem);
currItem->ContourLine = currItem->PoLine.copy();
currItem->ClipEdited = true;
currItem->FrameType = 3;
1481,14 → 1481,14
if (resizingsmaller)
{
currItem->Sizing = false;
doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
view->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
}
else
{
doc->MoveItem(-resizeBy, 0, currItem, false);
view->MoveItem(-resizeBy, 0, currItem, false);
currItem->moveImageXYOffsetBy(resizeBy/currItem->imageXScale(), 0);
currItem->Sizing = false;
doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
view->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
}
}
}
1533,15 → 1533,15
{
if (resizingsmaller)
{
doc->MoveItem(-resizeBy, 0, currItem, false);
view->MoveItem(-resizeBy, 0, currItem, false);
currItem->moveImageXYOffsetBy(resizeBy/currItem->imageXScale(), 0);
currItem->Sizing = false;
doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
view->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
}
else
{
currItem->Sizing = false;
doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
view->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr, true);
}
}
}
1587,14 → 1587,14
if (resizingsmaller)
{
currItem->Sizing = false;
doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
view->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
}
else
{
doc->MoveItem(0, -resizeBy, currItem, false);
view->MoveItem(0, -resizeBy, currItem, false);
currItem->moveImageXYOffsetBy(0, resizeBy/currItem->imageYScale());
currItem->Sizing = false;
doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
view->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
}
}
}
1639,15 → 1639,15
{
if (resizingsmaller)
{
doc->MoveItem(0, -resizeBy, currItem, false);
view->MoveItem(0, -resizeBy, currItem, false);
currItem->moveImageXYOffsetBy(0, resizeBy/currItem->imageYScale());
currItem->Sizing = false;
doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
view->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
}
else
{
currItem->Sizing = false;
doc->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
view->SizeItem(currItem->width(), currItem->height()+resizeBy, currItem->ItemNr, true);
}
}
}
7194,7 → 7194,7
for (uint b=0; b<doc->m_Selection->count(); ++b)
{
doc->m_Selection->itemAt(b)->setLocked(false);
doc->MoveItem(doc->toolSettings.dispX, doc->toolSettings.dispY, doc->m_Selection->itemAt(b));
view->MoveItem(doc->toolSettings.dispX, doc->toolSettings.dispY, doc->m_Selection->itemAt(b));
}
doc->useRaster = savedAlignGrid;
doc->SnapGuides = savedAlignGuides;
/branches/Version13x/Scribus/scribus/scribusdoc.cpp
31,9 → 31,7
 
#include <utility>
#include <qeventloop.h>
 
#include <qfile.h>
#include <qpainter.h>
#include <qprogressbar.h>
 
#include "fileloader.h"
54,7 → 52,6
#include "prefsfile.h"
#include "prefsmanager.h"
#include "scmessagebox.h"
#include "scpainter.h"
#include "scraction.h"
#include "scribusXml.h"
#include "selection.h"
4023,7 → 4020,7
polyLineItem->FrameType = 3;
polyLineItem->setRotation(currItem->rotation());
polyLineItem->setPolyClip(qRound(QMAX(polyLineItem->lineWidth() / 2, 1)));
AdjustItemSize(polyLineItem);
view()->AdjustItemSize(polyLineItem);
 
newItem->setLineColor(CommonStrings::None);
newItem->SetRectFrame();
4053,7 → 4050,7
newItem->convertTo(PageItem::PolyLine);
newItem->ClipEdited = true;
newItem->setPolyClip(qRound(QMAX(newItem->lineWidth() / 2, 1)));
AdjustItemSize(newItem);
m_View->AdjustItemSize(newItem);
break;
case PageItem::PathText:
{
4069,11 → 4066,11
/* if (!Doc->loading)
emit UpdtObj(Doc->currentPage->pageNr(), b->ItemNr); */
//FIXME: Stop using the view here
AdjustItemSize(newItem);
m_View->AdjustItemSize(newItem);
newItem->updatePolyClip();
double dx = secondaryItem->xPos() - newItem->xPos();
double dy = secondaryItem->yPos() - newItem->yPos();
MoveItem(dx, dy, newItem);
m_View->MoveItem(dx, dy, newItem);
newItem->setRotation(secondaryItem->rotation());
newItem->FrameType = 3;
}
5154,7 → 5151,7
if (currItem->asPathText())
{
currItem->updatePolyClip();
AdjustItemSize(currItem);
view()->AdjustItemSize(currItem);
}
// emit refreshItem(currItem);
}
5206,7 → 5203,7
if (currItem->asPathText())
{
currItem->updatePolyClip();
AdjustItemSize(currItem);
view()->AdjustItemSize(currItem);
}
// emit refreshItem(currItem);
}
5258,7 → 5255,7
if (currItem->asPathText())
{
currItem->updatePolyClip();
AdjustItemSize(currItem);
view()->AdjustItemSize(currItem);
}
// emit refreshItem(currItem);
}
5311,7 → 5308,7
if (currItem->asPathText())
{
currItem->updatePolyClip();
AdjustItemSize(currItem);
view()->AdjustItemSize(currItem);
}
// emit refreshItem(currItem);
}
5542,7 → 5539,6
connect(autoSaveTimer, SIGNAL(timeout()), WinHan, SLOT(slotAutoSave()));
connect(this, SIGNAL(refreshItem(PageItem*)), view(), SLOT(RefreshItem(PageItem*)));
connect(this, SIGNAL(updateContents()), view(), SLOT(slotUpdateContents()));
connect(this, SIGNAL(updateContents(const QRect&)), view(), SLOT(slotUpdateContents(const QRect&)));
// connect(this, SIGNAL(canvasAdjusted(double, double, double, double)), view(), SLOT(adjustCanvas(double, double, double, double)));
}
}
6244,7 → 6240,7
renumberItemsInListOrder();
if (selectedItemCount > 1)
undoManager->commit();
emit updateContents();
updateContents();
qApp->setOverrideCursor(QCursor(ArrowCursor), true);
//CB FIXME remove this and tree.h too
m_ScMW->outlinePalette->BuildTree();
7618,7 → 7614,7
{
PageItem* bItem=m_Selection->itemAt(b);
bItem->setLocked(false);
MoveItem(dH2, dV2, bItem, true);
m_View->MoveItem(dH2, dV2, bItem, true);
}
dH2 += dH;
dV2 += dV;
7646,7 → 7642,7
{
PageItem* bItem=m_Selection->itemAt(b);
bItem->setLocked(false);
MoveItem(j*dX, i*dY, bItem, true);
m_View->MoveItem(j*dX, i*dY, bItem, true);
}
}
}
7796,516 → 7792,3
}
}
 
void ScribusDoc::getClosestGuides(double xin, double yin, double *xout, double *yout)
{
m_View->GxM = -1;
m_View->GyM = -1;
QMap<double, uint> tmpGuidesSel;
Guides tmpGuides = currentPage()->guides.horizontals(GuideManagerCore::Standard);
Guides::iterator it;
uint yg = 0;
uint xg = 0;
double viewScale=m_View->scale();
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
{
if (((*it)+currentPage()->yOffset()< (yin+guidesSettings.guideRad / viewScale)) && ((*it)+currentPage()->yOffset()> (yin-guidesSettings.guideRad / viewScale)))
tmpGuidesSel.insert(fabs(((*it)+currentPage()->yOffset()) - yin), yg);
}
if (tmpGuidesSel.count() != 0)
{
m_View->GyM = tmpGuidesSel.begin().data();
*yout = tmpGuides[m_View->GyM];
}
tmpGuidesSel.clear();
tmpGuides = currentPage()->guides.verticals(GuideManagerCore::Standard);
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
{
if (((*it)+currentPage()->xOffset()< (xin+guidesSettings.guideRad / viewScale)) && ((*it)+currentPage()->xOffset()> (xin-guidesSettings.guideRad / viewScale)))
tmpGuidesSel.insert(fabs(((*it)+currentPage()->xOffset()) - xin), xg);
}
if (tmpGuidesSel.count() != 0)
{
m_View->GxM = tmpGuidesSel.begin().data();
*xout = tmpGuides[m_View->GxM];
}
yg = 0;
xg = 0;
tmpGuidesSel.clear();
tmpGuides = currentPage()->guides.horizontals(GuideManagerCore::Auto);
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
{
if (((*it)+currentPage()->yOffset()< (yin+guidesSettings.guideRad / viewScale)) && ((*it)+currentPage()->yOffset()> (yin-guidesSettings.guideRad / viewScale)))
tmpGuidesSel.insert(fabs(((*it)+currentPage()->yOffset()) - yin), yg);
}
if (tmpGuidesSel.count() != 0)
{
m_View->GyM = tmpGuidesSel.begin().data();
*yout = tmpGuides[m_View->GyM];
}
tmpGuidesSel.clear();
tmpGuides = currentPage()->guides.verticals(GuideManagerCore::Auto);
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
{
if (((*it)+currentPage()->xOffset()< (xin+guidesSettings.guideRad / viewScale)) && ((*it)+currentPage()->xOffset()> (xin-guidesSettings.guideRad / viewScale)))
tmpGuidesSel.insert(fabs(((*it)+currentPage()->xOffset()) - xin), xg);
}
if (tmpGuidesSel.count() != 0)
{
m_View->GxM = tmpGuidesSel.begin().data();
*xout = tmpGuides[m_View->GxM];
}
}
 
//CB-->Doc
void ScribusDoc::SnapToGuides(PageItem *currItem)
{
int pg = OnPage(currItem);
double xout, yout;
if (pg == -1)
return;
Page* page = Pages->at(pg);
 
getClosestGuides(0, currItem->yPos(), &xout, &yout);
if (m_View->GyM != -1)
currItem->setYPos(yout+page->yOffset());
if (currItem->asLine())
{
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
ma.rotate(currItem->rotation());
double my = ma.m22() * currItem->height() + ma.m12() * currItem->width() + ma.dy();
getClosestGuides(0, my, &xout, &yout);
if (m_View->GyM != -1)
currItem->moveBy(0.0, yout - my + page->yOffset());
}
else
{
getClosestGuides(0, currItem->yPos()+currItem->height(), &xout, &yout);
if (m_View->GyM != -1)
currItem->setYPos(yout-currItem->height()+page->yOffset());
}
getClosestGuides(currItem->xPos(), 0, &xout, &yout);
if (m_View->GxM != -1)
currItem->setXPos(xout+page->xOffset());
if (currItem->asLine())
{
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
ma.rotate(currItem->rotation());
double mx = ma.m11() * currItem->width() + ma.m21() * currItem->height() + ma.dx();
getClosestGuides(mx, 0, &xout, &yout);
if (m_View->GxM != -1)
currItem->moveBy(xout - mx + page->xOffset(), 0.0);
}
else
{
getClosestGuides(currItem->xPos()+currItem->width(), 0, &xout, &yout);
if (m_View->GxM != -1)
currItem->setXPos(xout-currItem->width()+page->xOffset());
}
}
 
 
//CB-->Doc?
bool ScribusDoc::ApplyGuides(double *x, double *y)
{
// m_SnapCounter++;
bool ret = false;
double xout, yout;
int pg = OnPage(*x, *y);
if (pg == -1)
return ret;
Page* page = Pages->at(pg);
// if ((SnapGuides) && (m_SnapCounter > 1))
if (SnapGuides)
{
// m_SnapCounter = 0;
getClosestGuides(*x, *y, &xout, &yout);
if (m_View->GxM != -1)
{
*x = xout+page->xOffset();
ret = true;
}
if (m_View->GyM != -1)
{
*y = yout+page->yOffset();
ret = true;
}
double invViewScale=1/m_View->scale();
if ((page->Margins.Left+page->xOffset() < (*x+guidesSettings.guideRad * invViewScale)) && (page->Margins.Left+page->xOffset() > (*x-guidesSettings.guideRad * invViewScale)))
{
*x = page->Margins.Left+page->xOffset();
ret = true;
}
if (((page->width() - page->Margins.Right)+page->xOffset() < (*x+guidesSettings.guideRad * invViewScale)) && ((page->width() - page->Margins.Right)+page->xOffset() > (*x-guidesSettings.guideRad * invViewScale)))
{
*x = page->width() - page->Margins.Right+page->xOffset();
ret = true;
}
if ((page->Margins.Top+page->yOffset() < (*y+guidesSettings.guideRad * invViewScale)) && (page->Margins.Top+page->yOffset() > (*y-guidesSettings.guideRad * invViewScale)))
{
*y = page->Margins.Top+page->yOffset();
ret = true;
}
if (((page->height() - page->Margins.Bottom)+page->yOffset() < (*y+guidesSettings.guideRad * invViewScale)) && ((page->height() - page->Margins.Bottom)+page->yOffset() > (*y-guidesSettings.guideRad * invViewScale)))
{
*y = page->height() - page->Margins.Bottom+page->yOffset();
ret = true;
}
}
// if (m_SnapCounter > 10)
// m_SnapCounter = 0;
return ret;
}
 
//CB-->Doc
bool ScribusDoc::MoveItem(double newX, double newY, PageItem* currItem, bool fromMP)
{
if (currItem->locked())
return false;
bool retw = false;
double oldx = currItem->xPos();
double oldy = currItem->yPos();
currItem->moveBy(newX, newY);
if ((useRaster) && (!m_View->operItemMoving) && (!fromMP) && (static_cast<int>(currentPage()->pageNr()) == currItem->OwnPage))
{
currItem->setXYPos(qRound(currItem->xPos() / guidesSettings.minorGrid) * guidesSettings.minorGrid, qRound(currItem->yPos() / guidesSettings.minorGrid) * guidesSettings.minorGrid);
}
if ((SnapGuides) && (!m_View->operItemMoving) && (appMode == modeNormal) && (!EditClip) && (!fromMP))
SnapToGuides(currItem);
if ((currItem->xPos() != oldx) || (currItem->yPos() != oldy))
retw = true;
if (!fromMP)
{
/* if (GroupSel)
{
double gx, gy, gh, gw;
setGroupRect();
getGroupRect(&gx, &gy, &gw, &gh);
emit ItemPos(gx, gy);
}
else */
//CB if (!GroupSel)
//CB emit ItemPos(currItem->xPos(), currItem->yPos());
//CB qDebug("if (!GroupSel) emit ItemPos(currItem->xPos(), currItem->yPos());");
}
/* if (!loading)
emit UpdtObj(currentPage->pageNr(), b->ItemNr); */
QRect oldR(currItem->getRedrawBounding(m_View->scale()));
setRedrawBounding(currItem);
QRect newR(currItem->getRedrawBounding(m_View->scale()));
if ((!m_View->operItemMoving) && (!currItem->Sizing))
emit updateContents(newR.unite(oldR));
currItem->OwnPage = OnPage(currItem);
return retw;
}
 
//CB-->Doc
void ScribusDoc::RotateItem(double win, int ite)
{
RotateItem(win, Items->at(ite));
}
 
//CB-->Doc
void ScribusDoc::RotateItem(double win, PageItem *currItem)
{
if (currItem->locked())
return;
QRect oldR(currItem->getRedrawBounding(m_View->scale()));
// if ((Doc->RotMode != 0) && (m_MouseButtonPressed))
if (RotMode != 0)
{
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
ma.scale(1, 1);
ma.rotate(currItem->rotation());
double ro = win-currItem->rotation();
currItem->setRotation(win);
FPoint n(0,0);
switch (RotMode)
{
case 2:
ma.translate(currItem->width()/2, currItem->height()/2);
n = FPoint(-currItem->width()/2, -currItem->height()/2);
break;
case 4:
ma.translate(currItem->width(), currItem->height());
n = FPoint(-currItem->width(), -currItem->height());
break;
case 3:
ma.translate(0, currItem->height());
n = FPoint(0, -currItem->height());
break;
case 1:
ma.translate(currItem->width(), 0);
n = FPoint(-currItem->width(), 0);
break;
}
ma.rotate(ro);
double x = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
double y = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
bool oldS = currItem->Sizing;
currItem->Sizing = true;
MoveItem(x-currItem->xPos(), y-currItem->yPos(), currItem);
currItem->Sizing = oldS;
}
else
{
currItem->setRotation(win);
setRedrawBounding(currItem);
}
QRect newR(currItem->getRedrawBounding(m_View->scale()));
emit updateContents(newR.unite(oldR));
//emit SetAngle(currItem->rotation());
}
 
 
//CB-->Doc
void ScribusDoc::MoveRotated(PageItem *currItem, FPoint npv, bool fromMP)
{
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
ma.rotate(currItem->rotation());
double mxc = currItem->xPos() - (ma.m11() * npv.x() + ma.m21() * npv.y() + ma.dx());
double myc = currItem->yPos() - (ma.m22() * npv.y() + ma.m12() * npv.x() + ma.dy());
MoveItem(-mxc, -myc, currItem, fromMP);
}
 
//CB-->Doc
bool ScribusDoc::SizeItem(double newX, double newY, int ite, bool fromMP, bool DoUpdateClip, bool redraw)
{
return SizeItem(newX, newY, Items->at(ite), fromMP, DoUpdateClip, redraw);
}
 
//CB-->Doc
bool ScribusDoc::SizeItem(double newX, double newY, PageItem *pi, bool fromMP, bool DoUpdateClip, bool redraw)
{
PageItem *currItem = pi;
if (currItem->locked())
return false;
QPainter p;
double viewScale=m_View->scale();
QRect oldR(currItem->getRedrawBounding(viewScale));
//Uncomment for stopping resize in any direction
//and remove the height/width <0 tests in item sizing switch
/*
if (!currItem->asLine())
{
newX = QMAX(newX, 1);
newY = QMAX(newY, 1);
}
*/
int ph = static_cast<int>(QMAX(1.0, currItem->lineWidth() / 2.0));
QWMatrix ma;
ma.rotate(currItem->rotation());
double dX = ma.m11() * (currItem->width() - newX) + ma.m21() * (currItem->height() - newY) + ma.dx();
double dY = ma.m22() * (currItem->height() - newY) + ma.m12() * (currItem->width() - newX) + ma.dy();
currItem->setWidthHeight(newX, newY);
if ((RotMode != 0) && (fromMP) && (!isLoading()) && (appMode == modeNormal))
{
double moveX=dX, moveY=dY;
if (RotMode==2)
{
moveX/=2.0;
moveY/=2.0;
}
else if (RotMode==3)
moveX=0.0;
else if (RotMode==1)
moveY=0.0;
MoveItem(moveX, moveY, currItem);
}
currItem->setCornerRadius(QMIN(currItem->cornerRadius(), QMIN(currItem->width(),currItem->height())/2));
if ((currItem->asImageFrame()) && (!currItem->Sizing) && (!EditClip))
{
currItem->AdjustPictScale();
}
if (currItem->asLine())
{
if (!fromMP)
{
currItem->setRotation(atan2(currItem->height(),currItem->width())*(180.0/M_PI));
currItem->setWidthHeight(sqrt(pow(currItem->width(),2)+pow(currItem->height(),2)), 1.0);
}
currItem->Clip.setPoints(4, -ph,-ph, static_cast<int>(currItem->width()+ph),-ph,
static_cast<int>(currItem->width()+ph),static_cast<int>(currItem->height()+ph),
-ph,static_cast<int>(currItem->height()+ph));
}
setRedrawBounding(currItem);
currItem->OwnPage = OnPage(currItem);
if (currItem->Sizing)
{
currItem->FrameOnly = true;
currItem->Tinput = true;
if ((m_View->frameResizeHandle == 1) && !(currItem->asLine()))
currItem->paintObj();
if ((currItem->FrameType == 0) || (currItem->asLine()) || (m_View->frameResizeHandle != 1))
return true;
QPainter p;
p.begin(m_View->viewport());
QPoint in(qRound((currItem->xPos()-minCanvasCoordinate.x())*viewScale), qRound((currItem->yPos()-minCanvasCoordinate.y())*viewScale));
QPoint out(m_View->contentsToViewport(in));
p.translate(out.x(), out.y());
p.scale(viewScale, viewScale);
p.rotate(currItem->rotation());
p.setRasterOp(XorROP);
p.setBrush(NoBrush);
p.setPen(QPen(white, 1, DotLine, FlatCap, MiterJoin));
p.save();
if (currItem->OldB2 < 0.0)
{
p.scale(-1, 1);
p.translate(qRound(-currItem->OldB2), 0);
}
if (currItem->OldH2 < 0.0)
{
p.scale(1, -1);
p.translate(0, qRound(-currItem->OldH2));
}
currItem->DrawPolyL(&p, currItem->Clip);
p.restore();
currItem->updateClip();
currItem->updateGradientVectors();
p.save();
if (currItem->width() < 0.0)
{
p.scale(-1, 1);
p.translate(qRound(-currItem->width()), 0);
}
if (currItem->height() < 0.0)
{
p.scale(1, -1);
p.translate(0, qRound(-currItem->height()));
}
currItem->DrawPolyL(&p, currItem->Clip);
p.restore();
p.end();
return true;
}
if (DoUpdateClip)
{
double nX=0.0, nY=0.0;
if (fromMP)
{
if (currItem->imageFlippedH())
nX=-(currItem->width() - currItem->OldB2)/currItem->imageXScale();
if (currItem->imageFlippedV())
nY=-(currItem->height() - currItem->OldH2)/currItem->imageYScale();
}
else
{
if (!currItem->imageFlippedH())
nX=(currItem->width() - currItem->OldB2)/currItem->imageXScale();
if (!currItem->imageFlippedV())
nY=(currItem->height() - currItem->OldH2)/currItem->imageYScale();
}
if (nX!=0.0 || nY!=0.0)
currItem->moveImageInFrame(dX,dY);
currItem->updateClip();
}
currItem->updateGradientVectors();
if (redraw)
{
QRect newR(currItem->getRedrawBounding(viewScale));
emit updateContents(newR.unite(oldR));
}
if (!fromMP)
{
if (m_Selection->isMultipleSelection())
{
double gx, gy, gh, gw;
m_Selection->setGroupRect();
m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
qDebug("doc, emit w&h, when was this used?");
emit widthAndHeight(gw, gh);
}
}
return true;
}
 
//CB-->Doc
bool ScribusDoc::MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP, bool constrainRotation)
{
PageItem *currItem = Items->at(ite);
double viewScale=m_View->scale();
QRect oldR(currItem->getRedrawBounding(viewScale));
if (currItem->asLine())
{
QWMatrix ma;
ma.translate(currItem->xPos(), currItem->yPos());
ma.rotate(currItem->rotation());
double mx = ma.m11() * currItem->width() + ma.dx();
double my = ma.m12() * currItem->width() + ma.dy();
MoveItem(newX.x(), newX.y(), currItem, fromMP);
double newRot=xy2Deg(mx - currItem->xPos(), my - currItem->yPos());
//CB Hmm should work, doesnt. (constraining on the first point of a line)
//if (constrainRotation)
// qDebug(QString("%1").arg(constrainAngle(newRot)));
currItem->setRotation(newRot);
currItem->setWidthHeight(sqrt(pow(mx - currItem->xPos(),2)+pow(my - currItem->yPos(),2)), 1.0);
currItem->updateClip();
setRedrawBounding(currItem);
QRect newR(currItem->getRedrawBounding(viewScale));
emit updateContents(oldR);
emit updateContents(newR);
// updateContents(newR.unite(oldR));
}
else
{
currItem->OldB2 = currItem->width();
currItem->OldH2 = currItem->height();
if (currItem->rotation() != 0)
{
FPoint npv(newX.x(), newX.y());
QWMatrix ma3;
ma3.translate(currItem->xPos(), currItem->yPos());
ma3.rotate(currItem->rotation());
double mxc3 = currItem->xPos() - (ma3.m11() * npv.x() + ma3.m21() * npv.y() + ma3.dx());
double myc3 = currItem->yPos() - (ma3.m22() * npv.y() + ma3.m12() * npv.x() + ma3.dy());
SizeItem(currItem->width() - newY.x(), currItem->height() - newY.y(), ite, fromMP, true, false);
MoveItem(-mxc3, -myc3, currItem, fromMP);
}
else
{
SizeItem(currItem->width() - newY.x(), currItem->height() - newY.y(), ite, fromMP, true, false);
MoveItem(newX.x(), newX.y(), currItem, fromMP);
}
}
return true;
}
 
//CB-->Doc
void ScribusDoc::AdjustItemSize(PageItem *currItem)
{
bool siz = currItem->Sizing;
currItem->Sizing = false;
FPointArray Clip;
Clip = currItem->PoLine;
FPoint tp2(getMinClipF(&Clip));
SizeItem(currItem->width() - tp2.x(), currItem->height() - tp2.y(), currItem, true, false, false);
Clip.translate(-tp2.x(), -tp2.y());
if (currItem->rotation() != 0)
{
FPoint npv(tp2.x(), tp2.y());
MoveRotated(currItem, npv, true);
}
else
MoveItem(tp2.x(), tp2.y(), currItem, true);
if (!currItem->imageFlippedH())
currItem->moveImageInFrame(-tp2.x()/currItem->imageXScale(), 0);
if (!currItem->imageFlippedV())
currItem->moveImageInFrame(0, -tp2.y()/currItem->imageYScale());
FPoint tp(getMaxClipF(&Clip));
if (currItem->imageFlippedH())
currItem->moveImageInFrame((currItem->width() - tp.x())/currItem->imageXScale(), 0);
if (currItem->imageFlippedV())
currItem->moveImageInFrame(0, (currItem->height() - tp.y())/currItem->imageYScale());
SizeItem(tp.x(), tp.y(), currItem, true, false);
currItem->ClipEdited = true;
currItem->PoLine = Clip.copy();
if (currItem->asPolyLine())
currItem->setPolyClip(qRound(QMAX(currItem->lineWidth() / 2, 1)));
else
currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
currItem->Sizing = siz;
}
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
2153,9 → 2153,6
z = doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, x, y, w, h, pw, Pcolor, Pcolor2, true);
currItem = doc->Items->at(z);
break;
case PageItem::Multiple:
Q_ASSERT(false);
break;
}
currItem->FrameType = obj->attribute("FRTYPE", "0").toInt();
currItem->setStartArrowIndex(obj->attribute("startArrowIndex", "0").toInt());
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
2240,9 → 2240,6
z = doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, x, y, w, h, pw, Pcolor, Pcolor2, true);
currItem = doc->Items->at(z);
break;
case PageItem::Multiple:
Q_ASSERT(false);
break;
}
currItem->FrameType = obj->attribute("FRTYPE", "0").toInt();
currItem->setStartArrowIndex(obj->attribute("startArrowIndex", "0").toInt());
/branches/Version13x/Scribus/scribus/plugins/psimport/importps.cpp
580,7 → 580,7
ite->setWidthHeight(wh.x(),wh.y());
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
ite->setFillTransparency(1.0 - Opacity);
m_Doc->AdjustItemSize(ite);
m_Doc->view()->AdjustItemSize(ite);
if (groupStack.count() != 0)
{
QValueStack<int> groupOld = groupStack.top()->Groups;
630,7 → 630,7
ite->setWidthHeight(wh.x(), wh.y());
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
ite->setLineTransparency(1.0 - Opacity);
m_Doc->AdjustItemSize(ite);
m_Doc->view()->AdjustItemSize(ite);
if (groupStack.count() != 0)
{
QValueStack<int> groupOld = groupStack.top()->Groups;
665,7 → 665,7
ite->setWidthHeight(wh.x(),wh.y());
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
// ite->setFillTransparency(1.0 - Opacity);
m_Doc->AdjustItemSize(ite);
m_Doc->view()->AdjustItemSize(ite);
ite->Groups.push(m_Doc->GroupCounter);
if (groupStack.count() != 0)
{
/branches/Version13x/Scribus/scribus/plugins/svgimplugin/svgplugin.cpp
498,7 → 498,7
// item->setPolyClip(qRound(QMAX(item->lineWidth() / 2.0, 1)));
// else
// item->Clip = FlattenPath(item->PoLine, item->Segments);
m_Doc->AdjustItemSize(item);
m_Doc->view()->AdjustItemSize(item);
break;
}
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp
79,7 → 79,7
if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
ScCore->primaryMainWindow()->view->moveGroup(ValueToPoint(x), ValueToPoint(y));
else
ScCore->primaryMainWindow()->doc->MoveItem(ValueToPoint(x), ValueToPoint(y), item);
ScCore->primaryMainWindow()->view->MoveItem(ValueToPoint(x), ValueToPoint(y), item);
// Now restore the selection. We just have to go through and select
// each and every item, unfortunately.
//ScCore->primaryMainWindow()->doc->selection->restoreFromTempList(0, tempList);
119,7 → 119,7
ScCore->primaryMainWindow()->view->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
}
else
ScCore->primaryMainWindow()->doc->MoveItem(pageUnitXToDocX(x) - item->xPos(), pageUnitYToDocY(y) - item->yPos(), item);
ScCore->primaryMainWindow()->view->MoveItem(pageUnitXToDocX(x) - item->xPos(), pageUnitYToDocY(y) - item->yPos(), item);
// Now restore the selection. We just have to go through and select
// each and every item, unfortunately.
//ScCore->primaryMainWindow()->doc->selection->restoreFromTempList(0, tempList);
142,7 → 142,7
PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
if (item == NULL)
return NULL;
ScCore->primaryMainWindow()->doc->RotateItem(item->rotation() - x, item->ItemNr);
ScCore->primaryMainWindow()->view->RotateItem(item->rotation() - x, item->ItemNr);
Py_INCREF(Py_None);
return Py_None;
}
158,7 → 158,7
PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
if (item == NULL)
return NULL;
ScCore->primaryMainWindow()->doc->RotateItem(x * -1.0, item->ItemNr);
ScCore->primaryMainWindow()->view->RotateItem(x * -1.0, item->ItemNr);
Py_INCREF(Py_None);
return Py_None;
}
174,7 → 174,7
PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
if (item == NULL)
return NULL;
ScCore->primaryMainWindow()->doc->SizeItem(ValueToPoint(x), ValueToPoint(y), item->ItemNr);
ScCore->primaryMainWindow()->view->SizeItem(ValueToPoint(x), ValueToPoint(y), item->ItemNr);
Py_INCREF(Py_None);
return Py_None;
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
233,15 → 233,15
if (np2.x() < 0)
{
it->PoLine.translate(-np2.x(), 0);
ScCore->primaryMainWindow()->doc->MoveItem(np2.x(), 0, it);
ScCore->primaryMainWindow()->view->MoveItem(np2.x(), 0, it);
}
if (np2.y() < 0)
{
it->PoLine.translate(0, -np2.y());
ScCore->primaryMainWindow()->doc->MoveItem(0, np2.y(), it);
ScCore->primaryMainWindow()->view->MoveItem(0, np2.y(), it);
}
ScCore->primaryMainWindow()->doc->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScCore->primaryMainWindow()->doc->AdjustItemSize(it);
ScCore->primaryMainWindow()->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScCore->primaryMainWindow()->view->AdjustItemSize(it);
if (Name != "")
{
it->setItemName(QString::fromUtf8(Name));
313,15 → 313,15
if (np2.x() < 0)
{
it->PoLine.translate(-np2.x(), 0);
ScCore->primaryMainWindow()->doc->MoveItem(np2.x(), 0, it);
ScCore->primaryMainWindow()->view->MoveItem(np2.x(), 0, it);
}
if (np2.y() < 0)
{
it->PoLine.translate(0, -np2.y());
ScCore->primaryMainWindow()->doc->MoveItem(0, np2.y(), it);
ScCore->primaryMainWindow()->view->MoveItem(0, np2.y(), it);
}
ScCore->primaryMainWindow()->doc->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScCore->primaryMainWindow()->doc->AdjustItemSize(it);
ScCore->primaryMainWindow()->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScCore->primaryMainWindow()->view->AdjustItemSize(it);
if (Name != "")
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
400,15 → 400,15
if (np2.x() < 0)
{
it->PoLine.translate(-np2.x(), 0);
ScCore->primaryMainWindow()->doc->MoveItem(np2.x(), 0, it);
ScCore->primaryMainWindow()->view->MoveItem(np2.x(), 0, it);
}
if (np2.y() < 0)
{
it->PoLine.translate(0, -np2.y());
ScCore->primaryMainWindow()->doc->MoveItem(0, np2.y(), it);
ScCore->primaryMainWindow()->view->MoveItem(0, np2.y(), it);
}
ScCore->primaryMainWindow()->doc->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScCore->primaryMainWindow()->doc->AdjustItemSize(it);
ScCore->primaryMainWindow()->view->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
ScCore->primaryMainWindow()->view->AdjustItemSize(it);
if (Name != "")
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
446,7 → 446,7
ScCore->primaryMainWindow()->doc->m_Selection->addItem(ScCore->primaryMainWindow()->doc->Items->at(ii));
PageItem *it = ScCore->primaryMainWindow()->doc->Items->at(i);
ScCore->primaryMainWindow()->view->ToPathText();
ScCore->primaryMainWindow()->doc->MoveItem(pageUnitXToDocX(x) - it->xPos(), pageUnitYToDocY(y) - it->yPos(), it);
ScCore->primaryMainWindow()->view->MoveItem(pageUnitXToDocX(x) - it->xPos(), pageUnitYToDocY(y) - it->yPos(), it);
if (Name != "")
it->setItemName(QString::fromUtf8(Name));
return PyString_FromString(it->itemName().utf8());
/branches/Version13x/Scribus/scribus/page.cpp
254,7 → 254,7
m_Doc->Items->append(oldItem);
oldItem->ItemNr = m_Doc->Items->count()-1;
oldItem->updatePolyClip();
m_Doc->AdjustItemSize(oldItem);
m_Doc->view()->AdjustItemSize(oldItem);
}
else
{
/branches/Version13x/Scribus/scribus/scribusdoc.h
767,19 → 767,7
FPoint ApplyGridF(const FPoint& in);
/*! \brief Does this doc have any TOC setups and potentially a TOC to generate */
bool hasTOCSetup() { return !docToCSetups.empty(); }
//! \brief Get the closest guide to the given point
void getClosestGuides(double xin, double yin, double *xout, double *yout);
//! \brief Snap an item to the guides
void SnapToGuides(PageItem *currItem);
bool ApplyGuides(double *x, double *y);
bool MoveItem(double newX, double newY, PageItem* ite, bool fromMP = false);
void RotateItem(double win, int ite);
void RotateItem(double win, PageItem *currItem);
void MoveRotated(PageItem *currItem, FPoint npv, bool fromMP = false);
bool SizeItem(double newX, double newY, int ite, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
bool SizeItem(double newX, double newY, PageItem *pi, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
bool MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP = false, bool constrainRotation=false);
void AdjustItemSize(PageItem *currItem);
 
protected:
void addSymbols();
982,7 → 970,6
*/
void docChanged();
void updateContents();
void updateContents(const QRect &r);
void refreshItem(PageItem *);
void canvasAdjusted(double width, double height, double dX, double dY);
void firstSelectedItemType(int);
997,8 → 984,6
* This also applies to Master Pages
*/
void signalRebuildOutLinePalette();
//! Temporary signal for SizeItem
void widthAndHeight(double, double);
public slots:
void itemSelection_ToggleLock();
/branches/Version13x/Scribus/scribus/pageitem.cpp
2819,7 → 2819,7
mx = -mx;
my = -my;
}
m_Doc->MoveItem(mx, my, this, false);
m_Doc->view()->MoveItem(mx, my, this, false);
oldXpos = Xpos;
oldYpos = Ypos;
oldOwnPage = OwnPage;
2842,17 → 2842,17
double my = oy - y;
if (isUndo)
{
m_Doc->SizeItem(ow, oh, this, false, true, true);
m_Doc->MoveItem(mx, my, this, false);
m_Doc->RotateItem(ort, this);
view->SizeItem(ow, oh, this, false, true, true);
view->MoveItem(mx, my, this, false);
view->RotateItem(ort, this);
}
else
{
mx = -mx;
my = -my;
m_Doc->SizeItem(w, h, this, false, true, true);
m_Doc->MoveItem(mx, my, this, false);
m_Doc->RotateItem(rt, this);
view->SizeItem(w, h, this, false, true, true);
view->MoveItem(mx, my, this, false);
view->RotateItem(rt, this);
}
oldWidth = Width;
oldHeight = Height;
2886,9 → 2886,9
Ypos+=my;
Width=ow;
Height=oh;*/
m_Doc->RotateItem(ort, this);
m_Doc->MoveItem(mx, my, this, false);
m_Doc->SizeItem(ow, oh, this, false, true, true);
view->RotateItem(ort, this);
view->MoveItem(mx, my, this, false);
view->SizeItem(ow, oh, this, false, true, true);
}
else
{
2901,9 → 2901,9
Width=w;
Height=h;
*/
m_Doc->RotateItem(rt, this);
m_Doc->MoveItem(mx, my, this, false);
m_Doc->SizeItem(w, h, this, false, true, true);
view->RotateItem(rt, this);
view->MoveItem(mx, my, this, false);
view->SizeItem(w, h, this, false, true, true);
}
/*
m_Doc->setRedrawBounding(this);
3222,8 → 3222,8
else
PoLine = newClip;
}
m_Doc->AdjustItemSize(this);
m_Doc->MoveItem(mx, my, this, false);
m_Doc->view()->AdjustItemSize(this);
m_Doc->view()->MoveItem(mx, my, this, false);
m_Doc->view()->slotUpdateContents();
}
 
/branches/Version13x/Scribus/scribus/mpalette.cpp
2461,9 → 2461,9
{
double r = atan2(h-y,w-x)*(180.0/M_PI);
w = sqrt(pow(w-x,2)+pow(h-y,2));
doc->MoveItem(x - CurItem->xPos(), 0, CurItem, true);
doc->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
doc->RotateItem(r, CurItem->ItemNr);
m_ScMW->view->MoveItem(x - CurItem->xPos(), 0, CurItem, true);
m_ScMW->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->RotateItem(r, CurItem->ItemNr);
}
else
{
2479,7 → 2479,7
base = ma.m11() * CurItem->width() + ma.m21() * CurItem->height() + ma.dx();
if (BottomLeft->isChecked())
base = ma.m11() * 0.0 + ma.m21() * CurItem->height() + ma.dx();
doc->MoveItem(x - base, 0, CurItem, true);
m_ScMW->view->MoveItem(x - base, 0, CurItem, true);
}
}
m_ScMW->view->updateContents();
2529,9 → 2529,9
{
double r = atan2(h-y,w-x)*(180.0/M_PI);
w = sqrt(pow(w-x,2)+pow(h-y,2));
doc->MoveItem(0, y - CurItem->yPos(), CurItem, true);
doc->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
doc->RotateItem(r, CurItem->ItemNr);
m_ScMW->view->MoveItem(0, y - CurItem->yPos(), CurItem, true);
m_ScMW->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->RotateItem(r, CurItem->ItemNr);
}
else
{
2547,7 → 2547,7
base = ma.m22() * CurItem->height() + ma.m12() * CurItem->width() + ma.dy();
if (BottomLeft->isChecked())
base = ma.m22() * CurItem->height() + ma.m12() * 0.0 + ma.dy();
doc->MoveItem(0, y - base, CurItem, true);
m_ScMW->view->MoveItem(0, y - base, CurItem, true);
}
}
m_ScMW->view->updateContents();
2597,10 → 2597,10
if (LMode)
{
double r = atan2(h-y,w-x)*(180.0/M_PI);
doc->RotateItem(r, CurItem->ItemNr);
m_ScMW->view->RotateItem(r, CurItem->ItemNr);
w = sqrt(pow(w-x,2)+pow(h-y,2));
}
doc->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
}
else
{
2621,19 → 2621,19
bb2 = bb;
while (bb2->RightLink != 0)
{
doc->MoveRotated(bb2->RightLink, FPoint(dist, 0), true);
m_ScMW->view->MoveRotated(bb2->RightLink, FPoint(dist, 0), true);
bb2 = bb2->RightLink;
}
doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
m_ScMW->view->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
bb = bb->BottomLink;
}
bb2 = bb;
while (bb2->RightLink != 0)
{
doc->MoveRotated(bb2->RightLink, FPoint(dist, 0), true);
m_ScMW->view->MoveRotated(bb2->RightLink, FPoint(dist, 0), true);
bb2 = bb2->RightLink;
}
doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
m_ScMW->view->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
doc->RotMode = rmo;
if (keepFrameWHRatioButton->isOn())
{
2648,10 → 2648,10
if (keepFrameWHRatioButton->isOn())
{
setBH(w, (w / CurItem->width()) * CurItem->height());
doc->SizeItem(w, (w / CurItem->width()) * CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->SizeItem(w, (w / CurItem->width()) * CurItem->height(), CurItem->ItemNr, true);
}
else
doc->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
}
}
}
2702,10 → 2702,10
if (LMode)
{
double r = atan2(h-y,w-x)*(180.0/M_PI);
doc->RotateItem(r, CurItem->ItemNr);
m_ScMW->view->RotateItem(r, CurItem->ItemNr);
w = sqrt(pow(w-x,2)+pow(h-y,2));
}
doc->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
m_ScMW->view->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
}
else
{
2726,19 → 2726,19
bb2 = bb;
while (bb2->BottomLink != 0)
{
doc->MoveRotated(bb2->BottomLink, FPoint(0, dist), true);
m_ScMW->view->MoveRotated(bb2->BottomLink, FPoint(0, dist), true);
bb2 = bb2->BottomLink;
}
doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
m_ScMW->view->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
bb = bb->RightLink;
}
bb2 = bb;
while (bb2->BottomLink != 0)
{
doc->MoveRotated(bb2->BottomLink, FPoint(0, dist), true);
m_ScMW->view->MoveRotated(bb2->BottomLink, FPoint(0, dist), true);
bb2 = bb2->BottomLink;
}
doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
m_ScMW->view->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
doc->RotMode = rmo;
if (keepFrameWHRatioButton->isOn())
{
2753,10 → 2753,10
if (keepFrameWHRatioButton->isOn())
{
setBH((h / CurItem->height()) * CurItem->width(), h);
doc->SizeItem((h / CurItem->height()) * CurItem->width(), h, CurItem->ItemNr, true);
m_ScMW->view->SizeItem((h / CurItem->height()) * CurItem->width(), h, CurItem->ItemNr, true);
}
else
doc->SizeItem(CurItem->width(), h, CurItem->ItemNr, true);
m_ScMW->view->SizeItem(CurItem->width(), h, CurItem->ItemNr, true);
}
}
}
2784,7 → 2784,7
setXY(gx, gy);
}
else
doc->RotateItem(Rot->value()*(-1), CurItem->ItemNr);
m_ScMW->view->RotateItem(Rot->value()*(-1), CurItem->ItemNr);
emit DocChanged();
m_ScMW->view->updateContents();
RoVal = Rot->value();
3866,7 → 3866,7
if ((HaveDoc) && (HaveItem))
{
CurItem->setTextToFrameDistLeft(Dist->value());
doc->AdjustItemSize(CurItem);
m_ScMW->view->AdjustItemSize(CurItem);
CurItem->updatePolyClip();
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
3880,7 → 3880,7
if ((HaveDoc) && (HaveItem))
{
CurItem->BaseOffs = -LineW->value();
doc->AdjustItemSize(CurItem);
m_ScMW->view->AdjustItemSize(CurItem);
CurItem->updatePolyClip();
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
/branches/Version13x/Scribus/scribus/frameedit.cpp
465,7 → 465,7
if (AbsMode->isChecked())
np -= zp;
view->MoveClipPoint(doc->m_Selection->itemAt(0), np);
doc->AdjustItemSize(doc->m_Selection->itemAt(0));
view->AdjustItemSize(doc->m_Selection->itemAt(0));
emit DocChanged();
}
}
/branches/Version13x/Scribus/scribus/scribusview.h
187,9 → 187,11
void FromVRuler(QMouseEvent *m);
void SetYGuide(QMouseEvent *m, int oldIndex);
void SetXGuide(QMouseEvent *m, int oldIndex);
// void getClosestGuides(double xin, double yin, double *xout, double *yout);
// bool ApplyGuides(double *x, double *y);
// void SnapToGuides(PageItem *currItem);
void getClosestGuides(double xin, double yin, double *xout, double *yout);
bool ApplyGuides(double *x, double *y);
void SnapToGuides(PageItem *currItem);
// void setGroupRect();
// void getGroupRect(double *x, double *y, double *w, double *h);
void getDragRectScreen(double *x, double *y, double *w, double *h);
void getGroupRectScreen(double *x, double *y, double *w, double *h);
void paintGroupRect(bool norm = true);
196,7 → 198,7
void PaintSizeRect(QPainter *p, QRect neu);
void ToView(QPainter *p);
void ToView(QWMatrix& m);
// bool MoveItem(double newX, double newY, PageItem* ite, bool fromMP = false);
bool MoveItem(double newX, double newY, PageItem* ite, bool fromMP = false);
void MarkClip(PageItem *currItem, FPointArray cli, bool once = false);
bool PointOnLine(QPoint Start, QPoint Ende, QRect MArea);
void TransformPoly(int mode, int rot = 1, double scaling = 1.0);
203,16 → 205,16
void Reset1Control();
void ResetControl();
void MoveClipPoint(PageItem *currItem, FPoint np);
// bool SizeItem(double newX, double newY, int ite, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
// bool SizeItem(double newX, double newY, PageItem *pi, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
bool SizeItem(double newX, double newY, int ite, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
bool SizeItem(double newX, double newY, PageItem *pi, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
void moveGroup(double x, double y, bool fromMP = false, Selection* customSelection = 0);
// void MoveRotated(PageItem *currItem, FPoint npv, bool fromMP = false);
// bool MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP = false, bool constrainRotation=false);
void MoveRotated(PageItem *currItem, FPoint npv, bool fromMP = false);
bool MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP = false, bool constrainRotation=false);
void RotateGroup(double win);
void scaleGroup(double scx, double scy, bool scaleText=true, Selection* customSelection = 0);
// void RotateItem(double win, int ite);
// void RotateItem(double win, PageItem *currItem);
// void AdjustItemSize(PageItem *currItem);
void RotateItem(double win, int ite);
void RotateItem(double win, PageItem *currItem);
void AdjustItemSize(PageItem *currItem);
bool slotSetCurs(int x, int y);
void slotDoCurs(bool draw);
void HandleCurs(QPainter *p, PageItem *currItem, QRect mpo);
/branches/Version13x/Scribus/scribus/pdflib.cpp
1709,9 → 1709,6
PutPage(PDF_TransparenzFill(ite));
PutPage(setTextSt(ite, pag->pageNr(), pag));
break;
case PageItem::Multiple:
Q_ASSERT(false);
break;
}
PutPage("Q\n");
StartObj(ObjCounter);
3363,9 → 3360,6
tmp += PDF_TransparenzFill(ite);
tmp += setTextSt(ite, PNr, pag);
break;
case PageItem::Multiple:
Q_ASSERT(false);
break;
}
tmp += "Q\n";
return tmp;