Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10435) Repodlg tabs in GTK+2 client
Home

[Freeciv-Dev] (PR#10435) Repodlg tabs in GTK+2 client

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10435) Repodlg tabs in GTK+2 client
From: "Gregor Richards" <akaquinn@xxxxxxxxxxx>
Date: Tue, 5 Oct 2004 10:28:38 -0700
Reply-to: rt@xxxxxxxxxxx

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

This adds a new "tabbed" view to the main dialog, allowing quick access
to repodlgs.  I will also implement a tabbed city dialog, but first I
have to get this fully working ;)

Right now, everything except for the units dialog works.
diff -ruN -X freeciv/diff_ignore freeciv/client/gui-gtk-2.0/cityrep.c 
tabbed/client/gui-gtk-2.0/cityrep.c
--- freeciv/client/gui-gtk-2.0/cityrep.c        2004-09-28 19:24:21.000000000 
-0700
+++ tabbed/client/gui-gtk-2.0/cityrep.c 2004-09-30 22:03:25.000000000 -0700
@@ -162,12 +162,16 @@
     city_dialog_shell_is_modal = make_modal;
     
     create_city_report_dialog(make_modal);
-    gtk_set_relative_position(toplevel, city_dialog_shell, 10, 10);
+    if (!enable_tabs) {
+      gtk_set_relative_position(toplevel, city_dialog_shell, 10, 10);
+    }
 
     select_menu_cached = FALSE;
   }
 
-  gtk_window_present(GTK_WINDOW(city_dialog_shell));
+  if (!enable_tabs) {
+    gtk_window_present(GTK_WINDOW(city_dialog_shell));
+  }
   hilite_cities_from_canvas();
 }
 
@@ -176,8 +180,10 @@
 ****************************************************************/
 void popdown_city_report_dialog(void)
 {
-  if (city_dialog_shell) {
-    gtk_widget_destroy(city_dialog_shell);
+  if (!enable_tabs) {
+    if (city_dialog_shell) {
+      gtk_widget_destroy(city_dialog_shell);
+    }
   }
 }
 
@@ -763,56 +769,85 @@
   static char *titles [NUM_CREPORT_COLS];
   static char  buf    [NUM_CREPORT_COLS][64];
   struct city_report_spec *spec;
+  
+  GtkWidget *label_l;
+  char *label_c;
 
   GtkWidget *w, *sw, *menubar;
   int i;
   
-  city_dialog_shell = gtk_dialog_new_with_buttons(_("Cities"),
-       NULL,
-       0,
-       NULL);
-  setup_dialog(city_dialog_shell, toplevel);
-  gtk_window_set_default_size(GTK_WINDOW(city_dialog_shell), -1, 420);
-  gtk_dialog_set_default_response(GTK_DIALOG(city_dialog_shell),
-                                 GTK_RESPONSE_CLOSE);
-
-  if (make_modal) {
-    gtk_window_set_transient_for(GTK_WINDOW(city_dialog_shell),
-                                GTK_WINDOW(toplevel));
-    gtk_window_set_modal(GTK_WINDOW(city_dialog_shell), TRUE);
-  }
-
-  g_signal_connect(city_dialog_shell, "response",
-                  G_CALLBACK(gtk_widget_destroy), NULL);
-  g_signal_connect(city_dialog_shell, "destroy",
-                  G_CALLBACK(gtk_widget_destroyed), &city_dialog_shell);
+  if (!enable_tabs) {
+    city_dialog_shell = gtk_dialog_new_with_buttons(_("Cities"),
+                                                    NULL,
+                                                    0,
+                                                    NULL);
+    setup_dialog(city_dialog_shell, toplevel);
+    gtk_window_set_default_size(GTK_WINDOW(city_dialog_shell), -1, 420);
+    gtk_dialog_set_default_response(GTK_DIALOG(city_dialog_shell),
+                                    GTK_RESPONSE_CLOSE);
+
+    if (make_modal) {
+      gtk_window_set_transient_for(GTK_WINDOW(city_dialog_shell),
+                                   GTK_WINDOW(toplevel));
+      gtk_window_set_modal(GTK_WINDOW(city_dialog_shell), TRUE);
+    }
+
+    g_signal_connect(city_dialog_shell, "response",
+                     G_CALLBACK(gtk_widget_destroy), NULL);
+    g_signal_connect(city_dialog_shell, "destroy",
+                     G_CALLBACK(gtk_widget_destroyed), &city_dialog_shell);
+  } else {
+    city_dialog_shell = tnbcities;
+  }
 
   /* menubar */
   menubar = create_city_report_menubar();
-  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(city_dialog_shell)->vbox),
-       menubar, FALSE, FALSE, 0);
+  if (!enable_tabs) {
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(city_dialog_shell)->vbox),
+                       menubar, FALSE, FALSE, 0);
+  } else {
+    gtk_box_pack_start(GTK_BOX(city_dialog_shell),
+                       menubar, FALSE, FALSE, 0);
+  }
 
   /* buttons */
   w = gtk_stockbutton_new(GTK_STOCK_ZOOM_FIT, _("Cen_ter"));
-  gtk_box_pack_end(GTK_BOX(GTK_DIALOG(city_dialog_shell)->action_area),
-       w, FALSE, TRUE, 0);
+  if (!enable_tabs) {
+    gtk_box_pack_end(GTK_BOX(GTK_DIALOG(city_dialog_shell)->action_area),
+                     w, FALSE, TRUE, 0);
+  } else {
+    gtk_box_pack_end(GTK_BOX(city_dialog_shell),
+                     w, FALSE, TRUE, 0);
+  }
   g_signal_connect(w, "clicked", G_CALLBACK(city_center_callback), NULL);
   city_center_command = w;
 
   w = gtk_stockbutton_new(GTK_STOCK_ZOOM_IN, _("_Popup"));
-  gtk_box_pack_end(GTK_BOX(GTK_DIALOG(city_dialog_shell)->action_area),
-       w, FALSE, TRUE, 0);
+  if (!enable_tabs) {
+    gtk_box_pack_end(GTK_BOX(GTK_DIALOG(city_dialog_shell)->action_area),
+                     w, FALSE, TRUE, 0);
+  } else {
+    gtk_box_pack_end(GTK_BOX(city_dialog_shell),
+                     w, FALSE, TRUE, 0);
+  }
   g_signal_connect(w, "clicked", G_CALLBACK(city_popup_callback), NULL);
   city_popup_command = w;
 
   w = gtk_stockbutton_new(GTK_STOCK_EXECUTE, _("_Buy"));
-  gtk_box_pack_end(GTK_BOX(GTK_DIALOG(city_dialog_shell)->action_area),
-       w, FALSE, TRUE, 0);
+  if (!enable_tabs) {
+    gtk_box_pack_end(GTK_BOX(GTK_DIALOG(city_dialog_shell)->action_area),
+                     w, FALSE, TRUE, 0);
+  } else {
+    gtk_box_pack_end(GTK_BOX(city_dialog_shell),
+                     w, FALSE, TRUE, 0);
+  }
   g_signal_connect(w, "clicked", G_CALLBACK(city_buy_callback), NULL);
   city_buy_command = w;
 
-  gtk_dialog_add_button(GTK_DIALOG(city_dialog_shell),
-                       GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+  if (!enable_tabs) {
+    gtk_dialog_add_button(GTK_DIALOG(city_dialog_shell),
+                          GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+  }
 
   /* tree view */
   for (i=0; i<NUM_CREPORT_COLS; i++)
@@ -856,11 +891,20 @@
                                  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
   gtk_container_add(GTK_CONTAINER(sw), city_view);
 
-  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(city_dialog_shell)->vbox),
-       sw, TRUE, TRUE, 0);
-
-  gtk_widget_show_all(GTK_DIALOG(city_dialog_shell)->vbox);
-  gtk_widget_show_all(GTK_DIALOG(city_dialog_shell)->action_area);
+  if (!enable_tabs) {
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(city_dialog_shell)->vbox),
+                       sw, TRUE, TRUE, 0);
+  } else {
+    gtk_box_pack_start(GTK_BOX(city_dialog_shell),
+                       sw, TRUE, TRUE, 0);
+  }    
+
+  if (!enable_tabs) {
+    gtk_widget_show_all(GTK_DIALOG(city_dialog_shell)->vbox);
+    gtk_widget_show_all(GTK_DIALOG(city_dialog_shell)->action_area);
+  } else {
+    gtk_widget_show_all(city_dialog_shell);
+  }
   city_model_init();
 
   city_selection_changed_callback(city_selection);
diff -ruN -X freeciv/diff_ignore freeciv/client/gui-gtk-2.0/gui_main.c 
tabbed/client/gui-gtk-2.0/gui_main.c
--- freeciv/client/gui-gtk-2.0/gui_main.c       2004-09-24 11:57:19.000000000 
-0700
+++ tabbed/client/gui-gtk-2.0/gui_main.c        2004-09-30 22:06:25.000000000 
-0700
@@ -85,6 +85,8 @@
 bool fullscreen_mode = FALSE;
 
 GtkWidget *toplevel;
+GtkWidget *topnbook, *tnbcities, *tnbunits, *tnbplrs;
+GtkWidget *tnbecon, *tnbsci;
 GtkWidget *top_vbox;
 GdkWindow *root_window;
 
@@ -594,6 +596,8 @@
   GtkCellRenderer *rend;
 
   GtkWidget *notebook, *messages;
+  GtkWidget *label_l, *menu_vbox;
+  char *label_c;
 
   main_tips = gtk_tooltips_new();
 
@@ -826,10 +830,24 @@
   unit_pixmap_table = table;
   populate_unit_pixmap_table();
 
-  /* Map canvas and scrollbars */
-
-  table = gtk_table_new(2, 2, FALSE);
-  gtk_box_pack_start(GTK_BOX(hbox), table, TRUE, TRUE, 0);
+  if (!enable_tabs) {
+    /* Map canvas and scrollbars */
+    table = gtk_table_new(2, 2, FALSE);
+    gtk_box_pack_start(GTK_BOX(hbox), table, TRUE, TRUE, 0);
+  } else {
+    /* Map canvas and scrollbars, in a tab interface that shows reports */
+    
+    /* *** the top is controlled by tabs *** */
+    topnbook = gtk_notebook_new();
+    gtk_notebook_set_tab_pos(GTK_NOTEBOOK(topnbook), GTK_POS_BOTTOM);
+    gtk_box_pack_start(GTK_BOX(hbox), topnbook, FALSE, FALSE, 0);
+
+    table = gtk_table_new(2, 2, FALSE);
+    //gtk_box_pack_start(GTK_BOX(hbox), table, TRUE, TRUE, 0);
+    label_c = _("Map");
+    label_l = gtk_label_new_with_mnemonic(label_c);
+    gtk_notebook_append_page(GTK_NOTEBOOK(topnbook), table, label_l);
+  }
 
   frame = gtk_frame_new(NULL);
   gtk_table_attach(GTK_TABLE(table), frame, 0, 1, 0, 1,
@@ -881,6 +899,34 @@
   g_signal_connect(toplevel, "key_press_event",
                    G_CALLBACK(keyboard_handler), NULL);
 
+  if (enable_tabs) {
+    /* add other tabs */
+    tnbcities = gtk_vbox_new(FALSE, 0);
+    label_c = _("Cities");
+    label_l = gtk_label_new_with_mnemonic(label_c);
+    gtk_notebook_append_page(GTK_NOTEBOOK(topnbook), tnbcities, label_l);
+  
+    tnbunits = gtk_vbox_new(FALSE, 0);
+    label_c = _("Units");
+    label_l = gtk_label_new_with_mnemonic(label_c);
+    gtk_notebook_append_page(GTK_NOTEBOOK(topnbook), tnbunits, label_l);
+
+    tnbplrs = gtk_vbox_new(FALSE, 0);
+    label_c = _("Players");
+    label_l = gtk_label_new_with_mnemonic(label_c);
+    gtk_notebook_append_page(GTK_NOTEBOOK(topnbook), tnbplrs, label_l);
+  
+    tnbecon = gtk_vbox_new(FALSE, 0);
+    label_c = _("Economy");
+    label_l = gtk_label_new_with_mnemonic(label_c);
+    gtk_notebook_append_page(GTK_NOTEBOOK(topnbook), tnbecon, label_l);
+
+    tnbsci = gtk_vbox_new(FALSE, 0);
+    label_c = _("Science");
+    label_l = gtk_label_new_with_mnemonic(label_c);
+    gtk_notebook_append_page(GTK_NOTEBOOK(topnbook), tnbsci, label_l);
+  }
+
   /* *** The message window -- this is a detachable widget *** */
 
   sbox = detached_widget_new();
diff -ruN -X freeciv/diff_ignore freeciv/client/gui-gtk-2.0/gui_main.h 
tabbed/client/gui-gtk-2.0/gui_main.h
--- freeciv/client/gui-gtk-2.0/gui_main.h       2004-05-01 10:28:47.000000000 
-0700
+++ tabbed/client/gui-gtk-2.0/gui_main.h        2004-09-30 22:08:43.000000000 
-0700
@@ -59,6 +59,14 @@
 extern GtkTextView *   main_message_area;
 extern GtkWidget *      text_scrollbar;
 extern GtkWidget *      toplevel;
+
+extern GtkWidget *      topnbook;
+extern GtkWidget *      tnbcities;
+extern GtkWidget *      tnbunits;
+extern GtkWidget *      tnbplrs;
+extern GtkWidget *      tnbecon;
+extern GtkWidget *      tnbsci;
+
 extern GtkWidget *      top_vbox;
 extern GtkWidget *      main_frame_civ_name;
 extern GtkWidget *      main_label_info;
diff -ruN -X freeciv/diff_ignore freeciv/client/gui-gtk-2.0/plrdlg.c 
tabbed/client/gui-gtk-2.0/plrdlg.c
--- freeciv/client/gui-gtk-2.0/plrdlg.c 2004-05-01 10:28:47.000000000 -0700
+++ tabbed/client/gui-gtk-2.0/plrdlg.c  2004-09-30 22:13:23.000000000 -0700
@@ -74,10 +74,15 @@
 {
   if (!players_dialog_shell){
     create_players_dialog();
-    gtk_window_set_position(GTK_WINDOW(players_dialog_shell),
-       GTK_WIN_POS_MOUSE);
+    if (!enable_tabs) {
+      gtk_window_set_position(GTK_WINDOW(players_dialog_shell),
+                              GTK_WIN_POS_MOUSE);
+    }
+  }
+  
+  if (!enable_tabs) {
+    gtk_window_present(GTK_WINDOW(players_dialog_shell));
   }
-  gtk_window_present(GTK_WINDOW(players_dialog_shell));
 }
 
 /****************************************************************
@@ -85,8 +90,10 @@
 *****************************************************************/
 void popdown_players_dialog(void)
 {
-  if (players_dialog_shell) {
-    gtk_widget_destroy(players_dialog_shell);
+  if (!enable_tabs) {
+    if (players_dialog_shell) {
+      gtk_widget_destroy(players_dialog_shell);
+    }
   }
 }
 
@@ -258,19 +265,23 @@
   GtkWidget *sep, *sw;
   GtkWidget *menubar, *menu, *item;
 
-  players_dialog_shell = gtk_dialog_new_with_buttons(_("Players"),
-    NULL,
-    0,
-    GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
-    NULL);
-  setup_dialog(players_dialog_shell, toplevel);
-
-  gtk_window_set_default_size(GTK_WINDOW(players_dialog_shell), -1, 270);
-
-  g_signal_connect(players_dialog_shell, "destroy",
-    G_CALLBACK(players_destroy_callback), NULL);
-  g_signal_connect_swapped(players_dialog_shell, "response",
-    G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(players_dialog_shell));
+  if (!enable_tabs) {
+    players_dialog_shell = gtk_dialog_new_with_buttons(_("Players"),
+                                                       NULL,
+                                                       0,
+                                                       GTK_STOCK_CLOSE, 
GTK_RESPONSE_CLOSE,
+                                                       NULL);
+    setup_dialog(players_dialog_shell, toplevel);
+
+    gtk_window_set_default_size(GTK_WINDOW(players_dialog_shell), -1, 270);
+
+    g_signal_connect(players_dialog_shell, "destroy",
+                     G_CALLBACK(players_destroy_callback), NULL);
+    g_signal_connect_swapped(players_dialog_shell, "response",
+                             G_CALLBACK(gtk_widget_destroy), 
GTK_OBJECT(players_dialog_shell));
+  } else {
+    players_dialog_shell = tnbplrs;
+  }
 
   create_store();
 
@@ -349,10 +360,17 @@
   gtk_container_add(GTK_CONTAINER(sw), players_list);
 
   menubar = gtk_menu_bar_new();
-  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(players_dialog_shell)->vbox), menubar,
-                    FALSE, FALSE, 0);
-  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(players_dialog_shell)->vbox), sw,
-                    TRUE, TRUE, 5);
+  if (!enable_tabs) {
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(players_dialog_shell)->vbox), 
menubar,
+                       FALSE, FALSE, 0);
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(players_dialog_shell)->vbox), sw,
+                       TRUE, TRUE, 5);
+  } else {
+    gtk_box_pack_start(GTK_BOX(players_dialog_shell), menubar,
+                       FALSE, FALSE, 0);
+    gtk_box_pack_start(GTK_BOX(players_dialog_shell), sw,
+                       TRUE, TRUE, 5);
+  }
 
   item = gtk_menu_item_new_with_mnemonic(_("_Player"));
   gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
@@ -403,8 +421,12 @@
   gtk_widget_add_accelerator(players_sship_command,
     "activate", accel, GDK_S, 0, GTK_ACCEL_VISIBLE);
 
-  gtk_window_add_accel_group(GTK_WINDOW(players_dialog_shell), accel);
-  gtk_widget_show_all(GTK_DIALOG(players_dialog_shell)->vbox);
+  if (!enable_tabs) {
+    gtk_window_add_accel_group(GTK_WINDOW(players_dialog_shell), accel);
+    gtk_widget_show_all(players_dialog_shell);
+  } else {
+    gtk_widget_show_all(players_dialog_shell);
+  }
 
   g_signal_connect(players_meet_command, "activate",
     G_CALLBACK(players_meet_callback), NULL);
@@ -420,8 +442,10 @@
   gtk_list_store_clear(store);
   update_players_dialog();
 
-  gtk_dialog_set_default_response(GTK_DIALOG(players_dialog_shell),
-    GTK_RESPONSE_CLOSE);
+  if (!enable_tabs) {
+    gtk_dialog_set_default_response(GTK_DIALOG(players_dialog_shell),
+                                    GTK_RESPONSE_CLOSE);
+  }
 }
 
 
diff -ruN -X freeciv/diff_ignore freeciv/client/gui-gtk-2.0/repodlgs.c 
tabbed/client/gui-gtk-2.0/repodlgs.c
--- freeciv/client/gui-gtk-2.0/repodlgs.c       2004-09-28 19:24:21.000000000 
-0700
+++ tabbed/client/gui-gtk-2.0/repodlgs.c        2004-10-01 21:42:01.000000000 
-0700
@@ -142,10 +142,14 @@
     science_dialog_shell_is_modal = make_modal;
     
     create_science_dialog(make_modal);
-    gtk_set_relative_position(toplevel, science_dialog_shell, 10, 10);
+    if (!enable_tabs) {
+      gtk_set_relative_position(toplevel, science_dialog_shell, 10, 10);
+    }
   }
 
-  gtk_window_present(GTK_WINDOW(science_dialog_shell));
+  if (!enable_tabs) {
+    gtk_window_present(GTK_WINDOW(science_dialog_shell));
+  }
 }
 
 
@@ -154,8 +158,10 @@
 *****************************************************************/
 void popdown_science_dialog(void)
 {
-  if (science_dialog_shell) {
-    gtk_widget_destroy(science_dialog_shell);
+  if (!enable_tabs) {
+    if (science_dialog_shell) {
+      gtk_widget_destroy(science_dialog_shell);
+    }
   }
 }
  
@@ -168,35 +174,49 @@
   GtkWidget *frame, *hbox, *w;
   int i;
 
-  science_dialog_shell = gtk_dialog_new_with_buttons(_("Science"),
-       NULL,
-       0,
-       GTK_STOCK_CLOSE,
-       GTK_RESPONSE_CLOSE,
-       NULL);
-  setup_dialog(science_dialog_shell, toplevel);
-  gtk_dialog_set_default_response(GTK_DIALOG(science_dialog_shell),
-       GTK_RESPONSE_CLOSE);
-
-  if (make_modal) {
-    gtk_window_set_transient_for(GTK_WINDOW(science_dialog_shell),
-                                GTK_WINDOW(toplevel));
-    gtk_window_set_modal(GTK_WINDOW(science_dialog_shell), TRUE);
-  }
-
-  g_signal_connect(science_dialog_shell, "response",
-                  G_CALLBACK(gtk_widget_destroy), NULL);
-  g_signal_connect(science_dialog_shell, "destroy",
-                  G_CALLBACK(gtk_widget_destroyed), &science_dialog_shell);
+  if (!enable_tabs) {
+    science_dialog_shell = gtk_dialog_new_with_buttons(_("Science"),
+                                                       NULL,
+                                                       0,
+                                                       GTK_STOCK_CLOSE,
+                                                       GTK_RESPONSE_CLOSE,
+                                                       NULL);
+    setup_dialog(science_dialog_shell, toplevel);
+    gtk_dialog_set_default_response(GTK_DIALOG(science_dialog_shell),
+                                    GTK_RESPONSE_CLOSE);
+
+    if (make_modal) {
+      gtk_window_set_transient_for(GTK_WINDOW(science_dialog_shell),
+                                   GTK_WINDOW(toplevel));
+      gtk_window_set_modal(GTK_WINDOW(science_dialog_shell), TRUE);
+    }
+
+    g_signal_connect(science_dialog_shell, "response",
+                     G_CALLBACK(gtk_widget_destroy), NULL);
+    g_signal_connect(science_dialog_shell, "destroy",
+                     G_CALLBACK(gtk_widget_destroyed), &science_dialog_shell);
+  } else {
+    science_dialog_shell = tnbsci;
+  }
 
   science_label = gtk_label_new("no text set yet");
 
-  gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->vbox ),
-        science_label, FALSE, FALSE, 0 );
+  if (!enable_tabs) {
+    gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->vbox ),
+                        science_label, FALSE, FALSE, 0 );
+  } else {
+    gtk_box_pack_start( GTK_BOX( science_dialog_shell ),
+                        science_label, FALSE, FALSE, 0 );
+  }
 
   frame = gtk_frame_new(_("Researching"));
-  gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->vbox ),
-        frame, FALSE, FALSE, 0 );
+  if (!enable_tabs) {
+    gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->vbox ),
+                        frame, FALSE, FALSE, 0 );
+  } else {
+    gtk_box_pack_start( GTK_BOX( science_dialog_shell ),
+                        frame, FALSE, FALSE, 0 );
+  }
 
   hbox = gtk_hbox_new( TRUE, 5 );
   gtk_container_add(GTK_CONTAINER(frame), hbox);
@@ -215,8 +235,13 @@
   gtk_box_pack_start( GTK_BOX( hbox ), science_help_toggle, TRUE, FALSE, 0 );
 
   frame = gtk_frame_new( _("Goal"));
-  gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->vbox ),
-        frame, FALSE, FALSE, 0 );
+  if (!enable_tabs) {
+    gtk_box_pack_start( GTK_BOX( GTK_DIALOG(science_dialog_shell)->vbox ),
+                        frame, FALSE, FALSE, 0 );
+  } else {
+    gtk_box_pack_start( GTK_BOX( science_dialog_shell ),
+                        frame, FALSE, FALSE, 0 );
+  }
 
   hbox = gtk_hbox_new( TRUE, 5 );
   gtk_container_add(GTK_CONTAINER(frame),hbox);
@@ -235,8 +260,13 @@
   gtk_box_pack_start( GTK_BOX( hbox ), w,TRUE, FALSE, 0 );
 
   hbox = gtk_hbox_new(TRUE, 0);
-  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(science_dialog_shell)->vbox),
-                    hbox, TRUE, TRUE, 5);
+  if (!enable_tabs) {
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(science_dialog_shell)->vbox),
+                       hbox, TRUE, TRUE, 5);
+  } else {
+    gtk_box_pack_start(GTK_BOX(science_dialog_shell),
+                       hbox, TRUE, TRUE, 5);
+  }
 
 
 
@@ -263,11 +293,17 @@
                     G_CALLBACK(science_help_callback), science_model[i]);
   }
 
-  gtk_widget_show_all(GTK_DIALOG(science_dialog_shell)->vbox);
+  if (!enable_tabs) {
+    gtk_widget_show_all(GTK_DIALOG(science_dialog_shell)->vbox);
+  } else {
+    gtk_widget_show_all(science_dialog_shell);
+  }
 
   science_dialog_update();
-  gtk_window_set_focus(GTK_WINDOW(science_dialog_shell),
-       science_change_menu_button);
+  if (!enable_tabs) {
+    gtk_window_set_focus(GTK_WINDOW(science_dialog_shell),
+                         science_change_menu_button);
+  }
 }
 
 /****************************************************************
@@ -594,10 +630,14 @@
     economy_dialog_shell_is_modal = make_modal;
 
     create_economy_report_dialog(make_modal);
-    gtk_set_relative_position(toplevel, economy_dialog_shell, 10, 10);
+    if (!enable_tabs) {
+      gtk_set_relative_position(toplevel, economy_dialog_shell, 10, 10);
+    }
   }
 
-  gtk_window_present(GTK_WINDOW(economy_dialog_shell));
+  if (!enable_tabs) {
+    gtk_window_present(GTK_WINDOW(economy_dialog_shell));
+  }
 }
 
 
@@ -606,8 +646,10 @@
 ****************************************************************/
 void popdown_economy_report_dialog(void)
 {
-  if (economy_dialog_shell) {
-    gtk_widget_destroy(economy_dialog_shell);
+  if (!enable_tabs) {
+    if (economy_dialog_shell) {
+      gtk_widget_destroy(economy_dialog_shell);
+    }
   }
 }
  
@@ -636,18 +678,22 @@
 
   intl_slist(ARRAY_SIZE(titles), titles, &titles_done);
   
-  economy_dialog_shell = gtk_dialog_new_with_buttons(_("Economy"),
-       NULL,
-       0,
-       NULL);
-  setup_dialog(economy_dialog_shell, toplevel);
-  gtk_dialog_set_default_response(GTK_DIALOG(economy_dialog_shell),
-       GTK_RESPONSE_CLOSE);
-
-  if (make_modal) {
-    gtk_window_set_transient_for(GTK_WINDOW(economy_dialog_shell),
-                                GTK_WINDOW(toplevel));
-    gtk_window_set_modal(GTK_WINDOW(economy_dialog_shell), TRUE);
+  if (!enable_tabs) {
+    economy_dialog_shell = gtk_dialog_new_with_buttons(_("Economy"),
+                                                       NULL,
+                                                       0,
+                                                       NULL);
+    setup_dialog(economy_dialog_shell, toplevel);
+    gtk_dialog_set_default_response(GTK_DIALOG(economy_dialog_shell),
+                                    GTK_RESPONSE_CLOSE);
+
+    if (make_modal) {
+      gtk_window_set_transient_for(GTK_WINDOW(economy_dialog_shell),
+                                   GTK_WINDOW(toplevel));
+      gtk_window_set_modal(GTK_WINDOW(economy_dialog_shell), TRUE);
+    }
+  } else {
+    economy_dialog_shell = tnbecon;
   }
 
   economy_store = gtk_list_store_newv(ARRAY_SIZE(model_types), model_types);
@@ -657,8 +703,13 @@
                                      GTK_SHADOW_ETCHED_IN);
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
                                 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(economy_dialog_shell)->vbox),
-       sw, TRUE, TRUE, 0);
+  if (!enable_tabs) {
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(economy_dialog_shell)->vbox),
+                       sw, TRUE, TRUE, 0);
+  } else {
+    gtk_box_pack_start(GTK_BOX(economy_dialog_shell),
+                       sw, TRUE, TRUE, 0);
+  }
 
   view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(economy_store));
   g_object_unref(economy_store);
@@ -691,33 +742,57 @@
   gtk_container_add(GTK_CONTAINER(sw), view);
 
   economy_label2 = gtk_label_new(_("Total Cost:"));
-  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(economy_dialog_shell)->vbox),
-       economy_label2, FALSE, FALSE, 0);
+  if (!enable_tabs) {
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(economy_dialog_shell)->vbox),
+                       economy_label2, FALSE, FALSE, 0);
+  } else {
+    gtk_box_pack_start(GTK_BOX(economy_dialog_shell),
+                       economy_label2, FALSE, FALSE, 0);
+  }
   gtk_misc_set_padding(GTK_MISC(economy_label2), 5, 5);
 
   sellobsolete_command = gtk_button_new_with_mnemonic(_("Sell _Obsolete"));
-  gtk_dialog_add_action_widget(GTK_DIALOG(economy_dialog_shell),
-                              sellobsolete_command, ECONOMY_SELL_OBSOLETE);
+  if (!enable_tabs) {
+    gtk_dialog_add_action_widget(GTK_DIALOG(economy_dialog_shell),
+                                 sellobsolete_command, ECONOMY_SELL_OBSOLETE);
+  } else {
+    g_signal_connect(sellobsolete_command, "clicked",
+                     G_CALLBACK(economy_command_callback), 
sellobsolete_command,
+                     ECONOMY_SELL_OBSOLETE);
+    gtk_box_pack_start(GTK_BOX(economy_dialog_shell), sellobsolete_command, 
FALSE, FALSE, 0);
+  }
   gtk_widget_set_sensitive(sellobsolete_command, FALSE);
 
   sellall_command = gtk_button_new_with_mnemonic(_("Sell _All"));
-  gtk_dialog_add_action_widget(GTK_DIALOG(economy_dialog_shell),
-                              sellall_command, ECONOMY_SELL_ALL);
+  if (!enable_tabs) {
+    gtk_dialog_add_action_widget(GTK_DIALOG(economy_dialog_shell),
+                                 sellall_command, ECONOMY_SELL_ALL);
+  } else {
+    g_signal_connect(sellall_command, "clicked",
+                     G_CALLBACK(economy_command_callback), ECONOMY_SELL_ALL);
+    gtk_box_pack_start(GTK_BOX(economy_dialog_shell), sellall_command, FALSE, 
FALSE, 0);
+  }
   gtk_widget_set_sensitive(sellall_command, FALSE);
 
-  gtk_dialog_add_button(GTK_DIALOG(economy_dialog_shell),
-                       GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
-
-  g_signal_connect(economy_dialog_shell, "response",
-                  G_CALLBACK(economy_command_callback), NULL);
-  g_signal_connect(economy_dialog_shell, "destroy",
-                  G_CALLBACK(gtk_widget_destroyed), &economy_dialog_shell);
+  if (!enable_tabs) {
+    gtk_dialog_add_button(GTK_DIALOG(economy_dialog_shell),
+                          GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+    
+    g_signal_connect(economy_dialog_shell, "response",
+                     G_CALLBACK(economy_command_callback), NULL);
+    g_signal_connect(economy_dialog_shell, "destroy",
+                     G_CALLBACK(gtk_widget_destroyed), &economy_dialog_shell);
+  }
 
   economy_report_dialog_update();
-  gtk_window_set_default_size(GTK_WINDOW(economy_dialog_shell), -1, 350);
+  if (!enable_tabs) 
gtk_window_set_default_size(GTK_WINDOW(economy_dialog_shell), -1, 350);
 
-  gtk_widget_show_all(GTK_DIALOG(economy_dialog_shell)->vbox);
-  gtk_widget_show_all(GTK_DIALOG(economy_dialog_shell)->action_area);
+  if (!enable_tabs) {
+    gtk_widget_show_all(GTK_DIALOG(economy_dialog_shell)->vbox);
+    gtk_widget_show_all(GTK_DIALOG(economy_dialog_shell)->action_area);
+  } else {
+    gtk_widget_show_all(economy_dialog_shell);
+  }
 
   gtk_tree_view_focus(GTK_TREE_VIEW(view));
 }
@@ -888,10 +963,14 @@
     activeunits_dialog_shell_is_modal = make_modal;
     
     create_activeunits_report_dialog(make_modal);
-    gtk_set_relative_position(toplevel, activeunits_dialog_shell, 10, 10);
+    if  (!enable_tabs) {
+      gtk_set_relative_position(toplevel, activeunits_dialog_shell, 10, 10);
+    }
   }
 
-  gtk_window_present(GTK_WINDOW(activeunits_dialog_shell));
+  if (!enable_tabs) {
+    gtk_window_present(GTK_WINDOW(activeunits_dialog_shell));
+  }
 }
 
 
@@ -900,8 +979,10 @@
 ****************************************************************/
 void popdown_activeunits_report_dialog(void)
 {
-  if (activeunits_dialog_shell) {
-    gtk_widget_destroy(activeunits_dialog_shell);
+  if (!enable_tabs) {
+    if (activeunits_dialog_shell) {
+      gtk_widget_destroy(activeunits_dialog_shell);
+    }
   }
 }
 
@@ -938,18 +1019,22 @@
 
   intl_slist(ARRAY_SIZE(titles), titles, &titles_done);
 
-  activeunits_dialog_shell = gtk_dialog_new_with_buttons(_("Units"),
-       NULL,
-       0,
-       NULL);
-  setup_dialog(activeunits_dialog_shell, toplevel);
-  gtk_dialog_set_default_response(GTK_DIALOG(activeunits_dialog_shell),
-       GTK_RESPONSE_CLOSE);
-
-  if (make_modal) {
-    gtk_window_set_transient_for(GTK_WINDOW(activeunits_dialog_shell),
-                                GTK_WINDOW(toplevel));
-    gtk_window_set_modal(GTK_WINDOW(activeunits_dialog_shell), TRUE);
+  if (!enable_tabs) {
+    activeunits_dialog_shell = gtk_dialog_new_with_buttons(_("Units"),
+                                                           NULL,
+                                                           0,
+                                                           NULL);
+    setup_dialog(activeunits_dialog_shell, toplevel);
+    gtk_dialog_set_default_response(GTK_DIALOG(activeunits_dialog_shell),
+                                    GTK_RESPONSE_CLOSE);
+    
+    if (make_modal) {
+      gtk_window_set_transient_for(GTK_WINDOW(activeunits_dialog_shell),
+                                   GTK_WINDOW(toplevel));
+      gtk_window_set_modal(GTK_WINDOW(activeunits_dialog_shell), TRUE);
+    }
+  } else {
+    activeunits_dialog_shell = tnbunits;
   }
 
   activeunits_store = gtk_list_store_newv(ARRAY_SIZE(model_types), 
model_types);
@@ -959,8 +1044,13 @@
                                      GTK_SHADOW_ETCHED_IN);
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
                                 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(activeunits_dialog_shell)->vbox),
-       sw, TRUE, TRUE, 0);
+  if (!enable_tabs) {
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(activeunits_dialog_shell)->vbox),
+                       sw, TRUE, TRUE, 0);
+  } else {
+    gtk_box_pack_start(GTK_BOX(activeunits_dialog_shell),
+                       sw, TRUE, TRUE, 0);
+  }
 
   view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(activeunits_store));
   g_object_unref(activeunits_store);
@@ -994,30 +1084,48 @@
   gtk_container_add(GTK_CONTAINER(sw), view);
 
   command = gtk_stockbutton_new(GTK_STOCK_FIND, _("Find _Nearest"));
-  gtk_dialog_add_action_widget(GTK_DIALOG(activeunits_dialog_shell),
-                              command, ACTIVEUNITS_NEAREST);
+  if (!enable_tabs) {
+    gtk_dialog_add_action_widget(GTK_DIALOG(activeunits_dialog_shell),
+                                 command, ACTIVEUNITS_NEAREST);
+  } else {
+    g_signal_connect(command, "clicked",
+                     G_CALLBACK(activeunits_command_callback), 
ACTIVEUNITS_NEAREST);
+    gtk_box_pack_start(GTK_BOX(activeunits_dialog_shell), command, FALSE, 
FALSE, 0);
+  }
   gtk_dialog_set_response_sensitive(GTK_DIALOG(activeunits_dialog_shell),
-                                   ACTIVEUNITS_NEAREST, FALSE);        
+                                   ACTIVEUNITS_NEAREST, FALSE);        */
   
   command = gtk_button_new_with_mnemonic(_("_Upgrade"));
-  gtk_dialog_add_action_widget(GTK_DIALOG(activeunits_dialog_shell),
-                              command, ACTIVEUNITS_UPGRADE);
+  if (!enable_tabs) {
+    gtk_dialog_add_action_widget(GTK_DIALOG(activeunits_dialog_shell),
+                                 command, ACTIVEUNITS_UPGRADE);
+  } else {
+    g_signal_connect(command, "clicked",
+                     G_CALLBACK(activeunits_command_callback), 
ACTIVEUNITS_UPGRADE);
+    gtk_box_pack_start(GTK_BOX(activeunits_dialog_shell), command, FALSE, 
FALSE, 0);
+  }
   gtk_dialog_set_response_sensitive(GTK_DIALOG(activeunits_dialog_shell),
                                    ACTIVEUNITS_UPGRADE, FALSE);        
 
-  gtk_dialog_add_button(GTK_DIALOG(activeunits_dialog_shell),
-                       GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+  if (!enable_tabs) {
+    gtk_dialog_add_button(GTK_DIALOG(activeunits_dialog_shell),
+                          GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
 
-  g_signal_connect(activeunits_dialog_shell, "response",
+    g_signal_connect(activeunits_dialog_shell, "response",
                   G_CALLBACK(activeunits_command_callback), NULL);
-  g_signal_connect(activeunits_dialog_shell, "destroy",
+    g_signal_connect(activeunits_dialog_shell, "destroy",
                   G_CALLBACK(gtk_widget_destroyed), &activeunits_dialog_shell);
+  }
 
   activeunits_report_dialog_update();
-  gtk_window_set_default_size(GTK_WINDOW(activeunits_dialog_shell), -1, 350);
+  if (!enable_tabs) 
gtk_window_set_default_size(GTK_WINDOW(activeunits_dialog_shell), -1, 350);
 
-  gtk_widget_show_all(GTK_DIALOG(activeunits_dialog_shell)->vbox);
-  gtk_widget_show_all(GTK_DIALOG(activeunits_dialog_shell)->action_area);
+  if (!enable_tabs) {
+    gtk_widget_show_all(GTK_DIALOG(activeunits_dialog_shell)->vbox);
+    gtk_widget_show_all(GTK_DIALOG(activeunits_dialog_shell)->action_area);
+  } else {
+    gtk_widget_show_all(activeunits_dialog_shell);
+  }
 
   gtk_tree_view_focus(GTK_TREE_VIEW(view));
 }
@@ -1045,26 +1153,28 @@
     }
   }
 
-  if (!is_unit_type) {
-    gtk_dialog_set_response_sensitive(GTK_DIALOG(activeunits_dialog_shell),
-                                     ACTIVEUNITS_NEAREST, FALSE);
-
-    gtk_dialog_set_response_sensitive(GTK_DIALOG(activeunits_dialog_shell),
-                                     ACTIVEUNITS_UPGRADE, FALSE);
-  } else {
-    gtk_dialog_set_response_sensitive(GTK_DIALOG(activeunits_dialog_shell),
-                                     ACTIVEUNITS_NEAREST,
-                                     can_client_issue_orders());       
-    
-    if (can_upgrade_unittype(game.player_ptr, activeunits_type[row]) != -1) {
+  if (!enable_tabs) {
+    if (!is_unit_type) {
+      gtk_dialog_set_response_sensitive(GTK_DIALOG(activeunits_dialog_shell),
+                                        ACTIVEUNITS_NEAREST, FALSE);
+      
       gtk_dialog_set_response_sensitive(GTK_DIALOG(activeunits_dialog_shell),
-                                       ACTIVEUNITS_UPGRADE,
-                                       can_client_issue_orders());     
+                                        ACTIVEUNITS_UPGRADE, FALSE);
     } else {
       gtk_dialog_set_response_sensitive(GTK_DIALOG(activeunits_dialog_shell),
-                                       ACTIVEUNITS_UPGRADE, FALSE);
+                                        ACTIVEUNITS_NEAREST,
+                                        can_client_issue_orders());    
+      
+      if (can_upgrade_unittype(game.player_ptr, activeunits_type[row]) != -1) {
+        gtk_dialog_set_response_sensitive(GTK_DIALOG(activeunits_dialog_shell),
+                                          ACTIVEUNITS_UPGRADE,
+                                          can_client_issue_orders());  
+      } else {
+        gtk_dialog_set_response_sensitive(GTK_DIALOG(activeunits_dialog_shell),
+                                          ACTIVEUNITS_UPGRADE, FALSE);
+      }
     }
-  }
+  } /* FIXME: NEEDS EQUIV. FOR TABBED */
 }
 
 /****************************************************************
@@ -1133,6 +1243,7 @@
   } else {
     ut2 = can_upgrade_unittype(game.player_ptr, activeunits_type[row]);
 
+    /* FIXME */
     shell = gtk_message_dialog_new(
          GTK_WINDOW(activeunits_dialog_shell),
          GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
diff -ruN -X freeciv/diff_ignore freeciv/client/options.c 
tabbed/client/options.c
--- freeciv/client/options.c    2004-08-26 00:59:01.000000000 -0700
+++ tabbed/client/options.c     2004-09-30 21:56:16.000000000 -0700
@@ -71,6 +71,7 @@
 bool popup_new_cities = TRUE;
 bool keyboardless_goto = TRUE;
 bool show_task_icons = TRUE;
+bool enable_tabs = FALSE;
 
 /* This option is currently set by the client - not by the user. */
 bool update_city_text_in_refresh_tile = TRUE;
@@ -105,6 +106,7 @@
   GEN_BOOL_OPTION(auto_turn_done,           N_("End Turn when done moving")),
   GEN_BOOL_OPTION(ask_city_name,            N_("Prompt for city names")),
   GEN_BOOL_OPTION(popup_new_cities,         N_("Pop up city dialog for new 
cities")),
+  GEN_BOOL_OPTION(enable_tabs,              N_("Enable status report tabs")),
 };
 #undef GEN_INT_OPTION
 #undef GEN_BOOL_OPTION
diff -ruN -X freeciv/diff_ignore freeciv/client/options.h 
tabbed/client/options.h
--- freeciv/client/options.h    2004-08-02 17:09:44.000000000 -0700
+++ tabbed/client/options.h     2004-09-30 21:54:39.000000000 -0700
@@ -46,6 +46,7 @@
 extern bool update_city_text_in_refresh_tile;
 extern bool keyboardless_goto;
 extern bool show_task_icons;
+extern bool enable_tabs;
 
 enum client_option_type {
   COT_BOOL,
diff -ruN -X freeciv/diff_ignore freeciv/client/packhand.c 
tabbed/client/packhand.c
--- freeciv/client/packhand.c   2004-09-28 19:24:19.000000000 -0700
+++ tabbed/client/packhand.c    2004-10-01 21:29:30.000000000 -0700
@@ -354,6 +354,14 @@
     /* Find something sensible to display instead of the intro gfx. */
     center_on_something();
     
+    if (enable_tabs) {
+      popup_city_report_dialog(0);
+      popup_activeunits_report_dialog(0);
+      popup_players_dialog();
+      popup_economy_report_dialog(0);
+      popup_science_dialog(0);
+    }
+    
     free_intro_radar_sprites();
     agents_game_start();
   }
diff -ruN -X freeciv/diff_ignore freeciv/client/plrdlg_common.c 
tabbed/client/plrdlg_common.c
--- freeciv/client/plrdlg_common.c      2004-08-15 02:47:04.000000000 -0700
+++ tabbed/client/plrdlg_common.c       2004-09-30 21:34:56.000000000 -0700
@@ -223,9 +223,9 @@
   {TRUE, COL_TEXT, N_("Vision"), col_vision, NULL, "vision"},
   {TRUE, COL_TEXT, N_("Reputation"), col_reputation, NULL, "reputation"},
   {TRUE, COL_TEXT, N_("State"), col_state, NULL, "state"},
-  {TRUE, COL_TEXT, N_("?Player_dlg:Host"), col_host, NULL, "host"},
-  {TRUE, COL_RIGHT_TEXT, N_("?Player_dlg:Idle"), col_idle, NULL, "idle"},
-  {TRUE, COL_RIGHT_TEXT, N_("Ping"), get_ping_time_text, NULL, "ping"}
+  {FALSE, COL_TEXT, N_("?Player_dlg:Host"), col_host, NULL, "host"},
+  {FALSE, COL_RIGHT_TEXT, N_("?Player_dlg:Idle"), col_idle, NULL, "idle"},
+  {FALSE, COL_RIGHT_TEXT, N_("Ping"), get_ping_time_text, NULL, "ping"}
 };
 
 const int num_player_dlg_columns = ARRAY_SIZE(player_dlg_columns);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10435) Repodlg tabs in GTK+2 client, Gregor Richards <=