Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/19/15 12:02:40 (8 years ago)
Author:
mkommend
Message:

#2486: Merged r12983, r12986, r13252 and r13271 into stable.

Location:
stable
Files:
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.DataPreprocessing.Views

  • stable/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.Designer.cs

    r12009 r13289  
    6363      this.btnReplace = new System.Windows.Forms.Button();
    6464      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     65      this.addRowButton = new System.Windows.Forms.Button();
     66      this.addColumnButton = new System.Windows.Forms.Button();
     67      this.renameColumnsButton = new System.Windows.Forms.Button();
    6568      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    6669      this.contextMenuCell.SuspendLayout();
     
    7073      //
    7174      this.rowsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
    72       this.rowsTextBox.Enabled = false;
    7375      this.errorProvider.SetIconAlignment(this.rowsTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    7476      this.errorProvider.SetIconPadding(this.rowsTextBox, 2);
    75       this.rowsTextBox.ReadOnly = true;
    7677      this.rowsTextBox.Size = new System.Drawing.Size(71, 20);
    7778      //
     
    7980      //
    8081      this.columnsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
    81       this.columnsTextBox.Enabled = false;
    82       this.columnsTextBox.ReadOnly = true;
    8382      this.columnsTextBox.Size = new System.Drawing.Size(71, 20);
    8483      //
    8584      // statisticsTextBox
    8685      //
    87       this.statisticsTextBox.Size = new System.Drawing.Size(522, 13);
     86      this.statisticsTextBox.Location = new System.Drawing.Point(3, 387);
     87      this.statisticsTextBox.Size = new System.Drawing.Size(421, 13);
    8888      //
    8989      // btnApplySort
    9090      //
    91       this.btnApplySort.Location = new System.Drawing.Point(349, 19);
     91      this.btnApplySort.Location = new System.Drawing.Point(234, 0);
    9292      this.btnApplySort.Name = "btnApplySort";
    93       this.btnApplySort.Size = new System.Drawing.Size(75, 23);
     93      this.btnApplySort.Size = new System.Drawing.Size(104, 23);
    9494      this.btnApplySort.TabIndex = 7;
    9595      this.btnApplySort.Text = "Apply Sort";
     
    104104            this.replaceValueOverSelectionToolStripMenuItem});
    105105      this.contextMenuCell.Name = "contextMenuCell";
    106       this.contextMenuCell.Size = new System.Drawing.Size(225, 70);
     106      this.contextMenuCell.Size = new System.Drawing.Size(225, 48);
    107107      //
    108108      // replaceValueOverColumnToolStripMenuItem
     
    154154      this.interpolationToolStripMenuItem_Column.Click += new System.EventHandler(this.ReplaceWithInterpolation_Column_Click);
    155155      //
    156       // smoothingToolStripMenuItem
    157       //
    158       this.smoothingToolStripMenuItem_Column.Name = "smoothingToolStripMenuItem";
     156      // smoothingToolStripMenuItem_Column
     157      //
     158      this.smoothingToolStripMenuItem_Column.Name = "smoothingToolStripMenuItem_Column";
    159159      this.smoothingToolStripMenuItem_Column.Size = new System.Drawing.Size(155, 22);
    160160      this.smoothingToolStripMenuItem_Column.Text = "Smoothing";
     
    202202      // btnSearch
    203203      //
    204       this.btnSearch.Location = new System.Drawing.Point(201, 19);
     204      this.btnSearch.Location = new System.Drawing.Point(173, 0);
    205205      this.btnSearch.Name = "btnSearch";
    206       this.btnSearch.Size = new System.Drawing.Size(53, 23);
     206      this.btnSearch.Size = new System.Drawing.Size(55, 23);
    207207      this.btnSearch.TabIndex = 8;
    208208      this.btnSearch.Text = "Search";
     
    213213      // btnReplace
    214214      //
    215       this.btnReplace.Location = new System.Drawing.Point(260, 19);
     215      this.btnReplace.Location = new System.Drawing.Point(173, 26);
    216216      this.btnReplace.Name = "btnReplace";
    217217      this.btnReplace.Size = new System.Drawing.Size(55, 23);
     
    222222      this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click);
    223223      //
     224      // addRowButton
     225      //
     226      this.addRowButton.Location = new System.Drawing.Point(344, 26);
     227      this.addRowButton.Name = "addRowButton";
     228      this.addRowButton.Size = new System.Drawing.Size(76, 23);
     229      this.addRowButton.TabIndex = 10;
     230      this.addRowButton.Text = "Add Row";
     231      this.addRowButton.UseVisualStyleBackColor = true;
     232      this.addRowButton.Click += new System.EventHandler(this.addRowButton_Click);
     233      //
     234      // addColumnButton
     235      //
     236      this.addColumnButton.Location = new System.Drawing.Point(344, 0);
     237      this.addColumnButton.Name = "addColumnButton";
     238      this.addColumnButton.Size = new System.Drawing.Size(76, 23);
     239      this.addColumnButton.TabIndex = 10;
     240      this.addColumnButton.Text = "Add Column";
     241      this.addColumnButton.UseVisualStyleBackColor = true;
     242      this.addColumnButton.Click += new System.EventHandler(this.addColumnButton_Click);
     243      //
     244      // renameColumnsButton
     245      //
     246      this.renameColumnsButton.Location = new System.Drawing.Point(234, 26);
     247      this.renameColumnsButton.Name = "renameColumnsButton";
     248      this.renameColumnsButton.Size = new System.Drawing.Size(104, 23);
     249      this.renameColumnsButton.TabIndex = 11;
     250      this.renameColumnsButton.Text = "Rename Columns";
     251      this.renameColumnsButton.UseVisualStyleBackColor = true;
     252      this.renameColumnsButton.Click += new System.EventHandler(this.renameColumnsButton_Click);
     253      //
    224254      // DataGridContentView
    225255      //
    226256      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    227257      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     258      this.Controls.Add(this.renameColumnsButton);
     259      this.Controls.Add(this.addColumnButton);
     260      this.Controls.Add(this.addRowButton);
    228261      this.Controls.Add(this.btnReplace);
    229262      this.Controls.Add(this.btnSearch);
    230263      this.Controls.Add(this.btnApplySort);
    231264      this.Name = "DataGridContentView";
    232       this.Size = new System.Drawing.Size(528, 404);
     265      this.Size = new System.Drawing.Size(430, 403);
     266      this.Controls.SetChildIndex(this.btnApplySort, 0);
     267      this.Controls.SetChildIndex(this.btnSearch, 0);
     268      this.Controls.SetChildIndex(this.btnReplace, 0);
     269      this.Controls.SetChildIndex(this.addRowButton, 0);
     270      this.Controls.SetChildIndex(this.addColumnButton, 0);
     271      this.Controls.SetChildIndex(this.renameColumnsButton, 0);
    233272      this.Controls.SetChildIndex(this.statisticsTextBox, 0);
    234273      this.Controls.SetChildIndex(this.rowsLabel, 0);
     
    236275      this.Controls.SetChildIndex(this.rowsTextBox, 0);
    237276      this.Controls.SetChildIndex(this.columnsTextBox, 0);
    238       this.Controls.SetChildIndex(this.btnApplySort, 0);
    239       this.Controls.SetChildIndex(this.btnSearch, 0);
    240       this.Controls.SetChildIndex(this.btnReplace, 0);
    241277      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    242278      this.contextMenuCell.ResumeLayout(false);
     
    265301    private System.Windows.Forms.ToolTip toolTip;
    266302    private System.Windows.Forms.ToolStripMenuItem smoothingToolStripMenuItem_Column;
     303    private System.Windows.Forms.Button addRowButton;
     304    private System.Windows.Forms.Button addColumnButton;
     305    private System.Windows.Forms.Button renameColumnsButton;
    267306  }
    268307}
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs

    r12718 r13289  
    5959      InitializeComponent();
    6060      dataGridView.CellMouseClick += dataGridView_CellMouseClick;
     61      dataGridView.RowHeaderMouseClick += dataGridView_RowHeaderMouseClick;
    6162      dataGridView.KeyDown += dataGridView_KeyDown;
    6263      dataGridView.MouseUp += dataGridView_MouseUp;
     
    142143
    143144
    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    }
    148168
    149169    protected override void SetEnabledStateOfControls() {
     
    165185    protected override void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
    166186      if (Content != null) {
    167         if (e.Button == System.Windows.Forms.MouseButtons.Left) {
     187        if (e.Button == MouseButtons.Left) {
    168188          dataGridView.Focus();
    169189          dataGridView.ClearSelection();
     
    174194            dataGridView[e.ColumnIndex, i].Selected = true;
    175195          }
    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) {
    177200          SortColumn(e.ColumnIndex);
    178201        }
    179202      }
    180203      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      }
    181212    }
    182213
     
    450481    private void dataGridView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
    451482      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)) {
    453484        if (e.ColumnIndex == -1 || e.RowIndex == -1) {
    454485          replaceValueOverColumnToolStripMenuItem.Visible = false;
     
    612643    #endregion
    613644
     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    }
    614660  }
    615661}
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj

    r12007 r13289  
    120120    <Compile Include="ComparisonFilterView.Designer.cs">
    121121      <DependentUpon>ComparisonFilterView.cs</DependentUpon>
     122    </Compile>
     123    <Compile Include="RenameColumnsDialog.cs">
     124      <SubType>Form</SubType>
     125    </Compile>
     126    <Compile Include="RenameColumnsDialog.Designer.cs">
     127      <DependentUpon>RenameColumnsDialog.cs</DependentUpon>
    122128    </Compile>
    123129    <Compile Include="ScatterPlotSingleView.cs">
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/RenameColumnsDialog.Designer.cs

    r13252 r13289  
    5656      this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    5757      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    58       this.okButton.Location = new System.Drawing.Point(83, 283);
     58      this.okButton.Location = new System.Drawing.Point(48, 302);
    5959      this.okButton.Name = "okButton";
    6060      this.okButton.Size = new System.Drawing.Size(75, 23);
     
    6767      this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    6868      this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    69       this.cancelButton.Location = new System.Drawing.Point(164, 283);
     69      this.cancelButton.Location = new System.Drawing.Point(129, 302);
    7070      this.cancelButton.Name = "cancelButton";
    7171      this.cancelButton.Size = new System.Drawing.Size(75, 23);
     
    8282            | System.Windows.Forms.AnchorStyles.Right)));
    8383      this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     84      this.dataGridView.ColumnHeadersVisible = false;
    8485      this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
    8586            this.ColumName});
    86       this.dataGridView.Location = new System.Drawing.Point(12, 12);
     87      this.dataGridView.Location = new System.Drawing.Point(0, 0);
    8788      this.dataGridView.Name = "dataGridView";
    88       this.dataGridView.Size = new System.Drawing.Size(227, 265);
     89      this.dataGridView.RowHeadersVisible = false;
     90      this.dataGridView.Size = new System.Drawing.Size(207, 296);
    8991      this.dataGridView.TabIndex = 2;
    9092      //
    9193      // ColumName
    9294      //
     95      this.ColumName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
    9396      this.ColumName.HeaderText = "Column Name";
    9497      this.ColumName.Name = "ColumName";
     
    99102      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    100103      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    101       this.ClientSize = new System.Drawing.Size(251, 318);
     104      this.ClientSize = new System.Drawing.Size(207, 330);
    102105      this.Controls.Add(this.dataGridView);
    103106      this.Controls.Add(this.cancelButton);
    104107      this.Controls.Add(this.okButton);
     108      this.MaximizeBox = false;
     109      this.MinimizeBox = false;
    105110      this.Name = "RenameColumnsDialog";
     111      this.ShowIcon = false;
    106112      this.Text = "Rename Columns";
    107113      ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
Note: See TracChangeset for help on using the changeset viewer.