parent
8202de23c9
commit
76bc4e3372
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -751,8 +751,8 @@ type ctslctrans = class(tmemoryclass)
|
|||
if ptr and sz>0 then
|
||||
begin
|
||||
return _tool.readbuf(ptr,sz);
|
||||
//setlength(r,sz);
|
||||
//for i := 0 to sz-1 do r[i+1]:= _tool.readbyte(ptr+i);
|
||||
setlength(r,sz);
|
||||
for i := 0 to sz-1 do r[i+1]:= _tool.readbyte(ptr+i);
|
||||
end
|
||||
return r;
|
||||
end
|
||||
|
|
@ -766,11 +766,17 @@ type ctslctrans = class(tmemoryclass)
|
|||
sz := _size_();
|
||||
if ifstring(s)and ptr and sz>0 and sz <= length(s)then
|
||||
begin
|
||||
_tool.writebuf(ptr,s,min(sz,length(s)));
|
||||
return _tool.writebuf(ptr,s,min(sz,length(s)));
|
||||
{for i := 0 to min(sz,length(s))-1 do
|
||||
begin
|
||||
_tool.writebyte(ptr+i,ord(s[i+1]));
|
||||
end}
|
||||
bts := array();
|
||||
for i := 0 to min(sz,length(s))-1 do
|
||||
begin
|
||||
bts[i] := ord(s[i+1]);
|
||||
end
|
||||
return _tool.writebytes(ptr,length(bts),bts);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1812,7 +1818,7 @@ type t_mem_mgr = class()
|
|||
begin
|
||||
if not(s and ifstring(s)) then return 0;
|
||||
if ifnil(n) then n := length(s);
|
||||
return memcpy2(p,s,n) ;
|
||||
return memcpy2(p,s,min(n,length(s))) ;
|
||||
end
|
||||
private
|
||||
function TSL_Malloc(sz:pointer):pointer;
|
||||
|
|
@ -1989,10 +1995,11 @@ type t_mem_mgr = class()
|
|||
_f_ := static function(var dst:string;src:pointer;size_t:pointer):pointer;cdecl;external getdlsymaddress(get_std_dll(),"memcpy");
|
||||
return ##_f_(dst,src,size_t);
|
||||
end
|
||||
function memcpy2(dst:pointer ;src:string;size_t:pointer):pointer;
|
||||
function memcpy2(dst:pointer ; src:string;size_t:pointer):pointer;
|
||||
begin
|
||||
_f_ := static function(dst:pointer ;src:string;size_t:pointer):pointer;cdecl;external getdlsymaddress(get_std_dll(),"memcpy");
|
||||
return ##_f_(dst,src,size_t);
|
||||
_f_ := static function(dst:pointer ; src:string;size_t:pointer):pointer;cdecl;external getdlsymaddress(get_std_dll(),"memcpy");
|
||||
r := ##_f_(dst,src,size_t);
|
||||
return r;
|
||||
end
|
||||
function memcpy3(var dst:string ;var src:string;size_t:pointer):pointer;
|
||||
begin
|
||||
|
|
@ -2074,7 +2081,7 @@ begin
|
|||
begin
|
||||
if len>0 then
|
||||
begin
|
||||
return get_mem_mgr().writebuf(p,s,len);
|
||||
return get_mem_mgr().writebuf(ptr,s,len);
|
||||
end else
|
||||
return get_mem_mgr().writestr(ptr,s);
|
||||
end
|
||||
|
|
|
|||
|
|
@ -650,11 +650,6 @@ type tsgtkapi = class(tgtkapis)
|
|||
function MultiByteToWideChar_a(CodePage:integer;dwFlags:integer;lpMultiByteStr:string;cbMultiByte:integer;var lpWideCharStr:string;cchWideChar:integer):integer;
|
||||
begin
|
||||
|
||||
end
|
||||
function GetEncoderClsid(n:String;ed:pointer):integer;
|
||||
begin
|
||||
WriteStringToPtr(ed,n); //±£´æ
|
||||
return -1;
|
||||
end
|
||||
function EnableWindow(w,c);
|
||||
begin
|
||||
|
|
@ -2483,7 +2478,7 @@ type tsgtkapi = class(tgtkapis)
|
|||
begin
|
||||
c := gtk_clipboard_get(69);
|
||||
r := gtk_clipboard_wait_for_text(c);
|
||||
if r then r := GtkStringToTsl(r);
|
||||
//if r then r := GtkStringToTsl(r);
|
||||
//echo "\r\ncop wire:",writefile(rwraw(),"","/tmp/test12.txt",0,length(r),r);
|
||||
return r;
|
||||
end
|
||||
|
|
@ -2492,8 +2487,9 @@ type tsgtkapi = class(tgtkapis)
|
|||
c := gtk_clipboard_get(69);
|
||||
if ifstring(s) and s then
|
||||
begin
|
||||
gs := TslStringToGtk(s);
|
||||
return gtk_clipboard_set_text(c,gs,length(gs));
|
||||
//gs := TslStringToGtk(s);
|
||||
//return gtk_clipboard_set_text(c,gs,length(gs));
|
||||
return gtk_clipboard_set_text(c,s,length(s));
|
||||
end else
|
||||
if ifnil(s) then gtk_clipboard_set_text(c,"",0);
|
||||
return 1;
|
||||
|
|
@ -2565,7 +2561,8 @@ type tsgtkapi = class(tgtkapis)
|
|||
df := my_trim( ReadStringFromPtr(dfdir));
|
||||
if df then
|
||||
begin
|
||||
gtk_file_chooser_set_filename(cdlg,TslStringToGtk( df));
|
||||
//gtk_file_chooser_set_filename(cdlg,TslStringToGtk( df));
|
||||
gtk_file_chooser_set_filename(cdlg, df);
|
||||
end
|
||||
end
|
||||
if GTK_RESPONSE_ACCEPT=gtk_dialog_run(cdlg)then
|
||||
|
|
@ -2632,46 +2629,48 @@ type tsgtkapi = class(tgtkapis)
|
|||
//fidx := obj._getvalue_("nfilterindex");
|
||||
if 0>1 then
|
||||
begin
|
||||
bts := ReadBytesFromPtr(obj._getvalue_("lpstrfilter"),obj._getvalue_("nmaxfiletitle"));
|
||||
fndx := "";
|
||||
for i ,v in bts do
|
||||
begin
|
||||
if bts[i]=0 and bts[i+1]=0 then break;
|
||||
fndx+=chr(bts[i]);
|
||||
end
|
||||
stp := str2array(fndx,"\0")[fidx*2-1];
|
||||
for i := length(stp) downto 1 do
|
||||
begin
|
||||
if stp[i] = "." then
|
||||
begin
|
||||
stype := stp[i:];
|
||||
end
|
||||
end
|
||||
for i := length(gf) downto 1 do
|
||||
begin
|
||||
gfi := gf[i];
|
||||
if gfi="/" then
|
||||
begin
|
||||
gf+=stype;
|
||||
break;
|
||||
end else
|
||||
if gfi = "." then
|
||||
begin
|
||||
break;
|
||||
end
|
||||
end
|
||||
bts := ReadBytesFromPtr(obj._getvalue_("lpstrfilter"),obj._getvalue_("nmaxfiletitle"));
|
||||
fndx := "";
|
||||
for i ,v in bts do
|
||||
begin
|
||||
if bts[i]=0 and bts[i+1]=0 then break;
|
||||
fndx+=chr(bts[i]);
|
||||
end
|
||||
stp := str2array(fndx,"\0")[fidx*2-1];
|
||||
for i := length(stp) downto 1 do
|
||||
begin
|
||||
if stp[i] = "." then
|
||||
begin
|
||||
stype := stp[i:];
|
||||
end
|
||||
end
|
||||
for i := length(gf) downto 1 do
|
||||
begin
|
||||
gfi := gf[i];
|
||||
if gfi="/" then
|
||||
begin
|
||||
gf+=stype;
|
||||
break;
|
||||
end else
|
||||
if gfi = "." then
|
||||
begin
|
||||
break;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if gf then
|
||||
begin
|
||||
gf := GtkStringToTsl( gf);
|
||||
fptr := obj._getvalue_("lpstrfile");
|
||||
gf+="\0";
|
||||
WriteStringToPtr(fptr,gf,length(gf));
|
||||
{//gf := GtkStringToTsl( gf);
|
||||
bts := zeros(length(gf)+1);
|
||||
for i := 1 to length(gf) do
|
||||
begin
|
||||
bts[i-1] := ord(gf[i]);
|
||||
end
|
||||
WriteBytesToPtr(fptr,bts);
|
||||
WriteBytesToPtr(fptr,bts);}
|
||||
r := true;
|
||||
end
|
||||
end
|
||||
|
|
@ -2782,12 +2781,14 @@ type tsgtkapi = class(tgtkapis)
|
|||
df := (ReadStringFromPtr(dir));
|
||||
if df then
|
||||
begin
|
||||
gtk_file_chooser_set_filename(cdlg,TslStringToGtk( df));
|
||||
//gtk_file_chooser_set_filename(cdlg,TslStringToGtk( df));
|
||||
gtk_file_chooser_set_filename(cdlg,( df));
|
||||
end
|
||||
end
|
||||
if GTK_RESPONSE_ACCEPT=gtk_dialog_run(cdlg) then
|
||||
begin
|
||||
r := GtkStringToTsl( gtk_file_chooser_get_filename(cdlg));
|
||||
//r := GtkStringToTsl( gtk_file_chooser_get_filename(cdlg));
|
||||
r := ( gtk_file_chooser_get_filename(cdlg));
|
||||
end
|
||||
gtk_widget_destroy(cdlg);
|
||||
return r;
|
||||
|
|
@ -2812,9 +2813,12 @@ type tsgtkapi = class(tgtkapis)
|
|||
return r;
|
||||
end
|
||||
procedure ILFree(pidl:pointer);
|
||||
begin
|
||||
mt := unit(cstructurelib).get_mem_mgr();
|
||||
mt.tfree(pidl);
|
||||
begin
|
||||
if pidl>0 or pidl<0 then
|
||||
begin
|
||||
mt := unit(cstructurelib).get_mem_mgr();
|
||||
mt.tfree(pidl);
|
||||
end
|
||||
end
|
||||
//caret ²åÈë·ûºÅ ´¦Àí
|
||||
function drawcaret(h,xy,f);
|
||||
|
|
|
|||
|
|
@ -888,19 +888,6 @@ type tcustomimage=class(TSLUIBASE)
|
|||
else t := lowercase(t_);
|
||||
if not(t in array("png","jpeg","bmp","gif","tiff"))then exit;
|
||||
return FImageTypes[t]; //дúÂë
|
||||
|
||||
vp := FImageTypes[t];
|
||||
if vp then return vp;
|
||||
dt := MemoryAlignmentCalculate(array((0,"byte[20]",array())),1,nil,nil);
|
||||
vp := new tslcstructureobj(dt,nil);
|
||||
//messagebox("image/"+t,"123",0);
|
||||
nt := _wapi.AnsiToWidChar("image/"+t);
|
||||
vvp := _wapi.GetEncoderClsid(nt,vp._getptr_);
|
||||
if vvp <>-1 then
|
||||
begin
|
||||
FImageTypes[t]:= vp;
|
||||
end
|
||||
return vp;
|
||||
end
|
||||
function IFhandle(h);
|
||||
begin
|
||||
|
|
@ -938,12 +925,6 @@ type tcustomimage=class(TSLUIBASE)
|
|||
return ;
|
||||
{$endif}
|
||||
FImageTypes := GetEncoderClsid();
|
||||
return ;
|
||||
FImageTypes := array();
|
||||
for i,v in array("png","jpeg","bmp","gif","tiff") do
|
||||
begin
|
||||
GetFileType(v);
|
||||
end
|
||||
end
|
||||
end
|
||||
function create();
|
||||
|
|
@ -1013,6 +994,12 @@ type tcustomimage=class(TSLUIBASE)
|
|||
@param(t)(string)ÀàÐÍ ,"png" "bmp" "gif"
|
||||
**}
|
||||
if not ifstring(p)then return -1;
|
||||
s := ImageToString(t);
|
||||
if ifstring(s) then
|
||||
begin
|
||||
return 1=writefile(rwraw(),"",p,0,length(s),s);
|
||||
end else return -1;
|
||||
///////////////µ÷Õû//////////////////////////////////
|
||||
if not ifstring(t)then t := "png";
|
||||
if not FHandle then return -1;
|
||||
vp := GetFileType(t);
|
||||
|
|
@ -1026,6 +1013,7 @@ type tcustomimage=class(TSLUIBASE)
|
|||
@param(t)(string) png bmp %%
|
||||
**}
|
||||
if not FHandle then exit;
|
||||
if not ifstring(t)then t := "png";
|
||||
/////////ÕûÀíimagetostring//////////
|
||||
vp := GetFileType(t);
|
||||
s := gdi.imagetostring(FHandle,vp);
|
||||
|
|
@ -3446,8 +3434,8 @@ begin
|
|||
return vs[v];
|
||||
end
|
||||
function GdipGetImageEncodersSize(var numencoders:integer;var size:integer):integer;stdcall ;external "Gdiplus.dll" name "GdipGetImageEncodersSize";
|
||||
Function GdipGetImageEncoders(numEncoders:integer;size:integer;encoders:pointer):pointer;stdcall;external "gdiplus.dll" name "GdipGetImageEncoders";
|
||||
function GetEncoderClsid();
|
||||
Function GdipGetImageEncoders(numEncoders:integer;size:integer;encoders:pointer):pointer;stdcall;external "Gdiplus.dll" name "GdipGetImageEncoders";
|
||||
function GetEncoderClsid(); //tslvclgetencoderclsid
|
||||
begin
|
||||
num := 0; // number of image encoders
|
||||
size := 0; // size of the image encoder array in bytes
|
||||
|
|
|
|||
|
|
@ -65,11 +65,6 @@ type twindowsapi = class()
|
|||
MultiByteToWideChar_a(0, 0, c , -1, pwszUnicode , iSize-1);
|
||||
return pwszUnicode;
|
||||
end
|
||||
function GetEncoderClsid(n:String;ed:pointer);
|
||||
begin
|
||||
r := tslvclgetencoderclsid(n,ed);
|
||||
return r;
|
||||
end;
|
||||
function GetSystemDirectory(); //»ñµÃwindowssystemĿ¼
|
||||
begin
|
||||
s := "";
|
||||
|
|
|
|||
Loading…
Reference in New Issue