Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] GUI PATCH: refresh_tile_mapcanvas cleanup
Home

[Freeciv-Dev] GUI PATCH: refresh_tile_mapcanvas cleanup

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxx
Cc: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] GUI PATCH: refresh_tile_mapcanvas cleanup
From: Andreas Kemnade <akemnade@xxxxxxxxxxx>
Date: Wed, 10 Oct 2001 20:03:31 +0200

Jason Dorje Short writes:
 > The function refresh_tile_mapcanvas() is absolutely identical in every
 > GUI.
 > 
 > So, in the process of cleaning up the map_adjust_[xy] calls I moved it
 > into common client code.  Two problems:
 > 
 > - There is no client/mapview.[ch], where it should properly go, so I put
 > it into client/climisc.[ch].
You should put it into client/mapview_generic.[ch]. (Create that file).
Other stuff will appear there, too.
I have thought about cleaning up
gui-*/mapview.c, too.

My suggestions:
1. Put a draw_sprite_part, draw_sprite, draw_fog_part and draw_fog 
   into gui-*/graphics.c (similar for goto lines).
2. Replace every gtk_gc_set_mask and gtk_draw_pixmap combination 
   with draw_sprite.
3. Compare the result with gui-win32/mapview.c (it has such a
   draw_sprite function). You will see that many functions differ in
   only one parameter. (HDC in gui-win32 and GdkDrawable* in gui-gtk)

4. Replace that parameter with something like 
   struct Drawing_data* (in a way like our struct Sprite definition)
   Define it in client/mapview.h as 
   struct Drawing_data;
   In gui-*/graphics.h, you can define it in a gui specific way. 

5. Move all those functions to client/mapview_generic.c
6. Clean up the xaw client and make it use the functions form    

Result: The Xaw client has isometric mode (without correct numpad and
scrollbar handling). During cleanup there were many patches that touch
every gui-*/mapview.c. That means a high risk of damaging a
client. Ideally the guy who does such a patch should have the ability to
check every client. But if these steps described above you can change
lots of things without touching code you probably cannot check.

Example: Adding hexagonal tiles/view. 
You have to add a hexagonal_view_supported in gui-*/graphics.c. Make
it return 0. You can change client/mapview_generic.c then. Enable the
hexagonal view in your favourite client. Then do your scrollbar and
numpad magic. If you have finished hexagonal view, it can be put into
cvs. You don't need to be afraid that you break the other clients. The
maintainers of the other clients can implement the new view if they
find the time to do it. They only have to do some scrollbar and numpad
magic. But perhaps even that can be avoided.
 > 
 > - I can only test the correctness of the GTK client.  All others should
 > work so long as the #includes and such are set up correctly, but who
 > knows?
gui-win32 works.

Greetings
Andreas Kemnade


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