Author: mordante
Date: Wed Apr 30 18:36:19 2008
New Revision: 26259
URL: http://svn.gna.org/viewcvs/wesnoth?rev=26259&view=rev
Log:
Rename the badly named scale to grow_factor.
Modified:
trunk/data/gui/default/window/addon.cfg
trunk/src/gui/widgets/grid.cpp
trunk/src/gui/widgets/grid.hpp
trunk/src/gui/widgets/panel.hpp
trunk/src/gui/widgets/window_builder.cpp
Modified: trunk/data/gui/default/window/addon.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/gui/default/window/addon.cfg?rev=26259&r1=26258&r2=26259&view=diff
==============================================================================
--- trunk/data/gui/default/window/addon.cfg (original)
+++ trunk/data/gui/default/window/addon.cfg Wed Apr 30 18:36:19 2008
@@ -19,11 +19,10 @@
[grid]
[row]
-#fixme rename scale to grow_factor
- scale = 0
-
- [column]
- scale = 1
+ grow_factor = 0
+
+ [column]
+ grow_factor = 1
border = "all"
border_size = 5
@@ -39,10 +38,10 @@
[/row]
[row]
- scale = 0
-
- [column]
- scale = 1
+ grow_factor = 0
+
+ [column]
+ grow_factor = 1
border = "all"
border_size = 5
@@ -58,20 +57,20 @@
[/row]
[row]
- scale = 1
-
- [column]
- scale = 1
+ grow_factor = 1
+
+ [column]
+ grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
- scale = 1
-
- [column]
- scale = 0
+ grow_factor = 1
+
+ [column]
+ grow_factor = 0
border = "all"
border_size = 5
@@ -86,7 +85,7 @@
[/column]
[column]
- scale = 1
+ grow_factor = 1
border = "all"
border_size = 5
@@ -112,19 +111,19 @@
[/row]
[row]
- scale = 0
-
- [column]
- scale = 1
+ grow_factor = 0
+
+ [column]
+ grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
- scale = 0
-
- [column]
- scale = 1
+ grow_factor = 0
+
+ [column]
+ grow_factor = 1
[spacer]
definition = "default"
@@ -167,7 +166,7 @@
[/row]
[row]
- scale = 0
+ grow_factor = 0
[column]
Modified: trunk/src/gui/widgets/grid.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.cpp?rev=26259&r1=26258&r2=26259&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.cpp (original)
+++ trunk/src/gui/widgets/grid.cpp Wed Apr 30 18:36:19 2008
@@ -55,8 +55,8 @@
minimum_col_width_(),
row_height_(),
col_width_(),
- row_scaling_(),
- col_scaling_(),
+ row_grow_factor_(),
+ col_grow_factor_(),
children_(rows * cols)
{
}
@@ -133,8 +133,8 @@
rows_ = rows;
cols_ = cols;
- row_scaling_.resize(rows);
- col_scaling_.resize(cols);
+ row_grow_factor_.resize(rows);
+ col_grow_factor_.resize(cols);
children_.resize(rows_ * cols_);
clear_cache();
}
@@ -231,8 +231,8 @@
assert(row_height_.size() == rows_);
assert(col_width_.size() == cols_);
- assert(row_scaling_.size() == rows_);
- assert(col_scaling_.size() == cols_);
+ assert(row_grow_factor_.size() == rows_);
+ assert(col_grow_factor_.size() == cols_);
if(best_size == size) {
row_height_ = best_row_height_;
col_width_ = best_col_width_;
@@ -248,12 +248,12 @@
// expand it.
if(size.x > best_size.x) {
const unsigned w = size.x - best_size.x;
- unsigned w_size = std::accumulate(col_scaling_.begin(),
col_scaling_.end(), 0);
+ unsigned w_size =
std::accumulate(col_grow_factor_.begin(), col_grow_factor_.end(), 0);
DBG_G << "Grid: extra width " << w << " will be divided
amount " << w_size << " units in " << cols_ << " columns.\n";
if(w_size == 0) {
// If all sizes are 0 reset them to 1
- foreach(unsigned& val, col_scaling_) {
+ foreach(unsigned& val, col_grow_factor_) {
val = 1;
}
w_size = cols_;
@@ -262,21 +262,21 @@
// but we ignore that part for now.
const unsigned w_normal = w / w_size;
for(unsigned i = 0; i < cols_; ++i) {
- col_width_[i] += w_normal * col_scaling_[i];
- DBG_G << "Grid: column " << i << " with scale
factor "
- << col_scaling_[i] << " set width to "
<< col_width_[i] << ".\n";
+ col_width_[i] += w_normal * col_grow_factor_[i];
+ DBG_G << "Grid: column " << i << " with grow
factor "
+ << col_grow_factor_[i] << " set width
to " << col_width_[i] << ".\n";
}
}
if(size.y > best_size.y) {
const unsigned h = size.y - best_size.y;
- unsigned h_size = std::accumulate(row_scaling_.begin(),
row_scaling_.end(), 0);
+ unsigned h_size =
std::accumulate(row_grow_factor_.begin(), row_grow_factor_.end(), 0);
DBG_G << "Grid: extra height " << h << " will be
divided amount " << h_size << " units in " << rows_ << " rows.\n";
if(h_size == 0) {
// If all sizes are 0 reset them to 1
- foreach(unsigned& val, row_scaling_) {
+ foreach(unsigned& val, row_grow_factor_) {
val = 1;
}
h_size = rows_;
@@ -285,9 +285,9 @@
// but we ignore that part for now.
const unsigned h_normal = h / h_size;
for(unsigned i = 0; i < rows_; ++i) {
- row_height_[i] += h_normal * row_scaling_[i];
- DBG_G << "Grid: row " << i << " with scale
factor "
- << row_scaling_[i] << " set height to "
<< row_height_[i] << ".\n";
+ row_height_[i] += h_normal *
row_grow_factor_[i];
+ DBG_G << "Grid: row " << i << " with grow
factor "
+ << row_grow_factor_[i] << " set height
to " << row_height_[i] << ".\n";
}
}
Modified: trunk/src/gui/widgets/grid.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.hpp?rev=26259&r1=26258&r2=26259&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.hpp (original)
+++ trunk/src/gui/widgets/grid.hpp Wed Apr 30 18:36:19 2008
@@ -74,11 +74,11 @@
void set_rows_cols(const unsigned rows, const unsigned cols);
- void set_row_scaling(const unsigned row, const unsigned scale)
- { row_scaling_[row] = scale; set_dirty(); } //FIXME add assert.
-
- void set_col_scaling(const unsigned col, const unsigned scale)
- { col_scaling_[col] = scale; set_dirty(); } //FIXME add assert.
+ void set_row_grow_factor(const unsigned row, const unsigned factor)
+ { row_grow_factor_[row] = factor; set_dirty(); } //FIXME add
assert.
+
+ void set_col_grow_factor(const unsigned col, const unsigned factor)
+ { col_grow_factor_[col] = factor; set_dirty(); } //FIXME add
assert.
void remove_child(const unsigned row, const unsigned col);
void remove_child(const std::string& id, const bool find_all = false);
@@ -225,8 +225,8 @@
std::vector<unsigned> col_width_;
//! The resize factors for rows / cols.
- std::vector<unsigned> row_scaling_;
- std::vector<unsigned> col_scaling_;
+ std::vector<unsigned> row_grow_factor_;
+ std::vector<unsigned> col_grow_factor_;
//! Contains all cells.
std::vector<tchild> children_;
Modified: trunk/src/gui/widgets/panel.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/panel.hpp?rev=26259&r1=26258&r2=26259&view=diff
==============================================================================
--- trunk/src/gui/widgets/panel.hpp (original)
+++ trunk/src/gui/widgets/panel.hpp Wed Apr 30 18:36:19 2008
@@ -85,11 +85,11 @@
const unsigned col, const unsigned flags, const unsigned
border_size)
{ grid_.add_child(widget, row, col, flags, border_size); }
- void set_row_scaling(const unsigned row, const unsigned scale)
- { grid_.set_row_scaling(row, scale); }
+ void set_row_grow_factor(const unsigned row, const unsigned factor)
+ { grid_.set_row_grow_factor(row, factor); }
- void set_col_scaling(const unsigned col, const unsigned scale)
- { grid_.set_col_scaling(col, scale); }
+ void set_col_grow_factor(const unsigned col, const unsigned factor)
+ { grid_.set_col_grow_factor(col, factor); }
private:
tgrid grid_;
Modified: trunk/src/gui/widgets/window_builder.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window_builder.cpp?rev=26259&r1=26258&r2=26259&view=diff
==============================================================================
--- trunk/src/gui/widgets/window_builder.cpp (original)
+++ trunk/src/gui/widgets/window_builder.cpp Wed Apr 30 18:36:19 2008
@@ -148,9 +148,9 @@
unsigned rows;
unsigned cols;
- //! The scale factor for the rows / columns.
- std::vector<unsigned> row_scale;
- std::vector<unsigned> col_scale;
+ //! The grow factor for the rows / columns.
+ std::vector<unsigned> row_grow_factor;
+ std::vector<unsigned> col_grow_factor;
//! The flags per grid cell.
std::vector<unsigned> flags;
@@ -185,11 +185,11 @@
window.set_rows_cols(rows, cols);
for(unsigned x = 0; x < rows; ++x) {
- window.set_row_scaling(x, definition->grid->row_scale[x]);
+ window.set_row_grow_factor(x,
definition->grid->row_grow_factor[x]);
for(unsigned y = 0; y < cols; ++y) {
if(x == 0) {
- window.set_col_scaling(y,
definition->grid->col_scale[y]);
+ window.set_col_grow_factor(y,
definition->grid->col_grow_factor[y]);
}
twidget* widget = definition->grid->widgets[x * cols +
y]->build();
@@ -344,8 +344,8 @@
tbuilder_widget(cfg),
rows(0),
cols(0),
- row_scale(),
- col_scale(),
+ row_grow_factor(),
+ col_grow_factor(),
flags(),
border_size(),
widgets()
@@ -358,7 +358,7 @@
unsigned col = 0;
-
row_scale.push_back(lexical_cast_default<unsigned>((**row_itor)["scale"]));
+
row_grow_factor.push_back(lexical_cast_default<unsigned>((**row_itor)["grow_factor"]));
const config::child_list& col_cfgs =
(**row_itor).get_children("column");
for(std::vector<config*>::const_iterator col_itor =
col_cfgs.begin();
@@ -367,7 +367,7 @@
flags.push_back(read_flags(**col_itor));
border_size.push_back(lexical_cast_default<unsigned>((**col_itor)["border_size"]));
if(rows == 0) {
-
col_scale.push_back(lexical_cast_default<unsigned>((**col_itor)["scale"]));
+
col_grow_factor.push_back(lexical_cast_default<unsigned>((**col_itor)["grow_factor"]));
}
if((**col_itor).child("button")) {
@@ -495,11 +495,11 @@
panel->set_rows_cols(rows, cols);
for(unsigned x = 0; x < rows; ++x) {
- panel->set_row_scaling(x, grid->row_scale[x]);
+ panel->set_row_grow_factor(x, grid->row_grow_factor[x]);
for(unsigned y = 0; y < cols; ++y) {
if(x == 0) {
- panel->set_col_scaling(y, grid->col_scale[y]);
+ panel->set_col_grow_factor(y,
grid->col_grow_factor[y]);
}
twidget* widget = grid->widgets[x * cols + y]->build();
@@ -553,11 +553,11 @@
<< cols << " columns.\n";
for(unsigned x = 0; x < rows; ++x) {
- grid->set_row_scaling(x, row_scale[x]);
+ grid->set_row_grow_factor(x, row_grow_factor[x]);
for(unsigned y = 0; y < cols; ++y) {
if(x == 0) {
- grid->set_col_scaling(y, col_scale[y]);
+ grid->set_col_grow_factor(y,
col_grow_factor[y]);
}
DBG_G << "Window builder: adding child at " << x << ','
<< y << ".\n";
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits