[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src/widgets textbox.cpp scrollarea.cpp ...
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src/widgets textbox.cpp scrollarea.cpp ... |
Date: |
Sat, 22 Jan 2005 19:28:34 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 05/01/23 00:28:34
Modified files:
src/widgets : textbox.cpp scrollarea.cpp scrollarea.hpp
scrollbar.cpp scrollbar.hpp
Log message:
fixed bug where scrolling to the bottom of a textbox wouldn't work
properly
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.cpp.diff?tr1=1.67&tr2=1.68&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.cpp.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.hpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
Patches:
Index: wesnoth/src/widgets/scrollarea.cpp
diff -u wesnoth/src/widgets/scrollarea.cpp:1.6
wesnoth/src/widgets/scrollarea.cpp:1.7
--- wesnoth/src/widgets/scrollarea.cpp:1.6 Mon Nov 22 23:54:27 2004
+++ wesnoth/src/widgets/scrollarea.cpp Sun Jan 23 00:28:34 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollarea.cpp,v 1.6 2004/11/22 23:54:27 ydirson Exp $*/
+/* $Id: scrollarea.cpp,v 1.7 2005/01/23 00:28:34 Sirp Exp $*/
/*
Copyright (C) 2004 by Guillaume Melquiond <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -74,6 +74,11 @@
unsigned scrollarea::get_position() const
{
return scrollbar_.get_position();
+}
+
+unsigned scrollarea::get_max_position() const
+{
+ return scrollbar_.get_max_position();
}
void scrollarea::set_position(unsigned pos)
Index: wesnoth/src/widgets/scrollarea.hpp
diff -u wesnoth/src/widgets/scrollarea.hpp:1.3
wesnoth/src/widgets/scrollarea.hpp:1.4
--- wesnoth/src/widgets/scrollarea.hpp:1.3 Sat Nov 6 22:40:00 2004
+++ wesnoth/src/widgets/scrollarea.hpp Sun Jan 23 00:28:34 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollarea.hpp,v 1.3 2004/11/06 22:40:00 silene Exp $ */
+/* $Id: scrollarea.hpp,v 1.4 2005/01/23 00:28:34 Sirp Exp $ */
/*
Copyright (C) 2004 by Guillaume Melquiond <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -41,7 +41,8 @@
SDL_Rect inner_location() const;
unsigned scrollbar_width() const;
- unsigned get_position() const;
+ unsigned get_position() const;
+ unsigned get_max_position() const;
void set_position(unsigned pos);
void adjust_position(unsigned pos);
void move_position(int dep);
Index: wesnoth/src/widgets/scrollbar.cpp
diff -u wesnoth/src/widgets/scrollbar.cpp:1.24
wesnoth/src/widgets/scrollbar.cpp:1.25
--- wesnoth/src/widgets/scrollbar.cpp:1.24 Mon Nov 22 23:54:27 2004
+++ wesnoth/src/widgets/scrollbar.cpp Sun Jan 23 00:28:34 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.cpp,v 1.24 2004/11/22 23:54:27 ydirson Exp $*/
+/* $Id: scrollbar.cpp,v 1.25 2005/01/23 00:28:34 Sirp Exp $*/
/*
Copyright (C) 2003 by David White <address@hidden>
2004 by Guillaume Melquiond <address@hidden>
@@ -76,11 +76,16 @@
unsigned scrollbar::get_position() const
{
return grip_position_;
+}
+
+unsigned scrollbar::get_max_position() const
+{
+ return full_height_ - grip_height_;
}
void scrollbar::set_position(unsigned pos)
{
- if (pos > full_height_ - grip_height_)
+ if (int(pos) > full_height_ - grip_height_)
pos = full_height_ - grip_height_;
if (pos == grip_position_)
return;
@@ -92,9 +97,9 @@
void scrollbar::adjust_position(unsigned pos)
{
- if (pos < grip_position_)
+ if (int(pos) < grip_position_)
set_position(pos);
- else if (pos >= grip_position_ + grip_height_)
+ else if (int(pos) >= grip_position_ + grip_height_)
set_position(pos - (grip_height_ - 1));
}
@@ -109,7 +114,7 @@
void scrollbar::set_shown_size(unsigned h)
{
- if (h > full_height_)
+ if (int(h) > full_height_)
h = full_height_;
if (h == grip_height_)
return;
Index: wesnoth/src/widgets/scrollbar.hpp
diff -u wesnoth/src/widgets/scrollbar.hpp:1.12
wesnoth/src/widgets/scrollbar.hpp:1.13
--- wesnoth/src/widgets/scrollbar.hpp:1.12 Sun Nov 14 00:39:10 2004
+++ wesnoth/src/widgets/scrollbar.hpp Sun Jan 23 00:28:34 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.hpp,v 1.12 2004/11/14 00:39:10 silene Exp $ */
+/* $Id: scrollbar.hpp,v 1.13 2005/01/23 00:28:34 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
2004 by Guillaume Melquiond <address@hidden>
@@ -38,7 +38,9 @@
/// This function is used to determine where the scrollbar is.
/// \return the position. For example, will return 0 if the scrollbar
/// is at the top, and (full_size - shown_size) if it is at the bottom.
- unsigned get_position() const;
+ unsigned get_position() const;
+
+ unsigned get_max_position() const;
/// Used to manually update the scrollbar.
void set_position(unsigned pos);
Index: wesnoth/src/widgets/textbox.cpp
diff -u wesnoth/src/widgets/textbox.cpp:1.67
wesnoth/src/widgets/textbox.cpp:1.68
--- wesnoth/src/widgets/textbox.cpp:1.67 Mon Nov 22 23:54:27 2004
+++ wesnoth/src/widgets/textbox.cpp Sun Jan 23 00:28:34 2005
@@ -1,4 +1,4 @@
-/* $Id: textbox.cpp,v 1.67 2004/11/22 23:54:27 ydirson Exp $ */
+/* $Id: textbox.cpp,v 1.68 2005/01/23 00:28:34 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -202,7 +202,7 @@
void textbox::scroll_to_bottom()
{
- set_position((unsigned)-1);
+ set_position(get_max_position());
}
void textbox::set_wrap(bool val)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src/widgets textbox.cpp scrollarea.cpp ...,
David White <=