Maintenance: [forced, user-approved] CLanguage step 7 (follow-up to #10185): the remaining edit-input methods move onto the real obje
Batch #10186 by ragnarok-clanker: forced by an admin (9 lower score(s), 41 changed function(s)); checked with 110 compiled unit(s), including every includer of Source/Client/Input/Language.h, Source/UI/Edit/EditTextState.h, Source/UI/Edit/EditViewport.h, Source/UI/Edit/UIEditCtrl.h.
This commit is contained in:
parent
45b5ebd97e
commit
bcaf506c7d
15 changed files with 171 additions and 205 deletions
|
|
@ -71,13 +71,7 @@ void CLanguageBase::Insert(const char* value) {
|
|||
}
|
||||
}
|
||||
|
||||
void CLanguage::DeleteSelection() {
|
||||
g_serverLanguage->DeleteSelection();
|
||||
}
|
||||
|
||||
void CLanguage::Insert(const char* value) {
|
||||
g_serverLanguage->Insert(value);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00ACF590
|
||||
// FUNCTION: fn_17797
|
||||
|
|
@ -128,24 +122,30 @@ void __stdcall SubACDD10() {
|
|||
|
||||
// OFFSET: 0x00ACD5C0
|
||||
// FUNCTION: fn_17765
|
||||
void CLanguage::CopySelection(bool password) {
|
||||
const int length = std::max(this->cursor, this->anchor) - std::min(this->cursor, this->anchor);
|
||||
if (!length || !OpenClipboard(this->window)) {
|
||||
void CLanguageBase::CopySelection() {
|
||||
const int length = std::abs(this->cursor - this->anchor);
|
||||
if (!length || !OpenClipboard(hWnd)) {
|
||||
return;
|
||||
}
|
||||
|
||||
HGLOBAL memory = GlobalAlloc(GMEM_DDESHARE, static_cast<std::uint32_t>(length + 1));
|
||||
HGLOBAL memory = GlobalAlloc(GMEM_DDESHARE, static_cast<std::uint32_t>(std::abs(this->cursor - this->anchor) + 1));
|
||||
if (memory) {
|
||||
auto* data = static_cast<char*>(GlobalLock(memory));
|
||||
if (data) {
|
||||
const int begin = std::min(this->cursor, this->anchor);
|
||||
if (password) {
|
||||
std::memset(data, '*', static_cast<std::uint32_t>(this->text.size()) - static_cast<std::uint32_t>(begin));
|
||||
} else {
|
||||
std::memcpy(data, this->text.data() + begin, length);
|
||||
int begin = this->anchor;
|
||||
int end = this->cursor;
|
||||
if (begin >= end) {
|
||||
begin = this->cursor;
|
||||
end = this->anchor;
|
||||
}
|
||||
|
||||
data[length] = 0;
|
||||
if (this->password) {
|
||||
std::memset(data, '*', static_cast<std::uint32_t>(this->text.size()) - static_cast<std::uint32_t>(begin));
|
||||
} else {
|
||||
std::memcpy(data, this->text.c_str() + begin, end - begin);
|
||||
}
|
||||
|
||||
data[std::abs(this->cursor - this->anchor)] = 0;
|
||||
GlobalUnWire(memory);
|
||||
EmptyClipboard();
|
||||
SetClipboardData(CF_TEXT, memory);
|
||||
|
|
@ -157,12 +157,12 @@ void CLanguage::CopySelection(bool password) {
|
|||
|
||||
// OFFSET: 0x00ACD540
|
||||
// FUNCTION: fn_17764
|
||||
void CLanguage::Paste(UIWindow* blockedFocus, WindowManagerWindows& windows) {
|
||||
if (this->focused == blockedFocus || windows.LookupWindow(278) || windows.LookupWindow(128)) {
|
||||
void CLanguageBase::Paste() {
|
||||
if (g_windowMgr.GetHoverWindow() == g_windowMgr.window_4F1FC || g_windowMgr.LookupWindow(278) || g_windowMgr.LookupWindow(128)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!OpenClipboard(this->window)) {
|
||||
if (!OpenClipboard(hWnd)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -180,12 +180,12 @@ void CLanguage::Paste(UIWindow* blockedFocus, WindowManagerWindows& windows) {
|
|||
|
||||
// OFFSET: 0x00ACD6B0
|
||||
// FUNCTION: fn_17766
|
||||
void CLanguage::MoveBack(unsigned codePage) {
|
||||
void CLanguageBase::MoveBack() {
|
||||
if (this->cursor < 0) {
|
||||
this->cursor = 0;
|
||||
} else if (this->cursor != 0) {
|
||||
const char* begin = this->text.c_str();
|
||||
this->cursor = static_cast<int>(CharPrevExA(static_cast<WORD>(codePage), begin, begin + this->cursor, 0) - begin);
|
||||
this->cursor = static_cast<int>(CharPrevExA(static_cast<WORD>(this->codePage), begin, begin + this->cursor, 0) - begin);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -203,19 +203,19 @@ void CLanguageBase::SelectionRange(int& begin, int& end) const {
|
|||
|
||||
// OFFSET: 0x00ACE4B0
|
||||
// FUNCTION: fn_17786
|
||||
void CLanguage::SetFlag8C(unsigned char value) {
|
||||
reinterpret_cast<unsigned char*>(this)[0x8C] = value;
|
||||
void CLanguageBase::SetPassword(unsigned char value) {
|
||||
this->password = value;
|
||||
}
|
||||
// OFFSET: 0x00ACE4C0
|
||||
// FUNCTION: fn_17787
|
||||
void CLanguage::IncreaseSelection(unsigned codePage) {
|
||||
void CLanguageBase::MoveForward() {
|
||||
const auto length = static_cast<std::uint32_t>(this->text.size());
|
||||
const auto position = static_cast<std::uint32_t>(this->cursor);
|
||||
if (position > length) {
|
||||
this->cursor = static_cast<int>(length);
|
||||
} else if (position < length) {
|
||||
const char* begin = this->text.c_str();
|
||||
this->cursor = static_cast<int>(CharNextExA(static_cast<WORD>(codePage), begin + position, 0) - begin);
|
||||
this->cursor = static_cast<int>(CharNextExA(static_cast<WORD>(this->codePage), begin + position, 0) - begin);
|
||||
}
|
||||
}
|
||||
// OFFSET: 0x00ACE5E0
|
||||
|
|
@ -257,74 +257,85 @@ void CLanguageBase::RetreatCursor(int delta) {
|
|||
|
||||
// OFFSET: 0x00ACE660
|
||||
// FUNCTION: fn_17791
|
||||
void CLanguage::Character(unsigned value, LPARAM, unsigned codePage) {
|
||||
if (value == 8) {
|
||||
void CLanguageBase::Character(unsigned value, LPARAM) {
|
||||
switch (value) {
|
||||
case VK_BACK:
|
||||
if (this->cursor == this->anchor) {
|
||||
this->MoveBack(codePage);
|
||||
this->MoveBack();
|
||||
}
|
||||
|
||||
this->DeleteSelection();
|
||||
return;
|
||||
case VK_TAB:
|
||||
case '\n':
|
||||
case VK_RETURN:
|
||||
case VK_ESCAPE:
|
||||
return;
|
||||
}
|
||||
|
||||
if (value <= 31) {
|
||||
return;
|
||||
}
|
||||
|
||||
char bytes[sizeof(value)];
|
||||
std::memcpy(bytes, &value, sizeof(value));
|
||||
this->Insert(bytes);
|
||||
this->DeleteSelection();
|
||||
const char* bytes = reinterpret_cast<const char*>(&value);
|
||||
this->text.insert(static_cast<std::size_t>(this->cursor), bytes, std::strlen(bytes));
|
||||
this->anchor = this->cursor + static_cast<int>(std::strlen(bytes));
|
||||
this->cursor = this->anchor;
|
||||
|
||||
if (this->text.c_str() && g_windowMgr.unknown_0024 && g_chatSuggestions && g_chatSuggestions->window &&
|
||||
g_windowMgr.GetHoverWindow() == g_chatSuggestions->window) {
|
||||
g_cashEmotionMgr->ProcessChatCommand(this->text.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00ACE880
|
||||
// FUNCTION: fn_17792
|
||||
void CLanguage::KeyDown(
|
||||
unsigned key, LPARAM, unsigned codePage, bool password, UIWindow* blockedPasteFocus, WindowManagerWindows& windows, UIWindow* const& chatArrows
|
||||
) {
|
||||
const auto cut = [&]() {
|
||||
this->CopySelection(password);
|
||||
this->DeleteSelection();
|
||||
};
|
||||
|
||||
if ((static_cast<unsigned short>(GetKeyState(VK_SHIFT)) >> 8) != 0) {
|
||||
void CLanguageBase::KeyDown(unsigned key, LPARAM) {
|
||||
if (static_cast<unsigned char>(static_cast<unsigned short>(GetKeyState(VK_SHIFT)) >> 8)) {
|
||||
switch (key) {
|
||||
case VK_LEFT:
|
||||
this->MoveBack(codePage);
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
this->IncreaseSelection(codePage);
|
||||
case VK_END:
|
||||
this->cursor = static_cast<int>(this->text.size());
|
||||
break;
|
||||
case VK_HOME:
|
||||
this->cursor = 0;
|
||||
break;
|
||||
case VK_END:
|
||||
this->cursor = static_cast<int>(this->text.size());
|
||||
case VK_LEFT:
|
||||
this->MoveBack();
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
this->MoveForward();
|
||||
break;
|
||||
case VK_INSERT:
|
||||
this->Paste(blockedPasteFocus, windows);
|
||||
this->Paste();
|
||||
break;
|
||||
case VK_DELETE:
|
||||
cut();
|
||||
this->CopySelection();
|
||||
this->DeleteSelection();
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ((static_cast<unsigned short>(GetKeyState(VK_CONTROL)) >> 8) != 0) {
|
||||
if (static_cast<unsigned char>(static_cast<unsigned short>(GetKeyState(VK_CONTROL)) >> 8)) {
|
||||
switch (key) {
|
||||
case 'X':
|
||||
cut();
|
||||
break;
|
||||
case 'C':
|
||||
this->CopySelection(password);
|
||||
break;
|
||||
case 'V':
|
||||
this->Paste(blockedPasteFocus, windows);
|
||||
break;
|
||||
case 'A':
|
||||
this->anchor = 0;
|
||||
this->cursor = std::max(static_cast<int>(this->text.size()), 0);
|
||||
this->cursor = static_cast<int>(this->text.size());
|
||||
if (this->cursor < 0) {
|
||||
this->cursor = 0;
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
this->CopySelection();
|
||||
break;
|
||||
case 'V':
|
||||
this->Paste();
|
||||
break;
|
||||
case 'X':
|
||||
this->CopySelection();
|
||||
this->DeleteSelection();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -332,34 +343,39 @@ void CLanguage::KeyDown(
|
|||
}
|
||||
|
||||
switch (key) {
|
||||
case VK_DELETE:
|
||||
if (this->cursor == this->anchor) {
|
||||
this->IncreaseSelection(codePage);
|
||||
}
|
||||
this->DeleteSelection();
|
||||
break;
|
||||
case VK_LEFT:
|
||||
case VK_RIGHT:
|
||||
if (chatArrows && chatArrows->geometry.visible != 0) {
|
||||
chatArrows->SendMsg(nullptr, 176, key, 0, 0, 0);
|
||||
} else {
|
||||
if (key == VK_LEFT) {
|
||||
this->MoveBack(codePage);
|
||||
} else {
|
||||
this->IncreaseSelection(codePage);
|
||||
}
|
||||
|
||||
this->anchor = this->cursor;
|
||||
}
|
||||
case VK_END:
|
||||
this->cursor = static_cast<int>(this->text.size());
|
||||
this->anchor = this->cursor;
|
||||
break;
|
||||
case VK_HOME:
|
||||
this->cursor = 0;
|
||||
this->anchor = 0;
|
||||
break;
|
||||
case VK_END:
|
||||
this->cursor = static_cast<int>(this->text.size());
|
||||
case VK_LEFT:
|
||||
if (g_chatSuggestions && g_chatSuggestions->Visible() && g_chatSuggestions->unknown_013C) {
|
||||
g_chatSuggestions->unknown_013C->SendMsg(nullptr, 176, VK_LEFT, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
this->MoveBack();
|
||||
this->anchor = this->cursor;
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
if (g_chatSuggestions && g_chatSuggestions->Visible() && g_chatSuggestions->unknown_013C) {
|
||||
g_chatSuggestions->unknown_013C->SendMsg(nullptr, 176, VK_RIGHT, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
this->MoveForward();
|
||||
this->anchor = this->cursor;
|
||||
break;
|
||||
case VK_DELETE:
|
||||
if (this->cursor == this->anchor) {
|
||||
this->MoveForward();
|
||||
}
|
||||
|
||||
this->DeleteSelection();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,49 +10,6 @@
|
|||
class UIWindow;
|
||||
#include "UI/Window/WindowManagerWindows.h"
|
||||
|
||||
class TextInputSuggestions {
|
||||
public:
|
||||
virtual void Update(const char* text) = 0;
|
||||
|
||||
protected:
|
||||
~TextInputSuggestions() = default;
|
||||
};
|
||||
|
||||
struct CLanguage {
|
||||
std::string& text;
|
||||
int& cursor;
|
||||
int& anchor;
|
||||
std::string& composition;
|
||||
std::string& candidate;
|
||||
int& compositionState;
|
||||
HWND& window;
|
||||
const bool& suggestionsEnabled;
|
||||
UIWindow* const& focused;
|
||||
UIWindow* const& chatInput;
|
||||
const bool& chatOpen;
|
||||
TextInputSuggestions& suggestions;
|
||||
|
||||
void DeleteSelection();
|
||||
void Insert(const char* value);
|
||||
|
||||
|
||||
void RefreshComposition(unsigned codePage);
|
||||
|
||||
void CopySelection(bool password);
|
||||
void Paste(UIWindow* blockedFocus, WindowManagerWindows& windows);
|
||||
|
||||
void MoveBack(unsigned codePage);
|
||||
|
||||
void IncreaseSelection(unsigned codePage);
|
||||
void SetFlag8C(unsigned char value);
|
||||
|
||||
void Character(unsigned value, LPARAM unused, unsigned codePage);
|
||||
|
||||
void KeyDown(
|
||||
unsigned key, LPARAM unused, unsigned codePage, bool password, UIWindow* blockedPasteFocus, WindowManagerWindows& windows, UIWindow* const& chatArrows
|
||||
);
|
||||
};
|
||||
|
||||
// VTABLE: vt_01604
|
||||
struct CLanguageBase {
|
||||
virtual ~CLanguageBase();
|
||||
|
|
@ -104,6 +61,13 @@ struct CLanguageBase {
|
|||
void CopyDisplayText(std::string& output) const;
|
||||
void AdvanceCursor(int delta);
|
||||
void RetreatCursor(int delta);
|
||||
void CopySelection();
|
||||
void Paste();
|
||||
void MoveBack();
|
||||
void MoveForward();
|
||||
void SetPassword(unsigned char value);
|
||||
void Character(unsigned value, LPARAM unused);
|
||||
void KeyDown(unsigned key, LPARAM unused);
|
||||
};
|
||||
|
||||
// VTABLE: vt_01607
|
||||
|
|
|
|||
|
|
@ -1087,7 +1087,6 @@ void UIEditCtrl_Currency::Slot19() {
|
|||
return;
|
||||
}
|
||||
|
||||
CLanguage& input = this->m_edit->input;
|
||||
int anchor;
|
||||
int cursor;
|
||||
g_serverLanguage->Selection(anchor, cursor);
|
||||
|
|
@ -1118,7 +1117,7 @@ void UIEditCtrl_Currency::Slot19() {
|
|||
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
input.Insert(this->text.c_str());
|
||||
g_serverLanguage->Insert(this->text.c_str());
|
||||
|
||||
const int length = static_cast<int>(this->text.size());
|
||||
anchor += length / 4 - (length - anchor) / 4 - separators;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ void EditTextState::SetText(const char* value) {
|
|||
if (this->focused) {
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->input.Insert(this->text.c_str());
|
||||
g_serverLanguage->Insert(this->text.c_str());
|
||||
}
|
||||
|
||||
this->SelectAll();
|
||||
|
|
@ -47,7 +47,7 @@ void EditTextState::Trim() {
|
|||
// FUNCTION: fn_10778
|
||||
void EditTextState::SelectAll() {
|
||||
if (this->focused) {
|
||||
g_serverLanguage->Select(0, static_cast<int>(this->input.text.size()));
|
||||
g_serverLanguage->Select(0, static_cast<int>(g_serverLanguage->text.size()));
|
||||
} else {
|
||||
this->anchor = 0;
|
||||
this->cursor = static_cast<int>(this->text.size());
|
||||
|
|
@ -56,5 +56,5 @@ void EditTextState::SelectAll() {
|
|||
|
||||
// OFFSET: 0x00858D50
|
||||
int EditTextState::Length() const {
|
||||
return static_cast<int>(this->focused ? this->input.text.size() : this->text.size());
|
||||
return static_cast<int>(this->focused ? g_serverLanguage->text.size() : this->text.size());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
struct CLanguage;
|
||||
struct CLanguageBase;
|
||||
|
||||
struct EditTextState {
|
||||
std::string& text;
|
||||
|
|
@ -12,7 +12,6 @@ struct EditTextState {
|
|||
int& cursor;
|
||||
const int& maximum;
|
||||
const bool& focused;
|
||||
CLanguage& input;
|
||||
const UINT& codePage;
|
||||
|
||||
void SetText(const char* value);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void EditViewport::Synchronize() {
|
|||
}
|
||||
|
||||
const auto selection =
|
||||
static_cast<std::uint32_t>(std::max(this->input.cursor, this->input.anchor)) - static_cast<std::uint32_t>(std::min(this->input.cursor, this->input.anchor));
|
||||
static_cast<std::uint32_t>(std::max(g_serverLanguage->cursor, g_serverLanguage->anchor)) - static_cast<std::uint32_t>(std::min(g_serverLanguage->cursor, g_serverLanguage->anchor));
|
||||
|
||||
if (selection >= length) {
|
||||
this->firstVisible = 0;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
class CDC;
|
||||
class FontCache;
|
||||
struct TextLocale;
|
||||
struct CLanguage;
|
||||
struct CLanguageBase;
|
||||
struct EditTextState;
|
||||
|
||||
struct EditViewport {
|
||||
|
|
@ -17,7 +17,6 @@ struct EditViewport {
|
|||
int& firstVisible;
|
||||
const int& width;
|
||||
const UINT& codePage;
|
||||
CLanguage& input;
|
||||
EditTextState& state;
|
||||
CDC& surface;
|
||||
FontCache& fonts;
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ void UIItemTagCtrl::sub_8962C0() {
|
|||
|
||||
const int bytes = static_cast<int>(std::strlen(fitted.c_str()));
|
||||
if (!g_windowMgr.unknown_0458 || static_cast<UIRodexComposeWnd*>(g_windowMgr.unknown_0458)->m_contents == g_windowMgr.GetHoverWindow()) {
|
||||
const int cursor = this->m_edit->input.cursor;
|
||||
const int cursor = g_serverLanguage->cursor;
|
||||
const int start = static_cast<int>(prefix.size());
|
||||
const int end = start + bytes + 2;
|
||||
if (cursor > start && cursor < end) {
|
||||
|
|
|
|||
|
|
@ -375,23 +375,22 @@ void CUIEditBoxEx::SetBackgroundColor(std::uint32_t color) {
|
|||
// OFFSET: 0x009E4BF0
|
||||
// FUNCTION: fn_14444
|
||||
void CUIEditCtrlEx::HandleKeyDown(int key, std::intptr_t lparam) {
|
||||
CLanguage& input = this->m_edit->input;
|
||||
const bool password = this->m_edit->password != 0;
|
||||
UIWindow* const chatWindow = g_chatSuggestions ? g_chatSuggestions->window : nullptr;
|
||||
|
||||
switch (key) {
|
||||
case VK_BACK:
|
||||
if (std::abs(input.cursor - input.anchor) == 0 && input.cursor >= 2 && input.cursor - 1 < this->text.size()) {
|
||||
const bool lineBreak = this->text.substr(input.cursor - 2, 2) == "\r\n";
|
||||
if (std::abs(g_serverLanguage->cursor - g_serverLanguage->anchor) == 0 && g_serverLanguage->cursor >= 2 && g_serverLanguage->cursor - 1 < this->text.size()) {
|
||||
const bool lineBreak = this->text.substr(g_serverLanguage->cursor - 2, 2) == "\r\n";
|
||||
if (lineBreak) {
|
||||
input.Character(VK_BACK, lparam, g_textCodePage);
|
||||
g_serverLanguage->Character(VK_BACK, lparam);
|
||||
}
|
||||
}
|
||||
this->caretStart = std::chrono::system_clock::now();
|
||||
break;
|
||||
case VK_END:
|
||||
if ((static_cast<unsigned short>(GetKeyState(VK_CONTROL)) >> 8) != 0) {
|
||||
g_serverLanguage->AdvanceCursor(static_cast<int>(this->text.size()) - input.cursor);
|
||||
g_serverLanguage->AdvanceCursor(static_cast<int>(this->text.size()) - g_serverLanguage->cursor);
|
||||
} else {
|
||||
g_serverLanguage->AdvanceCursor(static_cast<int>(this->lines[this->line].text.size()) - this->column);
|
||||
this->unknown_01DC = 1;
|
||||
|
|
@ -399,48 +398,48 @@ void CUIEditCtrlEx::HandleKeyDown(int key, std::intptr_t lparam) {
|
|||
return;
|
||||
case VK_HOME:
|
||||
if ((static_cast<unsigned short>(GetKeyState(VK_CONTROL)) >> 8) != 0) {
|
||||
g_serverLanguage->RetreatCursor(input.cursor);
|
||||
g_serverLanguage->RetreatCursor(g_serverLanguage->cursor);
|
||||
} else {
|
||||
g_serverLanguage->RetreatCursor(this->column);
|
||||
}
|
||||
break;
|
||||
case VK_LEFT:
|
||||
if (input.cursor >= 2 && input.cursor - 1 < this->text.size()) {
|
||||
const bool lineBreak = this->text.substr(input.cursor - 2, 2) == "\r\n";
|
||||
if (g_serverLanguage->cursor >= 2 && g_serverLanguage->cursor - 1 < this->text.size()) {
|
||||
const bool lineBreak = this->text.substr(g_serverLanguage->cursor - 2, 2) == "\r\n";
|
||||
if (lineBreak) {
|
||||
input.KeyDown(key, lparam, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, lparam);
|
||||
}
|
||||
}
|
||||
input.KeyDown(key, lparam, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, lparam);
|
||||
this->caretStart = std::chrono::system_clock::now();
|
||||
break;
|
||||
case VK_UP:
|
||||
case VK_DOWN:
|
||||
return;
|
||||
case VK_RIGHT:
|
||||
if (input.cursor >= 0 && input.cursor + 1 < this->text.size()) {
|
||||
const bool lineBreak = this->text.substr(input.cursor, 2) == "\r\n";
|
||||
if (g_serverLanguage->cursor >= 0 && g_serverLanguage->cursor + 1 < this->text.size()) {
|
||||
const bool lineBreak = this->text.substr(g_serverLanguage->cursor, 2) == "\r\n";
|
||||
if (lineBreak) {
|
||||
input.KeyDown(key, lparam, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, lparam);
|
||||
}
|
||||
}
|
||||
input.KeyDown(key, lparam, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, lparam);
|
||||
this->caretStart = std::chrono::system_clock::now();
|
||||
break;
|
||||
case VK_INSERT:
|
||||
case 'C':
|
||||
case 'V':
|
||||
case 'X':
|
||||
input.KeyDown(key, lparam, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, lparam);
|
||||
break;
|
||||
case VK_DELETE:
|
||||
if (std::abs(input.cursor - input.anchor) == 0 && input.cursor >= 0 && input.cursor + 1 < this->text.size()) {
|
||||
const bool lineBreak = this->text.substr(input.cursor, 2) == "\r\n";
|
||||
if (std::abs(g_serverLanguage->cursor - g_serverLanguage->anchor) == 0 && g_serverLanguage->cursor >= 0 && g_serverLanguage->cursor + 1 < this->text.size()) {
|
||||
const bool lineBreak = this->text.substr(g_serverLanguage->cursor, 2) == "\r\n";
|
||||
if (lineBreak) {
|
||||
input.KeyDown(key, lparam, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, lparam);
|
||||
}
|
||||
}
|
||||
input.KeyDown(key, lparam, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, lparam);
|
||||
this->caretStart = std::chrono::system_clock::now();
|
||||
break;
|
||||
case 'A':
|
||||
|
|
@ -456,12 +455,11 @@ void CUIEditCtrlEx::HandleKeyDown(int key, std::intptr_t lparam) {
|
|||
// OFFSET: 0x009E5B20
|
||||
// FUNCTION: fn_14450
|
||||
int CUIEditCtrlEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
|
||||
CLanguage& input = this->m_edit->input;
|
||||
int position;
|
||||
switch (message) {
|
||||
case 0:
|
||||
if (reinterpret_cast<const unsigned char*>(&this->unknown_0184)[1] != 0 && (static_cast<unsigned short>(GetKeyState(VK_SHIFT)) >> 8) != 0) {
|
||||
input.Insert("\r\n");
|
||||
g_serverLanguage->Insert("\r\n");
|
||||
return 0;
|
||||
}
|
||||
UIWindow::SendMsg(sender, 0, a, b, c, d);
|
||||
|
|
@ -550,7 +548,7 @@ int CUIEditCtrlEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::
|
|||
return 3;
|
||||
}
|
||||
}
|
||||
input.Character(a, b, g_textCodePage);
|
||||
g_serverLanguage->Character(a, b);
|
||||
this->selectedAll = 1;
|
||||
return 3;
|
||||
case WM_IME_COMPOSITION:
|
||||
|
|
@ -646,10 +644,9 @@ void CUIEditCtrlEx::SetText(const char* value) {
|
|||
this->text.assign(value);
|
||||
|
||||
if (this == g_windowMgr.GetHoverWindow()) {
|
||||
CLanguage& input = this->m_edit->input;
|
||||
g_serverLanguage->ResetInput();
|
||||
input.Insert(this->text.c_str());
|
||||
g_serverLanguage->Select(0, static_cast<int>(input.text.size()));
|
||||
g_serverLanguage->Insert(this->text.c_str());
|
||||
g_serverLanguage->Select(0, static_cast<int>(g_serverLanguage->text.size()));
|
||||
}
|
||||
|
||||
if (this->text.find("<ITEML>") != std::string::npos || this->text.find("</ITEML>") != std::string::npos) {
|
||||
|
|
|
|||
|
|
@ -213,7 +213,6 @@ struct EditPainting {
|
|||
const int& height;
|
||||
const int& screenWidth;
|
||||
const int& screenHeight;
|
||||
CLanguage& input;
|
||||
const InputCharset& charset;
|
||||
EditViewport& viewport;
|
||||
CDC& surface;
|
||||
|
|
@ -301,7 +300,7 @@ void EditPainting::Draw() {
|
|||
if (this->mask != 0) {
|
||||
display.assign(this->text.size(), static_cast<char>(this->mask));
|
||||
} else {
|
||||
const char* prefix = this->alternate ? this->input.candidate.c_str() : g_serverLanguage->Prefix(false);
|
||||
const char* prefix = this->alternate ? g_serverLanguage->candidate.c_str() : g_serverLanguage->Prefix(false);
|
||||
display = prefix;
|
||||
display += this->text;
|
||||
const auto prefixBytes = static_cast<unsigned>(std::strlen(prefix));
|
||||
|
|
@ -312,7 +311,7 @@ void EditPainting::Draw() {
|
|||
const int left = begin == 0 ? 0 : measure(display.c_str(), static_cast<int>(begin));
|
||||
const int right = end == 0 ? 0 : measure(display.c_str(), static_cast<int>(end));
|
||||
|
||||
if (this->input.cursor != this->input.anchor) {
|
||||
if (g_serverLanguage->cursor != g_serverLanguage->anchor) {
|
||||
highlight((x + left), (right - left));
|
||||
draw(display);
|
||||
} else if (this->candidateCursor != 0) {
|
||||
|
|
@ -453,7 +452,7 @@ void UIEditCtrl::Paint() {
|
|||
void UIEditCtrl::Slot23() {
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
g_serverLanguage->Insert(this->text.c_str());
|
||||
this->m_edit->password = this->mask != 0;
|
||||
this->SelectAll();
|
||||
}
|
||||
|
|
@ -536,10 +535,10 @@ void UIEditCtrl::SetText(const char* value) {
|
|||
this->text.assign(value, std::strlen(value));
|
||||
this->Trim();
|
||||
|
||||
if (this->m_edit->focus.window == this) {
|
||||
if (g_windowMgr.GetHoverWindow() == this) {
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
g_serverLanguage->Insert(this->text.c_str());
|
||||
}
|
||||
|
||||
this->SelectAll();
|
||||
|
|
@ -552,7 +551,7 @@ void UIEditCtrl::SetText(const char* value) {
|
|||
// OFFSET: 0x0085A590
|
||||
void UIEditCtrl::SelectAll() {
|
||||
const bool focused = this->m_edit->focus.window == this;
|
||||
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, this->m_edit->input, g_textCodePage};
|
||||
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, g_textCodePage};
|
||||
state.SelectAll();
|
||||
}
|
||||
|
||||
|
|
@ -565,7 +564,7 @@ void UIEditCtrl::PaintText() {
|
|||
// INLINED
|
||||
void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placeholder, std::uint32_t placeholderColor, bool placeholderEnabled) {
|
||||
const bool focused = this->m_edit->focus.window == this;
|
||||
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, this->m_edit->input, g_textCodePage};
|
||||
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, g_textCodePage};
|
||||
EditViewport viewport{
|
||||
this->text,
|
||||
this->anchor,
|
||||
|
|
@ -573,7 +572,6 @@ void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placehol
|
|||
this->firstVisible,
|
||||
this->geometry.width,
|
||||
g_textCodePage,
|
||||
this->m_edit->input,
|
||||
state,
|
||||
*this->geometry.surface,
|
||||
g_fontCache,
|
||||
|
|
@ -587,7 +585,7 @@ void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placehol
|
|||
top += window->geometry.y;
|
||||
}
|
||||
|
||||
const bool chat = this->m_edit->input.chatInput == this || this->m_edit->otherChatInput == this;
|
||||
const bool chat = (g_chatSuggestions && g_chatSuggestions->unknown_00BC == this) || this->m_edit->otherChatInput == this;
|
||||
const DWORD tick = timeGetTime();
|
||||
LinkLayout layout(*this);
|
||||
EditPainting painting{
|
||||
|
|
@ -602,14 +600,13 @@ void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placehol
|
|||
this->secondColor,
|
||||
focused,
|
||||
chat,
|
||||
this->m_edit->input.suggestionsEnabled,
|
||||
reinterpret_cast<const bool&>(g_windowMgr.unknown_0024),
|
||||
tick,
|
||||
this->m_edit->candidateCursor,
|
||||
this->geometry.width,
|
||||
this->geometry.height,
|
||||
this->m_edit->screenWidth,
|
||||
this->m_edit->screenHeight,
|
||||
this->m_edit->input,
|
||||
this->m_edit->charset,
|
||||
viewport,
|
||||
*this->geometry.surface,
|
||||
|
|
@ -635,7 +632,7 @@ void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placehol
|
|||
// OFFSET: 0x00862FB0
|
||||
void UIEditCtrl::Synchronize() {
|
||||
const bool focused = this->m_edit->focus.window == this;
|
||||
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, this->m_edit->input, g_textCodePage};
|
||||
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, g_textCodePage};
|
||||
EditViewport viewport{
|
||||
this->text,
|
||||
this->anchor,
|
||||
|
|
@ -643,7 +640,6 @@ void UIEditCtrl::Synchronize() {
|
|||
this->firstVisible,
|
||||
this->geometry.width,
|
||||
g_textCodePage,
|
||||
this->m_edit->input,
|
||||
state,
|
||||
*this->geometry.surface,
|
||||
g_fontCache,
|
||||
|
|
@ -655,14 +651,14 @@ void UIEditCtrl::Synchronize() {
|
|||
// OFFSET: 0x00868450
|
||||
void UIEditCtrl::Trim() {
|
||||
const bool focused = this->m_edit->focus.window == this;
|
||||
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, this->m_edit->input, g_textCodePage};
|
||||
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, g_textCodePage};
|
||||
state.Trim();
|
||||
}
|
||||
|
||||
// OFFSET: 0x00858D50
|
||||
// FUNCTION: fn_10768
|
||||
int UIEditCtrl::Length() const {
|
||||
return static_cast<int>(this->m_edit->focus.window == this ? this->m_edit->input.text.size() : this->text.size());
|
||||
return static_cast<int>(this->m_edit->focus.window == this ? g_serverLanguage->text.size() : this->text.size());
|
||||
}
|
||||
|
||||
// OFFSET: 0x00858D20
|
||||
|
|
@ -1088,7 +1084,6 @@ void UIItemWnd::Slot18() {
|
|||
// FUNCTION: fn_11518
|
||||
void UIEditCtrl_Custom::Synchronize() {
|
||||
const int previousCursor = this->cursor;
|
||||
CLanguage& input = this->m_edit->input;
|
||||
g_serverLanguage->CopyDisplayText(this->text);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
this->Trim();
|
||||
|
|
@ -1110,7 +1105,7 @@ void UIEditCtrl_Custom::Synchronize() {
|
|||
|
||||
std::string visible;
|
||||
|
||||
if (static_cast<unsigned>(std::abs(input.cursor - input.anchor)) >= this->text.size()) {
|
||||
if (static_cast<unsigned>(std::abs(g_serverLanguage->cursor - g_serverLanguage->anchor)) >= this->text.size()) {
|
||||
this->firstVisible = 0;
|
||||
}
|
||||
|
||||
|
|
@ -4051,10 +4046,9 @@ void UIEditCtrl_Custom::Trim() {
|
|||
const char* previous = CharPrevExA(codePage, this->text.c_str(), next, 0);
|
||||
this->text.resize(length - std::strlen(previous));
|
||||
|
||||
CLanguage& input = this->m_edit->input;
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
input.Insert(this->text.c_str());
|
||||
g_serverLanguage->Insert(this->text.c_str());
|
||||
|
||||
while (this->text.size() < static_cast<unsigned>(this->maximum)) {
|
||||
this->text.append(" ", 1);
|
||||
|
|
@ -7121,7 +7115,7 @@ void UIChatEditCtrl::InsertItemLink(const ITEM_INFO& item) {
|
|||
const std::string name = naming.DisplayName(item, 0);
|
||||
const std::string tag = this->unknown_0144->AppendTag(name);
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(tag.c_str());
|
||||
g_serverLanguage->Insert(tag.c_str());
|
||||
this->unknown_0144->sub_89CFE0(item, 0x12B8A4);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include <vector>
|
||||
|
||||
struct InputFocus;
|
||||
struct CLanguage;
|
||||
struct CLanguageBase;
|
||||
struct CLanguageBase;
|
||||
using InputCharset = CLanguageBase;
|
||||
struct BitmapImage;
|
||||
|
|
@ -21,7 +21,6 @@ class UIItemTagOnChat;
|
|||
|
||||
struct UIEditContext {
|
||||
InputFocus& focus;
|
||||
CLanguage& input;
|
||||
unsigned char& password;
|
||||
const InputCharset& charset;
|
||||
WindowManagerWindows& windows;
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ bool UIEditCtrl::RemoveInvalidLink(std::list<UIWindow*>::iterator& entry) {
|
|||
const bool allowed = !this->m_edit->linkInputRestricted || this->m_edit->permittedLinkInput == this->m_edit->focus.window;
|
||||
const auto boundary = left ? absolute + bytes : absolute;
|
||||
|
||||
if (allowed && boundary == static_cast<unsigned>(this->m_edit->input.cursor)) {
|
||||
if (allowed && boundary == static_cast<unsigned>(g_serverLanguage->cursor)) {
|
||||
const auto begin = left ? absolute - 1 : absolute;
|
||||
const auto end = absolute + bytes + (right ? 1 : 0);
|
||||
remaining = this->text.substr(0, begin) + this->text.substr(end);
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(remaining.c_str());
|
||||
g_serverLanguage->Insert(remaining.c_str());
|
||||
this->RemoveChild(button, 1);
|
||||
entry = this->links.erase(entry);
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ void UIEditCtrl::SetCursor(std::size_t position) {
|
|||
// FUNCTION: fn_10751
|
||||
void UIEditCtrl::MoveCursorToEnd() {
|
||||
if (this->m_edit->focus.window == this) {
|
||||
g_serverLanguage->Select(static_cast<int>(this->m_edit->input.text.size()), static_cast<int>(this->m_edit->input.text.size()));
|
||||
g_serverLanguage->Select(static_cast<int>(g_serverLanguage->text.size()), static_cast<int>(g_serverLanguage->text.size()));
|
||||
return;
|
||||
}
|
||||
this->anchor = static_cast<int>(this->text.size());
|
||||
|
|
@ -99,7 +99,7 @@ void UIEditCtrl::SnapLinkSelection(std::size_t prefix, std::size_t bytes) {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto cursor = static_cast<unsigned>(this->m_edit->input.cursor);
|
||||
const auto cursor = static_cast<unsigned>(g_serverLanguage->cursor);
|
||||
const auto end = prefix + bytes + 2;
|
||||
|
||||
if (cursor > prefix && cursor < end) {
|
||||
|
|
@ -121,7 +121,7 @@ void UIEditCtrl::UpdateLinks() {
|
|||
|
||||
for (auto entry = this->links.begin(); entry != this->links.end();) {
|
||||
if (this->RemoveInvalidLink(entry)) {
|
||||
remaining.assign(this->m_edit->input.text.c_str());
|
||||
remaining.assign(g_serverLanguage->text.c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ void UIChatEditCtrl::InsertItemTag(int tagId) {
|
|||
const std::string tag = this->unknown_0144->sub_874A40(tagId, 0x7F00E4);
|
||||
const std::string combined = this->text + tag;
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(combined.c_str());
|
||||
g_serverLanguage->Insert(combined.c_str());
|
||||
this->unknown_0144->taggedText = this->text;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,14 +54,13 @@ int UIEditCtrl2::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
|
|||
// FUNCTION: fn_10912
|
||||
int UIEditCtrl3::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
|
||||
using NextCharHandler = const char*(__thiscall*)(InputCharset*, const char*, int);
|
||||
CLanguage& input = this->m_edit->input;
|
||||
unsigned char* const scrolling = reinterpret_cast<unsigned char*>(&this->unknown_015C);
|
||||
unsigned char* const lineMove = reinterpret_cast<unsigned char*>(&this->unknown_0184);
|
||||
|
||||
if (message == 0) {
|
||||
if (lineMove[1] == 0 || (static_cast<unsigned short>(GetKeyState(VK_SHIFT)) >> 8) != 0 || lineMove[1] == 0) {
|
||||
char newline[] = "\r\n";
|
||||
input.Insert(newline);
|
||||
g_serverLanguage->Insert(newline);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +216,6 @@ int UIEditCtrl3::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
|
|||
// OFFSET: 0x0085E420
|
||||
// FUNCTION: fn_10829
|
||||
void UIEditCtrl3::HandleInputMessage(unsigned key, std::intptr_t data) {
|
||||
CLanguage& input = this->m_edit->input;
|
||||
const bool password = this->m_edit->password != 0;
|
||||
UIWindow* const chatWindow = g_chatSuggestions ? g_chatSuggestions->window : nullptr;
|
||||
|
||||
|
|
@ -233,7 +231,7 @@ void UIEditCtrl3::HandleInputMessage(unsigned key, std::intptr_t data) {
|
|||
length += static_cast<int>(std::strlen(this->unknown_0168[line].c_str()));
|
||||
}
|
||||
if (length == this->cursor && this->unknown_0174[this->textY - 1]) {
|
||||
input.Character(VK_BACK, data, g_textCodePage);
|
||||
g_serverLanguage->Character(VK_BACK, data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -269,10 +267,10 @@ void UIEditCtrl3::HandleInputMessage(unsigned key, std::intptr_t data) {
|
|||
length += static_cast<int>(std::strlen(this->unknown_0168[line].c_str()));
|
||||
}
|
||||
if (length == this->cursor && this->unknown_0174[this->textY - 1]) {
|
||||
input.KeyDown(key, data, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, data);
|
||||
}
|
||||
}
|
||||
input.KeyDown(key, data, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, data);
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
|
|
@ -282,12 +280,12 @@ void UIEditCtrl3::HandleInputMessage(unsigned key, std::intptr_t data) {
|
|||
length += static_cast<int>(std::strlen(this->unknown_0168[line].c_str()));
|
||||
}
|
||||
if (length - 2 == this->cursor && this->unknown_0174[this->textY]) {
|
||||
input.KeyDown(key, data, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
input.KeyDown(key, data, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, data);
|
||||
g_serverLanguage->KeyDown(key, data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
input.KeyDown(key, data, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, data);
|
||||
break;
|
||||
case VK_INSERT:
|
||||
case VK_DELETE:
|
||||
|
|
@ -295,7 +293,7 @@ void UIEditCtrl3::HandleInputMessage(unsigned key, std::intptr_t data) {
|
|||
case 'C':
|
||||
case 'V':
|
||||
case 'X':
|
||||
input.KeyDown(key, data, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
g_serverLanguage->KeyDown(key, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -501,7 +499,7 @@ void UIEditCtrl3::PaintText() {
|
|||
const int y = (line - first) * this->unknown_0138;
|
||||
offset += static_cast<int>(std::strlen(lines[line].c_str()));
|
||||
|
||||
if (g_windowMgr.GetHoverWindow() == this && this->m_edit->input.cursor - this->m_edit->input.anchor != 0) {
|
||||
if (g_windowMgr.GetHoverWindow() == this && g_serverLanguage->cursor - g_serverLanguage->anchor != 0) {
|
||||
const int selectionBegin = this->cursor < this->anchor ? this->cursor : this->anchor;
|
||||
const int selectionEnd = this->anchor < this->cursor ? this->cursor : this->anchor;
|
||||
int startX = 0;
|
||||
|
|
@ -769,7 +767,7 @@ void UIEditCtrl4::Slot23() {
|
|||
this->text.clear();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
g_serverLanguage->Insert(this->text.c_str());
|
||||
this->m_edit->password = this->mask != 0;
|
||||
this->SelectAll();
|
||||
}
|
||||
|
|
@ -795,7 +793,7 @@ void UIEditCtrl4::SetPlaceholder(const char* value) {
|
|||
if (this->m_edit->focus.window == this) {
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->placeholder.c_str());
|
||||
g_serverLanguage->Insert(this->placeholder.c_str());
|
||||
}
|
||||
|
||||
this->SelectAll();
|
||||
|
|
@ -891,7 +889,7 @@ void UIEditCtrl3::Trim() {
|
|||
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
g_serverLanguage->Insert(this->text.c_str());
|
||||
|
||||
while (this->text.size() < static_cast<unsigned>(limit)) {
|
||||
this->text += " ";
|
||||
|
|
@ -1027,7 +1025,7 @@ void UIEditCtrlVarId::SetText(const char* value) {
|
|||
void UIWhisperEditCtrl::Slot23() {
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
g_serverLanguage->Insert(this->text.c_str());
|
||||
this->m_edit->password = this->mask != 0;
|
||||
this->SelectAll();
|
||||
this->SelectAll();
|
||||
|
|
@ -1172,7 +1170,7 @@ void UIEditCtrl3::SetText(const char* value) {
|
|||
if (g_windowMgr.GetHoverWindow() == this) {
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
g_serverLanguage->Insert(this->text.c_str());
|
||||
}
|
||||
|
||||
this->SelectAll();
|
||||
|
|
|
|||
|
|
@ -684,7 +684,7 @@ void UIEditCtrl_Custom::PaintText() {
|
|||
const int left = begin ? this->TextWidth(display.c_str(), begin, 0, 12, 0, 0) : 0;
|
||||
const int right = end ? this->TextWidth(display.c_str(), end, 0, 12, 0, 0) : 0;
|
||||
|
||||
if (std::abs(this->m_edit->input.cursor - this->m_edit->input.anchor) != 0) {
|
||||
if (std::abs(g_serverLanguage->cursor - g_serverLanguage->anchor) != 0) {
|
||||
this->DrawSelection(x + left, right - left);
|
||||
this->DrawLabel(x, y, display.c_str());
|
||||
} else if (this->m_edit->candidateCursor != 0) {
|
||||
|
|
@ -1743,10 +1743,10 @@ bool UIItemTagCtrl::RemoveInvalidTag(std::list<ItemTagRecord>::iterator& entry)
|
|||
bool atCursor;
|
||||
if (before.find("<") != std::string::npos && after.find(">") == std::string::npos) {
|
||||
atCursor = (!g_windowMgr.unknown_0458 || static_cast<UIRodexComposeWnd*>(g_windowMgr.unknown_0458)->m_contents == g_windowMgr.GetHoverWindow()) &&
|
||||
absolute + bytes == this->m_edit->input.cursor;
|
||||
absolute + bytes == g_serverLanguage->cursor;
|
||||
} else if (before.find("<") == std::string::npos && after.find(">") != std::string::npos) {
|
||||
atCursor = (!g_windowMgr.unknown_0458 || static_cast<UIRodexComposeWnd*>(g_windowMgr.unknown_0458)->m_contents == g_windowMgr.GetHoverWindow()) &&
|
||||
absolute == this->m_edit->input.cursor;
|
||||
absolute == g_serverLanguage->cursor;
|
||||
} else if (before.find("<") != std::string::npos && after.find(">") != std::string::npos) {
|
||||
++count;
|
||||
if (count > entry->index) {
|
||||
|
|
@ -1768,7 +1768,7 @@ bool UIItemTagCtrl::RemoveInvalidTag(std::list<ItemTagRecord>::iterator& entry)
|
|||
}
|
||||
remaining += this->taggedText.substr(end + bytes);
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(remaining.c_str());
|
||||
g_serverLanguage->Insert(remaining.c_str());
|
||||
this->RemoveTagChild(entry->child);
|
||||
entry = this->tags.erase(entry);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include "Client/Input/InputCharset.h"
|
||||
#include "Contents/MessageTable.h"
|
||||
#include "Client/Input/Language.h"
|
||||
#include "Contents/Party/AdventurerAgencyMgr.h"
|
||||
|
|
@ -219,7 +220,7 @@ void UIRegisterPartyWnd::SetInfo(CAdvenPartyInfo value) {
|
|||
// INLINED
|
||||
const char* UIRegisterPartyWnd::Text(UIEditCtrl& control) const {
|
||||
const auto& edit = this->m_registration->edits;
|
||||
return edit.focus.window == &control ? edit.input.text.c_str() : control.text.c_str();
|
||||
return edit.focus.window == &control ? g_serverLanguage->text.c_str() : control.text.c_str();
|
||||
}
|
||||
|
||||
// OFFSET: 0x007BBA80
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue