00001 // Filename: gtkStatsPianoRoll.h 00002 // Created by: drose (18Jul00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef GTKSTATSPIANOROLL_H 00020 #define GTKSTATSPIANOROLL_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include "gtkStatsMonitor.h" 00025 00026 #include <pStatPianoRoll.h> 00027 #include <pointerTo.h> 00028 00029 #include <gtk--.h> 00030 #include "pmap.h" 00031 00032 class PStatView; 00033 class GtkStatsGuide; 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Class : GtkStatsPianoRoll 00037 // Description : A special widget that draws a piano-roll style chart, 00038 // which shows the collectors explicitly stopping and 00039 // starting, one frame at a time. 00040 //////////////////////////////////////////////////////////////////// 00041 class GtkStatsPianoRoll : public Gtk::DrawingArea, public PStatPianoRoll { 00042 public: 00043 GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index, 00044 int xsize, int ysize); 00045 00046 void mark_dead(); 00047 00048 Gtk::Alignment *get_labels(); 00049 00050 Gdk_GC get_collector_gc(int collector_index); 00051 00052 private: 00053 virtual void begin_draw(); 00054 virtual void draw_bar(int row, int from_x, int to_x); 00055 virtual void end_draw(); 00056 virtual void idle(); 00057 00058 virtual gint configure_event_impl(GdkEventConfigure *event); 00059 virtual gint expose_event_impl(GdkEventExpose *event); 00060 00061 void pack_labels(); 00062 void setup_white_gc(); 00063 00064 private: 00065 // Backing pixmap for drawing area. 00066 Gdk_Pixmap _pixmap; 00067 00068 // Graphics contexts for fg/bg. We don't use the contexts defined 00069 // in the style, because that would probably interfere with the 00070 // visibility of the chart. 00071 Gdk_GC _white_gc; 00072 Gdk_GC _black_gc; 00073 Gdk_GC _dark_gc; 00074 Gdk_GC _light_gc; 00075 00076 // Table of graphics contexts for our various collectors. 00077 typedef pmap<int, Gdk_GC> GCs; 00078 GCs _gcs; 00079 00080 // Table of Y-positions for each of our rows, measured from the 00081 // bottom. 00082 vector_int _y_positions; 00083 00084 Gtk::Alignment *_label_align; 00085 Gtk::VBox *_label_box; 00086 bool _is_dead; 00087 }; 00088 00089 #include "gtkStatsPianoRoll.I" 00090 00091 #endif 00092