Beispiel #1
0
void MCA_setcolordialogcolors(MCExecPoint& p_ep)
{
	const char * t_color_list;
	t_color_list = p_ep.getcstring();
    
	if (t_color_list != NULL)
	{
		MCColor t_colors[16];
		char *t_colornames[16];
		int i;
        
		for (i = 0 ; i < 16 ; i++)
			t_colornames[i] = NULL;
        
		MCscreen->parsecolors(t_color_list, t_colors, t_colornames, 16);
        
		for(i=0;i < 16;i++)
		{
			if (t_colors[i] . flags != 0)
				s_colordialogcolors[i] = RGB(t_colors[i].red >> 8, t_colors[i].green >> 8,
                                             t_colors[i].blue >> 8);
			else
				s_colordialogcolors[i] = NULL;
            
            delete t_colornames[i];
		}
Beispiel #2
0
bool MCNativeControl::ParseSet(MCExecPoint& ep, MCNativeControlEnumEntry *p_entries, int32_t& r_value)
{
    bool t_success = true;
    
	char **t_members_array;
	uint32_t t_members_count;
	t_members_array = nil;
	t_members_count = 0;
	if (t_success)
		t_success = MCCStringSplit(ep.getcstring(), ',', t_members_array, t_members_count);
	
	int32_t t_members_set;
	t_members_set = 0;
	if (t_success)
		for(uint32_t i = 0; t_success && i < t_members_count; i++)
        {
            bool t_found = false;
			for(uint32_t j = 0; !t_found && p_entries[j].key != nil; j++)
            {
				if (MCCStringEqualCaseless(t_members_array[i], p_entries[j].key))
                {
					t_members_set |= p_entries[j].value;
                    t_found = true;
                }
            }
            if (!t_found)
                t_success = false;
        }
	
	for(uint32_t i = 0; i < t_members_count; i++)
		MCCStringFree(t_members_array[i]);
	MCMemoryDeleteArray(t_members_array);
    
    if (t_success)
        r_value = t_members_set;
    
	return t_success;
}
Beispiel #3
0
Exec_stat MCAndroidPlayerControl::Set(MCNativeControlProperty p_property, MCExecPoint &ep)
{
    bool t_bool = false;
    int32_t t_integer;
    
    jobject t_view;
    t_view = GetView();
    
    switch (p_property)
    {
        case kMCNativeControlPropertyContent:
        {
            bool t_success = true;
            MCCStringFree(m_path);
            t_success = MCCStringClone(ep.getcstring(), m_path);
            if (MCCStringBeginsWith(m_path, "http://") || MCCStringBeginsWith(m_path, "https://"))
            {
                MCAndroidObjectRemoteCall(t_view, "setUrl", "bs", &t_success, m_path);
            }
            else
            {
                char *t_resolved_path = nil;
                bool t_is_asset = false;
                const char *t_asset_path = nil;
                
                t_resolved_path = MCS_resolvepath(m_path);
                t_is_asset = path_to_apk_path(t_resolved_path, t_asset_path);
                
                MCAndroidObjectRemoteCall(t_view, "setFile", "bsb", &t_success, t_is_asset ? t_asset_path : t_resolved_path, t_is_asset);
                
                MCCStringFree(t_resolved_path);
            }
            return ES_NORMAL;
        }
            
        case kMCNativeControlPropertyShowController:
        {
            if (!ParseBoolean(ep, t_bool))
                return ES_ERROR;
            MCAndroidObjectRemoteCall(t_view, "setShowController", "vb", nil, t_bool);
            return ES_NORMAL;
        }
            
        case kMCNativeControlPropertyCurrentTime:
        {
            if (!ParseInteger(ep, t_integer))
                return ES_ERROR;
            MCAndroidObjectRemoteCall(t_view, "setCurrentTime", "vi", nil, t_integer);
            return ES_NORMAL;
        }
            
        case kMCNativeControlPropertyLooping:
        {
            if (!ParseBoolean(ep, t_bool))
                return ES_ERROR;
            MCAndroidObjectRemoteCall(t_view, "setLooping", "vb", nil, t_bool);
            return ES_NORMAL;
        }
            
        default:
            break;
    }
    
    return MCAndroidControl::Set(p_property, ep);
}