Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef _MYAREA_HH
00038 #define _MYAREA_HH
00039 #include "misc.h"
00040 #include <gtkmm/drawingarea.h>
00041
00042
00043
00044 #define DATA_SIZE 100
00045
00046 struct Dot{
00047 int node;
00048 int col;
00049 int x_draw;
00050 int y_draw;
00051 };
00052
00053
00054
00055 struct Frame{
00056 unsigned long long time,diff;
00057 int x_draw;
00058 int y1_draw;
00059 int y2_draw;
00060 int src;
00061 int dest;
00062 int col;
00063 int mouseover;
00064 int nt;
00065 int pos_in_file;
00066 unsigned long serial;
00067 std::vector<Dot> dot;
00068 bool mark;
00069 bool cross;
00070 bool left_cross;
00071 };
00072
00073
00074 class MyArea : public Gtk::DrawingArea {
00075 private:
00076 pthread_mutex_t sem;
00077 int num_nodes, selected;
00078 double x_max,y_max,y_min,x_min;
00079 std::vector<Frame> frameVec;
00080 std::vector<bool> activeVec;
00081 Gdk::Color cols[32];
00082 Glib::RefPtr<Gdk::Window> window;
00083 Glib::RefPtr<Gdk::GC> gc;
00084 int y0,x0;
00085 int step;
00086 unsigned int max,min;
00087 int bytime;
00088 int max_size;
00089 int mouse_on;
00090 void draw_frame(int i);
00091 public:
00092 MyArea();
00093 void paint();
00094 void set_max_size(int _max_size);
00095 void clean_info();
00096 void clean_window();
00097 void beginInsert();
00098 int insertOne(int from, int to, long time ,int pos_in_file,int col, int nt);
00099 int insertOne(int from, int to, unsigned long long time ,int pos_in_file,unsigned long serial,int col, int nt);
00100 void endInsert();
00101 void setNumOfNodes(int n);
00102 void compute_environment();
00103 int get_y_pos(int node_id);
00104 void insert(int from, int to, long time ,int col);
00105 int get_selected();
00106 int get_offset_of_selected();
00107 int get_older_offset();
00108 void delete_older();
00109 int get_selected(int & from, int& to, int &col);
00110 int set_selected(int n);
00111 long get_selected_time();
00112 long get_mouse_on_time();
00113 int get_mouse_on_serial();
00114 int get_selected_serial();
00115 void addDot(int frame, int node, int color);
00116 void addMark(int frame);
00117 void addCross(int frame);
00118 void addLeftCross(int frame);
00119 void resetActive();
00120 void setActive(int i);
00121 protected:
00122
00123 bool timer_callback();
00124 virtual void on_realize();
00125 bool on_MyArea_motion_notify_event(GdkEventMotion* event);
00126 virtual bool on_expose_event(GdkEventExpose* e);
00127 virtual bool on_MyArea_button_press_event(GdkEventButton *ev);
00128 virtual bool on_MyArea_button_release_event(GdkEventButton *ev);
00129 };
00130
00131 #endif