📄 wfeditorui.pas
字号:
procedure TfWfEditorUI.actDecWidthExecute(Sender: TObject);
begin
Layout(ltDecWidth);
end;
procedure TfWfEditorUI.actMakeMaxWidthExecute(Sender: TObject);
begin
Layout(ltMakeMaxWidth);
end;
procedure TfWfEditorUI.actMakeMinWidthExecute(Sender: TObject);
begin
Layout(ltMakeMinWidth);
end;
procedure TfWfEditorUI.actMakeSameWidthExecute(Sender: TObject);
begin
Layout(ltMakeSameWidth);
end;
procedure TfWfEditorUI.actSpaceDecHExecute(Sender: TObject);
begin
Layout(ltSpaceDecH);
end;
procedure TfWfEditorUI.actSpaceIncHExecute(Sender: TObject);
begin
Layout(ltSpaceIncH);
end;
procedure TfWfEditorUI.actAlignTopExecute(Sender: TObject);
begin
Layout(ltAlignTop);
end;
procedure TfWfEditorUI.actAlignBottomExecute(Sender: TObject);
begin
Layout(ltAlignBottom);
end;
procedure TfWfEditorUI.actAlignVCenterExecute(Sender: TObject);
begin
Layout(ltAlignVCenter);
end;
procedure TfWfEditorUI.actSpaceEquVExecute(Sender: TObject);
begin
Layout(ltSpaceEquV);
end;
procedure TfWfEditorUI.actSpaceEquVYExecute(Sender: TObject);
begin
Layout(ltSpaceEquVY);
end;
procedure TfWfEditorUI.actIncHeightExecute(Sender: TObject);
begin
Layout(ltIncHeight);
end;
procedure TfWfEditorUI.actDecHeightExecute(Sender: TObject);
begin
Layout(ltDecHeight);
end;
procedure TfWfEditorUI.actMakeMaxHeightExecute(Sender: TObject);
begin
Layout(ltMakeMaxHeight);
end;
procedure TfWfEditorUI.actMakeMinHeightExecute(Sender: TObject);
begin
Layout(ltMakeMinHeight);
end;
procedure TfWfEditorUI.actMakeSameHeightExecute(Sender: TObject);
begin
Layout(ltMakeSameHeight);
end;
procedure TfWfEditorUI.actSpaceDecVExecute(Sender: TObject);
begin
Layout(ltSpaceDecV);
end;
procedure TfWfEditorUI.actSpaceIncVExecute(Sender: TObject);
begin
Layout(ltSpaceIncV);
end;
procedure TfWfEditorUI.DrawDrag(P1, P2 : TPoint; Mode : Integer);
var
AMode: TPenMode;
AColor: TColor;
ABkColor: TColor;
AStyle: TPenStyle;
PP1, PP2: TPoint;
begin
if P1.X < P2.X then begin
PP1.X := P1.X; PP2.X := P2.X;
end else begin
PP1.X := P2.X; PP2.X := P1.X;
end;
if P1.Y < P2.Y then begin
PP1.Y := P1.Y; PP2.Y := P2.Y;
end else begin
PP1.Y := P2.Y; PP2.Y := P1.Y;
end;
with View.Canvas do begin
AMode := Pen.Mode;
AColor := Pen.Color;
AStyle := Pen.Style;
ABkColor := Brush.Color;
Pen.Mode := pmNotXor;
Pen.Color := clBlack;
if Mode = 3 then Pen.Style := psDot;
Brush.Style := bsClear;
if Mode = 1 then case sbShape.Tag of
0, 1 : Rectangle(PP1.X, PP1.Y, PP2.X, PP2.Y);
2 : Ellipse(PP1.X, PP1.Y, PP2.X, PP2.Y);
3 : RoundRect(PP1.X, PP1.Y, PP2.X, PP2.Y, (PP2.X - PP1.X) shr 1, (PP2.Y - PP1.Y) shr 1);
4 : PolyLine([Point(PP1.X + (PP2.X - PP1.X) shr 1, PP1.Y),
Point(PP2.X, PP1.Y + (PP2.Y - PP1.Y) shr 1),
Point(PP1.X + (PP2.X - PP1.X) shr 1, PP2.Y),
Point(PP1.X, PP1.Y + (PP2.Y - PP1.Y) shr 1),
Point(PP1.X + (PP2.X - PP1.X) shr 1, PP1.Y)]);
5 : PolyLine([Point(PP1.X + (PP2.X - PP1.X) shr 1, PP1.Y),
Point(PP2.X, PP2.Y),
Point(PP1.X, PP2.Y),
Point(PP1.X + (PP2.X - PP1.X) shr 1, PP1.Y)]);
6 : PolyLine([Point(PP1.X, PP1.Y),
Point(PP2.X, PP1.Y),
Point(PP1.X + (PP2.X - PP1.X) shr 1, PP2.Y),
Point(PP1.X, PP1.Y)]);
7 : PolyLine([Point(PP1.X, PP1.Y),
Point(PP2.X, PP1.Y + (PP2.Y - PP1.Y) shr 1),
Point(PP1.X, PP2.Y),
Point(PP1.X, PP1.Y)]);
8 : PolyLine([Point(PP1.X, PP1.Y + (PP2.Y - PP1.Y) shr 1),
Point(PP2.X, PP1.Y),
Point(PP2.X, PP2.Y),
Point(PP1.X, PP1.Y + (PP2.Y - PP1.Y) shr 1)]);
9 : PolyLine([Point(PP1.X + (PP2.X - PP1.X) shr 2, PP1.Y),
Point(PP2.X - (PP2.X - PP1.X) shr 2, PP1.Y),
Point(PP2.X, PP1.Y + (PP2.Y - PP1.Y) shr 1),
Point(PP2.X - (PP2.X - PP1.X) shr 2, PP2.Y),
Point(PP1.X + (PP2.X - PP1.X) shr 2, PP2.Y),
Point(PP1.X, PP1.Y + (PP2.Y - PP1.Y) shr 1),
Point(PP1.X + (PP2.X - PP1.X) shr 2, PP1.Y)]);
end;
if Mode = 2 then begin
MoveTo(P1.X, P1.Y);
LineTo(P2.X, P2.Y);
end;
if Mode = 3 then Rectangle(P1.X, P1.Y, P2.X, P2.Y);
Pen.Mode := AMode;
Pen.Color := AColor;
Pen.Style := AStyle;
Brush.Color := ABkColor;
end;
end;
function TfWfEditorUI.FindAllUnions(AView : TdxFlowChart; FromUnion :
TdxFcObject): TdxFcObject;
var
i: Integer;
FFind: Boolean;
begin
Result := nil;
FFind := FromUnion = nil;
for i := 0 to AView.ObjectCount - 1 do
if AView.Objects[i].IsUnion then begin
if FFind then begin
Result := AView.Objects[i];
break;
end;
FFind := FromUnion = AView.Objects[i];
end;
end;
function TfWfEditorUI.FindUnions(AView : TdxFlowChart; FromUnion, Obj :
TdxFcObject): TdxFcObject;
var
i: Integer;
FFind: Boolean;
begin
Result := nil;
FFind := FromUnion = nil;
for i := 0 to AView.ObjectCount - 1 do
if AView.Objects[i].IsUnion and (Obj <> AView.Objects[i]) then
if AView.Objects[i].HasInUnion(Obj) then begin
if FFind then begin
Result := AView.Objects[i];
break;
end;
FFind := AView.Objects[i] = FromUnion;
end;
end;
procedure TfWfEditorUI.FormCreate(Sender: TObject);
begin
FView:=TWfView.Create(Self);
FView.Parent:=Self;
FView.BorderStyle:=bsNone;
FView.Align:=alClient;
FView.Images:=ilWfObj;
FView.OnChange:=ViewChange;
FView.OnDblClick:=ViewDblClick;
FView.OnKeyDown:=ViewKeyDown;
FView.OnKeyUp:=ViewKeyUp;
FView.OnMouseDown:=ViewMouseDown;
FView.OnMouseMove:=ViewMouseMove;
FView.OnMouseUp:=ViewMouseUp;
FView.OnSelected:=ViewSelected;
FView.OnSelection:=ViewSelection;
// FView.ChartWidth:=FView.Width-20;
// FView.ChartHeight:=FView.Height-20;
//
sbObjectFont.Font.Assign(View.Font);
sbConnectFont.Font.Assign(View.Font);
FChange := True;
Buf := TList.Create;
BufChart := TdxFlowChart.Create(Self);
FUndo := TWfEditorUndo.Create;
FUndo.Chart := View;
FUndo.UndoSteps := 30;
FStore := True;
LastObj := nil;
FSelect := False;
OldHintHidePause := Application.HintHidePause;
BitmapList := TList.Create;
//
iRectangleClick(iDArrow);
FFindStr:='';
end;
procedure TfWfEditorUI.FormDestroy(Sender: TObject);
var
i: Integer;
begin
if BitmapList <> nil then begin
for i := BitmapList.Count - 1 downto 0 do
TBitmap(BitmapList.Items[i]).Destroy;
BitmapList.Destroy;
end;
ClearBuf;
Buf.Free;
BufChart.Free;
FUndo.Free;
Application.HintHidePause := OldHintHidePause;
end;
procedure TfWfEditorUI.FormShow(Sender: TObject);
begin
ViewChange(View, nil);
end;
function TfWfEditorUI.GetImageIndexByMenuItem(Item : TmenuItem): Integer;
begin
Result := - 1;
if Item = mniOpen then begin Result := 0; Exit; end;
if Item = mniSaveAs then begin Result := 1; Exit; end;
if Item = mniUndo then begin Result := 2; Exit; end;
if Item = mniCut then begin Result := 3; Exit; end;
if Item = mniCopy then begin Result := 4; Exit; end;
if Item = mniPaste then begin Result := 5; Exit; end;
if Item = mniDelete then begin Result := 6; Exit; end;
if Item = mniSelectAll then begin Result := 7; Exit; end;
if Item = mniBringToFront then begin Result := 8; Exit; end;
if Item = mniSendToBack then begin Result := 9; Exit; end;
if Item = mniNewUnion then begin Result := 10; Exit; end;
if Item = mniAddToUnion then begin Result := 11; Exit; end;
if Item = mniRemoveFromUnion then begin Result := 12; Exit; end;
if Item = iNone then begin Result := 75; Exit; end;
if Item = iRectangle then begin Result := 0; Exit; end;
if Item = iEllipse then begin Result := 1; Exit; end;
if Item = iRoundRect then begin Result := 2; Exit; end;
if Item = iDiamond then begin Result := 3; Exit; end;
if Item = iNorthTriangle then begin Result := 4; Exit; end;
if Item = itSouthTriangle then begin Result := 5; Exit; end;
if Item = itEastTriangle then begin Result := 6; Exit; end;
if Item = itWestTriangle then begin Result := 7; Exit; end;
if Item = itHexagon then begin Result := 8; Exit; end;
if Item = i1p then begin Result := 9; Exit; end;
if Item = i2p then begin Result := 10; Exit; end;
if Item = i3p then begin Result := 11; Exit; end;
if Item = i4p then begin Result := 12; Exit; end;
if Item = i5p then begin Result := 13; Exit; end;
if Item = i6p then begin Result := 14; Exit; end;
if Item = i7p then begin Result := 15; Exit; end;
if Item = i8p then begin Result := 16; Exit; end;
if Item = i9p then begin Result := 17; Exit; end;
if Item = i10p then begin Result := 18; Exit; end;
if Item = iStraight then begin Result := 19; Exit; end;
if Item = iCurved then begin Result := 20; Exit; end;
if Item = iRectHorizontal then begin Result := 21; Exit; end;
if Item = iRectVertical then begin Result := 22; Exit; end;
if Item = iSNone then begin Result := 23; Exit; end;
if Item = iSArrow then begin Result := 24; Exit; end;
if Item = iSOvalArrow then begin Result := 25; Exit; end;
if Item = iSRectArrow then begin Result := 26; Exit; end;
if Item = iDNone then begin Result := 27; Exit; end;
if Item = iDArrow then begin Result := 28; Exit; end;
if Item = iDOvalArrow then begin Result := 29; Exit; end;
if Item = iDRectArrow then begin Result := 30; Exit; end;
if Item = iS10 then begin Result := 31; Exit; end;
if Item = iS20 then begin Result := 32; Exit; end;
if Item = iS30 then begin Result := 33; Exit; end;
if Item = iS40 then begin Result := 34; Exit; end;
if Item = iS50 then begin Result := 35; Exit; end;
if Item = iD10 then begin Result := 36; Exit; end;
if Item = iD20 then begin Result := 37; Exit; end;
if Item = iD30 then begin Result := 38; Exit; end;
if Item = iD40 then begin Result := 39; Exit; end;
if Item = iD50 then begin Result := 40; Exit; end;
if Item = iSP1 then begin Result := 41; Exit; end;
if Item = iSP2 then begin Result := 42; Exit; end;
if Item = iSP3 then begin Result := 43; Exit; end;
if Item = iSP4 then begin Result := 44; Exit; end;
if Item = iSP5 then begin Result := 45; Exit; end;
if Item = iSP6 then begin Result := 46; Exit; end;
if Item = iSP7 then begin Result := 47; Exit; end;
if Item = iSP8 then begin Result := 48; Exit; end;
if Item = iSP9 then begin Result := 49; Exit; end;
if Item = iSP10 then begin Result := 50; Exit; end;
if Item = iSP11 then begin Result := 51; Exit; end;
if Item = iSP12 then begin Result := 52; Exit; end;
if Item = iSP13 then begin Result := 53; Exit; end;
if Item = iSP14 then begin Result := 54; Exit; end;
if Item = iSP15 then begin Result := 55; Exit; end;
if Item = iSP16 then begin Result := 56; Exit; end;
if Item = iDP1 then begin Result := 41; Exit; end;
if Item = iDP2 then begin Result := 42; Exit; end;
if Item = iDP3 then begin Result := 43; Exit; end;
if Item = iDP4 then begin Result := 44; Exit; end;
if Item = iDP5 then begin Result := 45; Exit; end;
if Item = iDP6 then begin Result := 46; Exit; end;
if Item = iDP7 then begin Result := 47; Exit; end;
if Item = iDP8 then begin Result := 48; Exit; end;
if Item = iDP9 then begin Result := 49; Exit; end;
if Item = iDP10 then begin Result := 50; Exit; end;
if Item = iDP11 then begin Result := 51; Exit; end;
if Item = iDP12 then begin Result := 52; Exit; end;
if Item = iDP13 then begin Result := 53; Exit; end;
if Item = iDP14 then begin Result := 54; Exit; end;
if Item = iDP15 then begin Result := 55; Exit; end;
if Item = iDP16 then begin Result := 56; Exit; end;
if Item = iTextTopLeft then begin Result := 57; Exit; end;
if Item = iTextTop then begin Result := 58; Exit; end;
if Item = iTextTopRight then begin Result := 59; Exit; end;
if Item = iTextLeft then begin Result := 60; Exit; end;
if Item = iTextCenter then begin Result := 61; Exit; end;
if Item = iTextRight then begin Result := 62; Exit; end;
if Item = iTextBottomLeft then begin Result := 63; Exit; end;
if Item = iTextBottom then begin Result := 64; Exit; end;
if Item = iTextBottomRight then begin Result := 65; Exit; end;
if Item = iImageTopLeft then begin Result := 66; Exit; end;
if Item = iImageTop then begin Result := 67; Exit; end;
if Item = iImageTopRight then begin Result := 68; Exit; end;
if Item = iImageLeft then begin Result := 69; Exit; end;
if Item = iImageCenter then begin Result := 70; Exit; end;
if Item = iImageRight then begin Result := 71; Exit; end;
if Item = iImageBottomLeft then begin Result := 72; Exit; end;
if Item = iImageBottom then begin Result := 73; Exit; end;
if Item = iImageBottomRight then begin Result := 74; Exit; end;
if Item = iCut then begin Result := 3; Exit; end;
if Item = iCopy then begin Result := 4; Exit; end;
if Item = iPaste then begin Result := 5; Exit; end;
if Item = iDelete then begin Result := 6; Exit; end;
if Item = iSelectAll then begin Result := 7; Exit; end;
if Item = iBringToFront then begin Result := 8; Exit; end;
if Item = iSendToBack then begin Result := 9; Exit; end;
if Item = iNewUnion then begin Result := 10; Exit; end;
if Item = iAddToUnion then begin Result := 11; Exit; end;
if Item = iRemoveFromUnion then begin Result := 12; Exit; end;
if Item = mniZoomIn then begin Result := 13; Exit; end;
if Item = mniZoomOut then begin Result := 14; Exit; end;
if Item = mniFit then begin Result := 15; Exit; end;
end;
function TfWfEditorUI.GetMainItemInUnion(AView : TdxFlowChart; Obj :
TdxFcObject): TdxFcObject;
var
i: Integer;
begin
Result := nil;
for i := 0 to AView.ObjectCount - 1 do
if AView.O
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -