2009-08-06 15:42:19 +02:00
|
|
|
(*
|
|
|
|
* CDDL HEADER START
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the terms of the
|
|
|
|
* Common Development and Distribution License, Version 1.0 only
|
|
|
|
* (the "License"). You may not use this file except in compliance
|
|
|
|
* with the License.
|
|
|
|
*
|
|
|
|
* You can obtain a copy of the license at
|
|
|
|
* http://www.opensource.org/licenses/cddl1.php.
|
|
|
|
* See the License for the specific language governing permissions
|
|
|
|
* and limitations under the License.
|
|
|
|
*
|
|
|
|
* When distributing Covered Code, include this CDDL HEADER in each
|
|
|
|
* file and include the License file at
|
|
|
|
* http://www.opensource.org/licenses/cddl1.php. If applicable,
|
|
|
|
* add the following below this CDDL HEADER, with the fields enclosed
|
|
|
|
* by brackets "[]" replaced with your own identifying * information:
|
|
|
|
* Portions Copyright [yyyy] [name of copyright owner]
|
|
|
|
*
|
|
|
|
* CDDL HEADER END
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Portions Copyright 2009 Andreas Schneider
|
|
|
|
*)
|
|
|
|
unit UfrmBoundaries;
|
|
|
|
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
2009-09-02 03:21:39 +02:00
|
|
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
2015-05-01 12:23:03 +02:00
|
|
|
ComCtrls, Spin, ExtCtrls, Buttons, UfrmToolWindow;
|
2009-08-06 15:42:19 +02:00
|
|
|
|
|
|
|
type
|
|
|
|
|
|
|
|
{ TfrmBoundaries }
|
|
|
|
|
2009-09-02 03:21:39 +02:00
|
|
|
TfrmBoundaries = class(TfrmToolWindow)
|
2015-05-01 12:23:03 +02:00
|
|
|
GroupBox1: TGroupBox;
|
|
|
|
GroupBox2: TGroupBox;
|
|
|
|
lblAxeX1: TLabel;
|
|
|
|
lblAxeY1: TLabel;
|
2008-08-17 15:38:54 +02:00
|
|
|
lblMaxZ: TLabel;
|
|
|
|
lblMinZ: TLabel;
|
2015-05-01 12:23:03 +02:00
|
|
|
lblAxeX: TLabel;
|
|
|
|
lblAxeY: TLabel;
|
2008-08-17 15:38:54 +02:00
|
|
|
seMaxZ: TSpinEdit;
|
2009-08-06 15:42:19 +02:00
|
|
|
seMinZ: TSpinEdit;
|
2015-05-01 12:23:03 +02:00
|
|
|
seMaxX: TSpinEdit;
|
|
|
|
seMaxY: TSpinEdit;
|
|
|
|
seMinY: TSpinEdit;
|
|
|
|
seMinX: TSpinEdit;
|
|
|
|
sbClearXbnd: TSpeedButton;
|
|
|
|
sbClearYbnd: TSpeedButton;
|
2009-08-06 15:42:19 +02:00
|
|
|
tbMinZ: TTrackBar;
|
|
|
|
tbMaxZ: TTrackBar;
|
2015-05-01 12:23:03 +02:00
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
procedure sbClearXbndClick(Sender: TObject);
|
|
|
|
procedure sbClearYbndClick(Sender: TObject);
|
|
|
|
procedure seMaxXChange(Sender: TObject);
|
|
|
|
procedure seMaxYChange(Sender: TObject);
|
2009-08-06 15:42:19 +02:00
|
|
|
procedure seMaxZChange(Sender: TObject);
|
2015-05-01 12:23:03 +02:00
|
|
|
procedure seMinXChange(Sender: TObject);
|
|
|
|
procedure seMinYChange(Sender: TObject);
|
2009-08-06 15:42:19 +02:00
|
|
|
procedure seMinZChange(Sender: TObject);
|
|
|
|
procedure tbMaxZChange(Sender: TObject);
|
|
|
|
procedure tbMinZChange(Sender: TObject);
|
|
|
|
public
|
|
|
|
{ public declarations }
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
|
|
|
frmBoundaries: TfrmBoundaries;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
2015-05-01 12:23:03 +02:00
|
|
|
UfrmMain, Language;
|
2009-08-06 15:42:19 +02:00
|
|
|
|
|
|
|
{ TfrmBoundaries }
|
|
|
|
|
2015-05-01 12:23:03 +02:00
|
|
|
procedure TfrmBoundaries.FormCreate(Sender: TObject);
|
2009-08-06 15:42:19 +02:00
|
|
|
begin
|
2015-05-01 12:23:03 +02:00
|
|
|
LanguageTranslate(Self);
|
|
|
|
seMaxX.MaxValue := 8*frmMain.Landscape.Width-1;
|
|
|
|
seMinX.MaxValue := seMaxX.MaxValue; seMaxX.Value := seMaxX.MaxValue;
|
|
|
|
seMaxY.MaxValue := 8*frmMain.Landscape.Height-1;
|
|
|
|
seMinY.MaxValue := seMaxY.MaxValue; seMaxY.Value := seMaxY.MaxValue;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmBoundaries.sbClearXbndClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
seMinX.Value := seMinX.MinValue;
|
|
|
|
seMaxX.Value := seMaxX.MaxValue;
|
|
|
|
frmMain.InvalidateFilter;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmBoundaries.sbClearYbndClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
seMinY.Value := seMinY.MinValue;
|
|
|
|
seMaxY.Value := seMaxY.MaxValue;
|
|
|
|
frmMain.InvalidateFilter;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmBoundaries.seMinXChange(Sender: TObject);
|
|
|
|
begin
|
|
|
|
if (seMaxX.Value <= seMinX.Value) then if (seMinX.Value < seMaxX.MaxValue)
|
|
|
|
then seMaxX.Value := seMinX.Value+1
|
|
|
|
else seMaxX.Value := seMaxX.MaxValue;
|
|
|
|
frmMain.InvalidateFilter;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmBoundaries.seMaxXChange(Sender: TObject);
|
|
|
|
begin
|
|
|
|
if (seMinX.Value >= seMaxX.Value) then if (seMaxX.Value > seMinX.MinValue)
|
|
|
|
then seMinX.Value := seMaxX.Value-1
|
|
|
|
else seMinX.Value := seMinX.MinValue;
|
|
|
|
frmMain.InvalidateFilter;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmBoundaries.seMinYChange(Sender: TObject);
|
|
|
|
begin
|
|
|
|
if (seMaxY.Value <= seMinY.Value) then if (seMinY.Value < seMaxY.MaxValue)
|
|
|
|
then seMaxY.Value := seMinY.Value+1
|
|
|
|
else seMaxY.Value := seMaxY.MaxValue;
|
|
|
|
frmMain.InvalidateFilter;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmBoundaries.seMaxYChange(Sender: TObject);
|
|
|
|
begin
|
|
|
|
if (seMinY.Value >= seMaxY.Value) then if (seMaxY.Value > seMinY.MinValue)
|
|
|
|
then seMinY.Value := seMaxY.Value-1
|
|
|
|
else seMinY.Value := seMinY.MinValue;
|
2009-09-02 03:21:39 +02:00
|
|
|
frmMain.InvalidateFilter;
|
2009-08-06 15:42:19 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmBoundaries.seMinZChange(Sender: TObject);
|
|
|
|
begin
|
2015-05-01 12:23:03 +02:00
|
|
|
if (seMaxZ.Value <= seMinZ.Value) then if (seMinZ.Value < seMaxZ.MaxValue)
|
|
|
|
then seMaxZ.Value := seMinZ.Value+1
|
|
|
|
else seMaxZ.Value := seMaxZ.MaxValue;
|
2009-08-06 15:42:19 +02:00
|
|
|
tbMinZ.Position := seMinZ.Value;
|
2015-05-01 12:23:03 +02:00
|
|
|
tbMaxZ.Position := seMaxZ.Value;
|
2009-09-02 03:21:39 +02:00
|
|
|
frmMain.InvalidateFilter;
|
2009-08-06 15:42:19 +02:00
|
|
|
end;
|
|
|
|
|
2015-05-01 12:23:03 +02:00
|
|
|
procedure TfrmBoundaries.seMaxZChange(Sender: TObject);
|
2009-08-06 15:42:19 +02:00
|
|
|
begin
|
2015-05-01 12:23:03 +02:00
|
|
|
if (seMinZ.Value >= seMaxZ.Value) then if (seMaxZ.Value > seMinZ.MinValue)
|
|
|
|
then seMinZ.Value := seMaxZ.Value-1
|
|
|
|
else seMinZ.Value := seMinZ.MinValue;
|
|
|
|
tbMaxZ.Position := seMaxZ.Value;
|
|
|
|
tbMinZ.Position := seMinZ.Value;
|
2009-08-06 17:34:55 +02:00
|
|
|
frmMain.InvalidateFilter;
|
2009-08-06 15:42:19 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmBoundaries.tbMinZChange(Sender: TObject);
|
|
|
|
begin
|
2015-05-01 12:23:03 +02:00
|
|
|
if (tbMaxZ.Position <= tbMinZ.Position) then if (tbMinZ.Position < tbMaxZ.Max)
|
|
|
|
then tbMaxZ.Position := tbMinZ.Position+1
|
|
|
|
else tbMaxZ.Position := tbMaxZ.Max;
|
|
|
|
seMinZ.Value := tbMinZ.Position;
|
|
|
|
seMaxZ.Value := tbMaxZ.Position;
|
|
|
|
frmMain.InvalidateFilter;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmBoundaries.tbMaxZChange(Sender: TObject);
|
|
|
|
begin
|
|
|
|
if (tbMinZ.Position >= tbMaxZ.Position) then if (tbMaxZ.Position > tbMinZ.Min)
|
|
|
|
then tbMinZ.Position := tbMaxZ.Position-1
|
|
|
|
else tbMinZ.Position := tbMinZ.Min;
|
|
|
|
seMaxZ.Value := tbMaxZ.Position;
|
2009-08-06 15:42:19 +02:00
|
|
|
seMinZ.Value := tbMinZ.Position;
|
2009-08-06 17:34:55 +02:00
|
|
|
frmMain.InvalidateFilter;
|
2009-08-06 15:42:19 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
initialization
|
|
|
|
{$I UfrmBoundaries.lrs}
|
|
|
|
|
|
|
|
end.
|
|
|
|
|