[mapguide-commits] r5001 - in sandbox/maestro-3.0: Generated Maestro.Base Maestro.Base/Editor Maestro.Base/Services Maestro.Base/UI Maestro.Editors/DrawingSource Maestro.Editors/MapDefinition OSGeo.MapGuide.MaestroAPI

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jul 7 05:30:03 EDT 2010


Author: jng
Date: 2010-07-07 09:30:03 +0000 (Wed, 07 Jul 2010)
New Revision: 5001

Added:
   sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.Designer.cs
   sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.cs
   sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.resx
   sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.resx
Modified:
   sandbox/maestro-3.0/Generated/MapDefinition-1.0.0.designer.cs
   sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.Designer.cs
   sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.cs
   sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj
   sandbox/maestro-3.0/Maestro.Base/Services/OpenResourceManager.cs
   sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.Designer.cs
   sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.cs
   sandbox/maestro-3.0/Maestro.Editors/DrawingSource/DrawingSourceEditorCtrl.cs
   sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapDefinitionEditorCtrl.cs
   sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
   sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs
Log:
This submission includes the following changes:
 - Add missing MapDefinition serializer to ResourceTypeRegistry
 - Add top-level DrawingSourceEditor control
 - Activate editors for MapDefinition and DrawingSource resource types
 - Implement data-binding for MapDefinition editor (map settings)
 - Tweak the visual layout of items in New Resource dialog
 - Remove generated INotifyPropertyChanged code from MapDefinition which was shadowing the identical code in its superclass.

Modified: sandbox/maestro-3.0/Generated/MapDefinition-1.0.0.designer.cs
===================================================================
--- sandbox/maestro-3.0/Generated/MapDefinition-1.0.0.designer.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Generated/MapDefinition-1.0.0.designer.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -35,7 +35,7 @@
                 return serializer;
             }
         }
-        
+        /*
         public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
         
         public virtual void OnPropertyChanged(string info) {
@@ -43,7 +43,7 @@
             if ((handler != null)) {
                 handler(this, new System.ComponentModel.PropertyChangedEventArgs(info));
             }
-        }
+        }*/
         
         #region Serialize/Deserialize
         /// <summary>

Added: sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.Designer.cs	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.Designer.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -0,0 +1,61 @@
+namespace Maestro.Base.Editor
+{
+    partial class DrawingSourceEditor
+    {
+        /// <summary> 
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Component Designer generated code
+
+        /// <summary> 
+        /// Required method for Designer support - do not modify 
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.dsEditorCtrl = new Maestro.Editors.DrawingSource.DrawingSourceEditorCtrl();
+            this.panelBody.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // panelBody
+            // 
+            this.panelBody.Controls.Add(this.dsEditorCtrl);
+            // 
+            // dsEditorCtrl
+            // 
+            this.dsEditorCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.dsEditorCtrl.Location = new System.Drawing.Point(0, 0);
+            this.dsEditorCtrl.Name = "dsEditorCtrl";
+            this.dsEditorCtrl.Size = new System.Drawing.Size(614, 520);
+            this.dsEditorCtrl.TabIndex = 0;
+            // 
+            // DrawingSourceEditor
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Name = "DrawingSourceEditor";
+            this.panelBody.ResumeLayout(false);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private Maestro.Editors.DrawingSource.DrawingSourceEditorCtrl dsEditorCtrl;
+    }
+}

Added: sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.cs	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -0,0 +1,68 @@
+#region Disclaimer / License
+// Copyright (C) 2010, 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.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using ICSharpCode.Core;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+using Maestro.Editors;
+
+namespace Maestro.Base.Editor
+{
+    public partial class DrawingSourceEditor : EditorContentBase
+    {
+        public DrawingSourceEditor()
+        {
+            InitializeComponent();
+        }
+
+        private IResource _res;
+        private IEditorService _edsvc;
+
+        protected override void Bind(IEditorService service)
+        {
+            _edsvc = service;
+            _res = _edsvc.GetEditedResource();
+            _edsvc.BeforeSave += new CancelEventHandler(OnBeforeSave);
+            dsEditorCtrl.Bind(service);
+        }
+
+        void OnBeforeSave(object sender, CancelEventArgs e)
+        {
+            //We've been editing an in-memory model of the session copy
+            //so we need to save this model back to the session copy before Save()
+            //commits the changes back to the original resource
+            try
+            {
+                _edsvc.UpdateResourceContent(_res.Serialize());
+                e.Cancel = false;
+            }
+            catch (Exception ex)
+            {
+                MessageService.ShowError(ex);
+                e.Cancel = true;
+            }
+        }
+    }
+}

Added: sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.resx	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/DrawingSourceEditor.resx	2010-07-07 09:30:03 UTC (rev 5001)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file

Modified: sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.Designer.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.Designer.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -28,10 +28,35 @@
         /// </summary>
         private void InitializeComponent()
         {
-            components = new System.ComponentModel.Container();
+            this.mapEditorCtrl = new Maestro.Editors.MapDefinition.MapDefinitionEditorCtrl();
+            this.panelBody.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // panelBody
+            // 
+            this.panelBody.Controls.Add(this.mapEditorCtrl);
+            // 
+            // mapEditorCtrl
+            // 
+            this.mapEditorCtrl.AutoScroll = true;
+            this.mapEditorCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.mapEditorCtrl.Location = new System.Drawing.Point(0, 0);
+            this.mapEditorCtrl.Name = "mapEditorCtrl";
+            this.mapEditorCtrl.Size = new System.Drawing.Size(614, 520);
+            this.mapEditorCtrl.TabIndex = 0;
+            // 
+            // MapDefinitionEditor
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Name = "MapDefinitionEditor";
+            this.panelBody.ResumeLayout(false);
+            this.ResumeLayout(false);
+
         }
 
         #endregion
+
+        private Maestro.Editors.MapDefinition.MapDefinitionEditorCtrl mapEditorCtrl;
     }
 }

Modified: sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -24,6 +24,9 @@
 using System.Data;
 using System.Text;
 using System.Windows.Forms;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+using Maestro.Editors;
+using ICSharpCode.Core;
 
 namespace Maestro.Base.Editor
 {
@@ -34,9 +37,32 @@
             InitializeComponent();
         }
 
-        protected override void Bind(Maestro.Editors.IEditorService service)
+        private IResource _res;
+        private IEditorService _edsvc;
+
+        protected override void Bind(IEditorService service)
         {
-            
+            _edsvc = service;
+            _res = _edsvc.GetEditedResource();
+            _edsvc.BeforeSave += new CancelEventHandler(OnBeforeSave);
+            mapEditorCtrl.Bind(service);
         }
+
+        void OnBeforeSave(object sender, CancelEventArgs e)
+        {
+            //We've been editing an in-memory model of the session copy
+            //so we need to save this model back to the session copy before Save()
+            //commits the changes back to the original resource
+            try
+            {
+                _edsvc.UpdateResourceContent(_res.Serialize());
+                e.Cancel = false;
+            }
+            catch (Exception ex)
+            {
+                MessageService.ShowError(ex);
+                e.Cancel = true;
+            }
+        }
     }
 }

Added: sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.resx	                        (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/MapDefinitionEditor.resx	2010-07-07 09:30:03 UTC (rev 5001)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file

Modified: sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj	2010-07-07 09:30:03 UTC (rev 5001)
@@ -3,7 +3,7 @@
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
+    <ProductVersion>9.0.30729</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{F1E2F468-5030-4DBA-968C-9620284AFAA1}</ProjectGuid>
     <OutputType>Library</OutputType>
@@ -72,6 +72,12 @@
     <Compile Include="Commands\Toggle\ToggleMessagesCommand.cs" />
     <Compile Include="Commands\ValidateResourceCommand.cs" />
     <Compile Include="Commands\XmlEditCommand.cs" />
+    <Compile Include="Editor\DrawingSourceEditor.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="Editor\DrawingSourceEditor.Designer.cs">
+      <DependentUpon>DrawingSourceEditor.cs</DependentUpon>
+    </Compile>
     <Compile Include="Editor\FeatureSourceEditor.cs">
       <SubType>UserControl</SubType>
     </Compile>
@@ -264,6 +270,9 @@
     <None Include="Resources\MapGuide Maestro.ico" />
   </ItemGroup>
   <ItemGroup>
+    <EmbeddedResource Include="Editor\DrawingSourceEditor.resx">
+      <DependentUpon>DrawingSourceEditor.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Editor\EditorContentBase.resx">
       <DependentUpon>EditorContentBase.cs</DependentUpon>
       <SubType>Designer</SubType>
@@ -280,6 +289,9 @@
       <DependentUpon>LoadProcedureEditor.cs</DependentUpon>
       <SubType>Designer</SubType>
     </EmbeddedResource>
+    <EmbeddedResource Include="Editor\MapDefinitionEditor.resx">
+      <DependentUpon>MapDefinitionEditor.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Editor\WebLayoutEditor.resx">
       <DependentUpon>WebLayoutEditor.cs</DependentUpon>
       <SubType>Designer</SubType>

Modified: sandbox/maestro-3.0/Maestro.Base/Services/OpenResourceManager.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Services/OpenResourceManager.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Base/Services/OpenResourceManager.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -106,6 +106,7 @@
                     case ResourceTypes.ApplicationDefinition:
                         break;
                     case ResourceTypes.DrawingSource:
+                        ed = svc.OpenContent<DrawingSourceEditor>(ViewRegion.Document);
                         break;
                     case ResourceTypes.FeatureSource:
                         ed = svc.OpenContent<FeatureSourceEditor>(ViewRegion.Document);
@@ -117,7 +118,7 @@
                         ed = svc.OpenContent<LoadProcedureEditor>(ViewRegion.Document);
                         break;
                     case ResourceTypes.MapDefinition:
-                        //ed = svc.OpenContent<MapDefinitionEditor>(ViewRegion.Document);
+                        ed = svc.OpenContent<MapDefinitionEditor>(ViewRegion.Document);
                         break;
                     case ResourceTypes.PrintLayout:
                         //ed = svc.OpenContent<PrintLayoutEditor>(ViewRegion.Document);

Modified: sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.Designer.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.Designer.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -52,7 +52,7 @@
             this.lstTemplates.Size = new System.Drawing.Size(433, 225);
             this.lstTemplates.TabIndex = 0;
             this.lstTemplates.UseCompatibleStateImageBehavior = false;
-            this.lstTemplates.View = System.Windows.Forms.View.SmallIcon;
+            this.lstTemplates.View = System.Windows.Forms.View.Tile;
             this.lstTemplates.SelectedIndexChanged += new System.EventHandler(this.lstTemplates_SelectedIndexChanged);
             // 
             // lstCategories

Modified: sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -41,10 +41,14 @@
         private IResourceService _resSvc;
         private NewItemTemplateService _nits;
 
-        public NewResourceDialog(IResourceService resSvc, NewItemTemplateService nits) : this()
+        public NewResourceDialog(IResourceService resSvc, NewItemTemplateService nits) : this(resSvc, nits, "Library://") { }
+
+        public NewResourceDialog(IResourceService resSvc, NewItemTemplateService nits, string startPoint) : this()
         {
             _resSvc = resSvc;
             _nits = nits;
+
+            txtParentFolder.Text = startPoint;
         }
 
         protected override void OnLoad(EventArgs e)
@@ -105,6 +109,7 @@
                 lstTemplates.Items.Add(li);
             }
             lstTemplates.SmallImageList = tplImgList;
+            lstTemplates.LargeImageList = tplImgList;
         }
 
         private void lstTemplates_SelectedIndexChanged(object sender, EventArgs e)

Modified: sandbox/maestro-3.0/Maestro.Editors/DrawingSource/DrawingSourceEditorCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/DrawingSource/DrawingSourceEditorCtrl.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Editors/DrawingSource/DrawingSourceEditorCtrl.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -27,7 +27,7 @@
 
 namespace Maestro.Editors.DrawingSource
 {
-    public partial class DrawingSourceEditorCtrl : UserControl
+    public partial class DrawingSourceEditorCtrl : EditorBase
     {
         public DrawingSourceEditorCtrl()
         {

Modified: sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapDefinitionEditorCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapDefinitionEditorCtrl.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapDefinitionEditorCtrl.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -27,11 +27,21 @@
 
 namespace Maestro.Editors.MapDefinition
 {
-    public partial class MapDefinitionEditorCtrl : UserControl
+    public partial class MapDefinitionEditorCtrl : EditorBase
     {
         public MapDefinitionEditorCtrl()
         {
             InitializeComponent();
         }
+
+        private OSGeo.MapGuide.ObjectModels.MapDefinition.MapDefinition _map;
+
+        public override void Bind(IEditorService service)
+        {
+            _map = service.GetEditedResource() as OSGeo.MapGuide.ObjectModels.MapDefinition.MapDefinition;
+
+            mapSettingsSectionCtrl1.Bind(service);
+            mapLayersSectionCtrl1.Bind(service);
+        }
     }
 }

Modified: sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -29,11 +29,23 @@
 namespace Maestro.Editors.MapDefinition
 {
     [ToolboxItem(true)]
-    internal partial class MapLayersSectionCtrl : CollapsiblePanel
+    internal partial class MapLayersSectionCtrl : CollapsiblePanel, IEditorBindable
     {
         public MapLayersSectionCtrl()
         {
             InitializeComponent();
         }
+
+        private OSGeo.MapGuide.ObjectModels.MapDefinition.MapDefinition _map;
+
+        public void Bind(IEditorService service)
+        {
+            service.RegisterCustomNotifier(this);
+            _map = (OSGeo.MapGuide.ObjectModels.MapDefinition.MapDefinition)service.GetEditedResource();
+
+            
+        }
+
+        public event EventHandler ResourceChanged;
     }
 }

Modified: sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.Designer.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.Designer.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -45,8 +45,8 @@
             this.label9 = new System.Windows.Forms.Label();
             this.txtDescription = new System.Windows.Forms.TextBox();
             this.txtCoordinateSystem = new System.Windows.Forms.TextBox();
+            this.btnPickCs = new System.Windows.Forms.Button();
             this.cmbBackgroundColor = new Maestro.Editors.Common.ColorComboBox();
-            this.btnPickCs = new System.Windows.Forms.Button();
             this.contentPanel.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.SuspendLayout();
@@ -226,14 +226,6 @@
             this.txtCoordinateSystem.Size = new System.Drawing.Size(371, 20);
             this.txtCoordinateSystem.TabIndex = 6;
             // 
-            // cmbBackgroundColor
-            // 
-            this.cmbBackgroundColor.FormattingEnabled = true;
-            this.cmbBackgroundColor.Location = new System.Drawing.Point(143, 58);
-            this.cmbBackgroundColor.Name = "cmbBackgroundColor";
-            this.cmbBackgroundColor.Size = new System.Drawing.Size(121, 21);
-            this.cmbBackgroundColor.TabIndex = 7;
-            // 
             // btnPickCs
             // 
             this.btnPickCs.Location = new System.Drawing.Point(520, 30);
@@ -242,7 +234,16 @@
             this.btnPickCs.TabIndex = 8;
             this.btnPickCs.Text = "...";
             this.btnPickCs.UseVisualStyleBackColor = true;
+            this.btnPickCs.Click += new System.EventHandler(this.btnPickCs_Click);
             // 
+            // cmbBackgroundColor
+            // 
+            this.cmbBackgroundColor.FormattingEnabled = true;
+            this.cmbBackgroundColor.Location = new System.Drawing.Point(143, 58);
+            this.cmbBackgroundColor.Name = "cmbBackgroundColor";
+            this.cmbBackgroundColor.Size = new System.Drawing.Size(121, 21);
+            this.cmbBackgroundColor.TabIndex = 7;
+            // 
             // MapSettingsSectionCtrl
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

Modified: sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -25,15 +25,78 @@
 using System.Text;
 using System.Windows.Forms;
 using Maestro.Shared.UI;
+using Maestro.Editors.Common;
 
 namespace Maestro.Editors.MapDefinition
 {
     [ToolboxItem(true)]
-    internal partial class MapSettingsSectionCtrl : CollapsiblePanel
+    internal partial class MapSettingsSectionCtrl : CollapsiblePanel, IEditorBindable
     {
         public MapSettingsSectionCtrl()
         {
             InitializeComponent();
         }
+
+        private OSGeo.MapGuide.ObjectModels.MapDefinition.MapDefinition _map;
+
+        const string META_START = "<MapDescription>";
+        const string META_END = "</MapDescription>";
+
+        private IEditorService _service;
+
+        public void Bind(IEditorService service)
+        {
+            _service = service;
+            _service.RegisterCustomNotifier(this);
+            _map = (OSGeo.MapGuide.ObjectModels.MapDefinition.MapDefinition)service.GetEditedResource();
+
+            var b = new Binding("Text", _map, "Metadata");
+            b.Parse += (sender, e) =>
+            {
+                e.Value = META_START + e.Value + META_END;
+            };
+            b.Format += (sender, e) =>
+            {
+                var str = e.Value.ToString();
+                if (str.StartsWith(META_START) && str.EndsWith(META_END))
+                {
+                    e.Value = str.Substring(META_START.Length, str.Length - (META_START.Length + META_END.Length));
+                }
+            };
+            txtDescription.DataBindings.Add(b);
+            txtCoordinateSystem.DataBindings.Add("Text", _map, "CoordinateSystem");
+
+            //TODO: Find proper binding target
+            cmbBackgroundColor.DataBindings.Add("Tag", _map, "BackgroundColor");
+
+            txtLowerX.DataBindings.Add("Text", _map.Extents, "MinX");
+            txtLowerY.DataBindings.Add("Text", _map.Extents, "MinY");
+            txtUpperX.DataBindings.Add("Text", _map.Extents, "MaxX");
+            txtUpperY.DataBindings.Add("Text", _map.Extents, "MaxY");
+
+            _map.Extents.PropertyChanged += (sender, e) => { OnResourceChanged(); };
+        }
+
+        private void OnResourceChanged()
+        {
+            var handler = this.ResourceChanged;
+            if (handler != null)
+                handler(this, EventArgs.Empty);
+        }
+
+        public event EventHandler ResourceChanged;
+
+        private void btnPickCs_Click(object sender, EventArgs e)
+        {
+            string cs = _service.GetCoordinateSystem();
+            if (!string.IsNullOrEmpty(cs))
+            {
+                txtCoordinateSystem.Text = cs;
+
+                //HACK: Force the binding to update
+                //http://stackoverflow.com/questions/1060080/databound-winforms-control-does-not-recognize-change-until-losing-focus
+                txtCoordinateSystem.DataBindings[0].WriteValue();
+            }
+        }
     }
 }

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs	2010-07-07 08:23:07 UTC (rev 5000)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs	2010-07-07 09:30:03 UTC (rev 5001)
@@ -35,6 +35,7 @@
 using System.Xml;
 using OSGeo.MapGuide.MaestroAPI.ObjectModels;
 using OSGeo.MapGuide.ObjectModels.FeatureSource;
+using OSGeo.MapGuide.ObjectModels.MapDefinition;
 
 namespace OSGeo.MapGuide.MaestroAPI
 {
@@ -101,6 +102,15 @@
                     Deserialize = (xml) => { return LoadProcedure.Deserialize(xml); }
                 });
 
+            //MapDefinition 1.0.0
+            _serializers.Add(
+                ResourceTypeDescriptor.MapDefinition,
+                new ResourceSerializer()
+                {
+                    Serialize = (res) => { return res.SerializeToStream(); },
+                    Deserialize = (xml) => { return MapDefinition.Deserialize(xml); }
+                });
+
             //PrintLayout 1.0.0
             _serializers.Add(
                 ResourceTypeDescriptor.PrintLayout,



More information about the mapguide-commits mailing list