test data sent from hook file, square insert implemented
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 29 Sep 2003 12:11:26 +0000 (12:11 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 29 Sep 2003 12:11:26 +0000 (12:11 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@277 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c
ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c
ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h
ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c
ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.h
ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c
ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.h

index d69617a4e2f325d0516875371f92908d25808b86..2233e33240f005b6e5a8d3115fd549a092365092 100644 (file)
@@ -147,6 +147,8 @@ GuiControlFlow(void)
                        
        g_slist_append(gControl_Flow_Data_List,Control_Flow_Data);
 
+       send_test_data(Control_Flow_Data->Process_List);
+       
        return Control_Flow_Data;
 
 }
index a7120b93b977714148ebd80bba2a237ea971be20..572f4510650575a4d33acf22809295d777100dc7 100644 (file)
@@ -322,3 +322,112 @@ void Drawing_Resize(Drawing_t *Drawing, guint h, guint w)
 }
 
 
+/* Insert a square corresponding to a new process in the list */
+/* Applies to whole Drawing->width */
+void Drawing_Insert_Square(Drawing_t *Drawing,
+                               guint y,
+                               guint height)
+{
+       GdkRectangle update_rect;
+
+       /* Allocate a new pixmap with new height */
+       GdkPixmap *Pixmap = gdk_pixmap_new(Drawing->Drawing_Area_V->window,
+                         Drawing->width,
+                         Drawing->height + height,
+                         -1);
+       
+       /* Copy the high region */
+       gdk_draw_drawable (Pixmap,
+               Drawing->Drawing_Area_V->style->black_gc,
+               Drawing->Pixmap,
+               0, 0,
+               0, 0,
+               Drawing->width, y);
+
+
+
+
+       /* add an empty square */
+       gdk_draw_rectangle (Pixmap,
+               Drawing->Drawing_Area_V->style->white_gc,
+               TRUE,
+               0, y,
+               Drawing->width, // do not overlap
+               height);
+
+
+
+       /* copy the bottom of the region */
+       gdk_draw_drawable (Pixmap,
+               Drawing->Drawing_Area_V->style->black_gc,
+               Drawing->Pixmap,
+               0, y,
+               0, y + height,
+               Drawing->width, Drawing->height - y);
+
+
+
+
+       if (Drawing->Pixmap)
+               gdk_pixmap_unref(Drawing->Pixmap);
+
+       Drawing->Pixmap = Pixmap;
+       
+       Drawing->height+=height;
+
+       /* Rectangle to update, from new Drawing dimensions */
+       update_rect.x = 0 ;
+       update_rect.y = y ;
+       update_rect.width = Drawing->width;
+       update_rect.height = Drawing->height - y ;
+       gtk_widget_draw( Drawing->Drawing_Area_V, &update_rect);
+}
+
+
+/* Remove a square corresponding to a removed process in the list */
+void Drawing_Remove_Square(Drawing_t *Drawing,
+                               guint y,
+                               guint height)
+{
+       GdkRectangle update_rect;
+       
+       /* Allocate a new pixmap with new height */
+       GdkPixmap *Pixmap = gdk_pixmap_new(
+                       Drawing->Drawing_Area_V->window,
+                       Drawing->width,
+                       Drawing->height - height,
+                       -1);
+       
+       /* Copy the high region */
+       gdk_draw_drawable (Pixmap,
+               Drawing->Drawing_Area_V->style->black_gc,
+               Drawing->Pixmap,
+               0, 0,
+               0, 0,
+               Drawing->width, y);
+
+
+
+       /* Copy up the bottom of the region */
+       gdk_draw_drawable (Pixmap,
+               Drawing->Drawing_Area_V->style->black_gc,
+               Drawing->Pixmap,
+               0, y + height,
+               0, y,
+               Drawing->width, Drawing->height - y - height);
+
+
+       if (Drawing->Pixmap)
+               gdk_pixmap_unref(Drawing->Pixmap);
+
+       Drawing->Pixmap = Pixmap;
+       
+       Drawing->height-=height;
+       
+       /* Rectangle to update, from new Drawing dimensions */
+       update_rect.x = 0 ;
+       update_rect.y = y ;
+       update_rect.width = Drawing->width;
+       update_rect.height = Drawing->height - y ;
+       gtk_widget_draw( Drawing->Drawing_Area_V, &update_rect);
+}
index 22d2224b82c91cf8741c858f14940e5d0a8a53f1..947f9bfdea5d112e9c8f7981df791aaae874a546 100644 (file)
  * Refresh the physical screen with the pixmap
  * A helper function is provided here to convert from time and process
  * identifier to pixels and the contrary (will be useful for mouse selection).
+ * Insert an empty square in the drawing, moving the bottom part.
+ *
+ * The pixmap used has the width of the physical window, but the height
+ * of the shown processes.
  */
 
 typedef struct _Drawing_t Drawing_t;
@@ -37,6 +41,16 @@ void Drawing_draw_line(      Drawing_t *Drawing,
 //             guint xdest, guint ydest,
 //             guint width, guint height);
 
+/* Insert a square corresponding to a new process in the list */
+void Drawing_Insert_Square(Drawing_t *Drawing,
+                               guint y,
+                               guint height);
+
+/* Remove a square corresponding to a removed process in the list */
+void Drawing_Remove_Square(Drawing_t *Drawing,
+                               guint y,
+                               guint height);
+
 
 //void Drawing_Resize(Drawing_t *Drawing, guint h, guint w);
 
index 781f772bceed0187dac58efe48c914e76c57bd0c..bc278874d8561e79752a8bd4a5dd8b232f2c6dbd 100644 (file)
 
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
+#include <glib.h>
+
 #include <lttv/hook.h>
 #include <lttv/common.h>
 
 #include "Event_Hooks.h"
 #include "CFV.h"
+#include "Process_List.h"
+
+void send_test_data(ProcessList *Process_List)
+{
+       guint height;
+       int i;
+       ProcessInfo Process_Info = {10000, 12000, 55600};
+       //ProcessInfo Process_Info = {156, 14000, 55500};
+       GtkTreeRowReference *got_RowRef;
+
+       LttTime birth;
+       birth.tv_sec = 12000;
+       birth.tv_nsec = 55500;
+
+       ProcessList_add(Process_List,
+                       1,
+                       &birth,
+                       &height);
+
+       g_critical("height : %u", height);
+       
+       birth.tv_sec = 14000;
+       birth.tv_nsec = 55500;
+
+       ProcessList_add(Process_List,
+                       156,
+                       &birth,
+                       &height);
+
+       g_critical("height : %u", height);
+
+       birth.tv_sec = 12000;
+       birth.tv_nsec = 55700;
+
+       ProcessList_add(Process_List,
+                       10,
+                       &birth,
+                       &height);
+
+       for(i=0; i<10; i++)
+       {
+               birth.tv_sec = i*12000;
+               birth.tv_nsec = i*55700;
+
+               ProcessList_add(Process_List,
+                               i,
+                               &birth,
+                               &height);
+
+       }
+       g_critical("height : %u", height);
+
+       birth.tv_sec = 12000;
+       birth.tv_nsec = 55600;
+
+       ProcessList_add(Process_List,
+                       10,
+                       &birth,
+                       &height);
+       g_critical("height : %u", height);
+
+       ProcessList_add(Process_List,
+                       10000,
+                       &birth,
+                       &height);
+       g_critical("height : %u", height);
+
+
+       ProcessList_remove(     Process_List,
+                               10000,
+                               &birth);
+       
+       if(got_RowRef = 
+               (GtkTreeRowReference*)g_hash_table_lookup(
+                                       Process_List->Process_Hash,
+                                       &Process_Info))
+       {
+               g_critical("key found");
+               g_critical("position in the list : %s",
+                       gtk_tree_path_to_string (
+                       gtk_tree_row_reference_get_path(
+                               (GtkTreeRowReference*)got_RowRef)
+                       ));
+               
+       }
+
+}
+
+
 
 /**
  * Event Viewer's constructor hook
index ef4308755cb5ed2b297db725b1f0d780a1cac6c4..329718d086066a6d47ff480ae9c32c75836d7d75 100644 (file)
@@ -9,6 +9,9 @@
 
 #include <gtk/gtk.h>
 #include <lttv/mainWindow.h>
+#include "Process_List.h"
+
+void send_test_data(ProcessList *Process_List);
 
 GtkWidget *hGuiControlFlow(mainWindow *pmParentWindow);
 
index 2e416d078352334274cd5d59a426b33746d9ef38..a9da1fda4afc36ff21cdf38ef1b28e0d0ac26c11 100644 (file)
@@ -8,27 +8,6 @@
  *                       Methods to synchronize process list                 *
  *****************************************************************************/
 
-typedef struct _ProcessInfo {
-       
-       guint pid;
-       LttTime birth;
-
-} ProcessInfo;
-
-
-struct _ProcessList {
-       
-       GtkWidget *Process_List_VC;
-       GtkListStore *Store_M;
-
-       /* A hash table by PID to speed up process position find in the list */
-       GHashTable *Process_Hash;
-       
-       guint Number_Of_Process;
-
-};
-
-
 /* Enumeration of the columns */
 enum
 {
@@ -153,93 +132,6 @@ gint process_sort_func     (       GtkTreeModel *model,
 
 }
 
-void send_test_data(ProcessList *Process_List)
-{
-       guint height;
-       int i;
-       ProcessInfo Process_Info = {10000, 12000, 55600};
-       //ProcessInfo Process_Info = {156, 14000, 55500};
-       GtkTreeRowReference *got_RowRef;
-
-       LttTime birth;
-       birth.tv_sec = 12000;
-       birth.tv_nsec = 55500;
-
-       ProcessList_add(Process_List,
-                       1,
-                       &birth,
-                       &height);
-
-       g_critical("height : %u", height);
-       
-       birth.tv_sec = 14000;
-       birth.tv_nsec = 55500;
-
-       ProcessList_add(Process_List,
-                       156,
-                       &birth,
-                       &height);
-
-       g_critical("height : %u", height);
-
-       birth.tv_sec = 12000;
-       birth.tv_nsec = 55700;
-
-       ProcessList_add(Process_List,
-                       10,
-                       &birth,
-                       &height);
-
-       for(i=0; i<10; i++)
-       {
-               birth.tv_sec = i*12000;
-               birth.tv_nsec = i*55700;
-
-               ProcessList_add(Process_List,
-                               i,
-                               &birth,
-                               &height);
-
-       }
-       g_critical("height : %u", height);
-
-       birth.tv_sec = 12000;
-       birth.tv_nsec = 55600;
-
-       ProcessList_add(Process_List,
-                       10,
-                       &birth,
-                       &height);
-       g_critical("height : %u", height);
-
-       ProcessList_add(Process_List,
-                       10000,
-                       &birth,
-                       &height);
-       g_critical("height : %u", height);
-
-
-       ProcessList_remove(     Process_List,
-                               10000,
-                               &birth);
-       
-       if(got_RowRef = 
-               (GtkTreeRowReference*)g_hash_table_lookup(
-                                       Process_List->Process_Hash,
-                                       &Process_Info))
-       {
-               g_critical("key found");
-               g_critical("position in the list : %s",
-                       gtk_tree_path_to_string (
-                       gtk_tree_row_reference_get_path(
-                               (GtkTreeRowReference*)got_RowRef)
-                       ));
-               
-       }
-
-}
-
-
 guint hash_fct(gconstpointer key)
 {
        return ((ProcessInfo*)key)->pid;
@@ -361,8 +253,6 @@ ProcessList *ProcessList_construct(void)
                        Process_List,
                        (GDestroyNotify)ProcessList_destroy);
                        
-       send_test_data(Process_List);
-
        return Process_List;
 }
 void ProcessList_destroy(ProcessList *Process_List)
index ef38a9a2b7abffdd746c2bd562c05cfcb5fc0631..1daabdd65593f20daa4e3942730180a52cac95d5 100644 (file)
  *     note : the sync with drawing is left to the caller.
  * provides helper function to convert a process unique identifier to
  *     pixels (in height).
+ *
+ * //FIXME : connect the scrolled window adjustment with the list.
  */
 
+typedef struct _ProcessInfo {
+       
+       guint pid;
+       LttTime birth;
+
+} ProcessInfo;
+
+
+
+struct _ProcessList {
+       
+       GtkWidget *Process_List_VC;
+       GtkListStore *Store_M;
+
+       /* A hash table by PID to speed up process position find in the list */
+       GHashTable *Process_Hash;
+       
+       guint Number_Of_Process;
+
+};
+
+
 typedef struct _ProcessList ProcessList;
 
 ProcessList *ProcessList_construct(void);
This page took 0.029915 seconds and 4 git commands to generate.