Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2006:
[Freeciv-Dev] Re: (PR#15338) gui-xaw: leader name is not displayed in ch
Home

[Freeciv-Dev] Re: (PR#15338) gui-xaw: leader name is not displayed in ch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#15338) gui-xaw: leader name is not displayed in choose_nation dialog
From: "Egor Vyscrebentsov" <evyscr@xxxxxxxxx>
Date: Fri, 17 Feb 2006 07:48:31 -0800
Reply-to: bugs@xxxxxxxxxxx

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

On Thu, 16 Feb 2006 05:43:13 -0800
Egor Vyscrebentsov <evyscr AT murom.net> wrote:

> On Mon, 30 Jan 2006 00:03:13 -0800
> Egor Vyscrebentsov <evyscr AT murom.net> wrote:
>
> > There is a bug in gui-xaw that i don't know how to fix. When one presses
> > "Choose nation" button and opens proper dialog, he does not see leader name.
> >
> > Lader name is present in proper text widget, it just not displayed. If
> > one  presses key, proper letter will be added to leader name. No way to
> > delete letters.
> >
> > This bug presents in both XFree86-4.3.0 and Xorg-6.8.99.902
>
> Well, my window manager is IceWM. When I looked at this dialog in
> WindowMaker (which does not fill dialog at screen height) I saw that
> leader name is alterable.
> The key of the problem is gui-xaw natioins dialog implementation. I'm going
> to rewrite it (not sure that I'll can implement group support, however.)

Right now I have wrote a quick fix (adding scrollbared viewport for nation
toggles). Attached patch contains also some races dialog cleanups. Will be
commited ASAP (for both trunk and S2_1).

PS Strange enough, I have wrote it in fifth time and four previous
tries were unsuccessfull, but I wrote the same code! PoM problems? :)

-- 
Thanks, evyscr

Index: data/Freeciv.in
===================================================================
--- data/Freeciv.in     (revision 11600)
+++ data/Freeciv.in     (working copy)
@@ -3130,11 +3130,15 @@
 Freeciv*racespopup*translations:       #override \
                        <Key>Return: key-dialog-races-ok()
 
+Freeciv*racesform.background:          gray84
+
 Freeciv*raceslabel.label:              _("Select nation and name:")
 Freeciv*raceslabel.borderWidth:                0
 Freeciv*raceslabel.background:         gray84
 
-Freeciv*racesform.background:          gray84
+Freeciv*racestogglesviewport.height:   412
+Freeciv*racestogglesviewport.useRight: True
+Freeciv*racestogglesviewport.allowVert:        True
 
 Freeciv*racestogglesform.borderWidth:  1
 Freeciv*racestogglesform.background:   gray84
Index: client/gui-xaw/dialogs.c
===================================================================
--- client/gui-xaw/dialogs.c    (revision 11600)
+++ client/gui-xaw/dialogs.c    (working copy)
@@ -30,7 +30,8 @@
 #include <X11/Xaw/MenuButton.h>
 #include <X11/Xaw/SimpleMenu.h>
 #include <X11/Xaw/SmeBSB.h>
-#include <X11/Xaw/Toggle.h>     
+#include <X11/Xaw/Toggle.h>
+#include <X11/Xaw/Viewport.h>  /* for racesdlg */
 
 #include "fcintl.h"
 #include "log.h"
@@ -73,6 +74,7 @@
 /******************************************************************/
 static Widget races_dialog_shell=NULL;
 static Widget races_form, races_toggles_form, races_label;
+static Widget races_toggles_viewport;
 static Widget *races_toggles=NULL;
 static struct nation_type **races_toggles_to_nations = NULL;
 static int *nation_idx_to_race_toggle = NULL;
@@ -914,12 +916,19 @@
                                       labelWidgetClass, 
                                       races_form, NULL));  
 
-  races_toggles_form = XtVaCreateManagedWidget("racestogglesform", 
-                                              formWidgetClass, 
-                                              races_form, 
-                                              XtNfromVert, races_label, 
-                                              NULL);   
+  races_toggles_viewport =
+    XtVaCreateManagedWidget("racestogglesviewport",
+                           viewportWidgetClass,
+                           races_form,
+                           XtNfromVert, races_label,
+                           NULL);
 
+  races_toggles_form =
+    XtVaCreateManagedWidget("racestogglesform",
+                           formWidgetClass,
+                           races_toggles_viewport,
+                           NULL);
+
   free(races_toggles);
   races_toggles = fc_calloc(game.control.nation_count, sizeof(Widget));
   free(races_toggles_to_nations);
@@ -995,114 +1004,63 @@
     }
   } nations_iterate_end;
   nat_count = index + 1;
-/*
-  for( i = 0; i < ((game.control.playable_nation_count-1)/per_row)+1; i++) {
-    index = i * per_row;
-    my_snprintf(namebuf, sizeof(namebuf), "racestoggle%d", index);
-    if( i == 0 ) {
-      races_toggles[index] =
-       XtVaCreateManagedWidget(namebuf,
-                               toggleWidgetClass,
-                               races_toggles_form,
-                               XtNlabel, maxracename,
-                               NULL);
-    } else {
-      races_toggles[index] =
-       XtVaCreateManagedWidget(namebuf,
-                               toggleWidgetClass,
-                               races_toggles_form,
-                               XtNradioGroup,
-                               races_toggles[index-1],
-                               XtNfromVert,
-                               races_toggles[index-per_row],
-                               XtNlabel, maxracename,
-                               NULL);
-    }
 
-    for( j = 1; j < per_row; j++) {
-      index = i * per_row + j;
-      if( index >= game.control.playable_nation_count ) break;
-      my_snprintf(namebuf, sizeof(namebuf), "racestoggle%d", index);
-      if( i == 0 ) {
-       races_toggles[index] =
-         XtVaCreateManagedWidget(namebuf,
-                                 toggleWidgetClass,
-                                 races_toggles_form,
-                                 XtNradioGroup,
-                                 races_toggles[index-1],
-                                 XtNfromHoriz,
-                                 races_toggles[index-1],
-                                 XtNlabel, maxracename,
-                                 NULL);
-      } else {
-       races_toggles[index] =
-         XtVaCreateManagedWidget(namebuf,
-                                 toggleWidgetClass,
-                                 races_toggles_form,
-                                 XtNradioGroup,
-                                 races_toggles[index-1],
-                                 XtNfromVert,
-                                 races_toggles[index-per_row],
-                                 XtNfromHoriz,
-                                 races_toggles[index-1],
-                                 XtNlabel, maxracename,
-                                 NULL);
-      }
-    }
-  }
-*/
-  races_leader_form = XtVaCreateManagedWidget("racesleaderform",
-                                             formWidgetClass,
-                                             races_form,
-                                             XtNfromVert, races_toggles_form,
-                                             NULL);
+  races_leader_form =
+    XtVaCreateManagedWidget("racesleaderform",
+                           formWidgetClass,
+                           races_form,
+                           XtNfromVert, races_toggles_viewport,
+/*                         XtNfromHoriz, races_toggles_viewport,*/
+                           NULL);
 
   XtVaGetValues(races_leader_form, XtNdefaultDistance, &space, NULL);
   XtQueryGeometry(races_toggles[0], NULL, &geom);
-  races_leader = XtVaCreateManagedWidget("racesleader",
-                                        asciiTextWidgetClass,
-                                        races_leader_form,
-                                        XtNeditType, XawtextEdit,
-                                        XtNwidth,
-                                          space + 2*(geom.width + 
geom.border_width),
-                                        XtNstring, "",
-                                        NULL);
+  races_leader =
+    XtVaCreateManagedWidget("racesleader",
+                           asciiTextWidgetClass,
+                           races_leader_form,
+                           XtNeditType, XawtextEdit,
+                           XtNwidth,
+                             space + 2*(geom.width + geom.border_width),
+                           XtNstring, "",
+                           NULL);
 
   races_leader_pick_popupmenu = 0;
 
   races_leader_pick_menubutton =
     I_L(XtVaCreateManagedWidget("racesleaderpickmenubutton",
-                           menuButtonWidgetClass,
-                           races_leader_form,
-                           XtNfromHoriz, races_leader,
-                           NULL));
+                               menuButtonWidgetClass,
+                               races_leader_form,
+/*                             XtNfromVert, races_leader,*/
+                               XtNfromHoriz, races_leader,
+                               NULL));
 
-  races_sex_label = I_L(XtVaCreateManagedWidget("racessexlabel", 
-                                           labelWidgetClass, 
-                                           races_form, 
-                                           XtNfromVert, races_leader_form, 
-                                           NULL));  
+  races_sex_label = I_L(XtVaCreateManagedWidget("racessexlabel",
+                                           labelWidgetClass,
+                                           races_form,
+                                           XtNfromVert, races_leader_form,
+                                           NULL));
 
-  races_sex_form = XtVaCreateManagedWidget("racessexform", 
-                                          formWidgetClass, 
-                                          races_form, 
-                                          XtNfromVert, races_sex_label, 
-                                          NULL);   
+  races_sex_form = XtVaCreateManagedWidget("racessexform",
+                                          formWidgetClass,
+                                          races_form,
+                                          XtNfromVert, races_sex_label,
+                                          NULL);
 
   races_sex_toggles[0] =
-    I_L(XtVaCreateManagedWidget("racessextoggle0", 
-                               toggleWidgetClass, 
+    I_L(XtVaCreateManagedWidget("racessextoggle0",
+                               toggleWidgetClass,
                                races_sex_form,
                                NULL));
 
   races_sex_toggles[1] =
     I_L(XtVaCreateManagedWidget("racessextoggle1",
-                               toggleWidgetClass, 
+                               toggleWidgetClass,
                                races_sex_form,
-                               XtNfromHoriz, 
+                               XtNfromHoriz,
                                (XtArgVal)races_sex_toggles[0],
-                               XtNradioGroup, 
-                               races_sex_toggles[0], 
+                               XtNradioGroup,
+                               races_sex_toggles[0],
                                NULL));
 
   /* find out styles that can be used at the game beginning */
@@ -1115,17 +1073,21 @@
     }
   }
 
-  races_style_label = I_L(XtVaCreateManagedWidget("racesstylelabel", 
-                                             labelWidgetClass, 
-                                             races_form,
-                                             XtNfromVert, races_sex_form, 
-                                             NULL));  
+  races_style_label =
+    I_L(XtVaCreateManagedWidget("racesstylelabel", 
+                               labelWidgetClass, 
+                               races_form,
+                               XtNfromVert, races_sex_form,
+/*                             XtNfromHoriz, races_toggles_viewport,*/
+                               NULL));  
 
-  races_style_form = XtVaCreateManagedWidget("racesstyleform", 
-                                              formWidgetClass, 
-                                              races_form, 
-                                              XtNfromVert, races_style_label, 
-                                              NULL);   
+  races_style_form =
+    XtVaCreateManagedWidget("racesstyleform", 
+                           formWidgetClass, 
+                           races_form, 
+                           XtNfromVert, races_style_label,
+/*                         XtNfromHoriz, races_toggles_viewport,*/
+                           NULL);   
 
   free(races_style_toggles);
   races_style_toggles = fc_calloc(b_s_num,sizeof(Widget));

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