- Realigned frmRegionControl
- Added coordinate grabbing to TfrmRegionControl - Added hints to the grab buttons in frmLargeScaleCommand
This commit is contained in:
parent
387d5fb28d
commit
a9f278ae21
|
@ -1084,7 +1084,7 @@ object frmLargeScaleCommand: TfrmLargeScaleCommand
|
|||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = btnDeleteArea
|
||||
Left = 4
|
||||
Height = 118
|
||||
Height = 122
|
||||
Top = 154
|
||||
Width = 144
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
|
@ -1209,10 +1209,8 @@ object frmLargeScaleCommand: TfrmLargeScaleCommand
|
|||
Top = 280
|
||||
Width = 22
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
BorderSpacing.Around = 4
|
||||
Color = clBtnFace
|
||||
Glyph.Data = {
|
||||
36040000424D3604000000000000360000002800000010000000100000000100
|
||||
|
@ -1394,6 +1392,7 @@ object frmLargeScaleCommand: TfrmLargeScaleCommand
|
|||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 34
|
||||
Height = 22
|
||||
Hint = 'Grab coordinates from the main window.'
|
||||
Top = 360
|
||||
Width = 22
|
||||
Anchors = [akLeft, akBottom]
|
||||
|
@ -1438,6 +1437,8 @@ object frmLargeScaleCommand: TfrmLargeScaleCommand
|
|||
}
|
||||
NumGlyphs = 0
|
||||
OnClick = btnGrab1Click
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
end
|
||||
object btnGrab2: TSpeedButton
|
||||
AnchorSideLeft.Control = seY2
|
||||
|
@ -1446,6 +1447,7 @@ object frmLargeScaleCommand: TfrmLargeScaleCommand
|
|||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 92
|
||||
Height = 22
|
||||
Hint = 'Grab coordinates from the main window.'
|
||||
Top = 360
|
||||
Width = 22
|
||||
Anchors = [akLeft, akBottom]
|
||||
|
@ -1489,5 +1491,7 @@ object frmLargeScaleCommand: TfrmLargeScaleCommand
|
|||
}
|
||||
NumGlyphs = 0
|
||||
OnClick = btnGrab1Click
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
end
|
||||
end
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,7 +21,7 @@
|
|||
* CDDL HEADER END
|
||||
*
|
||||
*
|
||||
* Portions Copyright 2008 Andreas Schneider
|
||||
* Portions Copyright 2009 Andreas Schneider
|
||||
*)
|
||||
unit UfrmRegionControl;
|
||||
|
||||
|
@ -32,7 +32,7 @@ interface
|
|||
uses
|
||||
Classes, SysUtils, math, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
VirtualTrees, ExtCtrls, ImagingComponents, StdCtrls, Buttons, Spin, LCLIntf,
|
||||
UEnhancedMemoryStream, Menus, URectList, UEnums;
|
||||
UEnhancedMemoryStream, Menus, URectList, UEnums, UWorldItem;
|
||||
|
||||
type
|
||||
TAreaMoveType = (amLeft, amTop, amRight, amBottom);
|
||||
|
@ -54,32 +54,28 @@ type
|
|||
btnAddArea: TSpeedButton;
|
||||
btnAddRegion: TSpeedButton;
|
||||
btnClearArea: TSpeedButton;
|
||||
btnDeleteArea: TSpeedButton;
|
||||
btnClose: TButton;
|
||||
btnDeleteArea: TSpeedButton;
|
||||
btnDeleteRegion: TSpeedButton;
|
||||
|
||||
btnSave: TButton;
|
||||
Label1: TLabel;
|
||||
lblX: TLabel;
|
||||
lblY: TLabel;
|
||||
mnuAddRegion: TMenuItem;
|
||||
mnuDeleteRegion: TMenuItem;
|
||||
Panel1: TPanel;
|
||||
Panel2: TPanel;
|
||||
Panel3: TPanel;
|
||||
Panel4: TPanel;
|
||||
Panel5: TPanel;
|
||||
pbArea: TPaintBox;
|
||||
pnlAreaControls: TPanel;
|
||||
pmRegions: TPopupMenu;
|
||||
sbArea: TScrollBox;
|
||||
seX1: TSpinEdit;
|
||||
seX2: TSpinEdit;
|
||||
seY1: TSpinEdit;
|
||||
seY2: TSpinEdit;
|
||||
btnGrab1: TSpeedButton;
|
||||
btnGrab2: TSpeedButton;
|
||||
spRegionsArea: TSplitter;
|
||||
vstArea: TVirtualStringTree;
|
||||
vstRegions: TVirtualStringTree;
|
||||
procedure btnGrab1Click(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
procedure mnuAddRegionClick(Sender: TObject);
|
||||
procedure mnuDeleteRegionClick(Sender: TObject);
|
||||
|
@ -93,8 +89,8 @@ type
|
|||
procedure FormShow(Sender: TObject);
|
||||
procedure pbAreaMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure pbAreaMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer
|
||||
);
|
||||
procedure pbAreaMouseMove(Sender: TObject; Shift: TShiftState; X,
|
||||
Y: Integer);
|
||||
procedure pbAreaPaint(Sender: TObject);
|
||||
procedure seX1Change(Sender: TObject);
|
||||
procedure vstAreaChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||
|
@ -112,12 +108,15 @@ type
|
|||
FOnRegionModified: TRegionModifiedEvent;
|
||||
FOnRegionDeleted: TRegionDeletedEvent;
|
||||
FOnRegionList: TRegionListEvent;
|
||||
FSelectFirst: Boolean;
|
||||
FOldWindowState: TWindowState;
|
||||
function FindRegion(AName: string): PVirtualNode;
|
||||
procedure CheckUnsaved;
|
||||
procedure OnModifyRegionPacket(ABuffer: TEnhancedMemoryStream);
|
||||
procedure OnDeleteRegionPacket(ABuffer: TEnhancedMemoryStream);
|
||||
procedure OnListRegionsPacket(ABuffer: TEnhancedMemoryStream);
|
||||
procedure OnAccessChanged(AAccessLevel: TAccessLevel);
|
||||
procedure TileSelected(AWorldItem: TWorldItem);
|
||||
public
|
||||
property OnRegionModified: TRegionModifiedEvent read FOnRegionModified write FOnRegionModified;
|
||||
property OnRegionDeleted: TRegionDeletedEvent read FOnRegionDeleted write FOnRegionDeleted;
|
||||
|
@ -221,9 +220,9 @@ end;
|
|||
procedure TfrmRegionControl.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmRadarMap.Dependencies.Remove(pbArea);
|
||||
if AdminPacketHandlers[$08] <> nil then FreeAndNil(AdminPacketHandlers[$08]);
|
||||
if AdminPacketHandlers[$09] <> nil then FreeAndNil(AdminPacketHandlers[$09]);
|
||||
if AdminPacketHandlers[$0A] <> nil then FreeAndNil(AdminPacketHandlers[$0A]);
|
||||
FreeAndNil(AdminPacketHandlers[$08]);
|
||||
FreeAndNil(AdminPacketHandlers[$09]);
|
||||
FreeAndNil(AdminPacketHandlers[$0A]);
|
||||
end;
|
||||
|
||||
procedure TfrmRegionControl.FormShow(Sender: TObject);
|
||||
|
@ -302,6 +301,15 @@ begin
|
|||
CheckUnsaved;
|
||||
end;
|
||||
|
||||
procedure TfrmRegionControl.btnGrab1Click(Sender: TObject);
|
||||
begin
|
||||
FSelectFirst := (Sender = btnGrab1);
|
||||
frmMain.RegisterSelectionListener(@TileSelected);
|
||||
FOldWindowState := WindowState;
|
||||
WindowState := wsMinimized;
|
||||
frmMain.SwitchToSelection;
|
||||
end;
|
||||
|
||||
procedure TfrmRegionControl.mnuDeleteRegionClick(Sender: TObject);
|
||||
var
|
||||
regionNode: PVirtualNode;
|
||||
|
@ -481,6 +489,8 @@ begin
|
|||
seX2.Enabled := selected;
|
||||
seY1.Enabled := selected;
|
||||
seY2.Enabled := selected;
|
||||
btnGrab1.Enabled := selected;
|
||||
btnGrab2.Enabled := selected;
|
||||
if selected then
|
||||
begin
|
||||
areaInfo := Sender.GetNodeData(Node);
|
||||
|
@ -708,6 +718,22 @@ begin
|
|||
dmNetwork.Send(TRequestRegionListPacket.Create);
|
||||
end;
|
||||
|
||||
procedure TfrmRegionControl.TileSelected(AWorldItem: TWorldItem);
|
||||
begin
|
||||
if FSelectFirst then
|
||||
begin
|
||||
seX1.Value := AWorldItem.X;
|
||||
seY1.Value := AWorldItem.Y;
|
||||
end else
|
||||
begin
|
||||
seX2.Value := AWorldItem.X;
|
||||
seY2.Value := AWorldItem.Y;
|
||||
end;
|
||||
frmMain.UnregisterSelectionListener(@TileSelected);
|
||||
WindowState := FOldWindowState;
|
||||
seX1Change(nil);
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I UfrmRegionControl.lrs}
|
||||
|
||||
|
|
Loading…
Reference in New Issue