Freeciv-3.2
|
#include <limits.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "bitvector.h"
#include "fc_cmdline.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "fc_interface.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "movement.h"
#include "nation.h"
#include "research.h"
#include "tile.h"
#include "client_main.h"
#include "climisc.h"
#include "editor.h"
#include "mapview_common.h"
#include "tilespec.h"
#include "canvas.h"
#include "gui_main.h"
#include "gui_stuff.h"
#include "plrdlg.h"
#include "sprite.h"
#include "editprop.h"
#include "spechash.h"
Go to the source code of this file.
Data Structures | |
union | packetdata |
struct | tile_vision_data |
struct | pf_pattern |
struct | pf_conjunction |
struct | property_filter |
union | propval_data |
struct | propval |
struct | propstate |
struct | objprop |
struct | objbind |
struct | extviewer |
struct | property_page |
struct | property_editor |
Variables | |
static struct property_editor * | the_property_editor |
#define ADDPROP | ( | ARG_id, | |
ARG_name, | |||
ARG_tooltip, | |||
ARG_flags, | |||
ARG_valtype | |||
) |
#define PF_CONJUNCTION_SEPARATOR "&" |
Definition at line 120 of file editprop.c.
#define PF_DISJUNCTION_SEPARATOR "|" |
Definition at line 119 of file editprop.c.
#define PF_MAX_CLAUSES 16 |
Definition at line 118 of file editprop.c.
#define property_page_objbind_iterate | ( | ARG_pp, | |
NAME_ob | |||
) | TYPED_HASH_DATA_ITERATE(struct objbind *, (ARG_pp)->objbind_table, NAME_ob) |
Definition at line 639 of file editprop.c.
#define property_page_objbind_iterate_end HASH_DATA_ITERATE_END |
Definition at line 641 of file editprop.c.
#define property_page_objprop_iterate | ( | ARG_pp, | |
NAME_op | |||
) | TYPED_HASH_DATA_ITERATE(struct objprop *, (ARG_pp)->objprop_table, NAME_op) |
Definition at line 635 of file editprop.c.
#define property_page_objprop_iterate_end HASH_DATA_ITERATE_END |
Definition at line 637 of file editprop.c.
#define SPECHASH_IDATA_FREE propstate_destroy |
Definition at line 270 of file editprop.c.
#define SPECHASH_IDATA_FREE objbind_destroy |
Definition at line 270 of file editprop.c.
Definition at line 269 of file editprop.c.
Definition at line 269 of file editprop.c.
Definition at line 269 of file editprop.c.
#define SPECHASH_INT_DATA_TYPE |
Definition at line 91 of file editprop.c.
#define SPECHASH_INT_KEY_TYPE |
Definition at line 90 of file editprop.c.
#define SPECHASH_INT_KEY_TYPE |
Definition at line 90 of file editprop.c.
#define SPECHASH_INT_KEY_TYPE |
Definition at line 90 of file editprop.c.
#define SPECHASH_INT_KEY_TYPE |
Definition at line 90 of file editprop.c.
#define SPECHASH_TAG stored_tag |
Definition at line 89 of file editprop.c.
Definition at line 89 of file editprop.c.
Definition at line 89 of file editprop.c.
Definition at line 89 of file editprop.c.
Enumerator | |
---|---|
OPF_NO_FLAGS | |
OPF_EDITABLE | |
OPF_IN_LISTVIEW | |
OPF_HAS_WIDGET |
Definition at line 384 of file editprop.c.
Definition at line 305 of file editprop.c.
Definition at line 197 of file editprop.c.
|
static |
Convenience function to add a column to a GtkTreeView. Used for the view widget creation in extviewer_new().
Definition at line 820 of file editprop.c.
|
static |
Convert the built_status information to a user viewable string. Returned value is g_strdup'd and must be g_free'd.
Definition at line 981 of file editprop.c.
Returns TRUE if a unit can be created at the given tile based on the state of the editor (see editor_unit_virtual_create).
Definition at line 1002 of file editprop.c.
Create a pixbuf containing an image of the given city.
May return NULL on error or bad input. NB: You must call g_object_unref on the non-NULL return value when you no longer need it.
Definition at line 5146 of file editprop.c.
|
static |
Create a pixbuf containing an image of the given tile, unit or city restricted to the layer category 'cat'.
May return NULL on error or bad input. NB: You must call g_object_unref on the non-NULL return value when you no longer need it.
Definition at line 5160 of file editprop.c.
Create a pixbuf containing an image of the given tile. The image will only be of the layers containing terrains, resources and specials.
May return NULL on error or bad input. NB: You must call g_object_unref on the non-NULL return value when you no longer need it.
Definition at line 5122 of file editprop.c.
Create a pixbuf containing an image of the given unit.
May return NULL on error or bad input. NB: You must call g_object_unref on the non-NULL return value when you no longer need it.
Definition at line 5134 of file editprop.c.
struct property_editor * editprop_get_property_editor | ( | void | ) |
Get the property editor for the client's GUI.
Definition at line 6267 of file editprop.c.
Clear the display widgets.
Definition at line 4098 of file editprop.c.
Returns the object property that is displayed by this extviewer.
Definition at line 3792 of file editprop.c.
Returns the "panel widget" for this extviewer, i.e. the widget the is to be placed into the properties panel.
Definition at line 3804 of file editprop.c.
Returns the "view widget" for this extviewer, i.e. the widget the is to be used for viewing/editing a complex property.
Definition at line 3816 of file editprop.c.
Create "extended property viewer". This is used for viewing/editing complex property values (e.g. arrays, bitvectors, etc.).
Definition at line 3510 of file editprop.c.
Handle the extviewer's panel button click. This should set the property page to display the view widget for this complex property.
Definition at line 4153 of file editprop.c.
Set the widgets in the extended property viewer to display the given value.
Definition at line 3827 of file editprop.c.
|
static |
Handle a change in the extviewer's text buffer.
Definition at line 4394 of file editprop.c.
|
static |
Handle toggling of a boolean cell value in the extviewer's tree view.
Definition at line 4173 of file editprop.c.
Return the next tag number in the sequence.
Definition at line 1034 of file editprop.c.
Bind the object in the given objbind to the properties in the page.
Definition at line 2224 of file editprop.c.
Deletes all stored modified property values.
Definition at line 2115 of file editprop.c.
Remove a stored modified value, if it exists.
Definition at line 2070 of file editprop.c.
Destroy the object bind and free any resources it might have been using.
Definition at line 2194 of file editprop.c.
|
static |
If applicable, sets the allowed range values of the given object property as applied to the bound object. Returns TRUE if values were set.
Definition at line 1883 of file editprop.c.
|
static |
Retrieve the stored property value for the bound object, or NULL if none exists.
NB: Does NOT return a copy.
Definition at line 2175 of file editprop.c.
Returns the bound object, if it still "exists". Returns NULL on error.
Definition at line 1365 of file editprop.c.
Returns the ID of the bound object, or -1 if invalid.
Definition at line 1381 of file editprop.c.
Returns the object type of the bound object.
Definition at line 2213 of file editprop.c.
|
static |
Returns the row reference of this objbind, or NULL if not applicable.
Definition at line 2665 of file editprop.c.
|
static |
Returns a newly allocated property value for the given object property on the object referenced by the given object bind, or NULL on failure.
NB: You must call propval_free() on the non-NULL return value when it no longer needed.
Definition at line 1442 of file editprop.c.
Returns TRUE if there are any stored modified values of any of the properties of the bound object.
Definition at line 2103 of file editprop.c.
Create a new object "bind". It serves to bind a set of object properties to an object instance.
Definition at line 1339 of file editprop.c.
Fill the packet with the bound object's current state.
NB: This must be updated if the packet_edit_<object> definitions change.
Definition at line 2238 of file editprop.c.
|
static |
Package the modified property value into the supplied packet.
Definition at line 2381 of file editprop.c.
Returns TRUE if a stored modified property value exists for this bound object for the given property.
Definition at line 2084 of file editprop.c.
Sends a request to the server to have the bound object erased from existence. Only makes sense for object types for which the function objtype_is_conserved() returns FALSE.
Definition at line 1394 of file editprop.c.
|
static |
Store a modified property value, but only if it is different from the current value. Always makes a copy of the given value when storing.
Returns whether anything changed.
Definition at line 2129 of file editprop.c.
|
static |
Sets the row reference in a GtkTreeModel of this objbind.
Definition at line 2653 of file editprop.c.
|
static |
Create and return a cell renderer corresponding to this object property, suitable to be used with a tree view. May return NULL if this object property cannot exist in a list store.
Definition at line 2857 of file editprop.c.
Returns a the string corresponding to the attribute type name required for gtk_tree_view_column_new_with_attributes according to this objprop's GType value. May return NULL if it does not make sense for this object property.
Definition at line 2760 of file editprop.c.
|
static |
Retrieves the widget stored under the given name, or returns NULL and logs an error message if not found.
Definition at line 3418 of file editprop.c.
Returns the column id in the list store for this object property. May return -1 if not applicable or if not yet set. NB: This is the column id in the model, not the view.
Definition at line 2798 of file editprop.c.
Return the stored extviewer, or NULL if none exists.
Definition at line 3463 of file editprop.c.
Returns the GType that this object property renders as in a GtkTreeView. Returning G_TYPE_NONE indicates that this property cannot be viewed in a list.
NB: This must correspond to the actions in property_page_set_store_value.
Definition at line 2691 of file editprop.c.
Returns the unique property identifier for this object property.
Definition at line 2676 of file editprop.c.
Returns the string name of this object property.
Definition at line 2833 of file editprop.c.
Get the property page in which this property is installed.
Definition at line 3474 of file editprop.c.
Return a description (translated) of the property.
Definition at line 2844 of file editprop.c.
|
static |
Returns the previously stored tree view column reference, or NULL if none exists.
Definition at line 2822 of file editprop.c.
Returns the value type of this property value (one of enum value_types).
Definition at line 2724 of file editprop.c.
Returns the gtk widget used to display or edit this property, or NULL if not applicable.
Definition at line 3376 of file editprop.c.
Returns TRUE if this object property can create and use a property widget.
Definition at line 2746 of file editprop.c.
Return TRUE if the given object property cannot be edited (i.e. it is displayed information only).
Definition at line 2892 of file editprop.c.
Return TRUE if the given object property can be sorted (i.e. in the list view).
Definition at line 2878 of file editprop.c.
|
static |
Create a new object property.
Definition at line 3485 of file editprop.c.
Refresh the display/edit widget corresponding to this object property according to the value of the bound object. If a stored modified value exists, then check it against the object's current value and remove it if they are equal.
If 'ob' is NULL, then clear the widget.
Definition at line 3129 of file editprop.c.
|
static |
Stores the given widget under the given name. This function will have no effect if objprop_get_widget does not return a valid GtkWidget instance.
Definition at line 3391 of file editprop.c.
Store the column id of the list store that this object property can be viewed in. This should generally only be changed set once, when the object property's associated list view is created. NB: This is the column id in the model, not the view.
Definition at line 2785 of file editprop.c.
Store the extviewer struct for later retrieval.
Definition at line 3451 of file editprop.c.
|
static |
Sets the view column reference for later convenience.
Definition at line 2809 of file editprop.c.
Create the gtk widget used to edit or display this object property.
Definition at line 2953 of file editprop.c.
Returns TRUE if this object property can be viewed in a GtkTreeView.
Definition at line 2735 of file editprop.c.
|
static |
Callback for spin button widget 'value-changed' signal.
Definition at line 2919 of file editprop.c.
|
static |
Callback for text widget 'changed' signal.
Definition at line 2903 of file editprop.c.
Referenced by objprop_setup_widget().
|
static |
Callback for toggle type button widget 'toggled' signal.
Definition at line 2936 of file editprop.c.
|
static |
Returns the unique identifier value from the given object, assuming it is of the 'objtype' object type. Valid IDs are always greater than or equal to zero.
Definition at line 696 of file editprop.c.
|
static |
Returns the translated name for the given object type.
Definition at line 667 of file editprop.c.
|
static |
Get the object of type 'objtype' uniquely identified by 'id'.
Definition at line 725 of file editprop.c.
|
static |
Returns TRUE if it does not make sense for the object of the given type to be created and destroyed (e.g. tiles, game), as opposed to those that can be (e.g. units, cities, players, etc.).
Definition at line 756 of file editprop.c.
|
static |
Create and add a property page for the given object type to the property editor. Returns TRUE if successful.
Definition at line 6176 of file editprop.c.
void property_editor_clear | ( | struct property_editor * | pe | ) |
Clear all property pages in the given property editor.
Definition at line 6385 of file editprop.c.
|
static |
Returns the property page for the given object type.
Definition at line 6210 of file editprop.c.
void property_editor_handle_object_changed | ( | struct property_editor * | pe, |
enum editor_object_type | objtype, | ||
int | object_id, | ||
bool | remove | ||
) |
Handle a notification from the client core that some object has changed state at the server side (including being removed).
Definition at line 6345 of file editprop.c.
void property_editor_handle_object_created | ( | struct property_editor * | pe, |
int | tag, | ||
int | object_id | ||
) |
Handle a notification that an object was created under the given tag.
Definition at line 6367 of file editprop.c.
Refresh the given property editor according to the given list of tiles.
Definition at line 6278 of file editprop.c.
|
static |
Create and return the property editor widget bundle.
Definition at line 6223 of file editprop.c.
void property_editor_popdown | ( | struct property_editor * | pe | ) |
Hide the property editor window.
Definition at line 6332 of file editprop.c.
void property_editor_popup | ( | struct property_editor * | pe, |
enum editor_object_type | objtype | ||
) |
Show the property editor to the user, with given page corresponding to 'objtype' in front (if a valid object type).
Definition at line 6314 of file editprop.c.
void property_editor_reload | ( | struct property_editor * | pe, |
enum editor_object_type | objtype | ||
) |
Clear and load objects into the property page corresponding to the given object type. Also, make it the current shown notebook page.
Definition at line 6405 of file editprop.c.
|
static |
Frees all memory used by the property filter.
Definition at line 6581 of file editprop.c.
Returns TRUE if the filter matches the given object property.
The filter matches if its truth value is TRUE. That is, it has at least one OR clause in which all AND clauses are TRUE. An AND clause is TRUE if its pattern matches the name of the given object property (case is ignored), or it is negated and does not match. For example:
a - Matches all properties whose names contain "a" (or "A"). !a - Matches all properties whose names do not contain "a". a|b - Matches all properties whose names contain "a" or "b". a|b&c - Matches all properties whose names contain either an "a", or contain both "b" and "c".
NB: If you change the behaviour of this function, be sure to update the filter tooltip in property_page_new().
Definition at line 6527 of file editprop.c.
|
static |
Create a new property filter from the given filter string. Result should be freed by property_filter_free when no longed needed.
The filter string is '|' ("or") separated list of '&' ("and") separated lists of patterns. A pattern may be preceded by '!' to have its result negated.
NB: If you change the behaviour of this function, be sure to update the filter tooltip in property_page_new().
Definition at line 6453 of file editprop.c.
Add the extviewer's view widget to the property page so that it can be shown in the extended property view panel.
Definition at line 6008 of file editprop.c.
|
static |
Create a new object bind to the given object and register it with the given property page.
Definition at line 5217 of file editprop.c.
|
static |
Create zero or more object binds from the objects on the given tile to the properties contained in the given property page.
Definition at line 5253 of file editprop.c.
Handles the 'clicked' signal for the "Apply" button in the property page.
Definition at line 6116 of file editprop.c.
|
static |
Called when a user sets a new value for the given property via the GUI. Refreshes the properties widget if anything changes.
Definition at line 5527 of file editprop.c.
|
static |
Remove all object binds (i.e. objects listed) in the property page.
Definition at line 5202 of file editprop.c.
|
static |
Remove all tags in the tag table.
Definition at line 6105 of file editprop.c.
Handle a request to create a new object in the property page.
Definition at line 6137 of file editprop.c.
|
static |
Create objects corresponding to the type of this property page. Parameters such as the type, count, size and player owner are taken from the current editor state. The 'hint_tiles' argument is a list of tiles where the objects could be created.
Definition at line 5805 of file editprop.c.
Handle a click on the "destroy" button.
Definition at line 6165 of file editprop.c.
|
static |
Destroy all selected objects in the current property page.
Definition at line 5766 of file editprop.c.
|
static |
Inserts any objbinds owned by this proprety page into the page's list store if they are not there already and refreshes all property widgets.
Definition at line 5407 of file editprop.c.
|
static |
Free any resources being used by the packet.
Definition at line 5705 of file editprop.c.
|
static |
Get the objbind corresponding to the object that is currently in view (i.e. in the information/properties panels) or NULL if none.
Definition at line 5456 of file editprop.c.
Returns the translated name of the property page's object type.
Definition at line 5094 of file editprop.c.
|
static |
Return the number of current bound objects to this property page.
Definition at line 5515 of file editprop.c.
|
static |
Returns the objbind whose object corresponds to the given id, or NULL if no such objbind exists.
Definition at line 5481 of file editprop.c.
|
static |
Returns the object type for this property page, or -1 if none.
Definition at line 5106 of file editprop.c.
|
static |
Removes all of the current objbinds and extracts new ones from the supplied list of tiles.
Definition at line 5498 of file editprop.c.
|
static |
Create and return a property page of the given object type. Returns NULL if the page could not be created.
Definition at line 4771 of file editprop.c.
|
static |
Returns pointer to a packet suitable for this page's object type. Result should be freed using property_page_free_packet when no longer needed.
Definition at line 5623 of file editprop.c.
|
static |
Update objbinds and widgets according to how the object given by 'object_id' has changed. If the object no longer exists then the objbind is removed from the property page.
Definition at line 5930 of file editprop.c.
|
static |
Handle a notification of object creation sent back from the server. If this is something we previously requested, then 'tag' should be found in the tag table. In this case we create a new objbind for the object given by 'object_id' and add it to this page.
Definition at line 5982 of file editprop.c.
Callback to handle text changing in the quick find entry widget.
Definition at line 4733 of file editprop.c.
Handles the 'clicked' signal for the "Refresh" button in the property page.
Definition at line 6127 of file editprop.c.
|
static |
Decrease the tag count and remove the object creation tag if it is no longer needed.
Definition at line 6075 of file editprop.c.
|
static |
Reload the displayed values of all properties for the selected bound objects. Hence, deletes all their stored modified values.
Definition at line 5725 of file editprop.c.
|
static |
Callback for when a property page's listview's selection changes.
Definition at line 4653 of file editprop.c.
|
static |
Monitor which rows are to be selected, so we know which objbind to display in the properties panel.
Definition at line 4678 of file editprop.c.
|
static |
Sends the given packet.
Definition at line 5664 of file editprop.c.
|
static |
Send all modified values of all selected properties.
Definition at line 5569 of file editprop.c.
|
static |
Set the objbind that should be shown in the properties panel. Does not refresh property widgets.
Definition at line 5468 of file editprop.c.
|
static |
Set the column value in the list store of the property page. Returns TRUE if data was enetered into the store.
NB: This must match the conversion in objprop_get_gtype.
Definition at line 5307 of file editprop.c.
|
static |
Install all object properties that this page type can view/edit.
Definition at line 4443 of file editprop.c.
|
static |
Make the given extended property viewer's view widget visible in the property page.
Definition at line 6028 of file editprop.c.
|
static |
Store the given object creation tag so that when the server notifies us about it we know what to do, up to 'count' times.
Definition at line 6053 of file editprop.c.
|
static |
Check if the given tag is one that we previously stored.
Definition at line 6094 of file editprop.c.
Removes the stored value, freeing it if needed.
Definition at line 1284 of file editprop.c.
Free a property state and any associated resources.
Definition at line 1297 of file editprop.c.
Create a new "property state" record. It keeps track of the modified value of a property bound to an object.
NB: Does NOT make a copy of 'pv'.
Definition at line 1265 of file editprop.c.
Replace the stored property value with a new one. The old value will be freed if needed.
NB: Does NOT make a copy of 'pv'.
Definition at line 1312 of file editprop.c.
Fill the supplied buffer with a short string representation of the given value. Returned value is g_strdup'd and must be g_free'd.
Definition at line 862 of file editprop.c.
Return a newly allocated deep copy of the given value.
Definition at line 1045 of file editprop.c.
Returns TRUE if the two values are equal, in a deep sense.
Definition at line 1178 of file editprop.c.
Free all allocated memory used by this property value, including calling the appropriate free function on the internal data according to its type.
Definition at line 1127 of file editprop.c.
Frees the internal data held by the propval, without freeing the propval struct itself.
Definition at line 1141 of file editprop.c.
|
static |
Returns the untranslated name for the given value type.
Definition at line 779 of file editprop.c.
const char * vision_layer_get_name | ( | enum vision_layer | vl | ) |
Returns a translated string name for the given "vision layer".
Definition at line 6609 of file editprop.c.
|
static |
Definition at line 661 of file editprop.c.