Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-02-09 05:28:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-09 05:32:20 +0400
commitb105d2ac7fbccd3998c9a01c297edc8ef9fce4cb (patch)
tree6f3127ea83327bfe7ad9550a60309191b9d610b3 /source/blender/editors
parent873f901e5a3d0d10c4cca579ce1f2aaed852b1e8 (diff)
UI: replace uiPupMenuOkee & uiPupMenuSaveOver with WM_operator_confirm
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/UI_interface.h4
-rw-r--r--source/blender/editors/interface/interface_regions.c80
-rw-r--r--source/blender/editors/space_info/info_ops.c3
3 files changed, 2 insertions, 85 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index a0a2fde7f92..55c15ab60ad 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -348,10 +348,8 @@ struct uiPopupMenu *uiPupMenuBegin(struct bContext *C, const char *title, int ic
void uiPupMenuEnd(struct bContext *C, struct uiPopupMenu *head);
struct uiLayout *uiPupMenuLayout(uiPopupMenu *head);
-void uiPupMenuOkee(struct bContext *C, const char *opname, const char *str, ...) ATTR_PRINTF_FORMAT(3, 4);
-void uiPupMenuSaveOver(struct bContext *C, struct wmOperator *op, const char *filename);
void uiPupMenuReports(struct bContext *C, struct ReportList *reports) ATTR_NONNULL();
-void uiPupMenuInvoke(struct bContext *C, const char *idname); /* popup registered menu */
+void uiPupMenuInvoke(struct bContext *C, const char *idname) ATTR_NONNULL();
/* Popup Blocks
*
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index f1a03bc6b94..2770e657ea0 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2607,86 +2607,6 @@ uiLayout *uiPupMenuLayout(uiPopupMenu *pup)
/*************************** Standard Popup Menus ****************************/
-static void operator_name_cb(bContext *C, void *arg, int retval)
-{
- const char *opname = arg;
-
- if (opname && retval > 0)
- WM_operator_name_call(C, opname, WM_OP_EXEC_DEFAULT, NULL);
-}
-
-static void operator_cb(bContext *C, void *arg, int retval)
-{
- wmOperator *op = arg;
-
- if (op && retval > 0)
- WM_operator_call(C, op);
- else
- WM_operator_free(op);
-}
-
-static void confirm_cancel_operator(bContext *UNUSED(C), void *opv)
-{
- WM_operator_free(opv);
-}
-
-static void vconfirm_opname(bContext *C, const char *opname, const char *title,
- const char *itemfmt, va_list ap) ATTR_PRINTF_FORMAT(4, 0);
-static void vconfirm_opname(bContext *C, const char *opname, const char *title,
- const char *itemfmt, va_list ap)
-{
- uiPopupBlockHandle *handle;
- char *s, buf[512];
-
- s = buf;
- if (title) s += sprintf(s, "%s%%t|", title);
- vsnprintf(s, sizeof(buf) - (s - buf), itemfmt, ap);
- buf[sizeof(buf) - 1] = '\0';
-
- handle = ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf);
-
- handle->popup_func = operator_name_cb;
- handle->popup_arg = (void *)opname;
-}
-
-static void confirm_operator(bContext *C, wmOperator *op, const char *title, const char *item)
-{
- uiPopupBlockHandle *handle;
- char *s, buf[512];
-
- s = buf;
- if (title) s += BLI_snprintf(s, sizeof(buf), "%s%%t|%s", title, item);
- (void)s;
-
- handle = ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf);
-
- handle->popup_func = operator_cb;
- handle->popup_arg = op;
- handle->cancel_func = confirm_cancel_operator;
-}
-
-void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...)
-{
- va_list ap;
- char titlestr[256];
-
- BLI_snprintf(titlestr, sizeof(titlestr), IFACE_("OK? %%i%d"), ICON_QUESTION);
-
- va_start(ap, str);
- vconfirm_opname(C, opname, titlestr, str, ap);
- va_end(ap);
-}
-
-/* note, only call this is the file exists,
- * the case where the file does not exist so can be saved without a
- * popup must be checked for already, since saving from here
- * will free the operator which will break invoke().
- * The operator state for this is implicitly OPERATOR_RUNNING_MODAL */
-void uiPupMenuSaveOver(bContext *C, wmOperator *op, const char *filename)
-{
- confirm_operator(C, op, IFACE_("Save Over?"), filename);
-}
-
void uiPupMenuReports(bContext *C, ReportList *reports)
{
Report *report;
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index ac0023e8cc2..25fa31407ff 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -188,8 +188,7 @@ static int pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev
}
if (ima) {
- uiPupMenuOkee(C, "FILE_OT_pack_all", "Some images are painted on. These changes will be lost. Continue?");
- return OPERATOR_CANCELLED;
+ return WM_operator_confirm_message(C, op, "Some images are painted on. These changes will be lost. Continue?");
}
return pack_all_exec(C, op);