wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth data/themes/editor.cfg po/wesnoth-edito...


From: Bram Ridder
Subject: [Wesnoth-cvs-commits] wesnoth data/themes/editor.cfg po/wesnoth-edito...
Date: Tue, 05 Jul 2005 06:14:50 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Bram Ridder <address@hidden>    05/07/05 10:14:50

Modified files:
        data/themes    : editor.cfg 
        po/wesnoth-editor: en_GB.po 
        src/editor     : editor_layout.cpp editor_layout.hpp 
                         editor_palettes.cpp 

Log message:
        Fixes bug #11965 and makes the pallette 3-wide in stead of 2-wide (see 
also patc
        h #4144)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/themes/editor.cfg.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/po/wesnoth-editor/en_GB.po.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_layout.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_layout.hpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_palettes.cpp.diff?tr1=1.29&tr2=1.30&r1=text&r2=text

Patches:
Index: wesnoth/data/themes/editor.cfg
diff -u wesnoth/data/themes/editor.cfg:1.27 wesnoth/data/themes/editor.cfg:1.28
--- wesnoth/data/themes/editor.cfg:1.27 Sun Mar 27 23:06:16 2005
+++ wesnoth/data/themes/editor.cfg      Tue Jul  5 10:14:50 2005
@@ -240,36 +240,36 @@
        # The toolbar.
        [menu]
        title=_"Draw"
-       image=lite_small
+       image=button
        items=editdraw
-       rect=900,250,955,271
+       rect=900,230,1007,253
        xanchor=right
        yanchor=fixed
        [/menu]
 
        [menu]
        title=_"Flood"
-       image=lite_small
+       image=button
        items=editfloodfill
-       rect=960,250,1015,271
+       rect=900,255,1007,278
        xanchor=right
        yanchor=fixed
        [/menu]
 
        [menu]
        title=_"Start P"
-       image=lite_small
+       image=button
        items=editsetstartpos
-       rect=900,275,955,296
+       rect=900,280,1007,303
        xanchor=right
        yanchor=fixed
        [/menu]
 
        [menu]
        title=_"Paste"
-       image=lite_small
+       image=button
        items=editpaste
-       rect=960,275,1015,296
+       rect=900,305,1007,328
        xanchor=right
        yanchor=fixed
        [/menu]
@@ -326,14 +326,15 @@
 
                [edit_left_button_function]
                font_size=12
-               rect=900,300,1024,320
+               rect=900,330,1024,345
                xanchor=right
                yanchor=fixed
                [/edit_left_button_function]
 
                [selected_terrain]
                font_size=12
-               rect=900,730,1024,20
+               #rect=900,730,1024,20
+               rect=880,730,1024,40
                xanchor=right
                yanchor=bottom
                [/selected_terrain]
Index: wesnoth/po/wesnoth-editor/en_GB.po
diff -u wesnoth/po/wesnoth-editor/en_GB.po:1.18 
wesnoth/po/wesnoth-editor/en_GB.po:1.19
--- wesnoth/po/wesnoth-editor/en_GB.po:1.18     Mon May 30 09:21:20 2005
+++ wesnoth/po/wesnoth-editor/en_GB.po  Tue Jul  5 10:14:50 2005
@@ -29,7 +29,7 @@
 
 #: data/themes/editor.cfg:260
 msgid "Start P"
-msgstr "Start P"
+msgstr "Start Position"
 
 #: data/themes/editor.cfg:269
 msgid "Paste"
Index: wesnoth/src/editor/editor_layout.cpp
diff -u wesnoth/src/editor/editor_layout.cpp:1.6 
wesnoth/src/editor/editor_layout.cpp:1.7
--- wesnoth/src/editor/editor_layout.cpp:1.6    Sat Jul  2 21:37:19 2005
+++ wesnoth/src/editor/editor_layout.cpp        Tue Jul  5 10:14:50 2005
@@ -17,6 +17,7 @@
 
 namespace {
        const size_t default_terrain_size = 35;
+       const size_t default_palette_width = 3;
 }
 namespace map_editor {
 
@@ -24,6 +25,7 @@
        terrain_size = default_terrain_size;
        terrain_padding = 2;
        terrain_space = terrain_size + terrain_padding;
+       terrain_width = default_palette_width;
        brush_x = 0;
        brush_y = 0;
        palette_x = 0;
@@ -35,9 +37,9 @@
 void adjust_sizes(const display &disp, size_specs &sizes) {
        sizes.brush_x = disp.mapx() + 33;
        sizes.brush_y = 190;
-       sizes.palette_x = disp.mapx() + 40;
+       sizes.palette_x = disp.mapx() + 15;
        sizes.palette_y = sizes.brush_y + 160 + 10;
-       sizes.palette_w = sizes.terrain_space * 2;
+       sizes.palette_w = sizes.terrain_space * default_palette_width;
        sizes.palette_h = disp.y() - sizes.palette_y - 60;
 }
 
Index: wesnoth/src/editor/editor_layout.hpp
diff -u wesnoth/src/editor/editor_layout.hpp:1.5 
wesnoth/src/editor/editor_layout.hpp:1.6
--- wesnoth/src/editor/editor_layout.hpp:1.5    Sat Jul  2 21:37:19 2005
+++ wesnoth/src/editor/editor_layout.hpp        Tue Jul  5 10:14:50 2005
@@ -26,6 +26,7 @@
        size_t terrain_size;
        size_t terrain_padding;
        size_t terrain_space;
+       size_t terrain_width;
        size_t palette_x;
        size_t palette_y;
        size_t palette_h;
Index: wesnoth/src/editor/editor_palettes.cpp
diff -u wesnoth/src/editor/editor_palettes.cpp:1.29 
wesnoth/src/editor/editor_palettes.cpp:1.30
--- wesnoth/src/editor/editor_palettes.cpp:1.29 Sat Jul  2 21:37:19 2005
+++ wesnoth/src/editor/editor_palettes.cpp      Tue Jul  5 10:14:50 2005
@@ -23,8 +23,6 @@
 #include "../video.hpp"
 #include "../wassert.hpp"
 
-
-
 namespace map_editor {
 
 bool is_invalid_terrain(char c) {
@@ -51,25 +49,25 @@
 }
 
 void terrain_palette::adjust_size() {
+       
        scroll_top();
        const size_t button_height = 24;
        const size_t button_palette_padding = 8;
+       
        SDL_Rect rect = { size_specs_.palette_x, size_specs_.palette_y, 
size_specs_.palette_w, size_specs_.palette_h };
        set_location(rect);
        top_button_y_ = size_specs_.palette_y;
        button_x_ = size_specs_.palette_x + size_specs_.palette_w/2 - 
button_height/2;
        terrain_start_ = top_button_y_ + button_height + button_palette_padding;
-       const size_t space_for_terrains = size_specs_.palette_h -
-               (button_height + button_palette_padding) * 2;
+       const size_t space_for_terrains = size_specs_.palette_h - 
(button_height + button_palette_padding) * 2;
        rect.y = terrain_start_;
        rect.h = space_for_terrains;
        bg_register(rect);
-       const unsigned terrains_fitting =
-               (unsigned)(space_for_terrains / size_specs_.terrain_space) * 2;
+       const unsigned terrains_fitting = (unsigned)(space_for_terrains / 
size_specs_.terrain_space) * size_specs_.terrain_width;
        const unsigned total_terrains = num_terrains();
        nterrains_ = minimum<int>(terrains_fitting, total_terrains);
-       bot_button_y_ = size_specs_.palette_y + (nterrains_ / 2) * 
size_specs_.terrain_space +
-               button_palette_padding * 2 + button_height;
+       bot_button_y_ = size_specs_.palette_y + (nterrains_ / 
size_specs_.terrain_width) * size_specs_.terrain_space + \
+               button_palette_padding * size_specs_.terrain_width + 
button_height;
        top_button_.set_location(button_x_, top_button_y_);
        bot_button_.set_location(button_x_, bot_button_y_);
        top_button_.set_dirty();
@@ -86,23 +84,22 @@
 }
 
 void terrain_palette::scroll_down() {
-       if(tstart_ + nterrains_ + 2 <= num_terrains()) {
-               tstart_ += 2;
+       if(tstart_ + nterrains_ + size_specs_.terrain_width <= num_terrains()) {
+               tstart_ += size_specs_.terrain_width;
                bg_restore();
                set_dirty();
        }
-       else if (tstart_ + nterrains_ + 1 <= num_terrains()) {
-               tstart_ += 1;
+       else if (tstart_ + nterrains_ + (num_terrains() % 
size_specs_.terrain_width) <= num_terrains()) {
+               tstart_ += num_terrains() % size_specs_.terrain_width;
                bg_restore();
                set_dirty();
        }
 }
 
 void terrain_palette::scroll_up() {
-       unsigned int decrement = 2;
-       if (tstart_ + nterrains_ == num_terrains()
-               && num_terrains() % 2 != 0) {
-               decrement = 1;
+       unsigned int decrement = size_specs_.terrain_width;
+       if (tstart_ + nterrains_ == num_terrains() && num_terrains() % 
size_specs_.terrain_width != 0) {
+               decrement = num_terrains() % size_specs_.terrain_width;
        }
        if(tstart_ >= decrement) {
                bg_restore();
@@ -235,6 +232,7 @@
 }
 
 void terrain_palette::draw(bool force) {
+       
        if (top_button_.pressed()) {
                scroll_up();
        }
@@ -254,22 +252,20 @@
        int y = terrain_start_;
        for(unsigned int counter = starting; counter < ending; counter++){
                const gamemap::TERRAIN terrain = terrains_[counter];
-               const std::string filename = "terrain/" +
-                       map_.get_terrain_info(terrain).symbol_image() + ".png";
+               const std::string filename = "terrain/" + 
map_.get_terrain_info(terrain).symbol_image() + ".png";
                surface image(image::get_image(filename, image::UNSCALED));
                if(image == NULL) {
                        std::cerr << "image for terrain " << counter << ": '" 
<< filename << "' not found\n";
                        return;
                }
 
-               if((unsigned)image->w != size_specs_.terrain_size
-                  || (unsigned)image->h != size_specs_.terrain_size) {
-                       image.assign(scale_surface(image, 
size_specs_.terrain_size,
-                                                                          
size_specs_.terrain_size));
+               if((unsigned)image->w != size_specs_.terrain_size || 
(unsigned)image->h != size_specs_.terrain_size) {
+                       image.assign(scale_surface(image, 
size_specs_.terrain_size, size_specs_.terrain_size));
                }
+               
                const int counter_from_zero = counter - starting;
                SDL_Rect dstrect;
-               dstrect.x = loc.x + (counter_from_zero % 2 != 0 ? 
size_specs_.terrain_space : 0);
+               dstrect.x = loc.x + (counter_from_zero % 
size_specs_.terrain_width) * size_specs_.terrain_space;
                dstrect.y = y;
                dstrect.w = image->w;
                dstrect.h = image->h;
@@ -290,7 +286,7 @@
                        color = SDL_MapRGB(screen->format,0x00,0x00,0x00);
                }
                draw_rectangle(dstrect.x, dstrect.y, image->w, image->h, color, 
screen);
-               if (counter_from_zero % 2 != 0)
+               if (counter_from_zero % size_specs_.terrain_width == 
size_specs_.terrain_width - 1)
                        y += size_specs_.terrain_space;
        }
        update_rect(loc);
@@ -299,9 +295,8 @@
 
 int terrain_palette::tile_selected(const int x, const int y) const {
        for(unsigned int i = 0; i != nterrains_; i++) {
-               const int px = size_specs_.palette_x +
-                       (i % 2 != 0 ? size_specs_.terrain_space : 0);
-               const int py = terrain_start_ + (i / 2) * 
size_specs_.terrain_space;
+               const int px = size_specs_.palette_x + (i % 
size_specs_.terrain_width) * size_specs_.terrain_space;
+               const int py = terrain_start_ + (i / size_specs_.terrain_width) 
* size_specs_.terrain_space;
                const int pw = size_specs_.terrain_space;
                const int ph = size_specs_.terrain_space;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]