SaveScreen::SaveScreen(Screen *previous) : previous(previous) { Label *label; /* Create the main work/text area */ mainLayout = createMainLayout("", LANG_BACK); listBox = (TouchListBox*) mainLayout->getChildren()[FIRSTCHILD]; /* Create the different label/input fields */ /* ---------------------------------- */ label = createLabel(LANG_SAVE_TRUCK, FONTHEIGHT); checkBox.add(new CheckBox(scrWidth - 50, 2, 16, 16, label)); checkBox[0]->setResources(RES_CHECKBOX_UNCHECKED, RES_CHECKBOX_CHECKED); listBox->add(label); /* ---------------------------------- */ label = createLabel(LANG_SAVE_TRAILER, FONTHEIGHT); checkBox.add(new CheckBox(scrWidth - 50, 2, 16, 16, label)); checkBox[1]->setResources(RES_CHECKBOX_UNCHECKED, RES_CHECKBOX_CHECKED); listBox->add(label); /* ---------------------------------- */ listBox->setWrapping(WRAPPING); this->setMain(mainLayout); }
QWidget* createReverb(QGroupBox* parent) { parent->setObjectName("reverb"); parent->setCheckable(true); connectBox(p_reverb_on, parent); QGridLayout* grid = new QGridLayout(parent); // row 1 grid->addWidget(createDial(p_reverb_predelay), 0, 0); grid->addWidget(createDial(p_reverb_decay), 0, 1); grid->addWidget(createDial(p_reverb_lowcut), 0, 2); grid->addWidget(createDial(p_reverb_highcut), 0, 3); grid->addWidget(createDial(p_reverb_depth), 0, 4); // row 2 grid->addWidget(new QLabel("Predelay"), 1, 0); grid->addWidget(new QLabel("Decay"), 1, 1); grid->addWidget(new QLabel("Lowcut"), 1, 2); grid->addWidget(new QLabel("Highcut"), 1, 3); grid->addWidget(new QLabel("Depth"), 1, 4); // row 4 grid->addWidget(createLabel(p_reverb_predelay), 2, 0); grid->addWidget(createLabel(p_reverb_decay), 2, 1); grid->addWidget(createLabel(p_reverb_lowcut), 2, 2); grid->addWidget(createLabel(p_reverb_highcut), 2, 3); grid->addWidget(createLabel(p_reverb_depth), 2, 4); grid->setHorizontalSpacing(2); grid->setVerticalSpacing(0); grid->setColumnStretch(5, 1); return parent; }
QWidget* createLfo(QGroupBox* parent, uint i) { uint off = i * LFO_OFF; parent->setCheckable(true); connectBox(p_lfo1_on + off, parent); QGridLayout* grid = new QGridLayout(parent); // row 1 QComboBox* typeBox = createSelect(p_lfo1_type + off, lfo_types, 6); lfoMapper.setMapping(typeBox, i); connect(typeBox, SIGNAL(currentIndexChanged(int)), &lfoMapper, SLOT(map())); grid->addWidget(typeBox, 0, 0, 1, 2); grid->addWidget(createSelect(p_lfo1_reset_type + off, lfo_reset_types, 3), 0, 2, 1, 2); grid->addWidget(connectToLfo(createToggle(p_lfo1_inv + off, "Inv"), i), 0, 4); // row 2-4 grid->addWidget(lfo_wd[i] = new WaveDisplay(LFO_WIDTH, WAVE_HEIGHT), 1, 0, 3, 3); // row 5 grid->addWidget(createDial(p_lfo1_freq + off), 4, 0); grid->addWidget(connectToLfo(createDial(p_lfo1_start + off), i), 4, 1); grid->addWidget(connectToLfo(createDial(p_lfo1_width + off), i), 4, 2); grid->addWidget(createDial(p_lfo1_humanize + off), 4, 3); // row 6 grid->addWidget(new QLabel("Freq"), 5, 0); grid->addWidget(new QLabel("Start"), 5, 1); grid->addWidget(new QLabel("Width"), 5, 2); grid->addWidget(new QLabel("Rand"), 5, 3); // row 7 grid->addWidget(createLabel(p_lfo1_freq + off), 6, 0); grid->addWidget(createLabel(p_lfo1_start + off), 6, 1); grid->addWidget(createLabel(p_lfo1_width + off), 6, 2); grid->addWidget(createLabel(p_lfo1_humanize + off), 6, 3); grid->setHorizontalSpacing(2); grid->setVerticalSpacing(0); grid->setColumnStretch(5, 1); grid->setRowStretch(7, 1); return parent; }
//! [0] Window::Window() { aliasedLabel = createLabel(tr("Aliased")); antialiasedLabel = createLabel(tr("Antialiased")); intLabel = createLabel(tr("Int")); floatLabel = createLabel(tr("Float")); QGridLayout *layout = new QGridLayout; layout->addWidget(aliasedLabel, 0, 1); layout->addWidget(antialiasedLabel, 0, 2); layout->addWidget(intLabel, 1, 0); layout->addWidget(floatLabel, 2, 0); //! [0] //! [1] QTimer *timer = new QTimer(this); for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2; ++j) { circleWidgets[i][j] = new CircleWidget; circleWidgets[i][j]->setAntialiased(j != 0); circleWidgets[i][j]->setFloatBased(i != 0); connect(timer, SIGNAL(timeout()), circleWidgets[i][j], SLOT(nextAnimationFrame())); layout->addWidget(circleWidgets[i][j], i + 1, j + 1); } } //! [1] //! [2] timer->start(100); setLayout(layout); setWindowTitle(tr("Concentric Circles")); }
QWidget* createChorus(QGroupBox* parent) { parent->setObjectName("chorus"); parent->setCheckable(true); connectBox(p_chorus_on, parent); QGridLayout* grid = new QGridLayout(parent); // row 1 grid->addWidget(createDial(p_chorus_delay), 0, 0); grid->addWidget(createDial(p_chorus_amount), 0, 1); grid->addWidget(createDial(p_chorus_rate), 0, 2); grid->addWidget(createDial(p_chorus_depth), 0, 3); grid->addWidget(createDial(p_chorus_feedback), 0, 4); // row 2 grid->addWidget(new QLabel("Delay"), 1, 0); grid->addWidget(new QLabel("Mod amt"), 1, 1); grid->addWidget(new QLabel("Mod frq"), 1, 2); grid->addWidget(new QLabel("Depth"), 1, 3); grid->addWidget(new QLabel("Feedb"), 1, 4); // row 3 grid->addWidget(createLabel(p_chorus_delay), 2, 0); grid->addWidget(createLabel(p_chorus_amount), 2, 1); grid->addWidget(createLabel(p_chorus_rate), 2, 2); grid->addWidget(createLabel(p_chorus_depth), 2,3); grid->addWidget(createLabel(p_chorus_feedback), 2, 4); grid->setHorizontalSpacing(2); grid->setVerticalSpacing(0); grid->setColumnStretch(5, 1); return parent; }
void SceneMaterialHeatDialog::createContent() { txtThermalConductivity = new ValueLineEdit(this); txtThermalConductivity->setMinimumSharp(0.0); txtVolumeHeat = new ValueLineEdit(this, true); txtDensity = new ValueLineEdit(this); txtDensity->setEnabled(Util::scene()->problemInfo()->analysisType == AnalysisType_Transient); txtSpecificHeat = new ValueLineEdit(this); txtSpecificHeat->setEnabled(Util::scene()->problemInfo()->analysisType == AnalysisType_Transient); connect(txtThermalConductivity, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool))); connect(txtDensity, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool))); connect(txtSpecificHeat, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool))); layout->addWidget(createLabel(tr("<i>%1</i> (W/m·K)").arg(QString::fromUtf8("λ")), tr("Thermal conductivity")), 10, 0); layout->addWidget(txtThermalConductivity, 10, 2); layout->addWidget(createLabel(tr("<i>Q</i> (W/m<sup>3</sup>)"), tr("Volume heat")), 11, 0); layout->addWidget(txtVolumeHeat, 11, 2); layout->addWidget(createLabel(tr("<i>%1</i> (kg/m<sup>3</sup>)").arg(QString::fromUtf8("ρ")), tr("Mass density")), 12, 0); layout->addWidget(txtDensity, 12, 2); layout->addWidget(createLabel(tr("<i>c</i><sub>p</sub> (J/kg·K)"), tr("Specific heat")), 13, 0); layout->addWidget(txtSpecificHeat, 13, 2); }
void shortCircuit(compTree* ast, char* lTrue, char* lFalse) { if(ast == NULL) return; nodeList* auxNodeList; char labelTemp[100]; auxNodeList = ast->childNodeList; switch(ast->nodeType) { case AST_IF_ELSE: case AST_WHILE_DO: case AST_DO_WHILE: strcpy(ast->labelTrue,createLabel()); strcpy(ast->labelFalse,createLabel()); break; case AST_LOGICO_E: strcpy(labelTemp,createLabel()); strcpy(ast->labelTrue,labelTemp); strcpy(ast->labelFalse,lFalse); break; case AST_LOGICO_OU: strcpy(labelTemp,createLabel()); strcpy(ast->labelFalse,labelTemp); strcpy(ast->labelTrue,lTrue); break; } while(auxNodeList != NULL) { shortCircuit(auxNodeList->firstNode,ast->labelTrue,ast->labelFalse); auxNodeList = auxNodeList->nextNode; } }
void SceneBoundaryHeatDialog::createContent() { cmbType = new QComboBox(this); cmbType->addItem(physicFieldBCString(PhysicFieldBC_Heat_Temperature), PhysicFieldBC_Heat_Temperature); cmbType->addItem(physicFieldBCString(PhysicFieldBC_Heat_Flux), PhysicFieldBC_Heat_Flux); connect(cmbType, SIGNAL(currentIndexChanged(int)), this, SLOT(doTypeChanged(int))); txtHeatFlux = new ValueLineEdit(this); txtTemperature = new ValueLineEdit(this); txtHeatTransferCoefficient = new ValueLineEdit(this); txtExternalTemperature = new ValueLineEdit(this); connect(txtHeatFlux, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool))); connect(txtTemperature, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool))); connect(txtHeatTransferCoefficient, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool))); connect(txtExternalTemperature, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool))); // set active marker doTypeChanged(cmbType->currentIndex()); layout->addWidget(new QLabel(tr("BC type:")), 4, 0); layout->addWidget(cmbType, 4, 2); layout->addWidget(createLabel(tr("<i>T</i><sub>0</sub> (K)"), tr("Temperature")), 11, 0); layout->addWidget(txtTemperature, 11, 2); layout->addWidget(createLabel(tr("<i>f</i><sub>0</sub> (W/m<sup>2</sup>)"), tr("Heat flux")), 12, 0); layout->addWidget(txtHeatFlux, 12, 2); layout->addWidget(createLabel(tr("<i>%1</i> (W/m<sup>2</sup>·K)").arg(QString::fromUtf8("α")), tr("Heat transfer coef.")), 13, 0); layout->addWidget(txtHeatTransferCoefficient, 13, 2); layout->addWidget(createLabel(tr("<i>T</i><sub>ext</sub> (K)"), tr("External temperature")), 14, 0); layout->addWidget(txtExternalTemperature, 14, 2); }
QuickKeysMenu::QuickKeysMenu() { // add controls std::vector<HUDuiControl*>& controls = getControls(); controls.push_back(createLabel("Define Quick Keys")); controls.push_back(createLabel("Notice: depending on platform not all keys might work")); controls.push_back(createLabel("Send to All")); controls.push_back(createLabel("Send to Team")); firstKeyControl = controls.size(); int i; for (i=1; i < 11; i++) { std::string keyLabel = string_util::format("Alt-F%d", i); controls.push_back(createInput(keyLabel)); } for (i=1; i < 11; i++) { std::string keyLabel = string_util::format("Ctrl-F%d", i); controls.push_back(createInput(keyLabel)); } initNavigation(controls, firstKeyControl, controls.size()-1); }
QWidget* createMain(QWidget* parent) { parent->setObjectName("main"); QGridLayout* grid = new QGridLayout(parent); // row 1 grid->addWidget(createDial(p_volume), 0, 0); grid->addWidget(createSelect(p_play_mode, modes, 3), 0, 1); grid->addWidget(createDial(p_glide_time), 0, 2); grid->addWidget(createDial(p_pitchbend_range), 0, 3); // row 2 grid->addWidget(new QLabel("Vol"), 1, 0); grid->addWidget(new QLabel("Mode"), 1, 1); grid->addWidget(new QLabel("Glide t."), 1, 2); grid->addWidget(new QLabel("Bend r."), 1, 3); // row 3 grid->addWidget(createLabel(p_volume), 2, 0); // skip grid->addWidget(createLabel(p_glide_time), 2, 2); grid->addWidget(createLabel(p_pitchbend_range), 2, 3); grid->setHorizontalSpacing(2); grid->setVerticalSpacing(0); grid->setColumnStretch(4, 1); grid->setRowStretch(3, 1); return parent; }
QWidget* createPhaser(QGroupBox* parent) { parent->setObjectName("phaser"); parent->setCheckable(true); connectBox(p_phaser_on, parent); QGridLayout* grid = new QGridLayout(parent); // row 1 grid->addWidget(createDial(p_phaser_min_freq), 0, 0); grid->addWidget(createDial(p_phaser_max_freq), 0, 1); grid->addWidget(createDial(p_phaser_rate), 0, 2); grid->addWidget(createDial(p_phaser_depth), 0, 3); grid->addWidget(createDial(p_phaser_feedback), 0, 4); // row 2 grid->addWidget(new QLabel("Min Fr"), 1, 0); grid->addWidget(new QLabel("Max Fr"), 1, 1); grid->addWidget(new QLabel("Mod frq"), 1, 2); grid->addWidget(new QLabel("Depth"), 1, 3); grid->addWidget(new QLabel("Feedb"), 1, 4); // row 3 grid->addWidget(createLabel(p_phaser_min_freq), 2, 0); grid->addWidget(createLabel(p_phaser_max_freq), 2, 1); grid->addWidget(createLabel(p_phaser_rate), 2, 2); grid->addWidget(createLabel(p_phaser_depth), 2, 3); grid->addWidget(createLabel(p_phaser_feedback), 2, 4); grid->setHorizontalSpacing(2); grid->setVerticalSpacing(0); grid->setColumnStretch(5, 1); return parent; }
//! [0] TetrixWindow::TetrixWindow() { board = new TetrixBoard; //! [0] nextPieceLabel = new QLabel; nextPieceLabel->setFrameStyle(QFrame::Box | QFrame::Raised); nextPieceLabel->setAlignment(Qt::AlignCenter); board->setNextPieceLabel(nextPieceLabel); //! [1] scoreLcd = new QLCDNumber(5); scoreLcd->setSegmentStyle(QLCDNumber::Filled); //! [1] levelLcd = new QLCDNumber(2); levelLcd->setSegmentStyle(QLCDNumber::Filled); linesLcd = new QLCDNumber(5); linesLcd->setSegmentStyle(QLCDNumber::Filled); //! [2] startButton = new QPushButton(tr("&Start")); startButton->setFocusPolicy(Qt::NoFocus); quitButton = new QPushButton(tr("&Quit")); quitButton->setFocusPolicy(Qt::NoFocus); pauseButton = new QPushButton(tr("&Pause")); //! [2] //! [3] pauseButton->setFocusPolicy(Qt::NoFocus); //! [3] //! [4] connect(startButton, SIGNAL(clicked()), board, SLOT(start())); //! [4] //! [5] connect(quitButton , SIGNAL(clicked()), qApp, SLOT(quit())); connect(pauseButton, SIGNAL(clicked()), board, SLOT(pause())); connect(board, SIGNAL(scoreChanged(int)), scoreLcd, SLOT(display(int))); connect(board, SIGNAL(levelChanged(int)), levelLcd, SLOT(display(int))); connect(board, SIGNAL(linesRemovedChanged(int)), linesLcd, SLOT(display(int))); //! [5] //! [6] QGridLayout *layout = new QGridLayout; layout->addWidget(createLabel(tr("NEXT")), 0, 0); layout->addWidget(nextPieceLabel, 1, 0); layout->addWidget(createLabel(tr("LEVEL")), 2, 0); layout->addWidget(levelLcd, 3, 0); layout->addWidget(startButton, 4, 0); layout->addWidget(board, 0, 1, 6, 1); layout->addWidget(createLabel(tr("SCORE")), 0, 2); layout->addWidget(scoreLcd, 1, 2); layout->addWidget(createLabel(tr("LINES REMOVED")), 2, 2); layout->addWidget(linesLcd, 3, 2); layout->addWidget(quitButton, 4, 2); layout->addWidget(pauseButton, 5, 2); setLayout(layout); setWindowTitle(tr("Tetrix")); resize(550, 370); }
Widget* initializeChooseWorldWindow(SDL_Surface* windowSurface) { Widget* window = createWindow(windowSurface); char stringBuffer[SELECT_WORLD_STRING_LENGTH]; char digitBuffer[2]; strcpy(stringBuffer, SELECT_WORLD_COOSE_TEXT); SDL_Rect panelRect = { 300, 150, 400, 600 }; Widget* panel = createPanel(windowSurface, panelRect, SDL_MapRGB(pixel_format, COLOR_R, COLOR_G, COLOR_B)); addChild(window, panel); SDL_Rect labelRect = { 35, 20, 20, 20 }; Widget* label; if (currSelectionWindow == LOAD) { label = createLabel(labelRect, LOAD_GAME_TITLE, window->image, 0, 0, bitmapfont1, NULL); } else if (currSelectionWindow == EDIT) { label = createLabel(labelRect, EDIT_GAME_TITLE, window->image, 0, 0, bitmapfont1, NULL); } else { label = createLabel(labelRect, SAVE_GAME_TITLE, window->image, 0, 0, bitmapfont1, NULL); } addChild(panel, label); SDL_Rect buttonSelectRect = { 20, 60, 20, 20 }; SDL_Rect buttonDoneRect = { 20, 130, 20, 20 }; SDL_Rect buttonBackRect = { 20, 200, 20, 20 }; SDL_Rect buttonUpRect = { 186, 60, 20, 20 }; SDL_Rect buttonDownRect = { 186, 84, 20, 20 }; sprintf(digitBuffer, "%d", currWorld); strcat(stringBuffer, digitBuffer); Widget* buttonSelect = createButton(buttonSelectRect, stringBuffer, window->image, MARKED, "select_button.bmp", SDL_MapRGB(pixel_format, COLOR_R, COLOR_G, COLOR_B), 25, 10, BUTTON_SELECT_WORLD, bitmapfont1); addChild(panel, buttonSelect); Widget* buttonDone = createButton(buttonDoneRect, SELECT_WORLD_DONE_TEXT, window->image, REGULAR, "button.bmp", SDL_MapRGB(pixel_format, COLOR_R, COLOR_G, COLOR_B), 25, 10, BUTTON_SELECT_WORLD_DONE, bitmapfont1); addChild(panel, buttonDone); Widget* buttonBack = createButton(buttonBackRect, SELECT_WORLD_BACK_TEXT, window->image, REGULAR, "button.bmp", SDL_MapRGB(pixel_format, COLOR_R, COLOR_G, COLOR_B), 20, 10, BUTTON_SELECT_WORLD_BACK, bitmapfont1); addChild(panel, buttonBack); Widget* buttonUp = createButton(buttonUpRect, NULL, window->image, REGULAR, "up_button.bmp", SDL_MapRGB(pixel_format, COLOR_R, COLOR_G, COLOR_B), 20, 10, BUTTON_SELECT_WORLD_INCREASE, bitmapfont1); addChild(panel, buttonUp); Widget* buttonDown = createButton(buttonDownRect, NULL, window->image, REGULAR, "down_button.bmp", SDL_MapRGB(pixel_format, COLOR_R, COLOR_G, COLOR_B), 20, 10, BUTTON_SELECT_WORLD_DECREASE, bitmapfont1); addChild(panel, buttonDown); return window; }
Window::Window() { QTextBrowser *centralWidget = new QTextBrowser; centralWidget->setPlainText(tr("Central widget")); BorderLayout *layout = new BorderLayout; layout->addWidget(centralWidget, BorderLayout::Center); layout->addWidget(createLabel("North"), BorderLayout::North); layout->addWidget(createLabel("West"), BorderLayout::West); layout->addWidget(createLabel("East 1"), BorderLayout::East); layout->addWidget(createLabel("East 2") , BorderLayout::East); layout->addWidget(createLabel("South"), BorderLayout::South); setLayout(layout); setWindowTitle(tr("Border Layout")); }
ident_t condition(){ ident_t tmp1, tmp2 = 0, lab; symtype_t op = UNEQU; opcode_t opcode = NOP; vartype_t type = TCHAR; tmp1 = expression(); if(tmp1->subtype>type)type=tmp1->subtype; if(isEqualOperator(sym)){ op = sym->type; nextSym(); tmp2 = expression(); if(tmp2->subtype>type)type=tmp2->subtype; } if(type==TFLOAT){ gen(FCMP, tmp1, tmp2, 0); }else{ gen(CMP, tmp1, tmp2, 0); } lab = createLabel(); if(op==LESS){ opcode = JGE; }else if(op==LEQU){ opcode = JGT; }else if(op==GREATER){ opcode = JLE; }else if(op==GEQU){ opcode = JLT; }else if(op==UNEQU){ opcode = JEQ; }else if(op==EQU){ opcode = JNE; } gen(opcode, lab, 0, 0); return lab; }
string X86::addGlobalLiteral(string str) { stringstream s; string lb = createLabel(false, "str"); s << lb << " db '" << toNasmString(str) << "',0"; writeDATA(s.str()); return lb; }
void FontTest::setUp() { log("TDD Setup is called"); std::vector<std::string> fontList; // note: name of the font can be found here: // http://iosfonts.com/ fontList.push_back("Arial"); fontList.push_back("GillSans"); fontList.push_back("Helvetica"); fontList.push_back("AmericanTypewriter"); fontList.push_back("Arial-BoldMT"); fontList.push_back("Chalkduster"); fontList.push_back("Courier"); fontList.push_back("Papyrus"); fontList.push_back("TimesNewRomanPSMT"); Size size = TDDHelper::getScreenSize(); Point pos = Point(size.width/2, 100); for(int i=0; i<fontList.size(); i++) { std::string name = fontList[i]; Label *label = createLabel(name, name, 20); label->setPosition(pos); addChild(label); pos.y += 30; } }
void browserView::showApplications(application *applications, int count) { int height = 30; Layout * softkey_layout = new Layout (0, scrHeight, scrWidth, height, NULL, 2, 1); Label * softLeft = new Label (0, 0, scrWidth / 2, height, softkey_layout); softLeft->setCaption ("select"); if (count == 0) { createInfoLabel ("", "No apps in this category", list_box); this->currentScreen = BROWSER_VIEW; softLeft->setCaption (""); } softLeft->setBackgroundColor (0); softLeft->setHorizontalAlignment (Label::HA_LEFT); setLabelPadding (softLeft); Label * softRight = new Label (0, 0, scrWidth/2, height, softkey_layout); softRight->setCaption ("back"); softRight->setBackgroundColor (0); softRight->setHorizontalAlignment (Label::HA_RIGHT); setLabelPadding (softRight); this->getMain ()->add (softkey_layout); int i; for(i = 0; i < count; i++){ //printf("%s\n", applications[i].name); createLabel (applications [i].name, list_box); } }
bool ZodiakPlugin::eventFilter(QObject *o, QEvent *e) { if (e->type() == QEvent::ChildInserted){ QChildEvent *ce = (QChildEvent*)e; if (ce->child()->inherits("DatePicker")){ DatePicker *picker = (DatePicker*)(ce->child()); list<Picker>::iterator it; for (it = m_pickers.begin(); it != m_pickers.end(); ++it){ if ((*it).picker == picker) break; } if (it == m_pickers.end()) createLabel(picker); } } if (e->type() == QEvent::ChildRemoved){ QChildEvent *ce = (QChildEvent*)e; if (ce->child()->inherits("DatePicker")){ DatePicker *picker = (DatePicker*)(ce->child()); for (list<Picker>::iterator it = m_pickers.begin(); it != m_pickers.end(); ++it){ if ((*it).picker == picker){ m_pickers.erase(it); break; } } } } return QObject::eventFilter(o, e); }
Data::Node::Node(qlonglong id, QString name, Data::Type* type, float scaling, Data::Graph* graph, osg::Vec3f position) { //konstruktor //scaling je potrebne na zmensenie uzla ak je vnoreny this->id = id; this->name = name; this->type = type; this->mIsFocused = false; this->mTargetPosition = position; this->currentPosition = position * Util::ApplicationConfig::get()->getValue("Viewer.Display.NodeDistanceScale").toFloat(); this->graph = graph; this->inDB = false; this->edges = new QMap<qlonglong, osg::ref_ptr<Data::Edge> >; this->scale = scaling; this->setBall(NULL); this->setParentBall(NULL); this->hasNestedNodes = false; settings = new QMap<QString, QString>(); //APA settings->insert("Velkost","4242"); settings->insert("Farba","ruzova"); //APA int pos = 0; int cnt = 0; labelText = this->name; while ((pos = labelText.indexOf(QString(" "), pos + 1)) != -1) { if (++cnt % 3 == 0) labelText = labelText.replace(pos, 1, "\n"); } this->square = createNode(this->scale * 4, Node::createStateSet(this->type)); this->focusedSquare = createNode(this->scale * 16, Node::createStateSet(this->type)); this->addDrawable(square); this->label = createLabel(this->type->getScale(), labelText); this->force = osg::Vec3f(); this->velocity = osg::Vec3f(0,0,0); this->fixed = false; this->ignore = false; this->positionCanBeRestricted = true; this->removableByUser = true; this->selected = false; this->usingInterpolation = true; //nastavenie farebneho typu float r = type->getSettings()->value("color.R").toFloat(); float g = type->getSettings()->value("color.G").toFloat(); float b = type->getSettings()->value("color.B").toFloat(); float a = type->getSettings()->value("color.A").toFloat(); this->setColor(osg::Vec4(r, g, b, a)); }
/** Update function called from the GUIEngine to handle displaying of the * messages. It will make sure that each message is shown for a certain * amount of time, before it is discarded and the next message (if any) * is displayed. * \param dt Time step size. */ void update(float dt) { g_all_messages.lock(); bool empty = g_all_messages.getData().empty(); g_all_messages.unlock(); if (empty) return; g_all_messages.lock(); g_current_display_time += dt; if (g_current_display_time > g_max_display_time) { Message *last = g_all_messages.getData().top(); g_all_messages.getData().pop(); delete last; if (g_all_messages.getData().empty()) { g_all_messages.unlock(); return; } g_current_display_time = -1.0f; } Message *current = g_all_messages.getData().top(); // Create new data for the display. if (g_current_display_time < 0) { createLabel(current); } g_all_messages.unlock(); GUIEngine::getSkin()->drawMessage(g_container, g_area, current->getRenderType()); current->draw(); } // update
void switcher(){ ident_t expr, exitlab; qcode_t nop; if(sym->type!=LPAREN){ // error occur; } nextSym(); expr = expression(); if(sym->type!=RPAREN){ // error occur; } nextSym(); if(sym->type!=LBRACE){ // error occur; } nextSym(); exitlab = createLabel(); jumptable(expr, exitlab); if(sym->type==DEFUALT){ nextSym(); defaultcase(); } if(sym->type!=RBRACE){ // error occur; } nextSym(); nop = gen(NOP, 0, 0, 0); putLabel(exitlab, nop); }
void looper(){ ident_t lab1, lab2; qcode_t nop; if(sym->type!=LPAREN){ msg(ERR, "missing \'(\'", line); ERROR_STATUS = 1; } nextSym(); lab1 = createLabel(); nop = gen(NOP, 0, 0, 0); putLabel(lab1, nop); lab2 = condition(); if(sym->type!=RPAREN){ msg(ERR, "missing \')\'", line); ERROR_STATUS = 1; } nextSym(); if(statement()==0){ msg(ERR, "missing a statement", line); ERROR_STATUS = 1; } gen(JMP, lab1, 0, 0); nop = gen(NOP, 0, 0, 0); putLabel(lab2, nop); }
Data::OsgNode::OsgNode( qlonglong id, QString name, Data::Type* type, Data::Graph* graph, float scaling, osg::Vec3f position ) :DbNode( id,name,type,graph,scaling ) { this->mTargetPosition = position; this->currentPosition = position * Util::ApplicationConfig::get()->getValue( "Viewer.Display.NodeDistanceScale" ).toFloat(); this->setBall( NULL ); this->setParentBall( NULL ); insertChild( INDEX_LABEL, createLabel( this->type->getScale(), labelText ) , false ); insertChild( INDEX_SQUARE, createNodeSquare( this->scale, OsgNode::createStateSet( this->type ) ) , false ); insertChild( INDEX_SPHERE, createNodeSphere( this->scale, OsgNode::createStateSet( this->type ) ), false ); setValue( graph->getNodeVisual(), true ); this->square = createNode( this->scale * 4, OsgNode::createStateSet( this->type ) ); this->focusedSquare = createNode( this->scale * 16, OsgNode::createStateSet( this->type ) ); // this->label = createLabel( this->type->getScale(), labelText ); this->force = osg::Vec3f(); this->velocity = osg::Vec3f( 0,0,0 ); this->selected = false; this->usingInterpolation = true; //nastavenie farebneho typu float r = type->getSettings()->value( "color.R" ).toFloat(); float g = type->getSettings()->value( "color.G" ).toFloat(); float b = type->getSettings()->value( "color.B" ).toFloat(); float a = type->getSettings()->value( "color.A" ).toFloat(); this->colorOfNode=osg::Vec4( r, g, b, a ); this->setColor( colorOfNode ); setScale( type->getSettings()->value( "scale" ).toFloat() ); }
QWidget* createOutput(QWidget* parent, uint vol, uint pan) { QGridLayout* grid = new QGridLayout(parent); // row 1 grid->addWidget(createDial(vol), 0, 0); grid->addWidget(createDial(pan), 0, 1); // row 2 grid->addWidget(new QLabel("Vol"), 1, 0); grid->addWidget(new QLabel("Pan"), 1, 1); // row 3 grid->addWidget(createLabel(vol), 2, 0); grid->addWidget(createLabel(pan), 2, 1); grid->setHorizontalSpacing(2); grid->setVerticalSpacing(0); grid->setRowStretch(3, 1); return parent; }
TRadioField::TRadioField( TMeasurements& m, const char *aLabel, ushort aStringLength, TSItem *aStrings, TSItem *aDeviceStrings, ushort options ) : TField( m, TRadioField::controlSize, aLabel, aStringLength, options ), strings( aStrings ) { short i = 0; TSItem *p; for( p = aDeviceStrings; p != 0; p = p->next ) i++; deviceStrings = new TStringCollection( i, 0 ); while( aDeviceStrings != 0 ) { p = aDeviceStrings; deviceStrings->atInsert( deviceStrings->getCount(), newStr( aDeviceStrings->value ) ); aDeviceStrings = aDeviceStrings->next; delete p; } adjustRBMeasurements( m, aStrings ); createControl( m ); if( aLabel ) createLabel( m, aLabel ); }
LevelMenu::LevelMenu(PPoint* position, string texture, int level, int score, int width, int height) : WorldObject(position, texture, width, height) { this->level_ = level; if (level <8){ score = 400; } else if (level> 8 && level < 16){ score = 23700; } else { this->score_ = score; } offsetX_ = 0; if (score > 10000) setTexture("three_gold_star"); if (score < 10000) setTexture("two_gold_star"); if (score < 1000) setTexture("one_gold_star"); if (score < 100) setTexture("silver_stars"); if (score == 0) setTexture("lock"); spX_ = sprite_->getPositionX(); stringstream ss; ss << level+1; levelName_ = ss.str(); createLabel(); }
void MsgManager::popMsg(string str) { if (_msgLabelVec.size() > 0) { moveAllLabel(); } createLabel(str); }
MenuPanel::MenuPanel(MenuElements& elements, const sf::Vector2f& position) : m_position(position) { for(auto button = begin(elements.buttons); button != end(elements.buttons); ++button) createButton(*button); for(auto checkbox = begin(elements.checkboxes); checkbox != end(elements.checkboxes); ++checkbox) createCheckBox(*checkbox); for(auto slider = begin(elements.slider); slider != end(elements.slider); ++slider) createSlider(*slider); for(auto label = begin(elements.labels); label != end(elements.labels); ++label) createLabel(*label); for(auto sprite = begin(elements.sprites); sprite != end(elements.sprites); ++sprite) createSprite(*sprite); for(auto inputbox = begin(elements.infobox); inputbox != end(elements.infobox); ++inputbox) createInputBox(*inputbox); for(auto it = begin(elements.animationContainer); it != end(elements.animationContainer); ++it) createAnimationContainer(std::move(*it)); setCorrelation(); std::sort(m_elements.begin(), m_elements.end(), [](const std::unique_ptr<MenuElement>& a, const std::unique_ptr<MenuElement>& b) -> bool { return a->getId() < b->getId(); }); }
void DisplayFile::create() { text = ""; createQTE(); createLabel(); createLayout(); }