about summary refs log tree commit diff
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2012-01-08 13:36:47 +0100
committeroy <Tom_Adams@web.de>2012-01-08 13:36:47 +0100
commita9db705c1497044b32d5a722d484b275af92246a (patch)
tree5e6131a00eb3e0329df323c732fbca72d81f8f10
parentf8b895181a19a53a47c04fd6ed273c36a4c02c21 (diff)
downloadzcatch-a9db705c1497044b32d5a722d484b275af92246a.tar.gz
zcatch-a9db705c1497044b32d5a722d484b275af92246a.zip
fixed that refocus is done when using Home-key in a editor edit box. Closes #821
-rw-r--r--src/game/editor/editor.cpp6
-rw-r--r--src/game/editor/editor.h2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp
index 4f93f4fa..792c735a 100644
--- a/src/game/editor/editor.cpp
+++ b/src/game/editor/editor.cpp
@@ -228,6 +228,7 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str
 
 	if(UI()->LastActiveItem() == pID)
 	{
+		m_EditBoxActive = 2;
 		int Len = str_length(pStr);
 		if(Len == 0)
 			s_AtIndex = 0;
@@ -971,7 +972,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
 	// refocus button
 	TB_Bottom.VSplitLeft(50.0f, &Button, &TB_Bottom);
 	static int s_RefocusButton = 0;
-	if(DoButton_Editor(&s_RefocusButton, "Refocus", m_WorldOffsetX&&m_WorldOffsetY?0:-1, &Button, 0, "[HOME] Restore map focus") || Input()->KeyDown(KEY_HOME))
+	if(DoButton_Editor(&s_RefocusButton, "Refocus", m_WorldOffsetX&&m_WorldOffsetY?0:-1, &Button, 0, "[HOME] Restore map focus") || (m_EditBoxActive == 0 && Input()->KeyDown(KEY_HOME)))
 	{
 		m_WorldOffsetX = 0;
 		m_WorldOffsetY = 0;
@@ -3620,6 +3621,9 @@ void CEditor::Render()
 	// reset tip
 	m_pTooltip = 0;
 
+	if(m_EditBoxActive)
+		--m_EditBoxActive;
+
 	// render checker
 	RenderBackground(View, ms_CheckerTexture, 32.0f, 1.0f);
 
diff --git a/src/game/editor/editor.h b/src/game/editor/editor.h
index f5d43dae..99ec964c 100644
--- a/src/game/editor/editor.h
+++ b/src/game/editor/editor.h
@@ -478,6 +478,7 @@ public:
 
 		m_Mode = MODE_LAYERS;
 		m_Dialog = 0;
+		m_EditBoxActive = 0;
 		m_pTooltip = 0;
 
 		m_GridActive = false;
@@ -567,6 +568,7 @@ public:
 
 	int m_Mode;
 	int m_Dialog;
+	int m_EditBoxActive;
 	const char *m_pTooltip;
 
 	bool m_GridActive;