21#include <gdk/gdkkeysyms.h>
68 const struct city *pcity,
80 GCallback edit_callback,
81 gpointer callback_userdata);
88#define SPECHASH_TAG stored_tag
89#define SPECHASH_INT_KEY_TYPE
90#define SPECHASH_INT_DATA_TYPE
117#define PF_MAX_CLAUSES 16
118#define PF_DISJUNCTION_SEPARATOR "|"
119#define PF_CONJUNCTION_SEPARATOR "&"
266#define SPECHASH_TAG propstate
267#define SPECHASH_INT_KEY_TYPE
268#define SPECHASH_IDATA_TYPE struct propstate *
269#define SPECHASH_IDATA_FREE propstate_destroy
424 GtkTreeViewColumn *col);
431 const char *widget_name,
434 const char *widget_name);
446#define SPECHASH_TAG objprop
447#define SPECHASH_INT_KEY_TYPE
448#define SPECHASH_IDATA_TYPE struct objprop *
460 GtkTreeRowReference *
rowref;
497 GtkTreeRowReference *rr);
500#define SPECHASH_TAG objbind
501#define SPECHASH_INT_KEY_TYPE
502#define SPECHASH_IDATA_TYPE struct objbind *
503#define SPECHASH_IDATA_FREE objbind_destroy
571 const struct tile_list *tiles);
573 const struct tile *ptile);
577 gpointer object_data);
590 gboolean currently_selected,
601 struct tile_list *hint_tiles);
611 int tag,
int object_id);
632#define property_page_objprop_iterate(ARG_pp, NAME_op) \
633 TYPED_HASH_DATA_ITERATE(struct objprop *, (ARG_pp)->objprop_table, NAME_op)
634#define property_page_objprop_iterate_end HASH_DATA_ITERATE_END
636#define property_page_objbind_iterate(ARG_pp, NAME_ob) \
637 TYPED_HASH_DATA_ITERATE(struct objbind *, (ARG_pp)->objbind_table, NAME_ob)
638#define property_page_objbind_iterate_end HASH_DATA_ITERATE_END
670 return _(
"Start Position");
678 return Q_(
"?play:Game");
683 log_error(
"%s() Unhandled request to get name of object type %d.",
702 return ((
struct unit *)
object)->id;
704 return ((
struct city *)
object)->id;
713 log_error(
"%s(): Unhandled request to get object ID from object %p of "
714 "type %d (%s).", __FUNCTION__,
object,
objtype,
742 log_error(
"%s(): Unhandled request to get object of type %d (%s) "
743 "with ID %d.", __FUNCTION__,
objtype,
768 log_error(
"%s(): Unhandled request for object type %d (%s)).",
790 return "struct built_status[B_LAST]";
792 return "bool[A_LAST]";
802 return "struct nation_hash";
806 return "struct tile_vision_data";
809 log_error(
"%s(): unhandled value type %d.", __FUNCTION__, valtype);
823 GCallback edit_callback,
826 GtkCellRenderer *cell;
827 GtkTreeViewColumn *col;
828 const char *attr = NULL;
830 if (gtype == G_TYPE_BOOLEAN) {
831 cell = gtk_cell_renderer_toggle_new();
832 gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(cell),
835 g_signal_connect(cell,
"toggled", edit_callback, userdata);
838 }
else if (gtype == GDK_TYPE_PIXBUF) {
839 cell = gtk_cell_renderer_pixbuf_new();
842 cell = gtk_cell_renderer_text_new();
844 g_object_set(cell,
"editable",
TRUE, NULL);
845 g_signal_connect(cell,
"edited", edit_callback, userdata);
850 col = gtk_tree_view_column_new_with_attributes(
name, cell,
852 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
870 return g_strdup_printf(
"%d", pv->
data.
v_int);
873 return g_strdup_printf(
"%s", pv->
data.
v_bool ?
_(
"TRUE") :
_(
"FALSE"));
887 int great_wonder_count = 0, small_wonder_count = 0, building_count = 0;
896 great_wonder_count++;
898 small_wonder_count++;
905 return g_strdup_printf(
_(
"%db %ds %dW"),
906 building_count, small_wonder_count,
917 return g_strdup_printf(
_(
"%d known"), count);
927 return g_strdup_printf(
_(
"%d present"), count);
937 return g_strdup_printf(
_(
"%d present"), count);
947 return g_strdup_printf(
_(
"%d present"), count);
952 return g_strdup(
_(
"All nations"));
954 return g_strdup_printf(
PL_(
"%d nation",
"%d nations",
961 return g_strdup_printf(
PL_(
"%d byte",
"%d bytes", count),
969 log_error(
"%s(): Unhandled value type %d for property value %p.",
970 __FUNCTION__, pv->
valtype, pv);
982 turn_built = bs->
turn;
986 return g_strdup(
_(
"(never)"));
989 return g_strdup(
_(
"(destroyed)"));
991 return g_strdup_printf(
"%d", turn_built);
1033 static int tag_series = 0;
1114 log_error(
"%s(): Unhandled value type %d for property value %p.",
1115 __FUNCTION__, pv->
valtype, pv);
1168 log_error(
"%s(): Unhandled request to free data %p (type %s).",
1214 if (vatb < 0 && vbtb < 0) {
1251 log_error(
"%s(): Unhandled value type %d for property values %p and %p.",
1252 __FUNCTION__, pva->
valtype, pva, pvb);
1342 if (
object == NULL) {
1427 log_error(
"%s(): Unhandled request to destroy object %p (ID %d) of type "
1462 if (NULL == ptile) {
1475 case OPID_TILE_ADDRESS:
1484 if (NULL != pterrain) {
1495 if (NULL != presource) {
1503 pv->
data.
v_string = g_strdup_printf(
"(%d, %d)", tile_x, tile_y);
1575 if (ptile->
label != NULL) {
1582 log_error(
"%s(): Unhandled request for value of property %d "
1583 "(%s) from object of type \"%s\".", __FUNCTION__,
1593 const struct tile *ptile;
1618 log_error(
"%s(): Unhandled request for value of property %d "
1619 "(%s) from object of type \"%s\".", __FUNCTION__,
1630 if (NULL ==
punit) {
1640 case OPID_UNIT_ADDRESS:
1685 log_error(
"%s(): Unhandled request for value of property %d "
1686 "(%s) from object of type \"%s\".", __FUNCTION__,
1697 if (NULL == pcity) {
1707 case OPID_CITY_ADDRESS:
1744 log_error(
"%s(): Unhandled request for value of property %d "
1745 "(%s) from object of type \"%s\".", __FUNCTION__,
1757 if (NULL == pplayer) {
1775 case OPID_PLAYER_ADDRESS:
1800 log_error(
"%s(): Unhandled request for value of property %d "
1801 "(%s) from object of type \"%s\".", __FUNCTION__,
1812 if (NULL == pgame) {
1848 log_error(
"%s(): Unhandled request for value of property %d "
1849 "(%s) from object of type \"%s\".", __FUNCTION__,
1860 log_error(
"%s(): Unhandled request for object type \"%s\" (nb %d).",
1896 if (NULL != pstep) {
1901 if (NULL != pbig_step) {
1917 log_error(
"%s(): Unhandled request for value range of property %d (%s) "
1918 "from object of type \"%s\".", __FUNCTION__,
1927 if (NULL ==
punit) {
1962 log_error(
"%s(): Unhandled request for value range of property %d (%s) "
1963 "from object of type \"%s\".", __FUNCTION__,
1971 if (NULL == pcity) {
2004 log_error(
"%s(): Unhandled request for value range of property %d (%s) "
2005 "from object of type \"%s\".", __FUNCTION__,
2026 log_error(
"%s(): Unhandled request for value range of property %d (%s) "
2027 "from object of type \"%s\".", __FUNCTION__,
2032 log_error(
"%s(): Unhandled request for value range of property %d (%s) "
2033 "from object of type \"%s\".", __FUNCTION__,
2041 log_error(
"%s(): Unhandled request for object type \"%s\" (nb %d).",
2114 struct propval *pv_old, *pv_copy;
2183 gtk_tree_row_reference_free(ob->
rowref);
2234 if (NULL == ptile) {
2260 if (NULL ==
punit) {
2283 if (NULL == pcity) {
2287 packet->
id32 = pcity->
id;
2292 for (i = 0; i <
B_LAST; i++) {
2308 if (NULL == pplayer) {
2333 if (NULL == pgame) {
2353 log_error(
"%s(): Unhandled object type %s (nb %d).", __FUNCTION__,
2432 log_error(
"%s(): Unhandled request to pack value of property "
2433 "%d (%s) from object of type \"%s\".", __FUNCTION__,
2455 log_error(
"%s(): Unhandled request to pack value of property "
2456 "%d (%s) from object of type \"%s\".", __FUNCTION__,
2490 log_error(
"%s(): Unhandled request to pack value of property "
2491 "%d (%s) from object of type \"%s\".", __FUNCTION__,
2519 for (i = 0; i <
B_LAST; i++) {
2528 log_error(
"%s(): Unhandled request to pack value of property "
2529 "%d (%s) from object of type \"%s\".", __FUNCTION__,
2565 log_error(
"%s(): Unhandled request to pack value of property "
2566 "%d (%s) from object of type \"%s\".", __FUNCTION__,
2609 log_error(
"%s(): Unhandled request to pack value of property "
2610 "%d (%s) from object of type \"%s\".", __FUNCTION__,
2618 log_error(
"%s(): Unhandled request for object type \"%s\" (nb %d).",
2627 GtkTreeRowReference *rr)
2676 return G_TYPE_STRING;
2684 return G_TYPE_STRING;
2688 return GDK_TYPE_PIXBUF;
2742 if (gtype == G_TYPE_INT || gtype == G_TYPE_STRING
2743 || gtype == G_TYPE_BOOLEAN) {
2745 }
else if (gtype == GDK_TYPE_PIXBUF) {
2783 GtkTreeViewColumn *col)
2832 GtkCellRenderer *cell = NULL;
2837 if (gtype == G_TYPE_INT || gtype == G_TYPE_STRING
2838 || gtype == G_TYPE_BOOLEAN) {
2839 cell = gtk_cell_renderer_text_new();
2840 }
else if (gtype == GDK_TYPE_PIXBUF) {
2841 cell = gtk_cell_renderer_pixbuf_new();
2858 return gtype == G_TYPE_INT || gtype == G_TYPE_STRING;
2901 value.
data.
v_int = gtk_spin_button_get_value_as_int(spin);
2918 value.
data.
v_bool = gtk_toggle_button_get_active(button);
2928 GtkWidget *ebox, *hbox, *hbox2, *label, *image, *
entry, *spin, *button;
2940 ebox = gtk_event_box_new();
2943 hbox = gtk_grid_new();
2944 gtk_grid_set_column_spacing(GTK_GRID(hbox), 4);
2946 gtk_container_add(GTK_CONTAINER(ebox), hbox);
2949 gtk_widget_set_halign(label, GTK_ALIGN_START);
2950 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
2951 gtk_container_add(GTK_CONTAINER(hbox), label);
2974 case OPID_TILE_ADDRESS:
2975 case OPID_UNIT_ADDRESS:
2976 case OPID_CITY_ADDRESS:
2977 case OPID_PLAYER_ADDRESS:
2979 label = gtk_label_new(NULL);
2980 gtk_widget_set_hexpand(label,
TRUE);
2981 gtk_widget_set_halign(label, GTK_ALIGN_START);
2982 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
2983 gtk_container_add(GTK_CONTAINER(hbox), label);
2991 image = gtk_image_new();
2992 gtk_widget_set_hexpand(image,
TRUE);
2993 gtk_widget_set_halign(image, GTK_ALIGN_START);
2994 gtk_widget_set_valign(image, GTK_ALIGN_CENTER);
2995 gtk_container_add(GTK_CONTAINER(hbox), image);
3003 entry = gtk_entry_new();
3005 gtk_widget_set_halign(
entry, GTK_ALIGN_END);
3006 gtk_entry_set_width_chars(GTK_ENTRY(
entry), 8);
3007 g_signal_connect(
entry,
"changed",
3009 gtk_container_add(GTK_CONTAINER(hbox),
entry);
3019 spin = gtk_spin_button_new_with_range(0.0, 100.0, 1.0);
3020 gtk_widget_set_hexpand(spin,
TRUE);
3021 gtk_widget_set_halign(spin, GTK_ALIGN_END);
3022 g_signal_connect(spin,
"value-changed",
3024 gtk_container_add(GTK_CONTAINER(hbox), spin);
3032 hbox2 = gtk_grid_new();
3033 gtk_widget_set_hexpand(hbox2,
TRUE);
3034 gtk_widget_set_halign(hbox2, GTK_ALIGN_END);
3035 gtk_grid_set_column_spacing(GTK_GRID(hbox2), 4);
3036 gtk_container_add(GTK_CONTAINER(hbox), hbox2);
3037 spin = gtk_spin_button_new_with_range(0.0, 100.0, 1.0);
3038 g_signal_connect(spin,
"value-changed",
3040 gtk_container_add(GTK_CONTAINER(hbox2), spin);
3042 label = gtk_label_new(NULL);
3043 gtk_widget_set_halign(label, GTK_ALIGN_START);
3044 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
3045 gtk_container_add(GTK_CONTAINER(hbox2), label);
3080 button = gtk_check_button_new();
3081 gtk_widget_set_hexpand(button,
TRUE);
3082 gtk_widget_set_halign(button, GTK_ALIGN_END);
3083 g_signal_connect(button,
"toggled",
3085 gtk_container_add(GTK_CONTAINER(hbox), button);
3090 log_error(
"%s(): Unhandled request to create widget for property %d (%s).",
3105 GtkWidget *w, *label, *image, *
entry, *spin, *button;
3110 double min, max,
step, big_step;
3131 if (pv && modified) {
3156 gtk_image_set_from_pixbuf(GTK_IMAGE(image), pv->
data.
v_pixbuf);
3158 gtk_image_set_from_pixbuf(GTK_IMAGE(image), NULL);
3170 case OPID_TILE_ADDRESS:
3171 case OPID_UNIT_ADDRESS:
3172 case OPID_CITY_ADDRESS:
3173 case OPID_PLAYER_ADDRESS:
3177 gtk_label_set_text(GTK_LABEL(label), pv->
data.
v_string);
3179 gtk_label_set_text(GTK_LABEL(label), NULL);
3197 gtk_label_set_text(GTK_LABEL(label), agebuf);
3199 gtk_label_set_text(GTK_LABEL(label), NULL);
3211 gtk_entry_set_text(GTK_ENTRY(
entry),
"");
3213 gtk_widget_set_sensitive(
entry, pv != NULL);
3227 &
step, &big_step)) {
3228 gtk_spin_button_set_range(GTK_SPIN_BUTTON(spin), min, max);
3229 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(spin),
3232 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), pv->
data.
v_int);
3236 gtk_widget_set_sensitive(spin, pv != NULL);
3249 &
step, &big_step)) {
3250 gtk_spin_button_set_range(GTK_SPIN_BUTTON(spin), min, max);
3251 gtk_spin_button_set_increments(GTK_SPIN_BUTTON(spin),
3254 gtk_label_set_text(GTK_LABEL(label), buf);
3256 gtk_label_set_text(GTK_LABEL(label), NULL);
3258 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), pv->
data.
v_int);
3262 gtk_label_set_text(GTK_LABEL(label), NULL);
3264 gtk_widget_set_sensitive(spin, pv != NULL);
3302 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
3305 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
FALSE);
3309 gtk_widget_set_sensitive(button, pv != NULL);
3324 "<span foreground=\"red\">%s</span>",
name);
3325 gtk_label_set_markup(GTK_LABEL(label), namebuf);
3327 gtk_label_set_text(GTK_LABEL(label),
name);
3352 const char *widget_name,
3357 if (!op || !widget_name || !
widget) {
3363 log_error(
"Cannot store child widget %p under name "
3364 "\"%s\" using objprop_set_child_widget for object "
3365 "property %d (%s) because objprop_get_widget does "
3366 "not return a valid widget.",
3371 g_object_set_data(G_OBJECT(w), widget_name,
widget);
3379 const char *widget_name)
3381 GtkWidget *w, *child;
3383 if (!op || !widget_name) {
3389 log_error(
"Cannot retrieve child widget under name "
3390 "\"%s\" using objprop_get_child_widget for object "
3391 "property %d (%s) because objprop_get_widget does "
3392 "not return a valid widget.",
3397 child = g_object_get_data(G_OBJECT(w), widget_name);
3399 log_error(
"Child widget \"%s\" not found for object "
3400 "property %d (%s) via objprop_get_child_widget.",
3473 GtkWidget *hbox, *vbox, *label, *button, *scrollwin, *image;
3474 GtkWidget *
view = NULL;
3475 GtkTreeSelection *sel;
3476 GtkListStore *
store = NULL;
3477 GtkTextBuffer *
textbuf = NULL;
3503 hbox = gtk_grid_new();
3504 gtk_grid_set_column_spacing(GTK_GRID(hbox), 4);
3507 label = gtk_label_new(NULL);
3508 gtk_widget_set_halign(label, GTK_ALIGN_START);
3509 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
3510 gtk_container_add(GTK_CONTAINER(hbox), label);
3516 vbox = gtk_grid_new();
3517 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
3518 GTK_ORIENTATION_VERTICAL);
3519 gtk_grid_set_row_spacing(GTK_GRID(vbox), 4);
3522 label = gtk_label_new(NULL);
3523 gtk_widget_set_halign(label, GTK_ALIGN_START);
3524 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
3525 gtk_container_add(GTK_CONTAINER(vbox), label);
3528 hbox = gtk_grid_new();
3529 gtk_grid_set_column_spacing(GTK_GRID(hbox), 4);
3530 gtk_container_add(GTK_CONTAINER(vbox), hbox);
3532 image = gtk_image_new();
3533 gtk_widget_set_halign(image, GTK_ALIGN_START);
3534 gtk_widget_set_valign(image, GTK_ALIGN_CENTER);
3535 gtk_container_add(GTK_CONTAINER(hbox), image);
3540 hbox = gtk_grid_new();
3541 gtk_grid_set_column_spacing(GTK_GRID(hbox), 4);
3546 log_error(
"Unhandled request to create panel widget "
3547 "for property %d (%s) in extviewer_new().",
3549 hbox = gtk_grid_new();
3550 gtk_grid_set_column_spacing(GTK_GRID(hbox), 4);
3556 button = gtk_button_new_with_label(
Q_(
"?verb:View"));
3558 button = gtk_button_new_with_label(
_(
"Edit"));
3560 g_signal_connect(button,
"clicked",
3562 gtk_container_add(GTK_CONTAINER(hbox), button);
3573 store = gtk_list_store_new(3, G_TYPE_BOOLEAN, G_TYPE_INT,
3577 num_cols = 3 + 1 + V_COUNT;
3578 gtypes =
fc_malloc(num_cols *
sizeof(GType));
3579 gtypes[0] = G_TYPE_INT;
3580 gtypes[1] = GDK_TYPE_PIXBUF;
3581 gtypes[2] = G_TYPE_STRING;
3582 gtypes[3] = G_TYPE_BOOLEAN;
3584 gtypes[4 + v] = G_TYPE_BOOLEAN;
3586 store = gtk_list_store_newv(num_cols, gtypes);
3590 store = gtk_list_store_new(4, G_TYPE_BOOLEAN, G_TYPE_INT,
3591 G_TYPE_STRING, G_TYPE_STRING);
3596 store = gtk_list_store_new(4, G_TYPE_BOOLEAN, G_TYPE_INT,
3597 GDK_TYPE_PIXBUF, G_TYPE_STRING);
3601 textbuf = gtk_text_buffer_new(NULL);
3604 log_error(
"Unhandled request to create data store "
3605 "for property %d (%s) in extviewer_new().",
3615 vbox = gtk_grid_new();
3616 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
3617 GTK_ORIENTATION_VERTICAL);
3618 gtk_grid_set_row_spacing(GTK_GRID(vbox), 4);
3619 gtk_container_set_border_width(GTK_CONTAINER(vbox), 4);
3623 gtk_widget_set_halign(label, GTK_ALIGN_START);
3624 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
3625 gtk_container_add(GTK_CONTAINER(vbox), label);
3629 scrollwin = gtk_scrolled_window_new(NULL, NULL);
3630 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin),
3631 GTK_SHADOW_ETCHED_IN);
3632 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin),
3633 GTK_POLICY_AUTOMATIC,
3634 GTK_POLICY_AUTOMATIC);
3635 gtk_container_add(GTK_CONTAINER(vbox), scrollwin);
3638 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
store));
3639 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(
view));
3640 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
3644 gtk_text_view_set_editable(GTK_TEXT_VIEW(
view), editable);
3645 gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(
view), editable);
3647 gtk_widget_set_hexpand(
view,
TRUE);
3648 gtk_widget_set_vexpand(
view,
TRUE);
3650 gtk_container_add(GTK_CONTAINER(scrollwin),
view);
3734 g_signal_connect(
textbuf,
"changed",
3739 log_error(
"Unhandled request to configure view widget "
3740 "for property %d (%s) in extviewer_new().",
3798 GtkListStore *store;
3799 GtkTextBuffer *textbuf;
3825 gtk_list_store_clear(store);
3827 id = spe->data.special_idx;
3830 gtk_list_store_append(store, &iter);
3831 gtk_list_store_set(store, &iter, 0, present, 1,
id, 2,
name, -1);
3834 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
3839 gtk_list_store_clear(store);
3846 gtk_list_store_append(store, &iter);
3847 gtk_list_store_set(store, &iter, 0, present, 1,
id, 2,
name, -1);
3850 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
3855 gtk_list_store_clear(store);
3862 gtk_list_store_append(store, &iter);
3863 gtk_list_store_set(store, &iter, 0, present, 1,
id, 2,
name, -1);
3866 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
3871 gtk_list_store_clear(store);
3882 gtk_list_store_append(store, &iter);
3883 gtk_list_store_set(store, &iter, 0,
id, 2,
name, -1);
3885 gtk_list_store_set(store, &iter, 1, pixbuf, -1);
3886 g_object_unref(pixbuf);
3890 gtk_list_store_set(store, &iter, 3, present, -1);
3893 gtk_list_store_set(store, &iter, 4 + v, present, -1);
3899 gtk_list_store_clear(store);
3900 gtk_list_store_append(store, &iter);
3902 gtk_list_store_set(store, &iter, 0, all, 1, -1, 3,
3903 _(
"All nations"), -1);
3912 gtk_list_store_append(store, &iter);
3913 gtk_list_store_set(store, &iter, 0, present, 1,
id,
3914 2, pixbuf, 3,
name, -1);
3916 g_object_unref(pixbuf);
3921 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
3926 gtk_list_store_clear(store);
3934 present = turn_built >= 0;
3936 gtk_list_store_append(store, &iter);
3937 gtk_list_store_set(store, &iter, 0, present, 1,
id, 2,
name,
3942 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
3948 enum barbarian_type barbarian_type =
3951 gtk_list_store_clear(store);
3955 && (barbarian_type != NOT_A_BARBARIAN
3961 gtk_list_store_append(store, &iter);
3962 gtk_list_store_set(store, &iter, 0, present, 1,
id,
3963 2, pixbuf, 3,
name, -1);
3965 g_object_unref(pixbuf);
3972 gtk_image_set_from_pixbuf(GTK_IMAGE(ev->
panel_image), pixbuf);
3974 g_object_unref(pixbuf);
3981 gtk_list_store_clear(store);
3987 gtk_list_store_append(store, &iter);
3988 gtk_list_store_set(store, &iter, 0, present, 1,
id,
3989 2, pixbuf, 3,
name, -1);
3991 g_object_unref(pixbuf);
3999 gtk_label_set_text(GTK_LABEL(ev->
panel_label),
"?");
4004 gtk_image_set_from_pixbuf(GTK_IMAGE(ev->
panel_image), pixbuf);
4006 g_object_unref(pixbuf);
4012 gtk_list_store_clear(store);
4017 gtk_list_store_append(store, &iter);
4018 gtk_list_store_set(store, &iter, 0, present, 1,
id, 2,
name, -1);
4021 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
4030 GtkTextIter start, end;
4034 gtk_text_buffer_get_bounds(textbuf, &start, &end);
4035 oldtext = gtk_text_buffer_get_text(textbuf, &start, &end,
TRUE);
4044 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
4049 log_error(
"Unhandled request to refresh widgets "
4050 "extviewer_refresh_widgets() for objprop id=%d "
4075 gtk_label_set_text(GTK_LABEL(ev->
panel_label), NULL);
4086 gtk_list_store_clear(ev->
store);
4090 gtk_list_store_clear(ev->
store);
4091 gtk_image_set_from_pixbuf(GTK_IMAGE(ev->
panel_image), NULL);
4097 gtk_text_buffer_set_text(ev->
textbuf,
"", -1);
4103 log_error(
"Unhandled request to clear widgets "
4104 "in extviewer_clear_widgets() for objprop id=%d "
4142 GtkTreeModel *model;
4144 int id, old_id, turn_built;
4146 bool active, present;
4148 GdkPixbuf *pixbuf = NULL;
4162 active = gtk_cell_renderer_toggle_get_active(cell);
4165 model = GTK_TREE_MODEL(ev->
store);
4166 if (!gtk_tree_model_get_iter_from_string(model, &iter, path)) {
4175 gtk_tree_model_get(model, &iter, 1, &
id, -1);
4184 gtk_list_store_set(ev->
store, &iter, 0, present, -1);
4186 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
4191 gtk_tree_model_get(model, &iter, 1, &
id, -1);
4200 gtk_list_store_set(ev->
store, &iter, 0, present, -1);
4202 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
4207 gtk_tree_model_get(model, &iter, 1, &
id, -1);
4216 gtk_list_store_set(ev->
store, &iter, 0, present, -1);
4218 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
4223 gtk_tree_model_get(model, &iter, 1, &
id, -1);
4229 gtk_list_store_set(ev->
store, &iter, 0, present, -1);
4230 gtk_tree_model_get_iter_first(model, &iter);
4232 while (gtk_tree_model_iter_next(model, &iter)) {
4233 gtk_list_store_set(ev->
store, &iter, 0,
FALSE, -1);
4240 gtk_tree_model_iter_next(model, &iter);
4241 gtk_tree_model_get(model, &iter, 0, &id2, -1);
4242 gtk_list_store_set(ev->
store, &iter, 0,
TRUE, -1);
4250 gtk_list_store_set(ev->
store, &iter, 0, present, -1);
4257 gtk_tree_model_get_iter_first(model, &iter);
4259 gtk_list_store_set(ev->
store, &iter, 0, all, -1);
4262 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
4267 gtk_tree_model_get(model, &iter, 1, &
id, -1);
4268 if (!(0 <=
id &&
id <
B_LAST)) {
4274 gtk_list_store_set(ev->
store, &iter, 0, present, 3, buf, -1);
4277 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
4282 gtk_tree_model_get(model, &iter, 1, &
id, -1);
4288 gtk_list_store_set(ev->
store, &iter, 0,
TRUE, -1);
4289 gtk_tree_model_iter_nth_child(model, &iter, NULL, old_id);
4290 gtk_list_store_set(ev->
store, &iter, 0,
FALSE, -1);
4294 gtk_image_set_from_pixbuf(GTK_IMAGE(ev->
panel_image), pixbuf);
4296 g_object_unref(pixbuf);
4301 gtk_tree_model_get(model, &iter, 1, &
id, -1);
4308 gtk_list_store_set(ev->
store, &iter, 0,
TRUE, -1);
4309 gtk_tree_model_iter_nth_child(model, &iter, NULL, old_id);
4310 gtk_list_store_set(ev->
store, &iter, 0,
FALSE, -1);
4313 gtk_list_store_set(ev->
store, &iter, 0,
TRUE, -1);
4319 gtk_image_set_from_pixbuf(GTK_IMAGE(ev->
panel_image), pixbuf);
4321 g_object_unref(pixbuf);
4326 gtk_tree_model_get(model, &iter, 1, &
id, -1);
4335 gtk_list_store_set(ev->
store, &iter, 0, present, -1);
4337 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
4342 log_error(
"Unhandled widget toggled signal in "
4343 "extviewer_view_cell_toggled() for objprop id=%d "
4363 GtkTextIter start, end;
4376 gtk_text_buffer_get_start_iter(textbuf, &start);
4377 gtk_text_buffer_get_end_iter(textbuf, &end);
4378 text = gtk_text_buffer_get_text(textbuf, &start, &end,
FALSE);
4386 gtk_label_set_text(GTK_LABEL(ev->
panel_label), buf);
4390 log_error(
"Unhandled widget modified signal in "
4391 "extviewer_textbuf_changed() for objprop id=%d "
4406#define ADDPROP(ARG_id, ARG_name, ARG_tooltip, ARG_flags, ARG_valtype) do { \
4407 struct objprop *MY_op = objprop_new(ARG_id, ARG_name, ARG_tooltip, \
4408 ARG_flags, ARG_valtype, pp); \
4409 objprop_hash_insert(pp->objprop_table, MY_op->id, MY_op); \
4448 ADDPROP(OPID_TILE_ADDRESS,
_(
"Address"), NULL,
4478 ADDPROP(OPID_UNIT_ADDRESS,
_(
"Address"), NULL,
4510 ADDPROP(OPID_CITY_ADDRESS,
_(
"Address"), NULL,
4535 ADDPROP(OPID_PLAYER_ADDRESS,
_(
"Address"), NULL,
4563 _(
"Scenario Name"), NULL,
4567 _(
"Scenario Authors"), NULL,
4571 _(
"Scenario Description"), NULL,
4575 _(
"Save Random Number State"), NULL,
4578 _(
"Save Players"), NULL,
4581 _(
"Nation Start Positions"), NULL,
4584 _(
"Prevent New Cities"), NULL,
4587 _(
"Saltwater Flooding Lakes"), NULL,
4590 _(
"Lock to current Ruleset"), NULL,
4598 log_error(
"%s(): Unhandled page object type %s (nb %d).", __FUNCTION__,
4618 if (gtk_tree_selection_count_selected_rows(sel) < 1) {
4633 GtkTreeModel *model,
4634 GtkTreePath *sel_path,
4635 gboolean currently_selected,
4639 struct objbind *ob = NULL, *old_ob;
4643 if (!pp || !sel_path) {
4647 if (!gtk_tree_model_get_iter(model, &iter, sel_path)) {
4652 gtk_tree_model_get(model, &iter, 0, &ob, -1);
4653 if (currently_selected) {
4657 struct objbind *new_ob = NULL;
4659 rows = gtk_tree_selection_get_selected_rows(sel, NULL);
4660 for (p = rows; p != NULL; p = p->next) {
4662 if (gtk_tree_model_get_iter(model, &iter, path)) {
4663 struct objbind *test_ob = NULL;
4664 gtk_tree_model_get(model, &iter, 0, &test_ob, -1);
4665 if (test_ob == ob) {
4672 g_list_foreach(rows, (GFunc) gtk_tree_path_free, NULL);
4693 GtkTreeViewColumn *col;
4698 text = gtk_entry_get_text(GTK_ENTRY(
entry));
4717 gtk_tree_view_column_set_visible(col, matched);
4733 GtkWidget *vbox, *vbox2, *hbox, *hbox2, *paned, *frame, *w;
4734 GtkWidget *scrollwin, *
view, *label, *
entry, *notebook;
4735 GtkWidget *button, *hsep, *image;
4736 GtkTreeSelection *sel;
4737 GtkCellRenderer *cell;
4738 GtkTreeViewColumn *col;
4739 GtkSizeGroup *sizegroup;
4740 int num_columns = 0;
4754 sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
4772 gtype_array =
fc_malloc(num_columns *
sizeof(GType));
4773 gtype_array[0] = G_TYPE_POINTER;
4783 pp->
object_store = gtk_list_store_newv(num_columns, gtype_array);
4786 paned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
4787 gtk_paned_set_position(GTK_PANED(paned), 256);
4792 vbox = gtk_grid_new();
4793 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
4794 GTK_ORIENTATION_VERTICAL);
4795 gtk_grid_set_row_spacing(GTK_GRID(vbox), 4);
4796 gtk_container_set_border_width(GTK_CONTAINER(vbox), 4);
4797 gtk_paned_pack1(GTK_PANED(paned), vbox,
TRUE,
TRUE);
4799 scrollwin = gtk_scrolled_window_new(NULL, NULL);
4800 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin),
4801 GTK_SHADOW_ETCHED_IN);
4802 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin),
4803 GTK_POLICY_AUTOMATIC,
4804 GTK_POLICY_AUTOMATIC);
4805 gtk_container_add(GTK_CONTAINER(vbox), scrollwin);
4808 gtk_widget_set_hexpand(
view,
TRUE);
4809 gtk_widget_set_vexpand(
view,
TRUE);
4817 if (!attr_type_str) {
4833 col = gtk_tree_view_column_new_with_attributes(
name, cell,
4834 attr_type_str, col_id,
4837 gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
4838 gtk_tree_view_column_set_resizable(col,
TRUE);
4839 gtk_tree_view_column_set_reorderable(col,
TRUE);
4841 gtk_tree_view_column_set_clickable(col,
TRUE);
4842 gtk_tree_view_column_set_sort_column_id(col, col_id);
4844 gtk_tree_view_column_set_clickable(col,
FALSE);
4846 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
4851 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(
view));
4852 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
4853 g_signal_connect(sel,
"changed",
4855 gtk_tree_selection_set_select_function(sel,
4858 gtk_container_add(GTK_CONTAINER(scrollwin),
view);
4862 hbox = gtk_grid_new();
4863 gtk_grid_set_column_spacing(GTK_GRID(hbox), 4);
4864 gtk_container_add(GTK_CONTAINER(vbox), hbox);
4866 button = gtk_button_new();
4867 image = gtk_image_new_from_icon_name(
"list-add", GTK_ICON_SIZE_BUTTON);
4868 gtk_button_set_image(GTK_BUTTON(button), image);
4869 gtk_button_set_label(GTK_BUTTON(button),
_(
"Create"));
4870 gtk_size_group_add_widget(sizegroup, button);
4871 gtk_widget_set_tooltip_text(button,
4872 _(
"Pressing this button will create a new object of the "
4873 "same type as the current property page and add it to "
4874 "the page. The specific type and count of the objects "
4875 "is taken from the editor tool state. So for example, "
4876 "the \"tool value\" of the unit tool and its \"count\" "
4877 "parameter affect unit creation."));
4878 g_signal_connect(button,
"clicked",
4880 gtk_container_add(GTK_CONTAINER(hbox), button);
4882 button = gtk_button_new();
4883 image = gtk_image_new_from_icon_name(
"list-remove",
4884 GTK_ICON_SIZE_BUTTON);
4885 gtk_button_set_image(GTK_BUTTON(button), image);
4886 gtk_button_set_label(GTK_BUTTON(button),
_(
"Destroy"));
4887 gtk_size_group_add_widget(sizegroup, button);
4888 gtk_widget_set_tooltip_text(button,
4889 _(
"Pressing this button will send a request to the server "
4890 "to destroy (i.e. erase) the objects selected in the object "
4892 g_signal_connect(button,
"clicked",
4894 gtk_container_add(GTK_CONTAINER(hbox), button);
4899 hbox = gtk_grid_new();
4900 gtk_grid_set_column_spacing(GTK_GRID(hbox), 4);
4901 gtk_paned_pack2(GTK_PANED(paned), hbox,
TRUE,
TRUE);
4903 vbox = gtk_grid_new();
4904 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
4905 GTK_ORIENTATION_VERTICAL);
4906 gtk_grid_set_row_spacing(GTK_GRID(vbox), 4);
4907 gtk_container_set_border_width(GTK_CONTAINER(vbox), 4);
4908 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4914 vbox2 = gtk_grid_new();
4915 gtk_widget_set_hexpand(vbox2,
TRUE);
4916 gtk_widget_set_vexpand(vbox2,
TRUE);
4917 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox2),
4918 GTK_ORIENTATION_VERTICAL);
4919 gtk_grid_set_row_spacing(GTK_GRID(vbox2), 4);
4920 gtk_container_add(GTK_CONTAINER(hbox), vbox2);
4922 notebook = gtk_notebook_new();
4923 gtk_widget_set_vexpand(notebook,
TRUE);
4924 gtk_widget_set_size_request(notebook, 256, -1);
4925 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook),
FALSE);
4926 gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook),
FALSE);
4927 gtk_container_add(GTK_CONTAINER(vbox2), notebook);
4930 hsep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
4931 gtk_container_add(GTK_CONTAINER(vbox2), hsep);
4933 hbox2 = gtk_grid_new();
4934 gtk_container_set_border_width(GTK_CONTAINER(hbox2), 4);
4935 gtk_container_add(GTK_CONTAINER(vbox2), hbox2);
4937 button = gtk_button_new_with_mnemonic(
_(
"_Close"));
4938 gtk_size_group_add_widget(sizegroup, button);
4939 g_signal_connect_swapped(button,
"clicked",
4940 G_CALLBACK(gtk_widget_hide_on_delete), pe->
widget);
4941 gtk_container_add(GTK_CONTAINER(hbox2), button);
4947 title = g_strdup_printf(
_(
"%s Properties"),
4949 frame = gtk_frame_new(
title);
4951 gtk_widget_set_size_request(frame, 256, -1);
4952 gtk_container_add(GTK_CONTAINER(vbox), frame);
4954 scrollwin = gtk_scrolled_window_new(NULL, NULL);
4955 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin),
4957 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin),
4958 GTK_POLICY_AUTOMATIC,
4959 GTK_POLICY_AUTOMATIC);
4960 gtk_container_add(GTK_CONTAINER(frame), scrollwin);
4962 vbox2 = gtk_grid_new();
4963 gtk_widget_set_vexpand(vbox2,
TRUE);
4964 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox2),
4965 GTK_ORIENTATION_VERTICAL);
4966 gtk_grid_set_row_spacing(GTK_GRID(vbox2), 4);
4967 gtk_container_set_border_width(GTK_CONTAINER(vbox2), 4);
4968 gtk_container_add(GTK_CONTAINER(scrollwin), vbox2);
4978 gtk_container_add(GTK_CONTAINER(vbox2), w);
4981 gtk_widget_set_tooltip_text(w,
tooltip);
4985 hbox2 = gtk_grid_new();
4986 gtk_widget_set_margin_top(hbox2, 4);
4987 gtk_widget_set_margin_bottom(hbox2, 4);
4988 gtk_grid_set_column_spacing(GTK_GRID(hbox2), 4);
4989 gtk_container_add(GTK_CONTAINER(vbox), hbox2);
4991 label = gtk_label_new(
_(
"Filter:"));
4992 gtk_container_add(GTK_CONTAINER(hbox2), label);
4994 entry = gtk_entry_new();
4995 gtk_widget_set_tooltip_text(
entry,
4996 _(
"Enter a filter string to limit which properties are shown. "
4997 "The filter is one or more text patterns separated by | "
4998 "(\"or\") or & (\"and\"). The symbol & has higher precedence "
4999 "than |. A pattern may also be negated by prefixing it with !."));
5000 g_signal_connect(
entry,
"changed",
5002 gtk_container_add(GTK_CONTAINER(hbox2),
entry);
5004 hbox2 = gtk_grid_new();
5005 gtk_grid_set_column_spacing(GTK_GRID(hbox2), 4);
5006 gtk_container_add(GTK_CONTAINER(vbox), hbox2);
5008 button = gtk_button_new_with_mnemonic(
_(
"_Refresh"));
5009 gtk_size_group_add_widget(sizegroup, button);
5010 gtk_widget_set_tooltip_text(button,
5011 _(
"Pressing this button will reset all modified properties of "
5012 "the selected objects to their current values (the values "
5013 "they have on the server)."));
5014 g_signal_connect(button,
"clicked",
5016 gtk_container_add(GTK_CONTAINER(hbox2), button);
5018 button = gtk_button_new_with_mnemonic(
_(
"_Apply"));
5019 gtk_size_group_add_widget(sizegroup, button);
5020 gtk_widget_set_tooltip_text(button,
5021 _(
"Pressing this button will send all modified properties of "
5022 "the objects selected in the object list to the server. "
5023 "Modified properties' names are shown in red in the properties "
5025 g_signal_connect(button,
"clicked",
5027 gtk_container_add(GTK_CONTAINER(hbox2), button);
5103 const struct city *pcity,
5115 canvas.
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, fw, fh);
5118 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
5130 ptile, NULL, NULL,
punit, pcity,
5159 gpointer object_data)
5195 const struct tile *ptile)
5198 if (!pp || !ptile) {
5237 log_error(
"%s(): Unhandled page object type %s (nb %d).", __FUNCTION__,
5257 GdkPixbuf *pixbuf = NULL;
5258 GtkListStore *store;
5286 gtk_list_store_set(store, iter, col_id, pv->
data.
v_int, -1);
5296 for (p = buf; *p; p++) {
5297 if (*p ==
'\n' || *p ==
'\t' || *p ==
'\r') {
5301 gtk_list_store_set(store, iter, col_id, buf, -1);
5304 gtk_list_store_set(store, iter, col_id, pv->
data.
v_pixbuf, -1);
5313 gtk_list_store_set(store, iter, col_id, buf2, -1);
5318 gtk_list_store_set(store, iter, col_id, pixbuf, -1);
5320 g_object_unref(pixbuf);
5330 gtk_list_store_set(store, iter, col_id, pixbuf, -1);
5332 g_object_unref(pixbuf);
5358 GtkTreeRowReference *rr;
5359 GtkTreeModel *model;
5369 gtk_list_store_set(pp->
object_store, &iter, 0, ob, -1);
5370 path = gtk_tree_model_get_path(model, &iter);
5371 rr = gtk_tree_row_reference_new(model, path);
5372 gtk_tree_path_free(path);
5380 if (gtk_tree_model_get_iter_first(model, &iter)) {
5381 GtkTreeSelection *sel;
5382 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(pp->
object_view));
5383 gtk_tree_selection_select_iter(sel, &iter);
5440 const struct tile_list *tiles)
5442 if (!pp || !tiles) {
5472 GtkTreeSelection *sel;
5473 GtkTreeModel *model;
5478 bool changed =
FALSE;
5488 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(pp->
object_view));
5489 rows = gtk_tree_selection_get_selected_rows(sel, &model);
5491 for (p = rows; p != NULL; p = p->next) {
5493 if (gtk_tree_model_get_iter(model, &iter, path)) {
5494 gtk_tree_model_get(model, &iter, 0, &ob, -1);
5497 gtk_tree_path_free(path);
5512 GtkTreeSelection *sel;
5513 GtkTreeModel *model;
5525 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(pp->
object_view));
5526 if (gtk_tree_selection_count_selected_rows(sel) < 1) {
5535 rows = gtk_tree_selection_get_selected_rows(sel, &model);
5537 for (p = rows; p != NULL; p = p->next) {
5539 if (gtk_tree_model_get_iter(model, &iter, path)) {
5540 gtk_tree_model_get(model, &iter, 0, &ob, -1);
5552 gtk_tree_path_free(path);
5638 log_error(
"%s(): Unhandled object type %s (nb %d).",
5668 GtkTreeSelection *sel;
5669 GtkTreeModel *model;
5679 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(pp->
object_view));
5680 if (gtk_tree_selection_count_selected_rows(sel) < 1) {
5684 rows = gtk_tree_selection_get_selected_rows(sel, &model);
5685 for (p = rows; p != NULL; p = p->next) {
5687 if (gtk_tree_model_get_iter(model, &iter, path)) {
5688 gtk_tree_model_get(model, &iter, 0, &ob, -1);
5694 gtk_tree_path_free(path);
5709 GtkTreeSelection *sel;
5710 GtkTreeModel *model;
5721 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(pp->
object_view));
5722 if (gtk_tree_selection_count_selected_rows(sel) < 1) {
5726 rows = gtk_tree_selection_get_selected_rows(sel, &model);
5728 for (p = rows; p != NULL; p = p->next) {
5730 if (gtk_tree_model_get_iter(model, &iter, path)) {
5731 gtk_tree_model_get(model, &iter, 0, &ob, -1);
5734 gtk_tree_path_free(path);
5747 struct tile_list *hint_tiles)
5750 int apno, value, count,
size;
5753 struct tile *ptile = NULL;
5779 if (NULL == ptile) {
5783 if (NULL == ptile) {
5829 if (pplayer && hint_tiles) {
5875 GtkTreeRowReference *rr;
5883 if (rr && gtk_tree_row_reference_valid(rr)) {
5886 GtkTreeModel *model;
5889 path = gtk_tree_row_reference_get_path(rr);
5891 if (gtk_tree_model_get_iter(model, &iter, path)) {
5901 gtk_tree_path_free(path);
5972 GtkNotebook *notebook;
5985 page = gtk_notebook_page_num(notebook, w);
5986 gtk_notebook_set_current_page(notebook, page);
6000 if (stored_tag_hash_lookup(pp->
tag_table, tag, NULL)) {
6001 log_error(
"Attempted to insert object creation tag %d "
6002 "twice into tag table for property page %p (%d %s).",
6008 stored_tag_hash_insert(pp->
tag_table, tag, count);
6024 if (stored_tag_hash_lookup(pp->
tag_table, tag, &count)) {
6026 stored_tag_hash_remove(pp->
tag_table, tag);
6039 return stored_tag_hash_lookup(pp->
tag_table, tag, NULL);
6081 struct tile_list *tiles = NULL;
6089 tiles = tile_list_new();
6094 tile_list_append(tiles, ptile);
6099 tile_list_destroy(tiles);
6137 label = gtk_label_new(
name);
6138 gtk_notebook_append_page(GTK_NOTEBOOK(pe->
notebook),
6173 win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
6174 gtk_window_set_title(GTK_WINDOW(win),
_(
"Property Editor"));
6175 gtk_window_set_resizable(GTK_WINDOW(win),
TRUE);
6176 gtk_window_set_default_size(GTK_WINDOW(win), 780, 560);
6177 gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER_ON_PARENT);
6178 gtk_window_set_transient_for(GTK_WINDOW(win), GTK_WINDOW(
toplevel));
6179 gtk_window_set_destroy_with_parent(GTK_WINDOW(win),
TRUE);
6180 gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_DIALOG);
6181 gtk_container_set_border_width(GTK_CONTAINER(win), 4);
6182 g_signal_connect(win,
"delete-event",
6183 G_CALLBACK(gtk_widget_hide_on_delete), NULL);
6186 vbox = gtk_grid_new();
6187 gtk_container_add(GTK_CONTAINER(win), vbox);
6192 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(
notebook),
TRUE);
6193 gtk_container_add(GTK_CONTAINER(vbox),
notebook);
6218 const struct tile_list *tiles)
6230 if (!pe || !tiles) {
6239 for (i = 0; i <
ARRAY_SIZE(preferred) - 1; i++) {
6256 if (!pe || !pe->
widget) {
6260 gtk_widget_show_all(pe->
widget);
6262 gtk_window_present(GTK_WINDOW(pe->
widget));
6273 if (!pe || !pe->
widget) {
6276 gtk_widget_hide(pe->
widget);
6306 int tag,
int object_id)
6396 int or_clause_count, and_clause_count;
6398 const char *pattern;
6403 if (!filter || filter[0] ==
'\0') {
6407 or_clause_count =
get_tokens(filter, or_clauses,
6411 for (i = 0; i < or_clause_count; i++) {
6412 if (or_clauses[i][0] ==
'\0') {
6417 and_clause_count =
get_tokens(or_clauses[i], and_clauses,
6421 for (j = 0; j < and_clause_count; j++) {
6422 if (and_clauses[j][0] ==
'\0') {
6426 pattern = and_clauses[j];
6428 switch (pattern[0]) {
6471 bool match, or_result, and_result;
6486 if (pf->
count < 1) {
6492 for (i = 0; i < pf->
count; i++) {
6495 for (j = 0; j < pfc->
count; j++) {
6497 match = (pfp->
text[0] ==
'\0'
6502 and_result = and_result && match;
6507 or_result = or_result || and_result;
6529 for (i = 0; i < pf->
count; i++) {
6531 for (j = 0; j < pfc->
count; j++) {
6533 if (pfp->
text != NULL) {
6552 return _(
"Seen (Main)");
6555 return _(
"Seen (Invis)");
6558 return _(
"Seen (Subsurface)");
6563 log_error(
"%s(): Unrecognized vision layer %d.", __FUNCTION__, vl);
6564 return _(
"Unknown");
Base_type_id base_number(const struct base_type *pbase)
Base_type_id base_count(void)
bool dbv_isset(const struct dbv *pdbv, int bit)
#define BV_ARE_EQUAL(vec1, vec2)
#define BV_ISSET(bv, bit)
struct canvas int int canvas_y
struct canvas int canvas_x
int city_granary_size(int city_size)
bool city_can_be_built_here(const struct civ_map *nmap, const struct tile *ptile, const struct unit *punit, bool hut_test)
#define city_tile(_pcity_)
static citizens city_size_get(const struct city *pcity)
#define city_owner(_pcity_)
bool client_nation_is_in_current_set(const struct nation_type *pnation)
void connection_do_buffer(struct connection *pc)
void connection_do_unbuffer(struct connection *pc)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
int editor_tool_get_size(enum editor_tool_type ett)
int editor_tool_get_value(enum editor_tool_type ett)
int editor_tool_get_count(enum editor_tool_type ett)
struct unit * editor_unit_virtual_create(void)
int editor_tool_get_applied_player(enum editor_tool_type ett)
void free_tokens(char **tokens, size_t ntokens)
int get_tokens(const char *str, char **tokens, size_t num_tokens, const char *delimiterset)
const struct functions * fc_funcs
#define PL_(String1, String2, n)
struct unit * game_unit_by_number(int id)
struct city * game_city_by_number(int id)
const char * government_name_translation(const struct government *pgovern)
Government_type_id government_count(void)
struct government * government_by_number(const Government_type_id gov)
Government_type_id government_index(const struct government *pgovern)
#define governments_iterate(NAME_pgov)
#define governments_iterate_end
#define FC_STATIC_CANVAS_INIT
static void add_column(GtkWidget *view, int col_id, const char *name, GType gtype, bool editable, bool is_radio, GCallback edit_callback, gpointer callback_userdata)
static void property_page_reset_objbinds(struct property_page *pp)
static void property_page_send_values(struct property_page *pp)
static void objprop_setup_widget(struct objprop *op)
static void property_page_store_creation_tag(struct property_page *pp, int tag, int count)
static gchar * propval_as_string(struct propval *pv)
static struct property_page * objprop_get_property_page(const struct objprop *op)
static const char * objprop_get_name(const struct objprop *op)
const char * vision_layer_get_name(enum vision_layer)
static int objbind_get_object_id(struct objbind *ob)
static void objprop_set_extviewer(struct objprop *op, struct extviewer *ev)
static GtkWidget * extviewer_get_panel_widget(struct extviewer *ev)
static gpointer objtype_get_object_from_id(enum editor_object_type objtype, int id)
void property_editor_handle_object_changed(struct property_editor *pe, enum editor_object_type objtype, int object_id, bool remove)
static struct propstate * propstate_new(struct objprop *op, struct propval *pv)
static const char * valtype_get_name(enum value_types valtype)
static void propstate_destroy(struct propstate *ps)
static bool objbind_set_modified_value(struct objbind *ob, struct objprop *op, struct propval *pv)
static GtkCellRenderer * objprop_create_cell_renderer(const struct objprop *op)
static void extviewer_clear_widgets(struct extviewer *ev)
@ VALTYPE_INVENTIONS_ARRAY
@ VALTYPE_TILE_VISION_DATA
static void objprop_set_child_widget(struct objprop *op, const char *widget_name, GtkWidget *widget)
static bool property_editor_add_page(struct property_editor *pe, enum editor_object_type objtype)
static void propstate_clear_value(struct propstate *ps)
static void objbind_pack_modified_value(struct objbind *ob, struct objprop *op, union packetdata packet)
static struct objbind * property_page_get_focused_objbind(struct property_page *pp)
static bool objprop_has_widget(const struct objprop *op)
static int objtype_get_id_from_object(enum editor_object_type objtype, gpointer object)
static enum editor_object_type objbind_get_objtype(const struct objbind *ob)
static struct extviewer * objprop_get_extviewer(struct objprop *op)
static void extviewer_refresh_widgets(struct extviewer *ev, struct propval *pv)
static enum editor_object_type property_page_get_objtype(const struct property_page *pp)
#define property_page_objbind_iterate_end
static void property_page_show_extviewer(struct property_page *pp, struct extviewer *ev)
static gpointer objbind_get_object(struct objbind *ob)
static const char * property_page_get_name(const struct property_page *pp)
void property_editor_handle_object_created(struct property_editor *pe, int tag, int object_id)
static bool objbind_property_is_modified(struct objbind *ob, struct objprop *op)
static struct propval * propstate_get_value(struct propstate *ps)
static void property_page_clear_tags(struct property_page *pp)
static void property_page_object_created(struct property_page *pp, int tag, int object_id)
static bool property_page_tag_is_known(struct property_page *pp, int tag)
static void property_page_remove_creation_tag(struct property_page *pp, int tag)
static void property_page_load_tiles(struct property_page *pp, const struct tile_list *tiles)
static void property_page_create_objects(struct property_page *pp, struct tile_list *hint_tiles)
static void property_page_add_extviewer(struct property_page *pp, struct extviewer *ev)
static void property_page_refresh_button_clicked(GtkButton *button, gpointer userdata)
static void property_page_set_focused_objbind(struct property_page *pp, struct objbind *ob)
static void property_page_setup_objprops(struct property_page *pp)
static void objbind_set_rowref(struct objbind *ob, GtkTreeRowReference *rr)
static void objbind_clear_modified_value(struct objbind *ob, struct objprop *op)
static struct propval * objbind_get_value_from_object(struct objbind *ob, struct objprop *op)
static void propval_free(struct propval *pv)
static struct property_filter * property_filter_new(const char *filter)
static bool property_page_set_store_value(struct property_page *pp, struct objprop *op, struct objbind *ob, GtkTreeIter *iter)
static const char * objtype_get_name(enum editor_object_type objtype)
static void objprop_widget_entry_changed(GtkEntry *entry, gpointer userdata)
static void objbind_clear_all_modified_values(struct objbind *ob)
static bool property_filter_match(struct property_filter *pf, const struct objprop *op)
void property_editor_popup(struct property_editor *pe, enum editor_object_type objtype)
static void property_page_destroy_button_clicked(GtkButton *button, gpointer userdata)
static struct objbind * objbind_new(enum editor_object_type objtype, gpointer object)
static gboolean property_page_selection_func(GtkTreeSelection *sel, GtkTreeModel *model, GtkTreePath *path, gboolean currently_selected, gpointer data)
static int property_page_get_num_objbinds(const struct property_page *pp)
static bool objprop_show_in_listview(const struct objprop *op)
static GType objprop_get_gtype(const struct objprop *op)
static void objprop_set_treeview_column(struct objprop *op, GtkTreeViewColumn *col)
static void objbind_pack_current_values(struct objbind *ob, union packetdata packet)
static const char * objprop_get_attribute_type_string(const struct objprop *op)
static struct propval * propval_copy(struct propval *pv)
struct property_editor * editprop_get_property_editor(void)
void property_editor_reload(struct property_editor *pe, enum editor_object_type objtype)
static GdkPixbuf * create_unit_pixbuf(const struct unit *punit)
static void extviewer_view_cell_toggled(GtkCellRendererToggle *cell, gchar *path, gpointer userdata)
static struct property_editor * property_editor_new(void)
static void property_page_send_packet(struct property_page *pp, union packetdata packet)
static gchar * built_status_to_string(struct built_status *bs)
static int objprop_get_id(const struct objprop *op)
@ OPID_GAME_LAKE_FLOODING
@ OPID_GAME_SCENARIO_NAME
@ OPID_GAME_SCENARIO_AUTHORS
@ OPID_GAME_PREVENT_CITIES
@ OPID_GAME_SCENARIO_DESC
@ OPID_GAME_STARTPOS_NATIONS
@ OPID_PLAYER_SCENARIO_RESERVED
@ OPID_GAME_SCENARIO_RANDSTATE
@ OPID_GAME_SCENARIO_PLAYERS
@ OPID_GAME_RULESET_LOCKED
static enum value_types objprop_get_valtype(const struct objprop *op)
static int get_next_unique_tag(void)
static bool objprop_is_sortable(const struct objprop *op)
static void property_page_add_objbinds_from_tile(struct property_page *pp, const struct tile *ptile)
static const char * objprop_get_tooltip(const struct objprop *op)
static GtkTreeRowReference * objbind_get_rowref(struct objbind *ob)
static void property_filter_free(struct property_filter *pf)
static void objprop_widget_spin_button_changed(GtkSpinButton *spin, gpointer userdata)
#define PF_DISJUNCTION_SEPARATOR
static GtkWidget * objprop_get_child_widget(struct objprop *op, const char *widget_name)
static void property_page_selection_changed(GtkTreeSelection *sel, gpointer userdata)
static bool objtype_is_conserved(enum editor_object_type objtype)
static struct extviewer * extviewer_new(struct objprop *op)
static bool propval_equal(struct propval *pva, struct propval *pvb)
static void property_page_quick_find_entry_changed(GtkWidget *entry, gpointer userdata)
static void objprop_refresh_widget(struct objprop *op, struct objbind *ob)
void property_editor_popdown(struct property_editor *pe)
static void objbind_destroy(struct objbind *ob)
static void property_page_add_objbind(struct property_page *pp, gpointer object_data)
static void objbind_request_destroy_object(struct objbind *ob)
static void property_page_create_button_clicked(GtkButton *button, gpointer userdata)
static GdkPixbuf * create_pixbuf_from_layers(const struct tile *ptile, const struct unit *punit, const struct city *pcity, enum layer_category category)
static union packetdata property_page_new_packet(struct property_page *pp)
static void propstate_set_value(struct propstate *ps, struct propval *pv)
static int objprop_get_column_id(const struct objprop *op)
static GdkPixbuf * create_tile_pixbuf(const struct tile *ptile)
static struct objprop * extviewer_get_objprop(struct extviewer *ev)
static bool can_create_unit_at_tile(struct tile *ptile)
static struct objbind * property_page_get_objbind(struct property_page *pp, int object_id)
static bool objbind_get_allowed_value_span(struct objbind *ob, struct objprop *op, double *pmin, double *pmax, double *pstep, double *pbig_step)
static void property_page_free_packet(struct property_page *pp, union packetdata packet)
static GdkPixbuf * create_city_pixbuf(const struct city *pcity)
#define ADDPROP(ARG_id, ARG_name, ARG_tooltip, ARG_flags, ARG_valtype)
static void extviewer_panel_button_clicked(GtkButton *button, gpointer userdata)
static void property_page_destroy_objects(struct property_page *pp)
void property_editor_load_tiles(struct property_editor *pe, const struct tile_list *tiles)
static struct property_page * property_page_new(enum editor_object_type objtype, struct property_editor *parent)
#define property_page_objprop_iterate_end
static void property_page_clear_objbinds(struct property_page *pp)
void property_editor_clear(struct property_editor *pe)
#define property_page_objprop_iterate(ARG_pp, NAME_op)
static void objprop_set_column_id(struct objprop *op, int col_id)
static void objbind_bind_properties(struct objbind *ob, struct property_page *pp)
static void property_page_fill_widgets(struct property_page *pp)
static bool objbind_has_modified_properties(struct objbind *ob)
static void property_page_change_value(struct property_page *pp, struct objprop *op, struct propval *pv)
static void objprop_widget_toggle_button_changed(GtkToggleButton *button, gpointer userdata)
#define PF_CONJUNCTION_SEPARATOR
static void property_page_apply_button_clicked(GtkButton *button, gpointer userdata)
static struct objprop * objprop_new(int id, const char *name, const char *tooltip, enum object_property_flags flags, enum value_types valtype, struct property_page *parent)
static GtkWidget * extviewer_get_view_widget(struct extviewer *ev)
static GtkWidget * objprop_get_widget(struct objprop *op)
static void propval_free_data(struct propval *pv)
static void extviewer_textbuf_changed(GtkTextBuffer *textbuf, gpointer userdata)
static struct property_editor * the_property_editor
static void property_page_object_changed(struct property_page *pp, int object_id, bool remove)
static bool objprop_is_readonly(const struct objprop *op)
#define property_page_objbind_iterate(ARG_pp, NAME_ob)
static GtkTreeViewColumn * objprop_get_treeview_column(const struct objprop *op)
static struct property_page * property_editor_get_page(struct property_editor *pe, enum editor_object_type objtype)
static struct propval * objbind_get_modified_value(struct objbind *ob, struct objprop *op)
void disable_gobject_callback(GObject *obj, GCallback cb)
void enable_gobject_callback(GObject *obj, GCallback cb)
GdkPixbuf * get_flag(const struct nation_type *nation)
GdkPixbuf * surface_get_pixbuf(cairo_surface_t *surf, int width, int height)
GdkPixbuf * sprite_get_pixbuf(struct sprite *sprite)
bool is_special_improvement(const struct impr_type *pimprove)
Impr_type_id improvement_index(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
bool is_small_wonder(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert_ret_val(condition, val)
#define log_error(message,...)
struct startpos * map_startpos_get(const struct tile *ptile)
int startpos_number(const struct startpos *psp)
struct tile * startpos_tile(const struct startpos *psp)
const struct nation_hash * startpos_raw_nations(const struct startpos *psp)
bool startpos_pack(const struct startpos *psp, struct packet_edit_startpos_full *packet)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
bool startpos_is_excluding(const struct startpos *psp)
struct startpos * map_startpos_by_number(int id)
#define index_to_native_pos(pnat_x, pnat_y, mindex)
#define index_to_map_pos(pmap_x, pmap_y, mindex)
struct tile * get_center_tile_mapcanvas(void)
void put_one_element(struct canvas *pcanvas, float zoom, enum mapview_layer layer, const struct tile *ptile, const struct tile_edge *pedge, const struct tile_corner *pcorner, const struct unit *punit, const struct city *pcity, int canvas_x, int canvas_y, const struct city *citymode, const struct unit_type *putype)
#define fc_calloc(n, esz)
bool can_unit_exist_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
Nation_type_id nation_count(void)
Nation_type_id nation_number(const struct nation_type *pnation)
const char * nation_adjective_translation(const struct nation_type *pnation)
struct nation_type * nation_by_number(const Nation_type_id nation)
struct nation_type * nation_of_player(const struct player *pplayer)
bool is_nation_playable(const struct nation_type *nation)
Nation_type_id nation_index(const struct nation_type *pnation)
enum barbarian_type nation_barbarian_type(const struct nation_type *nation)
#define nation_hash_iterate(nationhash, pnation)
#define nations_iterate_end
#define nations_iterate(NAME_pnation)
#define nation_hash_iterate_end
int dsend_packet_edit_city_create(struct connection *pc, int owner, int tile, int size, int tag)
int send_packet_edit_city(struct connection *pc, const struct packet_edit_city *packet)
int send_packet_edit_game(struct connection *pc, const struct packet_edit_game *packet)
int dsend_packet_edit_city_remove(struct connection *pc, int id16, int id32)
int dsend_packet_edit_unit_remove_by_id(struct connection *pc, int id16, int id32)
int send_packet_edit_startpos_full(struct connection *pc, const struct packet_edit_startpos_full *packet)
int dsend_packet_edit_startpos(struct connection *pc, int id, bool removal, int tag)
int send_packet_edit_player(struct connection *pc, const struct packet_edit_player *packet)
int dsend_packet_edit_player_create(struct connection *pc, int tag)
int send_packet_edit_unit(struct connection *pc, const struct packet_edit_unit *packet)
int send_packet_edit_scenario_desc(struct connection *pc, const struct packet_edit_scenario_desc *packet)
int dsend_packet_edit_unit_create(struct connection *pc, int owner, int tile, Unit_type_id type, int count, int tag)
int dsend_packet_edit_player_remove(struct connection *pc, int id)
int send_packet_edit_tile(struct connection *pc, const struct packet_edit_tile *packet)
bool player_slot_is_used(const struct player_slot *pslot)
struct player * player_by_number(const int player_id)
int player_number(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
int player_slot_index(const struct player_slot *pslot)
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
int player_index(const struct player *pplayer)
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
struct player * player_slot_get_player(const struct player_slot *pslot)
#define players_iterate_end
#define players_iterate(_pplayer)
#define player_slots_iterate(_pslot)
#define player_slots_iterate_end
struct research * research_get(const struct player *pplayer)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Road_type_id road_count(void)
Road_type_id road_number(const struct road_type *proad)
cairo_surface_t * surface
struct built_status built[B_LAST]
struct packet_scenario_description scenario_desc
struct packet_game_info info
struct packet_scenario_info scenario
struct government * government_during_revolution
struct propval * pv_cached
bool(* player_tile_vision_get)(const struct tile *ptile, const struct player *pplayer, enum vision_layer vision)
struct propstate_hash * propstate_table
struct property_page * parent_property_page
GtkTreeRowReference * rowref
enum editor_object_type objtype
struct property_page * parent_page
enum object_property_flags flags
struct extviewer * extviewer
GtkTreeViewColumn * view_column
char name[MAX_LEN_CITYNAME]
char scenario_authors[MAX_LEN_PACKET/3]
Government_type_id government
bool inventions[A_LAST+1]
bv_startpos_nations nations
char description[MAX_LEN_CONTENT]
char authors[MAX_LEN_PACKET/3]
struct pf_pattern conjunction[PF_MAX_CLAUSES]
struct government * government
struct player_economic economic
struct nation_type * nation
struct property_page * property_pages[NUM_OBJTYPES]
struct pf_conjunction disjunction[PF_MAX_CLAUSES]
GtkListStore * object_store
struct property_editor * pe_parent
GtkWidget * extviewer_notebook
struct objbind_hash * objbind_table
struct objbind * focused_objbind
struct stored_tag_hash * tag_table
enum editor_object_type objtype
struct objprop_hash * objprop_table
struct propval * property_value
bv_player tile_seen[V_COUNT]
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
char * fc_strcasestr(const char *haystack, const char *needle)
#define sz_strlcpy(dest, src)
#define sz_strlcat(dest, src)
const char * advance_name_translation(const struct advance *padvance)
Tech_type_id advance_index(const struct advance *padvance)
#define advance_index_iterate_end
#define advance_iterate(_start, _p)
static Tech_type_id advance_count(void)
#define advance_iterate_end
#define advance_index_iterate(_start, _index)
const char * terrain_name_translation(const struct terrain *pterrain)
struct city * tile_city(const struct tile *ptile)
#define tile_resource(_tile)
#define tile_list_iterate(tile_list, ptile)
#define tile_terrain(_tile)
#define tile_list_iterate_end
static const bv_extras * tile_extras(const struct tile *ptile)
#define tile_has_extra(ptile, pextra)
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
int tileset_full_tile_height(const struct tileset *t)
bool tileset_layer_in_category(enum mapview_layer layer, enum layer_category cat)
int tileset_tile_height(const struct tileset *t)
int tileset_full_tile_width(const struct tileset *t)
#define mapview_layer_iterate(layer)
#define mapview_layer_iterate_end
struct packet_edit_tile * tile
struct packet_edit_unit * unit
struct packetdata::@145 pointers
struct packet_edit_player * player
struct packet_edit_city * city
struct packet_edit_game * game
struct packet_edit_startpos_full * startpos
struct government * v_gov
bv_max_extras v_bv_special
struct tile_vision_data * v_tile_vision
struct built_status * v_built
struct nation_type * v_nation
struct nation_hash * v_nation_hash
const char * v_const_string
static bool is_enemy_unit_tile(const struct tile *ptile, const struct player *pplayer)
static bool is_non_allied_unit_tile(const struct tile *ptile, const struct player *pplayer)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
int utype_veteran_levels(const struct unit_type *punittype)
const char * utype_name_translation(const struct unit_type *punittype)
#define utype_fuel(ptype)
#define vision_layer_iterate(v)
#define vision_layer_iterate_end