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>2012-12-02 08:51:15 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-02 08:51:15 +0400
commitf7f4148b4004c225a30bb80794094b574fbea744 (patch)
treed8ede9dbd62d0558a303c0d0634b8efd1f0a95ae /source/blender/editors
parent9865ee7637cd58622329c7dbe05c78bc4fe65308 (diff)
change uiButGetStrInfo() to use a trailing NULL arg rather then passing the number of args as an arg.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/interface/interface.c8
-rw-r--r--source/blender/editors/interface/interface_handlers.c4
-rw-r--r--source/blender/editors/interface/interface_ops.c5
-rw-r--r--source/blender/editors/interface/interface_regions.c12
5 files changed, 16 insertions, 15 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index f5c943fbb87..12db9b93772 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -542,7 +542,7 @@ typedef struct uiStringInfo {
/* Note: Expects pointers to uiStringInfo structs as parameters.
* Will fill them with translated strings, when possible.
* Strings in uiStringInfo must be MEM_freeN'ed by caller. */
-void uiButGetStrInfo(struct bContext *C, uiBut *but, int nbr, ...);
+void uiButGetStrInfo(struct bContext *C, uiBut *but, ...);
/* Edit i18n stuff. */
/* Name of the main py op from i18n addon. */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 9037afc472a..ce82e064531 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3797,16 +3797,16 @@ void uiButSetFocusOnEnter(wmWindow *win, uiBut *but)
wm_event_add(win, &event);
}
-void uiButGetStrInfo(bContext *C, uiBut *but, int nbr, ...)
+void uiButGetStrInfo(bContext *C, uiBut *but, ...)
{
va_list args;
+ uiStringInfo *si;
EnumPropertyItem *items = NULL, *item = NULL;
int totitems, free_items = FALSE;
- va_start(args, nbr);
- while (nbr--) {
- uiStringInfo *si = (uiStringInfo *) va_arg(args, void *);
+ va_start(args, but);
+ while ((si = (uiStringInfo *) va_arg(args, void *))) {
int type = si->type;
char *tmp = NULL;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ea53bbba70a..8aa35acc33c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4634,7 +4634,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
uiPopupMenu *pup;
uiLayout *layout;
int length;
- char *name;
+ const char *name;
uiStringInfo label = {BUT_GET_LABEL, NULL};
/* if ((but->rnapoin.data && but->rnaprop) == 0 && but->optype == NULL)*/
@@ -4642,7 +4642,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
button_timers_tooltip_remove(C, but);
- uiButGetStrInfo(C, but, 1, &label);
+ uiButGetStrInfo(C, but, &label, NULL);
name = label.strinfo;
pup = uiPupMenuBegin(C, name, ICON_NONE);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index e7a5f993d32..e57e52d74b6 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -960,7 +960,6 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
const char *root = U.i18ndir;
const char *uilng = BLF_lang_get();
- const int bufs_nbr = 10;
uiStringInfo but_label = {BUT_GET_LABEL, NULL};
uiStringInfo rna_label = {BUT_GET_RNA_LABEL, NULL};
uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL};
@@ -990,8 +989,8 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- uiButGetStrInfo(C, but, bufs_nbr, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
- &rna_struct, &rna_prop, &rna_enum, &rna_ctxt);
+ uiButGetStrInfo(C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
+ &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL);
WM_operator_properties_create(&ptr, EDTSRC_I18N_OP_NAME);
RNA_string_set(&ptr, "lang", uilng);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 7c099de9c1e..2c4f2e1d33b 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -426,7 +426,6 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
rctf rect_fl;
rcti rect_i;
- const int nbr_info = 6;
uiStringInfo but_tip = {BUT_GET_TIP, NULL};
uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL};
uiStringInfo enum_tip = {BUT_GET_RNAENUM_TIP, NULL};
@@ -440,7 +439,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* create tooltip data */
data = MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
- uiButGetStrInfo(C, but, nbr_info, &but_tip, &enum_label, &enum_tip, &op_keymap, &rna_struct, &rna_prop);
+ uiButGetStrInfo(C, but, &but_tip, &enum_label, &enum_tip, &op_keymap, &rna_struct, &rna_prop, NULL);
/* special case, enum rna buttons only have enum item description,
* use general enum description too before the specific one */
@@ -616,13 +615,16 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
}
#else
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0 && !but->optype && rna_struct.strinfo) {
- if (rna_prop.strinfo)
+ if (rna_prop.strinfo) {
/* Struct and prop */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]),
TIP_("Python: %s.%s"), rna_struct.strinfo, rna_prop.strinfo);
- else
+ }
+ else {
/* Only struct (e.g. menus) */
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), rna_struct.strinfo);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]),
+ TIP_("Python: %s"), rna_struct.strinfo);
+ }
data->color_id[data->totline] = UI_TIP_LC_PYTHON;
data->totline++;
}