]> git.street.me.uk Git - andy/viking.git/blobdiff - src/vikcoordlayer.c
[QA] Shift Gtk dependent utility functions into separate file.
[andy/viking.git] / src / vikcoordlayer.c
index 85c13be181a0a62f3b82bf1dc62b5160319ef211..40c0cf4a144e48c6aa70da8c0c3c8b860c353686 100644 (file)
@@ -30,7 +30,7 @@
 #include "viking.h"
 #include "icons/icons.h"
 
-static VikCoordLayer *coord_layer_new ( );
+static VikCoordLayer *coord_layer_new ( VikViewport *vp );
 static void coord_layer_draw ( VikCoordLayer *vcl, VikViewport *vp );
 static void coord_layer_free ( VikCoordLayer *vcl );
 static VikCoordLayer *coord_layer_create ( VikViewport *vp );
@@ -39,6 +39,7 @@ static VikCoordLayer *coord_layer_unmarshall( guint8 *data, gint len, VikViewpor
 static gboolean coord_layer_set_param ( VikCoordLayer *vcl, guint16 id, VikLayerParamData data, VikViewport *vp, gboolean is_file_operation );
 static VikLayerParamData coord_layer_get_param ( VikCoordLayer *vcl, guint16 id, gboolean is_file_operation );
 static void coord_layer_post_read ( VikLayer *vl, VikViewport *vp, gboolean from_file );
+static void coord_layer_update_gc ( VikCoordLayer *vcl, VikViewport *vp );
 
 static VikLayerParamScale param_scales[] = {
   { 0.05, 60.0, 0.25, 10 },
@@ -102,6 +103,7 @@ VikLayerInterface vik_coord_layer_interface = {
 
   (VikLayerFuncSetParam)                coord_layer_set_param,
   (VikLayerFuncGetParam)                coord_layer_get_param,
+  (VikLayerFuncChangeParam)             NULL,
 
   (VikLayerFuncReadFileData)            NULL,
   (VikLayerFuncWriteFileData)           NULL,
@@ -158,8 +160,9 @@ static void coord_layer_marshall( VikCoordLayer *vcl, guint8 **data, gint *len )
 
 static VikCoordLayer *coord_layer_unmarshall( guint8 *data, gint len, VikViewport *vvp )
 {
-  VikCoordLayer *rv = coord_layer_new ();
+  VikCoordLayer *rv = coord_layer_new ( vvp );
   vik_layer_unmarshall_params ( VIK_LAYER(rv), data, len, vvp );
+  coord_layer_update_gc ( rv, vvp );
   return rv;
 }
 
@@ -171,6 +174,7 @@ gboolean coord_layer_set_param ( VikCoordLayer *vcl, guint16 id, VikLayerParamDa
     case PARAM_COLOR: vcl->color = data.c; break;
     case PARAM_MIN_INC: vcl->deg_inc = data.d / 60.0; break;
     case PARAM_LINE_THICKNESS: if ( data.u >= 1 && data.u <= 15 ) vcl->line_thickness = data.u; break;
+    default: break;
   }
   return TRUE;
 }
@@ -183,6 +187,7 @@ static VikLayerParamData coord_layer_get_param ( VikCoordLayer *vcl, guint16 id,
     case PARAM_COLOR: rv.c = vcl->color; break;
     case PARAM_MIN_INC: rv.d = vcl->deg_inc * 60.0; break;
     case PARAM_LINE_THICKNESS: rv.i = vcl->line_thickness; break;
+    default: break;
   }
   return rv;
 }