r16944 by fschmid - Improved weld editing mode, now you can move the weld point and the object independly.
scribus-commit
scribus-commit at lists.scribus.net
Tue Nov 1 10:41:26 UTC 2011
Author: fschmid
Date: Tue Nov 1 10:41:26 2011
New Revision: 16944
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16944
Log:
Improved weld editing mode, now you can move the weld point and the object independly.
Added:
trunk/Scribus/scribus/ui/weldedit.cpp
trunk/Scribus/scribus/ui/weldedit.h
trunk/Scribus/scribus/ui/weldeditbase.ui
Modified:
trunk/Scribus/scribus/CMakeLists.txt
trunk/Scribus/scribus/actionmanager.cpp
trunk/Scribus/scribus/canvasmode_editweldpoint.cpp
trunk/Scribus/scribus/canvasmode_editweldpoint.h
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
trunk/Scribus/scribus/ui/propertiespalette_xyz.h
trunk/Scribus/scribus/ui/propertiespalette_xyzbase.ui
Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16944&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Tue Nov 1 10:41:26 2011
@@ -162,6 +162,7 @@
ui/helpbrowsernavigation.ui
ui/unicodesearch.ui
ui/useprintermarginsdialog.ui
+ ui/weldeditbase.ui
# ${SCRIBUS_ITEMSETTERS_UI_SRC}
${SCRIBUS_OSG_UI_SRC}
)
@@ -181,6 +182,7 @@
canvasmode_editpolygon.h
canvasmode_editspiral.h
canvasmode_edittable.h
+ canvasmode_editweldpoint.h
canvasmode_measurements.h
canvasmode_normal.h
chartablemodel.h
@@ -455,6 +457,7 @@
ui/unicodesearch.h
ui/useprintermarginsdialog.h
ui/vruler.h
+ ui/weldedit.h
# ${SCRIBUS_ITEMSETTERS_CLASS}
${SCRIBUS_OSG_CLASS}
)
@@ -883,6 +886,7 @@
ui/unicodesearch.cpp
ui/vruler.cpp
ui/useprintermarginsdialog.cpp
+ ui/weldedit.cpp
# ${SCRIBUS_ITEMSETTERS_SRC}
${SCRIBUS_OSG_SRC}
${SCRIBUS_GMAGICK_SRC}
Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16944&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Tue Nov 1 10:41:26 2011
@@ -509,6 +509,8 @@
name="itemsUnWeld";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="itemWeld";
+ scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+ name="itemEditWeld";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
connect( (*scrActions)["itemDuplicate"], SIGNAL(triggered()), mainWindow, SLOT(duplicateItem()) );
@@ -1116,6 +1118,7 @@
disconnect( (*scrActions)["extrasDeHyphenateText"], 0, 0, 0 );
disconnect( (*scrActions)["itemsUnWeld"], 0, 0, 0);
disconnect( (*scrActions)["itemWeld"], 0, 0, 0);
+ disconnect( (*scrActions)["itemEditWeld"], 0, 0, 0);
}
@@ -1151,6 +1154,7 @@
connect( (*scrActions)["itemAdjustImageToFrame"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustImagetoFrameSize()) );
connect( (*scrActions)["itemsUnWeld"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UnWeld()) );
connect( (*scrActions)["itemWeld"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_Weld()) );
+ connect( (*scrActions)["itemEditWeld"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_EditWeld()) );
}
@@ -1476,6 +1480,7 @@
(*scrActions)["itemConvertToTextFrame"]->setTexts( tr("&Text Frame"));
(*scrActions)["itemsUnWeld"]->setTexts( tr("Unweld items"));
(*scrActions)["itemWeld"]->setTexts( tr("Weld items"));
+ (*scrActions)["itemEditWeld"]->setTexts( tr("Edit weld item"));
//Insert Menu
(*scrActions)["insertFrame"]->setTexts( tr("&Frames..."));
@@ -1954,7 +1959,8 @@
<< "itemCombinePolygons"
<< "itemSplitPolygons"
<< "itemsUnWeld"
- << "itemWeld";
+ << "itemWeld"
+ << "itemEditWeld";
//Insert
++itmenu;
itmenu->second
Modified: trunk/Scribus/scribus/canvasmode_editweldpoint.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16944&path=/trunk/Scribus/scribus/canvasmode_editweldpoint.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editweldpoint.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_editweldpoint.cpp Tue Nov 1 10:41:26 2011
@@ -66,6 +66,7 @@
{
Mxp = Myp = -1;
selectedPoint = -1;
+ editWeldMode = true;
}
inline bool CanvasMode_EditWeldPoint::GetItem(PageItem** pi)
@@ -143,6 +144,12 @@
{
m_view->update();
}
+ ModeDialog = new WeldEditDialog(m_ScMW);
+ ModeDialog->show();
+ connect(ModeDialog, SIGNAL(endEdit()), this, SLOT(endEditing()));
+ connect(ModeDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
+ connect(ModeDialog, SIGNAL(modeMoveWeld()), this, SLOT(setWeldMode()));
+ connect(ModeDialog, SIGNAL(modeMoveObject()), this, SLOT(setObjectMode()));
}
void CanvasMode_EditWeldPoint::deactivate(bool forGesture)
@@ -150,6 +157,30 @@
m_view->redrawMarker->hide();
selectedPoint = -1;
weldToList.clear();
+ disconnect(ModeDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
+ ModeDialog->close();
+ delete ModeDialog;
+}
+
+void CanvasMode_EditWeldPoint::endEditing(bool active)
+{
+ if (!active)
+ endEditing();
+}
+
+void CanvasMode_EditWeldPoint::endEditing()
+{
+ m_view->requestMode(modeNormal);
+}
+
+void CanvasMode_EditWeldPoint::setWeldMode()
+{
+ editWeldMode = true;
+}
+
+void CanvasMode_EditWeldPoint::setObjectMode()
+{
+ editWeldMode = false;
}
void CanvasMode_EditWeldPoint::keyPressEvent(QKeyEvent *e)
@@ -245,8 +276,16 @@
}
if (isMoving)
{
- currItem->weldList[selectedPoint].weldPoint += FPoint(moveX, moveY);
- currItem->moveWelded(moveX, moveY, selectedPoint);
+ if (editWeldMode)
+ {
+ currItem->weldList[selectedPoint].weldPoint += FPoint(moveX, moveY);
+ }
+ else
+ {
+ currItem->setXYPos(currItem->xPos() + moveX, currItem->yPos() + moveY, true);
+ currItem->setRedrawBounding();
+ currItem->OwnPage = m_doc->OnPage(currItem);
+ }
}
if (doUpdate)
{
@@ -312,19 +351,25 @@
m_canvas->displayXYHUD(m->globalPos(), npf.x(), npf.y());
if (m_canvas->m_viewMode.m_MouseButtonPressed && m_view->moveTimerElapsed())
{
- if (selectedPoint != -1)
- {
- m_canvas->displayXYHUD(m->globalPos(), npf.x(), npf.y());
- FPoint mp, mp_orig;
- mp_orig = currItem->weldList[selectedPoint].weldPoint;
- mp = mp_orig - npx;
- double xx = mp.x();
- double yy = mp.y();
- snapToEdgePoints(xx, yy);
- currItem->weldList[selectedPoint].weldPoint = FPoint(xx, yy);
- xx = mp_orig.x() - xx;
- yy = mp_orig.y() - yy;
- currItem->moveWelded(-npx.x(), -npx.y(), selectedPoint);
+ if (editWeldMode)
+ {
+ if (selectedPoint != -1)
+ {
+ m_canvas->displayXYHUD(m->globalPos(), npf.x(), npf.y());
+ FPoint mp, mp_orig;
+ mp_orig = currItem->weldList[selectedPoint].weldPoint;
+ mp = mp_orig - npx;
+ double xx = mp.x();
+ double yy = mp.y();
+ snapToEdgePoints(xx, yy);
+ currItem->weldList[selectedPoint].weldPoint = FPoint(xx, yy);
+ }
+ }
+ else
+ {
+ currItem->setXYPos(currItem->xPos() - npx.x(), currItem->yPos() - npx.y(), true);
+ currItem->setRedrawBounding();
+ currItem->OwnPage = m_doc->OnPage(currItem);
}
m_doc->regionsChanged()->update(getUpdateRect());
}
Modified: trunk/Scribus/scribus/canvasmode_editweldpoint.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16944&path=/trunk/Scribus/scribus/canvasmode_editweldpoint.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editweldpoint.h (original)
+++ trunk/Scribus/scribus/canvasmode_editweldpoint.h Tue Nov 1 10:41:26 2011
@@ -28,6 +28,7 @@
#include "canvasmode.h"
#include "fpointarray.h"
+#include "ui/weldedit.h"
class PageItem;
class PageItem_TextFrame;
@@ -39,6 +40,7 @@
class CanvasMode_EditWeldPoint : public CanvasMode
{
+ Q_OBJECT
public:
explicit CanvasMode_EditWeldPoint(ScribusView* view);
virtual ~CanvasMode_EditWeldPoint() {}
@@ -69,6 +71,13 @@
bool m_keyRepeat;
PageItem *currItem;
QList<PageItem*> weldToList;
+ WeldEditDialog* ModeDialog;
+ bool editWeldMode;
+private slots:
+ void endEditing(bool active);
+ void endEditing();
+ void setWeldMode();
+ void setObjectMode();
};
#endif
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16944&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Tue Nov 1 10:41:26 2011
@@ -832,6 +832,7 @@
scrMenuMgr->addMenuItem(scrActions["itemsUnWeld"], "Item", false);
scrMenuMgr->addMenuItem(scrActions["itemWeld"], "Item", false);
+ scrMenuMgr->addMenuItem(scrActions["itemEditWeld"], "Item", false);
//Insert menu
scrMenuMgr->createMenu("Insert", ActionManager::defaultMenuNameEntryTranslated("Insert"));
@@ -3036,14 +3037,11 @@
if (docSelectionCount == 1)
{
PageItem* bx = doc->m_Selection->itemAt(0);
- if (bx->isWelded())
- scrActions["itemsUnWeld"]->setEnabled(true);
- else
- scrActions["itemsUnWeld"]->setEnabled(false);
+ scrActions["itemsUnWeld"]->setEnabled(bx->isWelded());
+ scrActions["itemEditWeld"]->setEnabled(bx->isWelded());
}
if (docSelectionCount > 1)
{
-// scrMenuMgr->setMenuEnabled("ItemWeld", true);
if (!doc->m_Selection->itemsAreSameType())
{
scrActions["itemConvertToBezierCurve"]->setEnabled(false);
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16944&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Tue Nov 1 10:41:26 2011
@@ -14276,3 +14276,7 @@
regionsChanged()->update(QRectF());
}
+void ScribusDoc::itemSelection_EditWeld()
+{
+ m_ScMW->view->requestMode(modeEditWeldPoint);
+}
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16944&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Tue Nov 1 10:41:26 2011
@@ -1523,6 +1523,7 @@
public slots:
void itemSelection_UnWeld();
void itemSelection_Weld();
+ void itemSelection_EditWeld();
};
Q_DECLARE_METATYPE(ScribusDoc*);
Modified: trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16944&path=/trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp Tue Nov 1 10:41:26 2011
@@ -134,7 +134,6 @@
connect(noResize , SIGNAL(clicked()), this, SLOT(handleLockSize()));
connect(doGroup , SIGNAL(clicked()), this, SLOT(handleGrouping()) );
connect(doUnGroup, SIGNAL(clicked()), this, SLOT(handleUngrouping()) );
- connect(buttonEditWeldPoint, SIGNAL(clicked()), this, SLOT(handleEditWeldPoint()));
m_haveItem = false;
xposSpin->showValue(0);
@@ -142,7 +141,6 @@
widthSpin->showValue(0);
heightSpin->showValue(0);
rotationSpin->showValue(0);
- buttonEditWeldPoint->setEnabled(false);
}
void PropertiesPalette_XYZ::setMainWindow(ScribusMainWindow* mw)
@@ -411,7 +409,6 @@
setEnabled(true);
}
updateSpinBoxConstants();
- buttonEditWeldPoint->setEnabled(m_item->isWelded());
}
void PropertiesPalette_XYZ::handleSelectionChanged()
@@ -517,7 +514,6 @@
heightSpin->showValue(0);
rotationSpin->showValue(0);
levelLabel->setText(" ");
- buttonEditWeldPoint->setEnabled(false);
setEnabled(false);
break;
case PageItem::ImageFrame:
@@ -1417,7 +1413,6 @@
doLock->setToolTip( tr("Lock or unlock the object"));
noResize->setToolTip( tr("Lock or unlock the size of the object"));
noPrint->setToolTip( tr("Enable or disable exporting of the object"));
- buttonEditWeldPoint->setToolTip( tr("Edit the welding point of the object"));
keepFrameWHRatioButton->setToolTip( tr("Keep the aspect ratio"));
}
@@ -1502,12 +1497,3 @@
{
m_ScMW->UnGroupObj();
}
-
-
-void PropertiesPalette_XYZ::handleEditWeldPoint()
-{
- if (buttonEditWeldPoint->isChecked())
- m_ScMW->view->requestMode(modeEditWeldPoint);
- else
- m_ScMW->view->requestMode(modeNormal);
-}
Modified: trunk/Scribus/scribus/ui/propertiespalette_xyz.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16944&path=/trunk/Scribus/scribus/ui/propertiespalette_xyz.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_xyz.h (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_xyz.h Tue Nov 1 10:41:26 2011
@@ -87,7 +87,6 @@
void handleNewName();
void handleGrouping();
void handleUngrouping();
- void handleEditWeldPoint();
protected slots:
//virtual void reject();
Modified: trunk/Scribus/scribus/ui/propertiespalette_xyzbase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16944&path=/trunk/Scribus/scribus/ui/propertiespalette_xyzbase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_xyzbase.ui (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_xyzbase.ui Tue Nov 1 10:41:26 2011
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>280</width>
- <height>352</height>
+ <height>325</height>
</rect>
</property>
<property name="windowTitle">
@@ -307,33 +307,6 @@
</widget>
</item>
</layout>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QToolButton" name="buttonEditWeldPoint">
- <property name="text">
- <string>Edit Weld Point</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
</item>
</layout>
</item>
More information about the scribus-commit
mailing list