24 #include <boost/dynamic_bitset.hpp>
26 #include <SDL2/SDL_image.h>
76 virtual const std::string&
window_id()
const override;
86 bool check_big(std::string img_abs_path,
const int scale_size)
88 SDL_Surface * img_surf = IMG_Load(img_abs_path.c_str());
89 return (img_surf->w > scale_size) || (img_surf->h > scale_size);
144 for (
unsigned i = 0;
i < values.size(); ++
i) {
145 if(values.at(
i)[
"label"] ==
item) {
155 const SDL_Keycode key,
156 SDL_Keymod modifier);
A config object defines a single node in a WML file, with access to child nodes.
A class grating read only view to a vector of config objects, viewed as one config with all children ...
Dialog that allows user to create custom unit types.
unsigned int selected_attack_
0 means there are no attacks.
void write()
Write the cfg file.
bool check_id(std::string id)
Utility method to check if ID contains any invalid characters.
std::vector< config > defense_list_
boost::dynamic_bitset res_toggles_
Used to control checkboxes, so that only specific values are overridden.
const game_config_view & game_config_
std::vector< std::string > sel_abilities_
Need this because can't store macros in config.
std::vector< std::pair< boost::dynamic_bitset<>, config > > attacks_
std::vector< config > abilities_list_
void store_attack()
Callbacks for attack page.
void set_selected_from_string(menu_button &list, std::vector< config > values, std::string item)
Utility method to set state of menu_button from a string.
std::vector< config > movetype_list_
std::vector< config > race_list_
void update_defenses()
Callbacks for defense list.
std::string generated_wml
Generated WML.
void save_unit_type()
Save Unit Type data to cfg.
std::vector< config > align_list_
void button_state_change()
Callback to enable/disable OK button if ID/Name is invalid.
bool check_big(std::string img_abs_path, const int scale_size)
Check if width/height bigger than a specified size.
void signal_handler_sdl_key_down(const event::ui_event, bool &handled, const SDL_Keycode key, SDL_Keymod modifier)
editor_edit_unit(const game_config_view &game_config, const std::string &addon_id)
void select_file(const std::string &default_dir, const std::string &id_stem)
Callback for file select button.
void button_state_change_id()
preproc_map specials_map_
void write_macro(std::ostream &out, int level, std::string macro_name)
Write macro to a stream at specified tab level.
boost::dynamic_bitset move_toggles_
void update_movement_costs()
Callbacks for movement list.
std::vector< config > resistances_list_
preproc_map abilities_map_
void enable_defense_slider()
void on_page_select()
Callback when an tab item in the "page" listbox is selected.
void update_resistances()
Callback for resistance list.
const std::string & addon_id_
void store_movement_costs()
void enable_movement_slider()
std::vector< config > specials_list_
virtual const std::string & window_id() const override
The ID of the window to build.
void enable_resistances_slider()
std::vector< std::string > sel_specials_
boost::dynamic_bitset def_toggles_
void load_unit_type()
Load Unit Type data from cfg.
void update_wml_view()
Update wml preview.
std::vector< config > usage_type_list_
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
DEFINE_SIMPLE_EXECUTE_WRAPPER(editor_edit_unit)
The execute function.
void load_movetype()
Callback for loading movetype data in UI.
void update_image(const std::string &id_stem)
Callback for image update.
Abstract base class for all modal dialogs.
base class of top level items, the only item which needs to store the final canvases to draw on.
Various uncategorised dialogs.
Game configuration data as global variables.
ui_event
The event sent to the dispatcher.
std::pair< std::string, unsigned > item
std::string default_dir()
std::map< std::string, struct preproc_define > preproc_map