From: compudj Date: Tue, 22 Jun 2004 22:03:07 +0000 (+0000) Subject: added redraw, continue and stop X-Git-Tag: v0.12.20~2881 X-Git-Url: http://git.lttng.org/?a=commitdiff_plain;h=9878c8a4ce727f8a542a836ed289f5eb365d3292;hp=e62a7964624b47582b69d87dc6740983db5bb3c5;p=lttv.git added redraw, continue and stop git-svn-id: http://ltt.polymtl.ca/svn@608 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index c6f574d4..c734f89d 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -435,8 +435,6 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) LttvTracesetContextPosition *end_position; - /* Current tab check : if no current tab is present, no hooks to call. */ - /* (Xang Xiu) It makes the expose works.. MD:? */ if(tab == NULL) return FALSE; @@ -1270,6 +1268,86 @@ void remove_trace(GtkWidget * widget, gpointer user_data) } +/* Redraw all the viewers in the current tab */ +void redraw(GtkWidget *widget, gpointer user_data) +{ + GtkWidget * notebook = lookup_widget(widget, "MNotebook"); + GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), + gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); + Tab *tab; + if(!page) { + return; + } else { + tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + } + + LttvHooks * tmp; + LttvAttributeValue value; + + g_assert(lttv_iattribute_find_by_path(tab->attributes, "hooks/redraw", LTTV_POINTER, &value)); + + tmp = (LttvHooks*)*(value.v_pointer); + g_assert(tmp != NULL); + + lttv_hooks_call(tmp,NULL); +} + + +void continue_processing(GtkWidget *widget, gpointer user_data) +{ + GtkWidget * notebook = lookup_widget(widget, "MNotebook"); + GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), + gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); + Tab *tab; + if(!page) { + return; + } else { + tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + } + + LttvHooks * tmp; + LttvAttributeValue value; + + g_assert(lttv_iattribute_find_by_path(tab->attributes, + "hooks/continue", LTTV_POINTER, &value)); + + tmp = (LttvHooks*)*(value.v_pointer); + g_assert(tmp != NULL); + + lttv_hooks_call(tmp,NULL); +} + +/* Stop the processing for the calling main window's current tab. + * It removes every processing requests that are in its list. It does not call + * the end request hooks, because the request is not finished. + */ + +void stop_processing(GtkWidget *widget, gpointer user_data) +{ + GtkWidget * notebook = lookup_widget(widget, "MNotebook"); + GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), + gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); + Tab *tab; + if(!page) { + return; + } else { + tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info"); + } + GSList *events_requests = tab->events_requests; + + GSList *iter = events_requests; + + while(iter != NULL) { + GSList *remove_iter = iter; + iter = g_slist_next(iter); + + g_free(remove_iter->data); + events_requests = g_slist_remove_link(events_requests, remove_iter); + } + g_assert(g_slist_length(events_requests) == 0); +} + + /* save will save the traceset to a file * Not implemented yet FIXME */ @@ -1870,6 +1948,28 @@ on_button_remove_trace_clicked (GtkButton *button, remove_trace((GtkWidget*)button, user_data); } +void +on_button_redraw_clicked (GtkButton *button, + gpointer user_data) +{ + redraw((GtkWidget*)button, user_data); +} + +void +on_button_continue_processing_clicked (GtkButton *button, + gpointer user_data) +{ + continue_processing((GtkWidget*)button, user_data); +} + +void +on_button_stop_processing_clicked (GtkButton *button, + gpointer user_data) +{ + stop_processing((GtkWidget*)button, user_data); +} + + void on_button_save_clicked (GtkButton *button, diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h index c46c9254..31589b38 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.h @@ -182,6 +182,17 @@ on_button_add_trace_clicked (GtkButton *button, void on_button_remove_trace_clicked (GtkButton *button, gpointer user_data); +void +on_button_redraw_clicked (GtkButton *button, + gpointer user_data); + +void +on_button_continue_processing_clicked (GtkButton *button, + gpointer user_data); + +void +on_button_stop_processing_clicked (GtkButton *button, + gpointer user_data); void on_button_save_clicked (GtkButton *button, diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/interface.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/interface.c index 46a82b17..da688fdf 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/interface.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/interface.c @@ -117,6 +117,9 @@ create_MWindow (void) // GtkWidget *tlbOpenTraceset; GtkWidget *tlbAddTrace; GtkWidget *tlbRemoveTrace; + GtkWidget *tlbRedraw; + GtkWidget *tlbContinueProcessing; + GtkWidget *tlbStopProcessing; // GtkWidget *tlbSave; // GtkWidget *tlbSaveAs; GtkWidget *tlbZoomIn; @@ -474,6 +477,44 @@ create_MWindow (void) gtk_widget_show (tlbSaveAs); gtk_container_set_border_width (GTK_CONTAINER (tlbSaveAs), 1); */ + gtk_toolbar_append_space (GTK_TOOLBAR (MToolbar1)); + + /* Manually added by Mathieu Desnoyers */ + + tmp_toolbar_icon = create_pixmap (MWindow, "stock_redraw_24.png"); + tlbRedraw = gtk_toolbar_append_element (GTK_TOOLBAR (MToolbar1), + GTK_TOOLBAR_CHILD_BUTTON, + NULL, + "", + "Redraw", NULL, + tmp_toolbar_icon, NULL, NULL); + gtk_label_set_use_underline (GTK_LABEL (((GtkToolbarChild*) (g_list_last (GTK_TOOLBAR (MToolbar1)->children)->data))->label), TRUE); + gtk_widget_show (tlbRedraw); + gtk_container_set_border_width (GTK_CONTAINER (tlbRedraw), 1); + + tmp_toolbar_icon = create_pixmap (MWindow, "stock_redo_24.png"); + tlbContinueProcessing = gtk_toolbar_append_element (GTK_TOOLBAR (MToolbar1), + GTK_TOOLBAR_CHILD_BUTTON, + NULL, + "", + "Continue Processing", NULL, + tmp_toolbar_icon, NULL, NULL); + gtk_label_set_use_underline (GTK_LABEL (((GtkToolbarChild*) (g_list_last (GTK_TOOLBAR (MToolbar1)->children)->data))->label), TRUE); + gtk_widget_show (tlbContinueProcessing); + gtk_container_set_border_width (GTK_CONTAINER (tlbContinueProcessing), 1); + + tmp_toolbar_icon = create_pixmap (MWindow, "stock_stop_24.png"); + tlbStopProcessing = gtk_toolbar_append_element (GTK_TOOLBAR (MToolbar1), + GTK_TOOLBAR_CHILD_BUTTON, + NULL, + "", + "Stop Processing", NULL, + tmp_toolbar_icon, NULL, NULL); + gtk_label_set_use_underline (GTK_LABEL (((GtkToolbarChild*) (g_list_last (GTK_TOOLBAR (MToolbar1)->children)->data))->label), TRUE); + gtk_widget_show (tlbStopProcessing); + gtk_container_set_border_width (GTK_CONTAINER (tlbStopProcessing), 1); + + gtk_toolbar_append_space (GTK_TOOLBAR (MToolbar1)); tmp_toolbar_icon = create_pixmap (MWindow, "stock_zoom_in_24.png"); @@ -727,6 +768,15 @@ create_MWindow (void) g_signal_connect ((gpointer) tlbRemoveTrace, "clicked", G_CALLBACK (on_button_remove_trace_clicked), NULL); + g_signal_connect ((gpointer) tlbRedraw, "clicked", + G_CALLBACK (on_button_redraw_clicked), + NULL); + g_signal_connect ((gpointer) tlbContinueProcessing, "clicked", + G_CALLBACK (on_button_continue_processing_clicked), + NULL); + g_signal_connect ((gpointer) tlbStopProcessing, "clicked", + G_CALLBACK (on_button_stop_processing_clicked), + NULL); /* g_signal_connect ((gpointer) tlbSave, "clicked", G_CALLBACK (on_button_save_clicked), diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index f7035ea3..cac8e126 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -464,6 +464,102 @@ void lttvwindow_unregister_traceset_notify(Tab *tab, lttv_hooks_remove_data(tmp, hook, hook_data); } +/** + * Function to register a hook function for a viewer be completely redrawn. + * + * @param tab viewer's tab + * @param hook hook function of the viewer. + * @param hook_data hook data associated with the hook function. + */ + +void lttvwindow_register_redraw_notify(Tab *tab, + LttvHook hook, gpointer hook_data) +{ + LttvAttributeValue value; + LttvHooks * tmp; + g_assert(lttv_iattribute_find_by_path(tab->attributes, + "hooks/redraw", LTTV_POINTER, &value)); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL){ + tmp = lttv_hooks_new(); + *(value.v_pointer) = tmp; + } + lttv_hooks_add(tmp, hook, hook_data, LTTV_PRIO_DEFAULT); +} + + +/** + * Function to unregister a hook function for a viewer be completely redrawn. + * + * @param tab viewer's tab + * @param hook hook function of the viewer. + * @param hook_data hook data associated with the hook function. + */ + +void lttvwindow_unregister_redraw_notify(Tab *tab, + LttvHook hook, gpointer hook_data) +{ + LttvAttributeValue value; + LttvHooks * tmp; + g_assert(lttv_iattribute_find_by_path(tab->attributes, + "hooks/redraw", LTTV_POINTER, &value)); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL) return; + lttv_hooks_remove_data(tmp, hook, hook_data); +} + +/** + * Function to register a hook function for a viewer to re-do the events + * requests for the needed interval. + * + * This action is typically done after a "stop". + * + * The typical hook will remove all current requests for the viewer + * and make requests for missing information. + * + * @param tab viewer's tab + * @param hook hook function of the viewer. + * @param hook_data hook data associated with the hook function. + */ + +void lttvwindow_register_continue_notify(Tab *tab, + LttvHook hook, gpointer hook_data) +{ + LttvAttributeValue value; + LttvHooks * tmp; + g_assert(lttv_iattribute_find_by_path(tab->attributes, + "hooks/continue", LTTV_POINTER, &value)); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL){ + tmp = lttv_hooks_new(); + *(value.v_pointer) = tmp; + } + lttv_hooks_add(tmp, hook, hook_data, LTTV_PRIO_DEFAULT); +} + + +/** + * Function to unregister a hook function for a viewer to re-do the events + * requests for the needed interval. + * + * @param tab viewer's tab + * @param hook hook function of the viewer. + * @param hook_data hook data associated with the hook function. + */ + +void lttvwindow_unregister_continue_notify(Tab *tab, + LttvHook hook, gpointer hook_data) +{ + LttvAttributeValue value; + LttvHooks * tmp; + g_assert(lttv_iattribute_find_by_path(tab->attributes, + "hooks/continue", LTTV_POINTER, &value)); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL) return; + lttv_hooks_remove_data(tmp, hook, hook_data); +} + + /** * Function to register a hook function for a viewer to set/update its * filter. diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h index 83a67d02..785a22f4 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h @@ -400,6 +400,60 @@ void lttvwindow_unregister_traceset_notify(Tab *tab, gpointer hook_data); +/** + * Function to register a hook function for a viewer be completely redrawn. + * + * @param tab viewer's tab + * @param hook hook function of the viewer. + * @param hook_data hook data associated with the hook function. + */ + +void lttvwindow_register_redraw_notify(Tab *tab, + LttvHook hook, gpointer hook_data); + +/** + * Function to unregister a hook function for a viewer be completely redrawn. + * + * @param tab viewer's tab + * @param hook hook function of the viewer. + * @param hook_data hook data associated with the hook function. + */ + +void lttvwindow_unregister_redraw_notify(Tab *tab, + LttvHook hook, gpointer hook_data); + + +/** + * Function to register a hook function for a viewer to re-do the events + * requests for the needed interval. + * + * This action is typically done after a "stop". + * + * The typical hook will remove all current requests for the viewer + * and make requests for missing information. + * + * @param tab viewer's tab + * @param hook hook function of the viewer. + * @param hook_data hook data associated with the hook function. + */ + +void lttvwindow_register_continue_notify(Tab *tab, + LttvHook hook, gpointer hook_data); + + +/** + * Function to unregister a hook function for a viewer to re-do the events + * requests for the needed interval. + * + * @param tab viewer's tab + * @param hook hook function of the viewer. + * @param hook_data hook data associated with the hook function. + */ + +void lttvwindow_unregister_continue_notify(Tab *tab, + LttvHook hook, gpointer hook_data); + + /** * Function to register a hook function for a viewer to set/update its * filter. diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am index fbaef594..eb375f40 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/Makefile.am @@ -21,4 +21,7 @@ EXTRA_DIST = \ remove1.png\ stock_zoom_fit_24.png\ stock_zoom_in_24.png\ - stock_zoom_out_24.png + stock_zoom_out_24.png\ + stock_stop_24.png\ + stock_redo_24.png\ + stock_refresh_24.png diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_redo_24.png b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_redo_24.png new file mode 100644 index 00000000..9a5ef573 Binary files /dev/null and b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_redo_24.png differ diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_refresh_24.png b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_refresh_24.png new file mode 100644 index 00000000..c7e691b9 Binary files /dev/null and b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_refresh_24.png differ diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_stop_24.png b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_stop_24.png new file mode 100644 index 00000000..89c21249 Binary files /dev/null and b/ltt/branches/poly/lttv/modules/gui/lttvwindow/pixmaps/stock_stop_24.png differ