Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs @ 10938

Last change on this file since 10938 was 10938, checked in by mleitner, 10 years ago

Improve context menu replace performance by disabling repaint

File size: 23.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Drawing;
25using System.Linq;
26using System.Windows.Forms;
27using HeuristicLab.Data;
28using HeuristicLab.DataPreprocessing.Filter;
29using HeuristicLab.MainForm;
30
31namespace HeuristicLab.DataPreprocessing.Views {
32  [View("Data Grid Content View")]
33  [Content(typeof(IDataGridContent), true)]
34  public partial class DataGridContentView : CopyOfStringConvertibleMatrixView {
35
36    private bool notOwnEvent = true;
37    private bool isSearching = false;
38    private bool isReplacing = false;
39    private bool updateOnMouseUp = false;
40    private SearchAndReplaceDialog findAndReplaceDialog;
41    private IFindPreprocessingItemsIterator searchIterator;
42    private string currentSearchText;
43    private ComparisonOperation currentComparisonOperation;
44    private Tuple<int, int> currentCell;
45
46    public new IDataGridContent Content {
47      get { return (IDataGridContent)base.Content; }
48      set { base.Content = value; }
49    }
50
51    private IList<int> _highlightedRowIndices;
52    public IList<int> HighlightedRowIndices {
53      get { return _highlightedRowIndices; }
54      set {
55        _highlightedRowIndices = value;
56        Refresh();
57      }
58    }
59
60    private IDictionary<int, IList<int>> _highlightedCellsBackground;
61    public IDictionary<int, IList<int>> HightlightedCellsBackground {
62      get { return _highlightedCellsBackground; }
63      set {
64        _highlightedCellsBackground = value;
65        Refresh();
66      }
67    }
68
69    public DataGridContentView() {
70      InitializeComponent();
71      dataGridView.CellMouseClick += dataGridView_CellMouseClick;
72      dataGridView.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(dataGridView_CellPainting);
73      dataGridView.KeyDown += dataGridView_KeyDown;
74      dataGridView.MouseUp += dataGridView_MouseUp;
75      contextMenuCell.Items.Add(ShowHideColumns);
76      _highlightedRowIndices = new List<int>();
77      _highlightedCellsBackground = new Dictionary<int, IList<int>>();
78      currentCell = null;
79    }
80
81    protected override void dataGridView_SelectionChanged(object sender, EventArgs e) {
82      if (Content != null) {
83        if (!isSearching && !isReplacing) {
84
85          if (Control.MouseButtons == MouseButtons.Left) {
86            updateOnMouseUp = true;
87            return;
88          }
89           
90          base.dataGridView_SelectionChanged(sender, e);
91       
92          Content.DataGridLogic.SetSelection(GetSelectedCells());
93        }
94      }
95    }
96
97    private void dataGridView_MouseUp(object sender, MouseEventArgs e) {
98      if (!updateOnMouseUp)
99        return;
100
101      updateOnMouseUp = false;
102      dataGridView_SelectionChanged(sender, e);
103    }                                     
104
105    protected override void OnContentChanged() {
106      base.OnContentChanged();
107      // ToDo: Temporarily disabled because needs to much performance
108      //DataGridView.AutoResizeColumns();
109      //DataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders);
110      DataGridView.RowHeadersWidth = 70;
111      if (Content == null && findAndReplaceDialog != null) {
112        findAndReplaceDialog.Close();
113      }
114    }
115
116    protected override void RegisterContentEvents() {
117      base.RegisterContentEvents();
118      Content.Changed += Content_Changed;
119      Content.FilterLogic.FilterChanged += FilterLogic_FilterChanged;
120    }
121
122    protected override void DeregisterContentEvents() {
123      base.DeregisterContentEvents();
124      Content.Changed -= Content_Changed;
125      Content.FilterLogic.FilterChanged -= FilterLogic_FilterChanged;
126    }
127
128    void FilterLogic_FilterChanged(object sender, EventArgs e) {
129      OnContentChanged();
130      searchIterator = null;
131      if (findAndReplaceDialog != null && !findAndReplaceDialog.IsDisposed) {
132        if (Content.FilterLogic.IsFiltered) {
133          findAndReplaceDialog.DisableReplace();
134        } else {
135          findAndReplaceDialog.EnableReplace();
136        }
137      }
138      btnReplace.Enabled = !Content.FilterLogic.IsFiltered;
139    }
140
141    void Content_Changed(object sender, DataPreprocessingChangedEventArgs e) {
142      if (notOwnEvent) {
143        switch (e.Type) {
144          case DataPreprocessingChangedEventType.ChangeColumn:
145          case DataPreprocessingChangedEventType.ChangeItem:
146            dataGridView.Refresh();
147            break;
148          default:
149            OnContentChanged();
150            break;
151        }
152      }
153      searchIterator = null;
154    }
155
156    protected override void dataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) {
157      if (!dataGridView.ReadOnly) {
158        string errorMessage;
159        if (Content != null) {
160          if (dataGridView.IsCurrentCellInEditMode && Content.FilterLogic.IsFiltered) {
161            errorMessage = "A filter is active, you cannot modify data. Press ESC to exit edit mode.";
162          } else {
163            Content.DataGridLogic.Validate(e.FormattedValue.ToString(), out errorMessage, e.ColumnIndex);
164          }
165
166          if (!String.IsNullOrEmpty(errorMessage)) {
167            e.Cancel = true;
168            dataGridView.Rows[e.RowIndex].ErrorText = errorMessage;
169          }
170        }
171      }
172    }
173
174    protected override void dataGridView_CellParsing(object sender, DataGridViewCellParsingEventArgs e) {
175      triggersOwnEvent(() => base.dataGridView_CellParsing(sender, e));
176    }
177
178    protected override void PasteValuesToDataGridView() {
179      triggersOwnEvent(() => base.PasteValuesToDataGridView());
180    }
181
182    protected override void SetEnabledStateOfControls() {
183      base.SetEnabledStateOfControls();
184      rowsTextBox.ReadOnly = true;
185      columnsTextBox.ReadOnly = true;
186    }
187
188    private void btnApplySort_Click(object sender, System.EventArgs e) {
189      triggersOwnEvent(() => {
190        Content.ManipulationLogic.ReOrderToIndices(virtualRowIndices);
191        OnContentChanged();
192      });
193    }
194
195    private void triggersOwnEvent(Action action) {
196      notOwnEvent = false;
197      action();
198      notOwnEvent = true;
199    }
200
201    #region FindAndReplaceDialog
202
203    private void CreateFindAndReplaceDialog() {
204      if (findAndReplaceDialog == null || findAndReplaceDialog.IsDisposed) {
205        findAndReplaceDialog = new SearchAndReplaceDialog();
206        findAndReplaceDialog.Show(this);
207        if (AreMultipleCellsSelected()) {
208          ResetHighlightedCellsBackground();
209          HightlightedCellsBackground = GetSelectedCells();
210          dataGridView.ClearSelection();
211        }
212        findAndReplaceDialog.FindAllEvent += findAndReplaceDialog_FindAllEvent;
213        findAndReplaceDialog.FindNextEvent += findAndReplaceDialog_FindNextEvent;
214        findAndReplaceDialog.ReplaceAllEvent += findAndReplaceDialog_ReplaceAllEvent;
215        findAndReplaceDialog.ReplaceNextEvent += findAndReplaceDialog_ReplaceEvent;
216        findAndReplaceDialog.FormClosing += findAndReplaceDialog_FormClosing;
217        searchIterator = null;
218        DataGridView.SelectionChanged += DataGridView_SelectionChanged_FindAndReplace;
219        if (Content.FilterLogic.IsFiltered) {
220          findAndReplaceDialog.DisableReplace();
221        }
222      }
223    }
224
225    private void DataGridView_SelectionChanged_FindAndReplace(object sender, EventArgs e) {
226      if (Content != null) {
227        if (!isSearching && AreMultipleCellsSelected()) {
228          ResetHighlightedCellsBackground();
229          HightlightedCellsBackground = GetSelectedCells();
230          searchIterator = null;
231        }
232      }
233    }
234
235    void findAndReplaceDialog_FormClosing(object sender, FormClosingEventArgs e) {
236      ResetHighlightedCellsBackground();
237      searchIterator = null;
238      DataGridView.SelectionChanged -= DataGridView_SelectionChanged_FindAndReplace;
239    }
240
241    void findAndReplaceDialog_ReplaceEvent(object sender, EventArgs e) {
242      if (searchIterator != null && searchIterator.GetCurrent() != null) {
243        Replace(TransformToDictionary(currentCell));
244      }
245    }
246
247    void findAndReplaceDialog_ReplaceAllEvent(object sender, EventArgs e) {
248      Replace(FindAll(findAndReplaceDialog.GetSearchText()));
249    }
250
251    void findAndReplaceDialog_FindNextEvent(object sender, EventArgs e) {
252      if (searchIterator == null ||
253        currentSearchText != findAndReplaceDialog.GetSearchText() ||
254        currentComparisonOperation != findAndReplaceDialog.GetComparisonOperation()) {
255        searchIterator = new FindPreprocessingItemsIterator(FindAll(findAndReplaceDialog.GetSearchText()));
256        currentSearchText = findAndReplaceDialog.GetSearchText();
257        currentComparisonOperation = findAndReplaceDialog.GetComparisonOperation();
258      }
259
260      if (IsOneCellSelected()) {
261        var first = GetSelectedCells().First();
262        searchIterator.SetStartCell(first.Key, first.Value[0]);
263      }
264
265      bool moreOccurences = false;
266      currentCell = searchIterator.GetCurrent();
267      moreOccurences = searchIterator.MoveNext();
268      if (IsOneCellSelected() && currentCell != null) {
269        var first = GetSelectedCells().First();
270        if (currentCell.Item1 == first.Key && currentCell.Item2 == first.Value[0]) {
271          if (!moreOccurences) {
272            searchIterator.Reset();
273          }
274          currentCell = searchIterator.GetCurrent();
275          moreOccurences = searchIterator.MoveNext();
276          if (!moreOccurences) {
277            searchIterator.Reset();
278          }
279        }
280      }
281
282      dataGridView.ClearSelection();
283
284      if (currentCell != null) {
285        dataGridView[currentCell.Item1, currentCell.Item2].Selected = true;
286      }
287    }
288
289    private bool AreMultipleCellsSelected() {
290      return GetSelectedCellCount() > 1;
291    }
292
293    private bool IsOneCellSelected() {
294      return GetSelectedCellCount() == 1;
295    }
296
297    private int GetSelectedCellCount() {
298      int count = 0;
299      foreach (var column in GetSelectedCells()) {
300        count += column.Value.Count();
301      }
302      return count;
303    }
304
305    void findAndReplaceDialog_FindAllEvent(object sender, EventArgs e) {
306      dataGridView.ClearSelection();
307      isSearching = true;
308      SuspendRepaint();
309      var selectedCells = FindAll(findAndReplaceDialog.GetSearchText());
310      foreach (var column in selectedCells) {
311        foreach (var cell in column.Value) {
312          dataGridView[column.Key, cell].Selected = true;
313        }
314      }
315      ResumeRepaint(true);
316      isSearching = false;
317      Content.DataGridLogic.SetSelection(selectedCells);
318      //update statistic in base
319      base.dataGridView_SelectionChanged(sender, e);
320    }
321
322    private Core.ConstraintOperation GetConstraintOperation(ComparisonOperation comparisonOperation) {
323      Core.ConstraintOperation constraintOperation = Core.ConstraintOperation.Equal;
324      switch (comparisonOperation) {
325        case ComparisonOperation.Equal:
326          constraintOperation = Core.ConstraintOperation.Equal;
327          break;
328        case ComparisonOperation.Greater:
329          constraintOperation = Core.ConstraintOperation.Greater;
330          break;
331        case ComparisonOperation.GreaterOrEqual:
332          constraintOperation = Core.ConstraintOperation.GreaterOrEqual;
333          break;
334        case ComparisonOperation.Less:
335          constraintOperation = Core.ConstraintOperation.Less;
336          break;
337        case ComparisonOperation.LessOrEqual:
338          constraintOperation = Core.ConstraintOperation.LessOrEqual;
339          break;
340        case ComparisonOperation.NotEqual:
341          constraintOperation = Core.ConstraintOperation.NotEqual;
342          break;
343      }
344      return constraintOperation;
345    }
346
347    private IDictionary<int, IList<int>> FindAll(string match) {
348      bool searchInSelection = HightlightedCellsBackground.Values.Sum(list => list.Count) > 1;
349      ComparisonOperation comparisonOperation = findAndReplaceDialog.GetComparisonOperation();
350      var comparisonFilter = new ComparisonFilter(Content.FilterLogic.PreprocessingData, GetConstraintOperation(comparisonOperation), new StringValue(match), true);
351      var filters = new List<Filter.IFilter>() { comparisonFilter };
352      var foundCells = new Dictionary<int, IList<int>>();
353      for (int i = 0; i < Content.FilterLogic.PreprocessingData.Columns; i++) {
354        comparisonFilter.ConstraintColumn = i;
355        bool[] filteredRows = Content.FilterLogic.GetFilterResult(filters, true);
356        var foundIndices = new List<int>();
357        for (int idx = 0; idx < filteredRows.Length; ++idx) {
358          var notFilteredThusFound = !filteredRows[idx];
359          if (notFilteredThusFound) {
360            foundIndices.Add(idx);
361          }
362        }
363        foundCells[i] = foundIndices;
364        IList<int> selectedList;
365        if (searchInSelection && HightlightedCellsBackground.TryGetValue(i, out selectedList)) {
366          foundCells[i] = foundCells[i].Intersect(selectedList).ToList<int>();
367        } else if (searchInSelection) {
368          foundCells[i].Clear();
369        }
370      }
371      return foundCells;
372    }
373
374    private void Replace(IDictionary<int, IList<int>> cells) {
375      if (findAndReplaceDialog != null) {
376        ReplaceTransaction(() => {
377          switch (findAndReplaceDialog.GetReplaceAction()) {
378            case ReplaceAction.Value:
379              Content.ManipulationLogic.ReplaceIndicesByValue(cells, findAndReplaceDialog.GetReplaceText());
380              break;
381            case ReplaceAction.Average:
382              Content.ManipulationLogic.ReplaceIndicesByAverageValue(cells, false);
383              break;
384            case ReplaceAction.Median:
385              Content.ManipulationLogic.ReplaceIndicesByMedianValue(cells, false);
386              break;
387            case ReplaceAction.Random:
388              Content.ManipulationLogic.ReplaceIndicesByRandomValue(cells, false);
389              break;
390            case ReplaceAction.MostCommon:
391              Content.ManipulationLogic.ReplaceIndicesByMostCommonValue(cells, false);
392              break;
393            case ReplaceAction.Interpolation:
394              Content.ManipulationLogic.ReplaceIndicesByLinearInterpolationOfNeighbours(cells);
395              break;
396          }
397        });
398      }
399    }
400
401    private IDictionary<int, IList<int>> TransformToDictionary(Tuple<int, int> tuple) {
402      var highlightCells = new Dictionary<int, IList<int>>();
403      highlightCells.Add(tuple.Item1, new List<int>() { tuple.Item2 });
404      return highlightCells;
405    }
406
407    private void ResetHighlightedCellsBackground() {
408      HightlightedCellsBackground = new Dictionary<int, IList<int>>();
409    }
410
411    #endregion FindAndReplaceDialog
412
413    private void dataGridView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
414      if (Content == null) return;
415      if (e.Button == System.Windows.Forms.MouseButtons.Right) {
416        if (e.ColumnIndex == -1 || e.RowIndex == -1) {
417          replaceValueOverColumnToolStripMenuItem.Visible = false;
418          contextMenuCell.Show(MousePosition);
419        } else {
420          if (!dataGridView.SelectedCells.Contains(dataGridView[e.ColumnIndex, e.RowIndex])) {
421            dataGridView.ClearSelection();
422            dataGridView[e.ColumnIndex, e.RowIndex].Selected = true;
423          }
424
425          var columnIndices = new HashSet<int>();
426          for (int i = 0; i < dataGridView.SelectedCells.Count; i++) {
427            columnIndices.Add(dataGridView.SelectedCells[i].ColumnIndex);
428          }
429
430          replaceValueOverSelectionToolStripMenuItem.Enabled = AreMultipleCellsSelected();
431
432          averageToolStripMenuItem_Column.Enabled =
433            averageToolStripMenuItem_Selection.Enabled =
434            medianToolStripMenuItem_Column.Enabled =
435            medianToolStripMenuItem_Selection.Enabled =
436            randomToolStripMenuItem_Column.Enabled =
437            randomToolStripMenuItem_Selection.Enabled = !Content.DataGridLogic.AreAllStringColumns(columnIndices);
438
439          smoothingToolStripMenuItem_Column.Enabled =
440            interpolationToolStripMenuItem_Column.Enabled = !dataGridView.SelectedCells.Contains(dataGridView[e.ColumnIndex, 0])
441            && !dataGridView.SelectedCells.Contains(dataGridView[e.ColumnIndex, Content.Rows - 1])
442            && !Content.DataGridLogic.AreAllStringColumns(columnIndices);
443
444          replaceValueOverColumnToolStripMenuItem.Visible = true;
445          contextMenuCell.Show(MousePosition);
446        }
447      }
448    }
449
450    protected void dataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) {
451      if (Content == null) return;
452      if (e.RowIndex < 0) return;
453      if (e.ColumnIndex < 0) return;
454      if (e.State.HasFlag(DataGridViewElementStates.Selected)) return;
455      if (!e.PaintParts.HasFlag(DataGridViewPaintParts.Background)) return;
456      if (HighlightedRowIndices == null) return;
457
458      int rowIndex = virtualRowIndices[e.RowIndex];
459
460      Color backColor = e.CellStyle.BackColor;
461
462      if (HightlightedCellsBackground.ContainsKey(e.ColumnIndex) && HightlightedCellsBackground[e.ColumnIndex].Contains(e.RowIndex)) {
463        backColor = Color.LightGray;
464      }
465
466      using (Brush backColorBrush = new SolidBrush(backColor)) {
467        Rectangle bounds = new Rectangle(e.CellBounds.X, e.CellBounds.Y, e.CellBounds.Width, e.CellBounds.Height);
468        e.Graphics.FillRectangle(backColorBrush, bounds);
469      }
470
471      using (Brush gridBrush = new SolidBrush(Color.LightGray)) {
472        Pen gridLinePen = new Pen(gridBrush);
473        e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left,
474               e.CellBounds.Bottom - 1, e.CellBounds.Right - 1,
475               e.CellBounds.Bottom - 1);
476        e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1,
477            e.CellBounds.Top, e.CellBounds.Right - 1,
478            e.CellBounds.Bottom);
479      }
480
481      e.PaintContent(e.CellBounds);
482      e.Handled = true;
483    }
484
485    void dataGridView_KeyDown(object sender, KeyEventArgs e) {
486      var selectedRows = dataGridView.SelectedRows;
487      if (e.KeyCode == Keys.Delete && selectedRows.Count > 0) {
488        List<int> rows = new List<int>();
489        for (int i = 0; i < selectedRows.Count; ++i) {
490          rows.Add(selectedRows[i].Index);
491        }
492        triggersOwnEvent(() => {
493          Content.DataGridLogic.DeleteRow(rows);
494          OnContentChanged();
495        });
496      } else if (e.Control && e.KeyCode == Keys.F) {
497        CreateFindAndReplaceDialog();
498        findAndReplaceDialog.ActivateSearch();
499      } else if (e.Control && e.KeyCode == Keys.R) {
500        CreateFindAndReplaceDialog();
501        findAndReplaceDialog.ActivateReplace();
502      }
503    }
504
505    protected override int[] Sort(IEnumerable<KeyValuePair<int, SortOrder>> sortedColumns) {
506      btnApplySort.Enabled = sortedColumns.Any();
507      return base.Sort(sortedColumns);
508    }
509
510    protected override void ClearSorting() {
511      btnApplySort.Enabled = false;
512      base.ClearSorting();
513    }
514
515    private IDictionary<int, IList<int>> GetSelectedCells() {
516      IDictionary<int, IList<int>> selectedCells = new Dictionary<int, IList<int>>();
517      for (int i = 0; i < dataGridView.SelectedCells.Count; i++) {
518        var columnIndex = dataGridView.SelectedCells[i].ColumnIndex;
519        if (!selectedCells.ContainsKey(columnIndex)) {
520          selectedCells.Add(columnIndex, new List<int>());
521        }
522        selectedCells[columnIndex].Add(dataGridView.SelectedCells[i].RowIndex);
523      }
524      return selectedCells;
525    }
526
527    private void StartReplacing() {
528      isReplacing = true;
529      SuspendRepaint();
530    }
531
532    private void StopReplacing() {
533      isReplacing = false;
534      ResumeRepaint(true);
535    }
536
537    private void ReplaceTransaction(Action action) {
538      StartReplacing();
539      action();
540      StopReplacing();
541    }
542
543    private void ReplaceWithAverage_Column_Click(object sender, EventArgs e) {
544      ReplaceTransaction(() => {
545        Content.ManipulationLogic.ReplaceIndicesByAverageValue(GetSelectedCells(), false);
546      });
547    }
548    private void ReplaceWithAverage_Selection_Click(object sender, EventArgs e) {
549      ReplaceTransaction(() => {
550        Content.ManipulationLogic.ReplaceIndicesByAverageValue(GetSelectedCells(), true);
551      });
552    }
553
554    private void ReplaceWithMedian_Column_Click(object sender, EventArgs e) {
555      ReplaceTransaction(() => {
556        Content.ManipulationLogic.ReplaceIndicesByMedianValue(GetSelectedCells(), false);
557      });
558    }
559    private void ReplaceWithMedian_Selection_Click(object sender, EventArgs e) {
560      ReplaceTransaction(() => {
561        Content.ManipulationLogic.ReplaceIndicesByMedianValue(GetSelectedCells(), true);
562      });
563    }
564
565    private void ReplaceWithRandom_Column_Click(object sender, EventArgs e) {
566      ReplaceTransaction(() => {
567        Content.ManipulationLogic.ReplaceIndicesByRandomValue(GetSelectedCells(), false);
568      });
569    }
570    private void ReplaceWithRandom_Selection_Click(object sender, EventArgs e) {
571      ReplaceTransaction(() => {
572        Content.ManipulationLogic.ReplaceIndicesByRandomValue(GetSelectedCells(), true);
573      });
574    }
575
576    private void ReplaceWithMostCommon_Column_Click(object sender, EventArgs e) {
577      ReplaceTransaction(() => {
578        Content.ManipulationLogic.ReplaceIndicesByMostCommonValue(GetSelectedCells(), false);
579      });
580    }
581    private void ReplaceWithMostCommon_Selection_Click(object sender, EventArgs e) {
582      ReplaceTransaction(() => {
583        Content.ManipulationLogic.ReplaceIndicesByMostCommonValue(GetSelectedCells(), true);
584      });
585    }
586
587    private void ReplaceWithInterpolation_Column_Click(object sender, EventArgs e) {
588      ReplaceTransaction(() => {
589        Content.ManipulationLogic.ReplaceIndicesByLinearInterpolationOfNeighbours(GetSelectedCells());
590      });
591    }
592
593    private void ReplaceWithSmoothing_Selection_Click(object sender, EventArgs e) {
594      ReplaceTransaction(() => {
595        Content.ManipulationLogic.ReplaceIndicesBySmoothing(GetSelectedCells());
596      });
597    }
598
599    private void btnSearch_Click(object sender, EventArgs e) {
600      CreateFindAndReplaceDialog();
601      findAndReplaceDialog.ActivateSearch();
602    }
603
604    private void btnReplace_Click(object sender, EventArgs e) {
605      CreateFindAndReplaceDialog();
606      findAndReplaceDialog.ActivateReplace();
607    }
608  }
609}
Note: See TracBrowser for help on using the repository browser.