File indexing completed on 2024-06-23 04:28:10

0001 /* This file is part of the KDE project
0002  *
0003  * SPDX-FileCopyrightText: 2006-2007 Thomas Zander <zander@kde.org>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #include "DefaultToolFactory.h"
0009 #include "DefaultTool.h"
0010 
0011 #include <kis_action_registry.h>
0012 
0013 #include <KoIcon.h>
0014 #include <klocalizedstring.h>
0015 
0016 DefaultToolFactory::DefaultToolFactory()
0017     : KoToolFactoryBase(KoInteractionTool_ID)
0018 {
0019     setToolTip(i18n("Select Shapes Tool"));
0020     setSection(ToolBoxSection::Main);
0021     setPriority(0);
0022     setIconName(koIconNameCStr("select"));
0023     setActivationShapeId("flake/always");
0024 }
0025 
0026 DefaultToolFactory::DefaultToolFactory(const QString &id)
0027     : KoToolFactoryBase(id)
0028 {
0029 }
0030 
0031 DefaultToolFactory::~DefaultToolFactory()
0032 {
0033 }
0034 
0035 KoToolBase *DefaultToolFactory::createTool(KoCanvasBase *canvas)
0036 {
0037     return new DefaultTool(canvas, true);
0038 }
0039 
0040 QList<QAction *> DefaultToolFactory::createActionsImpl()
0041 {
0042     KisActionRegistry *actionRegistry = KisActionRegistry::instance();
0043 
0044     QList<QAction *> actions;
0045     actions << actionRegistry->makeQAction("object_order_front", this);
0046     actions << actionRegistry->makeQAction("object_order_raise", this);
0047     actions << actionRegistry->makeQAction("object_order_lower", this);
0048     actions << actionRegistry->makeQAction("object_order_back", this);
0049     actions << actionRegistry->makeQAction("object_align_horizontal_left", this);
0050     actions << actionRegistry->makeQAction("object_align_horizontal_center", this);
0051     actions << actionRegistry->makeQAction("object_align_horizontal_right", this);
0052     actions << actionRegistry->makeQAction("object_align_vertical_top", this);
0053     actions << actionRegistry->makeQAction("object_align_vertical_center", this);
0054     actions << actionRegistry->makeQAction("object_align_vertical_bottom", this);
0055     actions << actionRegistry->makeQAction("object_distribute_horizontal_left", this);
0056     actions << actionRegistry->makeQAction("object_distribute_horizontal_center", this);
0057     actions << actionRegistry->makeQAction("object_distribute_horizontal_right", this);
0058     actions << actionRegistry->makeQAction("object_distribute_horizontal_gaps", this);
0059     actions << actionRegistry->makeQAction("object_distribute_vertical_top", this);
0060     actions << actionRegistry->makeQAction("object_distribute_vertical_center", this);
0061     actions << actionRegistry->makeQAction("object_distribute_vertical_bottom", this);
0062     actions << actionRegistry->makeQAction("object_distribute_vertical_gaps", this);
0063     actions << actionRegistry->makeQAction("object_group", this);
0064     actions << actionRegistry->makeQAction("object_ungroup", this);
0065     actions << actionRegistry->makeQAction("object_transform_rotate_90_cw", this);
0066     actions << actionRegistry->makeQAction("object_transform_rotate_90_ccw", this);
0067     actions << actionRegistry->makeQAction("object_transform_rotate_180", this);
0068     actions << actionRegistry->makeQAction("object_transform_mirror_horizontally", this);
0069     actions << actionRegistry->makeQAction("object_transform_mirror_vertically", this);
0070     actions << actionRegistry->makeQAction("object_transform_reset", this);
0071     actions << actionRegistry->makeQAction("object_unite", this);
0072     actions << actionRegistry->makeQAction("object_intersect", this);
0073     actions << actionRegistry->makeQAction("object_subtract", this);
0074     actions << actionRegistry->makeQAction("object_split", this);
0075 
0076     return actions;
0077 
0078 }