23 _thread_index(thread_index)
25 _menu = CreatePopupMenu();
33 ~WinStatsChartMenu() {
50 std::string thread_name;
51 if (_thread_index == 0) {
53 thread_name =
"Graphs";
59 memset(&mii, 0,
sizeof(mii));
60 mii.cbSize =
sizeof(mii);
62 mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_SUBMENU;
63 mii.fType = MFT_STRING;
65 mii.dwTypeData = (
char *)thread_name.c_str();
66 InsertMenuItem(menu_bar, before_menu_id, FALSE, &mii);
90 int num_items = GetMenuItemCount(_menu);
91 for (
int i = num_items - 1; i >= 0; i--) {
92 DeleteMenu(_menu, i, MF_BYPOSITION);
100 bool needs_separator =
true;
102 memset(&mii, 0,
sizeof(mii));
103 mii.cbSize =
sizeof(mii);
108 for (
int tc = 0; tc < num_toplevel_collectors; tc++) {
115 if (needs_separator) {
116 mii.fMask = MIIM_FTYPE;
117 mii.fType = MFT_SEPARATOR;
118 InsertMenuItem(_menu, GetMenuItemCount(_menu), TRUE, &mii);
120 needs_separator =
false;
129 mii.fMask = MIIM_FTYPE;
130 mii.fType = MFT_SEPARATOR;
131 InsertMenuItem(_menu, GetMenuItemCount(_menu), TRUE, &mii);
136 mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID;
137 mii.fType = MFT_STRING;
139 mii.dwTypeData =
"Piano Roll";
140 InsertMenuItem(_menu, GetMenuItemCount(_menu), TRUE, &mii);
147 void WinStatsChartMenu::
148 add_view(HMENU parent_menu,
const PStatViewLevel *view_level,
bool show_level) {
158 memset(&mii, 0,
sizeof(mii));
159 mii.cbSize =
sizeof(mii);
161 mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID;
162 mii.fType = MFT_STRING;
164 mii.dwTypeData = (
char *)collector_name.c_str();
165 InsertMenuItem(parent_menu, GetMenuItemCount(parent_menu), TRUE, &mii);
168 if (num_children > 1) {
171 HMENU submenu = CreatePopupMenu();
172 std::string submenu_name = collector_name +
" components";
174 mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_SUBMENU;
175 mii.fType = MFT_STRING;
176 mii.hSubMenu = submenu;
177 mii.dwTypeData = (
char *)submenu_name.c_str();
178 InsertMenuItem(parent_menu, GetMenuItemCount(parent_menu), TRUE, &mii);
183 for (
int c = num_children - 1; c >= 0; c--) {
184 add_view(submenu, view_level->
get_child(c), show_level);
const PStatViewLevel * get_top_level()
Returns a pointer to the level that corresponds to the Collector we've constrained to.
int get_toplevel_collector(int index) const
Returns the collector index of the nth toplevel collector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PStatView & get_level_view(int collector_index, int thread_index)
Returns a view on the level value (as opposed to elapsed time) for the given collector over the given...
const PStatViewLevel * get_child(int n) const
Returns the nth child of this Level/Collector.
The data associated with a particular client, but not with any one particular frame or thread: the li...
std::string get_collector_name(int index) const
Returns the name of the indicated collector.
This is a single level value, or band of color, within a View.
bool has_collector(int index) const
Returns true if the indicated collector has been defined by the client already, false otherwise.
A View boils down the frame data to a linear list of times spent in a number of different Collectors,...
PStatView & get_view(int thread_index)
Returns a view on the given thread index.
This class represents a connection to a PStatsClient and manages the data exchange with the client.
int get_collector() const
Returns the Collector index associated with this level.
int get_menu_id(const MenuDef &menu_def)
Returns the menu ID that is reserved for the indicated MenuDef properties.
int get_level_index() const
Returns an index number that can be used to determine when the set of known levels has changed.
const PStatClientData * get_client_data() const
Returns the client data associated with this monitor.
int get_num_children() const
Returns the number of children of this Level/Collector.
int get_num_toplevel_collectors() const
Returns the total number of collectors that are toplevel collectors.
std::string get_thread_name(int index) const
Returns the name of the indicated thread.
bool get_collector_has_level(int index, int thread_index) const
Returns whether the given collector has level data (and consequently, whether it should appear on the...