diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-02-10 14:23:47 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-10 14:23:47 -0500 |
commit | e0b069a3dc344154c22c2c5ab825e1aab22907a8 (patch) | |
tree | 8c03979f75134ea135d3a2e1132870efeb06de96 | |
parent | 586385934cd776e268042c9061c6edbe129a0977 (diff) |
trace-graph: Add popup menu to remove plot
Add a way to remove a plot.
Todo:
Add warning to remove plot
Add ways to get back CPU plots
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-graph.c | 31 | ||||
-rw-r--r-- | trace-graph.h | 2 |
2 files changed, 33 insertions, 0 deletions
diff --git a/trace-graph.c b/trace-graph.c index dee08f4..f1dcf0c 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -430,6 +430,20 @@ plot_task_clicked (gpointer data) | |||
430 | update_label_window(ginfo); | 430 | update_label_window(ginfo); |
431 | } | 431 | } |
432 | 432 | ||
433 | static void | ||
434 | remove_plot_clicked (gpointer data) | ||
435 | { | ||
436 | struct graph_info *ginfo = data; | ||
437 | int p = ginfo->plot_clicked; | ||
438 | |||
439 | if (p < 0) | ||
440 | return; | ||
441 | |||
442 | trace_graph_plot_remove(ginfo, p); | ||
443 | redraw_graph(ginfo); | ||
444 | update_label_window(ginfo); | ||
445 | } | ||
446 | |||
433 | static gboolean | 447 | static gboolean |
434 | do_pop_up(GtkWidget *widget, GdkEventButton *event, gpointer data) | 448 | do_pop_up(GtkWidget *widget, GdkEventButton *event, gpointer data) |
435 | { | 449 | { |
@@ -440,6 +454,7 @@ do_pop_up(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
440 | static GtkWidget *menu_filter_hide_task; | 454 | static GtkWidget *menu_filter_hide_task; |
441 | static GtkWidget *menu_filter_clear_tasks; | 455 | static GtkWidget *menu_filter_clear_tasks; |
442 | static GtkWidget *menu_plot_task; | 456 | static GtkWidget *menu_plot_task; |
457 | static GtkWidget *menu_remove_plot; | ||
443 | struct record *record = NULL; | 458 | struct record *record = NULL; |
444 | struct graph_plot *plot; | 459 | struct graph_plot *plot; |
445 | const char *comm; | 460 | const char *comm; |
@@ -494,6 +509,14 @@ do_pop_up(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
494 | G_CALLBACK (plot_task_clicked), | 509 | G_CALLBACK (plot_task_clicked), |
495 | data); | 510 | data); |
496 | 511 | ||
512 | menu_remove_plot = gtk_menu_item_new_with_label("Remove Plot"); | ||
513 | gtk_menu_shell_append(GTK_MENU_SHELL (menu), menu_remove_plot); | ||
514 | gtk_widget_show(menu_remove_plot); | ||
515 | |||
516 | g_signal_connect_swapped (G_OBJECT (menu_remove_plot), "activate", | ||
517 | G_CALLBACK (remove_plot_clicked), | ||
518 | data); | ||
519 | |||
497 | } | 520 | } |
498 | 521 | ||
499 | if (ginfo->filter_enabled) | 522 | if (ginfo->filter_enabled) |
@@ -516,15 +539,23 @@ do_pop_up(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
516 | 539 | ||
517 | time = convert_x_to_time(ginfo, x); | 540 | time = convert_x_to_time(ginfo, x); |
518 | 541 | ||
542 | ginfo->plot_clicked = -1; | ||
543 | |||
519 | for (i = 0; i < ginfo->plots; i++) { | 544 | for (i = 0; i < ginfo->plots; i++) { |
520 | if (y >= (PLOT_TOP(i) - PLOT_GIVE) && | 545 | if (y >= (PLOT_TOP(i) - PLOT_GIVE) && |
521 | y <= (PLOT_BOTTOM(i) + PLOT_GIVE)) { | 546 | y <= (PLOT_BOTTOM(i) + PLOT_GIVE)) { |
522 | plot = ginfo->plot_array[i]; | 547 | plot = ginfo->plot_array[i]; |
523 | record = trace_graph_plot_find_record(ginfo, plot, time); | 548 | record = trace_graph_plot_find_record(ginfo, plot, time); |
549 | ginfo->plot_clicked = i; | ||
524 | break; | 550 | break; |
525 | } | 551 | } |
526 | } | 552 | } |
527 | 553 | ||
554 | if (ginfo->plot_clicked < 0) | ||
555 | gtk_widget_set_sensitive(menu_remove_plot, FALSE); | ||
556 | else | ||
557 | gtk_widget_set_sensitive(menu_remove_plot, TRUE); | ||
558 | |||
528 | if (record) { | 559 | if (record) { |
529 | 560 | ||
530 | if (!trace_graph_check_sched_switch(ginfo, record, &pid, &comm)) { | 561 | if (!trace_graph_check_sched_switch(ginfo, record, &pid, &comm)) { |
diff --git a/trace-graph.h b/trace-graph.h index a2f3183..88680b9 100644 --- a/trace-graph.h +++ b/trace-graph.h | |||
@@ -119,6 +119,8 @@ struct graph_info { | |||
119 | gint last_x; /* last x seen while moving mouse */ | 119 | gint last_x; /* last x seen while moving mouse */ |
120 | gboolean line_active; /* set when button is pressed */ | 120 | gboolean line_active; /* set when button is pressed */ |
121 | 121 | ||
122 | gint plot_clicked; /* plot that was clicked on */ | ||
123 | |||
122 | gdouble hadj_value; /* value to set hadj width */ | 124 | gdouble hadj_value; /* value to set hadj width */ |
123 | gdouble hadj_page_size; /* visible size to set hadj */ | 125 | gdouble hadj_page_size; /* visible size to set hadj */ |
124 | 126 | ||