r16277 by fschmid - Finally fixed Bug #7991: "add a simple way to create portion of circle"
scribus-commit
scribus-commit at lists.scribus.net
Tue Jan 18 22:08:42 CET 2011
Author: fschmid
Date: Tue Jan 18 21:08:42 2011
New Revision: 16277
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16277
Log:
Finally fixed Bug #7991: "add a simple way to create portion of circle"
Modified:
trunk/Scribus/scribus/canvasmode_create.cpp
trunk/Scribus/scribus/canvasmode_editarc.cpp
trunk/Scribus/scribus/canvasmode_editarc.h
trunk/Scribus/scribus/ui/arcvectorbase.ui
trunk/Scribus/scribus/ui/arcvectordialog.cpp
trunk/Scribus/scribus/ui/arcvectordialog.h
trunk/Scribus/scribus/ui/propertiespalette.cpp
trunk/Scribus/scribus/ui/scrpalettebase.cpp
Modified: trunk/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16277&path=/trunk/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_create.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_create.cpp Tue Jan 18 21:08:42 2011
@@ -597,48 +597,30 @@
case modeDrawShapes:
switch (createObjectSubMode)
{
- case 0:
- if (modifiers == Qt::ShiftModifier)
- {
- z = m_doc->itemAddArea(PageItem::Polygon, PageItem::Rectangle, Rxp, Ryp, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
+ case 0:
+ if (modifiers == Qt::ShiftModifier)
+ z = m_doc->itemAddArea(PageItem::Polygon, PageItem::Rectangle, Rxp, Ryp, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
+ else
+ z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
m_doc->Items->at(z)->FrameType = 0;
- }
- else
- {
- z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
- m_doc->Items->at(z)->FrameType = 0;
- }
- break;
- case 1:
- if (modifiers == Qt::ShiftModifier)
- {
- z = m_doc->itemAddArea(PageItem::Polygon, PageItem::Ellipse, Rxp, Ryp, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
+ break;
+ case 1:
+ if (modifiers == Qt::ShiftModifier)
+ z = m_doc->itemAddArea(PageItem::Polygon, PageItem::Ellipse, Rxp, Ryp, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
+ else
+ z = m_doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
m_doc->Items->at(z)->FrameType = 1;
- }
- else
- {
- z = m_doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
- m_doc->Items->at(z)->FrameType = 1;
- }
- break;
- default:
- if (modifiers == Qt::ShiftModifier)
- {
- z = m_doc->itemAddArea(PageItem::Polygon, PageItem::Unspecified, Rxp, Ryp, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
+ break;
+ default:
+ if (modifiers == Qt::ShiftModifier)
+ z = m_doc->itemAddArea(PageItem::Polygon, PageItem::Unspecified, Rxp, Ryp, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
+ else
+ z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
m_doc->Items->at(z)->SetFrameShape(m_doc->ValCount, m_doc->ShapeValues);
m_doc->AdjustItemSize(m_doc->Items->at(z));
m_doc->setRedrawBounding(m_doc->Items->at(z));
m_doc->Items->at(z)->FrameType = createObjectSubMode + 2;
- }
- else
- {
- z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().shapeLineColor, true);
- m_doc->Items->at(z)->SetFrameShape(m_doc->ValCount, m_doc->ShapeValues);
- m_doc->AdjustItemSize(m_doc->Items->at(z));
- m_doc->setRedrawBounding(m_doc->Items->at(z));
- m_doc->Items->at(z)->FrameType = createObjectSubMode + 2;
- }
- break;
+ break;
}
break;
case modeDrawLine:
@@ -655,33 +637,21 @@
break;
case modeDrawLatex:
if (modifiers == Qt::ShiftModifier)
- {
z = m_doc->itemAddArea(PageItem::LatexFrame, PageItem::Unspecified, Rxp, Ryp, 1, m_doc->itemToolPrefs().imageFillColor, CommonStrings::None, true);
- }
else
- {
z = m_doc->itemAdd(PageItem::LatexFrame, PageItem::Unspecified, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().imageFillColor, CommonStrings::None, true);
- }
break;
case modeDrawImage:
if (modifiers == Qt::ShiftModifier)
- {
z = m_doc->itemAddArea(PageItem::ImageFrame, PageItem::Unspecified, Rxp, Ryp, 1, m_doc->itemToolPrefs().imageFillColor, CommonStrings::None, true);
- }
else
- {
z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().imageFillColor, CommonStrings::None, true);
- }
break;
case modeDrawText:
if (modifiers == Qt::ShiftModifier)
- {
z = m_doc->itemAddArea(PageItem::TextFrame, PageItem::Unspecified, Rxp, Ryp, m_doc->itemToolPrefs().shapeLineWidth, CommonStrings::None, m_doc->itemToolPrefs().textFont, true);
- }
else
- {
z = m_doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, CommonStrings::None, m_doc->itemToolPrefs().textFont, true);
- }
break;
case modeDrawRegularPolygon:
if (modifiers == Qt::ShiftModifier)
@@ -694,6 +664,8 @@
z = m_doc->itemAddArea(PageItem::Arc, PageItem::Unspecified, Rxp, Ryp, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().lineColor, true);
else
z = m_doc->itemAdd(PageItem::Arc, PageItem::Unspecified, Rxp, Ryp, Rxpd, Rypd, m_doc->itemToolPrefs().shapeLineWidth, m_doc->itemToolPrefs().shapeFillColor, m_doc->itemToolPrefs().lineColor, true);
+ m_doc->AdjustItemSize(m_doc->Items->at(z));
+ m_doc->setRedrawBounding(m_doc->Items->at(z));
break;
case modeInsertPDFButton:
case modeInsertPDFTextfield:
Modified: trunk/Scribus/scribus/canvasmode_editarc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16277&path=/trunk/Scribus/scribus/canvasmode_editarc.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editarc.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editarc.cpp Tue Jan 18 21:08:42 2011
@@ -175,10 +175,7 @@
endAngle = startAngle + item->arcSweepAngle;
QLineF res = QLineF(centerPoint, startPoint);
QLineF swe = QLineF(centerPoint, endPoint);
- double nSweep = swe.angle() - res.angle();
- if (nSweep < 0)
- nSweep += 360;
- VectorDialog->setValues(res.angle(), nSweep, item->arcHeight, item->arcWidth);
+ VectorDialog->setValues(res.angle(), swe.angle(), item->arcHeight, item->arcWidth);
VectorDialog->show();
setModeCursor();
if (fromGesture)
@@ -186,6 +183,19 @@
m_view->update();
}
connect(VectorDialog, SIGNAL(NewVectors(double, double, double, double)), this, SLOT(applyValues(double, double, double, double)));
+ connect(VectorDialog, SIGNAL(endEdit()), this, SLOT(endEditing()));
+ connect(VectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
+}
+
+void CanvasMode_EditArc::endEditing(bool active)
+{
+ if (!active)
+ endEditing();
+}
+
+void CanvasMode_EditArc::endEditing()
+{
+ m_view->requestMode(modeNormal);
}
void CanvasMode_EditArc::applyValues(double start, double end, double height, double width)
@@ -204,7 +214,7 @@
QLineF inp = QLineF(QPointF(width / 2.0, height / 2.0), QPointF(width, height / 2.0));
inp.setAngle(start);
QLineF res = bb.map(inp);
- inp.setAngle(start + end);
+ inp.setAngle(end);
QLineF ena = bb.map(inp);
startAngle = res.angle();
endAngle = ena.angle();
@@ -324,10 +334,7 @@
}
QLineF res = QLineF(centerPoint, startPoint);
QLineF swe = QLineF(centerPoint, endPoint);
- nSweep = swe.angle() - res.angle();
- if (nSweep < 0)
- nSweep += 360;
- VectorDialog->setValues(res.angle(), nSweep, nHeight * 2, nWidth * 2);
+ VectorDialog->setValues(res.angle(), swe.angle(), nHeight * 2, nWidth * 2);
currItem->update();
QRectF upRect;
upRect = QRectF(QPointF(0, 0), QPointF(currItem->width(), currItem->height())).normalized();
Modified: trunk/Scribus/scribus/canvasmode_editarc.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16277&path=/trunk/Scribus/scribus/canvasmode_editarc.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editarc.h (original)
+++ trunk/Scribus/scribus/canvasmode_editarc.h Tue Jan 18 21:08:42 2011
@@ -83,6 +83,8 @@
ArcVectorDialog* VectorDialog;
private slots:
+ void endEditing(bool active);
+ void endEditing();
void applyValues(double start, double end, double height, double width);
};
Modified: trunk/Scribus/scribus/ui/arcvectorbase.ui
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16277&path=/trunk/Scribus/scribus/ui/arcvectorbase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/arcvectorbase.ui (original)
+++ trunk/Scribus/scribus/ui/arcvectorbase.ui Tue Jan 18 21:08:42 2011
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>181</width>
- <height>136</height>
+ <width>176</width>
+ <height>147</height>
</rect>
</property>
<property name="minimumSize">
@@ -22,80 +22,108 @@
<property name="windowTitle">
<string>Edit Arc</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Start Angle:</string>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Start Angle:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="ScrSpinBox" name="startAngle">
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="minimum">
+ <double>-360.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>360.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>End Angle:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="ScrSpinBox" name="sweepAngle">
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="minimum">
+ <double>-360.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>360.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Height:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="ScrSpinBox" name="arcHeight">
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <double>360.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Width:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="ScrSpinBox" name="arcWidth">
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <double>360.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="0" column="1">
- <widget class="ScrSpinBox" name="startAngle">
- <property name="decimals">
- <number>1</number>
- </property>
- <property name="minimum">
- <double>-360.000000000000000</double>
- </property>
- <property name="maximum">
- <double>360.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Sweep Angle:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="ScrSpinBox" name="sweepAngle">
- <property name="decimals">
- <number>1</number>
- </property>
- <property name="minimum">
- <double>-360.000000000000000</double>
- </property>
- <property name="maximum">
- <double>360.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Height:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="ScrSpinBox" name="arcHeight">
- <property name="decimals">
- <number>1</number>
- </property>
- <property name="maximum">
- <double>360.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Width:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="ScrSpinBox" name="arcWidth">
- <property name="decimals">
- <number>1</number>
- </property>
- <property name="maximum">
- <double>360.000000000000000</double>
- </property>
- </widget>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="exitButton">
+ <property name="text">
+ <string>End Edit</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
Modified: trunk/Scribus/scribus/ui/arcvectordialog.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16277&path=/trunk/Scribus/scribus/ui/arcvectordialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/arcvectordialog.cpp (original)
+++ trunk/Scribus/scribus/ui/arcvectordialog.cpp Tue Jan 18 21:08:42 2011
@@ -23,7 +23,7 @@
#include "arcvectordialog.h"
-ArcVectorDialog::ArcVectorDialog(QWidget* parent) : ScrPaletteBase( parent, "GradientVectorPalette", false, 0 )
+ArcVectorDialog::ArcVectorDialog(QWidget* parent) : ScrPaletteBase( parent, "ArcVectorDialog", false, 0 )
{
setupUi(this);
startAngle->setNewUnit(6);
@@ -34,7 +34,9 @@
connect(sweepAngle, SIGNAL(valueChanged(double)), this, SLOT(changeVectors()));
connect(arcHeight, SIGNAL(valueChanged(double)), this, SLOT(changeVectors()));
connect(arcWidth, SIGNAL(valueChanged(double)), this, SLOT(changeVectors()));
+ connect(exitButton, SIGNAL(clicked()), this, SIGNAL(endEdit()));
languageChange();
+ resize(minimumSizeHint());
}
void ArcVectorDialog::changeEvent(QEvent *e)
Modified: trunk/Scribus/scribus/ui/arcvectordialog.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16277&path=/trunk/Scribus/scribus/ui/arcvectordialog.h
==============================================================================
--- trunk/Scribus/scribus/ui/arcvectordialog.h (original)
+++ trunk/Scribus/scribus/ui/arcvectordialog.h Tue Jan 18 21:08:42 2011
@@ -54,6 +54,7 @@
signals:
void NewVectors(double, double, double, double);
+ void endEdit();
};
#endif
Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16277&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Tue Jan 18 21:08:42 2011
@@ -2106,7 +2106,7 @@
i=doc->m_Selection->itemAt(0);
HaveItem=true;
EditShape->setEnabled(!i->locked());
- SCustom->setEnabled(nr!=5 && nr!=7 && nr!=8 && nr!=13 && !i->locked());
+ SCustom->setEnabled(nr!=5 && nr!=7 && nr!=8 && nr!=13 && nr!=14 && !i->locked());
}
else
{
Modified: trunk/Scribus/scribus/ui/scrpalettebase.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16277&path=/trunk/Scribus/scribus/ui/scrpalettebase.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrpalettebase.cpp (original)
+++ trunk/Scribus/scribus/ui/scrpalettebase.cpp Tue Jan 18 21:08:42 2011
@@ -152,9 +152,9 @@
*/
void ScrPaletteBase::closeEvent(QCloseEvent *closeEvent)
{
- emit paletteShown(false);
closeEvent->ignore();
hide();
+ emit paletteShown(false);
}
void ScrPaletteBase::hideEvent(QHideEvent*)
More information about the scribus-commit
mailing list