make inline correct -> must be static
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / drawing.h
index d07ed4e771e1262fd6c15526a5d426cf3722210a..ce058111846e9ed9d9edc0a5f15b76dee3150955 100644 (file)
@@ -134,22 +134,6 @@ void drawing_remove_square(Drawing_t *drawing,
         guint y,
         guint height);
 
-__inline void convert_pixels_to_time(
-    gint width,
-    guint x,
-    LttTime window_time_begin,
-    LttTime window_time_interval,
-    LttTime window_time_end,
-    LttTime *time);
-
-__inline void convert_time_to_pixels(
-    LttTime window_time_begin,
-    LttTime window_time_interval,
-    LttTime window_time_end,
-    LttTime time,
-    gint width,
-    guint *x);
-
 void drawing_update_ruler(Drawing_t *drawing, TimeWindow *time_window);
 
 void drawing_request_expose(EventsRequest *events_request,
@@ -168,4 +152,51 @@ tree_row_activated(GtkTreeModel *treemodel,
                    GtkTreeViewColumn *arg2,
                    gpointer user_data);
 
+
+/* convert_pixels_to_time
+ *
+ * Convert from window pixel and time interval to an absolute time.
+ */
+static inline void convert_pixels_to_time(
+    gint width,
+    guint x,
+    TimeWindow time_window,
+    LttTime *time)
+{
+  double time_d;
+  
+  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(time_window.start_time, *time);
+}
+
+
+static inline void convert_time_to_pixels(
+    TimeWindow time_window,
+    LttTime time,
+    int width,
+    guint *x)
+{
+  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, time_window.start_time);
+  
+  time_d = ltt_time_to_double(time);
+  
+  if(time_window.time_width_double == 0.0) {
+    g_assert(time_d == 0.0);
+    *x = 0;
+  } else {
+    *x = (guint)(time_d / time_window.time_width_double * (double)width);
+  }
+  
+}
+
+
+
 #endif // _DRAWING_H
This page took 0.023297 seconds and 4 git commands to generate.