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 uzccommandsabstract;
20 {$INCLUDE def.inc}
21 interface
22 uses uzbgeomtypes,uzbtypesbase,uzbtypes,uzglviewareadata,uzclog,gzctnrvectortypes;
23 const
24 CADWG=1;
25 CASelEnt=2;
26 CASelEnts=4;
27 CACanUndo=8;
28 CACanRedo=16;
29 CADWGChanged=32;
30
31
32 CEDeSelect=1;
33 CEDWGNChanged=2;
34 EmptyCommandOperands='';
35 type
36 TInteractiveProcObjBuild=procedure(const PInteractiveData:GDBPointer;Point:GDBVertex;Click:GDBBoolean);
37 {Export+}
38 TGetPointMode=(TGPWait{point},TGPWaitEnt,TGPEnt,TGPPoint,TGPCancel,TGPOtherCommand, TGPCloseDWG,TGPCloseApp);
39 TInteractiveData=packed record
40 GetPointMode:TGetPointMode;(*hidden_in_objinsp*)
41 GetPointValue:GDBVertex;(*hidden_in_objinsp*)
42 PInteractiveData:GDBPointer;
43 PInteractiveProc:{-}TInteractiveProcObjBuild{/GDBPointer/};
44 end;
45 TCommandOperands={-}GDBString{/GDBPointer/};
46 TCommandResult=GDBInteger;
47 TCStartAttr=GDBInteger;{атрибут разрешения\запрещения запуска команды}
48 TCEndAttr=GDBInteger;{атрибут действия по завершению команды}
49 PCommandObjectDef = ^CommandObjectDef;
50 CommandObjectDef ={$IFNDEF DELPHI}packed{$ENDIF} object (GDBaseObject)
51 CommandName:GDBString;(*hidden_in_objinsp*)
52 CommandGDBString:GDBString;(*hidden_in_objinsp*)
53 savemousemode: GDBByte;(*hidden_in_objinsp*)
54 mouseclic: GDBInteger;(*hidden_in_objinsp*)
55 dyn:GDBBoolean;(*hidden_in_objinsp*)
56 overlay:GDBBoolean;(*hidden_in_objinsp*)
57 CStartAttrEnableAttr:TCStartAttr;(*hidden_in_objinsp*)
58 CStartAttrDisableAttr:TCStartAttr;(*hidden_in_objinsp*)
59 CEndActionAttr:TCEndAttr;(*hidden_in_objinsp*)
60 pdwg:GDBPointer;(*hidden_in_objinsp*)
61 NotUseCommandLine:GDBBoolean;(*hidden_in_objinsp*)
62 IData:TInteractiveData;(*hidden_in_objinsp*)
63 procedure CommandStart(Operands:TCommandOperands); virtual; abstract;
64 procedure CommandEnd; virtual; abstract;
65 procedure CommandCancel; virtual; abstract;
66 procedure CommandInit; virtual; abstract;
67 procedure DrawHeplGeometry;virtual;
68 destructor done;virtual;
69 constructor init(cn:GDBString;SA,DA:TCStartAttr);
GetObjTypeNamenull70 function GetObjTypeName:GDBString;virtual;
IsRTECommandnull71 function IsRTECommand:GDBBoolean;virtual;
72 procedure CommandContinue; virtual;
73 end;
74 CommandFastObjectDef ={$IFNDEF DELPHI}packed{$ENDIF} object(CommandObjectDef)
75 UndoTop:TArrayIndex;(*hidden_in_objinsp*)
76 procedure CommandInit; virtual;abstract;
77 procedure CommandEnd; virtual;abstract;
78 end;
79 PCommandRTEdObjectDef=^CommandRTEdObjectDef;
80 CommandRTEdObjectDef = {$IFNDEF DELPHI}packed{$ENDIF} object(CommandFastObjectDef)
81 procedure CommandStart(Operands:TCommandOperands); virtual;abstract;
82 procedure CommandEnd; virtual;abstract;
83 procedure CommandCancel; virtual;abstract;
84 procedure CommandInit; virtual;abstract;
85 procedure CommandContinue; virtual;
MouseMoveCallbacknull86 function MouseMoveCallback(wc: GDBvertex; mc: GDBvertex2DI; var button: GDBByte;osp:pos_record): GDBInteger; virtual;
BeforeClicknull87 function BeforeClick(wc: GDBvertex; mc: GDBvertex2DI; var button: GDBByte;osp:pos_record): GDBInteger; virtual;
AfterClicknull88 function AfterClick(wc: GDBvertex; mc: GDBvertex2DI; var button: GDBByte;osp:pos_record): GDBInteger; virtual;
IsRTECommandnull89 function IsRTECommand:GDBBoolean;virtual;
90 end;
91 {Export-}
92 implementation
CommandObjectDef.IsRTECommandnull93 function CommandObjectDef.IsRTECommand:GDBBoolean;
94 begin
95 result:=false;
96 end;
97 procedure CommandObjectDef.CommandContinue;
98 begin
99 end;
CommandObjectDef.GetObjTypeNamenull100 function CommandObjectDef.GetObjTypeName:GDBString;
101 begin
102 //pointer(result):=typeof(testobj);
103 result:='CommandObjectDef';
104
105 end;
106 constructor CommandObjectDef.init;
107 begin
108 CStartAttrEnableAttr:=SA or CADWG;
109 CStartAttrDisableAttr:=DA;
110 overlay:=false;
111 CEndActionAttr:=CEDeSelect;
112 NotUseCommandLine:=true;
113 IData.GetPointMode:=TGPCancel;
114 end;
115
116 destructor CommandObjectDef.done;
117 begin
118 //inherited;
119 CommandName:='';
120 CommandGDBString:='';
121 end;
122 procedure CommandObjectDef.DrawHeplGeometry;
123 begin
124 end;
CommandRTEdObjectDef.BeforeClicknull125 function CommandRTEdObjectDef.BeforeClick(wc: GDBvertex; mc: GDBvertex2DI; var button: GDBByte;osp:pos_record):GDBInteger;
126 begin
127 result:=0;
128 end;
CommandRTEdObjectDef.AfterClicknull129 function CommandRTEdObjectDef.AfterClick(wc: GDBvertex; mc: GDBvertex2DI; var button: GDBByte;osp:pos_record): GDBInteger;
130 begin
131 if self.mouseclic=1 then
132 result:=0
133 else
134 result:=0;
135 end;
CommandRTEdObjectDef.IsRTECommandnull136 function CommandRTEdObjectDef.IsRTECommand:GDBBoolean;
137 begin
138 result:=true;
139 end;
140 procedure CommandRTEdObjectDef.CommandContinue;
141 begin
142 end;
CommandRTEdObjectDef.MouseMoveCallbacknull143 function CommandRTEdObjectDef.MouseMoveCallback(wc: GDBvertex; mc: GDBvertex2DI; var button: GDBByte;osp:pos_record): GDBInteger;
144 begin
145 //result:=0;
146 programlog.logoutstr('CommandRTEdObjectDef.MouseMoveCallback',0,LM_Trace);
147 { if button =1 then
148 begin
149 button:=-button;
150 button:=-button;
151 end;}
152 if (button and MZW_LBUTTON)<>0 then
153 begin
154 button:=button;
155 end;
156 if mouseclic = 0 then
157 result := BeforeClick(wc, mc, button,osp)
158 else
159 result := AfterClick(wc, mc, button,osp);
160 if ((button and MZW_LBUTTON)<>0)and(result<=0) then
161 begin
162 inc(self.mouseclic);
163 end;
164 end;
165 begin
166 end.
167