Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2006:
[Freeciv-Dev] (PR#16592) zooming using cairo
Home

[Freeciv-Dev] (PR#16592) zooming using cairo

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#16592) zooming using cairo
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 21 Apr 2006 23:39:06 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=16592 >

This transaction appears to have no content
Index: client/gui-gtk-2.0/menu.c
===================================================================
--- client/gui-gtk-2.0/menu.c   (revision 11877)
+++ client/gui-gtk-2.0/menu.c   (working copy)
@@ -95,6 +95,9 @@
   MENU_GOVERNMENT_WORKLISTS,
   MENU_GOVERNMENT_REVOLUTION,
 
+  MENU_VIEW_ZOOM_IN,
+  MENU_VIEW_ZOOM_OUT,
+  MENU_VIEW_ZOOM_100,
   MENU_VIEW_SHOW_CITY_OUTLINES,
   MENU_VIEW_SHOW_MAP_GRID,
   MENU_VIEW_SHOW_NATIONAL_BORDERS,
@@ -298,6 +301,21 @@
                               GtkWidget *widget)
 {
   switch(callback_action) {
+  case MENU_VIEW_ZOOM_IN:
+    cairo_scale(mapview.store->cr, 1/0.9, 1/0.9);
+    cairo_scale(mapview.tmp_store->cr, 1/0.9, 1/0.9);
+    update_map_canvas_visible();
+    break;
+  case MENU_VIEW_ZOOM_OUT:
+    cairo_scale(mapview.store->cr, 0.9, 0.9);
+    cairo_scale(mapview.tmp_store->cr, 0.9, 0.9);
+    update_map_canvas_visible();
+    break;
+  case MENU_VIEW_ZOOM_100:
+    cairo_identity_matrix(mapview.store->cr);
+    cairo_identity_matrix(mapview.store->cr);
+    update_map_canvas_visible();
+    break;
   case MENU_VIEW_SHOW_CITY_OUTLINES:
     if (draw_city_outlines ^ GTK_CHECK_MENU_ITEM(widget)->active) {
       key_city_outlines_toggle();
@@ -775,6 +793,12 @@
        NULL,                   0,                                      
"<Branch>"      },
   { "/" N_("View") "/tearoff1",                                NULL,
        NULL,                   0,                                      
"<Tearoff>"     },
+  { "/" N_("View") "/" N_("Zoom in"), NULL, view_menu_callback, 
MENU_VIEW_ZOOM_IN,
+    "<StockItem>", GTK_STOCK_ZOOM_IN },
+  { "/" N_("View") "/" N_("Zoom out"), NULL, view_menu_callback, 
MENU_VIEW_ZOOM_OUT,
+    "<StockItem>", GTK_STOCK_ZOOM_OUT },
+  { "/" N_("View") "/" N_("Zoom normal"), NULL, view_menu_callback, 
MENU_VIEW_ZOOM_100,
+    "<StockItem>", GTK_STOCK_ZOOM_100 },
   { "/" N_("View") "/" N_("City Outlines"), "<control>y",
     view_menu_callback, MENU_VIEW_SHOW_CITY_OUTLINES, "<CheckItem>"},
   { "/" N_("View") "/" N_("Map _Grid"),                        "<control>g",
@@ -1277,7 +1301,7 @@
           item = gtk_image_menu_item_new_with_label(buf);
 
          if ((gsprite = get_government_sprite(tileset, g))) {
-           image = gtk_image_new_from_pixbuf(sprite_get_pixbuf(gsprite));
+           image = sprite_create_image(gsprite);
            gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image);
            gtk_widget_show(image);
          }

[Prev in Thread] Current Thread [Next in Thread]