Commit: 3c59a5068fbb3a91777297e4b7007de33197972a
Author: Julian Eisel
Date:   Tue Jul 26 19:30:18 2016 +0200
Branches: master
https://developer.blender.org/rB3c59a5068fbb3a91777297e4b7007de33197972a

More useful block name for report popup blocks

Report popups simply reuse popup menu code, so their blocks got 
"UI_popup_menu_begin" assigned as name, which was a bit misleading. Now uses 
"UI_popup_menu_reports".
Ideally they'd have their own popup code.

===================================================================

M       source/blender/editors/include/UI_interface.h
M       source/blender/editors/interface/interface_regions.c

===================================================================

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index a623f5c..f77e795 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -382,7 +382,11 @@ typedef bool (*uiMenuStepFunc)(struct bContext *C, int 
direction, void *arg1);
 
 typedef struct uiPopupMenu uiPopupMenu;
 
-struct uiPopupMenu *UI_popup_menu_begin(struct bContext *C, const char *title, 
int icon) ATTR_NONNULL();
+uiPopupMenu *UI_popup_menu_begin(
+        struct bContext *C, const char *title, int icon) ATTR_NONNULL();
+uiPopupMenu *UI_popup_menu_begin_ex(
+        struct bContext *C, const char *title, const char *block_name,
+        int icon) ATTR_NONNULL();
 void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *head);
 struct uiLayout *UI_popup_menu_layout(uiPopupMenu *head);
 
diff --git a/source/blender/editors/interface/interface_regions.c 
b/source/blender/editors/interface/interface_regions.c
index 2caf52c..48618a2 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2807,14 +2807,17 @@ uiPopupBlockHandle *ui_popup_menu_create(
 
 /******************** Popup Menu API with begin and end 
***********************/
 
-/* only return handler, and set optional title */
-uiPopupMenu *UI_popup_menu_begin(bContext *C, const char *title, int icon)
+/**
+ * Only return handler, and set optional title.
+ * \param block_name: Assigned to uiBlock.name (useful info for debugging).
+ */
+uiPopupMenu *UI_popup_menu_begin_ex(bContext *C, const char *title, const char 
*block_name, int icon)
 {
        uiStyle *style = UI_style_get_dpi();
        uiPopupMenu *pup = MEM_callocN(sizeof(uiPopupMenu), "popup menu");
        uiBut *but;
 
-       pup->block = UI_block_begin(C, NULL, __func__, UI_EMBOSS_PULLDOWN);
+       pup->block = UI_block_begin(C, NULL, block_name, UI_EMBOSS_PULLDOWN);
        pup->block->flag |= UI_BLOCK_POPUP_MEMORY | UI_BLOCK_IS_FLIP;
        pup->block->puphash = ui_popup_menu_hash(title);
        pup->layout = UI_block_layout(pup->block, UI_LAYOUT_VERTICAL, 
UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style);
@@ -2845,6 +2848,11 @@ uiPopupMenu *UI_popup_menu_begin(bContext *C, const char 
*title, int icon)
        return pup;
 }
 
+uiPopupMenu *UI_popup_menu_begin(bContext *C, const char *title, int icon)
+{
+       return UI_popup_menu_begin_ex(C, title, __func__, icon);
+}
+
 /* set the whole structure to work */
 void UI_popup_menu_end(bContext *C, uiPopupMenu *pup)
 {
@@ -3203,7 +3211,8 @@ void UI_popup_menu_reports(bContext *C, ReportList 
*reports)
                if (pup == NULL) {
                        char title[UI_MAX_DRAW_STR];
                        BLI_snprintf(title, sizeof(title), "%s: %s", 
IFACE_("Report"), report->typestr);
-                       pup = UI_popup_menu_begin(C, title, ICON_NONE);
+                       /* popup_menu stuff does just what we need (but pass 
meaningful block name) */
+                       pup = UI_popup_menu_begin_ex(C, title, __func__, 
ICON_NONE);
                        layout = UI_popup_menu_layout(pup);
                }
                else {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to