- Timestamp:
- 11/19/15 12:02:40 (8 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 12983,12986,13252,13271
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.DataPreprocessing.Views merged: 12983,12986,13252,13271
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs
r12718 r13289 59 59 InitializeComponent(); 60 60 dataGridView.CellMouseClick += dataGridView_CellMouseClick; 61 dataGridView.RowHeaderMouseClick += dataGridView_RowHeaderMouseClick; 61 62 dataGridView.KeyDown += dataGridView_KeyDown; 62 63 dataGridView.MouseUp += dataGridView_MouseUp; … … 142 143 143 144 144 //protected override void PasteValuesToDataGridView() { 145 // base.PasteValuesToDataGridView(); 146 // dataGridView.Refresh(); 147 //} 145 protected override void PasteValuesToDataGridView() { 146 string[,] values = SplitClipboardString(Clipboard.GetText()); 147 int rowIndex = 0; 148 int columnIndex = 0; 149 if (dataGridView.CurrentCell != null) { 150 rowIndex = dataGridView.CurrentCell.RowIndex; 151 columnIndex = dataGridView.CurrentCell.ColumnIndex; 152 } 153 if (Content.Rows < values.GetLength(1) + rowIndex) Content.Rows = values.GetLength(1) + rowIndex; 154 if (Content.Columns < values.GetLength(0) + columnIndex) Content.Columns = values.GetLength(0) + columnIndex; 155 156 ReplaceTransaction(() => { 157 Content.PreProcessingData.InTransaction(() => { 158 for (int row = 0; row < values.GetLength(1); row++) { 159 for (int col = 0; col < values.GetLength(0); col++) { 160 Content.SetValue(values[col, row], row + rowIndex, col + columnIndex); 161 } 162 } 163 }); 164 }); 165 166 ClearSorting(); 167 } 148 168 149 169 protected override void SetEnabledStateOfControls() { … … 165 185 protected override void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { 166 186 if (Content != null) { 167 if (e.Button == System.Windows.Forms.MouseButtons.Left) {187 if (e.Button == MouseButtons.Left) { 168 188 dataGridView.Focus(); 169 189 dataGridView.ClearSelection(); … … 174 194 dataGridView[e.ColumnIndex, i].Selected = true; 175 195 } 176 } else if (Content.SortableView) { 196 } else if (e.Button == MouseButtons.Middle) { 197 int newIndex = e.ColumnIndex >= 0 ? e.ColumnIndex : 0; 198 Content.PreProcessingData.InsertColumn<double>(newIndex.ToString(), newIndex); 199 } else if (e.Button == MouseButtons.Right && Content.SortableView) { 177 200 SortColumn(e.ColumnIndex); 178 201 } 179 202 } 180 203 searchIterator = null; 204 } 205 private void dataGridView_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { 206 if (Content != null) { 207 if (e.Button == MouseButtons.Middle) { 208 int newIndex = e.RowIndex >= 0 ? e.RowIndex : 0; 209 Content.PreProcessingData.InsertRow(newIndex); 210 } 211 } 181 212 } 182 213 … … 450 481 private void dataGridView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { 451 482 if (Content == null) return; 452 if (e.Button == System.Windows.Forms.MouseButtons.Right && !(e.ColumnIndex != -1 && e.RowIndex == -1)) {483 if (e.Button == MouseButtons.Right && !(e.ColumnIndex != -1 && e.RowIndex == -1)) { 453 484 if (e.ColumnIndex == -1 || e.RowIndex == -1) { 454 485 replaceValueOverColumnToolStripMenuItem.Visible = false; … … 612 643 #endregion 613 644 645 private void addRowButton_Click(object sender, EventArgs e) { 646 Content.PreProcessingData.InsertRow(Content.Rows); 647 } 648 649 private void addColumnButton_Click(object sender, EventArgs e) { 650 Content.PreProcessingData.InsertColumn<double>(Content.Columns.ToString(), Content.Columns); 651 } 652 653 private void renameColumnsButton_Click(object sender, EventArgs e) { 654 var renameDialog = new RenameColumnsDialog(Content.ColumnNames); 655 656 if (renameDialog.ShowDialog(this) == DialogResult.OK) { 657 Content.PreProcessingData.RenameColumns(renameDialog.ColumnNames); 658 } 659 } 614 660 } 615 661 }
Note: See TracChangeset
for help on using the changeset viewer.