Author: ilor
Date: Tue Sep 23 01:16:18 2008
New Revision: 29658
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29658&view=rev
Log:
Editor 2: a feature to draw hex coordinates and/or terrain code on every hex.
Also a minor changelog backlog.
Modified:
trunk/changelog
trunk/data/core/editor2-hotkeys.cfg
trunk/data/themes/editor2.cfg
trunk/players_changelog
trunk/src/editor2/editor_controller.cpp
trunk/src/editor2/editor_display.cpp
trunk/src/editor2/editor_display.hpp
trunk/src/hotkeys.cpp
trunk/src/hotkeys.hpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=29658&r1=29657&r2=29658&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Tue Sep 23 01:16:18 2008
@@ -5,6 +5,8 @@
(hardcoded) list of time_of_days. Can change the settings and see the
effects without having to close the settings dialog. The preferences
are shared with the old editor.
+ * Added a feature to draw hex coordinates and/or terrain code on every hex
+ * Auto update transitions option is stored in the preferences
* Graphics:
* New or updated unit frames: Walking Corpse swimmer, Soulless swimmer
* Language and i18n:
Modified: trunk/data/core/editor2-hotkeys.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/editor2-hotkeys.cfg?rev=29658&r1=29657&r2=29658&view=diff
==============================================================================
--- trunk/data/core/editor2-hotkeys.cfg (original)
+++ trunk/data/core/editor2-hotkeys.cfg Tue Sep 23 01:16:18 2008
@@ -137,4 +137,18 @@
key="t"
[/hotkey]
+[hotkey]
+ command="editor-update-transitions"
+ key="t"
+[/hotkey]
+
+[hotkey]
+ command="editor-draw-coordinates"
+ key="o"
+[/hotkey]
+
+[hotkey]
+ command="editor-draw-terrain-codes"
+ key="i"
+[/hotkey]
#undef IF_APPLE_CMD_ELSE_CTRL
Modified: trunk/data/themes/editor2.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/themes/editor2.cfg?rev=29658&r1=29657&r2=29658&view=diff
==============================================================================
--- trunk/data/themes/editor2.cfg (original)
+++ trunk/data/themes/editor2.cfg Tue Sep 23 01:16:18 2008
@@ -140,7 +140,7 @@
id=menu-editor-map
title= _ "Map"
image=lite
-
items=editor-map-resize,editor-map-rotate,editor-map-flip-x,editor-map-flip-y,editor-map-generate,editor-refresh,editor-update-transitions,editor-auto-update-transitions,editor-refresh-image-cache
+
items=editor-map-resize,editor-map-rotate,editor-map-flip-x,editor-map-flip-y,editor-map-generate,editor-refresh,editor-update-transitions,editor-auto-update-transitions,editor-refresh-image-cache,editor-draw-coordinates,editor-draw-terrain-codes
rect="+2,=,+100,="
xanchor=fixed
yanchor=fixed
Modified: trunk/players_changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/players_changelog?rev=29658&r1=29657&r2=29658&view=diff
==============================================================================
--- trunk/players_changelog (original)
+++ trunk/players_changelog Tue Sep 23 01:16:18 2008
@@ -6,6 +6,7 @@
* Editor2
* Allow changing the display time of day from a preset list or to custom
values via sliders, available in the new editor settings dialog.
+ * Added a feature to draw hex coordinates and/or terrain code on every
hex
* Language and translations
* updated translations: Finnish, German, Lithuanian, Slovak, Valencian.
Modified: trunk/src/editor2/editor_controller.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.cpp?rev=29658&r1=29657&r2=29658&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.cpp (original)
+++ trunk/src/editor2/editor_controller.cpp Tue Sep 23 01:16:18 2008
@@ -593,6 +593,9 @@
return true;
case HOTKEY_EDITOR_MAP_ROTATE:
return false; //not implemented
+ case HOTKEY_EDITOR_DRAW_COORDINATES:
+ case HOTKEY_EDITOR_DRAW_TERRAIN_CODES:
+ return true;
default:
return false;
}
@@ -608,6 +611,10 @@
return is_mouse_action_set(command) ? ACTION_ON :
ACTION_OFF;
case HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS:
return auto_update_transitions_ ? ACTION_ON :
ACTION_OFF;
+ case HOTKEY_EDITOR_DRAW_COORDINATES:
+ return gui_->get_draw_coordinates() ? ACTION_ON :
ACTION_OFF;
+ case HOTKEY_EDITOR_DRAW_TERRAIN_CODES:
+ return gui_->get_draw_terrain_codes() ? ACTION_ON :
ACTION_OFF;
default:
return command_executor::get_action_state(command);
}
@@ -726,6 +733,14 @@
return true;
case HOTKEY_EDITOR_REFRESH_IMAGE_CACHE:
refresh_image_cache();
+ return true;
+ case HOTKEY_EDITOR_DRAW_COORDINATES:
+
gui().set_draw_coordinates(!gui().get_draw_coordinates());
+ gui().invalidate_all();
+ return true;
+ case HOTKEY_EDITOR_DRAW_TERRAIN_CODES:
+
gui().set_draw_terrain_codes(!gui().get_draw_terrain_codes());
+ gui().invalidate_all();
return true;
default:
return controller_base::execute_command(command, index);
Modified: trunk/src/editor2/editor_display.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_display.cpp?rev=29658&r1=29657&r2=29658&view=diff
==============================================================================
--- trunk/src/editor2/editor_display.cpp (original)
+++ trunk/src/editor2/editor_display.cpp Tue Sep 23 01:16:18 2008
@@ -26,6 +26,8 @@
: display(video, map, theme_cfg, cfg, level)
, brush_locations_()
, toolbar_hint_()
+ , draw_coordinates_(false)
+ , draw_terrain_codes_(false)
{
clear_screen();
}
@@ -84,9 +86,43 @@
int drawing_order = gamemap::get_drawing_order(loc);
tblit blit(xpos, ypos);
display::draw_hex(loc);
- if (map().on_board_with_border(loc) && map().in_selection(loc)) {
- drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order, tblit(xpos,
ypos,
- image::get_image("editor/selection-overlay.png",
image::SCALED_TO_HEX)));
+ if (map().on_board_with_border(loc)) {
+ if (map().in_selection(loc)) {
+ drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order,
tblit(xpos, ypos,
+
image::get_image("editor/selection-overlay.png", image::SCALED_TO_HEX)));
+ }
+ }
+ if (map().on_board(loc)) {
+ if (draw_coordinates_) {
+ int off_x = xpos + hex_size()/2;
+ int off_y = ypos + hex_size()/2;
+ surface text =
font::get_rendered_text(lexical_cast<std::string>(loc), font::SIZE_SMALL,
font::NORMAL_COLOUR);
+ surface bg = create_neutral_surface(text->w, text->h);
+ SDL_Rect bg_rect = {0, 0, text->w, text->h};
+ SDL_FillRect(bg, &bg_rect, 0xff000000);
+ off_x -= text->w / 2;
+ if (draw_terrain_codes_) {
+ off_y -= text->h;
+ } else {
+ off_y -= text->h / 2;
+ }
+ drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order,
tblit(off_x, off_y, bg));
+ drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order,
tblit(off_x, off_y, text));
+ }
+ if (draw_terrain_codes_) {
+ int off_x = xpos + hex_size()/2;
+ int off_y = ypos + hex_size()/2;
+ surface text =
font::get_rendered_text(lexical_cast<std::string>(map().get_terrain(loc)),
font::SIZE_SMALL, font::NORMAL_COLOUR);
+ surface bg = create_neutral_surface(text->w, text->h);
+ SDL_Rect bg_rect = {0, 0, text->w, text->h};
+ SDL_FillRect(bg, &bg_rect, 0xff000000);
+ off_x -= text->w / 2;
+ if (!draw_coordinates_) {
+ off_y -= text->h / 2;
+ }
+ drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order,
tblit(off_x, off_y, bg));
+ drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order,
tblit(off_x, off_y, text));
+ }
}
}
Modified: trunk/src/editor2/editor_display.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_display.hpp?rev=29658&r1=29657&r2=29658&view=diff
==============================================================================
--- trunk/src/editor2/editor_display.hpp (original)
+++ trunk/src/editor2/editor_display.hpp Tue Sep 23 01:16:18 2008
@@ -34,6 +34,10 @@
const editor_map& map() const { return static_cast<const
editor_map&>(map_); }
void rebuild_terrain(const gamemap::location &loc);
void set_toolbar_hint(const std::string value) { toolbar_hint_ = value;
}
+ bool get_draw_coordinates() { return draw_coordinates_; }
+ void set_draw_coordinates(bool value) { draw_coordinates_ = value; }
+ bool get_draw_terrain_codes() { return draw_terrain_codes_; }
+ void set_draw_terrain_codes(bool value) { draw_terrain_codes_ = value; }
protected:
void pre_draw();
/**
@@ -48,6 +52,9 @@
std::set<gamemap::location> brush_locations_;
std::string toolbar_hint_;
+
+ bool draw_coordinates_;
+ bool draw_terrain_codes_;
};
} //end namespace editor2
Modified: trunk/src/hotkeys.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/hotkeys.cpp?rev=29658&r1=29657&r2=29658&view=diff
==============================================================================
--- trunk/src/hotkeys.cpp (original)
+++ trunk/src/hotkeys.cpp Tue Sep 23 01:16:18 2008
@@ -186,11 +186,16 @@
{ hotkey::HOTKEY_EDITOR_REFRESH, "editor-refresh",
N_("Refresh Display"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_UPDATE_TRANSITIONS,
"editor-update-transitions",
- N_("Update Terrain Tranistions"), false, hotkey::SCOPE_EDITOR },
+ N_("Update Terrain Transitions"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS,
"editor-auto-update-transitions",
- N_("Auto-update Terrain Transitions"), false,
hotkey::SCOPE_EDITOR },
+ N_("Auto-update Terrain Transitions"), false,
hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_REFRESH_IMAGE_CACHE,
"editor-refresh-image-cache",
- N_("Refresh Image Cache"), false, hotkey::SCOPE_EDITOR },
+ N_("Refresh Image Cache"), false, hotkey::SCOPE_EDITOR },
+ { hotkey::HOTKEY_EDITOR_DRAW_COORDINATES, "editor-draw-coordinates",
+ N_("Draw Hex Coordinates"), false, hotkey::SCOPE_EDITOR },
+ { hotkey::HOTKEY_EDITOR_DRAW_TERRAIN_CODES,
"editor-draw-terrain-codes",
+ N_("Draw Terrain Codes"), false, hotkey::SCOPE_EDITOR },
+
#endif
Modified: trunk/src/hotkeys.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/hotkeys.hpp?rev=29658&r1=29657&r2=29658&view=diff
==============================================================================
--- trunk/src/hotkeys.hpp (original)
+++ trunk/src/hotkeys.hpp Tue Sep 23 01:16:18 2008
@@ -93,6 +93,7 @@
HOTKEY_EDITOR_REFRESH, HOTKEY_EDITOR_UPDATE_TRANSITIONS,
HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS,
HOTKEY_EDITOR_REFRESH_IMAGE_CACHE,
+ HOTKEY_EDITOR_DRAW_COORDINATES, HOTKEY_EDITOR_DRAW_TERRAIN_CODES,
#endif
//misc.
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits