编辑器

修正linux下编辑器打开中文名文件的问题
This commit is contained in:
2024-03-12 13:59:34 +08:00
parent 8202de23c9
commit 76bc4e3372
6 changed files with 108 additions and 92 deletions
+22 -7
View File
@@ -546,11 +546,12 @@ type teditorform = class(TVCform) //
begin
if it then
begin
if it.fisnewfile then self.Caption := (it.FEditer.ChangedFlag?"*":"")+ " new ";
if it.fisnewfile then cp := (it.FEditer.ChangedFlag?"*":"")+ " new ";
else
self.Caption := (it.FEditer.ChangedFlag?"*":"")+ it.OrigScriptPath;
cp := (it.FEditer.ChangedFlag?"*":"")+ it.OrigScriptPath;
end else
caption := "-tsl编辑器";
cp := "-tsl编辑器";
Caption := to_ansi_str(cp);
ModifyEnCodeMenu(it);
ModifySynMenu(it);
save_opend_file_name();
@@ -560,12 +561,13 @@ type teditorform = class(TVCform) //
cit := FEdter.GetCurrentItem();
if it=cit then
begin
if it.fisnewfile then self.Caption := (flg?"*":"")+ " new "//o.Caption;//it.ScriptPath+" -tsl编辑器";
if it.fisnewfile then cp := (flg?"*":"")+ " new "//o.Caption;//it.ScriptPath+" -tsl编辑器";
else
self.Caption := (flg?"*":"")+ it.OrigScriptPath;//o.Caption;//it.ScriptPath+" -tsl编辑器";
cp := (flg?"*":"")+ it.OrigScriptPath;//o.Caption;//it.ScriptPath+" -tsl编辑器";
ModifyEnCodeMenu(it);
end
else caption := "-tsl 编辑器";
else cp := "-tsl 编辑器";
caption := to_ansi_str(cp);
end
function OpenInOtherWnd(o,e)
begin
@@ -1366,6 +1368,19 @@ type TBlockManager=class(TVCForm)
Fbtns ;
FList;
end
type tdirlistbox = class(TListBox)
uses tslvcl,UtslCodeEditor;
function create(AOwner);
begin
inherited;
end
function getItemText(i);override;
begin
r := inherited;
return to_ansi_str(r); //"["$ i $"]" $
end
end
type tsearchdir = class(TCustomControl)
uses tslvcl;
function Create(AOwner);override;
@@ -1388,7 +1403,7 @@ type tsearchdir = class(TCustomControl)
FBtns := array();
for i,v in array(array(2,28,120,230),array(148,2,500,230)) do
begin
ls := new TListBox(self);
ls := new tdirlistbox(self);
ls.SetBoundsRect(v);
ls.parent := self;
ls.Border := true;
+14 -7
View File
@@ -17,6 +17,7 @@ TPagees; TPageItem
}
function gettslexe();
function to_ansi_str(s);
type TPageItem=class() //标签项
function Create(AOwner);
begin
@@ -194,7 +195,7 @@ type TPage=class(TCustomControl) //
dc.Stretchdraw(rc1,it.BitmapA);}
end
rc[0]+= 20;
dc.DrawText(it.caption,rc,DT_nOPREFIX .| DT_LEFT .| DT_SINGLELINE .| DT_VCENTER);
dc.DrawText(to_ansi_str(it.caption),rc,DT_nOPREFIX .| DT_LEFT .| DT_SINGLELINE .| DT_VCENTER);
end
end
if FCloseBtn and((FPageItems.Length()>0))then
@@ -2456,9 +2457,10 @@ type TEditer=class(TCustomcontrol) //
begin
if cit=it then
begin
if it.fisnewfile then Caption := (flg?"*":"")+" new ";
if it.fisnewfile then cp := (flg?"*":"")+" new ";
else
Caption :=(flg?"*":"")+it.OrigScriptPath;
cp :=(flg?"*":"")+it.OrigScriptPath;
Caption := to_ansi_str(cp);
end
callDatafunction(OnPageEditerChanged,it,flg);
it.BitmapA := flg?GetNeedSaveBmp():GetNneedSaveBmp();
@@ -2488,12 +2490,13 @@ type TEditer=class(TCustomcontrol) //
FCurrentItemCode[length(FCurrentItemCode)]:= it;
if it.fisnewfile then
begin
Caption :=(it.FEditer.ChangedFlag?"*":"")+" new ";
cp :=(it.FEditer.ChangedFlag?"*":"")+" new ";
end
else
begin
Caption :=(it.FEditer.ChangedFlag?"*":"")+it.OrigScriptPath;
cp :=(it.FEditer.ChangedFlag?"*":"")+it.OrigScriptPath;
end
Caption := to_ansi_str(cp);
CallDatafunction(FOnPageItemSelChanged,self(true),it);
cp := it.FEditer.Completion;
if cp and it.FInitCompletion then
@@ -6364,7 +6367,7 @@ type TMouseMoveList=class(TListBox)
function getItemText(i);override;
begin
r := inherited;
return "["$ i $"]" $ r;
return "["$ i $"]" $ to_ansi_str(r);
end
function PaintIdx(idx,rc_,cvs);virtual;
begin
@@ -6424,7 +6427,11 @@ begin
r["刷新当前符号"]:=getdbugfreshsymbmpinfo();
return r;
end
function to_ansi_str(s);
begin
if IsTextUTF8(s) then return UTF8toansi(s);
return s;
end
function ReWriteString(fn,d);
begin
if not ifstring(d)then return 0;