|
43 | 43 | using Couchcoding.Logbert.Theme.Interfaces;
|
44 | 44 | using Couchcoding.Logbert.Theme;
|
45 | 45 | using Couchcoding.Logbert.Theme.Themes;
|
| 46 | +using System.Windows.Forms; |
46 | 47 |
|
47 | 48 | namespace Couchcoding.Logbert.Dialogs.Docking
|
48 | 49 | {
|
49 | 50 | /// <summary>
|
50 | 51 | /// Implements the <see cref="DockContent"/> of the statistic window.
|
51 | 52 | /// </summary>
|
52 | 53 | public partial class FrmLogStatistic : DockContent, ILogPresenter, IThemable
|
53 |
| - { |
| 54 | + { |
| 55 | + #region Private Fields |
| 56 | + |
| 57 | + private Point mMousePoint = Point.Empty; |
| 58 | + private int mStartInclination = 0; |
| 59 | + private int mStartRotation = 0; |
| 60 | + |
| 61 | + /// <summary> |
| 62 | + /// Simple object for thread synchronization. |
| 63 | + /// </summary> |
| 64 | + private static object mSyncRoot = new object(); |
| 65 | + private volatile bool mInUpdate; |
| 66 | + private delegate void UpdateChartDelegate(List<LogMessage> messages); |
| 67 | + |
| 68 | + #endregion |
| 69 | + |
54 | 70 | #region Public Properties
|
55 |
| - |
| 71 | + |
56 | 72 | /// <summary>
|
57 | 73 | /// Gets the count of currently displayed <see cref="LogMessage"/>s.
|
58 | 74 | /// </summary>
|
@@ -100,11 +116,104 @@ public void LogMessagesChanged(List<LogMessage> messages, int delta = -1)
|
100 | 116 | }
|
101 | 117 |
|
102 | 118 | /// <summary>
|
103 |
| - /// Simple object for thread synchronization. |
| 119 | + /// Selects the given <paramref name="message"/>. |
104 | 120 | /// </summary>
|
105 |
| - private static object mSyncRoot = new object(); |
106 |
| - private volatile bool mInUpdate; |
107 |
| - private delegate void UpdateChartDelegate(List<LogMessage> messages); |
| 121 | + /// <param name="message">The <see cref="LogMessage"/> o select</param> |
| 122 | + /// <returns><c>True</c> if the given <paramref name="message"/> was selected successfully, otherwise <c>false</c>.</returns> |
| 123 | + public bool SelectLogMessage(LogMessage message) |
| 124 | + { |
| 125 | + // Nothing to do here. |
| 126 | + return true; |
| 127 | + } |
| 128 | + |
| 129 | + /// <summary> |
| 130 | + /// Selects the <see cref="LogMessage"/> on the given <paramref name="index"/>. |
| 131 | + /// </summary> |
| 132 | + /// <param name="index">The index of the <see cref="LogMessage"/> to select.</param> |
| 133 | + /// <returns><c>True</c> if the <see cref="LogMessage"/> of the given <paramref name="index"/> was selected successfully, otherwise <c>false</c>.</returns> |
| 134 | + public bool SelectLogMessage(int index) |
| 135 | + { |
| 136 | + // Nothing to do here. |
| 137 | + return true; |
| 138 | + } |
| 139 | + |
| 140 | + /// <summary> |
| 141 | + /// Increases the size of the <see cref="ILogPresenter"/> content. |
| 142 | + /// </summary> |
| 143 | + /// <returns><c>True</c> if further increasing is possible, otherwise <c>false</c>.</returns> |
| 144 | + public bool ZoomIn() |
| 145 | + { |
| 146 | + return false; |
| 147 | + } |
| 148 | + |
| 149 | + /// <summary> |
| 150 | + /// Decreases the size of the <see cref="ILogPresenter"/> content. |
| 151 | + /// </summary> |
| 152 | + /// <returns><c>True</c> if further decreasing is possible, otherwise <c>false</c>.</returns> |
| 153 | + public bool ZoomOut() |
| 154 | + { |
| 155 | + return false; |
| 156 | + } |
| 157 | + |
| 158 | + /// <summary> |
| 159 | + /// Applies the current theme to the <see cref="Control"/>. |
| 160 | + /// </summary> |
| 161 | + /// <param name="theme">The <see cref="BaseTheme"/> instance to apply.</param> |
| 162 | + public void ApplyTheme(BaseTheme theme) |
| 163 | + { |
| 164 | + tsbShowLegend.Image = theme.Resources.Images["FrmStatisticTbLegend"]; |
| 165 | + |
| 166 | + chrtOverview.BackColor = theme.ColorPalette.ContentBackground; |
| 167 | + chrtOverview.ForeColor = theme.ColorPalette.ContentForeground; |
| 168 | + |
| 169 | + chrtOverview.ChartAreas[0].BackColor = theme.ColorPalette.ContentBackground; |
| 170 | + |
| 171 | + chrtOverview.Series[0].LabelBackColor = theme.ColorPalette.ContentBackground; |
| 172 | + chrtOverview.Series[0].LabelForeColor = theme.ColorPalette.ContentForeground; |
| 173 | + |
| 174 | + chrtOverview.Legends[0].BackColor = theme.ColorPalette.ContentBackground; |
| 175 | + chrtOverview.Legends[0].ForeColor = theme.ColorPalette.ContentForeground; |
| 176 | + } |
| 177 | + |
| 178 | + #endregion |
| 179 | + |
| 180 | + #region Private Methods |
| 181 | + |
| 182 | + private void ChrtOverviewMouseMove(object sender, MouseEventArgs e) |
| 183 | + { |
| 184 | + if (e.Button == MouseButtons.Left) |
| 185 | + { |
| 186 | + int newValY = mStartInclination - (e.Location.Y - mMousePoint.Y); |
| 187 | + int newValX = mStartRotation - (e.Location.X - mMousePoint.X); |
| 188 | + |
| 189 | + chrtOverview.ChartAreas[0].Area3DStyle.Inclination = newValY < -90 ? -90 : newValY > 90 ? 90 : newValY; |
| 190 | + chrtOverview.ChartAreas[0].Area3DStyle.Rotation = newValX < -180 ? -180 : newValX > 180 ? 180 : newValX; |
| 191 | + } |
| 192 | + } |
| 193 | + |
| 194 | + private void ChrtOverviewMouseDown(object sender, MouseEventArgs e) |
| 195 | + { |
| 196 | + if (e.Button == MouseButtons.Left) |
| 197 | + { |
| 198 | + mMousePoint = e.Location; |
| 199 | + mStartInclination = chrtOverview.ChartAreas[0].Area3DStyle.Inclination; |
| 200 | + mStartRotation = chrtOverview.ChartAreas[0].Area3DStyle.Rotation; |
| 201 | + |
| 202 | + chrtOverview.Cursor = Cursors.SizeAll; |
| 203 | + } |
| 204 | + } |
| 205 | + |
| 206 | + private void ChrtOverviewMouseUp(object sender, MouseEventArgs e) |
| 207 | + { |
| 208 | + if (e.Button == MouseButtons.Left) |
| 209 | + { |
| 210 | + mMousePoint = Point.Empty; |
| 211 | + mStartInclination = 0; |
| 212 | + mStartRotation = 0; |
| 213 | + |
| 214 | + chrtOverview.Cursor = Cursors.Default; |
| 215 | + } |
| 216 | + } |
108 | 217 |
|
109 | 218 | private void StartUpdateChart(List<LogMessage> messages)
|
110 | 219 | {
|
@@ -181,70 +290,6 @@ private void UpdateChartCallback(IAsyncResult ar)
|
181 | 290 | BeginInvoke(new Action(EndUpdateChart));
|
182 | 291 | }
|
183 | 292 |
|
184 |
| - /// <summary> |
185 |
| - /// Selects the given <paramref name="message"/>. |
186 |
| - /// </summary> |
187 |
| - /// <param name="message">The <see cref="LogMessage"/> o select</param> |
188 |
| - /// <returns><c>True</c> if the given <paramref name="message"/> was selected successfully, otherwise <c>false</c>.</returns> |
189 |
| - public bool SelectLogMessage(LogMessage message) |
190 |
| - { |
191 |
| - // Nothing to do here. |
192 |
| - return true; |
193 |
| - } |
194 |
| - |
195 |
| - /// <summary> |
196 |
| - /// Selects the <see cref="LogMessage"/> on the given <paramref name="index"/>. |
197 |
| - /// </summary> |
198 |
| - /// <param name="index">The index of the <see cref="LogMessage"/> to select.</param> |
199 |
| - /// <returns><c>True</c> if the <see cref="LogMessage"/> of the given <paramref name="index"/> was selected successfully, otherwise <c>false</c>.</returns> |
200 |
| - public bool SelectLogMessage(int index) |
201 |
| - { |
202 |
| - // Nothing to do here. |
203 |
| - return true; |
204 |
| - } |
205 |
| - |
206 |
| - /// <summary> |
207 |
| - /// Increases the size of the <see cref="ILogPresenter"/> content. |
208 |
| - /// </summary> |
209 |
| - /// <returns><c>True</c> if further increasing is possible, otherwise <c>false</c>.</returns> |
210 |
| - public bool ZoomIn() |
211 |
| - { |
212 |
| - return false; |
213 |
| - } |
214 |
| - |
215 |
| - /// <summary> |
216 |
| - /// Decreases the size of the <see cref="ILogPresenter"/> content. |
217 |
| - /// </summary> |
218 |
| - /// <returns><c>True</c> if further decreasing is possible, otherwise <c>false</c>.</returns> |
219 |
| - public bool ZoomOut() |
220 |
| - { |
221 |
| - return false; |
222 |
| - } |
223 |
| - |
224 |
| - /// <summary> |
225 |
| - /// Applies the current theme to the <see cref="Control"/>. |
226 |
| - /// </summary> |
227 |
| - /// <param name="theme">The <see cref="BaseTheme"/> instance to apply.</param> |
228 |
| - public void ApplyTheme(BaseTheme theme) |
229 |
| - { |
230 |
| - tsbShowLegend.Image = theme.Resources.Images["FrmStatisticTbLegend"]; |
231 |
| - |
232 |
| - chrtOverview.BackColor = theme.ColorPalette.ContentBackground; |
233 |
| - chrtOverview.ForeColor = theme.ColorPalette.ContentForeground; |
234 |
| - |
235 |
| - chrtOverview.ChartAreas[0].BackColor = theme.ColorPalette.ContentBackground; |
236 |
| - |
237 |
| - chrtOverview.Series[0].LabelBackColor = theme.ColorPalette.ContentBackground; |
238 |
| - chrtOverview.Series[0].LabelForeColor = theme.ColorPalette.ContentForeground; |
239 |
| - |
240 |
| - chrtOverview.Legends[0].BackColor = theme.ColorPalette.ContentBackground; |
241 |
| - chrtOverview.Legends[0].ForeColor = theme.ColorPalette.ContentForeground; |
242 |
| - } |
243 |
| - |
244 |
| - #endregion |
245 |
| - |
246 |
| - #region Private Methods |
247 |
| - |
248 | 293 | /// <summary>
|
249 | 294 | /// Gets the <see cref="DataPoint"/> that represents the specified <paramref name="level"/>.
|
250 | 295 | /// </summary>
|
@@ -356,8 +401,8 @@ public FrmLogStatistic(ILogProvider logProvider)
|
356 | 401 |
|
357 | 402 | // Apply the current application theme to the control.
|
358 | 403 | ThemeManager.ApplyTo(this);
|
359 |
| - } |
360 |
| - |
| 404 | + } |
| 405 | + |
361 | 406 | #endregion
|
362 | 407 | }
|
363 | 408 | }
|
0 commit comments