Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>2011-08-13 05:53:36 +0400
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>2011-08-15 10:05:13 +0400
commit6a8a68e6878bf418baaae645c309c98c0d57e7ad (patch)
treec9855f960ae3f792d5d7bb27da1a835e392f4749 /main/src
parentf0f3f19ea43e3dcca2c0e394592b135b44d4b41c (diff)
[Windows] Implement reordering in the encoding selector.
Diffstat (limited to 'main/src')
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.Designer.cs34
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.cs31
2 files changed, 62 insertions, 3 deletions
diff --git a/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.Designer.cs b/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.Designer.cs
index 257efc3528..0031bfc576 100644
--- a/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.Designer.cs
+++ b/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.Designer.cs
@@ -35,6 +35,8 @@
this.label2 = new System.Windows.Forms.Label ();
this.shownListView = new MonoDevelop.Platform.EncodingListView ();
this.availableListView = new MonoDevelop.Platform.EncodingListView ();
+ this.upButton = new System.Windows.Forms.Button ();
+ this.downButton = new System.Windows.Forms.Button ();
this.SuspendLayout ();
//
// label1
@@ -71,7 +73,7 @@
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.okButton.Location = new System.Drawing.Point (474, 395);
+ this.okButton.Location = new System.Drawing.Point (534, 395);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size (75, 23);
this.okButton.TabIndex = 5;
@@ -83,7 +85,7 @@
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.cancelButton.Location = new System.Drawing.Point (555, 395);
+ this.cancelButton.Location = new System.Drawing.Point (615, 395);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size (75, 23);
this.cancelButton.TabIndex = 6;
@@ -128,13 +130,37 @@
this.availableListView.UseCompatibleStateImageBehavior = false;
this.availableListView.View = System.Windows.Forms.View.Details;
//
+ // upButton
+ //
+ this.upButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.upButton.Location = new System.Drawing.Point (640, 169);
+ this.upButton.Name = "upButton";
+ this.upButton.Size = new System.Drawing.Size (50, 30);
+ this.upButton.TabIndex = 8;
+ this.upButton.Text = "Up";
+ this.upButton.UseVisualStyleBackColor = true;
+ this.upButton.Click += new System.EventHandler (this.upButtonClick);
+ //
+ // downButton
+ //
+ this.downButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.downButton.Location = new System.Drawing.Point (640, 205);
+ this.downButton.Name = "downButton";
+ this.downButton.Size = new System.Drawing.Size (50, 30);
+ this.downButton.TabIndex = 9;
+ this.downButton.Text = "Down";
+ this.downButton.UseVisualStyleBackColor = true;
+ this.downButton.Click += new System.EventHandler (this.downButtonClick);
+ //
// EncodingSelectionForm
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
- this.ClientSize = new System.Drawing.Size (643, 431);
+ this.ClientSize = new System.Drawing.Size (703, 431);
+ this.Controls.Add (this.downButton);
+ this.Controls.Add (this.upButton);
this.Controls.Add (this.label2);
this.Controls.Add (this.shownListView);
this.Controls.Add (this.cancelButton);
@@ -161,5 +187,7 @@
private System.Windows.Forms.Button cancelButton;
private EncodingListView shownListView;
private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Button upButton;
+ private System.Windows.Forms.Button downButton;
}
} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.cs b/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.cs
index 2128fc65a3..73657ed942 100644
--- a/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.cs
+++ b/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.cs
@@ -111,6 +111,36 @@ namespace MonoDevelop.Platform
MoveItem (shownListView, availableListView);
}
+ void ShiftItem (ListView listView, int shift)
+ {
+ if (listView.SelectedIndices.Count == 0)
+ return;
+
+ int selectedIndex = listView.SelectedIndices[0];
+ int newIndex = selectedIndex + shift;
+ if (newIndex < 0 || newIndex >= listView.Items.Count)
+ return;
+
+ listView.BeginUpdate ();
+
+ var item = listView.Items[selectedIndex];
+ listView.Items.RemoveAt (selectedIndex);
+ listView.Items.Insert (newIndex, item);
+ item.Selected = true;
+
+ listView.EndUpdate ();
+ }
+
+ private void upButtonClick (object sender, EventArgs e)
+ {
+ ShiftItem (shownListView, -1);
+ }
+
+ private void downButtonClick (object sender, EventArgs e)
+ {
+ ShiftItem (shownListView, 1);
+ }
+
private void okButtonClick (object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
@@ -144,6 +174,7 @@ namespace MonoDevelop.Platform
View = View.Details;
MultiSelect = false;
FullRowSelect = true;
+ HideSelection = false;
Columns.Add ("Name");
Columns.Add ("Encoding");