diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2010-04-06 17:23:42 -0400 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2010-04-09 11:56:19 -0400 |
| commit | 76654897a4e4c222871dda9ff487be0e72be6a9b (patch) | |
| tree | fd2aeccb90b3738132384bab9ca8e80fb2ee1e20 | |
| parent | 608ee7934adf2ade0c1504ee030ab6f6a35be9e0 (diff) | |
trace-graph: Add tool tip about zooming
Show tip window to explain how to zoom in and out on the graph.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
| -rw-r--r-- | trace-graph.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/trace-graph.c b/trace-graph.c index cab3647..27c139d 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
| @@ -766,7 +766,25 @@ do_pop_up(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
| 766 | return TRUE; | 766 | return TRUE; |
| 767 | } | 767 | } |
| 768 | 768 | ||
| 769 | static void button_press(struct graph_info *ginfo, gint x, guint state) | 769 | static void draw_info_box(struct graph_info *ginfo, const gchar *buffer, |
| 770 | gint x, gint y); | ||
| 771 | |||
| 772 | static void stop_zoom_tip(struct graph_info *ginfo) | ||
| 773 | { | ||
| 774 | clear_info_box(ginfo); | ||
| 775 | } | ||
| 776 | |||
| 777 | static void show_zoom_tip(struct graph_info *ginfo, gint x, gint y) | ||
| 778 | { | ||
| 779 | clear_info_box(ginfo); | ||
| 780 | |||
| 781 | draw_info_box(ginfo, | ||
| 782 | "Click and hold left mouse and drag right to zoom in\n" | ||
| 783 | "Click and hold left mouse and drag left to zoom out", | ||
| 784 | x, y); | ||
| 785 | } | ||
| 786 | |||
| 787 | static void button_press(struct graph_info *ginfo, gint x, gint y, guint state) | ||
| 770 | { | 788 | { |
| 771 | ginfo->press_x = x; | 789 | ginfo->press_x = x; |
| 772 | ginfo->last_x = 0; | 790 | ginfo->last_x = 0; |
| @@ -785,8 +803,10 @@ static void button_press(struct graph_info *ginfo, gint x, guint state) | |||
| 785 | clear_line(ginfo, convert_time_to_x(ginfo, ginfo->marka_time)); | 803 | clear_line(ginfo, convert_time_to_x(ginfo, ginfo->marka_time)); |
| 786 | update_marka(ginfo, x); | 804 | update_marka(ginfo, x); |
| 787 | } | 805 | } |
| 788 | } else | 806 | } else { |
| 789 | ginfo->zoom = TRUE; | 807 | ginfo->zoom = TRUE; |
| 808 | show_zoom_tip(ginfo, x, y); | ||
| 809 | } | ||
| 790 | 810 | ||
| 791 | return; | 811 | return; |
| 792 | } | 812 | } |
| @@ -826,7 +846,7 @@ button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
| 826 | return TRUE; | 846 | return TRUE; |
| 827 | } | 847 | } |
| 828 | 848 | ||
| 829 | button_press(ginfo, event->x, event->state); | 849 | button_press(ginfo, event->x, event->y, event->state); |
| 830 | 850 | ||
| 831 | return TRUE; | 851 | return TRUE; |
| 832 | } | 852 | } |
| @@ -839,6 +859,9 @@ static void motion_plot(struct graph_info *ginfo, gint x, gint y) | |||
| 839 | { | 859 | { |
| 840 | struct graph_plot *plot; | 860 | struct graph_plot *plot; |
| 841 | 861 | ||
| 862 | if (ginfo->zoom) | ||
| 863 | stop_zoom_tip(ginfo); | ||
| 864 | |||
| 842 | if (!ginfo->curr_pixmap) | 865 | if (!ginfo->curr_pixmap) |
| 843 | return; | 866 | return; |
| 844 | 867 | ||
| @@ -876,7 +899,7 @@ info_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
| 876 | if (event->type == GDK_2BUTTON_PRESS) | 899 | if (event->type == GDK_2BUTTON_PRESS) |
| 877 | return FALSE; | 900 | return FALSE; |
| 878 | 901 | ||
| 879 | button_press(ginfo, gtk_adjustment_get_value(ginfo->hadj), event->state); | 902 | button_press(ginfo, gtk_adjustment_get_value(ginfo->hadj), event->y, event->state); |
| 880 | 903 | ||
| 881 | return FALSE; | 904 | return FALSE; |
| 882 | } | 905 | } |
| @@ -1500,7 +1523,8 @@ static void button_release(struct graph_info *ginfo, gint x) | |||
| 1500 | ginfo->show_marka = TRUE; | 1523 | ginfo->show_marka = TRUE; |
| 1501 | ginfo->show_markb = TRUE; | 1524 | ginfo->show_markb = TRUE; |
| 1502 | update_markb(ginfo, x); | 1525 | update_markb(ginfo, x); |
| 1503 | } | 1526 | } else |
| 1527 | stop_zoom_tip(ginfo); | ||
| 1504 | 1528 | ||
| 1505 | clear_line(ginfo, ginfo->last_x); | 1529 | clear_line(ginfo, ginfo->last_x); |
| 1506 | clear_line(ginfo, ginfo->press_x); | 1530 | clear_line(ginfo, ginfo->press_x); |
