reshaped the gui filter module
[lttv.git] / ltt / branches / poly / lttv / modules / gui / filter / filter.c
index 04b9e774435e00b6d6014f0baa8aa85dda90e759..389a4bad03d972bff52797c585ebb95bd53d245c 100644 (file)
 
 #include "hGuiFilterInsert.xpm"
 
+/*
+ * TODO
+ * - connect the gui filter to the core filter
+ */
+
 typedef struct _FilterViewerData FilterViewerData;
 
+/*
+ * Prototypes
+ */
 GtkWidget *guifilter_get_widget(FilterViewerData *fvd);
 FilterViewerData *gui_filter(Tab *tab);
 void gui_filter_destructor(FilterViewerData *fvd);
 gboolean filter_traceset_changed(void * hook_data, void * call_data);
 gboolean filter_viewer_data(void * hook_data, void * call_data); 
-GtkWidget* h_gui_filter(Tab *tab);
+GtkWidget* h_guifilter(Tab *tab);
 void statistic_destroy_walk(gpointer data, gpointer user_data);
   
 struct _FilterViewerData {
   Tab *tab;
 
-  // temp widget -- still thinking about a formal structure
-  GtkWidget *vcontainer;
-  GtkWidget *window;
+  GtkWidget *f_main_box;
+
+  GtkWidget *f_hbox1;
+  GtkWidget *f_hbox2;
+  
+  GtkWidget *f_expression_field;
+  GtkWidget *f_process_button;
+
+  GtkWidget *f_logical_op_box;
+  GtkWidget *f_struct_box;
+  GtkWidget *f_subfield_box;
+  GtkWidget *f_math_op_box;
+  GtkWidget *f_value_field;
+
+  GtkWidget *f_textwnd;
+  GtkWidget *f_selectwnd;
+  GtkWidget *f_treewnd;
+  
 };
 
 GtkWidget 
 *guifilter_get_widget(FilterViewerData *fvd)
 {
-  return fvd->window;
+  return fvd->f_main_box;
 }
 
 /**
@@ -64,6 +87,8 @@ GtkWidget
 FilterViewerData*
 gui_filter(Tab *tab)
 {
+  g_print("filter::gui_filter()");
+  
   GtkCellRenderer *renderer;
   GtkTreeViewColumn *column;
 
@@ -75,20 +100,87 @@ gui_filter(Tab *tab)
                                       filter_traceset_changed,
                                       filter_viewer_data);
 //  request_background_data(filter_viewer_data);
-
-  /* Initialize the vertical container */
+  /* 
+   * Initiating GtkTable layout 
+   * starts with 2 rows and 5 columns and 
+   * expands when expressions added
+   */
+  fvd->f_main_box = gtk_table_new(2,5,FALSE);
+  gtk_table_set_row_spacings(GTK_TABLE(fvd->f_main_box),5);
+  gtk_table_set_col_spacings(GTK_TABLE(fvd->f_main_box),5);
   
-  fvd->window =  gtk_drawing_area_new();
-
-  gtk_widget_set_size_request(fvd->window,200,200);
-        
-  fvd->vcontainer = gtk_vbox_new (FALSE, 1);
-  gtk_container_set_border_width (GTK_CONTAINER (fvd->vcontainer), 1);
-  gtk_container_add (GTK_CONTAINER (fvd->window), fvd->vcontainer);
-
-  gtk_box_pack_start (GTK_BOX (fvd->vcontainer), fvd->window, TRUE, TRUE, 0);
+  /*
+   *  First half of the filter window
+   *  - textual entry of filter expression
+   *  - processing button
+   */
+  fvd->f_expression_field = gtk_entry_new(); //gtk_scrolled_window_new (NULL, NULL);
+  gtk_entry_set_text(GTK_ENTRY(fvd->f_expression_field),"state.cpu>0");
+  gtk_widget_show (fvd->f_expression_field);
+
+  fvd->f_process_button = gtk_button_new_with_label("Process");
+  gtk_widget_show (fvd->f_process_button);
+  
+  gtk_table_attach( GTK_TABLE(fvd->f_main_box),fvd->f_expression_field,0,4,0,1,GTK_FILL,GTK_FILL,0,0);
+  gtk_table_attach( GTK_TABLE(fvd->f_main_box),fvd->f_process_button,4,5,0,1,GTK_SHRINK,GTK_FILL,0,0);
+  gtk_table_attach( GTK_TABLE(fvd->f_main_box),fvd->f_process_button,4,5,0,1,GTK_SHRINK,GTK_FILL,0,0);
+  
+  /*
+   *  Second half of the filter window
+   *  - combo boxes featuring filtering options added to the expression
+   */
+  fvd->f_logical_op_box = gtk_combo_box_new_text();
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_logical_op_box), "&");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_logical_op_box), "|");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_logical_op_box), "^");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_logical_op_box), "!");
+  gtk_widget_show(fvd->f_logical_op_box);
+  
+  fvd->f_struct_box = gtk_combo_box_new_text();
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_struct_box), "event");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_struct_box), "tracefile");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_struct_box), "trace");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_struct_box), "state");
+  gtk_widget_show(fvd->f_struct_box);
+  fvd->f_subfield_box = gtk_combo_box_new_text();
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "name");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "category");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "time");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "tsc");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "pid");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "ppid");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "creation time");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "insertion time");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "process name");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "execution mode");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "execution submode");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "process status");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_subfield_box), "cpu");
+  gtk_widget_show(fvd->f_subfield_box);
+  fvd->f_math_op_box = gtk_combo_box_new_text();
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_math_op_box), "=");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_math_op_box), "!=");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_math_op_box), "<");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_math_op_box), "<=");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_math_op_box), ">");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (fvd->f_math_op_box), ">=");
+  gtk_widget_show(fvd->f_math_op_box);
+
+  fvd->f_value_field = gtk_entry_new();
+  gtk_widget_show(fvd->f_value_field);
+  
+  gtk_table_attach( GTK_TABLE(fvd->f_main_box),fvd->f_logical_op_box,0,1,1,2,GTK_SHRINK,GTK_FILL,0,0);
+  gtk_table_attach( GTK_TABLE(fvd->f_main_box),fvd->f_struct_box,1,2,1,2,GTK_SHRINK,GTK_FILL,0,0);
+  gtk_table_attach( GTK_TABLE(fvd->f_main_box),fvd->f_subfield_box,2,3,1,2,GTK_SHRINK,GTK_FILL,0,0);
+  gtk_table_attach( GTK_TABLE(fvd->f_main_box),fvd->f_math_op_box,3,4,1,2,GTK_SHRINK,GTK_FILL,0,0);
+  gtk_table_attach( GTK_TABLE(fvd->f_main_box),fvd->f_value_field,4,5,1,2,GTK_SHRINK,GTK_FILL,0,0);
+   
+  /* show main container */
+  gtk_widget_show(fvd->f_main_box);
   
-//  gtk_widget_show(fvd->window);
   
   g_object_set_data_full(
       G_OBJECT(guifilter_get_widget(fvd)),
@@ -96,6 +188,7 @@ gui_filter(Tab *tab)
       fvd,
       (GDestroyNotify)gui_filter_destructor);
 
+  
   return fvd;
 }
 
@@ -139,10 +232,11 @@ filter_viewer_data(void * hook_data, void * call_data) {
  * @return The widget created.
  */
 GtkWidget *
-h_gui_filter(Tab *tab)
+h_guifilter(Tab *tab)
 {
   FilterViewerData* f = gui_filter(tab) ;
 
+  g_print("FilterViewerData:%p\n",f);
   if(f)
     return guifilter_get_widget(f);
   else return NULL;
@@ -164,7 +258,7 @@ static void init() {
                                   "Insert Filter Module",
                                   hGuiFilterInsert_xpm,
                                   "Insert Filter Module",
-                                  h_gui_filter);
+                                  h_guifilter);
 }
 
 void filter_destroy_walk(gpointer data, gpointer user_data)
@@ -185,7 +279,7 @@ void filter_destroy_walk(gpointer data, gpointer user_data)
  */
 static void destroy() {
   
-  lttvwindow_unregister_constructor(h_gui_filter);
+  lttvwindow_unregister_constructor(h_guifilter);
   
 }
 
This page took 0.025959 seconds and 4 git commands to generate.