Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7216 for trunk


Ignore:
Timestamp:
12/20/11 17:07:01 (12 years ago)
Author:
abeham
Message:

#1603

  • Made display name change transparent
  • Changed ok button

#1611

  • added warning and added label to show image size
  • fixed controls resizing
Location:
trunk/sources
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataRowVisualPropertiesControl.Designer.cs

    r6628 r7216  
    5454      this.label3 = new System.Windows.Forms.Label();
    5555      this.commonGroupBox = new System.Windows.Forms.GroupBox();
     56      this.displayNameTextBox = new System.Windows.Forms.TextBox();
    5657      this.axisGroupBox = new System.Windows.Forms.GroupBox();
    5758      this.label5 = new System.Windows.Forms.Label();
     
    6364      this.xAxisPrimaryRadioButton = new System.Windows.Forms.RadioButton();
    6465      this.xAxisSecondaryRadioButton = new System.Windows.Forms.RadioButton();
     66      this.label9 = new System.Windows.Forms.Label();
    6567      this.histoGramGroupBox = new System.Windows.Forms.GroupBox();
    6668      this.panel3 = new System.Windows.Forms.Panel();
     
    7375      this.lineStyleComboBox = new System.Windows.Forms.ComboBox();
    7476      this.label8 = new System.Windows.Forms.Label();
    75       this.label9 = new System.Windows.Forms.Label();
    76       this.displayNameTextBox = new System.Windows.Forms.TextBox();
    7777      ((System.ComponentModel.ISupportInitialize)(this.binsNumericUpDown)).BeginInit();
    7878      this.commonGroupBox.SuspendLayout();
     
    168168      // commonGroupBox
    169169      //
    170       this.commonGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    171                   | System.Windows.Forms.AnchorStyles.Right)));
     170      this.commonGroupBox.Anchor = System.Windows.Forms.AnchorStyles.Top;
    172171      this.commonGroupBox.Controls.Add(this.displayNameTextBox);
    173172      this.commonGroupBox.Controls.Add(this.axisGroupBox);
     
    184183      this.commonGroupBox.Text = "Common";
    185184      //
     185      // displayNameTextBox
     186      //
     187      this.displayNameTextBox.Location = new System.Drawing.Point(89, 19);
     188      this.displayNameTextBox.Name = "displayNameTextBox";
     189      this.displayNameTextBox.Size = new System.Drawing.Size(211, 20);
     190      this.displayNameTextBox.TabIndex = 10;
     191      this.displayNameTextBox.Validated += new System.EventHandler(this.displayNameTextBox_Validated);
     192      //
    186193      // axisGroupBox
    187194      //
     
    281288      this.xAxisSecondaryRadioButton.CheckedChanged += new System.EventHandler(this.xAxisRadioButton_CheckedChanged);
    282289      //
     290      // label9
     291      //
     292      this.label9.AutoSize = true;
     293      this.label9.Location = new System.Drawing.Point(8, 22);
     294      this.label9.Name = "label9";
     295      this.label9.Size = new System.Drawing.Size(75, 13);
     296      this.label9.TabIndex = 0;
     297      this.label9.Text = "Display Name:";
     298      //
    283299      // histoGramGroupBox
    284300      //
    285       this.histoGramGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    286                   | System.Windows.Forms.AnchorStyles.Right)));
     301      this.histoGramGroupBox.Anchor = System.Windows.Forms.AnchorStyles.Top;
    287302      this.histoGramGroupBox.Controls.Add(this.panel3);
    288303      this.histoGramGroupBox.Controls.Add(this.binsNumericUpDown);
     
    330345      // lineChartGroupBox
    331346      //
    332       this.lineChartGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    333                   | System.Windows.Forms.AnchorStyles.Right)));
     347      this.lineChartGroupBox.Anchor = System.Windows.Forms.AnchorStyles.Top;
    334348      this.lineChartGroupBox.Controls.Add(this.lineWidthNumericUpDown);
    335349      this.lineChartGroupBox.Controls.Add(this.label4);
     
    399413      this.label8.TabIndex = 0;
    400414      this.label8.Text = "Line style:";
    401       //
    402       // label9
    403       //
    404       this.label9.AutoSize = true;
    405       this.label9.Location = new System.Drawing.Point(8, 22);
    406       this.label9.Name = "label9";
    407       this.label9.Size = new System.Drawing.Size(75, 13);
    408       this.label9.TabIndex = 0;
    409       this.label9.Text = "Display Name:";
    410       //
    411       // displayNameTextBox
    412       //
    413       this.displayNameTextBox.Location = new System.Drawing.Point(89, 19);
    414       this.displayNameTextBox.Name = "displayNameTextBox";
    415       this.displayNameTextBox.Size = new System.Drawing.Size(211, 20);
    416       this.displayNameTextBox.TabIndex = 10;
    417       this.displayNameTextBox.Validated += new System.EventHandler(this.displayNameTextBox_Validated);
    418415      //
    419416      // DataRowVisualPropertiesControl
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableHistoryView.cs

    r6628 r7216  
    2020#endregion
    2121
    22 using System.Collections.Generic;
     22using System.Linq;
    2323using System.Windows.Forms;
    2424using HeuristicLab.Core.Views;
    2525using HeuristicLab.MainForm;
     26using System.Collections.Generic;
    2627
    2728namespace HeuristicLab.Analysis.Views {
     
    3940      using (DataTableVisualPropertiesDialog dialog = new DataTableVisualPropertiesDialog(current)) {
    4041        if (dialog.ShowDialog() != DialogResult.OK) return;
    41         Dictionary<string, bool> changeDisplayName = new Dictionary<string, bool>();
    42         foreach (DataRow row in current.Rows) {
    43           var answer = MessageBox.Show("Change display name for series " + row.Name + " to " + row.VisualProperties.DisplayName + " for all frames?", "Confirm change", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
    44           if (answer == DialogResult.Cancel) return;
    45           changeDisplayName[row.Name] = (answer == DialogResult.Yes);
    46         }
     42        HashSet<string> modifiedDisplayNames = new HashSet<string>(dialog.RowsWithModifiedDisplayNames);
    4743        foreach (DataTable dt in Content) {
    4844          if (current == dt) continue;
     
    5147            if (!dt.Rows.ContainsKey(row.Name)) continue;
    5248            string oldDisplayName = dt.Rows[row.Name].VisualProperties.DisplayName;
    53             var props = (DataRowVisualProperties)row.VisualProperties.Clone();
    54             if (!changeDisplayName[row.Name]) props.DisplayName = oldDisplayName;
    55             dt.Rows[row.Name].VisualProperties = props;
     49            dt.Rows[row.Name].VisualProperties = (DataRowVisualProperties)row.VisualProperties.Clone();
     50            if (!modifiedDisplayNames.Contains(row.Name))
     51              dt.Rows[row.Name].VisualProperties.DisplayName = oldDisplayName;
    5652          }
    5753        }
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.Designer.cs

    r6628 r7216  
    6868      //
    6969      this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    70       this.okButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    71       this.okButton.Location = new System.Drawing.Point(307, 381);
     70      this.okButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     71      this.okButton.Location = new System.Drawing.Point(297, 386);
    7272      this.okButton.Name = "okButton";
    7373      this.okButton.Size = new System.Drawing.Size(75, 23);
    7474      this.okButton.TabIndex = 0;
    75       this.okButton.Text = "Ok";
     75      this.okButton.Text = "OK";
    7676      this.okButton.UseVisualStyleBackColor = true;
    7777      this.okButton.Click += new System.EventHandler(this.okButton_Click);
     
    8181      this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    8282      this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    83       this.cancelButton.Location = new System.Drawing.Point(388, 381);
     83      this.cancelButton.Location = new System.Drawing.Point(378, 386);
    8484      this.cancelButton.Name = "cancelButton";
    8585      this.cancelButton.Size = new System.Drawing.Size(75, 23);
     
    9999      this.tabControl.Name = "tabControl";
    100100      this.tabControl.SelectedIndex = 0;
    101       this.tabControl.Size = new System.Drawing.Size(474, 374);
     101      this.tabControl.Size = new System.Drawing.Size(464, 379);
    102102      this.tabControl.TabIndex = 2;
    103103      //
     
    108108      this.seriesTabPage.Name = "seriesTabPage";
    109109      this.seriesTabPage.Padding = new System.Windows.Forms.Padding(3);
    110       this.seriesTabPage.Size = new System.Drawing.Size(466, 348);
     110      this.seriesTabPage.Size = new System.Drawing.Size(456, 353);
    111111      this.seriesTabPage.TabIndex = 0;
    112112      this.seriesTabPage.Text = "Series";
     
    131131      this.splitContainer.Panel2.Controls.Add(this.dataRowVisualPropertiesControl);
    132132      this.splitContainer.Panel2MinSize = 50;
    133       this.splitContainer.Size = new System.Drawing.Size(460, 342);
     133      this.splitContainer.Size = new System.Drawing.Size(450, 347);
    134134      this.splitContainer.SplitterDistance = 125;
    135135      this.splitContainer.TabIndex = 0;
     
    165165      this.seriesListView.Name = "seriesListView";
    166166      this.seriesListView.ShowGroups = false;
    167       this.seriesListView.Size = new System.Drawing.Size(125, 313);
     167      this.seriesListView.Size = new System.Drawing.Size(125, 319);
    168168      this.seriesListView.TabIndex = 0;
    169169      this.seriesListView.UseCompatibleStateImageBehavior = false;
     
    174174      //
    175175      this.dataRowVisualPropertiesControl.Content = null;
    176       this.dataRowVisualPropertiesControl.Dock = System.Windows.Forms.DockStyle.Fill;
    177       this.dataRowVisualPropertiesControl.Location = new System.Drawing.Point(0, 0);
     176      this.dataRowVisualPropertiesControl.Location = new System.Drawing.Point(3, 3);
    178177      this.dataRowVisualPropertiesControl.Name = "dataRowVisualPropertiesControl";
    179       this.dataRowVisualPropertiesControl.Size = new System.Drawing.Size(331, 342);
     178      this.dataRowVisualPropertiesControl.Size = new System.Drawing.Size(318, 342);
    180179      this.dataRowVisualPropertiesControl.TabIndex = 0;
    181180      //
     
    186185      this.chartTabPage.Name = "chartTabPage";
    187186      this.chartTabPage.Padding = new System.Windows.Forms.Padding(3);
    188       this.chartTabPage.Size = new System.Drawing.Size(466, 324);
     187      this.chartTabPage.Size = new System.Drawing.Size(453, 348);
    189188      this.chartTabPage.TabIndex = 1;
    190189      this.chartTabPage.Text = "Chart";
     
    197196      this.dataTableVisualPropertiesControl.Location = new System.Drawing.Point(3, 3);
    198197      this.dataTableVisualPropertiesControl.Name = "dataTableVisualPropertiesControl";
    199       this.dataTableVisualPropertiesControl.Size = new System.Drawing.Size(460, 318);
     198      this.dataTableVisualPropertiesControl.Size = new System.Drawing.Size(447, 342);
    200199      this.dataTableVisualPropertiesControl.TabIndex = 0;
    201200      //
     
    206205      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    207206      this.CancelButton = this.cancelButton;
    208       this.ClientSize = new System.Drawing.Size(475, 416);
     207      this.ClientSize = new System.Drawing.Size(465, 421);
    209208      this.Controls.Add(this.tabControl);
    210209      this.Controls.Add(this.cancelButton);
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.cs

    r6342 r7216  
    2121
    2222using System.Collections.Generic;
     23using System.ComponentModel;
    2324using System.Linq;
    2425using System.Windows.Forms;
     
    3233    private Dictionary<string, DataRowVisualProperties> originalDataRowVPs;
    3334
     35    private HashSet<string> modifiedDisplayNames;
     36    public IEnumerable<string> RowsWithModifiedDisplayNames { get { return modifiedDisplayNames.AsEnumerable(); } }
     37
    3438    public DataTableVisualPropertiesDialog(DataTable dataTable) {
    3539      InitializeComponent();
     40      #region Prepare controls
    3641      upButton.Text = string.Empty;
    3742      upButton.Image = VSImageLibrary.ArrowUp;
    3843      downButton.Text = string.Empty;
    3944      downButton.Image = VSImageLibrary.ArrowDown;
     45      seriesListView.Items.Clear();
     46      seriesListView.SmallImageList = new ImageList();
     47      seriesListView.SmallImageList.Images.Add(VSImageLibrary.Graph);
     48      #endregion
     49
    4050      Content = dataTable;
    4151      originalDataTableVPs = (DataTableVisualProperties)Content.VisualProperties.Clone();
     
    4353      foreach (DataRow row in Content.Rows)
    4454        originalDataRowVPs.Add(row.Name, (DataRowVisualProperties)row.VisualProperties.Clone());
    45       seriesListView.Items.Clear();
    46       seriesListView.SmallImageList = new ImageList();
    47       seriesListView.SmallImageList.Images.Add(VSImageLibrary.Graph);
     55
     56      dataTableVisualPropertiesControl.Content = Content.VisualProperties;
     57
     58      modifiedDisplayNames = new HashSet<string>();
    4859      FillSeriesListView();
    49       dataTableVisualPropertiesControl.Content = Content.VisualProperties;
     60      RegisterContentEvents();
    5061    }
    5162
    52     private void FillSeriesListView() {
    53       seriesListView.SelectedIndices.Clear();
     63    private void RegisterContentEvents() {
    5464      foreach (DataRow row in Content.Rows) {
    55         seriesListView.Items.Add(new ListViewItem(row.Name, 0));
     65        row.VisualProperties.PropertyChanged += new PropertyChangedEventHandler(Row_VisualProperties_PropertyChanged);
    5666      }
    57       seriesListView.SelectedIndices.Add(0);
     67    }
     68
     69    private void DeregisterContentEvents() {
     70      foreach (DataRow row in Content.Rows) {
     71        row.VisualProperties.PropertyChanged -= new PropertyChangedEventHandler(Row_VisualProperties_PropertyChanged);
     72      }
     73    }
     74
     75    protected override void OnClosing(CancelEventArgs e) {
     76      DeregisterContentEvents();
     77      Application.DoEvents();
     78      base.OnClosing(e);
     79    }
     80
     81    private void Row_VisualProperties_PropertyChanged(object sender, PropertyChangedEventArgs e) {
     82      foreach (DataRow row in Content.Rows) {
     83        if (e.PropertyName == "DisplayName" && row.VisualProperties == sender) {
     84          modifiedDisplayNames.Add(row.Name);
     85          break;
     86        }
     87      }
    5888    }
    5989
     
    79109        row.VisualProperties = originalDataRowVPs[row.Name];
    80110      }
     111      modifiedDisplayNames.Clear();
    81112      Content.VisualProperties = originalDataTableVPs;
    82113      Close();
     
    124155
    125156    #region Helpers
     157    private void FillSeriesListView() {
     158      seriesListView.SelectedIndices.Clear();
     159      foreach (DataRow row in Content.Rows) {
     160        seriesListView.Items.Add(new ListViewItem(row.Name, 0));
     161      }
     162      seriesListView.SelectedIndices.Add(0);
     163    }
     164
    126165    private void UpdateAllSeriesPositions() {
    127166      Dictionary<string, DataRow> rows = Content.Rows.ToDictionary(x => x.Name);
  • trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/ImageExportDialog.Designer.cs

    r6641 r7216  
    6767      this.previewZoomLabel = new System.Windows.Forms.Label();
    6868      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
     69      this.label19 = new System.Windows.Forms.Label();
     70      this.rawImageSizeLabel = new System.Windows.Forms.Label();
    6971      ((System.ComponentModel.ISupportInitialize)(this.widthNumericUD)).BeginInit();
    7072      this.groupBox1.SuspendLayout();
     
    162164            "96",
    163165            "150",
    164             "300",
    165             "600"});
     166            "300"});
    166167      this.resolutionComboBox.Location = new System.Drawing.Point(76, 383);
    167168      this.resolutionComboBox.Name = "resolutionComboBox";
     
    180181            65536});
    181182      this.widthNumericUD.Location = new System.Drawing.Point(76, 410);
    182       this.widthNumericUD.Maximum = new decimal(new int[] {
    183             1000,
    184             0,
    185             0,
    186             0});
    187183      this.widthNumericUD.Minimum = new decimal(new int[] {
    188184            1,
    189185            0,
    190186            0,
    191             131072});
     187            65536});
    192188      this.widthNumericUD.Name = "widthNumericUD";
    193189      this.widthNumericUD.Size = new System.Drawing.Size(75, 20);
     
    499495            65536});
    500496      this.heightNumericUD.Location = new System.Drawing.Point(76, 436);
    501       this.heightNumericUD.Maximum = new decimal(new int[] {
    502             1000,
    503             0,
    504             0,
    505             0});
    506497      this.heightNumericUD.Minimum = new decimal(new int[] {
    507498            1,
    508499            0,
    509500            0,
    510             131072});
     501            65536});
    511502      this.heightNumericUD.Name = "heightNumericUD";
    512503      this.heightNumericUD.Size = new System.Drawing.Size(75, 20);
     
    548539      //
    549540      this.splitContainer.Panel2.Controls.Add(this.previewPictureBox);
     541      this.splitContainer.Panel2.Controls.Add(this.label19);
    550542      this.splitContainer.Panel2.Controls.Add(this.label13);
     543      this.splitContainer.Panel2.Controls.Add(this.rawImageSizeLabel);
    551544      this.splitContainer.Panel2.Controls.Add(this.previewZoomLabel);
    552545      this.splitContainer.Size = new System.Drawing.Size(793, 478);
     
    640633          "*.gif)|*.gif|TIFF (*.tif)|*.tif\"";
    641634      this.saveFileDialog.FilterIndex = 2;
     635      //
     636      // label19
     637      //
     638      this.label19.AutoSize = true;
     639      this.label19.Location = new System.Drawing.Point(85, 459);
     640      this.label19.Name = "label19";
     641      this.label19.Size = new System.Drawing.Size(84, 13);
     642      this.label19.TabIndex = 10;
     643      this.label19.Text = "Raw image size:";
     644      //
     645      // rawImageSizeLabel
     646      //
     647      this.rawImageSizeLabel.AutoSize = true;
     648      this.rawImageSizeLabel.Location = new System.Drawing.Point(175, 459);
     649      this.rawImageSizeLabel.Name = "rawImageSizeLabel";
     650      this.rawImageSizeLabel.Size = new System.Drawing.Size(37, 13);
     651      this.rawImageSizeLabel.TabIndex = 10;
     652      this.rawImageSizeLabel.Text = "0.00M";
    642653      //
    643654      // ImageExportDialog
     
    721732    private System.Windows.Forms.ComboBox legendFontSizeComboBox;
    722733    private System.Windows.Forms.Label label17;
     734    private System.Windows.Forms.Label label19;
     735    private System.Windows.Forms.Label rawImageSizeLabel;
    723736  }
    724737}
  • trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/ImageExportDialog.cs

    r6644 r7216  
    127127        previewHeight = (int)Math.Round(height);
    128128      } else previewZoomLabel.Text = (scaleFactor * 100).ToString("0") + "%";
     129      rawImageSizeLabel.Text = GetRawImageSizeInMegabytes(width, height).ToString("0.00") + "M   " + "(" + Math.Round(width).ToString("0") + " x " + Math.Round(height).ToString("0") + ") pixels";
    129130
    130131      Bitmap image = new Bitmap(previewWidth, previewHeight);
     
    238239
    239240    private void widthNumericUD_ValueChanged(object sender, EventArgs e) {
     241      float dpi, width, height;
     242      GetImageParameters(out dpi, out width, out height);
     243      if (GetRawImageSizeInMegabytes(width, height) > 25) // bigger than A4 at 300dpi
     244        MessageBox.Show("Warning: The image is getting quite big.");
    240245      if (togglePreviewCheckBox.Checked) UpdatePreview();
    241246    }
    242247
    243248    private void heightNumericUD_ValueChanged(object sender, EventArgs e) {
     249      float dpi, width, height;
     250      GetImageParameters(out dpi, out width, out height);
     251      if (GetRawImageSizeInMegabytes(width, height) > 25) // bigger than A4 at 300dpi
     252        MessageBox.Show("Warning: The image is getting quite big.");
    244253      if (togglePreviewCheckBox.Checked) UpdatePreview();
    245254    }
     
    376385    }
    377386
     387    private static float GetRawImageSizeInMegabytes(float width, float height) {
     388      return ((3 * width * height) / (1024 * 1024));
     389    }
     390
    378391  }
    379392}
Note: See TracChangeset for help on using the changeset viewer.