Panda3D
gtkStatsPianoRoll.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file gtkStatsPianoRoll.h
10  * @author drose
11  * @date 2006-01-16
12  */
13 
14 #ifndef GTKSTATSPIANOROLL_H
15 #define GTKSTATSPIANOROLL_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "gtkStatsGraph.h"
20 #include "pStatPianoRoll.h"
21 #include "pointerTo.h"
22 
23 #include <gtk/gtk.h>
24 
25 class GtkStatsMonitor;
26 
27 /**
28  * A window that draws a piano-roll style chart, which shows the collectors
29  * explicitly stopping and starting, one frame at a time.
30  */
32 public:
33  GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index);
34  virtual ~GtkStatsPianoRoll();
35 
36  virtual void new_data(int thread_index, int frame_number);
37  virtual void force_redraw();
38  virtual void changed_graph_size(int graph_xsize, int graph_ysize);
39 
40  virtual void set_time_units(int unit_mask);
41  virtual void clicked_label(int collector_index);
42  void set_horizontal_scale(double time_width);
43 
44 protected:
45  void clear_region();
46  virtual void begin_draw();
47  virtual void draw_bar(int row, int from_x, int to_x);
48  virtual void end_draw();
49  virtual void idle();
50 
51  virtual void additional_graph_window_paint();
52  virtual DragMode consider_drag_start(int graph_x, int graph_y);
53 
54  virtual gboolean handle_button_press(GtkWidget *widget, int graph_x, int graph_y,
55  bool double_click);
56  virtual gboolean handle_button_release(GtkWidget *widget, int graph_x, int graph_y);
57  virtual gboolean handle_motion(GtkWidget *widget, int graph_x, int graph_y);
58 
59 private:
60  int get_collector_under_pixel(int xpoint, int ypoint);
61  void update_labels();
62  void draw_guide_bar(GdkDrawable *surface, const PStatGraph::GuideBar &bar);
63  void draw_guide_labels();
64  void draw_guide_label(const PStatGraph::GuideBar &bar);
65 
66  static gboolean expose_event_callback(GtkWidget *widget,
67  GdkEventExpose *event, gpointer data);
68 };
69 
70 #endif
virtual void set_time_units(int unit_mask)
Called when the user selects a new time units from the monitor pulldown menu, this should adjust the ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract class that presents the interface for drawing a piano- roll type chart: it shows ...
A window that draws a piano-roll style chart, which shows the collectors explicitly stopping and star...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_horizontal_scale(double time_width)
Changes the amount of time the width of the horizontal axis represents.
virtual void new_data(int thread_index, int frame_number)
Called as each frame's data is made available.
virtual void force_redraw()
Called when it is necessary to redraw the entire graph.
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: gtkStatsGraph.h:29
This class represents a connection to a PStatsClient and manages the data exchange with the client.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void clicked_label(int collector_index)
Called when the user single-clicks on a label.
virtual void changed_graph_size(int graph_xsize, int graph_ysize)
Called when the user has resized the window, forcing a resize of the graph.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.