[colobot] 216/390: Close CBot editor by CTRL+Action key (default ENTER), closes #383
Didier Raboud
odyx at moszumanska.debian.org
Fri Jun 12 14:21:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch upstream/latest
in repository colobot.
commit 80c9b35ce281372770a821bba8c79053b431c953
Author: krzys-h <krzys_h at interia.pl>
Date: Tue Nov 11 17:40:48 2014 +0100
Close CBot editor by CTRL+Action key (default ENTER), closes #383
---
src/ui/edit.cpp | 10 +++++-----
src/ui/studio.cpp | 12 ++++++++++++
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index b6e6bbf..1e55705 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -437,26 +437,26 @@ bool CEdit::EventProcess(const Event &event)
return true;
}
- if ( event.key.key == KEY(BACKSPACE) ) // backspace ( <- ) ?
+ if ( event.key.key == KEY(BACKSPACE) && !bControl ) // backspace ( <- ) ?
{
Delete(-1);
SendModifEvent();
return true;
}
- if ( event.key.key == KEY(DELETE) )
+ if ( event.key.key == KEY(DELETE) && !bControl )
{
Delete(1);
SendModifEvent();
return true;
}
- if ( event.key.key == KEY(RETURN) )
+ if ( event.key.key == KEY(RETURN) && !bControl )
{
Insert('\n');
SendModifEvent();
return true;
}
- if ( event.key.key == KEY(TAB) )
+ if ( event.key.key == KEY(TAB) && !bControl )
{
Insert('\t');
SendModifEvent();
@@ -464,7 +464,7 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.type == EVENT_KEY_DOWN && m_bFocus )
+ if ( event.type == EVENT_KEY_DOWN && !bControl && m_bFocus )
{
if (event.key.unicode >= ' ')
{
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index 5f4ca34..5482525 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -125,6 +125,18 @@ bool CStudio::EventProcess(const Event &event)
newEvent.type = EVENT_STUDIO_OK;
m_event->AddEvent(newEvent);
}
+
+ if ( event.type == EVENT_KEY_DOWN )
+ {
+ if ( (event.key.key == m_main->GetInputBinding(INPUT_SLOT_ACTION).primary ||
+ event.key.key == m_main->GetInputBinding(INPUT_SLOT_ACTION).secondary) &&
+ (event.kmodState & KEY_MOD(CTRL)) != 0 )
+ {
+ Event newEvent = event;
+ newEvent.type = EVENT_STUDIO_OK;
+ m_event->AddEvent(newEvent);
+ }
+ }
if ( event.type == EVENT_STUDIO_EDIT ) // text modifief?
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list