Author: mordante
Date: Sun May 27 11:54:30 2007
New Revision: 17899

URL: http://svn.gna.org/viewcvs/wesnoth?rev=17899&view=rev
Log:
renamed to following functions
display::x() => display::w()
display::y() => display::h()
display::mapx() => display::map_w()
Also did some small cleanups. 
map_w() is buggy (uses 140 hardcoded instead of theme valie) and might get 
removed.

Modified:
    trunk/src/about.cpp
    trunk/src/display.cpp
    trunk/src/display.hpp
    trunk/src/editor/editor.cpp
    trunk/src/editor/editor_dialogs.cpp
    trunk/src/editor/editor_layout.cpp
    trunk/src/filechooser.cpp
    trunk/src/play_controller.cpp
    trunk/src/preferences_display.cpp
    trunk/src/show_dialog.cpp
    trunk/src/titlescreen.cpp

Modified: trunk/src/about.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/about.cpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/about.cpp (original)
+++ trunk/src/about.cpp Sun May 27 11:54:30 2007
@@ -153,10 +153,10 @@
        }else{
                image_list=utils::split(images_default,',',utils::STRIP_SPACES);
        }
-       surface 
map_image(scale_surface(image::get_image(image_list[0],image::UNSCALED), 
disp.x(), disp.y()));
+       surface 
map_image(scale_surface(image::get_image(image_list[0],image::UNSCALED), 
disp.w(), disp.h()));
        if(! map_image){
                image_list[0]=game_config::game_title;
-               
map_image=surface(scale_surface(image::get_image(image_list[0],image::UNSCALED),
 disp.x(), disp.y()));
+               
map_image=surface(scale_surface(image::get_image(image_list[0],image::UNSCALED),
 disp.w(), disp.h()));
        }
 
        SDL_Rect map_rect;
@@ -215,7 +215,7 @@
                // check to see if background image has changed
                if(text.size() && (image_count < 
((startline*(int)image_list.size())/(int)text.size()))){
                        image_count++;
-                       surface 
temp=surface(scale_surface(image::get_image(image_list[image_count],image::UNSCALED),
 disp.x(), disp.y()));
+                       surface 
temp=surface(scale_surface(image::get_image(image_list[image_count],image::UNSCALED),
 disp.w(), disp.h()));
                        map_image=temp?temp:map_image;
                }
                // draw map to screen, thus erasing all text

Modified: trunk/src/display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Sun May 27 11:54:30 2007
@@ -198,12 +198,6 @@
 {
        const time_of_day& tod = status_.get_time_of_day();
        image::set_colour_adjustment(tod.red+r,tod.green+g,tod.blue+b);
-}
-
-SDL_Rect display::screen_area() const
-{
-       const SDL_Rect res = {0,0,x(),y()};
-       return res;
 }
 
 bool display::outside_area(const SDL_Rect& area, const int x, const int y) 
const
@@ -2494,7 +2488,7 @@
                        msg = message;
                        action = false;
                }
-               msg = font::word_wrap_text(msg,font::SIZE_SMALL,mapx()*3/4);
+               msg = font::word_wrap_text(msg,font::SIZE_SMALL,map_w()*3/4);
 
                int ypos = chat_message_x;
                for(std::vector<chat_message>::const_iterator m = 
chat_messages_.begin(); m != chat_messages_.end(); ++m) {

Modified: trunk/src/display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Sun May 27 11:54:30 2007
@@ -125,9 +125,9 @@
        //the dimensions of the display. x and y are width/height. mapx is the
        //width of the portion of the display which shows the game area. Between
        //mapx and x is the sidebar region.
-       int x() const { return screen_.getx(); }
-       int mapx() const { return x() - 140; }
-       int y() const { return screen_.gety(); }
+       int w() const { return screen_.getx(); }
+       int map_w() const { return w() - 140; }
+       int h() const { return screen_.gety(); }
 
        const SDL_Rect& map_area() const 
                { return theme_.main_map_location(screen_area()); }
@@ -136,7 +136,9 @@
        const SDL_Rect& unit_image_area() const 
                { return theme_.unit_image_location(screen_area()); }
 
-       SDL_Rect screen_area() const;
+       SDL_Rect screen_area() const
+               { const SDL_Rect res = {0,0,w(),h()}; return res; }
+
 
        //check if pixel x,y is outside specified area
        bool outside_area(const SDL_Rect& area, const int x, const int y) const;

Modified: trunk/src/editor/editor.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor.cpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/editor/editor.cpp (original)
+++ trunk/src/editor/editor.cpp Sun May 27 11:54:30 2007
@@ -228,8 +228,7 @@
        for (it = menus.begin(); it != menus.end(); it++) {
 
                // Get the button's screen location
-               SDL_Rect screen;
-               screen.x = 0; screen.y = 0; screen.w = gui_.x(); screen.h = 
gui_.y();
+               SDL_Rect screen = gui_.screen_area();
 
                const SDL_Rect tooltip_rect = (*it).location(screen);
                std::string text = "";
@@ -1523,13 +1522,13 @@
                if(key_[SDLK_UP] || mousey == 0) {
                        gui_.scroll(0,-scroll_speed);
                }
-               if(key_[SDLK_DOWN] || mousey == gui_.y()-1) {
+               if(key_[SDLK_DOWN] || mousey == gui_.h()-1) {
                        gui_.scroll(0,scroll_speed);
                }
                if(key_[SDLK_LEFT] || mousex == 0) {
                        gui_.scroll(-scroll_speed,0);
                }
-               if(key_[SDLK_RIGHT] || mousex == gui_.x()-1) {
+               if(key_[SDLK_RIGHT] || mousex == gui_.w()-1) {
                        gui_.scroll(scroll_speed,0);
                }
 

Modified: trunk/src/editor/editor_dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor_dialogs.cpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/editor/editor_dialogs.cpp (original)
+++ trunk/src/editor/editor_dialogs.cpp Sun May 27 11:54:30 2007
@@ -63,8 +63,8 @@
        int map_width(40), map_height(40);
        const int width = 600;
        const int height = 400;
-       const int xpos = disp.x()/2 - width/2;
-       const int ypos = disp.y()/2 - height/2;
+       const int xpos = disp.w()/2 - width/2;
+       const int ypos = disp.h()/2 - height/2;
        const int horz_margin = 5;
        const int vertical_margin = 20;
 
@@ -233,10 +233,10 @@
 
        const int width = 600;
        const int height = 200;
-       const int xpos = disp.x()/2 - width/2;
-       const int ypos = disp.y()/2 - height/2;
-
-       SDL_Rect clip_rect = {0,0,disp.x(),disp.y()};
+       const int xpos = disp.w()/2 - width/2;
+       const int ypos = disp.h()/2 - height/2;
+
+       SDL_Rect clip_rect = disp.screen_area();
 
        gui::button close_button(disp.video(),_("Close Window"));
 
@@ -417,8 +417,8 @@
        int map_width(curr_w), map_height(curr_h);
        const int width = 600;
        const int height = 200;
-       const int xpos = disp.x()/2 - width/2;
-       const int ypos = disp.y()/2 - height/2;
+       const int xpos = disp.w()/2 - width/2;
+       const int ypos = disp.h()/2 - height/2;
        const int horz_margin = 5;
        const int vertical_margin = 20;
        const int button_padding = 20;

Modified: trunk/src/editor/editor_layout.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor_layout.cpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/editor/editor_layout.cpp (original)
+++ trunk/src/editor/editor_layout.cpp Sun May 27 11:54:30 2007
@@ -35,12 +35,12 @@
 }
 
 void adjust_sizes(const display &disp, size_specs &sizes) {
-       sizes.brush_x = disp.mapx() + 23;
+       sizes.brush_x = disp.map_w() + 23;
        sizes.brush_y = 190;
-       sizes.palette_x = disp.mapx() + 13;
+       sizes.palette_x = disp.map_w() + 13;
        sizes.palette_y = sizes.brush_y + 160 + 10;
        sizes.palette_w = sizes.terrain_space * default_palette_width;
-       sizes.palette_h = disp.y() - sizes.palette_y - 60;
+       sizes.palette_h = disp.h() - sizes.palette_y - 60;
 }
 
 }

Modified: trunk/src/filechooser.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/filechooser.cpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/filechooser.cpp (original)
+++ trunk/src/filechooser.cpp Sun May 27 11:54:30 2007
@@ -42,8 +42,8 @@
 : gui::dialog(disp, title, file_path, gui::OK_CANCEL), files_list_(NULL), 
last_selection_(0)
 {
        files_list_ = new gui::file_menu(disp.video(), file_path);
-       const unsigned file_list_height = (disp.y() / 2);
-       const unsigned file_list_width = 
minimum<unsigned>(files_list_->width(), (disp.x() / 4));
+       const unsigned file_list_height = (disp.h() / 2);
+       const unsigned file_list_width = 
minimum<unsigned>(files_list_->width(), (disp.w() / 4));
        files_list_->set_measurements(file_list_width, file_list_height);
        files_list_->set_max_height(file_list_height);
        set_menu(files_list_);

Modified: trunk/src/play_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.cpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/play_controller.cpp (original)
+++ trunk/src/play_controller.cpp Sun May 27 11:54:30 2007
@@ -691,7 +691,7 @@
                scrolling_ = true;
        }
 
-       if((key[SDLK_DOWN] && !menu_handler_.get_textbox().active()) || mousey 
> gui_->y()-scroll_threshold) {
+       if((key[SDLK_DOWN] && !menu_handler_.get_textbox().active()) || mousey 
> gui_->h()-scroll_threshold) {
                gui_->scroll(0,preferences::scroll_speed());
                scrolling_ = true;
        }
@@ -701,7 +701,7 @@
                scrolling_ = true;
        }
 
-       if((key[SDLK_RIGHT] && !menu_handler_.get_textbox().active()) || mousex 
> gui_->x()-scroll_threshold) {
+       if((key[SDLK_RIGHT] && !menu_handler_.get_textbox().active()) || mousex 
> gui_->w()-scroll_threshold) {
                gui_->scroll(preferences::scroll_speed(),0);
                scrolling_ = true;
        }

Modified: trunk/src/preferences_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/preferences_display.cpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/preferences_display.cpp (original)
+++ trunk/src/preferences_display.cpp Sun May 27 11:54:30 2007
@@ -1257,8 +1257,8 @@
 
        const events::event_context dialog_events_context;
 
-       const int centerx = disp.x()/2;
-       const int centery = disp.y()/2;
+       const int centerx = disp.w()/2;
+       const int centery = disp.h()/2;
 #ifdef USE_TINY_GUI
        const int width = 300;                    // FIXME: should compute 
this, but using what data ?
        const int height = 220;
@@ -1276,7 +1276,7 @@
        surface_restorer restorer;
        gui::draw_dialog(xpos,ypos,width,height,disp.video(),_("Hotkey 
Settings"),NULL,&buttons,&restorer);
 
-       SDL_Rect clip_rect = { 0, 0, disp.x (), disp.y () };
+       SDL_Rect clip_rect = { 0, 0, disp.w (), disp.h () };
        SDL_Rect text_size = font::draw_text(NULL, clip_rect, font::SIZE_PLUS,
                                             font::NORMAL_COLOUR,_("Press 
desired Hotkey"),
                                             0, 0);

Modified: trunk/src/show_dialog.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/show_dialog.cpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/show_dialog.cpp (original)
+++ trunk/src/show_dialog.cpp Sun May 27 11:54:30 2007
@@ -383,8 +383,8 @@
        const size_t height = 80;
        const size_t border = 20;
 #endif
-       const int left = disp.x()/2 - width/2;
-       const int top = disp.y()/2 - height/2;
+       const int left = disp.w()/2 - width/2;
+       const int top = disp.h()/2 - height/2;
 
        const events::event_context dialog_events_context;
 
@@ -478,8 +478,8 @@
        const size_t width = 250;
        const size_t height = 20;
 #endif
-       const int left = disp.x()/2 - width/2;
-       const int top = disp.y()/2 - height/2;
+       const int left = disp.w()/2 - width/2;
+       const int top = disp.h()/2 - height/2;
 
        const events::event_context dialog_events_context;
 

Modified: trunk/src/titlescreen.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/titlescreen.cpp?rev=17899&r1=17898&r2=17899&view=diff
==============================================================================
--- trunk/src/titlescreen.cpp (original)
+++ trunk/src/titlescreen.cpp Sun May 27 11:54:30 2007
@@ -160,11 +160,11 @@
     std::string tip_of_day = get_tip_of_day(tips_of_day,ntip);
     if(tip_of_day.empty() == false) {
         tip_of_day = font::word_wrap_text(tip_of_day,font::SIZE_NORMAL,
-                                          
(game_config::title_tip_width*screen.x())/1024);
+                                          
(game_config::title_tip_width*screen.w())/1024);
 
         const std::string& tome = font::word_wrap_text(_("-- The Tome of 
Wesnoth"),
                 font::SIZE_NORMAL,
-                (game_config::title_tip_width*screen.x())/1024);
+                (game_config::title_tip_width*screen.w())/1024);
 
         const int pad = game_config::title_tip_padding;
 
@@ -173,7 +173,7 @@
         area.w = maximum<size_t>(area.w,tome_area.w) + 2*pad;
         area.h += tome_area.h + next_tip_button->location().h + 3*pad;
 
-        area.x = main_dialog_area->x - 
(game_config::title_tip_x*screen.x())/1024 - area.w;
+        area.x = main_dialog_area->x - 
(game_config::title_tip_x*screen.w())/1024 - area.w;
         area.y = main_dialog_area->y + main_dialog_area->h - area.h;
 
         // Note: The buttons' locations need to be set before the dialog frame 
is drawn.
@@ -216,10 +216,10 @@
        // Display Wesnoth logo
        surface const title_surface(scale_surface(
                image::get_image(game_config::game_title,image::UNSCALED),
-               screen.x(), screen.y()));
+               screen.w(), screen.h()));
        screen.video().modeChanged(); // resets modeChanged value
-       int logo_x = game_config::title_logo_x * screen.x() / 1024,
-           logo_y = game_config::title_logo_y * screen.y() / 768;
+       int logo_x = game_config::title_logo_x * screen.w() / 1024,
+           logo_y = game_config::title_logo_y * screen.h() / 768;
        do {
                if (title_surface.null()) {
                        ERR_DP << "Could not find title image\n";
@@ -241,9 +241,9 @@
        const SDL_Rect version_area = font::draw_text(NULL,screen_area(),
                                                      font::SIZE_TINY,
                                            
font::NORMAL_COLOUR,version_str,0,0);
-       const size_t versiony = screen.y() - version_area.h;
-
-       if(versiony < size_t(screen.y())) {
+       const size_t versiony = screen.h() - version_area.h;
+
+       if(versiony < size_t(screen.h())) {
                font::draw_text(&screen.video(),screen.screen_area(),
                                font::SIZE_TINY,
                                font::NORMAL_COLOUR,version_str,0,versiony);
@@ -273,14 +273,14 @@
 
        static const size_t nbuttons = 
sizeof(button_labels)/sizeof(*button_labels);
 
-       const int menu_xbase = (game_config::title_buttons_x*screen.x())/1024;
+       const int menu_xbase = (game_config::title_buttons_x*screen.w())/1024;
        const int menu_xincr = 0;
 
 #ifdef USE_TINY_GUI
-       const int menu_ybase = (game_config::title_buttons_y*screen.y())/768 - 
15;
+       const int menu_ybase = (game_config::title_buttons_y*screen.h())/768 - 
15;
        const int menu_yincr = 15;
 #else
-       const int menu_ybase = (game_config::title_buttons_y*screen.y())/768;
+       const int menu_ybase = (game_config::title_buttons_y*screen.h())/768;
        const int menu_yincr = 35;
 #endif
 
@@ -320,8 +320,8 @@
        draw_tip_of_day(screen, tips_of_day, ntip, style, &next_tip_button, 
&help_tip_button, &main_dialog_area, tip_of_day_restorer);
 
        const int pad = game_config::title_tip_padding;
-       beg_button.set_location(screen.x() - pad - beg_button.location().w,
-               screen.y() - pad - beg_button.location().h);
+       beg_button.set_location(screen.w() - pad - beg_button.location().w,
+               screen.h() - pad - beg_button.location().h);
        events::raise_draw_event();
 
        LOG_DP << "drew buttons dialog\n";


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

Reply via email to