-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
154 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
@author(Andrey Zubarev <[email protected]>) | ||
} | ||
{$MODE OBJFPC}{$H+} | ||
unit uzccommand_copy; | ||
unit uzcCommand_Copy; | ||
{$INCLUDE zengineconfig.inc} | ||
|
||
interface | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
@author(Andrey Zubarev <[email protected]>) | ||
} | ||
{$mode delphi} | ||
unit uzccommand_copyclip; | ||
unit uzcCommand_CopyClip; | ||
|
||
{$INCLUDE zengineconfig.inc} | ||
|
||
|
@@ -32,7 +32,7 @@ interface | |
uzgldrawcontext, | ||
uzcdrawings, | ||
uzccommandsabstract,uzccommandsimpl, | ||
uzegeometry,uzegeometrytypes; | ||
uzegeometry,uzegeometrytypes,uzcCommand_Duplicate; | ||
|
||
const | ||
ZCAD_DXF_CLIPBOARD_NAME='[email protected]'; | ||
|
@@ -50,7 +50,6 @@ procedure CopyToClipboard; | |
var | ||
s:ansistring; | ||
suni:unicodestring; | ||
I:integer; | ||
zcformat:TClipboardFormat; | ||
begin | ||
if fileexists(utf8tosys(CopyClipFile)) then | ||
|
@@ -61,10 +60,6 @@ procedure CopyToClipboard; | |
savedxf2000(s,ProgramPath + '/components/empty.dxf',ClipboardDWG^); | ||
s:=s+#0; | ||
suni:=s; | ||
//setlength(suni,length(s)*2+2); | ||
//fillchar(suni[1],length(suni),0); | ||
//for I := 1 to length(s) do | ||
// suni[i*2-1]:=s[i]; | ||
Clipboard.Open; | ||
Clipboard.Clear; | ||
zcformat:=RegisterClipboardFormat(ZCAD_DXF_CLIPBOARD_NAME); | ||
|
@@ -93,30 +88,13 @@ function CopyClip_com(const Context:TZCADCommandContext;operands:TCommandOperand | |
pobj,pobjcopy:pGDBObjEntity; | ||
ir:itrec; | ||
DC:TDrawContext; | ||
NeedReCreateClipboardDWG:boolean; | ||
FoundEnts:boolean; | ||
SelectedAABB:TBoundingBox; | ||
m:DMatrix4D; | ||
begin | ||
ClipboardDWG.pObjRoot.ObjArray.free; | ||
dc:=drawings.GetCurrentDwg^.CreateDrawingRC(false,[DCODrawable]); | ||
NeedReCreateClipboardDWG:=true; | ||
FoundEnts:=false; | ||
SelectedAABB:=default(TBoundingBox); | ||
|
||
pobj:=drawings.GetCurrentROOT.ObjArray.beginiterate(ir); | ||
if pobj<>nil then repeat | ||
if pobj.selected then begin | ||
if FoundEnts then | ||
ConcatBB(SelectedAABB,pobj.vp.BoundingBox) | ||
else | ||
SelectedAABB:=pobj.vp.BoundingBox; | ||
FoundEnts:=true; | ||
end; | ||
pobj:=drawings.GetCurrentROOT.ObjArray.iterate(ir); | ||
until pobj=nil; | ||
|
||
if FoundEnts then begin | ||
if GetSelectedEntsAABB(drawings.GetCurrentROOT.ObjArray,SelectedAABB) then begin | ||
ReCreateClipboardDWG; | ||
m:=CreateTranslationMatrix(-SelectedAABB.LBN{-(SelectedAABB.RTF+SelectedAABB.LBN)/2}); | ||
pobj:=drawings.GetCurrentROOT.ObjArray.beginiterate(ir); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
@author(Andrey Zubarev <[email protected]>) | ||
} | ||
{$mode delphi} | ||
unit uzccommand_cutclip; | ||
unit uzcCommand_CutClip; | ||
|
||
{$INCLUDE zengineconfig.inc} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{ | ||
***************************************************************************** | ||
* * | ||
* This file is part of the ZCAD * | ||
* * | ||
* See the file COPYING.txt, included in this distribution, * | ||
* for details about the copyright. * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * | ||
* * | ||
***************************************************************************** | ||
} | ||
{ | ||
@author(Andrey Zubarev <[email protected]>) | ||
} | ||
{$mode delphi} | ||
unit uzcCommand_Duplicate; | ||
|
||
{$INCLUDE zengineconfig.inc} | ||
|
||
interface | ||
uses | ||
uzcLog, | ||
SysUtils, | ||
LCLType,LazUTF8,Clipbrd, | ||
uzbpaths, | ||
uzeentity, | ||
uzeffdxf, | ||
gzctnrVectorTypes, | ||
uzgldrawcontext, | ||
uzcdrawings, | ||
uzcstrconsts, | ||
uzccommandsabstract,uzccommandsimpl,UGDBVisibleOpenArray, | ||
uzegeometry,uzegeometrytypes,uzcinterface,uzccommandsmanager, | ||
uzcCommand_Copy,uzglviewareadata; | ||
|
||
type | ||
duplicade_com= object(copy_com) | ||
procedure CommandStart(const Context:TZCADCommandContext;Operands:TCommandOperands);virtual; | ||
//function CalcTransformMatrix(p1,p2: GDBvertex):DMatrix4D; virtual; | ||
function AfterClick(const Context:TZCADCommandContext;wc: GDBvertex; mc: GDBvertex2DI; var button: Byte;osp:pos_record): Integer; virtual; | ||
end; | ||
var | ||
duplicade:duplicade_com; | ||
|
||
function GetSelectedEntsAABB(constref ObjArray:GDBObjEntityOpenArray;out SelectedAABB:TBoundingBox):boolean; | ||
|
||
implementation | ||
|
||
function GetSelectedEntsAABB(constref ObjArray:GDBObjEntityOpenArray;out SelectedAABB:TBoundingBox):boolean; | ||
var | ||
pobj:pGDBObjEntity; | ||
ir:itrec; | ||
begin | ||
Result:=False; | ||
SelectedAABB:=default(TBoundingBox); | ||
|
||
pobj:=ObjArray.beginiterate(ir); | ||
if pobj<>nil then repeat | ||
if pobj.selected then begin | ||
if Result then | ||
ConcatBB(SelectedAABB,pobj.vp.BoundingBox) | ||
else | ||
SelectedAABB:=pobj.vp.BoundingBox; | ||
Result:=true; | ||
end; | ||
pobj:=ObjArray.iterate(ir); | ||
until pobj=nil; | ||
end; | ||
|
||
procedure duplicade_com.CommandStart(const Context:TZCADCommandContext;Operands:TCommandOperands); | ||
var | ||
SelectedAABB:TBoundingBox; | ||
begin | ||
Inherited; | ||
if drawings.GetCurrentDWG^.ConstructObjRoot.ObjArray.GetRealCount>0 then begin | ||
GetSelectedEntsAABB(drawings.GetCurrentROOT.ObjArray,SelectedAABB); | ||
t3dp:=SelectedAABB.LBN; | ||
inc(mouseclic); | ||
end else begin | ||
ZCMsgCallBackInterface.TextMessage(rscmSelEntBeforeComm,TMWOHistoryOut); | ||
Commandmanager.executecommandend; | ||
end; | ||
end; | ||
|
||
function duplicade_com.AfterClick(const Context:TZCADCommandContext;wc: GDBvertex; mc: GDBvertex2DI; var button: Byte;osp:pos_record): Integer; | ||
begin | ||
inherited; | ||
if (button and MZW_LBUTTON)<>0 then | ||
Commandmanager.executecommandend; | ||
end; | ||
|
||
initialization | ||
programlog.LogOutFormatStr('Unit "%s" initialization',[{$INCLUDE %FILE%}],LM_Info,UnitsInitializeLMId); | ||
duplicade.init('Duplicate',0,0); | ||
finalization | ||
ProgramLog.LogOutFormatStr('Unit "%s" finalization',[{$INCLUDE %FILE%}],LM_Info,UnitsFinalizeLMId); | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
@author(Andrey Zubarev <[email protected]>) | ||
} | ||
{$MODE OBJFPC}{$H+} | ||
unit uzccommand_move; | ||
unit uzcCommand_Move; | ||
{$INCLUDE zengineconfig.inc} | ||
|
||
interface | ||
|
@@ -55,8 +55,10 @@ TCopyObjectDesc=record | |
move_com = object(CommandRTEdObject) | ||
t3dp: gdbvertex; | ||
pcoa:ptpcoavector; | ||
//constructor init; | ||
procedure CommandStart(const Context:TZCADCommandContext;Operands:TCommandOperands); virtual; | ||
protected | ||
function InternalCommandStart(const Context:TZCADCommandContext;Operands:TCommandOperands):Boolean;virtual; | ||
public | ||
procedure CommandStart(const Context:TZCADCommandContext;Operands:TCommandOperands);virtual; | ||
procedure CommandCancel(const Context:TZCADCommandContext); virtual; | ||
function BeforeClick(const Context:TZCADCommandContext;wc: GDBvertex; mc: GDBvertex2DI; var button: Byte;osp:pos_record): Integer; virtual; | ||
function AfterClick(const Context:TZCADCommandContext;wc: GDBvertex; mc: GDBvertex2DI; var button: Byte;osp:pos_record): Integer; virtual; | ||
|
@@ -82,16 +84,14 @@ procedure Move_com.showprompt(mklick:integer); | |
end; | ||
end; | ||
|
||
procedure Move_com.CommandStart(const Context:TZCADCommandContext;Operands:TCommandOperands); | ||
var //i: Integer; | ||
function Move_com.InternalCommandStart(const Context:TZCADCommandContext;Operands:TCommandOperands):Boolean; | ||
var | ||
tv,pobj: pGDBObjEntity; | ||
ir:itrec; | ||
counter:integer; | ||
tcd:TCopyObjectDesc; | ||
dc:TDrawContext; | ||
ir:itrec; | ||
counter:integer; | ||
tcd:TCopyObjectDesc; | ||
dc:TDrawContext; | ||
begin | ||
//self.savemousemode:=drawings.GetCurrentDWG^.wa.param.md.mode; | ||
Inherited; | ||
counter:=0; | ||
|
||
pobj:=drawings.GetCurrentROOT^.ObjArray.beginiterate(ir); | ||
|
@@ -103,39 +103,42 @@ procedure Move_com.CommandStart(const Context:TZCADCommandContext;Operands:TComm | |
until pobj=nil; | ||
|
||
|
||
if counter>0 then | ||
begin | ||
if counter>0 then begin | ||
inherited CommandStart(context,''); | ||
drawings.GetCurrentDWG^.wa.SetMouseMode((MGet3DPoint) or (MMoveCamera) or (MRotateCamera)); | ||
showprompt(0); | ||
dc:=drawings.GetCurrentDWG^.CreateDrawingRC; | ||
Getmem(Pointer(pcoa),sizeof(tpcoavector)); | ||
pcoa^.init(counter); | ||
pobj:=drawings.GetCurrentROOT^.ObjArray.beginiterate(ir); | ||
if pobj<>nil then | ||
repeat | ||
begin | ||
if pobj^.selected then | ||
begin | ||
tv := pobj^.Clone({drawings.GetCurrentROOT}@drawings.GetCurrentDWG^.ConstructObjRoot); | ||
if tv<>nil then | ||
begin | ||
tv^.State:=tv^.State+[ESConstructProxy]; | ||
drawings.GetCurrentDWG^.ConstructObjRoot.AddMi(@tv); | ||
//ObjArray.AddPEntity(tv^); | ||
tcd.sourceEnt:=pobj; | ||
tcd.tmpProxy:=tv; | ||
tcd.copyEnt:=nil; | ||
pcoa^.PushBackData(tcd); | ||
tv^.formatentity(drawings.GetCurrentDWG^,dc); | ||
end; | ||
end; | ||
end; | ||
pobj:=drawings.GetCurrentROOT^.ObjArray.iterate(ir); | ||
until pobj=nil | ||
end | ||
else | ||
begin | ||
dc:=drawings.GetCurrentDWG^.CreateDrawingRC; | ||
Getmem(Pointer(pcoa),sizeof(tpcoavector)); | ||
pcoa^.init(counter); | ||
pobj:=drawings.GetCurrentROOT^.ObjArray.beginiterate(ir); | ||
if pobj<>nil then | ||
repeat | ||
if pobj^.selected then begin | ||
tv := pobj^.Clone(@drawings.GetCurrentDWG^.ConstructObjRoot); | ||
if tv<>nil then | ||
begin | ||
tv^.State:=tv^.State+[ESConstructProxy]; | ||
drawings.GetCurrentDWG^.ConstructObjRoot.AddMi(@tv); | ||
tcd.sourceEnt:=pobj; | ||
tcd.tmpProxy:=tv; | ||
tcd.copyEnt:=nil; | ||
pcoa^.PushBackData(tcd); | ||
tv^.formatentity(drawings.GetCurrentDWG^,dc); | ||
end; | ||
end; | ||
pobj:=drawings.GetCurrentROOT^.ObjArray.iterate(ir); | ||
until pobj=nil; | ||
result:=True; | ||
end else begin | ||
result:=False; | ||
end; | ||
|
||
end; | ||
|
||
procedure Move_com.CommandStart(const Context:TZCADCommandContext;Operands:TCommandOperands); | ||
begin | ||
Inherited; | ||
if not InternalCommandStart(Context,Operands) then begin | ||
ZCMsgCallBackInterface.TextMessage(rscmSelEntBeforeComm,TMWOHistoryOut); | ||
Commandmanager.executecommandend; | ||
end; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
@author(Andrey Zubarev <[email protected]>) | ||
} | ||
{$MODE OBJFPC}{$H+} | ||
unit uzccommand_PasteClip; | ||
unit uzcCommand_PasteClip; | ||
{$INCLUDE zengineconfig.inc} | ||
|
||
interface | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters