Index: Core/GIS/src/Core.GIS.SharpMap.UI/Tools/Decorations/LayoutComponentTool.cs =================================================================== diff -u -rf1b79a2ac089360959e54586e0f51161d520ecc8 -rcc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c --- Core/GIS/src/Core.GIS.SharpMap.UI/Tools/Decorations/LayoutComponentTool.cs (.../LayoutComponentTool.cs) (revision f1b79a2ac089360959e54586e0f51161d520ecc8) +++ Core/GIS/src/Core.GIS.SharpMap.UI/Tools/Decorations/LayoutComponentTool.cs (.../LayoutComponentTool.cs) (revision cc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c) @@ -250,7 +250,7 @@ } } - public bool Selected { get; private set; } + public bool Selected { get; set; } public override void OnKeyDown(KeyEventArgs e) { Index: Core/GIS/test/Core.GIS.SharpMap.Tests/Core.GIS.SharpMap.Tests.csproj =================================================================== diff -u -r8ed458d0460c2bab956a7c3a75c2cdb5c1aae3e6 -rcc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c --- Core/GIS/test/Core.GIS.SharpMap.Tests/Core.GIS.SharpMap.Tests.csproj (.../Core.GIS.SharpMap.Tests.csproj) (revision 8ed458d0460c2bab956a7c3a75c2cdb5c1aae3e6) +++ Core/GIS/test/Core.GIS.SharpMap.Tests/Core.GIS.SharpMap.Tests.csproj (.../Core.GIS.SharpMap.Tests.csproj) (revision cc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c) @@ -238,6 +238,7 @@ ResXFileCodeGenerator Resources.Designer.cs + Designer Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/LayoutComponentToolCommand.cs =================================================================== diff -u --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/LayoutComponentToolCommand.cs (revision 0) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/LayoutComponentToolCommand.cs (revision cc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c) @@ -0,0 +1,71 @@ +using Core.Common.Gui; +using Core.GIS.SharpMap.UI.Tools; +using Core.GIS.SharpMap.UI.Tools.Decorations; + +namespace Core.Plugins.SharpMapGis.Gui.Commands +{ + public class LayoutComponentToolCommand : MapViewCommand, IGuiCommand where T : LayoutComponentTool + { + public override bool Checked + { + get + { + var layoutComponentTool = CurrentTool as LayoutComponentTool; + if (layoutComponentTool != null) + { + return layoutComponentTool.Visible; + } + + return false; + } + set + { + base.Checked = value; + } + } + + public IGui Gui { get; set; } + + protected override IMapTool CurrentTool + { + get + { + if (MapView == null) + { + return null; + } + + return MapView.MapControl.GetToolByType(); + } + } + + protected override void OnExecute(object[] arguments) + { + var layoutComponentTool = CurrentTool as LayoutComponentTool; + if (layoutComponentTool != null) + { + layoutComponentTool.Visible = !layoutComponentTool.Visible; + + if (!layoutComponentTool.Visible) + { + // If necessary, reset the gui selection (the tool might be the currently selected object) + if (Gui != null && Gui.Selection == layoutComponentTool) + { + Gui.Selection = null; + } + + // If necessary, unselect the tool + if (layoutComponentTool.Selected) + { + layoutComponentTool.Selected = false; + } + } + + // Refresh the map control + MapView.MapControl.Refresh(); + } + + base.OnExecute(arguments); + } + } +} \ No newline at end of file Fisheye: Tag cc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/ShowMapLegendCommand.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag cc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/ShowNorthArrowCommand.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag cc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/ShowScaleBarCommand.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Core.Plugins.SharpMapGis.Gui.csproj =================================================================== diff -u -r6819809d62f8609b8311b58dfef1b6ddef5701fe -rcc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Core.Plugins.SharpMapGis.Gui.csproj (.../Core.Plugins.SharpMapGis.Gui.csproj) (revision 6819809d62f8609b8311b58dfef1b6ddef5701fe) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Core.Plugins.SharpMapGis.Gui.csproj (.../Core.Plugins.SharpMapGis.Gui.csproj) (revision cc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c) @@ -68,10 +68,8 @@ - - - + Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Ribbon.xaml.cs =================================================================== diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -rcc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Ribbon.xaml.cs (.../Ribbon.xaml.cs) (revision a950714ad9510756331d862aa35695fa0b2ed03b) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Ribbon.xaml.cs (.../Ribbon.xaml.cs) (revision cc4fe77af8a4c4a8c076fe19a9a7f3ee8fe7714c) @@ -3,6 +3,7 @@ using System.Windows; using Core.Common.Controls; using Core.Common.Gui.Forms; +using Core.GIS.SharpMap.UI.Tools.Decorations; using Core.Plugins.SharpMapGis.Gui.Commands; using Fluent; @@ -46,9 +47,9 @@ commandShowMapContents = new ShowMapContentsCommand(); // map decorations - showNorthArrow = new ShowNorthArrowCommand(); - showMapLegend = new ShowMapLegendCommand(); - showScaleBar = new ShowScaleBarCommand(); + showNorthArrow = new LayoutComponentToolCommand(); + showMapLegend = new LayoutComponentToolCommand(); + showScaleBar = new LayoutComponentToolCommand(); // map interaction selectButton = new SelectCommand();