Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7377) Gtk2 client broken (4 February 2004)
Home

[Freeciv-Dev] Re: (PR#7377) Gtk2 client broken (4 February 2004)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: remi.bonnet@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7377) Gtk2 client broken (4 February 2004)
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Wed, 4 Feb 2004 12:07:11 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7377 >

On Wed, Feb 04, 2004 at 08:54:20AM -0800, Remi Bonnet wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7377 >
> 
> Current cvs of gtk2 is broken:
> 
> mapview.c: In function `overview_canvas_expose':
> mapview.c:465: warning: implicit declaration of function `refresh_overview'
> mapview.c: At top level:
> mapview.c:482: warning: no previous prototype for
> `refresh_overview_viewrect'
> mapview.c: In function `refresh_overview_viewrect':
> mapview.c:483: `map_overview_x0' undeclared (first use in this function)
> mapview.c:483: (Each undeclared identifier is reported only once
> mapview.c:483: for each function it appears in.)
> mapview.c:485: `map_overview_y0' undeclared (first use in this function)
> mapview.c:502: warning: implicit declaration of function
> `get_mapview_corners'
> ../../common/map.h: At top level:
> mapview.c:473: warning: `set_overview_tile_foreground_color' defined but
> not used
> 
> Probably due to the 'unify' patchs.

The applied patch is attached.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "A common mistake that people make, when trying to design 
  something completely foolproof is to underestimate the 
  ingenuity of complete fools."
    -- Douglas Adams in Mostly Harmless

Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.64
diff -u -u -r1.64 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       2004/01/24 02:58:55     1.64
+++ client/gui-gtk-2.0/gui_main.c       2004/02/04 19:55:40
@@ -1194,13 +1194,10 @@
 
   timer_id = gtk_timeout_add(TIMER_INTERVAL, timer_callback, NULL);
 
-  overview_canvas_store = gdk_pixmap_new(root_window,
-                                         overview_canvas_store_width,
-                                         overview_canvas_store_height, -1);
-
-  gdk_gc_set_foreground(fill_bg_gc, colors_standard[COLOR_STD_WHITE]);
-  gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE, 0, 0,
-                     overview_canvas_store_width, 
overview_canvas_store_height);
+  overview.store = NULL;
+  overview.window = fc_malloc(sizeof(*overview.window));
+  overview.window->pixmap = overview_canvas->window;
+  overview.window->pixcomm = NULL;
 
   single_tile_pixmap = gdk_pixmap_new(root_window, 
                                      UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT, -1);
Index: client/gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.89
diff -u -u -r1.89 mapview.c
--- client/gui-gtk-2.0/mapview.c        2004/02/03 20:16:07     1.89
+++ client/gui-gtk-2.0/mapview.c        2004/02/04 19:55:41
@@ -424,91 +424,52 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void set_overview_dimensions(int x, int y)
+void map_size_changed(void)
 {
-  overview_canvas_store_width = OVERVIEW_TILE_WIDTH * x;
-  overview_canvas_store_height = OVERVIEW_TILE_HEIGHT * y;
-
-  if (overview_canvas_store)
-    g_object_unref(overview_canvas_store);
-  
-  overview_canvas_store        = gdk_pixmap_new(root_window,
-                         overview_canvas_store_width,
-                         overview_canvas_store_height, -1);
-
-  gdk_gc_set_foreground(fill_bg_gc, colors_standard[COLOR_STD_BLACK]);
-  gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE,
-                    0, 0,
-                    overview_canvas_store_width, overview_canvas_store_height);
-
   gtk_widget_set_size_request(overview_canvas,
-                             OVERVIEW_TILE_WIDTH  * x,
-                             OVERVIEW_TILE_HEIGHT * y);
+                             overview.width, overview.height);
   update_map_canvas_scrollbars_size();
 }
 
 /**************************************************************************
 ...
 **************************************************************************/
-gboolean overview_canvas_expose(GtkWidget *w, GdkEventExpose *ev, gpointer 
data)
+struct canvas_store *canvas_store_create(int width, int height)
 {
-  if (!can_client_change_view()) {
-    if (radar_gfx_sprite) {
-      gdk_draw_drawable(overview_canvas->window, civ_gc,
-                       radar_gfx_sprite->pixmap, ev->area.x, ev->area.y,
-                       ev->area.x, ev->area.y,
-                       ev->area.width, ev->area.height);
-    }
-    return TRUE;
-  }
-  
-  refresh_overview();
-  return TRUE;
+  struct canvas_store *result = fc_malloc(sizeof(*result));
+
+  result->pixmap = gdk_pixmap_new(root_window, width, height, -1);
+  result->pixcomm = NULL;
+  return result;
 }
 
 /**************************************************************************
 ...
 **************************************************************************/
-static void set_overview_tile_foreground_color(int x, int y)
+void canvas_store_free(struct canvas_store *store)
 {
-  gdk_gc_set_foreground(fill_bg_gc,
-                       colors_standard[overview_tile_color(x, y)]);
+  g_object_unref(store->pixmap);
+  assert(store->pixcomm == NULL);
+  free(store);
 }
 
 /**************************************************************************
 ...
 **************************************************************************/
-void refresh_overview_viewrect(void)
+gboolean overview_canvas_expose(GtkWidget *w, GdkEventExpose *ev, gpointer 
data)
 {
-  int x0 = OVERVIEW_TILE_WIDTH * map_overview_x0;
-  int x1 = OVERVIEW_TILE_WIDTH * (map.xsize - map_overview_x0);
-  int y0 = OVERVIEW_TILE_HEIGHT * map_overview_y0;
-  int y1 = OVERVIEW_TILE_HEIGHT * (map.ysize - map_overview_y0);
-  int gui_x[4], gui_y[4], i;
-
-  /* (map_overview_x0, map_overview_y0) splits the map into four
-   * rectangles.  Draw each of these rectangles to the screen, in turn. */
-  gdk_draw_drawable(overview_canvas->window, civ_gc, overview_canvas_store,
-                   x0, y0, 0, 0, x1, y1);
-  gdk_draw_drawable(overview_canvas->window, civ_gc, overview_canvas_store,
-                   0, y0, x1, 0, x0, y1);
-  gdk_draw_drawable(overview_canvas->window, civ_gc, overview_canvas_store,
-                   x0, 0, 0, y1, x1, y0);
-  gdk_draw_drawable(overview_canvas->window, civ_gc, overview_canvas_store,
-                   0, 0, x1, y1, x0, y0);
-
-  /* Now draw the mapview window rectangle onto the overview. */
-  gdk_gc_set_foreground(civ_gc, colors_standard[COLOR_STD_WHITE]);
-  get_mapview_corners(gui_x, gui_y);
-  for (i = 0; i < 4; i++) {
-    int src_x = gui_x[i];
-    int src_y = gui_y[i];
-    int dest_x = gui_x[(i + 1) % 4];
-    int dest_y = gui_y[(i + 1) % 4];
-
-    gdk_draw_line(overview_canvas->window, civ_gc,
-                 src_x, src_y, dest_x, dest_y);
+  if (!can_client_change_view()) {
+    if (radar_gfx_sprite) {
+      gdk_draw_drawable(overview_canvas->window, civ_gc,
+                       radar_gfx_sprite->pixmap, ev->area.x, ev->area.y,
+                       ev->area.x, ev->area.y,
+                       ev->area.width, ev->area.height);
+    }
+    return TRUE;
   }
+  
+  refresh_overview_canvas();
+  return TRUE;
 }
 
 /**************************************************************************
@@ -561,7 +522,7 @@
       if (map_exists()) { /* do we have a map at all */
         update_map_canvas_visible();
         update_map_canvas_scrollbars();
-        refresh_overview_viewrect();
+       refresh_overview_canvas();
       }
     }
     
@@ -1103,6 +1064,17 @@
   gdk_gc_set_foreground(gc, colors_standard[color]);
   gdk_draw_line(pcanvas_store->pixmap, gc,
                start_x, start_y, start_x + dx, start_y + dy);
+}
+
+/**************************************************************************
+...
+**************************************************************************/
+void gui_copy_canvas(struct canvas_store *dest, struct canvas_store *src,
+                    int src_x, int src_y, int dest_x, int dest_y, int width,
+                    int height)
+{
+  gdk_draw_drawable(dest->pixmap, fill_bg_gc, src->pixmap,
+                   src_x, src_y, dest_x, dest_y, width, height);
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#7377) Gtk2 client broken (4 February 2004), Raimar Falke <=