Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_layout.c
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
| ListBase layout_dummy_list = {&layout_copy, &layout_copy}; | ListBase layout_dummy_list = {&layout_copy, &layout_copy}; | ||||
| ui_layout_introspect_items(ds, &layout_dummy_list); | ui_layout_introspect_items(ds, &layout_dummy_list); | ||||
| const char *result = BLI_dynstr_get_cstring(ds); | const char *result = BLI_dynstr_get_cstring(ds); | ||||
| BLI_dynstr_free(ds); | BLI_dynstr_free(ds); | ||||
| return result; | return result; | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | |||||
| /** \name Alert Icon Wrapper | |||||
Severin: I don't think this describes it well really. I'd make it less about "alert icon", more about… | |||||
| * | |||||
| * Helper to add an Alert Icon and creates a split layout for popups. | |||||
SeverinUnsubmitted Done Inline ActionsThis should be the doxygen comment for the function itself. Also (picky) grammar and capitalization seem weird. Suggestion: Severin: This should be the doxygen comment for the function itself.
Also (picky) grammar and… | |||||
| * | |||||
| * \{ */ | |||||
| uiLayout *uiItemsAlertBox(uiBlock *block, const int size, const eAlertIcon icon) | |||||
Done Inline ActionsI'd call this uiItemsAlertBox(). Severin: I'd call this `uiItemsAlertBox()`. | |||||
| { | |||||
| const uiStyle *style = UI_style_get_dpi(); | |||||
| const short icon_size = 64 * U.dpi_fac; | |||||
| const int text_points_max = MAX2(style->widget.points, style->widgetlabel.points); | |||||
| const int dialog_width = icon_size + (text_points_max * size * U.dpi_fac); | |||||
| /* By default, the space between icon and text/buttons will be equal to the 'columnspace', | |||||
| this extra padding will add some space by increasing the left column width, | |||||
Done Inline ActionsThese are not layout operations, I wouldn't put them here. Think it's fine to leave them duplicated in the caller. Or alternatively, add a UI_popup_block_alert_style() to interface_region_popup.c, or something like that. Severin: These are not layout operations, I wouldn't put them here. Think it's fine to leave them… | |||||
| making the icon placement more symmetrical, between the block edge and the text. */ | |||||
| const float icon_padding = 5.0f * U.dpi_fac; | |||||
| /* Calculate the factor of the fixed icon column depending on the block width. */ | |||||
| const float split_factor = ((float)icon_size + icon_padding) / | |||||
| (float)(dialog_width - style->columnspace); | |||||
| uiLayout *block_layout = UI_block_layout( | |||||
| block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, dialog_width, 0, 0, style); | |||||
| /* Split layout to put alert icon on left side. */ | |||||
| uiLayout *split_block = uiLayoutSplit(block_layout, split_factor, false); | |||||
| /* Alert icon. */ | |||||
| uiLayout *layout = uiLayoutRow(split_block, false); | |||||
| /* Using 'align_left' with 'row' avoids stretching the icon along the width of column. */ | |||||
| uiLayoutSetAlignment(layout, UI_LAYOUT_ALIGN_LEFT); | |||||
| uiDefButAlert(block, icon, 0, 0, icon_size, icon_size); | |||||
| /* The rest of the content on the right. */ | |||||
| layout = uiLayoutColumn(split_block, false); | |||||
| return layout; | |||||
| } | |||||
| /** \} */ | |||||
| Context not available. | |||||
I don't think this describes it well really. I'd make it less about "alert icon", more about, "alert box layout with a big icon".
Maybe "Alert Box with Big Icon" here?