]> git.street.me.uk Git - andy/viking.git/blobdiff - src/util.c
Use the last selected date when initializing the date search.
[andy/viking.git] / src / util.c
index d7a726c6fc586285052d25e1dd9d8f443dbe513f..ee84287041970b7d5367843eec9f1d2cfb68e5e7 100644 (file)
  *    along with this program; if not, write to the Free Software
  *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
  *    along with this program; if not, write to the Free Software
  *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
+ /*
+  * Ideally dependencies should just be on Glib, Gtk,
+  * see vikutils for things that further depend on other Viking types
+  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
+#include <glib/gstdio.h>
 #include <glib/gi18n.h>
 #include <glib/gprintf.h>
 
 #include <glib/gi18n.h>
 #include <glib/gprintf.h>
 
@@ -157,29 +162,3 @@ gboolean split_string_from_file_on_equals ( const gchar *buf, gchar **key, gchar
 
   return TRUE;
 }
 
   return TRUE;
 }
-
-/* 1 << (x) is like a 2**(x) */
-#define GZ(x) (1<<(x))
-
-static const gdouble scale_mpps[] = { 0.125, 0.25, 0.5, GZ(0), GZ(1), GZ(2), GZ(3), GZ(4), GZ(5), GZ(6), GZ(7), GZ(8), GZ(9),
-                                      GZ(10), GZ(11), GZ(12), GZ(13), GZ(14), GZ(15), GZ(16), GZ(17) };
-
-static const gint num_scales = (sizeof(scale_mpps) / sizeof(scale_mpps[0]));
-
-#define ERROR_MARGIN 0.01
-/**
- * mpp_to_zoom:
- *
- * Returns: a zoom level. see : http://wiki.openstreetmap.org/wiki/Zoom_levels
- */
-guint8 mpp_to_zoom ( gdouble mpp )
-{
-  gint i;
-  for ( i = 0; i < num_scales; i++ ) {
-    if ( ABS(scale_mpps[i] - mpp) < ERROR_MARGIN ) {
-      g_debug ( "mpp_to_zoom: %f -> %d", mpp, i );
-      return 20-i;
-    }
-  }
-  return 17; // a safe zoomed in default
-}