From 68f178e451b7f806b30aa20a4c5a532f2253568b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Thu, 28 Mar 2024 00:31:53 +0800 Subject: [PATCH] histsize --- Lang/en.h | 1 + Lang/zh.h | 1 + LunaHost/GUI/LunaHost.cpp | 21 ++++++++++++++++----- LunaHost/GUI/LunaHost.h | 1 + 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Lang/en.h b/Lang/en.h index 20884ff..8faa318 100644 --- a/Lang/en.h +++ b/Lang/en.h @@ -53,6 +53,7 @@ #define LblFilterRepeat L"Filter repetition" #define LblCodePage L"Default codepage" #define LblMaxBuff L"Max buffer size" +#define LblMaxHist L"Max history size" #define LblAutoAttach L"Auto attach" #define LblAutoAttach_savedonly L"Auto attach (saved only)" #define MenuCopyHookCode L"CopyHookCode" diff --git a/Lang/zh.h b/Lang/zh.h index e75931b..5d0b676 100644 --- a/Lang/zh.h +++ b/Lang/zh.h @@ -53,6 +53,7 @@ #define LblFilterRepeat L"过滤重复文本" #define LblCodePage L"默认代码页" #define LblMaxBuff L"最大缓冲区长度" +#define LblMaxHist L"最大缓存文本长度" #define LblAutoAttach L"自动附加" #define LblAutoAttach_savedonly L"自动附加 (仅限保存过配置的游戏)" #define MenuCopyHookCode L"复制特殊码" diff --git a/LunaHost/GUI/LunaHost.cpp b/LunaHost/GUI/LunaHost.cpp index a8e66a1..162fd80 100644 --- a/LunaHost/GUI/LunaHost.cpp +++ b/LunaHost/GUI/LunaHost.cpp @@ -56,6 +56,7 @@ void LunaHost::savesettings() configs->set("flushDelay",TextThread::flushDelay); configs->set("filterRepetition",TextThread::filterRepetition); configs->set("maxBufferSize",TextThread::maxBufferSize); + configs->set("maxHistorySize",TextThread::maxHistorySize); configs->set("defaultCodepage",Host::defaultCodepage); configs->set("autoattachexes",autoattachexes); configs->set("savedhookcontext",savedhookcontext); @@ -67,6 +68,7 @@ void LunaHost::loadsettings(){ TextThread::flushDelay=configs->get("flushDelay",TextThread::flushDelay); TextThread::filterRepetition=configs->get("filterRepetition",TextThread::filterRepetition); TextThread::maxBufferSize=configs->get("maxBufferSize",TextThread::maxBufferSize); + TextThread::maxHistorySize=configs->get("maxHistorySize",TextThread::maxHistorySize); Host::defaultCodepage=configs->get("defaultCodepage",Host::defaultCodepage); autoattachexes=configs->get("autoattachexes",std::set{}); savedhookcontext=configs->get("savedhookcontext",decltype(savedhookcontext){}); @@ -329,14 +331,14 @@ void LunaHost::on_thread_delete(TextThread& thread){ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){ int height=30;int curry=10;int space=10; - int labelwidth=300; - g_timeout = new spinbox(this,std::to_wstring(TextThread::flushDelay),space+labelwidth, curry, 100, height) ; + int labelwidth=300;int spinwidth=200; + g_timeout = new spinbox(this,std::to_wstring(TextThread::flushDelay),space+labelwidth, curry, spinwidth, height) ; new label(this,LblFlushDelay,10, curry, labelwidth, height);curry+=height+space; - g_codepage = new spinbox(this,std::to_wstring(Host::defaultCodepage),space+labelwidth, curry, 100, height) ; + g_codepage = new spinbox(this,std::to_wstring(Host::defaultCodepage),space+labelwidth, curry, spinwidth, height) ; new label(this,LblCodePage,10, curry, labelwidth, height);curry+=height+space; - spinmaxbuffsize = new spinbox(this,std::to_wstring(TextThread::maxBufferSize),space+labelwidth, curry, 100, height) ; + spinmaxbuffsize = new spinbox(this,std::to_wstring(TextThread::maxBufferSize),space+labelwidth, curry, spinwidth, height) ; new label(this,LblMaxBuff,10, curry, labelwidth, height);curry+=height+space; spinmaxbuffsize->onvaluechange=[=](int v){ @@ -344,6 +346,15 @@ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){ }; spinmaxbuffsize->setminmax(0,0x7fffffff); + + spinmaxhistsize = new spinbox(this,std::to_wstring(TextThread::maxHistorySize),space+labelwidth, curry, spinwidth, height) ; + new label(this,LblMaxHist,10, curry, labelwidth, height);curry+=height+space; + + spinmaxhistsize->onvaluechange=[=](int v){ + TextThread::maxHistorySize=v; + }; + spinmaxhistsize->setminmax(0,0x7fffffff); + ckbfilterrepeat=new checkbox(this,LblFilterRepeat,10, curry, labelwidth, height);curry+=height+space; ckbfilterrepeat->onclick=[=](){ TextThread::filterRepetition=ckbfilterrepeat->ischecked(); @@ -385,7 +396,7 @@ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){ } }; g_codepage->setminmax(0,CP_UTF8); - setcentral(500,500); + setcentral(600,500); settext(WndSetting); } void Pluginwindow::on_size(int w,int h){ diff --git a/LunaHost/GUI/LunaHost.h b/LunaHost/GUI/LunaHost.h index 48784a3..591f267 100644 --- a/LunaHost/GUI/LunaHost.h +++ b/LunaHost/GUI/LunaHost.h @@ -20,6 +20,7 @@ class Settingwindow:public mainwindow{ checkbox* autoattach; checkbox* autoattach_so; spinbox* spinmaxbuffsize; + spinbox* spinmaxhistsize; public: Settingwindow(LunaHost*); };