Beispiel #1
0
bool MCPlatformGetControlThemePropFont(MCPlatformControlType p_type, MCPlatformControlPart p_part, MCPlatformControlState p_state, MCPlatformThemeProperty p_prop, MCFontRef& r_font)
{
    // The only supported font property is the text font
    if (p_prop != kMCPlatformThemePropertyTextFont)
        return false;
    
    // For legacy theming, the font is always 12-point Arial
    if (p_state & kMCPlatformControlStateCompatibility)
        return MCFontCreate(MCNAME("Arial"), 0, 12, r_font);
    
    // Get the text size for this control type
    int t_text_size;
    if (!MCPlatformGetControlThemePropInteger(p_type, p_part, p_state, kMCPlatformThemePropertyTextSize, t_text_size))
        return false;
    
    // The default font is Roboto of the appropriate size
    return MCFontCreate(MCNAME("Roboto"), 0, t_text_size, r_font);
}
Beispiel #2
0
void MCStoreProductRequestResponseEvent::Dispatch()
{
    bool t_success = true;

	MCPurchase *t_purchase;
    
    if (MCPurchaseFindByProdId(m_product_id, t_purchase))
    {        
        MCAndroidPurchase *t_android_data = (MCAndroidPurchase*)t_purchase->platform_data;
        
		MCAutoArrayRef t_array;
		MCArrayCreateMutable(&t_array);
        
        // SN-2014-06-26 [[ MERGE-6.7 ]]
        // We directly fetch the values from the android data
        // The former code was only retrieving the productId since
        // the other entries don't exist in the s_purchase_property table
#ifdef LEGACY_EXEC
        t_product_id = MCStoreGetPurchaseProperty(m_product_id, "productId");
        t_description = MCStoreGetPurchaseProperty(m_product_id, "description");
        t_title = MCStoreGetPurchaseProperty(m_product_id, "title");
        t_itemType = MCStoreGetPurchaseProperty(m_product_id, "itemType");
        t_price = MCStoreGetPurchaseProperty(m_product_id, "price");
        t_itemImageUrl = MCStoreGetPurchaseProperty(m_product_id, "itemImageUrl");
        t_itemDownloadUrl = MCStoreGetPurchaseProperty(m_product_id, "itemDownloadUrl");
        t_subscriptionDurationUnit = MCStoreGetPurchaseProperty(m_product_id, "subscriptionDurationUnit");
        t_subscriptionDurationMultiplier = MCStoreGetPurchaseProperty(m_product_id, "subscriptionDurationMultiplier");
#endif

		MCArrayStoreValue(*t_array, false, MCNAME("productId"), t_android_data->product_id);
        
        MCParameter p1, p2;
        p1.setvalueref_argument(m_product_id);
        p1.setnext(&p2);
        p2.setvalueref_argument(*t_array);
        
        MCdefaultstackptr->getcurcard()->message(MCM_product_details_received, &p1);
    }    
}
Beispiel #3
0
void MCMailDoComposeMail(MCExecContext& ctxt, MCStringRef p_to, MCStringRef p_cc, MCStringRef p_bcc, MCStringRef p_subject, MCStringRef p_body, MCArrayRef p_attachments, MCMailType p_type)
{	
	bool t_can_send;
	MCMailGetCanSendMail(ctxt, t_can_send);

	if (!t_can_send)
		return;

	MCAutoArray<MCAttachmentData> t_attachments;

	if (p_attachments != nil && !MCArrayIsEmpty(p_attachments))
	{
		MCValueRef t_data;
		MCValueRef t_file;
		MCValueRef t_type;
		MCValueRef t_name;
		MCAttachmentData t_attachment;
		
		if (MCArrayIsSequence(p_attachments))
		{
			for(uindex_t i = 0; i < MCArrayGetCount(p_attachments); i++)
			{
				MCValueRef t_value;
				MCArrayFetchValueAtIndex(p_attachments, i + 1, t_value);
				if (!MCValueIsArray(t_value))
					continue;

                if (!MCArrayFetchValue((MCArrayRef)t_value, false, MCNAME("data"), t_data) ||
                    !ctxt . ConvertToData(t_data, t_attachment . data))
                    t_attachment . data = nil;
                
                if (!MCArrayFetchValue((MCArrayRef)t_value, false, MCNAME("file"), t_file) ||
                    !ctxt . ConvertToString(t_file, t_attachment . file))
                    t_attachment . file = nil;
                
                if (!MCArrayFetchValue((MCArrayRef)t_value, false, MCNAME("type"), t_type) ||
                    !ctxt . ConvertToString(t_type, t_attachment . type))
                    t_attachment . type = nil;
                
                if (!MCArrayFetchValue((MCArrayRef)t_value, false, MCNAME("name"), t_name) ||
                    !ctxt . ConvertToString(t_name, t_attachment . name))
                    t_attachment . name = nil;

				t_attachments . Push(t_attachment);
			}	
		}
		else
		{
			if (!MCArrayFetchValue(p_attachments, false, MCNAME("data"), t_data) ||
                !ctxt . ConvertToData(t_data, t_attachment . data))
                t_attachment . data = nil;
            
            if (!MCArrayFetchValue(p_attachments, false, MCNAME("file"), t_file) ||
                !ctxt . ConvertToString(t_file, t_attachment . file))
                t_attachment . file = nil;
            
            if (!MCArrayFetchValue(p_attachments, false, MCNAME("type"), t_type) ||
                !ctxt . ConvertToString(t_type, t_attachment . type))
                t_attachment . type = nil;
            
            if (!MCArrayFetchValue(p_attachments, false, MCNAME("name"), t_name) ||
                !ctxt . ConvertToString(t_name, t_attachment . name))
                t_attachment . name = nil;
		
			t_attachments . Push(t_attachment);
		}
	}

	MCAutoStringRef t_result;

	MCSystemSendMailWithAttachments(p_to, p_cc, p_bcc, p_subject, p_body, p_type, t_attachments . Ptr(), t_attachments . Size(), &t_result);

	ctxt . SetTheResultToValue(*t_result);
}
Beispiel #4
0
void MCLicenseSetRevLicenseLimits(MCExecContext& ctxt, MCArrayRef p_settings)
{
    if(!MCenvironmentactive)
        return;
    
    bool t_case_sensitive = ctxt . GetCaseSensitive();
    MCValueRef t_value;
    MCStringRef t_string;
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("token"), t_value)
            && ctxt . ConvertToString(t_value, t_string))
    {
        MCValueRelease(MClicenseparameters . license_token);
        MClicenseparameters . license_token = t_string;
    }
    
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("name"), t_value)
            && ctxt . ConvertToString(t_value, t_string))
    {
        MCValueRelease(MClicenseparameters . license_name);
        MClicenseparameters . license_name = t_string;
    }
    
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("organization"), t_value)
            && ctxt . ConvertToString(t_value, t_string))
    {
        MCValueRelease( MClicenseparameters . license_organization);
         MClicenseparameters . license_organization = t_string;
    }
    
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("class"), t_value))
    {
        MCAutoStringRef t_class;
        MCLicenseClass t_license_class;
        if (ctxt . ConvertToString(t_value, &t_class) && MCStringToLicenseClass(*t_class, t_license_class))
        {
            MClicenseparameters . license_class = t_license_class;
        }
        else
            MClicenseparameters . license_class = kMCLicenseClassNone;
    }
    
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("multiplicity"), t_value))
    {
	    MCAutoNumberRef t_number;
	    if (ctxt.ConvertToNumber(t_value, &t_number))
	    {
		    MClicenseparameters . license_multiplicity = MCNumberFetchAsUnsignedInteger(*t_number);
	    }
    }
    
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("scriptlimit"), t_value))
    {
	    MCAutoNumberRef t_number;
	    if (ctxt.ConvertToNumber(t_value, &t_number))
	    {
		    integer_t t_limit;
		    t_limit = MCNumberFetchAsInteger(*t_number);
		    MClicenseparameters . script_limit = t_limit <= 0 ? 0 : t_limit;
	    }
    }
    
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("dolimit"), t_value))
    {
	    MCAutoNumberRef t_number;
	    if (ctxt.ConvertToNumber(t_value, &t_number))
	    {
		    integer_t t_limit;
		    t_limit = MCNumberFetchAsInteger(*t_number);
		    MClicenseparameters . do_limit = t_limit <= 0 ? 0 : t_limit;
	    }
    }
    
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("usinglimit"), t_value))
    {
	    MCAutoNumberRef t_number;
	    if (ctxt.ConvertToNumber(t_value, &t_number))
	    {
		    integer_t t_limit;
		    t_limit = MCNumberFetchAsInteger(*t_number);
		    MClicenseparameters . using_limit = t_limit <= 0 ? 0 : t_limit;
	    }
    }
    
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("insertlimit"), t_value))
    {
	    MCAutoNumberRef t_number;
	    if (ctxt.ConvertToNumber(t_value, &t_number))
	    {
		    integer_t t_limit;
		    t_limit = MCNumberFetchAsInteger(*t_number);
		    MClicenseparameters . insert_limit = t_limit <= 0 ? 0 : t_limit;
	    }
    }
    
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("deploy"), t_value))
    {
        static struct { const char *tag; uint32_t value; } s_deploy_map[] =
        {
            { "windows", kMCLicenseDeployToWindows },
            { "macosx", kMCLicenseDeployToMacOSX },
            { "linux", kMCLicenseDeployToLinux },
            { "ios", kMCLicenseDeployToIOS },
            { "android", kMCLicenseDeployToAndroid },
            { "winmobile", kMCLicenseDeployToWinMobile },
            { "meego", kMCLicenseDeployToLinuxMobile },
            { "server", kMCLicenseDeployToServer },
            { "ios-embedded", kMCLicenseDeployToIOSEmbedded },
            { "android-embedded", kMCLicenseDeployToIOSEmbedded },
            { "html5", kMCLicenseDeployToHTML5 },
            { "filemaker", kMCLicenseDeployToFileMaker },
        };
        
        MClicenseparameters . deploy_targets = 0;
        
        MCAutoStringRef t_params;
        if (ctxt . ConvertToString(t_value, &t_params))
        {
            MCAutoArrayRef t_split_strings;
            MCValueRef t_fetched_string;
            if (MCStringSplit(*t_params, MCSTR(","), nil, kMCCompareExact, &t_split_strings))
            {
                for(uint32_t i = 0; i < MCArrayGetCount(*t_split_strings); i++)
                {
                    // Fetch the string value created with MCStringSplit
                    MCArrayFetchValueAtIndex(*t_split_strings, i+1, t_fetched_string);
                    
                    for(uint32_t j = 0; j < sizeof(s_deploy_map) / sizeof(s_deploy_map[0]); j++)
                        if (MCStringIsEqualToCString((MCStringRef)t_fetched_string, s_deploy_map[j] . tag, kMCStringOptionCompareCaseless))
                        {
                            MClicenseparameters . deploy_targets |= s_deploy_map[j] . value;
                            break;
                        }
                }
            }
        }
    }
    
    if (MCArrayFetchValue(p_settings, t_case_sensitive, MCNAME("addons"), t_value) && MCValueIsArray(t_value))
    {
        MCValueRelease(MClicenseparameters . addons);
        MCArrayCopy((MCArrayRef)t_value, MClicenseparameters . addons);
    }
}