From 609ff5325320c9d3f3835d9577de41517f5b593e Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 11 May 2015 19:30:23 +0200 Subject: [PATCH] * Added X/Y boundaries --- Client/CentrED.lpi | 4 +- Client/Tools/UfrmBoundaries.lfm | 328 ++++++++++++++++++++++---------- Client/Tools/UfrmBoundaries.pas | 51 ++++- Client/UfrmMain.pas | 8 +- 4 files changed, 289 insertions(+), 102 deletions(-) diff --git a/Client/CentrED.lpi b/Client/CentrED.lpi index 00b7240..d9f91e0 100644 --- a/Client/CentrED.lpi +++ b/Client/CentrED.lpi @@ -18,7 +18,7 @@ - + @@ -371,6 +371,7 @@ + @@ -474,6 +475,7 @@ + diff --git a/Client/Tools/UfrmBoundaries.lfm b/Client/Tools/UfrmBoundaries.lfm index 1db4b5e..9913d5b 100644 --- a/Client/Tools/UfrmBoundaries.lfm +++ b/Client/Tools/UfrmBoundaries.lfm @@ -1,109 +1,243 @@ inherited frmBoundaries: TfrmBoundaries - Left = 290 + Left = 1831 Height = 164 - Top = 171 - Width = 205 + Top = 239 + Width = 402 Caption = 'Boundaries' ClientHeight = 164 - ClientWidth = 205 - object lblMaxZ: TLabel[0] + ClientWidth = 402 + OnCreate = FormCreate + object gbZRestriction: TGroupBox[0] AnchorSideLeft.Control = Owner - AnchorSideTop.Control = seMaxZ - AnchorSideTop.Side = asrCenter - Left = 8 - Height = 16 - Top = 89 - Width = 68 - BorderSpacing.Left = 8 - Caption = 'Maximum Z:' - Layout = tlCenter - ParentColor = False - end - object lblMinZ: TLabel[1] - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = seMinZ - AnchorSideTop.Side = asrCenter - Left = 8 - Height = 16 - Top = 12 - Width = 67 - BorderSpacing.Left = 8 - Caption = 'Minimum Z:' - Layout = tlCenter - ParentColor = False - end - object tbMinZ: TTrackBar[2] - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = seMinZ - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 8 - Height = 36 - Top = 41 - Width = 189 - Frequency = 10 - Max = 127 - Min = -128 - OnChange = tbMinZChange - PageSize = 1 - Position = -128 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Around = 8 + AnchorSideTop.Control = Owner + Left = 4 + Height = 156 + Top = 4 + Width = 196 + BorderSpacing.Left = 4 + BorderSpacing.Top = 4 + Caption = 'Restrict Height' + ClientHeight = 141 + ClientWidth = 192 TabOrder = 0 + object lblMinZ: TLabel + AnchorSideLeft.Control = tbMinZ + AnchorSideTop.Control = seMinZ + AnchorSideTop.Side = asrCenter + Left = 4 + Height = 13 + Top = 8 + Width = 68 + Caption = 'Minimum Z:' + Layout = tlCenter + ParentColor = False + end + object seMinZ: TSpinEdit + AnchorSideTop.Control = gbZRestriction + AnchorSideRight.Control = gbZRestriction + AnchorSideRight.Side = asrBottom + Left = 136 + Height = 21 + Top = 4 + Width = 52 + Anchors = [akTop, akRight] + BorderSpacing.Top = 4 + BorderSpacing.Right = 4 + MaxValue = 127 + MinValue = -128 + OnChange = seMinZChange + TabOrder = 0 + Value = -128 + end + object tbMinZ: TTrackBar + AnchorSideLeft.Control = gbZRestriction + AnchorSideTop.Control = seMinZ + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = gbZRestriction + AnchorSideRight.Side = asrBottom + Left = 4 + Height = 36 + Top = 29 + Width = 184 + Frequency = 10 + Max = 127 + Min = -128 + OnChange = tbMinZChange + PageSize = 1 + Position = -128 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Around = 4 + TabOrder = 1 + end + object lblMaxZ: TLabel + AnchorSideLeft.Control = tbMaxZ + AnchorSideTop.Control = seMaxZ + AnchorSideTop.Side = asrCenter + Left = 4 + Height = 13 + Top = 73 + Width = 71 + Caption = 'Maximum Z:' + Layout = tlCenter + ParentColor = False + end + object seMaxZ: TSpinEdit + AnchorSideTop.Control = tbMinZ + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = seMinZ + AnchorSideRight.Side = asrBottom + Left = 136 + Height = 21 + Top = 69 + Width = 52 + Anchors = [akTop, akRight] + MaxValue = 127 + MinValue = -128 + OnChange = seMaxZChange + TabOrder = 2 + Value = 127 + end + object tbMaxZ: TTrackBar + AnchorSideLeft.Control = gbZRestriction + AnchorSideTop.Control = seMaxZ + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = gbZRestriction + AnchorSideRight.Side = asrBottom + Left = 4 + Height = 36 + Top = 94 + Width = 184 + Frequency = 10 + Max = 127 + Min = -128 + OnChange = tbMaxZChange + PageSize = 1 + Position = 127 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Around = 4 + TabOrder = 3 + end end - object tbMaxZ: TTrackBar[3] - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = seMaxZ - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 8 - Height = 36 - Top = 118 - Width = 189 - Frequency = 10 - Max = 127 - Min = -128 - OnChange = tbMaxZChange - PageSize = 1 - Position = 127 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Around = 8 - TabOrder = 1 - end - object seMaxZ: TSpinEdit[4] - AnchorSideTop.Control = tbMinZ - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 149 - Height = 25 - Top = 85 - Width = 48 - Anchors = [akTop, akRight] - BorderSpacing.Right = 8 - MaxValue = 127 - MinValue = -128 - OnChange = seMaxZChange - TabOrder = 2 - Value = 127 - end - object seMinZ: TSpinEdit[5] + object gbViewRestriction: TGroupBox[1] + AnchorSideLeft.Control = gbZRestriction + AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Owner AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 149 - Height = 25 - Top = 8 - Width = 48 - Anchors = [akTop, akRight] - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - MaxValue = 127 - MinValue = -128 - OnChange = seMinZChange - TabOrder = 3 - Value = -128 + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 204 + Height = 156 + Top = 4 + Width = 194 + Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Around = 4 + Caption = 'Restrict View Range' + ClientHeight = 141 + ClientWidth = 190 + TabOrder = 1 + object seMinX: TSpinEdit + AnchorSideLeft.Control = lblX + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = seMaxX + Left = 19 + Height = 21 + Top = 4 + Width = 74 + BorderSpacing.Left = 4 + OnChange = seMinXChange + TabOrder = 0 + end + object seMaxX: TSpinEdit + AnchorSideTop.Control = gbViewRestriction + AnchorSideRight.Control = gbViewRestriction + AnchorSideRight.Side = asrBottom + Left = 112 + Height = 21 + Top = 4 + Width = 74 + Anchors = [akTop, akRight] + BorderSpacing.Top = 4 + BorderSpacing.Right = 4 + OnChange = seMaxXChange + TabOrder = 1 + end + object seMinY: TSpinEdit + AnchorSideLeft.Control = seMinX + AnchorSideTop.Control = seMinX + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = seMinX + AnchorSideRight.Side = asrBottom + Left = 19 + Height = 21 + Top = 33 + Width = 74 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 8 + OnChange = seMinYChange + TabOrder = 2 + end + object seMaxY: TSpinEdit + AnchorSideLeft.Control = seMaxX + AnchorSideTop.Control = seMinY + AnchorSideRight.Control = seMaxX + AnchorSideRight.Side = asrBottom + Left = 112 + Height = 21 + Top = 33 + Width = 74 + Anchors = [akTop, akLeft, akRight] + OnChange = seMaxYChange + TabOrder = 3 + end + object lblX: TLabel + AnchorSideLeft.Control = gbViewRestriction + AnchorSideTop.Control = seMinX + AnchorSideTop.Side = asrCenter + Left = 4 + Height = 13 + Top = 8 + Width = 11 + BorderSpacing.Left = 4 + Caption = 'X:' + ParentColor = False + end + object lblY: TLabel + AnchorSideLeft.Control = lblX + AnchorSideTop.Control = seMinY + AnchorSideTop.Side = asrCenter + Left = 4 + Height = 13 + Top = 37 + Width = 10 + Caption = 'Y:' + ParentColor = False + end + object lblXSep: TLabel + AnchorSideLeft.Control = seMinX + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = seMaxX + AnchorSideTop.Side = asrCenter + Left = 97 + Height = 13 + Top = 8 + Width = 11 + BorderSpacing.Left = 4 + Caption = '—' + ParentColor = False + end + object lblYSep: TLabel + AnchorSideLeft.Control = lblXSep + AnchorSideTop.Control = seMinY + AnchorSideTop.Side = asrCenter + Left = 97 + Height = 13 + Top = 37 + Width = 11 + Caption = '—' + ParentColor = False + end + end + inherited tmClose: TTimer[2] end end diff --git a/Client/Tools/UfrmBoundaries.pas b/Client/Tools/UfrmBoundaries.pas index 3dfbefc..ecf7ea5 100644 --- a/Client/Tools/UfrmBoundaries.pas +++ b/Client/Tools/UfrmBoundaries.pas @@ -21,7 +21,8 @@ * CDDL HEADER END * * - * Portions Copyright 2009 Andreas Schneider + * Portions Copyright 2015 Andreas Schneider + * Portions Copyright 2015 StaticZ *) unit UfrmBoundaries; @@ -38,13 +39,28 @@ type { TfrmBoundaries } TfrmBoundaries = class(TfrmToolWindow) + gbZRestriction: TGroupBox; + gbViewRestriction: TGroupBox; + lblYSep: TLabel; + lblXSep: TLabel; + lblY: TLabel; + lblX: TLabel; lblMaxZ: TLabel; lblMinZ: TLabel; seMaxZ: TSpinEdit; seMinZ: TSpinEdit; - tbMinZ: TTrackBar; + seMinX: TSpinEdit; + seMaxX: TSpinEdit; + seMinY: TSpinEdit; + seMaxY: TSpinEdit; tbMaxZ: TTrackBar; + tbMinZ: TTrackBar; + procedure FormCreate(Sender: TObject); + procedure seMaxXChange(Sender: TObject); + procedure seMaxYChange(Sender: TObject); procedure seMaxZChange(Sender: TObject); + procedure seMinXChange(Sender: TObject); + procedure seMinYChange(Sender: TObject); procedure seMinZChange(Sender: TObject); procedure tbMaxZChange(Sender: TObject); procedure tbMinZChange(Sender: TObject); @@ -62,12 +78,43 @@ uses { TfrmBoundaries } +procedure TfrmBoundaries.FormCreate(Sender: TObject); +begin + seMinX.MaxValue := frmMain.Landscape.CellWidth - 1; + seMaxX.MaxValue := seMinX.MaxValue; + seMaxX.Value := seMaxX.MaxValue; + + seMinY.MaxValue := frmMain.Landscape.CellHeight - 1; + seMaxY.MaxValue := seMinY.MaxValue; + seMaxY.Value := seMaxX.MaxValue; +end; + +procedure TfrmBoundaries.seMaxXChange(Sender: TObject); +begin + frmMain.InvalidateFilter; +end; + +procedure TfrmBoundaries.seMaxYChange(Sender: TObject); +begin + frmMain.InvalidateFilter; +end; + procedure TfrmBoundaries.seMaxZChange(Sender: TObject); begin tbMaxZ.Position := seMaxZ.Value; frmMain.InvalidateFilter; end; +procedure TfrmBoundaries.seMinXChange(Sender: TObject); +begin + frmMain.InvalidateFilter; +end; + +procedure TfrmBoundaries.seMinYChange(Sender: TObject); +begin + frmMain.InvalidateFilter; +end; + procedure TfrmBoundaries.seMinZChange(Sender: TObject); begin tbMinZ.Position := seMinZ.Value; diff --git a/Client/UfrmMain.pas b/Client/UfrmMain.pas index 9cfbb86..d4b4515 100644 --- a/Client/UfrmMain.pas +++ b/Client/UfrmMain.pas @@ -37,7 +37,7 @@ uses LCLIntf, UOverlayUI, UStatics, UEnhancedMemoryStream, ActnList, XMLPropStorage, ImagingClasses, dateutils, UPlatformTypes, UMap, UPacket, UGLFont, DOM, XMLRead, XMLWrite, strutils, ULightManager, heContnrs, - UContnrExt, UTiledata; + UContnrExt, UTiledata, Types; type TAccessChangedListener = procedure(AAccessLevel: TAccessLevel) of object; @@ -2833,7 +2833,11 @@ begin begin blockInfo^.State := ssNormal; if (blockInfo^.Item.Z < frmBoundaries.tbMinZ.Position) or - (blockInfo^.Item.Z > frmBoundaries.tbMaxZ.Position) then + (blockInfo^.Item.Z > frmBoundaries.tbMaxZ.Position) or + (blockInfo^.Item.X < frmBoundaries.seMinX.Value) or + (blockInfo^.Item.X > frmBoundaries.seMaxX.Value) or + (blockInfo^.Item.Y < frmBoundaries.seMinY.Value) or + (blockInfo^.Item.Y > frmBoundaries.seMaxY.Value) then begin blockInfo^.State := ssFiltered; end else