fixed that refocus is done when using Home-key in a editor edit box. Closes #821

This commit is contained in:
oy 2012-01-08 13:36:47 +01:00
parent f8b895181a
commit a9db705c14
2 changed files with 7 additions and 1 deletions

View file

@ -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);

View file

@ -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;