Merge branch 'develop' into ryzomclassic-develop

ryzomclassic-develop
kaetemi 4 years ago
commit 374601e8d1

@ -1265,9 +1265,11 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
return 0; return 0;
} }
#ifdef WM_UNICHAR
// https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar // https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar
if (message == WM_UNICHAR) if (message == WM_UNICHAR)
return (wParam == UNICODE_NOCHAR); return (wParam == UNICODE_NOCHAR);
#endif
return DefWindowProcW(hWnd, message, wParam, lParam); return DefWindowProcW(hWnd, message, wParam, lParam);
} }

@ -183,9 +183,11 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
return 0; return 0;
} }
#ifdef WM_UNICHAR
// https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar // https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar
if (message == WM_UNICHAR) if (message == WM_UNICHAR)
return (wParam == UNICODE_NOCHAR); return (wParam == UNICODE_NOCHAR);
#endif
return trapMessage ? 0 : DefWindowProcW(hWnd, message, wParam, lParam); return trapMessage ? 0 : DefWindowProcW(hWnd, message, wParam, lParam);
} }

@ -119,9 +119,11 @@ namespace NLGUI
// - "_" that should be the character with the lowest part // - "_" that should be the character with the lowest part
// - A with an accent for the highest part // - A with an accent for the highest part
// https://www.compart.com/en/unicode/U+00C4 // https://www.compart.com/en/unicode/U+00C4
_FontSizingChars = { (u32char)'_', 0x000000C4 }; static const u32char chars[] = { (u32char)'_', 0x000000C4, 0 };
_FontSizingChars = chars;
// fallback if SizingChars are not supported by font // fallback if SizingChars are not supported by font
_FontSizingFallback = { (u32char)'|' }; static const u32char fallback[] = { (u32char)'|', 0 };
_FontSizingFallback = fallback;
computeFontSize (); computeFontSize ();
} }
@ -954,13 +956,15 @@ namespace NLGUI
} }
// "_Ä" lowest/highest chars (underscore, A+diaeresis) // "_Ä" lowest/highest chars (underscore, A+diaeresis)
_FontSizingChars = { (u32char)'_', 0x000000C4 }; static const u32char chars[] = { (u32char)'_', 0x000000C4, 0 };
_FontSizingChars = chars;
prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_chars" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_chars" );
if (prop) if (prop)
_FontSizingChars = CUtfStringView((const char*)prop).toUtf32(); _FontSizingChars = CUtfStringView((const char*)prop).toUtf32();
// fallback if SizingChars are not supported by font // fallback if SizingChars are not supported by font
_FontSizingFallback = { (u32char)'|' }; static const u32char fallback[] = { (u32char)'|', 0 };
_FontSizingFallback = fallback;
prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_fallback" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"sizing_fallback" );
if (prop) if (prop)
_FontSizingFallback = CUtfStringView((const char*)prop).toUtf32(); _FontSizingFallback = CUtfStringView((const char*)prop).toUtf32();
@ -2199,7 +2203,7 @@ namespace NLGUI
if (_ClampRight) if (_ClampRight)
{ {
CUtfStringView sv(_Text); CUtfStringView sv(_Text);
::u32string ucStrLetter = u32string(1, (u32char)' '); ::u32string ucStrLetter = ::u32string(1, (u32char)' ');
for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it) for (CUtfStringView::iterator it(sv.begin()), end(sv.end()); it != end; ++it)
{ {
ucStrLetter[0] = *it; ucStrLetter[0] = *it;
@ -2226,7 +2230,7 @@ namespace NLGUI
{ {
// FIXME: Optimize reverse UTF iteration // FIXME: Optimize reverse UTF iteration
::u32string uctext = CUtfStringView(_Text).toUtf32(); ::u32string uctext = CUtfStringView(_Text).toUtf32();
::u32string ucStrLetter = u32string(1, (u32char)' '); ::u32string ucStrLetter = ::u32string(1, (u32char)' ');
for (sint i = (sint)uctext.size() - 1; i >= 0; --i) for (sint i = (sint)uctext.size() - 1; i >= 0; --i)
{ {
ucStrLetter[0] = uctext[i]; ucStrLetter[0] = uctext[i];

@ -228,8 +228,12 @@ namespace NLGUI
while(NLMISC::strFindReplace(result, "{ros_exit}", "")); while(NLMISC::strFindReplace(result, "{ros_exit}", ""));
// Modify the text? // Modify the text?
if(_StringModifier) if (_StringModifier)
_StringModifier->onReceiveTextId(ucstring::makeFromUtf8(result)); {
ucstring tmp = ucstring::makeFromUtf8(result);
_StringModifier->onReceiveTextId(tmp); // FIXME: UTF-8
result = tmp.toUtf8();
}
// Set the Text // Set the Text
if(_IsTextFormatTaged) if(_IsTextFormatTaged)

@ -459,9 +459,11 @@ namespace NLMISC
{ {
return handleWMCopyData(hwnd, (COPYDATASTRUCT *) lParam); return handleWMCopyData(hwnd, (COPYDATASTRUCT *) lParam);
} }
#ifdef WM_UNICHAR
// https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar // https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-unichar
if (uMsg == WM_UNICHAR) if (uMsg == WM_UNICHAR)
return (wParam == UNICODE_NOCHAR); return (wParam == UNICODE_NOCHAR);
#endif
return DefWindowProc(hwnd, uMsg, wParam, lParam); return DefWindowProc(hwnd, uMsg, wParam, lParam);
} }

@ -162,6 +162,7 @@ bool CWinEventEmitter::processMessage (HWND hWnd, uint32 msg, WPARAM wParam, LPA
server->postEvent (new CEventKeyUp ((NLMISC::TKey)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this)); server->postEvent (new CEventKeyUp ((NLMISC::TKey)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this));
} }
break; break;
#ifdef WM_UNICHAR
case WM_UNICHAR: case WM_UNICHAR:
if (wParam != UNICODE_NOCHAR && _KeyboardEventsEnabled) if (wParam != UNICODE_NOCHAR && _KeyboardEventsEnabled)
{ {
@ -170,11 +171,15 @@ bool CWinEventEmitter::processMessage (HWND hWnd, uint32 msg, WPARAM wParam, LPA
server->postEvent (new CEventChar ((u32char)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this)); server->postEvent (new CEventChar ((u32char)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this));
} }
break; break;
#endif
case WM_CHAR: case WM_CHAR:
if (_KeyboardEventsEnabled) if (_KeyboardEventsEnabled)
{ {
//if (wParam < KeyCount) //if (wParam < KeyCount)
//nlinfo("WM_CHAR with %u", wParam); //nlinfo("WM_CHAR with %u", wParam);
#ifndef WM_UNICHAR
// FIXME: Combine UTF-16 pairs
#endif
server->postEvent (new CEventChar ((ucchar)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this)); server->postEvent (new CEventChar ((ucchar)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this));
} }
break; break;

@ -42,13 +42,13 @@ void CGeneralSettingsWidget::load()
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
std::vector<std::string> codes = NLMISC::CI18N::getLanguageCodes(); std::vector<std::string> codes = NLMISC::CI18N::getLanguageCodes();
std::vector<ucstring> names = NLMISC::CI18N::getLanguageNames(); std::vector<std::string> names = NLMISC::CI18N::getLanguageNames();
languageComboBox->clear(); languageComboBox->clear();
for(uint i = 0; i < codes.size(); ++i) for(uint i = 0; i < codes.size(); ++i)
{ {
languageComboBox->addItem(QString::fromUtf16(names[i].c_str()), QString::fromUtf8(codes[i].c_str())); languageComboBox->addItem(QString::fromUtf8(names[i].c_str()), QString::fromUtf8(codes[i].c_str()));
} }
sint32 cbIndex = getIndexForLanguageCode( QString::fromUtf8( s.config.getString( "LanguageCode" ).c_str() ) ); sint32 cbIndex = getIndexForLanguageCode( QString::fromUtf8( s.config.getString( "LanguageCode" ).c_str() ) );

Loading…
Cancel
Save