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

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

[Wesnoth-cvs-commits] wesnoth/src filechooser.cpp multiplayer_connect...


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src filechooser.cpp multiplayer_connect...
Date: Tue, 15 Mar 2005 16:47:41 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    05/03/15 21:47:41

Modified files:
        src            : filechooser.cpp multiplayer_connect.cpp 
                         video.cpp video.hpp 
        src/widgets    : button.cpp file_chooser.cpp label.cpp menu.cpp 
                         progressbar.cpp scrollbar.cpp slider.cpp 
                         textbox.cpp textbox.hpp widget.cpp widget.hpp 

Log message:
        more cleanup of deps against display

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filechooser.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.121&tr2=1.122&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.cpp.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.hpp.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/button.cpp.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/file_chooser.cpp.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/label.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.81&tr2=1.82&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/progressbar.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.cpp.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/slider.cpp.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.cpp.diff?tr1=1.71&tr2=1.72&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.hpp.diff?tr1=1.42&tr2=1.43&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.cpp.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.hpp.diff?tr1=1.24&tr2=1.25&r1=text&r2=text

Patches:
Index: wesnoth/src/filechooser.cpp
diff -u wesnoth/src/filechooser.cpp:1.5 wesnoth/src/filechooser.cpp:1.6
--- wesnoth/src/filechooser.cpp:1.5     Thu Mar 10 21:42:04 2005
+++ wesnoth/src/filechooser.cpp Tue Mar 15 21:47:40 2005
@@ -1,5 +1,6 @@
 #include "global.hpp"
 
+#include "display.hpp"
 #include "gettext.hpp"
 #include "show_dialog.hpp"
 #include "video.hpp"
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.121 
wesnoth/src/multiplayer_connect.cpp:1.122
--- wesnoth/src/multiplayer_connect.cpp:1.121   Tue Mar 15 20:01:31 2005
+++ wesnoth/src/multiplayer_connect.cpp Tue Mar 15 21:47:40 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.121 2005/03/15 20:01:31 ydirson Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.122 2005/03/15 21:47:40 ydirson Exp $ */
 /*
    Copyright (C) 
    Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -12,6 +12,7 @@
 */
 
 #include "global.hpp"
+
 #include "dialogs.hpp"
 #include "font.hpp"
 #include "game_config.hpp"
@@ -758,7 +759,7 @@
                        bottom-left_button->height()-gui::ButtonVPadding);
 
        // Title and labels
-       gui::draw_dialog_title(left,top,&disp().video(),_("Game Lobby"));
+       gui::draw_dialog_title(left,top,&video(),_("Game Lobby"));
 
        
type_title_label_.set_location((left+30)+(launch_.width()/2)-(type_title_label_.width()/2),top+35);
        
faction_title_label_.set_location((left+145)+(launch_.width()/2)-(faction_title_label_.width()/2),top+35);
Index: wesnoth/src/video.cpp
diff -u wesnoth/src/video.cpp:1.57 wesnoth/src/video.cpp:1.58
--- wesnoth/src/video.cpp:1.57  Tue Mar 15 00:42:44 2005
+++ wesnoth/src/video.cpp       Tue Mar 15 21:47:40 2005
@@ -1,4 +1,4 @@
-/* $Id: video.cpp,v 1.57 2005/03/15 00:42:44 ydirson Exp $ */
+/* $Id: video.cpp,v 1.58 2005/03/15 21:47:40 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -123,9 +123,9 @@
        return frameBuffer;
 }
 
-SDL_Rect screen_area()
+const SDL_Rect& screen_area()
 {
-       const SDL_Rect res = {0,0,frameBuffer->w,frameBuffer->h};
+       static const SDL_Rect res = {0,0,frameBuffer->w,frameBuffer->h};
        return res;
 }
 
Index: wesnoth/src/video.hpp
diff -u wesnoth/src/video.hpp:1.29 wesnoth/src/video.hpp:1.30
--- wesnoth/src/video.hpp:1.29  Tue Mar 15 00:42:44 2005
+++ wesnoth/src/video.hpp       Tue Mar 15 21:47:40 2005
@@ -1,4 +1,4 @@
-/* $Id: video.hpp,v 1.29 2005/03/15 00:42:44 ydirson Exp $ */
+/* $Id: video.hpp,v 1.30 2005/03/15 21:47:40 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -23,7 +23,7 @@
 
 surface display_format_alpha(surface surf);
 surface get_video_surface();
-SDL_Rect screen_area();
+const SDL_Rect& screen_area();
 
 bool non_interactive();
 
Index: wesnoth/src/widgets/button.cpp
diff -u wesnoth/src/widgets/button.cpp:1.58 wesnoth/src/widgets/button.cpp:1.59
--- wesnoth/src/widgets/button.cpp:1.58 Tue Mar 15 20:01:31 2005
+++ wesnoth/src/widgets/button.cpp      Tue Mar 15 21:47:41 2005
@@ -1,4 +1,4 @@
-/* $Id: button.cpp,v 1.58 2005/03/15 20:01:31 ydirson Exp $ */
+/* $Id: button.cpp,v 1.59 2005/03/15 21:47:41 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -69,8 +69,8 @@
 
        textRect_.x = 0;
        textRect_.y = 0;
-       textRect_.w = disp.x();
-       textRect_.h = disp.y();
+       textRect_.w = video().getx();
+       textRect_.h = video().gety();
 
        textRect_ = font::draw_text(NULL,textRect_,font_size,
                                    font::BUTTON_COLOUR,label_,0,0);
@@ -172,7 +172,7 @@
 
        disp().blit_surface(loc.x, loc.y, image);
        const std::string etext = font::make_text_ellipsis(label_, font_size, 
loc.w);
-       font::draw_text(&disp().video(), clipArea, font_size, 
font::BUTTON_COLOUR, etext, textx, texty);
+       font::draw_text(&video(), clipArea, font_size, font::BUTTON_COLOUR, 
etext, textx, texty);
 
        update_rect(loc);
 }
@@ -199,7 +199,7 @@
                }
        }
 
-       textRect_ = disp().screen_area();
+       textRect_ = screen_area();
        const std::string etext = font::make_text_ellipsis(label_, font_size, 
width());
        textRect_ = font::draw_text(NULL,textRect_,font_size,
                                    font::BUTTON_COLOUR,etext,0,0);
Index: wesnoth/src/widgets/file_chooser.cpp
diff -u wesnoth/src/widgets/file_chooser.cpp:1.25 
wesnoth/src/widgets/file_chooser.cpp:1.26
--- wesnoth/src/widgets/file_chooser.cpp:1.25   Thu Mar 10 02:09:26 2005
+++ wesnoth/src/widgets/file_chooser.cpp        Tue Mar 15 21:47:41 2005
@@ -20,6 +20,7 @@
 #include "../filesystem.hpp"
 #include "../font.hpp"
 #include "../gettext.hpp"
+#include "../key.hpp"
 #include "../show_dialog.hpp"
 #include "../wml_separators.hpp"
 #include "file_chooser.hpp"
Index: wesnoth/src/widgets/label.cpp
diff -u wesnoth/src/widgets/label.cpp:1.7 wesnoth/src/widgets/label.cpp:1.8
--- wesnoth/src/widgets/label.cpp:1.7   Tue Mar 15 20:01:31 2005
+++ wesnoth/src/widgets/label.cpp       Tue Mar 15 21:47:41 2005
@@ -1,4 +1,4 @@
-/* $Id: label.cpp,v 1.7 2005/03/15 20:01:31 ydirson Exp $ */
+/* $Id: label.cpp,v 1.8 2005/03/15 21:47:41 ydirson Exp $ */
 /*
    Copyright (C) 2004 by Philippe Plantier <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -14,7 +14,6 @@
 #include "../global.hpp"
 
 #include "label.hpp"
-#include "../display.hpp"
 #include "../font.hpp"
 #include "../video.hpp"
 
@@ -68,7 +67,7 @@
 
 void label::draw_contents()
 {
-       font::draw_text(&disp().video(), screen_area(), size_, colour_, text_, 
location().x, location().y);
+       font::draw_text(&video(), screen_area(), size_, colour_, text_, 
location().x, location().y);
 }
 
 void label::update_label_size()
Index: wesnoth/src/widgets/menu.cpp
diff -u wesnoth/src/widgets/menu.cpp:1.81 wesnoth/src/widgets/menu.cpp:1.82
--- wesnoth/src/widgets/menu.cpp:1.81   Tue Mar 15 20:01:31 2005
+++ wesnoth/src/widgets/menu.cpp        Tue Mar 15 21:47:41 2005
@@ -171,7 +171,7 @@
                return size_t(max_items_);
        }
 
-       const size_t max_height = max_height_ == -1 ? (disp().y()*66)/100 : 
max_height_;
+       const size_t max_height = max_height_ == -1 ? (video().gety()*66)/100 : 
max_height_;
        std::vector<int> heights;
        size_t n;
        for(n = 0; n != items_.size(); ++n) {
@@ -397,9 +397,9 @@
        gui::draw_solid_tinted_rectangle(rect.x, rect.y, rect.w, rect.h,
                                         item == selected_ ? 150:0,0,0,
                                         item == selected_ ? 0.6 : 0.2,
-                                        disp().video().getSurface());
+                                        video().getSurface());
 
-       SDL_Rect const &area = disp().screen_area();
+       SDL_Rect const &area = screen_area();
        //SDL_Rect area = { 0, 0, rect.w, rect.h };
        SDL_Rect const &loc = inner_location();
 
@@ -429,7 +429,7 @@
                                        font::make_text_ellipsis(str, 
menu_font_size, loc.w - (xpos - rect.x)) : str;
                                const SDL_Rect& text_size = 
font::text_area(str,menu_font_size);
                                const size_t y = rect.y + (rect.h - 
text_size.h)/2;
-                               
font::draw_text(&disp().video(),area,menu_font_size,font::NORMAL_COLOUR,to_show,xpos,y);
+                               
font::draw_text(&video(),area,menu_font_size,font::NORMAL_COLOUR,to_show,xpos,y);
                                xpos += text_size.w + 5;
                        }
                }
@@ -516,7 +516,7 @@
 
        SDL_Rect res = { loc.x, y, loc.w, get_item_height(item) };
 
-       SDL_Rect const &screen_area = disp().screen_area();
+       SDL_Rect const &screen_area = ::screen_area();
 
        if(res.x > screen_area.w) {
                return empty_rect;
Index: wesnoth/src/widgets/progressbar.cpp
diff -u wesnoth/src/widgets/progressbar.cpp:1.7 
wesnoth/src/widgets/progressbar.cpp:1.8
--- wesnoth/src/widgets/progressbar.cpp:1.7     Tue Mar 15 20:01:31 2005
+++ wesnoth/src/widgets/progressbar.cpp Tue Mar 15 21:47:41 2005
@@ -2,7 +2,6 @@
 
 #include "progressbar.hpp"
 
-#include "../display.hpp"
 #include "../font.hpp"
 #include "../util.hpp"
 #include "../video.hpp"
@@ -20,7 +19,7 @@
 
 void progress_bar::draw_contents()
 {
-       surface const surf = disp().video().getSurface();
+       surface const surf = video().getSurface();
        SDL_Rect area = location();
 
        if(area.w >= 2 && area.h >= 2) {
@@ -37,7 +36,7 @@
                text_area.x = area.x + area.w/2 - text_area.w/2;
                text_area.y = area.y + area.h/2 - text_area.h/2;
 
-               
font::draw_text(&disp().video(),location(),font::SIZE_NORMAL,font::BLACK_COLOUR,text,text_area.x,text_area.y);
+               
font::draw_text(&video(),location(),font::SIZE_NORMAL,font::BLACK_COLOUR,text,text_area.x,text_area.y);
        }
 
        update_rect(location());
Index: wesnoth/src/widgets/scrollbar.cpp
diff -u wesnoth/src/widgets/scrollbar.cpp:1.28 
wesnoth/src/widgets/scrollbar.cpp:1.29
--- wesnoth/src/widgets/scrollbar.cpp:1.28      Sat Feb 26 21:18:15 2005
+++ wesnoth/src/widgets/scrollbar.cpp   Tue Mar 15 21:47:41 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.cpp,v 1.28 2005/02/26 21:18:15 gruikya Exp $*/
+/* $Id: scrollbar.cpp,v 1.29 2005/03/15 21:47:41 ydirson Exp $*/
 /*
    Copyright (C) 2003 by David White <address@hidden>
                  2004 by Guillaume Melquiond <address@hidden>
@@ -236,7 +236,7 @@
                return;
        }
 
-       surface const screen = disp().video().getSurface();
+       surface const screen = video().getSurface();
 
        // draw scrollbar "groove"
        disp().blit_surface(groove.x, groove.y, top_grv);
Index: wesnoth/src/widgets/slider.cpp
diff -u wesnoth/src/widgets/slider.cpp:1.36 wesnoth/src/widgets/slider.cpp:1.37
--- wesnoth/src/widgets/slider.cpp:1.36 Mon Nov 22 23:54:27 2004
+++ wesnoth/src/widgets/slider.cpp      Tue Mar 15 21:47:41 2005
@@ -1,4 +1,4 @@
-/* $Id: slider.cpp,v 1.36 2004/11/22 23:54:27 ydirson Exp $ */
+/* $Id: slider.cpp,v 1.37 2005/03/15 21:47:41 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -120,7 +120,7 @@
        if (image->w >= loc.w)
                return;
 
-       surface const screen = disp().video().getSurface();
+       surface const screen = video().getSurface();
 
        SDL_Rect line_rect = { loc.x + image->w / 2, loc.y + loc.h / 2, loc.w - 
image->w, 1 };
        SDL_FillRect(screen, &line_rect, SDL_MapRGB(screen->format, 255, 255, 
255));
Index: wesnoth/src/widgets/textbox.cpp
diff -u wesnoth/src/widgets/textbox.cpp:1.71 
wesnoth/src/widgets/textbox.cpp:1.72
--- wesnoth/src/widgets/textbox.cpp:1.71        Thu Mar  3 21:52:40 2005
+++ wesnoth/src/widgets/textbox.cpp     Tue Mar 15 21:47:41 2005
@@ -1,4 +1,4 @@
-/* $Id: textbox.cpp,v 1.71 2005/03/03 21:52:40 gruikya Exp $ */
+/* $Id: textbox.cpp,v 1.72 2005/03/15 21:47:41 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -109,11 +109,11 @@
        update_text_cache(true);
 }
 
-void textbox::draw_cursor(int pos, display &disp) const
+void textbox::draw_cursor(int pos, CVideo &video) const
 {
        if(show_cursor_ && editable_) {
                SDL_Rect rect = {location().x + pos, location().y, 1, 
location().h };
-               surface const frame_buffer = disp.video().getSurface();
+               surface const frame_buffer = video.getSurface();
                
SDL_FillRect(frame_buffer,&rect,SDL_MapRGB(frame_buffer->format,255,255,255));
        }
 }
@@ -122,7 +122,7 @@
 {
        SDL_Rect const &loc = inner_location();
 
-       surface surf = disp().video().getSurface();
+       surface surf = video().getSurface();
        gui::draw_solid_tinted_rectangle(loc.x,loc.y,loc.w,loc.h,0,0,0,
                                  focus() ? alpha_focus_ : alpha_, surf);
        
@@ -133,7 +133,7 @@
                src.w = minimum<size_t>(loc.w,text_image_->w);
                src.h = minimum<size_t>(loc.h,text_image_->h);
                src.x = text_pos_;
-               SDL_Rect dest = disp().screen_area();
+               SDL_Rect dest = screen_area();
                dest.x = loc.x;
                dest.y = loc.y;
 
@@ -167,7 +167,7 @@
                SDL_BlitSurface(text_image_, &src, surf, &dest);
        }
 
-       draw_cursor((cursor_pos_ == 0 ? 0 : cursor_pos_ - 1), disp());
+       draw_cursor((cursor_pos_ == 0 ? 0 : cursor_pos_ - 1), video());
 
        update_rect(loc);
 }
Index: wesnoth/src/widgets/textbox.hpp
diff -u wesnoth/src/widgets/textbox.hpp:1.42 
wesnoth/src/widgets/textbox.hpp:1.43
--- wesnoth/src/widgets/textbox.hpp:1.42        Thu Mar 10 22:29:57 2005
+++ wesnoth/src/widgets/textbox.hpp     Tue Mar 15 21:47:41 2005
@@ -1,4 +1,4 @@
-/* $Id: textbox.hpp,v 1.42 2005/03/10 22:29:57 ydirson Exp $ */
+/* $Id: textbox.hpp,v 1.43 2005/03/15 21:47:41 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -14,10 +14,11 @@
 #ifndef TEXTBOX_HPP_INCLUDED
 #define TEXTBOX_HPP_INCLUDED
 
+class display;
+
 #include "../serialization/string_utils.hpp"
 #include "../sdl_utils.hpp"
 
-#include "display.hpp"
 #include "scrollarea.hpp"
 
 #include "SDL.h"
@@ -87,7 +88,7 @@
 
        void handle_event(const SDL_Event& event);
 
-       void draw_cursor(int pos, display &disp) const;
+       void draw_cursor(int pos, CVideo &video) const;
        void update_text_cache(bool reset = false);
        surface add_text_line(const wide_string& text);
        bool is_selection();
Index: wesnoth/src/widgets/widget.cpp
diff -u wesnoth/src/widgets/widget.cpp:1.28 wesnoth/src/widgets/widget.cpp:1.29
--- wesnoth/src/widgets/widget.cpp:1.28 Wed Mar  9 22:21:54 2005
+++ wesnoth/src/widgets/widget.cpp      Tue Mar 15 21:47:41 2005
@@ -29,6 +29,11 @@
        bg_cancel();
 }
 
+// FIXME: we should move this into the header so that it can be
+// inlined, but that would currently create a
+// widget->display->button->widget include cycle
+CVideo& widget::video() const { return (disp_->video()); }
+
 void widget::bg_cancel()
 {
        for(std::vector< surface_restorer >::iterator i = restorer_.begin(),
@@ -57,7 +62,7 @@
 
 void widget::bg_register(SDL_Rect const &rect)
 {
-       restorer_.push_back(surface_restorer(&disp_->video(), rect));
+       restorer_.push_back(surface_restorer(&video(), rect));
 }
 
 void widget::set_location(int x, int y)
@@ -163,7 +168,7 @@
 {
        util::scoped_ptr<clip_rect_setter> clipper(NULL);
        if (clip_)
-               clipper.assign(new 
clip_rect_setter(disp().video().getSurface(), clip_rect_));
+               clipper.assign(new clip_rect_setter(video().getSurface(), 
clip_rect_));
 
        if (needs_restore_) {
                for(std::vector< surface_restorer >::const_iterator i = 
restorer_.begin(),
@@ -181,7 +186,7 @@
 {
        util::scoped_ptr<clip_rect_setter> clipper(NULL);
        if (clip_)
-               clipper.assign(new 
clip_rect_setter(disp().video().getSurface(), clip_rect_));
+               clipper.assign(new clip_rect_setter(video().getSurface(), 
clip_rect_));
 
        for(std::vector< surface_restorer >::const_iterator i = 
restorer_.begin(),
            i_end = restorer_.end(); i != i_end; ++i)
@@ -204,7 +209,7 @@
 
        util::scoped_ptr<clip_rect_setter> clipper(NULL);
        if (clip_)
-               clipper.assign(new 
clip_rect_setter(disp().video().getSurface(), clip_rect_));
+               clipper.assign(new clip_rect_setter(video().getSurface(), 
clip_rect_));
 
        draw_contents();
 
Index: wesnoth/src/widgets/widget.hpp
diff -u wesnoth/src/widgets/widget.hpp:1.24 wesnoth/src/widgets/widget.hpp:1.25
--- wesnoth/src/widgets/widget.hpp:1.24 Thu Mar 10 02:09:26 2005
+++ wesnoth/src/widgets/widget.hpp      Tue Mar 15 21:47:41 2005
@@ -9,6 +9,7 @@
 #include <string>
 #include <vector>
 
+class CVideo;
 class display;
 
 namespace gui {
@@ -65,6 +66,7 @@
        void bg_cancel();
 
        display& disp() const { return *disp_; }
+       CVideo& video() const;
 
        virtual void handle_event(SDL_Event const &event) {}
 




reply via email to

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