Revert "GUI2: implemented fixed_width and fixed_height keys for all widgets"
This reverts commit 556331ac3f
.
Since the keys aren't working, the implementation shouldn't be in the
Git repository. Otherwise some poor soul will attempt to use them and
face additional work afterwards.
This commit is contained in:
parent
18e208e07c
commit
506ee85d2d
7 changed files with 6 additions and 95 deletions
|
@ -29,7 +29,6 @@ Version 1.13.10+dev:
|
|||
* Greatly improved behavior of sliders.
|
||||
* Fixed crash when modifying an existing friend entry in Preferences.
|
||||
* Fixed players being unable to start campaigns in MP mode.
|
||||
* Added new fixed_width and fixed_height keys to GUI2 widgets.
|
||||
* WML Engine:
|
||||
* File paths with backslashes are no longer allowed. This ensures that a UMC
|
||||
author can't accidentally use them and make an add-on that breaks on
|
||||
|
|
|
@ -654,16 +654,6 @@
|
|||
type="bool"
|
||||
default=false
|
||||
[/key]
|
||||
[key]
|
||||
name="fixed_width"
|
||||
type="f_unsigned"
|
||||
default=""
|
||||
[/key]
|
||||
[key]
|
||||
name="fixed_height"
|
||||
type="f_unsigned"
|
||||
default=""
|
||||
[/key]
|
||||
[/tag]
|
||||
[/tag]
|
||||
[tag]
|
||||
|
@ -2344,16 +2334,6 @@
|
|||
type="string"
|
||||
default=0
|
||||
[/key]
|
||||
[key]
|
||||
name="fixed_width"
|
||||
type="f_unsigned"
|
||||
default=""
|
||||
[/key]
|
||||
[key]
|
||||
name="fixed_height"
|
||||
type="f_unsigned"
|
||||
default=""
|
||||
[/key]
|
||||
[/tag]
|
||||
[tag]
|
||||
name="helptip"
|
||||
|
|
|
@ -113,8 +113,6 @@ window* build(CVideo& video, const std::string& type)
|
|||
builder_widget::builder_widget(const config& cfg)
|
||||
: id(cfg["id"])
|
||||
, linked_group(cfg["linked_group"])
|
||||
, fixed_width(cfg["fixed_width"], 0)
|
||||
, fixed_height(cfg["fixed_height"], 0)
|
||||
, debug_border_mode(cfg["debug_border_mode"])
|
||||
, debug_border_color(decode_color(cfg["debug_border_color"]))
|
||||
{
|
||||
|
|
|
@ -66,9 +66,6 @@ public:
|
|||
std::string id;
|
||||
std::string linked_group;
|
||||
|
||||
typed_formula<unsigned> fixed_width;
|
||||
typed_formula<unsigned> fixed_height;
|
||||
|
||||
int debug_border_mode;
|
||||
color_t debug_border_color;
|
||||
};
|
||||
|
|
|
@ -34,8 +34,6 @@ widget::widget()
|
|||
, y_(-1)
|
||||
, width_(0)
|
||||
, height_(0)
|
||||
, fixed_width_("", 0)
|
||||
, fixed_height_("", 0)
|
||||
, layout_size_()
|
||||
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
|
||||
, last_best_size_()
|
||||
|
@ -58,8 +56,6 @@ widget::widget(const builder_widget& builder)
|
|||
, y_(-1)
|
||||
, width_(0)
|
||||
, height_(0)
|
||||
, fixed_width_(builder.fixed_width)
|
||||
, fixed_height_(builder.fixed_height)
|
||||
, layout_size_()
|
||||
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
|
||||
, last_best_size_()
|
||||
|
@ -203,32 +199,11 @@ point widget::get_best_size() const
|
|||
|
||||
point result = layout_size_;
|
||||
if(result == point()) {
|
||||
point best_size = calculate_best_size();
|
||||
|
||||
if(!has_fixed_size()) {
|
||||
result = best_size;
|
||||
} else {
|
||||
result = get_fixed_size();
|
||||
|
||||
//
|
||||
// NOTE: the x or y coordinates could be 0 or less at this point, either because
|
||||
// the formulas evaluated to 0 or because either of the fixed_width or fixed_height
|
||||
// keys were omitted in the WML (in which case, the default value is 0). We'll
|
||||
// assume a 0 value means that dimension is unfixed, so fall back on the best size.
|
||||
//
|
||||
if(result.x <= 0) {
|
||||
result.x = best_size.x;
|
||||
}
|
||||
|
||||
if(result.y <= 0) {
|
||||
result.y = best_size.y;
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust to linked widget size if linked widget size was already calculated.
|
||||
if(!get_window()->get_need_layout() && !linked_group_.empty()) {
|
||||
result = calculate_best_size();
|
||||
//Adjust to linked widget size if linked widget size was already calculated.
|
||||
if(!get_window()->get_need_layout() && !linked_group_.empty())
|
||||
{
|
||||
point linked_size = get_window()->get_linked_size(linked_group_);
|
||||
|
||||
result.x = std::max(result.x, linked_size.x);
|
||||
result.y = std::max(result.y, linked_size.y);
|
||||
}
|
||||
|
@ -241,21 +216,6 @@ point widget::get_best_size() const
|
|||
return result;
|
||||
}
|
||||
|
||||
bool widget::has_fixed_size() const
|
||||
{
|
||||
return fixed_width_.has_formula() || fixed_height_.has_formula();
|
||||
}
|
||||
|
||||
point widget::get_fixed_size() const
|
||||
{
|
||||
if(const window* window = get_window()) {
|
||||
const wfl::map_formula_callable& vars = window->get_variables();
|
||||
return point(fixed_width_(vars), fixed_height_(vars));
|
||||
}
|
||||
|
||||
return point();
|
||||
}
|
||||
|
||||
bool widget::can_wrap() const
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -14,12 +14,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "color.hpp"
|
||||
#include "formula/callable.hpp"
|
||||
#include "gui/auxiliary/typed_formula.hpp"
|
||||
#include "gui/core/event/dispatcher.hpp"
|
||||
#include "gui/widgets/event_executor.hpp"
|
||||
#include "sdl/point.hpp"
|
||||
#include "gui/widgets/event_executor.hpp"
|
||||
#include "color.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -325,15 +323,6 @@ public:
|
|||
*/
|
||||
point get_best_size() const;
|
||||
|
||||
/**
|
||||
* Checks if this widget has a fixed size.
|
||||
* If so, it will be used instead of the result of get_best_size();
|
||||
*/
|
||||
bool has_fixed_size() const;
|
||||
|
||||
/** Evaluates and returns the result of the fixed size formulas. */
|
||||
point get_fixed_size() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Calculates the best size.
|
||||
|
@ -497,12 +486,6 @@ private:
|
|||
/** The height of the widget. */
|
||||
unsigned height_;
|
||||
|
||||
/** A given fixed width of the widget. */
|
||||
typed_formula<unsigned> fixed_width_;
|
||||
|
||||
/** A given fixed height of the widget. */
|
||||
typed_formula<unsigned> fixed_height_;
|
||||
|
||||
/**
|
||||
* The best size for the widget.
|
||||
*
|
||||
|
|
|
@ -431,12 +431,6 @@ public:
|
|||
variables_.add(key, value);
|
||||
set_is_dirty(true);
|
||||
}
|
||||
|
||||
const wfl::map_formula_callable& get_variables() const
|
||||
{
|
||||
return variables_;
|
||||
}
|
||||
|
||||
point get_linked_size(const std::string& linked_group_id) const
|
||||
{
|
||||
std::map<std::string, linked_size>::const_iterator it = linked_size_.find(linked_group_id);
|
||||
|
|
Loading…
Add table
Reference in a new issue