Shift: TShiftState; X, Y: Integer);
procedure ToolButton6Click(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure AcadDocument1BeginCommand(Sender: TObject;
var CommandName: OleVariant);
procedure AcadDocument1EndCommand(Sender: TObject;
var CommandName: OleVariant);
procedure ToolButton4Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure STDPanel1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure STDPanel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure STDPanel2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure STDPanel2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure STDPanel2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure ToolButton20Click(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure ToolButton21Click(Sender: TObject);
procedure tbSaveClick(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
Successful: Boolean;
CommandEnded: Boolean;
CommandsCount: Integer;
public
{ Public declarations }
Item:array [1..10000] of TProcess;
links:array [1..10000] of TLink;
SaveFile: TStringList;
OpenFile: TStringList;
SelectItems: Boolean;
Drag: Boolean;
OldSelect: TPoint;
SelectedItems: TItemList;
SelectedLinks: TLinkList;
// procedure DefineLinkInACAD(Link: TLink; NewParams: TStrings; IdentLinks: TLinkList);
// procedure SelectParams(Item: TProcess);
// function GetInput(Bits: Integer; KeyWordList, Prompt: OLEVariant): WideString;
// procedure CreateProfile(Item: TProcess); //тючтЁр•рхЄ False хёыш яюы№чютрЄхы№ юЄьхэшы
end;
type
item_type=record
left,top,width,height:integer;
hint:string[80];
pic_path:string[80];
kol: Word;
par:array [1..100] of string[80];
end;
link_type=record
first,second: Word;
caption:string[80];
kol: Word;
par:array [1..100] of string[80];
end;
det=record
kol_tool: Word;
end;
const
FlipInds: array[1..2] of Char = ('a','b');
var
Form1: TForm1;
program_dir:string;
index: Word;
Item_index,index_item: Word;
click_arr:array [1..2] of Word;
mx,my:integer;
link_index,index_link: Word;
first_click,second_click:boolean;
dx,dy: Word;
destroy_flag:boolean;
rr:TRect;
p_rr:PRect;
detal1,detal2:word;
current_item:word;
current_Link: Word;
flip_flag:Boolean;
labs:array of TLabel;
kol:byte;
t,ht,e:real;
method:integer;
desc:string;
implementation
uses WaitCommand, LinkEdit, Variables,
Progress,Unit2, Unit3, relation,model_param_dlg;
{$R *.DFM}
procedure TForm1.LinkDblClick(Sender: TObject);
var st:TStringList;
t:Tlink;
s:string;
begin
st:=(sender as Tlink).Param;
t:=sender as Tlink;
linksfm.showEdit(t);
end;
procedure TForm1.ItemDblClick(Sender: TObject);
begin
if (Sender as TProcess).Hint='=хяюфтшцэр _юяюЁр' then
begin
massafm.Edit6.Visible:=false;
massafm.Edit7.Visible:=false;
massafm.label8.Visible:=false;
massafm.label9.Visible:=false;
massafm.Edit1.Text:=(Sender as TProcess).FileName.Strings[2];
massafm.Edit2.Text:=(Sender as TProcess).FileName.Strings[3];
massafm.Edit3.Text:=(Sender as TProcess).FileName.Strings[4];
massafm.Edit4.Text:=(Sender as TProcess).FileName.Strings[5];
massafm.Edit5.Text:=(Sender as TProcess).FileName.Strings[6];
if (Sender as TProcess).FileName.Strings[7]='TRUE' then
massafm.CheckBox1.Checked:=true
else massafm.CheckBox1.Checked:=false;
massafm.Caption:=(Sender as TProcess).FileName.Strings[0];
massafm.ShowModal;
(Sender as TProcess).FileName.Clear;
(Sender as TProcess).FileName.Add(massafm.Caption);
(Sender as TProcess).FileName.Add('notmov');
(Sender as TProcess).FileName.Add(massafm.Edit1.Text);
(Sender as TProcess).FileName.Add(massafm.Edit2.Text);
(Sender as TProcess).FileName.Add(massafm.Edit3.Text);
(Sender as TProcess).FileName.Add(massafm.Edit4.Text);
(Sender as TProcess).FileName.Add(massafm.Edit5.Text);
if massafm.CheckBox1.Checked=true then
(Sender as TProcess).FileName.Add('TRUE')
else (Sender as TProcess).FileName.Add('FALSE');
end;
if (Sender as TProcess).Hint='TюёЁхфюЄюўхээр _ьрёёр' then
begin
massafm.Edit6.Visible:=true;
massafm.Edit7.Visible:=true;
massafm.label8.Visible:=true;
massafm.label9.Visible:=true;
massafm.Edit1.Text:=(Sender as TProcess).FileName.Strings[2];
massafm.Edit2.Text:=(Sender as TProcess).FileName.Strings[3];
massafm.Edit3.Text:=(Sender as TProcess).FileName.Strings[4];
massafm.Edit4.Text:=(Sender as TProcess).FileName.Strings[5];
massafm.Edit5.Text:=(Sender as TProcess).FileName.Strings[6];
massafm.Edit6.Text:=(Sender as TProcess).FileName.Strings[7];
massafm.Edit7.Text:=(Sender as TProcess).FileName.Strings[8];
if (Sender as TProcess).FileName.Strings[9]='TRUE' then
massafm.CheckBox1.Checked:=true
else massafm.CheckBox1.Checked:=false;
massafm.Caption:=(Sender as TProcess).FileName.Strings[0];
massafm.ShowModal;
(Sender as TProcess).FileName.Clear;
(Sender as TProcess).FileName.Add(massafm.Caption);
(Sender as TProcess).FileName.Add('notmov');
(Sender as TProcess).FileName.Add(massafm.Edit1.Text);
(Sender as TProcess).FileName.Add(massafm.Edit2.Text);
(Sender as TProcess).FileName.Add(massafm.Edit3.Text);
(Sender as TProcess).FileName.Add(massafm.Edit4.Text);
(Sender as TProcess).FileName.Add(massafm.Edit5.Text);
(Sender as TProcess).FileName.Add(massafm.Edit6.Text);
(Sender as TProcess).FileName.Add(massafm.Edit7.Text);
if massafm.CheckBox1.Checked=true then
(Sender as TProcess).FileName.Add('TRUE')
else (Sender as TProcess).FileName.Add('FALSE');
end;
Abort;
end;
procedure TForm1.LinkMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
i,j, k: Integer;
begin
j := 0;
while (j < SelectedLinks.Count) and (Sender as TLink <> SelectedLinks.Items[j]) do
Inc(j);
if j = SelectedLinks.Count then
begin
if not (ssShift in Shift) then
SelectedLinks.Clear;
SelectedLinks.Add(Sender as TLink);
(Sender as TLink).Selected := True;
end
else
begin
SelectedLinks.Delete(j);
(Sender as TLink).Selected := False;
end;
if ToolBar2.Buttons[5].Down then
begin
for k := 0 to SelectedLinks.Count - 1 do
begin
i := 1;
while (i < link_index) and (links[i]<>SelectedLinks.Items[k]) do
Inc(i);
if i = link_index then
Exit;
links[i].Free;
for j:=i to link_index-2 do
begin
links[j]:=links[j+1];
end;
link_index:=link_index-1;
end;
ToolBar2.Buttons[5].Down:=False;
SelectedLinks.Free;
SelectedLinks := TLinkList.Create;
end;
end;
procedure TForm1.ItemMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
i: Integer;
j: Integer;
begin
if ssLeft in Shift then
begin
rr.Left:=STDPanel1.Left+Form1.Left+7;
rr.Top:=STDPanel1.Top+Form1.Top+25;
rr.Right:=STDPanel1.Left+STDPanel1.Width+Form1.Left;
rr.Bottom:=STDPanel1.Top+STDPanel1.Height+Form1.Top+20;
p_rr:=@rr;
ClipCursor(p_rr);
for j := 0 to SelectedItems.Count - 1 do
begin
if (SelectedItems.Items[j].Left+x-dx>0) and
(SelectedItems.Items[j].Left+x-dx+SelectedItems.Items[j].Width<STDPanel1.Width-5) then
begin
SelectedItems.Items[j].Left:=SelectedItems.Items[j].Left+x-dx;
end;
if (SelectedItems.Items[j].Top+y-dy>0) and
(SelectedItems.Items[j].Top+y-dy+SelectedItems.Items[j].Height<STDPanel1.Height-5) then
begin
SelectedItems.Items[j].Top:=SelectedItems.Items[j].Top+y-dy;
end;
end;
for i:=1 to link_index-1 do
for j := 0 to SelectedItems.Count - 1 do
begin
if links[i].First= SelectedItems.Items[j] then
Links[i].First:=SelectedItems.Items[j];
if links[i].Second=SelectedItems.Items[j] then
Links[i].Second:=SelectedItems.Items[j];
end;
end;
end;
procedure TForm1.ItemMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
label Again;
var
i, j, k: Integer;
l1,l2:integer;
Sel_Item: Tprocess;
Sel_Link: Tlink;
IdentLinks: TLinkList;
str:TStringList;
begin
rr.Left:=Screen.DesktopLeft;
rr.Top:=Screen.DesktopTop;
rr.Right:=Screen.DesktopLeft+Screen.DesktopWidth;
rr.Bottom:=Screen.DesktopTop+Screen.DesktopHeight;
p_rr:=@rr;
ClipCursor(p_rr);
//яЁютхЁър эр єфрыхэшх
for k := 0 to SelectedItems.Count - 1 do
SelectedItems.Items[k].Mode := pmNormal;
//яЁютхЁър эр єёЄрэютъє ёт чш
Sel_Item := Sender as TProcess;
if ToolBar2.Buttons[4].Down then
begin
for i:=1 to item_index-1 do
if Sel_Item = item[i] then
Break;
if (not first_click) then
begin
click_arr[1]:=i;
first_click:=True;
exit;
end;
if i<>click_arr[1] then click_arr[2]:=i;
for i:=1 to 2 do
if click_arr[i]=0 then exit;
ToolBar2.Buttons[4].Down:=False;
links[link_index]:=TLink.Create(STDPanel1);
first_click:=False;
links[link_index].Parent:=STDPanel1;
links[link_index].Caption:='';
links[link_index].First:=item[click_arr[1]];
links[link_index].Second:=item[click_arr[2]];
links[link_index].Param:=TStringList.Create;
links[link_index].OnMouseDown:=LinkMouseDown;
links[link_index].OnDblClick:=LinkDblClick;
links[link_index].NameBoxSize:=0;
links[link_index].Param.Add('Tт ч№ '+inttostr(index_link));
str:=links[link_index].Param;
linksfm.showEdit(links[link_index]);
links[link_index].Param:=str;
click_arr[1]:=0;
click_arr[2]:=0;
{ if (AnsiUpperCase(links[link_index].First.Hint) = '¦¦+LLT-') or
(AnsiUpperCase(links[link_index].Second.Hint) = '¦¦+LLT-') then
// begin
links[link_index].Kind := lkJoin;
{ IdentLinks := TLinkList.Create;
try
DefineLinkInACAD(links[link_index], links[link_index].Param, IdentLinks);
except
links[link_index].Free;
Exit;
end;
end
else}
inc(link_index);
inc(index_link);
end;
end;
procedure TForm1.ItemMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
i: Integer;
j: Integer;
begin
if ssLeft in Shift then
begin
j := 0;
while (j < SelectedItems.Count) and (Sender as TProcess <> SelectedItems.Items[j]) do
Inc(j);
if j = SelectedItems.Count then
begin
if not (ssShift in Shift) then
SelectedItems.Clear;
SelectedItems.Add(Sender as TProcess);
(Sender as TProcess).Selected := True;
end
else
begin
if (ssShift in Shift) then
begin
SelectedItems.Delete(j);
(Sender as TProcess).Selected := False;
end;
end;
for j := 0 to SelectedItems.Count - 1 do
SelectedItems.Items[j].Mode:=pmMove;
dx:=x;
dy:=y;
end;
if ssRight in Shift then
begin
if (Sender as TProcess).FileName.Count>0 then PopupMenu1.Items.Items[0].Enabled:=True
else PopupMenu1.Items.Items[0].Enabled:=False;
if (Sender as TProcess).FileName.IndexOf('TOOL')>=0 then
PopupMenu1.Items.Items[1].Enabled:=True
else
PopupMenu1.Items.Items[1].Enabled:=False;
PopupMenu1.Items.Items[1].Checked := (Sender as TProcess).OnlyTool;
for i:=1 to item_index-1 do
if (Sender as TProcess)=item[i] then
begin
current_item:=i;
break;
end;
PopupMenu1.Popup((Sender as TProcess).left+STDPanel1.Left+x+Form1.Left+ScrollBox1.Left,(Sender as TProcess).top+STDPanel1.Top+y+Form1.Top+ScrollBox1.Top+40);
end;
end;
procedure TForm1.STDPanel1Click(Sender: TObject);
label Ex;
var
i: Integer;
pic:TBitmap;
Res: TModalResult;
begin
pic:=TBitmap.Create;
for i:=0 to ToolBar1.ButtonCount-1 do
begin
if ToolBar1.Buttons[i].Down then
begin
ToolBar1.Buttons[i].Down:=False;
Item[Item_index]:=TProcess.Create(STDPanel1);
pic.LoadFromFile(ToolBar1.Buttons[i].Caption);
Item[item_index].PicPath:=ToolBar1.Buttons[i].Caption;
Item[item_index].Width:=pic.Width+3;
Item[item_index].Height:=pic.Height+3;
Item[item_index].Mode:=pmNormal;
Item[item_index].left:=mx;
Item[item_index].top:=my;
Item[item_index].FileName:=TStringList.Create;
first_click:=False;
Item[item_index].Parent:=STDPanel1;
Item[item_index].Hint:=ToolBar1.Buttons[i].Hint;
Item[item_index].ShowHint:=True;
Item[item_index].Picture.LoadFromFile(ToolBar1.Buttons[i].Caption);
Item[item_index].OnMouseDown:=ItemMouseDown;
Item[item_index].OnMouseUp:=ItemMouseUp;
Item[item_index].OnMouseMove:=ItemMouseMove;
Item[item_index].OnDblClick:=ItemDblClick;
if Item[item_index].Hint='=хяюфтшцэр _юяюЁр' then
begin
massafm.Edit6.Visible:=false;
massafm.Edit7.Visible:=false;
massafm.label8.Visible:=false;
massafm.label9.Visible:=false;
massafm.Edit5.Text:='=хяюфтшцэр _юяюЁр';
massafm.Caption:='¦рёёр '+inttostr(index_item);
massafm.ShowModal;
Item[item_index].FileName.Add('¦рёёр '+inttostr(index_item));
Item[item_index].FileName.Add('=хяюфтшцэр _юяюЁр');
Item[item_index].FileName.Add(massafm.Edit1.Text);
Item[item_index].FileName.Add(massafm.Edit2.Text);
Item[item_index].FileName.Add(massafm.Edit3.Text);
Item[item_index].FileName.Add(massafm.Edit4.Text);
Item[item_index].FileName.Add(massafm.Edit5.Text);
if massafm.CheckBox1.Checked=true then
Item[item_index].FileName.Add('TRUE')
else Item[item_index].FileName.Add('FALSE');
end;
if Item[item_index].Hint='TюёЁхфюЄюўхээр _ьрёёр' then
begin
massafm.Edit6.Visible:=true;
massafm.Edit7.Visible:=true;
massafm.label8.Visible:=true;
massafm.label9.Visible:=true;
massafm.Edit5.Text:='TюёЁхфюЄюўхээр _ьрёёр';
massafm.Caption:='¦рёёр '+inttostr(index_item);
massafm.ShowModal;
Item[item_index].FileName.Add('¦рёёр '+inttostr(index_item));
Item[item_index].FileName.Add('TюёЁхфюЄюўхээр _ьрёёр');
Item[item_index].FileName.Add(massafm.Edit1.Text);
Item[item_index].FileName.Add(massafm.Edit2.Text);
Item[item_index].FileName.Add(massafm.Edit3.Text);
Item[item_index].FileName.Add(massafm.Edit4.Text);
Item[item_index].FileName.Add(massafm.Edit5.Text);
Item[item_index].FileName.Add(massafm.Edit6.Text);
Item[item_index].FileName.Add(massafm.Edit7.Text);
if massafm.CheckBox1.Checked=true then
Item[item_index].FileName.Add('TRUE')
else Item[item_index].FileName.Add('FALSE');
end;
{ if AnsiUpperCase(Item[item_index].Hint) = '¦¦+LLT-' then
try
CreateProfile(Item[item_index]);
except
on E: Exception do
MessageDlg(E.Message, mtError,[mbOK],0);
end
else
SelectParams(Item[item_index]);
if Item[item_index].FileName.Text = '' then
begin
Item[item_index].Free;
Pic.Free;
Exit;
end;}
inc(item_index);
inc(index_item);
break;
end;
end;
Pic.Free;
end;
procedure TForm1.ToolButtonClick(Sender: TObject);
var
i: Word;
begin
for i:=0 to ToolBar2.ButtonCount-1 do ToolBar2.Buttons[i].Down:=False;
if (Sender as TToolButton).Down then
begin
index:=(Sender as TToolButton).Index;
for i:=0 to ToolBar1.ButtonCount-1 do