Paste P297

Masterwork From Distant Lands
ActivePublic

Authored by dkazakov on Fri, Feb 1, 1:57 PM.
diff --git a/libs/ui/input/kis_tool_invocation_action.cpp b/libs/ui/input/kis_tool_invocation_action.cpp
index a7b501f..792c5d4 100644
--- a/libs/ui/input/kis_tool_invocation_action.cpp
+++ b/libs/ui/input/kis_tool_invocation_action.cpp
@@ -37,12 +37,14 @@ class KisToolInvocationAction::Private
public:
Private()
: active(false),
- lineToolActivated(false)
+ lineToolActivated(false),
+ colorPickerToolActivated(false)
{
}
bool active;
bool lineToolActivated;
+ bool colorPickerToolActivated;
};
KisToolInvocationAction::KisToolInvocationAction()
@@ -57,6 +59,7 @@ KisToolInvocationAction::KisToolInvocationAction()
indexes.insert(i18n("Confirm"), ConfirmShortcut);
indexes.insert(i18n("Cancel"), CancelShortcut);
indexes.insert(i18n("Activate Line Tool"), LineToolShortcut);
+ indexes.insert(i18n("Activate Color Picker Tool"), ColorPickerToolShortcut);
setShortcutIndexes(indexes);
}
@@ -73,6 +76,9 @@ void KisToolInvocationAction::activate(int shortcut)
if (shortcut == LineToolShortcut) {
KoToolManager::instance()->switchToolTemporaryRequested("KritaShape/KisToolLine");
d->lineToolActivated = true;
+ } else if (shortcut == ColorPickerToolShortcut) {
+ KoToolManager::instance()->switchToolTemporaryRequested("KritaSelected/KisToolColorPicker");
+ d->colorPickerToolActivated = true;
}
inputManager()->toolProxy()->activateToolAction(KisTool::Primary);
@@ -88,6 +94,9 @@ void KisToolInvocationAction::deactivate(int shortcut)
if (shortcut == LineToolShortcut && d->lineToolActivated) {
d->lineToolActivated = false;
KoToolManager::instance()->switchBackRequested();
+ } else if (shortcut == ColorPickerToolShortcut && d->colorPickerToolActivated) {
+ d->colorPickerToolActivated = false;
+ KoToolManager::instance()->switchBackRequested();
}
}
@@ -103,7 +112,10 @@ bool KisToolInvocationAction::canIgnoreModifiers() const
void KisToolInvocationAction::begin(int shortcut, QEvent *event)
{
- if (shortcut == ActivateShortcut || shortcut == LineToolShortcut) {
+ if (shortcut == ActivateShortcut ||
+ shortcut == LineToolShortcut ||
+ shortcut == ColorPickerToolShortcut) {
+
d->active =
inputManager()->toolProxy()->forwardEvent(
KisToolProxy::BEGIN, KisTool::Primary, event, event);
diff --git a/libs/ui/input/kis_tool_invocation_action.h b/libs/ui/input/kis_tool_invocation_action.h
index d23c9bc..f6f5a08 100644
--- a/libs/ui/input/kis_tool_invocation_action.h
+++ b/libs/ui/input/kis_tool_invocation_action.h
@@ -34,7 +34,8 @@ public:
ActivateShortcut,
ConfirmShortcut,
CancelShortcut,
- LineToolShortcut
+ LineToolShortcut,
+ ColorPickerToolShortcut
};
explicit KisToolInvocationAction();
~KisToolInvocationAction() override;
dkazakov edited the content of this paste. (Show Details)Fri, Feb 1, 1:57 PM
dkazakov changed the title of this paste from untitled to Masterwork From Distant Lands.