changed following Michel's email
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 27 May 2004 14:32:21 +0000 (14:32 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 27 May 2004 14:32:21 +0000 (14:32 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@565 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/viewer.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/viewer.h

index 2adc00b87c07dd04382986446f0d243ed5b0db56..0300cdda4f297e5fe39574c7c0036c317a493308 100644 (file)
@@ -144,6 +144,99 @@ void set_time_window(MainWindow * main_win, const TimeWindow *time_window)
 
 }
 
+
+/* Remove menu entry and tool button from main window for the 
+ * unloaded  module
+ */
+
+void remove_menu_item(gpointer main_win, gpointer user_data)
+{
+  MainWindow * mw = (MainWindow *) main_win;
+  lttv_menu_closure *menu_item = (lttv_menu_closure *)user_data;
+  GtkWidget * tool_menu_title_menu, *insert_view;
+
+  tool_menu_title_menu = lookup_widget(mw->mwindow,"ToolMenuTitle_menu");
+  insert_view = (GtkWidget*)g_hash_table_lookup(mw->hash_menu_item,
+                                               menu_item->menuText);
+  if(insert_view){
+    g_hash_table_remove(mw->hash_menu_item, menu_item->menuText);
+    gtk_container_remove (GTK_CONTAINER (tool_menu_title_menu), insert_view);
+  }
+}
+
+void remove_toolbar_item(gpointer main_win, gpointer user_data)
+{
+  MainWindow * mw = (MainWindow *) main_win;
+  lttv_toolbar_closure *toolbar_item = (lttv_toolbar_closure *)user_data;
+  GtkWidget * tool_menu_title_menu, *insert_view;
+
+
+  tool_menu_title_menu = lookup_widget(mw->mwindow,"MToolbar1");
+  insert_view = (GtkWidget*)g_hash_table_lookup(mw->hash_toolbar_item,
+                                               toolbar_item->tooltip);
+  if(insert_view){
+    g_hash_table_remove(mw->hash_toolbar_item, toolbar_item->tooltip);
+    gtk_container_remove (GTK_CONTAINER (tool_menu_title_menu), insert_view);
+  }
+}
+
+/**
+ * Remove menu and toolbar item when a module unloaded from all 
+ * main windows
+ */
+
+void main_window_remove_menu_item(lttvwindow_viewer_constructor constructor)
+{
+  int i;
+  LttvMenus * menu;
+  lttv_menu_closure *menu_item;
+  LttvAttributeValue value;
+  LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
+
+  g_assert(lttv_iattribute_find_by_path(attributes,
+          "viewers/menu", LTTV_POINTER, &value));
+  menu = (LttvMenus*)*(value.v_pointer);
+
+  if(menu){
+    for(i=0;i<menu->len;i++){
+      menu_item = &g_array_index(menu, lttv_menu_closure, i);
+      if(menu_item->con != constructor) continue;
+      if(g_main_window_list){
+       g_slist_foreach(g_main_window_list, remove_menu_item, menu_item);
+      }
+      break;
+    }
+  }
+  
+}
+
+void main_window_remove_toolbar_item(lttvwindow_viewer_constructor constructor)
+{
+  int i;
+  LttvToolbars * toolbar;
+  lttv_toolbar_closure *toolbar_item;
+  LttvAttributeValue value;
+  LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
+
+  g_assert(lttv_iattribute_find_by_path(attributes,
+          "viewers/toolbar", LTTV_POINTER, &value));
+  toolbar = (LttvToolbars*)*(value.v_pointer);
+
+  if(toolbar){
+    for(i=0;i<toolbar->len;i++){
+      toolbar_item = &g_array_index(toolbar, lttv_toolbar_closure, i);
+      if(toolbar_item->con != constructor) continue;
+      if(g_main_window_list){
+       g_slist_foreach(g_main_window_list, remove_toolbar_item, toolbar_item);
+      }
+      break;
+    }
+  }
+}
+
+
+
+
 /**
  * API parts
  */
@@ -633,27 +726,6 @@ void lttvwindow_time_interval_request(MainWindow *main_win,
   }
 }
 
-
-
-/**
- * Function to get the current time interval of the current traceset.
- * It will be called by a viewer's hook function to update the 
- * time interval of the viewer and also be called by the constructor
- * of the viewer.
- * @param main_win the main window the viewer belongs to.
- * @param time_interval a pointer where time interval will be stored.
- */
-
-const TimeInterval *lttvwindow_get_time_span(MainWindow *main_win)
-{
-  //time_window->start_time = main_win->current_tab->time_window.start_time;
-  //time_window->time_width = main_win->current_tab->time_window.time_width;
-  return (LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
-             traceset_context)->Time_Span);
-}
-
-
-
 /**
  * Function to get the current time interval shown on the current tab.
  * It will be called by a viewer's hook function to update the 
index dbcc175208c1ef92c3459a5f7396f8e0025a9a1d..0f0bd8e549c9e4200555ae5c1bd78054957f06d6 100644 (file)
@@ -32,6 +32,30 @@ every viewer that currently sits in memory so it can destroy them before the
 module gets unloaded/destroyed.
 
 
+Main Window
+
+The main window is a container that offers menus, buttons and a notebook. Some
+of those menus and buttons are part of the core of the main window, others
+are dynamically added and removed when modules are loaded/unloaded.
+
+The notebook contains as much tabs as wanted. Each tab is linked with a
+set of traces (traceset). Each trace contains many tracefiles (one per cpu).
+A trace corresponds to a kernel being traced. A traceset corresponds to
+many traces read together. The time span of a traceset goes from the
+earliest start of all the traces to the latest end of all the traces.
+
+Inside each tab are added the viewers. When they interact with the main
+window through the lttvwindow API, they affect the other viewers located
+in the same tab as they are.
+
+The insertion of many viewers in a tab permits a quick look at all the
+information wanted in a glance. The main window does merge the read requests
+from all the viewers in the same tab in a way that every viewer will get exactly
+the events it asked for, while the event reading loop and state update are
+shared. It improves performance of events delivery to the viewers.
+
+
+
 Viewer Instance Related API
 
 The lifetime of a viewer is as follows. The viewer constructor function is
@@ -105,15 +129,17 @@ Requesting Events to Main Window
 
 Events can be requested by passing a EventsRequest structure to the main window.
 They will be delivered later when the next g_idle functions will be called.
-Event delivery is done by calling the middle hook for this event ID, or the 
-main middle hooks.
+Event delivery is done by calling the event hook for this event ID, or the 
+main event hooks. A pointer to the EventsRequest structure is passed as 
+hook_data to the event hooks of the viewers.
 
 EventsRequest consists in 
+- a pointer to the viewer specific data structure
 - a start timestamp or position
 - a stop_flag, ending the read process when set to TRUE
 - a end timestamp and/or position and/or number of events to read
 - hook lists to call for traceset/trace/tracefile begin and end, and for each
-  event (middle).
+  event (event hooks and event_by_id hooks).
   
 The main window will deliver events for every EventRequests it has pending
 through an algorithm that guarantee that all events requested, and only them,
@@ -193,6 +219,18 @@ In the second case, with a pixmap buffer, the expose handler is only responsible
 of showing the pixmap buffer on the screen. If the pixmap buffer has never
 been filled with a drawing, the expose handler may ask for it to be filled.
 
+The interest of using events request to the main window instead of reading the
+events directly from the trace comes from the fact that the main window
+does merge requests from the different viewers in the same tab so that the
+read loop and the state update is shared. As viewers will, in the common
+scenario, request the same events, only one pass through the trace that will
+call the right hooks for the right intervals will be done.
+
+When the traceset read is over for a events request, the traceset_end hook is
+called. It has the responsibility of finishing the drawing if some parts
+still need to be drawn and to show it on the screen (if the viewer uses a pixmap
+buffer).
+
 It can add dotted lines and such visual effects to enhance the user's
 experience.
 
@@ -215,9 +253,11 @@ FIXME : explain other important events
 
 #include <gtk/gtk.h>
 #include <ltt/ltt.h>
+#include <ltt/time.h>
 #include <lttv/hook.h>
-#include <lttvwindow/common.h>
+#include <lttv/tracecontext.h>
 #include <lttv/stats.h>
+#include <lttvwindow/common.h>
 //FIXME (not ready yet) #include <lttv/filter.h>
 
 
@@ -541,18 +581,20 @@ void lttvwindow_report_focus(MainWindow *main_win,
 /* Structure sent to the time request hook */
                                                 /* Value considered as empty */
 typedef struct _EventsRequest {
-  LttTime                     start_time,       /* Unset : { 0, 0 }          */
-  LttvTracesetContextPosition start_position,   /* Unset : num_traces = 0    */
-  LttTime                     end_time,         /* Unset : { 0, 0 }          */
-  guint                       num_events,       /* Unset : G_MAXUINT         */
-  LttvTracesetContextPosition end_position,     /* Unset : num_traces = 0    */
-  LttvHooksById              *before_traceset,  /* Unset : NULL              */
-  LttvHooksById              *before_trace,     /* Unset : NULL              */
-  LttvHooksById              *before_tracefile, /* Unset : NULL              */
-  LttvHooksById              *middle,           /* Unset : NULL              */
-  LttvHooksById              *after_tracefile,  /* Unset : NULL              */
-  LttvHooksById              *after_trace,      /* Unset : NULL              */
-  LttvHooksById              *after_traceset    /* Unset : NULL              */
+  LttTime                     start_time,       /* Unset : { 0, 0 }         */
+  LttvTracesetContextPosition start_position,   /* Unset : num_traces = 0   */
+  gboolean                    stop_flag,        /* Continue:TRUE Stop:FALSE */
+  LttTime                     end_time,         /* Unset : { 0, 0 }         */
+  guint                       num_events,       /* Unset : G_MAXUINT        */
+  LttvTracesetContextPosition end_position,     /* Unset : num_traces = 0   */
+  LttvHooks                  *before_traceset,  /* Unset : NULL             */
+  LttvHooks                  *before_trace,     /* Unset : NULL             */
+  LttvHooks                  *before_tracefile, /* Unset : NULL             */
+  LttvHooks                  *event,            /* Unset : NULL             */
+  LttvHooksById              *event_by_id,      /* Unset : NULL             */
+  LttvHooks                  *after_tracefile,  /* Unset : NULL             */
+  LttvHooks                  *after_trace,      /* Unset : NULL             */
+  LttvHooks                  *after_traceset    /* Unset : NULL             */
 } EventsRequest;
 
 
@@ -577,15 +619,6 @@ typedef struct _EventsRequest {
 void lttvwindow_events_request(MainWindow    *main_win,
                                EventsRequest  events_request);
 
-/**
- * Function to get the life span of the traceset
- *
- * @param main_win the main window the viewer belongs to.
- * @return pointer to a time interval : the life span of the traceset.
- */
-
-const TimeInterval *lttvwindow_get_time_span(MainWindow *main_win);
-
 /**
  * Function to get the current time window of the current tab.
  * 
This page took 0.027774 seconds and 4 git commands to generate.