From 59ab7046c4d41babc2159d6e9357584f00f9ed3f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 10 Dec 2009 16:54:43 +0100 Subject: [PATCH] - Relect selection of the random tile list with the normal list list (fixes #51) --- Client/UfrmMain.lfm | 3 ++- Client/UfrmMain.pas | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Client/UfrmMain.lfm b/Client/UfrmMain.lfm index dfca3f5..cb73b7f 100644 --- a/Client/UfrmMain.lfm +++ b/Client/UfrmMain.lfm @@ -16,7 +16,7 @@ object frmMain: TfrmMain OnCreate = FormCreate OnDestroy = FormDestroy Position = poScreenCenter - SessionProperties = 'acFlat.Checked;acNoDraw.Checked;Height;Left;mnuFlatShowHeight.Checked;tbStatics.Down;tbTerrain.Down;Top;Width;WindowState;mnuShowAnimations.Checked;mnuSecurityQuestion.Checked' + SessionProperties = 'acFlat.Checked;acNoDraw.Checked;Height;Left;mnuFlatShowHeight.Checked;mnuSecurityQuestion.Checked;mnuShowAnimations.Checked;tbStatics.Down;tbTerrain.Down;Top;Width;WindowState;spTileList.Top' ShowInTaskBar = stAlways LCLVersion = '0.9.29' WindowState = wsMaximized @@ -507,6 +507,7 @@ object frmMain: TfrmMain TabOrder = 0 TreeOptions.PaintOptions = [toHideFocusRect, toShowButtons, toShowDropmark, toThemeAware, toUseBlendedImages] TreeOptions.SelectionOptions = [toFullRowSelect, toMultiSelect] + OnClick = vdtRandomClick OnDragOver = vdtRandomDragOver OnDragDrop = vdtRandomDragDrop OnDrawNode = vdtTilesDrawNode diff --git a/Client/UfrmMain.pas b/Client/UfrmMain.pas index 400f41d..0a2f7ee 100644 --- a/Client/UfrmMain.pas +++ b/Client/UfrmMain.pas @@ -238,6 +238,7 @@ type procedure tmGrabTileInfoTimer(Sender: TObject); procedure tmMovementTimer(Sender: TObject); procedure tmTileHintTimer(Sender: TObject); + procedure vdtRandomClick(Sender: TObject); procedure vdtRandomDragDrop(Sender: TBaseVirtualTree; Source: TObject; DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode); @@ -1405,6 +1406,37 @@ begin tmTileHint.Enabled := False; end; +procedure TfrmMain.vdtRandomClick(Sender: TObject); +var + node: PVirtualNode; + tileInfo: PTileInfo; + selectedID: Integer; +begin + if vdtRandom.SelectedCount = 1 then + begin + node := vdtRandom.GetFirstSelected; + if node <> nil then + begin + tileInfo := vdtRandom.GetNodeData(node); + selectedID := tileInfo^.ID; + + node := vdtTiles.GetFirst; + while node <> nil do + begin + tileInfo := vdtTiles.GetNodeData(node); + if tileInfo^.ID = selectedID then + begin + vdtTiles.ClearSelection; + vdtTiles.Selected[node] := True; + vdtTiles.FocusedNode := node; + node := nil; + end else + node := vdtTiles.GetNext(node); + end; + end; + end; +end; + procedure TfrmMain.vdtRandomDragDrop(Sender: TBaseVirtualTree; Source: TObject; DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);