void MCArraysExecSplit(MCExecContext& ctxt, MCStringRef p_string, MCStringRef p_element_delimiter, MCStringRef p_key_delimiter, MCArrayRef& r_array) { if (MCStringSplit(p_string, p_element_delimiter, p_key_delimiter, ctxt . GetStringComparisonType(), r_array)) return; ctxt . Throw(); }
void MCButton::SetStyle(MCExecContext& ctxt, intenum_t p_style) { flags &= ~(F_STYLE | F_DISPLAY_STYLE | F_ALIGNMENT); if (entry != NULL) deleteentry(); switch (p_style) { case kMCButtonStyleStandard: flags |= F_STANDARD | F_SHOW_BORDER | F_OPAQUE | F_ALIGN_CENTER | F_HILITE_BOTH | F_ARM_BORDER; break; case kMCButtonStyleMenu: case kMCButtonStylePopup: flags |= F_MENU | F_SHOW_BORDER | F_OPAQUE | F_ALIGN_CENTER | F_ARM_BORDER; if (menumode == WM_COMBO) createentry(); if (menumode == WM_TOP_LEVEL) { MCValueRelease(tabs); /* UNCHECKED */ MCStringSplit(menustring, MCSTR("\n"), nil, kMCStringOptionCompareExact, tabs); } break; case kMCButtonStyleCheck: flags |= F_CHECK | F_ALIGN_LEFT; break; case kMCButtonStyleRadio: flags |= F_RADIO | F_ALIGN_LEFT; flags &= ~F_SHARED_HILITE; break; case kMCButtonStyleRoundrect: flags |= F_ROUNDRECT | F_SHOW_BORDER | F_OPAQUE | F_ALIGN_CENTER | F_HILITE_FILL; break; case kMCButtonStyleRectangle: flags |= F_RECTANGLE | F_SHOW_BORDER | F_OPAQUE | F_ALIGN_CENTER | F_HILITE_BOTH | F_ARM_BORDER; break; case kMCButtonStyleOval: flags |= F_OVAL_BUTTON | F_HILITE_FILL; break; case kMCButtonStyleTransparent: flags |= F_STANDARD | F_ALIGN_CENTER; break; case kMCButtonStyleShadow: flags |= F_STANDARD | F_SHOW_BORDER | F_OPAQUE | F_SHADOW | F_ALIGN_CENTER | F_HILITE_BOTH | F_ARM_BORDER; break; case kMCButtonStyleShowBorder: flags |= F_STANDARD | F_OPAQUE | F_ALIGN_CENTER | F_HILITE_FILL | F_ARM_BORDER; break; default: break; } // MW-2011-09-21: [[ Layers ]] Make sure the layerattrs are recomputed. m_layer_attr_changed = true; Redraw(); }
void MCButton::SetMenuMode(MCExecContext& ctxt, intenum_t p_mode) { if (entry != nil) deleteentry(); else freemenu(False); setmenumode((uint1)p_mode); if (p_mode == WM_COMBO) createentry(); else if (p_mode == WM_TOP_LEVEL) { if (getstyleint(flags) == F_MENU) { MCValueRelease(tabs); /* UNCHECKED */ MCStringSplit(menustring, MCSTR("\n"), nil, kMCStringOptionCompareExact, tabs); } } Redraw(); }
void MCArraysExecSplitAsSet(MCExecContext& ctxt, MCStringRef p_string, MCStringRef p_element_delimiter, MCArrayRef& r_array) { // Split the incoming string into its components MCAutoArrayRef t_keys; if (!MCStringSplit(p_string, p_element_delimiter, nil, ctxt . GetStringComparisonType(), &t_keys)) { ctxt . Throw(); return; } // The new array, with keys equal to the components of the string MCAutoArrayRef t_array; if (!MCArrayCreateMutable(&t_array)) { ctxt . Throw(); return; } MCNameRef t_key_ignored; MCValueRef t_value; uintptr_t t_iterator = 0; while (MCArrayIterate(*t_keys, t_iterator, t_key_ignored, t_value)) { // The value stored at each key is a boolean "true" MCNewAutoNameRef t_keyname; if (!ctxt . ConvertToName(t_value, &t_keyname) || !MCArrayStoreValue(*t_array, ctxt . GetCaseSensitive(), *t_keyname, kMCTrue)) { ctxt . Throw(); return; } } MCArrayCopy(*t_array, r_array); }
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); } }