diff --git a/Greenshot/Forms/SettingsForm.Designer.cs b/Greenshot/Forms/SettingsForm.Designer.cs index 99b4d1103..5dd23bf6a 100644 --- a/Greenshot/Forms/SettingsForm.Designer.cs +++ b/Greenshot/Forms/SettingsForm.Designer.cs @@ -70,7 +70,9 @@ namespace Greenshot { this.textBoxJpegQuality = new System.Windows.Forms.TextBox(); this.trackBarJpegQuality = new System.Windows.Forms.TrackBar(); this.groupbox_destination = new System.Windows.Forms.GroupBox(); - this.checkedDestinationsListBox = new System.Windows.Forms.CheckedListBox(); + this.checkbox_picker = new System.Windows.Forms.CheckBox(); + this.destinationsListView = new System.Windows.Forms.ListView(); + this.destination = new System.Windows.Forms.ColumnHeader(); this.tabcontrol = new System.Windows.Forms.TabControl(); this.tab_general = new System.Windows.Forms.TabPage(); this.groupbox_network = new System.Windows.Forms.GroupBox(); @@ -118,7 +120,6 @@ namespace Greenshot { this.groupbox_plugins = new System.Windows.Forms.GroupBox(); this.listview_plugins = new System.Windows.Forms.ListView(); this.button_pluginconfigure = new System.Windows.Forms.Button(); - this.checkbox_picker = new System.Windows.Forms.CheckBox(); this.groupbox_preferredfilesettings.SuspendLayout(); this.groupbox_applicationsettings.SuspendLayout(); this.groupbox_jpegsettings.SuspendLayout(); @@ -349,23 +350,46 @@ namespace Greenshot { // groupbox_destination // this.groupbox_destination.Controls.Add(this.checkbox_picker); - this.groupbox_destination.Controls.Add(this.checkedDestinationsListBox); + this.groupbox_destination.Controls.Add(this.destinationsListView); this.groupbox_destination.Location = new System.Drawing.Point(2, 6); this.groupbox_destination.Name = "groupbox_destination"; - this.groupbox_destination.Size = new System.Drawing.Size(412, 294); + this.groupbox_destination.Size = new System.Drawing.Size(412, 311); this.groupbox_destination.TabIndex = 16; this.groupbox_destination.TabStop = false; this.groupbox_destination.Text = "Screenshot Destination"; // - // checkedDestinationsListBox + // checkbox_picker // - this.checkedDestinationsListBox.FormattingEnabled = true; - this.checkedDestinationsListBox.Location = new System.Drawing.Point(5, 50); - this.checkedDestinationsListBox.Name = "checkedDestinationsListBox"; - this.checkedDestinationsListBox.ScrollAlwaysVisible = true; - this.checkedDestinationsListBox.Size = new System.Drawing.Size(401, 244); - this.checkedDestinationsListBox.TabIndex = 0; - this.checkedDestinationsListBox.SelectedValueChanged += new System.EventHandler(this.DestinationsCheckStateChanged); + this.checkbox_picker.Location = new System.Drawing.Point(6, 14); + this.checkbox_picker.Name = "checkbox_picker"; + this.checkbox_picker.Size = new System.Drawing.Size(394, 24); + this.checkbox_picker.TabIndex = 19; + this.checkbox_picker.Text = "Destination picker"; + this.checkbox_picker.UseVisualStyleBackColor = true; + this.checkbox_picker.CheckStateChanged += new System.EventHandler(this.DestinationsCheckStateChanged); + // + // destinationsListView + // + this.destinationsListView.Alignment = System.Windows.Forms.ListViewAlignment.Left; + this.destinationsListView.AutoArrange = false; + this.destinationsListView.CheckBoxes = true; + this.destinationsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.destination}); + this.destinationsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.destinationsListView.LabelWrap = false; + this.destinationsListView.Location = new System.Drawing.Point(6, 38); + this.destinationsListView.Name = "destinationsListView"; + this.destinationsListView.ShowGroups = false; + this.destinationsListView.Size = new System.Drawing.Size(401, 267); + this.destinationsListView.Sorting = System.Windows.Forms.SortOrder.Ascending; + this.destinationsListView.TabIndex = 0; + this.destinationsListView.UseCompatibleStateImageBehavior = false; + this.destinationsListView.View = System.Windows.Forms.View.Details; + // + // destination + // + this.destination.Text = "Destination"; + this.destination.Width = 380; // // tabcontrol // @@ -882,16 +906,6 @@ namespace Greenshot { this.button_pluginconfigure.UseVisualStyleBackColor = true; this.button_pluginconfigure.Click += new System.EventHandler(this.Button_pluginconfigureClick); // - // checkbox_picker - // - this.checkbox_picker.Location = new System.Drawing.Point(6, 19); - this.checkbox_picker.Name = "checkbox_picker"; - this.checkbox_picker.Size = new System.Drawing.Size(394, 24); - this.checkbox_picker.TabIndex = 19; - this.checkbox_picker.Text = "Destination picker"; - this.checkbox_picker.UseVisualStyleBackColor = true; - this.checkbox_picker.CheckStateChanged += new System.EventHandler(this.DestinationsCheckStateChanged); - // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -935,8 +949,9 @@ namespace Greenshot { this.groupbox_plugins.PerformLayout(); this.ResumeLayout(false); } + private System.Windows.Forms.ColumnHeader destination; private System.Windows.Forms.CheckBox checkbox_picker; - private System.Windows.Forms.CheckedListBox checkedDestinationsListBox; + private System.Windows.Forms.ListView destinationsListView; private System.Windows.Forms.GroupBox groupbox_editor; private System.Windows.Forms.CheckBox checkbox_editor_match_capture_size; private System.Windows.Forms.NumericUpDown numericUpDown_daysbetweencheck; diff --git a/Greenshot/Forms/SettingsForm.cs b/Greenshot/Forms/SettingsForm.cs index 0ae2cc24d..8da3953b6 100644 --- a/Greenshot/Forms/SettingsForm.cs +++ b/Greenshot/Forms/SettingsForm.cs @@ -279,13 +279,37 @@ namespace Greenshot { checkbox_playsound.Checked = coreConfiguration.PlayCameraSound; checkbox_picker.Checked = false; - checkedDestinationsListBox.Items.Clear(); + + destinationsListView.Items.Clear(); + destinationsListView.ListViewItemSorter = new ListviewWithDestinationComparer(); + ImageList imageList = new ImageList(); + destinationsListView.SmallImageList = imageList; + int imageNr = -1; foreach(IDestination destination in DestinationHelper.GetAllDestinations()) { + Image destinationImage = destination.DisplayIcon; + if (destinationImage != null) { + imageList.Images.Add(destination.DisplayIcon); + imageNr++; + } if (PickerDestination.DESIGNATION.Equals(destination.Designation)) { checkbox_picker.Checked = true; checkbox_picker.Text = destination.Description; } else { - checkedDestinationsListBox.Items.Add(destination, coreConfiguration.OutputDestinations.Contains(destination.Designation)); + ListViewItem item; + if (destinationImage != null) { + item = destinationsListView.Items.Add(destination.Description, imageNr); + } else { + item = destinationsListView.Items.Add(destination.Description); + } + item.Tag = destination; + item.Checked = coreConfiguration.OutputDestinations.Contains(destination.Designation); + } + } + if (checkbox_picker.Checked) { + destinationsListView.Enabled = false; + foreach(int index in destinationsListView.CheckedIndices) { + ListViewItem item = destinationsListView.Items[index]; + item.Checked = false; } } // checkbox_clipboard.Checked = coreConfiguration.OutputDestinations.Contains("Clipboard"); @@ -352,9 +376,11 @@ namespace Greenshot { if (checkbox_picker.Checked) { destinations.Add(PickerDestination.DESIGNATION); } - foreach(int index in checkedDestinationsListBox.CheckedIndices) { - IDestination destination = (IDestination)checkedDestinationsListBox.Items[index]; - if (checkedDestinationsListBox.GetItemCheckState(index) == CheckState.Checked) { + foreach(int index in destinationsListView.CheckedIndices) { + ListViewItem item = destinationsListView.Items[index]; + + IDestination destination = item.Tag as IDestination; + if (item.Checked) { destinations.Add(destination.Designation); } } @@ -499,8 +525,11 @@ namespace Greenshot { void CheckDestinationSettings() { bool clipboardDestinationChecked = false; bool pickerSelected = checkbox_picker.Checked; + destinationsListView.Enabled = true; - foreach(IDestination destination in checkedDestinationsListBox.CheckedItems) { + foreach(int index in destinationsListView.CheckedIndices) { + ListViewItem item = destinationsListView.Items[index]; + IDestination destination = item.Tag as IDestination; if (destination.Designation.Equals(ClipboardDestination.DESIGNATION)) { clipboardDestinationChecked = true; break; @@ -508,16 +537,12 @@ namespace Greenshot { } if (pickerSelected) { - foreach(int index in checkedDestinationsListBox.CheckedIndices) { - IDestination destination = (IDestination)checkedDestinationsListBox.Items[index]; - checkedDestinationsListBox.SetItemCheckState(index, CheckState.Indeterminate); + destinationsListView.Enabled = false; + foreach(int index in destinationsListView.CheckedIndices) { + ListViewItem item = destinationsListView.Items[index]; + item.Checked = false; } } else { - foreach(int index in checkedDestinationsListBox.CheckedIndices) { - if (checkedDestinationsListBox.GetItemCheckState(index) == CheckState.Indeterminate) { - checkedDestinationsListBox.SetItemCheckState(index, CheckState.Checked); - } - } // Prevent multiple clipboard settings at once, see bug #3435056 if (clipboardDestinationChecked) { checkbox_copypathtoclipboard.Checked = false; @@ -532,4 +557,29 @@ namespace Greenshot { CheckDestinationSettings(); } } + + public class ListviewWithDestinationComparer : System.Collections.IComparer { + public int Compare(object x, object y) { + if (!(x is ListViewItem)) { + return (0); + } + if (!(y is ListViewItem)) { + return (0); + } + + ListViewItem l1 = (ListViewItem)x; + ListViewItem l2 = (ListViewItem)y; + + IDestination firstDestination = l1.Tag as IDestination; + IDestination secondDestination = l2.Tag as IDestination; + + if (secondDestination == null) { + return 1; + } + if (firstDestination.Priority == secondDestination.Priority) { + return firstDestination.Description.CompareTo(secondDestination.Description); + } + return firstDestination.Priority - secondDestination.Priority; + } + } } diff --git a/Greenshot/Forms/SettingsForm.resx b/Greenshot/Forms/SettingsForm.resx index a05dd69a1..c1d301171 100644 --- a/Greenshot/Forms/SettingsForm.resx +++ b/Greenshot/Forms/SettingsForm.resx @@ -112,29 +112,29 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - iVBORw0KGgoAAAANSUhEUgAAABcAAAAYCAYAAAARfGZ1AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOwAAA - DsABataJCQAAAhhJREFUSEu109Fu0mAYxvHXK/AWvAXjHXjiFRATT/TEuGk2D1zs5olxooYDncahAUdk - NWIz0Gm3ocS6xdVRHQhRsggilgnrZGNdnNGYBXikX8JSodQD0ib/pEnf95fmS7tvVQfIqUutNuBUVGji - TkX5zQacinKVBuwSF7PwBp/iwTPFds7KoE/fG7DLH4oi8XUXA+fduHKLR2guaTtvtmhl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cv/wIx4ZVTMa2OwzDpA/fa2jPWEWpVGKw + sQqe5+FyuZr4XQbPziZQLv/CrfthHO1L4/illQ7DMCm5WkN7xlehqiqD4/E4W0XrjQ24WNxh8Iz0BYdd + r1hWjiUeiioYdnuRSMgdcKFQxZh/Co+jSQYePCKwLPHlYg1W8eI79HPXIAgv91eRzW7APfYAT+Kf9mcO + HLqHAc+ypUFLX/fQrUBkEWcvXMH8fBqZzBoGhq6Db/6p5vOnR6Su87SQ/QO7fMJrnDgzyDLu/3fe/Jxi + md9wKhJTuzCHHi+zRZH3OzDXo/2PRaGlbZjrFTdbFHyzBacif3wTTkXjL3Q4Fd2cWYdT/QX1oojdNG2w + yQAAAABJRU5ErkJggg== + + \ No newline at end of file