Maintenance: [forced, user-approved] CLanguage step 6 (follow-up to #10184): edit-input methods move from the reference struct CLangu
Batch #10185 by ragnarok-clanker: forced by an admin (5 lower score(s), 39 changed function(s)); checked with 66 compiled unit(s), including every includer of Source/Client/Input/Language.h.
This commit is contained in:
parent
044035f45d
commit
45b5ebd97e
14 changed files with 126 additions and 109 deletions
|
|
@ -24,12 +24,12 @@
|
|||
|
||||
// OFFSET: 0x00ACF2A0
|
||||
// FUNCTION: fn_17794
|
||||
void CLanguage::ResetInput() {
|
||||
HIMC context = ImmGetContext(this->window);
|
||||
void CLanguageBase::ResetInput() {
|
||||
HIMC context = ImmGetContext(hWnd);
|
||||
|
||||
if (context) {
|
||||
ImmNotifyIME(context, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
|
||||
ImmReleaseContext(this->window, context);
|
||||
ImmReleaseContext(hWnd, context);
|
||||
}
|
||||
|
||||
this->text.clear();
|
||||
|
|
@ -37,7 +37,7 @@ void CLanguage::ResetInput() {
|
|||
this->anchor = 0;
|
||||
this->composition.clear();
|
||||
this->candidate.clear();
|
||||
this->compositionState = 0;
|
||||
this->candidateCount = 0;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00ACD700
|
||||
|
|
@ -81,16 +81,30 @@ void CLanguage::Insert(const char* value) {
|
|||
|
||||
// OFFSET: 0x00ACF590
|
||||
// FUNCTION: fn_17797
|
||||
void CLanguage::Select(int anchor, int cursor) {
|
||||
void CLanguageBase::Select(int anchor, int cursor) {
|
||||
this->anchor = anchor;
|
||||
this->cursor = cursor;
|
||||
this->anchor = std::clamp(this->anchor, 0, static_cast<int>(this->text.size()));
|
||||
this->cursor = std::clamp(this->cursor, 0, static_cast<int>(this->text.size()));
|
||||
|
||||
if (anchor < 0) {
|
||||
this->anchor = 0;
|
||||
anchor = 0;
|
||||
}
|
||||
|
||||
if (static_cast<unsigned>(anchor) > this->text.size()) {
|
||||
this->anchor = static_cast<int>(this->text.size());
|
||||
}
|
||||
|
||||
if (cursor < 0) {
|
||||
this->cursor = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
this->cursor = static_cast<unsigned>(cursor) > this->text.size() ? static_cast<int>(this->text.size()) : cursor;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00ACE3C0
|
||||
// FUNCTION: fn_17782
|
||||
void CLanguage::CopyDisplayText(std::string& output) const {
|
||||
void CLanguageBase::CopyDisplayText(std::string& output) const {
|
||||
if (&output != &this->text) {
|
||||
output = this->text;
|
||||
}
|
||||
|
|
@ -102,7 +116,7 @@ void CLanguage::CopyDisplayText(std::string& output) const {
|
|||
|
||||
// OFFSET: 0x00ACE420
|
||||
// FUNCTION: fn_17783
|
||||
void CLanguage::Selection(int& anchor, int& cursor) const {
|
||||
void CLanguageBase::Selection(int& anchor, int& cursor) const {
|
||||
anchor = this->anchor;
|
||||
cursor = this->cursor;
|
||||
}
|
||||
|
|
@ -177,7 +191,7 @@ void CLanguage::MoveBack(unsigned codePage) {
|
|||
|
||||
// OFFSET: 0x00ACE440
|
||||
// FUNCTION: fn_45441
|
||||
void CLanguage::SelectionRange(int& begin, int& end) const {
|
||||
void CLanguageBase::SelectionRange(int& begin, int& end) const {
|
||||
if (this->anchor < this->cursor) {
|
||||
begin = this->anchor;
|
||||
end = this->cursor;
|
||||
|
|
@ -206,40 +220,37 @@ void CLanguage::IncreaseSelection(unsigned codePage) {
|
|||
}
|
||||
// OFFSET: 0x00ACE5E0
|
||||
// FUNCTION: fn_17789
|
||||
void CLanguage::AdvanceCursor(int delta) {
|
||||
void CLanguageBase::AdvanceCursor(int delta) {
|
||||
const unsigned length = static_cast<unsigned>(this->text.size());
|
||||
unsigned cursor = static_cast<unsigned>(this->cursor);
|
||||
if (cursor == length) {
|
||||
if (static_cast<unsigned>(this->cursor) == length) {
|
||||
return;
|
||||
}
|
||||
if (cursor > length) {
|
||||
|
||||
if (static_cast<unsigned>(this->cursor) > length) {
|
||||
this->cursor = static_cast<int>(length);
|
||||
} else {
|
||||
unsigned next = cursor + static_cast<unsigned>(delta);
|
||||
if (next <= length) {
|
||||
this->cursor = static_cast<int>(next);
|
||||
}
|
||||
} else if (static_cast<unsigned>(this->cursor) + delta <= length) {
|
||||
this->cursor += delta;
|
||||
}
|
||||
if ((static_cast<unsigned short>(GetKeyState(VK_SHIFT)) >> 8) == 0) {
|
||||
|
||||
if (!static_cast<unsigned char>(static_cast<unsigned short>(GetKeyState(VK_SHIFT)) >> 8)) {
|
||||
this->anchor = this->cursor;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00ACE620
|
||||
// FUNCTION: fn_17790
|
||||
void CLanguage::RetreatCursor(int delta) {
|
||||
void CLanguageBase::RetreatCursor(int delta) {
|
||||
if (this->cursor == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->cursor < 0) {
|
||||
this->cursor = 0;
|
||||
} else {
|
||||
int prev = this->cursor - delta;
|
||||
if (prev >= 0) {
|
||||
this->cursor = prev;
|
||||
}
|
||||
} else if (this->cursor - delta >= 0) {
|
||||
this->cursor -= delta;
|
||||
}
|
||||
if ((static_cast<unsigned short>(GetKeyState(VK_SHIFT)) >> 8) == 0) {
|
||||
|
||||
if (!static_cast<unsigned char>(static_cast<unsigned short>(GetKeyState(VK_SHIFT)) >> 8)) {
|
||||
this->anchor = this->cursor;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,14 +32,9 @@ struct CLanguage {
|
|||
const bool& chatOpen;
|
||||
TextInputSuggestions& suggestions;
|
||||
|
||||
void ResetInput();
|
||||
void DeleteSelection();
|
||||
void Insert(const char* value);
|
||||
void Select(int anchor, int cursor);
|
||||
void CopyDisplayText(std::string& output) const;
|
||||
void Selection(int& anchor, int& cursor) const;
|
||||
|
||||
void SelectionRange(int& begin, int& end) const;
|
||||
|
||||
void RefreshComposition(unsigned codePage);
|
||||
|
||||
|
|
@ -50,8 +45,6 @@ struct CLanguage {
|
|||
|
||||
void IncreaseSelection(unsigned codePage);
|
||||
void SetFlag8C(unsigned char value);
|
||||
void AdvanceCursor(int delta);
|
||||
void RetreatCursor(int delta);
|
||||
|
||||
void Character(unsigned value, LPARAM unused, unsigned codePage);
|
||||
|
||||
|
|
@ -104,6 +97,13 @@ struct CLanguageBase {
|
|||
void SetServicePrefix(std::string prefix);
|
||||
void DeleteSelection();
|
||||
void Insert(const char* value);
|
||||
void ResetInput();
|
||||
void Select(int anchor, int cursor);
|
||||
void Selection(int& anchor, int& cursor) const;
|
||||
void SelectionRange(int& begin, int& end) const;
|
||||
void CopyDisplayText(std::string& output) const;
|
||||
void AdvanceCursor(int delta);
|
||||
void RetreatCursor(int delta);
|
||||
};
|
||||
|
||||
// VTABLE: vt_01607
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include "Client/Input/InputCharset.h"
|
||||
#include "UI/Window/UINewSelectCharWnd.h"
|
||||
#include "Client/Replay.h"
|
||||
#include "UI/Window/WindowPolicy.h"
|
||||
|
|
@ -1089,7 +1090,7 @@ void UIEditCtrl_Currency::Slot19() {
|
|||
CLanguage& input = this->m_edit->input;
|
||||
int anchor;
|
||||
int cursor;
|
||||
input.Selection(anchor, cursor);
|
||||
g_serverLanguage->Selection(anchor, cursor);
|
||||
|
||||
std::string digits = this->text;
|
||||
int separators = 0;
|
||||
|
|
@ -1115,8 +1116,8 @@ void UIEditCtrl_Currency::Slot19() {
|
|||
this->text = formatted;
|
||||
this->Trim();
|
||||
|
||||
input.ResetInput();
|
||||
input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
input.Insert(this->text.c_str());
|
||||
|
||||
const int length = static_cast<int>(this->text.size());
|
||||
|
|
@ -1128,7 +1129,7 @@ void UIEditCtrl_Currency::Slot19() {
|
|||
cursor = 1;
|
||||
}
|
||||
|
||||
input.Select(anchor, cursor);
|
||||
g_serverLanguage->Select(anchor, cursor);
|
||||
this->formattedLength = this->text.size();
|
||||
this->Invalidate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include "Client/Input/InputCharset.h"
|
||||
#include "Client/Input/Language.h"
|
||||
#include "UI/Edit/EditTextState.h"
|
||||
|
||||
|
|
@ -9,8 +10,8 @@ void EditTextState::SetText(const char* value) {
|
|||
this->Trim();
|
||||
|
||||
if (this->focused) {
|
||||
this->input.ResetInput();
|
||||
this->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->input.Insert(this->text.c_str());
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +47,7 @@ void EditTextState::Trim() {
|
|||
// FUNCTION: fn_10778
|
||||
void EditTextState::SelectAll() {
|
||||
if (this->focused) {
|
||||
this->input.Select(0, static_cast<int>(this->input.text.size()));
|
||||
g_serverLanguage->Select(0, static_cast<int>(this->input.text.size()));
|
||||
} else {
|
||||
this->anchor = 0;
|
||||
this->cursor = static_cast<int>(this->text.size());
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include "Client/Input/InputCharset.h"
|
||||
#include "Client/Input/Language.h"
|
||||
#include "Render/Text/TextContext.h"
|
||||
#include "UI/Edit/EditTextState.h"
|
||||
|
|
@ -11,8 +12,8 @@
|
|||
// FUNCTION: fn_10905
|
||||
void EditViewport::Synchronize() {
|
||||
const int previousCursor = this->cursor;
|
||||
this->input.CopyDisplayText(this->text);
|
||||
this->input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->CopyDisplayText(this->text);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
this->state.Trim();
|
||||
const auto length = static_cast<std::uint32_t>(this->text.size());
|
||||
bool clamped = false;
|
||||
|
|
@ -20,7 +21,7 @@ void EditViewport::Synchronize() {
|
|||
if (static_cast<std::uint32_t>(this->cursor) > length || static_cast<std::uint32_t>(this->anchor) > length) {
|
||||
this->anchor = static_cast<int>(std::min(static_cast<std::uint32_t>(this->anchor), length));
|
||||
this->cursor = static_cast<int>(std::min(static_cast<std::uint32_t>(this->cursor), length));
|
||||
this->input.Select(this->anchor, this->cursor);
|
||||
g_serverLanguage->Select(this->anchor, this->cursor);
|
||||
clamped = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include "Client/Input/InputCharset.h"
|
||||
#include "Client/Input/Language.h"
|
||||
#include "Contents/Items/ItemInfo.h"
|
||||
#include "Contents/Items/ItemNaming.h"
|
||||
|
|
@ -396,7 +397,7 @@ void UIItemTagCtrl::sub_8962C0() {
|
|||
const int end = start + bytes + 2;
|
||||
if (cursor > start && cursor < end) {
|
||||
const int target = start + bytes / 2 + 1 > cursor ? end : start;
|
||||
this->m_edit->input.Select(target, target);
|
||||
g_serverLanguage->Select(target, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ void CUIEditCtrlEx::UpdateScrollBar() {
|
|||
// FUNCTION: fn_14446
|
||||
void CUIEditCtrlEx::Synchronize() {
|
||||
if (this == g_windowMgr.GetHoverWindow()) {
|
||||
this->m_edit->input.CopyDisplayText(this->text);
|
||||
g_serverLanguage->CopyDisplayText(this->text);
|
||||
this->RefreshPlaceholder();
|
||||
}
|
||||
this->Trim();
|
||||
|
|
@ -225,7 +225,7 @@ void CUIEditCtrlEx::Synchronize() {
|
|||
|
||||
int anchor = 0;
|
||||
int cursor = 0;
|
||||
this->m_edit->input.Selection(anchor, cursor);
|
||||
g_serverLanguage->Selection(anchor, cursor);
|
||||
int selStart = anchor;
|
||||
int selEnd = cursor;
|
||||
if (selStart > selEnd) {
|
||||
|
|
@ -391,17 +391,17 @@ void CUIEditCtrlEx::HandleKeyDown(int key, std::intptr_t lparam) {
|
|||
break;
|
||||
case VK_END:
|
||||
if ((static_cast<unsigned short>(GetKeyState(VK_CONTROL)) >> 8) != 0) {
|
||||
input.AdvanceCursor(static_cast<int>(this->text.size()) - input.cursor);
|
||||
g_serverLanguage->AdvanceCursor(static_cast<int>(this->text.size()) - input.cursor);
|
||||
} else {
|
||||
input.AdvanceCursor(static_cast<int>(this->lines[this->line].text.size()) - this->column);
|
||||
g_serverLanguage->AdvanceCursor(static_cast<int>(this->lines[this->line].text.size()) - this->column);
|
||||
this->unknown_01DC = 1;
|
||||
}
|
||||
return;
|
||||
case VK_HOME:
|
||||
if ((static_cast<unsigned short>(GetKeyState(VK_CONTROL)) >> 8) != 0) {
|
||||
input.RetreatCursor(input.cursor);
|
||||
g_serverLanguage->RetreatCursor(input.cursor);
|
||||
} else {
|
||||
input.RetreatCursor(this->column);
|
||||
g_serverLanguage->RetreatCursor(this->column);
|
||||
}
|
||||
break;
|
||||
case VK_LEFT:
|
||||
|
|
@ -445,7 +445,7 @@ void CUIEditCtrlEx::HandleKeyDown(int key, std::intptr_t lparam) {
|
|||
break;
|
||||
case 'A':
|
||||
if ((static_cast<unsigned short>(GetKeyState(VK_CONTROL)) >> 8) != 0) {
|
||||
input.Select(0, static_cast<int>(this->text.size()));
|
||||
g_serverLanguage->Select(0, static_cast<int>(this->text.size()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -478,7 +478,7 @@ int CUIEditCtrlEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::
|
|||
case 18:
|
||||
if (this->line > 0) {
|
||||
if (this->unknown_01D4 == this->line - 1) {
|
||||
input.RetreatCursor(this->unknown_01D8);
|
||||
g_serverLanguage->RetreatCursor(this->unknown_01D8);
|
||||
} else {
|
||||
const EditLine& previous = this->lines[this->line - 1];
|
||||
const std::string& current = this->lines[this->line].text;
|
||||
|
|
@ -495,7 +495,7 @@ int CUIEditCtrlEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::
|
|||
}
|
||||
|
||||
const int delta = (previous.unknown_0018 != 0 ? 2 : 0) + static_cast<int>(previous.text.size()) - offset + this->column;
|
||||
input.RetreatCursor(delta);
|
||||
g_serverLanguage->RetreatCursor(delta);
|
||||
this->unknown_01D8 = delta;
|
||||
}
|
||||
this->unknown_01D4 = this->line;
|
||||
|
|
@ -506,7 +506,7 @@ int CUIEditCtrlEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::
|
|||
case 19:
|
||||
if (static_cast<unsigned>(this->line) < this->lines.size() - 1) {
|
||||
if (this->unknown_01D4 == this->line + 1) {
|
||||
input.AdvanceCursor(this->unknown_01D8);
|
||||
g_serverLanguage->AdvanceCursor(this->unknown_01D8);
|
||||
} else {
|
||||
const EditLine& next = this->lines[this->line + 1];
|
||||
const std::string& current = this->lines[this->line].text;
|
||||
|
|
@ -524,7 +524,7 @@ int CUIEditCtrlEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::
|
|||
|
||||
const EditLine& line = this->lines[this->line];
|
||||
const int delta = (line.unknown_0018 != 0 ? 2 : 0) + static_cast<int>(line.text.size()) - this->column + offset;
|
||||
input.AdvanceCursor(delta);
|
||||
g_serverLanguage->AdvanceCursor(delta);
|
||||
this->unknown_01D8 = delta;
|
||||
}
|
||||
this->unknown_01D4 = this->line;
|
||||
|
|
@ -647,9 +647,9 @@ void CUIEditCtrlEx::SetText(const char* value) {
|
|||
|
||||
if (this == g_windowMgr.GetHoverWindow()) {
|
||||
CLanguage& input = this->m_edit->input;
|
||||
input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
input.Insert(this->text.c_str());
|
||||
input.Select(0, static_cast<int>(input.text.size()));
|
||||
g_serverLanguage->Select(0, static_cast<int>(input.text.size()));
|
||||
}
|
||||
|
||||
if (this->text.find("<ITEML>") != std::string::npos || this->text.find("</ITEML>") != std::string::npos) {
|
||||
|
|
|
|||
|
|
@ -451,8 +451,8 @@ void UIEditCtrl::Paint() {
|
|||
// OFFSET: 0x0085AAB0
|
||||
// FUNCTION: fn_10783
|
||||
void UIEditCtrl::Slot23() {
|
||||
this->m_edit->input.ResetInput();
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
this->m_edit->password = this->mask != 0;
|
||||
this->SelectAll();
|
||||
|
|
@ -518,7 +518,7 @@ int UIEditCtrl::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::int
|
|||
UIWindow::SendMsg(sender, message, a, b, c, d);
|
||||
|
||||
if (message == 0 && this->preserveInput == 0) {
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -537,8 +537,8 @@ void UIEditCtrl::SetText(const char* value) {
|
|||
this->Trim();
|
||||
|
||||
if (this->m_edit->focus.window == this) {
|
||||
this->m_edit->input.ResetInput();
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
}
|
||||
|
||||
|
|
@ -1089,8 +1089,8 @@ void UIItemWnd::Slot18() {
|
|||
void UIEditCtrl_Custom::Synchronize() {
|
||||
const int previousCursor = this->cursor;
|
||||
CLanguage& input = this->m_edit->input;
|
||||
input.CopyDisplayText(this->text);
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->CopyDisplayText(this->text);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
this->Trim();
|
||||
|
||||
const auto length = static_cast<unsigned>(this->text.size());
|
||||
|
|
@ -1099,7 +1099,7 @@ void UIEditCtrl_Custom::Synchronize() {
|
|||
if (static_cast<unsigned>(this->cursor) > length || static_cast<unsigned>(this->anchor) > length) {
|
||||
this->anchor = std::min<unsigned>(this->anchor, length);
|
||||
this->cursor = std::min<unsigned>(this->cursor, length);
|
||||
input.Select(this->anchor, this->cursor);
|
||||
g_serverLanguage->Select(this->anchor, this->cursor);
|
||||
clamped = true;
|
||||
}
|
||||
|
||||
|
|
@ -4052,8 +4052,8 @@ void UIEditCtrl_Custom::Trim() {
|
|||
this->text.resize(length - std::strlen(previous));
|
||||
|
||||
CLanguage& input = this->m_edit->input;
|
||||
input.ResetInput();
|
||||
input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
input.Insert(this->text.c_str());
|
||||
|
||||
while (this->text.size() < static_cast<unsigned>(this->maximum)) {
|
||||
|
|
@ -5706,29 +5706,29 @@ int UIEditCtrl_Currency::SendMsg(UIWindow* sender, int message, std::intptr_t a,
|
|||
if (a == VK_BACK) {
|
||||
int anchor;
|
||||
int cursor;
|
||||
this->m_edit->input.Selection(anchor, cursor);
|
||||
g_serverLanguage->Selection(anchor, cursor);
|
||||
|
||||
if (anchor == cursor) {
|
||||
if (cursor <= 2) {
|
||||
if (this->text[1] == ',') {
|
||||
this->m_edit->input.Select(0, 2);
|
||||
g_serverLanguage->Select(0, 2);
|
||||
}
|
||||
} else if (this->text[cursor - 1] == ',') {
|
||||
this->m_edit->input.Select(cursor - 1, cursor - 1);
|
||||
g_serverLanguage->Select(cursor - 1, cursor - 1);
|
||||
}
|
||||
}
|
||||
} else if (a == VK_DELETE) {
|
||||
int anchor;
|
||||
int cursor;
|
||||
this->m_edit->input.Selection(anchor, cursor);
|
||||
g_serverLanguage->Selection(anchor, cursor);
|
||||
|
||||
if (anchor == cursor) {
|
||||
if (cursor == 0) {
|
||||
if (this->text[1] == ',') {
|
||||
this->m_edit->input.Select(0, 2);
|
||||
g_serverLanguage->Select(0, 2);
|
||||
}
|
||||
} else if (this->text[cursor] == ',') {
|
||||
this->m_edit->input.Select(cursor + 1, cursor + 1);
|
||||
g_serverLanguage->Select(cursor + 1, cursor + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7120,7 +7120,7 @@ void UIChatEditCtrl::InsertItemLink(const ITEM_INFO& item) {
|
|||
this->unknown_0144->taggedText = this->text;
|
||||
const std::string name = naming.DisplayName(item, 0);
|
||||
const std::string tag = this->unknown_0144->AppendTag(name);
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(tag.c_str());
|
||||
this->unknown_0144->sub_89CFE0(item, 0x12B8A4);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include "Client/Input/InputCharset.h"
|
||||
#include "Client/Input/Language.h"
|
||||
#include "UI/Window/InputFocus.h"
|
||||
#include "UI/Text/NavigationLink.h"
|
||||
|
|
@ -51,7 +52,7 @@ bool UIEditCtrl::RemoveInvalidLink(std::list<UIWindow*>::iterator& entry) {
|
|||
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);
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(remaining.c_str());
|
||||
this->RemoveChild(button, 1);
|
||||
entry = this->links.erase(entry);
|
||||
|
|
@ -77,14 +78,14 @@ bool UIEditCtrl::RemoveInvalidLink(std::list<UIWindow*>::iterator& entry) {
|
|||
void UIEditCtrl::SetCursor(std::size_t position) {
|
||||
position = std::min(position, this->text.size());
|
||||
this->anchor = this->cursor = static_cast<int>(position);
|
||||
this->m_edit->input.Select(this->cursor, this->cursor);
|
||||
g_serverLanguage->Select(this->cursor, this->cursor);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00855150
|
||||
// FUNCTION: fn_10751
|
||||
void UIEditCtrl::MoveCursorToEnd() {
|
||||
if (this->m_edit->focus.window == this) {
|
||||
this->m_edit->input.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>(this->m_edit->input.text.size()), static_cast<int>(this->m_edit->input.text.size()));
|
||||
return;
|
||||
}
|
||||
this->anchor = static_cast<int>(this->text.size());
|
||||
|
|
@ -103,7 +104,7 @@ void UIEditCtrl::SnapLinkSelection(std::size_t prefix, std::size_t bytes) {
|
|||
|
||||
if (cursor > prefix && cursor < end) {
|
||||
const auto target = prefix + bytes / 2 + 1 <= cursor ? prefix : end;
|
||||
this->m_edit->input.Select(static_cast<int>(target), static_cast<int>(target));
|
||||
g_serverLanguage->Select(static_cast<int>(target), static_cast<int>(target));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +188,7 @@ void UIChatEditCtrl::InsertItemTag(int tagId) {
|
|||
|
||||
const std::string tag = this->unknown_0144->sub_874A40(tagId, 0x7F00E4);
|
||||
const std::string combined = this->text + tag;
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(combined.c_str());
|
||||
this->unknown_0144->taggedText = this->text;
|
||||
}
|
||||
|
|
@ -251,7 +252,7 @@ void UIEditCtrl::InsertLink(const char* value) {
|
|||
|
||||
this->SetText(this->text.c_str());
|
||||
this->anchor = this->cursor = static_cast<int>(this->text.size());
|
||||
this->m_edit->input.Select(this->cursor, this->cursor);
|
||||
g_serverLanguage->Select(this->cursor, this->cursor);
|
||||
|
||||
auto* button = new UINaviLinkButton(*this->m_context, this->m_edit->navigation);
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ int UIEditCtrl3::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
|
|||
return 0;
|
||||
}
|
||||
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
if (this->unknown_0150 < 1 || this->unknown_0154 != this->cursor || scrolling[1] != 0) {
|
||||
const char* current = this->unknown_0160;
|
||||
this->unknown_015E = 0;
|
||||
|
|
@ -147,7 +147,7 @@ int UIEditCtrl3::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
|
|||
this->unknown_0150 = static_cast<int>(std::strlen(this->unknown_0160)) + this->unknown_0144 - column;
|
||||
}
|
||||
|
||||
input.RetreatCursor(this->unknown_0150);
|
||||
g_serverLanguage->RetreatCursor(this->unknown_0150);
|
||||
scrolling[1] = 1;
|
||||
lineMove[0] = 1;
|
||||
} else if (message == 19) {
|
||||
|
|
@ -158,7 +158,7 @@ int UIEditCtrl3::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
|
|||
return 0;
|
||||
}
|
||||
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
if (this->unknown_0150 < 1 || this->unknown_0154 != this->cursor || this->unknown_015E != 0) {
|
||||
scrolling[1] = 0;
|
||||
int bytes = 0;
|
||||
|
|
@ -198,7 +198,7 @@ int UIEditCtrl3::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
|
|||
this->unknown_0150 = this->unknown_0148 + column;
|
||||
}
|
||||
|
||||
input.AdvanceCursor(this->unknown_0150);
|
||||
g_serverLanguage->AdvanceCursor(this->unknown_0150);
|
||||
this->unknown_015E = 1;
|
||||
} else if (message == 256) {
|
||||
scrolling[0] = 0;
|
||||
|
|
@ -209,7 +209,7 @@ int UIEditCtrl3::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
|
|||
return 0;
|
||||
}
|
||||
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
this->unknown_0154 = this->cursor;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -227,7 +227,7 @@ void UIEditCtrl3::HandleInputMessage(unsigned key, std::intptr_t data) {
|
|||
switch (key) {
|
||||
case VK_BACK:
|
||||
if (this->unknown_0168.size() != 0) {
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
int length = 0;
|
||||
for (int line = 0; line < this->textY; ++line) {
|
||||
length += static_cast<int>(std::strlen(this->unknown_0168[line].c_str()));
|
||||
|
|
@ -239,31 +239,31 @@ void UIEditCtrl3::HandleInputMessage(unsigned key, std::intptr_t data) {
|
|||
break;
|
||||
case VK_END:
|
||||
if (this->unknown_0168.size() != 0) {
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
int offset = this->cursor;
|
||||
for (int line = 0; line < this->textY; ++line) {
|
||||
offset -= static_cast<int>(std::strlen(this->unknown_0168[line].c_str()));
|
||||
}
|
||||
const int length = static_cast<int>(std::strlen(this->unknown_0168[this->textY].c_str()));
|
||||
input.AdvanceCursor(this->unknown_0174[this->textY] ? length - offset - 2 : length - offset);
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->AdvanceCursor(this->unknown_0174[this->textY] ? length - offset - 2 : length - offset);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
}
|
||||
reinterpret_cast<unsigned char*>(&this->unknown_0184)[0] = 1;
|
||||
return;
|
||||
case VK_HOME:
|
||||
if (this->unknown_0168.size() != 0) {
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
int offset = this->cursor;
|
||||
for (int line = 0; line < this->textY; ++line) {
|
||||
offset -= static_cast<int>(std::strlen(this->unknown_0168[line].c_str()));
|
||||
}
|
||||
input.RetreatCursor(offset);
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->RetreatCursor(offset);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
}
|
||||
break;
|
||||
case VK_LEFT:
|
||||
if (this->textY > 0) {
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
int length = 0;
|
||||
for (int line = 0; line < this->textY; ++line) {
|
||||
length += static_cast<int>(std::strlen(this->unknown_0168[line].c_str()));
|
||||
|
|
@ -275,7 +275,7 @@ void UIEditCtrl3::HandleInputMessage(unsigned key, std::intptr_t data) {
|
|||
input.KeyDown(key, data, g_textCodePage, password, g_windowMgr.window_4F1FC, this->m_edit->windows, chatWindow);
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
input.Selection(this->anchor, this->cursor);
|
||||
g_serverLanguage->Selection(this->anchor, this->cursor);
|
||||
if (static_cast<unsigned>(this->textY) < this->unknown_0168.size()) {
|
||||
int length = 0;
|
||||
for (int line = 0; line <= this->textY; ++line) {
|
||||
|
|
@ -767,8 +767,8 @@ UIEditCtrl4::~UIEditCtrl4() = default;
|
|||
// FUNCTION: fn_10782
|
||||
void UIEditCtrl4::Slot23() {
|
||||
this->text.clear();
|
||||
this->m_edit->input.ResetInput();
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
this->m_edit->password = this->mask != 0;
|
||||
this->SelectAll();
|
||||
|
|
@ -793,8 +793,8 @@ void UIEditCtrl4::SetPlaceholder(const char* value) {
|
|||
this->Trim();
|
||||
|
||||
if (this->m_edit->focus.window == this) {
|
||||
this->m_edit->input.ResetInput();
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->placeholder.c_str());
|
||||
}
|
||||
|
||||
|
|
@ -889,8 +889,8 @@ void UIEditCtrl3::Trim() {
|
|||
const char* previous = CharPrevExA(static_cast<WORD>(g_textCodePage), this->text.c_str(), next, 0);
|
||||
this->text.resize(length - std::strlen(previous));
|
||||
|
||||
this->m_edit->input.ResetInput();
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
|
||||
while (this->text.size() < static_cast<unsigned>(limit)) {
|
||||
|
|
@ -1025,8 +1025,8 @@ void UIEditCtrlVarId::SetText(const char* value) {
|
|||
// OFFSET: 0x0085AB10
|
||||
// FUNCTION: fn_10784
|
||||
void UIWhisperEditCtrl::Slot23() {
|
||||
this->m_edit->input.ResetInput();
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
this->m_edit->password = this->mask != 0;
|
||||
this->SelectAll();
|
||||
|
|
@ -1170,8 +1170,8 @@ void UIEditCtrl3::SetText(const char* value) {
|
|||
this->Trim();
|
||||
|
||||
if (g_windowMgr.GetHoverWindow() == this) {
|
||||
this->m_edit->input.ResetInput();
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(this->text.c_str());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1767,7 +1767,7 @@ bool UIItemTagCtrl::RemoveInvalidTag(std::list<ItemTagRecord>::iterator& entry)
|
|||
++end;
|
||||
}
|
||||
remaining += this->taggedText.substr(end + bytes);
|
||||
this->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
this->m_edit->input.Insert(remaining.c_str());
|
||||
this->RemoveTagChild(entry->child);
|
||||
entry = this->tags.erase(entry);
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ int UICaptchaRegisterWnd::SendMsg(
|
|||
CRagConnection& connection = GetRagConnection();
|
||||
connection.Send(g_packetLengths.FixedLength(packet.id), &packet);
|
||||
|
||||
reinterpret_cast<CLanguage*>(g_serverLanguage)->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include "Client/Input/InputCharset.h"
|
||||
#include "UI/UIMacroDetectorWnd.h"
|
||||
#include "Client/Input/Language.h"
|
||||
#include "Contents/MessageTable.h"
|
||||
|
|
@ -113,7 +114,7 @@ int UIMacroDetectorWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a,
|
|||
CRagConnection& connection = GetRagConnection();
|
||||
connection.Send(g_packetLengths.FixedLength(packet.id), &packet);
|
||||
this->m_lastAnswer = this->m_editCtrl->Text();
|
||||
this->m_editCtrl->m_edit->input.ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
}
|
||||
}
|
||||
return UIWindow::SendMsg(sender, message, a, b, c, d);
|
||||
|
|
|
|||
|
|
@ -2890,7 +2890,7 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu
|
|||
static_cast<UINavigationWnd*>(g_windowMgr.window_0428)->RefreshWorldMapLevels();
|
||||
}
|
||||
this->LayoutWithDetails();
|
||||
reinterpret_cast<CLanguage*>(g_serverLanguage)->ResetInput();
|
||||
g_serverLanguage->ResetInput();
|
||||
}
|
||||
break;
|
||||
case 0x150:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue