r15850 by fschmid - Provide direct access to the angle and width properties of the "Calligraphic Pen" tool.

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 14 10:54:11 CET 2010


Author: fschmid
Date: Sun Nov 14 09:54:11 2010
New Revision: 15850

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15850
Log:
Provide direct access to the angle and width properties of the "Calligraphic Pen" tool.

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/ui/modetoolbar.cpp
    trunk/Scribus/scribus/ui/modetoolbar.h

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15850&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Nov 14 09:54:11 2010
@@ -2196,6 +2196,8 @@
 	tocGenerator->setDoc(doc);
 	styleManager->setDoc(doc);
 	symbolPalette->setDoc(doc);
+	modeToolBar->Angle->setValue(doc->itemToolPrefs().calligrapicPenAngle);
+	modeToolBar->PWidth->setValue(doc->itemToolPrefs().calligrapicPenWidth);
 	// Give plugins a chance to react on changing the current document
 	PluginManager& pluginManager(PluginManager::instance());
 	QStringList pluginNames(pluginManager.pluginNames(false));

Modified: trunk/Scribus/scribus/ui/modetoolbar.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15850&path=/trunk/Scribus/scribus/ui/modetoolbar.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/modetoolbar.cpp (original)
+++ trunk/Scribus/scribus/ui/modetoolbar.cpp Sun Nov 14 09:54:11 2010
@@ -34,6 +34,7 @@
 #include "scraction.h"
 #include "scribus.h"
 #include "scribusdoc.h"
+#include "scrspinbox.h"
 #include "util.h"
 
 ModeToolBar::ModeToolBar(ScribusMainWindow* parent) : ScToolBar( tr("Tools"), "Tools", parent, Qt::Vertical)
@@ -73,7 +74,31 @@
 	this->addAction(m_ScMW->scrActions["toolsInsertLine"]);
 	this->addAction(m_ScMW->scrActions["toolsInsertBezier"]);
 	this->addAction(m_ScMW->scrActions["toolsInsertFreehandLine"]);
+
+	propWidget = new QWidget();
+	group1Layout = new QGridLayout( propWidget );
+	group1Layout->setSpacing( 3 );
+	group1Layout->setMargin( 0 );
+	group1Layout->setAlignment( Qt::AlignTop );
+	Angle = new ScrSpinBox( -180, 180, propWidget, 6 );
+	Angle->setValue( 0 );
+	AngleTxt = new QLabel( tr("Angle:"), propWidget );
+	group1Layout->addWidget( Angle, 0, 1 );
+	group1Layout->addWidget( AngleTxt, 0 , 0 );
+	PWidth = new ScrSpinBox( 0, 100, propWidget, 0 );
+	PWidth->setValue( 5 );
+	PWidthTxt = new QLabel( tr("Width:"), propWidget );
+	group1Layout->addWidget( PWidth, 1, 1 );
+	group1Layout->addWidget( PWidthTxt, 1 , 0 );
+	calPop = new QMenu();
+	calValAct = new QWidgetAction(this);
+	calValAct->setDefaultWidget(propWidget);
+	calPop->addAction(calValAct);
 	this->addAction(m_ScMW->scrActions["toolsInsertCalligraphicLine"]);
+	m_ScMW->scrActions["toolsInsertCalligraphicLine"]->setMenu(calPop);
+	QToolButton* tb3 = dynamic_cast<QToolButton*>(this->widgetForAction(m_ScMW->scrActions["toolsInsertCalligraphicLine"]));
+	tb3->setPopupMode(QToolButton::MenuButtonPopup);
+
 	this->addAction(m_ScMW->scrActions["toolsRotate"]);
 	this->addAction(m_ScMW->scrActions["toolsZoom"]);
 	this->addAction(m_ScMW->scrActions["toolsEditContents"]);
@@ -86,6 +111,14 @@
 
 	languageChange();
 	connect(Rechteck, SIGNAL(FormSel(int, int, qreal *)), this, SLOT(SelShape(int, int, qreal *)));
+	connect(Angle, SIGNAL(valueChanged(double)), this, SLOT(newCalValues()));
+	connect(PWidth, SIGNAL(valueChanged(double)), this, SLOT(newCalValues()));
+}
+
+void ModeToolBar::newCalValues()
+{
+	m_ScMW->doc->itemToolPrefs().calligrapicPenAngle = Angle->value();
+	m_ScMW->doc->itemToolPrefs().calligrapicPenWidth = PWidth->value();
 }
 
 void ModeToolBar::GetPolyProps()
@@ -119,6 +152,8 @@
 
 void ModeToolBar::languageChange()
 {
+	AngleTxt->setText(tr("Angle:"));
+	PWidthTxt->setText(tr("Width:"));
 	idInsertPolygonButtonMenu->setText( tr("Properties..."));
 	ScToolBar::languageChange();
 }

Modified: trunk/Scribus/scribus/ui/modetoolbar.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15850&path=/trunk/Scribus/scribus/ui/modetoolbar.h
==============================================================================
--- trunk/Scribus/scribus/ui/modetoolbar.h (original)
+++ trunk/Scribus/scribus/ui/modetoolbar.h Sun Nov 14 09:54:11 2010
@@ -29,6 +29,9 @@
 #include <QAction>
 #include <QMenu>
 #include <QWidgetAction>
+#include <QGridLayout>
+#include <QLabel>
+#include <QWidget>
 
 class QEvent;
 
@@ -36,6 +39,7 @@
 class AutoformButtonGroup;
 class ScribusMainWindow;
 class WidgetPopupMenu2;
+class ScrSpinBox;
 
 /**
   *@author Franz Schmid
@@ -52,10 +56,13 @@
 	int SubMode;
 	int ValCount;
 	double *ShapeVals;
+	ScrSpinBox *Angle;
+	ScrSpinBox *PWidth;
 	
 	virtual void changeEvent(QEvent *e);
 
 public slots:
+	void newCalValues();
 	void GetPolyProps();
 	void SelShape(int s, int c, qreal *vals);
 	void languageChange();
@@ -67,6 +74,12 @@
 	QMenu* insertPolygonButtonMenu;
 	QAction* idInsertPolygonButtonMenu;
 	ScribusMainWindow* m_ScMW;
+	QWidget *propWidget;
+	QGridLayout* group1Layout;
+	QMenu* calPop;
+	QWidgetAction* calValAct;
+	QLabel *AngleTxt;
+	QLabel *PWidthTxt;
 };
 
 #endif




More information about the scribus-commit mailing list