Author: ilor
Date: Fri Jul 25 20:32:19 2008
New Revision: 28196

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28196&view=rev
Log:
make editor2 use the old editor's palette, only display the palette for now. 
crashes in some circumstances, needs fixing.

Added:
    trunk/src/editor2/editor_layout.cpp
      - copied, changed from r28192, trunk/src/editor/editor_layout.cpp
    trunk/src/editor2/editor_layout.hpp
      - copied, changed from r28192, trunk/src/editor/editor_layout.hpp
    trunk/src/editor2/editor_palettes.cpp
      - copied, changed from r28192, trunk/src/editor/editor_palettes.cpp
    trunk/src/editor2/editor_palettes.hpp
      - copied, changed from r28192, trunk/src/editor/editor_palettes.hpp
Modified:
    trunk/src/CMakeLists.txt
    trunk/src/Makefile.am
    trunk/src/SConscript
    trunk/src/editor2/editor_controller.cpp
    trunk/src/editor2/editor_controller.hpp
    trunk/src/editor2/editor_mode.hpp

Modified: trunk/src/CMakeLists.txt
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/CMakeLists.txt?rev=28196&r1=28195&r2=28196&view=diff
==============================================================================
--- trunk/src/CMakeLists.txt (original)
+++ trunk/src/CMakeLists.txt Fri Jul 25 20:32:19 2008
@@ -310,8 +310,10 @@
     editor2/editor_main.cpp
     editor2/editor_controller.cpp
     editor2/editor_display.cpp
+    editor2/editor_layout.cpp
     editor2/editor_map.cpp
     editor2/editor_mode.cpp
+    editor2/editor_palettes.cpp
     editor2/map_fragment.cpp
     editor2/mouse_action.cpp
 )

Modified: trunk/src/Makefile.am
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/Makefile.am?rev=28196&r1=28195&r2=28196&view=diff
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Fri Jul 25 20:32:19 2008
@@ -155,8 +155,10 @@
        editor2/editor_main.cpp \
        editor2/editor_controller.cpp \
        editor2/editor_display.cpp \
+       editor2/editor_layout.cpp \
        editor2/editor_map.cpp \
        editor2/editor_mode.cpp \
+       editor2/editor_palettes.cpp \
        editor2/map_fragment.cpp \
        editor2/mouse_action.cpp
 

Modified: trunk/src/SConscript
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/SConscript?rev=28196&r1=28195&r2=28196&view=diff
==============================================================================
--- trunk/src/SConscript (original)
+++ trunk/src/SConscript Fri Jul 25 20:32:19 2008
@@ -247,8 +247,10 @@
     editor2/editor_main.cpp
     editor2/editor_controller.cpp
     editor2/editor_display.cpp
+    editor2/editor_layout.cpp
     editor2/editor_map.cpp
     editor2/editor_mode.cpp
+    editor2/editor_palettes.cpp
     editor2/map_fragment.cpp
     editor2/mouse_action.cpp
     """)

Modified: trunk/src/editor2/editor_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.cpp?rev=28196&r1=28195&r2=28196&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.cpp (original)
+++ trunk/src/editor2/editor_controller.cpp Fri Jul 25 20:32:19 2008
@@ -13,7 +13,9 @@
 
 #include "editor_controller.hpp"
 #include "editor_display.hpp"
+#include "editor_layout.hpp"
 #include "editor_map.hpp"
+#include "editor_palettes.hpp"
 #include "mouse_action.hpp"
 
 #include "gui/dialogs/editor_new_map.hpp"
@@ -43,7 +45,11 @@
 , current_brush_index_(0)
 {
        init(video);
-       cursor::set(cursor::NORMAL);
+       size_specs_ = new size_specs();
+       adjust_sizes(gui(), *size_specs_);
+       palette_ = new terrain_palette(gui(), *size_specs_, map_, game_config);
+//             foreground_terrain(), background_terrain());
+       //brush_bar_ = new brush_bar(gui(), *size_specs_);
        
        brushes_.push_back(brush());
        brushes_[0].add_relative_location(0, 0);
@@ -60,8 +66,9 @@
        mouse_actions_.insert(std::make_pair(hotkey::HOTKEY_EDITOR_TOOL_FILL, 
new mouse_action_fill(*this)));
        hotkey_set_mouse_action(hotkey::HOTKEY_EDITOR_TOOL_PAINT);      
        
+       cursor::set(cursor::NORMAL);
        gui_->invalidate_game_status();
-       gui_->invalidate_all();
+       refresh_all();
        gui_->draw();
        events::raise_draw_event();     
 }
@@ -436,6 +443,11 @@
 
 void editor_controller::refresh_all()
 {
+       adjust_sizes(gui(), *size_specs_);
+       palette_->adjust_size();
+       //brush_bar_->adjust_size();
+       palette_->draw(true);
+       //brush_bar_->draw(true);
        gui().rebuild_all();
        gui().invalidate_all();
        gui().recalculate_minimap();

Modified: trunk/src/editor2/editor_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.hpp?rev=28196&r1=28195&r2=28196&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.hpp (original)
+++ trunk/src/editor2/editor_controller.hpp Fri Jul 25 20:32:19 2008
@@ -22,7 +22,6 @@
 #include "editor_main.hpp"
 #include "editor_mode.hpp"
 
-#include "../config.hpp"
 #include "../controller_base.hpp"
 #include "../events.hpp"
 #include "../hotkeys.hpp"
@@ -33,7 +32,13 @@
 #include <deque>
 #include <boost/utility.hpp>
 
+class config;
+
 namespace editor2 {
+
+class brush_bar;
+class size_specs;
+class terrain_palette;
 
 class editor_controller : public controller_base, 
        public editor_mode, public events::mouse_handler_base,
@@ -99,8 +104,12 @@
                
                std::string filename_;
                
-               /** The display object used and owned by the editor. Possibly 
recreated when a new map is created */
+               /** The display object used and owned by the editor. */
                editor_display* gui_;
+               
+               size_specs* size_specs_;
+               terrain_palette* palette_;
+               brush_bar* brush_bar_;
                
                preferences::display_manager* prefs_disp_manager_;
                

Copied: trunk/src/editor2/editor_layout.cpp (from r28192, 
trunk/src/editor/editor_layout.cpp)
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_layout.cpp?p2=trunk/src/editor2/editor_layout.cpp&p1=trunk/src/editor/editor_layout.cpp&r1=28192&r2=28196&rev=28196&view=diff
==============================================================================
--- trunk/src/editor/editor_layout.cpp (original)
+++ trunk/src/editor2/editor_layout.cpp Fri Jul 25 20:32:19 2008
@@ -24,7 +24,7 @@
        const size_t default_palette_width = 3;
 }
 
-namespace map_editor {
+namespace editor2 {
 
 size_specs::size_specs() {
        terrain_size = default_terrain_size;
@@ -53,5 +53,5 @@
        sizes.palette_h = disp.h() - sizes.palette_y - 5;
 }
 
-} // end namespace map_editor
+} // end namespace editor2
 

Copied: trunk/src/editor2/editor_layout.hpp (from r28192, 
trunk/src/editor/editor_layout.hpp)
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_layout.hpp?p2=trunk/src/editor2/editor_layout.hpp&p1=trunk/src/editor/editor_layout.hpp&r1=28192&r2=28196&rev=28196&view=diff
==============================================================================
--- trunk/src/editor/editor_layout.hpp (original)
+++ trunk/src/editor2/editor_layout.hpp Fri Jul 25 20:32:19 2008
@@ -22,7 +22,7 @@
 
 #include "display.hpp"
 
-namespace map_editor {
+namespace editor2 {
 
 //! Size specifications for the map editor.
 struct size_specs {

Modified: trunk/src/editor2/editor_mode.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_mode.hpp?rev=28196&r1=28195&r2=28196&view=diff
==============================================================================
--- trunk/src/editor2/editor_mode.hpp (original)
+++ trunk/src/editor2/editor_mode.hpp Fri Jul 25 20:32:19 2008
@@ -40,6 +40,8 @@
 protected:
        void set_foreground_terrain(t_translation::t_terrain t) { 
foreground_terrain_ = t; }
        void set_background_terrain(t_translation::t_terrain t) { 
background_terrain_ = t; }
+       t_translation::t_terrain& foreground_terrain() { return 
foreground_terrain_; }
+       t_translation::t_terrain& background_terrain() { return 
background_terrain_; }
        void set_brush(brush* brush) { brush_ = brush; }
        void set_mouse_action(mouse_action* action) { mouse_action_ = action; }
        

Copied: trunk/src/editor2/editor_palettes.cpp (from r28192, 
trunk/src/editor/editor_palettes.cpp)
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_palettes.cpp?p2=trunk/src/editor2/editor_palettes.cpp&p1=trunk/src/editor/editor_palettes.cpp&r1=28192&r2=28196&rev=28196&view=diff
==============================================================================
--- trunk/src/editor/editor_palettes.cpp (original)
+++ trunk/src/editor2/editor_palettes.cpp Fri Jul 25 20:32:19 2008
@@ -32,7 +32,7 @@
 
 #include <cassert>
 
-namespace map_editor {
+namespace editor2 {
 
 static bool is_invalid_terrain(t_translation::t_terrain c) {
        return (c == t_translation::VOID_TERRAIN || c == t_translation::FOGGED);
@@ -608,5 +608,5 @@
        return -1;
 }
 
-} // end namespace map_editor
-
+} // end namespace editor2
+

Copied: trunk/src/editor2/editor_palettes.hpp (from r28192, 
trunk/src/editor/editor_palettes.hpp)
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_palettes.hpp?p2=trunk/src/editor2/editor_palettes.hpp&p1=trunk/src/editor/editor_palettes.hpp&r1=28192&r2=28196&rev=28196&view=diff
==============================================================================
--- trunk/src/editor/editor_palettes.hpp (original)
+++ trunk/src/editor2/editor_palettes.hpp Fri Jul 25 20:32:19 2008
@@ -32,7 +32,7 @@
 
 class config;
 
-namespace map_editor {
+namespace editor2 {
 
 //! Stores the info about the data in editor-groups.cfg in a nice format.
 // Helper struct which for some reason can't be moved to the cpp file. 


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

Reply via email to