Code cleanup: remove more string encoded menu functions

This commit is contained in:
2014-02-15 11:35:40 +11:00
parent 67ba7e50d4
commit 01d9bbaa5e
5 changed files with 5 additions and 151 deletions

View File

@@ -102,13 +102,6 @@ void BKE_library_make_local(struct Main *bmain, struct Library *lib, bool untagg
struct ID *BKE_libblock_find_name(const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
#if 0
void IDnames_to_pupstring(const char **str, const char *title, const char *extraops,
struct ListBase *lb, struct ID *link, short *nr);
void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops,
struct ListBase *lb, struct ID *link, short *nr);
#endif
void set_free_windowmanager_cb(void (*func)(struct bContext *, struct wmWindowManager *) );
void set_free_notifier_reference_cb(void (*func)(const void *) );

View File

@@ -1096,135 +1096,6 @@ ID *BKE_libblock_find_name(const short type, const char *name) /* type: "OB
return BLI_findstring(lb, name, offsetof(ID, name) + 2);
}
#if 0 /* UNUSED */
#define MAX_IDPUP 60 /* was 24 */
static void get_flags_for_id(ID *id, char *buf)
{
int isfake = id->flag & LIB_FAKEUSER;
int isnode = 0;
/* Writeout the flags for the entry, note there
* is a small hack that writes 5 spaces instead
* of 4 if no flags are displayed... this makes
* things usually line up ok - better would be
* to have that explicit, oh well - zr
*/
if (GS(id->name) == ID_MA)
isnode = ((Material *)id)->use_nodes;
if (GS(id->name) == ID_TE)
isnode = ((Tex *)id)->use_nodes;
if (id->us < 0)
strcpy(buf, "-1W ");
else if (!id->lib && !isfake && id->us && !isnode)
strcpy(buf, " ");
else if (isnode)
sprintf(buf, "%c%cN%c ", id->lib ? 'L' : ' ', isfake ? 'F' : ' ', (id->us == 0) ? 'O' : ' ');
else
sprintf(buf, "%c%c%c ", id->lib ? 'L' : ' ', isfake ? 'F' : ' ', (id->us == 0) ? 'O' : ' ');
}
#define IDPUP_NO_VIEWER 1
static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, short *nr, int hideflag)
{
int i, nids = BLI_countlist(lb);
if (nr) *nr = -1;
if (nr && nids > MAX_IDPUP) {
BLI_dynstr_append(pupds, "DataBrowse %x-2");
*nr = -2;
}
else {
ID *id;
for (i = 0, id = lb->first; id; id = id->next, i++) {
char numstr[32];
if (nr && id == link) *nr = i + 1;
if (U.uiflag & USER_HIDE_DOT && id->name[2] == '.')
continue;
if (hideflag & IDPUP_NO_VIEWER)
if (GS(id->name) == ID_IM)
if ( ((Image *)id)->source == IMA_SRC_VIEWER)
continue;
get_flags_for_id(id, numstr);
BLI_dynstr_append(pupds, numstr);
BLI_dynstr_append(pupds, id->name + 2);
BLI_snprintf(numstr, sizeof(numstr), "%%x%d", i + 1);
BLI_dynstr_append(pupds, numstr);
/* icon */
switch (GS(id->name)) {
case ID_MA: /* fall through */
case ID_TE: /* fall through */
case ID_IM: /* fall through */
case ID_WO: /* fall through */
case ID_LA: /* fall through */
BLI_snprintf(numstr, sizeof(numstr), "%%i%d", BKE_icon_getid(id));
BLI_dynstr_append(pupds, numstr);
break;
default:
break;
}
if (id->next)
BLI_dynstr_append(pupds, "|");
}
}
}
/* used by headerbuttons.c buttons.c editobject.c editseq.c */
/* if (nr == NULL) no MAX_IDPUP, this for non-header browsing */
void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr)
{
DynStr *pupds = BLI_dynstr_new();
if (title) {
BLI_dynstr_append(pupds, title);
BLI_dynstr_append(pupds, "%t|");
}
if (extraops) {
BLI_dynstr_append(pupds, extraops);
if (BLI_dynstr_get_len(pupds))
BLI_dynstr_append(pupds, "|");
}
IDnames_to_dyn_pupstring(pupds, lb, link, nr, 0);
*str = BLI_dynstr_get_cstring(pupds);
BLI_dynstr_free(pupds);
}
/* skips viewer images */
void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr)
{
DynStr *pupds = BLI_dynstr_new();
if (title) {
BLI_dynstr_append(pupds, title);
BLI_dynstr_append(pupds, "%t|");
}
if (extraops) {
BLI_dynstr_append(pupds, extraops);
if (BLI_dynstr_get_len(pupds))
BLI_dynstr_append(pupds, "|");
}
IDnames_to_dyn_pupstring(pupds, lb, link, nr, IDPUP_NO_VIEWER);
*str = BLI_dynstr_get_cstring(pupds);
BLI_dynstr_free(pupds);
}
#endif
void id_sort_by_name(ListBase *lb, ID *id)
{
ID *idtest;

View File

@@ -165,6 +165,7 @@ void BIF_makeListTemplates(const bContext *C)
}
}
#if 0 /* UNUSED */
const char *BIF_listTemplates(const bContext *UNUSED(C))
{
GHashIterator ghi;
@@ -194,6 +195,7 @@ const char *BIF_listTemplates(const bContext *UNUSED(C))
return TEMPLATES_MENU;
}
#endif
int BIF_currentTemplate(const bContext *C)
{

View File

@@ -187,7 +187,6 @@ void BIF_deleteSketch(struct bContext *C);
void BIF_selectAllSketch(struct bContext *C, int mode); /* -1: deselect, 0: select, 1: toggle */
void BIF_makeListTemplates(const struct bContext *C);
const char *BIF_listTemplates(const struct bContext *C);
int BIF_currentTemplate(const struct bContext *C);
void BIF_freeTemplates(struct bContext *C);
void BIF_setTemplate(struct bContext *C, int index);

View File

@@ -4168,22 +4168,11 @@ void uiButGetStrInfo(bContext *C, uiBut *but, ...)
if (type == BUT_GET_LABEL) {
if (but->str) {
/* Menu labels can have some complex formating stuff marked by pipes or %t, we don't want those here! */
const char *tc1, *tc2;
tc1 = strstr(but->str, "%t");
tc2 = strstr(but->str, UI_SEP_CHAR_S);
if (tc2 && (!tc1 || tc1 > tc2))
tc1 = tc2;
if (tc1)
tmp = BLI_strdupn(but->str, tc1 - but->str);
else
tmp = BLI_strdup(but->str);
tmp = BLI_strdup(but->str);
}
else
else {
type = BUT_GET_RNA_LABEL; /* Fail-safe solution... */
}
}
else if (type == BUT_GET_TIP) {
if (but->tip && but->tip[0])