diff --git a/designer/utslvcldpropertytypes.tsf b/designer/utslvcldpropertytypes.tsf index e09e902..0dfdd59 100644 --- a/designer/utslvcldpropertytypes.tsf +++ b/designer/utslvcldpropertytypes.tsf @@ -3,7 +3,7 @@ interface {** @explan(说明) 设计器属性编辑库,继承该库,定义属性编辑类 %% **} -uses utslvclauxiliary,utslvclbase,utslvclgdi,uvcpropertytypespersistence,tslvcl,utslvcldcomponents; +uses utslvclauxiliary,utslvclbase,utslvclgdi,uvcpropertytypespersistence,tslvcl,utslvcldcomponents,UTslSynMemo; function registereditpropertytodesigner(cls); type TGCellRender = class(TSLUIBASE) //属性编辑器单元格对象基类 {** @@ -1464,15 +1464,8 @@ type TGridList = class(TListView) end end - - //**********属性编辑类*************** - - - - - ///////////////////////////////////////////////////////////////////////// type TGridCellNaturalEdit = class(TGridPropertyRender,TPropertyNatural) @@ -3478,6 +3471,7 @@ type TtextEditor = class(tpanel) property ItemStr read GetItemStr write SetItemStr; end + type TGridCellTextEdit = class(TGridCellEditWithButton,TPropertyText) {** @explan(说明)编辑字符串文本属性%% @@ -3590,6 +3584,188 @@ type TGridCellStringsEdit = class(TGridCellTextEdit) inherited; end end +type TGridCelltslEdit = class(TGridCellEditWithButton,tpropertytsl) +{** + @explan(说明)编辑字符串文本属性%% + **} + private + isShow; + FRbuttonWidth; + screenbottom; + protected + Fowner; + Fpanel; + rowNum; + colNum; + Fgrid; + public + function create(AOwner);override; + begin + inherited; + Fowner := AOwner; + Fpanel := nil; + FRbuttonWidth := 20; + screenArr := _wapi.getscreenrect(); + screenbottom := screenArr[3]; + isShow := true; + end + function createEditObj();virtual; + begin + Fpanel := new ttslediter(Fowner); + end + function ButtonClick(grid,e,d);override; + begin + {** + @explan(说明) 格子点击 %% + **} + inherited; + rowNum := e.iitem; + colNum := e.isubitem; + Fgrid := grid; + pt := e.ptaction; + rec := grid.getSubItemRect(rowNum,colNum); + if pt[0]>=(rec[2]-FRbuttonWidth) then + begin + if ifnil(Fpanel) then begin + createEditObj(); + Fpanel.parent := Fowner; + Fpanel.OnActivate := function(o,e) + begin + if e.lowparam = WA_INACTIVE then + begin + CellLeave(Fgrid); + end + end; + end + clickToText(d); + if Fpanel.showmodal()=1 then + begin + textChange1(Fpanel.itemData); + end + end + end + function clickToText(d);virtual; + begin + Fpanel.ItemStr := tostn(d["value"]); + end + function CellName();virtual; + begin + return "tsl"; + end + function textChange1(data);virtual; + begin + Fgrid.CellChanged(rowNum,colNum,"value",data); + end + function CellDrawLabel(dc,rect,d);override; + begin + {** + @explan(说明) 绘制格子 %% + **} + dc.drawtext(cellName(),rect,DT_VCENTER.|DT_LEFT .|DT_SINGLELINE); + end +end +type TGridCelllazytslEdit = class(TGridCellEditWithButton,tpropertylazytsl) +{** + @explan(说明)编辑字符串文本属性%% + **} + private + isShow; + FRbuttonWidth; + screenbottom; + protected + Fowner; + Fpanel; + rowNum; + colNum; + Fgrid; + public + function create(AOwner);override; + begin + inherited; + Fowner := AOwner; + Fpanel := nil; + FRbuttonWidth := 20; + screenArr := _wapi.getscreenrect(); + screenbottom := screenArr[3]; + isShow := true; + end + function createEditObj();virtual; + begin + Fpanel := new ttslediter(Fowner); + end + function ButtonClick(grid,e,d);override; + begin + {** + @explan(说明) 格子点击 %% + **} + inherited; + rowNum := e.iitem; + colNum := e.isubitem; + Fgrid := grid; + pt := e.ptaction; + rec := grid.getSubItemRect(rowNum,colNum); + if pt[0]>=(rec[2]-FRbuttonWidth) then + begin + if ifnil(Fpanel) then begin + createEditObj(); + Fpanel.parent := Fowner; + Fpanel.OnActivate := function(o,e) + begin + if e.lowparam = WA_INACTIVE then + begin + CellLeave(Fgrid); + end + end; + end + clickToText(d); + if Fpanel.showmodal()=1 then + begin + textChange1(Fpanel.itemData); + end + end + end + function clickToText(d);virtual; + begin + Fpanel.ItemStr := tostn(d["value"]); + end + function CellName();virtual; + begin + return "lazytsl"; + end + function textChange1(data);virtual; + begin + Fgrid.CellChanged(rowNum,colNum,"value",data); + end + function CellDrawLabel(dc,rect,d);override; + begin + {** + @explan(说明) 绘制格子 %% + **} + dc.drawtext(cellName(),rect,DT_VCENTER.|DT_LEFT .|DT_SINGLELINE); + end +end + +type ttslediter = class(TtextEditor) + function create(AOwner); + begin + inherited; + caption := "tsl"; + hg := new TTslSynHighLighter(self); + memo.Highlighter := hg; + end + protected + function comfirmEdit(o,e);override; + begin + itemData := nil; + s := memo.text; + try + itemData := eval(&s); + except + end + EndModalCode := 1; + return EndModal(); + end +end type TstringsEditor = class(TtextEditor) {** @explan(说明)memo编辑器%% @@ -4309,7 +4485,11 @@ begin class(TGridCellPairIntEdit), class(TGridCellPairSpliterTypeEdit), class(tGridCellAlignPosBoxEdit), - class(TGridCellTreeViewDataEdit) + class(TGridCellTreeViewDataEdit), + + class(TGridCelltslEdit), + class(TGridCelllazytslEdit) + )); registerproperties(psi); end diff --git a/funcext/tvclib/tcomponent.tsf b/funcext/tvclib/tcomponent.tsf index eb5f1fe..1d16ef5 100644 --- a/funcext/tvclib/tcomponent.tsf +++ b/funcext/tvclib/tcomponent.tsf @@ -218,6 +218,7 @@ public //通知 @param(AComponent)(tcomponent) 改变的对象 %% @param(Operation)(member of TOperation) 通知码 %% **} + if dosendrenote(AComponent,Operation) then return ; If(Operation=opRemove)then begin RemoveFreeNotification(AComponent); @@ -231,6 +232,17 @@ public //通知 end; end; private + function dosendrenote(a,op); + begin + if op=opRemove or op=opInsert then return 0; + if fonnotification then + begin + e := new tuieventbase(op,0,0,0); + e.sender := a; + CallMessgeFunction(fonnotification,self(true),e); + return e.skip; + end + end Procedure SetDesignInstance(Value); //设置设计状态 begin If Value then diff --git a/funcext/tvclib/tcontrol.tsf b/funcext/tvclib/tcontrol.tsf index 2ce70c7..9693a2e 100644 --- a/funcext/tvclib/tcontrol.tsf +++ b/funcext/tvclib/tcontrol.tsf @@ -1355,12 +1355,11 @@ type tcontrol = class(tcomponent) end if rchange then begin - //mtic; - //relnotification(self(true),array("type":"possize","flag":rchange,"data":array(fleft,ftop,FWidth,FHeight))); obj := class(tUIglobalData).uigetdata("tuiapplication"); if obj then begin obj.Notification(self(true),array("type":"possize","flag":rchange,"data":array(fleft,ftop,FWidth,FHeight))); + //obj.Notification(self(true),new tpossizenote(rchange,fleft,ftop,FWidth,FHeight)); end //echo "\r\n note change mtoc:",caption,"===",mtoc; end diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index 8461cb9..2bda4ce 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -516,8 +516,7 @@ type tapplication=class(tcomponent) FApplicationWindow.bindmessage(WM_ACTIVATEAPP,thisfunction(WMACTIVATEAPP)); end function Notification(a,op);override; - begin - inherited; + begin if op=opRecycling then begin if a=Fmainform then @@ -529,6 +528,7 @@ type tapplication=class(tcomponent) FApplicationWindow := nil; end end + inherited; end function createform(classname,varable); begin @@ -3278,12 +3278,12 @@ type TPairSplitter=class(tcustomcontrol) // end end function Notification(AComponent,Operation);override; - begin - inherited; + begin if Operation=opRemove then begin RemoveSide(AComponent); end + inherited; end function DoControlAlign();override; begin diff --git a/funcext/tvclib/utslvclaction.tsf b/funcext/tvclib/utslvclaction.tsf index 115a085..c3a27ce 100644 --- a/funcext/tvclib/utslvclaction.tsf +++ b/funcext/tvclib/utslvclaction.tsf @@ -104,8 +104,7 @@ type TBasicAction=class(TComponent) end end function Notification(AComponent,Operation);override; - begin - inherited; + begin if Operation=opRecycling and AComponent=FActionComponent then //opRemove begin FActionComponent := nil; @@ -114,6 +113,7 @@ type TBasicAction=class(TComponent) FParent.DeleteAction(self); end end + inherited; end function SetActionComponent(Value); begin @@ -330,12 +330,12 @@ type TCustomactionlist=class(TComponent) end end function Notification(AComponent,Operation);override; - begin - inherited; + begin if Operation=opRecycling and AComponent=FActionComponent then //opRemove begin DeleteAllActions(); end + inherited; end function Recycling();override; begin diff --git a/funcext/tvclib/utslvclauxiliary.tsf b/funcext/tvclib/utslvclauxiliary.tsf index 2ab3426..c44d2fc 100644 --- a/funcext/tvclib/utslvclauxiliary.tsf +++ b/funcext/tvclib/utslvclauxiliary.tsf @@ -40,8 +40,22 @@ function DeleteAllFiles(path); function CreateDirWithFileName(fname); function TS_GetUserProfileHome(); function gettslexefullpath(); - -type tuiglobaldata=class +type tpossizenote = class() + function create(c,l,t,w,h); + begin + ch := c; + left := l; + top := t; + width := w; + height := h; + end + ch; + left; + top; + width; + height; +end +type tuiglobaldata=class() static UIData; class Function uisetdata(n,d); begin @@ -60,7 +74,7 @@ type tuiglobaldata=class if not ifarray(UIData)then UIData := array(); end end -type TCharDiscrimi=class +type TCharDiscrimi=class() static CD_SMA; static CD_BGA; static CD_SMZ; diff --git a/funcext/tvclib/utslvclconstant.tsf b/funcext/tvclib/utslvclconstant.tsf index 34ecf78..8cde87d 100644 --- a/funcext/tvclib/utslvclconstant.tsf +++ b/funcext/tvclib/utslvclconstant.tsf @@ -486,10 +486,13 @@ end type tmacroconst=class(_commctrldef_,_tvclmsageid_,_shellapi_) class function sinit();virtual; begin + if tmacroconstinit then return ; class(_commctrldef_).sinit(); class(_tvclmsageid_).sinit(); class(_shellapi_).sinit(); + tmacroconstinit := true; end + static tmacroconstinit; end type tconstant = class(talign,TAnchorKind,TFormStyle,TComponentState, TComponentStyle,TOperation,TWinControlFlag, @@ -511,6 +514,7 @@ type TSLUICONST=class(tmacroconst,tconstant) static WM_TRAY; class function sinit();override; begin + if WM_TRAY>0 then return ; class(tmacroconst).sinit(); opRemove := "opRemove-";//移除操作 opInsert := "opInsert+";//插入 @@ -5946,6 +5950,6 @@ end } initialization -class(TSLUICONST).sinit(); class(tenumeration).initenumeration(new tconstant()); +class(TSLUICONST).sinit(); end. \ No newline at end of file diff --git a/funcext/tvclib/utslvclcoolbar.tsf b/funcext/tvclib/utslvclcoolbar.tsf index 560f950..1c99646 100644 --- a/funcext/tvclib/utslvclcoolbar.tsf +++ b/funcext/tvclib/utslvclcoolbar.tsf @@ -35,9 +35,8 @@ type tcustomcoolbar=class(tcustomcontrol) end function Notification(o,op);override; begin - r := inherited; - if class(tcoolbarlocker).haslocker then return r; - if (o is class(TWinControl)) and o.WsPopUp then return r; + if class(tcoolbarlocker).haslocker then return ; + if (o is class(TWinControl)) and o.WsPopUp then return ; if HandleAllocated() and ifarray(op) and (op["type"]="possize") then //位置大小发送变化 begin ctls := controls; @@ -45,10 +44,10 @@ type tcustomcoolbar=class(tcustomcontrol) begin doControlALign(); InvalidateRect(nil,false); - return r; + return ; end end - return r; + inherited; end function WMLBUTTONUP(o,e);override;//拖拽实现 begin diff --git a/funcext/tvclib/utslvclmenu.tsf b/funcext/tvclib/utslvclmenu.tsf index f371f72..23e580e 100644 --- a/funcext/tvclib/utslvclmenu.tsf +++ b/funcext/tvclib/utslvclmenu.tsf @@ -470,12 +470,12 @@ private end end function Notification(AComponent:TComponent;Operation:TOperation);override; - begin - inherited; + begin if Operation=opRecycling then //opRemove begin if AComponent=Action then Action := nil; end + inherited; end class function sinit();override; begin diff --git a/funcext/tvclib/utslvclstdctl.tsf b/funcext/tvclib/utslvclstdctl.tsf index 373d635..e3059d5 100644 --- a/funcext/tvclib/utslvclstdctl.tsf +++ b/funcext/tvclib/utslvclstdctl.tsf @@ -3842,8 +3842,7 @@ type TCustomComboBoxbase=class(TCustomControl) **} function Create(AOwner);override; begin - inherited; - + inherited; end function AfterConstruction();override; begin @@ -3903,7 +3902,7 @@ type TCustomComboBoxbase=class(TCustomControl) FListBox.show(5); CallMessgeFunction(ondropdown,self(true),e); end else - if not(flg)and FListBox.Visible then + if not(flg) and FListBox.Visible then begin FListBox.Visible := false; CallMessgeFunction(oncloseup,self(true),e); @@ -3918,7 +3917,7 @@ type TCustomComboBoxbase=class(TCustomControl) inherited; end published - property ItemIndex:lazyinteger read GetItemIndex write SetItemIndex; + property ItemIndex:lazytsl read GetItemIndex write SetItemIndex; property OnSelchanged:eventhandler read FOnSelchanged write FOnSelchanged; property ondropdown:eventhandler read Fondropdown write Fondropdown; property oncloseup:eventhandler read Foncloseup write Foncloseup; @@ -3947,7 +3946,7 @@ type TCustomComboBoxbase=class(TCustomControl) **} if not(FListBox is class(TWinControl))then return; rc := ClientRect; - FListbox.height := FListBox.ItemHeight * (min(max(0,FListBox.ItemCount),FmaxListItemShow))+10; + FListbox.height := getlistitemheight()* (min(max(0,getlistitemcount()),FmaxListItemShow))+10; nrc := ClientToScreen(rc[0],rc[3]); if FScreenRect[3]-nrc[1]<250 then begin @@ -3970,7 +3969,7 @@ type TCustomComboBoxbase=class(TCustomControl) Fondropdown; //下拉 Foncloseup; //收起 FBtnWidth; - function SetmaxListItemShow(v); + function SetmaxListItemShow(v);//显示项目数量 begin if v>0 then begin @@ -3981,7 +3980,7 @@ type TCustomComboBoxbase=class(TCustomControl) end end end - function SetBtnWidth(n); + function SetBtnWidth(n);//按钮宽度 begin if not(n>10 and n<100)then return; nn := int(n); @@ -3992,10 +3991,18 @@ type TCustomComboBoxbase=class(TCustomControl) DoControlAlign(); end end - function GetItemIndex();virtual; + function getlistitemcount();virtual; //获得项目 + begin + return FListBox.ItemCount; + end + function getlistitemheight();virtual; //获得项目高 + begin + return FListBox.ItemHeight; + end + function GetItemIndex();virtual;//获得选中的序号 begin end - function SetItemIndex();virtual; + function SetItemIndex();virtual;//设置选中的序号 begin end end @@ -4240,12 +4247,12 @@ type TcustomComboBox=class(TCustomComboBoxbase) end function GetItemIndex();override; begin - if FMultisel and (csDesigning in ComponentState) then return -1; + //if FMultisel and (csDesigning in ComponentState) then return -1; return FListBox.GetCurrentSelection(); end function SetItemIndex(idx);override; begin - if FMultisel and (csDesigning in ComponentState) then return -1; + //if FMultisel and (csDesigning in ComponentState) then return -1; return FListBox.SetCurrentSelection(idx); end feditischanging;//改变正在回调 @@ -5467,7 +5474,6 @@ type TCustomSpinEdit = class(TCustomControl) begin FValue := r; end - return FValue; end procedure SetValue(const AValue:Double);virtual; @@ -5590,7 +5596,6 @@ type TCustomSpinEdit = class(TCustomControl) fedit := nil; inherited; end - function DoControlAlign(rect);override; begin rect := ClientRect; @@ -5812,7 +5817,8 @@ type tcustomprogressbar=class(TCustomControl) dc.brush.color := FbarColor; dc.FillRect(br); end - function increaseByStep();begin + function increaseByStep(); + begin {** @explan(说明)按照步增量移动进度条当前的位置,当其超过限度则设置位置至下限以便于从头重新开始%% @return(integer)先前的位置,出错返回-1%% @@ -5826,7 +5832,8 @@ type tcustomprogressbar=class(TCustomControl) InvalidateRect(nil,false); return r; end - function increaseBySpecifiedIncrement(n);begin + function increaseBySpecifiedIncrement(n); + begin {** @explan(说明)进度条移动指定长度,当其超过限度则设置位置至该限度%% @param(n)(integer)增长的数量%% @@ -5887,7 +5894,8 @@ type tcustomprogressbar=class(TCustomControl) return not (n.&0xFFFFFFFFFF000000); else return 0; end - function setRange(l,h);begin + function setRange(l,h); + begin {** @explan(说明)设置进度栏的上下限,要求上限高于下限且皆非负%% @param(l)(integer)下限%% @@ -5905,7 +5913,8 @@ type tcustomprogressbar=class(TCustomControl) end end - function setRangeA(arr);begin + function setRangeA(arr); + begin return setRange(arr[0],arr[1]); end function setPosition(n); @@ -5923,7 +5932,8 @@ type tcustomprogressbar=class(TCustomControl) end return r; end - function setStep(n);begin + function setStep(n); + begin {** @explan(说明)设置进度栏步增量%% @param(n)(integer)要设置的值%% diff --git a/funcext/tvclib/uvcpropertytypespersistence.tsf b/funcext/tvclib/uvcpropertytypespersistence.tsf index f290c70..98e8ded 100644 --- a/funcext/tvclib/uvcpropertytypespersistence.tsf +++ b/funcext/tvclib/uvcpropertytypespersistence.tsf @@ -1035,7 +1035,7 @@ type TPropertyType=class @explan(说明) 是否为延迟设置属性%% @return(bool) **} - return false; + return Fislazy; end function IfComponent();virtual; begin @@ -1045,6 +1045,9 @@ type TPropertyType=class return false; end property TmfParser:TTmfParser read Gettfmparser; + property islazy read Fislazy write Fislazy; //是否后天就数据 + private + Fislazy; end type TPropertyNatural=class(TPropertyType) //自然数 function EditType();override; @@ -1907,6 +1910,59 @@ type TPropertyText=class(TPropertyString) return tostn(d); end end +type tpropertytsl=class(TPropertyType) + Function EditType();override; + begin + return "tsl"; + end + function TmfToNode(d);override; + begin + if ifstring(d)then + begin + r := HexFormatStrToTsl(d); + return r; + end + end + function FormatTMF(d);override; + begin + if datanotok(d) then return ""; + reti := TSlToHexFormatStr(d); + ret := "{ "; + ret += reti; + ret += " }"; + return ret; + end + function ReadTMF(d,o);override; + begin + if d and ifstring(d) then + begin + return HexFormatStrToTsl(d); + end + end + private + function datanotok(d);// + begin + if ifobj(d) then return true; + if ifarray(d) then + begin + for i ,v in d do + begin + if (datanotok(v)) then return true; + end + end + return false; + end +end +type tpropertylazytsl = class(tpropertytsl) + Function EditType();override; + begin + return "lazytsl"; + end + function LazyProperty();override; + begin + return true; + end +end type TPropertyStrings=class(TPropertyType) function EditType();override; begin @@ -2345,6 +2401,8 @@ begin "tpropertytabalign", "tpropertytext", "tpropertystrings", + "tpropertytsl", + "tpropertylazytsl", "tpropertyesalign", "tpropertymbbtnstyle", "tpropertymbicostyle",