diff -burd freeciv-1.10.0.orig/client/control.c freeciv-1.10.0/client/control.c --- freeciv-1.10.0.orig/client/control.c Thu Feb 24 19:47:50 2000 +++ freeciv-1.10.0/client/control.c Sat Feb 26 21:41:31 2000 @@ -509,6 +509,28 @@ } /************************************************************************** + Toggle display of city names +**************************************************************************/ +void request_toggle_city_names(void) +{ + if(get_client_state()!=CLIENT_GAME_RUNNING_STATE) return; + + draw_city_names^=1; + update_map_canvas_visible(); +} + +/************************************************************************** + Toggle display of city productions +**************************************************************************/ +void request_toggle_city_productions(void) +{ + if(get_client_state()!=CLIENT_GAME_RUNNING_STATE) return; + + draw_city_productions^=1; + update_map_canvas_visible(); +} + +/************************************************************************** ... **************************************************************************/ void do_move_unit(struct unit *punit, struct packet_unit_info *pinfo) @@ -785,6 +807,22 @@ void key_map_grid_toggle(void) { request_toggle_map_grid(); +} + +/************************************************************************** +... +**************************************************************************/ +void key_city_names_toggle(void) +{ + request_toggle_city_names(); +} + +/************************************************************************** +... +**************************************************************************/ +void key_city_productions_toggle(void) +{ + request_toggle_city_productions(); } /************************************************************************** diff -burd freeciv-1.10.0.orig/client/control.h freeciv-1.10.0/client/control.h --- freeciv-1.10.0.orig/client/control.h Thu Feb 24 19:47:50 2000 +++ freeciv-1.10.0/client/control.h Sat Feb 26 21:41:31 2000 @@ -43,6 +43,8 @@ void request_unit_wait(struct unit *punit); void request_unit_wakeup(struct unit *punit); void request_toggle_map_grid(void); +void request_toggle_city_names(void); +void request_toggle_city_productions(void); void wakeup_sentried_units(int x, int y); @@ -55,6 +57,8 @@ void key_cancel_action(void); void key_end_turn(void); void key_map_grid_toggle(void); +void key_city_names_toggle(void); +void key_city_productions_toggle(void); void key_move_north(void); void key_move_north_east(void); void key_move_east(void); diff -burd freeciv-1.10.0.orig/client/gui-gtk/mapctrl.c freeciv-1.10.0/client/gui-gtk/mapctrl.c --- freeciv-1.10.0.orig/client/gui-gtk/mapctrl.c Thu Feb 24 19:47:51 2000 +++ freeciv-1.10.0/client/gui-gtk/mapctrl.c Sat Feb 26 21:41:31 2000 @@ -58,6 +58,8 @@ extern int smooth_move_units; /* from options.o */ extern int auto_center_on_unit; extern int draw_map_grid; +extern int draw_city_names; +extern int draw_city_productions; /************************************************************************** ... diff -burd freeciv-1.10.0.orig/client/gui-gtk/mapview.c freeciv-1.10.0/client/gui-gtk/mapview.c --- freeciv-1.10.0.orig/client/gui-gtk/mapview.c Thu Feb 24 19:47:51 2000 +++ freeciv-1.10.0/client/gui-gtk/mapview.c Mon Feb 28 18:16:12 2000 @@ -112,7 +112,7 @@ int x, int y, struct Sprite *ssprite); static void put_overlay_tile_gpixmap(GtkPixcomm *pixmap, int x, int y, struct Sprite *ssprite); -static void show_city_names(void); +static void show_city_descriptions(void); /* the intro picture is held in this pixmap, which is scaled to @@ -877,7 +877,7 @@ height*NORMAL_TILE_HEIGHT ); if(width==map_canvas_store_twidth && height==map_canvas_store_theight) { - show_city_names(); + show_city_descriptions(); } } @@ -923,9 +923,21 @@ /************************************************************************** ... **************************************************************************/ -static void show_city_names(void) +void update_city_descriptions(void) +{ + update_map_canvas(0,0,map_canvas_store_twidth,map_canvas_store_theight,1); +} + +/************************************************************************** +... +**************************************************************************/ +static void show_city_descriptions(void) { int x, y; + static char prod_desc[512],whole_desc[512]; + + if(!draw_city_names && !draw_city_productions) + return; for(y=0; yname); + int w; + + if(draw_city_productions) + { + int turns; + struct unit_type *punit_type; + struct improvement_type *pimprovement_type; + + turns=city_turns_to_build(pcity,pcity->currently_building, + pcity->is_building_unit); + + if(pcity->is_building_unit) + { + punit_type=get_unit_type(pcity->currently_building); + my_snprintf(prod_desc, sizeof(prod_desc), "%s %d", + punit_type->name, + /*pcity->shield_stock, + punit_type->build_cost,*/ + turns); + + } + else + { + pimprovement_type=get_improvement_type(pcity->currently_building); + my_snprintf(prod_desc, sizeof(prod_desc), "%s %d", + pimprovement_type->name, + turns); + } + } + + my_snprintf(whole_desc, sizeof(whole_desc), "%s%s%s", + draw_city_names ? pcity->name : "", + (draw_city_names && draw_city_productions)?" ":"", + draw_city_productions ? prod_desc : ""); + w=gdk_string_width(main_font, whole_desc); /*FIXME*/ gdk_draw_string( map_canvas->window, main_font, toplevel->style->black_gc, x*NORMAL_TILE_WIDTH+NORMAL_TILE_WIDTH/2-w/2+1, (y+1)*NORMAL_TILE_HEIGHT+main_font->ascent+1, - pcity->name ); + whole_desc); gdk_draw_string( map_canvas->window, main_font, toplevel->style->white_gc, x*NORMAL_TILE_WIDTH+NORMAL_TILE_WIDTH/2-w/2, (y+1)*NORMAL_TILE_HEIGHT+main_font->ascent, - pcity->name ); + whole_desc); } } } diff -burd freeciv-1.10.0.orig/client/gui-gtk/menu.c freeciv-1.10.0/client/gui-gtk/menu.c --- freeciv-1.10.0.orig/client/gui-gtk/menu.c Thu Feb 24 19:47:51 2000 +++ freeciv-1.10.0/client/gui-gtk/menu.c Sat Feb 26 21:41:31 2000 @@ -81,6 +81,8 @@ MENU_KINGDOM_REVOLUTION, MENU_VIEW_SHOW_MAP_GRID, + MENU_VIEW_SHOW_CITY_NAMES, + MENU_VIEW_SHOW_CITY_PRODUCTIONS, MENU_VIEW_CENTER_VIEW, MENU_ORDER_AUTO_SETTLER, @@ -214,8 +216,17 @@ { switch(callback_action) { case MENU_VIEW_SHOW_MAP_GRID: + if(draw_map_grid ^ GTK_CHECK_MENU_ITEM(widget)->active) key_map_grid_toggle (); break; + case MENU_VIEW_SHOW_CITY_NAMES: + if(draw_city_names ^ GTK_CHECK_MENU_ITEM(widget)->active) + key_city_names_toggle (); + break; + case MENU_VIEW_SHOW_CITY_PRODUCTIONS: + if(draw_city_productions ^ GTK_CHECK_MENU_ITEM(widget)->active) + key_city_productions_toggle (); + break; case MENU_VIEW_CENTER_VIEW: center_on_unit(); break; @@ -519,6 +530,11 @@ 0, "" }, { "/" N_("View") "/" N_("Map Grid"), "g", view_menu_callback, MENU_VIEW_SHOW_MAP_GRID, "" }, + { "/" N_("View") "/" N_("City Names"), "n", view_menu_callback, + MENU_VIEW_SHOW_CITY_NAMES, "" }, + { "/" N_("View") "/" N_("City Productions"),"p", view_menu_callback, + MENU_VIEW_SHOW_CITY_PRODUCTIONS, "" }, + { "/" N_("View") "/" N_("Center View"), "c", view_menu_callback, MENU_VIEW_CENTER_VIEW }, @@ -746,6 +762,26 @@ gtk_widget_set_sensitive(item, sensitive); } +/**************************************************************** +... +*****************************************************************/ +static void menus_set_active(const char *path, int active) +{ + GtkWidget *item; + + path = translate_menu_path(path); + + if(!(item=gtk_item_factory_get_widget(item_factory, path))) { + freelog(LOG_VERBOSE, + "Can't set active for non-existent menu %s.", path); + return; + } + + if(GTK_IS_MENU(item)) + item=gtk_menu_get_attach_widget(GTK_MENU(item)); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), active); +} + #ifdef UNUSED /**************************************************************** ... @@ -836,6 +872,12 @@ menus_set_sensitive("
/Reports/Spaceship", (game.player_ptr->spaceship.state!=SSHIP_NONE)); + + menus_set_sensitive("
/View/ViewDisconnect", TRUE); + + menus_set_active("
/View/Map Grid", draw_map_grid); + menus_set_active("
/View/City Names", draw_city_names); + menus_set_active("
/View/City Productions", draw_city_productions); if((punit=get_unit_in_focus())) { char *chgfmt = _("Change to %s"); diff -burd freeciv-1.10.0.orig/client/include/mapview_g.h freeciv-1.10.0/client/include/mapview_g.h --- freeciv-1.10.0.orig/client/include/mapview_g.h Thu Feb 24 19:47:53 2000 +++ freeciv-1.10.0/client/include/mapview_g.h Sat Feb 26 21:41:31 2000 @@ -30,6 +30,7 @@ void update_timeout_label(void); void update_unit_pix_label(struct unit *punit); void update_turn_done_button(int do_restore); +void update_city_descriptions(void); void set_bulb_sol_government(int bulb, int sol, int government); void set_overview_dimensions(int x, int y); diff -burd freeciv-1.10.0.orig/client/options.c freeciv-1.10.0/client/options.c --- freeciv-1.10.0.orig/client/options.c Thu Feb 24 19:47:50 2000 +++ freeciv-1.10.0/client/options.c Sat Feb 26 21:41:31 2000 @@ -44,6 +44,8 @@ int center_when_popup_city=1; int concise_city_production=0; int draw_map_grid=0; +int draw_city_names=1; +int draw_city_productions=0; #define GEN_OPTION(name, description) { #name, description, &name, NULL } #define NULL_OPTION { NULL, NULL, NULL, NULL } diff -burd freeciv-1.10.0.orig/client/options.h freeciv-1.10.0/client/options.h --- freeciv-1.10.0.orig/client/options.h Thu Feb 24 19:47:50 2000 +++ freeciv-1.10.0/client/options.h Sat Feb 26 21:41:31 2000 @@ -25,6 +25,8 @@ extern int center_when_popup_city; extern int concise_city_production; extern int draw_map_grid; +extern int draw_city_names; +extern int draw_city_productions; typedef struct { char *name; diff -burd freeciv-1.10.0.orig/client/packhand.c freeciv-1.10.0/client/packhand.c --- freeciv-1.10.0.orig/client/packhand.c Thu Feb 24 19:47:50 2000 +++ freeciv-1.10.0/client/packhand.c Sat Feb 26 21:41:31 2000 @@ -332,6 +332,8 @@ meswin_update_delay_off(); update_meswin_dialog(); + update_city_descriptions(); + if(game.player_ptr->ai.control && !ai_manual_turn_done) user_ended_turn(); }