aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-01-08 09:25:29 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-01-08 09:25:29 -0500
commit2f8004337f24888e6f14f5f58fab30333f36bd45 (patch)
treef4a092df37623fee4f7a7573634a140dd767ab13
parent3c6228066478232d696fc7da7db2e1c7a3e29329 (diff)
trace-graph: Rename vadj to hadj since it is the horizontal adjustment
For some reason we called the horizontal adjustment of the graph vadj. Call it hadj. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-graph.c58
-rw-r--r--trace-graph.h6
2 files changed, 32 insertions, 32 deletions
diff --git a/trace-graph.c b/trace-graph.c
index e055f35..1f7668d 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -844,9 +844,9 @@ static void draw_cpu_info(struct graph_info *ginfo, gint cpu, gint x, gint y)
844 if (y > height) 844 if (y > height)
845 y -= height; 845 y -= height;
846 846
847 view_start = gtk_adjustment_get_value(ginfo->vadj); 847 view_start = gtk_adjustment_get_value(ginfo->hadj);
848 view_width = gtk_adjustment_get_page_size(ginfo->vadj); 848 view_width = gtk_adjustment_get_page_size(ginfo->hadj);
849 849
850 if (x + width > view_start + view_width) 850 if (x + width > view_start + view_width)
851 x -= (x + width) - (view_start + view_width); 851 x -= (x + width) - (view_start + view_width);
852 852
@@ -980,12 +980,12 @@ static void zoom_in_window(struct graph_info *ginfo, gint start, gint end)
980 gint old_width = ginfo->draw_width; 980 gint old_width = ginfo->draw_width;
981 981
982 g_assert(start < end); 982 g_assert(start < end);
983 g_assert(ginfo->vadj); 983 g_assert(ginfo->hadj);
984 984
985 start_time = ginfo->start_time + 985 start_time = ginfo->start_time +
986 (ginfo->start_x + start) / ginfo->resolution; 986 (ginfo->start_x + start) / ginfo->resolution;
987 987
988 view_width = gtk_adjustment_get_page_size(ginfo->vadj); 988 view_width = gtk_adjustment_get_page_size(ginfo->hadj);
989 select_width = end - start; 989 select_width = end - start;
990 percent = view_width / select_width; 990 percent = view_width / select_width;
991 991
@@ -1055,18 +1055,18 @@ static void zoom_in_window(struct graph_info *ginfo, gint start, gint end)
1055 print_time(ginfo->view_start_time); 1055 print_time(ginfo->view_start_time);
1056 dprintf(1, "\n"); 1056 dprintf(1, "\n");
1057 1057
1058 /* Adjust start to be the location for the vadj */ 1058 /* Adjust start to be the location for the hadj */
1059 start = (mid - new_start) - view_width / 2; 1059 start = (mid - new_start) - view_width / 2;
1060 } else 1060 } else
1061 start *= percent; 1061 start *= percent;
1062 1062
1063 update_graph_to_start_x(ginfo); 1063 update_graph_to_start_x(ginfo);
1064 1064
1065 ginfo->vadj_value = start; 1065 ginfo->hadj_value = start;
1066 ginfo->vadj_value = (start_time - ginfo->view_start_time) * ginfo->resolution; 1066 ginfo->hadj_value = (start_time - ginfo->view_start_time) * ginfo->resolution;
1067 1067
1068 if (ginfo->vadj_value > (ginfo->draw_width - view_width)) 1068 if (ginfo->hadj_value > (ginfo->draw_width - view_width))
1069 ginfo->vadj_value = ginfo->draw_width - view_width; 1069 ginfo->hadj_value = ginfo->draw_width - view_width;
1070 1070
1071 dprintf(1, "new width=%d\n", ginfo->draw_width); 1071 dprintf(1, "new width=%d\n", ginfo->draw_width);
1072 1072
@@ -1076,11 +1076,11 @@ static void zoom_in_window(struct graph_info *ginfo, gint start, gint end)
1076 else 1076 else
1077 gtk_widget_set_size_request(ginfo->draw, ginfo->draw_width, ginfo->draw_height); 1077 gtk_widget_set_size_request(ginfo->draw, ginfo->draw_width, ginfo->draw_height);
1078 1078
1079 dprintf(1, "set val %f\n", ginfo->vadj_value); 1079 dprintf(1, "set val %f\n", ginfo->hadj_value);
1080 1080
1081 1081
1082 dprintf(1, "*** ended with with "); 1082 dprintf(1, "*** ended with with ");
1083 print_time(ginfo->vadj_value / ginfo->resolution + ginfo->view_start_time); 1083 print_time(ginfo->hadj_value / ginfo->resolution + ginfo->view_start_time);
1084 dprintf(1, "\n"); 1084 dprintf(1, "\n");
1085 1085
1086} 1086}
@@ -1110,10 +1110,10 @@ static void zoom_out_window(struct graph_info *ginfo, gint start, gint end)
1110 gint old_width = ginfo->draw_width; 1110 gint old_width = ginfo->draw_width;
1111 1111
1112 g_assert(start > end); 1112 g_assert(start > end);
1113 g_assert(ginfo->vadj); 1113 g_assert(ginfo->hadj);
1114 1114
1115 view_width = gtk_adjustment_get_page_size(ginfo->vadj); 1115 view_width = gtk_adjustment_get_page_size(ginfo->hadj);
1116 start_x = gtk_adjustment_get_value(ginfo->vadj); 1116 start_x = gtk_adjustment_get_value(ginfo->hadj);
1117 mid = start_x + view_width / 2; 1117 mid = start_x + view_width / 2;
1118 1118
1119 time = mid / ginfo->resolution + ginfo->view_start_time; 1119 time = mid / ginfo->resolution + ginfo->view_start_time;
@@ -1168,7 +1168,7 @@ static void zoom_out_window(struct graph_info *ginfo, gint start, gint end)
1168 if (start_x < 0) 1168 if (start_x < 0)
1169 start_x = 0; 1169 start_x = 0;
1170 1170
1171 ginfo->vadj_value = start_x; 1171 ginfo->hadj_value = start_x;
1172} 1172}
1173 1173
1174static gboolean 1174static gboolean
@@ -1510,7 +1510,7 @@ static void draw_timeline(struct graph_info *ginfo, gint width)
1510 1510
1511 1511
1512 /* --- draw time at intervals --- */ 1512 /* --- draw time at intervals --- */
1513 view_width = gtk_adjustment_get_page_size(ginfo->vadj); 1513 view_width = gtk_adjustment_get_page_size(ginfo->hadj);
1514 1514
1515 for (mid = view_width / 2; mid < (width - view_width / 2 + 10); 1515 for (mid = view_width / 2; mid < (width - view_width / 2 + 10);
1516 mid += view_width / 2) { 1516 mid += view_width / 2) {
@@ -1561,7 +1561,7 @@ void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time)
1561 gint end; 1561 gint end;
1562 guint64 old_start_time = ginfo->view_start_time; 1562 guint64 old_start_time = ginfo->view_start_time;
1563 1563
1564 view_width = gtk_adjustment_get_page_size(ginfo->vadj); 1564 view_width = gtk_adjustment_get_page_size(ginfo->hadj);
1565 width = ginfo->draw_width ? : ginfo->full_width; 1565 width = ginfo->draw_width ? : ginfo->full_width;
1566 1566
1567 mid = (time - ginfo->start_time) * ginfo->resolution; 1567 mid = (time - ginfo->start_time) * ginfo->resolution;
@@ -1588,7 +1588,7 @@ void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time)
1588 if (old_start_time != ginfo->view_start_time) 1588 if (old_start_time != ginfo->view_start_time)
1589 redraw_pixmap_backend(ginfo); 1589 redraw_pixmap_backend(ginfo);
1590 1590
1591 /* Adjust start to be the location for the vadj */ 1591 /* Adjust start to be the location for the hadj */
1592 mid = (time - ginfo->view_start_time) * ginfo->resolution; 1592 mid = (time - ginfo->view_start_time) * ginfo->resolution;
1593 start = mid - view_width / 2; 1593 start = mid - view_width / 2;
1594 if (start < 0) 1594 if (start < 0)
@@ -1596,7 +1596,7 @@ void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time)
1596 1596
1597 if (start > (width - view_width)) 1597 if (start > (width - view_width))
1598 start = width - view_width; 1598 start = width - view_width;
1599 gtk_adjustment_set_value(ginfo->vadj, start); 1599 gtk_adjustment_set_value(ginfo->hadj, start);
1600 1600
1601 ginfo->last_x = (ginfo->cursor - ginfo->view_start_time) 1601 ginfo->last_x = (ginfo->cursor - ginfo->view_start_time)
1602 * ginfo->resolution; 1602 * ginfo->resolution;
@@ -1719,9 +1719,9 @@ static void redraw_pixmap_backend(struct graph_info *ginfo)
1719 g_object_unref(old_pix); 1719 g_object_unref(old_pix);
1720 } 1720 }
1721 1721
1722 if (ginfo->vadj_value) { 1722 if (ginfo->hadj_value) {
1723// gtk_adjustment_set_lower(ginfo->vadj, -100.0); 1723// gtk_adjustment_set_lower(ginfo->hadj, -100.0);
1724 gtk_adjustment_set_value(ginfo->vadj, ginfo->vadj_value); 1724 gtk_adjustment_set_value(ginfo->hadj, ginfo->hadj_value);
1725 } 1725 }
1726} 1726}
1727 1727
@@ -1735,9 +1735,9 @@ configure_event(GtkWidget *widget, GdkEventMotion *event, gpointer data)
1735 redraw_pixmap_backend(ginfo); 1735 redraw_pixmap_backend(ginfo);
1736 1736
1737 /* debug */ 1737 /* debug */
1738 ginfo->vadj_value = gtk_adjustment_get_value(ginfo->vadj); 1738 ginfo->hadj_value = gtk_adjustment_get_value(ginfo->hadj);
1739 dprintf(2, "get val %f\n", ginfo->vadj_value); 1739 dprintf(2, "get val %f\n", ginfo->hadj_value);
1740 ginfo->vadj_value = 0.0; 1740 ginfo->hadj_value = 0.0;
1741 1741
1742 return TRUE; 1742 return TRUE;
1743} 1743}
@@ -1805,7 +1805,7 @@ static void info_draw_cpu_labels(struct graph_info *ginfo)
1805 gint cpu; 1805 gint cpu;
1806#if 0 1806#if 0
1807 clear_old_cpu_labels(ginfo); 1807 clear_old_cpu_labels(ginfo);
1808 ginfo->cpu_x = gtk_adjustment_get_value(ginfo->vadj) + 5; 1808 ginfo->cpu_x = gtk_adjustment_get_value(ginfo->hadj) + 5;
1809#endif 1809#endif
1810 1810
1811 for (cpu = 0; cpu < ginfo->cpus; cpu++) 1811 for (cpu = 0; cpu < ginfo->cpus; cpu++)
@@ -1911,9 +1911,9 @@ trace_graph_create_with_callbacks(struct tracecmd_input *handle,
1911 gtk_box_pack_start(GTK_BOX (ginfo->widget), ginfo->scrollwin, TRUE, TRUE, 0); 1911 gtk_box_pack_start(GTK_BOX (ginfo->widget), ginfo->scrollwin, TRUE, TRUE, 0);
1912 1912
1913 ginfo->draw_height = CPU_SPACE(ginfo->cpus); 1913 ginfo->draw_height = CPU_SPACE(ginfo->cpus);
1914 ginfo->vadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(ginfo->scrollwin)); 1914 ginfo->hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(ginfo->scrollwin));
1915 1915
1916 gtk_signal_connect(GTK_OBJECT(ginfo->vadj), "value_changed", 1916 gtk_signal_connect(GTK_OBJECT(ginfo->hadj), "value_changed",
1917 (GtkSignalFunc) value_changed, ginfo); 1917 (GtkSignalFunc) value_changed, ginfo);
1918 1918
1919 for (cpu = 0; cpu < ginfo->cpus; cpu++) { 1919 for (cpu = 0; cpu < ginfo->cpus; cpu++) {
diff --git a/trace-graph.h b/trace-graph.h
index 36320b3..508614a 100644
--- a/trace-graph.h
+++ b/trace-graph.h
@@ -27,7 +27,7 @@ struct graph_info {
27 GtkWidget *draw; 27 GtkWidget *draw;
28 GdkPixmap *curr_pixmap; /* pixmap backstore */ 28 GdkPixmap *curr_pixmap; /* pixmap backstore */
29 GdkPixmap *info_pixmap; /* pixmap backstore */ 29 GdkPixmap *info_pixmap; /* pixmap backstore */
30 GtkAdjustment *vadj; /* scrollwindow vert adjust */ 30 GtkAdjustment *hadj; /* scrollwindow horizontal adjust */
31 guint64 start_time; /* True start time of trace */ 31 guint64 start_time; /* True start time of trace */
32 guint64 end_time; /* True end time of trace */ 32 guint64 end_time; /* True end time of trace */
33 guint64 view_start_time; /* visible start time */ 33 guint64 view_start_time; /* visible start time */
@@ -42,8 +42,8 @@ struct graph_info {
42 gint last_x; /* last x seen while moving mouse */ 42 gint last_x; /* last x seen while moving mouse */
43 gboolean line_active; /* set when button is pressed */ 43 gboolean line_active; /* set when button is pressed */
44 44
45 gdouble vadj_value; /* value to set vadj width */ 45 gdouble hadj_value; /* value to set hadj width */
46 gdouble vadj_page_size; /* visible size to set vadj */ 46 gdouble hadj_page_size; /* visible size to set hadj */
47 47
48 gint draw_width; /* width of pixmap */ 48 gint draw_width; /* width of pixmap */
49 gint draw_height; /* height of pixmap */ 49 gint draw_height; /* height of pixmap */