Revert "GP Editor Word Wrap (#3519)"

This reverts commit abd522d937.
This commit is contained in:
auria.mg 2018-10-18 19:20:35 -04:00
parent 10956a9517
commit 1d5e4de91d
4 changed files with 13 additions and 15 deletions

View File

@ -24,7 +24,7 @@
<label id="gpname" text_align="center" width="100%" text="" />
<ribbon_grid id="tracks" proportion="1" width="100%" square_items="true"
label_location="each" align="left" max_rows="1"
child_width="160" child_height="120" word_wrap="true" />
child_width="160" child_height="120" />
</box>
<spacer height="20" />

View File

@ -39,6 +39,7 @@ DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row)
m_scroll_offset = 0;
m_needed_cols = 0;
m_col_amount = 0;
m_previous_item_count = 0;
m_max_label_length = 0;
m_multi_row = multi_row;
m_combo = combo;
@ -418,16 +419,7 @@ void DynamicRibbonWidget::buildInternalStructure()
icon->m_properties[PROP_HEIGHT] = m_properties[PROP_CHILD_HEIGHT];
icon->m_w = atoi(icon->m_properties[PROP_WIDTH].c_str());
icon->m_h = atoi(icon->m_properties[PROP_HEIGHT].c_str());
if (m_properties[PROP_WORD_WRAP] == "true")
{
icon->m_properties[PROP_WORD_WRAP] = "true";
}
else
{
icon->setLabelFont(m_font);
}
icon->setLabelFont(m_font);
// If we want each icon to have its own label, we must make it non-empty, otherwise
// it will assume there is no label and none will be created (FIXME: that's ugly)
@ -545,6 +537,7 @@ void DynamicRibbonWidget::clearItems()
void DynamicRibbonWidget::elementRemoved()
{
Widget::elementRemoved();
m_previous_item_count = 0;
m_rows.clearWithoutDeleting();
m_left_widget = NULL;
m_right_widget = NULL;
@ -897,8 +890,12 @@ void DynamicRibbonWidget::updateLabel(RibbonWidget* from_this_ribbon)
void DynamicRibbonWidget::updateItemDisplay()
{
buildInternalStructure();
// ---- Check if we need to update the number of icons in the ribbon
if ((int)m_items.size() != m_previous_item_count)
{
buildInternalStructure();
m_previous_item_count = (int)m_items.size();
}
// ---- some variables
int icon_id = 0;

View File

@ -98,6 +98,8 @@ namespace GUIEngine
*/
bool m_scrolling_enabled;
/** Used to keep track of item count changes */
int m_previous_item_count;
/** List of items in the ribbon */
std::vector<ItemDescription> m_items;

View File

@ -396,9 +396,8 @@ void RibbonWidget::add()
has_label = false;
}
const int font_size = m_active_children[i].m_properties[PROP_WORD_WRAP] == "true" ? GUIEngine::getFontHeight() * 2 : GUIEngine::getFontHeight();
const int needed_space_under_button = has_label
? font_size
? GUIEngine::getFontHeight()
: 10;
float imageRatio =