stylus tool bar

vector_item
thomas_lucky13 2 years ago
parent e7907cd38f
commit 411f85ca81
  1. 21
      resources/forms/mainWindow.ui
  2. 3
      src/api/UBWidgetUniboardAPI.cpp
  3. 2
      src/board/UBBoardController.cpp
  4. 5
      src/board/UBBoardView.cpp
  5. 22
      src/board/UBDrawingController.cpp
  6. 1
      src/board/UBDrawingController.h
  7. 1
      src/core/UB.h
  8. 6
      src/domain/UBGraphicsScene.cpp
  9. 1
      src/gui/UBStylusPalette.cpp
  10. 1
      src/gui/UBToolbarButtonGroup.cpp

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1342</width>
<height>223</height>
<height>268</height>
</rect>
</property>
<property name="windowTitle">
@ -1702,6 +1702,25 @@
<string>Draw intermediate grid lines</string>
</property>
</action>
<action name="actionVector">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../OpenBoard.qrc">
<normaloff>:/images/stylusPalette/line.png</normaloff>
<normalon>:/images/stylusPalette/lineOn.png</normalon>:/images/stylusPalette/line.png</iconset>
</property>
<property name="text">
<string>Vector</string>
</property>
<property name="toolTip">
<string>Draw Vectors</string>
</property>
<property name="shortcut">
<string>Ctrl+J</string>
</property>
</action>
</widget>
<resources>
<include location="../OpenBoard.qrc"/>

@ -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);
}
}

@ -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)
{

@ -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;

@ -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)
{

@ -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);
};

@ -71,6 +71,7 @@ struct UBStylusTool
ZoomOut,
Pointer,
Line,
Vector,
Text,
Capture
};

@ -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;

@ -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;

@ -210,6 +210,7 @@ void UBToolbarButtonGroup::colorPaletteChanged()
QList<QColor> colors;
if (UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Pen
|| UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Vector
|| UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line)
{
colors = UBSettings::settings()->penColors(isDarkBackground);

Loading…
Cancel
Save