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