Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12158


Ignore:
Timestamp:
03/09/15 10:28:35 (9 years ago)
Author:
ehopf
Message:

#2335 Added a possibility to delete columns in the DataGrid view of the data preprocessing.

Location:
branches/DataPreprocessingImprovements
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessingImprovements/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs

    r12012 r12158  
    438438      if (Content == null) return;
    439439      if (e.Button == System.Windows.Forms.MouseButtons.Right) {
     440        if (e.ColumnIndex != -1 && e.RowIndex == -1) {
     441          dataGridView.Focus();
     442          dataGridView.ClearSelection();
     443          for (int r = 0; r < dataGridView.RowCount; r++) {
     444            dataGridView[e.ColumnIndex, r].Selected = true;
     445          }
     446          return;
     447        }
    440448        if (e.ColumnIndex == -1 || e.RowIndex == -1) {
    441449          replaceValueOverColumnToolStripMenuItem.Visible = false;
     
    474482    private void dataGridView_KeyDown(object sender, KeyEventArgs e) {
    475483      var selectedRows = dataGridView.SelectedRows;
    476       if (e.KeyCode == Keys.Delete && selectedRows.Count > 0) {
    477         List<int> rows = new List<int>();
    478         for (int i = 0; i < selectedRows.Count; ++i) {
    479           rows.Add(selectedRows[i].Index);
    480         }
    481         Content.DeleteRow(rows);
    482       } else if (e.Control && e.KeyCode == Keys.F) {
    483         CreateFindAndReplaceDialog();
    484         findAndReplaceDialog.ActivateSearch();
    485       } else if (e.Control && e.KeyCode == Keys.R) {
    486         CreateFindAndReplaceDialog();
    487         findAndReplaceDialog.ActivateReplace();
     484      var selectedCells = dataGridView.SelectedCells;
     485      if (!Content.FilterLogic.IsFiltered) { //data is in read only mode....
     486        if (e.KeyCode == Keys.Delete && selectedCells.Count == Content.Rows && selectedCells.Count > 0) {
     487          Content.DeleteColumn(selectedCells[0].ColumnIndex);
     488        } else if (e.KeyCode == Keys.Delete && selectedRows.Count > 0) {
     489          List<int> rows = new List<int>();
     490          for (int i = 0; i < selectedRows.Count; ++i) {
     491            rows.Add(selectedRows[i].Index);
     492          }
     493          Content.DeleteRows(rows);
     494        } else if (e.Control && e.KeyCode == Keys.F) {
     495          CreateFindAndReplaceDialog();
     496          findAndReplaceDialog.ActivateSearch();
     497        } else if (e.Control && e.KeyCode == Keys.R) {
     498          CreateFindAndReplaceDialog();
     499          findAndReplaceDialog.ActivateReplace();
     500        }
    488501      }
    489502    }
  • branches/DataPreprocessingImprovements/HeuristicLab.DataPreprocessing/3.4/Implementations/DataGridContent.cs

    r12012 r12158  
    114114    }
    115115
    116     public void DeleteRow(IEnumerable<int> rows) {
     116    public void DeleteRows(IEnumerable<int> rows) {
    117117      PreProcessingData.DeleteRowsWithIndices(rows);
    118118      createRowNames();
     119    }
     120
     121    public void DeleteColumn(int column) {
     122      PreProcessingData.DeleteColumn(column);
    119123    }
    120124
  • branches/DataPreprocessingImprovements/HeuristicLab.DataPreprocessing/3.4/Interfaces/IDataGridContent.cs

    r12012 r12158  
    3131    IDictionary<int, IList<int>> Selection { get; set; }
    3232
    33     void DeleteRow(IEnumerable<int> rows);
     33    void DeleteRows(IEnumerable<int> rows);
     34    void DeleteColumn(int column);
    3435    bool Validate(string value, out string errorMessage, int columnIndex);
    3536
Note: See TracChangeset for help on using the changeset viewer.