[mapguide-commits] r7032 - in trunk/Tools/Maestro: Maestro Maestro.Editors Maestro.Editors/Common Maestro.Editors/MapDefinition Maestro.Editors/MapDefinition/Live Maestro.MapViewer
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Sep 18 08:46:04 PDT 2012
Author: jng
Date: 2012-09-18 08:46:03 -0700 (Tue, 18 Sep 2012)
New Revision: 7032
Added:
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/Live/DragMessages.cs
Modified:
trunk/Tools/Maestro/Maestro.Editors/Common/RepositoryView.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Common/RepositoryView.cs
trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.resx
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorDrawOrder.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorDrawOrder.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorLegend.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorRepositoryView.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorRepositoryView.cs
trunk/Tools/Maestro/Maestro.MapViewer/Legend.Designer.cs
trunk/Tools/Maestro/Maestro.MapViewer/Legend.cs
trunk/Tools/Maestro/Maestro/changelog.txt
Log:
#2018: Support drag and drop of Layer Definitions from the Repository View into the Layers/Group view of the Live Map Definition editor. Such drops will result in the dropped layer being inserted to the map at the top of the draw order.
Modified: trunk/Tools/Maestro/Maestro/changelog.txt
===================================================================
--- trunk/Tools/Maestro/Maestro/changelog.txt 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro/changelog.txt 2012-09-18 15:46:03 UTC (rev 7032)
@@ -1,4 +1,5 @@
-- Streamlined localizable strings
+- New specialized error dialog for XML content errors, that shows the offending XML contnent.
+- Streamlined localizable strings
- Live Map Definition Editor improvements
- Add a repository browser view. Layers selected can be added to the current map
- Move to a 3 pane interface (ala. AJAX viewer)
@@ -13,6 +14,9 @@
- Missing label in new fusion templates
- Fusion editor improvements
- Can view widget info in the Generic Widget XML editor
+- Theme generation now considers active layer filter when generating rules
+- Fix: Dirty state not properly raised for certain Web Layout properties
+- Fix: Node color incorrectly set in Site Explorer for re-activated editors
- Fix: Updating a dynamic group name in a Map Definition did not update child groups
- Fix: Have RDBMS Feature Source editor fill a fake password when opening a RDBMS feature source with secured credentials to give appearance of a password filled in.
- Fix: Theming using first rule as template now preserves transparency
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/RepositoryView.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/RepositoryView.Designer.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/RepositoryView.Designer.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -39,6 +39,7 @@
resources.ApplyResources(this.trvRepository, "trvRepository");
this.trvRepository.ImageList = this.resImageList;
this.trvRepository.Name = "trvRepository";
+ this.trvRepository.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.trvRepository_ItemDrag);
//
// resImageList
//
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/RepositoryView.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/RepositoryView.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/RepositoryView.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -156,5 +156,14 @@
}
}
}
+
+ public event ItemDragEventHandler ItemDrag;
+
+ private void trvRepository_ItemDrag(object sender, ItemDragEventArgs e)
+ {
+ var h = this.ItemDrag;
+ if (h != null)
+ h(this, e);
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj 2012-09-18 15:46:03 UTC (rev 7032)
@@ -966,6 +966,7 @@
<Compile Include="MapDefinition\Live\NewGroupDialog.Designer.cs">
<DependentUpon>NewGroupDialog.cs</DependentUpon>
</Compile>
+ <Compile Include="MapDefinition\Live\DragMessages.cs" />
<Compile Include="MapDefinition\ManualScaleEditor.cs">
<SubType>Form</SubType>
</Compile>
Added: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/Live/DragMessages.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/Live/DragMessages.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/Live/DragMessages.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -0,0 +1,56 @@
+#region Disclaimer / License
+// Copyright (C) 2012, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Maestro.Editors.MapDefinition.Live
+{
+ public class ResourceDragMessage
+ {
+ public ResourceDragMessage(string resId) { this.ResourceID = resId; }
+
+ public string ResourceID { get; private set; }
+ }
+
+ public class LayerDragMessage
+ {
+ public LayerDragMessage(string groupName, string layerName)
+ {
+ this.GroupName = groupName;
+ this.LayerName = layerName;
+ }
+
+ public string GroupName { get; private set; }
+
+ public string LayerName { get; private set; }
+ }
+
+ public class GroupDragMessage
+ {
+ public GroupDragMessage(string groupName)
+ {
+ this.GroupName = groupName;
+ }
+
+ public string GroupName { get; private set; }
+ }
+}
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.Designer.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.Designer.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -37,6 +37,7 @@
this.viewer = new Maestro.MapViewer.MapViewer();
this.TAB_DRAW_ORDER = new System.Windows.Forms.TabPage();
this.drawOrderCtrl = new Maestro.Editors.MapDefinition.LiveMapEditorDrawOrder();
+ this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.tabRepo = new System.Windows.Forms.TabControl();
@@ -51,16 +52,18 @@
this.lblSelected = new System.Windows.Forms.ToolStripStatusLabel();
this.lblScale = new System.Windows.Forms.ToolStripStatusLabel();
this.mapStatusTracker = new Maestro.MapViewer.MapStatusTracker();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.tabLayersAndGroups.SuspendLayout();
this.TAB_LEGEND.SuspendLayout();
this.TAB_DRAW_ORDER.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
this.splitContainer3.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
@@ -103,11 +106,15 @@
//
// legendCtrl
//
+ this.legendCtrl.AllowDrop = true;
resources.ApplyResources(this.legendCtrl, "legendCtrl");
this.legendCtrl.Name = "legendCtrl";
this.legendCtrl.Viewer = this.viewer;
this.legendCtrl.NodeDeleted += new Maestro.MapViewer.NodeEventHandler(this.legendCtrl_NodeDeleted);
this.legendCtrl.NodeSelected += new Maestro.MapViewer.NodeEventHandler(this.legendCtrl_NodeSelected);
+ this.legendCtrl.DragDrop += new System.Windows.Forms.DragEventHandler(this.legendCtrl_DragDrop);
+ this.legendCtrl.DragEnter += new System.Windows.Forms.DragEventHandler(this.legendCtrl_DragEnter);
+ this.legendCtrl.DragOver += new System.Windows.Forms.DragEventHandler(this.legendCtrl_DragOver);
//
// viewer
//
@@ -119,6 +126,7 @@
this.viewer.Name = "viewer";
this.viewer.PointPixelBuffer = 2;
this.viewer.SelectionColor = System.Drawing.Color.Blue;
+ this.viewer.TooltipDelayInterval = 1000;
this.viewer.ZoomInFactor = 0.5D;
this.viewer.ZoomOutFactor = 2D;
//
@@ -131,12 +139,22 @@
//
// drawOrderCtrl
//
+ this.drawOrderCtrl.AllowDrop = true;
resources.ApplyResources(this.drawOrderCtrl, "drawOrderCtrl");
this.drawOrderCtrl.Name = "drawOrderCtrl";
this.drawOrderCtrl.Viewer = this.viewer;
this.drawOrderCtrl.LayerChanged += new Maestro.Editors.MapDefinition.LayerEventHandler(this.drawOrderCtrl_LayerChanged);
this.drawOrderCtrl.LayerDeleted += new Maestro.Editors.MapDefinition.LayerEventHandler(this.drawOrderCtrl_LayerDeleted);
//
+ // imageList1
+ //
+ this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
+ this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
+ this.imageList1.Images.SetKeyName(0, "layer.png");
+ this.imageList1.Images.SetKeyName(1, "layers-stack.png");
+ this.imageList1.Images.SetKeyName(2, "property.png");
+ this.imageList1.Images.SetKeyName(3, "folder-tree.png");
+ //
// splitContainer3
//
resources.ApplyResources(this.splitContainer3, "splitContainer3");
@@ -184,8 +202,10 @@
//
resources.ApplyResources(this.repoView, "repoView");
this.repoView.Name = "repoView";
+ this.repoView.ItemSelected += new System.EventHandler(this.repoView_ItemSelected);
this.repoView.RequestAddToMap += new System.EventHandler(this.repoView_RequestAddToMap);
this.repoView.RequestEdit += new System.EventHandler(this.repoView_RequestEdit);
+ this.repoView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.repoView_ItemDrag);
//
// tabProperties
//
@@ -245,15 +265,6 @@
this.mapStatusTracker.SelectedLabel = this.lblSelected;
this.mapStatusTracker.Viewer = this.viewer;
//
- // imageList1
- //
- this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- this.imageList1.Images.SetKeyName(0, "layer.png");
- this.imageList1.Images.SetKeyName(1, "layers-stack.png");
- this.imageList1.Images.SetKeyName(2, "property.png");
- this.imageList1.Images.SetKeyName(3, "folder-tree.png");
- //
// LiveMapDefinitionEditorCtrl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -264,15 +275,18 @@
resources.ApplyResources(this, "$this");
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.tabLayersAndGroups.ResumeLayout(false);
this.TAB_LEGEND.ResumeLayout(false);
this.TAB_DRAW_ORDER.ResumeLayout(false);
this.splitContainer3.Panel1.ResumeLayout(false);
this.splitContainer3.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
this.splitContainer3.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.tabRepo.ResumeLayout(false);
this.TAB_REPO.ResumeLayout(false);
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -32,6 +32,7 @@
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
using OSGeo.MapGuide.MaestroAPI.Resource;
using Maestro.MapViewer.Model;
+using Maestro.Editors.MapDefinition.Live;
namespace Maestro.Editors.MapDefinition
{
@@ -171,5 +172,32 @@
{
MessageBox.Show(Strings.FeatureNotImplemented);
}
+
+ private void repoView_ItemSelected(object sender, EventArgs e)
+ {
+ viewer.ActiveTool = MapViewer.MapActiveTool.None;
+ }
+
+ private void repoView_ItemDrag(object sender, ItemDragEventArgs e)
+ {
+ var item = repoView.SelectedItem;
+ if (item != null && !item.IsFolder)
+ repoView.DoDragDrop(new ResourceDragMessage(item.ResourceId), DragDropEffects.Copy);
+ }
+
+ private void legendCtrl_DragEnter(object sender, DragEventArgs e)
+ {
+ legendCtrl.HandleDragEnter(e);
+ }
+
+ private void legendCtrl_DragOver(object sender, DragEventArgs e)
+ {
+ legendCtrl.HandleDragOver(e);
+ }
+
+ private void legendCtrl_DragDrop(object sender, DragEventArgs e)
+ {
+ legendCtrl.HandleDragDrop(e);
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.resx 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapDefinitionEditorCtrl.resx 2012-09-18 15:46:03 UTC (rev 7032)
@@ -272,7 +272,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABw
- CwAAAk1TRnQBSQFMAgEBBAEAAQgBAAEIAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+ CwAAAk1TRnQBSQFMAgEBBAEAAVABAAFQAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@@ -309,7 +309,7 @@
AW8B8wgHAfQB8AQAAe8FAAEaAcMCoAHDARoDAAHxAfML8gHxAQAB8QHzAfAB8QYJAd0BuwHxAbsB8gLw
DPQB8AQAAfQFAAEbBBoBGwMAAfEB8wvyAfEBAAHyAfMB8AHxAfABGQHdAwkBGQG7AfEBCQHyAvAB/wFP
Af8BBwG8AfAB8QX/AfAEAAHvDgAB8QPzCfIB8QEAAfIB8wHwAfIBGQXxARkBuwHyAQkB8gHxAfAH/wGZ
- AUsBHAK8AfAEAAH0BQABmQV0AfQCAAHyBvMH8gEAAfIB8wHxAfIG8QHzAbsB8gEJAfIC8QL/Ae4BSwHu
+ AUsBHAK8AfAEAAH0BQABmQV0AfQCAAHyBvMH8gEAAfIB8wHxAfIG8QHzAbsB8gEJAfIC8QL/AbwBSwG8
Af8BmQFLAZkBSwEcAbwB8QQAAQcFAAGZA5oBdAHcAZkCAAHyAfQK8wH0AfIBAAHzAvIB8wEZBfMB8QEJ
AfMBCQHzAfEB8AIHAUsBmgFLAW4BSwGaAUsBmgJLAe0B/wMAAfQFAAGZA5oBeQH/AZkCAAHyAfQK8wH0
AfIBAAH/AfMCCQG7BgkB3QHzAQkB8wHyAfEB8AHxAZkBdAGaAUsBmgFLAZoBdAGaA3QB8QIAAQcB/wEH
@@ -725,6 +725,12 @@
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>800, 533</value>
</data>
+ <data name=">>imageList1.Name" xml:space="preserve">
+ <value>imageList1</value>
+ </data>
+ <data name=">>imageList1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
<data name=">>lblCoordinates.Name" xml:space="preserve">
<value>lblCoordinates</value>
</data>
@@ -749,12 +755,6 @@
<data name=">>mapStatusTracker.Type" xml:space="preserve">
<value>Maestro.MapViewer.MapStatusTracker, Maestro.MapViewer, Version=5.0.0.6640, Culture=neutral, PublicKeyToken=f526c48929fda856</value>
</data>
- <data name=">>imageList1.Name" xml:space="preserve">
- <value>imageList1</value>
- </data>
- <data name=">>imageList1.Type" xml:space="preserve">
- <value>System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </data>
<data name=">>$this.Name" xml:space="preserve">
<value>LiveMapDefinitionEditorCtrl</value>
</data>
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorDrawOrder.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorDrawOrder.Designer.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorDrawOrder.Designer.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -99,6 +99,9 @@
this.lstDrawOrder.Size = new System.Drawing.Size(241, 380);
this.lstDrawOrder.TabIndex = 1;
this.lstDrawOrder.SelectedIndexChanged += new System.EventHandler(this.lstDrawOrder_SelectedIndexChanged);
+ this.lstDrawOrder.DragDrop += new System.Windows.Forms.DragEventHandler(this.lstDrawOrder_DragDrop);
+ this.lstDrawOrder.DragEnter += new System.Windows.Forms.DragEventHandler(this.lstDrawOrder_DragEnter);
+ this.lstDrawOrder.DragOver += new System.Windows.Forms.DragEventHandler(this.lstDrawOrder_DragOver);
//
// LiveMapEditorDrawOrder
//
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorDrawOrder.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorDrawOrder.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorDrawOrder.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -190,6 +190,21 @@
this.Viewer.RefreshMap();
}
}
+
+ private void lstDrawOrder_DragOver(object sender, DragEventArgs e)
+ {
+
+ }
+
+ private void lstDrawOrder_DragEnter(object sender, DragEventArgs e)
+ {
+
+ }
+
+ private void lstDrawOrder_DragDrop(object sender, DragEventArgs e)
+ {
+
+ }
}
/// <summary>
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorLegend.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorLegend.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorLegend.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -30,6 +30,8 @@
using OSGeo.MapGuide.MaestroAPI.Resource;
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
using Maestro.MapViewer.Model;
+using System.Diagnostics;
+using Maestro.Editors.MapDefinition.Live;
namespace Maestro.Editors.MapDefinition
{
@@ -200,5 +202,135 @@
}
}
}
+
+ private void AddLayerDefinition(ResourceDragMessage message, GroupNodeMetadata groupMeta)
+ {
+ if (ResourceIdentifier.GetResourceType(message.ResourceID) == ResourceTypes.LayerDefinition)
+ {
+ var map = this.Viewer.GetMap();
+ var conn = map.CurrentConnection;
+ var mapSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
+ var ldf = (ILayerDefinition)conn.ResourceService.GetResource(message.ResourceID);
+ var rtLayer = mapSvc.CreateMapLayer(map, ldf);
+
+ if (groupMeta != null)
+ rtLayer.Group = groupMeta.Name;
+
+ map.Layers.Insert(0, rtLayer);
+ this.Viewer.RefreshMap();
+ }
+ }
+
+ public event ItemDragEventHandler ItemDrag;
+
+ internal void HandleDragDrop(DragEventArgs e)
+ {
+ var layer = e.Data.GetData(typeof(LayerDragMessage)) as LayerDragMessage;
+ var group = e.Data.GetData(typeof(GroupDragMessage)) as GroupDragMessage;
+ var res = e.Data.GetData(typeof(ResourceDragMessage)) as ResourceDragMessage;
+ var pt = legendCtrl.PointToClient(new Point(e.X, e.Y));
+ var node = legendCtrl.GetNodeAt(pt.X, pt.Y);
+ if (node != null)
+ {
+ var groupMeta = node.Tag as GroupNodeMetadata;
+ if (groupMeta != null)
+ {
+ if (layer != null)
+ {
+ if (groupMeta.Name != layer.GroupName)
+ {
+ MessageBox.Show("Handle layer drop into (" + groupMeta.Name + ")");
+ }
+ }
+ else if (group != null)
+ {
+ if (groupMeta.Name != group.GroupName)
+ {
+ MessageBox.Show("Handle group drop into (" + groupMeta.Name + ")");
+ }
+ }
+ else if (res != null)
+ {
+ if (groupMeta != null)
+ {
+ AddLayerDefinition(res, groupMeta);
+ }
+ }
+ }
+ }
+ else
+ {
+ if (layer != null)
+ {
+ MessageBox.Show("Handle layer drop into root");
+ }
+ else if (group != null)
+ {
+ MessageBox.Show("Handle group drop into root");
+ }
+ else if (res != null)
+ {
+ AddLayerDefinition(res, null);
+ }
+ }
+ }
+
+ internal void HandleDragOver(DragEventArgs e)
+ {
+ var layer = e.Data.GetData(typeof(LayerDragMessage)) as LayerDragMessage;
+ var group = e.Data.GetData(typeof(GroupDragMessage)) as GroupDragMessage;
+ var res = e.Data.GetData(typeof(ResourceDragMessage)) as ResourceDragMessage;
+ var pt = legendCtrl.PointToClient(new Point(e.X, e.Y));
+ var node = legendCtrl.GetNodeAt(pt.X, pt.Y);
+ if (node != null)
+ {
+ var groupMeta = node.Tag as GroupNodeMetadata;
+ if (groupMeta != null)
+ {
+ if (layer != null)
+ {
+ if (groupMeta.Name != layer.GroupName)
+ e.Effect = DragDropEffects.Copy;
+ else
+ e.Effect = DragDropEffects.None;
+ }
+ else if (group != null)
+ {
+ if (groupMeta.Name != group.GroupName)
+ e.Effect = DragDropEffects.Copy;
+ else
+ e.Effect = DragDropEffects.None;
+ }
+ else if (res != null)
+ {
+
+ if (groupMeta != null)
+ e.Effect = DragDropEffects.Copy;
+ else
+ e.Effect = DragDropEffects.None;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+ else
+ {
+ if (layer != null || group != null || res != null)
+ e.Effect = DragDropEffects.Copy;
+ else
+ e.Effect = DragDropEffects.None;
+ }
+ }
+
+ internal void HandleDragEnter(DragEventArgs e)
+ {
+ Trace.TraceInformation("HandleDragEnter(e)");
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorRepositoryView.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorRepositoryView.Designer.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorRepositoryView.Designer.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -82,6 +82,7 @@
resources.ApplyResources(this.repoView, "repoView");
this.repoView.Name = "repoView";
this.repoView.ItemSelected += new System.EventHandler(this.repoView_ItemSelected);
+ this.repoView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.repoView_ItemDrag);
//
// LiveMapEditorRepositoryView
//
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorRepositoryView.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorRepositoryView.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/LiveMapEditorRepositoryView.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -78,6 +78,11 @@
}
/// <summary>
+ /// Raised when an item is selected
+ /// </summary>
+ public event EventHandler ItemSelected;
+
+ /// <summary>
/// Raised when the currently selected item is requested to be added to the currently edited map
/// </summary>
public event EventHandler RequestAddToMap;
@@ -88,6 +93,11 @@
public event EventHandler RequestEdit;
/// <summary>
+ /// Raised when an item is dragged
+ /// </summary>
+ public event ItemDragEventHandler ItemDrag;
+
+ /// <summary>
/// Gets the selected item in the repository
/// </summary>
public IRepositoryItem SelectedItem
@@ -101,6 +111,9 @@
var condition = (item != null && !item.IsFolder && (item.ResourceType == ResourceTypes.LayerDefinition));
btnAddToMap.Enabled = btnEdit.Enabled = condition;
btnRefresh.Enabled = !condition;
+ var h = this.ItemSelected;
+ if (h != null)
+ h(this, EventArgs.Empty);
}
private void btnRefresh_Click(object sender, EventArgs e)
@@ -116,5 +129,12 @@
repoView.RefreshModel(parent);
}
}
+
+ private void repoView_ItemDrag(object sender, ItemDragEventArgs e)
+ {
+ var h = this.ItemDrag;
+ if (h != null)
+ h(this, e);
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro.MapViewer/Legend.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.MapViewer/Legend.Designer.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.MapViewer/Legend.Designer.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -52,6 +52,7 @@
this.trvLegend.AfterCollapse += new System.Windows.Forms.TreeViewEventHandler(this.trvLegend_AfterCollapse);
this.trvLegend.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.trvLegend_AfterExpand);
this.trvLegend.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.trvLegend_DrawNode);
+ this.trvLegend.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.trvLegend_ItemDrag);
this.trvLegend.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.trvLegend_AfterSelect);
this.trvLegend.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.trvLegend_NodeMouseClick);
this.trvLegend.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trvLegend_MouseDown);
Modified: trunk/Tools/Maestro/Maestro.MapViewer/Legend.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.MapViewer/Legend.cs 2012-09-18 15:10:52 UTC (rev 7031)
+++ trunk/Tools/Maestro/Maestro.MapViewer/Legend.cs 2012-09-18 15:46:03 UTC (rev 7032)
@@ -63,6 +63,8 @@
this.ShowAllLayersAndGroups = false;
}
+ public event ItemDragEventHandler ItemDrag;
+
/// <summary>
/// Gets whether to display all layers and groups regardless of display settings
/// and visibility
@@ -176,23 +178,7 @@
if (nodes != null)
{
//Attach relevant context menus based on attached metadata
- foreach (var n in nodes)
- {
- var lm = n.Tag as LegendNodeMetadata;
- if (lm != null)
- {
- if (lm.IsGroup)
- {
- n.ContextMenuStrip = this.GroupContextMenu;
- }
- else
- {
- var lyrm = n.Tag as LayerNodeMetadata;
- if (lyrm != null)
- n.ContextMenuStrip = this.LayerContextMenu;
- }
- }
- }
+ AttachContextMenus(nodes);
trvLegend.Nodes.AddRange(nodes);
}
trvLegend.EndUpdate();
@@ -201,6 +187,37 @@
_legendUpdateStopwatch.Reset();
}
+ private void AttachContextMenus(IEnumerable<TreeNode> nodes)
+ {
+ foreach (var n in nodes)
+ {
+ var lm = n.Tag as LegendNodeMetadata;
+ if (lm != null)
+ {
+ if (lm.IsGroup)
+ {
+ n.ContextMenuStrip = this.GroupContextMenu;
+ }
+ else
+ {
+ var lyrm = n.Tag as LayerNodeMetadata;
+ if (lyrm != null)
+ n.ContextMenuStrip = this.LayerContextMenu;
+ }
+ }
+ if (n.Nodes.Count > 0)
+ AttachContextMenus(AsEnumerable(n.Nodes));
+ }
+ }
+
+ static IEnumerable<TreeNode> AsEnumerable(TreeNodeCollection nodes)
+ {
+ for (int i = 0; i < nodes.Count; i++)
+ {
+ yield return nodes[i];
+ }
+ }
+
public TreeNode SelectedNode { get { return trvLegend.SelectedNode; } }
private static void ClearNodes(TreeNodeCollection nodes)
@@ -515,5 +532,17 @@
trvLegend.SelectedNode = trvLegend.GetNodeAt(e.X, e.Y);
}
}
+
+ public TreeNode GetNodeAt(int x, int y)
+ {
+ return trvLegend.GetNodeAt(x, y);
+ }
+
+ private void trvLegend_ItemDrag(object sender, ItemDragEventArgs e)
+ {
+ var h = this.ItemDrag;
+ if (h != null)
+ h(this, e);
+ }
}
}
More information about the mapguide-commits
mailing list