This commit is contained in:
恍兮惚兮 2024-03-28 00:31:53 +08:00
parent 6834f6809d
commit 68f178e451
4 changed files with 19 additions and 5 deletions

View File

@ -53,6 +53,7 @@
#define LblFilterRepeat L"Filter repetition" #define LblFilterRepeat L"Filter repetition"
#define LblCodePage L"Default codepage" #define LblCodePage L"Default codepage"
#define LblMaxBuff L"Max buffer size" #define LblMaxBuff L"Max buffer size"
#define LblMaxHist L"Max history size"
#define LblAutoAttach L"Auto attach" #define LblAutoAttach L"Auto attach"
#define LblAutoAttach_savedonly L"Auto attach (saved only)" #define LblAutoAttach_savedonly L"Auto attach (saved only)"
#define MenuCopyHookCode L"CopyHookCode" #define MenuCopyHookCode L"CopyHookCode"

View File

@ -53,6 +53,7 @@
#define LblFilterRepeat L"过滤重复文本" #define LblFilterRepeat L"过滤重复文本"
#define LblCodePage L"默认代码页" #define LblCodePage L"默认代码页"
#define LblMaxBuff L"最大缓冲区长度" #define LblMaxBuff L"最大缓冲区长度"
#define LblMaxHist L"最大缓存文本长度"
#define LblAutoAttach L"自动附加" #define LblAutoAttach L"自动附加"
#define LblAutoAttach_savedonly L"自动附加 (仅限保存过配置的游戏)" #define LblAutoAttach_savedonly L"自动附加 (仅限保存过配置的游戏)"
#define MenuCopyHookCode L"复制特殊码" #define MenuCopyHookCode L"复制特殊码"

View File

@ -56,6 +56,7 @@ void LunaHost::savesettings()
configs->set("flushDelay",TextThread::flushDelay); configs->set("flushDelay",TextThread::flushDelay);
configs->set("filterRepetition",TextThread::filterRepetition); configs->set("filterRepetition",TextThread::filterRepetition);
configs->set("maxBufferSize",TextThread::maxBufferSize); configs->set("maxBufferSize",TextThread::maxBufferSize);
configs->set("maxHistorySize",TextThread::maxHistorySize);
configs->set("defaultCodepage",Host::defaultCodepage); configs->set("defaultCodepage",Host::defaultCodepage);
configs->set("autoattachexes",autoattachexes); configs->set("autoattachexes",autoattachexes);
configs->set("savedhookcontext",savedhookcontext); configs->set("savedhookcontext",savedhookcontext);
@ -67,6 +68,7 @@ void LunaHost::loadsettings(){
TextThread::flushDelay=configs->get("flushDelay",TextThread::flushDelay); TextThread::flushDelay=configs->get("flushDelay",TextThread::flushDelay);
TextThread::filterRepetition=configs->get("filterRepetition",TextThread::filterRepetition); TextThread::filterRepetition=configs->get("filterRepetition",TextThread::filterRepetition);
TextThread::maxBufferSize=configs->get("maxBufferSize",TextThread::maxBufferSize); TextThread::maxBufferSize=configs->get("maxBufferSize",TextThread::maxBufferSize);
TextThread::maxHistorySize=configs->get("maxHistorySize",TextThread::maxHistorySize);
Host::defaultCodepage=configs->get("defaultCodepage",Host::defaultCodepage); Host::defaultCodepage=configs->get("defaultCodepage",Host::defaultCodepage);
autoattachexes=configs->get("autoattachexes",std::set<std::string>{}); autoattachexes=configs->get("autoattachexes",std::set<std::string>{});
savedhookcontext=configs->get("savedhookcontext",decltype(savedhookcontext){}); savedhookcontext=configs->get("savedhookcontext",decltype(savedhookcontext){});
@ -329,14 +331,14 @@ void LunaHost::on_thread_delete(TextThread& thread){
Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){
int height=30;int curry=10;int space=10; int height=30;int curry=10;int space=10;
int labelwidth=300; int labelwidth=300;int spinwidth=200;
g_timeout = new spinbox(this,std::to_wstring(TextThread::flushDelay),space+labelwidth, curry, 100, height) ; 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; 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; 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; new label(this,LblMaxBuff,10, curry, labelwidth, height);curry+=height+space;
spinmaxbuffsize->onvaluechange=[=](int v){ spinmaxbuffsize->onvaluechange=[=](int v){
@ -344,6 +346,15 @@ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){
}; };
spinmaxbuffsize->setminmax(0,0x7fffffff); 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=new checkbox(this,LblFilterRepeat,10, curry, labelwidth, height);curry+=height+space;
ckbfilterrepeat->onclick=[=](){ ckbfilterrepeat->onclick=[=](){
TextThread::filterRepetition=ckbfilterrepeat->ischecked(); TextThread::filterRepetition=ckbfilterrepeat->ischecked();
@ -385,7 +396,7 @@ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){
} }
}; };
g_codepage->setminmax(0,CP_UTF8); g_codepage->setminmax(0,CP_UTF8);
setcentral(500,500); setcentral(600,500);
settext(WndSetting); settext(WndSetting);
} }
void Pluginwindow::on_size(int w,int h){ void Pluginwindow::on_size(int w,int h){

View File

@ -20,6 +20,7 @@ class Settingwindow:public mainwindow{
checkbox* autoattach; checkbox* autoattach;
checkbox* autoattach_so; checkbox* autoattach_so;
spinbox* spinmaxbuffsize; spinbox* spinmaxbuffsize;
spinbox* spinmaxhistsize;
public: public:
Settingwindow(LunaHost*); Settingwindow(LunaHost*);
}; };