[Pioneers-commits] r30 - in trunk: client/gtk common/gtk

kemm at garage.maemo.org kemm at garage.maemo.org
Sun Mar 23 00:01:55 EET 2008


Author: kemm
Date: 2008-03-23 00:01:53 +0200 (Sun, 23 Mar 2008)
New Revision: 30

Modified:
   trunk/client/gtk/gui.c
   trunk/common/gtk/guimap.c
   trunk/common/gtk/guimap.h
Log:
* Make map scrollable
* Increase minimum hex radius from 3 to 15



Modified: trunk/client/gtk/gui.c
===================================================================
--- trunk/client/gtk/gui.c	2008-03-15 22:59:12 UTC (rev 29)
+++ trunk/client/gtk/gui.c	2008-03-22 22:01:53 UTC (rev 30)
@@ -572,6 +572,7 @@
 {
 	GtkWidget *lbl;
     GtkWidget *panel;
+    GtkWidget *scrollable;
 
 	map_notebook = gtk_notebook_new();
 	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(map_notebook), GTK_POS_TOP);
@@ -580,8 +581,12 @@
 	/* Tab page name */
 	lbl = gtk_label_new(_("Map"));
 	gtk_widget_show(lbl);
+    scrollable = gtk_scrolled_window_new(NULL, NULL);
+    gtk_widget_show(scrollable);
+    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollable), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollable), build_map_area());
 	gtk_notebook_insert_page(GTK_NOTEBOOK(map_notebook),
-				 build_map_area(), lbl, MAP_PAGE);
+				 scrollable, lbl, MAP_PAGE);
 
     /* Tab page name */
     lbl = gtk_label_new(_("Chat"));

Modified: trunk/common/gtk/guimap.c
===================================================================
--- trunk/common/gtk/guimap.c	2008-03-15 22:59:12 UTC (rev 29)
+++ trunk/common/gtk/guimap.c	2008-03-22 22:01:53 UTC (rev 30)
@@ -960,13 +960,13 @@
 	const gint reserved_height = 0;
 	gint width_radius;
 	gint height_radius;
-	width_radius = (width - reserved_width)
-	    / ((gmap->map->x_size * 2 + 1
-		- gmap->map->shrink_left
-		- gmap->map->shrink_right) * cos(M_PI / 6.0));
-	height_radius = (height - reserved_height)
-	    / ((gmap->map->y_size - 1)
-	       * (sin(M_PI / 6.0) + 1) + 2);
+    width_radius = (width - reserved_width)
+        / ((gmap->map->x_size * 2 + 1
+            - gmap->map->shrink_left
+            - gmap->map->shrink_right) * cos(M_PI / 6.0));
+    height_radius = (height - reserved_height)
+        / ((gmap->map->y_size - 1)
+           * (sin(M_PI / 6.0) + 1) + 2);
 
 	if (width_radius < height_radius)
 		guimap_scale_with_radius(gmap, width_radius);
@@ -978,6 +978,7 @@
 
 	gmap->width = width;
 	gmap->height = height;
+
 }
 
 static void build_hex_region(GuiMap * gmap)
@@ -1038,6 +1039,12 @@
 		g_object_unref(gmap->gc);
 	}
 
+    if (gmap->hex_radius < MIN_HEX_RADIUS)
+        gmap->hex_radius = MIN_HEX_RADIUS;
+
+    guimap_scale_with_radius(gmap, gmap->hex_radius);
+    gtk_widget_set_size_request(gmap->area, gmap->width, gmap->height);
+
 	gmap->gc = gdk_gc_new(gmap->pixmap);
 	build_hex_region(gmap);
 

Modified: trunk/common/gtk/guimap.h
===================================================================
--- trunk/common/gtk/guimap.h	2008-03-15 22:59:12 UTC (rev 29)
+++ trunk/common/gtk/guimap.h	2008-03-22 22:01:53 UTC (rev 30)
@@ -27,7 +27,7 @@
 #include <gtk/gtk.h>
 
 #define MAX_POINTS 32		/* maximum points in a polygon */
-#define MIN_HEX_RADIUS 3	/* minimum hex_radius */
+#define MIN_HEX_RADIUS 15	/* minimum hex_radius */
 
 typedef enum {
 	NO_CURSOR,



More information about the Pioneers-commits mailing list