1 {
2 *****************************************************************************
3 *                                                                           *
4 *  This file is part of the ZCAD                                            *
5 *                                                                           *
6 *  See the file COPYING.modifiedLGPL.txt, included in this distribution,    *
7 *  for details about the copyright.                                         *
8 *                                                                           *
9 *  This program is distributed in the hope that it will be useful,          *
10 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
11 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
12 *                                                                           *
13 *****************************************************************************
14 }
15 {
16 @author(Andrey Zubarev <zamtmn@yandex.ru>)
17 }
18 
19 unit varmandef;
20 {$INCLUDE def.inc}
21 
22 interface
23 uses
24   LCLProc,SysUtils,UGDBTree,gzctnrstl,uzctnrvectorgdbstring,strutils,uzbtypesbase,
25   uzedimensionaltypes,UGDBOpenArrayOfByte,uzbtypes,
26   gzctnrvectortypes,Classes,Controls,StdCtrls,Graphics,types;
27 const
28   {Ttypenothing=-1;
29   Ttypecustom=1;
30   TGDBPointer=2;
31   Trecord=3;
32   Tarray=4;
33   Tenum=6;
34   TGDBBoolean=7;
35   TGDBShortint=8;
36   TGDBByte=9;
37   TGDBSmallint=10;
38   TGDBWord=11;
39   TGDBInteger=12;
40   TGDBLongword=13;
41   TGDBDouble=14;
42   TGDBString=15;
43   TGDBobject=16;}
44   Ignore=#13;
45   Break='=:,'#10;
46   dynamicoffset=-1;
47   invar='_INVAR_';
48   TA_COMPOUND=1;
49   TA_OBJECT=2;
50   TA_ENUM=4;
51 
52   vda_different=1;
53   vda_RO=2;
54   vda_approximately=4;
55   vda_colored1=8;
56 type
57 TInternalScriptString=Ansistring;
58 TCompareResult=(CRLess,CREqual,CRGreater,CRNotEqual);
59 TPropEditorOwner=TWinControl;
60 PDMode=(PDM_Field,PDM_Property);
61 PUserTypeDescriptor=^UserTypeDescriptor;
62 TPropEditor=class;
63 TEditorMode=(TEM_Integrate,TEM_Nothing);
64 TEditorDesc=packed record
65                   Editor:TPropEditor;
66                   Mode:TEditorMode;
67             end;
68 TOnCreateEditor=function (TheOwner:TPropEditorOwner;rect:trect;pinstance:pointer;psa:PTZctnrVectorGDBString;FreeOnLostFocus:boolean;PTD:PUserTypeDescriptor):TEditorDesc;
Instancenull69 TOnGetValueAsString=function(PInstance:GDBPointer):GDBString;
70 TOnDrawProperty=procedure(canvas:TCanvas;ARect:TRect;PInstance:GDBPointer);
71 
72 TFastEditorState=(TFES_Default,TFES_Hot,TFES_Pressed);
73 
74 TGetPrefferedFastEditorSize=function (PInstance:Pointer;ARect:TRect):TSize;
75 TDrawFastEditor=procedure (canvas:TCanvas;r:trect;PInstance:Pointer;state:TFastEditorState;boundr:trect);
76 TRunFastEditor=procedure (PInstance:Pointer);
77 
78 TDecoratedProcs=packed record
79                 OnGetValueAsString:TOnGetValueAsString;
80                 OnCreateEditor:TOnCreateEditor;
81                 OnDrawProperty:TOnDrawProperty;
82                 end;
83 TFastEditorProcs=packed record
84                 OnGetPrefferedFastEditorSize:TGetPrefferedFastEditorSize;
85                 OnDrawFastEditor:TDrawFastEditor;
86                 OnRunFastEditor:TRunFastEditor;
87                 UndoInsideFastEditor:Boolean;
88                 end;
89 TFastEditorRunTimeData=packed record
90                       Procs:TFastEditorProcs;
91                       FastEditorState:TFastEditorState;
92                       FastEditorDrawed:GDBBoolean;
93                       FastEditorRect:trect;
94                       end;
95 TFastEditorsVector=specialize TMyVector<TFastEditorProcs>;
96 TFastEditorsRunTimeVector=specialize TMyVector<TFastEditorRunTimeData>;
97   PBasePropertyDeskriptor=^BasePropertyDeskriptor;
98   BasePropertyDeskriptor=object({GDBaseObject}GDBBaseNode)
99     Name: GDBString;
100     Value: GDBString;
101     ValKey: GDBString;
102     ValType: GDBString;
103     Category: GDBString;
104     PTypeManager:PUserTypeDescriptor;
105     Attr:GDBWord;
106     Collapsed:PGDBBoolean;
107     ValueOffsetInMem: GDBWord;
108     valueAddres:GDBPointer;
109     HelpPointer:GDBPointer;
110     rect:trect;
111     //x1,y1,x2,y2:GDBInteger;
112     _ppda:GDBPointer;
113     _bmode:GDBInteger;
114     mode:PDMode;
115     r,w:GDBString;
116     Decorators:TDecoratedProcs;
117     FastEditors:{TFastEditorsVector}TFastEditorsRunTimeVector;
118     procedure free;virtual;
119   end;
120   propdeskptr = ^propdesk;
121   propdesk = record
122     name: GDBString;
123     value: GDBString;
124     proptype:char;
125     drawsub:GDBBoolean;
126     valueoffsetinmem: GDBWord;
127     valueaddres: GDBPointer;
128     valuetype: GDBByte;
129     next, sub, help: propdeskptr;
130     ptm:PUserTypeDescriptor;
131   end;
132 
133 TTypeAttr=GDBWord;
134 
135 TOIProps=record
136                ci,barpos:GDBInteger;
137          end;
138 pvardesk = ^vardesk;
139 TMyNotifyCommand=(TMNC_EditingDoneEnterKey,TMNC_EditingDoneLostFocus,TMNC_EditingDoneESC,TMNC_EditingProcess,TMNC_RunFastEditor,TMNC_EditingDoneDoNothing);
140 TMyNotifyProc=procedure (Sender: TObject;Command:TMyNotifyCommand) of object;
141 TCreateEditorFunc=function (TheOwner:TPropEditorOwner;rect:trect;pinstance:pointer;psa:PTZctnrVectorGDBString;FreeOnLostFocus:boolean;InitialValue:GDBString;ptdesc:PUserTypeDescriptor;preferedHeight:integer):TEditorDesc of object;
142 UserTypeDescriptor=object(GDBaseObject)
143                          SizeInGDBBytes:GDBInteger;
144                          TypeName:String;
145                          PUnit:GDBPointer;
146                          OIP:TOIProps;
147                          Collapsed:GDBBoolean;
148                          Decorators:TDecoratedProcs;
149                          //FastEditor:TFastEditorProcs;
150                          FastEditors:TFastEditorsVector;
151                          onCreateEditorFunc:TCreateEditorFunc;
152                          constructor init(size:GDBInteger;tname:string;pu:pointer);
153                          constructor baseinit(size:GDBInteger;tname:string;pu:pointer);
154                          procedure _init(size:GDBInteger;tname:string;pu:pointer);
CreateEditornull155                          function CreateEditor(TheOwner:TPropEditorOwner;rect:trect;pinstance:pointer;psa:PTZctnrVectorGDBString;FreeOnLostFocus:boolean;InitialValue:TInternalScriptString;preferedHeight:integer):TEditorDesc;virtual;
156                          procedure ApplyOperator(oper,path:TInternalScriptString;var offset:GDBInteger;out tc:PUserTypeDescriptor);virtual;abstract;
Serializenull157                          //function Serialize(PInstance:GDBPointer;SaveFlag:GDBWord;var membuf:PGDBOpenArrayOfByte;var  linkbuf:PGDBOpenArrayOfTObjLinkRecord;var sub:integer):integer;virtual;abstract;
158                          function SerializePreProcess(Value:TInternalScriptString;sub:integer):TInternalScriptString;virtual;
DeSerializenull159                          //function DeSerialize(PInstance:GDBPointer;SaveFlag:GDBWord;var membuf:GDBOpenArrayOfByte;linkbuf:PGDBOpenArrayOfTObjLinkRecord):integer;virtual;abstract;
160                          function GetTypeAttributes:TTypeAttr;virtual;
GetValueAsStringnull161                          function GetValueAsString(pinstance:Pointer):TInternalScriptString;virtual;
GetFormattedValueAsStringnull162                          function GetFormattedValueAsString(PInstance:Pointer; const f:TzeUnitsFormat):TInternalScriptString;virtual;
GetUserValueAsStringnull163                          function GetUserValueAsString(pinstance:Pointer):TInternalScriptString;virtual;
GetDecoratedValueAsStringnull164                          function GetDecoratedValueAsString(pinstance:GDBPointer; const f:TzeUnitsFormat):TInternalScriptString;virtual;
165                          procedure CopyInstanceTo(source,dest:pointer);virtual;
Comparenull166                          function Compare(pleft,pright:pointer):TCompareResult;virtual;
167                          procedure SetValueFromString(PInstance:Pointer;_Value:TInternalScriptString);virtual;abstract;
168                          procedure InitInstance(PInstance:GDBPointer);virtual;
169                          destructor Done;virtual;
170                          procedure MagicFreeInstance(PInstance:Pointer);virtual;
171                          procedure MagicAfterCopyInstance(PInstance:Pointer);virtual;
172                          procedure SavePasToMem(var membuf:GDBOpenArrayOfByte;PInstance:Pointer;prefix:TInternalScriptString);virtual;
173                          procedure IncAddr(var addr:GDBPointer);virtual;
GetFactTypedefnull174                          function GetFactTypedef:PUserTypeDescriptor;virtual;
175                          procedure Format;virtual;
176                    end;
177 TPropEditor=class(TComponent)
178                  public
179                  PInstance:GDBPointer;
180                  PTD:PUserTypeDescriptor;
181                  OwnerNotify:TMyNotifyProc;
182                  fFreeOnLostFocus:boolean;
183                  byObjects:boolean;
184                  CanRunFastEditor:boolean;
185                  RunFastEditorValue:tobject;
186                  changed:boolean;
187                  constructor Create(AOwner:TComponent;_PInstance:GDBPointer;var _PTD:UserTypeDescriptor;FreeOnLostFocus:boolean);
188                  destructor Destroy;override;
189                  procedure EditingDone(Sender: TObject);//Better name ..LostFocus..
190                  procedure EditingDone2(Sender: TObject);
191                  procedure StoreData(Sender: TObject);
192                  procedure EditingProcess(Sender: TObject);
193                  procedure ExitEdit(Sender: TObject);
194                  procedure keyPress(Sender: TObject; var Key: char);
geteditornull195                  function geteditor:TWinControl;
196                  procedure SetEditorBounds(pd:PBasePropertyDeskriptor;OnlyHotFasteditors:boolean);
197             end;
198   //pd=^GDBDouble;
199   {-}{/pGDBInteger=^GDBInteger;/}
200   //pstr=^TInternalScriptString;
201   {-}{/pGDBPointer=^GDBPointer;/}
202   //pbooleab=^GDBBoolean;
203  {TODO:огнегне}
functionnull204 TTranslateFunction=function (const Identifier, OriginalValue: String): String;
205 {EXPORT+}
206 TTraceAngle=(
207               TTA90(*'90 deg'*),
208               TTA45(*'45 deg'*),
209               TTA30(*'30 deg'*)
210              );
211 TTraceMode=packed record
212                  Angle:TTraceAngle;(*'Angle'*)
213                  ZAxis:GDBBoolean;(*'Z Axis'*)
214            end;
215 TOSMode=packed record
216               kosm_inspoint:GDBBoolean;(*'Insertion'*)
217               kosm_endpoint:GDBBoolean;(*'Endpoint'*)
218               kosm_midpoint:GDBBoolean;(*'Midpoint'*)
219               kosm_3:GDBBoolean;(*'1/3'*)
220               kosm_4:GDBBoolean;(*'1/4'*)
221               kosm_center:GDBBoolean;(*'Center'*)
222               kosm_quadrant:GDBBoolean;(*'Quadrant'*)
223               kosm_point:GDBBoolean;(*'Point'*)
224               kosm_intersection:GDBBoolean;(*'Intersection'*)
225               kosm_perpendicular:GDBBoolean;(*'Perpendicular'*)
226               kosm_tangent:GDBBoolean;(*'Tangent'*)
227               kosm_nearest:GDBBoolean;(*'Nearest'*)
228               kosm_apparentintersection:GDBBoolean;(*'Apparent intersection'*)
229               kosm_paralel:GDBBoolean;(*'Paralel'*)
230         end;
231   indexdesk =packed  record
232     indexmin, count: GDBInteger;
233   end;
234   arrayindex =packed  array[1..2] of indexdesk;
235   parrayindex = ^arrayindex;
236   PTTypedData=^TTypedData;
237   TTypedData=packed record
238                    Instance: GDBPointer;
239                    PTD:{-}PUserTypeDescriptor{/GDBPointer/};
240              end;
241   TVariableAttributes=GDBInteger;
242   vardesk =packed  record
243     name: TInternalScriptString;
244     username: TInternalScriptString;
245     data: TTypedData;
246     attrib:TVariableAttributes;
247   end;
248 ptypemanagerdef=^typemanagerdef;
249 typemanagerdef={$IFNDEF DELPHI}packed{$ENDIF} object(GDBaseObject)
250                   procedure readbasetypes;virtual;abstract;
251                   procedure readexttypes(fn: TInternalScriptString);virtual;abstract;
_TypeName2Indexnull252                   function _TypeName2Index(name: TInternalScriptString): GDBInteger;virtual;abstract;
_TypeName2PTDnull253                   function _TypeName2PTD(name: TInternalScriptString):PUserTypeDescriptor;virtual;abstract;
_TypeIndex2PTDnull254                   function _TypeIndex2PTD(ind:integer):PUserTypeDescriptor;virtual;abstract;
255 
getDataMutablenull256                   function getDataMutable(index:TArrayIndex):GDBPointer;virtual;abstract;
getcountnull257                   function getcount:TArrayIndex;virtual;abstract;
AddTypeByPPnull258                   function AddTypeByPP(p:GDBPointer):TArrayIndex;virtual;abstract;
AddTypeByRefnull259                   function AddTypeByRef(var _type:UserTypeDescriptor):TArrayIndex;virtual;abstract;
260             end;
261 pvarmanagerdef=^varmanagerdef;
262 varmanagerdef={$IFNDEF DELPHI}packed{$ENDIF} object(GDBaseObject)
263                  {vardescarray:GDBOpenArrayOfData;
264                  vararray:GDBOpenArrayOfByte;}
findvardescnull265                  function findvardesc(varname:TInternalScriptString): pvardesk;virtual;abstract;
createvariablenull266                  function createvariable(varname:TInternalScriptString; var vd:vardesk;attr:TVariableAttributes=0): pvardesk;virtual;abstract;
267                  procedure createvariablebytype(varname,vartype:TInternalScriptString);virtual;abstract;
268                  procedure createbasevaluefromGDBString(varname: TInternalScriptString; varvalue: TInternalScriptString; var vd: vardesk);virtual;abstract;
findfieldcustomnull269                  function findfieldcustom(var pdesc: pGDBByte; var offset: GDBInteger;var tc:PUserTypeDescriptor; nam: shortString): GDBBoolean;virtual;abstract;
270            end;
271 {EXPORT-}
272 procedure convertToRunTime(dt:TFastEditorsVector;var rt:TFastEditorsRunTimeVector);
273 procedure clearRTd(rtv:TFastEditorsRunTimeVector);
274 procedure clearRTstate(rtv:TFastEditorsRunTimeVector);
275 var
276   date:TDateTime;
277 procedure ProcessVariableAttributes(var attr:TVariableAttributes; const setattrib,resetattrib:TVariableAttributes);
278 implementation
279 //uses log;
280 {for hide exttype}
281 procedure BasePropertyDeskriptor.free;
282 begin
283    inherited;
284    freeandnil(FastEditors);
285 end;
286 procedure clearRTd(rtv:TFastEditorsRunTimeVector);
287 var
288   i:integer;
289 begin
290   if (assigned(rtv))and(rtv.size>0)then
291     for i:=0 to rtv.size-1 do
292       begin
293         rtv.Mutable[i]^.FastEditorDrawed:=false;
294       end;
295 end;
296 procedure clearRTstate(rtv:TFastEditorsRunTimeVector);
297 var
298   i:integer;
299 begin
300   if (assigned(rtv))and(rtv.size>0)then
301     for i:=0 to rtv.size-1 do
302       begin
303         rtv.Mutable[i]^.FastEditorState:=TFES_Default;
304       end;
305 end;
306 procedure convertToRunTime(dt:TFastEditorsVector;var rt:TFastEditorsRunTimeVector);
307 var
308   i:integer;
309   td:TFastEditorRunTimeData;
310 begin
311   if (assigned(dt))and(dt.size>0)then
312   begin
313     if not assigned(rt) then
314                         begin
315                             rt:=TFastEditorsRunTimeVector.Create;
316                             rt.Reserve(dt.size);
317                             for i:=0 to dt.size-1 do
318                               begin
319                                 td.Procs:=dt[i];
320                                 rt.PushBack(td);
321                                 //result.Mutable[i]^.Procs:=dt[i];
322                               end;
323                         end
324                         else
325                         begin
326                             for i:=0 to dt.size-1 do
327                               begin
328                                 rt.Mutable[i]^.Procs:=dt[i];
329                               end;
330                         end
331 
332   end
333   else
334    begin
335      if assigned(rt) then
336                          rt.destroy;
337      rt:=nil;
338    end;
339 end;
340 procedure ProcessVariableAttributes(var attr:TVariableAttributes; const setattrib,resetattrib:TVariableAttributes);
341 begin
342      attr:=(attr or setattrib)and(not resetattrib);
343 end;
344 
345 constructor TPropEditor.Create(AOwner:TComponent;_PInstance:GDBPointer;var _PTD:UserTypeDescriptor;FreeOnLostFocus:boolean);
346 begin
347      inherited create(AOwner);
348      PInstance:=_PInstance;
349      PTD:=@_PTD;
350      fFreeOnLostFocus:=FreeOnLostFocus;
351      byObjects:=false;
352      CanRunFastEditor:=false;
353      RunFastEditorValue:=nil;
354      changed:=false;
355 end;
TPropEditor.geteditornull356 function TPropEditor.geteditor:TWinControl;
357 begin
358      tobject(result):=(self.Components[0]);
359 end;
360 procedure TPropEditor.SetEditorBounds(pd:PBasePropertyDeskriptor;OnlyHotFasteditors:boolean);
361 var
362   editorcontrol:TWinControl;
363   r:trect;
364   i:integer;
365 begin
366      if pd<>nil then begin
367        editorcontrol:=geteditor;
368        r:=pd^.rect;
369        if not OnlyHotFasteditors then
370          if assigned(pd^.FastEditors) then
371            for i:=0 to pd^.FastEditors.Size-1 do
372              if pd^.FastEditors[i].FastEditorDrawed then
373                if pd^.FastEditors[i].FastEditorRect.Left<r.Right then
374                  r.Right:=pd^.FastEditors[i].FastEditorRect.Left;
375        editorcontrol.SetBounds(r.Left+2,r.Top,r.Right-r.Left-2,r.Bottom-r.Top);
376      end;
377 end;
378 destructor TPropEditor.Destroy;
379 begin
380      tobject(self.Components[0]).destroy;
381      inherited;
382 end;
383 procedure TPropEditor.keyPress(Sender: TObject; var Key: char);
384 begin
385      if key=#13 then
386                     if assigned(OwnerNotify) then
387                                                  begin
388                                                       ptd^.SetValueFromString(PInstance,tedit(sender).text);
389                                                       OwnerNotify(self,TMNC_EditingDoneEnterKey);
390                                                  end;
391 end;
392 procedure TPropEditor.StoreData(Sender: TObject);
393 var
394   i:integer;
395   p:pointer;
396 begin
397      if changed then
398      begin
399      if byobjects then
400                       begin
401                            i:=tcombobox(sender).ItemIndex;
402                            p:=tcombobox(sender).Items.Objects[i];
403                            ptd^.CopyInstanceTo(@p,PInstance)
404                       end
405                   else
406                       ptd^.SetValueFromString(PInstance,tedit(sender).text);
407      end;
408 end;
409 procedure TPropEditor.EditingDone(Sender: TObject);
410 begin
411      StoreData(sender);
412      if assigned(OwnerNotify) then
413                                   OwnerNotify(self,TMNC_EditingDoneLostFocus);
414 end;
415 procedure TPropEditor.EditingDone2(Sender: TObject);
416 begin
417      StoreData(sender);
418      tedit(sender).OnExit:=nil;
419      if assigned(OwnerNotify) then
420                                   OwnerNotify(self,TMNC_EditingDoneDoNothing);
421 end;
422 procedure TPropEditor.EditingProcess(Sender: TObject);
423 var
424   i:integer;
425   p:pointer;
426   rfs:boolean;
427   selectableeditor:boolean;
428 begin
429      changed:=true;
430      selectableeditor:=false;
431      if self.geteditor is TCombobox then
432      if TCombobox(self.geteditor).Style in [csDropDownList,csOwnerDrawFixed,csOwnerDrawVariable]  then
433        selectableeditor:=true;
434      if (not fFreeOnLostFocus)or(selectableeditor) then
435      begin
436      rfs:=false;
437      if assigned(OwnerNotify) then
438                                   begin
439                                        if byobjects then
440                                                         begin
441                                                              i:=tcombobox(sender).ItemIndex;
442                                                              p:=tcombobox(sender).Items.Objects[i];
443                                                              if CanRunFastEditor then
444                                                              if pointer(RunFastEditorValue)=p then
445                                                                                          rfs:=true;
446                                                              if not rfs then
447                                                                             ptd^.CopyInstanceTo(@p,PInstance);
448                                                         end
449                                                     else
450                                                         ptd^.SetValueFromString(PInstance,tedit(sender).text);
451                                         if rfs then
452                                                    OwnerNotify(self,TMNC_RunFastEditor)
453                                                else
454                                                    begin
455                                                      if selectableeditor then
456                                                       OwnerNotify(self,{TMNC_EditingDoneDoNothing}TMNC_EditingProcess)
457                                                      else
458                                                       OwnerNotify(self,TMNC_EditingProcess);
459                                                    end;
460                                   end;
461      end
462 end;
463 procedure TPropEditor.ExitEdit(Sender: TObject);
464 var
465    peditor:tobject;
466 begin
467      if fFreeOnLostFocus then
468                              begin
469                                   peditor:=self.geteditor;
470                                   if peditor<>nil then
471                                                       EditingDone(peditor);
472                              end;
473 end;
474 procedure UserTypeDescriptor.IncAddr(var addr:GDBPointer);
475 begin
476      inc(pGDBByte(addr),SizeInGDBBytes);
477 end;
UserTypeDescriptor.GetFactTypedefnull478 function UserTypeDescriptor.GetFactTypedef:PUserTypeDescriptor;
479 begin
480      result:=@self;
481 end;
482 procedure UserTypeDescriptor.Format;
483 begin
484 end;
485 procedure UserTypeDescriptor.SavePasToMem(var membuf:GDBOpenArrayOfByte;PInstance:Pointer;prefix:TInternalScriptString);
486 begin
487      membuf.TXTAddGDBStringEOL(prefix+':='+{pvd.data.PTD.}GetValueAsString(PInstance)+';');
488 end;
489 procedure UserTypeDescriptor.MagicFreeInstance(PInstance:Pointer);
490 begin
491 end;
492 procedure UserTypeDescriptor.MagicAfterCopyInstance(PInstance:Pointer);
493 begin
494 
495 end;
496 procedure UserTypeDescriptor.InitInstance(PInstance:GDBPointer);
497 begin
498      fillchar(pinstance^,SizeInGDBBytes,0)
499 end;
500 procedure UserTypeDescriptor.CopyInstanceTo(source,dest:pointer);
501 begin
502      Move(source^, dest^,SizeInGDBBytes);
503      MagicAfterCopyInstance(dest);
504 end;
UserTypeDescriptor.Comparenull505 function UserTypeDescriptor.Compare(pleft,pright:pointer):TCompareResult;
506 begin
507      if CompareByte(pleft^,pright^,SizeInGDBBytes)=0 then
508                                                          result:=CREqual
509                                                      else
510                                                          result:=CRNotEqual;
511 end;
512 
UserTypeDescriptor.SerializePreProcessnull513 function UserTypeDescriptor.SerializePreProcess(Value:TInternalScriptString;sub:integer):TInternalScriptString;
514 begin
515      result:=DupeString(' ',sub)+value;
516 end;
517 procedure UserTypeDescriptor._init(size:GDBInteger;tname:string;pu:pointer);
518 begin
519      SizeInGDBBytes:=size;
520      pointer(typename):=nil;
521      typename:=tname;
522      PUnit:=pu;
523      oip.ci:=0;
524      oip.barpos:=0;
525      collapsed:=true;
526      onCreateEditorFunc:=nil;
527 end;
528 
529 constructor UserTypeDescriptor.init(size:GDBInteger;tname:string;pu:pointer);
530 begin
531      baseinit(size,tname,pu);
532 end;
533 constructor UserTypeDescriptor.baseinit(size:GDBInteger;tname:string;pu:pointer);
534 begin
535      _init(size,tname,pu);
536      Decorators.OnGetValueAsString:=nil;
537      FastEditors:=nil;
538 end;
539 
540 destructor UserTypeDescriptor.done;
541 begin
542      if VerboseLog^ then
543        DebugLn('{T}[FINALIZATION_TYPES]'+self.TypeName);
544      //programlog.LogOutStr(self.TypeName,lp_OldPos,LM_Trace);
545      SizeInGDBBytes:=0;
546      typename:='';
547      if FastEditors<>nil then
548                              FastEditors.Destroy;
549 end;
UserTypeDescriptor.CreateEditornull550 function UserTypeDescriptor.CreateEditor(TheOwner:TPropEditorOwner;rect:trect;pinstance:pointer;psa:PTZctnrVectorGDBString;FreeOnLostFocus:boolean;InitialValue:TInternalScriptString;preferedHeight:integer):TEditorDesc;
551 begin
552      if assigned(onCreateEditorFunc) then
553                                          result:=onCreateEditorFunc(TheOwner,rect,pinstance,psa,FreeOnLostFocus,initialvalue,@self,preferedHeight)
554                                      else
555                                          begin
556                                            result.editor:=nil;
557                                            result.mode:=TEM_Nothing;
558                                          end;
559 end;
UserTypeDescriptor.GetTypeAttributesnull560 function UserTypeDescriptor.GetTypeAttributes:TTypeAttr;
561 begin
562      result:=0;
563 end;
UserTypeDescriptor.GetValueAsStringnull564 function UserTypeDescriptor.GetValueAsString(pinstance:Pointer):TInternalScriptString;
565 begin
566      result:='UserTypeDescriptor.GetValueAsString;';
567 end;
UserTypeDescriptor.GetFormattedValueAsStringnull568 function UserTypeDescriptor.GetFormattedValueAsString(pinstance:Pointer; const f:TzeUnitsFormat):TInternalScriptString;
569 begin
570      result:=GetValueAsString(PInstance);
571 end;
572 
UserTypeDescriptor.GetUserValueAsStringnull573 function UserTypeDescriptor.GetUserValueAsString(pinstance:Pointer):TInternalScriptString;
574 begin
575      result:=GetValueAsString(pinstance);
576 end;
UserTypeDescriptor.GetDecoratedValueAsStringnull577 function UserTypeDescriptor.GetDecoratedValueAsString(pinstance:GDBPointer; const f:TzeUnitsFormat):TInternalScriptString;
578 begin
579      if assigned(Decorators.OnGetValueAsString) then
580                                          result:=Decorators.OnGetValueAsString(pinstance)
581                                      else
582                                          result:=GetFormattedValueAsString(pinstance,f);
583 end;
584 begin
585   DecimalSeparator := '.';
586 end.
587 
588