Changeset 573
- Timestamp:
- 09/14/08 22:31:37 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.CEDMA.Charting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChart.cs
r570 r573 64 64 foreach(Record r in results.Records) { 65 65 records.Add(r); 66 r.OnSelectionChanged += new EventHandler(Record_OnSelectionChanged); 67 } 66 } 68 67 results.OnRecordAdded += new EventHandler<RecordAddedEventArgs>(results_OnRecordAdded); 69 68 results.Changed += new EventHandler(results_Changed); … … 81 80 void results_OnRecordAdded(object sender, RecordAddedEventArgs e) { 82 81 lock(records) { 83 e.Record.OnSelectionChanged += new EventHandler(Record_OnSelectionChanged);84 82 records.Add(e.Record); 85 }86 }87 88 void Record_OnSelectionChanged(object sender, EventArgs e) {89 Record r = (Record)sender;90 IPrimitive primitive;91 recordToPrimitiveDictionary.TryGetValue(r, out primitive);92 if(primitive != null) {93 ((FixedSizeCircle)primitive).UpdateEnabled = false;94 points.UpdateEnabled = false;95 if(r.Selected) {96 int alpha = primitive.Pen.Color.A;97 primitive.Pen.Color = Color.FromArgb(alpha, selectionColor);98 primitive.Brush = primitive.Pen.Brush;99 primitive.IntoForeground();100 } else {101 int alpha = primitive.Pen.Color.A;102 primitive.Pen.Color = Color.FromArgb(alpha, defaultColor);103 primitive.Brush = primitive.Pen.Brush;104 primitive.IntoBackground();105 }106 ((FixedSizeCircle)primitive).UpdateEnabled = true;107 points.UpdateEnabled = true;108 83 } 109 84 } … … 165 140 c.ToolTipText = r.GetToolTipText(); 166 141 points.Add(c); 142 if(!r.Selected) c.IntoBackground(); 167 143 primitiveToRecordDictionary[c] = r; 168 144 recordToPrimitiveDictionary[r] = c; -
trunk/sources/HeuristicLab.CEDMA.Charting/Histogram.cs
r572 r573 87 87 88 88 private void Repaint() { 89 if(dimension == null) return; 90 UpdateEnabled = false; 91 Group.Clear(); 92 primitiveToRecordsDictionary.Clear(); 93 recordToPrimitiveDictionary.Clear(); 94 bars = new Group(this); 95 Group.Add(new Axis(this, 0, 0, AxisType.Both)); 96 UpdateViewSize(0, 0); 97 Pen defaultPen = new Pen(defaultColor); 98 Brush defaultBrush = defaultPen.Brush; 99 PaintHistogram(records, defaultPen, defaultBrush); 100 Pen selectionPen = new Pen(selectionColor); 101 Brush selectionBrush = selectionPen.Brush; 102 PaintHistogram(records.Where(r => r.Selected), selectionPen, selectionBrush); 103 Group.Add(bars); 104 UpdateEnabled = true; 89 lock(records) { 90 if(dimension == null) return; 91 UpdateEnabled = false; 92 Group.Clear(); 93 primitiveToRecordsDictionary.Clear(); 94 recordToPrimitiveDictionary.Clear(); 95 bars = new Group(this); 96 Group.Add(new Axis(this, 0, 0, AxisType.Both)); 97 UpdateViewSize(0, 0); 98 Pen defaultPen = new Pen(defaultColor); 99 Brush defaultBrush = defaultPen.Brush; 100 PaintHistogram(records, defaultPen, defaultBrush); 101 Pen selectionPen = new Pen(selectionColor); 102 Brush selectionBrush = selectionPen.Brush; 103 PaintHistogram(records.Where(r => r.Selected), selectionPen, selectionBrush); 104 Group.Add(bars); 105 UpdateEnabled = true; 106 } 105 107 } 106 108 … … 168 170 public override void MouseClick(Point point, MouseButtons button) { 169 171 if(button == MouseButtons.Left) { 170 List<Record> rs = GetRecords(point); 171 UpdateEnabled = false; 172 if(rs != null) rs.ForEach(r => r.ToggleSelected()); 173 UpdateEnabled = true; 172 lock(records) { 173 List<Record> rs = GetRecords(point); 174 UpdateEnabled = false; 175 if(rs != null) rs.ForEach(r => r.ToggleSelected()); 176 UpdateEnabled = true; 177 } 174 178 results.FireChanged(); 175 179 } else { -
trunk/sources/HeuristicLab.CEDMA.Charting/Record.cs
r569 r573 68 68 public const string Y_JITTER = "__Y_JITTER"; 69 69 70 public event EventHandler OnSelectionChanged;71 72 70 private Dictionary<string, double> values = new Dictionary<string, double>(); 73 71 private ResultList resultList; … … 94 92 public void ToggleSelected() { 95 93 selected = !selected; 96 if(OnSelectionChanged != null) OnSelectionChanged(this, new EventArgs());97 94 } 98 95
Note: See TracChangeset
for help on using the changeset viewer.