Changeset 1389 for trunk/sources/HeuristicLab.Visualization
- Timestamp:
- 03/21/09 13:41:51 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Visualization/Options
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.Designer.cs
r1345 r1389 26 26 this.OptionsDialogCancelButton = new System.Windows.Forms.Button(); 27 27 this.OptionsDialogOkButton = new System.Windows.Forms.Button(); 28 this.OptionsDialogApplyBtn = new System.Windows.Forms.Button();29 28 this.fdFont = new System.Windows.Forms.FontDialog(); 30 29 this.tpTitle = new System.Windows.Forms.TabPage(); … … 65 64 this.OptionsDialogCancelButton.Size = new System.Drawing.Size(75, 23); 66 65 this.OptionsDialogCancelButton.TabIndex = 1; 67 this.OptionsDialogCancelButton.Text = " Cancel";66 this.OptionsDialogCancelButton.Text = "Reset"; 68 67 this.OptionsDialogCancelButton.UseVisualStyleBackColor = true; 69 this.OptionsDialogCancelButton.Click += new System.EventHandler(this.OptionsDialog CancelButton_Click);68 this.OptionsDialogCancelButton.Click += new System.EventHandler(this.OptionsDialogResetButton_Click); 70 69 // 71 70 // OptionsDialogOkButton 72 71 // 73 this.OptionsDialogOkButton.Location = new System.Drawing.Point( 43, 232);72 this.OptionsDialogOkButton.Location = new System.Drawing.Point(132, 232); 74 73 this.OptionsDialogOkButton.Name = "OptionsDialogOkButton"; 75 74 this.OptionsDialogOkButton.Size = new System.Drawing.Size(75, 23); … … 78 77 this.OptionsDialogOkButton.UseVisualStyleBackColor = true; 79 78 this.OptionsDialogOkButton.Click += new System.EventHandler(this.OptionsDialogOkButton_Click); 80 //81 // OptionsDialogApplyBtn82 //83 this.OptionsDialogApplyBtn.Location = new System.Drawing.Point(128, 231);84 this.OptionsDialogApplyBtn.Name = "OptionsDialogApplyBtn";85 this.OptionsDialogApplyBtn.Size = new System.Drawing.Size(75, 23);86 this.OptionsDialogApplyBtn.TabIndex = 3;87 this.OptionsDialogApplyBtn.Text = "Apply";88 this.OptionsDialogApplyBtn.UseVisualStyleBackColor = true;89 this.OptionsDialogApplyBtn.Click += new System.EventHandler(this.OptionsDialogApplyBtn_Click);90 79 // 91 80 // fdFont … … 207 196 this.LinestyleCB.Size = new System.Drawing.Size(121, 21); 208 197 this.LinestyleCB.TabIndex = 2; 198 this.LinestyleCB.SelectedIndexChanged += new System.EventHandler(this.LinestyleCB_SelectedIndexChanged); 209 199 // 210 200 // label1 … … 256 246 this.LineThicknessCB.Size = new System.Drawing.Size(121, 21); 257 247 this.LineThicknessCB.TabIndex = 4; 248 this.LineThicknessCB.SelectedIndexChanged += new System.EventHandler(this.LineThicknessCB_SelectedIndexChanged); 258 249 // 259 250 // label3 … … 324 315 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 325 316 this.ClientSize = new System.Drawing.Size(292, 266); 326 this.Controls.Add(this.OptionsDialogApplyBtn);327 317 this.Controls.Add(this.OptionsDialogOkButton); 328 318 this.Controls.Add(this.OptionsDialogCancelButton); … … 351 341 private System.Windows.Forms.Button OptionsDialogCancelButton; 352 342 private System.Windows.Forms.Button OptionsDialogOkButton; 353 private System.Windows.Forms.Button OptionsDialogApplyBtn;354 343 private System.Windows.Forms.FontDialog fdFont; 355 344 private System.Windows.Forms.TabPage tpTitle; -
trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.cs
r1388 r1389 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Drawing; 3 4 using System.Windows.Forms; 4 5 using HeuristicLab.Visualization.Legend; … … 8 9 private readonly IChartDataRowsModel model; 9 10 private readonly ViewSettings viewSettings; 11 private readonly ViewSettings oldViewSettings; 12 private LineParams[] oldLineParams; 13 private Dictionary<CheckBox,bool> ShowYAxisBoxes; 14 15 internal class LineParams { 16 string Label { get; set; } 17 Color Color { get; set; } 18 int Thickness { get; set; } 19 DrawingStyle Style { get; set; } 20 private readonly IDataRow row; 21 22 public LineParams(IDataRow row) { 23 Label = row.Label; 24 Color = row.Color; 25 Thickness = row.Thickness; 26 Style = row.Style; 27 this.row = row; 28 } 29 30 public void applySettings() { 31 row.Label = Label; 32 row.Color = Color; 33 row.Thickness = Thickness; 34 row.Style = Style; 35 } 36 } 10 37 11 38 public OptionsDialog(IChartDataRowsModel model) { … … 14 41 this.model = model; 15 42 viewSettings = model.ViewSettings; 43 oldViewSettings = new ViewSettings(model.ViewSettings); 16 44 17 45 cbLegendPosition.Items.Add(LegendPosition.Top); … … 27 55 dlg.ShowDialog(); 28 56 ColorPreviewTB.BackColor = dlg.Color; 57 ((IDataRow)LineSelectCB.SelectedValue).Color = dlg.Color; 29 58 } 30 59 31 60 public IList<int> GetThicknesses() { 32 return new List<int>(new int[] { 0,1, 2, 3, 4, 5, 6, 7, 8});61 return new List<int>(new int[] {1, 2, 3, 4, 5, 6, 7, 8}); 33 62 } 34 63 … … 38 67 39 68 private void OptionsDialog_Load(object sender, EventArgs e) { 69 InitTabPageLines(); 70 InitTabPageYAxes(); 71 } 72 73 private void InitTabPageLines() { 40 74 if (model.Rows.Count != 0) { 75 int index = 0; 76 oldLineParams = new LineParams[model.Rows.Count]; 77 foreach (var row in model.Rows) { 78 oldLineParams[index++]= new LineParams(row); 79 } 80 LineThicknessCB.DataSource = GetThicknesses(); 81 LinestyleCB.DataSource = GetStyles(); 82 LinestyleCB.SelectedItem = model.Rows[0].Style; 83 LineThicknessCB.SelectedItem = model.Rows[0].Thickness; 84 41 85 LineSelectCB.DataSource = model.Rows; 42 86 LineSelectCB.DisplayMember = "Label"; 43 87 44 LineThicknessCB.DataSource = GetThicknesses(); 45 LinestyleCB.DataSource = GetStyles(); 88 46 89 LineSelectCB.SelectedIndex = 0; 47 90 LineSelectCB_SelectedIndexChanged(this, null); 48 } 49 50 InitTabPageYAxes(); 91 92 } 51 93 } 52 94 53 95 private void InitTabPageYAxes() { 96 ShowYAxisBoxes = new Dictionary<CheckBox, bool>(); 54 97 for (int i = 0; i < model.YAxes.Count; i++) { 55 98 YAxisDescriptor yAxisDescriptor = model.YAxes[i]; … … 58 101 chkbox.Text = yAxisDescriptor.Label; 59 102 chkbox.Checked = yAxisDescriptor.ShowYAxis; 103 ShowYAxisBoxes[chkbox] = yAxisDescriptor.ShowYAxis; 60 104 chkbox.CheckedChanged += delegate { yAxisDescriptor.ShowYAxis = chkbox.Checked; }; 61 105 … … 66 110 private void LineSelectCB_SelectedIndexChanged(object sender, EventArgs e) { 67 111 if (LineSelectCB.SelectedValue != null) { 68 int index =112 /* int index = 69 113 LineThicknessCB.FindStringExact(((IDataRow)LineSelectCB.SelectedValue).Thickness.ToString()); 70 114 LineThicknessCB.SelectedIndex = index; 71 115 index = LinestyleCB.FindStringExact(((IDataRow)LineSelectCB.SelectedValue).Style.ToString()); 72 LinestyleCB.SelectedIndex = index; 73 ColorPreviewTB.BackColor = ((IDataRow)LineSelectCB.SelectedValue).Color; 74 } 75 } 76 77 private void OptionsDialogCancelButton_Click(object sender, EventArgs e) { 116 LinestyleCB.SelectedIndex = index; */ 117 LineThicknessCB.SelectedItem = ((IDataRow) LineSelectCB.SelectedValue).Thickness; 118 LinestyleCB.SelectedItem = ((IDataRow)LineSelectCB.SelectedValue).Style; 119 ColorPreviewTB.BackColor = ((IDataRow)LineSelectCB.SelectedValue).Color; 120 } 121 } 122 123 124 private void OptionsDialogOkButton_Click(object sender, EventArgs e) { 78 125 Close(); 79 126 } 80 81 private void OptionsDialogOkButton_Click(object sender, EventArgs e) { 82 ApplyChanges(); 83 84 Close(); 85 } 86 87 private void OptionsDialogApplyBtn_Click(object sender, EventArgs e) { 88 ApplyChanges(); 89 } 90 91 private void ApplyChanges() { 92 if (LineSelectCB.SelectedValue != null) { 93 ((IDataRow)LineSelectCB.SelectedValue).Thickness = (int)LineThicknessCB.SelectedItem; 94 ((IDataRow)LineSelectCB.SelectedValue).Color = ColorPreviewTB.BackColor; 95 ((IDataRow)LineSelectCB.SelectedValue).Style = (DrawingStyle)LinestyleCB.SelectedItem; 96 } 97 viewSettings.UpdateView(); 98 } 127 128 129 99 130 100 131 private void cbLegendPosition_SelectedIndexChanged(object sender, EventArgs e) { 101 132 viewSettings.LegendPosition = (LegendPosition)cbLegendPosition.SelectedItem; 133 viewSettings.UpdateView(); 102 134 } 103 135 … … 143 175 } 144 176 } 177 178 private void OptionsDialogResetButton_Click(object sender, EventArgs e) { 179 foreach (var param in oldLineParams) { 180 param.applySettings(); 181 } 182 183 foreach (var box in ShowYAxisBoxes) { 184 box.Key.Checked = box.Value; 185 } 186 viewSettings.LegendColor = oldViewSettings.LegendColor; 187 viewSettings.LegendPosition = oldViewSettings.LegendPosition; 188 viewSettings.LegendFont = oldViewSettings.LegendFont; 189 viewSettings.TitleColor = oldViewSettings.TitleColor; 190 viewSettings.TitleFont = oldViewSettings.TitleFont; 191 viewSettings.XAxisColor = oldViewSettings.LegendColor; 192 viewSettings.XAxisFont = oldViewSettings.XAxisFont; 193 viewSettings.UpdateView(); 194 cbLegendPosition.SelectedItem = viewSettings.LegendPosition; 195 this.LineSelectCB_SelectedIndexChanged(this,null); 196 } 197 198 private void LinestyleCB_SelectedIndexChanged(object sender, EventArgs e) { 199 if (LineSelectCB.SelectedValue != null) 200 ((IDataRow)LineSelectCB.SelectedValue).Style = (DrawingStyle)LinestyleCB.SelectedItem; 201 } 202 203 private void LineThicknessCB_SelectedIndexChanged(object sender, EventArgs e) { 204 if (LineSelectCB.SelectedValue != null) 205 ((IDataRow)LineSelectCB.SelectedValue).Thickness = (int)LineThicknessCB.SelectedItem; 206 } 207 208 209 210 145 211 } 146 212 } -
trunk/sources/HeuristicLab.Visualization/Options/ViewSettings.cs
r1388 r1389 25 25 26 26 legendPosition = LegendPosition.Bottom; 27 } 28 29 public ViewSettings(ViewSettings src) { 30 31 titleFont = (Font)(src.titleFont.Clone()); 32 titleColor = src.TitleColor; 33 34 legendFont = (Font)(src.legendFont.Clone()); 35 legendColor = src.LegendColor; 36 37 xAxisFont = (Font) (src.xAxisFont.Clone()); 38 xAxisColor = src.XAxisColor; 39 40 legendPosition = src.LegendPosition; 27 41 } 28 42
Note: See TracChangeset
for help on using the changeset viewer.