mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-14 14:10:35 +00:00
GUI2/Canvas: clean up some remnants of old attribute handling
This commit is contained in:
parent
dc0de427db
commit
67c7c4bb10
|
@ -412,10 +412,6 @@ text_shape::text_shape(const config& cfg, wfl::action_function_symbol_table& fun
|
|||
, highlight_start_(cfg["highlight_start"])
|
||||
, highlight_end_(cfg["highlight_end"])
|
||||
, highlight_color_(cfg["highlight_color"], color_t::from_hex_string("215380"))
|
||||
, attr_start_(cfg["attr_start"])
|
||||
, attr_end_(cfg["attr_end"])
|
||||
, attr_name_(cfg["attr_name"])
|
||||
, attr_data_(cfg["attr_data"])
|
||||
, outline_(cfg["outline"], false)
|
||||
, actions_formula_(cfg["actions"], &functions)
|
||||
{
|
||||
|
@ -444,13 +440,11 @@ void text_shape::draw(wfl::map_formula_callable& variables)
|
|||
//
|
||||
// Highlight
|
||||
//
|
||||
std::vector<std::string> starts = utils::split(highlight_start_, ',');
|
||||
std::vector<std::string> stops = utils::split(highlight_end_, ',');
|
||||
const int highlight_start = highlight_start_(variables);
|
||||
const int highlight_end = highlight_end_(variables);
|
||||
|
||||
for(size_t i = 0; i < std::min(starts.size(), stops.size()); i++) {
|
||||
typed_formula<int> hstart(starts.at(i));
|
||||
typed_formula<int> hstop(stops.at(i));
|
||||
add_attribute_bg_color(text_attributes, hstart(variables), hstop(variables), highlight_color_(variables));
|
||||
if(highlight_start != highlight_end) {
|
||||
add_attribute_bg_color(text_attributes, highlight_start, highlight_end, highlight_color_(variables));
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -285,30 +285,15 @@ private:
|
|||
/** The maximum height for the text. */
|
||||
typed_formula<int> maximum_height_;
|
||||
|
||||
/** Start and end offsets for highlight */
|
||||
std::string highlight_start_;
|
||||
std::string highlight_end_;
|
||||
/** Start offset for highlight */
|
||||
typed_formula<int> highlight_start_;
|
||||
|
||||
/** End offset for highlight */
|
||||
typed_formula<int> highlight_end_;
|
||||
|
||||
/** The color to be used for highlighting */
|
||||
typed_formula<color_t> highlight_color_;
|
||||
|
||||
/** Generic start and end offsets for various attributes */
|
||||
std::string attr_start_;
|
||||
std::string attr_end_;
|
||||
|
||||
/**
|
||||
* The attribute type
|
||||
* Possible values :
|
||||
* color/foreground, bgcolor/background, font_size/size,
|
||||
* bold, italic, underline
|
||||
* The first three require extra data
|
||||
* the color for the first two, and font size for the last
|
||||
*/
|
||||
std::string attr_name_;
|
||||
|
||||
/** extra data for the attribute, if any */
|
||||
std::string attr_data_;
|
||||
|
||||
/** Whether to apply a text outline. */
|
||||
typed_formula<bool> outline_;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user