[mapguide-commits] r5307 - in sandbox/maestro-3.0/Maestro.Base: Commands UI

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Oct 20 11:03:25 EDT 2010


Author: jng
Date: 2010-10-20 08:03:25 -0700 (Wed, 20 Oct 2010)
New Revision: 5307

Modified:
   sandbox/maestro-3.0/Maestro.Base/Commands/PasteCommand.cs
   sandbox/maestro-3.0/Maestro.Base/UI/SiteExplorer.Designer.cs
   sandbox/maestro-3.0/Maestro.Base/UI/SiteExplorer.cs
Log:
3.0 sandbox changes:
 - Implement common keyboard shortcuts for SiteExplorer, which basically invoke their corresponding menu commands.
 - Fix paste command to copy with references updated if the pasted item is a folder

Modified: sandbox/maestro-3.0/Maestro.Base/Commands/PasteCommand.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/PasteCommand.cs	2010-10-20 14:50:30 UTC (rev 5306)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/PasteCommand.cs	2010-10-20 15:03:25 UTC (rev 5307)
@@ -86,7 +86,10 @@
 
                 if (item.ClipboardState == RepositoryItem.ClipboardAction.Copy)
                 {
-                    conn.ResourceService.CopyResource(item.ResourceId, resId, false);
+                    if (item.IsFolder)
+                        conn.ResourceService.CopyFolderWithReferences(item.ResourceId, resId, null, null);
+                    else
+                        conn.ResourceService.CopyResource(item.ResourceId, resId, false);
                 }
                 else if (item.ClipboardState == RepositoryItem.ClipboardAction.Cut)
                 {

Modified: sandbox/maestro-3.0/Maestro.Base/UI/SiteExplorer.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/UI/SiteExplorer.Designer.cs	2010-10-20 14:50:30 UTC (rev 5306)
+++ sandbox/maestro-3.0/Maestro.Base/UI/SiteExplorer.Designer.cs	2010-10-20 15:03:25 UTC (rev 5307)
@@ -69,6 +69,7 @@
             this.trvResources.DragDrop += new System.Windows.Forms.DragEventHandler(this.trvResources_DragDrop);
             this.trvResources.Expanding += new System.EventHandler<Aga.Controls.Tree.TreeViewAdvEventArgs>(this.trvResources_Expanding);
             this.trvResources.DragEnter += new System.Windows.Forms.DragEventHandler(this.trvResources_DragEnter);
+            this.trvResources.KeyUp += new System.Windows.Forms.KeyEventHandler(this.trvResources_KeyUp);
             this.trvResources.Expanded += new System.EventHandler<Aga.Controls.Tree.TreeViewAdvEventArgs>(this.trvResources_Expanded);
             this.trvResources.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.trvResources_ItemDrag);
             // 

Modified: sandbox/maestro-3.0/Maestro.Base/UI/SiteExplorer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/UI/SiteExplorer.cs	2010-10-20 14:50:30 UTC (rev 5306)
+++ sandbox/maestro-3.0/Maestro.Base/UI/SiteExplorer.cs	2010-10-20 15:03:25 UTC (rev 5307)
@@ -32,6 +32,8 @@
 using ICSharpCode.Core;
 using Maestro.Base.UI.Preferences;
 using Maestro.Shared.UI;
+using Maestro.Base.Commands.SiteExplorer;
+using Maestro.Base.Commands;
 
 namespace Maestro.Base.UI
 {
@@ -461,5 +463,25 @@
             var affectedFolders = (IEnumerable<string>)dlg.RunOperationAsync(wb, worker, folderId, resIds);
             return new List<string>(affectedFolders).ToArray();
         }
+
+        private void trvResources_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Control && e.KeyCode == Keys.C) //Copy
+            {
+                new CopyCommand().Run();
+            }
+            else if (e.Control && e.KeyCode == Keys.X) //Cut
+            {
+                new CutCommand().Run();
+            }
+            else if (e.Control && e.KeyCode == Keys.V) //Paste
+            {
+                new PasteCommand().Run();
+            }
+            else if (e.KeyCode == Keys.Delete)
+            {
+                new DeleteSelectedItemsCommand().Run();
+            }
+        }
     }
 }



More information about the mapguide-commits mailing list