Skip to content

Commit 7814f85

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents ac14f27 + 86557b7 commit 7814f85

File tree

13 files changed

+66
-44
lines changed

13 files changed

+66
-44
lines changed

src/TSMapEditor/Models/TerrainType.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55

66
namespace TSMapEditor.Models
77
{
8-
public class TerrainType : GameObjectType
8+
public class TerrainType : GameObjectType, IArtConfigContainer
99
{
1010
public TerrainType(string iniName) : base(iniName)
1111
{
1212
}
1313

1414
public override RTTIType WhatAmI() => RTTIType.TerrainType;
1515

16+
public IArtConfig GetArtConfig() => ArtConfig;
1617
public TerrainArtConfig ArtConfig { get; } = new TerrainArtConfig();
1718

1819
public TerrainOccupation TemperateOccupationBits { get; set; }

src/TSMapEditor/TSMapEditor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@
481481
<PackageReference Include="MonoGame.Framework.WindowsDX" Version="3.8.3" />
482482
<PackageReference Include="Rampastring.Tools" Version="2.0.6" />
483483
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.3" />
484-
<PackageReference Include="Rampastring.XNAUI.WindowsDX" Version="2.7.7" />
484+
<PackageReference Include="Rampastring.XNAUI.WindowsDX" Version="3.0.3" />
485485
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.10" />
486486
<PackageReference Include="Westwind.Scripting" Version="1.3.3" />
487487
</ItemGroup>

src/TSMapEditor/UI/Controls/EditorLinkLabel.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ protected override void ParseControlINIAttribute(IniFile iniFile, string key, st
2626
base.ParseControlINIAttribute(iniFile, key, value);
2727
}
2828

29-
public override void OnLeftClick()
29+
public override void OnLeftClick(InputEventArgs inputEventArgs)
3030
{
31+
inputEventArgs.Handled = true;
32+
3133
if (!string.IsNullOrWhiteSpace(URL))
3234
{
3335
try
@@ -44,7 +46,7 @@ public override void OnLeftClick()
4446
}
4547
}
4648

47-
base.OnLeftClick();
49+
base.OnLeftClick(inputEventArgs);
4850
}
4951
}
5052
}

src/TSMapEditor/UI/Controls/EditorWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public EditorWindow(WindowManager windowManager) : base(windowManager)
2727
/// to clean up event handlers when the window controller
2828
/// for a session is cleaned.
2929
/// </summary>
30-
public EventHandler FocusSwitchEventHandler { get; set; }
30+
public EventHandler<InputEventArgs> FocusSwitchEventHandler { get; set; }
3131

3232
protected bool CanBeMoved { get; set; } = true;
3333

src/TSMapEditor/UI/Controls/MenuButton.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ private void ContextMenu_EnabledChanged(object sender, System.EventArgs e)
6666
}
6767
}
6868

69-
public override void OnMouseLeftDown()
69+
public override void OnMouseLeftDown(InputEventArgs inputEventArgs)
7070
{
71-
base.OnMouseLeftDown();
71+
inputEventArgs.Handled = true;
72+
base.OnMouseLeftDown(inputEventArgs);
7273

7374
if (!ContextMenu.Enabled)
7475
{
@@ -77,9 +78,10 @@ public override void OnMouseLeftDown()
7778
}
7879
}
7980

80-
public override void OnLeftClick()
81+
public override void OnLeftClick(InputEventArgs inputEventArgs)
8182
{
82-
base.OnLeftClick();
83+
inputEventArgs.Handled = true;
84+
base.OnLeftClick(inputEventArgs);
8385

8486
if ((!ContextMenu.Enabled && !contextMenuDisabledOnCurrentFrame) || contextMenuOpenedOnClick)
8587
OpenContextMenu();

src/TSMapEditor/UI/MapUI.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,16 @@ private void EditorState_CursorActionChanged(object sender, EventArgs e)
347347
lastTileUnderCursor = null;
348348
}
349349

350-
public override void OnMouseScrolled()
350+
public override void OnMouseScrolled(InputEventArgs inputEventArgs)
351351
{
352+
inputEventArgs.Handled = true;
353+
352354
if (Cursor.ScrollWheelValue > 0)
353355
Camera.ZoomLevel += ZoomStep;
354356
else
355357
Camera.ZoomLevel -= ZoomStep;
356358

357-
base.OnMouseScrolled();
359+
base.OnMouseScrolled(inputEventArgs);
358360
}
359361

360362
public override void OnMouseOnControl()
@@ -448,9 +450,10 @@ public override void OnMouseEnter()
448450
base.OnMouseEnter();
449451
}
450452

451-
public override void OnMouseLeftDown()
453+
public override void OnMouseLeftDown(InputEventArgs inputEventArgs)
452454
{
453-
base.OnMouseLeftDown();
455+
inputEventArgs.Handled = true;
456+
base.OnMouseLeftDown(inputEventArgs);
454457
leftPressedDownOnControl = true;
455458

456459
if (CursorAction != null)
@@ -494,8 +497,10 @@ public override void OnMouseMove()
494497
}
495498
}
496499

497-
public override void OnLeftClick()
500+
public override void OnLeftClick(InputEventArgs inputEventArgs)
498501
{
502+
inputEventArgs.Handled = true;
503+
499504
if (tileUnderCursor != null && CursorAction != null)
500505
{
501506
CursorAction.LeftClick(tileUnderCursor.CoordsToPoint());
@@ -513,7 +518,7 @@ public override void OnLeftClick()
513518
}
514519
}
515520

516-
base.OnLeftClick();
521+
base.OnLeftClick(inputEventArgs);
517522
}
518523

519524
private void HandleDoubleClick()
@@ -540,16 +545,18 @@ private void HandleDoubleClick()
540545
}
541546
}
542547

543-
public override void OnRightClick()
548+
public override void OnRightClick(InputEventArgs inputEventArgs)
544549
{
550+
inputEventArgs.Handled = true;
551+
545552
if (CursorAction != null && !isRightClickScrolling)
546553
{
547554
CursorAction = null;
548555
}
549556

550557
isRightClickScrolling = false;
551558

552-
base.OnRightClick();
559+
base.OnRightClick(inputEventArgs);
553560
}
554561

555562
private MapTile CalculateBestTileUnderCursor()

src/TSMapEditor/UI/OverlayFrameSelector.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,17 @@ private void CenterLine(List<OverlayFrameSelectorFrame> line, int lineHeight)
279279
}
280280
}
281281

282-
public override void OnMouseScrolled()
282+
public override void OnMouseScrolled(InputEventArgs inputEventArgs)
283283
{
284-
base.OnMouseScrolled();
284+
inputEventArgs.Handled = true;
285+
base.OnMouseScrolled(inputEventArgs);
285286
viewY += Cursor.ScrollWheelValue * SCROLL_RATE;
286287
}
287288

288-
public override void OnMouseLeftDown()
289+
public override void OnMouseLeftDown(InputEventArgs inputEventArgs)
289290
{
290-
base.OnMouseLeftDown();
291+
inputEventArgs.Handled = true;
292+
base.OnMouseLeftDown(inputEventArgs);
291293
SelectedArrayIndex = GetFrameIndexUnderCursor();
292294
}
293295

src/TSMapEditor/UI/Sidebar/TreeView.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ private void ScrollBar_Scrolled(object sender, EventArgs e)
303303
/// <summary>
304304
/// Handles input from a scroll wheel.
305305
/// </summary>
306-
public override void OnMouseScrolled()
306+
public override void OnMouseScrolled(InputEventArgs inputEventArgs)
307307
{
308308
if (GetTotalContentHeight() < Height)
309309
{
@@ -312,6 +312,7 @@ public override void OnMouseScrolled()
312312
}
313313

314314
ViewTop -= Cursor.ScrollWheelValue * ScrollBar.ScrollStep;
315+
inputEventArgs.Handled = true;
315316

316317
if (ViewTop < 0)
317318
{
@@ -325,7 +326,7 @@ public override void OnMouseScrolled()
325326
ScrollToBottom();
326327
}
327328

328-
base.OnMouseScrolled();
329+
base.OnMouseScrolled(inputEventArgs);
329330
}
330331

331332
/// <summary>
@@ -345,8 +346,10 @@ public override void OnMouseLeave()
345346
base.OnMouseLeave();
346347
}
347348

348-
public override void OnMouseLeftDown()
349+
public override void OnMouseLeftDown(InputEventArgs inputEventArgs)
349350
{
351+
inputEventArgs.Handled = true;
352+
350353
var node = GetItemOnCursor(GetCursorPoint());
351354

352355
if (node == null)
@@ -370,7 +373,7 @@ public override void OnMouseLeftDown()
370373
SelectedNode = node;
371374
}
372375

373-
base.OnMouseLeftDown();
376+
base.OnMouseLeftDown(inputEventArgs);
374377
}
375378

376379
private TreeViewNode GetItemOnCursor(Point mouseLocation)

src/TSMapEditor/UI/TileDisplay.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,21 @@ private void CenterLine(List<TileDisplayTile> line, int lineHeight)
245245
}
246246
}
247247

248-
public override void OnMouseScrolled()
248+
public override void OnMouseScrolled(InputEventArgs inputEventArgs)
249249
{
250-
base.OnMouseScrolled();
250+
inputEventArgs.Handled = true;
251+
base.OnMouseScrolled(inputEventArgs);
251252
ViewY += Cursor.ScrollWheelValue * SCROLL_RATE;
252253
}
253254

254-
public override void OnMouseLeftDown()
255+
public override void OnMouseLeftDown(InputEventArgs inputEventArgs)
255256
{
256-
base.OnMouseLeftDown();
257257
SelectedTile = GetTileUnderCursor()?.TileImageToPlace;
258+
259+
if (SelectedTile != null)
260+
inputEventArgs.Handled = true;
261+
262+
base.OnMouseLeftDown(inputEventArgs);
258263
}
259264

260265
private TileDisplayTile GetTileUnderCursor()

src/TSMapEditor/UI/TileSelector.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,20 +215,18 @@ private void PreviousTileSet()
215215
lbTileSetList.SelectedIndex--;
216216
}
217217

218-
public override void OnMouseLeftDown()
218+
public override void OnMouseLeftDown(InputEventArgs inputEventArgs)
219219
{
220-
if (IsActive)
221-
{
222-
var cursorPoint = GetCursorPoint();
220+
inputEventArgs.Handled = true;
221+
var cursorPoint = GetCursorPoint();
223222

224-
if (!isBeingDragged && cursorPoint.Y > 0 && cursorPoint.Y < ResizeDragThreshold && Cursor.LeftDown)
225-
{
226-
isBeingDragged = true;
227-
previousMouseY = GetCursorPoint().Y;
228-
}
223+
if (!isBeingDragged && cursorPoint.Y > 0 && cursorPoint.Y < ResizeDragThreshold && Cursor.LeftDown)
224+
{
225+
isBeingDragged = true;
226+
previousMouseY = GetCursorPoint().Y;
229227
}
230228

231-
base.OnMouseLeftDown();
229+
base.OnMouseLeftDown(inputEventArgs);
232230
}
233231

234232
public override void Update(GameTime gameTime)
@@ -267,7 +265,9 @@ public override void Update(GameTime gameTime)
267265
previousMouseY = GetCursorPoint().Y;
268266

269267
if (!Cursor.LeftDown)
268+
{
270269
isBeingDragged = false;
270+
}
271271
}
272272
}
273273

0 commit comments

Comments
 (0)