Beispiel #1
0
Exec_stat MCObject::getproparray(MCExecPoint &ep, uint4 parid, bool effective)
{
	PropList *table;
	uint2 tablesize;

	switch (gettype())
	{
	case CT_STACK:
		table = stackprops;
		tablesize = ELEMENTS(stackprops);
		break;
	case CT_CARD:
		table = cardprops;
		tablesize = ELEMENTS(cardprops);
		break;
	case CT_GROUP:
		table = groupprops;
		tablesize = ELEMENTS(groupprops);
		break;
	case CT_BUTTON:
		table = buttonprops;
		tablesize = ELEMENTS(buttonprops);
		break;
	case CT_FIELD:
		table = fieldprops;
		tablesize = ELEMENTS(fieldprops);
		break;
	case CT_IMAGE:
		table = imageprops;
		tablesize = ELEMENTS(imageprops);
		break;
	case CT_GRAPHIC:
		table = graphicprops;
		tablesize = ELEMENTS(graphicprops);
		break;
	case CT_SCROLLBAR:
		table = scrollbarprops;
		tablesize = ELEMENTS(scrollbarprops);
		break;
	case CT_PLAYER:
		table = playerprops;
		tablesize = ELEMENTS(playerprops);
		break;
	case CT_EPS:
		table = epsprops;
		tablesize = ELEMENTS(epsprops);
		break;
	case CT_COLOR_PALETTE:
		table = colorpaletteprops;
		tablesize = ELEMENTS(colorpaletteprops);
		break;
	case CT_AUDIO_CLIP:
		table = audioclipprops;
		tablesize = ELEMENTS(audioclipprops);
		break;
	case CT_VIDEO_CLIP:
		table = videoclipprops;
		tablesize = ELEMENTS(videoclipprops);
		break;
	default:
		return ES_NORMAL;
	}
	MCVariableValue *v = new MCVariableValue;
	v->assign_new_array(64);
	MCerrorlock++;
	while (tablesize--)
	{
        const char * t_token = table[tablesize].token;
        
        if ((Properties)table[tablesize].value > P_FIRST_ARRAY_PROP)
            getarrayprop(parid, (Properties)table[tablesize].value, ep, kMCEmptyName, effective);
        else
        {
            // MERG-2013-05-07: [[ RevisedPropsProp ]] Special-case the props that could
			//   be either Unicode or native (ensure minimal encoding is used).
			// MERG-2013-06-24: [[ RevisedPropsProp ]] Treat the short name specially to ensure
			//   round-tripping. If the name is empty, then return empty for 'name'.
            switch ((Properties)table[tablesize].value) {
                case P_SHORT_NAME:
                    if (isunnamed())
                        ep.clear();
                    else
                        getprop(parid, P_SHORT_NAME, ep, effective);
                    break;
                case P_LABEL:
                    getprop(parid, P_UNICODE_LABEL, ep, effective);
                    if (!ep.trytoconvertutf16tonative())
                    {
                        if (gettype() == CT_STACK)
                            t_token = "unicodeTitle";
                        else
                            t_token = "unicodeLabel";
                    }
                    break;
                case P_TOOL_TIP:
                    getprop(parid, P_UNICODE_TOOL_TIP, ep, effective);
                    if (!ep.trytoconvertutf16tonative())
                        t_token = "unicodeToolTip";
                    break;
                case P_TEXT:
                    if (gettype() == CT_BUTTON)
                    {
                        getprop(parid, P_UNICODE_TEXT, ep, effective);
                        if (!ep.trytoconvertutf16tonative())
                            t_token = "unicodeText";
                        break;
                    }
                default:
                    getprop(parid, (Properties)table[tablesize].value, ep, effective);
                    break;
            }
        }
        
        v->store_element(ep, t_token);
	}
	MCerrorlock--;
	ep.setarray(v, True);
	return ES_NORMAL;
}