Git commit c8037eedc978a73d6b3ba60c138aa3a8883fe989 by Boudewijn Rempt. Committed on 21/06/2018 at 09:53. Pushed by rempt into branch 'master'. Remove the recorder We've been disabling this in releases since forwever because itr was never even nearly finished: for instance, the wdgpaintactioneditor form was never used anywhere, most tools didn't implement the special recording code, all of our actions were never recorded. A design where extra code has to be added in multiple places for every single thing that we want to record isn't going to work. If we want to do a recorder, we should start thinking about how we can do this in a generic way, by having the UI generate xml or json that gets recorded and executed: I guess we'd need to add some kind of interpreter at the heart of Krita. But this is a dead end... CCMAIL:kimageshop@kde.org M +0 -7 krita/krita4.xmlgui M +0 -52 krita/kritamenu.action M +2 -17 libs/image/CMakeLists.txt M +1 -1 libs/image/brushengine/kis_paintop_settings.h M +0 -9 libs/image/kis_image.cc M +0 -6 libs/image/kis_image.h R +0 -0 libs/image/kis_node_query_path.cc [from: libs/image/recorder= /kis_node_query_path.cc - 100% similarity] R +0 -0 libs/image/kis_node_query_path.h [from: libs/image/recorder/= kis_node_query_path.h - 100% similarity] M +1 -1 libs/image/kis_spontaneous_job.h D +0 -38 libs/image/recorder/kis_action_recorder.cc D +0 -49 libs/image/recorder/kis_action_recorder.h D +0 -132 libs/image/recorder/kis_macro.cc D +0 -75 libs/image/recorder/kis_macro.h D +0 -108 libs/image/recorder/kis_macro_player.cc D +0 -49 libs/image/recorder/kis_macro_player.h D +0 -65 libs/image/recorder/kis_play_info.cc D +0 -42 libs/image/recorder/kis_play_info.h D +0 -94 libs/image/recorder/kis_recorded_action.cc D +0 -77 libs/image/recorder/kis_recorded_action.h D +0 -51 libs/image/recorder/kis_recorded_action_factory_registry.cc D +0 -36 libs/image/recorder/kis_recorded_action_factory_registry.h D +0 -24 libs/image/recorder/kis_recorded_action_load_context.cpp D +0 -35 libs/image/recorder/kis_recorded_action_load_context.h D +0 -23 libs/image/recorder/kis_recorded_action_save_context.cpp D +0 -34 libs/image/recorder/kis_recorded_action_save_context.h D +0 -117 libs/image/recorder/kis_recorded_fill_paint_action.cpp D +0 -65 libs/image/recorder/kis_recorded_fill_paint_action.h D +0 -175 libs/image/recorder/kis_recorded_filter_action.cpp D +0 -64 libs/image/recorder/kis_recorded_filter_action.h D +0 -75 libs/image/recorder/kis_recorded_node_action.cc D +0 -51 libs/image/recorder/kis_recorded_node_action.h D +0 -467 libs/image/recorder/kis_recorded_paint_action.cpp D +0 -110 libs/image/recorder/kis_recorded_paint_action.h D +0 -292 libs/image/recorder/kis_recorded_path_paint_action.cpp D +0 -87 libs/image/recorder/kis_recorded_path_paint_action.h D +0 -169 libs/image/recorder/kis_recorded_shape_paint_action.cpp D +0 -72 libs/image/recorder/kis_recorded_shape_paint_action.h M +1 -5 libs/image/tests/CMakeLists.txt D +0 -62 libs/image/tests/kis_macro_test.cpp D +0 -33 libs/image/tests/kis_macro_test.h M +1 -1 libs/image/tests/kis_node_query_path_test.cpp D +0 -30 libs/image/tests/kis_recorded_action_factory_registry_test.c= pp D +0 -33 libs/image/tests/kis_recorded_action_factory_registry_test.h D +0 -50 libs/image/tests/kis_recorded_action_test.cpp D +0 -33 libs/image/tests/kis_recorded_action_test.h D +0 -45 libs/image/tests/kis_recorded_filter_action_test.cpp D +0 -33 libs/image/tests/kis_recorded_filter_action_test.h M +0 -5 libs/koplugin/KisMimeDatabase.cpp M +0 -1 libs/pigment/KoColorSpaceRegistry.h M +0 -11 libs/ui/CMakeLists.txt D +0 -207 libs/ui/forms/wdgpaintactioneditor.ui M +0 -1 libs/ui/kis_selection_manager.cc D +0 -95 libs/ui/recorder/kis_node_query_path_editor.cc D +0 -50 libs/ui/recorder/kis_node_query_path_editor.h D +0 -31 libs/ui/recorder/kis_recorded_action_creator.cc D +0 -39 libs/ui/recorder/kis_recorded_action_creator.h D +0 -59 libs/ui/recorder/kis_recorded_action_creator_factory.cc D +0 -56 libs/ui/recorder/kis_recorded_action_creator_factory.h D +0 -72 libs/ui/recorder/kis_recorded_action_creator_factory_registr= y.cc D +0 -55 libs/ui/recorder/kis_recorded_action_creator_factory_registr= y.h D +0 -32 libs/ui/recorder/kis_recorded_action_editor_factory.cc D +0 -50 libs/ui/recorder/kis_recorded_action_editor_factory.h D +0 -83 libs/ui/recorder/kis_recorded_action_editor_factory_registry= .cc D +0 -58 libs/ui/recorder/kis_recorded_action_editor_factory_registry= .h D +0 -77 libs/ui/recorder/kis_recorded_filter_action_creator.cpp D +0 -50 libs/ui/recorder/kis_recorded_filter_action_creator.h D +0 -97 libs/ui/recorder/kis_recorded_filter_action_editor.cc D +0 -57 libs/ui/recorder/kis_recorded_filter_action_editor.h D +0 -158 libs/ui/recorder/kis_recorded_paint_action_editor.cc D +0 -68 libs/ui/recorder/kis_recorded_paint_action_editor.h M +0 -1 libs/ui/tests/CMakeLists.txt D +0 -49 libs/ui/tests/kis_recorded_action_editor_test.cpp D +0 -31 libs/ui/tests/kis_recorded_action_editor_test.h D +0 -87 libs/ui/tool/kis_recording_adapter.cpp D +0 -54 libs/ui/tool/kis_recording_adapter.h M +0 -19 libs/ui/tool/kis_resources_snapshot.cpp M +1 -6 libs/ui/tool/kis_resources_snapshot.h M +0 -7 libs/ui/tool/kis_tool.cc M +0 -3 libs/ui/tool/kis_tool.h M +2 -11 libs/ui/tool/kis_tool_freehand.cc M +0 -5 libs/ui/tool/kis_tool_freehand.h M +0 -25 libs/ui/tool/kis_tool_freehand_helper.cpp M +0 -2 libs/ui/tool/kis_tool_freehand_helper.h M +11 -12 libs/ui/tool/kis_tool_multihand_helper.cpp M +1 -2 libs/ui/tool/kis_tool_multihand_helper.h M +0 -11 libs/ui/tool/kis_tool_paint.cc M +0 -2 libs/ui/tool/kis_tool_paint.h M +1 -54 libs/ui/tool/kis_tool_shape.cc M +0 -2 libs/ui/tool/kis_tool_shape.h M +0 -1 plugins/extensions/CMakeLists.txt D +0 -13 plugins/extensions/bigbrother/CMakeLists.txt D +0 -199 plugins/extensions/bigbrother/actionseditor/kis_actions_edit= or.cpp D +0 -61 plugins/extensions/bigbrother/actionseditor/kis_actions_edit= or.h D +0 -41 plugins/extensions/bigbrother/actionseditor/kis_actions_edit= or_dialog.cpp D +0 -37 plugins/extensions/bigbrother/actionseditor/kis_actions_edit= or_dialog.h D +0 -122 plugins/extensions/bigbrother/actionseditor/kis_macro_model.= cpp D +0 -47 plugins/extensions/bigbrother/actionseditor/kis_macro_model.h D +0 -197 plugins/extensions/bigbrother/actionseditor/wdgactionseditor= .ui D +0 -235 plugins/extensions/bigbrother/bigbrother.cc D +0 -52 plugins/extensions/bigbrother/bigbrother.h D +0 -15 plugins/extensions/bigbrother/bigbrother.xmlgui D +0 -10 plugins/extensions/bigbrother/kritabigbrother.json M +0 -11 plugins/tools/basictools/kis_tool_ellipse.cc M +0 -20 plugins/tools/basictools/kis_tool_fill.cc M +1 -8 plugins/tools/basictools/kis_tool_line.cc M +1 -3 plugins/tools/basictools/kis_tool_line_helper.cpp M +1 -2 plugins/tools/basictools/kis_tool_line_helper.h M +1 -2 plugins/tools/basictools/kis_tool_multihand.cpp M +0 -10 plugins/tools/basictools/kis_tool_rectangle.cc M +0 -15 plugins/tools/tool_polygon/kis_tool_polygon.cc M +0 -14 plugins/tools/tool_polyline/kis_tool_polyline.cc https://commits.kde.org/krita/c8037eedc978a73d6b3ba60c138aa3a8883fe989 diff --git a/krita/krita4.xmlgui b/krita/krita4.xmlgui index 907ebfe3265..7c29c0e666a 100644 --- a/krita/krita4.xmlgui +++ b/krita/krita4.xmlgui @@ -311,13 +311,6 @@ xsi:schemaLocation=3D"http://www.kde.org/standards/kxm= lgui/1.0 http://www.kde.org &Tools Scripts - - Macros - - - - - Setti&ngs diff --git a/krita/kritamenu.action b/krita/kritamenu.action index 151a10df76a..22e8e1e24da 100644 --- a/krita/kritamenu.action +++ b/krita/kritamenu.action @@ -1495,58 +1495,6 @@ = - - Tools - - media-record - &Start recording macro - - Start recording macro - Start recording macro - 1000 - 0 - - false - - - - media-playback-stop - Stop &recording macro - - Stop recording macro - Stop recording macro - 1000 - 0 - - false - - - - media-playback-start - &Open and play... - - Open and play - Open and play - 0 - 0 - - false - - - - document-edit - Open &and edit... - - Open and edit - Open and edit - 0 - 0 - - false - - - - Settings diff --git a/libs/image/CMakeLists.txt b/libs/image/CMakeLists.txt index d20f437daa5..f72d83badff 100644 --- a/libs/image/CMakeLists.txt +++ b/libs/image/CMakeLists.txt @@ -14,7 +14,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/generator ${CMAKE_CURRENT_SOURCE_DIR}/layerstyles ${CMAKE_CURRENT_SOURCE_DIR}/processing - ${CMAKE_CURRENT_SOURCE_DIR}/recorder = ${CMAKE_SOURCE_DIR}/sdk/tests ) @@ -286,21 +285,6 @@ set(kritaimage_LIB_SRCS metadata/kis_meta_data_type_info.cc metadata/kis_meta_data_validator.cc metadata/kis_meta_data_value.cc - recorder/kis_action_recorder.cc - recorder/kis_macro.cc - recorder/kis_macro_player.cc - recorder/kis_node_query_path.cc - recorder/kis_play_info.cc - recorder/kis_recorded_action.cc - recorder/kis_recorded_action_factory_registry.cc - recorder/kis_recorded_action_load_context.cpp - recorder/kis_recorded_action_save_context.cpp - recorder/kis_recorded_filter_action.cpp - recorder/kis_recorded_fill_paint_action.cpp - recorder/kis_recorded_node_action.cc - recorder/kis_recorded_paint_action.cpp - recorder/kis_recorded_path_paint_action.cpp - recorder/kis_recorded_shape_paint_action.cpp = kis_keyframe.cpp kis_keyframe_channel.cpp @@ -328,6 +312,8 @@ set(kritaimage_LIB_SRCS layerstyles/gimp_bump_map.cpp = KisProofingConfiguration.cpp + + kis_node_query_path.cc ) = set(einspline_SRCS @@ -381,7 +367,6 @@ target_include_directories(kritaimage $ $ $ - $ ) = set_target_properties(kritaimage PROPERTIES diff --git a/libs/image/brushengine/kis_paintop_settings.h b/libs/image/bru= shengine/kis_paintop_settings.h index d820f5bcce1..14c39bbf897 100644 --- a/libs/image/brushengine/kis_paintop_settings.h +++ b/libs/image/brushengine/kis_paintop_settings.h @@ -61,7 +61,7 @@ const QString SPACING_USE_UPDATES =3D "PaintOpSettings/up= dateSpacingBetweenDabs"; * between two creations. There is one KisPaintOpSettings per input device= (mouse, tablet, * etc...). * - * The settings may be stored in a preset or a recorded brush stroke. Note= that if your + * The settings may be stored in a preset. Note that if your * paintop's settings subclass has data that is not stored as a property, = that data is not * saved and restored. * diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc index 51be3f46df2..fa5415f8918 100644 --- a/libs/image/kis_image.cc +++ b/libs/image/kis_image.cc @@ -40,7 +40,6 @@ #include #include "KisProofingConfiguration.h" = -#include "recorder/kis_action_recorder.h" #include "kis_adjustment_layer.h" #include "kis_annotation.h" #include "kis_change_profile_visitor.h" @@ -140,7 +139,6 @@ public: , undoStore(undo ? undo : new KisDumbUndoStore()) , legacyUndoAdapter(undoStore.data(), _q) , postExecutionUndoAdapter(undoStore.data(), _q) - , recorder(_q) , signalRouter(_q) , animationInterface(_animationInterface) , scheduler(_q, _q) @@ -217,8 +215,6 @@ public: KisLegacyUndoAdapter legacyUndoAdapter; KisPostExecutionUndoAdapter postExecutionUndoAdapter; = - KisActionRecorder recorder; - vKisAnnotationSP annotations; = QAtomicInt disableUIUpdateSignals; @@ -1155,11 +1151,6 @@ KisUndoAdapter* KisImage::undoAdapter() const return &m_d->legacyUndoAdapter; } = -KisActionRecorder* KisImage::actionRecorder() const -{ - return &m_d->recorder; -} - void KisImage::setDefaultProjectionColor(const KoColor &color) { KIS_ASSERT_RECOVER_RETURN(m_d->rootLayer); diff --git a/libs/image/kis_image.h b/libs/image/kis_image.h index 240ffbc2d76..fcea5fd28a1 100644 --- a/libs/image/kis_image.h +++ b/libs/image/kis_image.h @@ -43,7 +43,6 @@ class KoColorSpace; class KoColor; = class KisCompositeProgressProxy; -class KisActionRecorder; class KisUndoStore; class KisUndoAdapter; class KisImageSignalRouter; @@ -388,11 +387,6 @@ public: */ KisUndoStore* undoStore(); = - /** - * @return the action recorder associated with this image - */ - KisActionRecorder* actionRecorder() const; - /** * Tell the image it's modified; this emits the sigImageModified * signal. This happens when the image needs to be saved diff --git a/libs/image/recorder/kis_node_query_path.cc b/libs/image/kis_no= de_query_path.cc similarity index 100% rename from libs/image/recorder/kis_node_query_path.cc rename to libs/image/kis_node_query_path.cc diff --git a/libs/image/recorder/kis_node_query_path.h b/libs/image/kis_nod= e_query_path.h similarity index 100% rename from libs/image/recorder/kis_node_query_path.h rename to libs/image/kis_node_query_path.h diff --git a/libs/image/kis_spontaneous_job.h b/libs/image/kis_spontaneous_= job.h index 6a4194062d6..033eac24e6a 100644 --- a/libs/image/kis_spontaneous_job.h +++ b/libs/image/kis_spontaneous_job.h @@ -24,7 +24,7 @@ /** * This class represents a simple update just that should be * executed by the updates system from time to time, without - * any recording or undo support. Just some useful update that + * any undo support. Just some useful update that * can be run concurrently with other types updates. */ class KRITAIMAGE_EXPORT KisSpontaneousJob : public KisRunnable diff --git a/libs/image/recorder/kis_action_recorder.cc b/libs/image/record= er/kis_action_recorder.cc deleted file mode 100644 index a0cf36bca32..00000000000 --- a/libs/image/recorder/kis_action_recorder.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "recorder/kis_action_recorder.h" - -#include "recorder/kis_recorded_action.h" - -KisActionRecorder::KisActionRecorder(QObject* parent) - : QObject(parent) -{ - -} - -KisActionRecorder::~KisActionRecorder() -{ -} - -void KisActionRecorder::addAction(const KisRecordedAction& action, const K= isRecordedAction* before) -{ - Q_UNUSED(before); - emit(addedAction(action)); -} - diff --git a/libs/image/recorder/kis_action_recorder.h b/libs/image/recorde= r/kis_action_recorder.h deleted file mode 100644 index c4fbba629fe..00000000000 --- a/libs/image/recorder/kis_action_recorder.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_ACTION_RECORDER_H_ -#define _KIS_ACTION_RECORDER_H_ - -#include -#include "kritaimage_export.h" - -class KisRecordedAction; - -/** - * This class allows other \ref KisMacro to connect to it - * to get the action that are currently created. - */ -class KRITAIMAGE_EXPORT KisActionRecorder : public QObject -{ - Q_OBJECT -public: - KisActionRecorder(QObject* parent =3D 0); - ~KisActionRecorder() override; - -public Q_SLOTS: - - void addAction(const KisRecordedAction& action, const KisRecordedActio= n* before =3D 0); - -Q_SIGNALS: - /** - * This signal is emitted each time an action is added to this recorde= r. - */ - void addedAction(const KisRecordedAction& action); -}; - -#endif diff --git a/libs/image/recorder/kis_macro.cc b/libs/image/recorder/kis_mac= ro.cc deleted file mode 100644 index 84e0ee3554b..00000000000 --- a/libs/image/recorder/kis_macro.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_macro.h" -#include - -#include -#include - -#include "kis_image.h" -#include "recorder/kis_recorded_action.h" -#include "recorder/kis_recorded_action_factory_registry.h" -#include "kis_undo_adapter.h" -#include "kis_play_info.h" -#include "kis_node_query_path.h" -#include - -struct Q_DECL_HIDDEN KisMacro::Private { - QList actions; -}; - -KisMacro::KisMacro(QObject* parent) : QObject(parent), d(new Private) -{ -} - -KisMacro::KisMacro(const QList& actions) : d(new Priva= te) -{ - appendActions(actions); -} - -KisMacro::~KisMacro() -{ - qDeleteAll(d->actions); - delete d; -} - - -void KisMacro::appendActions(const QList& actions) -{ - Q_FOREACH (KisRecordedAction* action, actions) { - addAction(*action); - } -} - -void KisMacro::removeActions(const QList& actions) -{ - Q_FOREACH (KisRecordedAction* action, actions) { - d->actions.removeAll(action); - } - qDeleteAll(actions); -} - -void KisMacro::addAction(const KisRecordedAction& action, const KisRecorde= dAction* before) -{ - if (before =3D=3D 0) { - KisRecordedAction* a =3D action.clone(); - Q_ASSERT(a); - d->actions.append(a); - } else { - d->actions.insert(d->actions.indexOf(const_cast(before)), action.clone()); - } -} - -void KisMacro::moveAction(const KisRecordedAction* action, const KisRecord= edAction* before) -{ - KisRecordedAction* _action =3D d->actions.takeAt(d->actions.indexOf(co= nst_cast(action))); - if (before =3D=3D 0) { - Q_ASSERT(_action); - d->actions.append(_action); - } else { - d->actions.insert(d->actions.indexOf(const_cast(before)), _action); - } -} - -void KisMacro::fromXML(const QDomElement& docElem, const KisRecordedAction= LoadContext* loadContext) -{ - d->actions.clear(); - QDomNode node =3D docElem.firstChild(); - while (!node.isNull()) { - QDomElement elt =3D node.toElement(); // try to convert the node t= o an element. - if (!elt.isNull() && elt.tagName() =3D=3D "RecordedAction") { - QString id =3D elt.attribute("id", ""); - if (!id.isNull()) { - dbgImage << "Reconstruct : " << id << endl; // the node re= ally is an element. - KisRecordedActionFactory* raf =3D KisRecordedActionFactory= Registry::instance()->get(id); - if (raf) { - KisRecordedAction* a =3D raf->fromXML(elt, loadContext= ); - Q_ASSERT(a); - d->actions.append(a); // TODO should use addAction - } else { - dbgImage << "Unknown action : " << id << endl; - } - } else { - dbgImage << "Invalid recorded action: null id"; - } - } else { - dbgImage << "Unknown element " << elt.tagName() << (elt.tagNam= e() =3D=3D "RecordedAction"); - } - node =3D node.nextSibling(); - } -} - -void KisMacro::toXML(QDomDocument& doc, QDomElement& e, KisRecordedActionS= aveContext* saveContext) const -{ - for (QList::iterator it =3D d->actions.begin(); - it !=3D d->actions.end(); ++it) { - QDomElement eAct =3D doc.createElement("RecordedAction"); - (*it)->toXML(doc, eAct, saveContext); - e.appendChild(eAct); - } -} - -const QList& KisMacro::actions() const -{ - return d->actions; -} - diff --git a/libs/image/recorder/kis_macro.h b/libs/image/recorder/kis_macr= o.h deleted file mode 100644 index 3f904abd4c0..00000000000 --- a/libs/image/recorder/kis_macro.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_MACRO_H_ -#define _KIS_MACRO_H_ - -#include -#include -#include - -#include "kis_serializable_configuration.h" -#include "kis_types.h" - -class KisRecordedAction; -class KisRecordedActionLoadContext; -class KisRecordedActionSaveContext; - -/** - * This is the base class for macro in Krita. It's basically a list of rec= orded action,KisRecordedAction - * that can be stored as XML, played, and edited. - */ -class KRITAIMAGE_EXPORT KisMacro : public QObject -{ - Q_OBJECT -public: - KisMacro(QObject* parent =3D 0); - KisMacro(const QList& _actions); - ~KisMacro() override; -public: - /** - * Append a list of actions, and make clone of them. - */ - void appendActions(const QList& actions); - /** - * Remove the list of actions. Actions are deleted. - */ - void removeActions(const QList& actions); - /** - * Move the action before an other one. - * @param before if null, the action is moved to the end - */ - void moveAction(const KisRecordedAction* action, const KisRecordedActi= on* before); -public: // serialization functions - - virtual void fromXML(const QDomElement&, const KisRecordedActionLoadCo= ntext* loadContext); - virtual void toXML(QDomDocument& doc, QDomElement& e, KisRecordedActio= nSaveContext* saveContext) const; - const QList& actions() const; -public Q_SLOTS: - /** - * add a single action, and make a clone of it. - * @param before if non null, the action will be added before that act= ion, - * otherwise, if null, the action will be added at the e= nd. - */ - virtual void addAction(const KisRecordedAction& action, const KisRecor= dedAction* before =3D 0); -private: - struct Private; - Private* const d; -}; - -#endif diff --git a/libs/image/recorder/kis_macro_player.cc b/libs/image/recorder/= kis_macro_player.cc deleted file mode 100644 index 7490b93e8da..00000000000 --- a/libs/image/recorder/kis_macro_player.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2007,2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_macro_player.h" - -#include - -#include -#include - -#include "kis_image.h" -#include "kis_debug.h" -#include "kis_macro.h" -#include "kis_node_query_path.h" -#include "kis_play_info.h" -#include "kis_recorded_action.h" -#include "kis_undo_adapter.h" -#include "kundo2magicstring.h" - - -struct Q_DECL_HIDDEN KisMacroPlayer::Private -{ - Private(const KisPlayInfo& _info) : info(_info), updater(0) {} - bool paused; - KisMacro* macro; - KisPlayInfo info; - KoUpdater* updater; -}; - -KisMacroPlayer::KisMacroPlayer(KisMacro* _macro, const KisPlayInfo& info, = KoUpdater * updater, QObject* _parent ) : QThread(_parent), d(new Private(i= nfo)) -{ - d->macro =3D _macro; - d->updater =3D updater; -} - -KisMacroPlayer::~KisMacroPlayer() -{ - delete d; -} - -void KisMacroPlayer::pause() -{ - d->paused =3D true; -} - -void KisMacroPlayer::resume() -{ - d->paused =3D false; -} - -void KisMacroPlayer::run() -{ - d->paused =3D false; - QList actions =3D d->macro->actions(); - - if (actions.size() < 1) { - return; - } - - dbgImage << "Start playing macro with " << actions.size() << " actions= "; - if (d->info.undoAdapter()) { - d->info.undoAdapter()->beginMacro(kundo2_i18n("Play macro")); - } - - KoProgressUpdater* progressUpdater =3D 0; - if(d->updater) { - progressUpdater =3D new KoProgressUpdater(d->updater); - progressUpdater->start(actions.size(), i18n("Playing back macro")); - } - - for (QList::iterator it =3D actions.begin(); it != =3D actions.end(); ++it) { - if (*it) { - dbgImage << "Play action : " << (*it)->name(); - KoUpdater* updater =3D 0; - if(progressUpdater) { - updater =3D progressUpdater->startSubtask(); - } - (*it)->play(d->info, updater); - } - if(progressUpdater && progressUpdater->interrupted()) { - break; - } - } - - if (d->info.undoAdapter()) { - d->info.undoAdapter()->endMacro(); - if(progressUpdater && progressUpdater->interrupted()) { - d->info.undoAdapter()->undoLastCommand(); - } - } - -} - diff --git a/libs/image/recorder/kis_macro_player.h b/libs/image/recorder/k= is_macro_player.h deleted file mode 100644 index c58cafc0642..00000000000 --- a/libs/image/recorder/kis_macro_player.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_MACRO_PLAYER_H_ -#define _KIS_MACRO_PLAYER_H_ - -#include - -#include -#include - -class KisMacro; -class KisPlayInfo; -class KoUpdater; - -/** - * This class play a macro inside a thread. - */ -class KRITAIMAGE_EXPORT KisMacroPlayer : public QThread { - Q_OBJECT -public: - KisMacroPlayer(KisMacro* _macro, const KisPlayInfo& info, KoUpdater * = updater =3D 0, QObject* _parent =3D 0); - ~KisMacroPlayer() override; -public Q_SLOTS: - void pause(); - void resume(); -protected: - void run() override; -private: - struct Private; - Private* const d; -}; - -#endif diff --git a/libs/image/recorder/kis_play_info.cc b/libs/image/recorder/kis= _play_info.cc deleted file mode 100644 index a0d40d8aad5..00000000000 --- a/libs/image/recorder/kis_play_info.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2009,2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_play_info.h" - -#include "kis_image.h" -#include "kis_node.h" -#include - -struct Q_DECL_HIDDEN KisPlayInfo::Private { - KisImageWSP image; - KisNodeSP currentNode; -}; - -KisPlayInfo::KisPlayInfo(KisImageWSP image, KisNodeSP currentNode) - : d(new Private) -{ - d->image =3D image; - d->currentNode =3D currentNode; -} - -KisPlayInfo::KisPlayInfo(const KisPlayInfo& _rhs) : d(new Private(*_rhs.d)) -{ -} - -KisPlayInfo& KisPlayInfo::operator=3D(const KisPlayInfo& _rhs) -{ - *d =3D *_rhs.d; - return *this; -} - -KisPlayInfo::~KisPlayInfo() -{ - delete d; -} - -KisUndoAdapter* KisPlayInfo::undoAdapter() const -{ - return d->image->undoAdapter(); -} - -KisImageWSP KisPlayInfo::image() const -{ - return d->image; -} - -KisNodeSP KisPlayInfo::currentNode() const -{ - return d->currentNode; -} diff --git a/libs/image/recorder/kis_play_info.h b/libs/image/recorder/kis_= play_info.h deleted file mode 100644 index 9f54df938e0..00000000000 --- a/libs/image/recorder/kis_play_info.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2009 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_PLAY_INFO_H_ -#define _KIS_PLAY_INFO_H_ - -#include -#include - -class KisUndoAdapter; - -class KRITAIMAGE_EXPORT KisPlayInfo -{ -public: - KisPlayInfo(KisImageWSP image, KisNodeSP currentNodes); - KisPlayInfo(const KisPlayInfo& _rhs); - KisPlayInfo& operator=3D(const KisPlayInfo& _rhs); - ~KisPlayInfo(); - KisUndoAdapter* undoAdapter() const; - KisImageWSP image() const; - KisNodeSP currentNode() const; -private: - struct Private; - Private* const d; -}; - -#endif diff --git a/libs/image/recorder/kis_recorded_action.cc b/libs/image/record= er/kis_recorded_action.cc deleted file mode 100644 index 5b5ae388c50..00000000000 --- a/libs/image/recorder/kis_recorded_action.cc +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action.h" -#include -#include -#include - -#include -#include -#include -#include -#include - -struct Q_DECL_HIDDEN KisRecordedAction::Private { - QString name; - QString id; -}; - -KisRecordedAction::KisRecordedAction(const QString& id, const QString& nam= e) : d(new Private()) -{ - d->name =3D name; - d->id =3D id; -} - -KisRecordedAction::KisRecordedAction(const KisRecordedAction& rhs) : d(new= Private(*rhs.d)) -{ - -} - -KisRecordedAction::~KisRecordedAction() -{ - delete d; -} - -const QString& KisRecordedAction::id() const -{ - return d->id; -} - -const QString& KisRecordedAction::name() const -{ - return d->name; -} - -void KisRecordedAction::setName(const QString& name) -{ - d->name =3D name; -} - -void KisRecordedAction::toXML(QDomDocument& , QDomElement& elt, KisRecorde= dActionSaveContext* ) const -{ - elt.setAttribute("name", name()); - elt.setAttribute("id", id()); -} - -struct Q_DECL_HIDDEN KisRecordedActionFactory::Private { - QString id; -}; - -KisRecordedActionFactory::KisRecordedActionFactory(QString id) : d(new Pri= vate) -{ - d->id =3D id; -} - -KisRecordedActionFactory::~KisRecordedActionFactory() -{ - delete d; -} - -QString KisRecordedActionFactory::id() const -{ - return d->id; -} - -QString KisRecordedActionFactory::name() const -{ - return QString(); -} diff --git a/libs/image/recorder/kis_recorded_action.h b/libs/image/recorde= r/kis_recorded_action.h deleted file mode 100644 index 6285be090bc..00000000000 --- a/libs/image/recorder/kis_recorded_action.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_ACTION_H_ -#define _KIS_RECORDED_ACTION_H_ - -class QDomDocument; -class QDomElement; -class QString; -class KisPlayInfo; -class KisRecordedActionLoadContext; -class KisRecordedActionSaveContext; -class KoUpdater; - -#include -#include -#include - -/** - * This class represent an action. - */ -class KRITAIMAGE_EXPORT KisRecordedAction -{ -public: - KisRecordedAction(const QString& id, const QString& name); - KisRecordedAction(const KisRecordedAction&); - virtual ~KisRecordedAction(); - /** - * Play the action. - */ - virtual void play(const KisPlayInfo& _info, KoUpdater* _updater =3D 0)= const =3D 0; - /** - * Clone this action. - */ - virtual KisRecordedAction* clone() const =3D 0; - virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedAct= ionSaveContext* ) const; -public: - const QString& id() const; - const QString& name() const; - void setName(const QString& name); -private: - struct Private; - Private* const d; -}; - -/** - * This class is used to create recorded action. - */ -class KRITAIMAGE_EXPORT KisRecordedActionFactory -{ -public: - KisRecordedActionFactory(QString id); - virtual ~KisRecordedActionFactory(); - virtual KisRecordedAction* fromXML(const QDomElement& elt, const KisRe= cordedActionLoadContext*) =3D 0; - QString id() const; - QString name() const; -private: - struct Private; - Private* const d; -}; - -#endif diff --git a/libs/image/recorder/kis_recorded_action_factory_registry.cc b/= libs/image/recorder/kis_recorded_action_factory_registry.cc deleted file mode 100644 index b1d17cc41c8..00000000000 --- a/libs/image/recorder/kis_recorded_action_factory_registry.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_factory_registry.h" -#include "kis_recorded_filter_action.h" -#include "kis_recorded_path_paint_action.h" -#include "kis_recorded_shape_paint_action.h" -#include "kis_recorded_fill_paint_action.h" - -#include -#include - -Q_GLOBAL_STATIC(KisRecordedActionFactoryRegistry, s_instance) - - -KisRecordedActionFactoryRegistry* KisRecordedActionFactoryRegistry::instan= ce() -{ - return s_instance; -} - - -KisRecordedActionFactoryRegistry::KisRecordedActionFactoryRegistry() -{ - add(new KisRecordedFilterActionFactory); - add(new KisRecordedPathPaintActionFactory); - add(new KisRecordedShapePaintActionFactory); - add(new KisRecordedFillPaintActionFactory); -} - -KisRecordedActionFactoryRegistry::~KisRecordedActionFactoryRegistry() -{ - Q_FOREACH (const QString &id, keys()) { - delete get(id); - } - dbgRegistry << "deleting KisRecordedActionFactoryRegistry"; -} diff --git a/libs/image/recorder/kis_recorded_action_factory_registry.h b/l= ibs/image/recorder/kis_recorded_action_factory_registry.h deleted file mode 100644 index b6784172204..00000000000 --- a/libs/image/recorder/kis_recorded_action_factory_registry.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_ACTION_FACTORY_REGISTRY_H_ -#define _KIS_RECORDED_ACTION_FACTORY_REGISTRY_H_ - -#include - -class KisRecordedActionFactory; - -#include - -class KRITAIMAGE_EXPORT KisRecordedActionFactoryRegistry : public KoGeneri= cRegistry -{ -public: - KisRecordedActionFactoryRegistry(); - ~KisRecordedActionFactoryRegistry() override; - static KisRecordedActionFactoryRegistry* instance(); -}; - -#endif diff --git a/libs/image/recorder/kis_recorded_action_load_context.cpp b/lib= s/image/recorder/kis_recorded_action_load_context.cpp deleted file mode 100644 index cb1dc1f43dd..00000000000 --- a/libs/image/recorder/kis_recorded_action_load_context.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_load_context.h" - - -KisRecordedActionLoadContext::~KisRecordedActionLoadContext() -{ -} diff --git a/libs/image/recorder/kis_recorded_action_load_context.h b/libs/= image/recorder/kis_recorded_action_load_context.h deleted file mode 100644 index 940fc3123b1..00000000000 --- a/libs/image/recorder/kis_recorded_action_load_context.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_ACTION_LOAD_CONTEXT_H_ -#define _KIS_RECORDED_ACTION_LOAD_CONTEXT_H_ - -#include "kritaimage_export.h" - -class KoAbstractGradient; -class KoPattern; -class QString; - -class KRITAIMAGE_EXPORT KisRecordedActionLoadContext { - public: - virtual ~KisRecordedActionLoadContext(); - virtual KoAbstractGradient* gradient(const QString& name) const = =3D 0; - virtual KoPattern* pattern(const QString& name) const =3D 0; -}; - -#endif diff --git a/libs/image/recorder/kis_recorded_action_save_context.cpp b/lib= s/image/recorder/kis_recorded_action_save_context.cpp deleted file mode 100644 index 9230072cc70..00000000000 --- a/libs/image/recorder/kis_recorded_action_save_context.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_save_context.h" - -KisRecordedActionSaveContext::~KisRecordedActionSaveContext() -{ -} diff --git a/libs/image/recorder/kis_recorded_action_save_context.h b/libs/= image/recorder/kis_recorded_action_save_context.h deleted file mode 100644 index c52ecf5ce37..00000000000 --- a/libs/image/recorder/kis_recorded_action_save_context.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_ACTION_SAVE_CONTEXT_H_ -#define _KIS_RECORDED_ACTION_SAVE_CONTEXT_H_ - -#include "kritaimage_export.h" - -class KoAbstractGradient; -class KoPattern; - -class KRITAIMAGE_EXPORT KisRecordedActionSaveContext { - public: - virtual ~KisRecordedActionSaveContext(); - virtual void saveGradient(const KoAbstractGradient* gradient) =3D = 0; - virtual void savePattern(const KoPattern* pattern) =3D 0; -}; - -#endif diff --git a/libs/image/recorder/kis_recorded_fill_paint_action.cpp b/libs/= image/recorder/kis_recorded_fill_paint_action.cpp deleted file mode 100644 index 5a26bad2a4f..00000000000 --- a/libs/image/recorder/kis_recorded_fill_paint_action.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_fill_paint_action.h" - -#include - -#include - -#include "kis_image.h" -#include -#include "kis_node.h" -#include "kis_node_query_path.h" -#include -#include "kis_play_info.h" - -struct Q_DECL_HIDDEN KisRecordedFillPaintAction::Private { - Private(const KisNodeQueryPath& _projectionPath) : projectionPath(_pro= jectionPath) {} - QPoint pt; - KisNodeQueryPath projectionPath; -}; - -KisRecordedFillPaintAction::KisRecordedFillPaintAction( - const KisNodeQueryPath& path, - const QPoint& pt, - const KisNodeQueryPath& projectionPath) - : KisRecordedPaintAction("FillPaintAction", i18n("Fill"), path, 0) - , d(new Private(projectionPath)) -{ - d->pt =3D pt; -} - -KisRecordedFillPaintAction::KisRecordedFillPaintAction(const KisRecordedFi= llPaintAction& rhs) : KisRecordedPaintAction(rhs), d(new Private(*rhs.d)) -{ - -} - -KisRecordedFillPaintAction::~KisRecordedFillPaintAction() -{ - delete d; -} - -void KisRecordedFillPaintAction::toXML(QDomDocument& doc, QDomElement& elt= , KisRecordedActionSaveContext* context) const -{ - KisRecordedPaintAction::toXML(doc, elt, context); - elt.setAttribute("x", d->pt.x()); - elt.setAttribute("y", d->pt.y()); - elt.setAttribute("projectionPath", d->projectionPath.toString()); -} - -KisRecordedAction* KisRecordedFillPaintAction::clone() const -{ - return new KisRecordedFillPaintAction(*this); -} - -KisPainter* KisRecordedFillPaintAction::createPainter(KisPaintDeviceSP dev= ice) const -{ - return new KisFillPainter(device); -} - -void KisRecordedFillPaintAction::playPaint(const KisPlayInfo& info, KisPai= nter* _painter) const -{ - QList nodes =3D d->projectionPath.queryNodes(info.image(), = info.currentNode()); - KisPaintDeviceSP projection =3D 0; - if (!nodes.isEmpty()) - { - projection =3D nodes[0]->projection(); - } - KisFillPainter* painter =3D static_cast(_painter); - painter->setWidth(info.image()->width()); - painter->setHeight(info.image()->height()); - if (fillStyle() =3D=3D KisPainter::FillStylePattern) - { - painter->fillPattern(d->pt.x(), d->pt.y(), projection); - } else { - painter->fillColor(d->pt.x(), d->pt.y(), projection); - } -} - -KisRecordedFillPaintActionFactory::KisRecordedFillPaintActionFactory() : - KisRecordedPaintActionFactory("FillPaintAction") -{ -} - -KisRecordedFillPaintActionFactory::~KisRecordedFillPaintActionFactory() -{ - -} - -KisRecordedAction* KisRecordedFillPaintActionFactory::fromXML(const QDomEl= ement& elt, const KisRecordedActionLoadContext* context) -{ - KisNodeQueryPath pathnode =3D nodeQueryPathFromXML(elt); - KisNodeQueryPath projectionPathnode =3D KisNodeQueryPath::fromString(e= lt.attribute("projectionPath")); - - int x =3D elt.attribute("x", "0").toInt(); - int y =3D elt.attribute("y", "0").toInt(); - - KisRecordedFillPaintAction* rplpa =3D new KisRecordedFillPaintAction(p= athnode, QPoint(x,y), projectionPathnode); - - setupPaintAction(rplpa, elt, context); - return rplpa; -} diff --git a/libs/image/recorder/kis_recorded_fill_paint_action.h b/libs/im= age/recorder/kis_recorded_fill_paint_action.h deleted file mode 100644 index 4a7fd3f00dd..00000000000 --- a/libs/image/recorder/kis_recorded_fill_paint_action.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_FILL_PAINT_ACTION_H_ -#define _KIS_RECORDED_FILL_PAINT_ACTION_H_ - -#include "recorder/kis_recorded_action.h" -#include "recorder/kis_recorded_paint_action.h" -#include "kis_types.h" - -#include - -/** - * This class will record the painting of a bezier curve. - */ -class KRITAIMAGE_EXPORT KisRecordedFillPaintAction : public KisRecordedPai= ntAction -{ -public: - - KisRecordedFillPaintAction(const KisNodeQueryPath& path, const QPoint&= pt, const KisNodeQueryPath& projectionPath); - - KisRecordedFillPaintAction(const KisRecordedFillPaintAction&); - - ~KisRecordedFillPaintAction() override; - - void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveC= ontext* ) const override; - - KisRecordedAction* clone() const override; - -protected: - - KisPainter* createPainter(KisPaintDeviceSP device) const override; - void playPaint(const KisPlayInfo& info, KisPainter* painter) const ove= rride; - -private: - - struct Private; - Private* const d; -}; - - -class KisRecordedFillPaintActionFactory : public KisRecordedPaintActionFac= tory -{ -public: - KisRecordedFillPaintActionFactory(); - ~KisRecordedFillPaintActionFactory() override; - KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedAc= tionLoadContext*) override; -}; - -#endif diff --git a/libs/image/recorder/kis_recorded_filter_action.cpp b/libs/imag= e/recorder/kis_recorded_filter_action.cpp deleted file mode 100644 index 5052a43f116..00000000000 --- a/libs/image/recorder/kis_recorded_filter_action.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "recorder/kis_recorded_filter_action.h" -#include -#include - - -#include "kis_image.h" -#include "filter/kis_filter.h" -#include "filter/kis_filter_configuration.h" -#include "filter/kis_filter_registry.h" -#include "kis_layer.h" -#include "kis_node.h" -#include "kis_selection.h" -#include "kis_transaction.h" -#include "kis_undo_adapter.h" -#include "kis_selection_mask.h" -#include "kis_config_widget.h" -#include "kis_node_query_path.h" -#include "kis_play_info.h" - -struct Q_DECL_HIDDEN KisRecordedFilterAction::Private { - Private() - : filterConfiguration(0) - { - - } - - const KisFilter* filter; - QRect rect; - - KisFilterConfigurationSP configuration() { - if (!filterConfiguration) { - filterConfiguration =3D filter->defaultConfiguration(); - if (filterConfiguration) { - filterConfiguration->fromXML(configstr); - } - } - return filterConfiguration; - } - - void setConfiguration(KisFilterConfigurationSP conf) { - filterConfiguration =3D conf; - configstr =3D conf->toXML(); - } - - void setConfig(const QString& cfg) { - filterConfiguration =3D 0; - configstr =3D cfg; - } - - const QString& config() { - return configstr; - } - -private: - QString configstr; - KisFilterConfigurationSP filterConfiguration; -}; - -KisRecordedFilterAction::KisRecordedFilterAction(QString name, const KisNo= deQueryPath& path, const KisFilter* filter, const KisFilterConfigurationSP = fc) : KisRecordedNodeAction("FilterAction", name, path), d(new Private) -{ - Q_ASSERT(filter); - d->filter =3D filter; - if (fc) { - d->setConfig(fc->toXML()); - } -} - -KisRecordedFilterAction::KisRecordedFilterAction(const KisRecordedFilterAc= tion& rhs) : KisRecordedNodeAction(rhs), d(new Private(*rhs.d)) -{ -} - -KisRecordedFilterAction::~KisRecordedFilterAction() -{ - delete d; -} - -void KisRecordedFilterAction::play(KisNodeSP node, const KisPlayInfo& _inf= o, KoUpdater* _updater) const -{ - KisFilterConfigurationSP kfc =3D d->configuration(); - KisPaintDeviceSP dev =3D node->paintDevice(); - KisLayerSP layer =3D qobject_cast(node.data()); - QRect r1 =3D dev->extent(); - KisTransaction transaction(kundo2_i18n("Filter: \"%1\"", d->filter->na= me()), dev); - - KisImageWSP image =3D _info.image(); - r1 =3D r1.intersected(image->bounds()); - if (layer && layer->selection()) { - r1 =3D r1.intersected(layer->selection()->selectedExactRect()); - } - - d->filter->process(dev, dev, layer->selection(), r1, kfc, _updater); - node->setDirty(r1); - - transaction.commit(_info.undoAdapter()); -} - -void KisRecordedFilterAction::toXML(QDomDocument& doc, QDomElement& elt, K= isRecordedActionSaveContext* context) const -{ - KisRecordedAction::toXML(doc, elt, context); - elt.setAttribute("filter", d->filter->id()); - // Save configuration - KisFilterConfigurationSP kfc =3D d->configuration(); - if (kfc) { - QDomElement filterConfigElt =3D doc.createElement("Params"); - kfc->toXML(doc, filterConfigElt); - elt.appendChild(filterConfigElt); - } -} - -KisRecordedAction* KisRecordedFilterAction::clone() const -{ - return new KisRecordedFilterAction(*this); -} - -const KisFilter* KisRecordedFilterAction::filter() const -{ - return d->filter; -} - -const KisFilterConfigurationSP KisRecordedFilterAction::filterConfiguratio= n() const -{ - return d->configuration(); -} - -void KisRecordedFilterAction::setFilterConfiguration(KisFilterConfiguratio= nSP config) -{ - d->setConfiguration(config); -} - - -KisRecordedFilterActionFactory::KisRecordedFilterActionFactory() : - KisRecordedActionFactory("FilterAction") -{ -} - -KisRecordedFilterActionFactory::~KisRecordedFilterActionFactory() -{ - -} - -KisRecordedAction* KisRecordedFilterActionFactory::fromXML(const QDomEleme= nt& elt, const KisRecordedActionLoadContext*) -{ - QString name =3D elt.attribute("name"); - KisNodeQueryPath pathnode =3D KisNodeQueryPath::fromString(elt.attribu= te("path")); - const KisFilterSP filter =3D KisFilterRegistry::instance()->get(elt.at= tribute("filter")); - if (filter) { - KisFilterConfigurationSP config =3D filter->defaultConfiguration(); - QDomElement paramsElt =3D elt.firstChildElement("Params"); - if (config && !paramsElt.isNull()) { - config->fromXML(paramsElt); - } - KisRecordedFilterAction* rfa =3D new KisRecordedFilterAction(name,= pathnode, filter, config); - return rfa; - } else { - return 0; - } -} diff --git a/libs/image/recorder/kis_recorded_filter_action.h b/libs/image/= recorder/kis_recorded_filter_action.h deleted file mode 100644 index c568117ace5..00000000000 --- a/libs/image/recorder/kis_recorded_filter_action.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_FILTER_ACTION_H_ -#define _KIS_RECORDED_FILTER_ACTION_H_ - -#include "recorder/kis_recorded_node_action.h" - -#include - -class QString; -class KisFilterConfiguration; - -/** - * Action representing a filter. - */ -class KRITAIMAGE_EXPORT KisRecordedFilterAction : public KisRecordedNodeAc= tion -{ -public: - /** - * @param config the filter configuration, the ownership of config rem= ains in the caller. - */ - KisRecordedFilterAction(QString name, const KisNodeQueryPath& path, co= nst KisFilter* filter, const KisFilterConfigurationSP config); - KisRecordedFilterAction(const KisRecordedFilterAction&); - ~KisRecordedFilterAction() override; - using KisRecordedNodeAction::play; - void play(KisNodeSP node, const KisPlayInfo& _info, KoUpdater* _update= r =3D 0) const override; - void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveC= ontext* ) const override; - KisRecordedAction* clone() const override; - const KisFilter* filter() const; - const KisFilterConfigurationSP filterConfiguration() const; - /** - * Set the configuration, and takes the ownership of the config object. - */ - void setFilterConfiguration(KisFilterConfigurationSP config); -private: - struct Private; - Private* const d; -}; - -class KisRecordedFilterActionFactory : public KisRecordedActionFactory -{ -public: - KisRecordedFilterActionFactory(); - ~KisRecordedFilterActionFactory() override; - KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedAc= tionLoadContext*) override; -}; - -#endif diff --git a/libs/image/recorder/kis_recorded_node_action.cc b/libs/image/r= ecorder/kis_recorded_node_action.cc deleted file mode 100644 index 2529cc519c3..00000000000 --- a/libs/image/recorder/kis_recorded_node_action.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_node_action.h" - -#include -#include -#include - -#include "kis_node_query_path.h" -#include "kis_play_info.h" -#include "kis_image.h" -#include "kis_paint_device.h" -#include - -struct Q_DECL_HIDDEN KisRecordedNodeAction::Private -{ - Private(const KisNodeQueryPath& _path) : path(_path) {} - KisNodeQueryPath path; -}; - -KisRecordedNodeAction::KisRecordedNodeAction(const QString& id, const QStr= ing& name, const KisNodeQueryPath& path) : KisRecordedAction(id, name), d(n= ew Private(path)) -{ -} - -KisRecordedNodeAction::KisRecordedNodeAction(const KisRecordedNodeAction& = _rhs) : KisRecordedAction(_rhs), d(new Private(*_rhs.d)) -{ -} - -KisRecordedNodeAction::~KisRecordedNodeAction() -{ - delete d; -} - -void KisRecordedNodeAction::play(const KisPlayInfo& _info, KoUpdater* _upd= ater) const -{ - QList nodes =3D nodeQueryPath().queryNodes(_info.image(), _= info.currentNode()); - KoProgressUpdater updater(_updater); - updater.start(nodes.size(), i18n("Applying action to all selected node= s")); - Q_FOREACH (KisNodeSP node, nodes) - { - play(node, _info, updater.startSubtask()); - } -} - -const KisNodeQueryPath& KisRecordedNodeAction::nodeQueryPath() const -{ - return d->path; -} - -void KisRecordedNodeAction::setNodeQueryPath(const KisNodeQueryPath& nqp) -{ - d->path =3D nqp; -} - -void KisRecordedNodeAction::toXML(QDomDocument& doc, QDomElement& elt, Kis= RecordedActionSaveContext* ) const -{ - Q_UNUSED(doc) - elt.setAttribute("path", d->path.toString()); = -} diff --git a/libs/image/recorder/kis_recorded_node_action.h b/libs/image/re= corder/kis_recorded_node_action.h deleted file mode 100644 index e9a4884b0de..00000000000 --- a/libs/image/recorder/kis_recorded_node_action.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_NODE_ACTION_H_ -#define _KIS_RECORDED_NODE_ACTION_H_ - -#include "kis_recorded_action.h" -class KisNodeQueryPath; - -/** - * Used for action that applys on nodes that are = - */ -class KRITAIMAGE_EXPORT KisRecordedNodeAction : public KisRecordedAction -{ -public: - KisRecordedNodeAction(const QString& id, const QString& name, const Ki= sNodeQueryPath& path); - KisRecordedNodeAction(const KisRecordedNodeAction& _rhs); - ~KisRecordedNodeAction() override; - /** - * Play the action on one node - */ - virtual void play(KisNodeSP node, const KisPlayInfo&, KoUpdater* _upda= ter) const =3D 0; - /** - * Play the action on all the nodes returned by the nodeQueryPath - */ - void play(const KisPlayInfo& _info, KoUpdater* _updater) const overrid= e; - void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveC= ontext* ) const override; -public: - const KisNodeQueryPath& nodeQueryPath() const; - void setNodeQueryPath(const KisNodeQueryPath&); -private: - struct Private; - Private* const d; -}; - -#endif diff --git a/libs/image/recorder/kis_recorded_paint_action.cpp b/libs/image= /recorder/kis_recorded_paint_action.cpp deleted file mode 100644 index 5f04f122946..00000000000 --- a/libs/image/recorder/kis_recorded_paint_action.cpp +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Copyright (c) 2007,2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include //MSVC requires that V= c come first -#include "recorder/kis_recorded_paint_action.h" - -#include -#include - -#include -#include -#include -#include - -#include "kis_node.h" -#include "kis_mask_generator.h" -#include "kis_painter.h" -#include -#include "kis_paintop_registry.h" -#include "kis_transaction.h" -#include "kis_undo_adapter.h" -#include -#include -#include "kis_paint_device.h" -#include "kis_image.h" -#include "kis_layer.h" -#include "kis_play_info.h" -#include "kis_node_query_path.h" -#include -// Recorder -#include "kis_recorded_action_factory_registry.h" -#include "kis_recorded_action_load_context.h" -#include "kis_recorded_action_save_context.h" -#include -#include -#include -#include -#include - - -struct Q_DECL_HIDDEN KisRecordedPaintAction::Private { - KisPaintOpPresetSP paintOpPreset; - KoColor foregroundColor; - KoColor backgroundColor; - qreal opacity; ///< opacity in the range 0.0 -> 100.0 - bool paintIncremental; - QString compositeOp; - KisPainter::StrokeStyle strokeStyle; - KisPainter::FillStyle fillStyle; - const KoPattern* pattern; - const KoAbstractGradient* gradient; - KisFilterConfigurationSP generator; -}; - -KisRecordedPaintAction::KisRecordedPaintAction(const QString & id, - const QString & name, - const KisNodeQueryPath& path, - const KisPaintOpPresetSP paintOpPreset) - : KisRecordedNodeAction(id, name, path) - , d(new Private) -{ - if (paintOpPreset) - { - d->paintOpPreset =3D paintOpPreset; - } - d->opacity =3D 1.0; - d->paintIncremental =3D true; - d->compositeOp =3D COMPOSITE_OVER; - d->strokeStyle =3D KisPainter::StrokeStyleBrush; - d->fillStyle =3D KisPainter::FillStyleNone; - d->pattern =3D 0; - d->gradient =3D 0; -} - -KisRecordedPaintAction::KisRecordedPaintAction(const KisRecordedPaintActio= n& rhs) : KisRecordedNodeAction(rhs), d(new Private(*rhs.d)) -{ - -} - -KisRecordedPaintAction::~KisRecordedPaintAction() -{ - delete d; -} - -void KisRecordedPaintAction::toXML(QDomDocument& doc, QDomElement& elt, Ki= sRecordedActionSaveContext* context) const -{ - KisRecordedAction::toXML(doc, elt, context); - - // Paint op presset - if (d->paintOpPreset) - { - QDomElement paintopPressetElt =3D doc.createElement("PaintopPreset= "); - d->paintOpPreset->toXML(doc, paintopPressetElt); - elt.appendChild(paintopPressetElt); - } - - // ForegroundColor - QDomElement foregroundColorElt =3D doc.createElement("ForegroundColor"= ); - d->foregroundColor.toXML(doc, foregroundColorElt); - elt.appendChild(foregroundColorElt); - - // BackgroundColor - QDomElement backgroundColorElt =3D doc.createElement("BackgroundColor"= ); - d->backgroundColor.toXML(doc, backgroundColorElt); - elt.appendChild(backgroundColorElt); - - // Opacity - elt.setAttribute("opacity", KisDomUtils::toString(d->opacity)); - - // paintIncremental - elt.setAttribute("paintIncremental", d->paintIncremental); - - // compositeOp - elt.setAttribute("compositeOp", d->compositeOp); - - // Save stroke style - switch(d->strokeStyle) - { - case KisPainter::StrokeStyleNone: - elt.setAttribute("strokeStyle", "None"); - break; - case KisPainter::StrokeStyleBrush: - elt.setAttribute("strokeStyle", "Brush"); - break; - } - // Save fill style - switch(d->fillStyle) - { - case KisPainter::FillStyleNone: - elt.setAttribute("fillStyle", "None"); - break; - case KisPainter::FillStyleForegroundColor: - elt.setAttribute("fillStyle", "PaintColor"); - break; - case KisPainter::FillStyleBackgroundColor: - elt.setAttribute("fillStyle", "AlternativeColor"); - break; - case KisPainter::FillStylePattern: - elt.setAttribute("fillStyle", "Pattern"); - context->savePattern(d->pattern); - elt.setAttribute("pattern", d->pattern->name()); - break; - case KisPainter::FillStyleGradient: - elt.setAttribute("fillStyle", "Gradient"); - context->saveGradient(d->gradient); - elt.setAttribute("gradient", d->gradient->name()); - break; - case KisPainter::FillStyleStrokes: - elt.setAttribute("fillStyle", "Strokes"); - break; - case KisPainter::FillStyleGenerator: - elt.setAttribute("fillStyle", "Generator"); - if (d->generator) - { - elt.setAttribute("generator", d->generator->name()); - QDomElement filterConfigElt =3D doc.createElement("Generat= or"); - d->generator->toXML(doc, filterConfigElt); - elt.appendChild(filterConfigElt); - } - break; - } -} - -KisPaintOpPresetSP KisRecordedPaintAction::paintOpPreset() const -{ - return d->paintOpPreset; -} - -void KisRecordedPaintAction::setPaintOpPreset(KisPaintOpPresetSP preset) -{ - d->paintOpPreset =3D preset; -} - -qreal KisRecordedPaintAction::opacity() const -{ - return d->opacity; -} - -void KisRecordedPaintAction::setOpacity(qreal opacity) -{ - d->opacity =3D opacity; -} - -KoColor KisRecordedPaintAction::paintColor() const -{ - return d->foregroundColor; -} - -void KisRecordedPaintAction::setPaintColor(const KoColor& color) -{ - d->foregroundColor =3D color; -} - -KoColor KisRecordedPaintAction::backgroundColor() const -{ - return d->backgroundColor; -} - -void KisRecordedPaintAction::setBackgroundColor(const KoColor& color) -{ - d->backgroundColor =3D color; -} - -QString KisRecordedPaintAction::compositeOp() -{ - return d->compositeOp; -} - -void KisRecordedPaintAction::setCompositeOp(const QString& id) -{ - d->compositeOp =3D id; -} - -void KisRecordedPaintAction::setPaintIncremental(bool v) -{ - d->paintIncremental =3D v; -} - -void KisRecordedPaintAction::setStrokeStyle(KisPainter::StrokeStyle stroke= Style) -{ - d->strokeStyle =3D strokeStyle; -} - -void KisRecordedPaintAction::setFillStyle(KisPainter::FillStyle fillStyle) -{ - d->fillStyle =3D fillStyle; -} - -KisPainter::FillStyle KisRecordedPaintAction::fillStyle() const -{ - return d->fillStyle; -} - -void KisRecordedPaintAction::setPattern(const KoPattern* pattern) -{ - d->pattern =3D pattern; -} - -void KisRecordedPaintAction::setGradient(const KoAbstractGradient* gradien= t) -{ - d->gradient =3D gradient; -} - -void KisRecordedPaintAction::setGenerator(const KisFilterConfigurationSP = generator) -{ - d->generator =3D generator; -} - -void KisRecordedPaintAction::play(KisNodeSP node, const KisPlayInfo& info,= KoUpdater* _updater) const -{ - dbgUI << "Play recorded paint action on node : " << node->name() ; - KisTransaction transaction(node->paintDevice()); - - KisPaintDeviceSP target =3D 0; - if (d->paintIncremental) { - target =3D node->paintDevice(); - } else { - target =3D node->paintDevice()->createCompositionSourceDevice(); - } - - KisPainter* painter =3D createPainter(target); - painter->setProgress(_updater); - - if (d->paintIncremental) { - painter->setCompositeOp(d->compositeOp); - painter->setOpacity(d->opacity * 255); - } else { - painter->setCompositeOp(node->paintDevice()->colorSpace()->composi= teOp(COMPOSITE_ALPHA_DARKEN)); - painter->setOpacity(OPACITY_OPAQUE_U8); - - } - - painter->setPaintColor(d->foregroundColor); - painter->setBackgroundColor(d->backgroundColor); - - painter->setStrokeStyle(d->strokeStyle); - painter->setFillStyle(d->fillStyle); - painter->setPattern(d->pattern); - painter->setGradient(d->gradient); - painter->setGenerator(d->generator); - - if (d->paintOpPreset) { - painter->setPaintOpPreset(d->paintOpPreset, node, info.image()); - } - - playPaint(info, painter); - - if (!d->paintIncremental) { - KisPainter painter2(node->paintDevice()); - painter2.setCompositeOp(d->compositeOp); - painter2.setOpacity(d->opacity * 255); - - QVector dirtyRects =3D painter->takeDirtyRegion(); - Q_FOREACH (const QRect &rc, dirtyRects) { - painter2.bitBlt(rc.topLeft(), target, rc); - } - - node->setDirty(painter2.takeDirtyRegion()); - } else { - node->setDirty(painter->takeDirtyRegion()); - } - delete painter; - - transaction.commit(info.undoAdapter()); -} - -KisPainter* KisRecordedPaintAction::createPainter(KisPaintDeviceSP device)= const -{ - return new KisPainter(device); -} - -void KisRecordedPaintActionFactory::setupPaintAction(KisRecordedPaintActio= n* action, const QDomElement& elt, const KisRecordedActionLoadContext* cont= ext) -{ - QString name =3D elt.attribute("name"); - - qreal opacity =3D opacityFromXML(elt); - dbgKrita << ppVar(opacity); - bool paintIncremental =3D paintIncrementalFromXML(elt); - - QString compositeOp =3D compositeOpFromXML(elt); - // Decode colors - - KoColor bC =3D backgroundColorFromXML(elt); - KoColor fC =3D paintColorFromXML(elt); - - action->setName(name); - action->setBackgroundColor(bC); - action->setPaintColor(fC); - action->setOpacity(opacity); - action->setPaintIncremental(paintIncremental); - action->setCompositeOp(compositeOp); - - - // Load stroke style - QString strokeAttr =3D elt.attribute("strokeStyle", "None"); - if (strokeAttr =3D=3D "Brush" ) - { - action->setStrokeStyle(KisPainter::StrokeStyleBrush); - } else { // "None" - action->setStrokeStyle(KisPainter::StrokeStyleNone); - } - // Save fill style - QString fillAttr =3D elt.attribute("fillStyle", "None"); - if (fillAttr =3D=3D "PaintColor") - { - action->setFillStyle(KisPainter::FillStyleForegroundColor); - } else if(fillAttr =3D=3D "AlternativeColor") - { - action->setFillStyle(KisPainter::FillStyleBackgroundColor); - } else if(fillAttr =3D=3D "Pattern") - { - const KoPattern* pattern =3D context->pattern(elt.attribute("patte= rn")); - if (pattern) - { - action->setFillStyle(KisPainter::FillStylePattern); - action->setPattern(pattern); - } else { - action->setFillStyle(KisPainter::FillStyleNone); - } - } else if(fillAttr =3D=3D "Gradient") - { - const KoAbstractGradient* gradient =3D context->gradient(elt.attri= bute("gradient")); - if (gradient) - { - action->setFillStyle(KisPainter::FillStyleGradient); - action->setGradient(gradient); - } else { - action->setFillStyle(KisPainter::FillStyleNone); - } - } else if(fillAttr =3D=3D "Strokes") - { - action->setFillStyle(KisPainter::FillStyleStrokes); - } else if(fillAttr =3D=3D "Generator") - { - KisGeneratorSP g =3D KisGeneratorRegistry::instance()->value(elt.a= ttribute("generator")); - KisFilterConfigurationSP config =3D 0; - if (g) - { - config =3D g->defaultConfiguration(); - QDomElement paramsElt =3D elt.firstChildElement("Generator"); - if (config && !paramsElt.isNull()) { - config->fromXML(paramsElt); - } - } - if(config) - { - action->setFillStyle(KisPainter::FillStyleGenerator); - action->setGenerator(config); - } else { - action->setFillStyle(KisPainter::FillStyleNone); - } - } -} - -KisPaintOpPresetSP KisRecordedPaintActionFactory::paintOpPresetFromXML(con= st QDomElement& elt) -{ - - QDomElement settingsElt =3D elt.firstChildElement("PaintopPreset"); - if (!settingsElt.isNull()) { - KisPaintOpPresetSP settings =3D new KisPaintOpPreset; - settings->fromXML(settingsElt); - return settings; - } else { - errImage << "No found"; - return 0; - } -} - -KoColor KisRecordedPaintActionFactory::paintColorFromXML(const QDomElement= & elt) -{ - return colorFromXML(elt, "ForegroundColor"); -} - -KoColor KisRecordedPaintActionFactory::backgroundColorFromXML(const QDomEl= ement& elt) -{ - return colorFromXML(elt, "BackgroundColor"); -} - -KoColor KisRecordedPaintActionFactory::colorFromXML(const QDomElement& elt= , const QString& elementName) -{ - QDomElement colorElt =3D elt.firstChildElement(elementName); - KoColor bC; - - if (!colorElt.isNull()) { - bC =3D KoColor::fromXML(colorElt.firstChildElement(), Integer8Bits= ColorDepthID.id()); - bC.setOpacity(quint8(255)); - dbgImage << elementName << " color : " << bC.toQColor(); - } else { - dbgImage << "Warning: no <" << elementName << " /> found"; - } - return bC; -} - -qreal KisRecordedPaintActionFactory::opacityFromXML(const QDomElement& elt) -{ - return KisDomUtils::toDouble(elt.attribute("opacity", "1.0")); -} - -bool KisRecordedPaintActionFactory::paintIncrementalFromXML(const QDomElem= ent& elt) -{ - return KisDomUtils::toInt(elt.attribute("paintIncremental", "1")); -} - -QString KisRecordedPaintActionFactory::compositeOpFromXML(const QDomElemen= t& elt) -{ - return elt.attribute("compositeOp", COMPOSITE_OVER); -} - -KisNodeQueryPath KisRecordedPaintActionFactory::nodeQueryPathFromXML(const= QDomElement& elt) -{ - return KisNodeQueryPath::fromString(elt.attribute("path")); -} diff --git a/libs/image/recorder/kis_recorded_paint_action.h b/libs/image/r= ecorder/kis_recorded_paint_action.h deleted file mode 100644 index 68b33119bb6..00000000000 --- a/libs/image/recorder/kis_recorded_paint_action.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2007,2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_PAINT_ACTION_H_ -#define _KIS_RECORDED_PAINT_ACTION_H_ - -#include "recorder/kis_recorded_node_action.h" -#include "kis_types.h" -#include "kis_painter.h" - -class KisPainter; -class KoColor; - -#include - -/** - * Base class for paint action. - */ -class KRITAIMAGE_EXPORT KisRecordedPaintAction : public KisRecordedNodeAct= ion -{ -public: - - KisRecordedPaintAction(const QString & id, - const QString & name, - const KisNodeQueryPath& path, - KisPaintOpPresetSP paintOpPreset); - - KisRecordedPaintAction(const KisRecordedPaintAction&); - - ~KisRecordedPaintAction() override; - - void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveC= ontext* ) const override; - - using KisRecordedNodeAction::play; - void play(KisNodeSP node, const KisPlayInfo& info, KoUpdater* _updater= =3D 0) const override; - -protected: - /** - * This function will create a painter for the given device. The defau= lt - * implementation creates a KisPainter, subclass can reimplement it if - * they want to use one of the subclass of KisPainter. - */ - virtual KisPainter* createPainter(KisPaintDeviceSP device) const; - /** - * Reimplement this function in a subclass to play the painting. - */ - virtual void playPaint(const KisPlayInfo&, KisPainter* painter) const = =3D 0; - -public: - KisPaintOpPresetSP paintOpPreset() const; - void setPaintOpPreset(KisPaintOpPresetSP preset); - /** - * @return the opacity in the range 0.0->1.0 - */ - qreal opacity() const; - void setOpacity(qreal ); - KoColor paintColor() const; - void setPaintColor(const KoColor& color); - KoColor backgroundColor() const; - void setBackgroundColor(const KoColor& color); - QString compositeOp(); - void setCompositeOp(const QString& ); - void setPaintIncremental(bool ); - void setStrokeStyle(KisPainter::StrokeStyle ); - void setFillStyle(KisPainter::FillStyle ); - KisPainter::FillStyle fillStyle() const; - void setPattern(const KoPattern* ); - void setGradient(const KoAbstractGradient* gradient); - void setGenerator(const KisFilterConfigurationSP generator); -private: - - struct Private; - Private* const d; -}; - -class KisRecordedPaintActionFactory : public KisRecordedActionFactory -{ -public: - KisRecordedPaintActionFactory(const QString & id) : KisRecordedActionF= actory(id) {} - ~KisRecordedPaintActionFactory() override {} -protected: - - void setupPaintAction(KisRecordedPaintAction* action, const QDomElemen= t& elt, const KisRecordedActionLoadContext*); - KisPaintOpPresetSP paintOpPresetFromXML(const QDomElement& elt); - KoColor paintColorFromXML(const QDomElement& elt); - KoColor backgroundColorFromXML(const QDomElement& elt); - KoColor colorFromXML(const QDomElement& elt, const QString& elementNam= e); - qreal opacityFromXML(const QDomElement& elt); - bool paintIncrementalFromXML(const QDomElement& elt); - QString compositeOpFromXML(const QDomElement& elt); - KisNodeQueryPath nodeQueryPathFromXML(const QDomElement& elt); -}; - - -#endif diff --git a/libs/image/recorder/kis_recorded_path_paint_action.cpp b/libs/= image/recorder/kis_recorded_path_paint_action.cpp deleted file mode 100644 index a4951a5194b..00000000000 --- a/libs/image/recorder/kis_recorded_path_paint_action.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include //MSVC requires that V= c come first -#include "recorder/kis_recorded_path_paint_action.h" -#include -#include - -#include -#include -#include -#include "kis_node.h" -#include "kis_mask_generator.h" -#include "kis_painter.h" -#include -#include "kis_paintop_registry.h" -#include "recorder/kis_recorded_action_factory_registry.h" -#include "kis_transaction.h" -#include "kis_undo_adapter.h" -#include -#include -#include "kis_paint_device.h" -#include "kis_image.h" -#include "kis_layer.h" -#include "kis_node_query_path.h" -#include - -struct Q_DECL_HIDDEN KisRecordedPathPaintAction::Private { - struct BezierCurveSlice { - enum Type { - Point, - Line, - Curve - }; - Type type; - KisPaintInformation point1; - QPointF control1; - QPointF control2; - KisPaintInformation point2; - }; - - Private(const KisDistanceInitInfo &startDistInfo) : - startDistInfo(startDistInfo) {} - - QList curveSlices; - - // Information about distance and spacing at the start of the action. - KisDistanceInitInfo startDistInfo; -}; - -KisRecordedPathPaintAction::KisRecordedPathPaintAction( - const KisNodeQueryPath& path, - const KisPaintOpPresetSP preset, - const KisDistanceInitInfo& startDistInfo) - : KisRecordedPaintAction("PathPaintAction", i18n("Path"), path, pr= eset) - , d(new Private(startDistInfo)) -{ -} - -KisRecordedPathPaintAction::KisRecordedPathPaintAction(const KisRecordedPa= thPaintAction& rhs) : KisRecordedPaintAction(rhs), d(new Private(*rhs.d)) -{ - -} - -KisRecordedPathPaintAction::~KisRecordedPathPaintAction() -{ - delete d; -} - -KisDistanceInitInfo KisRecordedPathPaintAction::getInitDistInfo() const -{ - return d->startDistInfo; -} - -void KisRecordedPathPaintAction::setInitDistInfo(const KisDistanceInitInfo= &startDistInfo) -{ - d->startDistInfo =3D startDistInfo; -} - -void KisRecordedPathPaintAction::addPoint(const KisPaintInformation& info) -{ - Private::BezierCurveSlice slice; - slice.type =3D Private::BezierCurveSlice::Point; - slice.point1 =3D info; - d->curveSlices.append(slice); -} - -void KisRecordedPathPaintAction::addLine(const KisPaintInformation& point1= , const KisPaintInformation& point2) -{ - Private::BezierCurveSlice slice; - slice.type =3D Private::BezierCurveSlice::Line; - slice.point1 =3D point1; - slice.point2 =3D point2; - d->curveSlices.append(slice); -} - -void KisRecordedPathPaintAction::addPolyLine(const QList& points) -{ - QPointF previousPoint =3D points[0]; - for(int i =3D 1; i < points.size(); ++i) { - QPointF pt =3D points[i]; - addLine(KisPaintInformation(previousPoint), KisPaintInformation(pt= )); - previousPoint =3D pt; - } -} - - -void KisRecordedPathPaintAction::addCurve(const KisPaintInformation& point= 1, - const QPointF& control1, - const QPointF& control2, - const KisPaintInformation& point2) -{ - Private::BezierCurveSlice slice; - slice.type =3D Private::BezierCurveSlice::Curve; - slice.point1 =3D point1; - slice.control1 =3D control1; - slice.control2 =3D control2; - slice.point2 =3D point2; - d->curveSlices.append(slice); -} - -void KisRecordedPathPaintAction::playPaint(const KisPlayInfo&, KisPainter*= painter) const -{ - dbgImage << "play path paint action with " << d->curveSlices.size() <<= " slices"; - if (d->curveSlices.size() <=3D 0) return; - - KisDistanceInformation savedDist =3D d->startDistInfo.makeDistInfo(); - - Q_FOREACH (const Private::BezierCurveSlice &slice, d->curveSlices) - { - switch(slice.type) - { - case Private::BezierCurveSlice::Point: - painter->paintAt(slice.point1, &savedDist); - break; - case Private::BezierCurveSlice::Line: - painter->paintLine(slice.point1, slice.point2, &savedDist); - break; - case Private::BezierCurveSlice::Curve: - painter->paintBezierCurve(slice.point1, slice.control1, sl= ice.control2, slice.point2, &savedDist); - break; - } - } -} - -void KisRecordedPathPaintAction::toXML(QDomDocument& doc, QDomElement& elt= , KisRecordedActionSaveContext* context) const -{ - KisRecordedPaintAction::toXML(doc, elt, context); - QDomElement waypointsElt =3D doc.createElement("Slices"); - Q_FOREACH (const Private::BezierCurveSlice & slice, d->curveSlices) { - switch(slice.type) - { - case Private::BezierCurveSlice::Point: - { - QDomElement infoElt =3D doc.createElement("Point"); - slice.point1.toXML(doc, infoElt); - - waypointsElt.appendChild(infoElt); - break; - } - case Private::BezierCurveSlice::Line: - { - QDomElement infoElt =3D doc.createElement("Line"); - // Point1 - QDomElement point1Elt =3D doc.createElement("Point1"); - slice.point1.toXML(doc, point1Elt); - infoElt.appendChild(point1Elt); - // Point2 - QDomElement point2Elt =3D doc.createElement("Point2"); - slice.point2.toXML(doc, point2Elt); - infoElt.appendChild(point2Elt); - - waypointsElt.appendChild(infoElt); - break; - } - case Private::BezierCurveSlice::Curve: - { - QDomElement infoElt =3D doc.createElement("Curve"); - // Point1 - QDomElement point1Elt =3D doc.createElement("Point1"); - slice.point1.toXML(doc, point1Elt); - infoElt.appendChild(point1Elt); - // Control1 - QDomElement control1Elt =3D doc.createElement("Control1"); - control1Elt.setAttribute("x", KisDomUtils::toString(slice.= control1.x())); - control1Elt.setAttribute("y", KisDomUtils::toString(slice.= control1.y())); - infoElt.appendChild(control1Elt); - // Control2 - QDomElement control2Elt =3D doc.createElement("Control2"); - control2Elt.setAttribute("x", KisDomUtils::toString(slice.= control2.x())); - control2Elt.setAttribute("y", KisDomUtils::toString(slice.= control2.y())); - infoElt.appendChild(control2Elt); - // Point2 - QDomElement point2Elt =3D doc.createElement("Point2"); - slice.point2.toXML(doc, point2Elt); - infoElt.appendChild(point2Elt); - - waypointsElt.appendChild(infoElt); - } - } - } - elt.appendChild(waypointsElt); - - QDomElement initDistElt =3D doc.createElement("StartDistInfo"); - d->startDistInfo.toXML(doc, initDistElt); - elt.appendChild(initDistElt); -} - -KisRecordedAction* KisRecordedPathPaintAction::clone() const -{ - return new KisRecordedPathPaintAction(*this); -} - - -KisRecordedPathPaintActionFactory::KisRecordedPathPaintActionFactory() : - KisRecordedPaintActionFactory("PathPaintAction") -{ -} - -KisRecordedPathPaintActionFactory::~KisRecordedPathPaintActionFactory() -{ - -} - -KisRecordedAction* KisRecordedPathPaintActionFactory::fromXML(const QDomEl= ement& elt, const KisRecordedActionLoadContext* context) -{ - KisNodeQueryPath pathnode =3D nodeQueryPathFromXML(elt); - - // Decode pressets - KisPaintOpPresetSP paintOpPreset =3D paintOpPresetFromXML(elt); - - KisRecordedPathPaintAction* rplpa =3D new KisRecordedPathPaintAction(p= athnode, paintOpPreset, - Kis= DistanceInitInfo()); - - setupPaintAction(rplpa, elt, context); - - QDomElement wpElt =3D elt.firstChildElement("Slices"); - if (!wpElt.isNull()) { - QDomNode nWp =3D wpElt.firstChild(); - while (!nWp.isNull()) { - QDomElement eWp =3D nWp.toElement(); - if (!eWp.isNull()) { - if( eWp.tagName() =3D=3D "Point") { - rplpa->addPoint(KisPaintInformation::fromXML(eWp)); - } else if(eWp.tagName() =3D=3D "Line") { - rplpa->addLine(KisPaintInformation::fromXML(eWp.firstC= hildElement("Point1")), - KisPaintInformation::fromXML(eWp.first= ChildElement("Point2"))); - } else if( eWp.tagName() =3D=3D "Curve") { - QDomElement control1Elt =3D eWp.firstChildElement("Con= trol1"); - QDomElement control2Elt =3D eWp.firstChildElement("Con= trol2"); - rplpa->addCurve(KisPaintInformation::fromXML(eWp.first= ChildElement("Point1")), - QPointF(KisDomUtils::toDouble(control1= Elt.attribute("x", "0.0")), - KisDomUtils::toDouble(control1= Elt.attribute("y", "0.0"))), - QPointF(KisDomUtils::toDouble(control2= Elt.attribute("x", "0.0")), - KisDomUtils::toDouble(control2= Elt.attribute("y", "0.0"))), - KisPaintInformation::fromXML(eWp.first= ChildElement("Point2"))); - } else { - dbgImage << "Unsupported <" << eWp.tagName() << " /> e= lement"; - } - } - nWp =3D nWp.nextSibling(); - } - } else { - dbgImage << "Warning: no found"; - } - - QDomElement initDistInfoElt =3D elt.firstChildElement("StartDistInfo"); - if (!initDistInfoElt.isNull()) { - rplpa->setInitDistInfo(KisDistanceInitInfo::fromXML(initDistInfoEl= t)); - } else { - dbgImage << "Warning: no found"; - } - - return rplpa; -} - - diff --git a/libs/image/recorder/kis_recorded_path_paint_action.h b/libs/im= age/recorder/kis_recorded_path_paint_action.h deleted file mode 100644 index 607eb47ccca..00000000000 --- a/libs/image/recorder/kis_recorded_path_paint_action.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_PATH_PAINT_ACTIONS_H_ -#define _KIS_RECORDED_PATH_PAINT_ACTIONS_H_ - -#include "recorder/kis_recorded_action.h" -#include "recorder/kis_recorded_paint_action.h" -#include "kis_types.h" - -class KisPaintInformation; -class KisPainter; -class KisDistanceInitInfo; - -#include - -/** - * This class will record the painting of a bezier curve. - */ -class KRITAIMAGE_EXPORT KisRecordedPathPaintAction : public KisRecordedPai= ntAction -{ - -public: - - /** - * @param startDist - Provides initial information related to distance= and spacing, which can - * have an effect on how the path is painted. - */ - KisRecordedPathPaintAction(const KisNodeQueryPath& path, - const KisPaintOpPresetSP paintOpPreset, - const KisDistanceInitInfo& startDistInfo); - - KisRecordedPathPaintAction(const KisRecordedPathPaintAction&); - - ~KisRecordedPathPaintAction() override; - - KisDistanceInitInfo getInitDistInfo() const; - - void setInitDistInfo(const KisDistanceInitInfo &startDistInfo); - - void addPoint(const KisPaintInformation& info); - void addLine(const KisPaintInformation& point1, const KisPaintInformat= ion& point2); - void addPolyLine(const QList& points); - void addCurve(const KisPaintInformation& point1, - const QPointF& control1, - const QPointF& control2, - const KisPaintInformation& point2); - - void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveC= ontext* ) const override; - - KisRecordedAction* clone() const override; - -protected: - - void playPaint(const KisPlayInfo& info, KisPainter* painter) const ove= rride; - -private: - - struct Private; - Private* const d; -}; - - -class KisRecordedPathPaintActionFactory : public KisRecordedPaintActionFac= tory -{ -public: - KisRecordedPathPaintActionFactory(); - ~KisRecordedPathPaintActionFactory() override; - KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedAc= tionLoadContext*) override; -}; - -#endif diff --git a/libs/image/recorder/kis_recorded_shape_paint_action.cpp b/libs= /image/recorder/kis_recorded_shape_paint_action.cpp deleted file mode 100644 index ea48b426d88..00000000000 --- a/libs/image/recorder/kis_recorded_shape_paint_action.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include //MSVC requires that V= c come first - -#include "recorder/kis_recorded_shape_paint_action.h" - -#include -#include - -#include -#include -#include -#include "kis_node.h" -#include "kis_mask_generator.h" -#include "kis_painter.h" -#include -#include "kis_paintop_registry.h" -#include "recorder/kis_recorded_action_factory_registry.h" -#include "kis_transaction.h" -#include "kis_undo_adapter.h" -#include -#include -#include "kis_paint_device.h" -#include "kis_image.h" -#include "kis_layer.h" -#include "kis_node_query_path.h" -#include - -struct Q_DECL_HIDDEN KisRecordedShapePaintAction::Private { - Shape shape; - QRectF rectangle; -}; - -QString selectName(KisRecordedShapePaintAction::Shape s) -{ - switch(s) - { - case KisRecordedShapePaintAction::Ellipse: - return i18n("Ellipse"); - case KisRecordedShapePaintAction::Rectangle: - return i18n("Rectangle"); - } - return QString(); -} - -KisRecordedShapePaintAction::KisRecordedShapePaintAction( - const KisNodeQueryPath& path, - const KisPaintOpPresetSP preset, - Shape shape, - const QRectF& rect) - : KisRecordedPaintAction("ShapePaintAction", selectName(shape), pa= th, preset) - , d(new Private) -{ - d->shape =3D shape; - d->rectangle =3D rect; -} - -KisRecordedShapePaintAction::KisRecordedShapePaintAction(const KisRecorded= ShapePaintAction& rhs) : KisRecordedPaintAction(rhs), d(new Private(*rhs.d)) -{ - -} - -KisRecordedShapePaintAction::~KisRecordedShapePaintAction() -{ - delete d; -} - -void KisRecordedShapePaintAction::playPaint(const KisPlayInfo&, KisPainter= * painter) const -{ - switch(d->shape) - { - case Ellipse: - painter->paintEllipse(d->rectangle); - break; - case Rectangle: - painter->paintRect(d->rectangle); - break; - } -} - -void KisRecordedShapePaintAction::toXML(QDomDocument& doc, QDomElement& el= t, KisRecordedActionSaveContext* context) const -{ - KisRecordedPaintAction::toXML(doc, elt, context); - QDomElement rectangleElt =3D doc.createElement("Rectangle"); - rectangleElt.setAttribute("x", KisDomUtils::toString(d->rectangle.x())= ); - rectangleElt.setAttribute("y", KisDomUtils::toString(d->rectangle.y())= ); - rectangleElt.setAttribute("width", KisDomUtils::toString(d->rectangle.= width())); - rectangleElt.setAttribute("height", KisDomUtils::toString(d->rectangle= .height())); - elt.appendChild(rectangleElt); - switch(d->shape) - { - case Ellipse: - elt.setAttribute("shape", "Ellipse"); - break; - case Rectangle: - elt.setAttribute("shape", "Rectangle"); - break; - } -} - -KisRecordedAction* KisRecordedShapePaintAction::clone() const -{ - return new KisRecordedShapePaintAction(*this); -} - - -KisRecordedShapePaintActionFactory::KisRecordedShapePaintActionFactory() : - KisRecordedPaintActionFactory("ShapePaintAction") -{ -} - -KisRecordedShapePaintActionFactory::~KisRecordedShapePaintActionFactory() -{ - -} - -KisRecordedAction* KisRecordedShapePaintActionFactory::fromXML(const QDomE= lement& elt, const KisRecordedActionLoadContext* context) -{ - KisNodeQueryPath pathnode =3D nodeQueryPathFromXML(elt); - - // Decode pressets - KisPaintOpPresetSP paintOpPreset =3D paintOpPresetFromXML(elt); - - QDomElement ellipseElt =3D elt.firstChildElement("Rectangle"); - qreal x, y, width, height; - if (!ellipseElt.isNull()) { - x =3D KisDomUtils::toDouble(ellipseElt.attribute("x", "0.0")); - y =3D KisDomUtils::toDouble(ellipseElt.attribute("y", "0.0")); - width =3D KisDomUtils::toDouble(ellipseElt.attribute("width", "0.0= ")); - height =3D KisDomUtils::toDouble(ellipseElt.attribute("height", "0= .0")); - } - else { - x =3D 0; - y =3D 0; - width =3D 0; - height =3D 0; - dbgImage << "Warning: no found"; - } - - KisRecordedShapePaintAction::Shape shape =3D KisRecordedShapePaintActi= on::Ellipse; - QString shapeStr =3D elt.attribute("shape", "Ellipse"); - if (shapeStr =3D=3D "Ellipse") - { - shape =3D KisRecordedShapePaintAction::Ellipse; - } else { // shapeStr =3D=3D "Rectangle" - shape =3D KisRecordedShapePaintAction::Rectangle; - } - - KisRecordedShapePaintAction* rplpa =3D new KisRecordedShapePaintAction= (pathnode, paintOpPreset, shape, QRectF(x, y, width, height)); - - setupPaintAction(rplpa, elt, context); - return rplpa; -} diff --git a/libs/image/recorder/kis_recorded_shape_paint_action.h b/libs/i= mage/recorder/kis_recorded_shape_paint_action.h deleted file mode 100644 index cc190ed8d02..00000000000 --- a/libs/image/recorder/kis_recorded_shape_paint_action.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_ELLIPSE_PAINT_ACTION_H_ -#define _KIS_RECORDED_ELLIPSE_PAINT_ACTION_H_ - -#include "recorder/kis_recorded_action.h" -#include "recorder/kis_recorded_paint_action.h" -#include "kis_types.h" - -#include - -/** - * This class will record the painting of a bezier curve. - */ -class KRITAIMAGE_EXPORT KisRecordedShapePaintAction : public KisRecordedPa= intAction -{ -public: - enum Shape { - Ellipse, - Rectangle - }; -public: - - KisRecordedShapePaintAction(const KisNodeQueryPath& path, - const KisPaintOpPresetSP paintOpPres= et, - Shape shape, - const QRectF& rect); - - KisRecordedShapePaintAction(const KisRecordedShapePaintAction&); - - ~KisRecordedShapePaintAction() override; - - void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveC= ontext* ) const override; - - KisRecordedAction* clone() const override; - -protected: - - void playPaint(const KisPlayInfo& info, KisPainter* painter) const ove= rride; - -private: - - struct Private; - Private* const d; -}; - - -class KisRecordedShapePaintActionFactory : public KisRecordedPaintActionFa= ctory -{ -public: - KisRecordedShapePaintActionFactory(); - ~KisRecordedShapePaintActionFactory() override; - KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedAc= tionLoadContext*) override; -}; - -#endif diff --git a/libs/image/tests/CMakeLists.txt b/libs/image/tests/CMakeLists.= txt index 979f93f1dd4..aff2df122c9 100644 --- a/libs/image/tests/CMakeLists.txt +++ b/libs/image/tests/CMakeLists.txt @@ -85,7 +85,6 @@ ecm_add_tests( kis_simple_stroke_strategy_test.cpp kis_stroke_strategy_undo_command_based_test.cpp kis_strokes_queue_test.cpp - kis_macro_test.cpp kis_mask_test.cpp kis_math_toolbox_test.cpp kis_name_server_test.cpp @@ -96,9 +95,6 @@ ecm_add_tests( kis_distance_information_test.cpp kis_paintop_test.cpp kis_pattern_test.cpp - kis_recorded_action_factory_registry_test.cpp - kis_recorded_action_test.cpp - kis_recorded_filter_action_test.cpp kis_selection_mask_test.cpp kis_shared_ptr_test.cpp kis_bsplines_test.cpp @@ -110,8 +106,8 @@ ecm_add_tests( kis_filter_config_widget_test.cpp kis_mask_generator_test.cpp kis_cubic_curve_test.cpp - kis_node_query_path_test.cpp kis_fixed_point_maths_test.cpp + kis_node_query_path_test.cpp kis_filter_weights_buffer_test.cpp kis_filter_weights_applicator_test.cpp kis_fill_interval_test.cpp diff --git a/libs/image/tests/kis_macro_test.cpp b/libs/image/tests/kis_mac= ro_test.cpp deleted file mode 100644 index b921304a096..00000000000 --- a/libs/image/tests/kis_macro_test.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org - * - * 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-13= 01, USA. - */ - -#include "kis_macro_test.h" - -#include -#include "recorder/kis_macro.h" -#include -#include -#include "kis_image.h" - -#include "recorder/kis_recorded_action.h" -#include - -class TestAction : public KisRecordedAction -{ -public: - - TestAction(const QString & id, const QString & name) - : KisRecordedAction(id, name) { - } - - void play(const KisPlayInfo&, KoUpdater*) const override { - } - - KisRecordedAction* clone() const override { - return new TestAction(id(), name()); - } - -}; - - -void KisMacroTest::testCreation() -{ - QList actions; - TestAction tc("bla", "bla"); - actions << &tc; - - const KoColorSpace * cs =3D KoColorSpaceRegistry::instance()->rgb8(); - KisImageSP image =3D new KisImage(0, 512, 512, cs, "test"); - - KisMacro a; - KisMacro b(actions); -} - - -QTEST_MAIN(KisMacroTest) diff --git a/libs/image/tests/kis_macro_test.h b/libs/image/tests/kis_macro= _test.h deleted file mode 100644 index 8c8099195d1..00000000000 --- a/libs/image/tests/kis_macro_test.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org - * - * 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-13= 01, USA. - */ - -#ifndef KIS_MACRO_TEST_H -#define KIS_MACRO_TEST_H - -#include - -class KisMacroTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - - void testCreation(); - -}; - -#endif diff --git a/libs/image/tests/kis_node_query_path_test.cpp b/libs/image/tes= ts/kis_node_query_path_test.cpp index 6a77305b283..a694526048f 100644 --- a/libs/image/tests/kis_node_query_path_test.cpp +++ b/libs/image/tests/kis_node_query_path_test.cpp @@ -20,7 +20,7 @@ = #include = -#include "recorder/kis_node_query_path.h" +#include "kis_node_query_path.h" #include #include #include diff --git a/libs/image/tests/kis_recorded_action_factory_registry_test.cpp= b/libs/image/tests/kis_recorded_action_factory_registry_test.cpp deleted file mode 100644 index b6192ef6e28..00000000000 --- a/libs/image/tests/kis_recorded_action_factory_registry_test.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_factory_registry_test.h" - -#include -#include "recorder/kis_recorded_action_factory_registry.h" - -void KisRecordedActionFactoryRegistryTest::testCreation() -{ - KisRecordedActionFactoryRegistry test; -} - - -QTEST_MAIN(KisRecordedActionFactoryRegistryTest) diff --git a/libs/image/tests/kis_recorded_action_factory_registry_test.h b= /libs/image/tests/kis_recorded_action_factory_registry_test.h deleted file mode 100644 index 1f76a932127..00000000000 --- a/libs/image/tests/kis_recorded_action_factory_registry_test.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org - * - * 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-13= 01, USA. - */ - -#ifndef KIS_RECORDED_ACTION_FACTORY_REGISTRY_TEST_H -#define KIS_RECORDED_ACTION_FACTORY_REGISTRY_TEST_H - -#include - -class KisRecordedActionFactoryRegistryTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - - void testCreation(); - -}; - -#endif diff --git a/libs/image/tests/kis_recorded_action_test.cpp b/libs/image/tes= ts/kis_recorded_action_test.cpp deleted file mode 100644 index 5481427f562..00000000000 --- a/libs/image/tests/kis_recorded_action_test.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_test.h" - -#include -#include -#include "recorder/kis_recorded_action.h" -#include - -class TestAction : public KisRecordedAction -{ -public: - - TestAction(const QString & id, const QString & name) - : KisRecordedAction(id, name) { - } - - void play(const KisPlayInfo&, KoUpdater*) const override { - } - - KisRecordedAction* clone() const override { - return new TestAction(id(), name()); - } - -}; - - -void KisRecordedActionTest::testCreation() -{ - TestAction tc("bla", "bla"); -} - - -QTEST_MAIN(KisRecordedActionTest) diff --git a/libs/image/tests/kis_recorded_action_test.h b/libs/image/tests= /kis_recorded_action_test.h deleted file mode 100644 index cc20fa40f47..00000000000 --- a/libs/image/tests/kis_recorded_action_test.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org - * - * 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-13= 01, USA. - */ - -#ifndef KIS_RECORDED_ACTION_TEST_H -#define KIS_RECORDED_ACTION_TEST_H - -#include - -class KisRecordedActionTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - - void testCreation(); - -}; - -#endif diff --git a/libs/image/tests/kis_recorded_filter_action_test.cpp b/libs/im= age/tests/kis_recorded_filter_action_test.cpp deleted file mode 100644 index 94677fcb8b7..00000000000 --- a/libs/image/tests/kis_recorded_filter_action_test.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_filter_action_test.h" - -#include -#include "recorder/kis_recorded_filter_action.h" -#include -#include -#include "kis_paint_layer.h" -#include "filter/kis_filter.h" -#include "filter/kis_filter_configuration.h" -#include "filter/kis_filter_registry.h" -#include "kis_image.h" -#include "kis_paint_device.h" -#include - -void KisRecordedFilterActionTest::testCreation() -{ - const KoColorSpace * cs =3D KoColorSpaceRegistry::instance()->rgb8(); - KisFilterSP f =3D KisFilterRegistry::instance()->value("invert"); - KisFilterConfigurationSP kfc =3D f->defaultConfiguration(); - KisImageSP image =3D new KisImage(0, 10, 10, cs, "merge test"); - KisPaintLayerSP layer =3D new KisPaintLayer(image, "test", OPACITY_OPA= QUE_U8); - - KisRecordedFilterAction test("invert", KisNodeQueryPath::absolutePath(= layer), f, kfc); -} - - -QTEST_MAIN(KisRecordedFilterActionTest) diff --git a/libs/image/tests/kis_recorded_filter_action_test.h b/libs/imag= e/tests/kis_recorded_filter_action_test.h deleted file mode 100644 index f517964e674..00000000000 --- a/libs/image/tests/kis_recorded_filter_action_test.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org - * - * 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-13= 01, USA. - */ - -#ifndef KIS_RECORDED_FILTER_ACTION_TEST_H -#define KIS_RECORDED_FILTER_ACTION_TEST_H - -#include - -class KisRecordedFilterActionTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - - void testCreation(); - -}; - -#endif diff --git a/libs/koplugin/KisMimeDatabase.cpp b/libs/koplugin/KisMimeDatab= ase.cpp index 6fcf7f874fc..10fb99289c6 100644 --- a/libs/koplugin/KisMimeDatabase.cpp +++ b/libs/koplugin/KisMimeDatabase.cpp @@ -227,11 +227,6 @@ void KisMimeDatabase::fillMimeData() mimeType.suffixes =3D QStringList() << "ocio"; s_mimeDatabase << mimeType; = - mimeType.mimeType =3D "application/x-krita-recorded-macro"; - mimeType.description =3D i18nc("description of a file type", "Krit= a Recorded Action"); - mimeType.suffixes =3D QStringList() << "krarec"; - s_mimeDatabase << mimeType; - mimeType.mimeType =3D "application/x-gimp-gradient"; mimeType.description =3D i18nc("description of a file type", "GIMP= Gradients"); mimeType.suffixes =3D QStringList() << "ggr"; diff --git a/libs/pigment/KoColorSpaceRegistry.h b/libs/pigment/KoColorSpac= eRegistry.h index 89abd8c935e..8db1fe20540 100644 --- a/libs/pigment/KoColorSpaceRegistry.h +++ b/libs/pigment/KoColorSpaceRegistry.h @@ -330,7 +330,6 @@ private: friend class KisCrashFilterTest; friend class KoColorSpacesBenchmark; friend class TestKoColorSpaceSanity; - friend class KisActionRecorderTest; friend class TestColorConversionSystem; friend class FriendOfColorSpaceRegistry; = diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt index 38b6e288e80..fe7af228024 100644 --- a/libs/ui/CMakeLists.txt +++ b/libs/ui/CMakeLists.txt @@ -165,15 +165,6 @@ set(kritaui_LIB_SRCS opengl/kis_texture_tile_info_pool.cpp opengl/KisOpenGLUpdateInfoBuilder.cpp kis_fps_decoration.cpp - recorder/kis_node_query_path_editor.cc - recorder/kis_recorded_action_creator.cc - recorder/kis_recorded_action_creator_factory.cc - recorder/kis_recorded_action_creator_factory_registry.cc - recorder/kis_recorded_action_editor_factory.cc - recorder/kis_recorded_action_editor_factory_registry.cc - recorder/kis_recorded_filter_action_editor.cc - recorder/kis_recorded_filter_action_creator.cpp - recorder/kis_recorded_paint_action_editor.cc tool/kis_selection_tool_helper.cpp tool/kis_selection_tool_config_widget_helper.cpp tool/kis_rectangle_constraint_widget.cpp @@ -187,7 +178,6 @@ set(kritaui_LIB_SRCS tool/kis_tool_freehand_helper.cpp tool/kis_tool_multihand_helper.cpp tool/kis_figure_painting_tool_helper.cpp - tool/kis_recording_adapter.cpp tool/kis_tool_paint.cc tool/kis_tool_shape.cc tool/kis_tool_ellipse_base.cpp @@ -491,7 +481,6 @@ ki18n_wrap_ui(kritaui_LIB_SRCS forms/wdgdlgfilelayer.ui forms/wdgfilterselector.ui forms/wdgfilternodecreation.ui - forms/wdgpaintactioneditor.ui forms/wdgmultipliersdoublesliderspinbox.ui forms/wdgnodequerypatheditor.ui forms/wdgpresetselectorstrip.ui diff --git a/libs/ui/forms/wdgpaintactioneditor.ui b/libs/ui/forms/wdgpaint= actioneditor.ui deleted file mode 100644 index deac79f578e..00000000000 --- a/libs/ui/forms/wdgpaintactioneditor.ui +++ /dev/null @@ -1,207 +0,0 @@ - - - WdgPaintActionEditor - - - - 0 - 0 - 405 - 376 - - - - - - - - - - 0 - - - - Options - - - - - - Paint color: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Background color: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Vertical - - - - 236 - 147 - - - - - - - - Opacity: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - 0 - - - 100 - - - true - - - - - - - - 0 - 0 - - - - ... - - - - - - - - 0 - 0 - - - - ... - - - - - - - - Current preset - - - - - - Paint op: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - - - 0 - 4 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - Preset Collection - - - - - - - 4 - 4 - - - - - - - - - - - - - KisColorButton - QPushButton -
kis_color_button.h
-
- - KisIntParseSpinBox - QSpinBox -
kis_int_parse_spin_box.h
-
- - KisPresetChooser - QWidget -
widgets/kis_preset_chooser.h
- 1 -
- - KisNodeQueryPathEditor - QWidget -
recorder/kis_node_query_path_editor.h
- 1 -
-
- - -
diff --git a/libs/ui/kis_selection_manager.cc b/libs/ui/kis_selection_manag= er.cc index 1f04c273763..22ad36152c7 100644 --- a/libs/ui/kis_selection_manager.cc +++ b/libs/ui/kis_selection_manager.cc @@ -91,7 +91,6 @@ #include "kis_action_manager.h" #include "operations/kis_operation_configuration.h" //new -#include "kis_recorded_path_paint_action.h" #include "kis_node_query_path.h" #include "kis_tool_shape.h" = diff --git a/libs/ui/recorder/kis_node_query_path_editor.cc b/libs/ui/recor= der/kis_node_query_path_editor.cc deleted file mode 100644 index 36db465c7a6..00000000000 --- a/libs/ui/recorder/kis_node_query_path_editor.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_node_query_path_editor.h" - -#include "ui_wdgnodequerypatheditor.h" -#include -#include -#include - -struct KisNodeQueryPathEditor::Private -{ - Ui_WdgNodeQueryPathEditor form; -}; - -KisNodeQueryPathEditor::KisNodeQueryPathEditor(QWidget* parent) : QWidget(= parent), d(new Private) -{ - d->form.setupUi(this); - = - connect(d->form.radioButtonCurrentLayer, SIGNAL(clicked(bool)), SLOT(c= urrentLayerEnabled(bool))); - connect(d->form.radioButtonCustomPath, SIGNAL(clicked(bool)), SLOT(cus= tomPathEnabled(bool))); - = - d->form.kpushbutton->setIcon(KisIconUtils::loadIcon("system-help")); - connect(d->form.kpushbutton, SIGNAL(clicked()), this, SLOT(slotPopupQu= ickHelp())); - currentLayerEnabled(true); - - connect(d->form.klineeditPath, SIGNAL(textChanged(QString)), SIGNAL(no= deQueryPathChanged())); -} - -KisNodeQueryPathEditor::~KisNodeQueryPathEditor() -{ - delete d; -} - -void KisNodeQueryPathEditor::setNodeQueryPath(const KisNodeQueryPath& path) -{ - if(path.toString() =3D=3D ".") - { - d->form.radioButtonCurrentLayer->setChecked(true); - currentLayerEnabled(true); - } else { - d->form.radioButtonCustomPath->setChecked(true); - customPathEnabled(true); - d->form.klineeditPath->setText(path.toString()); - } -} - -KisNodeQueryPath KisNodeQueryPathEditor::nodeQueryPath() const -{ - return KisNodeQueryPath::fromString(d->form.klineeditPath->text()); -} - -void KisNodeQueryPathEditor::currentLayerEnabled(bool v) -{ - if(!v) return; - d->form.klineeditPath->setEnabled(false); - d->form.kpushbutton->setEnabled(false); - d->form.klineeditPath->setText("."); -} - -void KisNodeQueryPathEditor::customPathEnabled(bool v) -{ - if(!v) return; - d->form.klineeditPath->setEnabled(true); - d->form.kpushbutton->setEnabled(true); -} - -void KisNodeQueryPathEditor::slotPopupQuickHelp() -{ - QWhatsThis::showText(QCursor::pos(), i18n( - "/ represents the root of the image, or a separator
\= n" - "a number represents a layer
\n" - ". represents the current layer
\n" - ".. represents the parent layer
\n\n" - "Examples:
\n" - "/0 represents the bottom layer of the image
\n" - "../1 represents the second layer from the bottom of the = parent of the current layer
\n" - "./0 represents the first child of the current layer" ) ); -} - diff --git a/libs/ui/recorder/kis_node_query_path_editor.h b/libs/ui/record= er/kis_node_query_path_editor.h deleted file mode 100644 index cfea6ea7b54..00000000000 --- a/libs/ui/recorder/kis_node_query_path_editor.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_NODE_QUERY_PATH_EDITOR_H_ -#define _KIS_NODE_QUERY_PATH_EDITOR_H_ - -#include - -class KisNodeQueryPath; -/** - * This class is used to edit @ref KisNodeQueryPath - */ -class KisNodeQueryPathEditor : public QWidget -{ - Q_OBJECT -public: - KisNodeQueryPathEditor(QWidget* parent); - ~KisNodeQueryPathEditor() override; - void setNodeQueryPath(const KisNodeQueryPath& path); - /** - * Generate a node query path based on the state of the widgets - */ - KisNodeQueryPath nodeQueryPath() const; -Q_SIGNALS: - void nodeQueryPathChanged(); -private Q_SLOTS: - void currentLayerEnabled(bool v); - void customPathEnabled(bool v); - void slotPopupQuickHelp(); -private: - struct Private; - Private* const d; -}; - -#endif diff --git a/libs/ui/recorder/kis_recorded_action_creator.cc b/libs/ui/reco= rder/kis_recorded_action_creator.cc deleted file mode 100644 index 20157d4fbcf..00000000000 --- a/libs/ui/recorder/kis_recorded_action_creator.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_creator.h" - -KisRecordedActionCreator::KisRecordedActionCreator(QWidget* parent, Qt::Wi= ndowFlags f) - : QWidget(parent, f) - , d(0) -{ -} - -KisRecordedActionCreator::~KisRecordedActionCreator() -{ - // delete d; -} - diff --git a/libs/ui/recorder/kis_recorded_action_creator.h b/libs/ui/recor= der/kis_recorded_action_creator.h deleted file mode 100644 index bf3677f2e8a..00000000000 --- a/libs/ui/recorder/kis_recorded_action_creator.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2011 Cyrille Berger - * - * 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-13= 01, USA. - */ -#ifndef KIS_RECORDED_ACTION_CREATOR -#define KIS_RECORDED_ACTION_CREATOR -#include - -class KisRecordedAction; - -class KisRecordedActionCreator : public QWidget { -public: - explicit KisRecordedActionCreator(QWidget* parent =3D 0, Qt::WindowFla= gs f =3D 0); - ~KisRecordedActionCreator() override; - /** - * This function is called when the dialog is closed and the action ha= s to be created - * from the parameters in the widget. - */ - virtual KisRecordedAction* createAction() const =3D 0; -private: - struct Private; - Private * const d; -}; - - -#endif diff --git a/libs/ui/recorder/kis_recorded_action_creator_factory.cc b/libs= /ui/recorder/kis_recorded_action_creator_factory.cc deleted file mode 100644 index afd9f8f9662..00000000000 --- a/libs/ui/recorder/kis_recorded_action_creator_factory.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2009,2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_creator_factory.h" - -#include - -struct KisRecordedActionCreatorFactory::Private { - QString id; - QString name; -}; - -KisRecordedActionCreatorFactory::KisRecordedActionCreatorFactory(const QSt= ring& _id, const QString& _name) : d(new Private) -{ - d->id =3D _id; - d->name =3D _name; -} - -KisRecordedActionCreatorFactory::~KisRecordedActionCreatorFactory() -{ - delete d; -} - -QString KisRecordedActionCreatorFactory::id() const -{ - return d->id; -} - -QString KisRecordedActionCreatorFactory::name() const -{ - return d->name; -} - -KisRecordedActionCreator* KisRecordedActionCreatorFactory::createCreator(Q= Widget* /*parent*/) const -{ - Q_ASSERT(requireCreator() =3D=3D false); - return 0; -} - -KisRecordedAction* KisRecordedActionCreatorFactory::createAction() const -{ - Q_ASSERT(requireCreator() =3D=3D true); - return 0; -} diff --git a/libs/ui/recorder/kis_recorded_action_creator_factory.h b/libs/= ui/recorder/kis_recorded_action_creator_factory.h deleted file mode 100644 index cd2d17c6832..00000000000 --- a/libs/ui/recorder/kis_recorded_action_creator_factory.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2009,2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_ACTION_CREATOR_FACTORY_H_ -#define _KIS_RECORDED_ACTION_CREATOR_FACTORY_H_ - -#include - -class KisRecordedAction; -class KisRecordedActionCreator; -class QString; -class QWidget; - -/** - * This class allows to create widgets that are used to create new actions. - */ -class KRITAUI_EXPORT KisRecordedActionCreatorFactory -{ -public: - KisRecordedActionCreatorFactory(const QString& _id, const QString& _na= me); - virtual ~KisRecordedActionCreatorFactory(); - QString id() const; - QString name() const; - /** - * @return true if the creation of this action require the use of a cr= eator widget - */ - virtual bool requireCreator() const =3D 0; - /** - * Create an creator for the action. - */ - virtual KisRecordedActionCreator* createCreator(QWidget* parent) const; - /** - * Create an action. If the action require a creator, it should return= 0. - */ - virtual KisRecordedAction* createAction() const; -private: - struct Private; - Private* const d; -}; - -#endif diff --git a/libs/ui/recorder/kis_recorded_action_creator_factory_registry.= cc b/libs/ui/recorder/kis_recorded_action_creator_factory_registry.cc deleted file mode 100644 index ab0e0f87620..00000000000 --- a/libs/ui/recorder/kis_recorded_action_creator_factory_registry.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2009,2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_creator_factory_registry.h" - -#include - -#include -#include -#include -#include - -#include -#include "kis_recorded_action_creator_factory.h" -#include "kis_recorded_filter_action_creator.h" - -Q_GLOBAL_STATIC(KisRecordedActionCreatorFactoryRegistry, s_instance) - -struct KisRecordedActionCreatorFactoryRegistry::Private { - KoGenericRegistry factories; -}; - -KisRecordedActionCreatorFactoryRegistry::KisRecordedActionCreatorFactoryRe= gistry() - : d(new Private) -{ - add(new KisRecordedFilterActionCreatorFactory); -} - -KisRecordedActionCreatorFactoryRegistry::~KisRecordedActionCreatorFactoryR= egistry() -{ - delete d; -} - -KisRecordedActionCreatorFactoryRegistry* KisRecordedActionCreatorFactoryRe= gistry::instance() -{ - return s_instance; -} - -void KisRecordedActionCreatorFactoryRegistry::add(KisRecordedActionCreator= Factory* factory) -{ - d->factories.add(factory); -} - -KisRecordedActionCreatorFactory* KisRecordedActionCreatorFactoryRegistry::= get(const QString& _id) const -{ - return d->factories.get(_id); -} - -QList KisRecordedActionCreatorFactoryRegistry::creators() const -{ - QList cs; - Q_FOREACH (const QString &id, d->factories.keys()) - { - cs.push_back(KoID(id, d->factories.get(id)->name())); - } - return cs; -} diff --git a/libs/ui/recorder/kis_recorded_action_creator_factory_registry.= h b/libs/ui/recorder/kis_recorded_action_creator_factory_registry.h deleted file mode 100644 index 5e1e4c48b2f..00000000000 --- a/libs/ui/recorder/kis_recorded_action_creator_factory_registry.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2009,2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_ACTION_CREATOR_FACTORY_REGISTRY_H_ -#define _KIS_RECORDED_ACTION_CREATOR_FACTORY_REGISTRY_H_ - -#include -#include - -class KisRecordedActionCreatorFactory; - -/** - * This class allow to create a creator for a specific recorded action. - * - */ -class KRITAUI_EXPORT KisRecordedActionCreatorFactoryRegistry -{ -public: - KisRecordedActionCreatorFactoryRegistry(); - ~KisRecordedActionCreatorFactoryRegistry(); - static KisRecordedActionCreatorFactoryRegistry* instance(); - /** - * Add a factory of action creator. - */ - void add(KisRecordedActionCreatorFactory* factory); - /** - * @return an creator for the given action, or a null pointer if there= is - * no factory for that action. - */ - KisRecordedActionCreatorFactory* get(const QString& _id) const; - /** - * @return the list of creators - */ - QList creators() const; -private: - struct Private; - Private* const d; -}; - -#endif diff --git a/libs/ui/recorder/kis_recorded_action_editor_factory.cc b/libs/= ui/recorder/kis_recorded_action_editor_factory.cc deleted file mode 100644 index dc46c9a7357..00000000000 --- a/libs/ui/recorder/kis_recorded_action_editor_factory.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2009 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_editor_factory.h" - -struct KisRecordedActionEditorFactory::Private { - -}; - -KisRecordedActionEditorFactory::KisRecordedActionEditorFactory() : d(new P= rivate) -{ -} - -KisRecordedActionEditorFactory::~KisRecordedActionEditorFactory() -{ - delete d; -} diff --git a/libs/ui/recorder/kis_recorded_action_editor_factory.h b/libs/u= i/recorder/kis_recorded_action_editor_factory.h deleted file mode 100644 index 1c906569a62..00000000000 --- a/libs/ui/recorder/kis_recorded_action_editor_factory.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2009 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_ACTION_EDITOR_FACTORY_H_ -#define _KIS_RECORDED_ACTION_EDITOR_FACTORY_H_ - -#include - -class QWidget; -class KisRecordedAction; - -/** - * This class allow to create widget that can edit a @ref KisRecordedAction - */ -class KRITAUI_EXPORT KisRecordedActionEditorFactory -{ -public: - KisRecordedActionEditorFactory(); - virtual ~KisRecordedActionEditorFactory(); - /** - * Create an editor for the action. - * The widget is expected to have a 'actionChanged' signal that is emi= tted - * when the editor has changed one of the parameter of the action. - */ - virtual QWidget* createEditor(QWidget* parent, KisRecordedAction* acti= on) const =3D 0; - /** - * @return true if this factory can create an editor for the given act= ion. - */ - virtual bool canEdit(const KisRecordedAction* action) const =3D 0; -private: - struct Private; - Private* const d; -}; - -#endif diff --git a/libs/ui/recorder/kis_recorded_action_editor_factory_registry.c= c b/libs/ui/recorder/kis_recorded_action_editor_factory_registry.cc deleted file mode 100644 index 14e6d2f4098..00000000000 --- a/libs/ui/recorder/kis_recorded_action_editor_factory_registry.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2009 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_editor_factory_registry.h" - -#include -#include -#include -#include - -#include -#include "kis_recorded_action_editor_factory.h" -#include "kis_recorded_filter_action_editor.h" -#include "kis_recorded_paint_action_editor.h" - -Q_GLOBAL_STATIC(KisRecordedActionEditorFactoryRegistry, s_instance) - -struct KisRecordedActionEditorFactoryRegistry::Private { - QList< KisRecordedActionEditorFactory* > factories; -}; - -KisRecordedActionEditorFactoryRegistry::KisRecordedActionEditorFactoryRegi= stry() - : d(new Private) -{ - add(new KisRecordedFilterActionEditorFactory); - add(new KisRecordedPaintActionEditorFactory); -} - -KisRecordedActionEditorFactoryRegistry::~KisRecordedActionEditorFactoryReg= istry() -{ - dbgRegistry << "Deleting KisRecordedActionEditorFactoryRegistry"; - qDeleteAll(d->factories); - delete d; -} - -KisRecordedActionEditorFactoryRegistry* KisRecordedActionEditorFactoryRegi= stry::instance() -{ - return s_instance; -} - -void KisRecordedActionEditorFactoryRegistry::add(KisRecordedActionEditorFa= ctory* factory) -{ - if (d->factories.contains(factory)) return; - d->factories.push_front(factory); -} - -QWidget* KisRecordedActionEditorFactoryRegistry::createEditor(QWidget* par= ent, KisRecordedAction* action) const -{ - Q_FOREACH (KisRecordedActionEditorFactory* factory, d->factories) { - if (factory->canEdit(action)) { - QWidget* editor =3D factory->createEditor(parent, action); - Q_ASSERT(editor); - Q_ASSERT(editor->metaObject()->indexOfSignal("actionEdited()")= !=3D -1); - return editor; - } - } - return 0; -} - -bool KisRecordedActionEditorFactoryRegistry::hasEditor(KisRecordedAction* = action) const -{ - Q_FOREACH (KisRecordedActionEditorFactory* factory, d->factories) { - if (factory->canEdit(action)) { - return true; - } - } - return false; -} diff --git a/libs/ui/recorder/kis_recorded_action_editor_factory_registry.h= b/libs/ui/recorder/kis_recorded_action_editor_factory_registry.h deleted file mode 100644 index a5279d1fdfc..00000000000 --- a/libs/ui/recorder/kis_recorded_action_editor_factory_registry.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2009 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_ACTION_EDITOR_FACTORY_REGISTRY_H_ -#define _KIS_RECORDED_ACTION_EDITOR_FACTORY_REGISTRY_H_ - -#include - -class QWidget; -class KisRecordedAction; -class KisRecordedActionEditorFactory; - -/** - * This class allow to create an editor for a specific recorded action. - * - * If two editors can edit the same type of action, then the editor that - * was added last is used in priority. - */ -class KRITAUI_EXPORT KisRecordedActionEditorFactoryRegistry -{ -public: - KisRecordedActionEditorFactoryRegistry(); - ~KisRecordedActionEditorFactoryRegistry(); - static KisRecordedActionEditorFactoryRegistry* instance(); - /** - * Add a factory of action editor. - */ - void add(KisRecordedActionEditorFactory* factory); - /** - * @return an editor for the given action, or a null pointer if there = is - * no factory for that action. - */ - QWidget* createEditor(QWidget* parent, KisRecordedAction* action) cons= t; - /** - * @return true if there is an editor for this action. - */ - bool hasEditor(KisRecordedAction* action) const; -private: - struct Private; - Private* const d; -}; - -#endif diff --git a/libs/ui/recorder/kis_recorded_filter_action_creator.cpp b/libs= /ui/recorder/kis_recorded_filter_action_creator.cpp deleted file mode 100644 index fcdf6d4ef59..00000000000 --- a/libs/ui/recorder/kis_recorded_filter_action_creator.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_filter_action_creator.h" - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -KisRecordedFilterActionCreator::KisRecordedFilterActionCreator(QWidget* pa= rent , Qt::WindowFlags f) - : KisRecordedActionCreator(parent, f) -{ - m_filterModel =3D new KisFiltersModel(true, 0); - m_filterTree =3D new QTreeView(this); - m_filterTree->setModel(m_filterModel); - m_filterTree->header()->setVisible(false); - QGridLayout* layout =3D new QGridLayout(); - setLayout(layout); - layout->addWidget(m_filterTree, 0, 0, 1, 1); -} - -KisRecordedFilterActionCreator::~KisRecordedFilterActionCreator() -{ - delete m_filterTree; - delete m_filterModel; -} - -KisRecordedAction* KisRecordedFilterActionCreator::createAction() const -{ - const KisFilter* filter =3D m_filterModel->indexToFilter(m_filterTree-= >currentIndex()); - if(!filter) return 0; - return new KisRecordedFilterAction(filter->name(), KisNodeQueryPath::f= romString(""), filter, filter->defaultConfiguration()); -} - - -KisRecordedFilterActionCreatorFactory::KisRecordedFilterActionCreatorFacto= ry() - : KisRecordedActionCreatorFactory("filter", i18nc("recorded filter act= ion", "Apply Filter")) -{ -} - -KisRecordedFilterActionCreatorFactory::~KisRecordedFilterActionCreatorFact= ory() -{ -} - -bool KisRecordedFilterActionCreatorFactory::requireCreator() const -{ - return true; -} - -KisRecordedActionCreator* KisRecordedFilterActionCreatorFactory::createCre= ator(QWidget* parent) const -{ - return new KisRecordedFilterActionCreator(parent); -} diff --git a/libs/ui/recorder/kis_recorded_filter_action_creator.h b/libs/u= i/recorder/kis_recorded_filter_action_creator.h deleted file mode 100644 index d329ea238c0..00000000000 --- a/libs/ui/recorder/kis_recorded_filter_action_creator.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_FILTER_ACTION_CREATOR_FACTORY_H_ -#define _KIS_RECORDED_FILTER_ACTION_CREATOR_FACTORY_H_ - -#include "kis_recorded_action_creator.h" -#include "kis_recorded_action_creator_factory.h" - -class KisFiltersModel; -class QTreeView; - -class KisRecordedFilterActionCreator : public KisRecordedActionCreator { -public: - explicit KisRecordedFilterActionCreator(QWidget* parent =3D 0, Qt::Win= dowFlags f =3D 0); - ~KisRecordedFilterActionCreator() override; - KisRecordedAction* createAction() const override; -private: - KisFiltersModel* m_filterModel; - QTreeView* m_filterTree; -}; - -/** - * This class allows to create widgets that are used to create new actions. - */ -class KisRecordedFilterActionCreatorFactory : public KisRecordedActionCrea= torFactory -{ -public: - KisRecordedFilterActionCreatorFactory(); - ~KisRecordedFilterActionCreatorFactory() override; - bool requireCreator() const override; - KisRecordedActionCreator* createCreator(QWidget* parent) const overrid= e; -}; - -#endif diff --git a/libs/ui/recorder/kis_recorded_filter_action_editor.cc b/libs/u= i/recorder/kis_recorded_filter_action_editor.cc deleted file mode 100644 index 82a39ae6799..00000000000 --- a/libs/ui/recorder/kis_recorded_filter_action_editor.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2009 Cyrille Berger - * - * 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-13= 01, USA. - */ - - -#include -#include "kis_recorded_filter_action_editor.h" -#include -#include -#include -#include -#include -#include -#include -#include "kis_node_query_path_editor.h" -#include -#include - -KisRecordedFilterActionEditor::KisRecordedFilterActionEditor(QWidget* pare= nt, KisRecordedAction* action) - : QWidget(parent) - , m_action(dynamic_cast(action)) - , m_gridLayout(new QGridLayout(this)) -{ - Q_ASSERT(m_action); - - // Create the node query path editor - m_nodeQueryPathEditor =3D new KisNodeQueryPathEditor(this); - m_nodeQueryPathEditor->setNodeQueryPath(m_action->nodeQueryPath()); - connect(m_nodeQueryPathEditor, SIGNAL(nodeQueryPathChanged()), SLOT(no= deQueryPathChanged())); - m_gridLayout->addWidget(m_nodeQueryPathEditor, 1, 0); - - // Create the filter editor - m_configWidget =3D m_action->filter()->createConfigurationWidget(this,= new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8())); - if (m_configWidget) { - m_gridLayout->addWidget(m_configWidget); - - // FIXME: pass the view object to the config widget - //m_configWidget->setView(view); - - m_configWidget->setConfiguration(m_action->filterConfiguration()); - connect(m_configWidget, SIGNAL(sigConfigurationItemChanged()), SLO= T(configurationUpdated())); - } else { - m_gridLayout->addWidget(new QLabel(i18n("No configuration option."= ), this)); - } -} - -KisRecordedFilterActionEditor::~KisRecordedFilterActionEditor() -{ -} - -void KisRecordedFilterActionEditor::configurationUpdated() -{ - KisFilterConfigurationSP config =3D dynamic_cast(m_configWidget->configuration().data()); - if (config) { - m_action->setFilterConfiguration(config); - emit(actionEdited()); - } -} - -void KisRecordedFilterActionEditor::nodeQueryPathChanged() -{ - m_action->setNodeQueryPath(m_nodeQueryPathEditor->nodeQueryPath()); - emit(actionEdited()); -} - -KisRecordedFilterActionEditorFactory::KisRecordedFilterActionEditorFactory= () -{ -} - -KisRecordedFilterActionEditorFactory::~KisRecordedFilterActionEditorFactor= y() -{ -} - -QWidget* KisRecordedFilterActionEditorFactory::createEditor(QWidget* paren= t, KisRecordedAction* action) const -{ - return new KisRecordedFilterActionEditor(parent, action); -} - -bool KisRecordedFilterActionEditorFactory::canEdit(const KisRecordedAction= * action) const -{ - return action->id() =3D=3D "FilterAction"; -} - diff --git a/libs/ui/recorder/kis_recorded_filter_action_editor.h b/libs/ui= /recorder/kis_recorded_filter_action_editor.h deleted file mode 100644 index 3f034bacae6..00000000000 --- a/libs/ui/recorder/kis_recorded_filter_action_editor.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2009 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_FILTER_ACTION_EDITOR_H_ -#define _KIS_RECORDED_FILTER_ACTION_EDITOR_H_ - -#include -#include "kis_recorded_action_editor_factory.h" - -class KisNodeQueryPathEditor; -class KisRecordedFilterAction; -class QGridLayout; -class KisConfigWidget; - -class KisRecordedFilterActionEditor : public QWidget -{ - Q_OBJECT -public: - KisRecordedFilterActionEditor(QWidget* parent, KisRecordedAction* acti= on); - ~KisRecordedFilterActionEditor() override; -private Q_SLOTS: - void configurationUpdated(); - void nodeQueryPathChanged(); -Q_SIGNALS: - void actionEdited(); -private: - KisRecordedFilterAction* m_action; - QGridLayout* m_gridLayout; - KisConfigWidget* m_configWidget; - KisNodeQueryPathEditor* m_nodeQueryPathEditor; -}; - -class KisRecordedFilterActionEditorFactory : public KisRecordedActionEdito= rFactory -{ -public: - KisRecordedFilterActionEditorFactory(); - ~KisRecordedFilterActionEditorFactory() override; - QWidget* createEditor(QWidget* parent, KisRecordedAction* action) cons= t override; - bool canEdit(const KisRecordedAction* action) const override; -}; - -#endif diff --git a/libs/ui/recorder/kis_recorded_paint_action_editor.cc b/libs/ui= /recorder/kis_recorded_paint_action_editor.cc deleted file mode 100644 index d18e2b59e67..00000000000 --- a/libs/ui/recorder/kis_recorded_paint_action_editor.cc +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_paint_action_editor.h" - -#include -#include - -#include - -#include "recorder/kis_recorded_paint_action.h" -#include -#include -#include - -#include "ui_wdgpaintactioneditor.h" -#include -#include -#include "kis_node_query_path_editor.h" -#include - -KisRecordedPaintActionEditor::KisRecordedPaintActionEditor(QWidget* parent= , KisRecordedAction* action) : QWidget(parent), - m_action(dynamic_cast(action)), - m_actionEditor(new Ui_WdgPaintActionEditor), - m_configWidget(0) -{ - Q_ASSERT(m_action); - m_actionEditor->setupUi(this); - - // Setup paint color editor - m_actionEditor->paintColor->setColor(m_action->paintColor()); - connect(m_actionEditor->paintColor, SIGNAL(changed(KoColor)), - this, SLOT(configurationUpdated())); - - // Setup background color editor - m_actionEditor->backgroundColor->setColor(m_action->backgroundColor()); - connect(m_actionEditor->backgroundColor, SIGNAL(changed(KoColor)), - this, SLOT(configurationUpdated())); - - // Setup opacity - m_actionEditor->opacity->setValue(m_action->opacity() * 100.0); - connect(m_actionEditor->opacity, SIGNAL(valueChanged(int)), SLOT(confi= gurationUpdated())); - - // Setup paint ops - - QList keys =3D KisPaintOpRegistry::instance()->listKeys(); - Q_FOREACH (const KoID& paintopId, keys) { - QIcon pm =3D KisPaintOpRegistry::instance()->icon(paintopId); - - m_actionEditor->paintOps->addItem(pm, paintopId.name()); - m_paintops.append(paintopId.id()); - } - connect(m_actionEditor->paintOps, SIGNAL(activated(int)), SLOT(paintOp= Changed(int))); - - // Setup configuration widget for paint op settings - m_gridLayout =3D new QGridLayout(m_actionEditor->frmOptionWidgetContai= ner); - setPaintOpPreset(); - m_actionEditor->paintOps->setCurrentIndex(m_paintops.indexOf(m_action-= >paintOpPreset()->paintOp().id())); - m_paintOpsToPreset[m_action->paintOpPreset()->paintOp().id()] =3D m_ac= tion->paintOpPreset(); - connect(m_actionEditor->wdgPresetChooser, SIGNAL(resourceSelected(KoRe= source*)), SLOT(resourceSelected(KoResource*))); - - // Setup the query path editor - m_actionEditor->nodeQueryPathEditor->setNodeQueryPath(m_action->nodeQu= eryPath()); - connect(m_actionEditor->nodeQueryPathEditor, SIGNAL(nodeQueryPathChang= ed()), SLOT(nodeQueryPathChanged())); - = -} - -KisRecordedPaintActionEditor::~KisRecordedPaintActionEditor() -{ - delete m_actionEditor; -} - -void KisRecordedPaintActionEditor::configurationUpdated() -{ - m_configWidget->writeConfigurationSafe(const_cast= (m_action->paintOpPreset()->settings().data())); - - m_action->setPaintColor(m_actionEditor->paintColor->color()); - m_action->setBackgroundColor(m_actionEditor->backgroundColor->color()); - m_action->setOpacity(m_actionEditor->opacity->value() / qreal(100.0)); - - emit(actionEdited()); -} - -void KisRecordedPaintActionEditor::paintOpChanged(int index) -{ - QString id =3D m_paintops[index]; - KisPaintOpPresetSP preset =3D m_paintOpsToPreset[id]; - if (!preset) { - preset =3D KisPaintOpRegistry::instance()->defaultPreset(KoID(id, = "")); - m_paintOpsToPreset[id] =3D preset; - } - m_action->setPaintOpPreset(preset); - setPaintOpPreset(); -} - -void KisRecordedPaintActionEditor::resourceSelected(KoResource* resource) -{ - KisPaintOpPresetSP preset =3D static_cast(resource); - - m_paintOpsToPreset[preset->paintOp().id()] =3D preset; - m_action->setPaintOpPreset(preset); - setPaintOpPreset(); -} - -void KisRecordedPaintActionEditor::nodeQueryPathChanged() -{ - m_action->setNodeQueryPath(m_actionEditor->nodeQueryPathEditor->nodeQu= eryPath()); - emit(actionEdited()); -} - - -void KisRecordedPaintActionEditor::setPaintOpPreset() -{ - delete m_configWidget; - m_configWidget =3D KisPaintOpRegistry::instance()->get(m_action->paint= OpPreset()->paintOp().id())->createConfigWidget(m_actionEditor->frmOptionWi= dgetContainer); - if (m_configWidget) { - m_gridLayout->addWidget(m_configWidget); - //TODO use default configuration instead? - //m_configWidget->setConfiguration(m_action->paintOpPreset()->sett= ings()); - connect(m_configWidget, SIGNAL(sigConfigurationUpdated()), SLOT(co= nfigurationUpdated())); - } else { - m_gridLayout->addWidget(new QLabel(i18n("No configuration option."= ), this)); - } -} - -KisRecordedPaintActionEditorFactory::KisRecordedPaintActionEditorFactory() -{ -} - -KisRecordedPaintActionEditorFactory::~KisRecordedPaintActionEditorFactory() -{ -} - -QWidget* KisRecordedPaintActionEditorFactory::createEditor(QWidget* parent= , KisRecordedAction* action) const -{ - return new KisRecordedPaintActionEditor(parent, action); -} - -bool KisRecordedPaintActionEditorFactory::canEdit(const KisRecordedAction*= action) const -{ - return dynamic_cast(action); -} - diff --git a/libs/ui/recorder/kis_recorded_paint_action_editor.h b/libs/ui/= recorder/kis_recorded_paint_action_editor.h deleted file mode 100644 index 5eeaaf79a4e..00000000000 --- a/libs/ui/recorder/kis_recorded_paint_action_editor.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2010 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_PAINT_ACTION_EDITOR_H_ -#define _KIS_RECORDED_PAINT_ACTION_EDITOR_H_ - -#include -#include "kis_recorded_action_editor_factory.h" -#include "kis_types.h" - -class QGridLayout; -class KoColorPopupAction; -class KisPaintOpConfigWidget; -class KisRecordedPaintAction; -class Ui_WdgPaintActionEditor; -class KoResource; - -/** - * This is the editor for all \ref KisRecordedPaintAction - */ -class KisRecordedPaintActionEditor : public QWidget -{ - Q_OBJECT -public: - KisRecordedPaintActionEditor(QWidget* parent, KisRecordedAction* actio= n); - ~KisRecordedPaintActionEditor() override; -private Q_SLOTS: - void configurationUpdated(); - void paintOpChanged(int index); - void resourceSelected(KoResource* resource); - void nodeQueryPathChanged(); -Q_SIGNALS: - void actionEdited(); -private: - void setPaintOpPreset(); - KisRecordedPaintAction* m_action; - Ui_WdgPaintActionEditor* m_actionEditor; - KisPaintOpConfigWidget* m_configWidget; - QGridLayout* m_gridLayout; - QList m_paintops; - QMap m_paintOpsToPreset; -}; - -class KisRecordedPaintActionEditorFactory : public KisRecordedActionEditor= Factory -{ -public: - KisRecordedPaintActionEditorFactory(); - ~KisRecordedPaintActionEditorFactory() override; - QWidget* createEditor(QWidget* parent, KisRecordedAction* action) cons= t override; - bool canEdit(const KisRecordedAction* action) const override; -}; - -#endif diff --git a/libs/ui/tests/CMakeLists.txt b/libs/ui/tests/CMakeLists.txt index 148486fa22f..df77a02ec90 100644 --- a/libs/ui/tests/CMakeLists.txt +++ b/libs/ui/tests/CMakeLists.txt @@ -11,7 +11,6 @@ macro_add_unittest_definitions() ecm_add_tests( kis_image_view_converter_test.cpp kis_shape_selection_test.cpp - kis_recorded_action_editor_test.cpp kis_doc2_test.cpp kis_coordinates_converter_test.cpp kis_grid_config_test.cpp diff --git a/libs/ui/tests/kis_recorded_action_editor_test.cpp b/libs/ui/te= sts/kis_recorded_action_editor_test.cpp deleted file mode 100644 index 3d00ce8d401..00000000000 --- a/libs/ui/tests/kis_recorded_action_editor_test.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2009 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#include "kis_recorded_action_editor_test.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -void KisRecordedActionEditorTest::testFilterEditorCreation() -{ - KisRecordedActionEditorFactoryRegistry* reg =3D KisRecordedActionEdito= rFactoryRegistry::instance(); - const KisFilter* blurFilter =3D KisFilterRegistry::instance()->get("bl= ur"); - KisRecordedFilterAction* blurFilterAction =3D new KisRecordedFilterAct= ion( - "hello", KisNodeQueryPath::fromString(""), blurFilter, blurFilter-= >defaultConfiguration()); - QVERIFY(reg->hasEditor(blurFilterAction)); - QVERIFY(reg->createEditor(0, blurFilterAction)); - const KisFilter* invertFilter =3D KisFilterRegistry::instance()->get("= invert"); - KisRecordedFilterAction* invertFilterAction =3D new KisRecordedFilterA= ction( - "hello", KisNodeQueryPath::fromString(""), invertFilter, invertFil= ter->defaultConfiguration()); - QVERIFY(reg->hasEditor(invertFilterAction)); - QVERIFY(reg->createEditor(0, invertFilterAction)); -} - - -QTEST_MAIN(KisRecordedActionEditorTest) - diff --git a/libs/ui/tests/kis_recorded_action_editor_test.h b/libs/ui/test= s/kis_recorded_action_editor_test.h deleted file mode 100644 index 74b605a0ee2..00000000000 --- a/libs/ui/tests/kis_recorded_action_editor_test.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2009 Cyrille Berger - * - * 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-13= 01, USA. - */ - -#ifndef _KIS_RECORDED_ACTION_EDITOR_TEST_H_ -#define _KIS_RECORDED_ACTION_EDITOR_TEST_H_ - -#include - -class KisRecordedActionEditorTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void testFilterEditorCreation(); -}; - -#endif diff --git a/libs/ui/tool/kis_recording_adapter.cpp b/libs/ui/tool/kis_reco= rding_adapter.cpp deleted file mode 100644 index 41e67fa9fcb..00000000000 --- a/libs/ui/tool/kis_recording_adapter.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2011 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-13= 01, USA. - */ - -#include "kis_recording_adapter.h" - -#include "kis_image.h" -#include "kis_node.h" -#include - -#include "recorder/kis_action_recorder.h" -#include "recorder/kis_recorded_path_paint_action.h" -#include "recorder/kis_node_query_path.h" - - -KisRecordingAdapter::KisRecordingAdapter() - : m_pathPaintAction(0) -{ -} - -KisRecordingAdapter::~KisRecordingAdapter() -{ -} - -void KisRecordingAdapter::startStroke(KisImageWSP image, KisResourcesSnaps= hotSP resources, - const KisDistanceInitInfo &startDist= Info) -{ - Q_ASSERT(!m_pathPaintAction); - Q_ASSERT(!m_image); - - m_image =3D image; - m_pathPaintAction =3D new KisRecordedPathPaintAction( - KisNodeQueryPath::absolutePath(resources->currentNode()), 0, start= DistInfo); - - resources->setupPaintAction(m_pathPaintAction); -} - -void KisRecordingAdapter::endStroke() -{ - Q_ASSERT(m_pathPaintAction); - Q_ASSERT(m_image); - - m_image->actionRecorder()->addAction(*m_pathPaintAction); - - delete m_pathPaintAction; - m_pathPaintAction =3D 0; - m_image =3D 0; -} - - -void KisRecordingAdapter::addPoint(const KisPaintInformation &pi) -{ - KIS_SAFE_ASSERT_RECOVER_RETURN(m_pathPaintAction); - m_pathPaintAction->addPoint(pi); -} - -void KisRecordingAdapter::addLine(const KisPaintInformation &pi1, - const KisPaintInformation &pi2) -{ - KIS_SAFE_ASSERT_RECOVER_RETURN(m_pathPaintAction); - m_pathPaintAction->addLine(pi1, pi2); -} - - -void KisRecordingAdapter::addCurve(const KisPaintInformation &pi1, - const QPointF &control1, - const QPointF &control2, - const KisPaintInformation &pi2) -{ - KIS_SAFE_ASSERT_RECOVER_RETURN(m_pathPaintAction); - m_pathPaintAction->addCurve(pi1, control1, control2, pi2); -} - diff --git a/libs/ui/tool/kis_recording_adapter.h b/libs/ui/tool/kis_record= ing_adapter.h deleted file mode 100644 index 76b8752465a..00000000000 --- a/libs/ui/tool/kis_recording_adapter.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2011 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-13= 01, USA. - */ - -#ifndef __KIS_RECORDING_ADAPTER_H -#define __KIS_RECORDING_ADAPTER_H - -#include "kis_types.h" -#include "kis_resources_snapshot.h" - -class KisRecordedPathPaintAction; -class KisPaintInformation; -class KisDistanceInitInfo; - - -class KisRecordingAdapter -{ -public: - KisRecordingAdapter(); - ~KisRecordingAdapter(); - - void startStroke(KisImageWSP image, KisResourcesSnapshotSP resources, - const KisDistanceInitInfo &startDist); - void endStroke(); - - void addPoint(const KisPaintInformation &pi); - void addLine(const KisPaintInformation &pi1, - const KisPaintInformation &pi2); - - void addCurve(const KisPaintInformation &pi1, - const QPointF &control1, - const QPointF &control2, - const KisPaintInformation &pi2); - -private: - KisImageWSP m_image; - KisRecordedPathPaintAction *m_pathPaintAction; -}; - -#endif /* __KIS_RECORDING_ADAPTER_H */ diff --git a/libs/ui/tool/kis_resources_snapshot.cpp b/libs/ui/tool/kis_res= ources_snapshot.cpp index 733ef420a0f..99384963f94 100644 --- a/libs/ui/tool/kis_resources_snapshot.cpp +++ b/libs/ui/tool/kis_resources_snapshot.cpp @@ -31,7 +31,6 @@ #include "kis_image.h" #include "kis_paint_device.h" #include "kis_paint_layer.h" -#include "recorder/kis_recorded_paint_action.h" #include "kis_selection.h" #include "kis_selection_mask.h" #include "kis_algebra_2d.h" @@ -223,24 +222,6 @@ void KisResourcesSnapshot::setupMaskingBrushPainter(Ki= sPainter *painter) m_d->currentNode, m_d->image); } = -void KisResourcesSnapshot::setupPaintAction(KisRecordedPaintAction *action) -{ - action->setPaintOpPreset(m_d->currentPaintOpPreset); - action->setPaintIncremental(!needsIndirectPainting()); - - action->setPaintColor(m_d->currentFgColor); - action->setBackgroundColor(m_d->currentBgColor); - action->setGenerator(m_d->currentGenerator); - action->setGradient(m_d->currentGradient); - action->setPattern(m_d->currentPattern); - - action->setOpacity(m_d->opacity / qreal(OPACITY_OPAQUE_U8)); - action->setCompositeOp(m_d->compositeOp->id()); - - action->setStrokeStyle(m_d->strokeStyle); - action->setFillStyle(m_d->fillStyle); -} - KisPostExecutionUndoAdapter* KisResourcesSnapshot::postExecutionUndoAdapte= r() const { return m_d->image ? m_d->image->postExecutionUndoAdapter() : 0; diff --git a/libs/ui/tool/kis_resources_snapshot.h b/libs/ui/tool/kis_resou= rces_snapshot.h index 16e280c1695..658936ba89c 100644 --- a/libs/ui/tool/kis_resources_snapshot.h +++ b/libs/ui/tool/kis_resources_snapshot.h @@ -30,12 +30,11 @@ class KoCanvasResourceManager; class KoCompositeOp; class KisPainter; class KisPostExecutionUndoAdapter; -class KisRecordedPaintAction; class KoPattern; = /** * @brief The KisResourcesSnapshot class takes a snapshot of the various r= esources - * like colors and settings used at the begin of a stroke or a recording s= o subsequent + * like colors and settings used at the begin of a stroke so subsequent * changes don't impact the running stroke. The main reason for the snapsh= ot is that the * user can *change* the options while the stroke is being executed in the= background. */ @@ -49,10 +48,6 @@ public: void setupPainter(KisPainter *painter); void setupMaskingBrushPainter(KisPainter *painter); = - // XXX: This was marked as KDE_DEPRECATED, but no althernative was - // given in the apidox. - void setupPaintAction(KisRecordedPaintAction *action); - KisPostExecutionUndoAdapter* postExecutionUndoAdapter() const; void setCurrentNode(KisNodeSP node); void setStrokeStyle(KisPainter::StrokeStyle strokeStyle); diff --git a/libs/ui/tool/kis_tool.cc b/libs/ui/tool/kis_tool.cc index 3331b2edb7d..f9ee6ee555e 100644 --- a/libs/ui/tool/kis_tool.cc +++ b/libs/ui/tool/kis_tool.cc @@ -62,7 +62,6 @@ #include "kis_config.h" #include "kis_config_notifier.h" #include "kis_cursor.h" -#include #include #include "kis_resources_snapshot.h" #include @@ -548,12 +547,6 @@ void KisTool::deleteSelection() } } = -void KisTool::setupPaintAction(KisRecordedPaintAction* action) -{ - action->setPaintColor(currentFgColor()); - action->setBackgroundColor(currentBgColor()); -} - QWidget* KisTool::createOptionWidget() { d->optionWidget =3D new QLabel(i18n("No options")); diff --git a/libs/ui/tool/kis_tool.h b/libs/ui/tool/kis_tool.h index 21d532cee48..dcf5368519d 100644 --- a/libs/ui/tool/kis_tool.h +++ b/libs/ui/tool/kis_tool.h @@ -43,7 +43,6 @@ class KisFilterConfiguration; class QPainter; class QPainterPath; class QPolygonF; -class KisRecordedPaintAction; = /// Definitions of the toolgroups of Krita static const QString TOOL_TYPE_SHAPE =3D "0 Krita/Shape"; // Geome= tric shapes like ellipses and lines @@ -271,8 +270,6 @@ protected: KisPaintOpPresetSP currentPaintOpPreset(); KisFilterConfigurationSP currentGenerator(); = - virtual void setupPaintAction(KisRecordedPaintAction* action); - /// paint the path which is in view coordinates, default paint mode is= XOR_MODE, BW_MODE is also possible /// never apply transformations to the painter, they would be useless,= if drawing in OpenGL mode. The coordinates in the path should be in view c= oordinates. void paintToolOutline(QPainter * painter, const QPainterPath &path); diff --git a/libs/ui/tool/kis_tool_freehand.cc b/libs/ui/tool/kis_tool_free= hand.cc index f419cc11d0b..3df3db09573 100644 --- a/libs/ui/tool/kis_tool_freehand.cc +++ b/libs/ui/tool/kis_tool_freehand.cc @@ -57,7 +57,6 @@ #include #include "kis_painting_information_builder.h" #include "kis_tool_freehand_helper.h" -#include "kis_recording_adapter.h" #include "strokes/freehand_stroke.h" = using namespace std::placeholders; // For _1 placeholder @@ -76,17 +75,14 @@ KisToolFreehand::KisToolFreehand(KoCanvasBase * canvas,= const QCursor & cursor, setMaskSyntheticEvents(KisConfig().disableTouchOnCanvas()); // Disallo= w mouse events from finger presses unless enabled = m_infoBuilder =3D new KisToolFreehandPaintingInformationBuilder(this); - m_recordingAdapter =3D new KisRecordingAdapter(); - m_helper =3D new KisToolFreehandHelper(m_infoBuilder, transactionText,= m_recordingAdapter); + m_helper =3D new KisToolFreehandHelper(m_infoBuilder, transactionText); = - connect(m_helper, SIGNAL(requestExplicitUpdateOutline()), - SLOT(explicitUpdateOutline())); + connect(m_helper, SIGNAL(requestExplicitUpdateOutline()), SLOT(explici= tUpdateOutline())); } = KisToolFreehand::~KisToolFreehand() { delete m_helper; - delete m_recordingAdapter; delete m_infoBuilder; } = @@ -142,11 +138,6 @@ KisPaintingInformationBuilder* KisToolFreehand::painti= ngInformationBuilder() con return m_infoBuilder; } = -KisRecordingAdapter* KisToolFreehand::recordingAdapter() const -{ - return m_recordingAdapter; -} - void KisToolFreehand::resetHelper(KisToolFreehandHelper *helper) { delete m_helper; diff --git a/libs/ui/tool/kis_tool_freehand.h b/libs/ui/tool/kis_tool_freeh= and.h index 28db6de7cdb..bc090e75ee5 100644 --- a/libs/ui/tool/kis_tool_freehand.h +++ b/libs/ui/tool/kis_tool_freehand.h @@ -33,11 +33,8 @@ class KoPointerEvent; class KoCanvasBase; = - - class KisPaintingInformationBuilder; class KisToolFreehandHelper; -class KisRecordingAdapter; = = class KRITAUI_EXPORT KisToolFreehand : public KisToolPaint @@ -83,7 +80,6 @@ protected: = = KisPaintingInformationBuilder* paintingInformationBuilder() const; - KisRecordingAdapter* recordingAdapter() const; void resetHelper(KisToolFreehandHelper *helper); = protected Q_SLOTS: @@ -120,7 +116,6 @@ protected: private: KisPaintingInformationBuilder *m_infoBuilder; KisToolFreehandHelper *m_helper; - KisRecordingAdapter *m_recordingAdapter; = QPointF m_initialGestureDocPoint; QPointF m_lastDocumentPoint; diff --git a/libs/ui/tool/kis_tool_freehand_helper.cpp b/libs/ui/tool/kis_t= ool_freehand_helper.cpp index f060c6cf917..f0c4b994bb8 100644 --- a/libs/ui/tool/kis_tool_freehand_helper.cpp +++ b/libs/ui/tool/kis_tool_freehand_helper.cpp @@ -29,7 +29,6 @@ #include "kis_algebra_2d.h" #include "kis_distance_information.h" #include "kis_painting_information_builder.h" -#include "kis_recording_adapter.h" #include "kis_image.h" #include "kis_painter.h" #include @@ -66,7 +65,6 @@ const qreal TIMING_UPDATE_INTERVAL =3D 50.0; struct KisToolFreehandHelper::Private { KisPaintingInformationBuilder *infoBuilder; - KisRecordingAdapter *recordingAdapter; KisStrokesFacade *strokesFacade; = KUndo2MagicString transactionText; @@ -122,12 +120,10 @@ struct KisToolFreehandHelper::Private = KisToolFreehandHelper::KisToolFreehandHelper(KisPaintingInformationBuilder= *infoBuilder, const KUndo2MagicString &tran= sactionText, - KisRecordingAdapter *recordin= gAdapter, KisSmoothingOptions *smoothin= gOptions) : m_d(new Private()) { m_d->infoBuilder =3D infoBuilder; - m_d->recordingAdapter =3D recordingAdapter; m_d->transactionText =3D transactionText; m_d->smoothingOptions =3D KisSmoothingOptionsSP( smoothingOptions ? smoothingOptions : new KisSmoothingOpti= ons()); @@ -311,10 +307,6 @@ void KisToolFreehandHelper::initPaintImpl(qreal startA= ngle, createPainters(m_d->strokeInfos, startDist); = - if(m_d->recordingAdapter) { - m_d->recordingAdapter->startStroke(image, m_d->resources, startDis= tInfo); - } - KisStrokeStrategy *stroke =3D new FreehandStrokeStrategy(m_d->resources, m_d->strokeInfos, m_d->= transactionText); = @@ -653,10 +645,6 @@ void KisToolFreehandHelper::endPaint() = m_d->strokesFacade->endStroke(m_d->strokeId); m_d->strokeId.clear(); - - if(m_d->recordingAdapter) { - m_d->recordingAdapter->endStroke(); - } } = void KisToolFreehandHelper::cancelPaint() @@ -687,10 +675,6 @@ void KisToolFreehandHelper::cancelPaint() m_d->strokesFacade->cancelStroke(m_d->strokeId); m_d->strokeId.clear(); = - if(m_d->recordingAdapter) { - //FIXME: not implemented - //m_d->recordingAdapter->cancelStroke(); - } } = int KisToolFreehandHelper::elapsedStrokeTime() const @@ -925,9 +909,6 @@ void KisToolFreehandHelper::paintAt(int strokeInfoId, m_d->strokesFacade->addJob(m_d->strokeId, new FreehandStrokeStrategy::Data(strokeInfo= Id, pi)); = - if(m_d->recordingAdapter) { - m_d->recordingAdapter->addPoint(pi); - } } = void KisToolFreehandHelper::paintLine(int strokeInfoId, @@ -938,9 +919,6 @@ void KisToolFreehandHelper::paintLine(int strokeInfoId, m_d->strokesFacade->addJob(m_d->strokeId, new FreehandStrokeStrategy::Data(strokeInfo= Id, pi1, pi2)); = - if(m_d->recordingAdapter) { - m_d->recordingAdapter->addLine(pi1, pi2); - } } = void KisToolFreehandHelper::paintBezierCurve(int strokeInfoId, @@ -978,9 +956,6 @@ void KisToolFreehandHelper::paintBezierCurve(int stroke= InfoId, new FreehandStrokeStrategy::Data(strokeInfo= Id, pi1, contr= ol1, control2, pi2)); = - if(m_d->recordingAdapter) { - m_d->recordingAdapter->addCurve(pi1, control1, control2, pi2); - } } = void KisToolFreehandHelper::createPainters(QVector= &strokeInfos, diff --git a/libs/ui/tool/kis_tool_freehand_helper.h b/libs/ui/tool/kis_too= l_freehand_helper.h index 75840a2ee16..d313eca2454 100644 --- a/libs/ui/tool/kis_tool_freehand_helper.h +++ b/libs/ui/tool/kis_tool_freehand_helper.h @@ -34,7 +34,6 @@ class KoPointerEvent; class KoCanvasResourceManager; class KisPaintingInformationBuilder; -class KisRecordingAdapter; class KisStrokesFacade; class KisPostExecutionUndoAdapter; class KisPaintOp; @@ -49,7 +48,6 @@ public: = KisToolFreehandHelper(KisPaintingInformationBuilder *infoBuilder, const KUndo2MagicString &transactionText =3D KUn= do2MagicString(), - KisRecordingAdapter *recordingAdapter =3D 0, KisSmoothingOptions *smoothingOptions =3D 0); ~KisToolFreehandHelper() override; = diff --git a/libs/ui/tool/kis_tool_multihand_helper.cpp b/libs/ui/tool/kis_= tool_multihand_helper.cpp index 705c377e319..fe430d0edc0 100644 --- a/libs/ui/tool/kis_tool_multihand_helper.cpp +++ b/libs/ui/tool/kis_tool_multihand_helper.cpp @@ -29,9 +29,8 @@ struct KisToolMultihandHelper::Private }; = KisToolMultihandHelper::KisToolMultihandHelper(KisPaintingInformationBuild= er *infoBuilder, - const KUndo2MagicString &tr= ansactionText, - KisRecordingAdapter *record= ingAdapter) - : KisToolFreehandHelper(infoBuilder, transactionText, recordingAdapter) + const KUndo2MagicString &tr= ansactionText) + : KisToolFreehandHelper(infoBuilder, transactionText) , d(new Private) { } @@ -63,7 +62,7 @@ void KisToolMultihandHelper::paintAt(const KisPaintInform= ation &pi) QLineF rotateme(QPointF (0.0,0.0), QPointF (10.0,10.0)); rotateme.setAngle(__pi.canvasRotation()); QLineF rotated =3D transform.map(rotateme); - = + __pi.setPos(transform.map(__pi.pos())); __pi.setCanvasRotation(rotated.angle()); = @@ -86,7 +85,7 @@ void KisToolMultihandHelper::paintLine(const KisPaintInfo= rmation &pi1, KisPaintInformation __pi2 =3D pi2; __pi1.setPos(transform.map(__pi1.pos())); __pi2.setPos(transform.map(__pi2.pos())); - = + QLineF rotateme(QPointF (0.0,0.0), QPointF (10.0,10.0)); rotateme.setAngle(__pi1.canvasRotation()); QLineF rotated =3D transform.map(rotateme); @@ -99,11 +98,11 @@ void KisToolMultihandHelper::paintLine(const KisPaintIn= formation &pi1, //check mirroring if (__pi2.canvasMirroredH()) { __pi1.setCanvasRotation(180-__pi1.canvasRotation()); - __pi1.setCanvasRotation(__pi1.canvasRotation()+180); = = + __pi1.setCanvasRotation(__pi1.canvasRotation()+180); __pi2.setCanvasRotation(180-__pi2.canvasRotation()); __pi2.setCanvasRotation(__pi2.canvasRotation()+180); } - = + = paintLine(i, __pi1, __pi2); } @@ -121,23 +120,23 @@ void KisToolMultihandHelper::paintBezierCurve(const K= isPaintInformation &pi1, KisPaintInformation __pi2 =3D pi2; __pi1.setPos(transform.map(__pi1.pos())); __pi2.setPos(transform.map(__pi2.pos())); - = + QLineF rotateme(QPointF (0.0,0.0), QPointF (10.0,10.0)); rotateme.setAngle(__pi1.canvasRotation()); QLineF rotated =3D transform.map(rotateme); __pi1.setCanvasRotation(rotated.angle()); - = + rotateme.setAngle(__pi2.canvasRotation()); rotated =3D transform.map(rotateme); __pi2.setCanvasRotation(rotated.angle()); - = + if (__pi2.canvasMirroredH()) { __pi1.setCanvasRotation(180-__pi1.canvasRotation()); - __pi1.setCanvasRotation(__pi1.canvasRotation()+180); = = + __pi1.setCanvasRotation(__pi1.canvasRotation()+180); __pi2.setCanvasRotation(180-__pi2.canvasRotation()); __pi2.setCanvasRotation(__pi2.canvasRotation()+180); } - = + = QPointF __control1 =3D transform.map(control1); QPointF __control2 =3D transform.map(control2); diff --git a/libs/ui/tool/kis_tool_multihand_helper.h b/libs/ui/tool/kis_to= ol_multihand_helper.h index 5530ce58a25..38a31b6e1cb 100644 --- a/libs/ui/tool/kis_tool_multihand_helper.h +++ b/libs/ui/tool/kis_tool_multihand_helper.h @@ -28,8 +28,7 @@ class KRITAUI_EXPORT KisToolMultihandHelper : public KisT= oolFreehandHelper = public: KisToolMultihandHelper(KisPaintingInformationBuilder *infoBuilder, - const KUndo2MagicString &transactionText, - KisRecordingAdapter *recordingAdapter =3D 0); + const KUndo2MagicString &transactionText); ~KisToolMultihandHelper() override; = void setupTransformations(const QVector &transformations); diff --git a/libs/ui/tool/kis_tool_paint.cc b/libs/ui/tool/kis_tool_paint.cc index 7b32baba970..83fe524badd 100644 --- a/libs/ui/tool/kis_tool_paint.cc +++ b/libs/ui/tool/kis_tool_paint.cc @@ -70,7 +70,6 @@ #include "widgets/kis_cmb_composite.h" #include "widgets/kis_slider_spin_box.h" #include "kis_canvas_resource_provider.h" -#include #include "kis_tool_utils.h" #include #include @@ -620,16 +619,6 @@ void KisToolPaint::slotPopupQuickHelp() QWhatsThis::showText(QCursor::pos(), quickHelp()); } = -void KisToolPaint::setupPaintAction(KisRecordedPaintAction* action) -{ - KisTool::setupPaintAction(action); - action->setOpacity(m_opacity / qreal(255.0)); - const KoCompositeOp *op =3D compositeOp(); - if (op) { - action->setCompositeOp(op->id()); - } -} - KisToolPaint::NodePaintAbility KisToolPaint::nodePaintAbility() { KisNodeSP node =3D currentNode(); diff --git a/libs/ui/tool/kis_tool_paint.h b/libs/ui/tool/kis_tool_paint.h index 93d1153d13a..129d7666551 100644 --- a/libs/ui/tool/kis_tool_paint.h +++ b/libs/ui/tool/kis_tool_paint.h @@ -110,8 +110,6 @@ protected: return QString(); } = - void setupPaintAction(KisRecordedPaintAction* action) override; - enum NodePaintAbility { NONE, PAINT, diff --git a/libs/ui/tool/kis_tool_shape.cc b/libs/ui/tool/kis_tool_shape.cc index 9f46b39d2e7..270a060e789 100644 --- a/libs/ui/tool/kis_tool_shape.cc +++ b/libs/ui/tool/kis_tool_shape.cc @@ -43,11 +43,8 @@ #include #include #include -#include -#include #include "kis_figure_painting_tool_helper.h" -#include -#include +#include = #include #include @@ -140,16 +137,6 @@ qreal KisToolShape::currentStrokeWidth() const return canvas()->unit().fromUserValue(sizeInPx); } = -void KisToolShape::setupPaintAction(KisRecordedPaintAction* action) -{ - KisToolPaint::setupPaintAction(action); - action->setFillStyle(fillStyle()); - action->setStrokeStyle(strokeStyle()); - action->setGenerator(currentGenerator()); - action->setPattern(currentPattern()); - action->setGradient(currentGradient()); -} - void KisToolShape::addShape(KoShape* shape) { KoImageCollection* imageCollection =3D canvas()->shapeController()->re= sourceManager()->imageCollection(); @@ -220,8 +207,6 @@ void KisToolShape::addPathShape(KoPathShape* pathShape,= const KUndo2MagicString& if (!node || !blockUntilOperationsFinished()) { return; } - // Get painting options - KisPaintOpPresetSP preset =3D currentPaintOpPreset(); = // Compute the outline KisImageSP image =3D this->image(); @@ -230,44 +215,6 @@ void KisToolShape::addPathShape(KoPathShape* pathShape= , const KUndo2MagicString& matrix.translate(pathShape->position().x(), pathShape->position().y()); QPainterPath mapedOutline =3D matrix.map(pathShape->outline()); = - // Recorde the paint action - KisRecordedPathPaintAction bezierCurvePaintAction( - KisNodeQueryPath::absolutePath(node), - preset, - KisDistanceInitInfo()); - bezierCurvePaintAction.setPaintColor(currentFgColor()); - QPointF lastPoint, nextPoint; - int elementCount =3D mapedOutline.elementCount(); - for (int i =3D 0; i < elementCount; i++) { - QPainterPath::Element element =3D mapedOutline.elementAt(i); - switch (element.type) { - case QPainterPath::MoveToElement: - if (i !=3D 0) { - qFatal("Unhandled"); // XXX: I am not sure the tool can pr= oduce such element, deal with it when it can - } - lastPoint =3D QPointF(element.x, element.y); - break; - case QPainterPath::LineToElement: - nextPoint =3D QPointF(element.x, element.y); - bezierCurvePaintAction.addLine(KisPaintInformation(lastPoint),= KisPaintInformation(nextPoint)); - lastPoint =3D nextPoint; - break; - case QPainterPath::CurveToElement: - nextPoint =3D QPointF(mapedOutline.elementAt(i + 2).x, mapedO= utline.elementAt(i + 2).y); - bezierCurvePaintAction.addCurve(KisPaintInformation(lastPoint), - QPointF(mapedOutline.elementA= t(i).x, - mapedOutline.elementA= t(i).y), - QPointF(mapedOutline.elementA= t(i + 1).x, - mapedOutline.elementA= t(i + 1).y), - KisPaintInformation(nextPoint= )); - lastPoint =3D nextPoint; - break; - default: - continue; - } - } - image->actionRecorder()->addAction(bezierCurvePaintAction); - if (node->hasEditablePaintDevice()) { KisFigurePaintingToolHelper helper(name, image, diff --git a/libs/ui/tool/kis_tool_shape.h b/libs/ui/tool/kis_tool_shape.h index fcd913d999c..71aa2222048 100644 --- a/libs/ui/tool/kis_tool_shape.h +++ b/libs/ui/tool/kis_tool_shape.h @@ -71,8 +71,6 @@ protected: = qreal currentStrokeWidth() const; = - void setupPaintAction(KisRecordedPaintAction* action) override; - void addShape(KoShape* shape); = void addPathShape(KoPathShape* pathShape, const KUndo2MagicString& nam= e); diff --git a/plugins/extensions/CMakeLists.txt b/plugins/extensions/CMakeLi= sts.txt index b5ed7be8598..9ace76c315d 100644 --- a/plugins/extensions/CMakeLists.txt +++ b/plugins/extensions/CMakeLists.txt @@ -1,4 +1,3 @@ -add_subdirectory( bigbrother ) add_subdirectory( imagesplit ) add_subdirectory( clonesarray ) add_subdirectory( colorrange ) diff --git a/plugins/extensions/bigbrother/CMakeLists.txt b/plugins/extensi= ons/bigbrother/CMakeLists.txt deleted file mode 100644 index 6510562d103..00000000000 --- a/plugins/extensions/bigbrother/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set(kritabigbrother_SOURCES - bigbrother.cc - actionseditor/kis_actions_editor.cpp - actionseditor/kis_actions_editor_dialog.cpp - actionseditor/kis_macro_model.cpp ) - -ki18n_wrap_ui(kritabigbrother_SOURCES - actionseditor/wdgactionseditor.ui ) - -add_library(kritabigbrother MODULE ${kritabigbrother_SOURCES}) -target_link_libraries(kritabigbrother kritaui) -install(TARGETS kritabigbrother DESTINATION ${KRITA_PLUGIN_INSTALL_DIR}) -install( FILES bigbrother.xmlgui DESTINATION ${DATA_INSTALL_DIR}/kritapl= ugins) diff --git a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor= .cpp b/plugins/extensions/bigbrother/actionseditor/kis_actions_editor.cpp deleted file mode 100644 index ee37a7df7a6..00000000000 --- a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* This file is part of the KDE project - * Copyright (c) 2009 Cyrille Berger - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public Licen= se - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "kis_actions_editor.h" - -#include "ui_wdgactionseditor.h" - -#include "kis_macro_model.h" -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -KisActionsEditor::KisActionsEditor(QWidget* parent) : QWidget(parent), m_c= urrentEditor(0), m_form(new Ui::ActionsEditor), m_macro(0), m_model(0), m_w= idgetLayout(0) - -{ - m_form->setupUi(this); - - // Setup buttons - m_form->bnAdd->setIcon(KisIconUtils::loadIcon("list-add")); - QSignalMapper* mapper =3D new QSignalMapper(this); - connect(mapper, SIGNAL(mapped(QString)), SLOT(slotCreateAction(QString= ))); - QMenu* addMenu =3D new QMenu; - Q_FOREACH (const KoID& id, KisRecordedActionCreatorFactoryRegistry::in= stance()->creators()) - { - QAction* action =3D addMenu->addAction(id.name(), mapper, SLOT(map= ())); - mapper->setMapping(action, id.id()); - } - m_form->bnAdd->setMenu(addMenu); - = - - m_form->bnDelete->setIcon(KisIconUtils::loadIcon("edit-delete")); - connect(m_form->bnDelete, SIGNAL(released()), SLOT(slotBtnDelete())); - - m_form->bnRaise->setIcon(KisIconUtils::loadIcon("arrow-up")); - connect(m_form->bnRaise, SIGNAL(released()), SLOT(slotBtnRaise())); - - m_form->bnLower->setIcon(KisIconUtils::loadIcon("arrow-down")); - connect(m_form->bnLower, SIGNAL(released()), SLOT(slotBtnLower())); - - m_form->bnDuplicate->setIcon(KisIconUtils::loadIcon("edit-copy")); - connect(m_form->bnDuplicate, SIGNAL(released()), SLOT(slotBtnDuplicate= ())); - - // Setup actions list - connect(m_form->actionsList, SIGNAL(clicked(const QModelIndex&)), SLOT= (slotActionActivated(const QModelIndex&))); - connect(m_form->actionsList, SIGNAL(activated(QModelIndex)), SLOT(slot= ActionActivated(const QModelIndex&))); - - // Editor - m_widgetLayout =3D new QGridLayout(m_form->editorWidget); - setCurrentAction(0); -} - -KisActionsEditor::~KisActionsEditor() -{ - delete m_form; -} - -void KisActionsEditor::setMacro(KisMacro* _macro) -{ - m_macro =3D _macro; - KisMacroModel* oldModel =3D m_model; - m_model =3D new KisMacroModel(m_macro); - m_form->actionsList->setModel(m_model); - delete oldModel; -} - -void KisActionsEditor::slotCreateAction(const QString& _id) -{ - KisRecordedActionCreatorFactory* f =3D KisRecordedActionCreatorFactory= Registry::instance()->get(_id); - Q_ASSERT(f); - if(!f) return; - KisRecordedAction* action =3D 0; - if(f->requireCreator()) - { - KoDialog d; - d.setButtons(KoDialog::Ok | KoDialog::Cancel); - KisRecordedActionCreator* creator =3D f->createCreator(&d); - d.setMainWidget(creator); - if(d.exec() =3D=3D KoDialog::Accepted) - { - action =3D creator->createAction(); - if(!action) { - QMessageBox::critical(this, i18nc("@title:window", "Krita"= ), i18n("Failed to create an action.")); - return; - } - } - else { - return; - } - } - else { - action =3D f->createAction(); - } - Q_ASSERT(action); - = - m_model->addAction(m_form->actionsList->currentIndex(), *action); - delete action; -} - -void KisActionsEditor::slotActionActivated(const QModelIndex& item) -{ - if (item.isValid() && m_macro) { - setCurrentAction(m_macro->actions()[item.row()]); - } else { - setCurrentAction(0); - } -} - -void KisActionsEditor::setCurrentAction(KisRecordedAction* _action) -{ - // First change, the editor - delete m_currentEditor; - m_currentEditor =3D 0; - if (_action) { - m_currentEditor =3D KisRecordedActionEditorFactoryRegistry::instan= ce()->createEditor(this, _action); - } else { - m_currentEditor =3D new QLabel(i18n("No action is selected."), thi= s); - } - if (!m_currentEditor) { - m_currentEditor =3D new QLabel(i18n("No editor for current action.= "), this); - } - m_widgetLayout->addWidget(m_currentEditor, 0 , 0); - - // Then disable/enalbed button - m_form->bnDuplicate->setEnabled(_action); - m_form->bnRaise->setEnabled(_action); - m_form->bnLower->setEnabled(_action); - m_form->bnDelete->setEnabled(_action); - if (_action) { - int pos =3D m_macro->actions().indexOf(_action); - if (pos =3D=3D 0) { - m_form->bnRaise->setEnabled(false); - } - if (pos =3D=3D m_macro->actions().count() - 1) { - m_form->bnLower->setEnabled(false); - } - } -} - -void KisActionsEditor::slotBtnDelete() -{ - QModelIndex idx =3D m_form->actionsList->currentIndex(); - Q_ASSERT(idx.isValid()); - m_model->removeRows(idx.row(), 1); - setCurrentAction(0); -} - -void KisActionsEditor::slotBtnDuplicate() -{ - QModelIndex idx =3D m_form->actionsList->currentIndex(); - Q_ASSERT(idx.isValid()); - m_model->duplicateAction(idx); -} - -void KisActionsEditor::slotBtnRaise() -{ - QModelIndex idx =3D m_form->actionsList->currentIndex(); - Q_ASSERT(idx.isValid()); - m_model->raise(idx); - m_form->actionsList->setCurrentIndex(m_model->index(idx.row() - 1)); - slotActionActivated(m_form->actionsList->currentIndex()); -} - -void KisActionsEditor::slotBtnLower() -{ - QModelIndex idx =3D m_form->actionsList->currentIndex(); - Q_ASSERT(idx.isValid()); - m_model->lower(idx); - m_form->actionsList->setCurrentIndex(m_model->index(idx.row() + 1)); - slotActionActivated(m_form->actionsList->currentIndex()); -} - diff --git a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor= .h b/plugins/extensions/bigbrother/actionseditor/kis_actions_editor.h deleted file mode 100644 index 8ad167b9be6..00000000000 --- a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor.h +++ /dev/null @@ -1,61 +0,0 @@ -/* This file is part of the KDE project - * Copyright (c) 2009 Cyrille Berger - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public Licen= se - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _KIS_ACTIONS_EDITOR_H_ -#define _KIS_ACTIONS_EDITOR_H_ - -#include - -class KisMacro; -class KisMacroModel; -class KisRecordedAction; - -class QModelIndex; -class QGridLayout; - -namespace Ui -{ -class ActionsEditor; -} - -class KisActionsEditor : public QWidget -{ - Q_OBJECT -public: - KisActionsEditor(QWidget* parent); - ~KisActionsEditor() override; - void setMacro(KisMacro*); -private Q_SLOTS: - void slotCreateAction(const QString& _id); - void slotActionActivated(const QModelIndex&); - void slotBtnDelete(); - void slotBtnDuplicate(); - void slotBtnRaise(); - void slotBtnLower(); -private: - void setCurrentAction(KisRecordedAction* _action); -private: - QWidget* m_currentEditor; - Ui::ActionsEditor* m_form; - KisMacro* m_macro; - KisMacroModel* m_model; - QGridLayout* m_widgetLayout; -}; - -#endif diff --git a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor= _dialog.cpp b/plugins/extensions/bigbrother/actionseditor/kis_actions_edito= r_dialog.cpp deleted file mode 100644 index 561b6fa2378..00000000000 --- a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor_dialog= .cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* This file is part of the KDE project - * Copyright (c) 2009 Cyrille Berger - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public Licen= se - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "kis_actions_editor_dialog.h" -#include "kis_actions_editor.h" - -#include - -KisActionsEditorDialog::KisActionsEditorDialog(QWidget* parent) : KoDialog= (parent), - m_actionsEditor(new KisActionsEditor(this)) -{ - setMainWidget(m_actionsEditor); - setButtons(Cancel | Ok); - setButtonText(Ok, i18n("Save macro")); - setButtonText(Cancel, i18n("Discard changes")); -} - -KisActionsEditorDialog::~KisActionsEditorDialog() -{ -} - -KisActionsEditor* KisActionsEditorDialog::actionsEditor() -{ - return m_actionsEditor; -} diff --git a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor= _dialog.h b/plugins/extensions/bigbrother/actionseditor/kis_actions_editor_= dialog.h deleted file mode 100644 index 8ca9a824c2c..00000000000 --- a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor_dialog= .h +++ /dev/null @@ -1,37 +0,0 @@ -/* This file is part of the KDE project - * Copyright (c) 2009 Cyrille Berger - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public Licen= se - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _KIS_ACTIONS_EDITOR_DIALOG_H_ -#define _KIS_ACTIONS_EDITOR_DIALOG_H_ - -#include - -class KisActionsEditor; - -class KisActionsEditorDialog : public KoDialog -{ -public: - KisActionsEditorDialog(QWidget* parent); - ~KisActionsEditorDialog() override; - KisActionsEditor* actionsEditor(); -private: - KisActionsEditor* m_actionsEditor; -}; - -#endif diff --git a/plugins/extensions/bigbrother/actionseditor/kis_macro_model.cp= p b/plugins/extensions/bigbrother/actionseditor/kis_macro_model.cpp deleted file mode 100644 index 01f55bf677e..00000000000 --- a/plugins/extensions/bigbrother/actionseditor/kis_macro_model.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* This file is part of the KDE project - * Copyright (c) 2009 Cyrille Berger - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public Licen= se - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "kis_macro_model.h" -#include -#include - -KisMacroModel::KisMacroModel(KisMacro* _macro) : m_macro(_macro) -{ -} - -KisMacroModel::~KisMacroModel() -{ -} - -int KisMacroModel::rowCount(const QModelIndex & parent) const -{ - Q_UNUSED(parent); - return m_macro->actions().count(); -} - -QVariant KisMacroModel::data(const QModelIndex & index, int role) const -{ - if (index.isValid()) { - if (role =3D=3D Qt::DisplayRole || role =3D=3D Qt::EditRole) { - return m_macro->actions()[index.row()]->name(); - } - } - return QVariant(); -} - -bool KisMacroModel::setData(const QModelIndex & index, const QVariant & va= lue, int role) -{ - if (index.isValid()) { - if (role =3D=3D Qt::EditRole) { - m_macro->actions()[index.row()]->setName(value.toString()); - return true; - } - } - return false; -} - -Qt::ItemFlags KisMacroModel::flags(const QModelIndex & index) const -{ - Q_UNUSED(index); - return Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable; -} - -bool KisMacroModel::removeRows(int row, int count, const QModelIndex & par= ent) -{ - beginRemoveRows(parent, row, row + count); - - QList actions; - for (int i =3D row; i < row + count; ++i) { - actions.push_back(m_macro->actions()[i]); - } - m_macro->removeActions(actions); - - endRemoveRows(); - return true; -} - -void KisMacroModel::addAction(const QModelIndex& _after, const KisRecorded= Action& _action) -{ - if(m_macro->actions().isEmpty()) - { - beginInsertRows(QModelIndex(), 0, 0); - m_macro->addAction(_action); - endInsertRows(); - } else { - int row =3D _after.row(); - beginInsertRows(QModelIndex(), row, row); - m_macro->addAction(_action, m_macro->actions().at(row)); - endInsertRows(); - } -} - -void KisMacroModel::duplicateAction(const QModelIndex& index) -{ - if (index.isValid()) { - KisRecordedAction* action =3D m_macro->actions()[index.row()]; - beginInsertRows(QModelIndex(), index.row(), index.row()); - m_macro->addAction(*action, action); - endInsertRows(); - } -} - -void KisMacroModel::raise(const QModelIndex& index) -{ - if (index.isValid()) { - KisRecordedAction* action =3D m_macro->actions()[index.row()]; - KisRecordedAction* before =3D m_macro->actions()[index.row() - 1]; - m_macro->moveAction(action, before); - emit(dataChanged(createIndex(index.row() - 1, 0), index)); - } -} - -void KisMacroModel::lower(const QModelIndex& index) -{ - if (index.isValid()) { - KisRecordedAction* before =3D m_macro->actions()[index.row()]; - KisRecordedAction* action =3D m_macro->actions()[index.row() + 1]; - m_macro->moveAction(action, before); - emit(dataChanged(index, createIndex(index.row() + 1, 0))); - } -} diff --git a/plugins/extensions/bigbrother/actionseditor/kis_macro_model.h = b/plugins/extensions/bigbrother/actionseditor/kis_macro_model.h deleted file mode 100644 index 8cd9189f8c2..00000000000 --- a/plugins/extensions/bigbrother/actionseditor/kis_macro_model.h +++ /dev/null @@ -1,47 +0,0 @@ -/* This file is part of the KDE project - * Copyright (c) 2009 Cyrille Berger - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public Licen= se - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _KIS_MACRO_MODEL_H_ -#define _KIS_MACRO_MODEL_H_ - -#include - -class KisRecordedAction; -class KisMacro; - -class KisMacroModel : public QAbstractListModel -{ -public: - KisMacroModel(KisMacro*); - ~KisMacroModel() override; - int rowCount(const QModelIndex & parent =3D QModelIndex()) const overr= ide; - QVariant data(const QModelIndex & index, int role =3D Qt::DisplayRole)= const override; - Qt::ItemFlags flags(const QModelIndex & index) const override; - bool setData(const QModelIndex & index, const QVariant & value, int ro= le =3D Qt::EditRole) override; - bool removeRows(int row, int count, const QModelIndex & parent =3D QMo= delIndex()) override; - void addAction(const QModelIndex& _after, const KisRecordedAction& _ac= tion); - void duplicateAction(const QModelIndex& index); - void raise(const QModelIndex& index); - void lower(const QModelIndex& index); -private: - KisMacro* m_macro; -}; - - -#endif diff --git a/plugins/extensions/bigbrother/actionseditor/wdgactionseditor.u= i b/plugins/extensions/bigbrother/actionseditor/wdgactionseditor.ui deleted file mode 100644 index f59e0506341..00000000000 --- a/plugins/extensions/bigbrother/actionseditor/wdgactionseditor.ui +++ /dev/null @@ -1,197 +0,0 @@ - - - ActionsEditor - - - - 0 - 0 - 682 - 403 - - - - - - - Qt::Horizontal - - - - - - - Actions: - - - - - - - - - - - - - 0 - 0 - - - - - 32 - 22 - - - - - 22 - 22 - - - - Create a new action - - - - - - QToolButton::MenuButtonPopup - - - true - - - - - - - - 22 - 22 - - - - - 22 - 22 - - - - Duplicate action - - - Duplicate action - - - Duplicate the currently selected action - - - - - - true - - - - - - - - 22 - 22 - - - - - 22 - 22 - - - - Move an action up - - - - - - true - - - - - - - - 22 - 22 - - - - - 22 - 22 - - - - Move an action down - - - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 22 - 22 - - - - - 22 - 22 - - - - Delete the current action - - - - - - true - - - - - - - - - - - - - - - diff --git a/plugins/extensions/bigbrother/bigbrother.cc b/plugins/extensio= ns/bigbrother/bigbrother.cc deleted file mode 100644 index aeaac1beac0..00000000000 --- a/plugins/extensions/bigbrother/bigbrother.cc +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger (cberger@cberger.net) - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as publish= ed by - * the Free Software Foundation; version 2.1 of the License. - * - * This library 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public Licen= se - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-13= 01, USA. - */ - -#include "bigbrother.h" -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "actionseditor/kis_actions_editor.h" -#include "actionseditor/kis_actions_editor_dialog.h" - -#include -#include - - -K_PLUGIN_FACTORY_WITH_JSON(BigBrotherPluginFactory, "kritabigbrother.json"= , registerPlugin();) - -class RecordedActionSaveContext : public KisRecordedActionSaveContext { - public: - void saveGradient(const KoAbstractGradient* ) override {} - void savePattern(const KoPattern* ) override {} -}; - -class RecordedActionLoadContext : public KisRecordedActionLoadContext { - public: - KoAbstractGradient* gradient(const QString& name) const override - { - return KoResourceServerProvider::instance()->gradientServer()-= >resourceByName(name); - } - KoPattern* pattern(const QString& name) const override - { - return KoResourceServerProvider::instance()->patternServer()->= resourceByName(name); - } -}; - -BigBrotherPlugin::BigBrotherPlugin(QObject *parent, const QVariantList &) - : KisActionPlugin(parent) - , m_recorder(0) -{ - if (parent->inherits("KisViewManager")) { - // Open and play action - KisAction* action =3D createAction("Macro_Open_Play"); - connect(action, SIGNAL(triggered()), this, SLOT(slotOpenPlay())); - - // Open and edit action - action =3D createAction("Macro_Open_Edit"); - connect(action, SIGNAL(triggered()), this, SLOT(slotOpenEdit())); - - // Start recording action - m_startRecordingMacroAction =3D createAction("Recording_Start_Reco= rding_Macro"); - connect(m_startRecordingMacroAction, SIGNAL(triggered()), this, SL= OT(slotStartRecordingMacro())); - - // Save recorded action - m_stopRecordingMacroAction =3D createAction("Recording_Stop_Record= ing_Macro"); - connect(m_stopRecordingMacroAction, SIGNAL(triggered()), this, SLO= T(slotStopRecordingMacro())); - m_stopRecordingMacroAction->setEnabled(false); - } -} - -BigBrotherPlugin::~BigBrotherPlugin() -{ - delete m_recorder; -} - -void BigBrotherPlugin::slotOpenPlay() -{ - KisMacro* m =3D openMacro(); - dbgKrita << m; - if (!m) return; - dbgPlugins << "Play the macro"; - KoUpdaterPtr updater =3D viewManager()->createUnthreadedUpdater(i18n("= Playing back macro")); - KisMacroPlayer player(m, KisPlayInfo(viewManager()->image(), viewManag= er()->activeNode()), updater); - player.start(); - while(player.isRunning()) - { - QApplication::processEvents(); - } - dbgPlugins << "Finished"; - delete m; -} - - -void BigBrotherPlugin::slotOpenEdit() -{ - KisMacro *macro =3D openMacro(); - if (!macro) return; - KisActionsEditorDialog aed(viewManager()->mainWindow()); - - aed.actionsEditor()->setMacro(macro); - - if (aed.exec() =3D=3D QDialog::Accepted) { - saveMacro(macro); - } - - delete macro; -} - -void BigBrotherPlugin::slotStartRecordingMacro() -{ - dbgPlugins << "Start recording macro"; - if (m_recorder) return; - // Alternate actions - m_startRecordingMacroAction->setEnabled(false); - m_stopRecordingMacroAction->setEnabled(true); - - // Create recorder - m_recorder =3D new KisMacro(); - connect(viewManager()->image()->actionRecorder(), SIGNAL(addedAction(c= onst KisRecordedAction&)), - m_recorder, SLOT(addAction(const KisRecordedAction&))); -} - -void BigBrotherPlugin::slotStopRecordingMacro() -{ - dbgPlugins << "Stop recording macro"; - if (!m_recorder) return; - // Alternate actions - m_startRecordingMacroAction->setEnabled(true); - m_stopRecordingMacroAction->setEnabled(false); - // Save the macro - saveMacro(m_recorder); - // Delete recorder - delete m_recorder; - m_recorder =3D 0; -} - -KisMacro* BigBrotherPlugin::openMacro() -{ - QStringList mimeFilter; - mimeFilter << "*.krarec|Recorded actions (*.krarec)"; - - KoFileDialog dialog(viewManager()->mainWindow(), KoFileDialog::OpenFil= e, "OpenDocument"); - dialog.setCaption(i18n("Open Macro")); - dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::= PicturesLocation)); - dialog.setMimeTypeFilters(QStringList() << "application/x-krita-record= ed-macro"); - QString filename =3D dialog.filename(); - RecordedActionLoadContext loadContext; - - if (!filename.isNull()) { - QDomDocument doc; - QFile f(filename); - if (f.exists()) { - dbgPlugins << f.open(QIODevice::ReadOnly); - QString err; - int line, col; - if (!doc.setContent(&f, &err, &line, &col)) { - // TODO error message - dbgPlugins << err << " line =3D " << line << " col =3D " <= < col; - f.close(); - return 0; - } - f.close(); - QDomElement docElem =3D doc.documentElement(); - if (!docElem.isNull() && docElem.tagName() =3D=3D "RecordedAct= ions") { - dbgPlugins << "Load the macro"; - KisMacro* m =3D new KisMacro(); - m->fromXML(docElem, &loadContext); - return m; - } else { - // TODO error message - } - } else { - dbgPlugins << "Unexistant file : " << filename; - } - } - return 0; -} - -void BigBrotherPlugin::saveMacro(const KisMacro* macro) -{ - KoFileDialog dialog(viewManager()->mainWindow(), KoFileDialog::SaveFil= e, "bigbrother"); - dialog.setCaption(i18n("Save Macro")); - dialog.setMimeTypeFilters(QStringList() << "application/x-krita-record= ed-macro"); - - QString filename =3D dialog.filename(); - - if (!filename.isNull()) { - QDomDocument doc; - QDomElement e =3D doc.createElement("RecordedActions"); - RecordedActionSaveContext context; - macro->toXML(doc, e, &context); - - doc.appendChild(e); - QFile f(filename); - f.open(QIODevice::WriteOnly); - QTextStream stream(&f); - stream.setCodec("UTF-8"); - doc.save(stream, 2); - f.close(); - } -} - -#include "bigbrother.moc" diff --git a/plugins/extensions/bigbrother/bigbrother.h b/plugins/extension= s/bigbrother/bigbrother.h deleted file mode 100644 index c53b4c2fb4b..00000000000 --- a/plugins/extensions/bigbrother/bigbrother.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2007 Cyrille Berger (cberger@cberger.net) - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as publish= ed by - * the Free Software Foundation; version 2.1 of the License. - * - * This library 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public Licen= se - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-13= 01, USA. - */ - -#ifndef _BIGBROTHER_H_ -#define _BIGBROTHER_H_ - -#include -#include - -class KisAction; -class KisMacro; -class KisViewManager; - -class BigBrotherPlugin : public KisActionPlugin -{ - Q_OBJECT -public: - BigBrotherPlugin(QObject *parent, const QVariantList &); - ~BigBrotherPlugin() override; - -private Q_SLOTS: - - void slotOpenPlay(); - void slotOpenEdit(); - void slotStartRecordingMacro(); - void slotStopRecordingMacro(); - -private: - void saveMacro(const KisMacro* macro); - KisMacro *openMacro(); -private: - KisMacro *m_recorder; - KisAction *m_startRecordingMacroAction; - KisAction *m_stopRecordingMacroAction; - -}; - -#endif // bigbrotherPlugin_H diff --git a/plugins/extensions/bigbrother/bigbrother.xmlgui b/plugins/exte= nsions/bigbrother/bigbrother.xmlgui deleted file mode 100644 index 8ed27965c36..00000000000 --- a/plugins/extensions/bigbrother/bigbrother.xmlgui +++ /dev/null @@ -1,15 +0,0 @@ - - - - &Tools - Recording - - - - Macros - - - - - - diff --git a/plugins/extensions/bigbrother/kritabigbrother.json b/plugins/e= xtensions/bigbrother/kritabigbrother.json deleted file mode 100644 index 1ac545995cd..00000000000 --- a/plugins/extensions/bigbrother/kritabigbrother.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - - "Id": "bigbrother", - "Type": "Service", - "X-KDE-Library": "kritabigbrother", - "X-KDE-ServiceTypes": [ - "Krita/ViewPlugin" - ], - "X-Krita-Version": "28" -} diff --git a/plugins/tools/basictools/kis_tool_ellipse.cc b/plugins/tools/b= asictools/kis_tool_ellipse.cc index f06a8d4bbec..926b61fce7c 100644 --- a/plugins/tools/basictools/kis_tool_ellipse.cc +++ b/plugins/tools/basictools/kis_tool_ellipse.cc @@ -31,11 +31,6 @@ #include "kis_figure_painting_tool_helper.h" #include = -#include -#include -#include - - KisToolEllipse::KisToolEllipse(KoCanvasBase * canvas) : KisToolEllipseBase(canvas, KisToolEllipseBase::PAINT, KisCursor:= :load("tool_ellipse_cursor.png", 6, 6)) { @@ -59,12 +54,6 @@ void KisToolEllipse::finishRect(const QRectF& rect) if (rect.isEmpty() || !blockUntilOperationsFinished()) return; = - if (image()) { - KisRecordedShapePaintAction linePaintAction(KisNodeQueryPath::abso= lutePath(currentNode()), currentPaintOpPreset(), KisRecordedShapePaintActio= n::Ellipse, rect); - setupPaintAction(&linePaintAction); - image()->actionRecorder()->addAction(linePaintAction); - } - if (!currentNode()->inherits("KisShapeLayer")) { KisFigurePaintingToolHelper helper(kundo2_i18n("Draw Ellipse"), image(), diff --git a/plugins/tools/basictools/kis_tool_fill.cc b/plugins/tools/basi= ctools/kis_tool_fill.cc index 4f5a155b90c..35d23d27aa4 100644 --- a/plugins/tools/basictools/kis_tool_fill.cc +++ b/plugins/tools/basictools/kis_tool_fill.cc @@ -49,9 +49,6 @@ #include #include #include -#include -#include -#include #include "kis_resources_snapshot.h" = #include @@ -127,23 +124,6 @@ void KisToolFill::endPrimaryAction(KoPointerEvent *eve= nt) return; } = - // TODO: remove this block after recording refactoring - if (image()) { - KisNodeSP projectionNode; - if(m_unmerged) { - projectionNode =3D currentNode(); - } else { - projectionNode =3D image()->root(); - } - KisRecordedFillPaintAction paintAction(KisNodeQueryPath::absoluteP= ath(currentNode()), m_startPos, KisNodeQueryPath::absolutePath(projectionNo= de)); - setupPaintAction(&paintAction); - paintAction.setPattern(currentPattern()); - if(m_usePattern) { - paintAction.setFillStyle(KisPainter::FillStylePattern); - } - image()->actionRecorder()->addAction(paintAction); - } - bool useFastMode =3D m_useFastMode->isChecked(); = KisProcessingApplicator applicator(currentImage(), currentNode(), diff --git a/plugins/tools/basictools/kis_tool_line.cc b/plugins/tools/basi= ctools/kis_tool_line.cc index 358efd9451c..91d87d23e61 100644 --- a/plugins/tools/basictools/kis_tool_line.cc +++ b/plugins/tools/basictools/kis_tool_line.cc @@ -41,16 +41,9 @@ #include "kis_figure_painting_tool_helper.h" #include "kis_canvas2.h" = - -#include -#include -#include - #include "kis_painting_information_builder.h" #include "kis_tool_line_helper.h" = -#define ENABLE_RECORDING - const KisCoordinatesConverter* getCoordinatesConverter(KoCanvasBase * canv= as) { KisCanvas2 *kritaCanvas =3D dynamic_cast(canvas); @@ -237,7 +230,7 @@ void KisToolLine::continuePrimaryAction(KoPointerEvent = *event) if (m_chkShowPreview->isChecked()) { // If the cursor has moved a significant amount, immediately clear= the // current preview and redraw. Otherwise, do slow redraws periodic= ally. - auto updateDistance =3D (pixelToView(m_lastUpdatedPoint) - pixelTo= View(pos)).manhattanLength(); = + auto updateDistance =3D (pixelToView(m_lastUpdatedPoint) - pixelTo= View(pos)).manhattanLength(); if (updateDistance > 10) { m_helper->clearPaint(); m_longStrokeUpdateCompressor.stop(); diff --git a/plugins/tools/basictools/kis_tool_line_helper.cpp b/plugins/to= ols/basictools/kis_tool_line_helper.cpp index 195a8595ae1..230b358999f 100644 --- a/plugins/tools/basictools/kis_tool_line_helper.cpp +++ b/plugins/tools/basictools/kis_tool_line_helper.cpp @@ -38,11 +38,9 @@ struct KisToolLineHelper::Private }; = KisToolLineHelper::KisToolLineHelper(KisPaintingInformationBuilder *infoBu= ilder, - const KUndo2MagicString &transactionT= ext, - KisRecordingAdapter *recordingAdapter) + const KUndo2MagicString &transactionT= ext) : KisToolFreehandHelper(infoBuilder, transactionText, - recordingAdapter, new KisSmoothingOptions(false)), m_d(new Private(infoBuilder)) { diff --git a/plugins/tools/basictools/kis_tool_line_helper.h b/plugins/tool= s/basictools/kis_tool_line_helper.h index 4fbb62913dc..a8f15e15161 100644 --- a/plugins/tools/basictools/kis_tool_line_helper.h +++ b/plugins/tools/basictools/kis_tool_line_helper.h @@ -26,8 +26,7 @@ class KisToolLineHelper : private KisToolFreehandHelper { public: KisToolLineHelper(KisPaintingInformationBuilder *infoBuilder, - const KUndo2MagicString &transactionText, - KisRecordingAdapter *recordingAdapter =3D 0); + const KUndo2MagicString &transactionText); = ~KisToolLineHelper() override; = diff --git a/plugins/tools/basictools/kis_tool_multihand.cpp b/plugins/tool= s/basictools/kis_tool_multihand.cpp index 8da94a46f33..bfc025155f6 100644 --- a/plugins/tools/basictools/kis_tool_multihand.cpp +++ b/plugins/tools/basictools/kis_tool_multihand.cpp @@ -60,8 +60,7 @@ KisToolMultihand::KisToolMultihand(KoCanvasBase *canvas) = m_helper =3D new KisToolMultihandHelper(paintingInformationBuilder(), - kundo2_i18n("Multibrush Stroke"), - recordingAdapter()); + kundo2_i18n("Multibrush Stroke")); resetHelper(m_helper); if (image()) { m_axesPoint =3D QPointF(0.5 * image()->width(), 0.5 * image()->hei= ght()); diff --git a/plugins/tools/basictools/kis_tool_rectangle.cc b/plugins/tools= /basictools/kis_tool_rectangle.cc index 52be92cb970..72d8e5c1bc7 100644 --- a/plugins/tools/basictools/kis_tool_rectangle.cc +++ b/plugins/tools/basictools/kis_tool_rectangle.cc @@ -31,10 +31,6 @@ #include "kis_shape_tool_helper.h" #include "kis_figure_painting_tool_helper.h" = -#include -#include -#include - #include #include = @@ -62,12 +58,6 @@ void KisToolRectangle::finishRect(const QRectF &rect) if (rect.isNull() || !blockUntilOperationsFinished()) return; = - if (image()) { - KisRecordedShapePaintAction linePaintAction(KisNodeQueryPath::abso= lutePath(currentNode()), currentPaintOpPreset(), KisRecordedShapePaintActio= n::Rectangle, rect); - setupPaintAction(&linePaintAction); - image()->actionRecorder()->addAction(linePaintAction); - } - if (!currentNode()->inherits("KisShapeLayer")) { KisFigurePaintingToolHelper helper(kundo2_i18n("Draw Rectangle"), image(), diff --git a/plugins/tools/tool_polygon/kis_tool_polygon.cc b/plugins/tools= /tool_polygon/kis_tool_polygon.cc index 3ba7af25bcd..cbd7fe17afa 100644 --- a/plugins/tools/tool_polygon/kis_tool_polygon.cc +++ b/plugins/tools/tool_polygon/kis_tool_polygon.cc @@ -31,12 +31,6 @@ #include #include "kis_figure_painting_tool_helper.h" = -#include -#include -#include - - - KisToolPolygon::KisToolPolygon(KoCanvasBase *canvas) : KisToolPolylineBase(canvas, KisToolPolylineBase::PAINT, KisCurs= or::load("tool_polygon_cursor.png", 6, 6)) { @@ -58,15 +52,6 @@ void KisToolPolygon::finishPolyline(const QVector& points) { if (!blockUntilOperationsFinished()) return; = - if (image()) { - KisRecordedPathPaintAction linePaintAction(KisNodeQueryPath::absol= utePath(currentNode()), - currentPaintOpPreset(), - KisDistanceInitInfo()); - setupPaintAction(&linePaintAction); - linePaintAction.addPolyLine(points.toList()); - linePaintAction.addLine(KisPaintInformation(points.last()), KisPai= ntInformation(points.first())); - image()->actionRecorder()->addAction(linePaintAction); - } if (!currentNode()->inherits("KisShapeLayer")) { KisFigurePaintingToolHelper helper(kundo2_i18n("Draw Polygon"), image(), diff --git a/plugins/tools/tool_polyline/kis_tool_polyline.cc b/plugins/too= ls/tool_polyline/kis_tool_polyline.cc index 5ceb6343387..6148d448e6f 100644 --- a/plugins/tools/tool_polyline/kis_tool_polyline.cc +++ b/plugins/tools/tool_polyline/kis_tool_polyline.cc @@ -30,12 +30,6 @@ #include #include "kis_figure_painting_tool_helper.h" = -#include -#include -#include - - - KisToolPolyline::KisToolPolyline(KoCanvasBase * canvas) : KisToolPolylineBase(canvas, KisToolPolylineBase::PAINT, KisCurso= r::load("tool_polyline_cursor.png", 6, 6)) { @@ -62,14 +56,6 @@ void KisToolPolyline::finishPolyline(const QVector& points) { if (!blockUntilOperationsFinished()) return; = - if (image()) { - KisRecordedPathPaintAction linePaintAction(KisNodeQueryPath::absol= utePath(currentNode()), - currentPaintOpPreset(), - KisDistanceInitInfo()); - setupPaintAction(&linePaintAction); - linePaintAction.addPolyLine(points.toList()); - image()->actionRecorder()->addAction(linePaintAction); - } if (!currentNode()->inherits("KisShapeLayer")) { KisFigurePaintingToolHelper helper(kundo2_i18n("Draw Polyline"), image(),