Panda3D
|
A window that draws a strip chart, given a view. More...
#include "gtkStatsStripChart.h"
Public Member Functions | |
GtkStatsStripChart (GtkStatsMonitor *monitor, int thread_index, int collector_index, bool show_level) | |
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 | clicked_label (int collector_index) |
Called when the user single-clicks on a label. | |
virtual void | force_redraw () |
Called when it is necessary to redraw the entire graph. | |
virtual void | new_collector (int collector_index) |
Called whenever a new Collector definition is received from the client. | |
virtual void | new_data (int thread_index, int frame_number) |
Called as each frame's data is made available. | |
virtual void | set_scroll_speed (double scroll_speed) |
Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust the speed for the graph to the indicated value. | |
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 units for the graph to the indicated mask if it is a time-based graph. | |
void | set_vertical_scale (double value_height) |
Changes the value the height of the vertical axis represents. | |
Protected Member Functions | |
virtual void | additional_graph_window_paint () |
This is called during the servicing of expose_event; it gives a derived class opportunity to do some further painting into the graph window. | |
virtual void | clear_region () |
Erases the chart area. | |
virtual DragMode | consider_drag_start (int graph_x, int graph_y) |
Based on the mouse position within the graph window, look for draggable things the mouse might be hovering over and return the appropriate DragMode enum or DM_none if nothing is indicated. | |
virtual void | copy_region (int start_x, int end_x, int dest_x) |
Should be overridden by the user class to copy a region of the chart from one part of the chart to another. | |
virtual void | draw_cursor (int x) |
Draws a single vertical slice of foreground color. | |
virtual void | draw_empty (int x, int w) |
Draws a single vertical slice of background color. | |
virtual void | draw_slice (int x, int w, const PStatStripChart::FrameData &fdata) |
Draws a single vertical slice of the strip chart, at the given pixel position, and corresponding to the indicated level data. | |
virtual void | end_draw (int from_x, int to_x) |
Should be overridden by the user class. | |
virtual gboolean | handle_button_press (GtkWidget *widget, int graph_x, int graph_y, bool double_click) |
Called when the mouse button is depressed within the graph window. | |
virtual gboolean | handle_button_release (GtkWidget *widget, int graph_x, int graph_y) |
Called when the mouse button is released within the graph window. | |
virtual gboolean | handle_motion (GtkWidget *widget, int graph_x, int graph_y) |
Called when the mouse is moved within the graph window. | |
virtual void | set_drag_mode (DragMode drag_mode) |
This should be called whenever the drag mode needs to change state. | |
virtual void | update_labels () |
Resets the list of labels. |
A window that draws a strip chart, given a view.
Definition at line 32 of file gtkStatsStripChart.h.
void GtkStatsStripChart::additional_graph_window_paint | ( | ) | [protected, virtual] |
This is called during the servicing of expose_event; it gives a derived class opportunity to do some further painting into the graph window.
Reimplemented from GtkStatsGraph.
Definition at line 388 of file gtkStatsStripChart.cxx.
References PStatGraph::get_num_user_guide_bars(), PStatGraph::get_user_guide_bar(), and PStatGraph::get_xsize().
void GtkStatsStripChart::changed_graph_size | ( | int | graph_xsize, |
int | graph_ysize | ||
) | [virtual] |
Called when the user has resized the window, forcing a resize of the graph.
Reimplemented from GtkStatsGraph.
Definition at line 159 of file gtkStatsStripChart.cxx.
References PStatStripChart::changed_size().
void GtkStatsStripChart::clear_region | ( | ) | [protected, virtual] |
Erases the chart area.
Reimplemented from PStatStripChart.
Definition at line 268 of file gtkStatsStripChart.cxx.
References PStatGraph::get_xsize(), and PStatGraph::get_ysize().
void GtkStatsStripChart::clicked_label | ( | int | collector_index | ) | [virtual] |
Called when the user single-clicks on a label.
Reimplemented from GtkStatsGraph.
Definition at line 204 of file gtkStatsStripChart.cxx.
References PStatMonitor::get_client_data(), PStatClientData::get_collector_def(), PStatStripChart::get_collector_index(), PStatStripChart::get_view(), PStatClientData::has_collector(), and PStatStripChart::set_collector_index().
Referenced by handle_button_press().
GtkStatsGraph::DragMode GtkStatsStripChart::consider_drag_start | ( | int | graph_x, |
int | graph_y | ||
) | [protected, virtual] |
Based on the mouse position within the graph window, look for draggable things the mouse might be hovering over and return the appropriate DragMode enum or DM_none if nothing is indicated.
Reimplemented from GtkStatsGraph.
Definition at line 404 of file gtkStatsStripChart.cxx.
References PStatGraph::find_user_guide_bar(), PStatGraph::get_xsize(), PStatGraph::get_ysize(), and PStatStripChart::pixel_to_height().
void GtkStatsStripChart::copy_region | ( | int | start_x, |
int | end_x, | ||
int | dest_x | ||
) | [protected, virtual] |
Should be overridden by the user class to copy a region of the chart from one part of the chart to another.
This is used to implement scrolling.
Reimplemented from PStatStripChart.
Definition at line 282 of file gtkStatsStripChart.cxx.
References PStatGraph::get_ysize().
void GtkStatsStripChart::draw_cursor | ( | int | x | ) | [protected, virtual] |
Draws a single vertical slice of foreground color.
Reimplemented from PStatStripChart.
Definition at line 353 of file gtkStatsStripChart.cxx.
References PStatGraph::get_ysize().
void GtkStatsStripChart::draw_empty | ( | int | x, |
int | w | ||
) | [protected, virtual] |
Draws a single vertical slice of background color.
Reimplemented from PStatStripChart.
Definition at line 341 of file gtkStatsStripChart.cxx.
References PStatGraph::get_ysize().
void GtkStatsStripChart::draw_slice | ( | int | x, |
int | w, | ||
const PStatStripChart::FrameData & | fdata | ||
) | [protected, virtual] |
Draws a single vertical slice of the strip chart, at the given pixel position, and corresponding to the indicated level data.
Reimplemented from PStatStripChart.
Definition at line 306 of file gtkStatsStripChart.cxx.
References GtkStatsGraph::get_collector_gc(), PStatStripChart::get_vertical_scale(), PStatGraph::get_ysize(), and PStatStripChart::height_to_pixel().
void GtkStatsStripChart::end_draw | ( | int | from_x, |
int | to_x | ||
) | [protected, virtual] |
Should be overridden by the user class.
This hook will be called after drawing a series of color bars in the strip chart; it gives the pixel range that was just redrawn.
Reimplemented from PStatStripChart.
Definition at line 367 of file gtkStatsStripChart.cxx.
References PStatGraph::get_guide_bar(), PStatGraph::get_num_guide_bars(), and PStatGraph::get_ysize().
void GtkStatsStripChart::force_redraw | ( | ) | [virtual] |
Called when it is necessary to redraw the entire graph.
Reimplemented from GtkStatsGraph.
Definition at line 148 of file gtkStatsStripChart.cxx.
gboolean GtkStatsStripChart::handle_button_press | ( | GtkWidget * | widget, |
int | graph_x, | ||
int | graph_y, | ||
bool | double_click | ||
) | [protected, virtual] |
Called when the mouse button is depressed within the graph window.
Reimplemented from GtkStatsGraph.
Definition at line 461 of file gtkStatsStripChart.cxx.
References clicked_label(), PStatStripChart::get_collector_under_pixel(), PStatStripChart::pixel_to_height(), and set_drag_mode().
gboolean GtkStatsStripChart::handle_button_release | ( | GtkWidget * | widget, |
int | graph_x, | ||
int | graph_y | ||
) | [protected, virtual] |
Called when the mouse button is released within the graph window.
Reimplemented from GtkStatsGraph.
Definition at line 494 of file gtkStatsStripChart.cxx.
References PStatGraph::get_ysize(), handle_motion(), PStatGraph::move_user_guide_bar(), PStatStripChart::pixel_to_height(), PStatGraph::remove_user_guide_bar(), and set_drag_mode().
gboolean GtkStatsStripChart::handle_motion | ( | GtkWidget * | widget, |
int | graph_x, | ||
int | graph_y | ||
) | [protected, virtual] |
Called when the mouse is moved within the graph window.
Reimplemented from GtkStatsGraph.
Definition at line 521 of file gtkStatsStripChart.cxx.
References PStatGraph::add_user_guide_bar(), PStatStripChart::get_collector_under_pixel(), PStatGraph::get_ysize(), GtkStatsLabelStack::highlight_label(), PStatGraph::move_user_guide_bar(), PStatStripChart::pixel_to_height(), set_drag_mode(), and set_vertical_scale().
Referenced by handle_button_release().
void GtkStatsStripChart::new_collector | ( | int | collector_index | ) | [virtual] |
Called whenever a new Collector definition is received from the client.
Reimplemented from GtkStatsGraph.
Definition at line 109 of file gtkStatsStripChart.cxx.
void GtkStatsStripChart::new_data | ( | int | thread_index, |
int | frame_number | ||
) | [virtual] |
Called as each frame's data is made available.
There is no gurantee the frames will arrive in order, or that all of them will arrive at all. The monitor should be prepared to accept frames received out-of-order or missing.
Reimplemented from GtkStatsGraph.
Definition at line 123 of file gtkStatsStripChart.cxx.
References PStatGraph::format_number(), PStatStripChart::get_average_net_value(), PStatGraph::get_guide_bar_unit_name(), PStatGraph::get_guide_bar_units(), PStatStripChart::get_title_text(), PStatStripChart::is_title_unknown(), and PStatStripChart::update().
void GtkStatsStripChart::set_drag_mode | ( | GtkStatsGraph::DragMode | drag_mode | ) | [protected, virtual] |
This should be called whenever the drag mode needs to change state.
It provides hooks for a derived class to do something special.
Reimplemented from GtkStatsGraph.
Definition at line 434 of file gtkStatsStripChart.cxx.
References PStatStripChart::set_average_mode().
Referenced by handle_button_press(), handle_button_release(), and handle_motion().
void GtkStatsStripChart::set_scroll_speed | ( | double | scroll_speed | ) | [virtual] |
Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust the speed for the graph to the indicated value.
Reimplemented from GtkStatsGraph.
Definition at line 191 of file gtkStatsStripChart.cxx.
References PStatStripChart::set_horizontal_scale().
Referenced by GtkStatsMonitor::open_strip_chart().
void GtkStatsStripChart::set_time_units | ( | int | unit_mask | ) | [virtual] |
Called when the user selects a new time units from the monitor pulldown menu, this should adjust the units for the graph to the indicated mask if it is a time-based graph.
Reimplemented from GtkStatsGraph.
Definition at line 172 of file gtkStatsStripChart.cxx.
References PStatGraph::get_guide_bar_units(), and PStatGraph::set_guide_bar_units().
Referenced by GtkStatsMonitor::open_strip_chart().
void GtkStatsStripChart::set_vertical_scale | ( | double | value_height | ) |
Changes the value the height of the vertical axis represents.
This may force a redraw.
Reimplemented from PStatStripChart.
Definition at line 238 of file gtkStatsStripChart.cxx.
Referenced by handle_motion().
void GtkStatsStripChart::update_labels | ( | ) | [protected, virtual] |
Resets the list of labels.
Reimplemented from PStatStripChart.
Definition at line 251 of file gtkStatsStripChart.cxx.
References GtkStatsLabelStack::add_label(), GtkStatsLabelStack::clear_labels(), PStatGraph::get_label_collector(), and PStatGraph::get_num_labels().