GUI2/Styled Widget: remove orphaned text_maximum_width_

This was first added by mordante in a36e1ee696. The code around it was subsequently removed in b217903c07, and had since remained functionally useless.

It was briefly called to action as part of #8510 (see 9b38089db0), but that usecase was temporary and the hardcoded max width subsequently removed in 4cb9df8e6c.
This commit is contained in:
Charles Dang 2025-03-11 19:43:32 -04:00
parent b4175dbb4b
commit dc5e0d62c4
3 changed files with 2 additions and 28 deletions

View File

@ -74,13 +74,6 @@ public:
void set_link_aware(bool l);
void set_text_max_width(int max_width) {
label* text_label = get_internal_label();
if (text_label) {
text_label->set_text_maximum_width(max_width);
}
}
private:
/**
* Possible states of the widget.

View File

@ -55,7 +55,6 @@ styled_widget::styled_widget(const implementation::builder_styled_widget& builde
, config_(get_control(control_type, definition_))
, canvases_(config_->state.size()) // One canvas per state
, renderer_()
, text_maximum_width_(0)
, text_alignment_(PANGO_ALIGN_LEFT)
, text_ellipse_mode_(PANGO_ELLIPSIZE_END)
, shrunken_(false)
@ -418,8 +417,7 @@ int styled_widget::get_text_maximum_width() const
{
assert(config_);
return text_maximum_width_ != 0 ? text_maximum_width_
: get_width() - config_->text_extra_width;
return get_width() - config_->text_extra_width;
}
int styled_widget::get_text_maximum_height() const
@ -454,9 +452,7 @@ point styled_widget::get_best_text_size(point minimum_size, point maximum_size)
assert(!label_.empty());
// Try with the minimum wanted size.
const int maximum_width = text_maximum_width_ != 0
? text_maximum_width_
: maximum_size.x;
const int maximum_width = maximum_size.x;
/*
* NOTE: text rendering does *not* happen here. That happens in the text_shape
@ -487,7 +483,6 @@ point styled_widget::get_best_text_size(point minimum_size, point maximum_size)
<< "Status:\n"
<< "minimum_size: " << minimum_size << "\n"
<< "maximum_size: " << maximum_size << "\n"
<< "maximum width of text: " << text_maximum_width_ << "\n"
<< "can_wrap: " << can_wrap() << "\n"
<< "characters_per_line: " << get_characters_per_line() << "\n"
<< "truncated: " << renderer_.is_truncated() << "\n"

View File

@ -346,17 +346,6 @@ protected:
*/
int get_text_maximum_height() const;
public:
/**
* Set how wide the text can become. If the text is bigger
* than this limit, it gets wrapped
*/
void set_text_maximum_width(int max_width) {
if (max_width > 0) {
text_maximum_width_ = max_width;
}
}
private:
/**
* The definition is the id of that widget class.
@ -496,9 +485,6 @@ private:
*/
mutable font::pango_text renderer_;
/** The maximum width for the text in a styled_widget. */
int text_maximum_width_;
/** The alignment of the text in a styled_widget. */
PangoAlignment text_alignment_;