#include <pStatPianoRoll.h>
Inheritance diagram for PStatPianoRoll:
Public Types | |
enum | GuideBarUnits { GBU_hz = 0x0001, GBU_ms = 0x0002, GBU_named = 0x0004, GBU_show_units = 0x0008 } |
Public Member Functions | |
PStatPianoRoll (PStatMonitor *monitor, int thread_index, int xsize, int ysize) | |
virtual | ~PStatPianoRoll () |
void | update () |
Updates the chart with the latest data. | |
void | set_horizontal_scale (float time_width) |
Changes the amount of time the width of the horizontal axis represents. | |
float | get_horizontal_scale () const |
Returns the amount of total time the width of the horizontal axis represents. | |
int | timestamp_to_pixel (float time) const |
Converts a timestamp to a horizontal pixel offset. | |
float | pixel_to_timestamp (int x) const |
Converts a horizontal pixel offset to a timestamp. | |
PStatMonitor * | get_monitor () const |
Returns the monitor associated with this chart. | |
int | get_num_labels () const |
Returns the number of labels to be drawn for this chart. | |
int | get_label_collector (int n) const |
Returns the collector index associated with the nth label. | |
string | get_label_name (int n) const |
Returns the text associated with the nth label. | |
RGBColorf | get_label_color (int n) const |
Returns the color associated with the nth label. | |
void | set_target_frame_rate (float frame_rate) |
Sets the target frame rate of the application in Hz. | |
float | get_target_frame_rate () const |
Returns the indicated target frame rate in Hz. | |
int | get_xsize () const |
Returns the width of the chart in pixels. | |
int | get_ysize () const |
Returns the height of the chart in pixels. | |
int | get_num_guide_bars () const |
Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame rate. | |
const GuideBar & | get_guide_bar (int n) const |
Returns the nth horizontal guide bar. | |
void | set_guide_bar_units (int unit_mask) |
Sets the units that are displayed for the guide bar labels. | |
int | get_guide_bar_units () const |
Returns the units that are displayed for the guide bar labels. | |
void | set_guide_bar_unit_name (const string &unit_name) |
Sets the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_show_units. | |
const string & | get_guide_bar_unit_name () const |
Returns the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_show_units. | |
Static Public Member Functions | |
string | format_number (float value) |
Returns a string representing the value nicely formatted for its range. | |
string | format_number (float value, int guide_bar_units, const string &unit_name=string()) |
Returns a string representing the value nicely formatted for its range, including the units as indicated. | |
Protected Types | |
typedef vector_int | Labels |
typedef pvector< GuideBar > | GuideBars |
Protected Member Functions | |
void | changed_size (int xsize, int ysize) |
To be called by the user class when the widget size has changed. | |
void | force_redraw () |
To be called by the user class when the whole thing needs to be redrawn for some reason. | |
virtual void | normal_guide_bars () |
Calls update_guide_bars with parameters suitable to this kind of graph. | |
virtual void | begin_draw () |
Should be overridden by the user class. | |
virtual void | begin_row (int row) |
Should be overridden by the user class. | |
virtual void | draw_bar (int row, int from_x, int to_x) |
Draws a single bar in the chart for the indicated row, in the color get_row_color(row), for the indicated horizontal pixel range. | |
virtual void | end_row (int row) |
Should be overridden by the user class. | |
virtual void | end_draw () |
Should be overridden by the user class. | |
virtual void | idle () |
Should be overridden by the user class to perform any other updates might be necessary after the bars have been redrawn. | |
void | update_guide_bars (int num_bars, float scale) |
Resets the list of guide bars. | |
GuideBar | make_guide_bar (float value) const |
Makes a guide bar for the indicated elapsed time or level units. | |
Protected Attributes | |
bool | _labels_changed |
bool | _guide_bars_changed |
PointerTo< PStatMonitor > | _monitor |
float | _target_frame_rate |
int | _xsize |
int | _ysize |
Labels | _labels |
GuideBars | _guide_bars |
int | _guide_bar_units |
string | _unit_name |
Private Types | |
typedef pvector< ColorBar > | ColorBars |
typedef pmap< int, BarBuilder > | PageData |
Private Member Functions | |
void | compute_page (const PStatFrameData &frame_data) |
Examines the given frame data and rebuilds the _page_data to match it. | |
Private Attributes | |
int | _thread_index |
float | _time_width |
float | _start_time |
PageData | _page_data |
int | _current_frame |
This class just manages all the piano-roll logic; the actual nuts and bolts of drawing pixels is left to a user-derived class.
Definition at line 61 of file pStatPianoRoll.h.
|
Definition at line 100 of file pStatPianoRoll.h. |
|
Definition at line 115 of file pStatGraph.h. |
|
Definition at line 112 of file pStatGraph.h. |
|
Definition at line 113 of file pStatPianoRoll.h. |
|
Definition at line 76 of file pStatGraph.h. |
|
|
Definition at line 133 of file pStatPianoRoll.cxx. |
|
Should be overridden by the user class. This hook will be called before drawing any bars in the chart. Reimplemented in GtkStatsPianoRoll. Definition at line 249 of file pStatPianoRoll.cxx. |
|
Should be overridden by the user class. This hook will be called before drawing any one row of bars. These bars correspond to the collector whose index is get_row_collector(row), and in the color get_row_color(row). Definition at line 269 of file pStatPianoRoll.cxx. References SortCollectorLabels1::_client_data. |
|
To be called by the user class when the widget size has changed. This updates the chart's internal data and causes it to issue redraw commands to reflect the new size. Definition at line 182 of file pStatPianoRoll.cxx. |
|
Examines the given frame data and rebuilds the _page_data to match it.
Definition at line 363 of file pStatPianoRoll.cxx. Referenced by PStatPianoRoll(). |
|
Draws a single bar in the chart for the indicated row, in the color get_row_color(row), for the indicated horizontal pixel range.
Reimplemented in GtkStatsPianoRoll. Definition at line 285 of file pStatPianoRoll.cxx. References _page_data, _start_time, PStatFrameData::get_num_events(), PStatFrameData::get_start(), PStatFrameData::get_time_collector(), and size_t. |
|
Should be overridden by the user class. This hook will be called after drawing a series of color bars in the chart. Reimplemented in GtkStatsPianoRoll. Definition at line 317 of file pStatPianoRoll.cxx. References PStatGraph::_labels, and PStatGraph::_labels_changed. |
|
Should be overridden by the user class. This hook will be called after drawing a series of color bars for a single row. Definition at line 301 of file pStatPianoRoll.cxx. References _page_data. |
|
To be called by the user class when the whole thing needs to be redrawn for some reason.
Definition at line 203 of file pStatPianoRoll.cxx. Referenced by update(). |
|
Returns a string representing the value nicely formatted for its range, including the units as indicated.
Definition at line 182 of file pStatGraph.cxx. |
|
Returns a string representing the value nicely formatted for its range.
Definition at line 151 of file pStatGraph.cxx. References PStatGraph::GBU_show_units. Referenced by PStatGraph::update_guide_bars(). |
|
Returns the nth horizontal guide bar. This should be drawn as a horizontal line across the chart at the y pixel location determined by height_to_pixel(bar._height). It is possible that this bar will be off the top of the chart. Definition at line 131 of file pStatGraph.cxx. |
|
Returns the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_show_units.
Definition at line 223 of file pStatGraph.I. |
|
Returns the units that are displayed for the guide bar labels. This may be a union of one or more members of the GuideBarUnits enum. Definition at line 189 of file pStatGraph.I. |
|
Returns the amount of total time the width of the horizontal axis represents.
Definition at line 52 of file pStatPianoRoll.I. References _start_time, _time_width, and PStatGraph::_xsize. |
|
Returns the collector index associated with the nth label.
Definition at line 62 of file pStatGraph.I. Referenced by GtkStatsPianoRoll::begin_draw(). |
|
Returns the color associated with the nth label.
Definition at line 90 of file pStatGraph.I. References PStatGraph::_target_frame_rate, and INLINE. |
|
Returns the text associated with the nth label.
Definition at line 76 of file pStatGraph.I. References PStatGraph::_target_frame_rate, INLINE, and PStatGraph::normal_guide_bars(). |
|
Returns the monitor associated with this chart.
Definition at line 32 of file pStatGraph.I. References PStatGraph::_labels, and INLINE. Referenced by GtkStatsStripChart::get_labels(), and PStatStripChart::new_data(). |
|
Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame rate. Not all of these may be visible; some may be off the top of the chart because of the vertical scale. Definition at line 108 of file pStatGraph.cxx. References PStatGraph::_guide_bars. |
|
Returns the number of labels to be drawn for this chart.
Definition at line 47 of file pStatGraph.I. References PStatGraph::_labels, INLINE, and nassertr. |
|
Returns the indicated target frame rate in Hz. Definition at line 126 of file pStatGraph.I. References PStatGraph::_guide_bar_units, INLINE, and PStatGraph::normal_guide_bars(). |
|
Returns the width of the chart in pixels.
Definition at line 139 of file pStatGraph.I. References PStatGraph::_guide_bar_units, and INLINE. Referenced by GtkStatsStripChart::end_draw(), GtkStatsStripChart::get_collector_gc(), GtkStatsStripWindow::menu_hscale(), and PStatStripChart::set_scroll_mode(). |
|
Returns the height of the chart in pixels.
Definition at line 152 of file pStatGraph.I. References PStatGraph::_unit_name, and INLINE. Referenced by GtkStatsStripChart::copy_region(), GtkStatsStripChart::draw_slice(), GtkStatsStripChart::end_draw(), GtkStatsStripChart::get_collector_gc(), PStatStripChart::get_scroll_mode(), and GtkStatsStripWindow::menu_hscale(). |
|
Should be overridden by the user class to perform any other updates might be necessary after the bars have been redrawn.
Reimplemented in GtkStatsPianoRoll. Definition at line 333 of file pStatPianoRoll.cxx. |
|
Makes a guide bar for the indicated elapsed time or level units.
Definition at line 289 of file pStatGraph.cxx. |
|
Calls update_guide_bars with parameters suitable to this kind of graph.
Implements PStatGraph. Definition at line 233 of file pStatPianoRoll.cxx. Referenced by update(). |
|
Converts a horizontal pixel offset to a timestamp.
Definition at line 78 of file pStatPianoRoll.I. |
|
Sets the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_show_units.
Definition at line 206 of file pStatGraph.I. |
|
Sets the units that are displayed for the guide bar labels. This may be a union of one or more members of the GuideBarUnits enum. Definition at line 169 of file pStatGraph.I. References PStatGraph::_unit_name. |
|
Changes the amount of time the width of the horizontal axis represents. This may force a redraw. Definition at line 33 of file pStatPianoRoll.I. References _time_width, and INLINE. |
|
Sets the target frame rate of the application in Hz. This only affects the choice of initial scale and the placement of guide bars. Definition at line 108 of file pStatGraph.I. References PStatGraph::_xsize. |
|
Converts a timestamp to a horizontal pixel offset.
Definition at line 65 of file pStatPianoRoll.I. |
|
Updates the chart with the latest data.
Definition at line 145 of file pStatPianoRoll.cxx. References PStatGraph::_xsize, PStatGraph::_ysize, force_redraw(), and normal_guide_bars(). Referenced by GtkStatsPianoWindow::mark_dead(). |
|
Resets the list of guide bars.
Definition at line 247 of file pStatGraph.cxx. References PStatGraph::_guide_bar_units, PStatGraph::_target_frame_rate, PStatGraph::_unit_name, PStatGraph::format_number(), PStatGraph::GBU_named, and IS_NEARLY_EQUAL. |
|
Definition at line 115 of file pStatPianoRoll.h. Referenced by PStatPianoRoll(). |
|
Definition at line 117 of file pStatGraph.h. Referenced by PStatGraph::get_target_frame_rate(), PStatGraph::get_xsize(), PStatStripChart::PStatStripChart(), and PStatGraph::update_guide_bars(). |
|
Definition at line 116 of file pStatGraph.h. Referenced by PStatGraph::get_num_guide_bars(), and PStatGraph::~PStatGraph(). |
|
Definition at line 101 of file pStatGraph.h. Referenced by GtkStatsStripChart::draw_cursor(). |
|
Definition at line 113 of file pStatGraph.h. Referenced by PStatStripChart::draw_slice(), end_draw(), PStatGraph::get_monitor(), and PStatGraph::get_num_labels(). |
|
Definition at line 100 of file pStatGraph.h. Referenced by end_draw(). |
|
Definition at line 103 of file pStatGraph.h. Referenced by PStatGraph::GuideBar::GuideBar(), PStatPianoRoll(), and PStatStripChart::PStatStripChart(). |
|
Definition at line 114 of file pStatPianoRoll.h. Referenced by draw_bar(), and end_row(). |
|
Definition at line 93 of file pStatPianoRoll.h. Referenced by draw_bar(), and get_horizontal_scale(). |
|
Definition at line 105 of file pStatGraph.h. Referenced by PStatGraph::get_label_color(), PStatGraph::get_label_name(), and PStatGraph::update_guide_bars(). |
|
Definition at line 90 of file pStatPianoRoll.h. Referenced by PStatPianoRoll(). |
|
Definition at line 92 of file pStatPianoRoll.h. Referenced by get_horizontal_scale(), and set_horizontal_scale(). |
|
Definition at line 118 of file pStatGraph.h. Referenced by PStatGraph::get_ysize(), PStatStripChart::PStatStripChart(), PStatGraph::set_guide_bar_units(), and PStatGraph::update_guide_bars(). |
|
Definition at line 107 of file pStatGraph.h. Referenced by PStatStripChart::get_frame_data(), get_horizontal_scale(), PStatGraph::GuideBar::GuideBar(), PStatStripChart::idle(), PStatStripChart::set_default_vertical_scale(), PStatGraph::set_target_frame_rate(), and update(). |
|
Definition at line 108 of file pStatGraph.h. Referenced by PStatStripChart::get_frame_data(), PStatGraph::GuideBar::GuideBar(), and update(). |