Classes | |
class | map_editor |
A map editor. Receives SDL events and can execute hotkey commands. More... | |
struct | size_specs |
Size specifications for the map editor. More... | |
struct | terrain_group |
Stores the info about the data in editor-groups.cfg in a nice format. More... | |
class | terrain_palette |
Palette where the terrain to be drawn can be selected. More... | |
class | brush_bar |
A bar where the brush is drawn. More... | |
class | map_undo_action |
A saved action that may be undone. More... | |
Typedefs | |
typedef std::deque < map_undo_action > | map_undo_list |
typedef std::vector< std::pair < gamemap::location, t_translation::t_terrain > > | terrain_log |
Enumerations | |
enum | FLIP_AXIS { NO_FLIP, FLIP_X, FLIP_Y } |
Functions | |
bool | check_data (std::string &data, std::string &filename, bool &from_scenario, config &game_cfg) |
map_editor (editor_display &gui, editormap &map, config &theme, config &game_config) | |
void | load_tooltips () |
~map_editor () | |
void | handle_event (const SDL_Event &event) |
void | handle_keyboard_event (const SDL_KeyboardEvent &event, const int, const int) |
void | handle_mouse_button_event (const SDL_MouseButtonEvent &event, const int mousex, const int mousey) |
void | left_click (const gamemap::location hex_clicked) |
void | right_click (const gamemap::location hex_clicked) |
void | change_language () |
Change the language (effectively reload the editor). | |
void | edit_save_as () |
void | perform_set_starting_pos () |
void | edit_set_start_pos () |
void | perform_flood_fill (const t_translation::t_terrain fill_with) |
void | edit_flood_fill () |
void | edit_save_map () |
void | edit_quit () |
void | edit_new_map () |
void | edit_load_map () |
void | edit_fill_selection () |
void | edit_cut () |
void | edit_copy () |
void | perform_paste () |
void | edit_paste () |
void | edit_rotate_selection () |
void | edit_revert () |
void | edit_resize () |
void | edit_flip () |
void | edit_select_all () |
void | edit_draw () |
void | edit_refresh () |
void | edit_update () |
void | edit_auto_update () |
hotkey::ACTION_STATE | get_action_state (hotkey::HOTKEY_COMMAND command) const |
void | copy_buffer (map_buffer &buffer, const std::set< gamemap::location > &locs, const gamemap::location &origin) |
void | paste_buffer (const map_buffer &buffer, const gamemap::location &loc, map_undo_action &undo_action) |
void | insert_selection_in_clipboard () |
void | perform_fill_hexes (std::set< gamemap::location > &fill_hexes, const t_translation::t_terrain terrain, map_undo_action &undo_action) |
void | perform_selection_move () |
bool | can_execute_command (hotkey::HOTKEY_COMMAND command, int) const |
void | toggle_grid () |
void | save_undo_action (const map_undo_action &action) |
void | undo () |
void | redo () |
void | preferences () |
void | redraw_everything () |
void | highlight_selected_hexes (const bool clear_old) |
void | clear_highlighted_hexes_in_gui () |
void | set_mouseover_overlay () |
bool | changed_since_save () const |
void | set_starting_position (const int player, const gamemap::location loc) |
void | set_abort (const ABORT_MODE abort) |
void | set_file_to_save_as (const std::string filename, bool from_scenario) |
void | left_button_down (const int mousex, const int mousey) |
void | draw_on_mouseover_hexes (const t_translation::t_terrain terrain, const bool one_layer_only) |
void | draw_terrain (const t_translation::t_terrain terrain, const std::vector< gamemap::location > &hexes, const bool one_layer_only) |
void | terrain_changed (const gamemap::location &hex) |
void | right_button_down (const int, const int) |
void | middle_button_down (const int mousex, const int mousey) |
bool | confirm_exit_and_save () |
bool | save_map (const std::string fn, const bool display_confirmation) |
bool | verify_filename (const std::string &filename, bool show_error) const |
void | show_menu (const std::vector< std::string > &items, const int xloc, const int yloc, const bool) |
void | execute_command (const hotkey::HOTKEY_COMMAND command) |
void | recalculate_starting_pos_labels () |
void | update_mouse_over_hexes (const gamemap::location mouse_over_hex) |
void | left_button_func_changed (const LEFT_BUTTON_FUNC func) |
void | update_l_button_palette () |
std::string | get_action_name (const LEFT_BUTTON_FUNC func) const |
bool | is_left_button_func_menu (const theme::menu &menu) const |
void | main_loop () |
bool | confirm_modification_disposal (display &disp) |
Notify the user that the map is changed and ask if the user wants to proceed. | |
std::string | new_map_dialog (display &disp, const t_translation::t_terrain fill_terrain, const bool confirmation_needed, const config &gconfig) |
Show a dialog to create new map. | |
void | preferences_dialog (display &disp, config &prefs) |
Show a dialog where the user may set the preferences used in the editor. | |
bool | resize_dialog (display &disp, unsigned &width, unsigned &height, int &x_offset, int &y_offset, bool &do_expand) |
Show a dialog asking for the new size of the map. | |
FLIP_AXIS | flip_dialog (display &disp) |
void | adjust_sizes (const display &disp, size_specs &sizes) |
Adjust the internal size specifications to fit the display. | |
static bool | is_invalid_terrain (t_translation::t_terrain c) |
void | add_undo_action (const map_undo_action &action) |
Add an undo action to the undo stack. | |
bool | exist_undo_actions () |
Return true if there exist any undo actions in the undo stack. | |
bool | exist_redo_actions () |
Return true if there exist any redo actions in the redo stack. | |
map_undo_action | pop_undo_action () |
Remove, store in the redo stack and return the last undo action stored. | |
map_undo_action | pop_redo_action () |
Remove, store in the undo stack and return the last redo action stored. | |
void | clear_undo_actions () |
Clear all stored information about performed actions. | |
std::vector< gamemap::location > | get_tiles (const gamemap &map, const gamemap::location &a, const unsigned int radius) |
Return the tiles that are within radius from the location. | |
void | flood_fill (gamemap &map, const gamemap::location &start_loc, const t_translation::t_terrain fill_with, terrain_log *log=NULL) |
Flood fill the map with the terrain fill_with starting from the location start_loc. | |
std::set< gamemap::location > | get_component (const gamemap &map, const gamemap::location &start_loc) |
Return the area that would be flood filled if a flood fill was requested. | |
std::string | resize_map (editormap &map, const unsigned new_w, const unsigned new_h, const int off_x, const int off_y, const bool do_expand, const t_translation::t_terrain fill_with) |
Return the string representation of the map after it has been resized to new_w X new_h. | |
std::string | flip_map (editormap &map, const FLIP_AXIS axis) |
Return the string representation of the map after it has been flipped around the axis. | |
bool | valid_mapdata (const std::string &data, const config &cfg) |
Return true if the data is valid to create a map with, othwerwise false. | |
std::string | new_map (const size_t width, const size_t height, const t_translation::t_terrain filler) |
Returns a string representating a new empty map of width by height of the terrain filler. |
typedef std::deque<map_undo_action> map_editor::map_undo_list |
Definition at line 99 of file editor_undo.hpp.
typedef std::vector<std::pair<gamemap::location, t_translation::t_terrain> > map_editor::terrain_log |
Definition at line 171 of file map_manip.hpp.
void map_editor::map_editor::add_undo_action | ( | const map_undo_action & | action | ) |
Add an undo action to the undo stack.
Resize the stack if it gets larger than the maximum size. Add an operation to the number done since save. If keep_selection is true, it indicates that the selection has not changed and the currently selected terrain should be kept if this action is redone/undone. Also clear the redo stack.
Definition at line 121 of file editor_undo.cpp.
References redo_stack, undo_limit, and undo_stack.
Referenced by save_undo_action().
void map_editor::map_editor::adjust_sizes | ( | const display & | disp, | |
size_specs & | sizes | |||
) |
Adjust the internal size specifications to fit the display.
Definition at line 43 of file editor_layout.cpp.
References map_editor::size_specs::brush_x, map_editor::size_specs::brush_y, default_palette_width, display::h(), display::map_outside_area(), map_editor::size_specs::palette_h, map_editor::size_specs::palette_w, map_editor::size_specs::palette_x, map_editor::size_specs::palette_y, and map_editor::size_specs::terrain_space.
Referenced by map_editor(), and redraw_everything().
bool map_editor::can_execute_command | ( | hotkey::HOTKEY_COMMAND | command, | |
int | ||||
) | const |
Definition at line 905 of file editor.cpp.
References hotkey::HOTKEY_EDIT_AUTO_UPDATE, hotkey::HOTKEY_EDIT_COPY, hotkey::HOTKEY_EDIT_CUT, hotkey::HOTKEY_EDIT_DRAW, hotkey::HOTKEY_EDIT_FILL_SELECTION, hotkey::HOTKEY_EDIT_FLIP, hotkey::HOTKEY_EDIT_FLOOD_FILL, hotkey::HOTKEY_EDIT_LOAD_MAP, hotkey::HOTKEY_EDIT_NEW_MAP, hotkey::HOTKEY_EDIT_PASTE, hotkey::HOTKEY_EDIT_QUIT, hotkey::HOTKEY_EDIT_REFRESH, hotkey::HOTKEY_EDIT_RESIZE, hotkey::HOTKEY_EDIT_REVERT, hotkey::HOTKEY_EDIT_ROTATE_SELECTION, hotkey::HOTKEY_EDIT_SAVE_AS, hotkey::HOTKEY_EDIT_SAVE_MAP, hotkey::HOTKEY_EDIT_SELECT_ALL, hotkey::HOTKEY_EDIT_SET_START_POS, hotkey::HOTKEY_EDIT_UPDATE, hotkey::HOTKEY_FULLSCREEN, hotkey::HOTKEY_LANGUAGE, hotkey::HOTKEY_MAP_SCREENSHOT, hotkey::HOTKEY_MOUSE_SCROLL, hotkey::HOTKEY_PREFERENCES, hotkey::HOTKEY_REDO, hotkey::HOTKEY_SCREENSHOT, hotkey::HOTKEY_TOGGLE_GRID, hotkey::HOTKEY_UNDO, hotkey::HOTKEY_ZOOM_DEFAULT, hotkey::HOTKEY_ZOOM_IN, and hotkey::HOTKEY_ZOOM_OUT.
void map_editor::change_language | ( | ) |
Change the language (effectively reload the editor).
Definition at line 460 of file editor.cpp.
References _, game_config_, get_language(), get_languages(), preferences::language(), languagedef_name(), hotkey::load_descriptions(), font::load_font_config(), load_tooltips(), map_, new_map(), gui::OK_CANCEL, config::reset_translation(), game_config::revision, preferences::set_language(), set_language(), gui::dialog::set_menu(), gui::dialog::show(), and gamemap::write().
bool map_editor::changed_since_save | ( | ) | const |
Definition at line 1108 of file editor.cpp.
Referenced by confirm_exit_and_save(), edit_load_map(), and edit_new_map().
bool map_editor::check_data | ( | std::string & | data, | |
std::string & | filename, | |||
bool & | from_scenario, | |||
config & | game_cfg | |||
) |
Definition at line 80 of file editor.cpp.
References directory_name(), file_exists(), get_user_data_dir(), is_directory(), read_file(), and valid_mapdata().
Referenced by edit_load_map(), edit_revert(), and main().
void map_editor::clear_highlighted_hexes_in_gui | ( | ) |
Definition at line 1053 of file editor.cpp.
Referenced by highlight_selected_hexes(), and left_click().
void map_editor::map_editor::clear_undo_actions | ( | ) |
Clear all stored information about performed actions.
Definition at line 159 of file editor_undo.cpp.
References redo_stack, and undo_stack.
Referenced by edit_load_map(), and edit_new_map().
bool map_editor::confirm_exit_and_save | ( | ) |
Definition at line 1297 of file editor.cpp.
References _, changed_since_save(), save_map(), and gui::YES_NO.
Referenced by main_loop().
bool map_editor::map_editor::confirm_modification_disposal | ( | display & | disp | ) |
Notify the user that the map is changed and ask if the user wants to proceed.
Return true if yes is answered.
Definition at line 50 of file editor_dialogs.cpp.
References _, and gui::OK_CANCEL.
Referenced by edit_load_map(), and new_map_dialog().
void map_editor::copy_buffer | ( | map_buffer & | buffer, | |
const std::set< gamemap::location > & | locs, | |||
const gamemap::location & | origin | |||
) |
Definition at line 817 of file editor.cpp.
References gamemap::get_terrain(), map_, and starting_side_at().
Referenced by edit_rotate_selection(), insert_selection_in_clipboard(), and perform_selection_move().
void map_editor::draw_on_mouseover_hexes | ( | const t_translation::t_terrain | terrain, | |
const bool | one_layer_only | |||
) |
Definition at line 1212 of file editor.cpp.
References draw_terrain(), get_tiles(), map_, and gamemap::on_board().
Referenced by left_button_down(), left_click(), and right_button_down().
void map_editor::draw_terrain | ( | const t_translation::t_terrain | terrain, | |
const std::vector< gamemap::location > & | hexes, | |||
const bool | one_layer_only | |||
) |
Definition at line 1220 of file editor.cpp.
References map_editor::map_undo_action::add_terrain(), gamemap::BASE, t_translation::t_terrain::base, gamemap::get_terrain(), gamemap::get_terrain_info(), map_, t_translation::NO_LAYER, gamemap::OVERLAY, save_undo_action(), gamemap::set_terrain(), and terrain_type::terrain_with_default_base().
Referenced by draw_on_mouseover_hexes().
void map_editor::edit_auto_update | ( | ) |
Definition at line 806 of file editor.cpp.
void map_editor::edit_copy | ( | ) |
Definition at line 660 of file editor.cpp.
References insert_selection_in_clipboard().
Referenced by edit_cut().
void map_editor::edit_cut | ( | ) |
void map_editor::edit_draw | ( | ) |
void map_editor::edit_fill_selection | ( | ) |
Definition at line 649 of file editor.cpp.
References perform_fill_hexes(), and save_undo_action().
Referenced by edit_cut().
void map_editor::edit_flip | ( | ) |
Definition at line 760 of file editor.cpp.
References flip_dialog(), flip_map(), map_, NO_FLIP, save_undo_action(), map_editor::map_undo_action::set_map_data(), and gamemap::write().
void map_editor::edit_flood_fill | ( | ) |
void map_editor::edit_load_map | ( | ) |
Definition at line 624 of file editor.cpp.
References _, changed_since_save(), check_data(), clear_undo_actions(), confirm_modification_disposal(), game_config_, get_dir(), get_user_data_dir(), new_map(), read_file(), dialogs::show_file_chooser_dialog(), and verify_filename().
void map_editor::edit_new_map | ( | ) |
Definition at line 612 of file editor.cpp.
References changed_since_save(), clear_undo_actions(), game_config_, gamemap::get_terrain_info(), map, map_, and new_map_dialog().
void map_editor::edit_paste | ( | ) |
void map_editor::edit_quit | ( | ) |
void map_editor::edit_refresh | ( | ) |
Definition at line 791 of file editor.cpp.
References image::flush_cache(), and redraw_everything().
void map_editor::edit_resize | ( | ) |
Definition at line 728 of file editor.cpp.
References gamemap::get_terrain_info(), gamemap::h(), map_, gamemap::incorrect_format_exception::msg_, resize_dialog(), resize_map(), save_undo_action(), map_editor::map_undo_action::set_map_data(), twml_exception::show(), gamemap::w(), and gamemap::write().
void map_editor::edit_revert | ( | ) |
Definition at line 714 of file editor.cpp.
References _, check_data(), game_config_, map_, new_map(), read_file(), save_undo_action(), map_editor::map_undo_action::set_map_data(), and gamemap::write().
void map_editor::edit_rotate_selection | ( | ) |
Definition at line 675 of file editor.cpp.
References buf, copy_buffer(), gamemap::location::get_direction(), is_odd(), paste_buffer(), save_undo_action(), gamemap::location::SOUTH, gamemap::location::SOUTH_EAST, gamemap::location::SOUTH_WEST, gamemap::location::valid(), gamemap::location::x, and gamemap::location::y.
void map_editor::edit_save_as | ( | ) |
Definition at line 508 of file editor.cpp.
References _, file_exists(), get_dir(), get_user_data_dir(), save_map(), set_file_to_save_as(), dialogs::show_file_chooser_dialog(), verify_filename(), and gui::YES_NO.
Referenced by save_map().
void map_editor::edit_save_map | ( | ) |
void map_editor::edit_select_all | ( | ) |
Definition at line 771 of file editor.cpp.
References gamemap::h(), highlight_selected_hexes(), map_, and gamemap::w().
void map_editor::edit_set_start_pos | ( | ) |
void map_editor::edit_update | ( | ) |
void map_editor::execute_command | ( | const hotkey::HOTKEY_COMMAND | command | ) |
Definition at line 1401 of file editor.cpp.
References hotkey::execute_command(), hotkey::HOTKEY_QUIT_GAME, and set_abort().
Referenced by play_controller::execute_command(), and show_menu().
bool map_editor::map_editor::exist_redo_actions | ( | ) |
Return true if there exist any redo actions in the redo stack.
Definition at line 135 of file editor_undo.cpp.
References redo_stack.
Referenced by redo().
bool map_editor::map_editor::exist_undo_actions | ( | ) |
Return true if there exist any undo actions in the undo stack.
Definition at line 131 of file editor_undo.cpp.
References undo_stack.
Referenced by undo().
Definition at line 684 of file editor_dialogs.cpp.
References _, FLIP_X, FLIP_Y, NO_FLIP, gui::OK_CANCEL, gui::dialog::set_menu(), gui::dialog::show(), and font::word_wrap_text().
Referenced by edit_flip().
std::string map_editor::map_editor::flip_map | ( | editormap & | map, | |
const FLIP_AXIS | axis | |||
) |
Return the string representation of the map after it has been flipped around the axis.
Definition at line 389 of file map_manip.cpp.
References editormap::flip().
Referenced by edit_flip().
void map_editor::map_editor::flood_fill | ( | gamemap & | map, | |
const gamemap::location & | start_loc, | |||
const t_translation::t_terrain | fill_with, | |||
terrain_log * | log = NULL | |||
) |
Flood fill the map with the terrain fill_with starting from the location start_loc.
If log is non-null it will contain the positions of the changed tiles and the terrains they had before the filling started.
Definition at line 327 of file map_manip.cpp.
References t_translation::t_terrain::base, get_component(), gamemap::get_terrain(), loc, t_translation::NO_LAYER, gamemap::OVERLAY, and gamemap::set_terrain().
Referenced by perform_flood_fill().
std::string map_editor::get_action_name | ( | const LEFT_BUTTON_FUNC | func | ) | const |
Definition at line 1498 of file editor.cpp.
Referenced by is_left_button_func_menu(), left_button_func_changed(), and update_l_button_palette().
hotkey::ACTION_STATE map_editor::get_action_state | ( | hotkey::HOTKEY_COMMAND | command | ) | const |
Definition at line 810 of file editor.cpp.
References hotkey::ACTION_OFF, hotkey::ACTION_ON, and hotkey::HOTKEY_EDIT_AUTO_UPDATE.
std::set< gamemap::location > map_editor::map_editor::get_component | ( | const gamemap & | map, | |
const gamemap::location & | start_loc | |||
) |
Return the area that would be flood filled if a flood fill was requested.
Definition at line 350 of file map_manip.cpp.
References gamemap::get_terrain(), get_tiles(), loc, and gamemap::on_board().
Referenced by flood_fill(), and left_button_down().
std::vector< gamemap::location > map_editor::map_editor::get_tiles | ( | const gamemap & | map, | |
const gamemap::location & | a, | |||
const unsigned int | radius | |||
) |
Return the tiles that are within radius from the location.
Definition at line 298 of file map_manip.cpp.
References gamemap::location::get_direction(), loc, gamemap::location::NORTH, gamemap::location::NORTH_EAST, gamemap::location::NORTH_WEST, gamemap::on_board(), gamemap::location::SOUTH, gamemap::location::SOUTH_EAST, and gamemap::location::SOUTH_WEST.
Referenced by draw_on_mouseover_hexes(), get_component(), left_button_down(), and update_mouse_over_hexes().
void map_editor::handle_event | ( | const SDL_Event & | event | ) |
Definition at line 286 of file editor.cpp.
References handle_keyboard_event(), handle_mouse_button_event(), and tooltips::process().
Referenced by gui::textbox::handle_event(), mp::gamebrowser::handle_event(), gui::menu::handle_event(), and gui::file_menu::handle_event().
void map_editor::handle_keyboard_event | ( | const SDL_KeyboardEvent & | event, | |
const | int, | |||
const | int | |||
) |
Definition at line 302 of file editor.cpp.
References preferences::fullscreen(), hotkey::key_event(), preferences::resolution(), and set_abort().
Referenced by handle_event().
void map_editor::handle_mouse_button_event | ( | const SDL_MouseButtonEvent & | event, | |
const int | mousex, | |||
const int | mousey | |||
) |
Definition at line 328 of file editor.cpp.
References theme::menu::items(), left_click(), map_, gamemap::on_board(), perform_selection_move(), point_in_rect(), rect, right_click(), preferences::scroll_speed(), SDL_BUTTON_WHEELDOWN, SDL_BUTTON_WHEELLEFT, SDL_BUTTON_WHEELRIGHT, SDL_BUTTON_WHEELUP, and show_menu().
Referenced by handle_event().
void map_editor::highlight_selected_hexes | ( | const bool | clear_old | ) |
Definition at line 1043 of file editor.cpp.
References clear_highlighted_hexes_in_gui().
Referenced by edit_select_all(), paste_buffer(), redo(), and undo().
void map_editor::insert_selection_in_clipboard | ( | ) |
Definition at line 854 of file editor.cpp.
References copy_buffer(), and distance_between().
Referenced by edit_copy().
static bool map_editor::is_invalid_terrain | ( | t_translation::t_terrain | c | ) | [static] |
Definition at line 37 of file editor_palettes.cpp.
References t_translation::FOGGED, and t_translation::VOID_TERRAIN.
Referenced by map_editor::terrain_palette::terrain_palette().
bool map_editor::is_left_button_func_menu | ( | const theme::menu & | menu | ) | const |
Definition at line 1515 of file editor.cpp.
References get_action_name(), and theme::menu::items().
Referenced by update_l_button_palette().
void map_editor::left_button_down | ( | const int | mousex, | |
const int | mousey | |||
) |
Definition at line 1145 of file editor.cpp.
References draw_on_mouseover_hexes(), get_component(), get_tiles(), key_, map_, gamemap::on_board(), update_mouse_over_hexes(), gamemap::location::valid(), and display::WARP.
Referenced by main_loop().
void map_editor::left_button_func_changed | ( | const LEFT_BUTTON_FUNC | func | ) |
Definition at line 1460 of file editor.cpp.
References reports::EDIT_LEFT_BUTTON_FUNCTION, get_action_name(), and hotkey::get_hotkey().
Referenced by edit_draw(), edit_flood_fill(), edit_paste(), edit_set_start_pos(), and map_editor().
void map_editor::left_click | ( | const gamemap::location | hex_clicked | ) |
Definition at line 398 of file editor.cpp.
References clear_highlighted_hexes_in_gui(), draw_on_mouseover_hexes(), gamemap::get_terrain(), key_, map_, perform_flood_fill(), perform_paste(), and perform_set_starting_pos().
Referenced by handle_mouse_button_event().
void map_editor::load_tooltips | ( | ) |
Definition at line 215 of file editor.cpp.
References _, tooltips::add_tooltip(), tooltips::clear_tooltips(), theme::menus(), screen, display::screen_area(), and text.
Referenced by change_language(), map_editor(), and redraw_everything().
void map_editor::main_loop | ( | ) |
Definition at line 1528 of file editor.cpp.
References confirm_exit_and_save(), theme::menu::items(), key_, left_button_down(), theme::object::location(), middle_button_down(), perform_selection_move(), events::pump(), events::raise_draw_event(), recalculate_starting_pos_labels(), redraw_everything(), right_button_down(), preferences::scroll_speed(), set_abort(), show_menu(), update_l_button_palette(), and update_mouse_over_hexes().
map_editor::map_editor | ( | editor_display & | gui, | |
editormap & | map, | |||
config & | theme, | |||
config & | game_config | |||
) |
Definition at line 158 of file editor.cpp.
References adjust_sizes(), hotkeys_, istream_file(), left_button_func_changed(), hotkey::load_descriptions(), hotkey::load_hotkeys(), load_tooltips(), config::error::message, events::raise_draw_event(), read(), recalculate_starting_pos_labels(), redraw_everything(), and stream.
void map_editor::middle_button_down | ( | const int | mousex, | |
const int | mousey | |||
) |
Definition at line 1289 of file editor.cpp.
References gamemap::location::valid(), and display::WARP.
Referenced by main_loop().
std::string map_editor::new_map | ( | const size_t | width, | |
const size_t | height, | |||
const t_translation::t_terrain | filler | |||
) |
Returns a string representating a new empty map of width by height of the terrain filler.
Definition at line 413 of file map_manip.cpp.
References gamemap::default_map_header, map, and t_translation::write_game_map().
Referenced by change_language(), edit_load_map(), edit_revert(), main(), and new_map_dialog().
std::string map_editor::map_editor::new_map_dialog | ( | display & | disp, | |
const t_translation::t_terrain | fill_terrain, | |||
const bool | confirmation_needed, | |||
const config & | gconfig | |||
) |
Show a dialog to create new map.
If confirmation_needed is true, the user will be asked if she wants to continue even though the changes to the current map is lost. fill_terrain will be used to fill the map if a new one is created. Return the string representation of the new map, or the empty string if the operation failed or was cancelled.
Definition at line 58 of file editor_dialogs.cpp.
References _, util::scoped_resource< T, ReleasePolicy >::assign(), cfg, config::child(), confirm_modification_disposal(), create_map_generator(), gamemap::default_border, cursor::draw(), font::draw_text(), dummy_cfg, config::find_child(), util::scoped_resource< T, ReleasePolicy >::get(), display::h(), map, map_max_height, map_max_width, map_min_height, map_min_width, new_map(), font::NORMAL_COLOUR, events::pump(), events::raise_draw_event(), events::raise_process_event(), screen_area(), display::update_display(), update_rect(), display::video(), and display::w().
Referenced by edit_new_map().
void map_editor::paste_buffer | ( | const map_buffer & | buffer, | |
const gamemap::location & | loc, | |||
map_undo_action & | undo_action | |||
) |
Definition at line 826 of file editor.cpp.
References map_editor::map_undo_action::add_starting_location(), map_editor::map_undo_action::add_terrain(), gamemap::get_terrain(), highlight_selected_hexes(), map_, gamemap::on_board(), map_editor::map_undo_action::set_selection(), gamemap::set_starting_position(), gamemap::set_terrain(), gamemap::starting_position(), and terrain_changed().
Referenced by edit_rotate_selection(), perform_paste(), and perform_selection_move().
void map_editor::perform_fill_hexes | ( | std::set< gamemap::location > & | fill_hexes, | |
const t_translation::t_terrain | terrain, | |||
map_undo_action & | undo_action | |||
) |
Definition at line 869 of file editor.cpp.
References map_editor::map_undo_action::add_terrain(), t_translation::t_terrain::base, gamemap::get_terrain(), map_, t_translation::NO_LAYER, gamemap::on_board(), gamemap::OVERLAY, gamemap::set_terrain(), and terrain_changed().
Referenced by edit_fill_selection(), and perform_selection_move().
void map_editor::perform_flood_fill | ( | const t_translation::t_terrain | fill_with | ) |
Definition at line 584 of file editor.cpp.
References map_editor::map_undo_action::add_terrain(), flood_fill(), gamemap::get_terrain_info(), map_, save_undo_action(), terrain_changed(), and terrain_type::terrain_with_default_base().
Referenced by left_click(), and right_click().
void map_editor::perform_paste | ( | ) |
Definition at line 665 of file editor.cpp.
References paste_buffer(), and save_undo_action().
Referenced by left_click().
void map_editor::perform_selection_move | ( | ) |
Definition at line 886 of file editor.cpp.
References buf, copy_buffer(), paste_buffer(), perform_fill_hexes(), and save_undo_action().
Referenced by handle_mouse_button_event(), and main_loop().
void map_editor::perform_set_starting_pos | ( | ) |
Definition at line 548 of file editor.cpp.
References _, map_, gamemap::MAX_PLAYERS, gui::OK_CANCEL, gui::dialog::set_menu(), set_starting_position(), gui::dialog::show(), and starting_side_at().
Referenced by left_click().
map_undo_action map_editor::map_editor::pop_redo_action | ( | ) |
Remove, store in the undo stack and return the last redo action stored.
Definition at line 149 of file editor_undo.cpp.
References redo_stack, undo_limit, and undo_stack.
Referenced by redo().
map_undo_action map_editor::map_editor::pop_undo_action | ( | ) |
Remove, store in the redo stack and return the last undo action stored.
Definition at line 139 of file editor_undo.cpp.
References redo_stack, undo_limit, and undo_stack.
Referenced by undo().
void map_editor::preferences | ( | ) |
Show a dialog where the user may set the preferences used in the editor.
Definition at line 237 of file editor_dialogs.cpp.
References _, gui::dialog_frame::default_style, draw_solid_tinted_rectangle(), font::draw_text(), preferences::editor_b(), preferences::editor_g(), preferences::editor_r(), preferences::fullscreen(), CVideo::getSurface(), preferences::grid(), display::h(), font::NORMAL_COLOUR, events::pump(), events::raise_draw_event(), events::raise_process_event(), screen_area(), display::screen_area(), preferences::scroll_speed(), preferences::set_editor_b(), preferences::set_editor_g(), preferences::set_editor_r(), preferences::set_fullscreen(), preferences::set_grid(), preferences::set_scroll_speed(), preferences::show_hotkeys_dialog(), preferences::show_video_mode_dialog(), str_cast(), gui::button::TYPE_CHECK, display::update_display(), update_rect(), display::video(), and display::w().
Referenced by preferences(), and preferences::show_preferences_dialog().
void map_editor::recalculate_starting_pos_labels | ( | ) |
Definition at line 1410 of file editor.cpp.
References _, loc, map_, gamemap::MAX_PLAYERS, gamemap::starting_position(), and gamemap::location::valid().
Referenced by edit_update(), main_loop(), map_editor(), redo(), set_starting_position(), and undo().
void map_editor::redo | ( | ) |
Definition at line 992 of file editor.cpp.
References exist_redo_actions(), highlight_selected_hexes(), map_, map_editor::map_undo_action::map_data_set(), map_editor::map_undo_action::new_map_data(), t_translation::NO_LAYER, gamemap::OVERLAY, pop_redo_action(), recalculate_starting_pos_labels(), map_editor::map_undo_action::redo_selection(), map_editor::map_undo_action::redo_starting_locations(), map_editor::map_undo_action::redo_terrains(), map_editor::map_undo_action::selection_set(), gamemap::set_starting_position(), gamemap::set_terrain(), map_editor::map_undo_action::starting_location_set(), terrain_changed(), and map_editor::map_undo_action::terrain_set().
void map_editor::redraw_everything | ( | ) |
Definition at line 1032 of file editor.cpp.
References adjust_sizes(), load_tooltips(), and update_l_button_palette().
Referenced by edit_refresh(), main_loop(), and map_editor().
bool map_editor::map_editor::resize_dialog | ( | display & | disp, | |
unsigned & | width, | |||
unsigned & | height, | |||
int & | x_offset, | |||
int & | y_offset, | |||
bool & | do_expand | |||
) |
Show a dialog asking for the new size of the map.
Return the chosen width and height. Checks are made to see that the desired values will result in a feasible map.
Definition at line 488 of file editor_dialogs.cpp.
References _, cursor::draw(), font::draw_text(), display::h(), lexical_cast(), map_max_height, map_max_width, map_min_height, map_min_width, font::NORMAL_COLOUR, events::pump(), events::raise_draw_event(), events::raise_process_event(), screen_area(), gui::button::TYPE_CHECK, display::update_display(), update_rect(), display::video(), and display::w().
Referenced by edit_resize().
std::string map_editor::map_editor::resize_map | ( | editormap & | map, | |
const unsigned | new_w, | |||
const unsigned | new_h, | |||
const int | off_x, | |||
const int | off_y, | |||
const bool | do_expand, | |||
const t_translation::t_terrain | fill_with | |||
) |
Return the string representation of the map after it has been resized to new_w X new_h.
If the new dimensions are smaller than the current ones, the map will be cropped from the bottom and from the right. If the map becomes larger than the current dimensions, the new map area appeard at the bottom and/or the right and is filled with the terrain fill_with.
Definition at line 381 of file map_manip.cpp.
References editormap::resize().
Referenced by edit_resize().
void map_editor::right_button_down | ( | const | int, | |
const | int | |||
) |
Definition at line 1282 of file editor.cpp.
References draw_on_mouseover_hexes().
Referenced by main_loop().
void map_editor::right_click | ( | const gamemap::location | hex_clicked | ) |
Definition at line 446 of file editor.cpp.
References gamemap::get_terrain(), key_, map_, and perform_flood_fill().
Referenced by handle_mouse_button_event().
bool map_editor::save_map | ( | const std::string | fn, | |
const bool | display_confirmation | |||
) |
Definition at line 1313 of file editor.cpp.
References _, data, edit_save_as(), map_, read_file(), verify_filename(), vgettext(), io_exception::what(), gamemap::write(), and write_file().
Referenced by confirm_exit_and_save(), edit_save_as(), and edit_save_map().
void map_editor::save_undo_action | ( | const map_undo_action & | action | ) |
Definition at line 952 of file editor.cpp.
References add_undo_action(), and map_editor::map_undo_action::something_set().
Referenced by draw_terrain(), edit_fill_selection(), edit_flip(), edit_resize(), edit_revert(), edit_rotate_selection(), perform_flood_fill(), perform_paste(), perform_selection_move(), and set_starting_position().
void map_editor::set_abort | ( | const ABORT_MODE | abort | ) |
Definition at line 1134 of file editor.cpp.
Referenced by edit_quit(), execute_command(), handle_keyboard_event(), and main_loop().
void map_editor::set_file_to_save_as | ( | const std::string | filename, | |
bool | from_scenario | |||
) |
void map_editor::set_mouseover_overlay | ( | ) |
Definition at line 1058 of file editor.cpp.
References adjust_surface_alpha(), create_compatible_surface(), image::get_image(), gamemap::get_terrain_info(), map_, scale_surface(), size, and zoom.
Referenced by update_mouse_over_hexes().
void map_editor::set_starting_position | ( | const int | player, | |
const gamemap::location | loc | |||
) |
Definition at line 1112 of file editor.cpp.
References map_editor::map_undo_action::add_starting_location(), map_, gamemap::on_board(), recalculate_starting_pos_labels(), save_undo_action(), gamemap::set_starting_position(), and gamemap::starting_position().
Referenced by perform_set_starting_pos().
void map_editor::show_menu | ( | const std::vector< std::string > & | items, | |
const int | xloc, | |||
const int | yloc, | |||
const | bool | |||
) |
Definition at line 1383 of file editor.cpp.
References execute_command(), hotkey::get_hotkey(), gui2::get_id(), gui::dialog::hotkeys_style, gui::MESSAGE, gui::dialog::set_menu(), and gui::dialog::show().
Referenced by handle_mouse_button_event(), main_loop(), and play_controller::show_menu().
void map_editor::terrain_changed | ( | const gamemap::location & | hex | ) |
Definition at line 1254 of file editor.cpp.
Referenced by paste_buffer(), perform_fill_hexes(), perform_flood_fill(), redo(), and undo().
void map_editor::toggle_grid | ( | ) |
Definition at line 946 of file editor.cpp.
References preferences::grid(), and preferences::set_grid().
void map_editor::undo | ( | ) |
Definition at line 961 of file editor.cpp.
References exist_undo_actions(), highlight_selected_hexes(), map_, map_editor::map_undo_action::map_data_set(), map_editor::map_undo_action::old_map_data(), pop_undo_action(), recalculate_starting_pos_labels(), map_editor::map_undo_action::selection_set(), gamemap::set_starting_position(), gamemap::set_terrain(), map_editor::map_undo_action::starting_location_set(), terrain_changed(), map_editor::map_undo_action::terrain_set(), map_editor::map_undo_action::undo_selection(), map_editor::map_undo_action::undo_starting_locations(), and map_editor::map_undo_action::undo_terrains().
void map_editor::update_l_button_palette | ( | ) |
Definition at line 1471 of file editor.cpp.
References draw_rectangle(), get_action_name(), CVideo::getSurface(), is_left_button_func_menu(), theme::menus(), r, screen, update_rect(), and display::video().
Referenced by main_loop(), and redraw_everything().
void map_editor::update_mouse_over_hexes | ( | const gamemap::location | mouse_over_hex | ) |
Definition at line 1429 of file editor.cpp.
References get_tiles(), map_, set_mouseover_overlay(), and size.
Referenced by left_button_down(), and main_loop().
bool map_editor::map_editor::valid_mapdata | ( | const std::string & | data, | |
const config & | cfg | |||
) |
Return true if the data is valid to create a map with, othwerwise false.
Definition at line 393 of file map_manip.cpp.
References twml_exception::dev_message, gamemap::h(), twml_exception::user_message, and gamemap::w().
Referenced by check_data().
bool map_editor::verify_filename | ( | const std::string & | filename, | |
bool | show_error | |||
) | const |
Definition at line 1368 of file editor.cpp.
References _.
Referenced by edit_load_map(), edit_save_as(), and save_map().
map_editor::~map_editor | ( | ) |
Definition at line 270 of file editor.cpp.
References hotkeys_, ostream_file(), hotkey::save_hotkeys(), io_exception::what(), and write().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |