parent
10956a9517
commit
1d5e4de91d
@ -24,7 +24,7 @@
|
|||||||
<label id="gpname" text_align="center" width="100%" text="" />
|
<label id="gpname" text_align="center" width="100%" text="" />
|
||||||
<ribbon_grid id="tracks" proportion="1" width="100%" square_items="true"
|
<ribbon_grid id="tracks" proportion="1" width="100%" square_items="true"
|
||||||
label_location="each" align="left" max_rows="1"
|
label_location="each" align="left" max_rows="1"
|
||||||
child_width="160" child_height="120" word_wrap="true" />
|
child_width="160" child_height="120" />
|
||||||
</box>
|
</box>
|
||||||
|
|
||||||
<spacer height="20" />
|
<spacer height="20" />
|
||||||
|
@ -39,6 +39,7 @@ DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row)
|
|||||||
m_scroll_offset = 0;
|
m_scroll_offset = 0;
|
||||||
m_needed_cols = 0;
|
m_needed_cols = 0;
|
||||||
m_col_amount = 0;
|
m_col_amount = 0;
|
||||||
|
m_previous_item_count = 0;
|
||||||
m_max_label_length = 0;
|
m_max_label_length = 0;
|
||||||
m_multi_row = multi_row;
|
m_multi_row = multi_row;
|
||||||
m_combo = combo;
|
m_combo = combo;
|
||||||
@ -418,16 +419,7 @@ void DynamicRibbonWidget::buildInternalStructure()
|
|||||||
icon->m_properties[PROP_HEIGHT] = m_properties[PROP_CHILD_HEIGHT];
|
icon->m_properties[PROP_HEIGHT] = m_properties[PROP_CHILD_HEIGHT];
|
||||||
icon->m_w = atoi(icon->m_properties[PROP_WIDTH].c_str());
|
icon->m_w = atoi(icon->m_properties[PROP_WIDTH].c_str());
|
||||||
icon->m_h = atoi(icon->m_properties[PROP_HEIGHT].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
|
// 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)
|
// 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()
|
void DynamicRibbonWidget::elementRemoved()
|
||||||
{
|
{
|
||||||
Widget::elementRemoved();
|
Widget::elementRemoved();
|
||||||
|
m_previous_item_count = 0;
|
||||||
m_rows.clearWithoutDeleting();
|
m_rows.clearWithoutDeleting();
|
||||||
m_left_widget = NULL;
|
m_left_widget = NULL;
|
||||||
m_right_widget = NULL;
|
m_right_widget = NULL;
|
||||||
@ -897,8 +890,12 @@ void DynamicRibbonWidget::updateLabel(RibbonWidget* from_this_ribbon)
|
|||||||
|
|
||||||
void DynamicRibbonWidget::updateItemDisplay()
|
void DynamicRibbonWidget::updateItemDisplay()
|
||||||
{
|
{
|
||||||
|
// ---- Check if we need to update the number of icons in the ribbon
|
||||||
|
if ((int)m_items.size() != m_previous_item_count)
|
||||||
|
{
|
||||||
buildInternalStructure();
|
buildInternalStructure();
|
||||||
|
m_previous_item_count = (int)m_items.size();
|
||||||
|
}
|
||||||
|
|
||||||
// ---- some variables
|
// ---- some variables
|
||||||
int icon_id = 0;
|
int icon_id = 0;
|
||||||
|
@ -98,6 +98,8 @@ namespace GUIEngine
|
|||||||
*/
|
*/
|
||||||
bool m_scrolling_enabled;
|
bool m_scrolling_enabled;
|
||||||
|
|
||||||
|
/** Used to keep track of item count changes */
|
||||||
|
int m_previous_item_count;
|
||||||
|
|
||||||
/** List of items in the ribbon */
|
/** List of items in the ribbon */
|
||||||
std::vector<ItemDescription> m_items;
|
std::vector<ItemDescription> m_items;
|
||||||
|
@ -396,9 +396,8 @@ void RibbonWidget::add()
|
|||||||
has_label = false;
|
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
|
const int needed_space_under_button = has_label
|
||||||
? font_size
|
? GUIEngine::getFontHeight()
|
||||||
: 10;
|
: 10;
|
||||||
|
|
||||||
float imageRatio =
|
float imageRatio =
|
||||||
|
Loading…
Reference in New Issue
Block a user