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

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

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


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src help.cpp widgets/scrollarea.cpp wid...
Date: Sat, 06 Nov 2004 17:45:39 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    04/11/06 22:40:00

Modified files:
        src            : help.cpp 
        src/widgets    : scrollarea.cpp scrollarea.hpp scrollbar.cpp 
                         scrollbar.hpp scrollpane.cpp 

Log message:
        Added a scroll rate factor.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.52&tr2=1.53&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.hpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.cpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.hpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollpane.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.52 wesnoth/src/help.cpp:1.53
--- wesnoth/src/help.cpp:1.52   Sat Nov  6 20:09:15 2004
+++ wesnoth/src/help.cpp        Sat Nov  6 22:40:00 2004
@@ -1607,7 +1607,9 @@
          title_spacing_(16), curr_loc_(0, 0),
          min_row_height_(font::get_max_height(normal_font_size)), 
curr_row_height_(min_row_height_),
          contents_height_(0)
-{}
+{
+       set_scroll_rate(40);
+}
 
 void help_text_area::set_inner_location(SDL_Rect const &rect) {
        bg_register(rect);
Index: wesnoth/src/widgets/scrollarea.cpp
diff -u wesnoth/src/widgets/scrollarea.cpp:1.3 
wesnoth/src/widgets/scrollarea.cpp:1.4
--- wesnoth/src/widgets/scrollarea.cpp:1.3      Sat Nov  6 20:03:56 2004
+++ wesnoth/src/widgets/scrollarea.cpp  Sat Nov  6 22:40:00 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollarea.cpp,v 1.3 2004/11/06 20:03:56 silene Exp $*/
+/* $Id: scrollarea.cpp,v 1.4 2004/11/06 22:40:00 silene Exp $*/
 /*
    Copyright (C) 2004 by Guillaume Melquiond <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -101,6 +101,11 @@
        test_scrollbar();
 }
 
+void scrollarea::set_scroll_rate(unsigned r)
+{
+       scrollbar_.set_scroll_rate(r);
+}
+
 void scrollarea::process_event()
 {
        int grip_position = scrollbar_.get_position();
@@ -131,9 +136,9 @@
        SDL_MouseButtonEvent const &e = event.button;
        if (point_in_rect(e.x, e.y, inner_location()))
                if (e.button == SDL_BUTTON_WHEELDOWN)
-                       scrollbar_.move_position(1);
+                       scrollbar_.move_position(scrollbar_.scroll_rate_);
                else if (e.button == SDL_BUTTON_WHEELUP)
-                       scrollbar_.move_position(-1);
+                       scrollbar_.move_position(-scrollbar_.scroll_rate_);
 }
 
 }
Index: wesnoth/src/widgets/scrollarea.hpp
diff -u wesnoth/src/widgets/scrollarea.hpp:1.2 
wesnoth/src/widgets/scrollarea.hpp:1.3
--- wesnoth/src/widgets/scrollarea.hpp:1.2      Sat Nov  6 13:13:16 2004
+++ wesnoth/src/widgets/scrollarea.hpp  Sat Nov  6 22:40:00 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollarea.hpp,v 1.2 2004/11/06 13:13:16 silene Exp $ */
+/* $Id: scrollarea.hpp,v 1.3 2004/11/06 22:40:00 silene Exp $ */
 /*
    Copyright (C) 2004 by Guillaume Melquiond <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -47,6 +47,7 @@
        void move_position(int dep);
        void set_shown_size(unsigned h);
        void set_full_size(unsigned h);
+       void set_scroll_rate(unsigned r);
        bool has_scrollbar() const;
 
 private:
Index: wesnoth/src/widgets/scrollbar.cpp
diff -u wesnoth/src/widgets/scrollbar.cpp:1.20 
wesnoth/src/widgets/scrollbar.cpp:1.21
--- wesnoth/src/widgets/scrollbar.cpp:1.20      Sat Nov  6 13:13:16 2004
+++ wesnoth/src/widgets/scrollbar.cpp   Sat Nov  6 22:40:00 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.cpp,v 1.20 2004/11/06 13:13:16 silene Exp $*/
+/* $Id: scrollbar.cpp,v 1.21 2004/11/06 22:40:00 silene Exp $*/
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -40,7 +40,8 @@
        : widget(d), mid_scaled_(NULL), groove_scaled_(NULL),
          uparrow_(d, "", button::TYPE_TURBO, "uparrow-button"),
          downarrow_(d, "", button::TYPE_TURBO, "downarrow-button"),
-         state_(NORMAL), grip_position_(0), grip_height_(0), full_height_(0)
+         state_(NORMAL),
+         grip_position_(0), grip_height_(0), full_height_(0), scroll_rate_(1)
 {
        static const surface img(image::get_image(scrollbar_mid, 
image::UNSCALED));
        
@@ -124,12 +125,17 @@
        set_dirty(true);
 }
 
+void scrollbar::set_scroll_rate(unsigned r)
+{
+       scroll_rate_ = r;
+}
+
 void scrollbar::process_event()
 {
        if (uparrow_.pressed())
-               move_position(-1);
+               move_position(-scroll_rate_);
        if (downarrow_.pressed())
-               move_position(1);
+               move_position(scroll_rate_);
 }
 
 SDL_Rect scrollbar::groove_area() const
Index: wesnoth/src/widgets/scrollbar.hpp
diff -u wesnoth/src/widgets/scrollbar.hpp:1.10 
wesnoth/src/widgets/scrollbar.hpp:1.11
--- wesnoth/src/widgets/scrollbar.hpp:1.10      Sat Nov  6 13:13:16 2004
+++ wesnoth/src/widgets/scrollbar.hpp   Sat Nov  6 22:40:00 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.hpp,v 1.10 2004/11/06 13:13:16 silene Exp $ */
+/* $Id: scrollbar.hpp,v 1.11 2004/11/06 22:40:00 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -54,6 +54,9 @@
        /// Set the relative size of the scrollbar.
        void set_full_size(unsigned h);
 
+       /// Set scroll rate.
+       void set_scroll_rate(unsigned r);
+
 protected:
        virtual void update_location(SDL_Rect const &rect);
        virtual void handle_event(const SDL_Event& event);
@@ -72,7 +75,7 @@
 
        int minimum_grip_height_, mousey_on_grip_;
        // Relative data
-       int grip_position_, old_position_, grip_height_, full_height_;
+       int grip_position_, old_position_, grip_height_, full_height_, 
scroll_rate_;
 
        friend class scrollarea;
 };
Index: wesnoth/src/widgets/scrollpane.cpp
diff -u wesnoth/src/widgets/scrollpane.cpp:1.2 
wesnoth/src/widgets/scrollpane.cpp:1.3
--- wesnoth/src/widgets/scrollpane.cpp:1.2      Sat Nov  6 09:19:28 2004
+++ wesnoth/src/widgets/scrollpane.cpp  Sat Nov  6 22:40:00 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollpane.cpp,v 1.2 2004/11/06 09:19:28 silene Exp $ */
+/* $Id: scrollpane.cpp,v 1.3 2004/11/06 22:40:00 silene Exp $ */
 /*
    Copyright (C) 2004 by Philippe Plantier <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -36,6 +36,7 @@
        content_pos_.x = 0;
        content_pos_.y = 0;
        update_content_size();
+       set_scroll_rate(40);
 }
 
 void scrollpane::clear()




reply via email to

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