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

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

[Wesnoth-cvs-commits] wesnoth/src/widgets scrollarea.cpp scrollarea.h...


From: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth/src/widgets scrollarea.cpp scrollarea.h...
Date: Sun, 21 Aug 2005 08:58:46 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Philippe Plantier <address@hidden>      05/08/21 12:58:46

Modified files:
        src/widgets    : scrollarea.cpp scrollarea.hpp scrollbar.cpp 
                         textbox.cpp widget.cpp 

Log message:
        Fixed #13011, and several other general brokages in the scrollarea / 
textbox code.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.cpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.hpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.cpp.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.cpp.diff?tr1=1.83&tr2=1.84&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.cpp.diff?tr1=1.34&tr2=1.35&r1=text&r2=text

Patches:
Index: wesnoth/src/widgets/scrollarea.cpp
diff -u wesnoth/src/widgets/scrollarea.cpp:1.12 
wesnoth/src/widgets/scrollarea.cpp:1.13
--- wesnoth/src/widgets/scrollarea.cpp:1.12     Fri Mar 18 21:21:48 2005
+++ wesnoth/src/widgets/scrollarea.cpp  Sun Aug 21 12:58:46 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollarea.cpp,v 1.12 2005/03/18 21:21:48 ydirson Exp $*/
+/* $Id: scrollarea.cpp,v 1.13 2005/08/21 12:58:46 gruikya Exp $*/
 /*
    Copyright (C) 2004 by Guillaume Melquiond <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -22,13 +22,15 @@
 
 scrollarea::scrollarea(CVideo &video)
        : widget(video), scrollbar_(video),
-         old_position_(0), recursive_(false), shown_scrollbar_(false)
+         old_position_(0), recursive_(false), shown_scrollbar_(false),
+         shown_size_(0), full_size_(0)
 {
+       scrollbar_.hide(true);
 }
 
 bool scrollarea::has_scrollbar() const
 {
-       return scrollbar_.grip_height_ < scrollbar_.full_height_ && 
scrollbar_.is_valid_height(location().h);
+       return shown_size_ < full_size_ && 
scrollbar_.is_valid_height(location().h);
 }
 
 void scrollarea::update_location(SDL_Rect const &rect)
@@ -42,7 +44,8 @@
                scrollbar_.set_location(r);
                r.x -= w;
                r.w = w;
-       }
+       } 
+
        if (!hidden())
                scrollbar_.hide(!shown_scrollbar_);
        set_inner_location(r);
@@ -64,7 +67,7 @@
 void scrollarea::hide(bool value)
 {
        widget::hide(value);
-       if (has_scrollbar())
+       if (shown_scrollbar_)
                scrollbar_.hide(value);
 }
 
@@ -96,12 +99,14 @@
 void scrollarea::set_shown_size(unsigned h)
 {
        scrollbar_.set_shown_size(h);
+       shown_size_ = h;
        test_scrollbar();
 }
 
 void scrollarea::set_full_size(unsigned h)
 {
        scrollbar_.set_full_size(h);
+       full_size_ = h;
        test_scrollbar();
 }
 
@@ -122,7 +127,7 @@
 SDL_Rect scrollarea::inner_location() const
 {
        SDL_Rect r = location();
-       if (has_scrollbar())
+       if (shown_scrollbar_)
                r.w -= scrollbar_.width();
        return r;
 }
Index: wesnoth/src/widgets/scrollarea.hpp
diff -u wesnoth/src/widgets/scrollarea.hpp:1.6 
wesnoth/src/widgets/scrollarea.hpp:1.7
--- wesnoth/src/widgets/scrollarea.hpp:1.6      Fri Mar 18 21:21:48 2005
+++ wesnoth/src/widgets/scrollarea.hpp  Sun Aug 21 12:58:46 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollarea.hpp,v 1.6 2005/03/18 21:21:48 ydirson Exp $ */
+/* $Id: scrollarea.hpp,v 1.7 2005/08/21 12:58:46 gruikya Exp $ */
 /*
    Copyright (C) 2004 by Guillaume Melquiond <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -55,6 +55,8 @@
        scrollbar scrollbar_;
        int old_position_;
        bool recursive_, shown_scrollbar_;
+       unsigned shown_size_;
+       unsigned full_size_;
 
        void test_scrollbar();
 };
Index: wesnoth/src/widgets/scrollbar.cpp
diff -u wesnoth/src/widgets/scrollbar.cpp:1.34 
wesnoth/src/widgets/scrollbar.cpp:1.35
--- wesnoth/src/widgets/scrollbar.cpp:1.34      Sat Jul  2 21:37:20 2005
+++ wesnoth/src/widgets/scrollbar.cpp   Sun Aug 21 12:58:46 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.cpp,v 1.34 2005/07/02 21:37:20 ott Exp $*/
+/* $Id: scrollbar.cpp,v 1.35 2005/08/21 12:58:46 gruikya Exp $*/
 /*
    Copyright (C) 2003 by David White <address@hidden>
                  2004 by Guillaume Melquiond <address@hidden>
@@ -62,7 +62,9 @@
        SDL_Rect r = rect;
        r.y += uh;
        r.h -= uh + dh;
-       bg_register(r);
+
+       widget::update_location(r);
+       //bg_register(r);
 }
 
 void scrollbar::hide(bool value)
Index: wesnoth/src/widgets/textbox.cpp
diff -u wesnoth/src/widgets/textbox.cpp:1.83 
wesnoth/src/widgets/textbox.cpp:1.84
--- wesnoth/src/widgets/textbox.cpp:1.83        Sat Jul  2 21:37:20 2005
+++ wesnoth/src/widgets/textbox.cpp     Sun Aug 21 12:58:46 2005
@@ -1,4 +1,4 @@
-/* $Id: textbox.cpp,v 1.83 2005/07/02 21:37:20 ott Exp $ */
+/* $Id: textbox.cpp,v 1.84 2005/08/21 12:58:46 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -231,6 +231,7 @@
        text_pos_ = 0;
 
        scrollarea::set_location(rect);
+       set_shown_size(location().h);
 }
 
 void textbox::scroll(int pos)
Index: wesnoth/src/widgets/widget.cpp
diff -u wesnoth/src/widgets/widget.cpp:1.34 wesnoth/src/widgets/widget.cpp:1.35
--- wesnoth/src/widgets/widget.cpp:1.34 Wed Jul 20 08:56:52 2005
+++ wesnoth/src/widgets/widget.cpp      Sun Aug 21 12:58:46 2005
@@ -1,4 +1,4 @@
-/* $Id: widget.cpp,v 1.34 2005/07/20 08:56:52 ott Exp $ */
+/* $Id: widget.cpp,v 1.35 2005/08/21 12:58:46 gruikya Exp $ */
 /*
    Copyright (C) 2003-5 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -51,10 +51,11 @@
 
 void widget::set_location(SDL_Rect const &rect)
 {
-       if (rect_.x == rect.x && rect_.y == rect.y && rect_.w == rect.w && 
rect_.h == rect.h)
+       if(rect_.x == rect.x && rect_.y == rect.y && rect_.w == rect.w && 
rect_.h == rect.h)
                return;
-       if (state_ == UNINIT && rect.x != -1234 && rect.y != -1234)
+       if(state_ == UNINIT && rect.x != -1234 && rect.y != -1234)
                state_ = DRAWN;
+
        bg_restore();
        bg_cancel();
        rect_ = rect;




reply via email to

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