void RMDialogChoice::prepare(CORO_PARAM) { CORO_BEGIN_CONTEXT; int i; RMPoint ptPos; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); addPrim(new RMGfxPrimitive(&_dlgText, RMPoint(0, 0))); addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155))); addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83))); addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83 + 83))); addPrim(new RMGfxPrimitive(&_dlgTextLine, RMPoint(0, 155 + 83 + 83 + 83))); _ctx->ptPos.set(20, 90); for (_ctx->i = 0; _ctx->i < _numChoices; _ctx->i++) { addPrim(new RMGfxPrimitive(&_drawedStrings[_ctx->i], _ctx->ptPos)); _ptDrawStrings[_ctx->i] = _ctx->ptPos; _ctx->ptPos.offset(0, _drawedStrings[_ctx->i].getDimy() + 15); } CORO_INVOKE_0(drawOT); clearOT(); _ptDrawPos.set(0, 480 - _ctx->ptPos._y); CORO_END_CODE; }
LLSD FSFloaterObjectExport::getLinkSet(LLSelectNode* node) { LLSD linkset; LLViewerObject* object = node->getObject(); LLUUID object_id = object->getID(); // root prim linkset.append(object_id); addPrim(object, true); // child prims LLViewerObject::const_child_list_t& child_list = object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); ++iter) { LLViewerObject* child = *iter; linkset.append(child->getID()); addPrim(child, false); } return linkset; }
void RMDialogChoice::setSelected(CORO_PARAM, int pos) { CORO_BEGIN_CONTEXT; RMGfxBox box; RMRect rc; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); if (pos == _curSelection) return; _ctx->box.setPriority(5); if (_curSelection != -1) { _ctx->box.setColor(0xCC, 0xCC, 0xFF); _ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[_curSelection]._y); _ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[_curSelection].getDimy()); addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc)); addPrim(new RMGfxPrimitive(&_drawedStrings[_curSelection], _ptDrawStrings[_curSelection])); CORO_INVOKE_0(drawOT); clearOT(); } if (pos != -1) { _ctx->box.setColor(100, 100, 100); _ctx->rc.topLeft() = RMPoint(18, _ptDrawStrings[pos]._y); _ctx->rc.bottomRight() = _ctx->rc.topLeft() + RMPoint(597, _drawedStrings[pos].getDimy()); addPrim(new RMGfxPrimitive(&_ctx->box, _ctx->rc)); addPrim(new RMGfxPrimitive(&_drawedStrings[pos], _ptDrawStrings[pos])); } CORO_INVOKE_0(drawOT); clearOT(); _curSelection = pos; CORO_END_CODE; }
static ModulePtr makePrimitivesModule() { ModulePtr prims = new Module("__primitives__"); addPrim(prims, "Bool", boolType.ptr()); addPrim(prims, "Int8", int8Type.ptr()); addPrim(prims, "Int16", int16Type.ptr()); addPrim(prims, "Int32", int32Type.ptr()); addPrim(prims, "Int64", int64Type.ptr()); addPrim(prims, "Int128", int128Type.ptr()); addPrim(prims, "UInt8", uint8Type.ptr()); addPrim(prims, "UInt16", uint16Type.ptr()); addPrim(prims, "UInt32", uint32Type.ptr()); addPrim(prims, "UInt64", uint64Type.ptr()); addPrim(prims, "UInt128", uint128Type.ptr()); addPrim(prims, "Float32", float32Type.ptr()); addPrim(prims, "Float64", float64Type.ptr()); addPrim(prims, "Float80", float80Type.ptr()); addPrim(prims, "Imag32", imag32Type.ptr()); addPrim(prims, "Imag64", imag64Type.ptr()); addPrim(prims, "Imag80", imag80Type.ptr()); addPrim(prims, "Complex32", complex32Type.ptr()); addPrim(prims, "Complex64", complex64Type.ptr()); addPrim(prims, "Complex80", complex80Type.ptr()); GlobalAliasPtr v = new GlobalAlias(prims.ptr(), Identifier::get("ExceptionsEnabled?"), PUBLIC, vector<PatternVar>(), NULL, vector<IdentifierPtr>(), NULL, new BoolLiteral(exceptionsEnabled())); addPrim(prims, "ExceptionsEnabled?", v.ptr()); vector<IdentifierPtr> recordParams; RecordBodyPtr recordBody = new RecordBody(vector<RecordFieldPtr>()); recordParams.push_back(Identifier::get("T")); RecordDeclPtr byRefRecord = new RecordDecl( prims.ptr(), Identifier::get("ByRef"), PUBLIC, vector<PatternVar>(), NULL, recordParams, NULL, recordBody); byRefRecord->env = new Env(prims); addPrim(prims, "ByRef", byRefRecord.ptr()); recordParams.clear(); recordParams.push_back(Identifier::get("Properties")); recordParams.push_back(Identifier::get("Fields")); RecordDeclPtr rwpRecord = new RecordDecl( prims.ptr(), Identifier::get("RecordWithProperties"), PUBLIC, vector<PatternVar>(), NULL, recordParams, NULL, recordBody); rwpRecord->env = new Env(prims); addPrim(prims, "RecordWithProperties", rwpRecord.ptr()); #define PRIMITIVE(x) addPrimOp(prims, toPrimStr(#x), new PrimOp(PRIM_##x)) PRIMITIVE(TypeP); PRIMITIVE(TypeSize); PRIMITIVE(TypeAlignment); PRIMITIVE(SymbolP); PRIMITIVE(StaticCallDefinedP); PRIMITIVE(StaticCallOutputTypes); PRIMITIVE(StaticMonoP); PRIMITIVE(StaticMonoInputTypes); PRIMITIVE(bitcopy); PRIMITIVE(bitcast); PRIMITIVE(boolNot); PRIMITIVE(integerEqualsP); PRIMITIVE(integerLesserP); PRIMITIVE(numericAdd); PRIMITIVE(numericSubtract); PRIMITIVE(numericMultiply); PRIMITIVE(floatDivide); PRIMITIVE(numericNegate); PRIMITIVE(integerQuotient); PRIMITIVE(integerRemainder); PRIMITIVE(integerShiftLeft); PRIMITIVE(integerShiftRight); PRIMITIVE(integerBitwiseAnd); PRIMITIVE(integerBitwiseOr); PRIMITIVE(integerBitwiseXor); PRIMITIVE(integerBitwiseNot); PRIMITIVE(numericConvert); PRIMITIVE(integerAddChecked); PRIMITIVE(integerSubtractChecked); PRIMITIVE(integerMultiplyChecked); PRIMITIVE(integerQuotientChecked); PRIMITIVE(integerRemainderChecked); PRIMITIVE(integerShiftLeftChecked); PRIMITIVE(integerNegateChecked); PRIMITIVE(integerConvertChecked); PRIMITIVE(floatOrderedEqualsP); PRIMITIVE(floatOrderedLesserP); PRIMITIVE(floatOrderedLesserEqualsP); PRIMITIVE(floatOrderedGreaterP); PRIMITIVE(floatOrderedGreaterEqualsP); PRIMITIVE(floatOrderedNotEqualsP); PRIMITIVE(floatOrderedP); PRIMITIVE(floatUnorderedEqualsP); PRIMITIVE(floatUnorderedLesserP); PRIMITIVE(floatUnorderedLesserEqualsP); PRIMITIVE(floatUnorderedGreaterP); PRIMITIVE(floatUnorderedGreaterEqualsP); PRIMITIVE(floatUnorderedNotEqualsP); PRIMITIVE(floatUnorderedP); PRIMITIVE(Pointer); PRIMITIVE(addressOf); PRIMITIVE(pointerDereference); PRIMITIVE(pointerOffset); PRIMITIVE(pointerToInt); PRIMITIVE(intToPointer); PRIMITIVE(nullPointer); PRIMITIVE(CodePointer); PRIMITIVE(makeCodePointer); PRIMITIVE(AttributeStdCall); PRIMITIVE(AttributeFastCall); PRIMITIVE(AttributeCCall); PRIMITIVE(AttributeThisCall); PRIMITIVE(AttributeLLVMCall); PRIMITIVE(AttributeDLLImport); PRIMITIVE(AttributeDLLExport); PRIMITIVE(ExternalCodePointer); PRIMITIVE(makeExternalCodePointer); PRIMITIVE(callExternalCodePointer); PRIMITIVE(Array); PRIMITIVE(arrayRef); PRIMITIVE(arrayElements); PRIMITIVE(Vec); PRIMITIVE(Tuple); PRIMITIVE(TupleElementCount); PRIMITIVE(tupleRef); PRIMITIVE(tupleElements); PRIMITIVE(Union); PRIMITIVE(UnionMemberCount); PRIMITIVE(RecordP); PRIMITIVE(RecordFieldCount); PRIMITIVE(RecordFieldName); PRIMITIVE(RecordWithFieldP); PRIMITIVE(recordFieldRef); PRIMITIVE(recordFieldRefByName); PRIMITIVE(recordFields); PRIMITIVE(recordVariadicField); PRIMITIVE(VariantP); PRIMITIVE(VariantMemberIndex); PRIMITIVE(VariantMemberCount); PRIMITIVE(VariantMembers); PRIMITIVE(variantRepr); PRIMITIVE(BaseType); PRIMITIVE(Static); PRIMITIVE(StaticName); PRIMITIVE(staticIntegers); PRIMITIVE(integers); PRIMITIVE(staticFieldRef); PRIMITIVE(MainModule); PRIMITIVE(StaticModule); PRIMITIVE(ModuleName); PRIMITIVE(ModuleMemberNames); PRIMITIVE(EnumP); PRIMITIVE(EnumMemberCount); PRIMITIVE(EnumMemberName); PRIMITIVE(enumToInt); PRIMITIVE(intToEnum); PRIMITIVE(StringLiteralP); PRIMITIVE(stringLiteralByteIndex); PRIMITIVE(stringLiteralBytes); PRIMITIVE(stringLiteralByteSize); PRIMITIVE(stringLiteralByteSlice); PRIMITIVE(stringLiteralConcat); PRIMITIVE(stringLiteralFromBytes); PRIMITIVE(stringTableConstant); PRIMITIVE(OrderUnordered); PRIMITIVE(OrderMonotonic); PRIMITIVE(OrderAcquire); PRIMITIVE(OrderRelease); PRIMITIVE(OrderAcqRel); PRIMITIVE(OrderSeqCst); PRIMITIVE(FlagP); PRIMITIVE(Flag); PRIMITIVE(atomicFence); PRIMITIVE(atomicRMW); PRIMITIVE(atomicLoad); PRIMITIVE(atomicStore); PRIMITIVE(atomicCompareExchange); PRIMITIVE(RMWXchg); PRIMITIVE(RMWAdd); PRIMITIVE(RMWSubtract); PRIMITIVE(RMWAnd); PRIMITIVE(RMWNAnd); PRIMITIVE(RMWOr); PRIMITIVE(RMWXor); PRIMITIVE(RMWMin); PRIMITIVE(RMWMax); PRIMITIVE(RMWUMin); PRIMITIVE(RMWUMax); PRIMITIVE(activeException); PRIMITIVE(memcpy); PRIMITIVE(memmove); PRIMITIVE(countValues); PRIMITIVE(nthValue); PRIMITIVE(withoutNthValue); PRIMITIVE(takeValues); PRIMITIVE(dropValues); PRIMITIVE(LambdaRecordP); PRIMITIVE(LambdaSymbolP); PRIMITIVE(LambdaMonoP); PRIMITIVE(LambdaMonoInputTypes); PRIMITIVE(GetOverload); PRIMITIVE(usuallyEquals); #undef PRIMITIVE return prims; }
static void addPrimOp(ModulePtr m, llvm::StringRef name, PrimOpPtr x) { primOpNames[x->primOpCode] = name; addPrim(m, name, x.ptr()); }
void RMText::writeText(Common::String text, RMFontColor *font, int *time) { RMGfxPrimitive *prim; // Set the base color font->setBaseColor(_textR, _textG, _textB); // Destroy the buffer before starting destroy(); // If the string is empty, do nothing if (text.empty()) return; // Divide the words into lines. In this cycle, X contains the maximum length reached by a line, // and the number of lines Common::Array<Common::String> lines; uint p = 0; int j = 0; int x = 0; while (p < text.size()) { j += font->stringLen(text[p]); if (j > (((_aHorType == HLEFTPAR) && (lines.size() > 0)) ? _maxLineLength - 25 : _maxLineLength)) { j -= font->stringLen(text[p], (p + 1 == text.size()) ? '\0' : text[p + 1]); if (j > x) x = j; // Back to the first usable space // // BERNIE: In the original, sentences containing words that exceed the // width of a line caused discontinuation of the whole sentence. // This workaround has the partial word broken up so it will still display // uint old_p = p; while (text[p] != ' ' && text[p] != '-' && p > 0) p--; if (p == 0) p = old_p; // Check if there are any blanks to end while ((text[p] == ' ' || text[p] == '-') && p + 1 < text.size()) p++; if (p == text.size()) break; lines.push_back(Common::String(text.c_str(), p)); if (text[p] == ' ') p++; text = text.c_str() + p; p = 0; j = 0; continue; } p++; } if (j > x) x = j; // Add the last line of text. lines.push_back(text); x += 8; // Starting position for the surface: X1, Y int width = x; int height = (lines.size() - 1) * font->letterHeight() + font->_fontDimy; // Create the surface create(width, height); Common::fill(_buf, _buf + width * height * 2, 0); p = 0; int y = 0; int numchar = 0; for (uint i = 0; i < lines.size(); ++i) { const Common::String &line = lines[i]; // Measure the length of the line x = 0; j = font->stringLen(line); switch (_aHorType) { case HLEFT: x = 0; break; case HLEFTPAR: if (i == 0) x = 0; else x = 25; break; case HCENTER: x = width / 2 - j / 2; break; case HRIGHT: x = width - j - 1; break; } p = 0; while (p < line.size()) { if (line[p] == ' ') { x += font->stringLen(line[p]); p++; continue; } int len; prim = font->makeLetterPrimitive(line[p], len); prim->getDst()._x1 = x; prim->getDst()._y1 = y; addPrim(prim); numchar++; x += font->stringLen(line[p], (p + 1 == line.size()) ? '\0' : line[p + 1]); p++; } p++; y += font->letterHeight(); } if (time != NULL) *time = 1000 + numchar * (11 - GLOBALS._nCfgTextSpeed) * 14; }
static void addPrimOp(ModulePtr m, const string &name, PrimOpPtr x) { primOpNames[x->primOpCode] = name; addPrim(m, name, x.ptr()); }