diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-02 10:18:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-02 10:18:54 +0300 |
commit | a76b045326d69287585b914329339ae8390783f5 (patch) | |
tree | 6bef461066b5ef305b9fc838e7831914594c4b7b /source/blender | |
parent | 15e63742e25028225f8746e1b663548e8c0569cd (diff) |
UI: add scale option for template_icon_view button
The existing scale option only changed the scale if icons in the popup.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 3 |
3 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 31956877d1b..b1dc5821d7a 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1087,7 +1087,9 @@ void uiTemplatePreview( struct MTex *slot, const char *preview_id); void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool expand); void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale); -void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale); +void uiTemplateIconView( + uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool show_labels, + float icon_scale, float icon_scale_popup); void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 0d3aa43cd56..ec055ddb05b 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2650,7 +2650,9 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem) /** * \param icon_scale: Scale of the icon, 1x == button height. */ -void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale) +void uiTemplateIconView( + uiLayout *layout, PointerRNA *ptr, const char *propname, bool show_labels, + float icon_scale, float icon_scale_popup) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); IconViewMenuArgs *cb_args; @@ -2677,12 +2679,16 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, cb_args->ptr = *ptr; cb_args->prop = prop; cb_args->show_labels = show_labels; - cb_args->icon_scale = icon_scale; + cb_args->icon_scale = icon_scale_popup; - but = uiDefBlockButN(block, ui_icon_view_menu_cb, cb_args, "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, ""); + but = uiDefBlockButN( + block, ui_icon_view_menu_cb, cb_args, "", + 0, 0, UI_UNIT_X * icon_scale, UI_UNIT_Y * icon_scale, ""); } else { - but = uiDefIconBut(block, UI_BTYPE_LABEL, 0, ICON_X, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, NULL, 0.0, 0.0, 0.0, 0.0, ""); + but = uiDefIconBut( + block, UI_BTYPE_LABEL, 0, ICON_X, + 0, 0, UI_UNIT_X * icon_scale, UI_UNIT_Y * icon_scale, NULL, 0.0, 0.0, 0.0, 0.0, ""); } diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index fdf2b5f311b..0db0408d09f 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -941,7 +941,8 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews"); api_ui_item_rna_common(func); RNA_def_boolean(func, "show_labels", false, "", "Show enum label in preview buttons"); - RNA_def_float(func, "scale", 5.0f, 1.0f, 100.0f, "Scale", "Scale the icon size (by the button size)", 1.0f, 100.0f); + RNA_def_float(func, "scale", 6.0f, 1.0f, 100.0f, "UI Units", "Scale the button icon size (by the button size)", 1.0f, 100.0f); + RNA_def_float(func, "scale_popup", 5.0f, 1.0f, 100.0f, "Scale", "Scale the popup icon size (by the button size)", 1.0f, 100.0f); func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram"); RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data"); |