parent
b4a34c10eb
commit
9b652672e8
|
|
@ -25,6 +25,7 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm)
|
||||||
"charset":0,"outprecision":0,"clipprecision":0,"quality":1,"pitchandfamily":1,"facename":"Courier New","color":0);
|
"charset":0,"outprecision":0,"clipprecision":0,"quality":1,"pitchandfamily":1,"facename":"Courier New","color":0);
|
||||||
//134
|
//134
|
||||||
//font := array("facename":"Courier New");
|
//font := array("facename":"Courier New");
|
||||||
|
autogutterwidth := true;
|
||||||
end
|
end
|
||||||
function DoCaretPosChanged();override;
|
function DoCaretPosChanged();override;
|
||||||
begin
|
begin
|
||||||
|
|
@ -187,13 +188,13 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm)
|
||||||
end
|
end
|
||||||
function DoTextChanged(p);override;
|
function DoTextChanged(p);override;
|
||||||
begin
|
begin
|
||||||
n := Lines.Length();
|
{n := Lines.Length();
|
||||||
ccnt := GutterCharCnt;
|
ccnt := GutterCharCnt;
|
||||||
nccnt := max(integer(n~10)+3,4);
|
nccnt := max(integer(n~10)+2,3);
|
||||||
if ccnt <> nccnt then
|
if ccnt <> nccnt then
|
||||||
begin
|
begin
|
||||||
GutterCharCnt := nccnt;
|
GutterCharCnt := nccnt;
|
||||||
end
|
end}
|
||||||
inherited;
|
inherited;
|
||||||
SetChangeFlag(true);
|
SetChangeFlag(true);
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1764,7 +1764,7 @@ type tmemo = class(TSynMemoNorm)
|
||||||
return array("name","font","color","parentcolor","parentfont",
|
return array("name","font","color","parentcolor","parentfont",
|
||||||
"popupmenu","visible","anchors","align",
|
"popupmenu","visible","anchors","align",
|
||||||
"height","width","left","top",
|
"height","width","left","top",
|
||||||
"text","readonly","selectbkcolor","guttercolor","currentlinecolor","guttercharcnt",
|
"text","readonly","selectbkcolor","guttercolor","currentlinecolor","guttercharcnt","autogutterwidth",
|
||||||
"tabspace","highlighter","onmousewheel","onmousemove","onpopupmenu",
|
"tabspace","highlighter","onmousewheel","onmousemove","onpopupmenu",
|
||||||
"onmousedown","onmouseup","onsetfocus","onkillfocus",
|
"onmousedown","onmouseup","onsetfocus","onkillfocus",
|
||||||
"onkeyup","onkeydown","onkeypress",
|
"onkeyup","onkeydown","onkeypress",
|
||||||
|
|
|
||||||
|
|
@ -653,6 +653,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
FTopLine; //首行
|
FTopLine; //首行
|
||||||
FScroolChanged; //滚动了
|
FScroolChanged; //滚动了
|
||||||
FGutterCharCount; //gutter 字符个数
|
FGutterCharCount; //gutter 字符个数
|
||||||
|
Fautogutterwidth; //自动设置gutter宽度
|
||||||
FGutter; //gutter
|
FGutter; //gutter
|
||||||
FMarginTop;
|
FMarginTop;
|
||||||
FLines;
|
FLines;
|
||||||
|
|
@ -689,7 +690,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
FCharWidth := Font.width;
|
FCharWidth := Font.width;
|
||||||
FGutter.Width := 1+FGutterCharCount * FCharWidth;
|
FGutter.Width := (5*(FGutterCharCount>0))+FGutterCharCount * FCharWidth+1;
|
||||||
FCharHeight := Font.Height;
|
FCharHeight := Font.Height;
|
||||||
fTextHeight := FCharHeight+FLineInterval;
|
fTextHeight := FCharHeight+FLineInterval;
|
||||||
UpDateScroll();
|
UpDateScroll();
|
||||||
|
|
@ -778,9 +779,9 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
cvs.Font.Color := 1;
|
cvs.Font.Color := 1;
|
||||||
for i := nL1 to nL2 do
|
for i := nL1 to nL2 do
|
||||||
begin
|
begin
|
||||||
r := rcDraw;
|
r := rc;//rcDraw;
|
||||||
r[1]:= rcDraw[1]+fTextHeight * iy;
|
r[1]:= rcDraw[1]+fTextHeight * iy;
|
||||||
r[2]-= 10;
|
r[2]-= 4;
|
||||||
r[3]:= r[1]+fTextHeight;
|
r[3]:= r[1]+fTextHeight;
|
||||||
it := flines[i];
|
it := flines[i];
|
||||||
if it and it.FMarked then
|
if it and it.FMarked then
|
||||||
|
|
@ -1008,9 +1009,10 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
FReadOnly := false;
|
FReadOnly := false;
|
||||||
FLineInterval := 4;
|
FLineInterval := 4;
|
||||||
FGutterCharCount := 4;
|
FGutterCharCount := 4;
|
||||||
|
Fautogutterwidth := false;
|
||||||
FSelectionMode := smNormal;
|
FSelectionMode := smNormal;
|
||||||
FGutter := new TMemoGutter(self);
|
FGutter := new TMemoGutter(self);
|
||||||
FGutter.Width := 1+Font.Width * FGutterCharCount;
|
FGutter.Width := 5+Font.Width * FGutterCharCount+1;
|
||||||
fLines := new TMemoLineList(self(true));
|
fLines := new TMemoLineList(self(true));
|
||||||
FInPutCache := 0;
|
FInPutCache := 0;
|
||||||
fLines.Text := "";
|
fLines.Text := "";
|
||||||
|
|
@ -1220,7 +1222,8 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
end
|
end
|
||||||
function DoTextChanged(p);virtual;//文本改变
|
function DoTextChanged(p);virtual;//文本改变
|
||||||
begin
|
begin
|
||||||
//¸Ä±ä
|
//改变
|
||||||
|
autosetgtwidth();
|
||||||
end
|
end
|
||||||
function DoCaretPosChanged();virtual;//caret位置改变
|
function DoCaretPosChanged();virtual;//caret位置改变
|
||||||
begin
|
begin
|
||||||
|
|
@ -1561,6 +1564,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
property GutterWidth read GetGutterWidth;
|
property GutterWidth read GetGutterWidth;
|
||||||
property LineInterval read FLineInterval write SetLineInterval;//行间距
|
property LineInterval read FLineInterval write SetLineInterval;//行间距
|
||||||
property GutterCharCnt:integer read FGutterCharCount write SetGutterCharCnt;
|
property GutterCharCnt:integer read FGutterCharCount write SetGutterCharCnt;
|
||||||
|
property autogutterwidth:bool read Fautogutterwidth write setautogutterwidth;
|
||||||
property currentLineColor:color read fcurrentLineColor write setcurrentLineColor;
|
property currentLineColor:color read fcurrentLineColor write setcurrentLineColor;
|
||||||
property guttercolor:color read fguttercolor write setguttercolor; //行标颜色
|
property guttercolor:color read fguttercolor write setguttercolor; //行标颜色
|
||||||
property selectbkcolor:color read fselectbkcolor write setselectbkcolor; //选中的颜色
|
property selectbkcolor:color read fselectbkcolor write setselectbkcolor; //选中的颜色
|
||||||
|
|
@ -1747,14 +1751,37 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
DecPaintLock();
|
DecPaintLock();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function SetGutterCharCnt(n);
|
function autosetgtwidth();//调整行号宽度
|
||||||
begin
|
begin
|
||||||
if not(n>=0 ) then return ;
|
if not Fautogutterwidth then return ;
|
||||||
|
n := Lines.Length();
|
||||||
|
nccnt := max(integer(n~10)+2,3);
|
||||||
|
if FGutterCharCount <> nccnt then
|
||||||
|
begin
|
||||||
|
SetGutterCharCnt(nccnt,true);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function setautogutterwidth(v);//设置自动调整宽度
|
||||||
|
begin
|
||||||
|
nv := v?true:false;
|
||||||
|
if nv<>Fautogutterwidth then
|
||||||
|
begin
|
||||||
|
Fautogutterwidth := nv;
|
||||||
|
if nv then
|
||||||
|
begin
|
||||||
|
autosetgtwidth();
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function SetGutterCharCnt(n,f); //设置行号宽度
|
||||||
|
begin
|
||||||
|
if Fautogutterwidth and ifnil(f) then return ;
|
||||||
|
if not(n>=0 ) then return ;
|
||||||
nn := integer(n);
|
nn := integer(n);
|
||||||
if nn<>FGutterCharCount then
|
if nn<>FGutterCharCount then
|
||||||
begin
|
begin
|
||||||
FGutterCharCount := nn;
|
FGutterCharCount := nn;
|
||||||
FGutter.Width := 1+FGutterCharCount*FCharWidth;
|
FGutter.Width := (5*(FGutterCharCount>0))+FGutterCharCount*FCharWidth+1;
|
||||||
InValidateRect(nil,false);
|
InValidateRect(nil,false);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue