mail[Wesnoth-commits] r44646 - in /trunk/src/storyscreen: controller.cpp interface.cpp interface.hpp render.cpp render.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on July 24, 2010 - 19:15:
Author: silene
Date: Sat Jul 24 19:15:07 2010
New Revision: 44646

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44646&view=rev
Log:
Removed first and last storyscreen buttons.

Modified:
    trunk/src/storyscreen/controller.cpp
    trunk/src/storyscreen/interface.cpp
    trunk/src/storyscreen/interface.hpp
    trunk/src/storyscreen/render.cpp
    trunk/src/storyscreen/render.hpp

Modified: trunk/src/storyscreen/controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen/controller.cpp?rev=44646&r1=44645&r2=44646&view=diff
==============================================================================
--- trunk/src/storyscreen/controller.cpp (original)
+++ trunk/src/storyscreen/controller.cpp Sat Jul 24 19:15:07 2010
@@ -129,11 +129,9 @@
                return NEXT;
        }
 
-       gui::button first_button(disp_.video(),_("First") + std::string(" 
↞"));
-       gui::button last_button (disp_.video(),std::string("↠ ") + 
_("Last"));
        gui::button back_button (disp_.video(),std::string("← ")+ 
_("Back"));
        gui::button next_button (disp_.video(),_("Next") + std::string(" 
→"));
-       gui::button play_button (disp_.video(),_("Play") + std::string(" 
→"));
+       gui::button play_button (disp_.video(),_("Play") + std::string(" 
↠"));
 
        // Build renderer cache unless built for a low-memory environment;
        // caching the scaled backgrounds can take over a decent amount of 
memory.
@@ -141,7 +139,7 @@
        std::vector< render_pointer_type > uis_;
        foreach(part_pointer_type p, parts_) {
                ASSERT_LOG( p != NULL, "Ouch: hit NULL storyscreen part in 
collection" );
-               render_pointer_type const rpt(new part_ui(*p, disp_, 
next_button, back_button, first_button, last_button, play_button));
+               render_pointer_type const rpt(new part_ui(*p, disp_, 
next_button, back_button, play_button));
                uis_.push_back(rpt);
        }
 #endif
@@ -162,7 +160,7 @@
 #ifndef LOW_MEM
                part_ui &render_interface = *uis_[k];
 #else
-               part_ui render_interface(*parts_[k], disp_, next_button, 
back_button, first_button, last_button, play_button);
+               part_ui render_interface(*parts_[k], disp_, next_button, 
back_button, play_button);
 #endif
 
                LOG_NG << "displaying storyscreen part " << k+1 << " of " << 
parts_.size() << '\n';
@@ -170,9 +168,7 @@
                const bool first_page = (segment_index_ == 0) && (k == 0);
                const bool last_page  = (segment_index_ == total_segments_ - 
1) && (k == parts_.size() - 1);
 
-               first_button.enable(!first_page);
                back_button.enable(!first_page);
-               last_button.enable(!last_page);
                play_button.enable(last_page);
 
                switch(render_interface.show()) {
@@ -187,28 +183,6 @@
                                return BACK;
                        }
                        break;
-               case part_ui::FIRST:
-                       if(segment_index_ == 0) {
-                               // this is the first segment
-                               k = 0;
-                       }
-                       else {
-                               // we want to rewind all the way
-                               // to the last segment
-                               return FIRST;
-                       }
-                       break;
-               case part_ui::LAST:
-                       if(segment_index_ == total_segments_ - 1) {
-                               // not at the end of this segment
-                               k = parts_.size() - 1;
-                       }
-                       else {
-                               // we want to fast forward all the way
-                               // to the last segment
-                               return LAST;
-                       }
-                       break;
                case part_ui::QUIT:
                        return QUIT;
                default:

Modified: trunk/src/storyscreen/interface.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen/interface.cpp?rev=44646&r1=44645&r2=44646&view=diff
==============================================================================
--- trunk/src/storyscreen/interface.cpp (original)
+++ trunk/src/storyscreen/interface.cpp Sat Jul 24 19:15:07 2010
@@ -84,17 +84,6 @@
                                startpos = storyscreen::START_END;
                        }
                        break;
-               case storyscreen::LAST:
-                       itor = story.second;
-                       --itor;
-                       segment_count = total_segments - 1;
-                       startpos = storyscreen::START_END;
-                       break;
-               case storyscreen::FIRST:
-                       itor = story.first;
-                       segment_count = 0;
-                       startpos = storyscreen::START_BEGINNING;
-                       break;
                case storyscreen::QUIT:
                        return storyscreen::QUIT;
                default:

Modified: trunk/src/storyscreen/interface.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen/interface.hpp?rev=44646&r1=44645&r2=44646&view=diff
==============================================================================
--- trunk/src/storyscreen/interface.hpp (original)
+++ trunk/src/storyscreen/interface.hpp Sat Jul 24 19:15:07 2010
@@ -33,8 +33,6 @@
 enum STORY_RESULT {
        NEXT,
        BACK,
-       FIRST,
-       LAST,
        QUIT
 };
 
@@ -60,7 +58,6 @@
  * be displayed in turn, with the user able to go to the next part, or skip
  * it entirely.
  * @return is NEXT if the segment played to the end, BACK if the segment 
played to the beginning,
- * FIRST if a skip to the first segment is requested, LAST if a skip to the 
last segment is requested,
  * and QUIT if the story was quit
  */
 storyscreen::STORY_RESULT show_storyscreen(display& disp, const vconfig& 
story_cfg,

Modified: trunk/src/storyscreen/render.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen/render.cpp?rev=44646&r1=44645&r2=44646&view=diff
==============================================================================
--- trunk/src/storyscreen/render.cpp (original)
+++ trunk/src/storyscreen/render.cpp Sat Jul 24 19:15:07 2010
@@ -81,18 +81,14 @@
 
 namespace storyscreen {
 
-part_ui::part_ui(part& p, display& disp,
-                gui::button& next_button, gui::button& back_button,
-                gui::button& first_button, gui::button& last_button,
-                gui::button& play_button)
+part_ui::part_ui(part &p, display &disp, gui::button &next_button,
+       gui::button &back_button, gui::button&play_button)
        : p_(p)
        , disp_(disp)
        , video_(disp.video())
        , keys_()
        , next_button_(next_button)
        , back_button_(back_button)
-       , first_button_(first_button)
-       , last_button_(last_button)
        , play_button_(play_button)
        , ret_(NEXT)
        , scale_factor_(1.0)
@@ -145,10 +141,8 @@
        buttons_x_ = video_.getx() - 50;
        buttons_y_ = base_rect_.y + base_rect_.h - 20;
 
-       next_button_.set_location(buttons_x_, buttons_y_ - 60);
-       back_button_.set_location(buttons_x_, buttons_y_ - 40);
-       first_button_.set_location(buttons_x_, buttons_y_ - 20);
-       last_button_.set_location(buttons_x_, buttons_y_);
+       next_button_.set_location(buttons_x_, buttons_y_ - 40);
+       back_button_.set_location(buttons_x_, buttons_y_ - 20);
        play_button_.set_location(buttons_x_, buttons_y_);
 
 #else // elif !defined(USE_TINY_GUI)
@@ -172,18 +166,14 @@
                buttons_y_ = video_.gety() - 40;
                break;
        }
-       next_button_.set_location(buttons_x_, buttons_y_ - 90);
-       back_button_.set_location(buttons_x_, buttons_y_ - 60);
-       first_button_.set_location(buttons_x_, buttons_y_ - 30);
-       last_button_.set_location(buttons_x_, buttons_y_);
+       next_button_.set_location(buttons_x_, buttons_y_ - 60);
+       back_button_.set_location(buttons_x_, buttons_y_ - 30);
        play_button_.set_location(buttons_x_, buttons_y_);
 #endif
 
-    next_button_.set_volatile(true);
-    play_button_.set_volatile(true);
-    back_button_.set_volatile(true);
-    first_button_.set_volatile(true);
-    last_button_.set_volatile(true);
+       next_button_.set_volatile(true);
+       play_button_.set_volatile(true);
+       back_button_.set_volatile(true);
 }
 
 void part_ui::prepare_floating_images()
@@ -224,19 +214,9 @@
                        for(unsigned i = 0; i != 50; ++i) {
                                const bool next_keydown = keys_[SDLK_SPACE] 
|| keys_[SDLK_RETURN] || keys_[SDLK_KP_ENTER] || keys_[SDLK_RIGHT];
                                const bool play_keydown = keys_[SDLK_ESCAPE] 
&& !play_button_.hidden();
-                               const bool last_keydown = (keys_[SDLK_ESCAPE] 
&& play_button_.hidden()) || keys_[SDLK_END] || keys_[SDLK_DOWN];
-                               const bool first_keydown = keys_[SDLK_HOME] 
|| keys_[SDLK_UP];
                                const bool back_keydown = 
keys_[SDLK_BACKSPACE] || keys_[SDLK_LEFT];
 
-                               if((last_keydown && !last_key) || 
last_button_.pressed()) {
-                                       ret_ = LAST;
-                                       return false;
-                               }
-                               else if((first_keydown && !last_key) || 
first_button_.pressed()) {
-                                       ret_ = FIRST;
-                                       return false;
-                               }
-                               else if(((next_keydown || play_keydown) && 
!last_key) || next_button_.pressed() || play_button_.pressed()) {
+                               if (((next_keydown || play_keydown) && 
!last_key) || next_button_.pressed() || play_button_.pressed()) {
                                        ret_ = NEXT;
                                        return false;
                                }
@@ -245,7 +225,7 @@
                                        return false;
                                }
 
-                               last_key = next_keydown || play_keydown || 
last_keydown || first_keydown || back_keydown;
+                               last_key = next_keydown || play_keydown || 
back_keydown;
 
                                disp_.delay(fi.display_delay() / 50);
 
@@ -272,7 +252,6 @@
 
                if(keys_[SDLK_ESCAPE] ||
                   next_button_.pressed()  || back_button_.pressed() ||
-                  first_button_.pressed() || last_button_.pressed() ||
                   play_button_.pressed()) {
                        skip = true;
                        ++fi_n;
@@ -472,13 +451,9 @@
                const bool next_hidden = next_button_.hidden();
                const bool back_hidden = back_button_.hidden();
                const bool play_hidden = play_button_.hidden();
-               const bool first_hidden = first_button_.hidden();
-               const bool last_hidden = last_button_.hidden();
 
                next_button_.hide();
                back_button_.hide();
-               first_button_.hide();
-               last_button_.hide();
                play_button_.hide();
 
 #ifndef LOW_MEM
@@ -499,10 +474,6 @@
                next_button_.hide(next_hidden);
                back_button_.set_location(back_button_.location());
                back_button_.hide(back_hidden);
-               first_button_.set_location(first_button_.location());
-               first_button_.hide(first_hidden);
-               last_button_.set_location(last_button_.location());
-               last_button_.hide(last_hidden);
                play_button_.set_location(play_button_.location());
                play_button_.hide(play_hidden);
        }
@@ -531,13 +502,10 @@
                        update_rect(dstrect);
                        ++scan.y;
                }
-               next_button_.hide(next_button_.hidden() || (scan_finished && 
last_button_.hidden()));
 
                const bool next_keydown  = keys_[SDLK_SPACE] || 
keys_[SDLK_RETURN] || keys_[SDLK_KP_ENTER] || keys_[SDLK_RIGHT];
                const bool back_keydown  = keys_[SDLK_BACKSPACE] || 
keys_[SDLK_LEFT];
                const bool play_keydown  = keys_[SDLK_ESCAPE] && 
!play_button_.hidden();
-               const bool last_keydown  = (keys_[SDLK_ESCAPE] && 
play_button_.hidden()) || keys_[SDLK_END] || keys_[SDLK_DOWN];
-               const bool first_keydown = keys_[SDLK_HOME] || keys_[SDLK_UP];
 
                if((next_keydown && !last_key) || next_button_.pressed()) {
                        if(skip == true || scan_finished) {
@@ -558,17 +526,7 @@
                        break;
                }
 
-               if((last_keydown && !last_key) || last_button_.pressed()) {
-                       ret_ = LAST;
-                       return;
-               }
-
-               if((first_keydown && !last_key) || first_button_.pressed()) {
-                       ret_ = FIRST;
-                       return;
-               }
-
-               last_key = next_keydown || back_keydown || play_keydown || 
last_keydown || first_keydown;
+               last_key = next_keydown || back_keydown || play_keydown;
 
                events::pump();
                events::raise_process_event();
@@ -591,12 +549,9 @@
        LOG_NG << "ENTER part_ui()::wait_for_input()\n";
 
        bool last_key = true;
-       next_button_.hide(next_button_.hidden() || last_button_.hidden());
        while(true) {
                const bool next_keydown = keys_[SDLK_SPACE] || 
keys_[SDLK_RETURN] || keys_[SDLK_KP_ENTER] || keys_[SDLK_RIGHT];
                const bool play_keydown = keys_[SDLK_ESCAPE] && 
!play_button_.hidden();
-               const bool last_keydown = (keys_[SDLK_ESCAPE] && 
play_button_.hidden()) || keys_[SDLK_END] || keys_[SDLK_DOWN];
-               const bool first_keydown = keys_[SDLK_HOME] || keys_[SDLK_UP];
                const bool back_keydown = keys_[SDLK_BACKSPACE] || 
keys_[SDLK_LEFT];
 
                if(((next_keydown || play_keydown) && !last_key) || 
next_button_.pressed() || play_button_.pressed()) {
@@ -609,18 +564,7 @@
                        break;
                }
 
-
-               if((last_keydown && !last_key) || last_button_.pressed()) {
-                       ret_ = LAST;
-                       return;
-               }
-
-               if((first_keydown && !last_key) || first_button_.pressed()) {
-                       ret_ = FIRST;
-                       return;
-               }
-
-               last_key = next_keydown || back_keydown || first_keydown || 
last_keydown || play_keydown;
+               last_key = next_keydown || back_keydown || play_keydown;
 
                events::pump();
                events::raise_process_event();

Modified: trunk/src/storyscreen/render.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen/render.hpp?rev=44646&r1=44645&r2=44646&view=diff
==============================================================================
--- trunk/src/storyscreen/render.hpp (original)
+++ trunk/src/storyscreen/render.hpp Sat Jul 24 19:15:07 2010
@@ -46,8 +46,6 @@
        enum RESULT {
                NEXT,   /**< The user pressed the go-next button. */
                BACK,   /**< The user pressed the go-back button. */
-               FIRST,  /**< The user pressed the go-first button. */
-               LAST,   /**< The user pressed the go-last button. */
                QUIT    /**< The user selected quit. */
        };
 
@@ -58,10 +56,8 @@
         * @param next_button Next button. Shouldn't be destroyed before the 
part_ui object.
         * @param skip_button Skip button. Shouldn't be destroyed before the 
part_ui object.
         */
-        part_ui(part& p, display& disp,
-                gui::button& next_button,  gui::button& back_button,
-                gui::button& first_button, gui::button& last_button,
-               gui::button& play_button);
+       part_ui(part &p, display &disp, gui::button &next_button,
+               gui::button &back_button, gui::button& play_button);
 
        /**
         * Render and display the storyscreen, process and return user input.
@@ -76,8 +72,6 @@
 
        gui::button& next_button_;
        gui::button& back_button_;
-       gui::button& first_button_;
-       gui::button& last_button_;
        gui::button& play_button_;
 
        RESULT ret_;




Related Messages


Powered by MHonArc, Updated Sat Jul 24 19:20:14 2010