Panda3D
|
00001 // Filename: gtkStatsPianoRoll.h 00002 // Created by: drose (16Jan06) 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 GTKSTATSPIANOROLL_H 00016 #define GTKSTATSPIANOROLL_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "gtkStatsGraph.h" 00021 #include "pStatPianoRoll.h" 00022 #include "pointerTo.h" 00023 00024 #include <gtk/gtk.h> 00025 00026 class GtkStatsMonitor; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : GtkStatsPianoRoll 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 GtkStatsPianoRoll : public PStatPianoRoll, public GtkStatsGraph { 00035 public: 00036 GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index); 00037 virtual ~GtkStatsPianoRoll(); 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 virtual void additional_graph_window_paint(); 00055 virtual DragMode consider_drag_start(int graph_x, int graph_y); 00056 00057 virtual gboolean handle_button_press(GtkWidget *widget, int graph_x, int graph_y, 00058 bool double_click); 00059 virtual gboolean handle_button_release(GtkWidget *widget, int graph_x, int graph_y); 00060 virtual gboolean handle_motion(GtkWidget *widget, int graph_x, int graph_y); 00061 00062 private: 00063 int get_collector_under_pixel(int xpoint, int ypoint); 00064 void update_labels(); 00065 void draw_guide_bar(GdkDrawable *surface, const PStatGraph::GuideBar &bar); 00066 void draw_guide_labels(); 00067 void draw_guide_label(const PStatGraph::GuideBar &bar); 00068 00069 static gboolean expose_event_callback(GtkWidget *widget, 00070 GdkEventExpose *event, gpointer data); 00071 }; 00072 00073 #endif 00074