编辑器

新打开的文本字体和当前的字体一样大小
This commit is contained in:
JianjunLiu 2023-04-26 09:12:14 +08:00
parent 6c508d6a31
commit e72305506f
6 changed files with 56 additions and 15 deletions

Binary file not shown.

View File

@ -2797,6 +2797,11 @@ type TEditer=class(TCustomcontrol) //
nn := fl[0,"FileName"]; nn := fl[0,"FileName"];
if(POS("d",fl[0,"Attr"]))then return false; if(POS("d",fl[0,"Attr"]))then return false;
it := new TPageEditerItem(FPageEditer); it := new TPageEditerItem(FPageEditer);
oit := GetCurrentEditer();
if oit then
begin
it.FEditer.font := oit.font;//font;
end
it.FDebuger := FTslDebug; it.FDebuger := FTslDebug;
it.FEditer.OnCaretChanged := thisfunction(EditerCaretChanged); it.FEditer.OnCaretChanged := thisfunction(EditerCaretChanged);
it.FEditer.Parent := FPageEditer; it.FEditer.Parent := FPageEditer;

View File

@ -361,7 +361,8 @@ type tcontrol = class(tcomponent)
begin begin
FFont.SetValues(v); FFont.SetValues(v);
end else end else
if v is class(tfont)then //if v is class(tfont)then
if v is class(Tcustomfont)then
begin begin
FFont.copyfont(v); FFont.copyfont(v);
end end

View File

@ -791,12 +791,13 @@ type tsgtkapi = class(tgtkapis)
if fto then fto := fto[0]; if fto then fto := fto[0];
if fto then //文字处理 if fto then //文字处理
begin begin
fc := fto._getvalue_("facename"); ftod := fto._getdata_();
ht := fto._getvalue_("height"); fc := ftod["facename"];
wd := fto._getvalue_("width"); ht := ftod["height"];
it := fto._getvalue_("italic"); wd := ftod["width"];
wt := fto._getvalue_("weight")=700; it := ftod["italic"];
udl := fto._getvalue_("underline"); wt := ftod["weight"]=700;
udl := ftod["underline"];
fnotset := false; fnotset := false;
{fns := static pango_font_family_get_names(); {fns := static pango_font_family_get_names();
for i,v in fns do for i,v in fns do
@ -2605,7 +2606,7 @@ type tsgtkapi = class(tgtkapis)
begin begin
Fscrolltimedo := makeinstance(thisfunction(docarettime)); Fscrolltimedo := makeinstance(thisfunction(docarettime));
g_gtk_caret_cache_timer:= new ttmstruct(nil); g_gtk_caret_cache_timer:= new ttmstruct(nil);
rt := g_timeout_add(500,Fscrolltimedo,g_gtk_caret_cache_timer._getptr_() ); rt := g_timeout_add(800,Fscrolltimedo,g_gtk_caret_cache_timer._getptr_() );
g_gtk_caret_cache_timer._setvalue_(0,rt); g_gtk_caret_cache_timer._setvalue_(0,rt);
end end
h := g_object_get_data(hwnd,"gtk_window_caret"); //获得caret h := g_object_get_data(hwnd,"gtk_window_caret"); //获得caret
@ -5170,22 +5171,22 @@ type tgtkapis = class() //gtk
ptr:=popen(cmd, "r"); ptr:=popen(cmd, "r");
if((ptr)<>0) then if((ptr)<>0) then
begin begin
while(fgets(buf_ps, len, ptr)<>0) do while(fgets(buf_ps, len-1, ptr)<>0) do
begin begin
for i:= 1 to len do for i:= 1 to len-1 do
begin begin
vi := buf_ps[i]; vi := buf_ps[i];
if vi="\0" then if vi="\0" then
begin begin
break; break;
end end
result += buf_ps[i]; end
end if i>1 then result += buf_ps[1:(i-1)];
end end
pclose(ptr); pclose(ptr);
end end
return result; return result;
end end
function get_proc_comand(); //获得进程命令行 function get_proc_comand(); //获得进程命令行
begin begin
tempdir := sysgetenv("HOME")+"/.tslvcl/proc/"+inttostr(datetoint(date()))+"-"+inttostr(integer(time()*24*60*60)); tempdir := sysgetenv("HOME")+"/.tslvcl/proc/"+inttostr(datetoint(date()))+"-"+inttostr(integer(time()*24*60*60));

View File

@ -7140,7 +7140,7 @@ end
function uinit(); function uinit();
begin begin
{$ifdef linux} {$ifdef linux}
class(tUIglobalData).uisetdata("G_T_TTIMER_",class(TCustomTimer)); //class(tUIglobalData).uisetdata("G_T_TTIMER_",class(TCustomTimer));
{$endif} {$endif}
class(tUIglobalData).uisetdata("G_T_TOOLBAR_",class(tcustomtoolbar)); class(tUIglobalData).uisetdata("G_T_TOOLBAR_",class(tcustomtoolbar));
end end

View File

@ -4,7 +4,7 @@ interface
@explan(˵Ã÷) windowsƽ̨Ïà¹Ø½Ó¿Ú %% @explan(˵Ã÷) windowsƽ̨Ïà¹Ø½Ó¿Ú %%
@date(20220509) %% @date(20220509) %%
**} **}
uses cstructurelib,utslvclauxiliary; uses cstructurelib,utslvclauxiliary,utslvclmemstruct;
type twindowsapi = class() type twindowsapi = class()
private private
static fdefaultwinprochandle; static fdefaultwinprochandle;
@ -381,6 +381,40 @@ type twindowsapi = class()
function memcpy(dst:pointer;src:string;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy"; function memcpy(dst:pointer;src:string;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy";
function memcpy2(var dst:string;src:pointer;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy"; function memcpy2(var dst:string;src:pointer;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy";
function fopen(filename:string; mode:string):pointer;cdecl;external "msvcrt.dll" name "fopen"; function fopen(filename:string; mode:string):pointer;cdecl;external "msvcrt.dll" name "fopen";
function exec_command_line(cmd:string); //执行cmd 并获得打印结果
begin
if not(cmd and ifstring(cmd)) then return "";
r := "";
FBufSize := 1024;
si := new T_startupinfoa();
sa := new T_security_attributes();
pi := new T_process_information();
sa.bInheritHandle := TRUE; //必须为TRUE父进程的读写句柄可以被子进程继承
sa.nLength := sa._size_;
//创建匿名管道
bRet := CreatePipe(hRead, hWrite, sa._getptr_, 0);
if not bRet then return r;
GetStartupInfoA(si._getptr_);
si.dwflags := 0x100;
si.hStdOutput := hWrite;
si.hStdError := hwrite;
p := CreateProcessA(nil,cmd, 0,0,true,0,0,nil,si._getptr_,pi._getptr_);
CloseHandle(hWrite); //关闭写管道
if p then //读取
begin
szReadBuf := "";
setlength(szReadBuf,FBufSize);
nReadNum :=0;
while (ReadFile__(hRead, szReadBuf, FBufSize-1,nReadNum,nil )) do
begin
r+= szreadbuf[1:nreadnum];
nReadNum := 0;
end
end
//GetExitCodeProcess(pi.hProcess,0);
CloseHandle(hRead); //关闭读管道
return r;
end
function fclose(f:pointer):integer;cdecl;external "msvcrt.dll" name "fclose"; function fclose(f:pointer):integer;cdecl;external "msvcrt.dll" name "fclose";
function GetProcessId(h:pointer):integer;stdcall;external "Kernel32.dll" name "GetProcessId"; function GetProcessId(h:pointer):integer;stdcall;external "Kernel32.dll" name "GetProcessId";
function LockFile(hFile:pointer; dwFileOffsetLow:integer; dwFileOffsetHigh:integer;nNumberOfBytesToLockLow:integer;nNumberOfBytesToLockHigh:integer):integer;stdcall;external "Kernel32.dll" name "LockFile"; function LockFile(hFile:pointer; dwFileOffsetLow:integer; dwFileOffsetHigh:integer;nNumberOfBytesToLockLow:integer;nNumberOfBytesToLockHigh:integer):integer;stdcall;external "Kernel32.dll" name "LockFile";