Panda3D
winStatsPianoRoll.cxx
1 // Filename: winStatsPianoRoll.cxx
2 // Created by: drose (03Dec03)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "winStatsPianoRoll.h"
16 #include "winStatsMonitor.h"
17 #include "numeric_types.h"
18 
19 static const int default_piano_roll_width = 400;
20 static const int default_piano_roll_height = 200;
21 
22 bool WinStatsPianoRoll::_window_class_registered = false;
23 const char * const WinStatsPianoRoll::_window_class_name = "piano";
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: WinStatsPianoRoll::Constructor
27 // Access: Public
28 // Description:
29 ////////////////////////////////////////////////////////////////////
30 WinStatsPianoRoll::
31 WinStatsPianoRoll(WinStatsMonitor *monitor, int thread_index) :
32  PStatPianoRoll(monitor, thread_index,
33  default_piano_roll_width,
34  default_piano_roll_height),
35  WinStatsGraph(monitor)
36 {
37  _left_margin = 128;
38  _right_margin = 8;
39  _top_margin = 16;
40  _bottom_margin = 8;
41 
42  // Let's show the units on the guide bar labels. There's room.
43  set_guide_bar_units(get_guide_bar_units() | GBU_show_units);
44 
45  create_window();
46  clear_region();
47 }
48 
49 ////////////////////////////////////////////////////////////////////
50 // Function: WinStatsPianoRoll::Destructor
51 // Access: Public, Virtual
52 // Description:
53 ////////////////////////////////////////////////////////////////////
54 WinStatsPianoRoll::
55 ~WinStatsPianoRoll() {
56 }
57 
58 ////////////////////////////////////////////////////////////////////
59 // Function: WinStatsPianoRoll::idle
60 // Access: Public, Virtual
61 // Description: Called as each frame's data is made available. There
62 // is no gurantee the frames will arrive in order, or
63 // that all of them will arrive at all. The monitor
64 // should be prepared to accept frames received
65 // out-of-order or missing.
66 ////////////////////////////////////////////////////////////////////
68 new_data(int thread_index, int frame_number) {
69  if (!_pause) {
70  update();
71  }
72 }
73 
74 ////////////////////////////////////////////////////////////////////
75 // Function: WinStatsPianoRoll::force_redraw
76 // Access: Public, Virtual
77 // Description: Called when it is necessary to redraw the entire graph.
78 ////////////////////////////////////////////////////////////////////
81  PStatPianoRoll::force_redraw();
82 }
83 
84 ////////////////////////////////////////////////////////////////////
85 // Function: WinStatsPianoRoll::changed_graph_size
86 // Access: Public, Virtual
87 // Description: Called when the user has resized the window, forcing
88 // a resize of the graph.
89 ////////////////////////////////////////////////////////////////////
91 changed_graph_size(int graph_xsize, int graph_ysize) {
92  PStatPianoRoll::changed_size(graph_xsize, graph_ysize);
93 }
94 
95 ////////////////////////////////////////////////////////////////////
96 // Function: WinStatsPianoRoll::set_time_units
97 // Access: Public, Virtual
98 // Description: Called when the user selects a new time units from
99 // the monitor pulldown menu, this should adjust the
100 // units for the graph to the indicated mask if it is a
101 // time-based graph.
102 ////////////////////////////////////////////////////////////////////
104 set_time_units(int unit_mask) {
105  int old_unit_mask = get_guide_bar_units();
106  if ((old_unit_mask & (GBU_hz | GBU_ms)) != 0) {
107  unit_mask = unit_mask & (GBU_hz | GBU_ms);
108  unit_mask |= (old_unit_mask & GBU_show_units);
109  set_guide_bar_units(unit_mask);
110 
111  RECT rect;
112  GetClientRect(_window, &rect);
113  rect.left = _right_margin;
114  InvalidateRect(_window, &rect, TRUE);
115  }
116 }
117 
118 ////////////////////////////////////////////////////////////////////
119 // Function: WinStatsPianoRoll::clicked_label
120 // Access: Public, Virtual
121 // Description: Called when the user single-clicks on a label.
122 ////////////////////////////////////////////////////////////////////
124 clicked_label(int collector_index) {
125  if (collector_index >= 0) {
126  WinStatsGraph::_monitor->open_strip_chart(_thread_index, collector_index, false);
127  }
128 }
129 
130 ////////////////////////////////////////////////////////////////////
131 // Function: WinStatsPianoRoll::set_horizontal_scale
132 // Access: Public
133 // Description: Changes the amount of time the width of the
134 // horizontal axis represents. This may force a redraw.
135 ////////////////////////////////////////////////////////////////////
137 set_horizontal_scale(double time_width) {
139 
140  RECT rect;
141  GetClientRect(_window, &rect);
142  rect.bottom = _top_margin;
143  InvalidateRect(_window, &rect, TRUE);
144 }
145 
146 ////////////////////////////////////////////////////////////////////
147 // Function: WinStatsPianoRoll::clear_region
148 // Access: Protected
149 // Description: Erases the chart area.
150 ////////////////////////////////////////////////////////////////////
151 void WinStatsPianoRoll::
152 clear_region() {
153  RECT rect = { 0, 0, get_xsize(), get_ysize() };
154  FillRect(_bitmap_dc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
155 }
156 
157 ////////////////////////////////////////////////////////////////////
158 // Function: WinStatsPianoRoll::begin_draw
159 // Access: Protected, Virtual
160 // Description: Erases the chart area in preparation for drawing a
161 // bunch of bars.
162 ////////////////////////////////////////////////////////////////////
163 void WinStatsPianoRoll::
164 begin_draw() {
165  clear_region();
166 
167  // Draw in the guide bars.
168  int num_guide_bars = get_num_guide_bars();
169  for (int i = 0; i < num_guide_bars; i++) {
170  draw_guide_bar(_bitmap_dc, get_guide_bar(i));
171  }
172 }
173 
174 ////////////////////////////////////////////////////////////////////
175 // Function: WinStatsPianoRoll::draw_bar
176 // Access: Protected, Virtual
177 // Description: Draws a single bar on the chart.
178 ////////////////////////////////////////////////////////////////////
179 void WinStatsPianoRoll::
180 draw_bar(int row, int from_x, int to_x) {
181  if (row >= 0 && row < _label_stack.get_num_labels()) {
182  int y = _label_stack.get_label_y(row) - _graph_top;
183  int height = _label_stack.get_label_height(row);
184 
185  RECT rect = {
186  from_x, y - height + 2,
187  to_x, y - 2,
188  };
189  int collector_index = get_label_collector(row);
190  HBRUSH brush = get_collector_brush(collector_index);
191  FillRect(_bitmap_dc, &rect, brush);
192  }
193 }
194 
195 ////////////////////////////////////////////////////////////////////
196 // Function: WinStatsPianoRoll::end_draw
197 // Access: Protected, Virtual
198 // Description: Called after all the bars have been drawn, this
199 // triggers a refresh event to draw it to the window.
200 ////////////////////////////////////////////////////////////////////
201 void WinStatsPianoRoll::
202 end_draw() {
203  InvalidateRect(_graph_window, NULL, FALSE);
204 }
205 
206 ////////////////////////////////////////////////////////////////////
207 // Function: WinStatsPianoRoll::idle
208 // Access: Protected, Virtual
209 // Description: Called at the end of the draw cycle.
210 ////////////////////////////////////////////////////////////////////
211 void WinStatsPianoRoll::
212 idle() {
213  if (_labels_changed) {
214  update_labels();
215  }
216 }
217 
218 ////////////////////////////////////////////////////////////////////
219 // Function: WinStatsPianoRoll::window_proc
220 // Access: Protected
221 // Description:
222 ////////////////////////////////////////////////////////////////////
223 LONG WinStatsPianoRoll::
224 window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
225  switch (msg) {
226  case WM_LBUTTONDOWN:
227  if (_potential_drag_mode == DM_new_guide_bar) {
228  set_drag_mode(DM_new_guide_bar);
229  SetCapture(_graph_window);
230  return 0;
231  }
232  break;
233 
234  default:
235  break;
236  }
237 
238  return WinStatsGraph::window_proc(hwnd, msg, wparam, lparam);
239 }
240 
241 ////////////////////////////////////////////////////////////////////
242 // Function: WinStatsPianoRoll::graph_window_proc
243 // Access: Protected
244 // Description:
245 ////////////////////////////////////////////////////////////////////
246 LONG WinStatsPianoRoll::
247 graph_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
248  switch (msg) {
249  case WM_LBUTTONDOWN:
250  if (_potential_drag_mode == DM_none) {
251  set_drag_mode(DM_scale);
252  PN_int16 x = LOWORD(lparam);
253  _drag_scale_start = pixel_to_height(x);
254  SetCapture(_graph_window);
255  return 0;
256 
257  } else if (_potential_drag_mode == DM_guide_bar && _drag_guide_bar >= 0) {
258  set_drag_mode(DM_guide_bar);
259  PN_int16 x = LOWORD(lparam);
260  _drag_start_x = x;
261  SetCapture(_graph_window);
262  return 0;
263  }
264  break;
265 
266  case WM_MOUSEMOVE:
267  if (_drag_mode == DM_none && _potential_drag_mode == DM_none) {
268  // When the mouse is over a color bar, highlight it.
269  PN_int16 x = LOWORD(lparam);
270  PN_int16 y = HIWORD(lparam);
271  _label_stack.highlight_label(get_collector_under_pixel(x, y));
272 
273  // Now we want to get a WM_MOUSELEAVE when the mouse leaves the
274  // graph window.
275  TRACKMOUSEEVENT tme = {
276  sizeof(TRACKMOUSEEVENT),
277  TME_LEAVE,
278  _graph_window,
279  0
280  };
281  TrackMouseEvent(&tme);
282 
283  } else {
284  // If the mouse is in some drag mode, stop highlighting.
285  _label_stack.highlight_label(-1);
286  }
287 
288  if (_drag_mode == DM_scale) {
289  PN_int16 x = LOWORD(lparam);
290  double ratio = (double)x / (double)get_xsize();
291  if (ratio > 0.0f) {
292  set_horizontal_scale(_drag_scale_start / ratio);
293  }
294  return 0;
295 
296  } else if (_drag_mode == DM_new_guide_bar) {
297  // We haven't created the new guide bar yet; we won't until the
298  // mouse comes within the graph's region.
299  PN_int16 x = LOWORD(lparam);
300  if (x >= 0 && x < get_xsize()) {
301  set_drag_mode(DM_guide_bar);
302  _drag_guide_bar = add_user_guide_bar(pixel_to_height(x));
303  return 0;
304  }
305 
306  } else if (_drag_mode == DM_guide_bar) {
307  PN_int16 x = LOWORD(lparam);
308  move_user_guide_bar(_drag_guide_bar, pixel_to_height(x));
309  return 0;
310  }
311  break;
312 
313  case WM_MOUSELEAVE:
314  // When the mouse leaves the graph, stop highlighting.
315  _label_stack.highlight_label(-1);
316  break;
317 
318  case WM_LBUTTONUP:
319  if (_drag_mode == DM_scale) {
320  set_drag_mode(DM_none);
321  ReleaseCapture();
322  return 0;
323 
324  } else if (_drag_mode == DM_guide_bar) {
325  PN_int16 x = LOWORD(lparam);
326  if (x < 0 || x >= get_xsize()) {
327  remove_user_guide_bar(_drag_guide_bar);
328  } else {
329  move_user_guide_bar(_drag_guide_bar, pixel_to_height(x));
330  }
331  set_drag_mode(DM_none);
332  ReleaseCapture();
333  return 0;
334  }
335  break;
336 
337  case WM_LBUTTONDBLCLK:
338  {
339  // Double-clicking on a color bar in the graph is the same as
340  // double-clicking on the corresponding label.
341  PN_int16 x = LOWORD(lparam);
342  PN_int16 y = HIWORD(lparam);
343  clicked_label(get_collector_under_pixel(x, y));
344  return 0;
345  }
346  break;
347 
348  default:
349  break;
350  }
351 
352  return WinStatsGraph::graph_window_proc(hwnd, msg, wparam, lparam);
353 }
354 
355 ////////////////////////////////////////////////////////////////////
356 // Function: WinStatsPianoRoll::additional_window_paint
357 // Access: Protected, Virtual
358 // Description: This is called during the servicing of WM_PAINT; it
359 // gives a derived class opportunity to do some further
360 // painting into the window (the outer window, not the
361 // graph window).
362 ////////////////////////////////////////////////////////////////////
363 void WinStatsPianoRoll::
364 additional_window_paint(HDC hdc) {
365  // Draw in the labels for the guide bars.
366  HFONT hfnt = (HFONT)GetStockObject(ANSI_VAR_FONT);
367  SelectObject(hdc, hfnt);
368  SetTextAlign(hdc, TA_LEFT | TA_BOTTOM);
369  SetBkMode(hdc, TRANSPARENT);
370 
371  int y = _top_margin;
372 
373  int i;
374  int num_guide_bars = get_num_guide_bars();
375  for (i = 0; i < num_guide_bars; i++) {
376  draw_guide_label(hdc, y, get_guide_bar(i));
377  }
378 
379  int num_user_guide_bars = get_num_user_guide_bars();
380  for (i = 0; i < num_user_guide_bars; i++) {
381  draw_guide_label(hdc, y, get_user_guide_bar(i));
382  }
383 }
384 
385 ////////////////////////////////////////////////////////////////////
386 // Function: WinStatsPianoRoll::additional_graph_window_paint
387 // Access: Protected, Virtual
388 // Description: This is called during the servicing of WM_PAINT; it
389 // gives a derived class opportunity to do some further
390 // painting into the window (the outer window, not the
391 // graph window).
392 ////////////////////////////////////////////////////////////////////
393 void WinStatsPianoRoll::
394 additional_graph_window_paint(HDC hdc) {
395  int num_user_guide_bars = get_num_user_guide_bars();
396  for (int i = 0; i < num_user_guide_bars; i++) {
397  draw_guide_bar(hdc, get_user_guide_bar(i));
398  }
399 }
400 
401 ////////////////////////////////////////////////////////////////////
402 // Function: WinStatsPianoRoll::consider_drag_start
403 // Access: Protected, Virtual
404 // Description: Based on the mouse position within the window's
405 // client area, look for draggable things the mouse
406 // might be hovering over and return the apprioprate
407 // DragMode enum or DM_none if nothing is indicated.
408 ////////////////////////////////////////////////////////////////////
409 WinStatsGraph::DragMode WinStatsPianoRoll::
410 consider_drag_start(int mouse_x, int mouse_y, int width, int height) {
411  if (mouse_y >= _graph_top && mouse_y < _graph_top + get_ysize()) {
412  if (mouse_x >= _graph_left && mouse_x < _graph_left + get_xsize()) {
413  // See if the mouse is over a user-defined guide bar.
414  int x = mouse_x - _graph_left;
415  double from_height = pixel_to_height(x - 2);
416  double to_height = pixel_to_height(x + 2);
417  _drag_guide_bar = find_user_guide_bar(from_height, to_height);
418  if (_drag_guide_bar >= 0) {
419  return DM_guide_bar;
420  }
421 
422  } else if (mouse_x < _left_margin - 2 ||
423  mouse_x > width - _right_margin + 2) {
424  // The mouse is left or right of the graph; maybe create a new
425  // guide bar.
426  return DM_new_guide_bar;
427  }
428  }
429 
430  return WinStatsGraph::consider_drag_start(mouse_x, mouse_y, width, height);
431 }
432 
433 ////////////////////////////////////////////////////////////////////
434 // Function: WinStatsPianoRoll::get_collector_under_pixel
435 // Access: Private
436 // Description: Returns the collector index associated with the
437 // indicated vertical row, or -1.
438 ////////////////////////////////////////////////////////////////////
439 int WinStatsPianoRoll::
440 get_collector_under_pixel(int xpoint, int ypoint) {
441  if (_label_stack.get_num_labels() == 0) {
442  return -1;
443  }
444 
445  // Assume all of the labels are the same height.
446  int height = _label_stack.get_label_height(0);
447  int row = (get_ysize() - ypoint) / height;
448  if (row >= 0 && row < _label_stack.get_num_labels()) {
449  return _label_stack.get_label_collector_index(row);
450  } else {
451  return -1;
452  }
453 }
454 
455 ////////////////////////////////////////////////////////////////////
456 // Function: WinStatsPianoRoll::update_labels
457 // Access: Private
458 // Description: Resets the list of labels.
459 ////////////////////////////////////////////////////////////////////
460 void WinStatsPianoRoll::
461 update_labels() {
462  _label_stack.clear_labels();
463  for (int i = 0; i < get_num_labels(); i++) {
464  int label_index =
465  _label_stack.add_label(WinStatsGraph::_monitor, this,
466  _thread_index,
467  get_label_collector(i), true);
468  }
469  _labels_changed = false;
470 }
471 
472 ////////////////////////////////////////////////////////////////////
473 // Function: WinStatsPianoRoll::draw_guide_bar
474 // Access: Private
475 // Description: Draws the line for the indicated guide bar on the
476 // graph.
477 ////////////////////////////////////////////////////////////////////
478 void WinStatsPianoRoll::
479 draw_guide_bar(HDC hdc, const PStatGraph::GuideBar &bar) {
480  int x = height_to_pixel(bar._height);
481 
482  if (x > 0 && x < get_xsize() - 1) {
483  // Only draw it if it's not too close to either edge.
484  switch (bar._style) {
485  case GBS_target:
486  SelectObject(hdc, _light_pen);
487  break;
488 
489  case GBS_user:
490  SelectObject(hdc, _user_guide_bar_pen);
491  break;
492 
493  case GBS_normal:
494  SelectObject(hdc, _dark_pen);
495  break;
496  }
497  MoveToEx(hdc, x, 0, NULL);
498  LineTo(hdc, x, get_ysize());
499  }
500 }
501 
502 ////////////////////////////////////////////////////////////////////
503 // Function: WinStatsPianoRoll::draw_guide_label
504 // Access: Private
505 // Description: Draws the text for the indicated guide bar label at
506 // the top of the graph.
507 ////////////////////////////////////////////////////////////////////
508 void WinStatsPianoRoll::
509 draw_guide_label(HDC hdc, int y, const PStatGraph::GuideBar &bar) {
510  switch (bar._style) {
511  case GBS_target:
512  SetTextColor(hdc, _light_color);
513  break;
514 
515  case GBS_user:
516  SetTextColor(hdc, _user_guide_bar_color);
517  break;
518 
519  case GBS_normal:
520  SetTextColor(hdc, _dark_color);
521  break;
522  }
523 
524  int x = height_to_pixel(bar._height);
525  const string &label = bar._label;
526  SIZE size;
527  GetTextExtentPoint32(hdc, label.data(), label.length(), &size);
528 
529  if (bar._style != GBS_user) {
530  double from_height = pixel_to_height(x - size.cx);
531  double to_height = pixel_to_height(x + size.cx);
532  if (find_user_guide_bar(from_height, to_height) >= 0) {
533  // Omit the label: there's a user-defined guide bar in the same space.
534  return;
535  }
536  }
537 
538  int this_x = _graph_left + x - size.cx / 2;
539  if (x >= 0 && x < get_xsize()) {
540  TextOut(hdc, this_x, y,
541  label.data(), label.length());
542  }
543 }
544 
545 ////////////////////////////////////////////////////////////////////
546 // Function: WinStatsPianoRoll::create_window
547 // Access: Private
548 // Description: Creates the window for this strip chart.
549 ////////////////////////////////////////////////////////////////////
550 void WinStatsPianoRoll::
551 create_window() {
552  if (_window) {
553  return;
554  }
555 
556  HINSTANCE application = GetModuleHandle(NULL);
557  register_window_class(application);
558 
559  const PStatClientData *client_data =
560  WinStatsGraph::_monitor->get_client_data();
561  string thread_name = client_data->get_thread_name(_thread_index);
562  string window_title = thread_name + " thread piano roll";
563 
564 
565  RECT win_rect = {
566  0, 0,
567  _left_margin + get_xsize() + _right_margin,
568  _top_margin + get_ysize() + _bottom_margin
569  };
570 
571  // compute window size based on desired client area size
572  AdjustWindowRect(&win_rect, graph_window_style, FALSE);
573 
574  _window =
575  CreateWindow(_window_class_name, window_title.c_str(), graph_window_style,
576  CW_USEDEFAULT, CW_USEDEFAULT,
577  win_rect.right - win_rect.left,
578  win_rect.bottom - win_rect.top,
579  WinStatsGraph::_monitor->get_window(), NULL, application, 0);
580  if (!_window) {
581  nout << "Could not create PianoRoll window!\n";
582  exit(1);
583  }
584 
585  SetWindowLongPtr(_window, 0, (LONG_PTR)this);
586  setup_label_stack();
587 
588  // Ensure that the window is on top of the stack.
589  SetWindowPos(_window, HWND_TOP, 0, 0, 0, 0,
590  SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
591 }
592 
593 ////////////////////////////////////////////////////////////////////
594 // Function: WinStatsPianoRoll::register_window_class
595 // Access: Private, Static
596 // Description: Registers the window class for the pianoRoll window, if
597 // it has not already been registered.
598 ////////////////////////////////////////////////////////////////////
599 void WinStatsPianoRoll::
600 register_window_class(HINSTANCE application) {
601  if (_window_class_registered) {
602  return;
603  }
604 
605  WNDCLASS wc;
606 
607  ZeroMemory(&wc, sizeof(WNDCLASS));
608  wc.style = 0;
609  wc.lpfnWndProc = (WNDPROC)static_window_proc;
610  wc.hInstance = application;
611  wc.hCursor = LoadCursor(NULL, IDC_ARROW);
612  wc.hbrBackground = (HBRUSH)COLOR_BACKGROUND;
613  wc.lpszMenuName = NULL;
614  wc.lpszClassName = _window_class_name;
615 
616  // Reserve space to associate the this pointer with the window.
617  wc.cbWndExtra = sizeof(WinStatsPianoRoll *);
618 
619  if (!RegisterClass(&wc)) {
620  nout << "Could not register PianoRoll window class!\n";
621  exit(1);
622  }
623 
624  _window_class_registered = true;
625 }
626 
627 ////////////////////////////////////////////////////////////////////
628 // Function: WinStatsPianoRoll::static_window_proc
629 // Access: Private, Static
630 // Description:
631 ////////////////////////////////////////////////////////////////////
632 LONG WINAPI WinStatsPianoRoll::
633 static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
634  WinStatsPianoRoll *self = (WinStatsPianoRoll *)GetWindowLongPtr(hwnd, 0);
635  if (self != (WinStatsPianoRoll *)NULL && self->_window == hwnd) {
636  return self->window_proc(hwnd, msg, wparam, lparam);
637  } else {
638  return DefWindowProc(hwnd, msg, wparam, lparam);
639  }
640 }
virtual void clicked_label(int collector_index)
Called when the user single-clicks on a label.
int get_xsize() const
Returns the width of the chart in pixels.
Definition: pStatGraph.I:103
int get_guide_bar_units() const
Returns the units that are displayed for the guide bar labels.
Definition: pStatGraph.I:140
void set_guide_bar_units(int unit_mask)
Sets the units that are displayed for the guide bar labels.
Definition: pStatGraph.I:125
int get_ysize() const
Returns the height of the chart in pixels.
Definition: pStatGraph.I:113
int get_num_labels() const
Returns the number of labels to be drawn for this chart.
Definition: pStatGraph.I:33
This is an abstract class that presents the interface for drawing a piano-roll type chart: it shows t...
void move_user_guide_bar(int n, double height)
Adjusts the height of the nth user-defined guide bar.
Definition: pStatGraph.cxx:137
void set_horizontal_scale(double time_width)
Changes the amount of time the width of the horizontal axis represents.
The data associated with a particular client, but not with any one particular frame or thread: the li...
int find_user_guide_bar(double from_height, double to_height) const
Returns the index number of the first user guide bar found whose height is within the indicated range...
Definition: pStatGraph.cxx:172
void update()
Updates the chart with the latest data.
void open_strip_chart(int thread_index, int collector_index, bool show_level)
Opens a new strip chart showing the indicated data.
virtual void new_data(int thread_index, int frame_number)
Called as each frame&#39;s data is made available.
const GuideBar & get_guide_bar(int n) const
Returns the nth horizontal guide bar.
Definition: pStatGraph.cxx:101
virtual void force_redraw()
Called when it is necessary to redraw the entire graph.
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: winStatsGraph.h:32
int height_to_pixel(double value) const
Converts a value (i.e.
virtual void changed_graph_size(int graph_xsize, int graph_ysize)
Called when the user has resized the window, forcing a resize of the graph.
virtual void set_time_units(int unit_mask)
Called when the user selects a new time units from the monitor pulldown menu, this should adjust the ...
int get_label_collector(int n) const
Returns the collector index associated with the nth label.
Definition: pStatGraph.I:44
This class represents a connection to a PStatsClient and manages the data exchange with the client...
int get_num_guide_bars() const
Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame...
Definition: pStatGraph.cxx:86
A window that draws a piano-roll style chart, which shows the collectors explicitly stopping and star...
void set_horizontal_scale(double time_width)
Changes the amount of time the width of the horizontal axis represents.
double pixel_to_height(int y) const
Converts a horizontal pixel offset to a value (a "height" in the strip chart).
const PStatClientData * get_client_data() const
Returns the client data associated with this monitor.
Definition: pStatMonitor.I:32
HWND get_window() const
Returns the window handle to the monitor&#39;s window.
int add_user_guide_bar(double height)
Creates a new user guide bar and returns its index number.
Definition: pStatGraph.cxx:148
GuideBar get_user_guide_bar(int n) const
Returns the nth user-defined guide bar.
Definition: pStatGraph.cxx:126
int get_num_user_guide_bars() const
Returns the current number of user-defined guide bars.
Definition: pStatGraph.cxx:116
string get_thread_name(int index) const
Returns the name of the indicated thread.
void remove_user_guide_bar(int n)
Removes the user guide bar with the indicated index number.
Definition: pStatGraph.cxx:160