界面库

更新
This commit is contained in:
JianjunLiu
2023-08-28 16:34:01 +08:00
parent 2554094ade
commit 899010e739
21 changed files with 79 additions and 26 deletions
+74 -25
View File
@@ -783,7 +783,7 @@ type tsgtkapi = class(tgtkapis)
end
Function TextOutA(hdc :pointer;X:integer;y:integer;txt:string;len:integer):integer;
begin
cl := gtk_object_get_data(hdc,"text.color");
cl := gtk_object_get_data(hdc,"text.color");
// gtk_rgb_color_rgb(cl,r,g,b);
// cairo_set_source_rgb(hdc, r, g, b);
xb := gtk_object_get_data(hdc,"viewport.x");
@@ -815,8 +815,7 @@ type tsgtkapi = class(tgtkapis)
end }
cft := (fnotset?fc:"AR PL UKai CN");
global g_gtk_font_get_size ;
if not ifarray(g_gtk_font_get_size) then g_gtk_font_get_size := array();
cfinfo := g_gtk_font_get_size[cft,ht,wd,it,wt];
cfinfo := g_gtk_font_get_size[cft{,ht},wd,it,wt];
if cfinfo then
begin
wd := cfinfo["width"];
@@ -826,13 +825,13 @@ type tsgtkapi = class(tgtkapis)
cairo_set_font_size(hdc,cfinfo["iwd2"]);
end else
begin
cairo_select_font_face(hdc,cft,it,wt);
ext := new _cairo_text_extents_t(nil);
cairo_select_font_face(hdc,cft,it,wt);
brk := 0;
wd2 := wd*2-2-wt; //ÉÔ΢ËõСһµã
wd2 := wd*2{-2-wt}; //ÉÔ΢ËõСһµã
iwd2 := wd2;
brk_Ct := 0;
dkzt := false;
{ext := new _cairo_text_extents_t(nil);
while not brk do
begin
brk_Ct++;
@@ -851,25 +850,28 @@ type tsgtkapi = class(tgtkapis)
iwd2 := wd+1+it-wt;
end
end
if nwd>(wd2+0.4) then
if nwd>(wd2+0.04) then
begin
iwd2-=0.25;
iwd2-=0.001;
end else
if nwd<(wd2) then
if nwd<(wd2+0.04) then
begin
iwd2+=0.25;
iwd2+=0.001;
end else
begin
brk := true;
end
end
echo "\r\n",iwd2,"++++",wd;
if brk_Ct>50 then break;
end
g_gtk_font_get_size[cft,ht,wd,it,wt] := array("width":wd,"zczw":dkzt,"iwd2":iwd2);
echo "\r\ncalc count:",brk_Ct;}
g_gtk_font_get_size[cft,{ht,}wd,it,wt] := array("width":wd,"zczw":dkzt,"iwd2":iwd2);
cairo_set_font_size(hdc,iwd2);
end
end
end
ht := wd*2;
wid := wd;
idx := 1 ;
tlen := (len<0)?length(txt):(min(len,length(txt)));
@@ -878,23 +880,69 @@ type tsgtkapi = class(tgtkapis)
///////////////////±³¾°/////////////////////////////////////////
if gtk_object_get_data(hdc,"font.bkmode") = 2 then
begin
gtk_rgb_color_rgb(gtk_object_get_data(hdc,"font.bkcolor"),r,g,b);
fillbk := true;
gtk_rgb_color_rgb(gtk_object_get_data(hdc,"font.bkcolor"),bkr,bkg,bkb);
//cairo_fill
cairo_move_to(hdc,xp,yp);
cairo_line_to(hdc,xp+wid*tlen,yp);
cairo_line_to(hdc,xp+wid*tlen,yp-ht);
cairo_line_to(hdc,xp,yp-ht);
cairo_line_to(hdc,xp,yp);
cairo_set_source_rgb(hdc, r, g, b);
cairo_fill(hdc);
end
gtk_rgb_color_rgb(cl,r,g,b);
cairo_set_source_rgb(hdc, r, g, b);
////////////////////////////////////////////////////////
if udl then
begin
cairo_set_line_width(hdc,0.5);
cairo_set_line_width(hdc,0.4);
end
txts := array();
txtidx := 0;
txti := "";
while idx<=tlen do
begin
ci := GetChar(txt,idx);
idx++;
if ci=10 then
begin
txts[txtidx++] := array(txti,yp,xp);
txti := "";
yp+=ht;
continue;
end
if ci=13 then
continue;
if ci=9 then txti+=" ";
else
txti+=txt[idx-1];
end
if txti then txts[txtidx++] := array(txti,yp,xp);
gtk_rgb_color_rgb(cl,pr,pg,pb);
for i ,v in txts do
begin
v0 := v[0];
if not v0 then continue;
vl := length(v0);
xx := v[2];
yy := v[1];
if fillbk then
begin
cairo_move_to(hdc,xx,yy);
cairo_line_to(hdc,xx+wid*vl,yy);
cairo_line_to(hdc,xx+wid*vl,yy-ht);
cairo_line_to(hdc,xx,yy-ht);
cairo_line_to(hdc,xx,yy);
cairo_set_source_rgb(hdc, bkr, bkg, bkb);
cairo_fill(hdc);
end
cairo_set_source_rgb(hdc, pr, pg, pb);
if udl then
begin
cairo_move_to(hdc,xx,yy-1);
cairo_line_to(hdc,(xx+wid*vl),yy-1);
end
cairo_move_to(hdc,xx,yy);
cairo_show_text(hdc,TslStringToGtk(v0));
cairo_stroke(hdc);
end
return 1;
while idx<=tlen do
begin
if udl then bxp := xp;
@@ -8957,7 +9005,8 @@ begin
end
function igtk();
begin
global g_w_i_datas,g_w_c_width, g_gtk_buttontable,g_gtk_keytable,g_gtk_call_handler_manager;
global g_w_i_datas,g_w_c_width, g_gtk_buttontable,g_gtk_keytable,g_gtk_call_handler_manager,g_gtk_font_get_size;
g_gtk_font_get_size := array();
gtk_init_check(nil,nil);
g_w_i_datas := array();
g_w_c_width := 35;
+5 -1
View File
@@ -2643,6 +2643,7 @@ type TSynCompletion = class(TSynCompletionList)
function Create(AOwner);override;
begin
inherited;
fmatchfirst := true;
{$ifdef linuxpop} //处理避免闪烁
{$else}
@@ -2871,7 +2872,8 @@ type TSynCompletion = class(TSynCompletionList)
for i,v in FCompData do
begin
vi := v[cindex];
if pos(cs,vi)=1 then
ps := pos(cs,vi);
if (fmatchfirst?(ps=1):(ps>=1)) then
begin
d[ld++] := v;
wd := max(wd,v["clen"]);
@@ -2902,7 +2904,9 @@ type TSynCompletion = class(TSynCompletionList)
property Memo Read FMemo write SetMemo; //编辑器
property IgnoreCase read FIgnoreCase Write SetIgnoreCase; //忽略大小写
property OnJumpChoosed read GetJumpChoosed write SetJumpChoosed;
property matchfirst read fmatchfirst write fmatchfirst ;//匹配首字母
private
fmatchfirst;
FCurrentWidth;
FCompData;
[weakref]FMemo;