System.Data.SQLite
Check-in [71293812a7]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:1.0.32.0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: 71293812a7ce21de84738321a574b6385156cba9
User & Date: rmsimpson 2006-08-06 18:17:34
Context
2006-08-07
03:50
1.0.32.0 check-in: 4c037f4d50 user: rmsimpson tags: sourceforge
2006-08-06
18:17
1.0.32.0 check-in: 71293812a7 user: rmsimpson tags: sourceforge
17:55
1.0.32.0 check-in: 6b4fd5077c user: rmsimpson tags: sourceforge
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added SQLite.Designer/ChangePasswordDialog.Designer.cs.

            1  +namespace SQLite.Designer
            2  +{
            3  +  partial class ChangePasswordDialog
            4  +  {
            5  +    /// <summary>
            6  +    /// Required designer variable.
            7  +    /// </summary>
            8  +    private System.ComponentModel.IContainer components = null;
            9  +
           10  +    /// <summary>
           11  +    /// Clean up any resources being used.
           12  +    /// </summary>
           13  +    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
           14  +    protected override void Dispose(bool disposing)
           15  +    {
           16  +      if (disposing && (components != null))
           17  +      {
           18  +        components.Dispose();
           19  +      }
           20  +      base.Dispose(disposing);
           21  +    }
           22  +
           23  +    #region Windows Form Designer generated code
           24  +
           25  +    /// <summary>
           26  +    /// Required method for Designer support - do not modify
           27  +    /// the contents of this method with the code editor.
           28  +    /// </summary>
           29  +    private void InitializeComponent()
           30  +    {
           31  +      System.Windows.Forms.Button cancelButton;
           32  +      System.Windows.Forms.Label label1;
           33  +      this.okButton = new System.Windows.Forms.Button();
           34  +      this.confirmLabel = new System.Windows.Forms.Label();
           35  +      this.password = new System.Windows.Forms.TextBox();
           36  +      this.passwordConfirm = new System.Windows.Forms.TextBox();
           37  +      this.action = new System.Windows.Forms.Label();
           38  +      cancelButton = new System.Windows.Forms.Button();
           39  +      label1 = new System.Windows.Forms.Label();
           40  +      this.SuspendLayout();
           41  +      // 
           42  +      // cancelButton
           43  +      // 
           44  +      cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
           45  +      cancelButton.Location = new System.Drawing.Point(212, 134);
           46  +      cancelButton.Name = "cancelButton";
           47  +      cancelButton.Size = new System.Drawing.Size(75, 23);
           48  +      cancelButton.TabIndex = 0;
           49  +      cancelButton.Text = "Cancel";
           50  +      cancelButton.UseVisualStyleBackColor = true;
           51  +      // 
           52  +      // label1
           53  +      // 
           54  +      label1.AutoSize = true;
           55  +      label1.Location = new System.Drawing.Point(28, 15);
           56  +      label1.Name = "label1";
           57  +      label1.Size = new System.Drawing.Size(77, 13);
           58  +      label1.TabIndex = 2;
           59  +      label1.Text = "New &Password";
           60  +      // 
           61  +      // okButton
           62  +      // 
           63  +      this.okButton.Location = new System.Drawing.Point(131, 134);
           64  +      this.okButton.Name = "okButton";
           65  +      this.okButton.Size = new System.Drawing.Size(75, 23);
           66  +      this.okButton.TabIndex = 1;
           67  +      this.okButton.Text = "OK";
           68  +      this.okButton.UseVisualStyleBackColor = true;
           69  +      this.okButton.Click += new System.EventHandler(this.okButton_Click);
           70  +      // 
           71  +      // confirmLabel
           72  +      // 
           73  +      this.confirmLabel.AutoSize = true;
           74  +      this.confirmLabel.Enabled = false;
           75  +      this.confirmLabel.Location = new System.Drawing.Point(12, 42);
           76  +      this.confirmLabel.Name = "confirmLabel";
           77  +      this.confirmLabel.Size = new System.Drawing.Size(93, 13);
           78  +      this.confirmLabel.TabIndex = 4;
           79  +      this.confirmLabel.Text = "&Confirm Password";
           80  +      // 
           81  +      // password
           82  +      // 
           83  +      this.password.Location = new System.Drawing.Point(111, 12);
           84  +      this.password.Name = "password";
           85  +      this.password.Size = new System.Drawing.Size(176, 21);
           86  +      this.password.TabIndex = 3;
           87  +      this.password.UseSystemPasswordChar = true;
           88  +      this.password.TextChanged += new System.EventHandler(this.password_TextChanged);
           89  +      // 
           90  +      // passwordConfirm
           91  +      // 
           92  +      this.passwordConfirm.Enabled = false;
           93  +      this.passwordConfirm.Location = new System.Drawing.Point(111, 39);
           94  +      this.passwordConfirm.Name = "passwordConfirm";
           95  +      this.passwordConfirm.Size = new System.Drawing.Size(176, 21);
           96  +      this.passwordConfirm.TabIndex = 5;
           97  +      this.passwordConfirm.UseSystemPasswordChar = true;
           98  +      this.passwordConfirm.TextChanged += new System.EventHandler(this.password_TextChanged);
           99  +      // 
          100  +      // action
          101  +      // 
          102  +      this.action.Location = new System.Drawing.Point(39, 74);
          103  +      this.action.Name = "action";
          104  +      this.action.Size = new System.Drawing.Size(220, 46);
          105  +      this.action.TabIndex = 6;
          106  +      // 
          107  +      // ChangePasswordDialog
          108  +      // 
          109  +      this.AcceptButton = this.okButton;
          110  +      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
          111  +      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
          112  +      this.CancelButton = cancelButton;
          113  +      this.ClientSize = new System.Drawing.Size(299, 169);
          114  +      this.Controls.Add(this.action);
          115  +      this.Controls.Add(this.passwordConfirm);
          116  +      this.Controls.Add(this.confirmLabel);
          117  +      this.Controls.Add(this.password);
          118  +      this.Controls.Add(label1);
          119  +      this.Controls.Add(this.okButton);
          120  +      this.Controls.Add(cancelButton);
          121  +      this.Font = new System.Drawing.Font("MS Shell Dlg 2", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
          122  +      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
          123  +      this.MaximizeBox = false;
          124  +      this.MinimizeBox = false;
          125  +      this.Name = "ChangePasswordDialog";
          126  +      this.ShowIcon = false;
          127  +      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
          128  +      this.Text = "Change SQLite Database Password";
          129  +      this.ResumeLayout(false);
          130  +      this.PerformLayout();
          131  +
          132  +    }
          133  +
          134  +    #endregion
          135  +
          136  +    private System.Windows.Forms.TextBox passwordConfirm;
          137  +    private System.Windows.Forms.Label action;
          138  +    private System.Windows.Forms.TextBox password;
          139  +    private System.Windows.Forms.Label confirmLabel;
          140  +    private System.Windows.Forms.Button okButton;
          141  +
          142  +  }
          143  +}

Added SQLite.Designer/ChangePasswordDialog.cs.

            1  +namespace SQLite.Designer
            2  +{
            3  +  using System;
            4  +  using System.Collections.Generic;
            5  +  using System.ComponentModel;
            6  +  using System.Data;
            7  +  using System.Drawing;
            8  +  using System.Text;
            9  +  using System.Windows.Forms;
           10  +  using Microsoft.VisualStudio.Data;
           11  +  using System.Windows.Forms.Design;
           12  +  using Microsoft.VisualStudio.Shell.Interop;
           13  +  using Microsoft.VisualStudio;
           14  +  using System.Data.Common;
           15  +
           16  +  public partial class ChangePasswordDialog : Form
           17  +  {
           18  +    internal string Password = null;
           19  +
           20  +    private SQLiteConnectionProperties _props;
           21  +
           22  +    internal ChangePasswordDialog(SQLiteConnectionProperties props)
           23  +    {
           24  +      _props = props;
           25  +      InitializeComponent();
           26  +
           27  +      password.Text = _props["Password"] as string;
           28  +    }
           29  +
           30  +    private void password_TextChanged(object sender, EventArgs e)
           31  +    {
           32  +      if (String.IsNullOrEmpty(password.Text) || password.Text == _props["Password"] as string)
           33  +      {
           34  +        confirmLabel.Enabled = false;
           35  +        passwordConfirm.Enabled = false;
           36  +        passwordConfirm.Text = "";
           37  +
           38  +        if (String.IsNullOrEmpty(password.Text) && _props["Password"] != null)
           39  +          action.Text = VSPackage.Decrypt;
           40  +        else
           41  +          action.Text = "";
           42  +      }
           43  +      else
           44  +      {
           45  +        confirmLabel.Enabled = true;
           46  +        passwordConfirm.Enabled = true;
           47  +
           48  +        if (_props["Password"] != null)
           49  +          action.Text = VSPackage.ReEncrypt;
           50  +        else
           51  +          action.Text = VSPackage.Encrypt;
           52  +      }
           53  +
           54  +      okButton.Enabled = (password.Text == passwordConfirm.Text);
           55  +    }
           56  +
           57  +    private void okButton_Click(object sender, EventArgs e)
           58  +    {
           59  +      Password = password.Text;
           60  +      DialogResult = DialogResult.OK;
           61  +      Close();
           62  +    }
           63  +  }
           64  +}

Added SQLite.Designer/ChangePasswordDialog.resx.

            1  +<?xml version="1.0" encoding="utf-8"?>
            2  +<root>
            3  +  <!-- 
            4  +    Microsoft ResX Schema 
            5  +    
            6  +    Version 2.0
            7  +    
            8  +    The primary goals of this format is to allow a simple XML format 
            9  +    that is mostly human readable. The generation and parsing of the 
           10  +    various data types are done through the TypeConverter classes 
           11  +    associated with the data types.
           12  +    
           13  +    Example:
           14  +    
           15  +    ... ado.net/XML headers & schema ...
           16  +    <resheader name="resmimetype">text/microsoft-resx</resheader>
           17  +    <resheader name="version">2.0</resheader>
           18  +    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
           19  +    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
           20  +    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
           21  +    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
           22  +    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
           23  +        <value>[base64 mime encoded serialized .NET Framework object]</value>
           24  +    </data>
           25  +    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
           26  +        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
           27  +        <comment>This is a comment</comment>
           28  +    </data>
           29  +                
           30  +    There are any number of "resheader" rows that contain simple 
           31  +    name/value pairs.
           32  +    
           33  +    Each data row contains a name, and value. The row also contains a 
           34  +    type or mimetype. Type corresponds to a .NET class that support 
           35  +    text/value conversion through the TypeConverter architecture. 
           36  +    Classes that don't support this are serialized and stored with the 
           37  +    mimetype set.
           38  +    
           39  +    The mimetype is used for serialized objects, and tells the 
           40  +    ResXResourceReader how to depersist the object. This is currently not 
           41  +    extensible. For a given mimetype the value must be set accordingly:
           42  +    
           43  +    Note - application/x-microsoft.net.object.binary.base64 is the format 
           44  +    that the ResXResourceWriter will generate, however the reader can 
           45  +    read any of the formats listed below.
           46  +    
           47  +    mimetype: application/x-microsoft.net.object.binary.base64
           48  +    value   : The object must be serialized with 
           49  +            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
           50  +            : and then encoded with base64 encoding.
           51  +    
           52  +    mimetype: application/x-microsoft.net.object.soap.base64
           53  +    value   : The object must be serialized with 
           54  +            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
           55  +            : and then encoded with base64 encoding.
           56  +
           57  +    mimetype: application/x-microsoft.net.object.bytearray.base64
           58  +    value   : The object must be serialized into a byte array 
           59  +            : using a System.ComponentModel.TypeConverter
           60  +            : and then encoded with base64 encoding.
           61  +    -->
           62  +  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
           63  +    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
           64  +    <xsd:element name="root" msdata:IsDataSet="true">
           65  +      <xsd:complexType>
           66  +        <xsd:choice maxOccurs="unbounded">
           67  +          <xsd:element name="metadata">
           68  +            <xsd:complexType>
           69  +              <xsd:sequence>
           70  +                <xsd:element name="value" type="xsd:string" minOccurs="0" />
           71  +              </xsd:sequence>
           72  +              <xsd:attribute name="name" use="required" type="xsd:string" />
           73  +              <xsd:attribute name="type" type="xsd:string" />
           74  +              <xsd:attribute name="mimetype" type="xsd:string" />
           75  +              <xsd:attribute ref="xml:space" />
           76  +            </xsd:complexType>
           77  +          </xsd:element>
           78  +          <xsd:element name="assembly">
           79  +            <xsd:complexType>
           80  +              <xsd:attribute name="alias" type="xsd:string" />
           81  +              <xsd:attribute name="name" type="xsd:string" />
           82  +            </xsd:complexType>
           83  +          </xsd:element>
           84  +          <xsd:element name="data">
           85  +            <xsd:complexType>
           86  +              <xsd:sequence>
           87  +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
           88  +                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
           89  +              </xsd:sequence>
           90  +              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
           91  +              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
           92  +              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
           93  +              <xsd:attribute ref="xml:space" />
           94  +            </xsd:complexType>
           95  +          </xsd:element>
           96  +          <xsd:element name="resheader">
           97  +            <xsd:complexType>
           98  +              <xsd:sequence>
           99  +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
          100  +              </xsd:sequence>
          101  +              <xsd:attribute name="name" type="xsd:string" use="required" />
          102  +            </xsd:complexType>
          103  +          </xsd:element>
          104  +        </xsd:choice>
          105  +      </xsd:complexType>
          106  +    </xsd:element>
          107  +  </xsd:schema>
          108  +  <resheader name="resmimetype">
          109  +    <value>text/microsoft-resx</value>
          110  +  </resheader>
          111  +  <resheader name="version">
          112  +    <value>2.0</value>
          113  +  </resheader>
          114  +  <resheader name="reader">
          115  +    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
          116  +  </resheader>
          117  +  <resheader name="writer">
          118  +    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
          119  +  </resheader>
          120  +  <metadata name="cancelButton.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          121  +    <value>False</value>
          122  +  </metadata>
          123  +  <metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          124  +    <value>False</value>
          125  +  </metadata>
          126  +</root>

Added SQLite.Designer/Design/Column.cs.

            1  +using System;
            2  +using System.Collections.Generic;
            3  +using System.Text;
            4  +using System.ComponentModel;
            5  +using System.ComponentModel.Design;
            6  +using System.Windows.Forms;
            7  +using System.Drawing.Design;
            8  +
            9  +namespace SQLite.Designer.Design
           10  +{
           11  +  internal class Column
           12  +  {
           13  +    private bool _allowNulls = false;
           14  +    private string _dataType = "";
           15  +    private string _defaultValue = "";
           16  +    private string _columnName = "";
           17  +    private CollationTypeEnum _collate = CollationTypeEnum.Binary;
           18  +    private DataGridViewRow _parent;
           19  +    private string _checkconstraint = "";
           20  +    private Unique _unique;
           21  +    private PrimaryKey _primaryKey;
           22  +    private Table _table;
           23  +
           24  +    internal Column(DataGridViewRow row)
           25  +    {
           26  +      _parent = row;
           27  +      _table = row.Tag as Table;
           28  +      _unique = new Unique(this);
           29  +      _primaryKey = new PrimaryKey(this);
           30  +    }
           31  +
           32  +    [Browsable(false)]
           33  +    internal Table Table
           34  +    {
           35  +      get { return _table; }
           36  +    }
           37  +
           38  +    internal void RefreshGrid()
           39  +    {
           40  +      _parent.DataGridView.Refresh();
           41  +    }
           42  +
           43  +    internal void CellValueChanged()
           44  +    {
           45  +      if (_parent.DataGridView.CurrentCell.RowIndex != _parent.Index) return;
           46  +
           47  +      object value;
           48  +
           49  +      if (_parent.DataGridView.CurrentCell.IsInEditMode == true)
           50  +      {
           51  +        if (_parent.DataGridView.EditingControl != null)
           52  +          value = ((IDataGridViewEditingControl)_parent.DataGridView.EditingControl).EditingControlFormattedValue;
           53  +        else
           54  +          value = _parent.DataGridView.CurrentCell.EditedFormattedValue;
           55  +      }
           56  +      else
           57  +        value = _parent.DataGridView.CurrentCell.Value;
           58  +
           59  +      switch (_parent.DataGridView.CurrentCell.ColumnIndex)
           60  +      {
           61  +        case 0:
           62  +          ColumnName = value.ToString();
           63  +          break;
           64  +        case 1:
           65  +          DataType = value.ToString();
           66  +          break;
           67  +        case 2:
           68  +          AllowNulls = Convert.ToBoolean(value);
           69  +          break;
           70  +      }
           71  +    }
           72  +
           73  +    [DisplayName("Check")]
           74  +    [Category("Constraints")]
           75  +    public virtual string CheckConstraint
           76  +    {
           77  +      get { return _checkconstraint; }
           78  +      set { _checkconstraint = value; }
           79  +    }
           80  +
           81  +    [DefaultValue(CollationTypeEnum.Binary)]
           82  +    [Category("Constraints")]
           83  +    public virtual CollationTypeEnum CollationType
           84  +    {
           85  +      get { return _collate; }
           86  +      set { _collate = value; }
           87  +    }
           88  +
           89  +    [Category("Constraints")]
           90  +    public virtual Unique Unique
           91  +    {
           92  +      get { return _unique; }
           93  +    }
           94  +
           95  +    [Browsable(false)]
           96  +    public virtual string ColumnName
           97  +    {
           98  +      get { return _columnName; }
           99  +      set { _columnName = value; }
          100  +    }
          101  +
          102  +    [DisplayName("Primary Key")]
          103  +    [Category("Constraints")]
          104  +    public virtual PrimaryKey PrimaryKey
          105  +    {
          106  +      get { return _primaryKey; }
          107  +    }
          108  +
          109  +    [DefaultValue(false)]
          110  +    [DisplayName("Allow Nulls")]
          111  +    [Category("Constraints")]
          112  +    public virtual bool AllowNulls
          113  +    {
          114  +      get { return _allowNulls; }
          115  +      set
          116  +      {
          117  +        if (value != _allowNulls)
          118  +        {
          119  +          _allowNulls = value;
          120  +          _parent.Cells[2].Value = _allowNulls;
          121  +        }
          122  +      }
          123  +    }
          124  +
          125  +    [Browsable(false)]
          126  +    public virtual string DataType
          127  +    {
          128  +      get { return _dataType; }
          129  +      set { _dataType = value; }
          130  +    }
          131  +
          132  +    [DisplayName("Default Value")]
          133  +    [Category("Constraints")]
          134  +    public virtual string DefaultValue
          135  +    {
          136  +      get { return _defaultValue; }
          137  +      set { _defaultValue = value; }
          138  +    }
          139  +  }
          140  +
          141  +  public enum CollationTypeEnum
          142  +  {
          143  +    Binary = 0,
          144  +    CaseInsensitive = 1,
          145  +  }
          146  +}

Added SQLite.Designer/Design/PrimaryKey.cs.

            1  +using System;
            2  +using System.Collections.Generic;
            3  +using System.Text;
            4  +using System.ComponentModel;
            5  +
            6  +namespace SQLite.Designer.Design
            7  +{
            8  +  [TypeConverter(typeof(ExpandableObjectConverter))]
            9  +  internal class PrimaryKey
           10  +  {
           11  +    private bool _primaryKey;
           12  +    private bool _autoIncrement;
           13  +    private IndexDirection _direction;
           14  +    private ConflictEnum _conflict;
           15  +    Column _column;
           16  +
           17  +    internal PrimaryKey(Column col)
           18  +    {
           19  +      _column = col;
           20  +    }
           21  +
           22  +    [RefreshProperties(RefreshProperties.All)]
           23  +    [DefaultValue(false)]
           24  +    public bool Enabled
           25  +    {
           26  +      get { return _primaryKey; }
           27  +      set
           28  +      {
           29  +        _primaryKey = value;
           30  +
           31  +        if (_primaryKey == false)
           32  +          AutoIncrement = false;
           33  +
           34  +        _column.RefreshGrid();
           35  +      }
           36  +    }
           37  +
           38  +    [RefreshProperties(RefreshProperties.All)]
           39  +    [DefaultValue(false)]
           40  +    [DisplayName("Auto Increment")]
           41  +    public bool AutoIncrement
           42  +    {
           43  +      get { return _autoIncrement; }
           44  +      set
           45  +      {
           46  +        if (_primaryKey == false && value == true)
           47  +          Enabled = true;
           48  +
           49  +        _autoIncrement = value;
           50  +      }
           51  +    }
           52  +
           53  +    [DefaultValue(ConflictEnum.Abort)]
           54  +    [DisplayName("On Conflict")]
           55  +    public ConflictEnum Conflict
           56  +    {
           57  +      get { return _conflict; }
           58  +      set { _conflict = value; }
           59  +    }
           60  +
           61  +    [DefaultValue(IndexDirection.Ascending)]
           62  +    [DisplayName("Sort Mode")]
           63  +    public IndexDirection SortMode
           64  +    {
           65  +      get { return _direction; }
           66  +      set { _direction = value; }
           67  +    }
           68  +
           69  +    public override string ToString()
           70  +    {
           71  +      return Enabled.ToString();
           72  +    }
           73  +  }
           74  +
           75  +  internal enum IndexDirection
           76  +  {
           77  +    Ascending = 0,
           78  +    Descending = 1,
           79  +  }
           80  +}

Added SQLite.Designer/Design/Table.cs.

            1  +namespace SQLite.Designer.Design
            2  +{
            3  +  using System;
            4  +  using System.Data.Common;
            5  +  using System.ComponentModel.Design;
            6  +  using System.ComponentModel;
            7  +  using System.Drawing.Design;
            8  +  using System.Data;
            9  +  using SQLite.Designer.Editors;
           10  +
           11  +  internal class Table
           12  +  {
           13  +    private string _name;
           14  +    string _catalog;
           15  +
           16  +    internal TableDesignerDoc _owner;
           17  +    internal DbConnection _connection;
           18  +    internal Table(string tableName, DbConnection connection, TableDesignerDoc owner)
           19  +    {
           20  +      _owner = owner;
           21  +      _connection = connection;
           22  +      Name = tableName;
           23  +      Catalog = _connection.Database; // main
           24  +    }
           25  +
           26  +    [Category("Storage")]
           27  +    [RefreshProperties(RefreshProperties.All)]
           28  +    public string Name
           29  +    {
           30  +      get { return _name; }
           31  +      set
           32  +      {
           33  +        _name = value;
           34  +        _owner.Name = value;
           35  +      }
           36  +    }
           37  +
           38  +    [Category("Storage")]
           39  +    [Editor(typeof(CatalogTypeEditor), typeof(UITypeEditor))]
           40  +    [DefaultValue("main")]
           41  +    [RefreshProperties(RefreshProperties.All)]
           42  +    public string Catalog
           43  +    {
           44  +      get { return _catalog; }
           45  +      set
           46  +      {
           47  +        string catalogs = "";
           48  +        using (DataTable table = _connection.GetSchema("Catalogs"))
           49  +        {
           50  +          foreach (DataRow row in table.Rows)
           51  +          {
           52  +            catalogs += (row[0].ToString() + ",");
           53  +          }
           54  +        }
           55  +
           56  +        if (catalogs.IndexOf(value + ",", StringComparison.OrdinalIgnoreCase) == -1)
           57  +          throw new ArgumentOutOfRangeException("Unrecognized catalog!");
           58  +
           59  +        _catalog = value;
           60  +      }
           61  +    }
           62  +  }
           63  +
           64  +  internal class CatalogTypeEditor : ObjectSelectorEditor
           65  +  {
           66  +    public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
           67  +    {
           68  +      return UITypeEditorEditStyle.DropDown;
           69  +    }
           70  +
           71  +    protected override void FillTreeWithData(Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
           72  +    {
           73  +      base.FillTreeWithData(selector, context, provider);
           74  +      Table source = context.Instance as Table;
           75  +
           76  +      if (source == null) return;
           77  +
           78  +      using (DataTable table = source._connection.GetSchema("Catalogs"))
           79  +      {
           80  +        foreach (DataRow row in table.Rows)
           81  +        {
           82  +          selector.AddNode(row[0].ToString(), row[0], null);
           83  +        }
           84  +      }
           85  +    }
           86  +  }
           87  +}

Added SQLite.Designer/Design/Unique.cs.

            1  +using System;
            2  +using System.Collections.Generic;
            3  +using System.Text;
            4  +using System.ComponentModel;
            5  +
            6  +namespace SQLite.Designer.Design
            7  +{
            8  +  [TypeConverter(typeof(ExpandableObjectConverter))]
            9  +  internal class Unique
           10  +  {
           11  +    private bool _isUnique;
           12  +    private ConflictEnum _conflict;
           13  +    private Column _column;
           14  +
           15  +    internal Unique(Column col)
           16  +    {
           17  +      _column = col;
           18  +    }
           19  +
           20  +    [DefaultValue(false)]
           21  +    [DisplayName("Enabled")]
           22  +    public bool Enabled
           23  +    {
           24  +      get { return _isUnique; }
           25  +      set { _isUnique = value; }
           26  +    }
           27  +
           28  +    [DefaultValue(ConflictEnum.Abort)]
           29  +    [DisplayName("On Conflict")]
           30  +    public ConflictEnum Conflict
           31  +    {
           32  +      get { return _conflict; }
           33  +      set { _conflict = value; }
           34  +    }
           35  +
           36  +    public override string ToString()
           37  +    {
           38  +      if (_isUnique == false)
           39  +        return Convert.ToString(false);
           40  +      else
           41  +        return String.Format("{0} ({1})", Convert.ToString(true), Convert.ToString(Conflict));
           42  +    }
           43  +  }
           44  +
           45  +  public enum ConflictEnum
           46  +  {
           47  +    Abort = 0,
           48  +    Rollback,
           49  +    Fail,
           50  +    Ignore,
           51  +    Replace,
           52  +  }
           53  +}

Added SQLite.Designer/Editors/AutoCompleteColumn.cs.

            1  +using System;
            2  +using System.Windows.Forms;
            3  +using System.Runtime.InteropServices;
            4  +using System.Drawing;
            5  +
            6  +namespace SQLite.Designer.Editors
            7  +{
            8  +  public class DbGridView : DataGridView
            9  +  {
           10  +    private TableDesignerDoc _owner = null;
           11  +
           12  +    public override void NotifyCurrentCellDirty(bool dirty)
           13  +    {
           14  +      base.NotifyCurrentCellDirty(dirty);
           15  +      SQLite.Designer.Design.Column col = Rows[CurrentCell.RowIndex].Tag as SQLite.Designer.Design.Column;
           16  +
           17  +      if (col == null && CurrentRow.IsNewRow == false)
           18  +      {
           19  +        col = new SQLite.Designer.Design.Column(Rows[CurrentCell.RowIndex]);
           20  +        Rows[CurrentCell.RowIndex].Tag = col;
           21  +        base.OnSelectionChanged(new EventArgs());
           22  +      }
           23  +      if (col != null)
           24  +        col.CellValueChanged();
           25  +
           26  +      if (_owner == null)
           27  +      {
           28  +        Control ctl = this;
           29  +
           30  +        while (ctl.GetType() != typeof(TableDesignerDoc))
           31  +        {
           32  +          ctl = ctl.Parent;
           33  +          if (ctl == null) break;
           34  +        }
           35  +        if (ctl != null) _owner = ctl as TableDesignerDoc;
           36  +      }
           37  +
           38  +      if (_owner != null)
           39  +        _owner.RefreshToolbars();
           40  +    }
           41  +  }
           42  +
           43  +  public class AutoCompleteColumn : DataGridViewColumn
           44  +  {
           45  +    public AutoCompleteColumn()
           46  +      : base(new AutoCompleteCell())
           47  +    {
           48  +    }
           49  +  }
           50  +
           51  +  public class AutoCompleteCell : DataGridViewTextBoxCell
           52  +  {
           53  +    public override Type EditType
           54  +    {
           55  +      get
           56  +      {
           57  +        return typeof(AutoCompleteEditingControl);
           58  +      }
           59  +    }
           60  +
           61  +    protected override bool SetValue(int rowIndex, object value)
           62  +    {
           63  +      return base.SetValue(rowIndex, value);
           64  +    }
           65  +  }
           66  +
           67  +  public class AutoCompleteEditingControl : DataGridViewComboBoxEditingControl
           68  +  {
           69  +    private bool inPrepare = false;
           70  +    private bool isDeleting = false;
           71  +
           72  +    public override object EditingControlFormattedValue
           73  +    {
           74  +      get
           75  +      {
           76  +        return base.Text;
           77  +      }
           78  +      set
           79  +      {
           80  +        base.Text = value as string;
           81  +      }
           82  +    }
           83  +
           84  +    public override void PrepareEditingControlForEdit(bool selectAll)
           85  +    {
           86  +      inPrepare = true;
           87  +      base.PrepareEditingControlForEdit(selectAll);
           88  +      if (base.Items.Count == 0)
           89  +      {
           90  +        base.Items.Add("integer");
           91  +        base.Items.Add("smallint");
           92  +        base.Items.Add("tinyint");
           93  +        base.Items.Add("bit");
           94  +        base.Items.Add("varchar(50)");
           95  +        base.Items.Add("nvarchar(50)");
           96  +        base.Items.Add("text");
           97  +        base.Items.Add("ntext");
           98  +        base.Items.Add("image");
           99  +        base.Items.Add("money");
          100  +        base.Items.Add("float");
          101  +        base.Items.Add("real");
          102  +        base.Items.Add("numeric(18,0)");
          103  +        base.Items.Add("char(10)");
          104  +        base.Items.Add("nchar(10)");
          105  +        base.Items.Add("datetime");
          106  +        base.Items.Add("guid");
          107  +      }
          108  +      base.DropDownStyle = ComboBoxStyle.DropDown;
          109  +      base.Text = EditingControlDataGridView.CurrentCell.Value as string;
          110  +      
          111  +      if (selectAll)
          112  +        base.SelectAll();
          113  +
          114  +      inPrepare = false;
          115  +    }
          116  +
          117  +    public override bool EditingControlWantsInputKey(Keys keyData, bool dataGridViewWantsInputKey)
          118  +    {
          119  +      isDeleting = false;
          120  +
          121  +      switch (keyData & Keys.KeyCode)
          122  +      {
          123  +        case Keys.Delete:
          124  +        case Keys.Back:
          125  +          isDeleting = true;
          126  +          break;
          127  +      }
          128  +
          129  +      if (((keyData & Keys.KeyCode) == Keys.Left && (base.SelectionStart > 0 ||  base.SelectionLength > 0))
          130  +        || ((keyData & Keys.KeyCode) == Keys.Right && (base.SelectionStart < base.Text.Length ||  base.SelectionLength > 0))
          131  +        || (((keyData & Keys.KeyCode) == Keys.Home || (keyData & Keys.KeyCode) == Keys.End) && base.SelectionLength != base.Text.Length)
          132  +        )
          133  +      {
          134  +        return true;
          135  +      }
          136  +
          137  +      return base.EditingControlWantsInputKey(keyData, dataGridViewWantsInputKey);
          138  +    }
          139  +
          140  +    protected override void OnTextChanged(EventArgs e)
          141  +    {
          142  +      if (inPrepare) return;
          143  +      base.OnTextChanged(e);
          144  +
          145  +      bool changed = !(EditingControlDataGridView.CurrentCell.Value as string == base.Text ||
          146  +                     (String.IsNullOrEmpty(base.Text) && String.IsNullOrEmpty(EditingControlDataGridView.CurrentCell.Value as string)));
          147  +
          148  +      if ((base.SelectionLength == 0 || base.SelectionStart == base.Text.Length) && isDeleting == false)
          149  +      {
          150  +        if (base.Items.Contains(base.Text) == false)
          151  +        {
          152  +          for (int n = 0; n < base.Items.Count; n++)
          153  +          {
          154  +            if (((string)base.Items[n]).StartsWith(base.Text, StringComparison.OrdinalIgnoreCase) == true)
          155  +            {
          156  +              int start = base.SelectionStart;
          157  +              inPrepare = true;
          158  +              
          159  +              base.Text = base.Items[n] as string;
          160  +              base.SelectionStart = start;
          161  +              base.SelectionLength = base.Text.Length - start;
          162  +
          163  +              inPrepare = false;
          164  +              break;
          165  +            }
          166  +          }
          167  +        }
          168  +      }
          169  +      EditingControlValueChanged = changed;
          170  +      EditingControlDataGridView.NotifyCurrentCellDirty(changed);
          171  +    }
          172  +  }
          173  +}

Added SQLite.Designer/Editors/TableDesignerDoc.Designer.cs.

            1  +namespace SQLite.Designer.Editors
            2  +{
            3  +  partial class TableDesignerDoc
            4  +  {
            5  +    /// <summary>
            6  +    /// Required designer variable.
            7  +    /// </summary>
            8  +    private System.ComponentModel.IContainer components = null;
            9  +
           10  +    /// <summary>
           11  +    /// Clean up any resources being used.
           12  +    /// </summary>
           13  +    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
           14  +    protected override void Dispose(bool disposing)
           15  +    {
           16  +      if (disposing && (components != null))
           17  +      {
           18  +        components.Dispose();
           19  +      }
           20  +
           21  +      _editingTables.Remove(GetHashCode());
           22  +
           23  +      base.Dispose(disposing);
           24  +    }
           25  +
           26  +    #region Windows Form Designer generated code
           27  +
           28  +    /// <summary>
           29  +    /// Required method for Designer support - do not modify
           30  +    /// the contents of this method with the code editor.
           31  +    /// </summary>
           32  +    private void InitializeComponent()
           33  +    {
           34  +      this.components = new System.ComponentModel.Container();
           35  +      System.Windows.Forms.SplitContainer _splitter;
           36  +      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TableDesignerDoc));
           37  +      this._dataGrid = new SQLite.Designer.Editors.DbGridView();
           38  +      this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();
           39  +      this.type = new SQLite.Designer.Editors.AutoCompleteColumn();
           40  +      this.isnull = new System.Windows.Forms.DataGridViewCheckBoxColumn();
           41  +      this._propertyGrid = new System.Windows.Forms.PropertyGrid();
           42  +      this.autoCompleteColumn1 = new SQLite.Designer.Editors.AutoCompleteColumn();
           43  +      this._imageList = new System.Windows.Forms.ImageList(this.components);
           44  +      _splitter = new System.Windows.Forms.SplitContainer();
           45  +      _splitter.Panel1.SuspendLayout();
           46  +      _splitter.Panel2.SuspendLayout();
           47  +      _splitter.SuspendLayout();
           48  +      ((System.ComponentModel.ISupportInitialize)(this._dataGrid)).BeginInit();
           49  +      this.SuspendLayout();
           50  +      // 
           51  +      // _splitter
           52  +      // 
           53  +      _splitter.BackColor = System.Drawing.SystemColors.Control;
           54  +      _splitter.Dock = System.Windows.Forms.DockStyle.Fill;
           55  +      _splitter.Location = new System.Drawing.Point(0, 0);
           56  +      _splitter.Name = "_splitter";
           57  +      _splitter.Orientation = System.Windows.Forms.Orientation.Horizontal;
           58  +      // 
           59  +      // _splitter.Panel1
           60  +      // 
           61  +      _splitter.Panel1.Controls.Add(this._dataGrid);
           62  +      // 
           63  +      // _splitter.Panel2
           64  +      // 
           65  +      _splitter.Panel2.Controls.Add(this._propertyGrid);
           66  +      _splitter.Size = new System.Drawing.Size(436, 401);
           67  +      _splitter.SplitterDistance = 197;
           68  +      _splitter.TabIndex = 0;
           69  +      // 
           70  +      // _dataGrid
           71  +      // 
           72  +      this._dataGrid.AllowUserToResizeRows = false;
           73  +      this._dataGrid.BackgroundColor = System.Drawing.SystemColors.Window;
           74  +      this._dataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
           75  +      this._dataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
           76  +            this.name,
           77  +            this.type,
           78  +            this.isnull});
           79  +      this._dataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
           80  +      this._dataGrid.Location = new System.Drawing.Point(0, 0);
           81  +      this._dataGrid.Name = "_dataGrid";
           82  +      this._dataGrid.RowHeadersWidth = 42;
           83  +      this._dataGrid.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
           84  +      this._dataGrid.RowTemplate.Height = 23;
           85  +      this._dataGrid.Size = new System.Drawing.Size(436, 197);
           86  +      this._dataGrid.TabIndex = 1;
           87  +      this._dataGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this._dataGrid_CellClick);
           88  +      this._dataGrid.RowHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this._dataGrid_RowHeaderMouseClick);
           89  +      this._dataGrid.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this._dataGrid_CellPainting);
           90  +      this._dataGrid.UserDeletedRow += new System.Windows.Forms.DataGridViewRowEventHandler(this._dataGrid_UserDeletedRow);
           91  +      this._dataGrid.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this._dataGrid_CellValueChanged);
           92  +      this._dataGrid.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this._dataGrid_CellEnter);
           93  +      this._dataGrid.SelectionChanged += new System.EventHandler(this._dataGrid_SelectionChanged);
           94  +      // 
           95  +      // name
           96  +      // 
           97  +      this.name.Frozen = true;
           98  +      this.name.HeaderText = "Column Name";
           99  +      this.name.Name = "name";
          100  +      this.name.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
          101  +      // 
          102  +      // type
          103  +      // 
          104  +      this.type.HeaderText = "Data Type";
          105  +      this.type.Name = "type";
          106  +      // 
          107  +      // isnull
          108  +      // 
          109  +      this.isnull.HeaderText = "Allow Nulls";
          110  +      this.isnull.Name = "isnull";
          111  +      // 
          112  +      // _propertyGrid
          113  +      // 
          114  +      this._propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
          115  +      this._propertyGrid.Location = new System.Drawing.Point(0, 0);
          116  +      this._propertyGrid.Name = "_propertyGrid";
          117  +      this._propertyGrid.Size = new System.Drawing.Size(436, 200);
          118  +      this._propertyGrid.TabIndex = 0;
          119  +      // 
          120  +      // autoCompleteColumn1
          121  +      // 
          122  +      this.autoCompleteColumn1.HeaderText = "Data Type";
          123  +      this.autoCompleteColumn1.Name = "autoCompleteColumn1";
          124  +      this.autoCompleteColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.True;
          125  +      this.autoCompleteColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
          126  +      // 
          127  +      // _imageList
          128  +      // 
          129  +      this._imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("_imageList.ImageStream")));
          130  +      this._imageList.TransparentColor = System.Drawing.Color.Magenta;
          131  +      this._imageList.Images.SetKeyName(0, "PrimaryKey.bmp");
          132  +      // 
          133  +      // TableDesignerDoc
          134  +      // 
          135  +      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
          136  +      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
          137  +      this.BackColor = System.Drawing.SystemColors.Window;
          138  +      this.Controls.Add(_splitter);
          139  +      this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
          140  +      this.Name = "TableDesignerDoc";
          141  +      this.Size = new System.Drawing.Size(436, 401);
          142  +      _splitter.Panel1.ResumeLayout(false);
          143  +      _splitter.Panel2.ResumeLayout(false);
          144  +      _splitter.ResumeLayout(false);
          145  +      ((System.ComponentModel.ISupportInitialize)(this._dataGrid)).EndInit();
          146  +      this.ResumeLayout(false);
          147  +
          148  +    }
          149  +
          150  +    #endregion
          151  +
          152  +    private DbGridView _dataGrid;
          153  +    private System.Windows.Forms.PropertyGrid _propertyGrid;
          154  +    private AutoCompleteColumn autoCompleteColumn1;
          155  +    private System.Windows.Forms.DataGridViewTextBoxColumn name;
          156  +    private AutoCompleteColumn type;
          157  +    private System.Windows.Forms.DataGridViewCheckBoxColumn isnull;
          158  +    private System.Windows.Forms.ImageList _imageList;
          159  +
          160  +  }
          161  +}

Added SQLite.Designer/Editors/TableDesignerDoc.cs.

            1  +namespace SQLite.Designer.Editors
            2  +{
            3  +  using System;
            4  +  using System.Collections.Generic;
            5  +  using System.ComponentModel;
            6  +  using System.Data;
            7  +  using System.Data.Common;
            8  +  using System.Drawing;
            9  +  using System.Text;
           10  +  using System.Windows.Forms;
           11  +  using Microsoft.VisualStudio.Shell.Interop;
           12  +  using Microsoft.VisualStudio.OLE.Interop;
           13  +  using Microsoft.VisualStudio;
           14  +  using Microsoft.VisualStudio.Data;
           15  +  using SQLite.Designer.Design;
           16  +
           17  +  public partial class TableDesignerDoc : UserControl,
           18  +    IVsPersistDocData,
           19  +    IVsWindowPane,
           20  +    IOleCommandTarget,
           21  +    ISelectionContainer,
           22  +    IVsWindowPaneCommit,
           23  +    IVsWindowFrameNotify
           24  +  {
           25  +    private static Dictionary<int, string> _editingTables = new Dictionary<int, string>();
           26  +    
           27  +    internal DataConnection _connection;
           28  +    internal Microsoft.VisualStudio.Data.ServiceProvider _serviceProvider;
           29  +    internal Table _table;
           30  +
           31  +    public TableDesignerDoc(DataConnection cnn, string tableName)
           32  +    {
           33  +      _connection = cnn;
           34  +
           35  +      InitializeComponent();
           36  +
           37  +      StringBuilder tables = new StringBuilder();
           38  +
           39  +      using (DataReader reader = cnn.Command.Execute("SELECT * FROM sqlite_master", 1, null, 30))
           40  +      {
           41  +        while (reader.Read())
           42  +        {
           43  +          tables.Append(reader.GetItem(2).ToString());
           44  +          tables.Append(",");
           45  +        }
           46  +      }
           47  +
           48  +      int n = 1;
           49  +
           50  +      if (String.IsNullOrEmpty(tableName))
           51  +      {
           52  +        string alltables = tables.ToString();
           53  +
           54  +        do
           55  +        {
           56  +          tableName = String.Format("Table{0}", n);
           57  +          n++;
           58  +        } while (alltables.IndexOf(tableName + ",", StringComparison.OrdinalIgnoreCase) > -1 || _editingTables.ContainsValue(tableName));
           59  +
           60  +        _editingTables.Add(GetHashCode(), tableName);
           61  +      }
           62  +      _table = new Table(tableName, _connection.ConnectionSupport.ProviderObject as DbConnection, this);
           63  +    }
           64  +
           65  +    void SetPropertyWindow()
           66  +    {
           67  +      IVsTrackSelectionEx track = _serviceProvider.GetService(typeof(SVsTrackSelectionEx)) as IVsTrackSelectionEx;
           68  +      if (track != null)
           69  +      {
           70  +        track.OnSelectChange(this);
           71  +      }
           72  +    }
           73  +
           74  +    public new string Name
           75  +    {
           76  +      get
           77  +      {
           78  +        if (_table != null)
           79  +          return _table.Name;
           80  +        else return base.Name;
           81  +      }
           82  +      set
           83  +      {
           84  +        string caption = "SQLite:" + value;
           85  +        base.Name = value;
           86  +
           87  +        if (_serviceProvider != null)
           88  +        {
           89  +          IVsWindowFrame frame = _serviceProvider.GetService(typeof(IVsWindowFrame)) as IVsWindowFrame;
           90  +          if (frame != null)
           91  +          {
           92  +            frame.SetProperty((int)__VSFPROPID.VSFPROPID_EditorCaption, value);
           93  +          }
           94  +        }
           95  +      }
           96  +    }
           97  +
           98  +    //public void NotifyChanges()
           99  +    //{
          100  +    //  if (_serviceProvider == null) return;
          101  +
          102  +    //  // Get a reference to the Running Document Table
          103  +    //  IVsRunningDocumentTable runningDocTable = (IVsRunningDocumentTable)_serviceProvider.GetService(typeof(SVsRunningDocumentTable));
          104  +
          105  +    //  // Lock the document
          106  +    //  uint docCookie;
          107  +    //  IVsHierarchy hierarchy;
          108  +    //  uint itemID;
          109  +    //  IntPtr docData;
          110  +    //  int hr = runningDocTable.FindAndLockDocument(
          111  +    //      (uint)_VSRDTFLAGS.RDT_ReadLock,
          112  +    //      base.Name,
          113  +    //      out hierarchy,
          114  +    //      out itemID,
          115  +    //      out docData,
          116  +    //      out docCookie
          117  +    //  );
          118  +    //  ErrorHandler.ThrowOnFailure(hr);
          119  +
          120  +    //  // Send the notification
          121  +    //  hr = runningDocTable.NotifyDocumentChanged(docCookie, (uint)__VSRDTATTRIB.RDTA_DocDataReloaded);
          122  +
          123  +    //  // Unlock the document.
          124  +    //  // Note that we have to unlock the document even if the previous call failed.
          125  +    //  runningDocTable.UnlockDocument((uint)_VSRDTFLAGS.RDT_ReadLock, docCookie);
          126  +
          127  +    //  // Check ff the call to NotifyDocChanged failed.
          128  +    //  ErrorHandler.ThrowOnFailure(hr);
          129  +    //}
          130  +
          131  +    #region IVsPersistDocData Members
          132  +
          133  +    int IVsPersistDocData.Close()
          134  +    {
          135  +      return VSConstants.S_OK;
          136  +    }
          137  +
          138  +    public int GetGuidEditorType(out Guid pClassID)
          139  +    {
          140  +      return ((IPersistFileFormat)this).GetClassID(out pClassID);
          141  +    }
          142  +
          143  +    public int IsDocDataDirty(out int pfDirty)
          144  +    {
          145  +      pfDirty = 1;
          146  +      return VSConstants.S_OK;
          147  +    }
          148  +
          149  +    public int IsDocDataReloadable(out int pfReloadable)
          150  +    {
          151  +      pfReloadable = 0;
          152  +      return VSConstants.S_OK;
          153  +    }
          154  +
          155  +    public int LoadDocData(string pszMkDocument)
          156  +    {
          157  +      return ((IPersistFileFormat)this).Load(pszMkDocument, 0, 0);
          158  +    }
          159  +
          160  +    public int OnRegisterDocData(uint docCookie, IVsHierarchy pHierNew, uint itemidNew)
          161  +    {
          162  +      return VSConstants.S_OK;
          163  +    }
          164  +
          165  +    public int ReloadDocData(uint grfFlags)
          166  +    {
          167  +      return VSConstants.E_NOTIMPL;
          168  +    }
          169  +
          170  +    public int RenameDocData(uint grfAttribs, IVsHierarchy pHierNew, uint itemidNew, string pszMkDocumentNew)
          171  +    {
          172  +      return VSConstants.E_NOTIMPL;
          173  +    }
          174  +
          175  +    public int SaveDocData(VSSAVEFLAGS dwSave, out string pbstrMkDocumentNew, out int pfSaveCanceled)
          176  +    {
          177  +      pbstrMkDocumentNew = _table.Name;
          178  +      pfSaveCanceled = 0;
          179  +
          180  +      return VSConstants.S_OK;
          181  +    }
          182  +
          183  +    public int SetUntitledDocPath(string pszDocDataPath)
          184  +    {
          185  +      return ((IPersistFileFormat)this).InitNew(0);
          186  +    }
          187  +
          188  +    #endregion
          189  +
          190  +    #region IVsWindowPane Members
          191  +
          192  +    public int ClosePane()
          193  +    {
          194  +      this.Dispose(true);
          195  +      return VSConstants.S_OK;
          196  +    }
          197  +
          198  +    public int CreatePaneWindow(IntPtr hwndParent, int x, int y, int cx, int cy, out IntPtr hwnd)
          199  +    {
          200  +      Win32Methods.SetParent(Handle, hwndParent);
          201  +      hwnd = Handle;
          202  +
          203  +      Size = new System.Drawing.Size(cx - x, cy - y);
          204  +      return VSConstants.S_OK;
          205  +    }
          206  +
          207  +    public int GetDefaultSize(Microsoft.VisualStudio.OLE.Interop.SIZE[] size)
          208  +    {
          209  +      if (size.Length >= 1)
          210  +      {
          211  +        size[0].cx = Size.Width;
          212  +        size[0].cy = Size.Height;
          213  +      }
          214  +
          215  +      return VSConstants.S_OK;
          216  +    }
          217  +
          218  +    public int LoadViewState(Microsoft.VisualStudio.OLE.Interop.IStream pStream)
          219  +    {
          220  +      return VSConstants.S_OK;
          221  +    }
          222  +
          223  +    public int SaveViewState(Microsoft.VisualStudio.OLE.Interop.IStream pStream)
          224  +    {
          225  +      return VSConstants.S_OK;
          226  +    }
          227  +
          228  +    public void RefreshToolbars()
          229  +    {
          230  +      if (_serviceProvider == null) return;
          231  +
          232  +      IVsUIShell shell = _serviceProvider.GetService(typeof(IVsUIShell)) as IVsUIShell;
          233  +
          234  +      if (shell != null)
          235  +      {
          236  +        shell.UpdateCommandUI(1);
          237  +      }
          238  +    }
          239  +
          240  +    public int SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider psp)
          241  +    {
          242  +      _serviceProvider = new ServiceProvider(psp);
          243  +      return VSConstants.S_OK;
          244  +    }
          245  +
          246  +    public int TranslateAccelerator(Microsoft.VisualStudio.OLE.Interop.MSG[] lpmsg)
          247  +    {
          248  +      return VSConstants.S_FALSE;
          249  +    }
          250  +
          251  +    #endregion
          252  +
          253  +    #region IOleCommandTarget Members
          254  +
          255  +    public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
          256  +    {
          257  +      return (int)(Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED);
          258  +    }
          259  +
          260  +    public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
          261  +    {
          262  +      System.Diagnostics.Debug.WriteLine(pguidCmdGroup.ToString());
          263  +
          264  +      if (pguidCmdGroup == VSConstants.GUID_VSStandardCommandSet97)
          265  +      {
          266  +        switch ((VSConstants.VSStd97CmdID)prgCmds[0].cmdID)
          267  +        {
          268  +          case VSConstants.VSStd97CmdID.PrimaryKey:
          269  +          case VSConstants.VSStd97CmdID.GenerateChangeScript:
          270  +            prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_ENABLED);
          271  +            System.Diagnostics.Debug.Write(".");
          272  +            break;
          273  +          default:
          274  +            return (int)(Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED);
          275  +        }
          276  +        return VSConstants.S_OK;
          277  +      }
          278  +
          279  +      if (pguidCmdGroup == SQLiteCommandHandler.guidDavinci)
          280  +      {
          281  +        switch (prgCmds[0].cmdID)
          282  +        {
          283  +          case (uint)VSConstants.VSStd97CmdID.ManageRelationships:
          284  +          case (uint)VSConstants.VSStd97CmdID.ManageIndexes:
          285  +          case (uint)VSConstants.VSStd97CmdID.ManageConstraints:
          286  +          //case 10: // Table View -> Custom
          287  +          //case 14: // Table View -> Modify Custom
          288  +          //case 33: // Database Diagram -> Add Table
          289  +          //case 1: // Database Diagram -> Add Related Tables
          290  +          //case 12: // Database Diagram -> Delete From Database
          291  +          //case 51: // Database Diagram -> Remove From Diagram
          292  +          //case 13: // Database Diagram -> Autosize Selected Tables
          293  +          //case 3: // Database Diagram -> Arrange Selection
          294  +          //case 2: // Database Diagram -> Arrange Tables
          295  +          //case 16: // Database Diagram -> Zoom -> 200%
          296  +          //case 17: // Database Diagram -> Zoom -> 150%
          297  +          //case 18: // Database Diagram -> Zoom -> 100%
          298  +          //case 19: // Database Diagram -> Zoom -> 75%
          299  +          //case 20: // Database Diagram -> Zoom -> 50%
          300  +          //case 21: // Database Diagram -> Zoom -> 25%
          301  +          //case 22: // Database Diagram -> Zoom -> 10%
          302  +          //case 24: // Database Diagram -> Zoom -> To Fit
          303  +          //case 6: // Database Diagram -> New Text Annotation
          304  +          //case 15: // Database Diagram -> Set Text Annotation Font
          305  +          //case 7: // Database Diagram -> Show Relationship Labels
          306  +          //case 8: // Database Diagram -> View Page Breaks
          307  +          //case 9: // Database Diagram -> Recalculate Page Breaks
          308  +          //case 43: // Database Diagram -> Copy Diagram to Clipboard
          309  +          //case 41: // Query Designer -> Table Display -> Column Names
          310  +          //case 42: // Query Designer -> Table Display -> Name Only
          311  +          //case 39: // Query Designer -> Add Table
          312  +          case 4: // Insert Column
          313  +          case 5: // Delete Column
          314  +            prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_ENABLED);
          315  +            break;
          316  +          default:
          317  +            return (int)(Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED);
          318  +        }
          319  +        return VSConstants.S_OK;
          320  +      }
          321  +
          322  +      return (int)(Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED);
          323  +    }
          324  +
          325  +    #endregion
          326  +
          327  +    #region ISelectionContainer Members
          328  +
          329  +    int ISelectionContainer.CountObjects(uint dwFlags, out uint pc)
          330  +    {
          331  +      pc = 1;
          332  +      return VSConstants.S_OK;
          333  +    }
          334  +
          335  +    int ISelectionContainer.GetObjects(uint dwFlags, uint cObjects, object[] apUnkObjects)
          336  +    {
          337  +      apUnkObjects[0] = _table;
          338  +      return VSConstants.S_OK;
          339  +    }
          340  +
          341  +    int ISelectionContainer.SelectObjects(uint cSelect, object[] apUnkSelect, uint dwFlags)
          342  +    {
          343  +      apUnkSelect[0] = _table;
          344  +      return VSConstants.S_OK;
          345  +    }
          346  +
          347  +    #endregion
          348  +
          349  +    #region IVsWindowPaneCommit Members
          350  +
          351  +    int IVsWindowPaneCommit.CommitPendingEdit(out int pfCommitFailed)
          352  +    {
          353  +      pfCommitFailed = 0;
          354  +      return VSConstants.S_OK;
          355  +    }
          356  +
          357  +    #endregion
          358  +
          359  +    #region IVsWindowFrameNotify Members
          360  +
          361  +    int IVsWindowFrameNotify.OnDockableChange(int fDockable)
          362  +    {
          363  +      return VSConstants.S_OK;
          364  +    }
          365  +
          366  +    int IVsWindowFrameNotify.OnMove()
          367  +    {
          368  +      return VSConstants.S_OK;
          369  +    }
          370  +
          371  +    int IVsWindowFrameNotify.OnShow(int fShow)
          372  +    {
          373  +      switch ((__FRAMESHOW)fShow)
          374  +      {
          375  +        case __FRAMESHOW.FRAMESHOW_TabActivated:
          376  +        case __FRAMESHOW.FRAMESHOW_WinShown:
          377  +          SetPropertyWindow();
          378  +          break;
          379  +      }
          380  +      return VSConstants.S_OK;
          381  +    }
          382  +
          383  +    int IVsWindowFrameNotify.OnSize()
          384  +    {
          385  +      return VSConstants.S_OK;
          386  +    }
          387  +
          388  +    #endregion
          389  +
          390  +    private void _dataGrid_CellEnter(object sender, DataGridViewCellEventArgs e)
          391  +    {
          392  +      if (e.ColumnIndex > -1)
          393  +      {
          394  +        _dataGrid.BeginEdit(true);
          395  +        _dataGrid_SelectionChanged(sender, e);
          396  +      }
          397  +    }
          398  +
          399  +    private void _dataGrid_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
          400  +    {
          401  +      _dataGrid.EndEdit();
          402  +      if (e.Button == MouseButtons.Right)
          403  +      {
          404  +        IVsUIShell shell = _serviceProvider.GetService(typeof(IVsUIShell)) as IVsUIShell;
          405  +        if (shell != null)
          406  +        {
          407  +          Guid guid;
          408  +          POINTS[] p = new POINTS[1];
          409  +          int ret;
          410  +
          411  +          p[0].x = (short)Control.MousePosition.X;
          412  +          p[0].y = (short)Control.MousePosition.Y;
          413  +
          414  +          guid = new Guid("732abe74-cd80-11d0-a2db-00aa00a3efff");
          415  +
          416  +          ret = shell.ShowContextMenu(0, ref guid, 259, p, this);
          417  +        }
          418  +      }
          419  +    }
          420  +
          421  +    private void _dataGrid_CellClick(object sender, DataGridViewCellEventArgs e)
          422  +    {
          423  +      if (e.ColumnIndex == -1 && e.RowIndex == -1)
          424  +      {
          425  +        _dataGrid.EndEdit();
          426  +      }
          427  +      _dataGrid_SelectionChanged(sender, e);
          428  +    }
          429  +
          430  +    private void _dataGrid_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
          431  +    {
          432  +      if (e.ColumnIndex > -1 || e.RowIndex < 0) return;
          433  +
          434  +      Column col = _dataGrid.Rows[e.RowIndex].Tag as Column;
          435  +
          436  +      if (col == null) return;
          437  +
          438  +      if (col.PrimaryKey.Enabled == true)
          439  +      {
          440  +        e.Paint(e.ClipBounds, DataGridViewPaintParts.All);
          441  +        _imageList.Draw(e.Graphics, e.CellBounds.Left, e.CellBounds.Top + ((e.CellBounds.Bottom - e.CellBounds.Top) - _imageList.ImageSize.Height) / 2, 0);
          442  +        e.Handled = true;
          443  +      }
          444  +    }
          445  +
          446  +    private void _dataGrid_SelectionChanged(object sender, EventArgs e)
          447  +    {
          448  +      List<object> items = new List<object>();
          449  +
          450  +      for (int n = 0; n < _dataGrid.Rows.Count; n++)
          451  +      {
          452  +        if (_dataGrid.Rows[n].Selected || (_dataGrid.CurrentCell.RowIndex == n && _dataGrid.IsCurrentCellInEditMode == true))
          453  +        {
          454  +          if (_dataGrid.Rows[n].Tag != null)
          455  +            items.Add(_dataGrid.Rows[n].Tag);
          456  +        }
          457  +      }
          458  +
          459  +      object[] objs = new object[items.Count];
          460  +      items.CopyTo(objs);
          461  +
          462  +      _propertyGrid.SelectedObjects = objs;
          463  +    }
          464  +
          465  +    private void _dataGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e)
          466  +    {
          467  +      _propertyGrid.SelectedObjects = _propertyGrid.SelectedObjects;
          468  +    }
          469  +
          470  +    private void _dataGrid_UserDeletedRow(object sender, DataGridViewRowEventArgs e)
          471  +    {
          472  +      _dataGrid_SelectionChanged(sender, e);
          473  +    }
          474  +  }
          475  +
          476  +  internal class FakeHierarchy : IVsUIHierarchy, IVsPersistHierarchyItem2
          477  +  {
          478  +    TableDesignerDoc _control;
          479  +    IVsUIHierarchy _owner;
          480  +    Dictionary<uint, IVsHierarchyEvents> _events = new Dictionary<uint, IVsHierarchyEvents>();
          481  +
          482  +    internal FakeHierarchy(TableDesignerDoc control, IVsUIHierarchy owner)
          483  +    {
          484  +      _control = control;
          485  +      _owner = owner;
          486  +    }
          487  +
          488  +    #region IVsUIHierarchy Members
          489  +
          490  +    int IVsUIHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
          491  +    {
          492  +      pdwCookie = 100;
          493  +      while (_events.ContainsKey(pdwCookie))
          494  +        pdwCookie++;
          495  +
          496  +      _events[pdwCookie] = pEventSink;
          497  +
          498  +      return VSConstants.S_OK;
          499  +    }
          500  +
          501  +    int IVsUIHierarchy.Close()
          502  +    {
          503  +      return VSConstants.S_OK;
          504  +    }
          505  +
          506  +    int IVsUIHierarchy.ExecCommand(uint itemid, ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
          507  +    {
          508  +      return VSConstants.E_NOTIMPL;
          509  +    }
          510  +
          511  +    int IVsUIHierarchy.GetCanonicalName(uint itemid, out string pbstrName)
          512  +    {
          513  +      pbstrName = _control._table.Name;
          514  +      return VSConstants.S_OK;
          515  +    }
          516  +
          517  +    int IVsUIHierarchy.GetGuidProperty(uint itemid, int propid, out Guid pguid)
          518  +    {
          519  +      return _owner.GetGuidProperty(itemid, propid, out pguid);
          520  +    }
          521  +
          522  +    int IVsUIHierarchy.GetNestedHierarchy(uint itemid, ref Guid iidHierarchyNested, out IntPtr ppHierarchyNested, out uint pitemidNested)
          523  +    {
          524  +      ppHierarchyNested = IntPtr.Zero;
          525  +      pitemidNested = 0;
          526  +
          527  +      return VSConstants.E_NOTIMPL;
          528  +    }
          529  +
          530  +    int IVsUIHierarchy.GetProperty(uint itemid, int propid, out object pvar)
          531  +    {
          532  +      pvar = null;
          533  +
          534  +      switch ((__VSHPROPID)propid)
          535  +      {
          536  +        case __VSHPROPID.VSHPROPID_AllowEditInRunMode:
          537  +          pvar = true;
          538  +          break;
          539  +        case __VSHPROPID.VSHPROPID_CanBuildFromMemory:
          540  +          pvar = true;
          541  +          break;
          542  +        case __VSHPROPID.VSHPROPID_Caption:
          543  +        case __VSHPROPID.VSHPROPID_SaveName:
          544  +          pvar = _control._table.Name;
          545  +          break;
          546  +        case __VSHPROPID.VSHPROPID_IsHiddenItem:
          547  +          pvar = true;
          548  +          break;
          549  +        case __VSHPROPID.VSHPROPID_IsNewUnsavedItem:
          550  +          pvar = true;
          551  +          break;
          552  +        case __VSHPROPID.VSHPROPID_ShowOnlyItemCaption:
          553  +          pvar = true;
          554  +          break;
          555  +        case __VSHPROPID.VSHPROPID_IconImgList:
          556  +          pvar = 0;
          557  +          break;
          558  +        case __VSHPROPID.VSHPROPID_IconHandle:
          559  +          pvar = null;
          560  +          return VSConstants.S_OK;
          561  +      }
          562  +
          563  +      //switch ((__VSHPROPID2)propid)
          564  +      //{
          565  +      //  case __VSHPROPID2.VSHPROPID_StatusBarClientText:
          566  +      //    pvar = "SQLite Table Editor";
          567  +      //    break;
          568  +      //}
          569  +
          570  +      if (pvar == null)
          571  +        return _owner.GetProperty(itemid, propid, out pvar);
          572  +      else
          573  +        return VSConstants.S_OK;
          574  +    }
          575  +
          576  +    int IVsUIHierarchy.GetSite(out Microsoft.VisualStudio.OLE.Interop.IServiceProvider ppSP)
          577  +    {
          578  +      ppSP = null;
          579  +      return VSConstants.E_NOTIMPL;
          580  +    }
          581  +
          582  +    int IVsUIHierarchy.ParseCanonicalName(string pszName, out uint pitemid)
          583  +    {
          584  +      pitemid = 0;
          585  +      return VSConstants.E_NOTIMPL;
          586  +    }
          587  +
          588  +    int IVsUIHierarchy.QueryClose(out int pfCanClose)
          589  +    {
          590  +      pfCanClose = 1;
          591  +      return VSConstants.S_OK;
          592  +    }
          593  +
          594  +    int IVsUIHierarchy.QueryStatusCommand(uint itemid, ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
          595  +    {
          596  +      return VSConstants.E_NOTIMPL;
          597  +    }
          598  +
          599  +    int IVsUIHierarchy.SetGuidProperty(uint itemid, int propid, ref Guid rguid)
          600  +    {
          601  +      return VSConstants.E_NOTIMPL;
          602  +    }
          603  +
          604  +    int IVsUIHierarchy.SetProperty(uint itemid, int propid, object var)
          605  +    {
          606  +      foreach(IVsHierarchyEvents listener in _events.Values)
          607  +      {
          608  +        listener.OnPropertyChanged(itemid, propid, 0);
          609  +      }
          610  +      return VSConstants.S_OK;
          611  +    }
          612  +
          613  +    int IVsUIHierarchy.SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider psp)
          614  +    {
          615  +      return VSConstants.E_NOTIMPL;
          616  +    }
          617  +
          618  +    int IVsUIHierarchy.UnadviseHierarchyEvents(uint dwCookie)
          619  +    {
          620  +      _events.Remove(dwCookie);
          621  +      return VSConstants.S_OK;
          622  +    }
          623  +
          624  +    int IVsUIHierarchy.Unused0()
          625  +    {
          626  +      return VSConstants.E_NOTIMPL;
          627  +    }
          628  +
          629  +    int IVsUIHierarchy.Unused1()
          630  +    {
          631  +      return VSConstants.E_NOTIMPL;
          632  +    }
          633  +
          634  +    int IVsUIHierarchy.Unused2()
          635  +    {
          636  +      return VSConstants.E_NOTIMPL;
          637  +    }
          638  +
          639  +    int IVsUIHierarchy.Unused3()
          640  +    {
          641  +      return VSConstants.E_NOTIMPL;
          642  +    }
          643  +
          644  +    int IVsUIHierarchy.Unused4()
          645  +    {
          646  +      return VSConstants.E_NOTIMPL;
          647  +    }
          648  +
          649  +    #endregion
          650  +
          651  +    #region IVsHierarchy Members
          652  +
          653  +    int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie)
          654  +    {
          655  +      return ((IVsUIHierarchy)this).AdviseHierarchyEvents(pEventSink, out pdwCookie);
          656  +    }
          657  +
          658  +    int IVsHierarchy.Close()
          659  +    {
          660  +      return ((IVsUIHierarchy)this).Close();
          661  +    }
          662  +
          663  +    int IVsHierarchy.GetCanonicalName(uint itemid, out string pbstrName)
          664  +    {
          665  +      return ((IVsUIHierarchy)this).GetCanonicalName(itemid, out pbstrName);
          666  +    }
          667  +
          668  +    int IVsHierarchy.GetGuidProperty(uint itemid, int propid, out Guid pguid)
          669  +    {
          670  +      return ((IVsUIHierarchy)this).GetGuidProperty(itemid, propid, out pguid);
          671  +    }
          672  +
          673  +    int IVsHierarchy.GetNestedHierarchy(uint itemid, ref Guid iidHierarchyNested, out IntPtr ppHierarchyNested, out uint pitemidNested)
          674  +    {
          675  +      return ((IVsUIHierarchy)this).GetNestedHierarchy(itemid, ref iidHierarchyNested, out ppHierarchyNested, out pitemidNested);
          676  +    }
          677  +
          678  +    int IVsHierarchy.GetProperty(uint itemid, int propid, out object pvar)
          679  +    {
          680  +      return ((IVsUIHierarchy)this).GetProperty(itemid, propid, out pvar);
          681  +    }
          682  +
          683  +    int IVsHierarchy.GetSite(out Microsoft.VisualStudio.OLE.Interop.IServiceProvider ppSP)
          684  +    {
          685  +      ppSP = null;
          686  +      return VSConstants.E_NOTIMPL;
          687  +    }
          688  +
          689  +    int IVsHierarchy.ParseCanonicalName(string pszName, out uint pitemid)
          690  +    {
          691  +      pitemid = 0;
          692  +      return VSConstants.E_NOTIMPL;
          693  +    }
          694  +
          695  +    int IVsHierarchy.QueryClose(out int pfCanClose)
          696  +    {
          697  +      return ((IVsUIHierarchy)this).QueryClose(out pfCanClose);
          698  +    }
          699  +
          700  +    int IVsHierarchy.SetGuidProperty(uint itemid, int propid, ref Guid rguid)
          701  +    {
          702  +      return ((IVsUIHierarchy)this).SetGuidProperty(itemid, propid, ref rguid);
          703  +    }
          704  +
          705  +    int IVsHierarchy.SetProperty(uint itemid, int propid, object var)
          706  +    {
          707  +      return ((IVsUIHierarchy)this).SetProperty(itemid, propid, var);
          708  +    }
          709  +
          710  +    int IVsHierarchy.SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider psp)
          711  +    {
          712  +      return ((IVsUIHierarchy)this).SetSite(psp);
          713  +    }
          714  +
          715  +    int IVsHierarchy.UnadviseHierarchyEvents(uint dwCookie)
          716  +    {
          717  +      return ((IVsUIHierarchy)this).UnadviseHierarchyEvents(dwCookie);
          718  +    }
          719  +
          720  +    int IVsHierarchy.Unused0()
          721  +    {
          722  +      return VSConstants.E_NOTIMPL;
          723  +    }
          724  +
          725  +    int IVsHierarchy.Unused1()
          726  +    {
          727  +      return VSConstants.E_NOTIMPL;
          728  +    }
          729  +
          730  +    int IVsHierarchy.Unused2()
          731  +    {
          732  +      return VSConstants.E_NOTIMPL;
          733  +    }
          734  +
          735  +    int IVsHierarchy.Unused3()
          736  +    {
          737  +      return VSConstants.E_NOTIMPL;
          738  +    }
          739  +
          740  +    int IVsHierarchy.Unused4()
          741  +    {
          742  +      return VSConstants.E_NOTIMPL;
          743  +    }
          744  +
          745  +    #endregion
          746  +
          747  +    #region IVsPersistHierarchyItem Members
          748  +
          749  +    int IVsPersistHierarchyItem.IsItemDirty(uint itemid, IntPtr punkDocData, out int pfDirty)
          750  +    {
          751  +      return ((IVsPersistDocData)_control).IsDocDataDirty(out pfDirty);
          752  +    }
          753  +
          754  +    int IVsPersistHierarchyItem.SaveItem(VSSAVEFLAGS dwSave, string pszSilentSaveAsName, uint itemid, IntPtr punkDocData, out int pfCanceled)
          755  +    {
          756  +      return ((IVsPersistDocData)_control).SaveDocData(dwSave, out pszSilentSaveAsName, out pfCanceled);
          757  +    }
          758  +
          759  +    #endregion
          760  +
          761  +    #region IVsPersistHierarchyItem2 Members
          762  +
          763  +    int IVsPersistHierarchyItem2.IgnoreItemFileChanges(uint itemid, int fIgnore)
          764  +    {
          765  +      return VSConstants.E_NOTIMPL;
          766  +    }
          767  +
          768  +    int IVsPersistHierarchyItem2.IsItemDirty(uint itemid, IntPtr punkDocData, out int pfDirty)
          769  +    {
          770  +      return ((IVsPersistDocData)_control).IsDocDataDirty(out pfDirty);
          771  +    }
          772  +
          773  +    int IVsPersistHierarchyItem2.IsItemReloadable(uint itemid, out int pfReloadable)
          774  +    {
          775  +      return ((IVsPersistDocData)_control).IsDocDataReloadable(out pfReloadable);
          776  +    }
          777  +
          778  +    int IVsPersistHierarchyItem2.ReloadItem(uint itemid, uint dwReserved)
          779  +    {
          780  +      return ((IVsPersistDocData)_control).ReloadDocData(dwReserved);
          781  +    }
          782  +
          783  +    int IVsPersistHierarchyItem2.SaveItem(VSSAVEFLAGS dwSave, string pszSilentSaveAsName, uint itemid, IntPtr punkDocData, out int pfCanceled)
          784  +    {
          785  +      return ((IVsPersistDocData)_control).SaveDocData(dwSave, out pszSilentSaveAsName, out pfCanceled);
          786  +    }
          787  +
          788  +    #endregion
          789  +  }
          790  +}

Added SQLite.Designer/Editors/TableDesignerDoc.resx.

            1  +<?xml version="1.0" encoding="utf-8"?>
            2  +<root>
            3  +  <!-- 
            4  +    Microsoft ResX Schema 
            5  +    
            6  +    Version 2.0
            7  +    
            8  +    The primary goals of this format is to allow a simple XML format 
            9  +    that is mostly human readable. The generation and parsing of the 
           10  +    various data types are done through the TypeConverter classes 
           11  +    associated with the data types.
           12  +    
           13  +    Example:
           14  +    
           15  +    ... ado.net/XML headers & schema ...
           16  +    <resheader name="resmimetype">text/microsoft-resx</resheader>
           17  +    <resheader name="version">2.0</resheader>
           18  +    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
           19  +    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
           20  +    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
           21  +    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
           22  +    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
           23  +        <value>[base64 mime encoded serialized .NET Framework object]</value>
           24  +    </data>
           25  +    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
           26  +        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
           27  +        <comment>This is a comment</comment>
           28  +    </data>
           29  +                
           30  +    There are any number of "resheader" rows that contain simple 
           31  +    name/value pairs.
           32  +    
           33  +    Each data row contains a name, and value. The row also contains a 
           34  +    type or mimetype. Type corresponds to a .NET class that support 
           35  +    text/value conversion through the TypeConverter architecture. 
           36  +    Classes that don't support this are serialized and stored with the 
           37  +    mimetype set.
           38  +    
           39  +    The mimetype is used for serialized objects, and tells the 
           40  +    ResXResourceReader how to depersist the object. This is currently not 
           41  +    extensible. For a given mimetype the value must be set accordingly:
           42  +    
           43  +    Note - application/x-microsoft.net.object.binary.base64 is the format 
           44  +    that the ResXResourceWriter will generate, however the reader can 
           45  +    read any of the formats listed below.
           46  +    
           47  +    mimetype: application/x-microsoft.net.object.binary.base64
           48  +    value   : The object must be serialized with 
           49  +            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
           50  +            : and then encoded with base64 encoding.
           51  +    
           52  +    mimetype: application/x-microsoft.net.object.soap.base64
           53  +    value   : The object must be serialized with 
           54  +            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
           55  +            : and then encoded with base64 encoding.
           56  +
           57  +    mimetype: application/x-microsoft.net.object.bytearray.base64
           58  +    value   : The object must be serialized into a byte array 
           59  +            : using a System.ComponentModel.TypeConverter
           60  +            : and then encoded with base64 encoding.
           61  +    -->
           62  +  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
           63  +    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
           64  +    <xsd:element name="root" msdata:IsDataSet="true">
           65  +      <xsd:complexType>
           66  +        <xsd:choice maxOccurs="unbounded">
           67  +          <xsd:element name="metadata">
           68  +            <xsd:complexType>
           69  +              <xsd:sequence>
           70  +                <xsd:element name="value" type="xsd:string" minOccurs="0" />
           71  +              </xsd:sequence>
           72  +              <xsd:attribute name="name" use="required" type="xsd:string" />
           73  +              <xsd:attribute name="type" type="xsd:string" />
           74  +              <xsd:attribute name="mimetype" type="xsd:string" />
           75  +              <xsd:attribute ref="xml:space" />
           76  +            </xsd:complexType>
           77  +          </xsd:element>
           78  +          <xsd:element name="assembly">
           79  +            <xsd:complexType>
           80  +              <xsd:attribute name="alias" type="xsd:string" />
           81  +              <xsd:attribute name="name" type="xsd:string" />
           82  +            </xsd:complexType>
           83  +          </xsd:element>
           84  +          <xsd:element name="data">
           85  +            <xsd:complexType>
           86  +              <xsd:sequence>
           87  +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
           88  +                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
           89  +              </xsd:sequence>
           90  +              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
           91  +              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
           92  +              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
           93  +              <xsd:attribute ref="xml:space" />
           94  +            </xsd:complexType>
           95  +          </xsd:element>
           96  +          <xsd:element name="resheader">
           97  +            <xsd:complexType>
           98  +              <xsd:sequence>
           99  +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
          100  +              </xsd:sequence>
          101  +              <xsd:attribute name="name" type="xsd:string" use="required" />
          102  +            </xsd:complexType>
          103  +          </xsd:element>
          104  +        </xsd:choice>
          105  +      </xsd:complexType>
          106  +    </xsd:element>
          107  +  </xsd:schema>
          108  +  <resheader name="resmimetype">
          109  +    <value>text/microsoft-resx</value>
          110  +  </resheader>
          111  +  <resheader name="version">
          112  +    <value>2.0</value>
          113  +  </resheader>
          114  +  <resheader name="reader">
          115  +    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
          116  +  </resheader>
          117  +  <resheader name="writer">
          118  +    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
          119  +  </resheader>
          120  +  <metadata name="_splitter.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          121  +    <value>False</value>
          122  +  </metadata>
          123  +  <metadata name="name.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          124  +    <value>True</value>
          125  +  </metadata>
          126  +  <metadata name="type.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          127  +    <value>True</value>
          128  +  </metadata>
          129  +  <metadata name="isnull.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          130  +    <value>True</value>
          131  +  </metadata>
          132  +  <metadata name="_imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
          133  +    <value>17, 17</value>
          134  +  </metadata>
          135  +  <data name="_imageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
          136  +    <value>
          137  +        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
          138  +        LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
          139  +        ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACA
          140  +        AgAAAk1TRnQBSQFMAwEBAAEEAQABBAEAASgBAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABoAMA
          141  +        ARADAAEBAQABGAYAAR7/AP8A/wD/ADMAAcMBzgHVARkBQAFaAbkBwQHG/wDYAAELAUIBYgExAcIB7AEl
          142  +        AT8BTgGxAbkBvf8A1QABEgFRAXEBXgHjAf8BMwGjAcIBIgExAT7/ANUAARcBXgF8AVcB4AH/AQsBNQFM
          143  +        AccBzwHT/wDVAAEeAWsBiwFuAecB/wFDAbwB2wE2AU0BXf8A0gABvQHJAdEBHgFqAYsBdwHpAf4BHgFA
          144  +        AU0BvQHGAcr/AM8AAd0B4wHnARwBWwF7AXwB6wH/AYoB7wH/AWAB0gHlAQ0BMwFDAaIBrwG2/wDMAAEj
          145  +        AWgBiQGHAewB+QGbAfMB/wGDAe8B/wGiAfYB/wFtAc0B3gEGASoBQP8AzAABMAF1AZIBrgH3Af8BhwHj
          146  +        Ae8BLgFhAXsBjQHlAfEBrgH4Af8BBQFCAV//AMwAAUcBkAGpAZ8B9QH/Aa4B+gH/AZIB5wHwAbEB+gH/
          147  +        AYoB6QH1AQQBSgFo/wDMAAHTAdsB3wFpAbYBygFSAZwBswE5AYABmgElAW8BkAEZAWoBjgHWAd0B4f8A
          148  +        /wD/AP8A/wD/AP8AGwABQgFNAT4HAAE+AwABKAMAAaADAAEQAwABAQEAAQEFAAFAAQEWAAP/AQAF/w8A
          149  +        Bf8PAAP/Af4BPw8AA/8B/gEfDwAD/wH+AR8PAAP/Af4BHw8AA/8B/gEfDwAD/wH8AR8PAAP/AfgBDw8A
          150  +        A/8B+AEPDwAD/wH4AQ8PAAP/AfgBDw8AA/8B+AEPDwAF/w8ABf8PAAX/DwAL
          151  +</value>
          152  +  </data>
          153  +</root>