void particle_controller::DetectCompositeParticles() { int primsum = 1; for (int i = 0; i < maxParticles; i++) { if (!spaces[i]) { primsum *= particles[i]->GetPrimID(); } } int i = maxParticles; switch (primsum) { case 13013: // Proton DeleteParticles(); i = CreateNew(particle::PROTON); particles[i]->AnimatedCreation(); break; case 11011: // Neutron DeleteParticles(); i = CreateNew(particle::NEUTRON); particles[i]->AnimatedCreation(); break; } if (i != maxParticles) { DeSelect(i); particles[i]->SetLocation(xSize/2 - particles[i]->GetWidth()/2, ySize/2 - particles[i]->GetHeight()/2); } }
static kbool_t FuelVM_VisitNewNode(KonohaContext *kctx, KBuilder *builder, kNode *expr, void *thunk) { enum TypeId Type = ConvertToTypeId(kctx, expr->attrTypeId); INode *Expr = CreateNew(BLD(builder), expr->unboxConstValue, Type); builder->Value = Expr; return true; }
// base clone function GError GProperty::BaseClone(const GElement& Source) { const GProperty& p = (const GProperty&)Source; if (p.gEaseProperty) { GProperty *tmpProp = (GProperty *)CreateNew(p.gEaseProperty->ClassID()); if (tmpProp) { GError err = tmpProp->CopyFrom(*(p.gEaseProperty)); if (err != G_NO_ERROR) return err; delete gEaseProperty; gEaseProperty = tmpProp; } else return G_MEMORY_ERROR; } gName = p.gName; gUpperName = p.gUpperName; gApplyEase = p.gApplyEase; gOORBefore = p.gOORBefore; gOORAfter = p.gOORAfter; gIsKeyBased = p.gIsKeyBased; gCachedValue = p.gCachedValue; return GAnimElement::BaseClone(Source); }
// add a property GProperty* GAnimElement::AddProperty(const GString& Name, const GClassID& ClassID, const GKeyValue& DefaultValue, GBool& AlreadyExist, GUInt32& PropertyIndex) { GProperty* tmpProp; // first try to see if the property already exists tmpProp = FindProperty(Name, PropertyIndex); if (tmpProp) AlreadyExist = G_TRUE; else AlreadyExist = G_FALSE; // if the property does not exist, lets create a new one if (!AlreadyExist) { tmpProp = (GProperty *)CreateNew(ClassID); // if creation has succeed, set property name and push it into internal list if (tmpProp) { // set default/cached tmpProp->SetDefaultValue(DefaultValue); // set name tmpProp->SetName(Name); // insert the property maintaining the order (by name, case-insensitive) GDynArray<GProperty *>::iterator it = gProperties.begin(); it += PropertyIndex; gProperties.insert(it, tmpProp); } } return tmpProp; }
Object* ObjectFactory::CreateNew(unsigned long typeId) { auto c = core::reflection::MetaGraph::Get().Get(typeId); if (c) { return CreateNew(c->GetName()); } else { return nullptr; } }
/** * @brief 全てのテキストをセットします */ void CFootyDoc::SetText( const wchar_t *pString ) { // データをセットする CreateNew(m_nGlobalID); InsertString( pString, false, false, true ); // 変数の初期化 m_cCaretPos.SetPosition(&m_lsLines,0,0); SendMoveCaretCallBack(); }
/*! If element can't be created a NULL pointer is returned. \note Class name comparison is case-insensitive. */ GElement* GElement::CreateNew(const GString& Class_Name) { GClassID cid; GError err; err = ClassIDFromClassName(Class_Name, cid); if (err == G_NO_ERROR) return CreateNew(cid); return NULL; }
BlockManager::BlockManager(IFile* pFile, bool truncate, offset_type blocksize) :m_pFile(pFile), m_Header(blocksize, offset_type(-1), offset_type(0)), m_pLock(new FileLock) { if(truncate) { CreateNew(blocksize); } else { LoadExist(blocksize); } }
DMenu *CreateMessageBoxMenu(DMenu *parent, const char *message, int messagemode, bool playsound, FName action = NAME_None, hfunc handler = nullptr) { auto c = PClass::FindClass(gameinfo.MessageBoxClass); if (!c->IsDescendantOf(NAME_MessageBoxMenu)) c = PClass::FindClass(NAME_MessageBoxMenu); auto p = c->CreateNew(); FString namestr = message; IFVIRTUALPTRNAME(p, NAME_MessageBoxMenu, Init) { VMValue params[] = { p, parent, &namestr, messagemode, playsound, action.GetIndex(), reinterpret_cast<void*>(handler) }; VMCall(func, params, countof(params), nullptr, 0); return (DMenu*)p; }
static kbool_t FuelVM_VisitFunctionNode(KonohaContext *kctx, KBuilder *builder, kNode *expr, void *thunk) { /* * [FunctionExpr] := new Function(method, env1, env2, ...) * expr->NodeList = [method, defObj, env1, env2, ...] **/ enum TypeId Type; kMethod *mtd = CallNode_getMethod(expr); kObject *obj = expr->NodeList->ObjectItems[1]; INode *MtdObj = CreateObject(BLD(builder), KType_Method, (void *) mtd); Type = ConvertToTypeId(kctx, kObject_class(obj)->typeId); INode *NewEnv = CreateNew(BLD(builder), 0, Type); size_t i, ParamSize = kArray_size(expr->NodeList)-2; for(i = 0; i < ParamSize; i++) { kNode *envN = kNode_At(expr, i+2); enum TypeId FieldType = ConvertToTypeId(kctx, envN->attrTypeId); INode *Node = CreateField(BLD(builder), FieldScope, FieldType, NewEnv, i); SUGAR VisitNode(kctx, builder, envN, thunk); CreateUpdate(BLD(builder), Node, FuelVM_getExpression(builder)); } Type = ConvertToTypeId(kctx, expr->attrTypeId); INode *NewFunc = CreateNew(BLD(builder), 0, Type); kNameSpace *ns = kNode_ns(expr); mtd = KLIB kNameSpace_GetMethodByParamSizeNULL(kctx, ns, KClass_Func, KMethodName_("_Create"), 2, KMethodMatch_NoOption); INode *CallMtd = CreateObject(BLD(builder), KType_Method, (void *) mtd); INode *Params[4]; Params[0] = CallMtd; Params[1] = NewFunc; Params[2] = NewEnv; Params[3] = MtdObj; builder->Value = CreateICall(BLD(builder), Type, DefaultCall, kNode_uline(expr), Params, 4); return true; }
void OnContent() { // std::cout << GetContentLength() << std::endl; gettime(&m_reply, NULL); { double treply = Diff(m_send, m_reply); // g_min_time2 = treply < g_min_time2 ? treply : g_min_time2; g_max_time2 = treply > g_max_time2 ? treply : g_max_time2; g_tot_time2 += treply; g_ant2 += 1; } gBytesIn += GetBytesReceived(true); gBytesOut += GetBytesSent(true); CreateNew(); }
IWMProfile* CProfile::GetWMProfile(void) { // Get windows media profile. This function is called // when the stream is to be encoded. If we do not have // the object yet, we create it using the settings we currently // have on the thingy DestroyObjects(); if (m_pIWMProfile == NULL) CreateNew(); else _ASSERT(FALSE); return m_pIWMProfile; }
GError GProperty::SetEaseProperty(const GProperty& EaseProperty) { // simple check, ease properties must have a scalar value if (EaseProperty.HandledType() != G_REAL_KEY) return G_INVALID_PARAMETER; // delete current ease property if (gEaseProperty) delete gEaseProperty; // create a new ease property gEaseProperty = (GProperty *)CreateNew(EaseProperty.ClassID()); if (gEaseProperty) // clone ease property from specified source return gEaseProperty->CopyFrom(EaseProperty); else return G_MEMORY_ERROR; }
Socket* SocketLookupTable::Fetch(UsageEnvironment& env, Port port, Boolean& isNew) { isNew = False; Socket* sock; do { sock = (Socket*) fTable->Lookup((char*)(long)(port.num())); if (sock == NULL) { // we need to create one: sock = CreateNew(env, port); if (sock == NULL || sock->socketNum() < 0) break; fTable->Add((char*)(long)(port.num()), (void*)sock); isNew = True; } return sock; } while (0); delete sock; return NULL; }
ComPtr<CanvasSwapChain> CanvasSwapChain::CreateNew( ICanvasDevice* device, ICoreWindow* coreWindow, float dpi) { CheckInPointer(device); CheckInPointer(coreWindow); Rect bounds; ThrowIfFailed(coreWindow->get_Bounds(&bounds)); return CreateNew( device, coreWindow, bounds.Width, bounds.Height, dpi, CanvasSwapChain::DefaultPixelFormat, CanvasSwapChain::DefaultBufferCount); }
UObject* UFaceFXActorFactory::FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) { return CreateNew(InClass, InParent, InName, Flags, FCompilationBeforeDeletionDelegate::CreateStatic(&UFaceFXActorFactory::OnFxActorCompilationBeforeDelete), GetCurrentFilename()); }
void ThemeInterfaceView::MessageReceived(BMessage *_msg) { ThemeManager *tman; int32 value; int32 id; _msg->PrintToStream(); switch(_msg->what) { case B_REFS_RECEIVED: _msg->PrintToStream(); break; case kMakeScreenshot: AddScreenshot(); break; case kThemeSelected: ThemeSelected(); break; case kApplyThemeBtn: ApplySelected(); break; case kCreateThemeBtn: if (fNameText->IsHidden()) { float w = fNameText->Bounds().Width() + 10.0; fNameText->Show(); fNameText->MakeFocus(); fNewBtn->MoveBy(w, 0); fSaveBtn->MoveBy(w, 0); fDeleteBtn->MoveBy(w, 0); break; } else { float w = fNameText->Bounds().Width() + 10.0; fNameText->Hide(); fNameText->MakeFocus(false); fNewBtn->MoveBy(-w, 0); fSaveBtn->MoveBy(-w, 0); fDeleteBtn->MoveBy(-w, 0); } /* FALLTHROUGH */ case kReallyCreateTheme: CreateNew(fNameText->Text()); break; case kSaveThemeBtn: SaveSelected(); break; case kDeleteThemeBtn: DeleteSelected(); break; #if 0 case kColorsChanged: case kGeneralChanged: case kFontsChanged: { BMessenger msgr (Parent()); msgr.SendMessage(B_PREF_APP_ENABLE_REVERT); BMessage changes; if (_msg->FindMessage("changes", &changes) == B_OK) { update_ui_settings(changes); } break; } #endif case B_PREF_APP_SET_DEFAULTS: { ApplyDefaults(); break; } case B_PREF_APP_REVERT: { Revert(); break; } case B_PREF_APP_ADDON_REF: { break; } case kThemeChanged: { /* BMessage data; BMessage names; get_ui_settings(&data, &names); fColorSelector->Update(data); fFontSelector->Refresh(); fGeneralSelector->Refresh(data); */ break; } case CB_APPLY: tman = GetThemeManager(); _msg->PrintToStream(); if (_msg->FindInt32("be:value", &value) < B_OK) value = false; if (_msg->FindInt32("addon", &id) < B_OK) break; if (id > -1) { tman->SetAddonFlags(id, (tman->AddonFlags(id) & ~Z_THEME_ADDON_DO_SET_ALL) | (value?Z_THEME_ADDON_DO_SET_ALL:0)); } else { // apply globally int32 i; for (i = fAddonList->CountItems() - 1; i > 0; i--) { ThemeAddonItem *item = static_cast<ThemeAddonItem *>(fAddonList->ItemAt(i)); item->ApplyBox()->SetValue(value); tman->SetAddonFlags(item->AddonId(), (tman->AddonFlags(item->AddonId()) & ~Z_THEME_ADDON_DO_SET_ALL) | (value?Z_THEME_ADDON_DO_SET_ALL:0)); } } break; case CB_SAVE: tman = GetThemeManager(); _msg->PrintToStream(); if (_msg->FindInt32("be:value", &value) < B_OK) value = false; if (_msg->FindInt32("addon", &id) < B_OK) break; if (id > -1) { tman->SetAddonFlags(id, (tman->AddonFlags(id) & ~Z_THEME_ADDON_DO_RETRIEVE) | (value?Z_THEME_ADDON_DO_RETRIEVE:0)); } else { // apply globally int32 i; for (i = fAddonList->CountItems() - 1; i > 0; i--) { ThemeAddonItem *item = static_cast<ThemeAddonItem *>(fAddonList->ItemAt(i)); item->SaveBox()->SetValue(value); tman->SetAddonFlags(item->AddonId(), (tman->AddonFlags(item->AddonId()) & ~Z_THEME_ADDON_DO_RETRIEVE) | (value?Z_THEME_ADDON_DO_RETRIEVE:0)); } } break; case BTN_PREFS: tman = GetThemeManager(); if (_msg->FindInt32("addon", &id) < B_OK) break; tman->RunPreferencesPanel(id); break; case kHideSSPulse: break; case kShowSSPulse: break; case skOnlineThemes: { /* ZETA code: be_roster->Launch( "application/x-vnd.Mozilla-Firefox", 1, (char **)&skThemeURL); */ if (!be_roster->IsRunning(kHaikuDepotSig)) { be_roster->Launch(kHaikuDepotSig); snooze(1000000); } BMessenger msgr(kHaikuDepotSig); BMessage message(B_SET_PROPERTY); message.AddString("data", "_theme"); message.AddSpecifier("Value"); message.AddSpecifier("View", "search terms"); message.AddSpecifier("Window", (int32)0); msgr.SendMessage(&message); break; } default: { BView::MessageReceived(_msg); break; } } }