[mapguide-commits] r5663 -
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Mar 28 06:56:53 EDT 2011
Author: jng
Date: 2011-03-28 03:56:52 -0700 (Mon, 28 Mar 2011)
New Revision: 5663
Modified:
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.resx
Log:
#1641: Add a tab close button
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.Designer.cs 2011-03-28 10:41:30 UTC (rev 5662)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.Designer.cs 2011-03-28 10:56:52 UTC (rev 5663)
@@ -39,6 +39,7 @@
this.btnSql = new System.Windows.Forms.ToolStripButton();
this.btnStandard = new System.Windows.Forms.ToolStripButton();
this.tabPreviews = new System.Windows.Forms.TabControl();
+ this.btnClose = new System.Windows.Forms.ToolStripButton();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
@@ -83,7 +84,8 @@
this.btnRefresh,
this.toolStripSeparator1,
this.btnSql,
- this.btnStandard});
+ this.btnStandard,
+ this.btnClose});
resources.ApplyResources(this.toolStrip1, "toolStrip1");
this.toolStrip1.Name = "toolStrip1";
//
@@ -121,6 +123,15 @@
this.tabPreviews.Name = "tabPreviews";
this.tabPreviews.SelectedIndex = 0;
//
+ // btnClose
+ //
+ this.btnClose.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.btnClose.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ resources.ApplyResources(this.btnClose, "btnClose");
+ this.btnClose.Image = global::Maestro.Editors.Properties.Resources.cross;
+ this.btnClose.Name = "btnClose";
+ this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
+ //
// LocalFeatureSourcePreviewCtrl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -148,5 +159,6 @@
private System.Windows.Forms.TreeView trvSchema;
private System.Windows.Forms.ImageList schemaImageList;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private System.Windows.Forms.ToolStripButton btnClose;
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs 2011-03-28 10:41:30 UTC (rev 5662)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs 2011-03-28 10:56:52 UTC (rev 5663)
@@ -184,6 +184,7 @@
pane.Dock = DockStyle.Fill;
page.Controls.Add(pane);
tabPreviews.TabPages.Add(page);
+ tabPreviews.SelectedIndex = tabPreviews.TabPages.IndexOf(page);
hasSql = true;
}
}
@@ -196,7 +197,10 @@
pane.Dock = DockStyle.Fill;
page.Controls.Add(pane);
tabPreviews.TabPages.Add(page);
+ tabPreviews.SelectedIndex = tabPreviews.TabPages.IndexOf(page);
}
+
+ btnClose.Enabled = (tabPreviews.TabPages.Count > 0);
}
ClassDefinition GetSelectedClass()
@@ -226,5 +230,45 @@
break;
}
}
+
+ private void btnClose_Click(object sender, EventArgs e)
+ {
+ if (tabPreviews.SelectedIndex >= 0)
+ {
+ //This is almost the same tab removal logic from TabFactory.cs in Maestro.Base
+ //done this way to remove any doubts about Mono
+
+ int idx = -1;
+ //HACK: Mono (2.4) will chuck a hissy fit if we remove
+ //a tab from a TabControl that has a selected tab so we
+ //have to null the selected tab, but this cause weird
+ //visual effects once the tab is removed, so we record
+ //the selected index, so we can assign the one beside it
+ //to be the selected tab after removal.
+ idx = tabPreviews.SelectedIndex;
+ var tab = tabPreviews.TabPages[idx];
+ tabPreviews.SelectedTab = null;
+ tabPreviews.TabPages.RemoveAt(idx);
+
+ if ((QueryMode)tab.Tag == QueryMode.SQL)
+ hasSql = false;
+
+ if (idx > 0)
+ {
+ idx--;
+ tabPreviews.SelectedIndex = idx;
+ }
+ else
+ {
+ //Set to first tab if available.
+ if (tabPreviews.TabCount > 0)
+ {
+ tabPreviews.SelectedIndex = 0;
+ }
+ }
+
+ btnClose.Enabled = (tabPreviews.TabPages.Count > 0);
+ }
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.resx 2011-03-28 10:41:30 UTC (rev 5662)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.resx 2011-03-28 10:56:52 UTC (rev 5663)
@@ -140,7 +140,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAw
- DQAAAk1TRnQBSQFMAgEBBgEAARwBAAEcAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+ DQAAAk1TRnQBSQFMAgEBBgEAASQBAAEkAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@@ -224,7 +224,7 @@
<value>0</value>
</data>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>17, 17</value>
+ <value>0, 0</value>
</metadata>
<data name="btnRefresh.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
@@ -262,6 +262,18 @@
<data name="btnStandard.Text" xml:space="preserve">
<value>Standard</value>
</data>
+ <data name="btnClose.Enabled" type="System.Boolean, mscorlib">
+ <value>False</value>
+ </data>
+ <data name="btnClose.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+ <value>Magenta</value>
+ </data>
+ <data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
+ <value>23, 22</value>
+ </data>
+ <data name="btnClose.Text" xml:space="preserve">
+ <value>toolStripButton1</value>
+ </data>
<data name="toolStrip1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
@@ -391,6 +403,12 @@
<data name=">>btnStandard.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
+ <data name=">>btnClose.Name" xml:space="preserve">
+ <value>btnClose</value>
+ </data>
+ <data name=">>btnClose.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
<data name=">>$this.Name" xml:space="preserve">
<value>LocalFeatureSourcePreviewCtrl</value>
</data>
More information about the mapguide-commits
mailing list