r15033 by fschmid - Mesh Gradient Editor: added multiselection of mesh points.
scribus-commit
scribus-commit at lists.scribus.net
Sun May 2 12:30:35 CEST 2010
Revision: 15033
Author: fschmid
Date: 2010-05-02T10:23:40.610129Z
Commit message: Mesh Gradient Editor: added multiselection of mesh points.
Changeset:
M /trunk/Scribus/scribus/canvas.cpp
M /trunk/Scribus/scribus/ui/cpalette.cpp
M /trunk/Scribus/scribus/canvas.h
M /trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
M /trunk/Scribus/scribus/canvasmode_editmeshgradient.h
M /trunk/Scribus/scribus/ui/about.cpp
Diffs:
Index: scribus/canvasmode_editmeshgradient.cpp
===================================================================
--- scribus/canvasmode_editmeshgradient.cpp (revision 15032)
+++ scribus/canvasmode_editmeshgradient.cpp (revision 15033)
@@ -63,8 +63,7 @@
CanvasMode_EditMeshGradient::CanvasMode_EditMeshGradient(ScribusView* view) : CanvasMode(view), m_ScMW(view->m_ScMW)
{
Mxp = Myp = -1;
- arrayX = -1;
- arrayY = -1;
+ selectedMeshPoints.clear();
m_gradientPoint = noPointDefined;
}
@@ -76,6 +75,7 @@
void CanvasMode_EditMeshGradient::drawControls(QPainter* p)
{
+ p->save();
if (m_canvas->m_viewMode.operItemMoving)
{
drawOutline(p);
@@ -84,8 +84,255 @@
{
drawSelection(p, false);
}
+ if (m_doc->appMode == modeEditMeshGradient)
+ {
+ drawControlsMeshGradient(p, m_doc->m_Selection->itemAt(0));
+ }
+ p->restore();
}
+void CanvasMode_EditMeshGradient::drawControlsMeshGradient(QPainter* psx, PageItem* currItem)
+{
+ QPen p1b = QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+ QPen p1bd = QPen(Qt::blue, 1.0 / m_canvas->m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin);
+ QPen p8b = QPen(Qt::blue, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin);
+ QPen p8r = QPen(Qt::red, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin);
+ QPen p8m = QPen(Qt::magenta, 8.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin);
+ QPen p14r = QPen(Qt::red, 14.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin);
+ QPen p14w = QPen(Qt::white, 14.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin);
+ psx->translate(static_cast<int>(currItem->xPos()), static_cast<int>(currItem->yPos()));
+ psx->rotate(currItem->rotation());
+ psx->setPen(p1b);
+ psx->setBrush(Qt::NoBrush);
+ for (int grow = 0; grow < currItem->meshGradientArray.count()-1; grow++)
+ {
+ for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count()-1; gcol++)
+ {
+ meshPoint mp1 = currItem->meshGradientArray[grow][gcol];
+ meshPoint mp2 = currItem->meshGradientArray[grow][gcol+1];
+ meshPoint mp3 = currItem->meshGradientArray[grow+1][gcol+1];
+ meshPoint mp4 = currItem->meshGradientArray[grow+1][gcol];
+ QPainterPath Bez;
+ Bez.moveTo(mp1.gridPoint.x(), mp1.gridPoint.y());
+ Bez.cubicTo(mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
+ Bez.cubicTo(mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
+ Bez.cubicTo(mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
+ Bez.cubicTo(mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
+ psx->setPen(p1b);
+ psx->drawPath(Bez);
+ }
+ }
+ for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++)
+ {
+ for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count(); gcol++)
+ {
+ bool isSelected = false;
+ for (int se = 0; se < selectedMeshPoints.count(); se++)
+ {
+ if ((grow == selectedMeshPoints[se].first) && (gcol == selectedMeshPoints[se].second))
+ {
+ isSelected = true;
+ break;
+ }
+ }
+ meshPoint mp1 = currItem->meshGradientArray[grow][gcol];
+ if (m_view->editStrokeGradient == 5)
+ {
+ if (isSelected)
+ psx->setPen(p8r);
+ else
+ psx->setPen(p8m);
+ psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()));
+ }
+ else if (m_view->editStrokeGradient == 6)
+ {
+ if (isSelected)
+ psx->setPen(p14r);
+ else
+ psx->setPen(p14w);
+ psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()));
+ psx->setPen(QPen(mp1.color, 10.0 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()));
+ }
+ else if (m_view->editStrokeGradient == 7)
+ {
+ psx->setPen(p8b);
+ psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()));
+ }
+ }
+ }
+ if ((selectedMeshPoints.count() > 0) && (m_view->editStrokeGradient == 7))
+ {
+ int grow = selectedMeshPoints[0].first;
+ int gcol = selectedMeshPoints[0].second;
+ meshPoint mp1 = currItem->meshGradientArray[grow][gcol];
+ psx->setPen(p8m);
+ if (grow == 0)
+ {
+ if (gcol == 0)
+ {
+ psx->setPen(p1bd);
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlR)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlB)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ }
+ else if (gcol == currItem->meshGradientArray[grow].count()-1)
+ {
+ psx->setPen(p1bd);
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlL)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlB)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ }
+ else
+ {
+ psx->setPen(p1bd);
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlL)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlB)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ if (m_gradientPoint == useControlR)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ }
+ }
+ else if (grow == currItem->meshGradientArray.count()-1)
+ {
+ if (gcol == 0)
+ {
+ psx->setPen(p1bd);
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlR)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlT)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ }
+ else if (gcol == currItem->meshGradientArray[grow].count()-1)
+ {
+ psx->setPen(p1bd);
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlL)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlT)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ }
+ else
+ {
+ psx->setPen(p1bd);
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlL)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlT)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ if (m_gradientPoint == useControlR)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ }
+ }
+ else
+ {
+ if (gcol == 0)
+ {
+ psx->setPen(p1bd);
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlR)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlT)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlB)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ }
+ else if (gcol == currItem->meshGradientArray[grow].count()-1)
+ {
+ psx->setPen(p1bd);
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlL)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlT)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlB)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ }
+ else
+ {
+ psx->setPen(p1bd);
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlL)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlT)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlB)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
+ psx->setPen(p8m);
+ if (m_gradientPoint == useControlR)
+ psx->setPen(p8r);
+ psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
+ }
+ }
+ }
+}
+
void CanvasMode_EditMeshGradient::enterEvent(QEvent *)
{
if (!m_canvas->m_viewMode.m_MouseButtonPressed)
@@ -110,6 +357,7 @@
m_canvas->m_viewMode.operItemMoving = false;
m_canvas->m_viewMode.operItemResizing = false;
m_view->MidButt = false;
+ selectedMeshPoints.clear();
Mxp = Myp = -1;
setModeCursor();
if (fromGesture)
@@ -121,8 +369,7 @@
void CanvasMode_EditMeshGradient::deactivate(bool forGesture)
{
m_view->redrawMarker->hide();
- arrayX = -1;
- arrayY = -1;
+ selectedMeshPoints.clear();
m_gradientPoint = noPointDefined;
m_ScMW->propertiesPalette->updateColorSpecialGradient();
}
@@ -170,30 +417,35 @@
{
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
m->accept();
- if ((arrayX == -1) || (arrayY == -1))
+ if (selectedMeshPoints.count() == 0)
return;
- if (m_canvas->m_viewMode.m_MouseButtonPressed)
+ if (m_canvas->m_viewMode.m_MouseButtonPressed && m_view->moveTimerElapsed())
{
double newX = mousePointDoc.x();
double newY = mousePointDoc.y();
PageItem *currItem = m_doc->m_Selection->itemAt(0);
FPoint npx(Mxp - newX, Myp - newY, 0, 0, currItem->rotation(), 1, 1, true);
- if ((arrayX > -1) && (arrayY > -1))
+ if (selectedMeshPoints.count() > 0)
{
if (m_view->editStrokeGradient == 5)
{
- currItem->meshGradientArray[arrayX][arrayY].moveRel(-npx.x(), -npx.y());
+ for (int mo = 0; mo < selectedMeshPoints.count(); mo++)
+ {
+ QPair<int, int> selP = selectedMeshPoints[mo];
+ currItem->meshGradientArray[selP.first][selP.second].moveRel(-npx.x(), -npx.y());
+ }
}
else if (m_view->editStrokeGradient == 7)
{
+ QPair<int, int> selP = selectedMeshPoints[0];
if (m_gradientPoint == useControlT)
- currItem->meshGradientArray[arrayX][arrayY].controlTop -= npx;
+ currItem->meshGradientArray[selP.first][selP.second].controlTop -= npx;
else if (m_gradientPoint == useControlB)
- currItem->meshGradientArray[arrayX][arrayY].controlBottom -= npx;
+ currItem->meshGradientArray[selP.first][selP.second].controlBottom -= npx;
else if (m_gradientPoint == useControlL)
- currItem->meshGradientArray[arrayX][arrayY].controlLeft -= npx;
+ currItem->meshGradientArray[selP.first][selP.second].controlLeft -= npx;
else if (m_gradientPoint == useControlR)
- currItem->meshGradientArray[arrayX][arrayY].controlRight -= npx;
+ currItem->meshGradientArray[selP.first][selP.second].controlRight -= npx;
}
currItem->update();
QRectF upRect;
@@ -218,9 +470,6 @@
m_doc->leaveDrag = false;
m->accept();
m_view->registerMousePress(m->globalPos());
- arrayX = -1;
- arrayY = -1;
- m_gradientPoint = noPointDefined;
Mxp = mousePointDoc.x(); //m->x();
Myp = mousePointDoc.y(); //m->y();
if (m->button() == Qt::MidButton)
@@ -232,12 +481,11 @@
}
QTransform itemMatrix;
PageItem *currItem = m_doc->m_Selection->itemAt(0);
- currItem->selectedMeshPointX = arrayX;
- currItem->selectedMeshPointY = arrayY;
itemMatrix.translate(currItem->xPos(), currItem->yPos());
itemMatrix.rotate(currItem->rotation());
bool found = false;
- if ((m_view->editStrokeGradient == 5) || (m_view->editStrokeGradient == 6))
+ QPair<int, int> selPoint;
+ if (m_view->editStrokeGradient == 5)
{
for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++)
{
@@ -248,10 +496,8 @@
gradientPoint = itemMatrix.map(gradientPoint);
if (m_canvas->hitsCanvasPoint(m->globalPos(), gradientPoint))
{
- arrayX = grow;
- arrayY = gcol;
- currItem->selectedMeshPointX = arrayX;
- currItem->selectedMeshPointY = arrayY;
+ selPoint.first = grow;
+ selPoint.second = gcol;
found = true;
break;
}
@@ -260,6 +506,30 @@
break;
}
}
+ else if (m_view->editStrokeGradient == 6)
+ {
+ selectedMeshPoints.clear();
+ for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++)
+ {
+ for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count(); gcol++)
+ {
+ meshPoint mp = currItem->meshGradientArray[grow][gcol];
+ QPointF gradientPoint = QPointF(mp.gridPoint.x(), mp.gridPoint.y());
+ gradientPoint = itemMatrix.map(gradientPoint);
+ if (m_canvas->hitsCanvasPoint(m->globalPos(), gradientPoint))
+ {
+ selPoint.first = grow;
+ selPoint.second = gcol;
+ currItem->selectedMeshPointX = grow;
+ currItem->selectedMeshPointY = gcol;
+ found = true;
+ break;
+ }
+ }
+ if (found)
+ break;
+ }
+ }
else if (m_view->editStrokeGradient == 7)
{
for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++)
@@ -450,11 +720,8 @@
}
if (found)
{
- arrayX = grow;
- arrayY = gcol;
- currItem->selectedMeshPointX = arrayX;
- currItem->selectedMeshPointY = arrayY;
- currItem->selectedMeshControlPoint = static_cast<int>(m_gradientPoint);
+ selPoint.first = grow;
+ selPoint.second = gcol;
break;
}
}
@@ -472,10 +739,8 @@
gradientPoint = itemMatrix.map(gradientPoint);
if (m_canvas->hitsCanvasPoint(m->globalPos(), gradientPoint))
{
- arrayX = grow;
- arrayY = gcol;
- currItem->selectedMeshPointX = arrayX;
- currItem->selectedMeshPointY = arrayY;
+ selPoint.first = grow;
+ selPoint.second = gcol;
found = true;
break;
}
@@ -485,6 +750,30 @@
}
}
}
+ if (!found)
+ {
+ if (!(m->modifiers() & Qt::ShiftModifier))
+ {
+ m_gradientPoint = noPointDefined;
+ selectedMeshPoints.clear();
+ }
+ }
+ else
+ {
+ if (!(m->modifiers() & Qt::ShiftModifier))
+ selectedMeshPoints.clear();
+ bool isSelected = false;
+ for (int se = 0; se < selectedMeshPoints.count(); se++)
+ {
+ if ((selPoint.first == selectedMeshPoints[se].first) && (selPoint.second == selectedMeshPoints[se].second))
+ {
+ isSelected = true;
+ break;
+ }
+ }
+ if (!isSelected)
+ selectedMeshPoints.append(selPoint);
+ }
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_ScMW->propertiesPalette->updateColorSpecialGradient();
qApp->changeOverrideCursor(QCursor(Qt::CrossCursor));
@@ -492,7 +781,6 @@
upRect = QRectF(QPointF(0, 0), QPointF(currItem->width(), currItem->height())).normalized();
upRect.translate(currItem->xPos(), currItem->yPos());
m_doc->regionsChanged()->update(upRect.adjusted(-10.0 - currItem->width() / 2.0, -10.0 - currItem->height() / 2.0, 10.0 + currItem->width() / 2.0, 10.0 + currItem->height() / 2.0));
-
}
void CanvasMode_EditMeshGradient::mouseReleaseEvent(QMouseEvent *m)
@@ -501,9 +789,6 @@
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_canvas->resetRenderMode();
m->accept();
- arrayX = -1;
- arrayY = -1;
- m_gradientPoint = noPointDefined;
PageItem *currItem = m_doc->m_Selection->itemAt(0);
currItem->update();
QRectF upRect;
Index: scribus/canvas.h
===================================================================
--- scribus/canvas.h (revision 15032)
+++ scribus/canvas.h (revision 15033)
@@ -224,7 +224,6 @@
void drawControlsMovingItemsRect(QPainter* pp);
// void drawControlsHighlightRect(QPainter* pp);
void drawControlsGradientVectors(QPainter* psx, PageItem *currItem);
- void drawControlsMeshGradient(QPainter* pp, PageItem* currItem);
void drawControlsBezierCurve(QPainter* pp, PageItem* currItem);
void drawControlsMeasurementLine(QPainter* pp);
void drawControlsDrawLine(QPainter* pp);
Index: scribus/canvas.cpp
===================================================================
--- scribus/canvas.cpp (revision 15032)
+++ scribus/canvas.cpp (revision 15033)
@@ -1003,10 +1003,6 @@
{
drawControlsGradientVectors(psx, m_doc->m_Selection->itemAt(0));
}
- if (m_doc->appMode == modeEditMeshGradient)
- {
- drawControlsMeshGradient(psx, m_doc->m_Selection->itemAt(0));
- }
if (m_viewMode.operItemMoving || m_viewMode.operItemResizing)
{
if (m_viewMode.operItemResizing)
@@ -1302,171 +1298,6 @@
}
}
-void Canvas::drawControlsMeshGradient(QPainter* psx, PageItem* currItem)
-{
- psx->translate(static_cast<int>(currItem->xPos()), static_cast<int>(currItem->yPos()));
- psx->rotate(currItem->rotation());
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
- psx->setBrush(Qt::NoBrush);
- for (int grow = 0; grow < currItem->meshGradientArray.count()-1; grow++)
- {
- for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count()-1; gcol++)
- {
- meshPoint mp1 = currItem->meshGradientArray[grow][gcol];
- meshPoint mp2 = currItem->meshGradientArray[grow][gcol+1];
- meshPoint mp3 = currItem->meshGradientArray[grow+1][gcol+1];
- meshPoint mp4 = currItem->meshGradientArray[grow+1][gcol];
- QPainterPath Bez;
- Bez.moveTo(mp1.gridPoint.x(), mp1.gridPoint.y());
- Bez.cubicTo(mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
- Bez.cubicTo(mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
- Bez.cubicTo(mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
- Bez.cubicTo(mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
- psx->drawPath(Bez);
- }
- }
- for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++)
- {
- for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count(); gcol++)
- {
- meshPoint mp1 = currItem->meshGradientArray[grow][gcol];
- if (m_view->editStrokeGradient == 5)
- {
- if ((currItem->selectedMeshPointX == grow) && (currItem->selectedMeshPointY == gcol))
- psx->setPen(QPen(Qt::red, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- else
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()));
- }
- else if (m_view->editStrokeGradient == 6)
- {
- if ((currItem->selectedMeshPointX == grow) && (currItem->selectedMeshPointY == gcol))
- psx->setPen(QPen(Qt::red, 14.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- else
- psx->setPen(QPen(Qt::white, 14.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()));
- psx->setPen(QPen(mp1.color, 10.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()));
- }
- else if (m_view->editStrokeGradient == 7)
- {
- psx->setPen(QPen(Qt::blue, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()));
- }
- }
- }
- if ((currItem->selectedMeshPointX > -1) && (currItem->selectedMeshPointY > -1) && (m_view->editStrokeGradient == 7))
- {
- int grow = currItem->selectedMeshPointX;
- int gcol = currItem->selectedMeshPointY;
- meshPoint mp1 = currItem->meshGradientArray[grow][gcol];
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- if (grow == 0)
- {
- if (gcol == 0)
- {
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- }
- else if (gcol == currItem->meshGradientArray[grow].count()-1)
- {
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- }
- else
- {
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- }
- }
- else if (grow == currItem->meshGradientArray.count()-1)
- {
- if (gcol == 0)
- {
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- }
- else if (gcol == currItem->meshGradientArray[grow].count()-1)
- {
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- }
- else
- {
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- }
- }
- else
- {
- if (gcol == 0)
- {
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- }
- else if (gcol == currItem->meshGradientArray[grow].count()-1)
- {
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- }
- else
- {
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->drawLine(QPointF(mp1.gridPoint.x(), mp1.gridPoint.y()), QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
- psx->drawPoint(QPointF(mp1.controlLeft.x(), mp1.controlLeft.y()));
- psx->drawPoint(QPointF(mp1.controlTop.x(), mp1.controlTop.y()));
- psx->drawPoint(QPointF(mp1.controlBottom.x(), mp1.controlBottom.y()));
- psx->drawPoint(QPointF(mp1.controlRight.x(), mp1.controlRight.y()));
- }
- }
- }
-}
-
/**
draws the bezier curve in edit bezier mode
*/
Index: scribus/canvasmode_editmeshgradient.h
===================================================================
--- scribus/canvasmode_editmeshgradient.h (revision 15032)
+++ scribus/canvasmode_editmeshgradient.h (revision 15033)
@@ -52,6 +52,7 @@
virtual void mouseMoveEvent(QMouseEvent *m);
virtual void mousePressEvent(QMouseEvent *m);
virtual void drawControls(QPainter* p);
+ void drawControlsMeshGradient(QPainter* pp, PageItem* currItem);
private:
@@ -73,6 +74,7 @@
int arrayX;
int arrayY;
eMGradientPoint m_gradientPoint;
+ QList<QPair<int, int> > selectedMeshPoints;
};
Index: scribus/ui/cpalette.cpp
===================================================================
--- scribus/ui/cpalette.cpp (revision 15032)
+++ scribus/ui/cpalette.cpp (revision 15033)
@@ -123,6 +123,13 @@
void Cpalette::setCurrentItem(PageItem* item)
{
+ if ((item == NULL) || (currentItem != item))
+ {
+ editStrokeGradient = 0;
+ CGradDia->hide();
+ editMeshColors->setEnabled(true);
+ gradEditButton->setEnabled(true);
+ }
currentItem = item;
}
Index: scribus/ui/about.cpp
===================================================================
--- scribus/ui/about.cpp (revision 15032)
+++ scribus/ui/about.cpp (revision 15033)
@@ -114,8 +114,8 @@
buildID = new QLabel( tab );
buildID->setAlignment(Qt::AlignCenter);
buildID->setTextInteractionFlags(Qt::TextSelectableByMouse);
- QString BUILD_DAY = "21";
- QString BUILD_MONTH = CommonStrings::april;
+ QString BUILD_DAY = " 2";
+ QString BUILD_MONTH = CommonStrings::may;
QString BUILD_YEAR = "2010";
QString BUILD_TIME = "";
QString BUILD_TZ = "";
More information about the scribus-commit
mailing list