if(t1.tv_sec > MAX_TV_SEC_TO_DOUBLE)
g_warning("Precision loss in conversion LttTime to double");
#endif //EXTRA_CHECK
- return ((double)t1.tv_sec * NANOSECONDS_PER_SECOND) + (double)t1.tv_nsec;
+ return ((double)t1.tv_sec * (double)NANOSECONDS_PER_SECOND) + (double)t1.tv_nsec;
}
g_debug("x is : %i, x+width is : %i", x, x+width);
convert_pixels_to_time(drawing->width, x,
- time_window.start_time,
- time_window.time_width,
- window_end,
+ time_window,
&start);
convert_pixels_to_time(drawing->width, x+width,
- time_window.start_time,
- time_window.time_width,
- window_end,
+ time_window,
&time_end);
lttvwindow_events_request_remove_all(tab,
cfd->drawing->last_start = events_request->start_time;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- end_time,
+ time_window,
events_request->start_time,
width,
&x);
#if 0
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- window_end,
+ time_window,
cfd->drawing->last_start,
drawing->width,
&x);
#endif //0
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- window_end,
+ time_window,
end_time,
drawing->width,
&x_end);
{
/* Draw the dotted lines */
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- window_end,
+ time_window,
current_time,
drawing->width,
&cursor_x);
g_debug("x click is : %f", event->x);
convert_pixels_to_time(drawing->width, (guint)event->x,
- time_window.start_time,
- time_window.time_width,
- window_end,
+ time_window,
&time);
lttvwindow_report_current_time(control_flow_data->tab, time);
__inline void convert_pixels_to_time(
gint width,
guint x,
- LttTime window_time_begin,
- LttTime window_time_interval,
- LttTime window_time_end,
+ TimeWindow time_window,
LttTime *time)
{
double time_d;
- time_d = ltt_time_to_double(window_time_interval);
+ time_d = time_window.time_width_double;
time_d = time_d / (double)width * (double)x;
*time = ltt_time_from_double(time_d);
- *time = ltt_time_add(window_time_begin, *time);
+ *time = ltt_time_add(time_window.start_time, *time);
}
__inline void convert_time_to_pixels(
- LttTime window_time_begin,
- LttTime window_time_interval,
- LttTime window_time_end,
+ TimeWindow time_window,
LttTime time,
int width,
guint *x)
{
- double time_d, interval_d;
+ double time_d;
#ifdef EXTRA_CHECK
g_assert(ltt_time_compare(window_time_begin, time) <= 0 &&
ltt_time_compare(window_time_end, time) >= 0);
#endif //EXTRA_CHECK
- time = ltt_time_sub(time, window_time_begin);
+ time = ltt_time_sub(time, time_window.start_time);
time_d = ltt_time_to_double(time);
- interval_d = ltt_time_to_double(window_time_interval);
- if(interval_d == 0.0) {
+ if(time_window.time_width_double == 0.0) {
g_assert(time_d == 0.0);
*x = 0;
} else {
- *x = (guint)(time_d / interval_d * (double)width);
+ *x = (guint)(time_d / time_window.time_width_double * (double)width);
}
}
__inline void convert_pixels_to_time(
gint width,
guint x,
- LttTime window_time_begin,
- LttTime window_time_interval,
- LttTime window_time_end,
+ TimeWindow time_window,
LttTime *time);
__inline void convert_time_to_pixels(
- LttTime window_time_begin,
- LttTime window_time_interval,
- LttTime window_time_end,
+ TimeWindow time_window,
LttTime time,
gint width,
guint *x);
lttvwindow_get_time_window(control_flow_data->tab);
LttTime end_time = time_window.end_time;
-
+#ifdef EXTRA_CHECK
if(ltt_time_compare(evtime, time_window.start_time) == -1
|| ltt_time_compare(evtime, end_time) == 1)
return;
+#endif //EXTRA_CHECK
guint width = drawing->width;
/* we are in a schedchange, before the state update. We must draw the
{
guint x;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- end_time,
+ time_window,
evtime,
width,
&x);
guint x;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- end_time,
+ time_window,
evtime,
width,
&x);
LttTime time = ltt_event_time(e);
- LttTime window_end = ltt_time_add(time_window.time_width,
- time_window.start_time);
-
+ LttTime window_end = time_window.end_time;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- window_end,
+ time_window,
time,
width,
&x);
LttTime end_time = time_window.end_time;
+#ifdef EXTRA_CHECK
if(ltt_time_compare(evtime, time_window.start_time) == -1
|| ltt_time_compare(evtime, end_time) == 1)
return;
+#endif //EXTRA_CHECK
guint width = control_flow_data->drawing->width;
guint new_x;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- end_time,
+ time_window,
evtime,
width,
&new_x);
//LttTime time = ltt_event_time(e);
- //LttTime window_end = ltt_time_add(time_window->time_width,
- // time_window->start_time);
+ //LttTime window_end = time_window->end_time;
//convert_time_to_pixels(
- // time_window->start_time,
- // time_window.time_width,
- // window_end,
+ // *time_window,
// time,
// width,
// &x);
LttTime end_time = time_window.end_time;
+#ifdef EXTRA_CHECK
if(ltt_time_compare(evtime, time_window.start_time) == -1
|| ltt_time_compare(evtime, end_time) == 1)
return;
+#endif //EXTRA_CHECK
guint width = drawing->width;
guint x;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- end_time,
+ time_window,
evtime,
width,
&x);
LttTime end_time = time_window.end_time;
+#ifdef EXTRA_CHECK
if(ltt_time_compare(evtime, time_window.start_time) == -1
|| ltt_time_compare(evtime, end_time) == 1)
return;
+#endif //EXTRA_CHECK
guint width = control_flow_data->drawing->width;
guint new_x;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- end_time,
+ time_window,
evtime,
width,
&new_x);
LttTime end_time = time_window.end_time;
+#ifdef EXTRA_CHECK
if(ltt_time_compare(evtime, time_window.start_time) == -1
|| ltt_time_compare(evtime, end_time) == 1)
return;
+#endif //EXTRA_CHECK
guint width = control_flow_data->drawing->width;
guint x;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- end_time,
+ time_window,
evtime,
width,
&x);
LttTime end_time = time_window.end_time;
+#ifdef EXTRA_CHECK
if(ltt_time_compare(evtime, time_window.start_time) == -1
|| ltt_time_compare(evtime, end_time) == 1)
return;
+#endif //EXTRA_CHECK
guint width = control_flow_data->drawing->width;
guint new_x;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- end_time,
+ time_window,
evtime,
width,
&new_x);
guint new_x;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- end_time,
+ time_window,
evtime,
width,
&new_x);
guint x = 0;
guint width = control_flow_data->drawing->width;
convert_time_to_pixels(
- *os,
- *ow,
- old_end,
+ *old_time_window,
*ns,
width,
&x);
guint x = 0;
guint width = control_flow_data->drawing->width;
convert_time_to_pixels(
- *ns,
- *nw,
- new_end,
+ *new_time_window,
*os,
width,
&x);
new_time_window.start_time = time_begin;
new_time_window.time_width = width;
+ new_time_window.time_width_double = ltt_time_to_double(width);
new_time_window.end_time = ltt_time_add(time_begin, width);
lttvwindow_report_time_window(control_flow_data->tab, new_time_window);
new_time_window.start_time = time_begin;
new_time_window.time_width = width;
+ new_time_window.time_width_double = ltt_time_to_double(width);
new_time_window.end_time = ltt_time_add(time_begin, width);
lttvwindow_report_time_window(control_flow_data->tab, new_time_window);
LttTime end_time = time_window.end_time;
+#ifdef EXTRA_CHECK
if(ltt_time_compare(evtime, time_window.start_time) == -1
|| ltt_time_compare(evtime, end_time) == 1)
return;
+#endif //EXTRA_CHECK
guint width = drawing->width;
guint x;
convert_time_to_pixels(
- time_window.start_time,
- time_window.time_width,
- end_time,
+ time_window,
evtime,
width,
&x);
tmp_time.tv_sec = time_span.end_time.tv_sec;
tmp_time.tv_nsec = 0;
new_time_window.time_width = tmp_time ;
+ new_time_window.time_width_double = ltt_time_to_double(tmp_time);
new_time_window.end_time = ltt_time_add(new_time_window.start_time,
new_time_window.time_width) ;
}
if(size == 0){
new_time_window.start_time = time_span.start_time;
new_time_window.time_width = time_delta;
+ new_time_window.time_width_double = ltt_time_to_double(time_delta);
new_time_window.end_time = ltt_time_add(new_time_window.start_time,
new_time_window.time_width) ;
}else{
new_time_window.time_width = ltt_time_div(new_time_window.time_width, size);
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
if(ltt_time_compare(new_time_window.time_width,time_delta) > 0)
{ /* Case where zoom out is bigger than trace length */
new_time_window.start_time = time_span.start_time;
new_time_window.time_width = time_delta;
+ new_time_window.time_width_double = ltt_time_to_double(time_delta);
new_time_window.end_time = ltt_time_add(new_time_window.start_time,
new_time_window.time_width) ;
}
{
/* Center the image on the current time */
new_time_window.start_time =
- ltt_time_sub(current_time, ltt_time_div(new_time_window.time_width, 2.0));
+ ltt_time_sub(current_time,
+ ltt_time_from_double(new_time_window.time_width_double/2.0));
new_time_window.end_time = ltt_time_add(new_time_window.start_time,
new_time_window.time_width) ;
/* If on borders, don't fall off */
"upper",
ltt_time_to_double(upper), /* upper */
"step_increment",
- ltt_time_to_double(new_time_window.time_width)
+ new_time_window.time_width_double
/ SCROLL_STEP_PER_PAGE, /* step increment */
"page_increment",
- ltt_time_to_double(new_time_window.time_width),
+ new_time_window.time_width_double,
/* page increment */
"page_size",
- ltt_time_to_double(new_time_window.time_width), /* page size */
+ new_time_window.time_width_double, /* page size */
NULL);
gtk_adjustment_changed(adjustment);
/* Fix the time width to fit start time and end time */
new_time_window.time_width = ltt_time_sub(end_time,
new_time_window.start_time);
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
+
new_time_window.end_time = end_time;
time_change_manager(tab, new_time_window);
/* Fix the time width to fit start time and end time */
new_time_window.time_width = ltt_time_sub(end_time,
new_time_window.start_time);
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
new_time_window.end_time = end_time;
/* Fix the time width to fit start time and end time */
new_time_window.time_width = ltt_time_sub(end_time,
new_time_window.start_time);
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
new_time_window.end_time = end_time;
/* Fix the time width to fit start time and end time */
new_time_window.time_width = ltt_time_sub(end_time,
new_time_window.start_time);
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
new_time_window.end_time = end_time;
time_change_manager(tab, new_time_window);
new_time_window.time_width =
ltt_time_from_double(page_size);
+ new_time_window.time_width_double =
+ page_size;
+
new_time_window.end_time = ltt_time_add(new_time_window.start_time,
new_time_window.time_width);
struct _TimeWindow {
LttTime start_time;
LttTime time_width;
+ double time_width_double;
LttTime end_time;
};