diff --git a/designer/udesignerproject.tsf b/designer/udesignerproject.tsf index 3c75666..0b721ae 100644 --- a/designer/udesignerproject.tsf +++ b/designer/udesignerproject.tsf @@ -1801,10 +1801,6 @@ type TFileTree = class(TTreeCtl) end fprojectpath; fio; - function CreateTreeNode();override; - begin - return New TTNode(self); - end function GetInfo(dir,files); //获得信息 begin leafs := array(); @@ -1902,10 +1898,12 @@ type TFileTree = class(TTreeCtl) fio := ioFileseparator(); ImageList := CreateaImageList(self,FImageIdName); hasline := true; + nodecreator := class(TTNode); FPNode := CreateTreeNode(); FPNode.Caption := "当前工程"; FPNode.FType := "dir"; FPNode.parent := RootNode; + //SetSel(FPNode); end function GetNodesByName(nds,n); diff --git a/designer/utslvcldcomponents.tsf b/designer/utslvcldcomponents.tsf index aa4ab3b..38d0488 100644 --- a/designer/utslvcldcomponents.tsf +++ b/designer/utslvcldcomponents.tsf @@ -550,6 +550,7 @@ type TDComponent = class() nn := cn+inttostr(i++); if nn in TemporaryNotName then continue; obj.name := nn; + if obj.Name<>nn then continue; SetComponentProperties("caption",nn); oname := nn;//obj.name; end @@ -812,10 +813,6 @@ type TComponentTree = class(TTreeView) // begin if not FLoading then inherited; end - function CreateTreeNode();override; //构造节点 - begin - return new TComponentTreeNode(self(true)); - end function Recycling();override; //回收 begin FDesigner := nil; @@ -826,6 +823,7 @@ type TComponentTree = class(TTreeView) // inherited; asdomain := true; FDesigner := AOwner; + nodecreator := class(TComponentTreeNode); end function GetRootNode();override; //根节点 begin diff --git a/funcext/tvclib/tcontrol.tsf b/funcext/tvclib/tcontrol.tsf index 743af3f..2ce70c7 100644 --- a/funcext/tvclib/tcontrol.tsf +++ b/funcext/tvclib/tcontrol.tsf @@ -11,36 +11,35 @@ type tcontrol = class(tcomponent) {$define gdipaint} {$endif} uses utslvclauxiliary,utslvclmemstruct,utslvclevent,utslvclgdi,utslvclaction,utslvclmenu; - private //计量处数据 + private //私有变量 #!begin //members - STATIC FSIDC; + STATIC FSIDC; //控件id生成器 FActionLink: TControlActionLink; - FCanvas: TCanvas; + FCanvas: TCanvas; //为可视控件提供画板 FMessagehandle;//消息表 - FtagPAINTSTRUCT; + FtagPAINTSTRUCT; //绘制区域 - //;数据 - //private FAnchors; FAnchorBounds; FCaption;//标题 FCaptureMouseButtons;//鼠标样式 FColor;//颜色 - FBKBitmap; + FBKBitmap; //背景图片 FControlFlags;//控件标记 FControlStyle;//控件样式 - FDesktopFont; - FDockOrientation; + //FDesktopFont; + //FDockOrientation; FDragCursor; FFont; //字体 - FHostDockSite: TWinControl; - FLastDoChangeBounds: TRect; - FLastDoChangeClientSize: TPoint; - FLastResizeClientHeight: integer; - FLastResizeClientWidth: integer; - FLastResizeHeight: integer; - FLastResizeWidth: integer; + FBorder; //边框 + //FHostDockSite: TWinControl; + //FLastDoChangeBounds: TRect; + //FLastDoChangeClientSize: TPoint; + //FLastResizeClientHeight: integer; + //FLastResizeClientWidth: integer; + //FLastResizeHeight: integer; + //FLastResizeWidth: integer; FOnClick; //点击 Fonrclick; FOnContextPopup; @@ -49,7 +48,7 @@ type tcontrol = class(tcomponent) FOnDragOver; FOnSize; FOnMove; - FOnEditingDone; + //FOnEditingDone; FOnEndDock; FOnEndDrag; FOnMouseDown; //按下 @@ -68,18 +67,15 @@ type tcontrol = class(tcomponent) FOnStartDock; FOnStartDrag; //FOnTripleClick; - FBorder; - protected + protected //可以重写的函数以及使用的成员变量 //对齐 FAlign;//对齐方式 - FUnAlignBounds; - + FUnAlignBounds; FParent;// TWinControl; //父节点 - //public //FParentBiDiMode;//: Boolean; FPopupMenu;//: TPopupMenu; //FIsControl;//: Boolean; - FShowHint;//: Boolean; + //FShowHint;//: Boolean; FParentColor;//: Boolean; FParentFont;//: Boolean; //FParentShowHint;//: Boolean; @@ -88,21 +84,19 @@ type tcontrol = class(tcomponent) FEnabled;//: Boolean; //有效 //FMouseEntered;//: boolean; FVisible;//: Boolean; //可见 - FID; + FID; //id FOnMeasureItem; FOnDrawItem; - #!end - + #!end //位置信息 - //protected FLeft:integer; //左边 FTop:integer;//: Integer; //上 FWidth:integer; FHeight:integer; //高度 - FControls; - FControlState; - FCursor; + FControls; //子控件 + FControlState; //状态 + FCursor; //鼠标 {** @param(FLeft)(integer) 左边 %% @param(FTop)(integer) 上边 %% @@ -134,7 +128,7 @@ type tcontrol = class(tcomponent) Value.FreeNotification(Self); end end - function getparenttype(); + function getparenttype(); begin return class(TWinControl); end @@ -161,7 +155,6 @@ type tcontrol = class(tcomponent) FEnabled := nv; end end - //protected procedure SetAlign(Value:TAlign);virtual; begin if not(Value in array(alLeft,alRight,alBottom,alTop,alNone,alClient))then exit; @@ -216,7 +209,7 @@ type tcontrol = class(tcomponent) return 1; end end - private + private //位置,大小,对齐等属性设置函数 function SetUnAlignBounds(Value); begin {** @@ -280,7 +273,7 @@ type tcontrol = class(tcomponent) end return FtagPAINTSTRUCT; end - function bindmessage(id,func); //type_tcontrol + function bindmessage(id,func); //绑定事件 begin {** @ignore 忽略 %% @@ -289,7 +282,7 @@ type tcontrol = class(tcomponent) if not ifarray(FMessagehandle)then FMessagehandle := array(); if ifnumber(id)and (datatype(func)=7)then FMessagehandle[id]:= func; end - private + private //事件绑定处理 static FClassDigestA; class function CtlInfoAndDigest(idx,d); //通过类的指纹保存或者获取控件信息 begin @@ -348,32 +341,8 @@ type tcontrol = class(tcomponent) begin bindmessage(i,findfunction(v,o)); end - return; - if not(o is class(tcontrol))then return; - t := o.classinfo; - hs := t["inherited"]; - for i,v in hs do - begin - call(thisfunction,findclass(v,o)); - end - for i,v in t["subs"] do - begin - if v["access"]in array(2,3)then continue; - fstring := v["functionname"]; - if not ifstring(fstring)then continue; - f := findfunction(fstring,o); - returntype := v["returntype"]; - try - if returntype then - begin - mid := invoke(o,returntype); - bindmessage(mid,f); - end - except - end; - end end - protected + protected //部分属性设置 function GetControlFont();virtual; begin if ParentFont and Parent then return Parent.FFont; @@ -410,23 +379,20 @@ type tcontrol = class(tcomponent) return f.Controls.indexof(self); end end - function RealGetText: - TCaption; - virtual; //type_tcontrol + function RealGetText():TCaption;virtual; //标题 begin return FCaption; end - procedure RealSetText(Value:TCaption);virtual; //type_tcontrol + procedure RealSetText(Value:TCaption);virtual; //标题 begin FCaption := Value; end - #!begin //资源处理 - function GetCursor();virtual; + function GetCursor();virtual; //鼠标 begin return FCursor; end - procedure SetCursor(Value);virtual; + procedure SetCursor(Value);virtual;//鼠标 begin if(FCursor is class(tcustomcursor))and ifnumber(Value)and FCursor.id <> Value then begin @@ -434,17 +400,13 @@ type tcontrol = class(tcomponent) Perform(new tuieventbase(CM_CURSORCHANGED,0,0)); end; end - procedure SetVisible(Value);virtual; + procedure SetVisible(Value);virtual; //可见 begin FVisible := Value?true:false; end - //procedure DoOnParentHandleDestruction;virtual; - //begin - //end - #!end - protected - function messagecreater(hwnd,message,wparam,lparam);virtual; ////type_tcontrol + protected //消息对象以及坐标 + function messagecreater(hwnd,message,wparam,lparam);virtual; ////构造消息对象 begin {** @explan(说明)根据消息参数构造消息对象; @@ -488,20 +450,20 @@ type tcontrol = class(tcomponent) return r; //return new tuieventbase(message,wparam,lparam,hwnd); end - function GetClientOrigin();virtual; ////type_tcontrol + function GetClientOrigin();virtual; ////坐标 begin if FParent then base := FParent.ClientOrigin(); return array(base[0]+FLeft,base[1]+FTop); end - function GetLogicalClientRect();virtual; //type_tcontrol + function GetLogicalClientRect();virtual; //坐标 begin return GetClientRect(); end; - function GetClientScrollOffset();virtual; //type_tcontrol + function GetClientScrollOffset();virtual; //坐标 begin return array(0,0); end - function GetScrolledClientRect();virtual; //type_tcontrol + function GetScrolledClientRect();virtual; //坐标 begin Result := GetClientRect(); ScrolledOffset := GetClientScrollOffset(); @@ -511,7 +473,7 @@ type tcontrol = class(tcomponent) Result[3]+= ScrolledOffset[1]; return Result; end; - function GetControlOrigin();virtual; //type_tcontrol + function GetControlOrigin();virtual; //坐标 begin Result := array(FLeft,FTop); if FParent <> nil then @@ -522,19 +484,19 @@ type tcontrol = class(tcomponent) end; return Result; end - function ControlAppended(AControl);virtual; + function ControlAppended(AControl);virtual;//添加控件 begin {** @explan(说明) 子控件添加 %% **} end - function ControlDeleted(AControl);virtual; + function ControlDeleted(AControl);virtual;//子控件被删除 begin {** @explan(说明) 子控件删除 %% **} end - function operatectrl(actrl,op);virtual; //type_tcontrol + function operatectrl(actrl,op);virtual; //控件操作通知 begin idx := FControls.indexof(actrl); if op=opRemove then @@ -561,7 +523,7 @@ type tcontrol = class(tcomponent) end return ifop; end - function SetParent(NewParent);virtual; //type_tcontrol + function SetParent(NewParent);virtual; //设置父控件 begin //1.为窗口类 //2.可以作为父窗口 @@ -586,35 +548,14 @@ type tcontrol = class(tcomponent) if Parent then FParent.operatectrl(self(true),opRemove); end end - procedure SetParentComponent(NewParentComponent);override; //type_tcontrol + procedure SetParentComponent(NewParentComponent);override; //设置父窗口 begin SetParent(NewParentComponent); end - public - procedure Notification(AComponent:TComponent;Operation:TOperation);override; //type_tcontrol - begin - {** - @explan(说明) 通知消息处理 %% - **} - if Operation=opRemove then - begin - if AComponent=PopupMenu then - PopupMenu := nil ; - else - if AComponent=Action then Action := nil; - idx := FControls.indexof(AComponent); //删除子控件 - if idx >= 0 then - begin - FControls.deli(idx); - end - end; - inherited; - end; - protected - procedure UpdateMouseCursor(X, Y: integer); - begin - end - procedure ChangeBounds(ALeft,ATop,AWidth,AHeight:integer;KeepBase:boolean);virtual; //type_tcontrol + + protected //大小改变 + //procedure UpdateMouseCursor(X, Y: integer); begin end + procedure ChangeBounds(ALeft,ATop,AWidth,AHeight:integer;KeepBase:boolean);virtual; //边界改变 begin SizeChanged :=(FWidth <> AWidth)or(FHeight <> AHeight); PosChanged :=(FLeft <> ALeft)or(FTop <> ATop); @@ -667,7 +608,7 @@ type tcontrol = class(tcomponent) begin return 0; end - public + public //鼠标事件 function MouseMove(o,e);virtual; begin end @@ -702,7 +643,26 @@ type tcontrol = class(tcomponent) e.skip := true; end end - public + public//通知 + procedure Notification(AComponent:TComponent;Operation:TOperation);override; //通知 + begin + {** + @explan(说明) 通知消息处理 %% + **} + if Operation=opRemove then + begin + if AComponent=PopupMenu then + PopupMenu := nil ; + else + if AComponent=Action then Action := nil; + idx := FControls.indexof(AComponent); //删除子控件 + if idx >= 0 then + begin + FControls.deli(idx); + end + end; + inherited; + end; procedure FontChanged(Sender:TObject);virtual; begin if parent then parent.FontChanged(Sender); @@ -951,11 +911,11 @@ type tcontrol = class(tcomponent) //InvalidateRect(nil,true); updateWindow(); end } end + public //消息id绑定相关 function CNALIGN(o,e):CN_ALIGN;virtual; begin DoCNALIGN(o,e); end - public function CNANCHOR(o,e):CN_ANCHOR;virtual; begin if Align <> alNone then exit; @@ -1148,12 +1108,8 @@ type tcontrol = class(tcomponent) // HelpType is set implicitly when assigning HelpContext or HelpKeyword end; end - function click(o,e);virtual; //type_tcontrol - begin - end - function DblClick(o,e);virtual; //type_tcontrol - begin - end + //function click(o,e);virtual;begin end + //function DblClick(o,e);virtual;begin end public function ScreenToClient(X,Y);virtual; begin @@ -1185,7 +1141,7 @@ type tcontrol = class(tcomponent) begin return Fid; end - function create(Owner);override; //type_tcontrol + function create(Owner);override; //构造函数 begin inherited; if ifnil(FSIDC)then FSIDC := new tidcreater(100); @@ -1200,7 +1156,7 @@ type tcontrol = class(tcomponent) FParentBidiMode := True; FParentColor := false; FParentFont := false; - FDesktopFont := True; + //FDesktopFont := True; FParentShowHint := True; FIsControl := False; FEnabled := True; @@ -1218,7 +1174,7 @@ type tcontrol = class(tcomponent) FCursor := new tcustomcursor(); FCursor.id := IDC_ARROW; end - procedure CheckNewParent(AParent:TWinControl);virtual; //type_tcontrol + procedure CheckNewParent(AParent:TWinControl);virtual; //检查parent begin { @ignore(忽略) @@ -1227,7 +1183,7 @@ type tcontrol = class(tcomponent) return(AParent is getparenttype())and AParent.IsContainer(self(true)); return false; end - function Recycling();override; //type_tcontrol + function Recycling();override; //销毁处理 begin {** @explan(说明) 资源回收,子类请override该方法然后在destroy中调用 %% @@ -1337,7 +1293,7 @@ type tcontrol = class(tcomponent) begin if ifnumber(id)and FMessagehandle then return FMessagehandle[id]; end - function dispatch(o,e);virtual; //type_tcontrol + function dispatch(o,e);virtual; //分发消息 begin {** @explan(说明)消息分发函数 %% @@ -1347,13 +1303,13 @@ type tcontrol = class(tcomponent) func := getmessagehandle(e.Msg); if func then call(func,o,e); end - procedure DoControlAlign();virtual; + procedure DoControlAlign();virtual;//调整子控件位置 begin end - procedure DoControlAnchor();virtual; + procedure DoControlAnchor();virtual;//调整子控件位置 begin end - procedure WndProc(TheMessage);virtual; //type_tcontrol + procedure WndProc(TheMessage);virtual; //消息分发 begin {** @explan(说明) 消息循环 %% @@ -1583,7 +1539,7 @@ type tcontrol = class(tcomponent) @param(OnDrawItem)(function[TControl,TMDRAWITEM]) 控件绘制回调 %% @param(Color)(integer) 背景色 %% **} - function isCustomPaint(); + function isCustomPaint(); //提供给gtk使用 begin return csCustomPaint in FControlState ; end diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index a5726bf..01b2566 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -62,23 +62,10 @@ function HexFormatStrToTsl(D); function GetTextWidthAndHeightWidthFont(s,f,mul); //**********操作系统相关函数********************* //////////////////////////////////// - - type TByteData = class(TByteDataOP) end - ///////////////////////////内存对象////////////////////////////// - - //////////////////////////////////内存对象截止//////////////////////////////////////////////////// - - //******************常量类型********************************** - - ///////////////////////////////// - - ///////////////////////////消息对象//////////////////////////////////// - - - - ///////////////tmf文件转换/////////////////////// +//******************常量类型********************************** +///////////////tmf文件转换/////////////////////// type Ttfm2Component = class(TTmfParser) {** @explan(说明) tfm数据到组件转换 %% @@ -91,7 +78,7 @@ type Ttfm2Component = class(TTmfParser) inherited; if not ifarray(FComponentTypes)then FComponentTypes := array(); end - function formatpath(s); + function formatpath(s);//处理windows的路径 begin r := ""; if s and ifstring(s)then @@ -257,17 +244,6 @@ type Ttfm2Component = class(TTmfParser) function Loadinherited(o);//导入 begin return Loadinherited_sub(o); - if not ifobj(o) then return ; - if not((o is class(TDCreateForm)) or (o is class(TDCreatePanel))) then return ;//判断类型 - ci := o.classinfo; - cn := ci["classname"]; - ic := ci["inherited"][0]; - if ((cn<>"tdcreateform") and (cn<>"tdcreatepanel")) then - begin - Loadinherited(findclass(ic,o)); - phs := static GetSourceDirs(); - Loadtfmtoform(o,phs,cn); - end end function Loadinherited_sub(o); begin @@ -324,7 +300,7 @@ type Ttfm2Component = class(TTmfParser) end end end - function GetLibPaths(); + function GetLibPaths(); //获得libpath begin p := tsl_getlibpath_(); if not p then return array(); @@ -375,7 +351,7 @@ type Ttfm2Component = class(TTmfParser) end end -type TGlobalComponentcache=class +type TGlobalComponentcache=class() //窗口对象缓存句柄作为索引 {** @ignore(忽略) %% @explan(说明) 窗口存储类 %% @@ -2798,6 +2774,7 @@ type TTreeView=class(TTreeCtl) height := 150; border := true; HasLine := true; + nodecreator := class(TTreeNode); end function expand(item); begin @@ -2878,15 +2855,10 @@ type TTreeView=class(TTreeCtl) if node is class(TTreeNode)then begin end else - return; + return; np := RootItem.HasNode(node); if np then np.DeleteChildNode(node); end - function CreateTreeNode();override; - begin - r := new TTreeNode(self(true)); - return r; - end public function Recycling();override; begin @@ -7227,10 +7199,10 @@ type TInputEditor=class end type TTipMessageButton = class(TGraphicControl) - {** - @ignore(忽略) %% - @explan(说明) 提示按钮 %% - **} +{** + @ignore(忽略) %% + @explan(说明) 提示按钮 %% +**} public function Create(AOwner);override; begin @@ -7324,7 +7296,7 @@ type TTipMessageButton = class(TGraphicControl) end private - type TTipImage=class + type TTipImage=class() public function create(); begin @@ -8035,7 +8007,7 @@ type TDragManager=class(TComponent) property DragThreshold:Integer read FDragThreshold write FDragThreshold; // default 5; end; -function GetAndDispatchMessageA(hwnd,minm,maxm); +function GetAndDispatchMessageA(hwnd,minm,maxm); //分发窗口消息 begin {** @explan(说明) 获得和分发消息 %% @@ -8064,7 +8036,7 @@ begin RunWorkerThreadLoop(); API.WaitMessage(); end - return-1; + return -1; ////////////////////////////////////////////////////// {r := API.GetMessageA(ptr, hwnd>0?hwnd:0, minm>0?minm:0, maxm>0?maxm:0); if r=0 then @@ -8075,48 +8047,14 @@ begin API.DispatchMessageA(ptr);} return r; end - -function GetGdipStatus(v); -begin - {** - @explan(说明) 获得gdiflat的运行状态说明 %% - @param(v)(integer) 状态值 %% - @return(string) 状态说明 %% - **} - vs := static array( - "Ok", - "GenericError", - "InvalidParameter", - "OutOfMemory", - "ObjectBusy", - "InsufficientBuffer", - "NotImplemented", - "Win32Error", - "WrongState", - "Aborted", - "FileNotFound", - "ValueOverflow", - "AccessDenied", - "UnknownImageFormat", - "FontFamilyNotFound", - "FontStyleNotFound", - "NotTrueTypeFont", - "UnsupportedGdiplusVersion", - "GdiplusNotInitialized", - "PropertyNotFound", - "PropertyNotSupported", - "ProfileNotFound"); - return vs[v]; -end - -function RegisterComponentType(n,typ); +function RegisterComponentType(n,typ);//注册componet对象 begin {** @explan(说明) 注册component组件 %% **} class(Ttfm2Component).RegisterComponentType(n,typ); end -function initializeapplication(); +function initializeapplication(); //应用对象 begin {** @explan(说明) 初始化application %% @@ -8124,7 +8062,7 @@ begin **} return getapplication(); end -function getapplication(); +function getapplication(); //应用对象 begin {** @explan(说明) 返回application对象%% @@ -8174,7 +8112,7 @@ begin return tslarraytocstructcalc(data,pack,0,ssize); end -function remotetslcallback(data); +function remotetslcallback(data);//远程执行 begin {** @explan(说明) 行情订阅回调 %% @@ -8183,10 +8121,7 @@ begin //return class(TQuotations)._SWINDOWS._send_(0X4400,0,data,1); end - - //*********字符串相关对象************************************** - -function calldatafunction(); +function calldatafunction();//事件回调调用 begin {** @explan(说明)执行函数句柄,默认第一个参数为函数句柄,后面的参数为该句柄的参数 %% @@ -8202,7 +8137,7 @@ begin 4:return call(f,params[2],params[3],params[4]); end; return nil; - ps := params; + {ps := params; f := ps[0]; pms := ps[1:]; if datatype(f)<> 7 or not(ifarray(pms))then exit; @@ -8213,9 +8148,9 @@ begin begin return callinarray(f,pms); end else - return callinarray(f,pms[0:lpt-1]); + return callinarray(f,pms[0:lpt-1]);} end -function NotifyComponent(Acomponent,Act,AOwner); +function NotifyComponent(Acomponent,Act,AOwner);//通知控件 begin {** @explan(说明) 通知节点AOwner有节点Acomponent 发生了改变,通知码为act %% @@ -8231,7 +8166,7 @@ begin end owner.Notification(Acomponent,Act); end -function _timeproc_(hwnd,message,wparam,lparam); //消息分发 +function _timeproc_(hwnd,message,wparam,lparam); //定时器消息分发 begin {** @explan(说明) 消息分发预处理函数被底层调用 %% @@ -8243,13 +8178,13 @@ begin **} return class(ttimer)._timeproc_(hwnd,message,wparam,lparam); end -function controlisCustomPaint(id); +function controlisCustomPaint(id);//提供给gtk使用 begin wd := class(tUIglobalData).uigetdata("TGlobalValues").getvalue(id); if wd then return wd.isCustomPaint(); return false; end -function _twinproc_(hwnd,message,wparam,lparam); //消息分发 +function _twinproc_(hwnd,message,wparam,lparam); //窗口消息分发 begin {** @explan(说明) 消息分发预处理函数被底层调用 %% @@ -8272,11 +8207,6 @@ begin ("lpcreateparams","intptr",0))),lparam); cid := cpm._getvalue_("lpcreateparams"); wdobj := class(tUIglobalData).uigetdata("TGlobalValues").getvalue(cid); - {if wdobj is class(TWincontrol) then - begin - //return wdobj.MainWndProc(hwnd,message,wparam,lparam); - //class(TGlobalComponentcache).registerhandle(hwnd,wdobj); - end } end end r := 0; @@ -8292,23 +8222,6 @@ begin class(tUIglobalData).uigetdata("TGlobalComponentcache").unregisterhandle(hwnd); end return r; - if message in array(1,0x81)then - begin - obj := new tslcstructureobj(MemoryAlignmentCalculate(array( - ("lpcreateparams","intptr",0), - ("hinstance","intptr",0), - ("hmenu","intptr",0), - ("hwndparent","intptr",0), - ("cy","int",0), - ("cx","int",0), - ("y","int",0), - ("x","int",0), - ("style","int",0), - ("lpszname","intptr",0), - ("lpszclass","intptr",0), - ("dwexstyle","int",0))),lparam); - echo tostn(obj._getdata_); - end end function _MessgeHook_a(hwnd,message,wparam,lparam); begin @@ -8345,16 +8258,10 @@ begin d := new TtagOFNA(lparam); end end - - - //function GetModuleFileNameA(m:pointer;var buf:string;len:integer):integer;stdcall;external "Kernel32.dll" name "GetModuleFileNameA"; //function CallWindowProcA(lpPrevWndFunc:pointer;hWnd:pointer;Msg:integer;wParam:pointer;lParam:pointer):pointer;stdcall;external "User32.dll" name "CallWindowProcA"; //function RegisterClassExA(wc:pointer):short;stdcall;external "User32.dll" name "RegisterClassExA"; - -//临时文件 - - +//tsl语言中使用动态库函数 function TS_EndExecute(id:integer);cdecl;external "TSSVRAPI.dll" name "TS_EndExecute"; function TSL_ScriptGo(L:pointer;Content:string;v:pointer):integer;cdecl;external "TSSVRAPI.dll" name "TSL_ScriptGo"; function TSL_InterpFreeLWrap(lWrap:pointer);cdecl;external "TSSVRAPI.dll" name "TSL_InterpFreeLWrap"; @@ -8366,32 +8273,30 @@ function TSL_FreeObj(L:pointer;v:pointer);cdecl;external {$ifdef linux}"libTSSVR //function TS_ModulePath():string;cdecl;external {$ifdef linux}"libTSSVRAPI.so"{$else}"TSSVRAPI.dll"{$endif} name "TS_ModulePath"; //function TS_ExecPath():string;cdecl;external {$ifdef linux}"libTSSVRAPI.so"{$else}"TSSVRAPI.dll"{$endif} name "TS_ExecPath"; //function TS_GetAppPath():string;cdecl;external {$ifdef linux}"libTSSVRAPI.so"{$else}"TSSVRAPI.dll"{$endif} name "TS_ExecPath"; - //function TS_GetIniPath(hometype:integer; var IniName:string):string;cdecl;external {$ifdef linux}"libTSSVRAPI.so"{$else}"TSSVRAPI.dll"{$endif} name "TS_GetIniPath"; function TSL_Check(func:string;funclen:integer;oResult:pointer):integer;cdecl;external {$ifdef linux}"libTSSVRAPI.so"{$else}"TSSVRAPI.dll"{$endif} name "TSL_Check"; procedure tslprocessmessages();begin {echo "\r\n processmessage";}end; function TS_GetUserProfileHome(); begin return unit(utslvclauxiliary).TS_GetUserProfileHome(); - end -function RunWorkerThreadLoop(); +function RunWorkerThreadLoop(); //执行工作线程循环 begin class(TThreadWorker).dispatch(); end //procedure ClearScriptCache();cdecl;external "TSLInterp.dll" name "ClearScriptCache"; -function CreateDirWithFileName(fname); +function CreateDirWithFileName(fname);//确保指定文件的文件夹是存在的 begin return unit(utslvclauxiliary).CreateDirWithFileName(fname); end -function DeleteAllFiles(path); +function DeleteAllFiles(path);//删除目录所有文件 begin return unit(utslvclauxiliary).DeleteAllFiles(path); end -function LoginTslServer(usr,pwd,addr,port); +function LoginTslServer(usr,pwd,addr,port);//登陆服务器 begin {** @explan(说明) 登陆服务器 %% @@ -8424,7 +8329,7 @@ function GetCheckStruct(); begin return new TCHECK_RESULT(); end -function CheckTslCode(code,err); +function CheckTslCode(code,err);//检查tsl语法 begin {** @explan(说明) tsl语法检查 %% @@ -8445,7 +8350,7 @@ begin end return true; end -function tslScriptGo(script); +function tslScriptGo(script);//执行tsl脚本 begin {** @explan(说明)执行tsl脚本 %% @@ -8463,13 +8368,13 @@ begin return tslScriptGo(script); **} ph := gettemppath(); - name := ph+"tslpengt.tsl"; + file := ph+"tslpengt.tsl"; if ifstring(script)and script then begin tsexe := SysExecName(); - FileDelete("",name); - writefile(rwraw(),"",name,0,length(script),script); - r := SysExec(tsexe,format('"%s" "%s"',tsexe,name),nil,0,r,nil); + FileDelete("",file); + writefile(rwraw(),"",file,0,length(script),script); + r := SysExec(tsexe,format('"%s" "%s"',tsexe,file),nil,0,r,nil); end return r; lwrap := TSL_InterpNewLWrap(); @@ -8484,7 +8389,7 @@ begin //TSL_InterpFreeLWrap(lwrap); return ret; end -function version(); +function version(); //版本 begin {** @explan(说明) 返回版本号 %% @@ -8494,7 +8399,7 @@ begin //return "1.1.1.20200731_beta"; //return "1.1.2.20210915_beta"; //return "1.1.3.20220210_beta"; - return "1.1.4.20220310_beta"; + return "1.1.4.20221010_beta"; end function ExitMessageLoop(); @@ -8506,7 +8411,7 @@ begin return WPI.PostQuitMessage(0); end -function SysExecWait(handle,exe,cmd,dir,fwait); +function SysExecWait(handle,exe,cmd,dir,fwait); //等待执行 begin {** @explan(说明) 运行进程 %% @@ -8557,7 +8462,7 @@ begin end return r; end -function MessageBoxA(txt,title,flag,wnd); +function MessageBoxA(txt,title,flag,wnd);//对话框api begin {** @explan(说明) 提示对话框 %% @@ -8583,7 +8488,7 @@ begin end end end -function CopyUsedTslDllToNewDir(npre); +function CopyUsedTslDllToNewDir(npre);//windows中使用,拷贝tsl使用的动态库到指定目录 begin {** @explan(说明) 拷贝当前的tsl目录中使用的dll到指定目录%% @@ -8616,19 +8521,19 @@ begin end ////////////////////封装已经移动到其他库的接口为了兼容/////////// -function TslToHexFormatStr(tsl); +function TslToHexFormatStr(tsl);//将tsl数据转换为16进制字符串 begin return unit(utslvclauxiliary).TslToHexFormatStr(tsl); end -function HexFormatStrToTsl(D); +function HexFormatStrToTsl(D);//将16进制字符串还原为tsl数据 begin return unit(utslvclauxiliary).HexFormatStrToTsl(d); end -function GetTextWidthAndHeightWidthFont(s,f,mul); +function GetTextWidthAndHeightWidthFont(s,f,mul);//获得字体的绘制高度宽度 begin return unit(utslvclgdi).GetTextWidthAndHeightWidthFont(s,f,mul); end -function CallMessgeFunction(f,o,e); +function CallMessgeFunction(f,o,e); //执行消息回调 begin return unit(utslvclauxiliary).CallMessgeFunction(f,o,e); end @@ -8686,3 +8591,22 @@ Initialization initlib(); Finalization end. +{ + if message in array(1,0x81)then + begin + obj := new tslcstructureobj(MemoryAlignmentCalculate(array( + ("lpcreateparams","intptr",0), + ("hinstance","intptr",0), + ("hmenu","intptr",0), + ("hwndparent","intptr",0), + ("cy","int",0), + ("cx","int",0), + ("y","int",0), + ("x","int",0), + ("style","int",0), + ("lpszname","intptr",0), + ("lpszclass","intptr",0), + ("dwexstyle","int",0))),lparam); + echo tostn(obj._getdata_); + end +} diff --git a/funcext/tvclib/utslvclauxiliary.tsf b/funcext/tvclib/utslvclauxiliary.tsf index 8a4a0ae..68090e6 100644 --- a/funcext/tvclib/utslvclauxiliary.tsf +++ b/funcext/tvclib/utslvclauxiliary.tsf @@ -2748,7 +2748,7 @@ begin end end else //多字节符的非首字节,应为 10xxxxxx begin - if((chr .& 0xC0)<> 0x80)then return-1; + if((chr .& 0xC0)<> 0x80)then return -1; nBytes--; end end; diff --git a/funcext/tvclib/utslvclgdi.tsf b/funcext/tvclib/utslvclgdi.tsf index 6cbb9bc..a54ab14 100644 --- a/funcext/tvclib/utslvclgdi.tsf +++ b/funcext/tvclib/utslvclgdi.tsf @@ -5,9 +5,9 @@ unit utslvclgdi; **} interface uses cstructurelib,utslvclmemstruct,utslvclauxiliary,utslvclbase; - function GetTextWidthAndHeightWidthFont(s,f,mul); function getdrawablebitmap(w,h,bmp); +function GetGdipStatus(v); type TGdi = class(TSLUIBASE) private static GDICache; @@ -3019,6 +3019,38 @@ begin return cv; end end +function GetGdipStatus(v); +begin + {** + @explan(说明) 获得gdiflat的运行状态说明 %% + @param(v)(integer) 状态值 %% + @return(string) 状态说明 %% + **} + vs := static array( + "Ok", + "GenericError", + "InvalidParameter", + "OutOfMemory", + "ObjectBusy", + "InsufficientBuffer", + "NotImplemented", + "Win32Error", + "WrongState", + "Aborted", + "FileNotFound", + "ValueOverflow", + "AccessDenied", + "UnknownImageFormat", + "FontFamilyNotFound", + "FontStyleNotFound", + "NotTrueTypeFont", + "UnsupportedGdiplusVersion", + "GdiplusNotInitialized", + "PropertyNotFound", + "PropertyNotSupported", + "ProfileNotFound"); + return vs[v]; +end initialization sinitgidplus(); class(tcustomimage).sinit(); diff --git a/funcext/tvclib/utslvcltree.tsf b/funcext/tvclib/utslvcltree.tsf index f9d8393..7524820 100644 --- a/funcext/tvclib/utslvcltree.tsf +++ b/funcext/tvclib/utslvcltree.tsf @@ -1643,6 +1643,7 @@ type TcustomTreeCtl = class(TVirtualList) FNodeHierarchyWidth := 20; FMulSelected := false; FMulSelects := array(); + fnodecreator := class(TcustomTreeCtlNode); end function InsertItem(it,idx);override; begin @@ -1773,6 +1774,7 @@ type TcustomTreeCtl = class(TVirtualList) end} function CreateTreeNode();virtual; begin + return createobject(fnodecreator,self(true)); r := new TcustomTreeCtlNode(self(true)); return r; end @@ -1841,6 +1843,7 @@ type TcustomTreeCtl = class(TVirtualList) FOnSelChanging := nil; FonEmptyNodeExapanding := nil; FNodeHierarchyWidth := 20; + //fnodecreator := nil; inherited; end function GetHierarchyByHandle(h); @@ -1878,6 +1881,7 @@ type TcustomTreeCtl = class(TVirtualList) property OnSelChanged:eventhandler read FOnSelChanged write FOnSelChanged; property OnSelChanging:eventhandler read FOnSelChanging write FOnSelChanging; property onEmptyNodeExapanding read FonEmptyNodeExapanding write FonEmptyNodeExapanding; + property nodecreator read fnodecreator write setnodecreator; protected function GetRootNode();virtual; //获得根节点 begin @@ -1889,11 +1893,24 @@ type TcustomTreeCtl = class(TVirtualList) return FRootItem; end private + fnodecreator; flockchangedcall;// FOnlyLeafNodeCheckMark; FNodeHierarchyWidth; FMulSelected; FMulSelects; + function setnodecreator(nd); + begin + if (fnodecreator<>nd) and (nd is class(TcustomTreeCtlNode)) then + begin + fnodecreator := nd; + if FRootItem then + begin + FRootItem.Recycling(); + FRootItem := nil; + end + end + end function SetNodeHierarchyWidth(v); begin if v >= 0 and FNodeHierarchyWidth <> v then