add pause option
This commit is contained in:
parent
eb951840cc
commit
b0c4f029dc
|
|
@ -58,6 +58,8 @@ WinStatsGraph(WinStatsMonitor *monitor, int thread_index) :
|
|||
_drag_mode = DM_none;
|
||||
_potential_drag_mode = DM_none;
|
||||
_drag_scale_start = 0.0f;
|
||||
|
||||
_pause = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -163,6 +165,18 @@ void WinStatsGraph::
|
|||
set_scroll_speed(float scroll_speed) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: WinStatsGraph::set_pause
|
||||
// Access: Public
|
||||
// Description: Changes the pause flag for the graph. When this flag
|
||||
// is true, the graph does not update in response to new
|
||||
// data.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WinStatsGraph::
|
||||
set_pause(bool pause) {
|
||||
_pause = pause;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: WinStatsGraph::user_guide_bars_changed
|
||||
// Access: Public
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ public:
|
|||
|
||||
virtual void set_time_units(int unit_mask);
|
||||
virtual void set_scroll_speed(float scroll_speed);
|
||||
void set_pause(bool pause);
|
||||
|
||||
void user_guide_bars_changed();
|
||||
virtual void clicked_label(int collector_index);
|
||||
|
||||
|
|
@ -112,6 +114,8 @@ protected:
|
|||
float _drag_scale_start;
|
||||
int _drag_guide_bar;
|
||||
|
||||
bool _pause;
|
||||
|
||||
private:
|
||||
void setup_bitmap(int xsize, int ysize);
|
||||
void release_bitmap();
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ enum WinStatsMenuId {
|
|||
MI_speed_3,
|
||||
MI_speed_6,
|
||||
MI_speed_12,
|
||||
MI_pause,
|
||||
|
||||
// This one is last and represents the beginning of the range for
|
||||
// the various "new chart" menu options.
|
||||
|
|
|
|||
|
|
@ -40,9 +40,10 @@ WinStatsMonitor(WinStatsServer *server) : PStatMonitor(server) {
|
|||
_menu_bar = 0;
|
||||
_options_menu = 0;
|
||||
|
||||
// This is filled in later when the menu is created.
|
||||
// These will be filled in later when the menu is created.
|
||||
_time_units = 0;
|
||||
_scroll_speed = 0.0;
|
||||
_pause = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -295,6 +296,7 @@ open_strip_chart(int thread_index, int collector_index) {
|
|||
|
||||
graph->set_time_units(_time_units);
|
||||
graph->set_scroll_speed(_scroll_speed);
|
||||
graph->set_pause(_pause);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -309,6 +311,7 @@ open_piano_roll(int thread_index) {
|
|||
|
||||
graph->set_time_units(_time_units);
|
||||
graph->set_scroll_speed(_scroll_speed);
|
||||
graph->set_pause(_pause);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -430,6 +433,33 @@ set_scroll_speed(float scroll_speed) {
|
|||
SetMenuItemInfo(_speed_menu, MI_speed_12, FALSE, &mii);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: WinStatsMonitor::set_pause
|
||||
// Access: Public
|
||||
// Description: Called when the user selects a pause on or pause off
|
||||
// option from the menu.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WinStatsMonitor::
|
||||
set_pause(bool pause) {
|
||||
_pause = pause;
|
||||
|
||||
// First, change all of the open graphs appropriately.
|
||||
Graphs::iterator gi;
|
||||
for (gi = _graphs.begin(); gi != _graphs.end(); ++gi) {
|
||||
WinStatsGraph *graph = (*gi);
|
||||
graph->set_pause(_pause);
|
||||
}
|
||||
|
||||
// Now change the checkmark on the pulldown menu.
|
||||
MENUITEMINFO mii;
|
||||
memset(&mii, 0, sizeof(mii));
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_STATE;
|
||||
|
||||
mii.fState = _pause ? MFS_CHECKED : MFS_UNCHECKED;
|
||||
SetMenuItemInfo(_speed_menu, MI_pause, FALSE, &mii);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: WinStatsMonitor::add_graph
|
||||
// Access: Private
|
||||
|
|
@ -587,7 +617,18 @@ setup_speed_menu() {
|
|||
mii.dwTypeData = "12";
|
||||
InsertMenuItem(_speed_menu, GetMenuItemCount(_speed_menu), TRUE, &mii);
|
||||
|
||||
mii.fMask = MIIM_FTYPE;
|
||||
mii.fType = MFT_SEPARATOR;
|
||||
InsertMenuItem(_speed_menu, GetMenuItemCount(_speed_menu), TRUE, &mii);
|
||||
|
||||
mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_CHECKMARKS | MIIM_STATE;
|
||||
mii.fType = MFT_STRING;
|
||||
mii.wID = MI_pause;
|
||||
mii.dwTypeData = "pause";
|
||||
InsertMenuItem(_speed_menu, GetMenuItemCount(_speed_menu), TRUE, &mii);
|
||||
|
||||
set_scroll_speed(3);
|
||||
set_pause(false);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -727,6 +768,10 @@ handle_menu_command(int menu_id) {
|
|||
set_scroll_speed(12);
|
||||
break;
|
||||
|
||||
case MI_pause:
|
||||
set_pause(!_pause);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (menu_id >= MI_new_chart) {
|
||||
const MenuDef &menu_def = lookup_menu(menu_id);
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public:
|
|||
|
||||
void set_time_units(int unit_mask);
|
||||
void set_scroll_speed(float scroll_speed);
|
||||
void set_pause(bool pause);
|
||||
|
||||
private:
|
||||
void add_graph(WinStatsGraph *graph);
|
||||
|
|
@ -109,6 +110,7 @@ private:
|
|||
string _window_title;
|
||||
int _time_units;
|
||||
float _scroll_speed;
|
||||
bool _pause;
|
||||
|
||||
static bool _window_class_registered;
|
||||
static const char * const _window_class_name;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ WinStatsPianoRoll::
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void WinStatsPianoRoll::
|
||||
new_data(int thread_index, int frame_number) {
|
||||
update();
|
||||
if (!_pause) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -91,7 +91,9 @@ new_collector(int collector_index) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void WinStatsStripChart::
|
||||
new_data(int thread_index, int frame_number) {
|
||||
update();
|
||||
if (!_pause) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in New Issue