add control flow view legend
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 27 Aug 2005 03:23:23 +0000 (03:23 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 27 Aug 2005 03:23:23 +0000 (03:23 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1084 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c
ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.h
ltt/branches/poly/lttv/modules/gui/controlflow/hLegendInsert.xpm [new file with mode: 0644]
ltt/branches/poly/lttv/modules/gui/controlflow/module.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am
ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/lttv-color-list.png [new file with mode: 0644]

index 601696875ae203d7aa8a3dda493f177fb18ed0b3..082a8ff934e7f5b49d238b01ebf74b37e9579544 100644 (file)
@@ -48,7 +48,6 @@ header_size_allocate(GtkWidget *widget,
 }
 
 
-
 /*****************************************************************************
  *                     Control Flow Viewer class implementation              *
  *****************************************************************************/
@@ -151,7 +150,6 @@ guicontrolflow(void)
   //inserted in the main window before the drawing area
   //can be configured (and this must happend bedore sending
   //data)
-
   
   return control_flow_data;
 
index 0b2caea19e505de0e4fc9a7a1863707d9d26a8cf..3e469bab9514dca82d3eb6980f30426a363341c8 100644 (file)
@@ -50,7 +50,7 @@ struct _ControlFlowData {
 
   Drawing_t *drawing;
   GtkAdjustment *v_adjust ;
-  
+
   /* Shown events information */
 //  TimeWindow time_window;
 //  LttTime current_time;
@@ -62,7 +62,6 @@ struct _ControlFlowData {
 
 } ;
 
-
 /* Control Flow Data constructor */
 ControlFlowData *guicontrolflow(void);
 void
index cf48bda0a1cc05693add3ed302d35a581113900a..a31234c633dd893f77217e1f6342d671d04f265d 100644 (file)
@@ -69,6 +69,7 @@
 #include <lttv/state.h>
 #include <lttvwindow/lttvwindow.h>
 #include <lttvwindow/lttvwindowtraces.h>
+#include <lttvwindow/support.h>
 
 
 #include "eventhooks.h"
@@ -79,6 +80,8 @@
 
 #define MAX_PATH_LEN 256
 
+extern GSList *g_legend_list;
+
 #if 0
 typedef struct _ProcessAddClosure {
   ControlFlowData *cfd;
@@ -263,6 +266,46 @@ h_guicontrolflow(Tab *tab)
   
 }
 
+void legend_destructor(GtkWindow *legend)
+{
+  g_legend_list = g_slist_remove(g_legend_list, legend);
+}
+
+/* Create a popup legend */
+GtkWidget *
+h_legend(Tab *tab)
+{
+  g_info("h_legend, %p", tab);
+
+  GtkWindow *legend = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
+  g_legend_list = g_slist_append(
+      g_legend_list,
+      legend);
+  g_object_set_data_full(
+      G_OBJECT(legend),
+      "legend",
+      legend,
+      (GDestroyNotify)legend_destructor);
+  
+  gtk_window_set_title(legend, "Control Flow View Legend");
+
+  GtkWidget *pixmap = create_pixmap(GTK_WIDGET(legend), "lttv-color-list.png");
+  
+ // GtkImage *image = GTK_IMAGE(gtk_image_new_from_pixmap(
+ //                               GDK_PIXMAP(pixmap), NULL));
+  
+  gtk_container_add(GTK_CONTAINER(legend), GTK_WIDGET(pixmap));
+
+  gtk_widget_show(GTK_WIDGET(pixmap));
+  gtk_widget_show(GTK_WIDGET(legend));
+  
+
+  return NULL; /* This is a popup window */
+}
+
+
 int event_selected_hook(void *hook_data, void *call_data)
 {
   ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
index d7244129bba0a0f8a74d95ef132f08f51f18c1ed..6f4fdf015e01a2a11e823e02721f4fedd457163b 100644 (file)
@@ -59,6 +59,8 @@ void send_test_data(ProcessList *process_list, Drawing_t *drawing);
 
 GtkWidget *h_guicontrolflow(Tab *tab);
 
+GtkWidget *h_legend(Tab *tab);
+
 int event_selected_hook(void *hook_data, void *call_data);
 
 /*
@@ -114,4 +116,6 @@ gint traceset_notify(void *hook_data, void *call_data);
 gint redraw_notify(void *hook_data, void *call_data);
 gint continue_notify(void *hook_data, void *call_data);
 
+void legend_destructor(GtkWindow *legend);
+
 #endif // _EVENT_HOOKS_H
diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/hLegendInsert.xpm b/ltt/branches/poly/lttv/modules/gui/controlflow/hLegendInsert.xpm
new file mode 100644 (file)
index 0000000..a6ff0f3
--- /dev/null
@@ -0,0 +1,45 @@
+/* XPM */
+static char * hLegendInsert_xpm[] = {
+"22 22 20 1",
+"      c None",
+".     c #0DF904",
+"+     c #000000",
+"@     c #000500",
+"#     c #000B00",
+"$     c #034001",
+"%     c #000200",
+"&     c #0CF403",
+"*     c #0BD603",
+"=     c #034901",
+"-     c #F90404",
+";     c #0AC503",
+">     c #000F00",
+",     c #034601",
+"'     c #0CF503",
+")     c #D60303",
+"!     c #001000",
+"~     c #044E01",
+"{     c #0CF203",
+"]     c #E40303",
+"                      ",
+"          .           ",
+"          ..          ",
+"        ++@#$         ",
+"       ++++++%        ",
+"       +  &*=++       ",
+"          .. ++       ",
+"          .  ++       ",
+"            ++        ",
+"----------;>+,'.......",
+"---------)!+~{........",
+"         +++          ",
+"         ++]----      ",
+"         ++-----      ",
+"         ++-----      ",
+"          ------      ",
+"         ++-----      ",
+"         ++-----      ",
+"                      ",
+"..........------------",
+"..........------------",
+"                      "};
index c7c571927f9804432e6901b00a6aba6c726d6288..14311efed2a552661b6eb7dd1cee0e5afeb1d8a7 100644 (file)
 #include "eventhooks.h"
 
 #include "hGuiControlFlowInsert.xpm"
+#include "hLegendInsert.xpm"
 
 GQuark LTT_NAME_CPU;
 
 /** Array containing instanced objects. Used when module is unloaded */
 GSList *g_control_flow_data_list = NULL ;
 
+GSList *g_legend_list = NULL ;
 
 /*****************************************************************************
  *                 Functions for module loading/unloading                    *
@@ -77,6 +79,14 @@ static void init() {
                                   hGuiControlFlowInsert_xpm,
                                   "Insert Control Flow Viewer",
                                   h_guicontrolflow);
+  
+  lttvwindow_register_constructor("guicontrolflowlegend",
+                                  "/",
+                                  "Popup Control Flow Viewer Legend",
+                                  hLegendInsert_xpm,
+                                  "Popup Control Flow Viewer Legend",
+                                  h_legend);
+
 
   LTT_NAME_CPU = g_quark_from_string("/cpu");
 }
@@ -87,6 +97,12 @@ void destroy_walk(gpointer data, gpointer user_data)
   guicontrolflow_destructor_full((ControlFlowData*)data);
 }
 
+void destroy_legend_walk(gpointer data, gpointer user_data)
+{
+  g_info("Walk destroy GUI Control Flow Viewer");
+  legend_destructor((GtkWindow*)data);
+}
+
 
 
 /**
@@ -102,8 +118,13 @@ static void destroy() {
   
   g_slist_free(g_control_flow_data_list);
 
+  g_slist_foreach(g_legend_list, destroy_legend_walk, NULL );
+  
+  g_slist_free(g_control_flow_data_list);
+  
   /* Unregister the toolbar insert button and menu entry */
   lttvwindow_unregister_constructor(h_guicontrolflow);
+  lttvwindow_unregister_constructor(h_legend);
 }
 
 
index afca17b92bb60ec95e0da72f1870e7ef27d46bdb..71064961a7de6239a745e884a088bbc4a4696db2 100644 (file)
@@ -26,4 +26,5 @@ EXTRA_DIST =  \
        stock_redo_24.png\
        stock_refresh_24.png\
        close.png\
-       stock_jump_to_24.png
+       stock_jump_to_24.png\
+       lttv-color-list.png
diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/lttv-color-list.png b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/lttv-color-list.png
new file mode 100644 (file)
index 0000000..2fc6651
Binary files /dev/null and b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/lttv-color-list.png differ
This page took 0.028716 seconds and 4 git commands to generate.