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

Attached patch greatly expands tooltips and fixes a few
that were not being shown because their widget needed to
be in an event box.

Also, widget layout was improved in the property editor,
and the close button was moved to the tab label (like
other tabs in the lower notebook).


-----------------------------------------------------------------------
儀式は始まりました。さあ、急ぎましょう!
diff --git a/client/editor.c b/client/editor.c
index bb77155..68fcc99 100644
--- a/client/editor.c
+++ b/client/editor.c
@@ -108,28 +108,33 @@ void editor_init(void)
 
   SET_TOOL(ETT_TERRAIN, _("Terrain"),
            ETF_HAS_VALUE | ETF_HAS_SIZE,
-           _("Change tile terrain."));
+           _("Change tile terrain.\nShortcut: t.\n"
+             "Select terrain type: shift+t or right-click here."));
   SET_TOOL(ETT_TERRAIN_RESOURCE, _("Terrain Resource"),
            ETF_HAS_VALUE | ETF_HAS_SIZE,
-           _("Change tile terrain resources."));
+           _("Change tile terrain resources.\nShortcut: r.\n"
+             "Select resource type: shift+r or right-click here."));
   SET_TOOL(ETT_TERRAIN_SPECIAL, _("Terrain Special"),
            ETF_HAS_VALUE | ETF_HAS_SIZE | ETF_HAS_VALUE_ERASE,
-           _("Modify tile specials."));
+           _("Modify tile specials.\nShortcut: s.\n"
+             "Select special type: shift+s or right-click here."));
   SET_TOOL(ETT_MILITARY_BASE, _("Military Base"),
            ETF_HAS_VALUE | ETF_HAS_SIZE | ETF_HAS_VALUE_ERASE,
-           _("Create a military base."));
+           _("Create a military base.\nShortcut: m.\n"
+             "Select base type: shift+m or right-click here."));
   SET_TOOL(ETT_UNIT, _("Unit"), ETF_HAS_VALUE | ETF_HAS_COUNT
            | ETF_HAS_APPLIED_PLAYER | ETF_HAS_VALUE_ERASE,
-           _("Create unit."));
+           _("Create unit.\nShortcut: u.\n"
+             "Select unit type: shift+u or right-click here."));
   SET_TOOL(ETT_CITY, _("City"), ETF_HAS_SIZE | ETF_HAS_APPLIED_PLAYER,
-           _("Create city."));
+           _("Create city.\nShortcut: c."));
   SET_TOOL(ETT_VISION, _("Vision"), ETF_HAS_SIZE,
-           _("Modify player's tile knowledge."));
+           _("Modify player's tile knowledge.\nShortcut: v."));
   SET_TOOL(ETT_TERRITORY, _("Territory"),
            ETF_HAS_SIZE | ETF_HAS_APPLIED_PLAYER,
-           _("Change tile ownership."));
+           _("Change tile ownership.\nShortcut: b."));
   SET_TOOL(ETT_STARTPOS, _("Start Position"), ETF_HAS_APPLIED_PLAYER,
-           _("Place a player start position."));
+           _("Place a player start position.\nShortcut: p."));
 #undef SET_TOOL
 
   editor_set_size(1);
diff --git a/client/gui-gtk-2.0/editgui.c b/client/gui-gtk-2.0/editgui.c
index fdd66b6..23f46f7 100644
--- a/client/gui-gtk-2.0/editgui.c
+++ b/client/gui-gtk-2.0/editgui.c
@@ -403,7 +403,7 @@ static void editbar_player_properties_button_clicked(GtkButton *b,
 static struct editbar *editbar_create(void)
 {
   struct editbar *eb;
-  GtkWidget *hbox, *button, *combo, *image, *separator, *vbox;
+  GtkWidget *hbox, *button, *combo, *image, *separator, *vbox, *evbox;
   GtkRadioButton *radio_parent;
   GtkListStore *store;
   GtkCellRenderer *cell;
@@ -418,13 +418,13 @@ static struct editbar *editbar_create(void)
 
   sprites = get_editor_sprites(tileset);
 
-  /* Erase tool. */
+  /* Erase mode toggle. */
   button = gtk_toggle_button_new();
   pixbuf = sprite_get_pixbuf(sprites->erase);
   image = gtk_image_new_from_pixbuf(pixbuf);
   gtk_container_add(GTK_CONTAINER(button), image);
   gtk_tooltips_set_tip(eb->tooltips, button,
-                       _("Set Erase Mode"), "");
+      _("Toggle erase mode.\nShortcut: shift-d."), "");
   gtk_widget_set_size_request(button, BWIDTH, BHEIGHT);
   gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
   gtk_button_set_focus_on_click(GTK_BUTTON(button), FALSE);
@@ -461,6 +461,9 @@ static struct editbar *editbar_create(void)
   gtk_box_pack_start(GTK_BOX(hbox), separator, FALSE, FALSE, 0);
 
   /* Player POV indicator. */
+  vbox = gtk_vbox_new(FALSE, 0);
+  gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
+
   store = gtk_list_store_new(PPV_NUM_COLS,
                              GDK_TYPE_PIXBUF,
                              G_TYPE_STRING);
@@ -478,23 +481,26 @@ static struct editbar *editbar_create(void)
   gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combo),
                                 cell, "text", PPV_COL_NAME);
 
-  gtk_tooltips_set_tip(eb->tooltips, combo,
-                       _("Switch Point of View"), "");
   gtk_widget_set_size_request(combo, 140, -1);
   g_signal_connect(combo, "changed",
                    G_CALLBACK(editbar_player_pov_combobox_changed), eb);
-  vbox = gtk_vbox_new(FALSE, 0);
-  gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
-  gtk_box_pack_start(GTK_BOX(vbox), combo, TRUE, FALSE, 0);
+
+  evbox = gtk_event_box_new();
+  gtk_tooltips_set_tip(eb->tooltips, evbox,
+      _("Switch player point-of-view. Use this to edit "
+        "from the perspective of different players, or "
+        "even as a global observer."), "");
+  gtk_container_add(GTK_CONTAINER(evbox), combo);
+  gtk_box_pack_start(GTK_BOX(vbox), evbox, TRUE, FALSE, 0);
   eb->player_pov_combobox = combo;
 
-  /* Player properties button. */
+  /* Property editor button. */
   button = gtk_button_new();
   pixbuf = sprite_get_pixbuf(sprites->properties);
   image = gtk_image_new_from_pixbuf(pixbuf);
   gtk_container_add(GTK_CONTAINER(button), image);
   gtk_tooltips_set_tip(eb->tooltips, button,
-                       _("Modify Player"), "");
+      _("Bring up the property editor."), "");
   gtk_widget_set_size_request(button, BWIDTH, BHEIGHT);
   gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
   gtk_button_set_focus_on_click(GTK_BUTTON(button), FALSE);
@@ -1088,13 +1094,13 @@ static struct editinfobox *editinfobox_create(void)
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
   evbox = gtk_event_box_new();
+  gtk_tooltips_set_tip(ei->tooltips, evbox,
+                       _("Click to change value if applicable."), "");
   g_signal_connect(evbox, "button_press_event",
       G_CALLBACK(editinfobox_handle_tool_image_button_press), NULL);
   gtk_box_pack_start(GTK_BOX(hbox), evbox, FALSE, FALSE, 0);
 
   image = gtk_image_new();
-  gtk_tooltips_set_tip(ei->tooltips, image,
-                       _("Click to change value if applicable."), "");
   gtk_container_add(GTK_CONTAINER(evbox), image);
   ei->tool_image = image;
 
@@ -1116,13 +1122,13 @@ static struct editinfobox *editinfobox_create(void)
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
   evbox = gtk_event_box_new();
+  gtk_tooltips_set_tip(ei->tooltips, evbox,
+                       _("Click to change tool mode."), "");
   g_signal_connect(evbox, "button_press_event",
       G_CALLBACK(editinfobox_handle_mode_image_button_press), NULL);
   gtk_box_pack_start(GTK_BOX(hbox), evbox, FALSE, FALSE, 0);
 
   image = gtk_image_new();
-  gtk_tooltips_set_tip(ei->tooltips, image,
-                       _("Toggle erase/paint mode."), "");
   gtk_container_add(GTK_CONTAINER(evbox), image);
   ei->mode_image = image;
 
@@ -1146,6 +1152,11 @@ static struct editinfobox *editinfobox_create(void)
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
   ei->size_hbox = hbox;
   spin = gtk_spin_button_new_with_range(1, 255, 1);
+  gtk_tooltips_set_tip(ei->tooltips, spin,
+      _("Use this to change the \"size\" parameter for the tool. "
+        "This parameter controls for example the half-width "
+        "of the square of tiles that will be affected by the "
+        "tool, or the size of a created city."), "");
   g_signal_connect(spin, "value-changed",
                    G_CALLBACK(editinfobox_spin_button_value_changed),
                    GINT_TO_POINTER(SPIN_BUTTON_SIZE));
@@ -1158,6 +1169,10 @@ static struct editinfobox *editinfobox_create(void)
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
   ei->count_hbox = hbox;
   spin = gtk_spin_button_new_with_range(1, 255, 1);
+  gtk_tooltips_set_tip(ei->tooltips, spin,
+      _("Use this to change the tool's \"count\" parameter. "
+        "This controls for example how many units are placed "
+        "at once with the unit tool."), "");
   g_signal_connect(spin, "value-changed",
                    G_CALLBACK(editinfobox_spin_button_value_changed),
                    GINT_TO_POINTER(SPIN_BUTTON_COUNT));
@@ -1184,12 +1199,17 @@ static struct editinfobox *editinfobox_create(void)
   gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combo),
                                 cell, "text", TAP_COL_NAME);
 
-  gtk_tooltips_set_tip(ei->tooltips, combo,
-                       _("Apply tool as this player."), "");
   gtk_widget_set_size_request(combo, 132, -1);
   g_signal_connect(combo, "changed",
                    G_CALLBACK(editinfobox_tool_applied_player_changed), ei);
-  gtk_box_pack_start(GTK_BOX(vbox), combo, FALSE, FALSE, 0);
+
+  evbox = gtk_event_box_new();
+  gtk_tooltips_set_tip(ei->tooltips, evbox,
+      _("Use this to change the \"applied player\" tool parameter. "
+        "This controls for example under which player units and cities "
+        "are created."), "");
+  gtk_container_add(GTK_CONTAINER(evbox), combo);
+  gtk_box_pack_start(GTK_BOX(vbox), evbox, FALSE, FALSE, 0);
   ei->tool_applied_player_combobox = combo;
 
   /* We add a ref to the editinfobox widget so that it is
diff --git a/client/gui-gtk-2.0/editprop.c b/client/gui-gtk-2.0/editprop.c
index 67d6012..1c0b0eb 100644
--- a/client/gui-gtk-2.0/editprop.c
+++ b/client/gui-gtk-2.0/editprop.c
@@ -487,6 +487,7 @@ struct property_editor {
   GtkWidget *widget;
   GtkWidget *notebook;
   GtkWidget *combo;
+  GtkTooltips *tooltips;
 
   struct property_page *property_pages[NUM_OBJTYPES];
 };
@@ -3374,8 +3375,10 @@ static struct property_page *property_page_new(int objtype)
   gtk_box_pack_start(GTK_BOX(hbox), notebook, TRUE, TRUE, 0);
   pp->extviewer_notebook = notebook;
 
+  /* Now create the properties panel. */
   frame = gtk_frame_new(_("Properties"));
   gtk_container_set_border_width(GTK_CONTAINER(frame), 4);
+  gtk_widget_set_size_request(frame, 256, -1);
   gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
 
   scrollwin = gtk_scrolled_window_new(NULL, NULL);
@@ -4240,20 +4243,46 @@ static void property_editor_combo_changed(GtkComboBox *combo,
 static struct property_editor *property_editor_new(void)
 {
   struct property_editor *pe;
-  GtkWidget *notebook, *button, *label, *combo;
-  GtkWidget *hbox, *vbox;
+  GtkWidget *notebook, *button, *label, *combo, *image;
+  GtkWidget *hbox, *vbox, *hbox2, *evbox;
   GtkSizeGroup *sizegroup;
-  int objtype;
+  int objtype, w, h;
   const char *name;
 
   pe = fc_calloc(1, sizeof(*pe));
+  pe->tooltips = gtk_tooltips_new();
 
   hbox = gtk_hbox_new(FALSE, 4);
   pe->widget = hbox;
 
+
+  /* Insert into bottom notebook with custom label. */
+
+  hbox2 = gtk_hbox_new(FALSE, 0);
+
   label = gtk_label_new(_("Property Editor"));
+  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+  gtk_misc_set_padding(GTK_MISC(label), 4, 0);
+  gtk_box_pack_start(GTK_BOX(hbox2), label, TRUE, TRUE, 0);
+
+  button = gtk_button_new();
+  gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
+  gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &w, &h);
+  gtk_widget_set_size_request(button, w, h);
+  gtk_tooltips_set_tip(pe->tooltips, button, _("Close Tab"), "");
+  g_signal_connect_swapped(button, "clicked",
+      G_CALLBACK(gtk_widget_hide_on_delete), pe->widget);
+  gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 0);
+
+  image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
+  gtk_container_add(GTK_CONTAINER(button), image);
+
+  gtk_widget_show_all(hbox2);
+
   gtk_notebook_append_page(GTK_NOTEBOOK(bottom_notebook),
-                           hbox, label);
+                           pe->widget, hbox2);
+
+  /* Property pages. */
 
   notebook = gtk_notebook_new();
   gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
@@ -4264,25 +4293,17 @@ static struct property_editor *property_editor_new(void)
     property_editor_add_page(pe, objtype);
   }
 
+  /* Page switching combobox and controlling buttons. */
+
   vbox = gtk_vbox_new(FALSE, 8);
   gtk_container_set_border_width(GTK_CONTAINER(vbox), 4);
   gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
 
   sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
 
-  button = gtk_button_new_from_stock(GTK_STOCK_APPLY);
-  gtk_size_group_add_widget(sizegroup, button);
-  g_signal_connect(button, "clicked",
-                   G_CALLBACK(property_editor_apply_button_clicked), pe);
-  gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
-
-  button = gtk_button_new_from_stock(GTK_STOCK_REFRESH);
-  gtk_size_group_add_widget(sizegroup, button);
-  g_signal_connect(button, "clicked",
-                   G_CALLBACK(property_editor_refresh_button_clicked), pe);
-  gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
-
+  /* Upper buttons/combobox. */
   combo = gtk_combo_box_new_text();
+  gtk_size_group_add_widget(sizegroup, combo);
   for (objtype = 0; objtype < NUM_OBJTYPES; objtype++) {
     name = property_page_get_name(pe->property_pages[objtype]);
     if (!name) {
@@ -4290,19 +4311,39 @@ static struct property_editor *property_editor_new(void)
     }
     gtk_combo_box_append_text(GTK_COMBO_BOX(combo), name);
   }
-
   g_signal_connect(combo, "changed",
                    G_CALLBACK(property_editor_combo_changed), pe);
-  gtk_size_group_add_widget(sizegroup, combo);
-  gtk_box_pack_start(GTK_BOX(vbox), combo, FALSE, FALSE, 24);
+  evbox = gtk_event_box_new();
+  gtk_tooltips_set_tip(pe->tooltips, evbox,
+      _("This shows the current property page in the property editor. "
+        "You can also change pages by selecting one from the list."), "");
+  gtk_container_add(GTK_CONTAINER(evbox), combo);
+  gtk_box_pack_start(GTK_BOX(vbox), evbox, FALSE, FALSE, 0);
   pe->combo = combo;
 
-  button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+  /* Lower buttons. */
+  button = gtk_button_new_from_stock(GTK_STOCK_APPLY);
   gtk_size_group_add_widget(sizegroup, button);
-  g_signal_connect_swapped(button, "clicked",
-                           G_CALLBACK(gtk_widget_hide_on_delete), pe->widget);
+  gtk_tooltips_set_tip(pe->tooltips, button,
+      _("Pressing this button will send all modified properties of "
+        "the objects selected in the object list to the server. "
+        "Modified properties' names are shown in red in the properties "
+        "panel."), "");
+  g_signal_connect(button, "clicked",
+                   G_CALLBACK(property_editor_apply_button_clicked), pe);
+  gtk_box_pack_end(GTK_BOX(vbox), button, FALSE, FALSE, 0);
+
+  button = gtk_button_new_from_stock(GTK_STOCK_REFRESH);
+  gtk_size_group_add_widget(sizegroup, button);
+  gtk_tooltips_set_tip(pe->tooltips, button,
+      _("Pressing this button will reset all modified properties of "
+        "the selected objects to their current values (the values "
+        "they have on the server)."), "");
+  g_signal_connect(button, "clicked",
+                   G_CALLBACK(property_editor_refresh_button_clicked), pe);
   gtk_box_pack_end(GTK_BOX(vbox), button, FALSE, FALSE, 0);
 
+
   gtk_widget_show_all(pe->widget);
 
   return pe;
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to