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

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

[Wesnoth-cvs-commits] wesnoth/src multiplayer_lobby.cpp playturn.cpp ...


From: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth/src multiplayer_lobby.cpp playturn.cpp ...
Date: Wed, 27 Oct 2004 16:47:55 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Philippe Plantier <address@hidden>      04/10/27 20:42:37

Modified files:
        src            : multiplayer_lobby.cpp playturn.cpp 
                         titlescreen.cpp video.cpp video.hpp 
        src/widgets    : combo.cpp 

Log message:
        * Fixed the window not always refreshing on resizing
        * Made default savegame names be ellipsed when they are too long

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.cpp.diff?tr1=1.42&tr2=1.43&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.279&tr2=1.280&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/titlescreen.cpp.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.cpp.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.hpp.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/combo.cpp.diff?tr1=1.21&tr2=1.22&r1=text&r2=text

Patches:
Index: wesnoth/src/multiplayer_lobby.cpp
diff -u wesnoth/src/multiplayer_lobby.cpp:1.42 
wesnoth/src/multiplayer_lobby.cpp:1.43
--- wesnoth/src/multiplayer_lobby.cpp:1.42      Sun Oct 24 13:11:42 2004
+++ wesnoth/src/multiplayer_lobby.cpp   Wed Oct 27 20:42:36 2004
@@ -42,8 +42,8 @@
        std::cerr << "entered multiplayer lobby...\n";
        const preferences::display_manager disp_manager(&disp);
        const hotkey::basic_handler key_handler(&disp);
-       const video_change_detector disp_change_detector(disp.video());
        const tooltips::manager tooltips_manager(disp);
+       disp.video().modeChanged(); // resets modeChanged value
 
        CKey key;
 
@@ -378,7 +378,7 @@
                                }
                        }
 
-                       if(disp_change_detector.changed()) {
+                       if(disp.video().modeChanged()) {
                                return CONTINUE;
                        }
 
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.279 wesnoth/src/playturn.cpp:1.280
--- wesnoth/src/playturn.cpp:1.279      Wed Oct 27 19:28:07 2004
+++ wesnoth/src/playturn.cpp    Wed Oct 27 20:42:36 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.279 2004/10/27 19:28:07 gruikya Exp $ */
+/* $Id: playturn.cpp,v 1.280 2004/10/27 20:42:36 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1382,7 +1382,10 @@
 void turn_info::save_game(const std::string& message, gui::DIALOG_TYPE 
dialog_type)
 {
        std::stringstream stream;
-       stream << state_of_game_.label << " " << _("Turn")
+
+       const std::string ellipsed_name = 
font::make_text_ellipsis(state_of_game_.label, 
+                       font::SIZE_NORMAL, 200);
+       stream << ellipsed_name << " " << _("Turn")
               << " " << status_.turn();
        std::string label = stream.str();
        if(dialog_type == gui::NULL_DIALOG && message != "") {
Index: wesnoth/src/titlescreen.cpp
diff -u wesnoth/src/titlescreen.cpp:1.26 wesnoth/src/titlescreen.cpp:1.27
--- wesnoth/src/titlescreen.cpp:1.26    Fri Oct 22 00:09:46 2004
+++ wesnoth/src/titlescreen.cpp Wed Oct 27 20:42:36 2004
@@ -45,8 +45,6 @@
 
        LOG_DP << "logo size: " << logo->w << "," << logo->h << "\n";
 
-       const video_change_detector disp_change_detector(screen.video());
-
        for(int x = 0; x != logo->w; ++x) {
                SDL_Rect srcrect = {x,0,1,logo->h};
                SDL_Rect dstrect = {xpos+x,ypos,1,logo->h};
@@ -69,7 +67,7 @@
                        SDL_Delay(10);
 
                        events::pump();
-                       if(disp_change_detector.changed()) {
+                       if(screen.video().modeChanged()) {
                                faded_in = true;
                                fade_logo(screen,xpos,ypos);
                                return;
@@ -132,12 +130,11 @@
        const preferences::display_manager disp_manager(&screen);
        const hotkey::basic_handler key_handler(&screen);
 
-       const video_change_detector disp_change_detector(screen.video());
-
        const font::floating_label_context label_manager;
        
        const surface 
title_surface_unscaled(image::get_image(game_config::game_title,image::UNSCALED));
        const surface 
title_surface(scale_surface(title_surface_unscaled,screen.x(),screen.y()));
+       screen.video().modeChanged(); // resets modeChanged value
 
        if(title_surface == NULL) {
                ERR_DP << "Could not find title image\n";
@@ -282,7 +279,7 @@
 
                //if the resolution has changed due to the user resizing the 
screen,
                //or from changing between windowed and fullscreen
-               if(disp_change_detector.changed()) {
+               if(screen.video().modeChanged()) {
                        return TITLE_CONTINUE;
                }
 
Index: wesnoth/src/video.cpp
diff -u wesnoth/src/video.cpp:1.50 wesnoth/src/video.cpp:1.51
--- wesnoth/src/video.cpp:1.50  Wed Oct  6 05:45:41 2004
+++ wesnoth/src/video.cpp       Wed Oct 27 20:42:36 2004
@@ -1,4 +1,4 @@
-/* $Id: video.cpp,v 1.50 2004/10/06 05:45:41 silene Exp $ */
+/* $Id: video.cpp,v 1.51 2004/10/27 20:42:36 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -249,6 +249,7 @@
 int CVideo::setMode( int x, int y, int bits_per_pixel, int flags )
 {
        update_rects.clear();
+       mode_changed_ = true;
 
        flags = get_flags(flags);
        const int res = SDL_VideoModeOK( x, y, bits_per_pixel, flags );
@@ -265,6 +266,13 @@
        } else  return 0;
 }
 
+bool CVideo::modeChanged()
+{
+       bool ret = mode_changed_;
+       mode_changed_ = false;
+       return ret;
+}
+
 int CVideo::setGamma(float gamma)
 {
        SDL_SetGamma(gamma, gamma, gamma);
Index: wesnoth/src/video.hpp
diff -u wesnoth/src/video.hpp:1.27 wesnoth/src/video.hpp:1.28
--- wesnoth/src/video.hpp:1.27  Tue Jul 20 11:56:58 2004
+++ wesnoth/src/video.hpp       Wed Oct 27 20:42:36 2004
@@ -1,4 +1,4 @@
-/* $Id: video.hpp,v 1.27 2004/07/20 11:56:58 gakusho Exp $ */
+/* $Id: video.hpp,v 1.28 2004/10/27 20:42:36 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -40,6 +40,9 @@
        int modePossible( int x, int y, int bits_per_pixel, int flags );
        int setMode( int x, int y, int bits_per_pixel, int flags );
 
+       //did the mode change, since the last call to the modeChanged() method?
+       bool modeChanged();
+
        int setGamma(float gamma);
 
        //functions to get the dimensions of the current video-mode
@@ -74,23 +77,12 @@
 
 private:
 
+       bool mode_changed_;
+
        int bpp;        // Store real bits per pixel
 
        //if there is no display at all, but we 'fake' it for clients
        bool fake_screen;
 };
 
-//a structure which will detect if the resolution or fullscreen mode has 
changed
-struct video_change_detector {
-       video_change_detector(CVideo& video) : video_(video), 
full_(video.isFullScreen()), x_(video.getx()), y_(video.gety())
-       {}
-
-       bool changed() const { return full_ != video_.isFullScreen() || x_ != 
video_.getx() || y_ != video_.gety(); }
-
-private:
-       CVideo& video_;
-       bool full_;
-       int x_, y_;
-};
-
 #endif
Index: wesnoth/src/widgets/combo.cpp
diff -u wesnoth/src/widgets/combo.cpp:1.21 wesnoth/src/widgets/combo.cpp:1.22
--- wesnoth/src/widgets/combo.cpp:1.21  Wed Oct 27 19:28:07 2004
+++ wesnoth/src/widgets/combo.cpp       Wed Oct 27 20:42:37 2004
@@ -1,4 +1,4 @@
-/* $Id: combo.cpp,v 1.21 2004/10/27 19:28:07 gruikya Exp $ */
+/* $Id: combo.cpp,v 1.22 2004/10/27 20:42:37 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -78,8 +78,8 @@
        if(button_.process(x,y,button)) {
                const SDL_Rect rect = button_.location();
                set_selected(gui::show_dialog(*display_,NULL,"","",
-                                                     
gui::MESSAGE,&items_,NULL,"",NULL,-1,NULL,NULL,
-                                                                         
rect.x,rect.y+rect.h));
+                                       
gui::MESSAGE,&items_,NULL,"",NULL,-1,NULL,NULL,
+                                       rect.x,rect.y+rect.h));
                
                button_.draw();
 




reply via email to

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