mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
add labels
This commit is contained in:
parent
4493177036
commit
4793ed7b68
@ -509,7 +509,7 @@ public:
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: PStatStripChart::update_labels
|
// Function: PStatStripChart::update_labels
|
||||||
// Access: Protected
|
// Access: Protected, Virtual
|
||||||
// Description: Resets the list of labels.
|
// Description: Resets the list of labels.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void PStatStripChart::
|
void PStatStripChart::
|
||||||
|
@ -89,7 +89,7 @@ protected:
|
|||||||
void changed_size(int xsize, int ysize);
|
void changed_size(int xsize, int ysize);
|
||||||
void force_redraw();
|
void force_redraw();
|
||||||
void force_reset();
|
void force_reset();
|
||||||
void update_labels();
|
virtual void update_labels();
|
||||||
virtual void normal_guide_bars();
|
virtual void normal_guide_bars();
|
||||||
|
|
||||||
virtual void clear_region();
|
virtual void clear_region();
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
#define SOURCES \
|
#define SOURCES \
|
||||||
winStats.cxx \
|
winStats.cxx \
|
||||||
winStatsGraph.cxx winStatsGraph.h \
|
winStatsGraph.cxx winStatsGraph.h \
|
||||||
|
winStatsLabel.cxx winStatsLabel.h \
|
||||||
|
winStatsLabelStack.cxx winStatsLabelStack.h \
|
||||||
winStatsServer.cxx winStatsServer.h \
|
winStatsServer.cxx winStatsServer.h \
|
||||||
winStatsMonitor.cxx winStatsMonitor.h \
|
winStatsMonitor.cxx winStatsMonitor.h \
|
||||||
winStatsStripChart.cxx winStatsStripChart.h
|
winStatsStripChart.cxx winStatsStripChart.h
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "winStatsGraph.h"
|
#include "winStatsGraph.h"
|
||||||
#include "winStatsMonitor.h"
|
#include "winStatsMonitor.h"
|
||||||
|
#include "winStatsLabelStack.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: WinStatsGraph::Constructor
|
// Function: WinStatsGraph::Constructor
|
||||||
@ -33,7 +34,7 @@ WinStatsGraph(WinStatsMonitor *monitor) :
|
|||||||
_bitmap_dc = 0;
|
_bitmap_dc = 0;
|
||||||
_bitmap_xsize = 0;
|
_bitmap_xsize = 0;
|
||||||
_bitmap_ysize = 0;
|
_bitmap_ysize = 0;
|
||||||
_left_margin = 64;
|
_left_margin = 96;
|
||||||
_right_margin = 32;
|
_right_margin = 32;
|
||||||
_top_margin = 16;
|
_top_margin = 16;
|
||||||
_bottom_margin = 8;
|
_bottom_margin = 8;
|
||||||
@ -136,6 +137,34 @@ release_bitmap() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: WinStatsGraph::setup_label_stack
|
||||||
|
// Access: Protected
|
||||||
|
// Description: Sets up the label stack on the left edge of the
|
||||||
|
// frame.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void WinStatsGraph::
|
||||||
|
setup_label_stack() {
|
||||||
|
_label_stack.setup(_window, 8, 8, _left_margin - 16, _top_margin + _bitmap_ysize + _bottom_margin - 16);
|
||||||
|
/*
|
||||||
|
if (_label_stack()->get_ideal_width() > _label_stack->get_width()) {
|
||||||
|
_left_margin = _label_stack->get_ideal_width() + 16;
|
||||||
|
move_label_stack();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: WinStatsGraph::move_label_stack
|
||||||
|
// Access: Protected
|
||||||
|
// Description: Repositions the label stack if its coordinates or
|
||||||
|
// size have changed.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void WinStatsGraph::
|
||||||
|
move_label_stack() {
|
||||||
|
_label_stack.set_pos(8, 8, _left_margin - 16, _top_margin + _bitmap_ysize + _bottom_margin - 16);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: WinStatsGraph::get_collector_brush
|
// Function: WinStatsGraph::get_collector_brush
|
||||||
// Access: Protected
|
// Access: Protected
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#define WINSTATSGRAPH_H
|
#define WINSTATSGRAPH_H
|
||||||
|
|
||||||
#include "pandatoolbase.h"
|
#include "pandatoolbase.h"
|
||||||
|
#include "winStatsLabelStack.h"
|
||||||
#include "pmap.h"
|
#include "pmap.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -45,6 +46,8 @@ protected:
|
|||||||
|
|
||||||
void setup_bitmap(int xsize, int ysize);
|
void setup_bitmap(int xsize, int ysize);
|
||||||
void release_bitmap();
|
void release_bitmap();
|
||||||
|
void setup_label_stack();
|
||||||
|
void move_label_stack();
|
||||||
|
|
||||||
HBRUSH get_collector_brush(int collector_index);
|
HBRUSH get_collector_brush(int collector_index);
|
||||||
void draw_graph(HDC hdc);
|
void draw_graph(HDC hdc);
|
||||||
@ -56,6 +59,7 @@ protected:
|
|||||||
|
|
||||||
WinStatsMonitor *_monitor;
|
WinStatsMonitor *_monitor;
|
||||||
HWND _window;
|
HWND _window;
|
||||||
|
WinStatsLabelStack _label_stack;
|
||||||
|
|
||||||
HBITMAP _bitmap;
|
HBITMAP _bitmap;
|
||||||
HDC _bitmap_dc;
|
HDC _bitmap_dc;
|
||||||
|
@ -249,7 +249,8 @@ create_window() {
|
|||||||
register_window_class(application);
|
register_window_class(application);
|
||||||
|
|
||||||
_window_title = get_client_progname() + " on " + get_client_hostname();
|
_window_title = get_client_progname() + " on " + get_client_hostname();
|
||||||
DWORD window_style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
DWORD window_style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN |
|
||||||
|
WS_CLIPSIBLINGS | WS_VISIBLE;
|
||||||
|
|
||||||
_window =
|
_window =
|
||||||
CreateWindow(_window_class_name, _window_title.c_str(), window_style,
|
CreateWindow(_window_class_name, _window_title.c_str(), window_style,
|
||||||
|
@ -88,6 +88,22 @@ new_data(int thread_index, int frame_number) {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: WinStatsStripChart::update_labels
|
||||||
|
// Access: Protected, Virtual
|
||||||
|
// Description: Resets the list of labels.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void WinStatsStripChart::
|
||||||
|
update_labels() {
|
||||||
|
PStatStripChart::update_labels();
|
||||||
|
|
||||||
|
_label_stack.clear_labels();
|
||||||
|
for (int i = 0; i < get_num_labels(); i++) {
|
||||||
|
_label_stack.add_label(WinStatsGraph::_monitor, get_label_collector(i));
|
||||||
|
}
|
||||||
|
_labels_changed = false;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: WinStatsStripChart::clear_region
|
// Function: WinStatsStripChart::clear_region
|
||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
@ -218,7 +234,7 @@ create_window() {
|
|||||||
register_window_class(application);
|
register_window_class(application);
|
||||||
|
|
||||||
string window_title = get_title_text();
|
string window_title = get_title_text();
|
||||||
DWORD window_style = WS_CHILD | WS_OVERLAPPEDWINDOW;
|
DWORD window_style = WS_CHILD | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW | WS_VISIBLE;
|
||||||
|
|
||||||
RECT win_rect = {
|
RECT win_rect = {
|
||||||
0, 0,
|
0, 0,
|
||||||
@ -241,7 +257,7 @@ create_window() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetWindowLongPtr(_window, 0, (LONG_PTR)this);
|
SetWindowLongPtr(_window, 0, (LONG_PTR)this);
|
||||||
ShowWindow(_window, SW_SHOWNORMAL);
|
setup_label_stack();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -315,6 +331,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||||||
HIWORD(lparam) - (_top_margin + _bottom_margin));
|
HIWORD(lparam) - (_top_margin + _bottom_margin));
|
||||||
setup_bitmap(get_xsize(), get_ysize());
|
setup_bitmap(get_xsize(), get_ysize());
|
||||||
force_redraw();
|
force_redraw();
|
||||||
|
move_label_stack();
|
||||||
InvalidateRect(hwnd, NULL, FALSE);
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ public:
|
|||||||
virtual void new_data(int thread_index, int frame_number);
|
virtual void new_data(int thread_index, int frame_number);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void update_labels();
|
||||||
|
|
||||||
virtual void clear_region();
|
virtual void clear_region();
|
||||||
virtual void copy_region(int start_x, int end_x, int dest_x);
|
virtual void copy_region(int start_x, int end_x, int dest_x);
|
||||||
virtual void draw_slice(int x, int frame_number);
|
virtual void draw_slice(int x, int frame_number);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user