nsresult nsEudoraMailbox::ExamineAttachment(SimpleBufferTonyRCopiedOnce& data) { // get the file, then get the mime type, and add it to the array // of attachments. int32_t len = data.m_bytesInBuf - data.m_writeOffset; const char *pChar = data.m_pBuffer + data.m_writeOffset; const char *pData; const char *pStart; int32_t nameLen; char quote; int32_t cnt; int32_t idx = 0; while ((cnt = eudoraAttachLen[idx]) != 0) { if (!strncmp(eudoraAttachLines[idx], pChar, cnt)) { pData = pChar + cnt; while (((*pData == ' ') || (*pData == '\t')) && (cnt < len)) { cnt++; pData++; } if (pData != pChar) { quote = *pData; nameLen = 0; if ((quote == '"') || (quote == '\'')) { pData++; cnt++; pStart = pData; while ((*pData != quote) && (cnt < len)) { cnt++; pData++; nameLen++; } } else { pStart = pData; // Skip to next end of line. while ((cnt < len) && (*pData != nsCRT::CR) && (*pData != nsCRT::LF)) { pData++; cnt++; nameLen++; } } nsCString fileName; fileName.Append(pStart, nameLen); fileName.Trim(kWhitespace); if (fileName.Length()) { #ifdef XP_MACOSX return NS_OK; #else if(AddAttachment(fileName)) return NS_OK; #endif } } } idx++; } return NS_OK; }
Critter::Critter(Type type, const RN::Vector3 &position) : _isFixedAndCantHaveChildren(false) { SetPosition(position); SetRenderGroup(31); SetTag(kWHCritterTag); SetType(type); NavigationAgent *agent = new NavigationAgent(); AddAttachment(agent); agent->Enable(); agent->Release(); RN::MessageCenter::GetSharedInstance()->AddObserver(kWHWorldSpawningStoppedMessage, [this](RN::Message *message) { RemoveFromWorld(); }, this); RN::MessageCenter::GetSharedInstance()->AddObserver(RNCSTR("fuckoff"), [this](RN::Message *message) { RN::Value *value = static_cast<RN::Value *>(message->GetObject()); SetTarget(value->GetValue<RN::Vector3>()); }, this); }
void mmAttachmentDialog::OnMenuSelected(wxCommandEvent& event) { switch(event.GetId()) { case MENU_NEW_ATTACHMENT: AddAttachment(); break; case MENU_OPEN_ATTACHMENT: OpenAttachment(); break; case MENU_EDIT_ATTACHMENT: EditAttachment(); break; case MENU_DELETE_ATTACHMENT: DeleteAttachment(); break; default: break; } }
Decoy::Decoy(const RN::Vector3 &position, const RN::Quaternion &rotation) { SetModel(RN::Model::WithFile("Models/foodbowl/obstschale_02.sgm")); SetPosition(position + rotation.GetRotatedVector(RN::Vector3(0.0f, 0.0f, -2.0f))); SetRenderGroup(31); RN::bullet::RigidBody *body = new RN::bullet::RigidBody(RN::bullet::CylinderShape::WithHalfExtents(RN::Vector3(0.3f, 0.3f, 0.1f)), 1.0f); body->ApplyImpulse(rotation.GetRotatedVector(RN::Vector3(0.0f, 0.8f, -5.0f))); AddAttachment(body->Autorelease()); }
void AvatarEditor::InitEditorWindow() { Foundation::UiServiceInterface *ui = rexlogicmodule_->GetFramework()->GetService<Foundation::UiServiceInterface>(); if (ui == 0) // If this occurs, we're most probably operating in headless mode. return; QUiLoader loader; loader.setLanguageChangeEnabled(true); QFile file("./data/ui/avatareditor.ui"); if (!file.exists()) { RexLogicModule::LogError("Cannot find avatar editor .ui file."); return; } avatar_widget_ = loader.load(&file, this); if (!avatar_widget_) return; QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(avatar_widget_); layout->setContentsMargins(0, 0, 0, 0); setLayout(layout); // Connect signals. QPushButton *button = avatar_widget_->findChild<QPushButton *>("but_export"); if (button) QObject::connect(button, SIGNAL(clicked()), this, SLOT(ExportAvatar())); button = avatar_widget_->findChild<QPushButton *>("but_exportlocal"); if (button) QObject::connect(button, SIGNAL(clicked()), this, SLOT(ExportAvatarLocal())); button = avatar_widget_->findChild<QPushButton *>("but_load"); if (button) QObject::connect(button, SIGNAL(clicked()), this, SLOT(LoadAvatar())); button = avatar_widget_->findChild<QPushButton *>("but_revert"); if (button) QObject::connect(button, SIGNAL(clicked()), this, SLOT(RevertAvatar())); button = avatar_widget_->findChild<QPushButton *>("but_attachment"); if (button) QObject::connect(button, SIGNAL(clicked()), this, SLOT(AddAttachment())); setWindowTitle(tr("Avatar Editor")); ui->AddWidgetToScene(this); ui->AddWidgetToMenu(this); }
bool CMapiMessage::IterateAttachTable(LPMAPITABLE lpTable) { ULONG rowCount; HRESULT hr = lpTable->GetRowCount(0, &rowCount); if (!rowCount) { return true; } hr = lpTable->SetColumns((LPSPropTagArray)&ptaEid, 0); if (FAILED(hr)) { MAPI_TRACE2("SetColumns for attachment table failed: 0x%lx, %d\r\n", (long)hr, (int)hr); return false; } hr = lpTable->SeekRow(BOOKMARK_BEGINNING, 0, NULL); if (FAILED(hr)) { MAPI_TRACE2("SeekRow for attachment table failed: 0x%lx, %d\r\n", (long)hr, (int)hr); return false; } int cNumRows = 0; LPSRowSet lpRow; bool bResult = true; do { lpRow = NULL; hr = lpTable->QueryRows(1, 0, &lpRow); if(HR_FAILED(hr)) { MAPI_TRACE2("QueryRows for attachment table failed: 0x%lx, %d\n", (long)hr, (int)hr); bResult = false; break; } if (lpRow) { cNumRows = lpRow->cRows; if (cNumRows) { DWORD aNum = lpRow->aRow[0].lpProps[ieidPR_ATTACH_NUM].Value.ul; AddAttachment(aNum); MAPI_TRACE1("\t\t****Attachment found - #%d\r\n", (int)aNum); } CMapiApi::FreeProws(lpRow); } } while (SUCCEEDED(hr) && cNumRows && lpRow); return bResult; }
// special case attachment that is used by outlook for contact pictures // szPath should point to a valid JPG or PNG (others may work but only tried these) // For optimal results the image should be max 72x96 pixels but anything works AFAIK bool MAPIContact::SetPicture(const String &szPath) { #ifdef _WIN32_WCE return false; #else if(GetAttachmentCount() > 0 && !DeleteAttachment()) return false; bool bPicture = false; if(!szPath.IsEmpty()) bPicture = AddAttachment(szPath, CONTACT_PICTURE, CONTACT_PICTURE); SetOutlookProperty(MAPIContact::OUTLOOK_DATA1, MAPIContact::OUTLOOK_PICTURE_FLAG, bPicture, PT_BOOLEAN); if(szPath.IsEmpty()) return true; return bPicture; #endif }
StaticEntity::StaticEntity(RN::Model *model) : RN::Entity(model) { size_t count = model->GetMeshCount(0); for(size_t i = 0; i < count; i ++) { RN::Material *material = model->GetMaterialAtIndex(0, i); material->SetLighting(false); material->SetCullMode(RN::Material::CullMode::None); } RN::bullet::Shape *shape = RN::bullet::TriangleMeshShape::WithModel(model); _body = new RN::bullet::RigidBody(shape, 0.0f); AddAttachment(_body); }
Racket::Racket() { RN::Entity *racketEnt = new RN::Entity(RN::Model::WithFile("assets/racket/racket-texturedrayne.sgm")); racketEnt->GetModel()->GetMaterialAtIndex(0, 0)->SetDiscard(true); RN::bullet::CompoundShape *racketshape = new RN::bullet::CompoundShape(); racketshape->Autorelease(); racketshape->AddChild(RN::bullet::CylinderShape::WithHalfExtents(RN::Vector3(0.3, 0.02, 0.3)), RN::Vector3(0.0f, 0.0f, -0.6f), RN::Vector3(0.0f, 0.0f, 0.0f)); RN::bullet::RigidBody *racketBodyTemp = RN::bullet::RigidBody::WithShape(racketshape, 0.1f); racketEnt->AddAttachment(racketBodyTemp); racketBodyTemp->GetBulletRigidBody()->forceActivationState(DISABLE_DEACTIVATION); RN::bullet::RigidBody *ghostBody = RN::bullet::RigidBody::WithShape(RN::bullet::SphereShape::WithRadius(0.001f), 0.0f); AddAttachment(ghostBody); btTransform noOffset; noOffset.setIdentity(); btFixedConstraint *constraint = new btFixedConstraint(*racketBodyTemp->GetBulletRigidBody(), *ghostBody->GetBulletRigidBody(), noOffset, noOffset); RN::bullet::PhysicsWorld::GetSharedInstance()->GetBulletDynamicsWorld()->addConstraint(constraint); }
void CTOutlineTable::SetSelection( DMSelection* inSelection) { // Validate pointers. ValidateThis_(); ValidateObject_(inSelection); // Let outline table record selection. OVTable::SetSelection(inSelection); // Create edit-menu handler attachment. AddAttachment(new DMEditAttachment( this, // inActionHost mSelection, // inSelection 6000)); // inEditMenuStrings }
void PDDocument::FinishCreate( const FSSpec* inFileSpec) { // Validate pointers. ValidateThis_(); // Set up undo/redo for the document. AddAttachment(new LUndoer); // Create resource map. ResIDT containerDSPC; SetupMapAndContainer(mRMMap, containerDSPC); ValidateObject_(mRMMap); // Create a selection for resource items. mSelection = new DMSelection; ValidateObject_(mSelection.GetObject()); try { // Set up resource container. DMReanimator* reanimator = DMReanimator::GetReanimator(); ValidateObject_(reanimator); DMElementPtr tempContainer; reanimator->ElementsFromResource('DSPC', containerDSPC, tempContainer); ValidateObject_(tempContainer.GetObject()); mRsrcContainer = (dynamic_cast<PDContainer*>(tempContainer.GetObject())); ValidateObject_(mRsrcContainer.GetObject()); // Set up editor session. mSession = new RESession(this, dynamic_cast<PDContainer*>(tempContainer.GetObject()), mRMMap); ValidateObject_(mSession); mRsrcContainer->SetSession(mSession); // Read data from file (if applicable). if (inFileSpec != nil) { mFile = new LFile(*inFileSpec); ValidateObject_(mFile); } CommonOpenFile(mFile, mRsrcContainer); // Check settings record for collapsed resource types. if (mFile != nil) CheckCollapsedTypes(); // Make sure the basic resource types have folders, even if they are empty. OpenDefaultFolders(); // Build & display window for editing. BuildEditWindow(); } catch(...) { mRsrcContainer = nil; mSelection = nil; if (mSession != nil) delete mSession; if (mRMMap != nil) delete mRMMap; #if SKIPOMPARSE throw; #endif } }
void Critter::SetShape(RN::bullet::Shape *shape) { RN::bullet::RigidBody *body = new RN::bullet::RigidBody(shape, 0.0f); AddAttachment(body->Autorelease()); }