Author: shadowmaster
Date: Mon Apr 27 23:54:21 2009
New Revision: 35275

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35275&view=rev
Log:
Revert to storyscreen page -> part convention in new storyscreen code
(part 3).

Added:
    trunk/src/storyscreen/part.cpp
      - copied, changed from r35274, trunk/src/storyscreen/page.cpp
    trunk/src/storyscreen/part.hpp
      - copied, changed from r35274, trunk/src/storyscreen/page.hpp
Removed:
    trunk/src/storyscreen/page.cpp
    trunk/src/storyscreen/page.hpp
Modified:
    trunk/src/CMakeLists.txt
    trunk/src/Makefile.am
    trunk/src/SConscript

Modified: trunk/src/CMakeLists.txt
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/CMakeLists.txt?rev=35275&r1=35274&r2=35275&view=diff
==============================================================================
--- trunk/src/CMakeLists.txt (original)
+++ trunk/src/CMakeLists.txt Mon Apr 27 23:54:21 2009
@@ -322,7 +322,7 @@
     statistics_dialog.cpp
     storyscreen/interface.cpp
     storyscreen/controller.cpp
-    storyscreen/page.cpp
+    storyscreen/part.cpp
     storyscreen/render.cpp
     team.cpp
     terrain_filter.cpp

Modified: trunk/src/Makefile.am
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/Makefile.am?rev=35275&r1=35274&r2=35275&view=diff
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Mon Apr 27 23:54:21 2009
@@ -152,7 +152,7 @@
        statistics_dialog.cpp \
        storyscreen/interface.cpp \
        storyscreen/controller.cpp \
-       storyscreen/page.cpp \
+       storyscreen/part.cpp \
        storyscreen/render.cpp \
        team.cpp \
        terrain_filter.cpp \

Modified: trunk/src/SConscript
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/SConscript?rev=35275&r1=35274&r2=35275&view=diff
==============================================================================
--- trunk/src/SConscript (original)
+++ trunk/src/SConscript Mon Apr 27 23:54:21 2009
@@ -207,7 +207,7 @@
     statistics_dialog.cpp
     storyscreen/interface.cpp
     storyscreen/controller.cpp
-    storyscreen/page.cpp
+    storyscreen/part.cpp
     storyscreen/render.cpp
     team.cpp
     terrain_filter.cpp

Removed: trunk/src/storyscreen/page.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen/page.cpp?rev=35274&view=auto
==============================================================================
--- trunk/src/storyscreen/page.cpp (original)
+++ trunk/src/storyscreen/page.cpp (removed)
@@ -1,251 +1,0 @@
-/* $Id$ */
-/*
-   Copyright (C) 2009 by Ignacio R. Morelle <[email protected]>
-   Part of the Battle for Wesnoth Project http://www.wesnoth.org/
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License version 2
-   or at your option any later version.
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY.
-
-   See the COPYING file for more details.
-*/
-
-/**
- * @file storyscreen/part.cpp
- * Storyscreen parts and floating images representation.
- */
-
-#include "global.hpp"
-#include "asserts.hpp"
-#include "foreach.hpp"
-#include "log.hpp"
-#include "storyscreen/part.hpp"
-
-#include "config.hpp"
-#include "gamestatus.hpp"
-#include "game_events.hpp"
-#include "image.hpp"
-#include "serialization/string_utils.hpp"
-#include "util.hpp"
-#include "variable.hpp"
-#include "video.hpp"
-
-// TODO: remove when completed
-#include "stub.hpp"
-
-namespace storyscreen {
-
-floating_image::floating_image()
-       : file_()
-       , x_(0)
-       , y_(0)
-       , delay_(0)
-       , autoscaled_(false)
-       , centered_(false)
-{
-}
-
-floating_image::floating_image(const floating_image& fi)
-       : file_()
-       , x_(0)
-       , y_(0)
-       , delay_(0)
-       , autoscaled_(false)
-       , centered_(false)
-{
-       this->assign(fi);
-}
-
-floating_image::floating_image(const config& cfg)
-       : file_(cfg["file"])
-       , x_(lexical_cast_default<int>(cfg["x"]))
-       , y_(lexical_cast_default<int>(cfg["y"]))
-       , delay_(lexical_cast_default<int>(cfg["delay"]))
-       , autoscaled_(utils::string_bool(cfg["scaled"], false))
-       , centered_(utils::string_bool(cfg["centered"], false))
-{
-}
-
-void floating_image::assign(const floating_image& fi)
-{
-       if(&fi == this)
-               return;
-
-       file_ = fi.file_; x_ = fi.x_; y_ = fi.y_; delay_ = fi.delay_;
-       autoscaled_ = fi.autoscaled_; centered_ = fi.centered_;
-}
-
-floating_image::render_input floating_image::get_render_input(double scale, 
SDL_Rect& dst_rect) const
-{
-       render_input ri = {
-               {0,0,0,0},
-               file_.empty() ? NULL : image::get_image(file_)
-       };
-
-       if(!ri.image.null()) {
-               if(autoscaled_) {
-                       ri.image = scale_surface(
-                               ri.image,
-                               static_cast<int>(ri.image->w * scale),
-                               static_cast<int>(ri.image->h * scale)
-                       );
-               }
-
-               ri.rect.x = static_cast<int>(x_*scale) + dst_rect.x;
-               ri.rect.y = static_cast<int>(y_*scale) + dst_rect.y;
-               ri.rect.w = ri.image->w;
-               ri.rect.h = ri.image->h;
-
-               if(centered_) {
-                       ri.rect.x -= ri.rect.w / 2;
-                       ri.rect.y -= ri.rect.h / 2;
-               }
-       }
-       return ri;
-}
-
-page::page()
-       : scale_background_()
-       , background_file_()
-       , show_title_()
-       , text_()
-       , text_title_()
-       , text_block_loc_()
-       , title_alignment_()
-       , music_()
-       , floating_images_()
-{
-       ASSERT_LOG(0xDEADBEEF == 0x0, "Ouch: shouldn't happen");
-}
-
-page::page(game_state& state_of_game, const vconfig& page_cfg)
-       : scale_background_(true)
-       , background_file_()
-       , show_title_()
-       , text_()
-       , text_title_()
-       , text_block_loc_(text_block_loc_)
-       , title_alignment_(title_alignment_)
-       , music_()
-       , floating_images_()
-{
-       // This method takes care of initializing
-       // and branching properties.
-       resolve_wml(page_cfg, state_of_game);
-}
-
-page::TEXT_BLOCK_LOCATION page::string_tblock_loc(const std::string& s)
-{
-       if(s.empty() != true) {
-               if(s == "top") {
-                       return page::TOP;
-               }
-               else if(s == "centered" || s == "center" || s == "middle") {
-                       return page::MIDDLE;
-               }
-       }
-       return page::BOTTOM;
-}
-
-page::TITLE_ALIGNMENT page::string_title_align(const std::string& s)
-{
-       if(s.empty() != true) {
-               if(s == "right") {
-                       return page::RIGHT;
-               }
-               else if(s == "centered" || s == "center" || s == "middle") {
-                       return page::CENTERED;
-               }
-       }
-       return page::LEFT;
-}
-
-void page::resolve_wml(const vconfig& cfg, game_state& gamestate)
-{
-       if(cfg.has_attribute("background")) {
-               background_file_ = cfg["background"];
-       }
-       if(cfg.has_attribute("scale_background")) {
-               scale_background_ = utils::string_bool(cfg["scale_background"], 
true);
-       }
-       if(cfg.has_attribute("show_title")) {
-               show_title_ = utils::string_bool(cfg["show_title"]);
-       }
-       if(cfg.has_attribute("story")) {
-               text_ = cfg["story"];
-       }
-       if(cfg.has_attribute("title")) {
-               text_title_ = cfg["title"];
-       }
-       if(cfg.has_attribute("text_layout")) {
-               text_block_loc_ = string_tblock_loc(cfg["text_layout"]);
-       }
-       if(cfg.has_attribute("title_alignment")) {
-               title_alignment_ = string_title_align(cfg["title_alignment"]);
-       }
-       if(cfg.has_attribute("music")) {
-               music_ = cfg["music"];
-       }
-
-       // Execution flow/branching/[image]
-       for(vconfig::all_children_iterator i = cfg.ordered_begin(); i != 
cfg.ordered_end(); ++ i) {
-               // i->first and i->second are goddamn temporaries; do not make 
references
-               const std::string key = i->first;
-               const vconfig node = i->second;
-
-               // [image]
-               if(key == "image") {
-                       floating_images_.push_back(node.get_parsed_config());
-               }
-               // [if]
-               else if(key == "if") {
-                       const std::string branch_label =
-                               game_events::conditional_passed(NULL, node) ?
-                               "then" : "else";
-                       const vconfig branch = node.child(branch_label);
-                       resolve_wml(branch, gamestate);
-               }
-               // [switch]
-               else if(key == "switch") {
-                       const std::string var_name = node["variable"];
-                       const std::string var_actual_value = 
gamestate.get_variable_const(var_name);
-                       bool case_not_found = true;
-
-                       for(vconfig::all_children_iterator j = 
node.ordered_begin(); j != node.ordered_end(); ++j) {
-                               if(j->first != "case") continue;
-
-                               // Enter all matching cases.
-                               const std::string var_expected_value = 
(j->second)["value"];
-                           if(var_actual_value == var_expected_value) {
-                                       case_not_found = false;
-                                       resolve_wml(j->second, gamestate);
-                           }
-                       }
-
-                       if(case_not_found) {
-                               for(vconfig::all_children_iterator j = 
node.ordered_begin(); j != node.ordered_end(); ++j) {
-                                       if(j->first != "else") continue;
-
-                                       // Enter all elses.
-                                       resolve_wml(j->second, gamestate);
-                               }
-                       }
-               }
-               // [deprecated_message]
-               else if(key == "deprecated_message") {
-                       // Won't appear until the scenario start event finishes.
-                       
game_events::handle_deprecated_message(node.get_parsed_config());
-               }
-               // [wml_message]
-               else if(key == "wml_message") {
-                       // Pass to game events handler. As with 
[deprecated_message],
-                       // it won't appear until the scenario start event is 
complete.
-                       
game_events::handle_wml_log_message(node.get_parsed_config());
-               }
-       }
-}
-
-} // end namespace storyscreen
-

Removed: trunk/src/storyscreen/page.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen/page.hpp?rev=35274&view=auto
==============================================================================
--- trunk/src/storyscreen/page.hpp (original)
+++ trunk/src/storyscreen/page.hpp (removed)
@@ -1,146 +1,0 @@
-/* $Id$ */
-/*
-   Copyright (C) 2009 by Ignacio R. Morelle <[email protected]>
-   Part of the Battle for Wesnoth Project http://www.wesnoth.org/
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License version 2
-   or at your option any later version.
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY.
-
-   See the COPYING file for more details.
-*/
-
-/**
- * @file storyscreen/part.hpp
- * Storyscreen parts and floating images representation.
- */
-
-#ifndef STORYSCREEN_PART_HPP_INCLUDED
-#define STORYSCREEN_PART_HPP_INCLUDED
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "sdl_utils.hpp"
-
-class config;
-class vconfig;
-class display;
-class game_state;
-
-namespace storyscreen {
-
-/**
- * Represents and contains informations about image labels used
- * in story screen pages.
- */
-class floating_image
-{
-public:
-       struct render_input
-       {
-               SDL_Rect rect;  /**< Corrected rectangle for rendering surf. */
-               surface image;  /**< Surface, scaled if required. */
-       };
-
-       floating_image();
-       floating_image(const config& cfg);
-       floating_image(const floating_image& fi);
-
-       void assign(const floating_image& fi);
-
-       floating_image& operator=(const floating_image& fi) {
-               assign(fi);
-               return *this;
-       }
-
-       /** Returns the referential X coordinate of the image. */
-       int ref_x() const { return x_; }
-       /** Returns the referential Y coordinate of the image. */
-       int ref_y() const { return y_; }
-
-       bool autoscale() const { return autoscaled_; }
-       bool centered() const  { return centered_; }
-
-       /** Delay before displaying, in milliseconds. */
-       int display_delay() const { return delay_; }
-
-       /** Render. */
-       render_input get_render_input(double scale, SDL_Rect& dst_rect) const;
-
-private:
-       std::string file_;
-       int x_, y_; // referential (non corrected) x,y
-       int delay_;
-       bool autoscaled_;
-       bool centered_;
-};
-
-/**
- * Represents and contains information about a single storyscreen page.
- */
-class page
-{
-public:
-       enum TEXT_BLOCK_LOCATION {
-               TOP,
-               MIDDLE,
-               BOTTOM
-       };
-       enum TITLE_ALIGNMENT {
-               LEFT, CENTERED, RIGHT
-       };
-       enum RESULT {
-               NEXT,
-               SKIP,
-               QUIT
-       };
-
-       page(game_state& state_of_game, const vconfig& page_cfg);
-
-       bool scale_background() const { return scale_background_; }
-       const std::string& background() const { return background_file_; }
-
-       bool show_title() const { return show_title_; }
-       const std::string& text() const { return text_; }
-       const std::string& title() const { return text_title_; }
-       const std::string& music() const { return music_; }
-
-       void set_text(const std::string& text) { text_ = text; }
-       void set_title(const std::string& title) { text_title_ = title; }
-
-       const std::vector<floating_image> get_floating_images() const {
-               return floating_images_;
-       }
-
-private:
-       page();
-
-       void resolve_wml(const vconfig& cfg, game_state& gamestate);
-
-       static TEXT_BLOCK_LOCATION string_tblock_loc(const std::string& s);
-       static TITLE_ALIGNMENT string_title_align(const std::string& s);
-
-       bool scale_background_;
-       std::string background_file_;
-
-       bool show_title_;
-       std::string text_;
-       std::string text_title_;
-       TEXT_BLOCK_LOCATION text_block_loc_;
-       TITLE_ALIGNMENT title_alignment_;
-
-       std::string music_;
-
-       std::vector<floating_image> floating_images_;
-
-       friend class page_ui;
-};
-
-} // end namespace storyscreen
-
-
-#endif /* ! STORYSCREEN_PART_HPP_INCLUDED */

Copied: trunk/src/storyscreen/part.cpp (from r35274, 
trunk/src/storyscreen/page.cpp)
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen/part.cpp?p2=trunk/src/storyscreen/part.cpp&p1=trunk/src/storyscreen/page.cpp&r1=35274&r2=35275&rev=35275&view=diff
==============================================================================
    (empty)

Copied: trunk/src/storyscreen/part.hpp (from r35274, 
trunk/src/storyscreen/page.hpp)
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen/part.hpp?p2=trunk/src/storyscreen/part.hpp&p1=trunk/src/storyscreen/page.hpp&r1=35274&r2=35275&rev=35275&view=diff
==============================================================================
    (empty)


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to