Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: Alternative nation dialog
Home

[Freeciv-Dev] Re: Alternative nation dialog

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: =?x-unknown?q?Daniel=5FSj=F6lie?= <deepone@xxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Alternative nation dialog
From: Daniel L Speyer <dspeyer@xxxxxxxxxxx>
Date: Wed, 27 Feb 2002 23:30:06 -0500 (EST)

On Wed, 27 Feb 2002, Raahul Kumar wrote:

> 
> --- Daniel L Speyer <dspeyer@xxxxxxxxxxx> wrote:
> > On Tue, 26 Feb 2002, [iso-8859-1] Daniel Sjölie wrote:
> > 
> > > On 2002-02-26 15:07:06, Daniel L Speyer wrote:
> > > > Here's the alternative nation dialog that I proposed a little while
> > > > back.  It pops up a table of flags, and only shows the name of the
> > > > selected nation.  Everything's visible at once, and there's decent room
> > > > for expansion.
> > > > 
> > > > There's a screenshot at 
> > > > http://speyer1-b.student.umd.edu/nationSelectShot.png
> > > > (The Israeli flag is highlighted because the mouse was over it)
> > > 
> > > Well... It looks good... But I think that even if most people either
> > > know what flag they want or select nation by looks of flag this dialog
> > > would be really painful in those instances where this is not true... :/
> > > 
> > 
> > Hmm, how about this then?  The nation name is a popdown menu that can set
> > the flag to match.  Patch is attatached, screenshot at
> > http://speyer1-b.student.umd.edu/nationSelectShot2.png
> > 
> 
> Much better. It's pretty and functional. I still preferred the original idea 
> of
> groups, dividing them along continental lines. North and South America, 
> Africa,
> Asia, Europe, Australia. You click on North America for instance and get to
> select the Americans or the various Red Indian tribes.
> 

OK, yet another version.  This doesn't have tabs, but it is built to
handle vastly different numbers of nations.  Check out
http://speyer1-b.student.umd.edu/nationSelectionShotFew.png
http://speyer1-b.student.umd.edu/nationSelectionShotFewer.png
http://speyer1-b.student.umd.edu/nationSelectionShotSemitic.png

Personally, I find the idea of categorizing nations to be highly
intimidating.  Are the turks asian, european, or semitic (does that third
category exist?).  Should the Aztecs be put with the Sioux, or the
Mexicans (or if those are both considered north american, is mexico
seperated from argentina?).

Furthermore, it would make the eurocentracism of Freeciv's nations
painfully aparent, and make it harder to find really cool looking flags.

Even so, this patch supercedes my previous one, as handling different size
nationsets will be useful for other things, and the patch takes care of
selecting invalid nations from the dropdown as well.

--Daniel Speyer
If you *don't* consider sharing information to be morally equivalent to 
kidnapping and murder on the high seas, you probably shouldn't use the
phrase "software piracy."

> > --Daniel Speyer
> > If you *don't* consider sharing information to be morally equivalent to 
> > kidnapping and murder on the high seas, you probably shouldn't use the
> > phrase "software piracy."
> > 
> > > /Daniel
> > > 
> > > -- 
> > > Now take a deep breath, smile and don't take life so seriously... :)
> > > 
> > > 
> > > --- freeciv-01-26-02/client/gui-gtk/dialogs.c     Sat Dec 22 02:06:11 2001
> > +++ freeciv/client/gui-gtk/dialogs.c        Wed Feb 27 19:00:47 2002
> > @@ -54,6 +54,7 @@
> >  /******************************************************************/
> >  static GtkWidget  *races_dialog_shell=NULL;
> >  static GtkWidget  *races_toggles_form;
> > +static GtkWidget  *races_by_name;
> >  static GtkWidget  *races_sex_toggles_form;
> >  static GtkWidget  *city_style_toggles_form;
> >  static GtkWidget  *races_ok_command;            /* ok button */
> > @@ -103,6 +104,7 @@
> >  static void create_races_dialog    (void);
> >  static void races_buttons_callback ( GtkWidget *w, gpointer data );
> >  static void races_toggles_callback ( GtkWidget *w, gpointer data );
> > +static void races_by_name_callback      ( GtkWidget *w, gpointer data );
> >  static void races_sex_toggles_callback ( GtkWidget *w, gpointer data );
> >  static void races_name_callback    ( GtkWidget *w, gpointer data );
> >  static void city_style_toggles_callback ( GtkWidget *w, gpointer data );
> > @@ -1918,12 +1920,14 @@
> >  *****************************************************************/
> >  void create_races_dialog(void)
> >  {
> > -  int       per_row = 5;
> > +  int       per_row = 9;
> >    int       i;
> >    GSList    *group = NULL;
> >    GSList    *sgroup = NULL;
> >    GSList    *cgroup = NULL;
> >    GtkWidget *f, *fs, *fa;
> > +  GtkWidget *pop_downs_box, *pop_downs_label;
> > +  GList     *race_names;
> >  
> >    races_dialog_shell = gtk_dialog_new();
> >      gtk_signal_connect( GTK_OBJECT(races_dialog_shell),"delete_event",
> > @@ -1951,20 +1955,42 @@
> >    sorted_races_list=g_list_sort(sorted_races_list,cmp_func);
> >    for(i=0; i<g_list_length(sorted_races_list); i++) {
> >      gint nat_id=GPOINTER_TO_INT(g_list_nth_data(sorted_races_list,i));
> > -    races_toggles[i]=gtk_radio_button_new_with_label(group,
> > -                                                get_nation_name(nat_id));
> > +    GtkWidget *flag;
> > +    SPRITE *s;
> > +    races_toggles[i]=gtk_radio_button_new(group);
> > +    s=get_nation_by_idx(nat_id)->flag_sprite;
> > +    flag=gtk_pixmap_new(s->pixmap,s->mask);
> > +    gtk_misc_set_alignment(GTK_MISC(flag),0,1);
> > +    gtk_container_add(GTK_CONTAINER(races_toggles[i]),flag);
> >      gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(races_toggles[i]), 
> > FALSE);
> >      group = gtk_radio_button_group( GTK_RADIO_BUTTON( races_toggles[i] ) );
> >     
> > gtk_table_attach_defaults(GTK_TABLE(races_toggles_form),races_toggles[i],
> >                           i%per_row, i%per_row+1, i/per_row, i/per_row+1);
> >    }
> >  
> > -  /* ------- nation leader combo ------- */
> > -
> > -  races_name = gtk_combo_new();
> > +  /* ------ choose nation by name -- and choose leader ------ */
> >  
> > +  pop_downs_box=gtk_hbox_new(0,0);
> >    gtk_box_pack_start( GTK_BOX( GTK_DIALOG( races_dialog_shell )->vbox ),
> > -   races_name, FALSE, FALSE, 0 );
> > +                 pop_downs_box, FALSE, FALSE, 0 );
> > +
> > +  pop_downs_label=gtk_label_new(_("Nation:"));
> > +  races_by_name = gtk_combo_new();
> > +  race_names = NULL;
> > +  for(i=0; i<game.playable_nation_count; i++) {
> > +    race_names = g_list_append(race_names,
> > +      get_nation_by_idx((int)g_list_nth_data(sorted_races_list,i))->name);
> > +  }
> > +  gtk_combo_set_popdown_strings(GTK_COMBO(races_by_name), race_names);
> > +  gtk_combo_set_value_in_list(GTK_COMBO(races_by_name), TRUE, FALSE);
> > +  gtk_box_pack_start( GTK_BOX( pop_downs_box ), pop_downs_label, FALSE,
> > FALSE, 0);
> > +  gtk_box_pack_start( GTK_BOX( pop_downs_box ), races_by_name, FALSE, 
> > FALSE,
> > 0);
> > +  
> > +
> > +  races_name = gtk_combo_new();
> > +  pop_downs_label=gtk_label_new(_("Leader:"));
> > +  gtk_box_pack_end( GTK_BOX( pop_downs_box ), races_name, FALSE, FALSE, 0);
> > +  gtk_box_pack_end( GTK_BOX( pop_downs_box ), pop_downs_label, FALSE, 
> > FALSE,
> > 0);
> >    GTK_WIDGET_SET_FLAGS( races_name, GTK_CAN_DEFAULT );
> >    gtk_widget_grab_default( races_name );
> >  
> > @@ -2056,6 +2082,10 @@
> >          gtk_signal_connect( GTK_OBJECT( city_style_toggles[i] ), "toggled",
> >         GTK_SIGNAL_FUNC( city_style_toggles_callback ), NULL );
> >  
> > +  gtk_signal_connect( GTK_OBJECT( GTK_COMBO(races_by_name)->list ), 
> > +                 "selection_changed",
> > +                 GTK_SIGNAL_FUNC( races_by_name_callback ), NULL );
> > +
> >    gtk_signal_connect( GTK_OBJECT( GTK_COMBO(races_name)->list ), 
> >                   "selection_changed",
> >                   GTK_SIGNAL_FUNC( races_name_callback ), NULL );
> > @@ -2132,6 +2162,21 @@
> >  /**************************************************************************
> >  ...
> >  **************************************************************************/
> > +static void races_by_name_callback( GtkWidget *w, gpointer data )
> > +{
> > +  int i;
> > +  for(i=0; i<g_list_length(sorted_races_list); i++) {
> > +    if (strcmp(gtk_entry_get_text(GTK_ENTRY( 
> > GTK_COMBO(races_by_name)->entry
> > )),
> > +         
> > get_nation_by_idx((int)g_list_nth_data(sorted_races_list,i))->name)==0){
> > +      gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(races_toggles[i]),
> > TRUE);
> > +      break;
> > +    }
> > +  }
> > +}
> > +
> > +/**************************************************************************
> > +...
> > +**************************************************************************/
> >  static void races_name_callback( GtkWidget *w, gpointer data )
> >  {
> >    char *lead;
> > @@ -2150,6 +2195,9 @@
> >  static void races_toggles_callback( GtkWidget *w, gpointer race_id_p )
> >  {
> >    selected_nation = GPOINTER_TO_INT(race_id_p);
> > +
> > +  gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(races_by_name)->entry),
> > +                get_nation_by_idx(selected_nation)->name);
> >  
> >    select_random_leader();
> >  
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Greetings - Send FREE e-cards for every occasion!
> http://greetings.yahoo.com
> 
> 

Attachment: nationdialog3.patch
Description: Text document


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