From 78cbf2ca5e12311504d3f209973131e6592fac07 Mon Sep 17 00:00:00 2001 From: naru Date: Tue, 22 Apr 2003 14:10:38 +0000 Subject: [PATCH] Position save and restore now supports multi monitors --- bottleclient/BottleDef.pas | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/bottleclient/BottleDef.pas b/bottleclient/BottleDef.pas index f1cfab7..27f47b0 100755 --- a/bottleclient/BottleDef.pas +++ b/bottleclient/BottleDef.pas @@ -143,6 +143,8 @@ type procedure SetNoExtraSSTPHeaders(const Value: boolean); procedure SetLogListPreviewStyle(const Value: TLogListPreviewStyle); procedure SetEditorPreviewWindowPosition(const Value: TRect); + protected + function InScreen(ARect: TRect): boolean; public property NoSendGhostList: boolean read FNoSendGhostList write SetNoSendGhostList; property ConfirmOnExit: boolean read FConfirmOnExit write SetConfirmOnExit; @@ -316,7 +318,7 @@ implementation { TBottlePrefs } constructor TBottlePrefs.Create; -var ARect, Dum: TRect; +var ARect: TRect; Strs: TStringList; begin FAutoJoinChannels := TStringList.Create; @@ -393,7 +395,7 @@ begin ARect.Left := FIni.ReadInteger('System', 'SenderWindowPositionLeft', 100); ARect.Bottom := FIni.ReadInteger('System', 'SenderWindowPositionBottom', 500); ARect.Right := FIni.ReadInteger('System', 'SenderWindowPositionRight', 500); - if not IntersectRect(Dum, Rect(0, 0, Screen.Width, Screen.Height), ARect) then + if not InScreen(ARect) then ARect := Rect(100, 100, 500, 500); SenderWindowPosition := ARect; ARect.Top := FIni.ReadInteger('System', 'LogWindowPositionTop', 200); @@ -402,7 +404,7 @@ begin ARect.Right := FIni.ReadInteger('System', 'LogWindowPositionRight', 400); LogWindowDividerPos := FIni.ReadInteger('System', 'LogWindowDividerPos', 150); LogWindowColumnWidth := FIni.ReadString('System', 'LogWindowColumnWidth', ''); - if not IntersectRect(Dum, Rect(0, 0, Screen.Width, Screen.Height), ARect) then begin + if not InScreen(ARect) then begin ARect := Rect(200, 200, 600, 400); LogWindowDividerPos := 150; end; @@ -826,6 +828,21 @@ begin FEditorPreviewWindowPosition := Value; end; +function TBottlePrefs.InScreen(ARect: TRect): boolean; +var i: integer; + dum: TRect; +begin + Result := false; + for i := 0 to Screen.MonitorCount-1 do + begin + if IntersectRect(dum, ARect, Screen.Monitors[i].WorkareaRect) then + begin + Result := true; + Exit; + end; + end; +end; + { TChannelListItem } procedure TChannelListItem.SetGhost(const Value: String); -- 2.11.0