[mapguide-commits] r5646 -
trunk/Tools/Maestro/Maestro.Editors/MapDefinition
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Mar 21 07:43:48 EDT 2011
Author: jng
Date: 2011-03-21 04:43:48 -0700 (Mon, 21 Mar 2011)
New Revision: 5646
Modified:
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
Log:
#1631: Hook up del keypress to delete current selected item
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2011-03-21 11:07:41 UTC (rev 5645)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2011-03-21 11:43:48 UTC (rev 5646)
@@ -46,8 +46,57 @@
public MapLayersSectionCtrl()
{
InitializeComponent();
+ trvBaseLayers.KeyUp += new KeyEventHandler(trvBaseLayers_KeyUp);
+ trvLayerDrawingOrder.KeyUp += new KeyEventHandler(trvLayerDrawingOrder_KeyUp);
+ trvLayersGroup.KeyUp += new KeyEventHandler(trvLayersGroup_KeyUp);
}
+ void trvLayersGroup_KeyUp(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Delete)
+ {
+ var group = GetSelectedLayerGroupItem() as GroupItem;
+ var layer = GetSelectedLayerGroupItem() as LayerItem;
+ if (layer != null)
+ {
+ RemoveSelectedLayerGroupItem(layer);
+ }
+ else if (group != null)
+ {
+ RemoveSelectedLayerGroupItem(group);
+ }
+ }
+ }
+
+ void trvLayerDrawingOrder_KeyUp(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Delete)
+ {
+ var layer = GetSelectedDrawOrderItem() as LayerItem;
+ if (layer != null)
+ {
+ RemoveSelectedDrawOrderLayerItem(layer);
+ }
+ }
+ }
+
+ void trvBaseLayers_KeyUp(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Delete)
+ {
+ var group = GetSelectedTiledLayerItem() as BaseLayerGroupItem;
+ var layer = GetSelectedTiledLayerItem() as BaseLayerItem;
+ if (group != null)
+ {
+ RemoveSelectedTiledLayerItem(group);
+ }
+ else if (layer != null)
+ {
+ RemoveSelectedTiledLayerItem(layer);
+ }
+ }
+ }
+
private IMapDefinition _map;
private DrawOrderLayerModel _doLayerModel;
@@ -158,6 +207,11 @@
private void btnRemoveGroup_Click(object sender, EventArgs e)
{
var group = GetSelectedLayerGroupItem() as GroupItem;
+ RemoveSelectedLayerGroupItem(group);
+ }
+
+ private void RemoveSelectedLayerGroupItem(GroupItem group)
+ {
_map.RemoveGroup(group.Tag);
propertiesPanel.Controls.Clear();
_grpLayerModel.Invalidate();
@@ -183,12 +237,17 @@
var layer = GetSelectedLayerGroupItem() as LayerItem;
if (layer != null)
{
- _map.RemoveLayer(layer.Tag);
- propertiesPanel.Controls.Clear();
- this.RefreshModels();
+ RemoveSelectedLayerGroupItem(layer);
}
}
+ private void RemoveSelectedLayerGroupItem(LayerItem layer)
+ {
+ _map.RemoveLayer(layer.Tag);
+ propertiesPanel.Controls.Clear();
+ this.RefreshModels();
+ }
+
private void btnConvertLayerGroupToBaseGroup_Click(object sender, EventArgs e)
{
var group = GetSelectedLayerGroupItem() as GroupItem;
@@ -218,12 +277,17 @@
var layer = GetSelectedDrawOrderItem() as LayerItem;
if (layer != null)
{
- _map.RemoveLayer(layer.Tag);
- propertiesPanel.Controls.Clear();
- this.RefreshModels();
+ RemoveSelectedDrawOrderLayerItem(layer);
}
}
+ private void RemoveSelectedDrawOrderLayerItem(LayerItem layer)
+ {
+ _map.RemoveLayer(layer.Tag);
+ propertiesPanel.Controls.Clear();
+ this.RefreshModels();
+ }
+
private void btnDLMoveLayerUp_Click(object sender, EventArgs e)
{
var layer = GetSelectedDrawOrderItem() as LayerItem;
@@ -379,12 +443,17 @@
var group = GetSelectedTiledLayerItem() as BaseLayerGroupItem;
if (group != null)
{
- _map.BaseMap.RemoveBaseLayerGroup(group.Tag);
- propertiesPanel.Controls.Clear();
- _tiledLayerModel.Invalidate();
+ RemoveSelectedTiledLayerItem(group);
}
}
+ private void RemoveSelectedTiledLayerItem(BaseLayerGroupItem group)
+ {
+ _map.BaseMap.RemoveBaseLayerGroup(group.Tag);
+ propertiesPanel.Controls.Clear();
+ _tiledLayerModel.Invalidate();
+ }
+
private void btnAddBaseLayer_Click(object sender, EventArgs e)
{
using (var picker = new ResourcePicker(_edSvc.ResourceService, ResourceTypes.LayerDefinition, ResourcePickerMode.OpenResource))
@@ -478,13 +547,18 @@
var layer = GetSelectedTiledLayerItem() as BaseLayerItem;
if (layer != null)
{
- var grp = layer.Parent;
- grp.RemoveBaseMapLayer(layer.Tag);
- propertiesPanel.Controls.Clear();
- _tiledLayerModel.Invalidate();
+ RemoveSelectedTiledLayerItem(layer);
}
}
+ private void RemoveSelectedTiledLayerItem(BaseLayerItem layer)
+ {
+ var grp = layer.Parent;
+ grp.RemoveBaseMapLayer(layer.Tag);
+ propertiesPanel.Controls.Clear();
+ _tiledLayerModel.Invalidate();
+ }
+
private void btnMoveBaseLayerUp_Click(object sender, EventArgs e)
{
var layer = GetSelectedTiledLayerItem() as BaseLayerItem;
More information about the mapguide-commits
mailing list