Browse Source

We now filter WM_CHARs containing control codes, so ignoring them in gui code is useless (even harmful)

Bartek Bok 13 years ago
parent
commit
7295a38386
  1. 15
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp
  2. 2
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h
  3. 14
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp
  4. 2
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h

15
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp

@ -72,7 +72,6 @@ pfGUIEditBoxMod::pfGUIEditBoxMod()
{ {
SetFlag( kWantsInterest ); SetFlag( kWantsInterest );
SetFlag( kTakesSpecialKeys ); SetFlag( kTakesSpecialKeys );
fIgnoreNextKey = false;
fEscapedFlag = false; fEscapedFlag = false;
fFirstHalfExitKeyPushed = false; fFirstHalfExitKeyPushed = false;
fSpecialCaptureKeyEventMode = false; fSpecialCaptureKeyEventMode = false;
@ -241,13 +240,6 @@ hsBool pfGUIEditBoxMod::HandleKeyPress( wchar_t key, uint8_t modifiers )
if( fBuffer == nil ) if( fBuffer == nil )
return false; return false;
if( fIgnoreNextKey )
{
// So we don't process keys that already got handled by HandleKeyEvent()
fIgnoreNextKey = false;
return true;
}
int i = wcslen( fBuffer ); int i = wcslen( fBuffer );
// Insert character at the current cursor position, then inc the cursor by one // Insert character at the current cursor position, then inc the cursor by one
@ -330,7 +322,6 @@ hsBool pfGUIEditBoxMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef
// done capturing... tell the handler // done capturing... tell the handler
DoSomething(); DoSomething();
} }
fIgnoreNextKey = true;
fFirstHalfExitKeyPushed = false; fFirstHalfExitKeyPushed = false;
return true; return true;
} }
@ -412,13 +403,7 @@ hsBool pfGUIEditBoxMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef
} }
} }
} }
else
{
fIgnoreNextKey = false;
return true;
}
fIgnoreNextKey = true;
IUpdate(); IUpdate();
return true; return true;
} }

2
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h

@ -66,7 +66,7 @@ class pfGUIEditBoxMod : public pfGUIControlMod
wchar_t *fBuffer; wchar_t *fBuffer;
uint32_t fBufferSize, fCursorPos; uint32_t fBufferSize, fCursorPos;
int32_t fScrollPos; int32_t fScrollPos;
hsBool fIgnoreNextKey, fEscapedFlag; hsBool fEscapedFlag;
hsBool fFirstHalfExitKeyPushed; hsBool fFirstHalfExitKeyPushed;
hsBool fSpecialCaptureKeyEventMode; hsBool fSpecialCaptureKeyEventMode;

14
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp

@ -151,7 +151,6 @@ pfGUIMultiLineEditCtrl::pfGUIMultiLineEditCtrl()
fLastCursorLine = 0; fLastCursorLine = 0;
fBuffer.Append( 0L ); fBuffer.Append( 0L );
fBufferLimit = -1; fBufferLimit = -1;
fIgnoreNextKey = false;
fScrollControl = nil; fScrollControl = nil;
fScrollProc = nil; fScrollProc = nil;
fScrollPos = 0; fScrollPos = 0;
@ -1036,13 +1035,6 @@ hsBool pfGUIMultiLineEditCtrl::HandleKeyPress( wchar_t key, uint8_t modifiers )
if ((fPrevCtrl || fNextCtrl) && (fLineStarts.GetCount() <= GetFirstVisibleLine())) if ((fPrevCtrl || fNextCtrl) && (fLineStarts.GetCount() <= GetFirstVisibleLine()))
return true; // we're ignoring if we can't actually edit our visible frame (and we're linked) return true; // we're ignoring if we can't actually edit our visible frame (and we're linked)
if( fIgnoreNextKey )
{
// So we don't process keys that already got handled by HandleKeyEvent()
fIgnoreNextKey = false;
return true;
}
// Store info for the event we're about to send out // Store info for the event we're about to send out
fLastKeyModifiers = modifiers; fLastKeyModifiers = modifiers;
fLastKeyPressed = key; fLastKeyPressed = key;
@ -1134,13 +1126,7 @@ hsBool pfGUIMultiLineEditCtrl::HandleKeyEvent( pfGameGUIMgr::EventType event, p
// fEscapedFlag = true; // fEscapedFlag = true;
DoSomething(); // Query WasEscaped() to see if it was escape vs enter DoSomething(); // Query WasEscaped() to see if it was escape vs enter
} }
else
{
fIgnoreNextKey = false;
return true;
}
fIgnoreNextKey = true;
return true; return true;
} }
else else

2
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h

@ -100,7 +100,7 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
hsTArray<int32_t> fLineStarts; hsTArray<int32_t> fLineStarts;
uint16_t fLineHeight, fCurrCursorX, fCurrCursorY; uint16_t fLineHeight, fCurrCursorX, fCurrCursorY;
int32_t fCursorPos, fLastCursorLine; int32_t fCursorPos, fLastCursorLine;
hsBool fIgnoreNextKey, fReadyToRender; hsBool fReadyToRender;
hsBounds3Ext fLastP2PArea; hsBounds3Ext fLastP2PArea;
int8_t fLockCount; int8_t fLockCount;
uint8_t fCalcedFontSize; // The font size that we calced our line height at uint8_t fCalcedFontSize; // The font size that we calced our line height at

Loading…
Cancel
Save