Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] RFC: unifying mapview parameters (again)
Home

[Freeciv-Dev] RFC: unifying mapview parameters (again)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv-Dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] RFC: unifying mapview parameters (again)
From: Jason Short <vze2zq63@xxxxxxxxxxx>
Date: Tue, 12 Feb 2002 03:54:21 -0500
Reply-to: jdorje@xxxxxxxxxxxx

Some weeks ago I suggested that mapview parameters (like map_view_x0, etc.) should be unified between the GUI's. There's a whole long list of things that will become much simpler if this were done.

The major problem is that I really can't figure out gui-mui. So while I have unified the other three working GUI's (gtk, xaw, win32), mui remains untouched.

Anyway...

I have replaced the 6 different GUI parameters with one structure in mapview_common, and updated them as appropriate from both the common gui code and the gui-specific code. Mostly this just involves a lot of variable substitution. I've tested it for GTK and xaw; win32 needs testing.

The most controversial part of the patch, no doubt, is the change to mapview_common. In mapview_common.h I declare the structure:

  struct mapview_window {
    /* The map position of the origin (top left corner)
       of the mapview window. */
    int origin_x, origin_y;

    /* The dimensions of the mapview window (and also the
       backing store, if applicable) in pixels. */
    int pixel_width, pixel_height;

    /* The dimensions of the mapview window (and also the
       backing store, if applicable) in tiles.  This can
       always be recalculated from the pixel dimensions,
       but its used so often we hold onto it. */
    int tile_width, tile_height;
  };

Before, there was no clear consensus on the names, and I imagine there won't be now either. I'm not particularly thrilled with this set of names.

- origin_x and origin_y could be x0 and y0, or just x and y. I prefer the origin_ prefix. Or, it could be made a struct map_position, so it would be origin.x and origin.y.

- pixel_width and pixel_height are adequate. One alternative is win_width/win_height.

- tile_width and tile_height are bad - they sound like the pixel widths of tiles. An alternative might be twidth/theight but this isn't particularly descriptive.


If there is still some enthusiasm about this change, I think the way to do it would be as I said before: first apply the patch to mapview_common (after agreeing on naming), then the GUI authors can fix/apply the gui-specific patches individually. Once all GUI's have been converted, then all sorts of cool things become possible.

If there's no enthusiasm about the change, then I probably need to explain all the cool things again :-).

The full patch is attached. It needs testing, but until the naming issues are resolved it'll be pretty unstable.

jason

Attachment: mapview_unification-2.diff.gz
Description: GNU Zip compressed data


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] RFC: unifying mapview parameters (again), Jason Short <=