draw icon working
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 4 Jan 2004 19:03:18 +0000 (19:03 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 4 Jan 2004 19:03:18 +0000 (19:03 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@350 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/guiControlFlow/CFV-private.h
ltt/branches/poly/lttv/modules/guiControlFlow/CFV.c
ltt/branches/poly/lttv/modules/guiControlFlow/CFV.h
ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.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/module.c

index 822b194b144203f0487b3e3585fdb00da602f9bb..04fe2f56d114309d1ce1ea4fe02a334a1a03bd29 100644 (file)
@@ -6,7 +6,8 @@
 struct _ControlFlowData {
 
        GtkWidget *Scrolled_Window_VC;
-       
+       MainWindow *Parent_Window;
+
        ProcessList *Process_List;
        Drawing_t *Drawing;
 
index 253b17bc4b4e5a0ec154cf293b29e2fde94b7807..fa8b6a3fe77b25301d393a98a2f8f33a9236445c 100644 (file)
@@ -10,6 +10,9 @@
 #include "CFV-private.h"
 
 
+#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
+#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
+
 extern GSList *gControl_Flow_Data_List;
 
 /*****************************************************************************
@@ -132,28 +135,35 @@ guicontrolflow(void)
 void
 guicontrolflow_destructor_full(ControlFlowData *Control_Flow_Data)
 {
+       g_info("CFV.c : guicontrolflow_destructor_full, %p", Control_Flow_Data);
        /* May already have been done by GTK window closing */
        if(GTK_IS_WIDGET(Control_Flow_Data->Scrolled_Window_VC))
                gtk_widget_destroy(Control_Flow_Data->Scrolled_Window_VC);
-
-       guicontrolflow_destructor(Control_Flow_Data);
+       //Control_Flow_Data->Parent_Window = NULL;
+       //FIXME guicontrolflow_destructor(Control_Flow_Data);
 }
 
+/* When this destructor is called, the widgets are already disconnected */
 void
 guicontrolflow_destructor(ControlFlowData *Control_Flow_Data)
 {
        guint index;
        
+       g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
+       g_info("%p, %p, %p", update_time_window_hook, Control_Flow_Data, Control_Flow_Data->Parent_Window);
        /* Process List is removed with it's widget */
        //ProcessList_destroy(Control_Flow_Data->Process_List);
-       unreg_update_time_window(update_time_window_hook,
+       if(Control_Flow_Data->Parent_Window != NULL)
+       {
+               unreg_update_time_window(update_time_window_hook,
                                Control_Flow_Data,
-                               Control_Flow_Data->Scrolled_Window_VC->parent);
+                               Control_Flow_Data->Parent_Window);
        
-       unreg_update_current_time(update_current_time_hook,
+               unreg_update_current_time(update_current_time_hook,
                                Control_Flow_Data,
-                               Control_Flow_Data->Scrolled_Window_VC->parent);
-       
+                               Control_Flow_Data->Parent_Window);
+       }
+       g_info("CFV.c : guicontrolflow_destructor, %p", Control_Flow_Data);
        g_slist_remove(gControl_Flow_Data_List,Control_Flow_Data);
        g_free(Control_Flow_Data);
 }
index b77b632c9a6fb37bb7d4a4cd5fee6d23a130b30a..fa59641322975d838190195c74084c5b039a6111 100644 (file)
@@ -2,8 +2,8 @@
 #define _CFV_H
 
 #include <gtk/gtk.h>
-#include "lttv/common.h"
-#include "lttv/mainWindow.h"
+#include <lttv/common.h>
+#include <lttv/mainWindow.h>
 #include "Process_List.h"
 
 typedef struct _ControlFlowData ControlFlowData;
index b363b675b4856603f62a0b08bd8ea23f1ff04cb2..6a1e25bd4a8337662e1489fd84fe4c52a309f461 100644 (file)
  *   GQuark.) The habitual place for xpm icons is in
  *   ${prefix}/share/LinuxTraceToolkit.) + position (over or under line)
  * - line (color, width, style)
- * - Arc (can be seen as points) (color, size)
+ * - Arc (big points) (color, size)
  * - background color (color)
  *
+ * An item is a leaf of the attributes tree. It is, in that case, including
+ * all kind of events categories we can have. It then associates each category
+ * with one or more actions (drawing something) or nothing.
+ * 
  * Each item has an array of hooks (hook list). Each hook represents an
  * operation to perform. We seek the array each time we want to
  * draw an item. We execute each operation in order. An operation type
index cacabf5c4caf445687e02bbe88bc227483f0d440..4f6ce62a4f90732ca421f10c5d89e5e04af9b934 100644 (file)
@@ -444,3 +444,5 @@ void drawing_remove_square(Drawing_t *Drawing,
        update_rect.height = Drawing->height - y ;
        gtk_widget_draw( Drawing->Drawing_Area_V, &update_rect);
 }
+
+
index 283a2338fc968a57f93129bc4e6a10a484eea194..dda39fb39b08637f0dcd5e02ab1b1d9974221f89 100644 (file)
  * Copy region of the screen into another.
  * Modify the boundaries to reflect a scale change. (resize)
  * Refresh the physical screen with the pixmap
- * A helper function is provided here to convert from time and process
+ * A helper function is provided here to convert from time to process
  * identifier to pixels and the contrary (will be useful for mouse selection).
  * Insert an empty square in the drawing, moving the bottom part.
  *
+ * Note: The last point is exactly why it would not be so easy to add the
+ * vertical line functionnality as in the original version of LTT. In order
+ * to do so, we should keep all processes in the list for the duration of
+ * all the trace instead of dynamically adding and removing them when we
+ * scroll. Another possibility is to redraw all the visible area when a new
+ * process is added to the list. The second solution seems more appropriate
+ * to me.
+ * 
+ *
  * The pixmap used has the width of the physical window, but the height
  * of the shown processes.
  */
index 4f54350813f349ff54e4c950ae7d7fab400710fa..9dc103a80330c23033f6d373dadfe641fbdbb87e 100644 (file)
@@ -3,6 +3,9 @@
  *****************************************************************************/
 
 
+#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
+#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
+
 //#define PANGO_ENABLE_BACKEND
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
@@ -20,7 +23,7 @@
 #include "CFV-private.h"
 
 
-/* NOTE : no drawing data should be sent there, as the drawing widget
+/* NOTE : no drawing data should be sent there, since the drawing widget
  * has not been initialized */
 void send_test_drawing(ProcessList *Process_List,
                        Drawing_t *Drawing,
@@ -38,6 +41,11 @@ void send_test_drawing(ProcessList *Process_List,
        PangoFontDescription *FontDesc;// = pango_font_description_new();
        gint Font_Size;
 
+       //icon
+       GdkBitmap *mask = g_new(GdkBitmap, 1);
+       GdkPixmap *icon_pixmap = g_new(GdkPixmap, 1);
+       GdkGC * gc = gdk_gc_new(Pixmap);
+       
        /* Sent text data */
        layout = gtk_widget_create_pango_layout(Drawing->Drawing_Area_V,
                        NULL);
@@ -52,14 +60,14 @@ void send_test_drawing(ProcessList *Process_List,
        LttTime birth;
        birth.tv_sec = 12000;
        birth.tv_nsec = 55500;
-       g_critical("we have : x : %u, y : %u, width : %u, height : %u", x, y, width, height);
+       g_info("we have : x : %u, y : %u, width : %u, height : %u", x, y, width, height);
        processlist_get_process_pixels(Process_List,
                                        1,
                                        &birth,
                                        &y,
                                        &height);
        
-       g_critical("we draw : x : %u, y : %u, width : %u, height : %u", x, y, width, height);
+       g_info("we draw : x : %u, y : %u, width : %u, height : %u", x, y, width, height);
        drawing_draw_line(
                Drawing, Pixmap, x,
                y+(height/2), x + width, y+(height/2),
@@ -84,7 +92,23 @@ void send_test_drawing(ProcessList *Process_List,
                y+(height/2), x + width, y+(height/2),
                Drawing->Drawing_Area_V->style->black_gc);
 
-       g_critical("y : %u, height : %u", y, height);
+
+       /* Draw icon */
+       icon_pixmap = gdk_pixmap_create_from_xpm(Pixmap, &mask, NULL,
+//                             "/home/compudj/local/share/LinuxTraceToolkit/pixmaps/move_message.xpm");
+                               "/home/compudj/local/share/LinuxTraceToolkit/pixmaps/mini-display.xpm");
+       gdk_gc_copy(gc, Drawing->Drawing_Area_V->style->black_gc);
+       gdk_gc_set_clip_mask(gc, mask);
+       gdk_draw_drawable(Pixmap, 
+                       gc,
+                       icon_pixmap,
+                       0, 0, 0, 0, -1, -1);
+       
+       g_free(icon_pixmap);
+       g_free(mask);
+       g_free(gc);
+
+       g_info("y : %u, height : %u", y, height);
 
        birth.tv_sec = 12000;
        birth.tv_nsec = 55700;
@@ -101,7 +125,7 @@ void send_test_drawing(ProcessList *Process_List,
                y+(height/2), x + width, y+(height/2),
                Drawing->Drawing_Area_V->style->black_gc);
 
-       g_critical("y : %u, height : %u", y, height);
+       g_info("y : %u, height : %u", y, height);
 
        for(i=0; i<10; i++)
        {
@@ -139,7 +163,7 @@ void send_test_drawing(ProcessList *Process_List,
                y+(height/2), x + width, y+(height/2),
                Drawing->Drawing_Area_V->style->black_gc);
 
-       g_critical("y : %u, height : %u", y, height);
+       g_info("y : %u, height : %u", y, height);
 
 
        pango_font_description_set_size(FontDesc, Font_Size);
@@ -304,8 +328,10 @@ void send_test_process(ProcessList *Process_List, Drawing_t *Drawing)
 GtkWidget *
 h_guicontrolflow(MainWindow *pmParentWindow, LttvTracesetSelector * s, char * key)
 {
-       g_critical("hGuiControlFlow");
+       g_info("h_guicontrolflow, %p, %p, %s", pmParentWindow, s, key);
        ControlFlowData *Control_Flow_Data = guicontrolflow() ;
+       
+       Control_Flow_Data->Parent_Window = pmParentWindow;
 
        get_time_window(pmParentWindow,
                        guicontrolflow_get_time_window(Control_Flow_Data));
@@ -402,7 +428,7 @@ void update_time_window_hook(void *hook_data, void *call_data)
        
 
        *Time_Window = *New_Time_Window;
-       g_critical("New time window HOOK : %u, %u to %u, %u",
+       g_info("New time window HOOK : %u, %u to %u, %u",
                        Time_Window->start_time.tv_sec,
                        Time_Window->start_time.tv_nsec,
                        Time_Window->time_width.tv_sec,
@@ -427,7 +453,7 @@ void update_current_time_hook(void *hook_data, void *call_data)
        LttTime* Current_Time = 
                guicontrolflow_get_current_time(Control_Flow_Data);
        *Current_Time = *((LttTime*)call_data);
-       g_critical("New Current time HOOK : %u, %u", Current_Time->tv_sec,
+       g_info("New Current time HOOK : %u, %u", Current_Time->tv_sec,
                                                        Current_Time->tv_nsec);
 
        /* If current time is inside time interval, just move the highlight
index 5ac3077e2ce254a864ebbe35cabfeb6b2aa5dbb6..dde25f283597eeb642b45cfc133e77e510b14553 100644 (file)
@@ -17,6 +17,9 @@
  * Author : Mathieu Desnoyers, June 2003
  */
 
+#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
+#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
+
 #include <glib.h>
 #include <gmodule.h>
 #include <lttv/module.h>
@@ -55,7 +58,7 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
          return;
        }
        
-       g_critical("GUI ControlFlow Viewer init()");
+       g_info("GUI ControlFlow Viewer init()");
 
        /* Register the toolbar insert button */
        toolbar_item_reg(hGuiControlFlowInsert_xpm, "Insert Control Flow Viewer",
@@ -68,8 +71,8 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
 
 void destroy_walk(gpointer data, gpointer user_data)
 {
+       g_info("Walk destroy GUI Control Flow Viewer");
        guicontrolflow_destructor_full((ControlFlowData*)data);
-       g_critical("Walk destroy GUI Control Flow Viewer");
 }
 
 
@@ -81,7 +84,7 @@ void destroy_walk(gpointer data, gpointer user_data)
  * everything that has been registered in the gtkTraceSet API.
  */
 G_MODULE_EXPORT void destroy() {
-       g_critical("GUI Control Flow Viewer destroy()");
+       g_info("GUI Control Flow Viewer destroy()");
        int i;
 
        g_slist_foreach(gControl_Flow_Data_List, destroy_walk, NULL );
This page took 0.030517 seconds and 4 git commands to generate.