Freeciv-3.2
Loading...
Searching...
No Matches
editor.h
Go to the documentation of this file.
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)
6 any later version.
7
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***********************************************************************/
13
14#ifndef FC__TOOLS_H
15#define FC__TOOLS_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
21#include "fc_types.h"
22
23/* See client/gui-gtk-3.22/editprop.c for instructions
24 * on how to add more object types. */
35
51
60
61void editor_init(void);
62void editor_clear(void);
63void editor_free(void);
64
65void editor_ruleset_changed(void);
66
67bool editor_is_active(void);
70const struct tile *editor_get_current_tile(void);
71void editor_set_current_tile(const struct tile *ptile);
72
83
87
90void editor_tool_set_count(enum editor_tool_type ett, int count);
91
95 int player_no);
96
101void editor_tool_set_value(enum editor_tool_type ett, int value);
103 int value);
104
108
111
112struct edit_buffer;
114
115
122
130
132 int button, int modifiers);
134 int button, int modifiers);
135void editor_mouse_move(int canvas_x, int canvas_y, int modifiers);
136
137void editor_apply_tool(const struct tile *ptile,
138 bool part_of_selection);
140
141void editor_selection_clear(void);
142void editor_selection_add(const struct tile *ptile);
143void editor_selection_remove(const struct tile *ptile);
144bool editor_tile_is_selected(const struct tile *ptile);
146int editor_selection_count(void);
147const struct tile *editor_get_selection_center(void);
148
149struct unit *editor_unit_virtual_create(void);
150
151
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. */
159 EBT_BASE = 1<<3,
160 EBT_ROAD = 1<<4,
161 EBT_UNIT = 1<<5,
162 EBT_CITY = 1<<6,
163
164 /* Equal to the bitwise OR of all preceding flags. */
165 EBT_ALL = (1<<7) - 1
167
169void edit_buffer_free(struct edit_buffer *ebuf);
172 const struct tile *ptile);
173const struct tile *edit_buffer_get_origin(const struct edit_buffer *ebuf);
174bool edit_buffer_has_type(const struct edit_buffer *ebuf, int type);
175void edit_buffer_copy(struct edit_buffer *ebuf, const struct tile *ptile);
177 const struct tile *center,
178 int radius);
179void edit_buffer_paste(struct edit_buffer *ebuf, const struct tile *dest);
181 char *buf, int buflen);
182
183/* Iterates over all type flags set for the given buffer. */
184#define edit_buffer_type_iterate(ARG_ebuf, NAME_type) \
185do {\
186 int NAME_type;\
187 if (!(ARG_ebuf)) {\
188 break;\
189 }\
190 for (NAME_type = 1; NAME_type < EBT_ALL; NAME_type <<= 1) {\
191 if (!(edit_buffer_has_type((ARG_ebuf), NAME_type))) {\
192 continue;\
193 }
194
195#define edit_buffer_type_iterate_end \
196 }\
197} while (FALSE)
198
199#ifdef __cplusplus
200}
201#endif /* __cplusplus */
202
203#endif /* FC__TOOLS_H */
struct canvas int int canvas_y
Definition canvas_g.h:43
struct canvas int canvas_x
Definition canvas_g.h:43
char * incite_cost
Definition comments.c:75
int edit_buffer_get_status_string(const struct edit_buffer *ebuf, char *buf, int buflen)
Definition editor.c:1873
bool editor_is_active(void)
Definition editor.c:347
void editor_selection_remove(const struct tile *ptile)
Definition editor.c:1107
bool edit_buffer_has_type(const struct edit_buffer *ebuf, int type)
Definition editor.c:1924
int editor_tool_get_size(enum editor_tool_type ett)
Definition editor.c:1219
editor_tool_mode
Definition editor.h:52
@ ETM_PASTE
Definition editor.h:56
@ NUM_EDITOR_TOOL_MODES
Definition editor.h:58
@ ETM_ERASE
Definition editor.h:54
@ ETM_PAINT
Definition editor.h:53
@ ETM_COPY
Definition editor.h:55
edit_buffer_types
Definition editor.h:155
@ EBT_RESOURCE
Definition editor.h:157
@ EBT_CITY
Definition editor.h:162
@ EBT_UNIT
Definition editor.h:161
@ EBT_BASE
Definition editor.h:159
@ EBT_ALL
Definition editor.h:165
@ EBT_ROAD
Definition editor.h:160
@ EBT_TERRAIN
Definition editor.h:156
@ EBT_SPECIAL
Definition editor.h:158
void editor_mouse_button_press(int canvas_x, int canvas_y, int button, int modifiers)
Definition editor.c:662
void editor_set_current_tile(const struct tile *ptile)
Definition editor.c:1017
void editor_mouse_move(int canvas_x, int canvas_y, int modifiers)
Definition editor.c:867
enum editor_tool_mode editor_tool_get_mode(enum editor_tool_type ett)
Definition editor.c:336
bool editor_tool_has_value_erase(enum editor_tool_type ett)
Definition editor.c:1378
void editor_tool_set_count(enum editor_tool_type ett, int count)
Definition editor.c:1264
void editor_tool_toggle_mode(enum editor_tool_type ett, enum editor_tool_mode etm)
Definition editor.c:1042
void editor_selection_add(const struct tile *ptile)
Definition editor.c:1096
void editor_notify_edit_finished(void)
Definition editor.c:898
void editor_init(void)
Definition editor.c:194
int editor_tool_get_value(enum editor_tool_type ett)
Definition editor.c:410
void editor_tool_set_applied_player(enum editor_tool_type, int player_no)
Definition editor.c:1353
struct edit_buffer * edit_buffer_new(int type_flags)
Definition editor.c:1434
struct edit_buffer * editor_get_copy_buffer(void)
Definition editor.c:1770
const char * editor_tool_get_mode_name(enum editor_tool_type ett, enum editor_tool_mode etm)
Definition editor.c:1781
void editor_set_tool(enum editor_tool_type emt)
Definition editor.c:271
void editor_clear(void)
Definition editor.c:247
void editor_tool_cycle_mode(enum editor_tool_type ett)
Definition editor.c:1059
int editor_tool_get_count(enum editor_tool_type ett)
Definition editor.c:1253
const struct tile * edit_buffer_get_origin(const struct edit_buffer *ebuf)
Definition editor.c:1913
void edit_buffer_copy(struct edit_buffer *ebuf, const struct tile *ptile)
Definition editor.c:1506
int editor_selection_count(void)
Definition editor.c:1389
void editor_tool_set_size(enum editor_tool_type ett, int size)
Definition editor.c:1230
const char * editor_get_mode_tooltip(enum editor_tool_mode etm)
Definition editor.c:1818
bool editor_tool_is_usable(enum editor_tool_type ett)
Definition editor.c:360
enum editor_tool_type editor_get_tool(void)
Definition editor.c:287
bool editor_tool_has_applied_player(enum editor_tool_type ett)
Definition editor.c:1366
bool editor_tool_has_size(enum editor_tool_type ett)
Definition editor.c:1208
void edit_buffer_clear(struct edit_buffer *ebuf)
Definition editor.c:1471
void editor_tool_set_value(enum editor_tool_type ett, int value)
Definition editor.c:398
bool editor_tool_has_value(enum editor_tool_type ett)
Definition editor.c:386
mouse_button_values
Definition editor.h:123
@ MOUSE_BUTTON_OTHER
Definition editor.h:124
@ MOUSE_BUTTON_LEFT
Definition editor.h:126
@ MOUSE_BUTTON_RIGHT
Definition editor.h:128
@ MOUSE_BUTTON_MIDDLE
Definition editor.h:127
const char * editor_tool_get_tooltip(enum editor_tool_type ett)
Definition editor.c:1328
void editor_selection_clear(void)
Definition editor.c:1085
void editor_mouse_button_release(int canvas_x, int canvas_y, int button, int modifiers)
Definition editor.c:799
void edit_buffer_copy_square(struct edit_buffer *ebuf, const struct tile *center, int radius)
Definition editor.c:1489
struct sprite * editor_tool_get_sprite(enum editor_tool_type ett)
Definition editor.c:1276
const struct tile * editor_get_current_tile(void)
Definition editor.c:1029
void editor_apply_tool_to_selection(void)
Definition editor.c:1129
const char * editor_tool_get_value_name(enum editor_tool_type ett, int value)
Definition editor.c:1173
void editor_apply_tool(const struct tile *ptile, bool part_of_selection)
Definition editor.c:910
bool editor_tile_is_selected(const struct tile *ptile)
Definition editor.c:1118
void edit_buffer_set_origin(struct edit_buffer *ebuf, const struct tile *ptile)
Definition editor.c:1901
void editor_free(void)
Definition editor.c:258
void edit_buffer_paste(struct edit_buffer *ebuf, const struct tile *dest)
Definition editor.c:1738
const struct tile * editor_get_selection_center(void)
Definition editor.c:1937
bool editor_tool_has_mode(enum editor_tool_type ett, enum editor_tool_mode etm)
Definition editor.c:314
struct unit * editor_unit_virtual_create(void)
Definition editor.c:1406
editor_object_type
Definition editor.h:25
@ OBJTYPE_PLAYER
Definition editor.h:30
@ OBJTYPE_UNIT
Definition editor.h:28
@ OBJTYPE_STARTPOS
Definition editor.h:27
@ OBJTYPE_GAME
Definition editor.h:31
@ NUM_OBJTYPES
Definition editor.h:33
@ OBJTYPE_CITY
Definition editor.h:29
@ OBJTYPE_TILE
Definition editor.h:26
void editor_ruleset_changed(void)
Definition editor.c:181
int editor_tool_get_applied_player(enum editor_tool_type ett)
Definition editor.c:1342
editor_keyboard_modifiers
Definition editor.h:116
@ EKM_CTRL
Definition editor.h:120
@ EKM_SHIFT
Definition editor.h:118
@ EKM_ALT
Definition editor.h:119
@ EKM_NONE
Definition editor.h:117
bool editor_tool_has_count(enum editor_tool_type ett)
Definition editor.c:1242
struct sprite * editor_get_mode_sprite(enum editor_tool_mode etm)
Definition editor.c:1840
editor_tool_type
Definition editor.h:36
@ ETT_ROAD
Definition editor.h:40
@ ETT_TERRAIN_SPECIAL
Definition editor.h:39
@ ETT_UNIT
Definition editor.h:42
@ ETT_VISION
Definition editor.h:44
@ ETT_STARTPOS
Definition editor.h:46
@ ETT_TERRITORY
Definition editor.h:45
@ NUM_EDITOR_TOOL_TYPES
Definition editor.h:49
@ ETT_CITY
Definition editor.h:43
@ ETT_COPYPASTE
Definition editor.h:47
@ ETT_TERRAIN_RESOURCE
Definition editor.h:38
@ ETT_MILITARY_BASE
Definition editor.h:41
@ ETT_TERRAIN
Definition editor.h:37
const char * editor_tool_get_name(enum editor_tool_type ett)
Definition editor.c:1160
void edit_buffer_free(struct edit_buffer *ebuf)
Definition editor.c:1452
void editor_tool_set_mode(enum editor_tool_type ett, enum editor_tool_mode etm)
Definition editor.c:299
GType type
Definition repodlgs.c:1313
size_t size
Definition specvec.h:72
int type_flags
Definition editor.c:64
Definition tile.h:50
Definition unit.h:138