X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2FmainWin%2Fsrc%2Fgtkcustom.c;h=806ac23100fbda0e03953960830c43be36ecad88;hb=308711e5772586ce8ecc22ce04e571b175309b8e;hp=491e730c5c781fe9f777ebe5155c031824123b22;hpb=b782dd11ec8e363e135b32a563687a8e4f70bedb;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 491e730c..806ac231 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkcustom.c +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkcustom.c @@ -107,7 +107,6 @@ void gtk_custom_widget_add(GtkCustom * custom, GtkWidget * widget1) GtkWidget * w; TimeWindow Time_Window; LttTime time; - double tmpValue; TimeInterval *Time_Span; g_return_if_fail(GTK_IS_CUSTOM(custom)); @@ -126,30 +125,19 @@ void gtk_custom_widget_add(GtkCustom * custom, GtkWidget * widget1) GetCurrentTime(custom->mw,&time); Time_Span = LTTV_TRACESET_CONTEXT(custom->mw->Traceset_Info->TracesetContext)->Time_Span ; - tmpValue = Time_Span->startTime.tv_sec; - tmpValue *= NANSECOND_CONST; - tmpValue += Time_Span->startTime.tv_nsec; - custom->hAdjust->lower = tmpValue; - custom->hAdjust->value = tmpValue; - tmpValue = Time_Span->endTime.tv_sec; - tmpValue *= NANSECOND_CONST; - tmpValue += Time_Span->endTime.tv_nsec; - custom->hAdjust->upper = tmpValue; - //tmpValue = time.tv_sec; - //tmpValue *= NANSECOND_CONST; - //tmpValue += time.tv_nsec; - //custom->hAdjust->value = tmpValue; - /* Step increment to 1/10 of visible area */ - tmpValue = Time_Window.Time_Width.tv_sec; - tmpValue *= NANSECOND_CONST; - tmpValue += Time_Window.Time_Width.tv_nsec; - custom->hAdjust->step_increment = tmpValue / 10; + custom->hAdjust->lower = ltt_time_to_double(Time_Span->startTime) * + NANOSECONDS_PER_SECOND; + custom->hAdjust->value = custom->hAdjust->lower; + custom->hAdjust->upper = ltt_time_to_double(Time_Span->endTime) * + NANOSECONDS_PER_SECOND; /* Page increment of whole visible area */ - custom->hAdjust->page_increment = tmpValue; + custom->hAdjust->page_increment = ltt_time_to_double( + Time_Window.Time_Width) * NANOSECONDS_PER_SECOND; /* 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 = tmpValue; + custom->hAdjust->page_size = custom->hAdjust->page_increment; + custom->hAdjust->step_increment = custom->hAdjust->page_increment / 10; gtk_range_set_update_policy (GTK_RANGE(custom->hScrollbar), GTK_UPDATE_DISCONTINUOUS); @@ -320,8 +308,7 @@ void gtk_custom_scroll_value_changed(GtkRange *range, gpointer custom_arg) LttTime time; GtkCustom * custom = (GtkCustom*)custom_arg; gdouble value = gtk_range_get_value(range); - time.tv_sec = value / NANSECOND_CONST; - time.tv_nsec = (value / NANSECOND_CONST - time.tv_sec) * NANSECOND_CONST; + time = ltt_time_from_double(value / NANOSECONDS_PER_SECOND); SetCurrentTime(custom->mw, &time); g_warning("The current time is second :%d, nanosecond : %d\n", time.tv_sec, time.tv_nsec); }