编辑器

优化颜色配置
This commit is contained in:
JianjunLiu 2023-01-13 16:43:20 +08:00
parent 797509de51
commit 7859332e70
3 changed files with 65 additions and 11 deletions

View File

@ -3035,7 +3035,7 @@ type TEditer=class(TCustomcontrol) //
while true do
begin
idx++;
fn := FTslCacheDir+"newfile"+ioFileseparator()+"new"+inttostr(idx);
fn := FTslCacheDir+"newfile"+ioFileseparator()+"new"+inttostr(idx)+".tsl";
if fileexists("",fn) then continue;
r := ReWriteString(fn,"");
if r=1 then
@ -4199,9 +4199,9 @@ type thighlightercoloredter=class(tvcform)
btn3:tbtn;
function Create(AOwner);override; //¹¹Ôì
begin
fcolorindexname := array("字体","关键字","符号","注释","字符串","数字","系统函数");
ffrontcolordefault := array(0,0x0000ff,0,0x228B22,0x8B008B,0x666666,0xcd0000);
fbkcolordefalut := zeros(7)+0xfafafa;
fcolorindexname := array("字体","关键字","符号","注释","字符串","数字","系统函数","选中背景","当前行背景");
ffrontcolordefault := array(0,0x0000ff,0,0x228B22,0x8B008B,0x666666,0xcd0000,0,0);
fbkcolordefalut := zeros(7)+0xfafafa union array(rgb(192,192,192),rgb(232,232,255));
ffrontcolors := ffrontcolordefault;
fbkcols := fbkcolordefalut;
inherited;
@ -4226,7 +4226,7 @@ type thighlightercoloredter=class(tvcform)
begin
if flistboxchanging then return ;
idx := listbox1.ItemIndex;
if idx >=0 then
if idx in array(0,7,8) then
begin
cl := colorcombobox2.getcurrentColor();
fbkcols[idx] := cl;
@ -4246,7 +4246,7 @@ type thighlightercoloredter=class(tvcform)
begin
if flistboxchanging then return ;
idx := listbox1.ItemIndex;
if idx >=0 then
if idx >=0 and idx<7 then
begin
cl := colorcombobox1.getcurrentColor();
ffrontcolors[idx] := cl;
@ -4333,13 +4333,21 @@ type thighlightercoloredter=class(tvcform)
rec2 := rec;
//rec2[0]+=100;
sel := e.sel;
cl := fbkcols[id];
if id<7 then
begin
ftcl := ffrontcolors[id];
cl := fbkcols[0];
end else
begin
ftcl := ffrontcolors[0];
cl := fbkcols[id];
end
if cl>=0 or cl<0 then
begin
cvs.brush.Color := cl;
cvs.fillrect(rec2);
end
ftcl := ffrontcolors[id];
if ftcl>0 or ftcl<=0 then
begin
cvs.font.Color := ftcl;

View File

@ -10,6 +10,14 @@ type thighlitcolor = class(tcomponent)
inherited;
intitcolors();
end
function selbkcolor();
begin
return FColors["选中背景"];
end
function curbkcolor();
begin
return FColors["当前行背景"];
end
function bkcolor(); //背景
begin
return FColors["back"];
@ -58,12 +66,18 @@ type thighlitcolor = class(tcomponent)
("font":2263842,"back":16448250),"字符串":
("font":9109643,"back":16448250),"数字":
("font":6710886,"back":16448250),"系统函数":
("font":13434880,"back":16448250)) do
("font":13434880,"back":16448250),"选中背景":
("font":0,"back":rgb(192,192,192)),"当前行背景":
("font":0,"back":rgb(232,232,255))) do
begin
if i="字体" then
begin
FColors["back"] := new tcolor(v["back"]);
end
end
if i in array("选中背景","当前行背景") then
begin
FColors[i] := new tcolor(v["back"]);
end else
FColors[i] := new tcolor(v["font"]);
end
end
@ -84,12 +98,24 @@ type thighlitcolor = class(tcomponent)
end else
begin
v.changed := false;
v.color := cls[i]["font"];
if i in array("选中背景","当前行背景") then
begin
v.color := cls[i]["back"];
end else
v.color := cls[i]["font"];
if v.changed then
begin
if i="字体" then
begin
cgd .|= 4;
end else
if i="选中背景" then
begin
cgd .|= 8;
end else
if i= "当前行背景" then
begin
cgd .|= 16;
end else
cgd .|= 1;
end

View File

@ -22,8 +22,20 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm)
begin
setbkc(hc.bkcolor().color);
setfc(hc.fontcolor().color);
setselbc(hc.selbkcolor().color);
curbc(hc.curbkcolor().color);
end
end
function setselbc(bc);
begin
if bc>0 then selectbkcolor := bc;
else selectbkcolor := rgb(192,192,192);
end
function curbc(bc);
begin
if bc>0 then currentLineColor := bc;
else currentLineColor := rgb(232,232,255);
end
function setbkc(bc);
begin
if bc>0 then color := bc;
@ -236,6 +248,14 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm)
if Visible then
InvalidateRect(nil,false);
end
if op["value"] .& 8 then
begin
setselbc(a.selbkcolor().color);
end
if op["value"] .& 16 then
begin
curbc(a.curbkcolor().color);
end
return ;
end
inherited;