Freeciv-3.3
|
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "fcintl.h"
#include "log.h"
#include "shared.h"
#include "support.h"
#include "connection.h"
#include "game.h"
#include "government.h"
#include "packets.h"
#include "chatline_common.h"
#include "client_main.h"
#include "dialogs_g.h"
#include "editor.h"
#include "mapview_common.h"
#include "tilespec.h"
#include "canvas.h"
#include "editgui.h"
#include "editprop.h"
#include "gui_main.h"
#include "gui_stuff.h"
#include "plrdlg.h"
#include "sprite.h"
Go to the source code of this file.
Data Structures | |
struct | tool_value_selector |
Enumerations | |
enum | tool_value_selector_columns { TVS_COL_IMAGE = 0 , TVS_COL_ID , TVS_COL_NAME , TVS_NUM_COLS } |
enum | player_pov_combo_columns { PPV_COL_FLAG = 0 , PPV_COL_NAME , PPV_COL_PLAYER_NO , PPV_NUM_COLS } |
enum | tool_applied_player_columns { TAP_COL_FLAG = 0 , TAP_COL_NAME , TAP_COL_PLAYER_NO , TAP_NUM_COLS } |
enum | spin_button_types { SPIN_BUTTON_SIZE , SPIN_BUTTON_COUNT } |
Variables | |
static struct editbar * | editor_toolbar |
static struct editinfobox * | editor_infobox |
|
static |
Clear icons from tool store, and the store itself.
Definition at line 730 of file editgui.c.
Referenced by clear_tool_stores().
Clears all stores from the editbar.
Definition at line 752 of file editgui.c.
Referenced by editbar_reload_tileset(), and editgui_free().
Convert gdk modifier values to editor modifier values.
Definition at line 898 of file editgui.c.
Referenced by handle_edit_mouse_button_press(), handle_edit_mouse_button_press(), handle_edit_mouse_button_release(), handle_edit_mouse_button_release(), handle_edit_mouse_move(), and handle_edit_mouse_move().
Convert gdk mouse button values to editor mouse button values.
Definition at line 918 of file editgui.c.
Referenced by handle_edit_mouse_button_press(), and handle_edit_mouse_button_release().
Create a pixbuf containing a representative image for the given terrain type, to be used as an icon in the GUI.
May return NULL on error.
NB: You must call g_object_unref on the non-NULL return value when you no longer need it.
Definition at line 696 of file editgui.c.
Referenced by editbar_reload_tileset(), and get_tool_value_pixbuf().
|
static |
Create a tool value selection dialog for the given toolbar.
Definition at line 994 of file editgui.c.
Referenced by editbar_add_tool_button().
Helper function to add a tool mode button to the editor toolbar. The button will be packed into the start of the hbox 'eb->widget'.
Definition at line 478 of file editgui.c.
Referenced by editbar_create().
A helper function to create a toolbar button for the given editor tool. Packs the newly created button into the hbox 'eb->widget'.
Definition at line 407 of file editgui.c.
Referenced by editbar_create().
Create and return an editor toolbar.
Definition at line 519 of file editgui.c.
Referenced by editgui_create_widgets().
|
static |
Callback for all tool mode toggle buttons.
Definition at line 154 of file editgui.c.
Referenced by editbar_add_mode_button(), and refresh_all_buttons().
|
static |
Callback to handle selection of a player/global observer in the player pov indicator.
NB: The convention is that the first entry (index 0) in the combo box corresponds to the "global observer".
Definition at line 277 of file editgui.c.
Referenced by editbar_create().
Handle a click on the player properties button in the editor toolbar.
Definition at line 463 of file editgui.c.
Referenced by editbar_create().
Refresh the given toolbar according to the current editor state.
Definition at line 669 of file editgui.c.
Referenced by editgui_refresh().
Reload all tool value data from the tileset for the given toolbar.
Definition at line 765 of file editgui.c.
Referenced by editgui_tileset_changed().
|
static |
Handle a mouse click on any of the tool buttons.
Definition at line 389 of file editgui.c.
Referenced by editbar_add_tool_button().
|
static |
Callback to handle toggling of any of the tool buttons.
Definition at line 201 of file editgui.c.
Referenced by editbar_add_tool_button(), and refresh_all_buttons().
Create all editor GUI widgets.
Definition at line 1822 of file editgui.c.
Referenced by setup_widgets().
Get the pointer for the editbar embedded in the client's GUI.
Definition at line 1788 of file editgui.c.
Referenced by editgui_free(), editgui_refresh(), editgui_run_tool_selection(), editgui_tileset_changed(), and setup_widgets().
struct editinfobox * editgui_get_editinfobox | ( | void | ) |
Return a pointer to the editor info box embedded in the client's GUI.
Definition at line 1853 of file editgui.c.
Referenced by editgui_free(), editgui_refresh(), editgui_run_tool_selection(), editgui_tileset_changed(), and editinfobox_spin_button_value_changed().
This is called to notify the editor GUI that some object (e.g. tile, unit, etc.) has changed (usually because the corresponding packet was received) and that widgets displaying the object should be updated.
Currently this is used to notify the property editor that some object has been removed or some property value has changed at the server.
Pass on the object creation notification to the property editor.
Definition at line 1922 of file editgui.c.
Referenced by handle_edit_object_created(), and handle_edit_startpos().
Popup all dialog window of the editor.
Definition at line 1890 of file editgui.c.
Referenced by client_game_free(), and client_game_reset().
Popup the property editor. If 'tiles' is non-NULL, the tiles, units and cities in those tiles are added to the property editor's object list. If 'objtype' is a valid object type, the corresponding page of the property editor notebook is focused. Otherwise which page is focused depends on what was loaded from 'tiles'.
Definition at line 1875 of file editgui.c.
Referenced by popup_properties().
Refresh all editor GUI widgets according to the current editor state.
Definition at line 1796 of file editgui.c.
Referenced by editbar_mode_button_toggled(), editbar_tool_button_toggled(), editinfobox_handle_mode_image_button_press(), editinfobox_handle_mode_image_button_press(), editor_apply_tool(), editor_apply_tool_to_selection(), editor_grab_applied_player(), editor_grab_tool(), handle_edit_key_press(), handle_edit_key_press(), handle_edit_key_press_with_shift(), handle_edit_key_press_with_shift(), handle_game_info(), handle_player_info(), handle_player_remove(), handle_research_info(), handle_unknown_research(), and real_menus_update().
|
static |
Run the tool value selector for the given tool type. Sets the editor state and refreshes the editor GUI depending on the user's choices.
Returns FALSE if running the dialog is not possible.
Definition at line 356 of file editgui.c.
Referenced by editbar_tool_button_mouse_click(), editbar_tool_right_button(), editinfobox_handle_tool_image_button_press(), editinfobox_handle_tool_image_button_press(), handle_edit_key_press(), handle_edit_key_press(), handle_edit_key_press_with_shift(), and handle_edit_key_press_with_shift().
Update all editor widget internal data for the new tileset. Call this after a new tileset has finished loading.
Definition at line 1862 of file editgui.c.
Referenced by set_client_state(), and tileset_changed().
|
static |
Create and return an editor info box widget bundle.
Definition at line 1167 of file editgui.c.
Referenced by editgui_create_widgets().
|
static |
Handle a mouse click on the mode image area in the editor info box.
Definition at line 1093 of file editgui.c.
Referenced by editinfobox_create().
|
static |
Handle a mouse click on the tool image area in the editor info box.
Definition at line 1082 of file editgui.c.
Referenced by editinfobox_create().
|
static |
Refresh the given editinfobox according to the current editor state.
Definition at line 1519 of file editgui.c.
Referenced by editgui_refresh(), editgui_run_tool_selection(), editgui_tileset_changed(), and editinfobox_spin_button_value_changed().
|
static |
Callback for spin button changes in the editor info box.
Definition at line 1106 of file editgui.c.
Referenced by editinfobox_create().
|
static |
Callback for changes in the applied player combobox in the editor info box.
Definition at line 1142 of file editgui.c.
Referenced by editinfobox_create().
|
static |
Return a pixbuf containing an image suitable for use as an icon respresenting the given editor tool mode.
NB: May return NULL. Must call g_object_unref on non-NULL when done.
Definition at line 1477 of file editgui.c.
Referenced by editinfobox_refresh().
|
static |
Return a pixbuf containing an image for the given editor tool sub-value, if one exists.
NB: Can return NULL. Must call g_object_unref on non-NULL when done.
Definition at line 1406 of file editgui.c.
Referenced by editinfobox_refresh().
gboolean handle_edit_key_press | ( | GdkEventKey * | ev | ) |
Handle any kind of key press event.
Definition at line 1662 of file editgui.c.
Referenced by toplevel_key_press_handler(), and toplevel_key_press_handler().
|
static |
Handle ctrl+[key] combinations.
Definition at line 1606 of file editgui.c.
Referenced by handle_edit_key_press(), and handle_edit_key_press().
|
static |
Handle shift+[key] combinations.
Definition at line 1614 of file editgui.c.
Referenced by handle_edit_key_press(), and handle_edit_key_press().
gboolean handle_edit_key_release | ( | GdkEventKey * | ev | ) |
Key release handler.
Definition at line 1780 of file editgui.c.
Referenced by toplevel_key_release_handler().
gboolean handle_edit_mouse_button_press | ( | GdkEventButton * | ev | ) |
Pass on the gdk mouse event to the editor's handler.
Definition at line 940 of file editgui.c.
Referenced by butt_down_mapcanvas(), left_butt_down_mapcanvas(), middle_butt_down_mapcanvas(), and right_butt_down_mapcanvas().
gboolean handle_edit_mouse_button_release | ( | GdkEventButton * | ev | ) |
Pass on the gdk mouse event to the editor's handler.
Definition at line 956 of file editgui.c.
Referenced by butt_release_mapcanvas(), left_butt_up_mapcanvas(), and right_butt_up_mapcanvas().
gboolean handle_edit_mouse_move | ( | GdkEventMotion * | ev | ) |
Pass on the gdk mouse event to the editor's handler.
Definition at line 971 of file editgui.c.
Referenced by move_mapcanvas(), and move_mapcanvas().
Refresh the buttons in the given editbar according to the current editor state.
Definition at line 113 of file editgui.c.
Referenced by editbar_refresh().
Refresh all tool value selectors in the given toolbar according to the current editor state.
Definition at line 651 of file editgui.c.
Referenced by editbar_refresh().
Refresh the player point-of-view indicator based on the client and editor state.
NB: The convention is that the first entry (index 0) in the combo box corresponds to the "global observer".
Definition at line 223 of file editgui.c.
Referenced by editbar_refresh().
|
static |
Refresh the given editinfobox's applied player combobox according to the current editor state.
Definition at line 1338 of file editgui.c.
Referenced by editinfobox_refresh().
Refresh the tool value selector in the given toolbar for the given tool type with data from the editor state.
Definition at line 612 of file editgui.c.
Referenced by refresh_all_tool_value_selectors().
NB: Assumes that widget 'old' has enough references to not be destroyed when removed from its parent container, and that the parent container is a GtkBox (or is descended from it).
Definition at line 1501 of file editgui.c.
Referenced by editinfobox_refresh().
|
static |
Run the tool value selection dialog and return the value ID selected. Returns -1 if cancelled.
Definition at line 319 of file editgui.c.
Referenced by editgui_run_tool_selection().
|
static |
Handle a double-click on the tool value list.
Definition at line 980 of file editgui.c.
Referenced by create_tool_value_selector().
|
static |
Try to set the given tool as the current editor tool. If the tool is unavailable (editor_tool_is_usable) an error popup is displayed.
Definition at line 177 of file editgui.c.
Referenced by editbar_tool_button_toggled(), handle_edit_key_press(), and handle_edit_key_press().
|
static |
Definition at line 107 of file editgui.c.
Referenced by editgui_create_widgets(), and editgui_get_editinfobox().
Definition at line 106 of file editgui.c.
Referenced by editgui_create_widgets(), and editgui_get_editbar().