📄 jvdockvidvcstyle.pas
字号:
begin
DockBottomRect.TopLeft := Point(ClientWidth div 5, ClientWidth div 5 * 4);
DockBottomRect.BottomRight := Point(ClientWidth div 5 * 4, ClientHeight - JvDockGetSysCaptionHeight);
end
else
begin
DockBottomRect.TopLeft := Point(0, ClientHeight div 5 * 4);
DockBottomRect.BottomRight := Point(ClientWidth, ClientHeight);
end;
DockCenterRect.TopLeft := Point(0, -JvDockGetSysCaptionHeight);
DockCenterRect.BottomRight := Point(ClientWidth, 0);
if Target is TJvDockCustomTabControl then
begin
DockTabRect.TopLeft := Point(0, ClientHeight - JvDockGetSysCaptionHeight);
DockTabRect.BottomRight := Point(ClientWidth, ClientHeight);
end
else
DockTabRect := Rect(0, 0, 0, 0);
if PtInRect(DockCenterRect, MousePos) or
PtInRect(DockTabRect, MousePos) then
begin
Result := alClient;
DockRect := DockCenterRect;
DockRect.BottomRight := Point(ClientWidth, ClientHeight);
end
else
if PtInRect(DockLeftRect, MousePos) then
begin
Result := alLeft;
DockRect := DockLeftRect;
DockRect.Right := Min(ClientWidth div 2, Control.ClientWidth);
end
else
if PtInRect(DockTopRect, MousePos) then
begin
Result := alTop;
DockRect := DockTopRect;
DockRect.Left := 0;
DockRect.Right := ClientWidth;
DockRect.Bottom := Min(ClientHeight div 2, Control.ClientHeight);
end
else
if PtInRect(DockRightRect, MousePos) then
begin
Result := alRight;
DockRect := DockRightRect;
DockRect.Left := Max(ClientWidth div 2, ClientWidth - Control.ClientWidth);
end
else
if PtInRect(DockBottomRect, MousePos) then
begin
Result := alBottom;
DockRect := DockBottomRect;
DockRect.Top := Max(ClientHeight div 2, ClientHeight - Control.ClientHeight);
end;
if Result = alNone then
Exit;
DockRect.TopLeft := ClientToScreen(DockRect.TopLeft);
DockRect.BottomRight := ClientToScreen(DockRect.BottomRight);
end;
end;
(* (ahuser) not used - make Delphi 5 happy
procedure SetTabControlPreview(VIDSource: TJvDockVIDVCDragDockObject;
TabControl: TJvDockVIDVCTabPageControl;
State: TDragState; DropAlign: TAlign);
var
I: Integer;
Index: Integer;
begin
if TabControl <> nil then
begin
if DropAlign = alClient then
begin
if TabControl.FTempSheet = nil then
begin
for I := VIDSource.SourceDockClientCount - 1 downto 0 do
begin
TabControl.FTempSheet := TJvDockVIDVCTabSheet.Create(TabControl);
TabControl.FTempSheet.PageControl := TabControl;
TabControl.FTempSheet.Caption := TWinControlAccessProtected(VIDSource.SourceDockClients[I]).Caption;
Index := TabControl.FTabImageList.AddIcon(TForm(VIDSource.SourceDockClients[I]).Icon);
if Index <> -1 then
TabControl.FTempSheet.ImageIndex := Index;
TabControl.FTempSheet.FIsSourceDockClient := True;
end;
TabControl.ActivePage := TabControl.FTempSheet;
TabControl.Panel.SelectSheet := TabControl.FTempSheet;
{$IFDEF COMPILER6_UP}
TabControl.Panel.FTempPages.Assign(TabControl.PageSheets);
{$ELSE}
AssignList(TabControl.PageSheets, TabControl.Panel.FTempPages);
{$ENDIF COMPILER6_UP}
TabControl.ActivePage.Invalidate;
end;
end;
if ((State = dsDragLeave) or (VIDSource.DropAlign <> alClient)) and (TabControl.FTempSheet <> nil) then
begin
for I := TabControl.PageCount - 1 downto 0 do
begin
if TJvDockVIDVCTabSheet(TabControl.Pages[I]).FIsSourceDockClient then
begin
Index := TabControl.Panel.FTempPages.IndexOf(TabControl.Pages[I]);
if Index >= 0 then
begin
TabControl.Panel.FTempPages.Delete(Index);
if TabControl.FTabImageList.Count > Index then
TabControl.FTabImageList.Delete(Index);
end;
TabControl.Pages[I].Free;
end;
end;
TabControl.FTempSheet := nil;
end;
TabControl.ParentForm.Caption := TabControl.ActivePage.Caption;
if TabControl.ParentForm.HostDockSite is TJvDockCustomPanel then
TabControl.ParentForm.HostDockSite.Invalidate;
end;
end;
*)
//=== { TJvDockVIDVCStyle } ==================================================
constructor TJvDockVIDVCStyle.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
DockPanelClass := TJvDockVIDVCPanel;
DockSplitterClass := TJvDockVIDVCSplitter;
ConjoinPanelClass := TJvDockVIDVCConjoinPanel;
TabDockClass := TJvDockVIDVCTabPageControl;
DockPanelTreeClass := TJvDockVIDVCTree;
DockPanelZoneClass := TJvDockVIDVCZone;
ConjoinPanelTreeClass := TJvDockVIDVCTree;
ConjoinPanelZoneClass := TJvDockVIDVCZone;
ConjoinServerOptionClass := TJvDockVIDVCConjoinServerOption;
TabServerOptionClass := TJvDockVIDVCTabServerOption;
end;
procedure TJvDockVIDVCStyle.FormDockOver(DockClient: TJvDockClient;
Source: TJvDockDragDockObject; X, Y: Integer; State: TDragState;
var Accept: Boolean);
var
ARect: TRect;
begin
with DockClient do
begin
Accept := EnableDock and EachOtherDock and
IsDockable(ParentForm, Source.Control, Source.DropOnControl, Source.DropAlign);
if State = dsDragMove then
begin
Source.DropAlign := ComputeVIDDockingRect(ParentForm, Source.Control, ARect, Point(X, Y));
if Accept and (Source.DropAlign <> alNone) then
begin
if Source.DropAlign = alClient then
Inc(ARect.Top, JvDockGetSysCaptionHeightAndBorderWidth + 1);
Source.DockRect := ARect;
end;
gi_DockRect := ARect;
end
else
if State = dsDragLeave then
Source.DropAlign := alNone;
if Source is TJvDockVIDVCDragDockObject then
begin
TJvDockVIDVCDragDockObject(Source).OldState := TJvDockVIDVCDragDockObject(Source).CurrState;
TJvDockVIDVCDragDockObject(Source).CurrState := State;
end;
end;
end;
procedure TJvDockVIDVCStyle.FormGetSiteInfo(Source: TJvDockDragDockObject;
DockClient: TJvDockClient; Client: TControl; var InfluenceRect: TRect;
MousePos: TPoint; var CanDock: Boolean);
const
DefExpandoRect = 20;
var
CH_BW: Integer;
ARect: TRect;
begin
with DockClient do
begin
CanDock := IsDockable(ParentForm, Client, Source.DropOnControl, Source.DropAlign);
if CanDock then
begin
GetWindowRect(ParentForm.Handle, InfluenceRect);
if ParentForm.HostDockSite is TJvDockCustomPanel then
begin
Dec(InfluenceRect.Top, TJvDockCustomPanel(ParentForm.HostDockSite).JvDockManager.GrabberSize);
end;
if PtInRect(InfluenceRect, MousePos) then
begin
ARect := InfluenceRect;
InflateRect(ARect, -DefExpandoRect, -DefExpandoRect);
CH_BW := JvDockGetSysCaptionHeightAndBorderWidth;
Inc(ARect.Top, CH_BW + 1);
if PtInRect(ARect, MousePos) then
begin
InfluenceRect := Rect(0, 0, 0, 0);
CanDock := False;
end;
end;
end;
end;
end;
procedure TJvDockVIDVCStyle.FormDockDrop(DockClient: TJvDockClient;
Source: TJvDockDragDockObject; X, Y: Integer);
var
ARect, DRect: TRect;
DockType: TAlign;
Host: TJvDockableForm;
APanelDock: TWinControl;
VIDSource: TJvDockVIDVCDragDockObject;
I: Integer;
begin
if Source is TJvDockVIDVCDragDockObject then
begin
TJvDockVIDVCDragDockObject(Source).CurrState := dsDragEnter;
TJvDockVIDVCDragDockObject(Source).OldState := dsDragEnter;
end;
if IsDockable(DockClient.ParentForm, Source.Control, Source.DropOnControl, Source.DropAlign) then
begin
Host := nil;
if not JvGlobalDockIsLoading then
JvDockLockWindow(nil);
try
with DockClient do
begin
DockType := ComputeVIDDockingRect(DockClient.ParentForm, Source.Control, ARect, Point(X, Y));
if ParentForm.HostDockSite is TJvDockPanel then
begin
if DockType = alClient then
begin
if Source.Control is TJvDockTabHostForm then
begin
APanelDock := ParentForm.HostDockSite;
ARect := ParentForm.BoundsRect;
ParentForm.ManualDock(TJvDockTabHostForm(Source.Control).PageControl, nil, alClient);
TJvDockTabHostForm(Source.Control).PageControl.ActivePage.PageIndex := 0;
Source.Control.BoundsRect := ARect;
Source.Control.ManualDock(APanelDock, nil, alClient);
if ParentForm.FormStyle = fsStayOnTop then
TForm(Source.Control).FormStyle := fsStayOnTop;
end
else
begin
APanelDock := ParentForm.HostDockSite;
DRect.TopLeft := ParentForm.HostDockSite.ClientToScreen(Point(0, 0));
Host := CreateTabHostAndDockControl(ParentForm, Source.Control);
SetDockSite(ParentForm, False);
SetDockSite(TWinControl(Source.Control), False);
Host.Top := DRect.Top;
Host.Left := DRect.Left;
Host.Visible := True;
Host.ManualDock(APanelDock, nil, alClient);
end;
end
else
begin
DRect := ParentForm.HostDockSite.BoundsRect;
Source.Control.ManualDock(ParentForm.HostDockSite, nil, DockType);
ParentForm.HostDockSite.BoundsRect := DRect;
SetDockSite(TWinControl(Source.Control), False);
end;
Exit;
end;
if DockType = alClient then
begin
if Source.Control is TJvDockTabHostForm then
begin
APanelDock := ParentForm.HostDockSite;
ARect := ParentForm.BoundsRect;
ParentForm.ManualDock(TJvDockTabHostForm(Source.Control).PageControl, nil, alClient);
TJvDockTabHostForm(Source.Control).PageControl.ActivePage.PageIndex := 0;
Source.Control.BoundsRect := ARect;
Source.Control.ManualDock(APanelDock, nil, alClient);
if ParentForm.FormStyle = fsStayOnTop then
TForm(Source.Control).FormStyle := fsStayOnTop;
Exit;
end
else
begin
if Source is TJvDockVIDVCDragDockObject then
begin
VIDSource := TJvDockVIDVCDragDockObject(Source);
DoFloatForm(Source.Control);
FreeAllDockableForm;
for I := 0 to VIDSource.SourceDockClientCount - 1 do
begin
VIDSource.Control := VIDSource.SourceDockClients[I];
if Host = nil then
Host := DockClient.CreateTabHostAndDockControl(DockClient.ParentForm, Source.Control)
else
Source.Control.ManualDock(TJvDockTabHostForm(Host).PageControl, nil, alClient);
end;
Host.Visible := True;
end;
end;
end
else
if DockType <> alNone then
begin
Host := CreateConjoinHostAndDockControl(ParentForm, Source.Control, DockType);
SetDockSite(ParentForm, False);
SetDockSite(TWinControl(Source.Control), False);
Host.Visible := True;
end;
if Host <> nil then
begin
Host.LRDockWidth := Source.Control.LRDockWidth;
Host.TBDockHeight := Source.Control.TBDockHeight;
end;
end;
finally
if not JvGlobalDockIsLoading then
JvDockUnLockWindow;
end;
end;
end;
procedure TJvDockVIDVCStyle.SetDockBaseControl(IsCreate: Boolean;
DockBaseControl: TJvDockBaseControl);
var
ADockClient: TJvDockClient;
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -