00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef WINSTATSGRAPH_H
00016 #define WINSTATSGRAPH_H
00017
00018 #include "pandatoolbase.h"
00019 #include "winStatsLabelStack.h"
00020 #include "pmap.h"
00021
00022 #include <windows.h>
00023
00024 class WinStatsMonitor;
00025
00026
00027
00028
00029
00030
00031
00032 class WinStatsGraph {
00033 public:
00034
00035 enum DragMode {
00036 DM_none,
00037 DM_scale,
00038 DM_left_margin,
00039 DM_right_margin,
00040 DM_guide_bar,
00041 DM_new_guide_bar,
00042 DM_sizing,
00043 };
00044
00045 public:
00046 WinStatsGraph(WinStatsMonitor *monitor);
00047 virtual ~WinStatsGraph();
00048
00049 virtual void new_collector(int collector_index);
00050 virtual void new_data(int thread_index, int frame_number);
00051 virtual void force_redraw();
00052 virtual void changed_graph_size(int graph_xsize, int graph_ysize);
00053
00054 virtual void set_time_units(int unit_mask);
00055 virtual void set_scroll_speed(double scroll_speed);
00056 void set_pause(bool pause);
00057
00058 void user_guide_bars_changed();
00059 virtual void clicked_label(int collector_index);
00060
00061 protected:
00062 void close();
00063
00064 void setup_label_stack();
00065 void move_label_stack();
00066
00067 HBRUSH get_collector_brush(int collector_index);
00068
00069 LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
00070 virtual LONG graph_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
00071
00072 virtual void additional_window_paint(HDC hdc);
00073 virtual void additional_graph_window_paint(HDC hdc);
00074 virtual DragMode consider_drag_start(int mouse_x, int mouse_y,
00075 int width, int height);
00076 virtual void set_drag_mode(DragMode drag_mode);
00077
00078 virtual void move_graph_window(int graph_left, int graph_top,
00079 int graph_xsize, int graph_ysize);
00080
00081 protected:
00082
00083 typedef pmap<int, HBRUSH> Brushes;
00084 Brushes _brushes;
00085
00086 WinStatsMonitor *_monitor;
00087 HWND _window;
00088 HWND _graph_window;
00089 WinStatsLabelStack _label_stack;
00090
00091 HCURSOR _sizewe_cursor;
00092 HCURSOR _hand_cursor;
00093
00094 HBITMAP _bitmap;
00095 HDC _bitmap_dc;
00096
00097 int _graph_left, _graph_top;
00098 int _bitmap_xsize, _bitmap_ysize;
00099 int _left_margin, _right_margin;
00100 int _top_margin, _bottom_margin;
00101
00102 COLORREF _dark_color;
00103 COLORREF _light_color;
00104 COLORREF _user_guide_bar_color;
00105 HPEN _dark_pen;
00106 HPEN _light_pen;
00107 HPEN _user_guide_bar_pen;
00108
00109 DragMode _drag_mode;
00110 DragMode _potential_drag_mode;
00111 int _drag_start_x, _drag_start_y;
00112 double _drag_scale_start;
00113 int _drag_guide_bar;
00114
00115 bool _pause;
00116
00117 private:
00118 void setup_bitmap(int xsize, int ysize);
00119 void release_bitmap();
00120 void create_graph_window();
00121 static void register_graph_window_class(HINSTANCE application);
00122
00123 static LONG WINAPI static_graph_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
00124
00125 static bool _graph_window_class_registered;
00126 static const char * const _graph_window_class_name;
00127
00128 protected:
00129 static DWORD graph_window_style;
00130 };
00131
00132 #endif
00133