[mapguide-commits] r5468 - sandbox/maestro-3.0/Maestro.Editors/Fusion

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Dec 10 07:17:38 EST 2010


Author: jng
Date: 2010-12-10 04:17:38 -0800 (Fri, 10 Dec 2010)
New Revision: 5468

Modified:
   sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.cs
   sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.resx
Log:
#786: Drag/Drop map support for Fusion editor

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.Designer.cs	2010-12-10 12:02:13 UTC (rev 5467)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.Designer.cs	2010-12-10 12:17:38 UTC (rev 5468)
@@ -58,12 +58,16 @@
             // 
             // lstMaps
             // 
+            this.lstMaps.AllowDrop = true;
             resources.ApplyResources(this.lstMaps, "lstMaps");
             this.lstMaps.Name = "lstMaps";
             this.lstMaps.SmallImageList = this.mapImgList;
             this.lstMaps.UseCompatibleStateImageBehavior = false;
             this.lstMaps.View = System.Windows.Forms.View.List;
             this.lstMaps.SelectedIndexChanged += new System.EventHandler(this.lstMaps_SelectedIndexChanged);
+            this.lstMaps.DragDrop += new System.Windows.Forms.DragEventHandler(this.lstMaps_DragDrop);
+            this.lstMaps.DragEnter += new System.Windows.Forms.DragEventHandler(this.lstMaps_DragEnter);
+            this.lstMaps.DragOver += new System.Windows.Forms.DragEventHandler(this.lstMaps_DragOver);
             // 
             // mapImgList
             // 
@@ -100,10 +104,10 @@
             // 
             // MapSettingsCtrl
             // 
-            resources.ApplyResources(this, "$this");
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
             this.HeaderText = "Maps";
             this.Name = "MapSettingsCtrl";
+            resources.ApplyResources(this, "$this");
             this.contentPanel.ResumeLayout(false);
             this.groupBox1.ResumeLayout(false);
             this.groupBox1.PerformLayout();

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.cs	2010-12-10 12:02:13 UTC (rev 5467)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.cs	2010-12-10 12:17:38 UTC (rev 5468)
@@ -131,19 +131,63 @@
             {
                 if (picker.ShowDialog() == DialogResult.OK)
                 {
-                    string prefix = ResourceIdentifier.GetName(picker.ResourceID);
-                    int counter = 0;
-                    string name = prefix;
+                    string resId = picker.ResourceID;
+                    AddMapDefinition(resId, ResourceIdentifier.GetName(resId));
+                }
+            }
+        }
 
-                    while (_flexLayout.MapSet.GetGroupById(name) != null)
-                    {
-                        counter++;
-                        name = prefix + counter;
-                    }
+        private void AddMapDefinition(string resId, string prefix)
+        {
+            int counter = 0;
+            string name = prefix;
 
-                    var grp = _flexLayout.AddMapGroup(name, true, picker.ResourceID);
-                    OnResourceChanged();
-                    AddMap(grp);
+            while (_flexLayout.MapSet.GetGroupById(name) != null)
+            {
+                counter++;
+                name = prefix + counter;
+            }
+
+            var grp = _flexLayout.AddMapGroup(name, true, resId);
+            OnResourceChanged();
+            AddMap(grp);
+        }
+
+        private void lstMaps_DragEnter(object sender, DragEventArgs e)
+        {
+            var rids = e.Data.GetData(typeof(ResourceIdentifier[])) as ResourceIdentifier[];
+            if (rids == null || rids.Length == 0)
+            {
+                e.Effect = DragDropEffects.None;
+                return;
+            }
+            e.Effect = DragDropEffects.Copy;
+        }
+
+        private void lstMaps_DragOver(object sender, DragEventArgs e)
+        {
+            var rids = e.Data.GetData(typeof(ResourceIdentifier[])) as ResourceIdentifier[];
+            if (rids == null || rids.Length == 0)
+            {
+                e.Effect = DragDropEffects.None;
+                return;
+            }
+            e.Effect = DragDropEffects.Copy;
+        }
+
+        private void lstMaps_DragDrop(object sender, DragEventArgs e)
+        {
+            var rids = e.Data.GetData(typeof(ResourceIdentifier[])) as ResourceIdentifier[];
+            if (rids != null && rids.Length > 0)
+            {
+                //Only map definition resources apply
+
+                foreach (var r in rids)
+                {
+                    if (r.ResourceType != ResourceTypes.MapDefinition)
+                        continue;
+
+                    AddMapDefinition(r.ToString(), r.Name);
                 }
             }
         }

Modified: sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.resx	2010-12-10 12:02:13 UTC (rev 5467)
+++ sandbox/maestro-3.0/Maestro.Editors/Fusion/MapSettingsCtrl.resx	2010-12-10 12:17:38 UTC (rev 5468)
@@ -167,7 +167,7 @@
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABk
-        CAAAAk1TRnQBSQFMAwEBAAEYAQABGAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
+        CAAAAk1TRnQBSQFMAwEBAAEoAQABKAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
         AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
         AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
         AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm
@@ -310,9 +310,6 @@
   <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
-    <value>6, 13</value>
-  </data>
   <data name="$this.Size" type="System.Drawing.Size, System.Drawing">
     <value>638, 365</value>
   </data>



More information about the mapguide-commits mailing list