Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

add floating bar UI placeholder

ross rosalesa5080e625dce
diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
index b40d5fe62a..095a2f48d5 100644
--- a/libs/ui/CMakeLists.txt
+++ b/libs/ui/CMakeLists.txt
@@ -138,6 +138,7 @@ set(kritaui_LIB_SRCS
KisLayerThumbnailCache.cpp
kis_painting_assistant.cc
kis_painting_assistants_decoration.cpp
+ kis_selection_assistants_decoration.cpp
KisDecorationsManager.cpp
kis_paintop_box.cc
kis_paintop_option.cpp
diff --git a/libs/ui/kis_painting_assistants_decoration.cpp b/libs/ui/kis_painting_assistants_decoration.cpp
index 1005433e84..6c9d223a41 100644
--- a/libs/ui/kis_painting_assistants_decoration.cpp
+++ b/libs/ui/kis_painting_assistants_decoration.cpp
@@ -6,6 +6,7 @@
*/
#include "kis_painting_assistants_decoration.h"
+#include "kis_selection_assistants_decoration.h"
#include <limits>
@@ -324,6 +325,10 @@ void KisPaintingAssistantsDecoration::drawDecoration(QPainter& gc, const QRectF&
drawEditorWidget(assistant, gc, converter);
}
}
+
+ // PLACEHOLDER TO DRAW SELECTION ACTION BAR
+ KisSelectionAssistantsDecoration decoration;
+ decoration.drawDecoration(gc, converter);
}
void KisPaintingAssistantsDecoration::drawHandles(KisPaintingAssistantSP assistant, QPainter& gc, const KisCoordinatesConverter *converter)
@@ -573,11 +578,11 @@ void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP as
}
}
-
+
gc.setPen(stroke);
gc.drawPath(bgPath);
- gc.fillPath(bgPath, backgroundColor);
-
+ gc.fillPath(bgPath, backgroundColor);
+
//draw drag handle
QColor dragDecorationColor(150,150,150,255);
@@ -586,9 +591,9 @@ void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP as
int width = actionsPosition.x()+globalEditorWidgetData.boundingSize.width()-globalEditorWidgetData.dragDecorationWidth+widgetOffset;
int height = actionsPosition.y()+globalEditorWidgetData.boundingSize.height()+widgetOffset;
dragRect.addRect(QRectF(width,actionsPosition.y()+widgetOffset,globalEditorWidgetData.dragDecorationWidth,globalEditorWidgetData.boundingSize.height()));
-
+
gc.fillPath(bgPath.intersected(dragRect),dragDecorationColor);
-
+
//draw dot decoration on handle
QPainterPath dragRectDots;
QColor dragDecorationDotsColor(50,50,50,255);
@@ -646,7 +651,7 @@ void KisPaintingAssistantsDecoration::drawEditorWidget(KisPaintingAssistantSP as
gc.drawPixmap(iconDeletePosition, globalEditorWidgetData.m_iconDelete);
}
-
+
}
diff --git a/libs/ui/kis_selection_assistants_decoration.cpp b/libs/ui/kis_selection_assistants_decoration.cpp
new file mode 100644
index 0000000000..fbfb17a679
--- /dev/null
+++ b/libs/ui/kis_selection_assistants_decoration.cpp
@@ -0,0 +1,69 @@
+#include "kis_selection_assistants_decoration.h"
+
+#include <limits>
+
+#include <QList>
+#include <QPointF>
+#include <klocalizedstring.h>
+#include <kactioncollection.h>
+#include <ktoggleaction.h>
+#include <kis_algebra_2d.h>
+#include "kis_debug.h"
+#include "KisDocument.h"
+#include "kis_canvas2.h"
+#include "kis_canvas_resource_provider.h"
+#include "kis_icon_utils.h"
+#include "KisViewManager.h"
+#include <KoCompositeOpRegistry.h>
+#include "kis_tool_proxy.h"
+#include <QTransform>
+
+#include <QPainter>
+#include <QPainterPath>
+#include <QApplication>
+
+struct KisSelectionAssistantsDecoration::Private {
+ Private()
+ {}
+ KisCanvas2 * m_canvas = 0;
+};
+
+
+
+KisSelectionAssistantsDecoration::KisSelectionAssistantsDecoration() :
+ d(new Private)
+{
+}
+
+KisSelectionAssistantsDecoration::~KisSelectionAssistantsDecoration()
+{
+ delete d;
+}
+
+void KisSelectionAssistantsDecoration::drawDecoration(QPainter& gc, const KisCoordinatesConverter *converter)
+{
+ QPainterPath bgPath;
+ bgPath.addRoundedRect(QRectF(200, 512, 128, 67), 6, 6); // placeholder position and size
+ gc.fillPath(bgPath, Qt::darkGray);
+
+ QPainterPath dragRect;
+ int width = 240;
+ int height = 67;
+ dragRect.addRect(QRectF(300, 512, width, height));
+ gc.fillPath(bgPath.intersected(dragRect),Qt::lightGray);
+
+ QPainterPath dragRectDots;
+ QColor dragDecorationDotsColor(50,50,50,255);
+ int dotSize = 2;
+ dragRectDots.addEllipse(3,2.5,dotSize,dotSize);
+ dragRectDots.addEllipse(3,7.5,dotSize,dotSize);
+ dragRectDots.addEllipse(3,-2.5,dotSize,dotSize);
+ dragRectDots.addEllipse(3,-7.5,dotSize,dotSize);
+ dragRectDots.addEllipse(-3,2.5,dotSize,dotSize);
+ dragRectDots.addEllipse(-3,7.5,dotSize,dotSize);
+ dragRectDots.addEllipse(-3,-2.5,dotSize,dotSize);
+ dragRectDots.addEllipse(-3,-7.5,dotSize,dotSize);
+ dragRectDots.translate(315, 542);
+
+ gc.fillPath(dragRectDots,dragDecorationDotsColor);
+}
diff --git a/libs/ui/kis_selection_assistants_decoration.h b/libs/ui/kis_selection_assistants_decoration.h
new file mode 100644
index 0000000000..949b8e2a93
--- /dev/null
+++ b/libs/ui/kis_selection_assistants_decoration.h
@@ -0,0 +1,43 @@
+#ifndef _KIS_SELECTION_ASSISTANTS_DECORATION_H_
+#define _KIS_SELECTION_ASSISTANTS_DECORATION_H_
+
+#include <QPointF>
+#include <QColor>
+
+#include "KoPointerEvent.h"
+#include "KoSnapGuide.h"
+#include "kis_icon_utils.h"
+#include "canvas/kis_canvas_decoration.h"
+#include "kis_painting_assistant.h"
+#include <kritaui_export.h>
+
+class KisView;
+
+class KisSelectionAssistantsDecoration;
+typedef KisSharedPtr<KisSelectionAssistantsDecoration> KisSelectionAssistantsDecorationSP;
+
+/**
+ * placeholder
+ * KisSelectionAssistantsDecoration draws the assistants stored in the document on
+ * the canvas.
+ * In the application flow, each canvas holds one of these classes to manage the assistants
+ * There is an assistants manager, but that is higher up in the flow and makes sure each view gets one of these
+ * Since this is off the canvas level, the decoration can be seen across all tools. The contents from here will be in
+ * front of the kis_assistant_tool, which hold and displays the editor controls.
+ *
+ * Many of the events this receives such as adding and removing assistants comes from kis_assistant_tool
+ */
+class KRITAUI_EXPORT KisSelectionAssistantsDecoration
+{
+ //Q_OBJECT
+public:
+ KisSelectionAssistantsDecoration();
+ ~KisSelectionAssistantsDecoration();
+ void drawDecoration(QPainter& gc, const KisCoordinatesConverter *converter);
+
+private:
+ struct Private;
+ Private* const d;
+};
+
+#endif