diff --git a/resources/forms/mainWindow.ui b/resources/forms/mainWindow.ui
index a24810b4..cec02a1c 100644
--- a/resources/forms/mainWindow.ui
+++ b/resources/forms/mainWindow.ui
@@ -7,7 +7,7 @@
0
0
1342
- 223
+ 268
@@ -1702,6 +1702,25 @@
Draw intermediate grid lines
+
+
+ true
+
+
+
+ :/images/stylusPalette/line.png
+ :/images/stylusPalette/lineOn.png:/images/stylusPalette/line.png
+
+
+ Vector
+
+
+ Draw Vectors
+
+
+ Ctrl+J
+
+
diff --git a/src/api/UBWidgetUniboardAPI.cpp b/src/api/UBWidgetUniboardAPI.cpp
index 14c04019..5d8b73cc 100644
--- a/src/api/UBWidgetUniboardAPI.cpp
+++ b/src/api/UBWidgetUniboardAPI.cpp
@@ -144,6 +144,9 @@ void UBWidgetUniboardAPI::setTool(const QString& toolString)
else if (lower == "line")
{
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Line);
+ } else if (lower == "vector")
+ {
+ UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Vector);
}
}
diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp
index dd5afac5..e2f5d427 100644
--- a/src/board/UBBoardController.cpp
+++ b/src/board/UBBoardController.cpp
@@ -1981,6 +1981,7 @@ void UBBoardController::setColorIndex(int pColorIndex)
if (UBDrawingController::drawingController()->stylusTool() != UBStylusTool::Marker &&
UBDrawingController::drawingController()->stylusTool() != UBStylusTool::Line &&
+ UBDrawingController::drawingController()->stylusTool() != UBStylusTool::Vector &&
UBDrawingController::drawingController()->stylusTool() != UBStylusTool::Text &&
UBDrawingController::drawingController()->stylusTool() != UBStylusTool::Selector)
{
@@ -1989,6 +1990,7 @@ void UBBoardController::setColorIndex(int pColorIndex)
if (UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Pen ||
UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line ||
+ UBDrawingController::drawingController()->stylusTool() != UBStylusTool::Vector ||
UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Text ||
UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Selector)
{
diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp
index 97c8e2af..366b74ae 100644
--- a/src/board/UBBoardView.cpp
+++ b/src/board/UBBoardView.cpp
@@ -367,7 +367,7 @@ void UBBoardView::tabletEvent (QTabletEvent * event)
QPointF scenePos = viewportTransform ().inverted ().map (tabletPos);
qreal pressure = 1.0;
- if (((currentTool == UBStylusTool::Pen || currentTool == UBStylusTool::Line) && mPenPressureSensitive) ||
+ if (((currentTool == UBStylusTool::Pen || currentTool == UBStylusTool::Line || currentTool == UBStylusTool::Vector) && mPenPressureSensitive) ||
(currentTool == UBStylusTool::Marker && mMarkerPressureSensitive))
pressure = event->pressure ();
else{
@@ -1821,6 +1821,9 @@ void UBBoardView::setToolCursor (int tool)
case UBStylusTool::Line:
controlViewport->setCursor (UBResources::resources ()->penCursor);
break;
+ case UBStylusTool::Vector:
+ controlViewport->setCursor (UBResources::resources ()->penCursor);
+ break;
case UBStylusTool::Text:
controlViewport->setCursor (UBResources::resources ()->textCursor);
break;
diff --git a/src/board/UBDrawingController.cpp b/src/board/UBDrawingController.cpp
index 705e1d18..828a938e 100644
--- a/src/board/UBDrawingController.cpp
+++ b/src/board/UBDrawingController.cpp
@@ -75,6 +75,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(zoomOutToolSelected(bool)));
connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered(bool)), this, SLOT(pointerToolSelected(bool)));
connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(lineToolSelected(bool)));
+ connect(UBApplication::mainWindow->actionVector, SIGNAL(triggered(bool)), this, SLOT(vectorToolSelected(bool)));
connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(textToolSelected(bool)));
connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(captureToolSelected(bool)));
}
@@ -104,12 +105,12 @@ void UBDrawingController::setStylusTool(int tool)
{
UBApplication::boardController->activeScene()->deselectAllItems();
if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker
- || mStylusTool == UBStylusTool::Line)
+ || mStylusTool == UBStylusTool::Line || mStylusTool == UBStylusTool::Vector)
{
mLatestDrawingTool = mStylusTool;
}
- if (tool == UBStylusTool::Pen || tool == UBStylusTool::Line)
+ if (tool == UBStylusTool::Pen || tool == UBStylusTool::Line || tool == UBStylusTool::Vector)
{
emit lineWidthIndexChanged(UBSettings::settings()->penWidthIndex());
emit colorIndexChanged(UBSettings::settings()->penColorIndex());
@@ -144,6 +145,8 @@ void UBDrawingController::setStylusTool(int tool)
UBApplication::mainWindow->actionPointer->setChecked(true);
else if (mStylusTool == UBStylusTool::Line)
UBApplication::mainWindow->actionLine->setChecked(true);
+ else if (mStylusTool == UBStylusTool::Vector)
+ UBApplication::mainWindow->actionVector->setChecked(true);
else if (mStylusTool == UBStylusTool::Text)
UBApplication::mainWindow->actionText->setChecked(true);
else if (mStylusTool == UBStylusTool::Capture)
@@ -160,13 +163,14 @@ bool UBDrawingController::isDrawingTool()
{
return (stylusTool() == UBStylusTool::Pen)
|| (stylusTool() == UBStylusTool::Marker)
+ || (stylusTool() == UBStylusTool::Vector)
|| (stylusTool() == UBStylusTool::Line);
}
int UBDrawingController::currentToolWidthIndex()
{
- if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line)
+ if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line || stylusTool() == UBStylusTool::Vector)
return UBSettings::settings()->penWidthIndex();
else if (stylusTool() == UBStylusTool::Marker)
return UBSettings::settings()->markerWidthIndex();
@@ -177,7 +181,7 @@ int UBDrawingController::currentToolWidthIndex()
qreal UBDrawingController::currentToolWidth()
{
- if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line)
+ if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line || stylusTool() == UBStylusTool::Vector)
return UBSettings::settings()->currentPenWidth();
else if (stylusTool() == UBStylusTool::Marker)
return UBSettings::settings()->currentMarkerWidth();
@@ -198,6 +202,7 @@ void UBDrawingController::setLineWidthIndex(int index)
UBSettings::settings()->setPenWidthIndex(index);
if(stylusTool() != UBStylusTool::Line
+ && stylusTool() != UBStylusTool::Vector
&& stylusTool() != UBStylusTool::Selector)
{
setStylusTool(UBStylusTool::Pen);
@@ -210,7 +215,7 @@ void UBDrawingController::setLineWidthIndex(int index)
int UBDrawingController::currentToolColorIndex()
{
- if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line)
+ if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line || stylusTool() == UBStylusTool::Vector)
{
return UBSettings::settings()->penColorIndex();
}
@@ -233,7 +238,7 @@ QColor UBDrawingController::currentToolColor()
QColor UBDrawingController::toolColor(bool onDarkBackground)
{
- if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line)
+ if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line || stylusTool() == UBStylusTool::Vector)
{
return UBSettings::settings()->penColor(onDarkBackground);
}
@@ -390,6 +395,11 @@ void UBDrawingController::lineToolSelected(bool checked)
setStylusTool(UBStylusTool::Line);
}
+void UBDrawingController::vectorToolSelected(bool checked)
+{
+ if (checked)
+ setStylusTool(UBStylusTool::Vector);
+}
void UBDrawingController::textToolSelected(bool checked)
{
diff --git a/src/board/UBDrawingController.h b/src/board/UBDrawingController.h
index 01c11187..116cb3c8 100644
--- a/src/board/UBDrawingController.h
+++ b/src/board/UBDrawingController.h
@@ -107,6 +107,7 @@ class UBDrawingController : public QObject
void zoomOutToolSelected(bool checked);
void pointerToolSelected(bool checked);
void lineToolSelected(bool checked);
+ void vectorToolSelected(bool checked);
void textToolSelected(bool checked);
void captureToolSelected(bool checked);
};
diff --git a/src/core/UB.h b/src/core/UB.h
index 8b9b1c7f..156aa1aa 100644
--- a/src/core/UB.h
+++ b/src/core/UB.h
@@ -71,6 +71,7 @@ struct UBStylusTool
ZoomOut,
Pointer,
Line,
+ Vector,
Text,
Capture
};
diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp
index e6ef1b3b..74efe918 100644
--- a/src/domain/UBGraphicsScene.cpp
+++ b/src/domain/UBGraphicsScene.cpp
@@ -539,7 +539,7 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
width /= UBApplication::boardController->systemScaleFactor();
width /= UBApplication::boardController->currentZoom();
- if (currentTool == UBStylusTool::Line || dc->mActiveRuler)
+ if (currentTool == UBStylusTool::Line || dc->mActiveRuler || currentTool == UBStylusTool::Vector)
{
if (UBDrawingController::drawingController()->stylusTool() != UBStylusTool::Marker)
if(NULL != mpLastPolygon && NULL != mCurrentStroke && mAddedItems.size() > 0){
@@ -580,7 +580,9 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
else if (currentTool == UBStylusTool::Line) {
drawLineTo(position, width, true);
}
-
+ else if (currentTool == UBStylusTool::Vector) {
+ drawLineTo(position, width, true);
+ }
else {
bool interpolate = false;
diff --git a/src/gui/UBStylusPalette.cpp b/src/gui/UBStylusPalette.cpp
index 11190b92..cb039782 100644
--- a/src/gui/UBStylusPalette.cpp
+++ b/src/gui/UBStylusPalette.cpp
@@ -61,6 +61,7 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
actions << UBApplication::mainWindow->actionPointer;
actions << UBApplication::mainWindow->actionLine;
+ actions << UBApplication::mainWindow->actionVector;
actions << UBApplication::mainWindow->actionText;
actions << UBApplication::mainWindow->actionCapture;
diff --git a/src/gui/UBToolbarButtonGroup.cpp b/src/gui/UBToolbarButtonGroup.cpp
index 30f697e5..2b73d31d 100644
--- a/src/gui/UBToolbarButtonGroup.cpp
+++ b/src/gui/UBToolbarButtonGroup.cpp
@@ -210,6 +210,7 @@ void UBToolbarButtonGroup::colorPaletteChanged()
QList colors;
if (UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Pen
+ || UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Vector
|| UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line)
{
colors = UBSettings::settings()->penColors(isDarkBackground);