ADDED SQLite.Designer/ChangePasswordDialog.Designer.cs Index: SQLite.Designer/ChangePasswordDialog.Designer.cs ================================================================== --- /dev/null +++ SQLite.Designer/ChangePasswordDialog.Designer.cs @@ -0,0 +1,143 @@ +namespace SQLite.Designer +{ + partial class ChangePasswordDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.Button cancelButton; + System.Windows.Forms.Label label1; + this.okButton = new System.Windows.Forms.Button(); + this.confirmLabel = new System.Windows.Forms.Label(); + this.password = new System.Windows.Forms.TextBox(); + this.passwordConfirm = new System.Windows.Forms.TextBox(); + this.action = new System.Windows.Forms.Label(); + cancelButton = new System.Windows.Forms.Button(); + label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // cancelButton + // + cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + cancelButton.Location = new System.Drawing.Point(212, 134); + cancelButton.Name = "cancelButton"; + cancelButton.Size = new System.Drawing.Size(75, 23); + cancelButton.TabIndex = 0; + cancelButton.Text = "Cancel"; + cancelButton.UseVisualStyleBackColor = true; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new System.Drawing.Point(28, 15); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(77, 13); + label1.TabIndex = 2; + label1.Text = "New &Password"; + // + // okButton + // + this.okButton.Location = new System.Drawing.Point(131, 134); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 23); + this.okButton.TabIndex = 1; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // confirmLabel + // + this.confirmLabel.AutoSize = true; + this.confirmLabel.Enabled = false; + this.confirmLabel.Location = new System.Drawing.Point(12, 42); + this.confirmLabel.Name = "confirmLabel"; + this.confirmLabel.Size = new System.Drawing.Size(93, 13); + this.confirmLabel.TabIndex = 4; + this.confirmLabel.Text = "&Confirm Password"; + // + // password + // + this.password.Location = new System.Drawing.Point(111, 12); + this.password.Name = "password"; + this.password.Size = new System.Drawing.Size(176, 21); + this.password.TabIndex = 3; + this.password.UseSystemPasswordChar = true; + this.password.TextChanged += new System.EventHandler(this.password_TextChanged); + // + // passwordConfirm + // + this.passwordConfirm.Enabled = false; + this.passwordConfirm.Location = new System.Drawing.Point(111, 39); + this.passwordConfirm.Name = "passwordConfirm"; + this.passwordConfirm.Size = new System.Drawing.Size(176, 21); + this.passwordConfirm.TabIndex = 5; + this.passwordConfirm.UseSystemPasswordChar = true; + this.passwordConfirm.TextChanged += new System.EventHandler(this.password_TextChanged); + // + // action + // + this.action.Location = new System.Drawing.Point(39, 74); + this.action.Name = "action"; + this.action.Size = new System.Drawing.Size(220, 46); + this.action.TabIndex = 6; + // + // ChangePasswordDialog + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = cancelButton; + this.ClientSize = new System.Drawing.Size(299, 169); + this.Controls.Add(this.action); + this.Controls.Add(this.passwordConfirm); + this.Controls.Add(this.confirmLabel); + this.Controls.Add(this.password); + this.Controls.Add(label1); + this.Controls.Add(this.okButton); + this.Controls.Add(cancelButton); + this.Font = new System.Drawing.Font("MS Shell Dlg 2", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ChangePasswordDialog"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Change SQLite Database Password"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox passwordConfirm; + private System.Windows.Forms.Label action; + private System.Windows.Forms.TextBox password; + private System.Windows.Forms.Label confirmLabel; + private System.Windows.Forms.Button okButton; + + } +} ADDED SQLite.Designer/ChangePasswordDialog.cs Index: SQLite.Designer/ChangePasswordDialog.cs ================================================================== --- /dev/null +++ SQLite.Designer/ChangePasswordDialog.cs @@ -0,0 +1,64 @@ +namespace SQLite.Designer +{ + using System; + using System.Collections.Generic; + using System.ComponentModel; + using System.Data; + using System.Drawing; + using System.Text; + using System.Windows.Forms; + using Microsoft.VisualStudio.Data; + using System.Windows.Forms.Design; + using Microsoft.VisualStudio.Shell.Interop; + using Microsoft.VisualStudio; + using System.Data.Common; + + public partial class ChangePasswordDialog : Form + { + internal string Password = null; + + private SQLiteConnectionProperties _props; + + internal ChangePasswordDialog(SQLiteConnectionProperties props) + { + _props = props; + InitializeComponent(); + + password.Text = _props["Password"] as string; + } + + private void password_TextChanged(object sender, EventArgs e) + { + if (String.IsNullOrEmpty(password.Text) || password.Text == _props["Password"] as string) + { + confirmLabel.Enabled = false; + passwordConfirm.Enabled = false; + passwordConfirm.Text = ""; + + if (String.IsNullOrEmpty(password.Text) && _props["Password"] != null) + action.Text = VSPackage.Decrypt; + else + action.Text = ""; + } + else + { + confirmLabel.Enabled = true; + passwordConfirm.Enabled = true; + + if (_props["Password"] != null) + action.Text = VSPackage.ReEncrypt; + else + action.Text = VSPackage.Encrypt; + } + + okButton.Enabled = (password.Text == passwordConfirm.Text); + } + + private void okButton_Click(object sender, EventArgs e) + { + Password = password.Text; + DialogResult = DialogResult.OK; + Close(); + } + } +} ADDED SQLite.Designer/ChangePasswordDialog.resx Index: SQLite.Designer/ChangePasswordDialog.resx ================================================================== --- /dev/null +++ SQLite.Designer/ChangePasswordDialog.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + False + + ADDED SQLite.Designer/Design/Column.cs Index: SQLite.Designer/Design/Column.cs ================================================================== --- /dev/null +++ SQLite.Designer/Design/Column.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel; +using System.ComponentModel.Design; +using System.Windows.Forms; +using System.Drawing.Design; + +namespace SQLite.Designer.Design +{ + internal class Column + { + private bool _allowNulls = false; + private string _dataType = ""; + private string _defaultValue = ""; + private string _columnName = ""; + private CollationTypeEnum _collate = CollationTypeEnum.Binary; + private DataGridViewRow _parent; + private string _checkconstraint = ""; + private Unique _unique; + private PrimaryKey _primaryKey; + private Table _table; + + internal Column(DataGridViewRow row) + { + _parent = row; + _table = row.Tag as Table; + _unique = new Unique(this); + _primaryKey = new PrimaryKey(this); + } + + [Browsable(false)] + internal Table Table + { + get { return _table; } + } + + internal void RefreshGrid() + { + _parent.DataGridView.Refresh(); + } + + internal void CellValueChanged() + { + if (_parent.DataGridView.CurrentCell.RowIndex != _parent.Index) return; + + object value; + + if (_parent.DataGridView.CurrentCell.IsInEditMode == true) + { + if (_parent.DataGridView.EditingControl != null) + value = ((IDataGridViewEditingControl)_parent.DataGridView.EditingControl).EditingControlFormattedValue; + else + value = _parent.DataGridView.CurrentCell.EditedFormattedValue; + } + else + value = _parent.DataGridView.CurrentCell.Value; + + switch (_parent.DataGridView.CurrentCell.ColumnIndex) + { + case 0: + ColumnName = value.ToString(); + break; + case 1: + DataType = value.ToString(); + break; + case 2: + AllowNulls = Convert.ToBoolean(value); + break; + } + } + + [DisplayName("Check")] + [Category("Constraints")] + public virtual string CheckConstraint + { + get { return _checkconstraint; } + set { _checkconstraint = value; } + } + + [DefaultValue(CollationTypeEnum.Binary)] + [Category("Constraints")] + public virtual CollationTypeEnum CollationType + { + get { return _collate; } + set { _collate = value; } + } + + [Category("Constraints")] + public virtual Unique Unique + { + get { return _unique; } + } + + [Browsable(false)] + public virtual string ColumnName + { + get { return _columnName; } + set { _columnName = value; } + } + + [DisplayName("Primary Key")] + [Category("Constraints")] + public virtual PrimaryKey PrimaryKey + { + get { return _primaryKey; } + } + + [DefaultValue(false)] + [DisplayName("Allow Nulls")] + [Category("Constraints")] + public virtual bool AllowNulls + { + get { return _allowNulls; } + set + { + if (value != _allowNulls) + { + _allowNulls = value; + _parent.Cells[2].Value = _allowNulls; + } + } + } + + [Browsable(false)] + public virtual string DataType + { + get { return _dataType; } + set { _dataType = value; } + } + + [DisplayName("Default Value")] + [Category("Constraints")] + public virtual string DefaultValue + { + get { return _defaultValue; } + set { _defaultValue = value; } + } + } + + public enum CollationTypeEnum + { + Binary = 0, + CaseInsensitive = 1, + } +} ADDED SQLite.Designer/Design/PrimaryKey.cs Index: SQLite.Designer/Design/PrimaryKey.cs ================================================================== --- /dev/null +++ SQLite.Designer/Design/PrimaryKey.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel; + +namespace SQLite.Designer.Design +{ + [TypeConverter(typeof(ExpandableObjectConverter))] + internal class PrimaryKey + { + private bool _primaryKey; + private bool _autoIncrement; + private IndexDirection _direction; + private ConflictEnum _conflict; + Column _column; + + internal PrimaryKey(Column col) + { + _column = col; + } + + [RefreshProperties(RefreshProperties.All)] + [DefaultValue(false)] + public bool Enabled + { + get { return _primaryKey; } + set + { + _primaryKey = value; + + if (_primaryKey == false) + AutoIncrement = false; + + _column.RefreshGrid(); + } + } + + [RefreshProperties(RefreshProperties.All)] + [DefaultValue(false)] + [DisplayName("Auto Increment")] + public bool AutoIncrement + { + get { return _autoIncrement; } + set + { + if (_primaryKey == false && value == true) + Enabled = true; + + _autoIncrement = value; + } + } + + [DefaultValue(ConflictEnum.Abort)] + [DisplayName("On Conflict")] + public ConflictEnum Conflict + { + get { return _conflict; } + set { _conflict = value; } + } + + [DefaultValue(IndexDirection.Ascending)] + [DisplayName("Sort Mode")] + public IndexDirection SortMode + { + get { return _direction; } + set { _direction = value; } + } + + public override string ToString() + { + return Enabled.ToString(); + } + } + + internal enum IndexDirection + { + Ascending = 0, + Descending = 1, + } +} ADDED SQLite.Designer/Design/Table.cs Index: SQLite.Designer/Design/Table.cs ================================================================== --- /dev/null +++ SQLite.Designer/Design/Table.cs @@ -0,0 +1,87 @@ +namespace SQLite.Designer.Design +{ + using System; + using System.Data.Common; + using System.ComponentModel.Design; + using System.ComponentModel; + using System.Drawing.Design; + using System.Data; + using SQLite.Designer.Editors; + + internal class Table + { + private string _name; + string _catalog; + + internal TableDesignerDoc _owner; + internal DbConnection _connection; + internal Table(string tableName, DbConnection connection, TableDesignerDoc owner) + { + _owner = owner; + _connection = connection; + Name = tableName; + Catalog = _connection.Database; // main + } + + [Category("Storage")] + [RefreshProperties(RefreshProperties.All)] + public string Name + { + get { return _name; } + set + { + _name = value; + _owner.Name = value; + } + } + + [Category("Storage")] + [Editor(typeof(CatalogTypeEditor), typeof(UITypeEditor))] + [DefaultValue("main")] + [RefreshProperties(RefreshProperties.All)] + public string Catalog + { + get { return _catalog; } + set + { + string catalogs = ""; + using (DataTable table = _connection.GetSchema("Catalogs")) + { + foreach (DataRow row in table.Rows) + { + catalogs += (row[0].ToString() + ","); + } + } + + if (catalogs.IndexOf(value + ",", StringComparison.OrdinalIgnoreCase) == -1) + throw new ArgumentOutOfRangeException("Unrecognized catalog!"); + + _catalog = value; + } + } + } + + internal class CatalogTypeEditor : ObjectSelectorEditor + { + public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) + { + return UITypeEditorEditStyle.DropDown; + } + + protected override void FillTreeWithData(Selector selector, ITypeDescriptorContext context, IServiceProvider provider) + { + base.FillTreeWithData(selector, context, provider); + Table source = context.Instance as Table; + + if (source == null) return; + + using (DataTable table = source._connection.GetSchema("Catalogs")) + { + foreach (DataRow row in table.Rows) + { + selector.AddNode(row[0].ToString(), row[0], null); + } + } + } + } +} ADDED SQLite.Designer/Design/Unique.cs Index: SQLite.Designer/Design/Unique.cs ================================================================== --- /dev/null +++ SQLite.Designer/Design/Unique.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel; + +namespace SQLite.Designer.Design +{ + [TypeConverter(typeof(ExpandableObjectConverter))] + internal class Unique + { + private bool _isUnique; + private ConflictEnum _conflict; + private Column _column; + + internal Unique(Column col) + { + _column = col; + } + + [DefaultValue(false)] + [DisplayName("Enabled")] + public bool Enabled + { + get { return _isUnique; } + set { _isUnique = value; } + } + + [DefaultValue(ConflictEnum.Abort)] + [DisplayName("On Conflict")] + public ConflictEnum Conflict + { + get { return _conflict; } + set { _conflict = value; } + } + + public override string ToString() + { + if (_isUnique == false) + return Convert.ToString(false); + else + return String.Format("{0} ({1})", Convert.ToString(true), Convert.ToString(Conflict)); + } + } + + public enum ConflictEnum + { + Abort = 0, + Rollback, + Fail, + Ignore, + Replace, + } +} ADDED SQLite.Designer/Editors/AutoCompleteColumn.cs Index: SQLite.Designer/Editors/AutoCompleteColumn.cs ================================================================== --- /dev/null +++ SQLite.Designer/Editors/AutoCompleteColumn.cs @@ -0,0 +1,173 @@ +using System; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using System.Drawing; + +namespace SQLite.Designer.Editors +{ + public class DbGridView : DataGridView + { + private TableDesignerDoc _owner = null; + + public override void NotifyCurrentCellDirty(bool dirty) + { + base.NotifyCurrentCellDirty(dirty); + SQLite.Designer.Design.Column col = Rows[CurrentCell.RowIndex].Tag as SQLite.Designer.Design.Column; + + if (col == null && CurrentRow.IsNewRow == false) + { + col = new SQLite.Designer.Design.Column(Rows[CurrentCell.RowIndex]); + Rows[CurrentCell.RowIndex].Tag = col; + base.OnSelectionChanged(new EventArgs()); + } + if (col != null) + col.CellValueChanged(); + + if (_owner == null) + { + Control ctl = this; + + while (ctl.GetType() != typeof(TableDesignerDoc)) + { + ctl = ctl.Parent; + if (ctl == null) break; + } + if (ctl != null) _owner = ctl as TableDesignerDoc; + } + + if (_owner != null) + _owner.RefreshToolbars(); + } + } + + public class AutoCompleteColumn : DataGridViewColumn + { + public AutoCompleteColumn() + : base(new AutoCompleteCell()) + { + } + } + + public class AutoCompleteCell : DataGridViewTextBoxCell + { + public override Type EditType + { + get + { + return typeof(AutoCompleteEditingControl); + } + } + + protected override bool SetValue(int rowIndex, object value) + { + return base.SetValue(rowIndex, value); + } + } + + public class AutoCompleteEditingControl : DataGridViewComboBoxEditingControl + { + private bool inPrepare = false; + private bool isDeleting = false; + + public override object EditingControlFormattedValue + { + get + { + return base.Text; + } + set + { + base.Text = value as string; + } + } + + public override void PrepareEditingControlForEdit(bool selectAll) + { + inPrepare = true; + base.PrepareEditingControlForEdit(selectAll); + if (base.Items.Count == 0) + { + base.Items.Add("integer"); + base.Items.Add("smallint"); + base.Items.Add("tinyint"); + base.Items.Add("bit"); + base.Items.Add("varchar(50)"); + base.Items.Add("nvarchar(50)"); + base.Items.Add("text"); + base.Items.Add("ntext"); + base.Items.Add("image"); + base.Items.Add("money"); + base.Items.Add("float"); + base.Items.Add("real"); + base.Items.Add("numeric(18,0)"); + base.Items.Add("char(10)"); + base.Items.Add("nchar(10)"); + base.Items.Add("datetime"); + base.Items.Add("guid"); + } + base.DropDownStyle = ComboBoxStyle.DropDown; + base.Text = EditingControlDataGridView.CurrentCell.Value as string; + + if (selectAll) + base.SelectAll(); + + inPrepare = false; + } + + public override bool EditingControlWantsInputKey(Keys keyData, bool dataGridViewWantsInputKey) + { + isDeleting = false; + + switch (keyData & Keys.KeyCode) + { + case Keys.Delete: + case Keys.Back: + isDeleting = true; + break; + } + + if (((keyData & Keys.KeyCode) == Keys.Left && (base.SelectionStart > 0 || base.SelectionLength > 0)) + || ((keyData & Keys.KeyCode) == Keys.Right && (base.SelectionStart < base.Text.Length || base.SelectionLength > 0)) + || (((keyData & Keys.KeyCode) == Keys.Home || (keyData & Keys.KeyCode) == Keys.End) && base.SelectionLength != base.Text.Length) + ) + { + return true; + } + + return base.EditingControlWantsInputKey(keyData, dataGridViewWantsInputKey); + } + + protected override void OnTextChanged(EventArgs e) + { + if (inPrepare) return; + base.OnTextChanged(e); + + bool changed = !(EditingControlDataGridView.CurrentCell.Value as string == base.Text || + (String.IsNullOrEmpty(base.Text) && String.IsNullOrEmpty(EditingControlDataGridView.CurrentCell.Value as string))); + + if ((base.SelectionLength == 0 || base.SelectionStart == base.Text.Length) && isDeleting == false) + { + if (base.Items.Contains(base.Text) == false) + { + for (int n = 0; n < base.Items.Count; n++) + { + if (((string)base.Items[n]).StartsWith(base.Text, StringComparison.OrdinalIgnoreCase) == true) + { + int start = base.SelectionStart; + inPrepare = true; + + base.Text = base.Items[n] as string; + base.SelectionStart = start; + base.SelectionLength = base.Text.Length - start; + + inPrepare = false; + break; + } + } + } + } + EditingControlValueChanged = changed; + EditingControlDataGridView.NotifyCurrentCellDirty(changed); + } + } +} ADDED SQLite.Designer/Editors/TableDesignerDoc.Designer.cs Index: SQLite.Designer/Editors/TableDesignerDoc.Designer.cs ================================================================== --- /dev/null +++ SQLite.Designer/Editors/TableDesignerDoc.Designer.cs @@ -0,0 +1,161 @@ +namespace SQLite.Designer.Editors +{ + partial class TableDesignerDoc + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + + _editingTables.Remove(GetHashCode()); + + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.SplitContainer _splitter; + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TableDesignerDoc)); + this._dataGrid = new SQLite.Designer.Editors.DbGridView(); + this.name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.type = new SQLite.Designer.Editors.AutoCompleteColumn(); + this.isnull = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this._propertyGrid = new System.Windows.Forms.PropertyGrid(); + this.autoCompleteColumn1 = new SQLite.Designer.Editors.AutoCompleteColumn(); + this._imageList = new System.Windows.Forms.ImageList(this.components); + _splitter = new System.Windows.Forms.SplitContainer(); + _splitter.Panel1.SuspendLayout(); + _splitter.Panel2.SuspendLayout(); + _splitter.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this._dataGrid)).BeginInit(); + this.SuspendLayout(); + // + // _splitter + // + _splitter.BackColor = System.Drawing.SystemColors.Control; + _splitter.Dock = System.Windows.Forms.DockStyle.Fill; + _splitter.Location = new System.Drawing.Point(0, 0); + _splitter.Name = "_splitter"; + _splitter.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // _splitter.Panel1 + // + _splitter.Panel1.Controls.Add(this._dataGrid); + // + // _splitter.Panel2 + // + _splitter.Panel2.Controls.Add(this._propertyGrid); + _splitter.Size = new System.Drawing.Size(436, 401); + _splitter.SplitterDistance = 197; + _splitter.TabIndex = 0; + // + // _dataGrid + // + this._dataGrid.AllowUserToResizeRows = false; + this._dataGrid.BackgroundColor = System.Drawing.SystemColors.Window; + this._dataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this._dataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.name, + this.type, + this.isnull}); + this._dataGrid.Dock = System.Windows.Forms.DockStyle.Fill; + this._dataGrid.Location = new System.Drawing.Point(0, 0); + this._dataGrid.Name = "_dataGrid"; + this._dataGrid.RowHeadersWidth = 42; + this._dataGrid.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; + this._dataGrid.RowTemplate.Height = 23; + this._dataGrid.Size = new System.Drawing.Size(436, 197); + this._dataGrid.TabIndex = 1; + this._dataGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this._dataGrid_CellClick); + this._dataGrid.RowHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this._dataGrid_RowHeaderMouseClick); + this._dataGrid.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this._dataGrid_CellPainting); + this._dataGrid.UserDeletedRow += new System.Windows.Forms.DataGridViewRowEventHandler(this._dataGrid_UserDeletedRow); + this._dataGrid.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this._dataGrid_CellValueChanged); + this._dataGrid.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this._dataGrid_CellEnter); + this._dataGrid.SelectionChanged += new System.EventHandler(this._dataGrid_SelectionChanged); + // + // name + // + this.name.Frozen = true; + this.name.HeaderText = "Column Name"; + this.name.Name = "name"; + this.name.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + // + // type + // + this.type.HeaderText = "Data Type"; + this.type.Name = "type"; + // + // isnull + // + this.isnull.HeaderText = "Allow Nulls"; + this.isnull.Name = "isnull"; + // + // _propertyGrid + // + this._propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; + this._propertyGrid.Location = new System.Drawing.Point(0, 0); + this._propertyGrid.Name = "_propertyGrid"; + this._propertyGrid.Size = new System.Drawing.Size(436, 200); + this._propertyGrid.TabIndex = 0; + // + // autoCompleteColumn1 + // + this.autoCompleteColumn1.HeaderText = "Data Type"; + this.autoCompleteColumn1.Name = "autoCompleteColumn1"; + this.autoCompleteColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.autoCompleteColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // + // _imageList + // + this._imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("_imageList.ImageStream"))); + this._imageList.TransparentColor = System.Drawing.Color.Magenta; + this._imageList.Images.SetKeyName(0, "PrimaryKey.bmp"); + // + // TableDesignerDoc + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.Window; + this.Controls.Add(_splitter); + this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Name = "TableDesignerDoc"; + this.Size = new System.Drawing.Size(436, 401); + _splitter.Panel1.ResumeLayout(false); + _splitter.Panel2.ResumeLayout(false); + _splitter.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this._dataGrid)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private DbGridView _dataGrid; + private System.Windows.Forms.PropertyGrid _propertyGrid; + private AutoCompleteColumn autoCompleteColumn1; + private System.Windows.Forms.DataGridViewTextBoxColumn name; + private AutoCompleteColumn type; + private System.Windows.Forms.DataGridViewCheckBoxColumn isnull; + private System.Windows.Forms.ImageList _imageList; + + } +} ADDED SQLite.Designer/Editors/TableDesignerDoc.cs Index: SQLite.Designer/Editors/TableDesignerDoc.cs ================================================================== --- /dev/null +++ SQLite.Designer/Editors/TableDesignerDoc.cs @@ -0,0 +1,790 @@ +namespace SQLite.Designer.Editors +{ + using System; + using System.Collections.Generic; + using System.ComponentModel; + using System.Data; + using System.Data.Common; + using System.Drawing; + using System.Text; + using System.Windows.Forms; + using Microsoft.VisualStudio.Shell.Interop; + using Microsoft.VisualStudio.OLE.Interop; + using Microsoft.VisualStudio; + using Microsoft.VisualStudio.Data; + using SQLite.Designer.Design; + + public partial class TableDesignerDoc : UserControl, + IVsPersistDocData, + IVsWindowPane, + IOleCommandTarget, + ISelectionContainer, + IVsWindowPaneCommit, + IVsWindowFrameNotify + { + private static Dictionary _editingTables = new Dictionary(); + + internal DataConnection _connection; + internal Microsoft.VisualStudio.Data.ServiceProvider _serviceProvider; + internal Table _table; + + public TableDesignerDoc(DataConnection cnn, string tableName) + { + _connection = cnn; + + InitializeComponent(); + + StringBuilder tables = new StringBuilder(); + + using (DataReader reader = cnn.Command.Execute("SELECT * FROM sqlite_master", 1, null, 30)) + { + while (reader.Read()) + { + tables.Append(reader.GetItem(2).ToString()); + tables.Append(","); + } + } + + int n = 1; + + if (String.IsNullOrEmpty(tableName)) + { + string alltables = tables.ToString(); + + do + { + tableName = String.Format("Table{0}", n); + n++; + } while (alltables.IndexOf(tableName + ",", StringComparison.OrdinalIgnoreCase) > -1 || _editingTables.ContainsValue(tableName)); + + _editingTables.Add(GetHashCode(), tableName); + } + _table = new Table(tableName, _connection.ConnectionSupport.ProviderObject as DbConnection, this); + } + + void SetPropertyWindow() + { + IVsTrackSelectionEx track = _serviceProvider.GetService(typeof(SVsTrackSelectionEx)) as IVsTrackSelectionEx; + if (track != null) + { + track.OnSelectChange(this); + } + } + + public new string Name + { + get + { + if (_table != null) + return _table.Name; + else return base.Name; + } + set + { + string caption = "SQLite:" + value; + base.Name = value; + + if (_serviceProvider != null) + { + IVsWindowFrame frame = _serviceProvider.GetService(typeof(IVsWindowFrame)) as IVsWindowFrame; + if (frame != null) + { + frame.SetProperty((int)__VSFPROPID.VSFPROPID_EditorCaption, value); + } + } + } + } + + //public void NotifyChanges() + //{ + // if (_serviceProvider == null) return; + + // // Get a reference to the Running Document Table + // IVsRunningDocumentTable runningDocTable = (IVsRunningDocumentTable)_serviceProvider.GetService(typeof(SVsRunningDocumentTable)); + + // // Lock the document + // uint docCookie; + // IVsHierarchy hierarchy; + // uint itemID; + // IntPtr docData; + // int hr = runningDocTable.FindAndLockDocument( + // (uint)_VSRDTFLAGS.RDT_ReadLock, + // base.Name, + // out hierarchy, + // out itemID, + // out docData, + // out docCookie + // ); + // ErrorHandler.ThrowOnFailure(hr); + + // // Send the notification + // hr = runningDocTable.NotifyDocumentChanged(docCookie, (uint)__VSRDTATTRIB.RDTA_DocDataReloaded); + + // // Unlock the document. + // // Note that we have to unlock the document even if the previous call failed. + // runningDocTable.UnlockDocument((uint)_VSRDTFLAGS.RDT_ReadLock, docCookie); + + // // Check ff the call to NotifyDocChanged failed. + // ErrorHandler.ThrowOnFailure(hr); + //} + + #region IVsPersistDocData Members + + int IVsPersistDocData.Close() + { + return VSConstants.S_OK; + } + + public int GetGuidEditorType(out Guid pClassID) + { + return ((IPersistFileFormat)this).GetClassID(out pClassID); + } + + public int IsDocDataDirty(out int pfDirty) + { + pfDirty = 1; + return VSConstants.S_OK; + } + + public int IsDocDataReloadable(out int pfReloadable) + { + pfReloadable = 0; + return VSConstants.S_OK; + } + + public int LoadDocData(string pszMkDocument) + { + return ((IPersistFileFormat)this).Load(pszMkDocument, 0, 0); + } + + public int OnRegisterDocData(uint docCookie, IVsHierarchy pHierNew, uint itemidNew) + { + return VSConstants.S_OK; + } + + public int ReloadDocData(uint grfFlags) + { + return VSConstants.E_NOTIMPL; + } + + public int RenameDocData(uint grfAttribs, IVsHierarchy pHierNew, uint itemidNew, string pszMkDocumentNew) + { + return VSConstants.E_NOTIMPL; + } + + public int SaveDocData(VSSAVEFLAGS dwSave, out string pbstrMkDocumentNew, out int pfSaveCanceled) + { + pbstrMkDocumentNew = _table.Name; + pfSaveCanceled = 0; + + return VSConstants.S_OK; + } + + public int SetUntitledDocPath(string pszDocDataPath) + { + return ((IPersistFileFormat)this).InitNew(0); + } + + #endregion + + #region IVsWindowPane Members + + public int ClosePane() + { + this.Dispose(true); + return VSConstants.S_OK; + } + + public int CreatePaneWindow(IntPtr hwndParent, int x, int y, int cx, int cy, out IntPtr hwnd) + { + Win32Methods.SetParent(Handle, hwndParent); + hwnd = Handle; + + Size = new System.Drawing.Size(cx - x, cy - y); + return VSConstants.S_OK; + } + + public int GetDefaultSize(Microsoft.VisualStudio.OLE.Interop.SIZE[] size) + { + if (size.Length >= 1) + { + size[0].cx = Size.Width; + size[0].cy = Size.Height; + } + + return VSConstants.S_OK; + } + + public int LoadViewState(Microsoft.VisualStudio.OLE.Interop.IStream pStream) + { + return VSConstants.S_OK; + } + + public int SaveViewState(Microsoft.VisualStudio.OLE.Interop.IStream pStream) + { + return VSConstants.S_OK; + } + + public void RefreshToolbars() + { + if (_serviceProvider == null) return; + + IVsUIShell shell = _serviceProvider.GetService(typeof(IVsUIShell)) as IVsUIShell; + + if (shell != null) + { + shell.UpdateCommandUI(1); + } + } + + public int SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider psp) + { + _serviceProvider = new ServiceProvider(psp); + return VSConstants.S_OK; + } + + public int TranslateAccelerator(Microsoft.VisualStudio.OLE.Interop.MSG[] lpmsg) + { + return VSConstants.S_FALSE; + } + + #endregion + + #region IOleCommandTarget Members + + public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) + { + return (int)(Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED); + } + + public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) + { + System.Diagnostics.Debug.WriteLine(pguidCmdGroup.ToString()); + + if (pguidCmdGroup == VSConstants.GUID_VSStandardCommandSet97) + { + switch ((VSConstants.VSStd97CmdID)prgCmds[0].cmdID) + { + case VSConstants.VSStd97CmdID.PrimaryKey: + case VSConstants.VSStd97CmdID.GenerateChangeScript: + prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_ENABLED); + System.Diagnostics.Debug.Write("."); + break; + default: + return (int)(Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED); + } + return VSConstants.S_OK; + } + + if (pguidCmdGroup == SQLiteCommandHandler.guidDavinci) + { + switch (prgCmds[0].cmdID) + { + case (uint)VSConstants.VSStd97CmdID.ManageRelationships: + case (uint)VSConstants.VSStd97CmdID.ManageIndexes: + case (uint)VSConstants.VSStd97CmdID.ManageConstraints: + //case 10: // Table View -> Custom + //case 14: // Table View -> Modify Custom + //case 33: // Database Diagram -> Add Table + //case 1: // Database Diagram -> Add Related Tables + //case 12: // Database Diagram -> Delete From Database + //case 51: // Database Diagram -> Remove From Diagram + //case 13: // Database Diagram -> Autosize Selected Tables + //case 3: // Database Diagram -> Arrange Selection + //case 2: // Database Diagram -> Arrange Tables + //case 16: // Database Diagram -> Zoom -> 200% + //case 17: // Database Diagram -> Zoom -> 150% + //case 18: // Database Diagram -> Zoom -> 100% + //case 19: // Database Diagram -> Zoom -> 75% + //case 20: // Database Diagram -> Zoom -> 50% + //case 21: // Database Diagram -> Zoom -> 25% + //case 22: // Database Diagram -> Zoom -> 10% + //case 24: // Database Diagram -> Zoom -> To Fit + //case 6: // Database Diagram -> New Text Annotation + //case 15: // Database Diagram -> Set Text Annotation Font + //case 7: // Database Diagram -> Show Relationship Labels + //case 8: // Database Diagram -> View Page Breaks + //case 9: // Database Diagram -> Recalculate Page Breaks + //case 43: // Database Diagram -> Copy Diagram to Clipboard + //case 41: // Query Designer -> Table Display -> Column Names + //case 42: // Query Designer -> Table Display -> Name Only + //case 39: // Query Designer -> Add Table + case 4: // Insert Column + case 5: // Delete Column + prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_ENABLED); + break; + default: + return (int)(Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED); + } + return VSConstants.S_OK; + } + + return (int)(Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED); + } + + #endregion + + #region ISelectionContainer Members + + int ISelectionContainer.CountObjects(uint dwFlags, out uint pc) + { + pc = 1; + return VSConstants.S_OK; + } + + int ISelectionContainer.GetObjects(uint dwFlags, uint cObjects, object[] apUnkObjects) + { + apUnkObjects[0] = _table; + return VSConstants.S_OK; + } + + int ISelectionContainer.SelectObjects(uint cSelect, object[] apUnkSelect, uint dwFlags) + { + apUnkSelect[0] = _table; + return VSConstants.S_OK; + } + + #endregion + + #region IVsWindowPaneCommit Members + + int IVsWindowPaneCommit.CommitPendingEdit(out int pfCommitFailed) + { + pfCommitFailed = 0; + return VSConstants.S_OK; + } + + #endregion + + #region IVsWindowFrameNotify Members + + int IVsWindowFrameNotify.OnDockableChange(int fDockable) + { + return VSConstants.S_OK; + } + + int IVsWindowFrameNotify.OnMove() + { + return VSConstants.S_OK; + } + + int IVsWindowFrameNotify.OnShow(int fShow) + { + switch ((__FRAMESHOW)fShow) + { + case __FRAMESHOW.FRAMESHOW_TabActivated: + case __FRAMESHOW.FRAMESHOW_WinShown: + SetPropertyWindow(); + break; + } + return VSConstants.S_OK; + } + + int IVsWindowFrameNotify.OnSize() + { + return VSConstants.S_OK; + } + + #endregion + + private void _dataGrid_CellEnter(object sender, DataGridViewCellEventArgs e) + { + if (e.ColumnIndex > -1) + { + _dataGrid.BeginEdit(true); + _dataGrid_SelectionChanged(sender, e); + } + } + + private void _dataGrid_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) + { + _dataGrid.EndEdit(); + if (e.Button == MouseButtons.Right) + { + IVsUIShell shell = _serviceProvider.GetService(typeof(IVsUIShell)) as IVsUIShell; + if (shell != null) + { + Guid guid; + POINTS[] p = new POINTS[1]; + int ret; + + p[0].x = (short)Control.MousePosition.X; + p[0].y = (short)Control.MousePosition.Y; + + guid = new Guid("732abe74-cd80-11d0-a2db-00aa00a3efff"); + + ret = shell.ShowContextMenu(0, ref guid, 259, p, this); + } + } + } + + private void _dataGrid_CellClick(object sender, DataGridViewCellEventArgs e) + { + if (e.ColumnIndex == -1 && e.RowIndex == -1) + { + _dataGrid.EndEdit(); + } + _dataGrid_SelectionChanged(sender, e); + } + + private void _dataGrid_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) + { + if (e.ColumnIndex > -1 || e.RowIndex < 0) return; + + Column col = _dataGrid.Rows[e.RowIndex].Tag as Column; + + if (col == null) return; + + if (col.PrimaryKey.Enabled == true) + { + e.Paint(e.ClipBounds, DataGridViewPaintParts.All); + _imageList.Draw(e.Graphics, e.CellBounds.Left, e.CellBounds.Top + ((e.CellBounds.Bottom - e.CellBounds.Top) - _imageList.ImageSize.Height) / 2, 0); + e.Handled = true; + } + } + + private void _dataGrid_SelectionChanged(object sender, EventArgs e) + { + List items = new List(); + + for (int n = 0; n < _dataGrid.Rows.Count; n++) + { + if (_dataGrid.Rows[n].Selected || (_dataGrid.CurrentCell.RowIndex == n && _dataGrid.IsCurrentCellInEditMode == true)) + { + if (_dataGrid.Rows[n].Tag != null) + items.Add(_dataGrid.Rows[n].Tag); + } + } + + object[] objs = new object[items.Count]; + items.CopyTo(objs); + + _propertyGrid.SelectedObjects = objs; + } + + private void _dataGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e) + { + _propertyGrid.SelectedObjects = _propertyGrid.SelectedObjects; + } + + private void _dataGrid_UserDeletedRow(object sender, DataGridViewRowEventArgs e) + { + _dataGrid_SelectionChanged(sender, e); + } + } + + internal class FakeHierarchy : IVsUIHierarchy, IVsPersistHierarchyItem2 + { + TableDesignerDoc _control; + IVsUIHierarchy _owner; + Dictionary _events = new Dictionary(); + + internal FakeHierarchy(TableDesignerDoc control, IVsUIHierarchy owner) + { + _control = control; + _owner = owner; + } + + #region IVsUIHierarchy Members + + int IVsUIHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie) + { + pdwCookie = 100; + while (_events.ContainsKey(pdwCookie)) + pdwCookie++; + + _events[pdwCookie] = pEventSink; + + return VSConstants.S_OK; + } + + int IVsUIHierarchy.Close() + { + return VSConstants.S_OK; + } + + int IVsUIHierarchy.ExecCommand(uint itemid, ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) + { + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.GetCanonicalName(uint itemid, out string pbstrName) + { + pbstrName = _control._table.Name; + return VSConstants.S_OK; + } + + int IVsUIHierarchy.GetGuidProperty(uint itemid, int propid, out Guid pguid) + { + return _owner.GetGuidProperty(itemid, propid, out pguid); + } + + int IVsUIHierarchy.GetNestedHierarchy(uint itemid, ref Guid iidHierarchyNested, out IntPtr ppHierarchyNested, out uint pitemidNested) + { + ppHierarchyNested = IntPtr.Zero; + pitemidNested = 0; + + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.GetProperty(uint itemid, int propid, out object pvar) + { + pvar = null; + + switch ((__VSHPROPID)propid) + { + case __VSHPROPID.VSHPROPID_AllowEditInRunMode: + pvar = true; + break; + case __VSHPROPID.VSHPROPID_CanBuildFromMemory: + pvar = true; + break; + case __VSHPROPID.VSHPROPID_Caption: + case __VSHPROPID.VSHPROPID_SaveName: + pvar = _control._table.Name; + break; + case __VSHPROPID.VSHPROPID_IsHiddenItem: + pvar = true; + break; + case __VSHPROPID.VSHPROPID_IsNewUnsavedItem: + pvar = true; + break; + case __VSHPROPID.VSHPROPID_ShowOnlyItemCaption: + pvar = true; + break; + case __VSHPROPID.VSHPROPID_IconImgList: + pvar = 0; + break; + case __VSHPROPID.VSHPROPID_IconHandle: + pvar = null; + return VSConstants.S_OK; + } + + //switch ((__VSHPROPID2)propid) + //{ + // case __VSHPROPID2.VSHPROPID_StatusBarClientText: + // pvar = "SQLite Table Editor"; + // break; + //} + + if (pvar == null) + return _owner.GetProperty(itemid, propid, out pvar); + else + return VSConstants.S_OK; + } + + int IVsUIHierarchy.GetSite(out Microsoft.VisualStudio.OLE.Interop.IServiceProvider ppSP) + { + ppSP = null; + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.ParseCanonicalName(string pszName, out uint pitemid) + { + pitemid = 0; + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.QueryClose(out int pfCanClose) + { + pfCanClose = 1; + return VSConstants.S_OK; + } + + int IVsUIHierarchy.QueryStatusCommand(uint itemid, ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) + { + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.SetGuidProperty(uint itemid, int propid, ref Guid rguid) + { + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.SetProperty(uint itemid, int propid, object var) + { + foreach(IVsHierarchyEvents listener in _events.Values) + { + listener.OnPropertyChanged(itemid, propid, 0); + } + return VSConstants.S_OK; + } + + int IVsUIHierarchy.SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider psp) + { + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.UnadviseHierarchyEvents(uint dwCookie) + { + _events.Remove(dwCookie); + return VSConstants.S_OK; + } + + int IVsUIHierarchy.Unused0() + { + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.Unused1() + { + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.Unused2() + { + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.Unused3() + { + return VSConstants.E_NOTIMPL; + } + + int IVsUIHierarchy.Unused4() + { + return VSConstants.E_NOTIMPL; + } + + #endregion + + #region IVsHierarchy Members + + int IVsHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents pEventSink, out uint pdwCookie) + { + return ((IVsUIHierarchy)this).AdviseHierarchyEvents(pEventSink, out pdwCookie); + } + + int IVsHierarchy.Close() + { + return ((IVsUIHierarchy)this).Close(); + } + + int IVsHierarchy.GetCanonicalName(uint itemid, out string pbstrName) + { + return ((IVsUIHierarchy)this).GetCanonicalName(itemid, out pbstrName); + } + + int IVsHierarchy.GetGuidProperty(uint itemid, int propid, out Guid pguid) + { + return ((IVsUIHierarchy)this).GetGuidProperty(itemid, propid, out pguid); + } + + int IVsHierarchy.GetNestedHierarchy(uint itemid, ref Guid iidHierarchyNested, out IntPtr ppHierarchyNested, out uint pitemidNested) + { + return ((IVsUIHierarchy)this).GetNestedHierarchy(itemid, ref iidHierarchyNested, out ppHierarchyNested, out pitemidNested); + } + + int IVsHierarchy.GetProperty(uint itemid, int propid, out object pvar) + { + return ((IVsUIHierarchy)this).GetProperty(itemid, propid, out pvar); + } + + int IVsHierarchy.GetSite(out Microsoft.VisualStudio.OLE.Interop.IServiceProvider ppSP) + { + ppSP = null; + return VSConstants.E_NOTIMPL; + } + + int IVsHierarchy.ParseCanonicalName(string pszName, out uint pitemid) + { + pitemid = 0; + return VSConstants.E_NOTIMPL; + } + + int IVsHierarchy.QueryClose(out int pfCanClose) + { + return ((IVsUIHierarchy)this).QueryClose(out pfCanClose); + } + + int IVsHierarchy.SetGuidProperty(uint itemid, int propid, ref Guid rguid) + { + return ((IVsUIHierarchy)this).SetGuidProperty(itemid, propid, ref rguid); + } + + int IVsHierarchy.SetProperty(uint itemid, int propid, object var) + { + return ((IVsUIHierarchy)this).SetProperty(itemid, propid, var); + } + + int IVsHierarchy.SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider psp) + { + return ((IVsUIHierarchy)this).SetSite(psp); + } + + int IVsHierarchy.UnadviseHierarchyEvents(uint dwCookie) + { + return ((IVsUIHierarchy)this).UnadviseHierarchyEvents(dwCookie); + } + + int IVsHierarchy.Unused0() + { + return VSConstants.E_NOTIMPL; + } + + int IVsHierarchy.Unused1() + { + return VSConstants.E_NOTIMPL; + } + + int IVsHierarchy.Unused2() + { + return VSConstants.E_NOTIMPL; + } + + int IVsHierarchy.Unused3() + { + return VSConstants.E_NOTIMPL; + } + + int IVsHierarchy.Unused4() + { + return VSConstants.E_NOTIMPL; + } + + #endregion + + #region IVsPersistHierarchyItem Members + + int IVsPersistHierarchyItem.IsItemDirty(uint itemid, IntPtr punkDocData, out int pfDirty) + { + return ((IVsPersistDocData)_control).IsDocDataDirty(out pfDirty); + } + + int IVsPersistHierarchyItem.SaveItem(VSSAVEFLAGS dwSave, string pszSilentSaveAsName, uint itemid, IntPtr punkDocData, out int pfCanceled) + { + return ((IVsPersistDocData)_control).SaveDocData(dwSave, out pszSilentSaveAsName, out pfCanceled); + } + + #endregion + + #region IVsPersistHierarchyItem2 Members + + int IVsPersistHierarchyItem2.IgnoreItemFileChanges(uint itemid, int fIgnore) + { + return VSConstants.E_NOTIMPL; + } + + int IVsPersistHierarchyItem2.IsItemDirty(uint itemid, IntPtr punkDocData, out int pfDirty) + { + return ((IVsPersistDocData)_control).IsDocDataDirty(out pfDirty); + } + + int IVsPersistHierarchyItem2.IsItemReloadable(uint itemid, out int pfReloadable) + { + return ((IVsPersistDocData)_control).IsDocDataReloadable(out pfReloadable); + } + + int IVsPersistHierarchyItem2.ReloadItem(uint itemid, uint dwReserved) + { + return ((IVsPersistDocData)_control).ReloadDocData(dwReserved); + } + + int IVsPersistHierarchyItem2.SaveItem(VSSAVEFLAGS dwSave, string pszSilentSaveAsName, uint itemid, IntPtr punkDocData, out int pfCanceled) + { + return ((IVsPersistDocData)_control).SaveDocData(dwSave, out pszSilentSaveAsName, out pfCanceled); + } + + #endregion + } +} ADDED SQLite.Designer/Editors/TableDesignerDoc.resx Index: SQLite.Designer/Editors/TableDesignerDoc.resx ================================================================== --- /dev/null +++ SQLite.Designer/Editors/TableDesignerDoc.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + True + + + True + + + True + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACA + AgAAAk1TRnQBSQFMAwEBAAEEAQABBAEAASgBAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABoAMA + ARADAAEBAQABGAYAAR7/AP8A/wD/ADMAAcMBzgHVARkBQAFaAbkBwQHG/wDYAAELAUIBYgExAcIB7AEl + AT8BTgGxAbkBvf8A1QABEgFRAXEBXgHjAf8BMwGjAcIBIgExAT7/ANUAARcBXgF8AVcB4AH/AQsBNQFM + AccBzwHT/wDVAAEeAWsBiwFuAecB/wFDAbwB2wE2AU0BXf8A0gABvQHJAdEBHgFqAYsBdwHpAf4BHgFA + AU0BvQHGAcr/AM8AAd0B4wHnARwBWwF7AXwB6wH/AYoB7wH/AWAB0gHlAQ0BMwFDAaIBrwG2/wDMAAEj + AWgBiQGHAewB+QGbAfMB/wGDAe8B/wGiAfYB/wFtAc0B3gEGASoBQP8AzAABMAF1AZIBrgH3Af8BhwHj + Ae8BLgFhAXsBjQHlAfEBrgH4Af8BBQFCAV//AMwAAUcBkAGpAZ8B9QH/Aa4B+gH/AZIB5wHwAbEB+gH/ + AYoB6QH1AQQBSgFo/wDMAAHTAdsB3wFpAbYBygFSAZwBswE5AYABmgElAW8BkAEZAWoBjgHWAd0B4f8A + /wD/AP8A/wD/AP8AGwABQgFNAT4HAAE+AwABKAMAAaADAAEQAwABAQEAAQEFAAFAAQEWAAP/AQAF/w8A + Bf8PAAP/Af4BPw8AA/8B/gEfDwAD/wH+AR8PAAP/Af4BHw8AA/8B/gEfDwAD/wH8AR8PAAP/AfgBDw8A + A/8B+AEPDwAD/wH4AQ8PAAP/AfgBDw8AA/8B+AEPDwAF/w8ABf8PAAX/DwAL + + +