[mapguide-commits] r6518 - in trunk/MgDev/Desktop: MapViewer
MapViewerTest
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Feb 17 05:25:25 EST 2012
Author: jng
Date: 2012-02-17 02:25:25 -0800 (Fri, 17 Feb 2012)
New Revision: 6518
Modified:
trunk/MgDev/Desktop/MapViewer/MgMapViewer.cs
trunk/MgDev/Desktop/MapViewerTest/Form1.Designer.cs
trunk/MgDev/Desktop/MapViewerTest/Form1.cs
trunk/MgDev/Desktop/MapViewerTest/Form1.resx
Log:
mg-desktop: Allow the MgMapViewer control to support a ContextMenuStrip attached to it. To do this, we do nothing on the MouseClick event handler if it is the right mouse button, allowing the event to properly propagate to the context menu.
Modified: trunk/MgDev/Desktop/MapViewer/MgMapViewer.cs
===================================================================
--- trunk/MgDev/Desktop/MapViewer/MgMapViewer.cs 2012-02-16 16:44:13 UTC (rev 6517)
+++ trunk/MgDev/Desktop/MapViewer/MgMapViewer.cs 2012-02-17 10:25:25 UTC (rev 6518)
@@ -2000,6 +2000,9 @@
private void HandleMouseClick(MouseEventArgs e)
{
+ if (e.Button == MouseButtons.Right)
+ return;
+
if (this.DigitizingType != MapDigitizationType.None)
{
//Points are easy, one click and you're done
Modified: trunk/MgDev/Desktop/MapViewerTest/Form1.Designer.cs
===================================================================
--- trunk/MgDev/Desktop/MapViewerTest/Form1.Designer.cs 2012-02-16 16:44:13 UTC (rev 6517)
+++ trunk/MgDev/Desktop/MapViewerTest/Form1.Designer.cs 2012-02-17 10:25:25 UTC (rev 6518)
@@ -65,6 +65,9 @@
this.viewer = new OSGeo.MapGuide.Viewer.MgMapViewer();
this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
this.toolbar = new OSGeo.MapGuide.Viewer.MgDefaultToolbar();
+ this.ctxViewer = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.refreshMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.initialViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
@@ -79,6 +82,7 @@
this.toolStripContainer1.ContentPanel.SuspendLayout();
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
this.toolStripContainer1.SuspendLayout();
+ this.ctxViewer.SuspendLayout();
this.SuspendLayout();
//
// statusStrip1
@@ -386,6 +390,7 @@
//
// viewer
//
+ this.viewer.ContextMenuStrip = this.ctxViewer;
this.viewer.ConvertTiledGroupsToNonTiled = true;
this.viewer.Cursor = System.Windows.Forms.Cursors.Default;
this.viewer.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -429,6 +434,28 @@
this.toolbar.Viewer = null;
this.toolbar.ZoomOutMode = OSGeo.MapGuide.Viewer.ZoomOutMode.AutoZoom;
//
+ // ctxViewer
+ //
+ this.ctxViewer.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.refreshMapToolStripMenuItem,
+ this.initialViewToolStripMenuItem});
+ this.ctxViewer.Name = "ctxViewer";
+ this.ctxViewer.Size = new System.Drawing.Size(153, 70);
+ //
+ // refreshMapToolStripMenuItem
+ //
+ this.refreshMapToolStripMenuItem.Name = "refreshMapToolStripMenuItem";
+ this.refreshMapToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.refreshMapToolStripMenuItem.Text = "Refresh Map";
+ this.refreshMapToolStripMenuItem.Click += new System.EventHandler(this.refreshMapToolStripMenuItem_Click);
+ //
+ // initialViewToolStripMenuItem
+ //
+ this.initialViewToolStripMenuItem.Name = "initialViewToolStripMenuItem";
+ this.initialViewToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.initialViewToolStripMenuItem.Text = "Initial View";
+ this.initialViewToolStripMenuItem.Click += new System.EventHandler(this.initialViewToolStripMenuItem_Click);
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -459,6 +486,7 @@
this.toolStripContainer1.TopToolStripPanel.PerformLayout();
this.toolStripContainer1.ResumeLayout(false);
this.toolStripContainer1.PerformLayout();
+ this.ctxViewer.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -502,6 +530,9 @@
private System.Windows.Forms.ToolStripMenuItem showConnectionPoolStatusToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem purgePooledConnectionsToolStripMenuItem;
private OSGeo.MapGuide.Viewer.MgLegend legend;
+ private System.Windows.Forms.ContextMenuStrip ctxViewer;
+ private System.Windows.Forms.ToolStripMenuItem refreshMapToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem initialViewToolStripMenuItem;
}
}
Modified: trunk/MgDev/Desktop/MapViewerTest/Form1.cs
===================================================================
--- trunk/MgDev/Desktop/MapViewerTest/Form1.cs 2012-02-16 16:44:13 UTC (rev 6517)
+++ trunk/MgDev/Desktop/MapViewerTest/Form1.cs 2012-02-17 10:25:25 UTC (rev 6518)
@@ -433,5 +433,15 @@
}
}
}
+
+ private void refreshMapToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ viewer.RefreshMap();
+ }
+
+ private void initialViewToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ viewer.InitialMapView();
+ }
}
}
Modified: trunk/MgDev/Desktop/MapViewerTest/Form1.resx
===================================================================
--- trunk/MgDev/Desktop/MapViewerTest/Form1.resx 2012-02-16 16:44:13 UTC (rev 6517)
+++ trunk/MgDev/Desktop/MapViewerTest/Form1.resx 2012-02-17 10:25:25 UTC (rev 6518)
@@ -132,6 +132,9 @@
<metadata name="ctxLayer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>545, 17</value>
</metadata>
+ <metadata name="ctxViewer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>641, 17</value>
+ </metadata>
<metadata name="toolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>353, 17</value>
</metadata>
More information about the mapguide-commits
mailing list