backspace, tab extension and length calc should work now in chat manager
This commit is contained in:
parent
964c776dcd
commit
30d72c7b3c
|
@ -95,18 +95,15 @@ void ChatManager::keyUp(SDL_KeyboardEvent key) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatManager::textInput(std::string text) {
|
bool ChatManager::textInput(std::string inputText) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] text [%s]\n",__FILE__,__FUNCTION__,__LINE__,text.c_str());
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] inputText [%s]\n",__FILE__,__FUNCTION__,__LINE__,inputText.c_str());
|
||||||
|
|
||||||
int maxTextLenAllowed = (customCB != NULL ? this->maxCustomTextLength : maxTextLenght);
|
int maxTextLenAllowed = (customCB != NULL ? this->maxCustomTextLength : maxTextLenght);
|
||||||
if(editEnabled && (int)text.size() < maxTextLenAllowed) {
|
if(editEnabled && (int)textCharLength.size() < maxTextLenAllowed) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
//space is the first meaningful code
|
textCharLength.push_back(inputText.length());
|
||||||
//wchar_t key = extractKeyPressedUnicode(c);
|
this->text +=inputText;
|
||||||
//wchar_t textAppend[] = { key, 0 };
|
updateAutoCompleteBuffer();
|
||||||
std::wstring widestr = std::wstring(text.begin(), text.end());
|
|
||||||
const wchar_t *textAppend = widestr.c_str();
|
|
||||||
appendText(textAppend);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -351,14 +348,15 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
||||||
void ChatManager::keyPress(SDL_KeyboardEvent c) {
|
void ChatManager::keyPress(SDL_KeyboardEvent c) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c.keysym.sym,c.keysym.sym);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c.keysym.sym,c.keysym.sym);
|
||||||
|
|
||||||
int maxTextLenAllowed = (customCB != NULL ? this->maxCustomTextLength : maxTextLenght);
|
// no more textinput with keyPress in SDL2!
|
||||||
if(editEnabled && (int)text.size() < maxTextLenAllowed) {
|
// int maxTextLenAllowed = (customCB != NULL ? this->maxCustomTextLength : maxTextLenght);
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c.keysym.sym,c.keysym.sym);
|
// if(editEnabled && (int)text.size() < maxTextLenAllowed) {
|
||||||
//space is the first meaningful code
|
// SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c.keysym.sym,c.keysym.sym);
|
||||||
wchar_t key = extractKeyPressedUnicode(c);
|
// //space is the first meaningful code
|
||||||
wchar_t textAppend[] = { key, 0 };
|
// wchar_t key = extractKeyPressedUnicode(c);
|
||||||
appendText(textAppend);
|
// wchar_t textAppend[] = { key, 0 };
|
||||||
}
|
// appendText(textAppend);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatManager::switchOnEdit(CustomInputCallbackInterface *customCB,int maxCustomTextLength) {
|
void ChatManager::switchOnEdit(CustomInputCallbackInterface *customCB,int maxCustomTextLength) {
|
||||||
|
|
|
@ -1218,9 +1218,7 @@ void MenuStateMasterserver::keyDown(SDL_KeyboardEvent key) {
|
||||||
ircClient->SendIRCCmdMessage(IRC_CHANNEL, chatManager.getText());
|
ircClient->SendIRCCmdMessage(IRC_CHANNEL, chatManager.getText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isKeyPressed(SDLK_RETURN,key,false) == true){
|
chatManager.keyDown(key);
|
||||||
chatManager.keyDown(key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(chatManager.getEditEnabled() == false) {
|
if(chatManager.getEditEnabled() == false) {
|
||||||
//if(key == configKeys.getCharKey("ToggleMusic")) {
|
//if(key == configKeys.getCharKey("ToggleMusic")) {
|
||||||
|
|
Loading…
Reference in New Issue