Author: mordante
Date: Sun Jan 10 19:56:13 2010
New Revision: 40658
URL: http://svn.gna.org/viewcvs/wesnoth?rev=40658&view=rev
Log:
Move tslider_definition to a new file.
Added:
trunk/src/gui/auxiliary/widget_definition/slider.cpp (with props)
trunk/src/gui/auxiliary/widget_definition/slider.hpp (with props)
Modified:
trunk/po/wesnoth-lib/POTFILES.in
trunk/src/CMakeLists.txt
trunk/src/Makefile.am
trunk/src/SConscript
trunk/src/gui/widgets/settings.cpp
trunk/src/gui/widgets/settings.hpp
trunk/src/gui/widgets/slider.cpp
Modified: trunk/po/wesnoth-lib/POTFILES.in
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/po/wesnoth-lib/POTFILES.in?rev=40658&r1=40657&r2=40658&view=diff
==============================================================================
--- trunk/po/wesnoth-lib/POTFILES.in (original)
+++ trunk/po/wesnoth-lib/POTFILES.in Sun Jan 10 19:56:13 2010
@@ -22,6 +22,7 @@
src/gui/auxiliary/widget_definition/repeating_button.cpp
src/gui/auxiliary/widget_definition/scroll_label.cpp
src/gui/auxiliary/widget_definition/scrollbar_panel.cpp
+src/gui/auxiliary/widget_definition/slider.cpp
src/gui/auxiliary/widget_definition/vertical_scrollbar.cpp
src/gui/auxiliary/window_builder/button.cpp
src/gui/auxiliary/window_builder/control.cpp
Modified: trunk/src/CMakeLists.txt
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/CMakeLists.txt?rev=40658&r1=40657&r2=40658&view=diff
==============================================================================
--- trunk/src/CMakeLists.txt (original)
+++ trunk/src/CMakeLists.txt Sun Jan 10 19:56:13 2010
@@ -238,6 +238,7 @@
gui/auxiliary/widget_definition/repeating_button.cpp
gui/auxiliary/widget_definition/scroll_label.cpp
gui/auxiliary/widget_definition/scrollbar_panel.cpp
+ gui/auxiliary/widget_definition/slider.cpp
gui/auxiliary/widget_definition/vertical_scrollbar.cpp
gui/auxiliary/window_builder/button.cpp
gui/auxiliary/window_builder/control.cpp
Modified: trunk/src/Makefile.am
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/Makefile.am?rev=40658&r1=40657&r2=40658&view=diff
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Sun Jan 10 19:56:13 2010
@@ -118,6 +118,7 @@
gui/auxiliary/widget_definition/repeating_button.cpp \
gui/auxiliary/widget_definition/scroll_label.cpp \
gui/auxiliary/widget_definition/scrollbar_panel.cpp \
+ gui/auxiliary/widget_definition/slider.cpp \
gui/auxiliary/widget_definition/vertical_scrollbar.cpp \
gui/auxiliary/window_builder/button.cpp \
gui/auxiliary/window_builder/control.cpp \
Modified: trunk/src/SConscript
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/SConscript?rev=40658&r1=40657&r2=40658&view=diff
==============================================================================
--- trunk/src/SConscript (original)
+++ trunk/src/SConscript Sun Jan 10 19:56:13 2010
@@ -279,6 +279,7 @@
gui/auxiliary/widget_definition/scroll_label.cpp
gui/auxiliary/widget_definition/vertical_scrollbar.cpp
gui/auxiliary/widget_definition/scrollbar_panel.cpp
+ gui/auxiliary/widget_definition/slider.cpp
gui/auxiliary/window_builder/button.cpp
gui/auxiliary/window_builder/control.cpp
gui/auxiliary/window_builder/helper.cpp
Added: trunk/src/gui/auxiliary/widget_definition/slider.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/auxiliary/widget_definition/slider.cpp?rev=40658&view=auto
==============================================================================
--- trunk/src/gui/auxiliary/widget_definition/slider.cpp (added)
+++ trunk/src/gui/auxiliary/widget_definition/slider.cpp Sun Jan 10 19:56:13
2010
@@ -1,0 +1,85 @@
+/* $Id$ */
+/*
+ Copyright (C) 2007 - 2010 by Mark de Wever <[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.
+*/
+
+#define GETTEXT_DOMAIN "wesnoth-lib"
+
+#include "gui/auxiliary/widget_definition/slider.hpp"
+
+#include "gui/auxiliary/log.hpp"
+#include "wml_exception.hpp"
+
+namespace gui2 {
+
+tslider_definition::tslider_definition(const config& cfg)
+ : tcontrol_definition(cfg)
+{
+ DBG_GUI_P << "Parsing slider " << id << '\n';
+
+ load_resolutions<tresolution>(cfg);
+}
+
+tslider_definition::tresolution::tresolution(const config& cfg)
+ : tresolution_definition_(cfg)
+ , minimum_positioner_length(
+
lexical_cast_default<unsigned>(cfg["minimum_positioner_length"]))
+ , maximum_positioner_length(
+
lexical_cast_default<unsigned>(cfg["maximum_positioner_length"]))
+ , left_offset(lexical_cast_default<unsigned>(cfg["left_offset"]))
+ , right_offset(lexical_cast_default<unsigned>(cfg["right_offset"]))
+{
+/*WIKI
+ * @page = GUIWidgetDefinitionWML
+ * @order = 1_slider
+ *
+ * == Slider ==
+ *
+ * @macro = slider_description
+ *
+ * @start_table = config
+ * minimum_positioner_length (unsigned)
+ * The minumum size the positioner is
+ * allowed to be. The engine needs to know
+ * this in order to calculate the best size
+ * for the positioner.
+ * maximum_positioner_length (unsigned = 0)
+ * The maximum size the positioner is
+ * allowed to be. If minimum and maximum
are
+ * the same value the positioner is fixed
+ * size. If the maximum is 0 (and the
+ * minimum not) there's no maximum.
+ * left_offset (unsigned = 0) The number of pixels at the left side
+ * which can't be used by the positioner.
+ * right_offset (unsigned = 0) The number of pixels at the right side
+ * which can't be used by the positioner.
+ * @end_table
+ *
+ * The following states exist:
+ * * state_enabled, the slider is enabled.
+ * * state_disabled, the slider is disabled.
+ * * state_pressed, the left mouse button is down on the positioner of the
slider.
+ * * state_focussed, the mouse is over the positioner of the slider.
+ */
+
+ VALIDATE(minimum_positioner_length,
+ missing_mandatory_wml_key("resolution",
"minimum_positioner_length"));
+
+ // Note the order should be the same as the enum tstate is slider.hpp.
+ state.push_back(tstate_definition(cfg.child("state_enabled")));
+ state.push_back(tstate_definition(cfg.child("state_disabled")));
+ state.push_back(tstate_definition(cfg.child("state_pressed")));
+ state.push_back(tstate_definition(cfg.child("state_focussed")));
+}
+
+} // namespace gui2
+
Propchange: trunk/src/gui/auxiliary/widget_definition/slider.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/gui/auxiliary/widget_definition/slider.cpp
------------------------------------------------------------------------------
svn:keywords = r"Author Date Id Revision"
Added: trunk/src/gui/auxiliary/widget_definition/slider.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/auxiliary/widget_definition/slider.hpp?rev=40658&view=auto
==============================================================================
--- trunk/src/gui/auxiliary/widget_definition/slider.hpp (added)
+++ trunk/src/gui/auxiliary/widget_definition/slider.hpp Sun Jan 10 19:56:13
2010
@@ -1,0 +1,43 @@
+/* $Id$ */
+/*
+ Copyright (C) 2007 - 2010 by Mark de Wever <[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.
+*/
+
+#ifndef GUI_AUXILIARY_WIDGET_DEFINITION_SLIDER_HPP_INCLUDED
+#define GUI_AUXILIARY_WIDGET_DEFINITION_SLIDER_HPP_INCLUDED
+
+#include "gui/auxiliary/widget_definition.hpp"
+
+namespace gui2 {
+
+struct tslider_definition
+ : public tcontrol_definition
+{
+ explicit tslider_definition(const config& cfg);
+
+ struct tresolution
+ : public tresolution_definition_
+ {
+ explicit tresolution(const config& cfg);
+
+ unsigned minimum_positioner_length;
+ unsigned maximum_positioner_length;
+
+ unsigned left_offset;
+ unsigned right_offset;
+ };
+};
+
+} // namespace gui2
+
+#endif
+
Propchange: trunk/src/gui/auxiliary/widget_definition/slider.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/gui/auxiliary/widget_definition/slider.hpp
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: trunk/src/gui/widgets/settings.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/settings.cpp?rev=40658&r1=40657&r2=40658&view=diff
==============================================================================
--- trunk/src/gui/widgets/settings.cpp (original)
+++ trunk/src/gui/widgets/settings.cpp Sun Jan 10 19:56:13 2010
@@ -37,6 +37,7 @@
#include "gui/auxiliary/widget_definition/repeating_button.hpp"
#include "gui/auxiliary/widget_definition/scroll_label.hpp"
#include "gui/auxiliary/widget_definition/scrollbar_panel.hpp"
+#include "gui/auxiliary/widget_definition/slider.hpp"
#include "gui/auxiliary/widget_definition/vertical_scrollbar.hpp"
#include "gui/widgets/window.hpp"
#include "serialization/parser.hpp"
@@ -453,66 +454,6 @@
canvas.set_cfg(draw);
}
-tslider_definition::tslider_definition(const config& cfg) :
- tcontrol_definition(cfg)
-{
- DBG_GUI_P << "Parsing slider " << id << '\n';
-
- load_resolutions<tresolution>(cfg);
-}
-
-tslider_definition::tresolution::tresolution(const config& cfg) :
- tresolution_definition_(cfg),
- minimum_positioner_length(
-
lexical_cast_default<unsigned>(cfg["minimum_positioner_length"])),
- maximum_positioner_length(
-
lexical_cast_default<unsigned>(cfg["maximum_positioner_length"])),
- left_offset(lexical_cast_default<unsigned>(cfg["left_offset"])),
- right_offset(lexical_cast_default<unsigned>(cfg["right_offset"]))
-{
-/*WIKI
- * @page = GUIWidgetDefinitionWML
- * @order = 1_slider
- *
- * == Slider ==
- *
- * @macro = slider_description
- *
- * @start_table = config
- * minimum_positioner_length (unsigned)
- * The minumum size the positioner is
- * allowed to be. The engine needs to know
- * this in order to calculate the best size
- * for the positioner.
- * maximum_positioner_length (unsigned = 0)
- * The maximum size the positioner is
- * allowed to be. If minimum and maximum
are
- * the same value the positioner is fixed
- * size. If the maximum is 0 (and the
- * minimum not) there's no maximum.
- * left_offset (unsigned = 0) The number of pixels at the left side
- * which can't be used by the positioner.
- * right_offset (unsigned = 0) The number of pixels at the right side
- * which can't be used by the positioner.
- * @end_table
- *
- * The following states exist:
- * * state_enabled, the slider is enabled.
- * * state_disabled, the slider is disabled.
- * * state_pressed, the left mouse button is down on the positioner of the
slider.
- * * state_focussed, the mouse is over the positioner of the slider.
- */
-
- VALIDATE(minimum_positioner_length,
- missing_mandatory_wml_key("resolution",
"minimum_positioner_length"));
-
- // Note the order should be the same as the enum tstate is slider.hpp.
- state.push_back(tstate_definition(cfg.child("state_enabled")));
- state.push_back(tstate_definition(cfg.child("state_disabled")));
- state.push_back(tstate_definition(cfg.child("state_pressed")));
- state.push_back(tstate_definition(cfg.child("state_focussed")));
-}
-
tspacer_definition::tspacer_definition(const config& cfg) :
tcontrol_definition(cfg)
{
Modified: trunk/src/gui/widgets/settings.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/settings.hpp?rev=40658&r1=40657&r2=40658&view=diff
==============================================================================
--- trunk/src/gui/widgets/settings.hpp (original)
+++ trunk/src/gui/widgets/settings.hpp Sun Jan 10 19:56:13 2010
@@ -86,22 +86,6 @@
const std::string& get_id(const twindow_type window_type);
-struct tslider_definition : public tcontrol_definition
-{
- tslider_definition(const config& cfg);
-
- struct tresolution : public tresolution_definition_
- {
- tresolution(const config& cfg);
-
- unsigned minimum_positioner_length;
- unsigned maximum_positioner_length;
-
- unsigned left_offset;
- unsigned right_offset;
- };
-};
-
struct tspacer_definition : public tcontrol_definition
{
Modified: trunk/src/gui/widgets/slider.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/slider.cpp?rev=40658&r1=40657&r2=40658&view=diff
==============================================================================
--- trunk/src/gui/widgets/slider.cpp (original)
+++ trunk/src/gui/widgets/slider.cpp Sun Jan 10 19:56:13 2010
@@ -19,6 +19,7 @@
#include "foreach.hpp"
#include "formatter.hpp"
#include "gui/auxiliary/log.hpp"
+#include "gui/auxiliary/widget_definition/slider.hpp"
#include "sound.hpp"
#define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits