编辑器

新打开的文本字体和当前的字体一样大小
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"];
if(POS("d",fl[0,"Attr"]))then return false;
it := new TPageEditerItem(FPageEditer);
oit := GetCurrentEditer();
if oit then
begin
it.FEditer.font := oit.font;//font;
end
it.FDebuger := FTslDebug;
it.FEditer.OnCaretChanged := thisfunction(EditerCaretChanged);
it.FEditer.Parent := FPageEditer;

View File

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

View File

@ -791,12 +791,13 @@ type tsgtkapi = class(tgtkapis)
if fto then fto := fto[0];
if fto then //ÎÄ×Ö´¦Àí
begin
fc := fto._getvalue_("facename");
ht := fto._getvalue_("height");
wd := fto._getvalue_("width");
it := fto._getvalue_("italic");
wt := fto._getvalue_("weight")=700;
udl := fto._getvalue_("underline");
ftod := fto._getdata_();
fc := ftod["facename"];
ht := ftod["height"];
wd := ftod["width"];
it := ftod["italic"];
wt := ftod["weight"]=700;
udl := ftod["underline"];
fnotset := false;
{fns := static pango_font_family_get_names();
for i,v in fns do
@ -2605,7 +2606,7 @@ type tsgtkapi = class(tgtkapis)
begin
Fscrolltimedo := makeinstance(thisfunction(docarettime));
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);
end
h := g_object_get_data(hwnd,"gtk_window_caret"); //»ñµÃcaret
@ -5170,17 +5171,17 @@ type tgtkapis = class() //gtk
ptr:=popen(cmd, "r");
if((ptr)<>0) then
begin
while(fgets(buf_ps, len, ptr)<>0) do
while(fgets(buf_ps, len-1, ptr)<>0) do
begin
for i:= 1 to len do
for i:= 1 to len-1 do
begin
vi := buf_ps[i];
if vi="\0" then
begin
break;
end
result += buf_ps[i];
end
if i>1 then result += buf_ps[1:(i-1)];
end
pclose(ptr);
end

View File

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

View File

@ -4,7 +4,7 @@ interface
@explan(˵Ã÷) windowsƽ̨Ïà¹Ø½Ó¿Ú %%
@date(20220509) %%
**}
uses cstructurelib,utslvclauxiliary;
uses cstructurelib,utslvclauxiliary,utslvclmemstruct;
type twindowsapi = class()
private
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 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 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 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";