Panda3D

winStatsPianoRoll.h

00001 // Filename: winStatsPianoRoll.h
00002 // Created by:  drose (12Jan04)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef WINSTATSPIANOROLL_H
00016 #define WINSTATSPIANOROLL_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include "winStatsGraph.h"
00021 #include "pStatPianoRoll.h"
00022 #include "pointerTo.h"
00023 
00024 #include <windows.h>
00025 
00026 class WinStatsMonitor;
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //       Class : WinStatsPianoRoll
00030 // Description : A window that draws a piano-roll style chart,
00031 //               which shows the collectors explicitly stopping and
00032 //               starting, one frame at a time.
00033 ////////////////////////////////////////////////////////////////////
00034 class WinStatsPianoRoll : public PStatPianoRoll, public WinStatsGraph {
00035 public:
00036   WinStatsPianoRoll(WinStatsMonitor *monitor, int thread_index);
00037   virtual ~WinStatsPianoRoll();
00038 
00039   virtual void new_data(int thread_index, int frame_number);
00040   virtual void force_redraw();
00041   virtual void changed_graph_size(int graph_xsize, int graph_ysize);
00042 
00043   virtual void set_time_units(int unit_mask);
00044   virtual void clicked_label(int collector_index);
00045   void set_horizontal_scale(double time_width);
00046 
00047 protected:
00048   void clear_region();
00049   virtual void begin_draw();
00050   virtual void draw_bar(int row, int from_x, int to_x);
00051   virtual void end_draw();
00052   virtual void idle();
00053 
00054   LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
00055   virtual LONG graph_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
00056   virtual void additional_window_paint(HDC hdc);
00057   virtual void additional_graph_window_paint(HDC hdc);
00058   virtual DragMode consider_drag_start(int mouse_x, int mouse_y, 
00059                                        int width, int height);
00060 
00061 private:
00062   int get_collector_under_pixel(int xpoint, int ypoint);
00063   void update_labels();
00064   void draw_guide_bar(HDC hdc, const GuideBar &bar);
00065   void draw_guide_label(HDC hdc, int y, const PStatGraph::GuideBar &bar);
00066 
00067   void create_window();
00068   static void register_window_class(HINSTANCE application);
00069 
00070   static LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
00071 
00072   static bool _window_class_registered;
00073   static const char * const _window_class_name;
00074 };
00075 
00076 #endif
00077 
 All Classes Functions Variables Enumerations