diff --git a/plugins/tools/CMakeLists.txt b/plugins/tools/CMakeLists.txt index d390b874bb..7d3381a403 100644 --- a/plugins/tools/CMakeLists.txt +++ b/plugins/tools/CMakeLists.txt @@ -1,10 +1,11 @@ add_subdirectory( basictools ) add_subdirectory( defaulttool ) add_subdirectory( selectiontools ) add_subdirectory( tool_crop ) add_subdirectory( tool_polygon ) add_subdirectory( tool_polyline ) add_subdirectory( tool_transform2 ) add_subdirectory( tool_dyna ) add_subdirectory( tool_text ) add_subdirectory( karbonplugins ) +add_subdirectory( tool_lazybrush ) diff --git a/plugins/tools/tool_lazybrush/CMakeLists.txt b/plugins/tools/tool_lazybrush/CMakeLists.txt new file mode 100644 index 0000000000..bbd2cb4665 --- /dev/null +++ b/plugins/tools/tool_lazybrush/CMakeLists.txt @@ -0,0 +1,25 @@ +#include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) + +set(kritatoollazybrush_SOURCES + tool_lazybrush.cpp + kis_tool_lazy_brush.cpp + ) + +#ki18n_wrap_ui(kritatoollazybrush_SOURCES wdgcolorpicker.ui wdgmovetool.ui) +qt5_add_resources(kritatoollazybrush_SOURCES tool_lazybrush.qrc ) + +add_library(kritatoollazybrush MODULE ${kritatoollazybrush_SOURCES}) + +generate_export_header(kritatoollazybrush BASE_NAME kritatoollazybrush) + +target_link_libraries(kritatoollazybrush kritaui) +#target_link_libraries(kritatoollazybrush ${Boost_SYSTEM_LIBRARY}) + +install(TARGETS kritatoollazybrush DESTINATION ${KRITA_PLUGIN_INSTALL_DIR}) + + +########### install files ############### + +# install( FILES +# KisToolPencil.action +# DESTINATION ${DATA_INSTALL_DIR}/krita/actions) diff --git a/plugins/tools/tool_lazybrush/dark_krita_tool_lazy_brush_stub.svg b/plugins/tools/tool_lazybrush/dark_krita_tool_lazy_brush_stub.svg new file mode 100644 index 0000000000..cf8380151f --- /dev/null +++ b/plugins/tools/tool_lazybrush/dark_krita_tool_lazy_brush_stub.svg @@ -0,0 +1,515 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Andrei Rudenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/tools/tool_lazybrush/kis_tool_lazy_brush.cpp b/plugins/tools/tool_lazybrush/kis_tool_lazy_brush.cpp new file mode 100644 index 0000000000..561ddf0fe4 --- /dev/null +++ b/plugins/tools/tool_lazybrush/kis_tool_lazy_brush.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016 Dmitry Kazakov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "kis_tool_lazy_brush.h" + +#include +#include +#include +#include + +#include +#include + +#include "kis_cursor.h" +#include "kis_config.h" +#include "kundo2magicstring.h" + +KisToolLazyBrush::KisToolLazyBrush(KoCanvasBase * canvas) + : KisToolFreehand(canvas, + KisCursor::load("tool_freehand_cursor.png", 5, 5), + kundo2_i18n("Colorize Mask Key Stroke")) +{ + setObjectName("tool_lazybrush"); +} + +KisToolLazyBrush::~KisToolLazyBrush() +{ +} + +void KisToolLazyBrush::activate(ToolActivation activation, const QSet &shapes) +{ + KisToolFreehand::activate(activation, shapes); +} + +void KisToolLazyBrush::deactivate() +{ + KisToolFreehand::deactivate(); +} + +void KisToolLazyBrush::resetCursorStyle() +{ + KisToolFreehand::resetCursorStyle(); +} + +QWidget * KisToolLazyBrush::createOptionWidget() +{ + QWidget *optionsWidget = KisToolFreehand::createOptionWidget(); + optionsWidget->setObjectName(toolId() + "option widget"); + + // // See https://bugs.kde.org/show_bug.cgi?id=316896 + // QWidget *specialSpacer = new QWidget(optionsWidget); + // specialSpacer->setObjectName("SpecialSpacer"); + // specialSpacer->setFixedSize(0, 0); + // optionsWidget->layout()->addWidget(specialSpacer); + + + return optionsWidget; +} + + diff --git a/plugins/tools/tool_lazybrush/kis_tool_lazy_brush.h b/plugins/tools/tool_lazybrush/kis_tool_lazy_brush.h new file mode 100644 index 0000000000..ed89b5ade1 --- /dev/null +++ b/plugins/tools/tool_lazybrush/kis_tool_lazy_brush.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016 Dmitry Kazakov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef KIS_TOOL_LAZY_BRUSH_H_ +#define KIS_TOOL_LAZY_BRUSH_H_ + +#include "kis_tool_freehand.h" + +#include "KoToolFactoryBase.h" + +#include +#include +#include + +#include +#include +#include + +class KActionCollection; +class KoCanvasBase; + +class KisToolLazyBrush : public KisToolFreehand +{ +public: + KisToolLazyBrush(KoCanvasBase * canvas); + virtual ~KisToolLazyBrush(); + + QWidget * createOptionWidget(); + +protected Q_SLOTS: + virtual void resetCursorStyle(); + +public Q_SLOTS: + virtual void activate(ToolActivation toolActivation, const QSet &shapes); + void deactivate(); + +Q_SIGNALS: + +private: +}; + + +class KisToolLazyBrushFactory : public KoToolFactoryBase +{ + +public: + KisToolLazyBrushFactory() + : KoToolFactoryBase("KritaShape/KisToolLazyBrush") { + + setToolTip(i18n("Colorize Mask Editing Tool")); + + // Temporarily + setToolType(TOOL_TYPE_SHAPE); + setIconName(koIconNameCStr("krita_tool_lazy_brush_stub")); + setShortcut(QKeySequence(Qt::Key_Shift + Qt::Key_B)); + setPriority(0); + setActivationShapeId(KRITA_TOOL_ACTIVATION_ID); + } + + virtual ~KisToolLazyBrushFactory() {} + + virtual KoToolBase * createTool(KoCanvasBase *canvas) { + return new KisToolLazyBrush(canvas); + } + +}; + + +#endif // KIS_TOOL_LAZY_BRUSH_H_ diff --git a/plugins/tools/tool_lazybrush/kritatoollazybrush.json b/plugins/tools/tool_lazybrush/kritatoollazybrush.json new file mode 100644 index 0000000000..204f2b83cb --- /dev/null +++ b/plugins/tools/tool_lazybrush/kritatoollazybrush.json @@ -0,0 +1,9 @@ +{ + "Id": "Lazy Brush Tool", + "Type": "Service", + "X-KDE-Library": "kritatoollazybrush", + "X-KDE-ServiceTypes": [ + "Krita/Tool" + ], + "X-Krita-Version": "28" +} diff --git a/plugins/tools/tool_lazybrush/light_krita_tool_lazy_brush_stub.svg b/plugins/tools/tool_lazybrush/light_krita_tool_lazy_brush_stub.svg new file mode 100644 index 0000000000..3c6c30505f --- /dev/null +++ b/plugins/tools/tool_lazybrush/light_krita_tool_lazy_brush_stub.svg @@ -0,0 +1,515 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Andrei Rudenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/tools/tool_lazybrush/tool_lazybrush.cpp b/plugins/tools/tool_lazybrush/tool_lazybrush.cpp new file mode 100644 index 0000000000..5174cb20e2 --- /dev/null +++ b/plugins/tools/tool_lazybrush/tool_lazybrush.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Dmitry Kazakov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "tool_lazybrush.h" +#include + +#include +#include + +#include +#include + +#include "kis_paint_device.h" +#include "kis_tool_lazy_brush.h" + + +K_PLUGIN_FACTORY_WITH_JSON(DefaultToolsFactory, "kritatoollazybrush.json", registerPlugin();) + + +ToolLazyBrush::ToolLazyBrush(QObject *parent, const QVariantList &) + : QObject(parent) +{ + KoToolRegistry::instance()->add(new KisToolLazyBrushFactory()); +} + +ToolLazyBrush::~ToolLazyBrush() +{ +} + +#include "tool_lazybrush.moc" diff --git a/plugins/tools/tool_lazybrush/tool_lazybrush.h b/plugins/tools/tool_lazybrush/tool_lazybrush.h new file mode 100644 index 0000000000..fbadd0178a --- /dev/null +++ b/plugins/tools/tool_lazybrush/tool_lazybrush.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Dmitry Kazakov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef TOOL_LAZYBRUSH_H_ +#define TOOL_LAZYBRUSH_H_ + +#include +#include + +class ToolLazyBrush : public QObject +{ + Q_OBJECT +public: + ToolLazyBrush(QObject *parent, const QVariantList &); + virtual ~ToolLazyBrush(); + +}; + +#endif // TOOL_LAZYBRUSH_H_ diff --git a/plugins/tools/tool_lazybrush/tool_lazybrush.qrc b/plugins/tools/tool_lazybrush/tool_lazybrush.qrc new file mode 100644 index 0000000000..8a2cd0c3c7 --- /dev/null +++ b/plugins/tools/tool_lazybrush/tool_lazybrush.qrc @@ -0,0 +1,7 @@ + + + + dark_krita_tool_lazy_brush_stub.svg + light_krita_tool_lazy_brush_stub.svg + +