Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] (PR#9028) spurious mapview resizing
Home

[Freeciv-Dev] (PR#9028) spurious mapview resizing

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9028) spurious mapview resizing
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 19 Jun 2004 03:56:52 -0700
Reply-to: rt@xxxxxxxxxxx

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

I thought I reported this earlier but I can't find it...

When the active unit changes, the unit info label (on the panel) may be 
resized.  This happens in the gtk2 client when changing from an active 
unit to no active unit, or vice versa.  This causes a resizing of the 
whole window, including the mapview.  Quite annoying.

The error is in the unit_info_label widget (or probably it's container), 
which will make itself smaller when the amount of text changes (it 
should make itself larger when needed, but never smaller).  The error is 
propogated by the get_unit_info_label_text2() function which seems to 
return an inconsistent number of lines.

This may be avoided by always having the same number of lines (4) in the 
text.  No doubt this used to be the case, but Raimar and I, in unifying 
this code, never thought of this (and it wasn't commented).  This patch 
fixes it and adds a comment.  I will commit it soon.

But fixing the widget ('s container) would also be good.  Vasco?

jason

Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.2
diff -u -r1.2 text.c
--- client/text.c       14 May 2004 15:34:45 -0000      1.2
+++ client/text.c       19 Jun 2004 10:56:16 -0000
@@ -476,6 +476,8 @@
 {
   INIT;
 
+  /* This text should always be the same number of long.  Otherwise the GUI
+   * widgets may be confused and try to resize themselves. */
   if (punit) {
     struct city *pcity =
        player_find_city_by_id(game.player_ptr, punit->homecity);
@@ -491,12 +493,13 @@
     add_line("%s", map_get_tile_info_text(punit->x, punit->y));
     if (infrastructure) {
       add_line("%s", map_get_infrastructure_text(infrastructure));
+    } else {
+      add_line(" ");
     }
     if (pcity) {
-      add("%s", pcity->name);
-    }
-    if (infrastructure) {
-      add("\n");
+      add_line("%s", pcity->name);
+    } else {
+      add_line(" ");
     }
   } else {
     add("\n\n\n");

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9028) spurious mapview resizing, Jason Short <=