issues/2 issues/3

This commit is contained in:
恍兮惚兮 2024-02-20 23:24:33 +08:00
parent b217875c8c
commit 607f24ca00
6 changed files with 19 additions and 4 deletions

View File

@ -44,6 +44,7 @@
#define BtnAttach L"Attach" #define BtnAttach L"Attach"
#define BtnRefresh L"Refresh" #define BtnRefresh L"Refresh"
#define BtnToClipboard L"to clipboard" #define BtnToClipboard L"to clipboard"
#define BtnReadOnly L"Text box Read only"
#define BtnInsertUserHook L"Insert UserHook" #define BtnInsertUserHook L"Insert UserHook"
#define BtnPlugin L"Plugins" #define BtnPlugin L"Plugins"
#define LblFlushDelay L"flushDelay" #define LblFlushDelay L"flushDelay"

View File

@ -44,6 +44,7 @@
#define BtnAttach L"注入进程" #define BtnAttach L"注入进程"
#define BtnRefresh L"刷新" #define BtnRefresh L"刷新"
#define BtnToClipboard L"复制到剪贴板" #define BtnToClipboard L"复制到剪贴板"
#define BtnReadOnly L"文本框只读"
#define BtnInsertUserHook L"插入特殊码" #define BtnInsertUserHook L"插入特殊码"
#define BtnPlugin L"插件" #define BtnPlugin L"插件"
#define LblFlushDelay L"刷新延迟" #define LblFlushDelay L"刷新延迟"

View File

@ -123,9 +123,9 @@ LunaHost::LunaHost(){
break; break;
} }
}; };
g_showtexts = new textedit(this,L"",10, 330, 200, 200,ES_READONLY|ES_MULTILINE |ES_AUTOVSCROLL| WS_VSCROLL); g_showtexts = new textedit(this,L"",10, 330, 200, 200,ES_MULTILINE |ES_AUTOVSCROLL| WS_VSCROLL);
g_showtexts->setreadonly(configs->get("ReadOnly",true));
TextThread::filterRepetition=configs->get("filterrepeat",false); TextThread::filterRepetition=configs->get("filterrepeat",false);
check_toclipboard=configs->get("ToClipboard",false); check_toclipboard=configs->get("ToClipboard",false);
TextThread::flushDelay=configs->get("flushDelay",TextThread::flushDelay); TextThread::flushDelay=configs->get("flushDelay",TextThread::flushDelay);
@ -200,7 +200,13 @@ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){
host->configs->set("ToClipboard",ck); host->configs->set("ToClipboard",ck);
}; };
g_check_clipboard->setcheck(host->configs->get("ToClipboard",false)); g_check_clipboard->setcheck(host->configs->get("ToClipboard",false));
readonlycheck=new checkbox(this,BtnReadOnly,10,170,200,30);
readonlycheck->onclick=[=](){
auto ck=readonlycheck->ischecked();
((LunaHost*)parent)->g_showtexts->setreadonly(ck);
host->configs->set("ReadOnly",ck);
};
readonlycheck->setcheck(host->configs->get("ReadOnly",true));
g_timeout = new spinbox(this,std::to_wstring(host->configs->get("flushDelay",TextThread::flushDelay)),150, 10, 100, 30) ; g_timeout = new spinbox(this,std::to_wstring(host->configs->get("flushDelay",TextThread::flushDelay)),150, 10, 100, 30) ;
g_codepage = new spinbox(this,std::to_wstring(host->configs->get("codepage",Host::defaultCodepage)),150, 50, 100, 30) ; g_codepage = new spinbox(this,std::to_wstring(host->configs->get("codepage",Host::defaultCodepage)),150, 50, 100, 30) ;
g_timeout->onvaluechange=[=](int v){ g_timeout->onvaluechange=[=](int v){
@ -215,7 +221,7 @@ Settingwindow::Settingwindow(LunaHost* host):mainwindow(host){
} }
}; };
g_codepage->setminmax(0,CP_UTF8); g_codepage->setminmax(0,CP_UTF8);
setcentral(300,240); setcentral(300,300);
settext(WndSetting); settext(WndSetting);
} }
void Pluginwindow::on_size(int w,int h){ void Pluginwindow::on_size(int w,int h){

View File

@ -17,6 +17,7 @@ class Settingwindow:public mainwindow{
spinbox* g_timeout; spinbox* g_timeout;
spinbox* g_codepage; spinbox* g_codepage;
checkbox* g_check_clipboard; checkbox* g_check_clipboard;
checkbox* readonlycheck;
public: public:
Settingwindow(LunaHost*); Settingwindow(LunaHost*);
}; };
@ -46,4 +47,5 @@ public:
void on_size(int w,int h); void on_size(int w,int h);
void on_close(); void on_close();
LunaHost(); LunaHost();
friend class Settingwindow;
}; };

View File

@ -75,6 +75,10 @@ void spinbox::setminmax(int min,int max){
textedit::textedit(mainwindow* parent,const std::wstring& text,int x,int y,int w,int h,DWORD stype):control(parent){ textedit::textedit(mainwindow* parent,const std::wstring& text,int x,int y,int w,int h,DWORD stype):control(parent){
winId=CreateWindowEx(0, L"EDIT", text.c_str(), WS_CHILD | WS_VISIBLE | WS_BORDER|stype , winId=CreateWindowEx(0, L"EDIT", text.c_str(), WS_CHILD | WS_VISIBLE | WS_BORDER|stype ,
x, y, w, h, parent->winId, NULL, NULL, NULL); x, y, w, h, parent->winId, NULL, NULL, NULL);
SendMessage(winId, EM_SETLIMITTEXT, 0, 0);
}
void textedit::setreadonly(bool ro){
SendMessage(winId, EM_SETREADONLY, ro, 0);
} }
void textedit::scrolltoend(){ void textedit::scrolltoend(){
int textLength = GetWindowTextLength(winId); int textLength = GetWindowTextLength(winId);

View File

@ -31,6 +31,7 @@ public:
std::function<void(const std::wstring&)> ontextchange=[&](const std::wstring &text){}; std::function<void(const std::wstring&)> ontextchange=[&](const std::wstring &text){};
void appendtext(const std::wstring&); void appendtext(const std::wstring&);
void scrolltoend(); void scrolltoend();
void setreadonly(bool);
}; };
class spinbox:public control{ class spinbox:public control{
HWND hUpDown; HWND hUpDown;