📄 rm_dsgform.pas
字号:
end;
end;
end;
// splitting
if (Cursor = crHSplit) and FMouseButtonDown and RM_SelectedManyObject and (FMode = mdSelect) then
begin
Result := True;
kx := x - FLastX;
ky := 0;
if (not FDesignerForm.GridAlign) or _GridCheck then
begin
with FSplitInfo do
begin
DrawHSplitter(SplRect);
SplRect := Rect(SplRect.Left + kx, SplRect.Top, SplRect.Right + kx, SplRect.Bottom);
DrawHSplitter(SplRect);
end;
FLastX := x - ((x - FLastX) - kx);
end;
end;
end;
procedure _SetMaxResizeHeight(aBand: TRMView; var ky: Integer);
var
i, lidx: Integer;
t: TRMView;
begin
if ky >= 0 then Exit;
for i := 0 to FDesignerForm.PageObjects.Count - 1 do
begin
t := FDesignerForm.PageObjects[i];
if (not t.IsBand) and (t.spTop_Designer >= aBand.spTop_Designer) and (t.spBottom_Designer <= aBand.spBottom_Designer) then
begin
lidx := aBand.spBottom_Designer - t.spBottom_Designer;
if lidx < -ky then
ky := -lidx;
end;
end;
if - ky > aBand.spHeight_Designer then ky := -aBand.spHeight_Designer;
end;
procedure _GetDefaultSize(var aKx, aKy: Integer);
var
lIndex: Integer;
begin
if FDesignerForm.Page is TRMDialogPage then
begin
lIndex := FPageEditor.ToolbarComponent.SelectedObjIndex;
if lIndex >= rmgtAddIn then
RMAddIns(lIndex - rmgtAddIn).ClassRef.DefaultSize(aKx, aKy);
end
else
FPageEditor.GetDefaultSize(kx, ky);
end;
begin
if FDesignerForm.Page = nil then Exit;
FMoved := True; w := 2;
if RM_FirstChange and FMouseButtonDown and not FObjectsSelecting then
begin
kx := x - FLastX;
ky := y - FLastY;
if not FDesignerForm.GridAlign or _GridCheck then
begin
FPageEditor.GetRegion;
if (kx <> 0) or (ky <> 0) then
FDesignerForm.AddUndoAction(rmacEdit);
end;
end;
if not FMouseButtonDown then
begin
if FPageEditor.ToolbarComponent.btnNoSelect.Down then
begin
FMode := mdSelect;
Cursor := crDefault;
if FDesignerForm.SelNum = 0 then
begin
FPageEditor.FShowSizes := False;
RM_OldRect := Rect(x, y, x, y);
FPageEditor.ShowObjMsg;
end;
end
else
begin
FMode := mdInsert; // 选择了控件,准备增加
if Cursor <> crCross then
begin
RoundCoord(x, y);
_GetDefaultSize(kx, ky);
RM_OldRect := Rect(x, y, x + kx, y + ky);
DrawFocusRect(RM_OldRect);
end;
Cursor := crCross;
end;
end;
if (FMode = mdInsert) and (not FMouseButtonDown) then
begin
DrawFocusRect(RM_OldRect);
RoundCoord(x, y);
OffsetRect(RM_OldRect, x - RM_OldRect.Left, y - RM_OldRect.Top);
DrawFocusRect(RM_OldRect);
FPageEditor.FShowSizes := True;
FPageEditor.ShowObjMsg;
FPageEditor.FShowSizes := False;
Exit;
end;
// cursor shapes
if not FMouseButtonDown and (FDesignerForm.SelNum = 1) and (FMode = mdSelect) then
begin
t := FDesignerForm.PageObjects[FDesignerForm.TopSelected];
if _Cont(t.spLeft_Designer, t.spTop_Designer, x, y) or _Cont(t.spLeft_Designer + t.spWidth_Designer, t.spTop_Designer + t.spHeight_Designer, x, y) then
Cursor := crSizeNWSE // 改变一个对象大小
else if _Cont(t.spLeft_Designer + t.spWidth_Designer, t.spTop_Designer, x, y) or _Cont(t.spLeft_Designer, t.spTop_Designer + t.spHeight_Designer, x, y) then
Cursor := crSizeNESW
else if _Cont(t.spLeft_Designer + t.spWidth_Designer div 2, t.spTop_Designer, x, y) or _Cont(t.spLeft_Designer + t.spWidth_Designer div 2, t.spTop_Designer + t.spHeight_Designer, x, y) then
Cursor := crSizeNS
else if _Cont(t.spLeft_Designer, t.spTop_Designer + t.spHeight_Designer div 2, x, y) or _Cont(t.spLeft_Designer + t.spWidth_Designer, t.spTop_Designer + t.spHeight_Designer div 2, x, y) then
Cursor := crSizeWE
else
Cursor := crDefault;
end;
// selecting a lot of objects
if FMouseButtonDown and FObjectsSelecting then
begin
DrawFocusRect(RM_OldRect);
if Cursor = crCross then
RoundCoord(x, y);
RM_OldRect := Rect(RM_OldRect.Left, RM_OldRect.Top, x, y);
DrawFocusRect(RM_OldRect);
FPageEditor.FShowSizes := True;
if Cursor = crCross then
FPageEditor.ShowObjMsg;
FPageEditor.FShowSizes := False;
Exit;
end;
// selecting a lot of objects
if FObjectsSelecting then // 选择Objects
begin
DrawFocusRect(RM_OldRect);
RM_OldRect := Rect(RM_OldRect.Left, RM_OldRect.Top, x, y);
DrawFocusRect(RM_OldRect);
Exit;
end;
if _IsSplitting then
begin
Exit;
end;
// moving
if FMouseButtonDown and (FMode = mdSelect) and (FDesignerForm.SelNum >= 1) and (Cursor = crDefault) then
begin
kx := x - FLastX;
ky := y - FLastY;
if FDesignerForm.GridAlign and not _GridCheck then Exit;
if RM_FirstBandMove and (FDesignerForm.SelNum = 1) and ((kx <> 0) or (ky <> 0)) and not (ssAlt in Shift) then
begin
if TRMView(FDesignerForm.PageObjects[FDesignerForm.TopSelected]).isBand then
begin
lBnd := FDesignerForm.PageObjects[FDesignerForm.TopSelected];
for i := 0 to FDesignerForm.PageObjects.Count - 1 do
begin
t := FDesignerForm.PageObjects[i];
if not t.IsBand then
if (t.spLeft_Designer >= lBnd.spLeft_Designer) and (t.spLeft_Designer + t.spWidth_Designer <= lBnd.spLeft_Designer + lBnd.spWidth_Designer) and
(t.spTop_Designer >= lBnd.spTop_Designer) and (t.spTop_Designer + t.spHeight_Designer <= lBnd.spTop_Designer + lBnd.spHeight_Designer) then
begin
t.Selected := True;
Inc(FDesignerForm.SelNum);
end;
end;
GetMultipleSelected;
end;
end;
if (kx <> 0) or (ky <> 0) then
begin
RM_FirstBandMove := False;
end;
DrawPage(dmShape);
for i := 0 to FDesignerForm.PageObjects.Count - 1 do
begin
t := FDesignerForm.PageObjects[i];
if not t.Selected then Continue;
if t.IsCrossBand then
begin
t.spLeft_Designer := t.spLeft_Designer + kx;
if kx <> 0 then FDesignerForm.Modified := True;
end
else if not FPageEditor.IsBandsSelect(liBand) then //对Band,控制其不能左右移动!
begin
t.spLeft_Designer := t.spLeft_Designer + kx;
if kx <> 0 then
begin
FDesignerForm.Modified := True;
FBandMoved := True;
end;
end;
t.spTop_Designer := t.spTop_Designer + ky;
if ky <> 0 then
begin
FDesignerForm.Modified := True;
FBandMoved := True;
end;
end;
DrawPage(dmShape);
Inc(FLastX, kx);
Inc(FLastY, ky);
FPageEditor.ShowObjMsg;
end;
// resizing
if FMouseButtonDown and (FMode = mdSelect) and (FDesignerForm.SelNum = 1) and (Cursor <> crDefault) then
begin
kx := x - FLastX;
ky := y - FLastY;
if FDesignerForm.GridAlign and not _GridCheck then Exit;
DrawPage(dmShape);
t := FDesignerForm.PageObjects[FDesignerForm.TopSelected];
if t.IsBand then
begin
if TRMCustomBandView(t).IsCrossBand then
ky := 0
else
begin
kx := 0;
_SetMaxResizeHeight(t, ky);
end;
end;
FDesignerForm.Modified := True;
w := 3;
if Cursor = crSizeNWSE then // 右下角,左上角
begin
if ((FCursorType = ct1) or _Cont(t.spLeft_Designer, t.spTop_Designer, FLastX, FLastY)) and
(FCursorType <> ct2) then
begin
t.spLeft_Designer := t.spLeft_Designer + kx;
t.spWidth_Designer := t.spWidth_Designer - kx;
t.spTop_Designer := t.spTop_Designer + ky;
t.spHeight_Designer := t.spHeight_Designer - ky;
_CheckWidthHeight(t, ct2, ct1);
end
else
begin
t.spWidth_Designer := t.spWidth_Designer + kx;
t.spHeight_Designer := t.spHeight_Designer + ky;
_CheckWidthHeight(t, ct1, ct2);
end;
if (ky <> 0) and t.IsBand and (not t.IsCrossBand) then
FBandMoved := True;
end;
if Cursor = crSizeNESW then // 右上角,左下角
begin
if ((FCursorType = ct3) or _Cont(t.spLeft_Designer + t.spWidth_Designer, t.spTop_Designer, FLastX, FLastY)) and
(FCursorType <> ct4) then
begin
t.spTop_Designer := t.spTop_Designer + ky;
t.spWidth_Designer := t.spWidth_Designer + kx;
t.spHeight_Designer := t.spHeight_Designer - ky;
_CheckWidthHeight(t, ct4, ct3);
end
else
begin
t.spLeft_Designer := t.spLeft_Designer + kx;
t.spWidth_Designer := t.spWidth_Designer - kx;
t.spHeight_Designer := t.spHeight_Designer + ky;
_CheckWidthHeight(t, ct3, ct4);
end;
if (ky <> 0) and t.IsBand and (not t.IsCrossBand) then
FBandMoved := True;
end;
if Cursor = crSizeWE then // 改变width
begin
if ((FCursorType = ct5) or _Cont(t.spLeft_Designer, t.spTop_Designer + t.spHeight_Designer div 2, FLastX, FLastY)) and
(FCursorType <> ct6) then
begin
t.spLeft_Designer := t.spLeft_Designer + kx;
t.spWidth_Designer := t.spWidth_Designer - kx;
_CheckWidthHeight(t, ct6, ct5);
end
else
begin
t.spWidth_Designer := t.spWidth_Designer + kx;
_CheckWidthHeight(t, ct5, ct6);
end;
end;
if Cursor = crSizeNS then // 改变Height
begin
if ((FCursorType = ct7) or _Cont(t.spLeft_Designer + t.spWidth_Designer div 2, t.spTop_Designer, FLastX, FLastY)) and
(FCursorType <> ct8) then
begin
t.spTop_Designer := t.spTop_Designer + ky;
t.spHeight_Designer := t.spHeight_Designer - ky;
_CheckWidthHeight(t, ct8, ct7);
end
else
begin
t.spHeight_Designer := t.spHeight_Designer + ky;
_CheckWidthHeight(t, ct7, ct8);
end;
end;
DrawPage(dmShape);
FLastX := x - ((x - FLastX) - kx);
FLastY := y - ((y - FLastY) - ky);
FPageEditor.ShowObjMsg;
end;
if (not (FDesignerForm.Page is TRMDialogPage)) and RM_Class.RMShowDropDownField and
(not FMouseButtonDown) and (FMode = mdSelect) and (Cursor = crDefault) then
begin
t1 := FCurrentView;
FCurrentView := nil;
FCurrentBand := nil;
for i := FDesignerForm.PageObjects.Count - 1 downto 0 do
begin
t := FDesignerForm.PageObjects[i];
if not t.IsBand then
begin
lRgn := t.GetClipRgn(rmrtNormal);
lFlag := PtInRegion(lRgn, X, Y);
DeleteObject(lRgn);
if lFlag and (t is TRMReportView) and RMHavePropertyName(t, 'DataField') then
begin
lBnd := FDesignerForm.GetParentBand(TRMReportView(t));
if (lBnd is TRMBandMasterData) and (TRMBandMasterData(lBnd).DataSetName <> '') and
(not TRMBandMasterData(lBnd).IsVirtualDataSet) then
begin
FCurrentView := TRMReportView(t);
FCurrentBand := TRMBandMasterData(lBnd);
end;
Break;
end;
end;
end;
if t1 <> FCurrentView then
begin
if FCurrentView <> nil then
DrawRect(FCurrentView);
//DrawObject(FCurrentView);
if t1 <> nil then
DrawRect(t1);
//DrawObject(t1);
//DrawPage(dmAll);
//Repaint;
end;
end;
end;
procedure TRMWorkSpace.CMMouseLeave(var Message: TMessage);
begin
inherited;
if ((FMode = mdInsert) and not FMouseButtonDown) or FDragFlag then
begin
DrawFocusRect(RM_OldRect);
OffsetRect(RM_OldRect, -10000, -10000);
Exit;
end;
end;
procedure TRMWorkSpace.OnDoubleClickEvent(Sender: TObject);
begin
FMouseButtonDown := False;
if FDesignerForm.SelNum = 0 then
begin
if FDesignerForm.Page is TRMReportPage then
begin
FDoubleClickFlag := True;
end
else
begin
end
end
else if FDesignerForm.SelNum = 1 then
begin
FPageEditor.ShowEditor;
FDoubleClickFlag := True;
end;
end;
procedure TRMWorkSpace.DrawHSplitter(aRect: TRect);
begin
with Canvas do
begin
Pen.Mode := pmXor;
Pen.Color := clSilver;
Pen.Width := 1;
MoveTo(aRect.Left, aRect.Top);
LineTo(aRect.Right, aRect.Bottom);
Pen.Mode := pmCopy;
end;
end;
procedure TRMWorkSpace.DrawFocusRect(aRect: TRect);
begin
with Canvas do
begin
Pen.Mode := pmXor;
Pen.Color := clSilver;
Pen.Width := 1;
Pen.Style := psSolid;
Brush.Style := bsClear;
Rectangle(aRect.Left, aRect.Top, aRect.Right, aRect.Bottom);
Pen.Mode := pmCopy;
Brush.Style := bsSolid;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -