[mapguide-commits] r7211 - in trunk/Tools/Maestro/Maestro.Editors: . Common FeatureSource/Preview
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Nov 19 03:31:06 PST 2012
Author: jng
Date: 2012-11-19 03:31:06 -0800 (Mon, 19 Nov 2012)
New Revision: 7211
Added:
trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs
trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs
trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.resx
Modified:
trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
trunk/Tools/Maestro/Maestro.Editors/ResourceEditorServiceBase.cs
trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Strings.resx
Log:
Re-integrate the old expression editor as the mono-compatible implementation. This way both Windows and Mono have an Expression Editor with some working level of auto-complete. Extract a common interface out of the two and delegate instantiation to a new FdoExpressionEditorFactory utility class that will return the correct compatible implementation based on whether the application is running in Mono or not.
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs 2012-11-19 11:03:11 UTC (rev 7210)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs 2012-11-19 11:31:06 UTC (rev 7211)
@@ -38,7 +38,7 @@
/// <summary>
/// An expression editor dialog
/// </summary>
- public partial class ExpressionEditor : Form
+ public partial class ExpressionEditor : Form, IExpressionEditor
{
private ClassDefinition _cls;
private IFeatureService _featSvc;
@@ -49,7 +49,7 @@
/// <summary>
/// Initializes a new instance of the <see cref="ExpressionEditor"/> class.
/// </summary>
- public ExpressionEditor()
+ internal ExpressionEditor()
{
InitializeComponent();
ExpressionText.SetHighlighting("FDO");
Added: trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs 2012-11-19 11:31:06 UTC (rev 7211)
@@ -0,0 +1,64 @@
+#region Disclaimer / License
+// Copyright (C) 2012, 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 OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Schema;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using OSGeo.MapGuide.ObjectModels.Capabilities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Maestro.Editors.Common
+{
+ /// <summary>
+ /// The expression editor interface
+ /// </summary>
+ public interface IExpressionEditor
+ {
+ /// <summary>
+ /// Initializes the expression editor
+ /// </summary>
+ /// <param name="featSvc"></param>
+ /// <param name="caps"></param>
+ /// <param name="cls"></param>
+ /// <param name="featuresSourceId"></param>
+ /// <param name="attachStylizationFunctions"></param>
+ void Initialize(IFeatureService featSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions);
+
+ /// <summary>
+ /// Gets or sets the FDO expression
+ /// </summary>
+ string Expression { get; set; }
+
+ System.Windows.Forms.DialogResult ShowDialog();
+ }
+
+ public static class FdoExpressionEditorFactory
+ {
+ public static IExpressionEditor Create()
+ {
+ if (Platform.IsRunningOnMono)
+ return new MonoCompatibleExpressionEditor();
+ else
+ return new ExpressionEditor();
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.Designer.cs 2012-11-19 11:31:06 UTC (rev 7211)
@@ -0,0 +1,213 @@
+namespace Maestro.Editors.Common
+{
+ partial class MonoCompatibleExpressionEditor
+ {
+ /// <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 Windows Form 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.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MonoCompatibleExpressionEditor));
+ this.OKBtn = new System.Windows.Forms.Button();
+ this.CancelBtn = new System.Windows.Forms.Button();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.lblHint = new System.Windows.Forms.Label();
+ this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+ this.btnProperties = new System.Windows.Forms.ToolStripDropDownButton();
+ this.btnFunctions = new System.Windows.Forms.ToolStripDropDownButton();
+ this.btnFilter = new System.Windows.Forms.ToolStripDropDownButton();
+ this.btnCondition = new System.Windows.Forms.ToolStripMenuItem();
+ this.btnSpatial = new System.Windows.Forms.ToolStripMenuItem();
+ this.btnDistance = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.ColumnValue = new System.Windows.Forms.ToolStripComboBox();
+ this.LookupValues = new System.Windows.Forms.ToolStripButton();
+ this.ColumnName = new System.Windows.Forms.ToolStripComboBox();
+ this.ExpressionText = new System.Windows.Forms.TextBox();
+ this._autoCompleteTooltip = new System.Windows.Forms.ToolTip(this.components);
+ this.panel1.SuspendLayout();
+ this.toolStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // OKBtn
+ //
+ resources.ApplyResources(this.OKBtn, "OKBtn");
+ this.OKBtn.Name = "OKBtn";
+ this.OKBtn.UseVisualStyleBackColor = true;
+ this.OKBtn.Click += new System.EventHandler(this.OKBtn_Click);
+ //
+ // CancelBtn
+ //
+ resources.ApplyResources(this.CancelBtn, "CancelBtn");
+ this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.CancelBtn.Name = "CancelBtn";
+ this.CancelBtn.UseVisualStyleBackColor = true;
+ //
+ // panel1
+ //
+ this.panel1.Controls.Add(this.lblHint);
+ this.panel1.Controls.Add(this.CancelBtn);
+ this.panel1.Controls.Add(this.OKBtn);
+ resources.ApplyResources(this.panel1, "panel1");
+ this.panel1.Name = "panel1";
+ //
+ // lblHint
+ //
+ resources.ApplyResources(this.lblHint, "lblHint");
+ this.lblHint.Name = "lblHint";
+ //
+ // toolStrip1
+ //
+ this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
+ this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.btnProperties,
+ this.btnFunctions,
+ this.btnFilter,
+ this.toolStripSeparator1,
+ this.ColumnValue,
+ this.LookupValues,
+ this.ColumnName});
+ resources.ApplyResources(this.toolStrip1, "toolStrip1");
+ this.toolStrip1.Name = "toolStrip1";
+ //
+ // btnProperties
+ //
+ this.btnProperties.Image = global::Maestro.Editors.Properties.Resources.property;
+ resources.ApplyResources(this.btnProperties, "btnProperties");
+ this.btnProperties.Name = "btnProperties";
+ //
+ // btnFunctions
+ //
+ this.btnFunctions.Image = global::Maestro.Editors.Properties.Resources.function;
+ resources.ApplyResources(this.btnFunctions, "btnFunctions");
+ this.btnFunctions.Name = "btnFunctions";
+ //
+ // btnFilter
+ //
+ this.btnFilter.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.btnCondition,
+ this.btnSpatial,
+ this.btnDistance});
+ this.btnFilter.Image = global::Maestro.Editors.Properties.Resources.funnel;
+ resources.ApplyResources(this.btnFilter, "btnFilter");
+ this.btnFilter.Name = "btnFilter";
+ //
+ // btnCondition
+ //
+ this.btnCondition.Name = "btnCondition";
+ resources.ApplyResources(this.btnCondition, "btnCondition");
+ //
+ // btnSpatial
+ //
+ this.btnSpatial.Image = global::Maestro.Editors.Properties.Resources.grid;
+ this.btnSpatial.Name = "btnSpatial";
+ resources.ApplyResources(this.btnSpatial, "btnSpatial");
+ //
+ // btnDistance
+ //
+ this.btnDistance.Image = global::Maestro.Editors.Properties.Resources.ruler;
+ this.btnDistance.Name = "btnDistance";
+ resources.ApplyResources(this.btnDistance, "btnDistance");
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1");
+ //
+ // ColumnValue
+ //
+ this.ColumnValue.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.ColumnValue.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.ColumnValue.DropDownWidth = 180;
+ resources.ApplyResources(this.ColumnValue, "ColumnValue");
+ this.ColumnValue.Name = "ColumnValue";
+ this.ColumnValue.SelectedIndexChanged += new System.EventHandler(this.ColumnValue_SelectedIndexChanged);
+ //
+ // LookupValues
+ //
+ this.LookupValues.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.LookupValues.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ resources.ApplyResources(this.LookupValues, "LookupValues");
+ this.LookupValues.Image = global::Maestro.Editors.Properties.Resources.table__arrow;
+ this.LookupValues.Name = "LookupValues";
+ this.LookupValues.Click += new System.EventHandler(this.LookupValues_Click);
+ //
+ // ColumnName
+ //
+ this.ColumnName.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.ColumnName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.ColumnName.DropDownWidth = 180;
+ this.ColumnName.Name = "ColumnName";
+ resources.ApplyResources(this.ColumnName, "ColumnName");
+ this.ColumnName.SelectedIndexChanged += new System.EventHandler(this.ColumnName_SelectedIndexChanged);
+ this.ColumnName.Click += new System.EventHandler(this.ColumnName_Click);
+ //
+ // ExpressionText
+ //
+ resources.ApplyResources(this.ExpressionText, "ExpressionText");
+ this.ExpressionText.HideSelection = false;
+ this.ExpressionText.Name = "ExpressionText";
+ this.ExpressionText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ExpressionText_KeyDown);
+ this.ExpressionText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ExpressionText_KeyUp);
+ //
+ // MonoCompatibleExpressionEditor
+ //
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ resources.ApplyResources(this, "$this");
+ this.ControlBox = false;
+ this.Controls.Add(this.ExpressionText);
+ this.Controls.Add(this.toolStrip1);
+ this.Controls.Add(this.panel1);
+ this.Name = "MonoCompatibleExpressionEditor";
+ this.panel1.ResumeLayout(false);
+ this.panel1.PerformLayout();
+ this.toolStrip1.ResumeLayout(false);
+ this.toolStrip1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button OKBtn;
+ private System.Windows.Forms.Button CancelBtn;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.ToolStrip toolStrip1;
+ private System.Windows.Forms.TextBox ExpressionText;
+ private System.Windows.Forms.ToolStripDropDownButton btnFilter;
+ private System.Windows.Forms.ToolStripMenuItem btnCondition;
+ private System.Windows.Forms.ToolStripMenuItem btnSpatial;
+ private System.Windows.Forms.ToolStripMenuItem btnDistance;
+ private System.Windows.Forms.ToolTip _autoCompleteTooltip;
+ private System.Windows.Forms.Label lblHint;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private System.Windows.Forms.ToolStripComboBox ColumnName;
+ private System.Windows.Forms.ToolStripButton LookupValues;
+ private System.Windows.Forms.ToolStripComboBox ColumnValue;
+ private System.Windows.Forms.ToolStripDropDownButton btnProperties;
+ private System.Windows.Forms.ToolStripDropDownButton btnFunctions;
+ }
+}
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs 2012-11-19 11:31:06 UTC (rev 7211)
@@ -0,0 +1,1213 @@
+#region Disclaimer / License
+// Copyright (C) 2009, Kenneth Skovhede
+// http://www.hexad.dk, opensource at hexad.dk
+//
+// 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.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using OSGeo.MapGuide.ObjectModels.Capabilities;
+using OSGeo.MapGuide.MaestroAPI.Exceptions;
+using Maestro.Shared.UI;
+using OSGeo.MapGuide.MaestroAPI.Schema;
+
+namespace Maestro.Editors.Common
+{
+ /*
+ * Intellisense overview:
+ *
+ * The intellisense of this expression editor consists of the following parts:
+ * - An ImageListBox which is filled with auto-complete suggestions
+ * - A System.Windows.Forms.ToolTip which is shown when an auto-complete choice is highlighted (but not selected)
+ *
+ * In order to invoke intellisense, we listen for the KeyUp and KeyDown events
+ * on the textbox to determine what actions to take. Some actions include:
+ *
+ * Key Up:
+ * - Comma: Show auto-complete with all suggestions
+ * - Quotes (Single or Double): Insert an extra quote of that type
+ * - Up/Down: Move the auto-complete selection up/down one item if the auto-complete box is visible.
+ * - Backspace: Invoke auto-complete with suggestions if there is a context buffer, otherwise hide auto-complete.
+ * - Alt + Right: Invoke auto-complete with all suggestions
+ * - Alphanumeric (no modifiers): Invoke auto-complete with suggestions
+ *
+ * Key Down:
+ * - Escape: Hide auto-complete
+ * - Enter: Hide auto-complete
+ *
+ * As part of the loading process, a full list of auto-complete items (functions/properties) is constructed (sorted by name)
+ * Everytime intellisense is invoked, this list is queried for possible suggestions.
+ *
+ * In order to determine what items to suggest, the editor builds a context buffer from the current position of the caret
+ * in the textbox. The context buffer algorithm is as follows:
+ *
+ * 1 - Start from caret position
+ * 2 - Can we move back one char?
+ * 2.1 - Get this char.
+ * 2.2 - If alpha numeric, goto 2.
+ * 3 - Get the string that represents the uninterrupted alphanumeric string sequence that ends at the caret position
+ * 4 - Get the list of completable items that starts with this alphanumeric string
+ * 5 - Add these items to the auto-complete box.
+ * 6 - Show the auto-complete box
+ */
+
+ /// <summary>
+ /// An expression editor dialog
+ /// </summary>
+ public partial class MonoCompatibleExpressionEditor : Form, IExpressionEditor
+ {
+ private ClassDefinition _cls;
+
+ private IFeatureService _featSvc;
+ private string m_featureSource = null;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExpressionEditor"/> class.
+ /// </summary>
+ internal MonoCompatibleExpressionEditor()
+ {
+ InitializeComponent();
+ InitAutoComplete();
+ }
+
+ /// <summary>
+ /// Gets or sets the expression.
+ /// </summary>
+ /// <value>The expression.</value>
+ public string Expression
+ {
+ get { return ExpressionText.Text; }
+ set { ExpressionText.Text = value; }
+ }
+
+ /// <summary>
+ /// Initializes the dialog.
+ /// </summary>
+ /// <param name="featSvc">The feature service.</param>
+ /// <param name="caps">The provider capabilities.</param>
+ /// <param name="cls">The class definition.</param>
+ /// <param name="featuresSourceId">The features source id.</param>
+ /// <param name="attachStylizationFunctions">If true, Stylization FDO functions will be included</param>
+ public void Initialize(IFeatureService featSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
+ {
+ try
+ {
+ _cls = cls;
+ _featSvc = featSvc;
+ m_featureSource = featuresSourceId;
+
+ //TODO: Perhaps add column type and indication of primary key
+ SortedList<string, PropertyDefinition> sortedCols = new SortedList<string, PropertyDefinition>();
+ foreach (var col in _cls.Properties)
+ {
+ sortedCols.Add(col.Name, col);
+ }
+
+ ColumnName.Items.Clear();
+ ColumnName.Tag = sortedCols;
+
+ foreach (var col in sortedCols.Values)
+ {
+ string name = col.Name;
+ ToolStripButton btn = new ToolStripButton();
+ btn.Name = name;
+ btn.Text = name;
+ btn.Click += delegate
+ {
+ InsertText(name);
+ };
+ btnProperties.DropDown.Items.Add(btn);
+
+ ColumnName.Items.Add(name);
+ }
+
+ if (ColumnName.Items.Count > 0)
+ ColumnName.SelectedIndex = 0;
+
+ LoadCompletableProperties(_cls.Properties);
+
+ //TODO: Figure out how to translate the enums into something usefull
+
+ //Functions
+ SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition> sortedFuncs = new SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition>();
+ foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in caps.Expression.FunctionDefinitionList)
+ {
+ sortedFuncs.Add(func.Name, func);
+ }
+
+ if (attachStylizationFunctions)
+ {
+ foreach (var func in GetStylizationFunctions())
+ {
+ sortedFuncs.Add(func.Name, func);
+ }
+ }
+
+ foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in sortedFuncs.Values)
+ {
+ string name = func.Name;
+ ToolStripButton btn = new ToolStripButton();
+ btn.Name = name;
+ btn.Text = name;
+ btn.ToolTipText = func.Description;
+ string fmt = "{0}({1})";
+ List<string> args = new List<string>();
+ foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in func.ArgumentDefinitionList)
+ {
+ args.Add(argDef.Name.Trim());
+ }
+ string expr = string.Format(fmt, name, string.Join(", ", args.ToArray()));
+ btn.Click += delegate
+ {
+ InsertText(expr);
+ };
+ btnFunctions.DropDown.Items.Add(btn);
+ }
+ LoadCompletableFunctions(caps.Expression.FunctionDefinitionList);
+ if (attachStylizationFunctions)
+ LoadCompletableFunctions(GetStylizationFunctions());
+
+ //Spatial Operators
+ foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Spatial)
+ {
+ string name = op.ToString().ToUpper();
+ ToolStripButton btn = new ToolStripButton();
+ btn.Name = btn.Text = btn.ToolTipText = op.ToString();
+ btn.Click += delegate
+ {
+ InsertFilter(name);
+ };
+ btnSpatial.DropDown.Items.Add(btn);
+ }
+
+ //Distance Operators
+ foreach (FdoProviderCapabilitiesFilterOperation1 op in caps.Filter.Distance)
+ {
+ string name = op.ToString().ToUpper();
+ ToolStripButton btn = new ToolStripButton();
+ btn.Name = btn.Text = btn.ToolTipText = op.ToString();
+ btn.Click += delegate
+ {
+ InsertFilter(name);
+ };
+ btnDistance.DropDown.Items.Add(btn);
+ }
+
+ //Conditional Operators
+ foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Condition)
+ {
+ string name = op.ToString().ToUpper();
+ ToolStripButton btn = new ToolStripButton();
+ btn.Name = btn.Text = btn.ToolTipText = op.ToString();
+ btn.Click += delegate
+ {
+ InsertFilter(name);
+ };
+ btnCondition.DropDown.Items.Add(btn);
+ }
+
+ /*try
+ {
+ /*FdoProviderCapabilities cap = m_connection.GetProviderCapabilities(m_providername);
+ foreach (FdoProviderCapabilitiesFilterType cmd in cap.Filter.Condition)
+ FunctionCombo.Items.Add(cmd.ToString());
+
+ FunctionLabel.Enabled = FunctionCombo.Enabled = true;
+ }
+ catch
+ {
+ FunctionLabel.Enabled = FunctionCombo.Enabled = false;
+ }*/
+ }
+ catch
+ {
+ }
+ }
+
+ private IEnumerable<FdoProviderCapabilitiesExpressionFunctionDefinition> GetStylizationFunctions()
+ {
+ //ARGB
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>()
+ {
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "aValue", //NOXLATE
+ Description = Strings.Func_ARGB_AValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.Int32
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "rValue", //NOXLATE
+ Description = Strings.Func_ARGB_RValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.Int32
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "gValue", //NOXLATE
+ Description = Strings.Func_ARGB_GValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.Int32
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "bValue", //NOXLATE
+ Description = Strings.Func_ARGB_BValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.Int32
+ },
+ },
+ Description = Strings.Func_ARGB_Description,
+ Name = "ARGB", //NOXLATE
+ ReturnType = "Int32" //NOXLATE
+ };
+ //DECAP
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>()
+ {
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "strValue", //NOXLATE
+ Description = Strings.Func_DECAP_StringValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ }
+ },
+ Description = Strings.Func_DECAP_Description,
+ Name = "DECAP", //NOXLATE
+ ReturnType = "String" //NOXLATE
+ };
+ //FEATURECLASS
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>(),
+ Description = Strings.Func_FEATURECLASS_Description,
+ Name = "FEATURECLASS", //NOXLATE
+ ReturnType = "String" //NOXLATE
+ };
+ //FEATUREID
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>(),
+ Description = Strings.Func_FEATUREID_Description,
+ Name = "FEATUREID", //NOXLATE
+ ReturnType = "String" //NOXLATE
+ };
+ //IF
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>()
+ {
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "condition", //NOXLATE
+ Description = Strings.Func_IF_ConditionDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "trueValue", //NOXLATE
+ Description = Strings.Func_IF_TrueValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "falseValue", //NOXLATE
+ Description = Strings.Func_IF_FalseValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ }
+ },
+ Description = Strings.Func_IF_Description,
+ Name = "IF", //NOXLATE
+ ReturnType = "String" //NOXLATE
+ };
+ //LAYERID
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>(),
+ Description = Strings.Func_LAYERID_Description,
+ Name = "LAYERID", //NOXLATE
+ ReturnType = "String" //NOXLATE
+ };
+ //LOOKUP
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>()
+ {
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "expression", //NOXLATE
+ Description = Strings.Func_LOOKUP_ExpressionDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "defaultValue", //NOXLATE
+ Description = Strings.Func_LOOKUP_DefaultValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "index", //NOXLATE
+ Description = Strings.Func_LOOKUP_IndexDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "value", //NOXLATE
+ Description = Strings.Func_LOOKUP_ValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ }
+ },
+ Description = Strings.Func_LOOKUP_Description,
+ Name = "LOOKUP", //NOXLATE
+ ReturnType = "String" //NOXLATE
+ };
+ //MAPNAME
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>(),
+ Description = Strings.Func_MAPNAME_Description,
+ Name = "MAPNAME", //NOXLATE
+ ReturnType = "String" //NOXLATE
+ };
+ //RANGE
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>()
+ {
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "expression", //NOXLATE
+ Description = Strings.Func_RANGE_ExpressionDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "rangeMin", //NOXLATE
+ Description = Strings.Func_RANGE_MinDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "rangeMax", //NOXLATE
+ Description = Strings.Func_RANGE_MaxDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "defaultValue", //NOXLATE
+ Description = Strings.Func_RANGE_DefaultValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ },
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "value", //NOXLATE
+ Description = Strings.Func_RANGE_ValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ }
+ },
+ Description = Strings.Func_RANGE_Description,
+ Name = "RANGE", //NOXLATE
+ ReturnType = "String" //NOXLATE
+ };
+ //SESSION
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>(),
+ Description = Strings.Func_SESSION_Description,
+ Name = "SESSION", //NOXLATE
+ ReturnType = "String" //NOXLATE
+ };
+ //URLENCODE
+ yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
+ {
+ ArgumentDefinitionList = new BindingList<FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition>()
+ {
+ new FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition()
+ {
+ Name = "strValue", //NOXLATE
+ Description = Strings.Func_URLENCODE_StringValueDescription,
+ DataType = FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinitionDataType.String
+ }
+ },
+ Description = Strings.Func_URLENCODE_Description,
+ Name = "URLENCODE", //NOXLATE
+ ReturnType = "String" //NOXLATE
+ };
+ }
+
+ private void InsertText(string exprText)
+ {
+ int index = ExpressionText.SelectionStart;
+ if (ExpressionText.SelectionLength > 0)
+ {
+ ExpressionText.SelectedText = exprText;
+ ExpressionText.SelectionStart = index;
+ }
+ else
+ {
+ if (index > 0)
+ {
+ string text = ExpressionText.Text;
+ ExpressionText.Text = text.Insert(index, exprText);
+ ExpressionText.SelectionStart = index;
+ }
+ else
+ {
+ ExpressionText.Text = exprText;
+ ExpressionText.SelectionStart = index;
+ }
+ }
+ }
+
+ private void InsertFilter(string op)
+ {
+ if (!string.IsNullOrEmpty(op))
+ {
+ string filterTemplate = "<geometry property> {0} GeomFromText('<FGF geometry text>')";
+ string exprText = string.Format(filterTemplate, op);
+ InsertText(exprText);
+ }
+ }
+
+ private void OKBtn_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ this.Close();
+ }
+
+ private SortedList<string, AutoCompleteItem> _autoCompleteItems = new SortedList<string, AutoCompleteItem>();
+ private ImageListBox _autoBox;
+
+ enum AutoCompleteItemType : int
+ {
+ Property = 0,
+ Function = 1,
+ }
+
+ /// <summary>
+ /// Base auto-complete item
+ /// </summary>
+ abstract class AutoCompleteItem
+ {
+ public abstract AutoCompleteItemType Type { get; }
+
+ public abstract string Name { get; }
+
+ public abstract string ToolTipText { get; }
+
+ public abstract string AutoCompleteText { get; }
+ }
+
+ /// <summary>
+ /// Property auto-complete item
+ /// </summary>
+ class PropertyItem : AutoCompleteItem
+ {
+ private PropertyDefinition _propDef;
+
+ public PropertyItem(PropertyDefinition pd)
+ {
+ _propDef = pd;
+ }
+
+ public override AutoCompleteItemType Type
+ {
+ get { return AutoCompleteItemType.Property; }
+ }
+
+ public override string Name
+ {
+ get { return _propDef.Name; }
+ }
+
+ private string _ttText;
+
+ public override string ToolTipText
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(_ttText))
+ {
+ _ttText = string.Format(Strings.PropertyTooltip, _propDef.Name, _propDef.Type.ToString());
+ }
+ return _ttText;
+ }
+ }
+
+ public override string AutoCompleteText
+ {
+ get { return this.Name; }
+ }
+ }
+
+ /// <summary>
+ /// Function auto-complete item
+ /// </summary>
+ class FunctionItem : AutoCompleteItem
+ {
+ private FdoProviderCapabilitiesExpressionFunctionDefinition _func;
+
+ public FunctionItem(FdoProviderCapabilitiesExpressionFunctionDefinition fd)
+ {
+ _func = fd;
+ }
+
+ public override AutoCompleteItemType Type
+ {
+ get { return AutoCompleteItemType.Function; }
+ }
+
+ public override string Name
+ {
+ get { return _func.Name; }
+ }
+
+ private string _ttText;
+
+ public override string ToolTipText
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(_ttText))
+ _ttText = string.Format(Strings.FunctionTooltip, GetReturnTypeString(), _func.Name, GetArgumentString(), _func.Description);
+
+ return _ttText;
+ }
+ }
+
+ private string _argStr;
+
+ private string GetArgumentString()
+ {
+ if (string.IsNullOrEmpty(_argStr))
+ {
+ List<string> tokens = new List<string>();
+ foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in _func.ArgumentDefinitionList)
+ {
+ tokens.Add("[" + argDef.Name.Trim() + "]");
+ }
+ _argStr = string.Join(", ", tokens.ToArray());
+ }
+ return _argStr;
+ }
+
+ private string GetReturnTypeString()
+ {
+ return _func.ReturnType;
+ }
+
+ public override string AutoCompleteText
+ {
+ get
+ {
+ return this.Name + "(" + GetArgumentString() + ")";
+ }
+ }
+ }
+
+ private void InitAutoComplete()
+ {
+ _autoBox = new ImageListBox();
+ _autoBox.Visible = false;
+ _autoBox.ImageList = new ImageList();
+ _autoBox.ImageList.Images.Add(Properties.Resources.property); //Property
+ _autoBox.ImageList.Images.Add(Properties.Resources.block); //Function
+ _autoBox.DoubleClick += new EventHandler(OnAutoCompleteDoubleClick);
+ _autoBox.SelectedIndexChanged += new EventHandler(OnAutoCompleteSelectedIndexChanged);
+ _autoBox.KeyDown += new KeyEventHandler(OnAutoCompleteKeyDown);
+ _autoBox.KeyUp += new KeyEventHandler(OnAutoCompleteKeyUp);
+ _autoBox.ValueMember = "Name";
+ _autoBox.Font = new Font(FontFamily.GenericMonospace, 10.0f);
+ ExpressionText.Controls.Add(_autoBox);
+ }
+
+ void OnAutoCompleteKeyDown(object sender, KeyEventArgs e)
+ {
+ ExpressionText.Focus();
+ }
+
+ void OnAutoCompleteKeyUp(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Enter)
+ {
+ PutAutoCompleteSuggestion();
+ _autoBox.Hide();
+ _autoCompleteTooltip.Hide(this);
+ }
+ }
+
+ void OnAutoCompleteSelectedIndexChanged(object sender, EventArgs e)
+ {
+ ExpressionText.Focus();
+ if (_autoBox.Visible && _autoBox.SelectedIndex >= 0 && _autoBox.Items.Count > 0)
+ {
+ string tt = ((_autoBox.SelectedItem as ImageListBoxItem).Tag as AutoCompleteItem).ToolTipText;
+ Point pt = GetCaretPoint();
+ pt.X += _autoBox.Width + 10;
+ pt.Y += 65;
+
+ _autoCompleteTooltip.Show(tt, this, pt.X, pt.Y);
+ }
+ }
+
+ void OnAutoCompleteDoubleClick(object sender, EventArgs e)
+ {
+ PutAutoCompleteSuggestion();
+ _autoBox.Hide();
+ _autoCompleteTooltip.Hide(this);
+ }
+
+ private void MoveAutoCompleteSelectionDown()
+ {
+ if (_autoBox.SelectedIndex < 0)
+ {
+ _autoBox.SelectedIndex = 0;
+ }
+ else
+ {
+ int idx = _autoBox.SelectedIndex;
+ if ((idx + 1) <= _autoBox.Items.Count - 1)
+ {
+ _autoBox.SelectedIndex = idx + 1;
+ }
+ }
+ }
+
+ private void MoveAutoCompleteSelectionUp()
+ {
+ if (_autoBox.SelectedIndex < 0)
+ {
+ _autoBox.SelectedIndex = 0;
+ }
+ else
+ {
+ int idx = _autoBox.SelectedIndex;
+ if ((idx - 1) >= 0)
+ {
+ _autoBox.SelectedIndex = idx - 1;
+ }
+ }
+ }
+
+ private void LoadCompletableProperties(IEnumerable<PropertyDefinition> cols)
+ {
+ foreach (var col in cols)
+ {
+ _autoCompleteItems[col.Name] = new PropertyItem(col);
+ }
+ }
+
+ private void LoadCompletableFunctions(IEnumerable<FdoProviderCapabilitiesExpressionFunctionDefinition> funcs)
+ {
+ foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in funcs)
+ {
+ _autoCompleteItems[func.Name] = new FunctionItem(func);
+ }
+ }
+
+ private void PutAutoCompleteSuggestion()
+ {
+ if (_autoBox.SelectedItems.Count == 1)
+ {
+ int pos = ExpressionText.SelectionStart;
+ string context;
+ char? c = GetContextBuffer(out context);
+
+ AutoCompleteItem aci = (_autoBox.SelectedItem as ImageListBoxItem).Tag as AutoCompleteItem;
+
+ string fullText = aci.AutoCompleteText;
+
+ int start = pos - context.Length;
+ int newPos = start + fullText.Length;
+ int selLength = -1;
+
+ //if it's a function, highlight the parameter (or the first parameter if there is multiple arguments
+ if (aci.Type == AutoCompleteItemType.Function)
+ {
+ newPos = start + aci.Name.Length + 1; //Position the caret just after the opening bracket
+
+ //Has at least two arguments
+ int idx = fullText.IndexOf(",");
+ if (idx > 0)
+ selLength = idx - aci.Name.Length - 1;
+ else
+ selLength = fullText.IndexOf(")") - fullText.IndexOf("(") - 1;
+ }
+
+ string prefix = ExpressionText.Text.Substring(0, start);
+ string suffix = ExpressionText.Text.Substring(pos, ExpressionText.Text.Length - pos);
+
+ ExpressionText.Text = prefix + fullText + suffix;
+ ExpressionText.SelectionStart = newPos;
+ if (selLength > 0)
+ {
+ ExpressionText.SelectionLength = selLength;
+ }
+ ExpressionText.ScrollToCaret();
+ }
+ }
+
+ private Point GetCaretPoint()
+ {
+ Point pt = ExpressionText.GetPositionFromCharIndex(ExpressionText.SelectionStart);
+ pt.Y += (int)Math.Ceiling(ExpressionText.Font.GetHeight()) + 2;
+ pt.X += 2; // for Courier, may need a better method
+ return pt;
+ }
+
+ private char? GetContextBuffer(out string buffer)
+ {
+ buffer = string.Empty;
+ int caretPos = ExpressionText.SelectionStart;
+ int currentPos = caretPos;
+ char? res = null;
+ if (caretPos > 0)
+ {
+ //Walk backwards
+ caretPos--;
+ char c = ExpressionText.Text[caretPos];
+ while (Char.IsLetterOrDigit(c))
+ {
+ caretPos--;
+
+ if (caretPos < 0)
+ break;
+
+ c = ExpressionText.Text[caretPos];
+ }
+
+ if (caretPos > 0)
+ {
+ res = ExpressionText.Text[caretPos];
+ }
+ buffer = ExpressionText.Text.Substring(caretPos + 1, currentPos - caretPos - 1);
+ }
+ return res;
+ }
+
+ private void HandleKeyDown(KeyEventArgs e)
+ {
+ Keys code = e.KeyCode;
+ if (code == Keys.Escape)
+ {
+ if (_autoBox.Visible)
+ {
+ e.SuppressKeyPress = true;
+ _autoBox.Hide();
+ _autoCompleteTooltip.Hide(this);
+ }
+ }
+ else if (code == Keys.Enter || code == Keys.Return)
+ {
+ if (_autoBox.Visible && _autoBox.SelectedItems.Count == 1)
+ {
+ e.SuppressKeyPress = true;
+ PutAutoCompleteSuggestion();
+ _autoBox.Hide();
+ _autoCompleteTooltip.Hide(this);
+ }
+ }
+ }
+
+ private void HandleKeyUp(KeyEventArgs e)
+ {
+ Keys code = e.KeyCode;
+ if (code == Keys.Oemcomma || code == Keys.OemOpenBrackets)
+ {
+ Complete(string.Empty);
+ }
+ else if (code == Keys.OemQuotes)
+ {
+ if (e.Modifiers == Keys.Shift) // "
+ InsertText("\"");
+ else // '
+ InsertText("'");
+
+ }
+ else if (code == Keys.D9 && e.Modifiers == Keys.Shift) // (
+ {
+ InsertText(")");
+ }
+ else if (code == Keys.Up || code == Keys.Down)
+ {
+ if (_autoBox.Visible)
+ {
+ if (code == Keys.Up)
+ {
+ MoveAutoCompleteSelectionUp();
+ }
+ else
+ {
+ MoveAutoCompleteSelectionDown();
+ }
+ }
+ }
+ else if (code == Keys.Back)
+ {
+ string context;
+ char? c = GetContextBuffer(out context);
+ if (!string.IsNullOrEmpty(context))
+ {
+ Complete(context);
+ }
+ else
+ {
+ if (_autoBox.Visible)
+ {
+ _autoBox.Hide();
+ _autoCompleteTooltip.Hide(this);
+ }
+ }
+ }
+ else if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.Right)
+ {
+ string context;
+ char? c = GetContextBuffer(out context);
+ Complete(context);
+ }
+ else
+ {
+ if (e.Modifiers == Keys.None)
+ {
+ bool alpha = (code >= Keys.A && code <= Keys.Z);
+ bool numeric = (code >= Keys.D0 && code <= Keys.D9) || (code >= Keys.NumPad0 && code <= Keys.NumPad9);
+ if (alpha || numeric)
+ {
+ string context;
+ char? c = GetContextBuffer(out context);
+ Complete(context);
+ }
+ }
+ }
+ }
+
+ private List<AutoCompleteItem> GetItemsStartingWith(string text)
+ {
+ List<AutoCompleteItem> ati = new List<AutoCompleteItem>();
+ foreach (string key in _autoCompleteItems.Keys)
+ {
+ if (key.ToLower().StartsWith(text.Trim().ToLower()))
+ {
+ ati.Add(_autoCompleteItems[key]);
+ }
+ }
+ return ati;
+ }
+
+ private void Complete(string text)
+ {
+ List<AutoCompleteItem> items = GetItemsStartingWith(text);
+ _autoBox.Items.Clear();
+
+ int width = 0;
+ foreach (AutoCompleteItem it in items)
+ {
+ ImageListBoxItem litem = new ImageListBoxItem();
+ litem.Text = it.Name;
+ litem.ImageIndex = (int)it.Type;
+ litem.Tag = it;
+
+ _autoBox.Items.Add(litem);
+ int length = TextRenderer.MeasureText(it.Name, _autoBox.Font).Width + 30; //For icon size
+ if (length > width)
+ width = length;
+ }
+ _autoBox.Width = width;
+
+ if (!_autoBox.Visible)
+ {
+ if (_autoBox.Items.Count > 0)
+ {
+ _autoBox.BringToFront();
+ _autoBox.Show();
+ }
+ }
+
+ Point pt = GetCaretPoint();
+
+ _autoBox.Location = pt;
+ }
+
+ private void ExpressionText_KeyDown(object sender, KeyEventArgs e)
+ {
+ HandleKeyDown(e);
+ }
+
+ private void ExpressionText_KeyUp(object sender, KeyEventArgs e)
+ {
+ HandleKeyUp(e);
+ }
+
+ private void ColumnName_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void ColumnName_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ ColumnValue.Enabled = false;
+ LookupValues.Enabled = ColumnName.SelectedIndex >= 0;
+ }
+
+ private void LookupValues_Click(object sender, EventArgs e)
+ {
+ //Use UNIQUE() method first. This should work in most cases
+ using (new WaitCursor(this))
+ {
+ string filter = null;
+ var expr = "UNIQUE(" + ColumnName.Text + ")";
+ bool bFallback = false;
+ ColumnValue.Items.Clear();
+ ColumnValue.Tag = null;
+ try
+ {
+ using (var rdr = _featSvc.AggregateQueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new System.Collections.Specialized.NameValueCollection() {
+ { "UNIQ_VALS", expr }
+ }))
+ {
+ for (int i = 0; i < rdr.FieldCount; i++)
+ {
+ if (rdr.GetName(i) == "UNIQ_VALS")
+ {
+ ColumnName.Tag = rdr.GetFieldType(i);
+ }
+ }
+ while (rdr.ReadNext())
+ {
+ if (!rdr.IsNull("UNIQ_VALS"))
+ {
+ object value = rdr["UNIQ_VALS"];
+ ColumnValue.Items.Add(value);
+ }
+ }
+ rdr.Close();
+ }
+ }
+ catch
+ {
+ ColumnValue.Items.Clear();
+ bFallback = true;
+ }
+ if (!bFallback)
+ {
+ ColumnValue.Enabled = true;
+ ColumnValue.SelectedIndex = -1;
+ ColumnValue.DroppedDown = true;
+ return;
+ }
+
+ try
+ {
+ SortedList<string, PropertyDefinition> cols = (SortedList<string, PropertyDefinition>)ColumnName.Tag;
+ PropertyDefinition col = cols[ColumnName.Text];
+
+ bool retry = true;
+ Exception rawEx = null;
+
+ SortedList<string, string> values = new SortedList<string, string>();
+ bool hasNull = false;
+
+ while (retry)
+ {
+ try
+ {
+ retry = false;
+ using (var rd = _featSvc.QueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new string[] { ColumnName.Text }))
+ {
+ while (rd.ReadNext())
+ {
+ if (rd.IsNull(ColumnName.Text))
+ hasNull = true;
+ else
+ values[Convert.ToString(rd[ColumnName.Text], System.Globalization.CultureInfo.InvariantCulture)] = null;
+ }
+ rd.Close();
+ }
+ }
+ catch (Exception ex)
+ {
+ if (filter == null && ex.Message.IndexOf("MgNullPropertyValueException") >= 0)
+ {
+ hasNull = true;
+ rawEx = ex;
+ retry = true;
+ filter = ColumnName.Text + " != NULL";
+ }
+ else if (rawEx != null)
+ throw rawEx;
+ else
+ throw;
+ }
+ }
+
+ ColumnValue.Items.Clear();
+ if (hasNull)
+ ColumnValue.Items.Add("NULL");
+
+ foreach (string s in values.Keys)
+ ColumnValue.Items.Add(s);
+
+ ColumnValue.Tag = col.Type;
+
+ if (ColumnValue.Items.Count == 0)
+ MessageBox.Show(this, Strings.NoColumnValuesError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ else
+ {
+ ColumnValue.Enabled = true;
+ ColumnValue.SelectedIndex = -1;
+ ColumnValue.DroppedDown = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
+ MessageBox.Show(this, string.Format(Strings.ColumnValueError, msg), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+ }
+
+ private void ColumnValue_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (ColumnValue.SelectedIndex >= 0)
+ {
+ var tag = ColumnValue.Tag;
+ if (tag != null)
+ {
+ if (ColumnValue.Tag == typeof(string) && (ColumnValue.SelectedIndex != 0 || ColumnValue.Text != "NULL"))
+ {
+ InsertText("'" + ColumnValue.Text + "'");
+ }
+ else
+ {
+ if (tag is PropertyValueType && (PropertyValueType)tag == PropertyValueType.String)
+ InsertText("'" + ColumnValue.Text + "'");
+ else
+ InsertText(ColumnValue.Text);
+ }
+ }
+ else
+ {
+ InsertText(ColumnValue.Text);
+ }
+ }
+ }
+ }
+
+ // ImageListBoxItem class
+ internal class ImageListBoxItem
+ {
+ private string _myText;
+ private int _myImageIndex;
+ // properties
+ public string Text
+ {
+ get { return _myText; }
+ set { _myText = value; }
+ }
+ public int ImageIndex
+ {
+ get { return _myImageIndex; }
+ set { _myImageIndex = value; }
+ }
+ //constructor
+ public ImageListBoxItem(string text, int index)
+ {
+ _myText = text;
+ _myImageIndex = index;
+ }
+ public ImageListBoxItem(string text) : this(text, -1) { }
+ public ImageListBoxItem() : this("") { }
+
+ private object _tag;
+
+ public object Tag
+ {
+ get { return _tag; }
+ set { _tag = value; }
+ }
+
+ public override string ToString()
+ {
+ return _myText;
+ }
+ }//End of ImageListBoxItem class
+
+ // ImageListBox class
+ //
+ // Based on GListBox
+ //
+ // http://www.codeproject.com/KB/combobox/glistbox.aspx
+
+ internal class ImageListBox : ListBox
+ {
+ private ImageList _myImageList;
+ public ImageList ImageList
+ {
+ get { return _myImageList; }
+ set { _myImageList = value; }
+ }
+ public ImageListBox()
+ {
+ // Set owner draw mode
+ this.DrawMode = DrawMode.OwnerDrawFixed;
+ }
+ protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e)
+ {
+ e.DrawBackground();
+ e.DrawFocusRectangle();
+ ImageListBoxItem item;
+ Rectangle bounds = e.Bounds;
+ Size imageSize = _myImageList.ImageSize;
+ try
+ {
+ item = (ImageListBoxItem)Items[e.Index];
+ if (item.ImageIndex != -1)
+ {
+ _myImageList.Draw(e.Graphics, bounds.Left, bounds.Top, item.ImageIndex);
+ e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor),
+ bounds.Left + imageSize.Width, bounds.Top);
+ }
+ else
+ {
+ e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor),
+ bounds.Left, bounds.Top);
+ }
+ }
+ catch
+ {
+ if (e.Index != -1)
+ {
+ e.Graphics.DrawString(Items[e.Index].ToString(), e.Font,
+ new SolidBrush(e.ForeColor), bounds.Left, bounds.Top);
+ }
+ else
+ {
+ e.Graphics.DrawString(Text, e.Font, new SolidBrush(e.ForeColor),
+ bounds.Left, bounds.Top);
+ }
+ }
+ base.OnDrawItem(e);
+ }
+ }//End of ImageListBox class
+}
Added: trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.resx (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.resx 2012-11-19 11:31:06 UTC (rev 7211)
@@ -0,0 +1,447 @@
+<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="OKBtn.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Right</value>
+ </data>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="OKBtn.Location" type="System.Drawing.Point, System.Drawing">
+ <value>342, 6</value>
+ </data>
+ <data name="OKBtn.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="OKBtn.TabIndex" type="System.Int32, mscorlib">
+ <value>2</value>
+ </data>
+ <data name="OKBtn.Text" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name=">>OKBtn.Name" xml:space="preserve">
+ <value>OKBtn</value>
+ </data>
+ <data name=">>OKBtn.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>OKBtn.Parent" xml:space="preserve">
+ <value>panel1</value>
+ </data>
+ <data name=">>OKBtn.ZOrder" xml:space="preserve">
+ <value>2</value>
+ </data>
+ <data name="CancelBtn.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Right</value>
+ </data>
+ <data name="CancelBtn.Location" type="System.Drawing.Point, System.Drawing">
+ <value>423, 6</value>
+ </data>
+ <data name="CancelBtn.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="CancelBtn.TabIndex" type="System.Int32, mscorlib">
+ <value>3</value>
+ </data>
+ <data name="CancelBtn.Text" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name=">>CancelBtn.Name" xml:space="preserve">
+ <value>CancelBtn</value>
+ </data>
+ <data name=">>CancelBtn.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>CancelBtn.Parent" xml:space="preserve">
+ <value>panel1</value>
+ </data>
+ <data name=">>CancelBtn.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="lblHint.AutoSize" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="lblHint.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 11</value>
+ </data>
+ <data name="lblHint.Size" type="System.Drawing.Size, System.Drawing">
+ <value>202, 13</value>
+ </data>
+ <data name="lblHint.TabIndex" type="System.Int32, mscorlib">
+ <value>4</value>
+ </data>
+ <data name="lblHint.Text" xml:space="preserve">
+ <value>Press Alt + Right to invoke auto-complete</value>
+ </data>
+ <data name=">>lblHint.Name" xml:space="preserve">
+ <value>lblHint</value>
+ </data>
+ <data name=">>lblHint.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>lblHint.Parent" xml:space="preserve">
+ <value>panel1</value>
+ </data>
+ <data name=">>lblHint.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <data name="panel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
+ <value>Bottom</value>
+ </data>
+ <data name="panel1.Location" type="System.Drawing.Point, System.Drawing">
+ <value>0, 249</value>
+ </data>
+ <data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
+ <value>510, 40</value>
+ </data>
+ <data name="panel1.TabIndex" type="System.Int32, mscorlib">
+ <value>4</value>
+ </data>
+ <data name=">>panel1.Name" xml:space="preserve">
+ <value>panel1</value>
+ </data>
+ <data name=">>panel1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>panel1.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>panel1.ZOrder" xml:space="preserve">
+ <value>2</value>
+ </data>
+ <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <data name="btnProperties.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+ <value>Magenta</value>
+ </data>
+ <data name="btnProperties.Size" type="System.Drawing.Size, System.Drawing">
+ <value>89, 22</value>
+ </data>
+ <data name="btnProperties.Text" xml:space="preserve">
+ <value>Properties</value>
+ </data>
+ <data name="btnFunctions.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+ <value>Magenta</value>
+ </data>
+ <data name="btnFunctions.Size" type="System.Drawing.Size, System.Drawing">
+ <value>88, 22</value>
+ </data>
+ <data name="btnFunctions.Text" xml:space="preserve">
+ <value>Functions</value>
+ </data>
+ <data name="btnCondition.Size" type="System.Drawing.Size, System.Drawing">
+ <value>127, 22</value>
+ </data>
+ <data name="btnCondition.Text" xml:space="preserve">
+ <value>Condition</value>
+ </data>
+ <data name="btnSpatial.Size" type="System.Drawing.Size, System.Drawing">
+ <value>127, 22</value>
+ </data>
+ <data name="btnSpatial.Text" xml:space="preserve">
+ <value>Spatial</value>
+ </data>
+ <data name="btnDistance.Size" type="System.Drawing.Size, System.Drawing">
+ <value>127, 22</value>
+ </data>
+ <data name="btnDistance.Text" xml:space="preserve">
+ <value>Distance</value>
+ </data>
+ <data name="btnFilter.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+ <value>Magenta</value>
+ </data>
+ <data name="btnFilter.Size" type="System.Drawing.Size, System.Drawing">
+ <value>62, 22</value>
+ </data>
+ <data name="btnFilter.Text" xml:space="preserve">
+ <value>Filter</value>
+ </data>
+ <data name="toolStripSeparator1.Size" type="System.Drawing.Size, System.Drawing">
+ <value>6, 25</value>
+ </data>
+ <data name="ColumnValue.Enabled" type="System.Boolean, mscorlib">
+ <value>False</value>
+ </data>
+ <data name="ColumnValue.Size" type="System.Drawing.Size, System.Drawing">
+ <value>110, 25</value>
+ </data>
+ <data name="LookupValues.Enabled" type="System.Boolean, mscorlib">
+ <value>False</value>
+ </data>
+ <data name="LookupValues.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+ <value>Magenta</value>
+ </data>
+ <data name="LookupValues.Size" type="System.Drawing.Size, System.Drawing">
+ <value>23, 22</value>
+ </data>
+ <data name="LookupValues.ToolTipText" xml:space="preserve">
+ <value>Click to lookup values from the selected column</value>
+ </data>
+ <data name="ColumnName.Size" type="System.Drawing.Size, System.Drawing">
+ <value>110, 25</value>
+ </data>
+ <data name="ColumnName.ToolTipText" xml:space="preserve">
+ <value>Select the column to read values from</value>
+ </data>
+ <data name="toolStrip1.Location" type="System.Drawing.Point, System.Drawing">
+ <value>0, 0</value>
+ </data>
+ <data name="toolStrip1.Size" type="System.Drawing.Size, System.Drawing">
+ <value>510, 25</value>
+ </data>
+ <data name="toolStrip1.TabIndex" type="System.Int32, mscorlib">
+ <value>5</value>
+ </data>
+ <data name="toolStrip1.Text" xml:space="preserve">
+ <value>toolStrip1</value>
+ </data>
+ <data name=">>toolStrip1.Name" xml:space="preserve">
+ <value>toolStrip1</value>
+ </data>
+ <data name=">>toolStrip1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>toolStrip1.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>toolStrip1.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="ExpressionText.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
+ <value>Fill</value>
+ </data>
+ <data name="ExpressionText.Font" type="System.Drawing.Font, System.Drawing">
+ <value>Courier New, 12pt</value>
+ </data>
+ <data name="ExpressionText.Location" type="System.Drawing.Point, System.Drawing">
+ <value>0, 25</value>
+ </data>
+ <data name="ExpressionText.Multiline" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="ExpressionText.Size" type="System.Drawing.Size, System.Drawing">
+ <value>510, 224</value>
+ </data>
+ <data name="ExpressionText.TabIndex" type="System.Int32, mscorlib">
+ <value>6</value>
+ </data>
+ <data name=">>ExpressionText.Name" xml:space="preserve">
+ <value>ExpressionText</value>
+ </data>
+ <data name=">>ExpressionText.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>ExpressionText.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>ExpressionText.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <metadata name="_autoCompleteTooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>116, 17</value>
+ </metadata>
+ <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+ <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
+ <value>510, 289</value>
+ </data>
+ <data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
+ <value>500, 300</value>
+ </data>
+ <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
+ <value>CenterParent</value>
+ </data>
+ <data name="$this.Text" xml:space="preserve">
+ <value>Expression Editor</value>
+ </data>
+ <data name=">>btnProperties.Name" xml:space="preserve">
+ <value>btnProperties</value>
+ </data>
+ <data name=">>btnProperties.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnFunctions.Name" xml:space="preserve">
+ <value>btnFunctions</value>
+ </data>
+ <data name=">>btnFunctions.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnFilter.Name" xml:space="preserve">
+ <value>btnFilter</value>
+ </data>
+ <data name=">>btnFilter.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnCondition.Name" xml:space="preserve">
+ <value>btnCondition</value>
+ </data>
+ <data name=">>btnCondition.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnSpatial.Name" xml:space="preserve">
+ <value>btnSpatial</value>
+ </data>
+ <data name=">>btnSpatial.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnDistance.Name" xml:space="preserve">
+ <value>btnDistance</value>
+ </data>
+ <data name=">>btnDistance.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>toolStripSeparator1.Name" xml:space="preserve">
+ <value>toolStripSeparator1</value>
+ </data>
+ <data name=">>toolStripSeparator1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>ColumnValue.Name" xml:space="preserve">
+ <value>ColumnValue</value>
+ </data>
+ <data name=">>ColumnValue.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>LookupValues.Name" xml:space="preserve">
+ <value>LookupValues</value>
+ </data>
+ <data name=">>LookupValues.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>ColumnName.Name" xml:space="preserve">
+ <value>ColumnName</value>
+ </data>
+ <data name=">>ColumnName.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>_autoCompleteTooltip.Name" xml:space="preserve">
+ <value>_autoCompleteTooltip</value>
+ </data>
+ <data name=">>_autoCompleteTooltip.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>$this.Name" xml:space="preserve">
+ <value>MonoCompatibleExpressionEditor</value>
+ </data>
+ <data name=">>$this.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs 2012-11-19 11:03:11 UTC (rev 7210)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs 2012-11-19 11:31:06 UTC (rev 7211)
@@ -108,7 +108,7 @@
private void txtFilter_Click(object sender, EventArgs e)
{
- var ed = new ExpressionEditor();
+ var ed = FdoExpressionEditorFactory.Create(); //new ExpressionEditor();
ed.Initialize(_featSvc, _caps, _cls, _fsId, false);
ed.Expression = txtFilter.Text;
if (ed.ShowDialog() == DialogResult.OK)
@@ -135,7 +135,7 @@
private void btnAdd_Click(object sender, EventArgs e)
{
- var ed = new ExpressionEditor();
+ var ed = FdoExpressionEditorFactory.Create();// new ExpressionEditor();
ed.Initialize(_featSvc, _caps, _cls, _fsId, false);
if (ed.ShowDialog() == DialogResult.OK)
{
Modified: trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj 2012-11-19 11:03:11 UTC (rev 7210)
+++ trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj 2012-11-19 11:31:06 UTC (rev 7211)
@@ -121,6 +121,7 @@
<Compile Include="Common\GenericInputDialog.Designer.cs">
<DependentUpon>GenericInputDialog.cs</DependentUpon>
</Compile>
+ <Compile Include="Common\IExpressionEditor.cs" />
<Compile Include="Common\ImageStylePicker.cs">
<SubType>Component</SubType>
</Compile>
@@ -131,6 +132,12 @@
<DependentUpon>GenericItemSelectionDialog.cs</DependentUpon>
</Compile>
<Compile Include="Common\ITextEditor.cs" />
+ <Compile Include="Common\MonoCompatibleExpressionEditor.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Common\MonoCompatibleExpressionEditor.Designer.cs">
+ <DependentUpon>MonoCompatibleExpressionEditor.cs</DependentUpon>
+ </Compile>
<Compile Include="Common\NsDoc.cs" />
<Compile Include="Common\RepositoryTreeModel.cs" />
<Compile Include="Common\RepositoryView.cs">
@@ -1341,6 +1348,9 @@
<EmbeddedResource Include="Common\GenericItemSelectionDialog.resx">
<DependentUpon>GenericItemSelectionDialog.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Common\MonoCompatibleExpressionEditor.resx">
+ <DependentUpon>MonoCompatibleExpressionEditor.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Common\RepositoryView.resx">
<DependentUpon>RepositoryView.cs</DependentUpon>
</EmbeddedResource>
Modified: trunk/Tools/Maestro/Maestro.Editors/ResourceEditorServiceBase.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/ResourceEditorServiceBase.cs 2012-11-19 11:03:11 UTC (rev 7210)
+++ trunk/Tools/Maestro/Maestro.Editors/ResourceEditorServiceBase.cs 2012-11-19 11:31:06 UTC (rev 7211)
@@ -83,7 +83,7 @@
/// <returns></returns>
public string EditExpression(string currentExpr, ClassDefinition classDef, string providerName, string featureSourceId, bool attachStylizationFunctions)
{
- var ed = new ExpressionEditor();
+ var ed = FdoExpressionEditorFactory.Create(); new ExpressionEditor();
var caps = this.FeatureService.GetProviderCapabilities(providerName);
ed.Initialize(this.FeatureService, caps, classDef, featureSourceId, attachStylizationFunctions);
ed.Expression = currentExpr;
Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs 2012-11-19 11:03:11 UTC (rev 7210)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs 2012-11-19 11:31:06 UTC (rev 7211)
@@ -808,6 +808,267 @@
}
/// <summary>
+ /// Looks up a localized string similar to Alpha value.
+ /// </summary>
+ internal static string Func_ARGB_AValueDescription {
+ get {
+ return ResourceManager.GetString("Func_ARGB_AValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Blue value.
+ /// </summary>
+ internal static string Func_ARGB_BValueDescription {
+ get {
+ return ResourceManager.GetString("Func_ARGB_BValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Color generation function.
+ /// </summary>
+ internal static string Func_ARGB_Description {
+ get {
+ return ResourceManager.GetString("Func_ARGB_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Green value.
+ /// </summary>
+ internal static string Func_ARGB_GValueDescription {
+ get {
+ return ResourceManager.GetString("Func_ARGB_GValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Red value.
+ /// </summary>
+ internal static string Func_ARGB_RValueDescription {
+ get {
+ return ResourceManager.GetString("Func_ARGB_RValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to String formatting function.
+ /// </summary>
+ internal static string Func_DECAP_Description {
+ get {
+ return ResourceManager.GetString("Func_DECAP_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to String to format.
+ /// </summary>
+ internal static string Func_DECAP_StringValueDescription {
+ get {
+ return ResourceManager.GetString("Func_DECAP_StringValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Returns the active feature class name.
+ /// </summary>
+ internal static string Func_FEATURECLASS_Description {
+ get {
+ return ResourceManager.GetString("Func_FEATURECLASS_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Returns the active feature Id.
+ /// </summary>
+ internal static string Func_FEATUREID_Description {
+ get {
+ return ResourceManager.GetString("Func_FEATUREID_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Boolean expression (filter) encapsulated in a string.
+ /// </summary>
+ internal static string Func_IF_ConditionDescription {
+ get {
+ return ResourceManager.GetString("Func_IF_ConditionDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to If evaluator for style theming.
+ /// </summary>
+ internal static string Func_IF_Description {
+ get {
+ return ResourceManager.GetString("Func_IF_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Returned if condition is false.
+ /// </summary>
+ internal static string Func_IF_FalseValueDescription {
+ get {
+ return ResourceManager.GetString("Func_IF_FalseValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Returned if condition is true.
+ /// </summary>
+ internal static string Func_IF_TrueValueDescription {
+ get {
+ return ResourceManager.GetString("Func_IF_TrueValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Returns the active layer Id.
+ /// </summary>
+ internal static string Func_LAYERID_Description {
+ get {
+ return ResourceManager.GetString("Func_LAYERID_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Default value returned if expression does not evaluate to any of the keys.
+ /// </summary>
+ internal static string Func_LOOKUP_DefaultValueDescription {
+ get {
+ return ResourceManager.GetString("Func_LOOKUP_DefaultValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Lookup table for style theming.
+ /// </summary>
+ internal static string Func_LOOKUP_Description {
+ get {
+ return ResourceManager.GetString("Func_LOOKUP_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Key expression.
+ /// </summary>
+ internal static string Func_LOOKUP_ExpressionDescription {
+ get {
+ return ResourceManager.GetString("Func_LOOKUP_ExpressionDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Lookup index that can be matched by the key expression.
+ /// </summary>
+ internal static string Func_LOOKUP_IndexDescription {
+ get {
+ return ResourceManager.GetString("Func_LOOKUP_IndexDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Value that is returned when the key expression matches the associated index.
+ /// </summary>
+ internal static string Func_LOOKUP_ValueDescription {
+ get {
+ return ResourceManager.GetString("Func_LOOKUP_ValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Returns the active map name.
+ /// </summary>
+ internal static string Func_MAPNAME_Description {
+ get {
+ return ResourceManager.GetString("Func_MAPNAME_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Default value returned if expression does not fall into any of the ranges.
+ /// </summary>
+ internal static string Func_RANGE_DefaultValueDescription {
+ get {
+ return ResourceManager.GetString("Func_RANGE_DefaultValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Range table for style theming.
+ /// </summary>
+ internal static string Func_RANGE_Description {
+ get {
+ return ResourceManager.GetString("Func_RANGE_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Key expression.
+ /// </summary>
+ internal static string Func_RANGE_ExpressionDescription {
+ get {
+ return ResourceManager.GetString("Func_RANGE_ExpressionDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Exclusive maximum of range that can be matched by the key expression.
+ /// </summary>
+ internal static string Func_RANGE_MaxDescription {
+ get {
+ return ResourceManager.GetString("Func_RANGE_MaxDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Inclusive minimum of range that can be matched by the key expression.
+ /// </summary>
+ internal static string Func_RANGE_MinDescription {
+ get {
+ return ResourceManager.GetString("Func_RANGE_MinDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Value that is returned when the key expression matches the associated range.
+ /// </summary>
+ internal static string Func_RANGE_ValueDescription {
+ get {
+ return ResourceManager.GetString("Func_RANGE_ValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Returns the active session.
+ /// </summary>
+ internal static string Func_SESSION_Description {
+ get {
+ return ResourceManager.GetString("Func_SESSION_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to String encoding function.
+ /// </summary>
+ internal static string Func_URLENCODE_Description {
+ get {
+ return ResourceManager.GetString("Func_URLENCODE_Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to String to URL encode.
+ /// </summary>
+ internal static string Func_URLENCODE_StringValueDescription {
+ get {
+ return ResourceManager.GetString("Func_URLENCODE_StringValueDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Function: {1}({2})
///Description: {3}
///Returns: {0}.
Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.resx 2012-11-19 11:03:11 UTC (rev 7210)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.resx 2012-11-19 11:31:06 UTC (rev 7211)
@@ -1374,4 +1374,91 @@
<data name="ExprEditorFunctionDesc" xml:space="preserve">
<value>{0}{3}{1}{3}Returns: {2}</value>
</data>
+ <data name="Func_ARGB_AValueDescription" xml:space="preserve">
+ <value>Alpha value</value>
+ </data>
+ <data name="Func_ARGB_BValueDescription" xml:space="preserve">
+ <value>Blue value</value>
+ </data>
+ <data name="Func_ARGB_Description" xml:space="preserve">
+ <value>Color generation function</value>
+ </data>
+ <data name="Func_ARGB_GValueDescription" xml:space="preserve">
+ <value>Green value</value>
+ </data>
+ <data name="Func_ARGB_RValueDescription" xml:space="preserve">
+ <value>Red value</value>
+ </data>
+ <data name="Func_DECAP_Description" xml:space="preserve">
+ <value>String formatting function</value>
+ </data>
+ <data name="Func_DECAP_StringValueDescription" xml:space="preserve">
+ <value>String to format</value>
+ </data>
+ <data name="Func_FEATURECLASS_Description" xml:space="preserve">
+ <value>Returns the active feature class name</value>
+ </data>
+ <data name="Func_FEATUREID_Description" xml:space="preserve">
+ <value>Returns the active feature Id</value>
+ </data>
+ <data name="Func_IF_ConditionDescription" xml:space="preserve">
+ <value>Boolean expression (filter) encapsulated in a string</value>
+ </data>
+ <data name="Func_IF_Description" xml:space="preserve">
+ <value>If evaluator for style theming</value>
+ </data>
+ <data name="Func_IF_FalseValueDescription" xml:space="preserve">
+ <value>Returned if condition is false</value>
+ </data>
+ <data name="Func_IF_TrueValueDescription" xml:space="preserve">
+ <value>Returned if condition is true</value>
+ </data>
+ <data name="Func_LAYERID_Description" xml:space="preserve">
+ <value>Returns the active layer Id</value>
+ </data>
+ <data name="Func_LOOKUP_DefaultValueDescription" xml:space="preserve">
+ <value>Default value returned if expression does not evaluate to any of the keys</value>
+ </data>
+ <data name="Func_LOOKUP_Description" xml:space="preserve">
+ <value>Lookup table for style theming</value>
+ </data>
+ <data name="Func_LOOKUP_ExpressionDescription" xml:space="preserve">
+ <value>Key expression</value>
+ </data>
+ <data name="Func_LOOKUP_IndexDescription" xml:space="preserve">
+ <value>Lookup index that can be matched by the key expression</value>
+ </data>
+ <data name="Func_LOOKUP_ValueDescription" xml:space="preserve">
+ <value>Value that is returned when the key expression matches the associated index</value>
+ </data>
+ <data name="Func_MAPNAME_Description" xml:space="preserve">
+ <value>Returns the active map name</value>
+ </data>
+ <data name="Func_RANGE_DefaultValueDescription" xml:space="preserve">
+ <value>Default value returned if expression does not fall into any of the ranges</value>
+ </data>
+ <data name="Func_RANGE_Description" xml:space="preserve">
+ <value>Range table for style theming</value>
+ </data>
+ <data name="Func_RANGE_ExpressionDescription" xml:space="preserve">
+ <value>Key expression</value>
+ </data>
+ <data name="Func_RANGE_MaxDescription" xml:space="preserve">
+ <value>Exclusive maximum of range that can be matched by the key expression</value>
+ </data>
+ <data name="Func_RANGE_MinDescription" xml:space="preserve">
+ <value>Inclusive minimum of range that can be matched by the key expression</value>
+ </data>
+ <data name="Func_RANGE_ValueDescription" xml:space="preserve">
+ <value>Value that is returned when the key expression matches the associated range</value>
+ </data>
+ <data name="Func_SESSION_Description" xml:space="preserve">
+ <value>Returns the active session</value>
+ </data>
+ <data name="Func_URLENCODE_Description" xml:space="preserve">
+ <value>String encoding function</value>
+ </data>
+ <data name="Func_URLENCODE_StringValueDescription" xml:space="preserve">
+ <value>String to URL encode</value>
+ </data>
</root>
\ No newline at end of file
More information about the mapguide-commits
mailing list