Author: ilor
Date: Sun Mar 22 13:41:54 2009
New Revision: 34027

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34027&view=rev
Log:
Backport r34007: implement FR bug #13172 (output a WML-style list of selected 
tiles from the editor). Uses the system clipboard.

Modified:
    branches/1.6/changelog
    branches/1.6/data/themes/editor2.cfg
    branches/1.6/src/editor2/editor_controller.cpp
    branches/1.6/src/editor2/editor_controller.hpp
    branches/1.6/src/hotkeys.cpp
    branches/1.6/src/hotkeys.hpp

Modified: branches/1.6/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/changelog?rev=34027&r1=34026&r2=34027&view=diff
==============================================================================
--- branches/1.6/changelog (original)
+++ branches/1.6/changelog Sun Mar 22 13:41:54 2009
@@ -1,4 +1,6 @@
 Version 1.6+svn:
+ * Editor2:
+   * New feature: exporting of selection coordinates to system clipboard
  * Language and i18n:
    * updated translations: British English, Catalan, German, Finnish, Hebrew,
      Italian, Turkish

Modified: branches/1.6/data/themes/editor2.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/data/themes/editor2.cfg?rev=34027&r1=34026&r2=34027&view=diff
==============================================================================
--- branches/1.6/data/themes/editor2.cfg (original)
+++ branches/1.6/data/themes/editor2.cfg Sun Mar 22 13:41:54 2009
@@ -130,7 +130,7 @@
             id=menu-editor-edit
             title= _ "Edit"
             image=lite
-            items=undo,redo,editor-cut,editor-copy,editor-paste, 
editor-select-all,editor-select-inverse,editor-select-none, 
editor-selection-fill,editor-selection-rotate,editor-selection-flip, 
editor-selection-generate,editor-selection-randomize, 
editor-clipboard-rotate-cw,editor-clipboard-rotate-ccw, 
editor-clipboard-flip-horizontal,editor-clipboard-flip-vertical
+            
items=undo,redo,editor-cut,editor-copy,editor-paste,editor-export-selection-coords,editor-select-all,editor-select-inverse,editor-select-none,
 editor-selection-fill,editor-selection-rotate,editor-selection-flip, 
editor-selection-generate,editor-selection-randomize, 
editor-clipboard-rotate-cw,editor-clipboard-rotate-ccw, 
editor-clipboard-flip-horizontal,editor-clipboard-flip-vertical
             rect="+2,=,+100,="
             xanchor=fixed
             yanchor=fixed

Modified: branches/1.6/src/editor2/editor_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/src/editor2/editor_controller.cpp?rev=34027&r1=34026&r2=34027&view=diff
==============================================================================
--- branches/1.6/src/editor2/editor_controller.cpp (original)
+++ branches/1.6/src/editor2/editor_controller.cpp Sun Mar 22 13:41:54 2009
@@ -25,6 +25,7 @@
 #include "gui/dialogs/editor_settings.hpp"
 #include "gui/widgets/window.hpp"
 
+#include "../clipboard.hpp"
 #include "../config_adapter.hpp"
 #include "../filechooser.hpp"
 #include "../filesystem.hpp"
@@ -767,6 +768,7 @@
                        return true; //tool selection always possible
                case HOTKEY_EDITOR_CUT:
                case HOTKEY_EDITOR_COPY:
+               case HOTKEY_EDITOR_EXPORT_SELECTION_COORDS:
                case HOTKEY_EDITOR_SELECTION_FILL:
                case HOTKEY_EDITOR_SELECTION_RANDOMIZE:
                        return !get_map().selection().empty();
@@ -893,6 +895,9 @@
                case HOTKEY_EDITOR_CUT:
                        cut_selection();
                        return true;
+               case HOTKEY_EDITOR_EXPORT_SELECTION_COORDS:
+                       export_selection_coords();
+                       return true;
                case HOTKEY_EDITOR_SELECT_ALL:
                        if (!get_map().everything_selected()) {
                                perform_refresh(editor_action_select_all());
@@ -1068,6 +1073,24 @@
        perform_refresh(editor_action_paint_area(get_map().selection(), 
background_terrain_));
 }
 
+void editor_controller::export_selection_coords()
+{
+       std::stringstream ssx, ssy;
+       std::set<map_location>::const_iterator i = 
get_map().selection().begin();
+       if (i != get_map().selection().end()) {
+               ssx << "x = " << i->x + 1;
+               ssy << "y = " << i->y + 1;
+               ++i;
+               while (i != get_map().selection().end()) {
+                       ssx << ", " << i->x + 1;
+                       ssy << ", " << i->y + 1;
+                       ++i;
+               }
+               ssx << "\n" << ssy.str() << "\n";
+               copy_to_clipboard(ssx.str(), false);
+       }
+}
+
 void editor_controller::fill_selection()
 {
        perform_refresh(editor_action_paint_area(get_map().selection(), 
foreground_terrain_));

Modified: branches/1.6/src/editor2/editor_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/src/editor2/editor_controller.hpp?rev=34027&r1=34026&r2=34027&view=diff
==============================================================================
--- branches/1.6/src/editor2/editor_controller.hpp (original)
+++ branches/1.6/src/editor2/editor_controller.hpp Sun Mar 22 13:41:54 2009
@@ -211,6 +211,9 @@
 
                /** Cut the selection from the current map to the clipboard */
                void cut_selection();
+
+               /** Export the WML-compatible list of selected tiles to the 
system clipboard */
+               void export_selection_coords();
 
                /** Fill the selection with the foreground terrain */
                void fill_selection();

Modified: branches/1.6/src/hotkeys.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/src/hotkeys.cpp?rev=34027&r1=34026&r2=34027&view=diff
==============================================================================
--- branches/1.6/src/hotkeys.cpp (original)
+++ branches/1.6/src/hotkeys.cpp Sun Mar 22 13:41:54 2009
@@ -123,6 +123,7 @@
        { hotkey::HOTKEY_EDITOR_CUT, "editor-cut", N_("Cut"), false, 
hotkey::SCOPE_EDITOR },
        { hotkey::HOTKEY_EDITOR_COPY, "editor-copy", N_("Copy"), false, 
hotkey::SCOPE_EDITOR },
        { hotkey::HOTKEY_EDITOR_PASTE, "editor-paste", N_("Paste"), false, 
hotkey::SCOPE_EDITOR },
+       { hotkey::HOTKEY_EDITOR_EXPORT_SELECTION_COORDS, 
"editor-export-selection-coords", N_("Export selected coordinates to system 
clipboard"), false, hotkey::SCOPE_EDITOR },
        { hotkey::HOTKEY_EDITOR_SELECT_ALL, "editor-select-all",
                 N_("Select All"), false, hotkey::SCOPE_EDITOR },
        { hotkey::HOTKEY_EDITOR_SELECT_INVERSE, "editor-select-inverse",

Modified: branches/1.6/src/hotkeys.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/src/hotkeys.hpp?rev=34027&r1=34026&r2=34027&view=diff
==============================================================================
--- branches/1.6/src/hotkeys.hpp (original)
+++ branches/1.6/src/hotkeys.hpp Sun Mar 22 13:41:54 2009
@@ -73,6 +73,7 @@
        HOTKEY_EDITOR_TOOL_SELECT, HOTKEY_EDITOR_TOOL_STARTING_POSITION,
        HOTKEY_EDITOR_BRUSH_NEXT, HOTKEY_EDITOR_BRUSH_DEFAULT,
        HOTKEY_EDITOR_CUT, HOTKEY_EDITOR_COPY, HOTKEY_EDITOR_PASTE,
+       HOTKEY_EDITOR_EXPORT_SELECTION_COORDS,
        HOTKEY_EDITOR_SELECT_ALL, HOTKEY_EDITOR_SELECT_INVERSE,
        HOTKEY_EDITOR_SELECT_NONE,
        HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW, HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW,


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to