- Timestamp:
- 06/26/19 08:13:50 (5 years ago)
- Location:
- branches/2925_AutoDiffForDynamicalModels
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2925_AutoDiffForDynamicalModels
- Property svn:mergeinfo changed
/trunk merged: 17007-17009,17014-17016,17019-17024,17028,17030,17032-17033
- Property svn:mergeinfo changed
-
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Core.Views merged: 17007-17009,17015
- Property svn:mergeinfo changed
-
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/CheckedItemCollectionView.cs
r16662 r17035 34 34 [Content(typeof(ReadOnlyCheckedItemCollection<>), true)] 35 35 public partial class CheckedItemCollectionView<T> : ItemCollectionView<T> where T : class, IItem { 36 private bool suppressCheckedEvents; 37 36 38 public new ICheckedItemCollection<T> Content { 37 39 get { return (ICheckedItemCollection<T>)base.Content; } … … 84 86 doubleClick = false; 85 87 } else { 88 bool check = e.NewValue == CheckState.Checked; 86 89 var checkedItem = (T)itemsListView.Items[e.Index].Tag; 87 bool check = e.NewValue == CheckState.Checked; 88 if (Content.ItemChecked(checkedItem) != check) { 89 if (!ReadOnly && !Locked) Content.SetItemCheckedState(checkedItem, check); 90 else e.NewValue = e.CurrentValue; 91 } 90 if (Content.ItemChecked(checkedItem) == check) return; 91 92 suppressCheckedEvents = true; 93 try { 94 if (itemsListView.SelectedIndices.Count > 1 95 && itemsListView.SelectedIndices.Contains(e.Index)) { 96 if (!ReadOnly && !Locked) Content.SetItemCheckedState(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (T)x.Tag), check); 97 else e.NewValue = e.CurrentValue; 98 } else { 99 if (!ReadOnly && !Locked) Content.SetItemCheckedState(checkedItem, check); 100 else e.NewValue = e.CurrentValue; 101 } 102 } finally { suppressCheckedEvents = false; } 92 103 } 93 104 } 94 protected void itemsListView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) {105 protected void itemsListView_MouseDown(object sender, MouseEventArgs e) { 95 106 if (e.Clicks > 1) 96 107 doubleClick = true; … … 103 114 Invoke(new CollectionItemsChangedEventHandler<T>(Content_CheckedItemsChanged), sender, e); 104 115 else { 105 UpdateCheckedItemState(e.Items);116 if (!suppressCheckedEvents) UpdateCheckedItemState(e.Items); 106 117 SetNumberOfCheckItems(); 107 118 } … … 130 141 131 142 private void UpdateCheckedItemState(IEnumerable<T> items) { 132 foreach (T item in items) { 133 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) { 134 var isChecked = Content.ItemChecked(item); 135 if (listViewItem.Checked != isChecked) 136 listViewItem.Checked = isChecked; 143 itemsListView.BeginUpdate(); 144 try { 145 foreach (T item in items) { 146 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) { 147 var isChecked = Content.ItemChecked(item); 148 if (listViewItem.Checked != isChecked) 149 listViewItem.Checked = isChecked; 150 } 137 151 } 138 } 152 } finally { itemsListView.EndUpdate(); itemsListView.Refresh(); } 139 153 } 140 154 } -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/CheckedItemListView.cs
r16662 r17035 37 37 [Content(typeof(ReadOnlyCheckedItemList<>), true)] 38 38 public partial class CheckedItemListView<T> : ItemListView<T> where T : class, IItem { 39 private bool suppressCheckedEvents; 40 39 41 public new ICheckedItemList<T> Content { 40 42 get { return (ICheckedItemList<T>)base.Content; } … … 86 88 doubleClick = false; 87 89 } else { 88 var checkedItem = (T)itemsListView.Items[e.Index].Tag;89 90 bool check = e.NewValue == CheckState.Checked; 90 if (Content.ItemChecked(checkedItem) != check) { 91 if (!ReadOnly && !Locked) Content.SetItemCheckedState(checkedItem, check); 92 else e.NewValue = e.CurrentValue; 93 } 91 if (Content.ItemChecked(e.Index) == check) return; 92 93 suppressCheckedEvents = true; 94 try { 95 if (itemsListView.SelectedIndices.Count > 1 96 && itemsListView.SelectedIndices.Contains(e.Index)) { 97 if (!ReadOnly && !Locked) Content.SetItemCheckedState(itemsListView.SelectedIndices.Cast<int>(), check); 98 else e.NewValue = e.CurrentValue; 99 } else { 100 var checkedItem = (T)itemsListView.Items[e.Index].Tag; 101 if (!ReadOnly && !Locked) Content.SetItemCheckedState(checkedItem, check); 102 else e.NewValue = e.CurrentValue; 103 } 104 } finally { suppressCheckedEvents = false; } 94 105 } 95 106 } … … 139 150 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_CheckedItemsChanged), sender, e); 140 151 else { 141 UpdateCheckedItemState(e.Items);152 if (!suppressCheckedEvents) UpdateCheckedItemState(e.Items); 142 153 SetNumberOfCheckItems(); 143 154 } … … 175 186 176 187 private void UpdateCheckedItemState(IEnumerable<IndexedItem<T>> items) { 177 foreach (var item in items) { 178 var isChecked = Content.ItemChecked(item.Value); 179 if (itemsListView.Items[item.Index].Checked != isChecked) 180 itemsListView.Items[item.Index].Checked = isChecked; 181 } 188 itemsListView.BeginUpdate(); 189 try { 190 foreach (var item in items) { 191 var isChecked = Content.ItemChecked(item.Value); 192 if (itemsListView.Items[item.Index].Checked != isChecked) 193 itemsListView.Items[item.Index].Checked = isChecked; 194 } 195 } finally { itemsListView.EndUpdate(); itemsListView.Refresh(); } 182 196 } 183 197 } -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/Clipboard.cs
r17000 r17035 155 155 foreach (string filename in items) { 156 156 try { 157 T item = (T)ContentManager.Load(filename); 157 T item = null; 158 if (HeuristicLab.Persistence.Default.Xml.XmlParser.CanOpen(filename)) { 159 item = HeuristicLab.Persistence.Default.Xml.XmlParser.Deserialize<T>(filename); 160 } else { 161 item = (T)new ProtoBufSerializer().Deserialize(filename); 162 } 158 163 OnItemLoaded(item, progressBar.Maximum / items.Length); 159 } catch (Exception) {164 } catch (Exception) { 160 165 // ignore if loading a clipboad item fails. 161 166 } -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj
r17000 r17035 375 375 <Private>False</Private> 376 376 </ProjectReference> 377 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> 378 <Project>{102bc7d3-0ef9-439c-8f6d-96ff0fdb8e1b}</Project> 379 <Name>HeuristicLab.Persistence-3.3</Name> 380 <Private>False</Private> 381 </ProjectReference> 377 382 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> 378 383 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/ItemArrayView.Designer.cs
r16662 r17035 20 20 #endregion 21 21 22 using System.Security.AccessControl;23 22 using System.Windows.Forms; 24 23 … … 154 153 this.itemsListView.DoubleClick += new System.EventHandler(this.itemsListView_DoubleClick); 155 154 this.itemsListView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.itemsListView_KeyDown); 155 this.itemsListView.Layout += new System.Windows.Forms.LayoutEventHandler(this.itemsListView_Layout); 156 // 157 // listViewColumnHeader 158 // 159 this.listViewColumnHeader.Width = 190; 156 160 // 157 161 // imageList -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/ItemArrayView.cs
r16662 r17035 237 237 (Content != null) && !Content.IsReadOnly && !ReadOnly; 238 238 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && (Content != null) && !Content.IsReadOnly && !ReadOnly; 239 AdjustListViewColumnSizes();240 239 241 240 if (showDetailsCheckBox.Checked) { … … 330 329 } 331 330 } 331 protected virtual void itemsListView_Layout(object sender, LayoutEventArgs e) { 332 if (itemsListView.Columns.Count == 1) 333 AdjustListViewColumnSizes(); 334 } 332 335 #endregion 333 336 … … 453 456 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) 454 457 UpdateListViewItemText(listViewItem); 455 AdjustListViewColumnSizes(); 458 if (itemsListView.Columns.Count > 1) 459 AdjustListViewColumnSizes(); 456 460 } 457 461 } … … 460 464 #region Helpers 461 465 protected virtual void AdjustListViewColumnSizes() { 462 if (itemsListView.Items.Count > 0) { 463 for (int i = 0; i < itemsListView.Columns.Count; i++) 464 itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 466 if (itemsListView.Columns.Count == 1) { 467 if (itemsListView.Columns[0].Width != itemsListView.ClientSize.Width) 468 itemsListView.Columns[0].Width = itemsListView.ClientSize.Width; 469 } else { 470 if (itemsListView.Items.Count > 0) { 471 for (int i = 0; i < itemsListView.Columns.Count; i++) 472 itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 473 } 465 474 } 466 475 } -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/ItemCollectionView.Designer.cs
r16662 r17035 20 20 #endregion 21 21 22 using System.Security.AccessControl;23 22 using System.Windows.Forms; 24 23 … … 107 106 this.itemsListView.DoubleClick += new System.EventHandler(this.itemsListView_DoubleClick); 108 107 this.itemsListView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.itemsListView_KeyDown); 108 this.itemsListView.Layout += new System.Windows.Forms.LayoutEventHandler(this.itemsListView_Layout); 109 // 110 // columnHeader1 111 // 112 this.columnHeader1.Width = 240; 109 113 // 110 114 // imageList -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r16662 r17035 221 221 protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) { 222 222 removeButton.Enabled = (Content != null) && !Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0; 223 AdjustListViewColumnSizes();224 223 if (showDetailsCheckBox.Checked) { 225 224 if (itemsListView.SelectedItems.Count == 1) { … … 327 326 } 328 327 } 328 protected virtual void itemsListView_Layout(object sender, LayoutEventArgs e) { 329 if (itemsListView.Columns.Count == 1) 330 AdjustListViewColumnSizes(); 331 } 329 332 #endregion 330 333 … … 423 426 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) 424 427 UpdateListViewItemText(listViewItem); 425 AdjustListViewColumnSizes(); 428 if (itemsListView.Columns.Count > 1) 429 AdjustListViewColumnSizes(); 426 430 } 427 431 } … … 435 439 } 436 440 protected virtual void AdjustListViewColumnSizes() { 437 if (itemsListView.Items.Count > 0) { 438 for (int i = 0; i < itemsListView.Columns.Count; i++) 439 itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 441 if (itemsListView.Columns.Count == 1) { 442 if (itemsListView.Columns[0].Width != itemsListView.ClientSize.Width) 443 itemsListView.Columns[0].Width = itemsListView.ClientSize.Width; 444 } else { 445 if (itemsListView.Items.Count > 0) { 446 for (int i = 0; i < itemsListView.Columns.Count; i++) 447 itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 448 } 440 449 } 441 450 } -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/ItemListView.Designer.cs
r16662 r17035 155 155 this.itemsListView.DoubleClick += new System.EventHandler(this.itemsListView_DoubleClick); 156 156 this.itemsListView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.itemsListView_KeyDown); 157 this.itemsListView.Layout += new System.Windows.Forms.LayoutEventHandler(this.itemsListView_Layout); 158 // 159 // listViewColumnHeader 160 // 161 this.listViewColumnHeader.Width = 190; 157 162 // 158 163 // imageList -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/ItemListView.cs
r16662 r17035 242 242 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && 243 243 (Content != null) && !Content.IsReadOnly && !ReadOnly; 244 AdjustListViewColumnSizes(); 245 244 246 245 if (showDetailsCheckBox.Checked) { 247 246 if (itemsListView.SelectedItems.Count == 1) { … … 354 353 } 355 354 } 355 protected virtual void itemsListView_Layout(object sender, LayoutEventArgs e) { 356 if (itemsListView.Columns.Count == 1) 357 AdjustListViewColumnSizes(); 358 } 356 359 #endregion 357 360 … … 494 497 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) 495 498 UpdateListViewItemText(listViewItem); 496 AdjustListViewColumnSizes(); 499 if (itemsListView.Columns.Count > 1) 500 AdjustListViewColumnSizes(); 497 501 } 498 502 } … … 501 505 #region Helpers 502 506 protected virtual void AdjustListViewColumnSizes() { 503 if (itemsListView.Items.Count > 0) { 504 for (int i = 0; i < itemsListView.Columns.Count; i++) 505 itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 507 if (itemsListView.Columns.Count == 1) { 508 if (itemsListView.Columns[0].Width != itemsListView.ClientSize.Width) 509 itemsListView.Columns[0].Width = itemsListView.ClientSize.Width; 510 } else { 511 if (itemsListView.Items.Count > 0) { 512 for (int i = 0; i < itemsListView.Columns.Count; i++) 513 itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 514 } 506 515 } 507 516 } -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Core.Views/3.3/Plugin.cs.frame
r17000 r17035 35 35 [PluginDependency("HeuristicLab.MainForm", "3.3")] 36 36 [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")] 37 [PluginDependency("HeuristicLab.Persistence", "3.3")] 37 38 public class HeuristicLabCoreViewsPlugin : PluginBase { 38 39 }
Note: See TracChangeset
for help on using the changeset viewer.