WidgetListItemButton::WidgetListItemButton(::Engines::GUI &gui, const Common::UString &button, const Common::UString &text, const Common::UString &icon, uint32 otherButtons, const Common::UString &soundClick) : WidgetListItemBaseButton(gui, button, 1.0f, soundClick), _isRight(true) { _text = new Graphics::Aurora::Text(FontMan.get("fnt_galahad14"), text); if (icon == "") { _icon = 0; } else { _icon = new Portrait(icon, Portrait::kSizeIcon); } if (otherButtons & kHelpButton) { _helpButton = loadModelGUI("ctl_cg_btn_help"); } else { _helpButton = 0; } if (otherButtons & kMoveButton) { _isMovable = true; _moveButtonRight = new WidgetButton(gui, "Item#" + text + "#MoveButtonRight", "ctl_cg_btn_right"); _moveButtonLeft = new WidgetButton(gui, "Item#" + text + "#MoveButtonLeft", "ctl_cg_btn_left"); addSub(*_moveButtonRight); addSub(*_moveButtonLeft); } else { _isMovable = false; _moveButtonLeft = 0; _moveButtonRight = 0; } }
void PseudoBooleanProcessor::learnGeqSub(Node geq){ Assert(geq.getKind() == kind::GEQ); const bool negated = false; bool success = decomposeAssertion(geq, negated); if(!success){ Debug("pbs::rewrites") << "failed " << std::endl; return; } Assert(d_off.constValue().isIntegral()); Integer off = d_off.constValue().ceiling(); // \sum pos >= \sum neg + off // for now special case everything we want // target easy clauses if( d_pos.size() == 1 && d_neg.size() == 1 && off.isZero() ){ // x >= y // |- (y >= 1) => (x >= 1) Node x = d_pos.front(); Node y = d_neg.front(); Node xGeq1 = mkGeqOne(x); Node yGeq1 = mkGeqOne(y); Node imp = yGeq1.impNode(xGeq1); addSub(geq, imp); }else if( d_pos.size() == 0 && d_neg.size() == 2 && off.isNegativeOne()){ // 0 >= (x + y -1) // |- 1 >= x + y // |- (or (not (x >= 1)) (not (y >= 1))) Node x = d_neg[0]; Node y = d_neg[1]; Node xGeq1 = mkGeqOne(x); Node yGeq1 = mkGeqOne(y); Node cases = (xGeq1.notNode()).orNode(yGeq1.notNode()); addSub(geq, cases); }else if( d_pos.size() == 2 && d_neg.size() == 1 && off.isZero() ){ // (x + y) >= z // |- (z >= 1) => (or (x >= 1) (y >=1 )) Node x = d_pos[0]; Node y = d_pos[1]; Node z = d_neg[0]; Node xGeq1 = mkGeqOne(x); Node yGeq1 = mkGeqOne(y); Node zGeq1 = mkGeqOne(z); NodeManager* nm =NodeManager::currentNM(); Node dis = nm->mkNode(kind::OR, zGeq1.notNode(), xGeq1, yGeq1); addSub(geq, dis); } }
WidgetGridItemPortrait::WidgetGridItemPortrait(NWN::GUI &gui, const Common::UString &portrait) : WidgetListItem(gui) { _portrait = portrait; _portraitWidget = new PortraitWidget(gui, "portrait#" + portrait, portrait + "m", Portrait::kSizeMedium, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f); addChild(*_portraitWidget); addSub(*_portraitWidget); }
void SRExpressionsParser::bitwiseShift(double* r) { double t = 0; Token op; addSub(r); op = token; while( (!strcmp(op.value(),"<<")) || (!strcmp(op.value(),">>"))) { parse(); addSub(&t); if (!strcmp(op.value(),"<<")) { *r = (double)((long long)*r << (long long)t); } if (!strcmp(op.value(),">>")) { *r = (double)((long long)*r >> (long long)t); } }
ChatModeButton::ChatModeButton(::Engines::GUI &gui, const Common::UString &tag, const Common::UString &model, ChatMode mode) : WidgetButton(gui, tag, model) { _label = new WidgetLabel(*_gui, getTag() + "#Label", "fnt_dialog16x16", ""); _label->setColor(1.0, 1.0, 1.0, 0.6); setMode(mode); setPosition(0.0, 0.0, 0.0); addSub(*_label); }
/** * Evaluates the bitshift expressions: shift left (a << b), and shift right * (a >> b), which have the same operator precedence, by recursively calling * the functions for evaluating expressions with higher precedence. * * @param[out] ret: the integer value the logical and expression evaluates to * * @return: whether at the current location the expression can be evaluated */ bool MacroParser::bitshift(int64_t *ret) { int64_t term2 = 0; if (addSub(ret)) { for (;;) { if (_scanner.atSymbol(GT_GT)) { if (addSub(&term2)) { *ret = *ret >> term2; } else { return false; } } else if (_scanner.atSymbol(LT_LT)) {
void WidgetListBox::createScrollbar() { if (!_hasScrollbar) return; // Get top position float minX, minY, minZ; _model->getNode("scrollmin")->getPosition(minX, minY, minZ); // Create the "up" button _up = new WidgetButton(*_gui, getTag() + "#Up", "pb_scrl_up", "gui_scroll"); _up->setPosition(minX, minY, -50.0f); addSub(*_up); // Get bottom position float maxX, maxY, maxZ; _model->getNode("scrollmax")->getPosition(maxX, maxY, maxZ); // Create the "down" button _down = new WidgetButton(*_gui, getTag() + "#Down", "pb_scrl_down", "gui_scroll"); _down->setPosition(maxX, maxY - 10, -50.0f); addSub(*_down); // Scroll bar range (max length) float scrollRange = minY - (maxY - 10) - _up->getHeight() - 1; // Create the scrollbar _scrollbar = new WidgetScrollbar(*_gui, getTag() + "#Bar", Scrollbar::kTypeVertical, scrollRange); // Center the bar within the scrollbar area float scrollX = maxX + (_up->getWidth() - _scrollbar->getWidth()) / 2; // Move it to the base position float scrollY = maxY - 10 + _up->getHeight(); _scrollbar->setPosition(scrollX, scrollY, -50.0f); addSub(*_scrollbar); }
void prepareArrayWithIndex(dynamicArray *anArray, int anIndex) { while (anIndex >= 0) { //calculate a size int theSize = 10; //<!-- by default if (NULL != anArray->lastSub) { theSize = anArray->lastSub->subSize * 2; } subArray *theSlot = createSubArray(theSize); addSub(anArray, theSlot); anIndex -= theSize; } }
void WidgetListBox::add(WidgetListItem *item) { assert(_locked); if (!_items.empty()) if (round(item->getHeight()) != round(_items.front()->getHeight())) throw Common::Exception("WidgetListBox item sizes mismatch"); item->_itemNumber = _items.size(); item->setTag(Common::UString::format("%s#Item%d", getTag().c_str(), (int)_items.size())); for (std::vector<WidgetListItem *>::iterator i = _items.begin(); i != _items.end(); ++i) { (*i)->addGroupMember(*item); item->addGroupMember(**i); } _items.push_back(item); addSub(*item); }
static int Write(void* _context, void *data) { Context_t * context = (Context_t *) _context; char * Encoding = NULL; char * Text; SubtitleOut_t * out; int DataLength; unsigned long long int Pts; float Duration; subtitle_printf(10, "\n"); if (data == NULL) { subtitle_err("null pointer passed\n"); return cERR_SUBTITLE_ERROR; } out = (SubtitleOut_t*) data; if (out->type == eSub_Txt) { Text = strdup((const char*) out->u.text.data); } else { /* fixme handle gfx subs from container_ass and send it to * the callback. this must be implemented also in e2/neutrino * then. */ subtitle_err("subtitle gfx currently not handled\n"); return cERR_SUBTITLE_ERROR; } DataLength = out->u.text.len; Pts = out->pts; Duration = out->duration; context->manager->subtitle->Command(context, MANAGER_GETENCODING, &Encoding); if (Encoding == NULL) { subtitle_err("encoding unknown\n"); free(Text); return cERR_SUBTITLE_ERROR; } subtitle_printf(20, "Encoding:%s Text:%s Len:%d\n", Encoding,Text, DataLength); if ( !strncmp("S_TEXT/SSA", Encoding, 10) || !strncmp("S_SSA", Encoding, 5)) subtitle_ParseSSA(&Text); else if(!strncmp("S_TEXT/ASS", Encoding, 10) || !strncmp("S_AAS", Encoding, 5)) subtitle_ParseASS(&Text); else if(!strncmp("S_TEXT/SRT", Encoding, 10) || !strncmp("S_SRT", Encoding, 5)) subtitle_ParseSRT(&Text); else { subtitle_err("unknown encoding %s\n", Encoding); return cERR_SUBTITLE_ERROR; } subtitle_printf(10, "Text:%s Duration:%f\n", Text,Duration); addSub(context, Text, Pts, Duration * 1000); free(Text); free(Encoding); subtitle_printf(10, "<\n"); return cERR_SUBTITLE_NO_ERROR; }