1 /**********************************************************************
2 Freeciv - Copyright (C) 2005 - The Freeciv Project
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
19 #endif /* __cplusplus */
23 /* See client/gui-gtk-3.0/editprop.c for instructions
24 * on how to add more object types. */
25 enum editor_object_type
{
36 enum editor_tool_type
{
52 enum editor_tool_mode
{
61 void editor_init(void);
62 void editor_clear(void);
63 void editor_free(void);
65 void editor_ruleset_changed(void);
67 bool editor_is_active(void);
68 enum editor_tool_type
editor_get_tool(void);
69 void editor_set_tool(enum editor_tool_type emt
);
70 const struct tile
*editor_get_current_tile(void);
71 void editor_set_current_tile(const struct tile
*ptile
);
73 bool editor_tool_has_mode(enum editor_tool_type ett
,
74 enum editor_tool_mode etm
);
75 enum editor_tool_mode
editor_tool_get_mode(enum editor_tool_type ett
);
76 void editor_tool_set_mode(enum editor_tool_type ett
,
77 enum editor_tool_mode etm
);
78 void editor_tool_toggle_mode(enum editor_tool_type ett
,
79 enum editor_tool_mode etm
);
80 void editor_tool_cycle_mode(enum editor_tool_type ett
);
81 const char *editor_tool_get_mode_name(enum editor_tool_type ett
,
82 enum editor_tool_mode etm
);
84 bool editor_tool_has_size(enum editor_tool_type ett
);
85 int editor_tool_get_size(enum editor_tool_type ett
);
86 void editor_tool_set_size(enum editor_tool_type ett
, int size
);
88 bool editor_tool_has_count(enum editor_tool_type ett
);
89 int editor_tool_get_count(enum editor_tool_type ett
);
90 void editor_tool_set_count(enum editor_tool_type ett
, int count
);
92 bool editor_tool_has_applied_player(enum editor_tool_type ett
);
93 int editor_tool_get_applied_player(enum editor_tool_type ett
);
94 void editor_tool_set_applied_player(enum editor_tool_type
,
97 bool editor_tool_is_usable(enum editor_tool_type ett
);
98 bool editor_tool_has_value(enum editor_tool_type ett
);
99 bool editor_tool_has_value_erase(enum editor_tool_type ett
);
100 int editor_tool_get_value(enum editor_tool_type ett
);
101 void editor_tool_set_value(enum editor_tool_type ett
, int value
);
102 const char *editor_tool_get_value_name(enum editor_tool_type ett
,
105 const char *editor_tool_get_name(enum editor_tool_type ett
);
106 struct sprite
*editor_tool_get_sprite(enum editor_tool_type ett
);
107 const char *editor_tool_get_tooltip(enum editor_tool_type ett
);
109 const char *editor_get_mode_tooltip(enum editor_tool_mode etm
);
110 struct sprite
*editor_get_mode_sprite(enum editor_tool_mode etm
);
113 struct edit_buffer
*editor_get_copy_buffer(void);
116 enum editor_keyboard_modifiers
{
123 enum mouse_button_values
{
124 MOUSE_BUTTON_OTHER
= 0,
126 MOUSE_BUTTON_LEFT
= 1,
127 MOUSE_BUTTON_MIDDLE
= 2,
128 MOUSE_BUTTON_RIGHT
= 3
131 void editor_mouse_button_press(int canvas_x
, int canvas_y
,
132 int button
, int modifiers
);
133 void editor_mouse_button_release(int canvas_x
, int canvas_y
,
134 int button
, int modifiers
);
135 void editor_mouse_move(int canvas_x
, int canvas_y
, int modifiers
);
137 void editor_apply_tool(const struct tile
*ptile
,
138 bool part_of_selection
);
139 void editor_notify_edit_finished(void);
141 void editor_selection_clear(void);
142 void editor_selection_add(const struct tile
*ptile
);
143 void editor_selection_remove(const struct tile
*ptile
);
144 bool editor_tile_is_selected(const struct tile
*ptile
);
145 void editor_apply_tool_to_selection(void);
146 int editor_selection_count(void);
147 const struct tile
*editor_get_selection_center(void);
149 struct unit
*editor_unit_virtual_create(void);
152 /* These type flags determine what an edit buffer
153 * will copy from its source tiles. Multiple flags
154 * may be set via bitwise OR. */
155 enum edit_buffer_types
{
164 /* Equal to the bitwise OR of all preceding flags. */
168 struct edit_buffer
*edit_buffer_new(int type_flags
);
169 void edit_buffer_free(struct edit_buffer
*ebuf
);
170 void edit_buffer_clear(struct edit_buffer
*ebuf
);
171 void edit_buffer_set_origin(struct edit_buffer
*ebuf
,
172 const struct tile
*ptile
);
173 const struct tile
*edit_buffer_get_origin(const struct edit_buffer
*ebuf
);
174 bool edit_buffer_has_type(const struct edit_buffer
*ebuf
, int type
);
175 void edit_buffer_copy(struct edit_buffer
*ebuf
, const struct tile
*ptile
);
176 void edit_buffer_copy_square(struct edit_buffer
*ebuf
,
177 const struct tile
*center
,
179 void edit_buffer_paste(struct edit_buffer
*ebuf
, const struct tile
*dest
);
180 int edit_buffer_get_status_string(const struct edit_buffer
*ebuf
,
181 char *buf
, int buflen
);
183 /* Iterates over all type flags set for the given buffer. */
184 #define edit_buffer_type_iterate(ARG_ebuf, NAME_type) \
190 for (NAME_type = 1; NAME_type < EBT_ALL; NAME_type <<= 1) {\
191 if (!(edit_buffer_has_type((ARG_ebuf), NAME_type))) {\
195 #define edit_buffer_type_iterate_end \
201 #endif /* __cplusplus */
203 #endif /* FC__TOOLS_H */