X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2FmainWin%2Fsrc%2Fgtkcustom.c;h=f9b3582678f02e408bb77cbd79fec3c61e590e30;hb=35d310374287f26a707e149f2f21dd48b6aa9f59;hp=492a9ef018067e9dd72929daa98041deb0c5dad6;hpb=e17c04d2b8c97c34969eb9a912a281ae7d5738db;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkcustom.c b/ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkcustom.c index 492a9ef0..f9b35826 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkcustom.c +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkcustom.c @@ -106,6 +106,8 @@ void gtk_custom_set_adjust(GtkCustom * custom, gboolean first_time) { TimeWindow time_window; TimeInterval *time_span; + double tmp, start; + double range = 5; get_time_window(custom->mw,&time_window); if(first_time){ @@ -123,14 +125,25 @@ void gtk_custom_set_adjust(GtkCustom * custom, gboolean first_time) g_warning("Insert a viewer first"); return; } + + start = ltt_time_to_double(time_window.start_time) * NANOSECONDS_PER_SECOND; + tmp = custom->hadjust->upper - custom->hadjust->lower; + custom->hadjust->page_increment = ltt_time_to_double( time_window.time_width) * NANOSECONDS_PER_SECOND; + + if(custom->hadjust->page_increment >= tmp - range) + custom->hadjust->value = custom->hadjust->lower; + if(start + custom->hadjust->page_increment > custom->hadjust->upper - range) + custom->hadjust->value = start; + /* page_size to the whole visible area will take care that the * scroll value + the shown area will never be more than what is * in the trace. */ custom->hadjust->page_size = custom->hadjust->page_increment; custom->hadjust->step_increment = custom->hadjust->page_increment / 10; + gtk_adjustment_changed (custom->hadjust); } void gtk_custom_widget_add(GtkCustom * custom, GtkWidget * widget1)