enhancements and bugfixes
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 23 Jul 2004 23:30:06 +0000 (23:30 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 23 Jul 2004 23:30:06 +0000 (23:30 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@629 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/controlflow/cfv-private.h
ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c
ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c
ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h

index 19361699027d082722421a79d01ed81692ecc671..ee3f6e4e824093e3fdfac78ccf26bc93441dc802 100644 (file)
@@ -22,7 +22,7 @@
 
 struct _ControlFlowData {
 
-  GtkWidget *scrolled_window;
+  GtkWidget *top_widget;
   Tab *tab;
 
   GtkWidget *h_paned;
index 508eb23e865a8468fe0d4b0fea1440e3090c213a..75fec21edba5b57773705ba4a0af7cf5d9264c83 100644 (file)
@@ -33,6 +33,9 @@ static void control_flow_grab_focus(GtkWidget *widget, gpointer data){
   ControlFlowData * control_flow_data = (ControlFlowData *)data;
   Tab * tab = control_flow_data->tab;
   lttvwindow_report_focus(tab, guicontrolflow_get_widget(control_flow_data));
+  //g_assert(GTK_WIDGET_CAN_FOCUS(widget));
+  //gtk_widget_grab_focus(widget);
+  g_debug("FOCUS GRABBED");
 }
 
 
@@ -54,6 +57,14 @@ guicontrolflow(void)
 
   ControlFlowData* control_flow_data = g_new(ControlFlowData,1) ;
 
+  control_flow_data->v_adjust = 
+    GTK_ADJUSTMENT(gtk_adjustment_new(  0.0,  /* Value */
+              0.0,  /* Lower */
+              0.0,  /* Upper */
+              0.0,  /* Step inc. */
+              0.0,  /* Page inc. */
+              0.0));  /* page size */
+
   /* Create the drawing */
   control_flow_data->drawing = drawing_construct(control_flow_data);
   
@@ -71,33 +82,20 @@ guicontrolflow(void)
   process_list_widget = 
     processlist_get_widget(control_flow_data->process_list);
   
-  //control_flow_data->Inside_HBox_V = gtk_hbox_new(0, 0);
-  control_flow_data->h_paned = gtk_hpaned_new();
-    
-  gtk_paned_pack1(GTK_PANED(control_flow_data->h_paned), process_list_widget, FALSE, TRUE);
-  gtk_paned_pack2(GTK_PANED(control_flow_data->h_paned), drawing_widget, TRUE, TRUE);
+  gtk_tree_view_set_vadjustment(GTK_TREE_VIEW(process_list_widget),
+                                GTK_ADJUSTMENT(
+                                   control_flow_data->v_adjust));
 
-  control_flow_data->v_adjust = 
-    GTK_ADJUSTMENT(gtk_adjustment_new(  0.0,  /* Value */
-              0.0,  /* Lower */
-              0.0,  /* Upper */
-              0.0,  /* Step inc. */
-              0.0,  /* Page inc. */
-              0.0));  /* page size */
-  
-  control_flow_data->scrolled_window =
-      gtk_scrolled_window_new (NULL,
-      control_flow_data->v_adjust);
-  
-  gtk_scrolled_window_set_policy(
-    GTK_SCROLLED_WINDOW(control_flow_data->scrolled_window) ,
-    GTK_POLICY_NEVER,
-    GTK_POLICY_AUTOMATIC);
-
-  gtk_scrolled_window_add_with_viewport(
-    GTK_SCROLLED_WINDOW(control_flow_data->scrolled_window),
-    control_flow_data->h_paned);
   
+  //control_flow_data->Inside_HBox_V = gtk_hbox_new(0, 0);
+  control_flow_data->top_widget = control_flow_data->h_paned =
+                                                     gtk_hpaned_new();
+    
+  gtk_paned_pack1(GTK_PANED(control_flow_data->h_paned),
+                  process_list_widget, FALSE, TRUE);
+  gtk_paned_pack2(GTK_PANED(control_flow_data->h_paned),
+                  drawing_widget, TRUE, TRUE);
   /* Set the size of the drawing area */
   //drawing_Resize(drawing, h, w);
 
@@ -107,10 +105,9 @@ guicontrolflow(void)
   gtk_widget_show(drawing_widget);
   gtk_widget_show(process_list_widget);
   gtk_widget_show(control_flow_data->h_paned);
-  gtk_widget_show(control_flow_data->scrolled_window);
   
   g_object_set_data_full(
-      G_OBJECT(control_flow_data->scrolled_window),
+      G_OBJECT(control_flow_data->top_widget),
       "control_flow_data",
       control_flow_data,
       (GDestroyNotify)guicontrolflow_destructor);
@@ -129,10 +126,11 @@ guicontrolflow(void)
   //can be configured (and this must happend bedore sending
   //data)
 
-  g_signal_connect (G_OBJECT (process_list_widget), "grab-focus",
-        G_CALLBACK (control_flow_grab_focus),
-        control_flow_data);
-  
+  //g_signal_connect (G_OBJECT (process_list_widget), "grab-focus",
+  //g_signal_connect (G_OBJECT (control_flow_data->scrolled_window), 
+  //      "button-press-event",
+  //      G_CALLBACK (control_flow_grab_focus),
+  //      control_flow_data);
   
   return control_flow_data;
 
@@ -186,6 +184,8 @@ guicontrolflow_destructor(ControlFlowData *control_flow_data)
     
     lttvwindow_events_request_remove_all(control_flow_data->tab,
                                          control_flow_data);
+
+    lttvwindowtraces_background_notify_remove(control_flow_data);
   }
   g_control_flow_data_list = 
          g_slist_remove(g_control_flow_data_list,control_flow_data);
@@ -197,7 +197,7 @@ guicontrolflow_destructor(ControlFlowData *control_flow_data)
 
 GtkWidget *guicontrolflow_get_widget(ControlFlowData *control_flow_data)
 {
-  return control_flow_data->scrolled_window ;
+  return control_flow_data->top_widget ;
 }
 
 ProcessList *guicontrolflow_get_process_list
index 091bcb8a62cf39afbb646803c7519b0303aee6f8..2c5ab83bf39c3e3dbb420f165a36a0ddf9f840ee 100644 (file)
@@ -80,6 +80,13 @@ void drawing_data_request(Drawing_t *drawing,
   if(width < 0) return ;
   if(height < 0) return ;
 
+  if(drawing->gc == NULL) {
+    drawing->gc = gdk_gc_new(drawing->drawing_area->window);
+    gdk_gc_copy(drawing->gc, drawing->drawing_area->style->black_gc);
+  }
+
+
+  
   TimeWindow time_window =
               lttvwindow_get_time_window(drawing->control_flow_data->tab);
 
@@ -103,12 +110,12 @@ void drawing_data_request(Drawing_t *drawing,
 
   g_debug("x is : %i, x+width is : %i", x, x+width);
 
-  convert_pixels_to_time(drawing->drawing_area->allocation.width, x,
+  convert_pixels_to_time(drawing->width, x,
         time_window.start_time,
         window_end,
         &start);
 
-  convert_pixels_to_time(drawing->drawing_area->allocation.width, x+width,
+  convert_pixels_to_time(drawing->width, x+width,
         time_window.start_time,
         window_end,
         &time_end);
@@ -221,9 +228,17 @@ void drawing_data_request_end(EventsRequest *events_request, LttvTracesetState *
   //drawing->damage_end = drawing->width;
 
   /* ask for the buffer to be redrawn */
+
   gtk_widget_queue_draw_area ( drawing->drawing_area,
-                               x, 0,
-                               width, drawing->height);
+                               0, 0,
+                               drawing->width, drawing->height);
+
+  /* FIXME
+   * will need more precise pixel_to_time and time_to_pixel conversion
+   * functions to redraw only the needed area. */
+  //gtk_widget_queue_draw_area ( drawing->drawing_area,
+  //                             x, 0,
+  //                             width, drawing->height);
  
 }
 
@@ -261,22 +276,22 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
   
   if(widget->allocation.width != drawing->width) {
     g_debug("drawing configure event");
-    g_debug("New draw size : %i by %i",widget->allocation.width,
+    g_debug("New alloc draw size : %i by %i",widget->allocation.width,
                                     widget->allocation.height);
   
     
     if (drawing->pixmap)
       gdk_pixmap_unref(drawing->pixmap);
   
-    drawing->pixmap = gdk_pixmap_new(
-    widget->window,
-    widget->allocation.width + SAFETY,
-    widget->allocation.height + SAFETY,
+    drawing->width = widget->allocation.width;
+    //drawing->height = widget->allocation.height;
+
+    drawing->pixmap = gdk_pixmap_new(widget->window,
+                                     drawing->width + SAFETY,
+                                     drawing->height,
+                                     -1);
     //ProcessList_get_height
     // (GuiControlFlow_get_process_list(drawing->control_flow_data)),
-    -1);
-    drawing->width = widget->allocation.width;
-    drawing->height = widget->allocation.height;
     
 
     // Clear the image
@@ -284,8 +299,8 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
           widget->style->black_gc,
           TRUE,
           0, 0,
-          widget->allocation.width+SAFETY,
-          widget->allocation.height+SAFETY);
+          drawing->width+SAFETY,
+          drawing->height);
 
     //g_info("init data request");
 
@@ -298,8 +313,8 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
     //    widget->allocation.width,
     //    widget->allocation.height);
                           
-    drawing->width = widget->allocation.width;
-    drawing->height = widget->allocation.height;
+    //drawing->width = widget->allocation.width;
+    //drawing->height = widget->allocation.height;
   
     drawing->damage_begin = 0;
     drawing->damage_end = widget->allocation.width;
@@ -311,7 +326,7 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
                            drawing->damage_begin,
                            0,
                            drawing->damage_end - drawing->damage_begin,
-                           widget->allocation.height);
+                           drawing->height);
     }
   }
   return TRUE;
@@ -343,7 +358,7 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
         time_window.start_time,
         window_end,
         current_time,
-        widget->allocation.width,
+        drawing->width,
         &cursor_x);
 
  
@@ -373,11 +388,12 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
                       0,
                       dash_list,
                       2);
-    drawing_draw_line(NULL, widget->window,
-                  cursor_x, 0,
-                  cursor_x, drawing->height,
-                  drawing->dotted_gc);
   }
+
+  drawing_draw_line(NULL, widget->window,
+                cursor_x, 0,
+                cursor_x, drawing->height,
+                drawing->dotted_gc);
   return FALSE;
 }
 
@@ -385,7 +401,7 @@ static gboolean
 after_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
 {
   //g_assert(0);
-  g_critical("AFTER EXPOSE");
+  g_debug("AFTER EXPOSE");
 
   return FALSE;
 
@@ -417,7 +433,7 @@ button_press_event( GtkWidget *widget, GdkEventButton *event, gpointer user_data
     /* left mouse button click */
     g_debug("x click is : %f", event->x);
 
-    convert_pixels_to_time(widget->allocation.width, (guint)event->x,
+    convert_pixels_to_time(drawing->width, (guint)event->x,
         time_window.start_time,
         window_end,
         &time);
@@ -432,6 +448,19 @@ button_press_event( GtkWidget *widget, GdkEventButton *event, gpointer user_data
   return FALSE;
 }
 
+static gboolean
+scrollbar_size_request(GtkWidget *widget,
+                       GtkRequisition *requisition,
+                       gpointer user_data)
+{
+  Drawing_t *drawing = (Drawing_t*)user_data;
+
+  gtk_widget_set_size_request(drawing->padding, requisition->width, -1);
+  //gtk_widget_queue_resize(drawing->padding);
+  //gtk_widget_queue_resize(drawing->ruler);
+  gtk_container_check_resize(GTK_CONTAINER(drawing->ruler_hbox));
+  return 0;
+}
 
 
 
@@ -442,14 +471,53 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data)
   drawing->control_flow_data = control_flow_data;
 
   drawing->vbox = gtk_vbox_new(FALSE, 1);
+
+  
+  drawing->ruler_hbox = gtk_hbox_new(FALSE, 1);
   drawing->ruler = gtk_drawing_area_new ();
+  gtk_widget_add_events(drawing->ruler, GDK_BUTTON_PRESS_MASK);
   gtk_widget_set_size_request(drawing->ruler, -1, 27);
   
+  drawing->padding = gtk_drawing_area_new ();
+  gtk_widget_add_events(drawing->padding, GDK_BUTTON_PRESS_MASK);
+  //gtk_widget_set_size_request(drawing->padding, -1, 27);
+  gtk_box_pack_start(GTK_BOX(drawing->ruler_hbox), drawing->ruler, 
+                     TRUE, TRUE, 0);
+  gtk_box_pack_end(GTK_BOX(drawing->ruler_hbox), drawing->padding, 
+                     FALSE, FALSE, 0);
+  
+
+
   drawing->drawing_area = gtk_drawing_area_new ();
+  
+  drawing->gc = NULL;
+  
+  drawing->hbox = gtk_hbox_new(FALSE, 1);
+  drawing->viewport = gtk_viewport_new(NULL, control_flow_data->v_adjust);
+  drawing->scrollbar = gtk_vscrollbar_new(control_flow_data->v_adjust);
+  gtk_box_pack_start(GTK_BOX(drawing->hbox), drawing->viewport, 
+                     TRUE, TRUE, 0);
+  gtk_box_pack_end(GTK_BOX(drawing->hbox), drawing->scrollbar, 
+                     FALSE, FALSE, 0);
+  
+  //drawing->scrolled_window =
+  //    gtk_scrolled_window_new (NULL,
+  //    control_flow_data->v_adjust);
+  
+  //gtk_scrolled_window_set_policy(
+  //  GTK_SCROLLED_WINDOW(drawing->scrolled_window),
+  //  GTK_POLICY_NEVER,
+  //  GTK_POLICY_AUTOMATIC);
 
-  gtk_box_pack_start(GTK_BOX(drawing->vbox), drawing->ruler, 
+  gtk_container_add(GTK_CONTAINER(drawing->viewport),
+                    drawing->drawing_area);
+  //gtk_scrolled_window_add_with_viewport(
+  //  GTK_SCROLLED_WINDOW(drawing->scrolled_window),
+  //  drawing->drawing_area);
+
+  gtk_box_pack_start(GTK_BOX(drawing->vbox), drawing->ruler_hbox, 
                      FALSE, FALSE, 0);
-  gtk_box_pack_end(GTK_BOX(drawing->vbox), drawing->drawing_area,
+  gtk_box_pack_end(GTK_BOX(drawing->vbox), drawing->hbox,
                    TRUE, TRUE, 0);
   
   drawing->pango_layout =
@@ -457,8 +525,8 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data)
 
   drawing->dotted_gc = NULL;
 
-  drawing->height = 0;
-  drawing->width = 0;
+  drawing->height = 1;
+  drawing->width = 1;
   drawing->depth = 0;
   
   drawing->damage_begin = 0;
@@ -520,6 +588,13 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data)
         (gpointer)drawing);
 
 
+  g_signal_connect (G_OBJECT(drawing->scrollbar),
+        "size-request",
+        G_CALLBACK(scrollbar_size_request),
+        (gpointer)drawing);
+
+
+
   g_signal_connect (G_OBJECT(drawing->drawing_area),
         "expose_event",
         G_CALLBACK (expose_event),
@@ -536,8 +611,15 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data)
         (gpointer)drawing);
   
   gtk_widget_show(drawing->ruler);
+  gtk_widget_show(drawing->padding);
+  gtk_widget_show(drawing->ruler_hbox);
+
   gtk_widget_show(drawing->drawing_area);
-    
+  //gtk_widget_show(drawing->scrolled_window);
+  gtk_widget_show(drawing->viewport);
+  gtk_widget_show(drawing->scrollbar);
+  gtk_widget_show(drawing->hbox);
+
   
   return drawing;
 }
@@ -547,7 +629,9 @@ void drawing_destroy(Drawing_t *drawing)
   g_info("drawing_destroy %p", drawing);
   // Do not unref here, Drawing_t destroyed by it's widget.
   //g_object_unref( G_OBJECT(drawing->drawing_area));
-    
+  if(drawing->gc != NULL)
+    gdk_gc_unref(drawing->gc);
+  
   g_free(drawing->pango_layout);
   if(!drawing->dotted_gc) gdk_gc_unref(drawing->dotted_gc);
   g_free(drawing);
@@ -632,7 +716,7 @@ void drawing_insert_square(Drawing_t *drawing,
   /* Allocate a new pixmap with new height */
   GdkPixmap *pixmap = gdk_pixmap_new(drawing->drawing_area->window,
         drawing->width + SAFETY,
-        drawing->height + height + SAFETY,
+        drawing->height + height,
         -1);
   
   /* Copy the high region */
@@ -662,9 +746,7 @@ void drawing_insert_square(Drawing_t *drawing,
     drawing->pixmap,
     0, y,
     0, y + height,
-    drawing->width+SAFETY, drawing->height - y + SAFETY);
-
-
+    drawing->width+SAFETY, drawing->height - y);
 
 
   if (drawing->pixmap)
@@ -672,8 +754,14 @@ void drawing_insert_square(Drawing_t *drawing,
 
   drawing->pixmap = pixmap;
   
-  drawing->height+=height;
-
+  if(drawing->height==1) drawing->height = height;
+  else drawing->height += height;
+  
+  gtk_widget_set_size_request(drawing->drawing_area,
+                             -1,
+                             drawing->height);
+  gtk_widget_queue_resize_no_redraw(drawing->drawing_area);
+  
   /* ask for the buffer to be redrawn */
   gtk_widget_queue_draw_area ( drawing->drawing_area,
                                0, y,
@@ -693,7 +781,7 @@ void drawing_remove_square(Drawing_t *drawing,
   GdkPixmap *pixmap = gdk_pixmap_new(
       drawing->drawing_area->window,
       drawing->width + SAFETY,
-      drawing->height - height + SAFETY,
+      drawing->height - height,
       -1);
   
   /* Copy the high region */
@@ -712,7 +800,7 @@ void drawing_remove_square(Drawing_t *drawing,
     drawing->pixmap,
     0, y + height,
     0, y,
-    drawing->width, drawing->height - y - height + SAFETY);
+    drawing->width, drawing->height - y - height);
 
 
   if (drawing->pixmap)
@@ -722,6 +810,10 @@ void drawing_remove_square(Drawing_t *drawing,
   
   drawing->height-=height;
   
+  gtk_widget_set_size_request(drawing->drawing_area,
+                             -1,
+                             drawing->height);
+  gtk_widget_queue_resize_no_redraw(drawing->drawing_area);
   /* ask for the buffer to be redrawn */
   gtk_widget_queue_draw_area ( drawing->drawing_area,
                                0, y,
index a36fdf49944e7f7093b4242edec69877f9952ccb..37dfc8385c1befb0bff148a803c80718db14e59d 100644 (file)
@@ -60,7 +60,14 @@ typedef struct _Drawing_t Drawing_t;
 struct _Drawing_t {
   GtkWidget *vbox;
   GtkWidget *drawing_area;
+  //GtkWidget *scrolled_window;
+  GtkWidget *hbox;
+  GtkWidget *viewport;
+  GtkWidget *scrollbar;
+  
+  GtkWidget *ruler_hbox;
   GtkWidget *ruler;
+  GtkWidget *padding;
   GdkPixmap *pixmap;
   ControlFlowData *control_flow_data;
   
@@ -72,6 +79,7 @@ struct _Drawing_t {
   gint      damage_begin, damage_end;
   LttTime   last_start;
   GdkGC     *dotted_gc;
+  GdkGC     *gc;
 };
 
 Drawing_t *drawing_construct(ControlFlowData *control_flow_data);
@@ -120,5 +128,4 @@ void drawing_update_ruler(Drawing_t *drawing, TimeWindow *time_window);
 
 void drawing_data_request_end(EventsRequest *events_request, LttvTracesetState *tss);
 
-
 #endif // _DRAWING_H
index 5ac72454b9550fdae956fb0d8b2de897078d2274..98b13d278cdecfeaac0e1099a472162afa43a254 100644 (file)
@@ -270,7 +270,7 @@ int draw_event_hook(void *hook_data, void *call_data)
     g_debug("out : %s",g_quark_to_string(process_out->state->s));
     
     birth = process_out->creation_time;
-    gchar *name = strdup(g_quark_to_string(process_out->name));
+    const gchar *name = g_quark_to_string(process_out->name);
     HashedProcessData *hashed_process_data_out = NULL;
 
     if(processlist_get_process_pixels(process_list,
@@ -281,25 +281,24 @@ int draw_event_hook(void *hook_data, void *call_data)
             &height,
             &hashed_process_data_out) == 1)
     {
-    /* Process not present */
-    processlist_add(process_list,
-        pid_out,
-        &birth,
-        tfc->t_context->index,
-        name,
-        &pl_height,
-        &hashed_process_data_out);
-    processlist_get_process_pixels(process_list,
-            pid_out,
-            &birth,
-            tfc->t_context->index,
-            &y_out,
-            &height,
-            &hashed_process_data_out);
-    drawing_insert_square( control_flow_data->drawing, y_out, height);
+      /* Process not present */
+      processlist_add(process_list,
+          pid_out,
+          &birth,
+          tfc->t_context->index,
+          name,
+          &pl_height,
+          &hashed_process_data_out);
+      g_assert(processlist_get_process_pixels(process_list,
+              pid_out,
+              &birth,
+              tfc->t_context->index,
+              &y_out,
+              &height,
+              &hashed_process_data_out)==0);
+      drawing_insert_square( control_flow_data->drawing, y_out, height);
     }
-
-    g_free(name);
+    //g_free(name);
     
     /* Find process pid_in in the list... */
     process_in = lttv_state_find_process(tfs, pid_in);
@@ -307,7 +306,7 @@ int draw_event_hook(void *hook_data, void *call_data)
     g_debug("in : %s",g_quark_to_string(process_in->state->s));
 
     birth = process_in->creation_time;
-    name = strdup(g_quark_to_string(process_in->name));
+    name = g_quark_to_string(process_in->name);
     HashedProcessData *hashed_process_data_in = NULL;
 
     if(processlist_get_process_pixels(process_list,
@@ -318,7 +317,7 @@ int draw_event_hook(void *hook_data, void *call_data)
             &height,
             &hashed_process_data_in) == 1)
     {
-    /* Process not present */
+      /* Process not present */
       processlist_add(process_list,
         pid_in,
         &birth,
@@ -336,13 +335,13 @@ int draw_event_hook(void *hook_data, void *call_data)
 
       drawing_insert_square( control_flow_data->drawing, y_in, height);
     }
-    g_free(name);
+    //g_free(name);
 
 
     /* Find pixels corresponding to time of the event. If the time does
      * not fit in the window, show a warning, not supposed to happend. */
     guint x = 0;
-    guint width = control_flow_data->drawing->drawing_area->allocation.width;
+    guint width = control_flow_data->drawing->width;
 
     LttTime time = ltt_event_time(e);
 
@@ -357,7 +356,7 @@ int draw_event_hook(void *hook_data, void *call_data)
         width,
         &x);
     //assert(x <= width);
-    
+    //
     /* draw what represents the event for outgoing process. */
 
     DrawContext *draw_context_out = hashed_process_data_out->draw_context;
@@ -404,8 +403,9 @@ int draw_event_hook(void *hook_data, void *call_data)
 
     if(process_out->state->s == LTTV_STATE_RUN)
     {
-      draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
-      gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
+      //draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+      //gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
+      draw_context_out->gc = control_flow_data->drawing->gc;
 
       PropertiesBG prop_bg;
       prop_bg.color = g_new(GdkColor,1);
@@ -440,7 +440,7 @@ int draw_event_hook(void *hook_data, void *call_data)
       g_debug("calling from draw_event");
       draw_bg((void*)&prop_bg, (void*)draw_context_out);
       g_free(prop_bg.color);
-      gdk_gc_unref(draw_context_out->gc);
+      //gdk_gc_unref(draw_context_out->gc);
     }
 
     draw_context_out->gc = widget->style->black_gc;
@@ -517,8 +517,9 @@ int draw_event_hook(void *hook_data, void *call_data)
     draw_text((void*)&prop_text_out, (void*)draw_context_out);
     //gdk_gc_unref(draw_context_out->gc);
 
-    draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
-    gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
+    //draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+    //gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
+    draw_context_out->gc = control_flow_data->drawing->gc;
 
     PropertiesLine prop_line_out;
     prop_line_out.color = g_new(GdkColor,1);
@@ -574,7 +575,7 @@ int draw_event_hook(void *hook_data, void *call_data)
   
     draw_line((void*)&prop_line_out, (void*)draw_context_out);
     g_free(prop_line_out.color);
-    gdk_gc_unref(draw_context_out->gc);
+    //gdk_gc_unref(draw_context_out->gc);
     /* Note : finishing line will have to be added when trace read over. */
       
     /* Finally, update the drawing context of the pid_in. */
@@ -625,8 +626,9 @@ int draw_event_hook(void *hook_data, void *call_data)
 
     if(process_in->state->s == LTTV_STATE_RUN)
     {
-      draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
-      gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
+      //draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+      //gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
+      draw_context_in->gc = control_flow_data->drawing->gc;
 
       PropertiesBG prop_bg;
       prop_bg.color = g_new(GdkColor,1);
@@ -661,7 +663,7 @@ int draw_event_hook(void *hook_data, void *call_data)
 
       draw_bg((void*)&prop_bg, (void*)draw_context_in);
       g_free(prop_bg.color);
-      gdk_gc_unref(draw_context_in->gc);
+      //gdk_gc_unref(draw_context_in->gc);
     }
 
     draw_context_in->gc = widget->style->black_gc;
@@ -740,8 +742,9 @@ int draw_event_hook(void *hook_data, void *call_data)
     draw_text((void*)&prop_text_in, (void*)draw_context_in);
     //gdk_gc_unref(draw_context_in->gc);
    
-    draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
-    gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
+    //draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+    //gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
+    draw_context_in->gc = control_flow_data->drawing->gc;
 
     PropertiesLine prop_line_in;
     prop_line_in.color = g_new(GdkColor,1);
@@ -795,12 +798,12 @@ int draw_event_hook(void *hook_data, void *call_data)
   
     draw_line((void*)&prop_line_in, (void*)draw_context_in);
     g_free(prop_line_in.color);
-    gdk_gc_unref(draw_context_in->gc);
+    //gdk_gc_unref(draw_context_in->gc);
   }
 
   return 0;
 
-  /* Temp dump */
+  /* Text dump */
 #ifdef DONTSHOW
   GString *string = g_string_new("");;
   gboolean field_names = TRUE, state = TRUE;
@@ -890,22 +893,22 @@ int draw_after_hook(void *hook_data, void *call_data)
             &height,
             &hashed_process_data_out) == 1)
     {
-    /* Process not present */
-    processlist_add(process_list,
-        pid_out,
-        &birth,
-        tfc->t_context->index,
-        name,
-        &pl_height,
-        &hashed_process_data_out);
-    processlist_get_process_pixels(process_list,
-            pid_out,
-            &birth,
-            tfc->t_context->index,
-            &y_out,
-            &height,
-            &hashed_process_data_out);
-    drawing_insert_square( control_flow_data->drawing, y_out, height);
+      /* Process not present */
+      processlist_add(process_list,
+          pid_out,
+          &birth,
+          tfc->t_context->index,
+          name,
+          &pl_height,
+          &hashed_process_data_out);
+      processlist_get_process_pixels(process_list,
+              pid_out,
+              &birth,
+              tfc->t_context->index,
+              &y_out,
+              &height,
+              &hashed_process_data_out);
+      drawing_insert_square( control_flow_data->drawing, y_out, height);
     }
 
     g_free(name);
@@ -1336,7 +1339,7 @@ gint update_time_window_hook(void *hook_data, void *call_data)
       g_info("scrolling near right");
       /* Scroll right, keep right part of the screen */
       guint x = 0;
-      guint width = control_flow_data->drawing->drawing_area->allocation.width;
+      guint width = control_flow_data->drawing->width;
       convert_time_to_pixels(
           *os,
           old_end,
@@ -1366,9 +1369,9 @@ gint update_time_window_hook(void *hook_data, void *call_data)
           TRUE,
           drawing->damage_begin+SAFETY, 0,
           drawing->damage_end - drawing->damage_begin,  // do not overlap
-          control_flow_data->drawing->height+SAFETY);
+          control_flow_data->drawing->height);
 
-       gtk_widget_queue_draw_area (drawing->drawing_area,
+      gtk_widget_queue_draw_area (drawing->drawing_area,
                                 0,0,
                                 control_flow_data->drawing->width,
                                 control_flow_data->drawing->height);
@@ -1389,7 +1392,7 @@ gint update_time_window_hook(void *hook_data, void *call_data)
         g_info("scrolling near left");
         /* Scroll left, keep left part of the screen */
         guint x = 0;
-        guint width = control_flow_data->drawing->drawing_area->allocation.width;
+        guint width = control_flow_data->drawing->width;
         convert_time_to_pixels(
             *ns,
             new_end,
@@ -1406,13 +1409,11 @@ gint update_time_window_hook(void *hook_data, void *call_data)
             x, 0,
             -1, -1);
   
-        *old_time_window = *new_time_window;
-
         if(drawing->damage_begin == drawing->damage_end)
           drawing->damage_end = x;
         else
           drawing->damage_end = 
-            control_flow_data->drawing->drawing_area->allocation.width;
+            control_flow_data->drawing->width;
 
         drawing->damage_begin = 0;
         
@@ -1421,7 +1422,7 @@ gint update_time_window_hook(void *hook_data, void *call_data)
           TRUE,
           drawing->damage_begin, 0,
           drawing->damage_end - drawing->damage_begin,  // do not overlap
-          control_flow_data->drawing->height+SAFETY);
+          control_flow_data->drawing->height);
 
         gtk_widget_queue_draw_area (drawing->drawing_area,
                                 0,0,
@@ -1450,7 +1451,7 @@ gint update_time_window_hook(void *hook_data, void *call_data)
             TRUE,
             0, 0,
             control_flow_data->drawing->width+SAFETY, // do not overlap
-            control_flow_data->drawing->height+SAFETY);
+            control_flow_data->drawing->height);
 
           gtk_widget_queue_draw_area (drawing->drawing_area,
                                 0,0,
@@ -1478,7 +1479,7 @@ gint update_time_window_hook(void *hook_data, void *call_data)
           TRUE,
           0, 0,
           control_flow_data->drawing->width+SAFETY, // do not overlap
-          control_flow_data->drawing->height+SAFETY);
+          control_flow_data->drawing->height);
 
     gtk_widget_queue_draw_area (drawing->drawing_area,
                                 0,0,
@@ -1507,7 +1508,7 @@ gint traceset_notify(void *hook_data, void *call_data)
   GtkWidget *widget = drawing->drawing_area;
 
   drawing->damage_begin = 0;
-  drawing->damage_end = widget->allocation.width;
+  drawing->damage_end = drawing->width;
 
 
   // Clear the image
@@ -1515,8 +1516,8 @@ gint traceset_notify(void *hook_data, void *call_data)
         widget->style->black_gc,
         TRUE,
         0, 0,
-        widget->allocation.width+SAFETY,
-        widget->allocation.height+SAFETY);
+        drawing->width+SAFETY,
+        drawing->height);
 
 
   if(drawing->damage_begin < drawing->damage_end)
@@ -1526,7 +1527,7 @@ gint traceset_notify(void *hook_data, void *call_data)
                          drawing->damage_begin,
                          0,
                          drawing->damage_end-drawing->damage_begin,
-                         widget->allocation.height);
+                         drawing->height);
   }
 
   gtk_widget_queue_draw_area(drawing->drawing_area,
@@ -1546,7 +1547,7 @@ gint redraw_notify(void *hook_data, void *call_data)
   GtkWidget *widget = drawing->drawing_area;
 
   drawing->damage_begin = 0;
-  drawing->damage_end = widget->allocation.width;
+  drawing->damage_end = drawing->width;
 
 
   // Clear the image
@@ -1554,8 +1555,8 @@ gint redraw_notify(void *hook_data, void *call_data)
         widget->style->black_gc,
         TRUE,
         0, 0,
-        widget->allocation.width+SAFETY,
-        widget->allocation.height+SAFETY);
+        drawing->width+SAFETY,
+        drawing->height);
 
 
   if(drawing->damage_begin < drawing->damage_end)
@@ -1565,7 +1566,7 @@ gint redraw_notify(void *hook_data, void *call_data)
                          drawing->damage_begin,
                          0,
                          drawing->damage_end-drawing->damage_begin,
-                         widget->allocation.height);
+                         drawing->height);
   }
 
   gtk_widget_queue_draw_area(drawing->drawing_area,
@@ -1593,7 +1594,7 @@ gint continue_notify(void *hook_data, void *call_data)
                          drawing->damage_begin,
                          0,
                          drawing->damage_end-drawing->damage_begin,
-                         widget->allocation.height);
+                         drawing->height);
   }
 
   return FALSE;
@@ -1745,7 +1746,7 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
   /* Find pixels corresponding to current time . If the time does
    * not fit in the window, show a warning, not supposed to happend. */
   guint x = 0;
-  guint width = control_flow_data->drawing->drawing_area->allocation.width;
+  guint width = control_flow_data->drawing->width;
 
   TimeWindow time_window =
             lttvwindow_get_time_window(control_flow_data->tab);
@@ -1774,8 +1775,9 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
   draw_context->drawable = control_flow_data->drawing->pixmap;
   draw_context->pango_layout = control_flow_data->drawing->pango_layout;
   //draw_context->gc = widget->style->black_gc;
-  draw_context->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
-  gdk_gc_copy(draw_context->gc, widget->style->black_gc);
+  //draw_context->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
+  //gdk_gc_copy(draw_context->gc, widget->style->black_gc);
+  draw_context->gc = control_flow_data->drawing->gc;
  
   if(process != NULL && process->state->s == LTTV_STATE_RUN)
   {
@@ -1879,7 +1881,7 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
 
   draw_line((void*)&prop_line, (void*)draw_context);
   g_free(prop_line.color);
-  gdk_gc_unref(draw_context->gc);
+  //gdk_gc_unref(draw_context->gc);
 
   /* Reset draw_context of the process for next request */
 
index 7b5885b18c05ec1845d6fa2164632cc6fa3b68b9..6c450afe6b72cb41c9ed60e0c4ef151d0c32d36a 100644 (file)
@@ -238,7 +238,6 @@ ProcessList *processlist_construct(void)
   process_list->process_list_widget = 
     gtk_tree_view_new_with_model
     (GTK_TREE_MODEL (process_list->list_store));
-
   g_object_unref (G_OBJECT (process_list->list_store));
 
   gtk_tree_sortable_set_sort_func(
@@ -367,7 +366,7 @@ int processlist_add(  ProcessList *process_list,
       guint pid,
       LttTime *birth,
       guint trace_num,
-      gchar *name,
+      const gchar *name,
       guint *height,
       HashedProcessData **pm_hashed_process_data)
 {
@@ -481,12 +480,16 @@ int processlist_remove( ProcessList *process_list,
           process_list->process_hash,
           &Process_Info))
   {
+    GtkTreePath *tree_path;
+
+    tree_path = gtk_tree_row_reference_get_path(
+                    hashed_process_data->row_ref);
+
     gtk_tree_model_get_iter (
         GTK_TREE_MODEL(process_list->list_store),
-        &iter,
-        gtk_tree_row_reference_get_path(
-          (GtkTreeRowReference*)hashed_process_data->row_ref)
-        );
+        &iter, tree_path);
+    gtk_tree_path_free(tree_path);
 
     gtk_list_store_remove (process_list->list_store, &iter);
     
@@ -554,6 +557,8 @@ gint processlist_get_process_pixels(  ProcessList *process_list,
         GTK_TREE_VIEW(process_list->process_list_widget));
     *y = *height * path_indices[0];
     *pm_hashed_process_data = hashed_process_data;
+    gtk_tree_path_free(tree_path);
+    
     return 0; 
   } else {
     *pm_hashed_process_data = hashed_process_data;
@@ -579,6 +584,7 @@ gint processlist_get_pixels_from_data(  ProcessList *process_list,
   *height = get_cell_height(
       GTK_TREE_VIEW(process_list->process_list_widget));
   *y = *height * path_indices[0];
+  gtk_tree_path_free(tree_path);
 
   return 0; 
 
index 20d39b9b8637a2d5701801942ea11828e9dfec9e..112337892991a020d326c6580d8bd3c7b9a76f82 100644 (file)
@@ -76,7 +76,7 @@ GtkWidget *processlist_get_widget(ProcessList *process_list);
 
 // out : success (0) and height
 int processlist_add(ProcessList *process_list, guint pid, LttTime *birth,
-    guint trace_num, gchar *name, guint *height,
+    guint trace_num, const gchar *name, guint *height,
     HashedProcessData **hashed_process_data);
 // out : success (0) and height
 int processlist_remove(ProcessList *process_list, guint pid, LttTime *birth,
This page took 0.039253 seconds and 4 git commands to generate.