void WinPhCalib::print() { _lcd->setColor(grey[0],grey[1],grey[2]); _lcd->setBackColor(VGA_WHITE); //Start screen if (_actScreen == 0) { _lcd->print(pmChar(startCalibStr1),centerX(startCalibStr1),_yThreeLnsFirst); _lcd->print(pmChar(startCalibStr2),centerX(startCalibStr2),_yThreeLnsSecond); _phCalibrationButtons[_nFlowButtons] = _buttons.addButton(centerX(yesStr),_yThreeLnsThird,yesStr); //pH 7,4 and 10 screens } else { _lcd->print(pmChar(phText1),centerX(phText1),_yThreeLnsFirst); _lcd->print(pmChar(phText2),centerX(phText2),_yThreeLnsSecond); uint16_t x = centerX(phText2) + 14*_bigFontSize; if (_actScreen == 1) _lcd->printNumI(7,x,_yThreeLnsSecond); if (_actScreen == 2) _lcd->printNumI(4,x,_yThreeLnsSecond); if (_actScreen == 3) _lcd->printNumI(10,x,_yThreeLnsSecond); _lcd->print(pmChar(phText4),centerX(phText4),_yThreeLnsThird); if ((_actScreen == 1) || (_actScreen == 2)) _phCalibrationButtons[_nFlowButtons] = _buttons.addButton(centerX(continueStr),200,continueStr); else if (_actScreen == 3) _phCalibrationButtons[_nFlowButtons] = _buttons.addButton(centerX(endStr),200,endStr); } }
void CartesianWidget::calcBounds() { int w = width(); int h = height(); mxmin = centerX() - (double)(w/2.0) / ((double)scaleX()/zoom()); mxmax = centerX() + (double)(w/2.0) / ((double)scaleX()/zoom()); mymin = centerY() - (double)(h/2.0) / ((double)scaleY()/zoom()); mymax = centerY() + (double)(h/2.0) / ((double)scaleY()/zoom()); emit boundsChanged(mxmin, mymin, mxmax, mymax); }
//These function should be the first to get its buttons into the array buttons //It gets input button array and adds appropriate back/save/cancel to positions 0, 1 & 2 void Window::addFlowButtons(boolean backButton, boolean saveButton, boolean exitButton, int8_t buttonArray[]) { _lcd->setBackColor(VGA_WHITE); _lcd->setColor(darkGreen[0],darkGreen[1],darkGreen[2]); if (backButton) { const int backX = 15; _lcd->drawLine(backX-1,_flowButtonY-5,backX+_bigFontSize*strlen_P(backText),_flowButtonY-5); buttonArray[0] = _buttons.addButton(backX, _flowButtonY, backText); } else buttonArray[0] = -1; if (saveButton) { const int saveX = centerX(saveText); _lcd->drawLine(saveX-1,_flowButtonY-5,saveX+_bigFontSize*strlen_P(saveText),_flowButtonY-5); buttonArray[1] = _buttons.addButton(saveX, _flowButtonY, saveText); } else buttonArray[1] = -1; if (exitButton) { const int cancelX = _xSize - 15 - _bigFontSize*strlen_P(cancelText); _lcd->drawLine(cancelX-1,_flowButtonY-5,cancelX+_bigFontSize*strlen_P(cancelText),_flowButtonY-5); buttonArray[2] = _buttons.addButton(cancelX, _flowButtonY, cancelText); } else buttonArray[2] = -1; }
void drawSavePanel(void) { const char* s; int i,strlength; GSetForeground(saveGC,(float)saveButtonColor,Xoption); for (i=saveButtonsStart; i<(saveButtonsEnd); i++) { GDraw3DButtonOut(saveGC,saveWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); s = (control->buttonQueue[i]).text; strlength = strlen(s); GSetForeground(trashGC, (float)monoColor((control->buttonQueue[i]).textColor),Xoption); GDrawString(trashGC,saveWindow, (control->buttonQueue[i]).buttonX + centerX(processGC,s,strlength, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(processGC,(control->buttonQueue[i]).buttonHeight), s,strlen(s),Xoption); } /* for i in control->buttonQueue */ } /* drawSavePanel */
//Draw splash Screen void Window::print() { _lcd->setFont(hallfetica_normal); _lcd->setColor(grey[0], grey[1], grey[2]); _lcd->setBackColor(VGA_WHITE); //Shows centered icon _lcd->drawBitmap(_xSize/2-(_bigIconSize/2),10,_bigIconSize,_bigIconSize,logo126); //Shows centered text _lcd->print(pmChar(loadingText),centerX(loadingText),50+_bigIconSize); }
void writeControlTitle(void) { int strlength; s = viewport->title; strlength = strlen(s); XClearArea(dsply,control->controlWindow,0,0,controlWidth,potA,False); GSetForeground(anotherGC,(float)controlTitleColor,Xoption); GDrawImageString(anotherGC,control->controlWindow, centerX(anotherGC,s,strlength,controlWidth), 15,s,strlength,Xoption); } /* writeControlTitle() */
static void draw(GDISPLAY_WIDGET* widget){ GDISPLAY* display = widget->_owner_; DIAL_WIDGET* dial = (DIAL_WIDGET*)widget; // Get the center of the dial PIXEL radius = getRadius(dial); //PIXEL innerRadius = radius * (100 - dial->dialThickness) / 100; VECTOR2D north = MAKE_VECTOR2D(0,-1); VECTOR2D origin = MAKE_VECTOR2D(centerX(dial),centerY(dial)); MATRIX2D rotate; // Create the dial background circle _displayMoveTo(display, origin.x, origin.y); _displaySetInk(display,&dial->_props_.dial); _displayCircle(display, radius, TRUE); // _displaySetInk(display,&dial->_widget_.bgnd); // _displayCircle(display, innerRadius, TRUE); // Put grad marks for every x if(dial->_props_.gradVal != 0){ _displaySetInk(display, &dial->_props_.grad); for(double grad = dial->_props_.setting.min; grad <= dial->_props_.setting.max; grad+=dial->_props_.gradVal){ // Create Rotation matrix double angle = interpolatef(grad, dial->_props_.setting.min, dial->_props_.setting.max, dial->_props_.minAng, dial->_props_.maxAng); double rad = angle * M_PI/180.0; matrix2d_SetRotate(&rotate, rad); // Rotate the North vector VECTOR2D max,min; matrix2d_Transform(&max, &north, &rotate); vector2d_Copy(&min,&max); vector2d_Scale(&max,radius); double scale = 0.85; vector2d_Scale(&min,radius * scale); vector2d_Add(&min,&origin); vector2d_Add(&max,&origin); // Draw line from min to max _displayMoveTo(display, round(min.x), round(min.y)); _displayLineTo(display, round(max.x), round(max.y)); } } }
void writeControlMessage(void) { int strlength; controlPanelStruct *cp; XWindowAttributes cwInfo; cp = viewport->controlPanel; XGetWindowAttributes(dsply,cp->controlWindow,&cwInfo); strlength = strlen(cp->message); GDrawImageString(controlMessageGC,cp->controlWindow, centerX(globalGC1,cp->message,strlength,controlWidth), controlMessageY + globalFont->max_bounds.ascent - 2, cp->message,strlength,Xoption); }
void onSetData(const GrGLSLProgramDataManager& data, const GrFragmentProcessor& _proc) override { const GrCircleBlurFragmentProcessor& _outer = _proc.cast<GrCircleBlurFragmentProcessor>(); auto circleRect = _outer.circleRect(); (void)circleRect; auto textureRadius = _outer.textureRadius(); (void)textureRadius; auto solidRadius = _outer.solidRadius(); (void)solidRadius; GrSurfaceProxy& blurProfileSamplerProxy = *_outer.textureSampler(0).proxy(); GrTexture& blurProfileSampler = *blurProfileSamplerProxy.priv().peekTexture(); (void)blurProfileSampler; UniformHandle& circleData = fCircleDataVar; (void)circleData; data.set4f(circleData, circleRect.centerX(), circleRect.centerY(), solidRadius, 1.f / textureRadius); }
void CreditContext::draw(){ //clear screen SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,0,0,0)); //draw listing int width = 0; int x = 0; for(size_t i = 0; i < creditListing.size(); ++i ){ width = getStringWidth(font::creditFont.at(fontSize), creditListing.at(i)); x = centerX( width, screen->w ); drawText( creditListing.at(i), font::creditFont.at(fontSize), colour::white, screen, x, line*i+y ); } //draw black box and "Press Esc to return" SDL_FillRect(screen, &escBox, SDL_MapRGB(screen->format,0,0,0)); drawText( "Press Esc to return", font::mainFont.at(16), colour::yellow, screen, 0, 0); }
void WinEcCalib::print() { _lcd->setColor(grey[0],grey[1],grey[2]); _lcd->setBackColor(VGA_WHITE); //Start screen if (_actScreen == 0) { _lcd->print(pmChar(startCalibStr1),centerX(startCalibStr1),_yThreeLnsFirst); _lcd->print(pmChar(startCalibStr2),centerX(startCalibStr2),_yThreeLnsSecond); _ecCalibrationButtons[_nFlowButtons] = _buttons.addButton(centerX(yesStr),_yThreeLnsThird,yesStr); //Dry calibration screen } else if (_actScreen == 1) { _lcd->print(pmChar(ecText1),centerX(ecText1),_yThreeLnsFirst); _lcd->print(pmChar(ecText2),centerX(ecText2),_yThreeLnsSecond); _lcd->print(pmChar(ecText3),centerX(ecText3),_yThreeLnsThird); _ecCalibrationButtons[_nFlowButtons] = _buttons.addButton(centerX(continueStr),200,continueStr); //40,000uS screen } else if (_actScreen == 2) { _lcd->print(pmChar(ecText4),centerX(ecText4),_yThreeLnsFirst); _lcd->print(pmChar(ecText5),centerX(ecText5),_yThreeLnsSecond); _lcd->print(pmChar(ecText6),centerX(ecText6),_yThreeLnsThird); _ecCalibrationButtons[_nFlowButtons] = _buttons.addButton(centerX(continueStr),200,continueStr); //10,500uS screen } else if (_actScreen = 3) { _lcd->print(pmChar(ecText7),centerX(ecText7),_yThreeLnsFirst); _lcd->print(pmChar(ecText8),centerX(ecText8),_yThreeLnsSecond); _lcd->print(pmChar(ecText6),centerX(ecText6),_yThreeLnsThird); _ecCalibrationButtons[_nFlowButtons] = _buttons.addButton(centerX(endStr),200,endStr); } }
void drawLightingPanel(void) { char *s; int i,strlength; /* Draw border lines to separate the lighting window, potentiometers, and button regions of the lightng subpanel. */ GSetForeground(trashGC,(float)foregroundColor,Xoption); GSetLineAttributes(trashGC,3,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, lightingWindow, 0, potA, controlWidth, potA, Xoption); GSetLineAttributes(trashGC,2,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, lightingWindow, 0, lightB, controlWidth, lightB, Xoption); GDrawLine(trashGC, lightingWindow, 0, lightPotA, controlWidth, lightPotA, Xoption); GDrawLine(trashGC, lightingWindow, 0, lightPotB, controlWidth, lightPotB, Xoption); GDrawLine(trashGC, lightingWindow, lightTransL, lightPotA, lightTransL, lightPotB, Xoption); writeControlTitle(lightingWindow); s = "Lighting Control Panel"; strlength = strlen(s); GSetForeground(anotherGC,(float)lightingTitleColor,Xoption); GDrawString(anotherGC, lightingWindow, centerX(anotherGC, s, strlength, controlWidth), lightB+18, s, strlength, Xoption); for (i=lightingButtonsStart; i<(lightingButtonsEnd); i++) { switch (i) { case lightMove: GSetForeground(lightingGC,(float)lightingButtonColor,Xoption); GDraw3DButtonOut(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); GSetForeground(lightingGC,(float)monoColor(buttonColor),Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY + 2*(control->buttonQueue[i]).yHalf,Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf, (control->buttonQueue[i]).buttonX + 2*(control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf,Xoption); break; case lightMoveXY: GSetForeground(lightingGC,(float)lightingButtonColor,Xoption); GDraw3DButtonOut(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); GSetForeground(lightingGC,(float)monoColor(buttonColor),Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY + 2*(control->buttonQueue[i]).yHalf,Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf, (control->buttonQueue[i]).buttonX + 2*(control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf,Xoption); break; case lightMoveZ: GSetForeground(lightingGC,(float)lightingButtonColor,Xoption); GDraw3DButtonOut(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); GSetForeground(lightingGC,(float)monoColor(buttonColor),Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf, (control->buttonQueue[i]).buttonY + 2*(control->buttonQueue[i]).yHalf,Xoption); GDrawLine(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf - (control->buttonQueue[i]).xHalf/2, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).xHalf + (control->buttonQueue[i]).xHalf/2, (control->buttonQueue[i]).buttonY + (control->buttonQueue[i]).yHalf,Xoption); break; case lightTranslucent: drawLightTransArrow(); break; default: GDraw3DButtonOut(lightingGC,lightingWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); s = (control->buttonQueue[i]).text; strlength = strlen(s); GSetForeground(trashGC, (float)monoColor((control->buttonQueue[i]).textColor),Xoption); GDrawString(trashGC, lightingWindow, (control->buttonQueue[i]).buttonX + centerX(processGC,s,strlength, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(processGC,(control->buttonQueue[i]).buttonHeight), s,strlen(s),Xoption); } /* switch */ } /* for i in control->buttonQueue */ GSetForeground(lightingGC,(float)monoColor(labelColor),Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightMoveXY].buttonX + control->buttonQueue[lightMoveXY].buttonWidth + 3, control->buttonQueue[lightMoveXY].buttonY + control->buttonQueue[lightMoveXY].yHalf, "x",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightMoveXY].buttonX + control->buttonQueue[lightMoveXY].xHalf - 2, control->buttonQueue[lightMoveXY].buttonY - 4, "y",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightMoveZ].buttonX + control->buttonQueue[lightMoveZ].xHalf - 2, control->buttonQueue[lightMoveZ].buttonY - 4, "z",1,Xoption); /** Draw the title for the intensity potentiometer. */ GSetForeground(lightingGC,(float)lightingTransColor,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY, "I",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight, "n",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*2, "t",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*3, "e",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*4, "n",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*5, "s",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*6, "i",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*7, "t",1,Xoption); GDrawString(lightingGC,lightingWindow, control->buttonQueue[lightTranslucent].buttonX + control->buttonQueue[lightTranslucent].buttonWidth + 3, control->buttonQueue[lightTranslucent].buttonY + lightFontHeight*8, "y",1,Xoption); drawLightingAxes(); drawLightTransArrow(); } /* drawLightingPanel */
void ChordRest::layoutArticulations() { if (parent() == 0 || _articulations.isEmpty()) return; qreal _spatium = spatium(); qreal _spStaff = _spatium * staff()->lineDistance(); // scaled to staff line distance for vert. pos. within a staff if (type() == Element::Type::CHORD) { if (_articulations.size() == 1) { static_cast<Chord*>(this)->layoutArticulation(_articulations[0]); return; } if (_articulations.size() == 2) { // // staccato | tenuto + marcato // Articulation* a1 = _articulations[0]; Articulation* a2 = _articulations[1]; ArticulationType st1 = a1->articulationType(); ArticulationType st2 = a2->articulationType(); if ((st2 == ArticulationType::Tenuto || st2 == ArticulationType::Staccato) && (st1 == ArticulationType::Marcato)) { qSwap(a1, a2); qSwap(st1, st2); } if ((st1 == ArticulationType::Tenuto || st1 == ArticulationType::Staccato) && (st2 == ArticulationType::Marcato)) { QPointF pt = static_cast<Chord*>(this)->layoutArticulation(a1); pt.ry() += a1->up() ? -_spStaff * .5 : _spStaff * .5; a2->layout(); a2->setUp(a1->up()); a2->setPos(pt); a2->adjustReadPos(); return; } // // staccato | tenuto + sforzato // if ((st2 == ArticulationType::Tenuto || st2 == ArticulationType::Staccato) && (st1 == ArticulationType::Sforzatoaccent)) { qSwap(a1, a2); qSwap(st1, st2); } if ((st1 == ArticulationType::Tenuto || st1 == ArticulationType::Staccato) && (st2 == ArticulationType::Sforzatoaccent)) { QPointF pt = static_cast<Chord*>(this)->layoutArticulation(a1); pt.ry() += a1->up() ? -_spStaff * .7 : _spStaff * .7; a2->layout(); a2->setUp(a1->up()); a2->setPos(pt); a2->adjustReadPos(); return; } } } qreal x = centerX(); qreal distance0 = score()->styleS(StyleIdx::propertyDistance).val() * _spatium; qreal distance1 = score()->styleS(StyleIdx::propertyDistanceHead).val() * _spatium; qreal distance2 = score()->styleS(StyleIdx::propertyDistanceStem).val() * _spatium; qreal chordTopY = upPos(); // note position of highest note qreal chordBotY = downPos(); // note position of lowest note qreal staffTopY = -distance2; qreal staffBotY = staff()->height() + distance2; // avoid collisions of staff articulations with chord notes: // gap between note and staff articulation is distance0 + 0.5 spatium if (type() == Element::Type::CHORD) { Chord* chord = static_cast<Chord*>(this); Stem* stem = chord->stem(); if (stem) { qreal y = stem->pos().y() + pos().y(); if (up() && stem->stemLen() < 0.0) y += stem->stemLen(); else if (!up() && stem->stemLen() > 0.0) y -= stem->stemLen(); if (beam()) { qreal bw = score()->styleS(StyleIdx::beamWidth).val() * _spatium; y += up() ? -bw : bw; } if (up()) staffTopY = qMin(staffTopY, qreal(y - 0.5 * _spatium)); else staffBotY = qMax(staffBotY, qreal(y + 0.5 * _spatium)); } } staffTopY = qMin(staffTopY, qreal(chordTopY - distance0 - 0.5 * _spatium)); staffBotY = qMax(staffBotY, qreal(chordBotY + distance0 + 0.5 * _spatium)); qreal dy = 0.0; int n = _articulations.size(); for (int i = 0; i < n; ++i) { Articulation* a = _articulations.at(i); // // determine MScore::Direction // if (a->direction() != MScore::Direction::AUTO) { a->setUp(a->direction() == MScore::Direction::UP); } else { if (a->anchor() == ArticulationAnchor::CHORD) a->setUp(!up()); else a->setUp(a->anchor() == ArticulationAnchor::TOP_STAFF || a->anchor() == ArticulationAnchor::TOP_CHORD); } } // // pass 1 // place tenuto and staccato // for (int i = 0; i < n; ++i) { Articulation* a = _articulations.at(i); a->layout(); ArticulationAnchor aa = a->anchor(); if ((a->articulationType() != ArticulationType::Tenuto) && (a->articulationType() != ArticulationType::Staccato)) continue; if (aa != ArticulationAnchor::CHORD && aa != ArticulationAnchor::TOP_CHORD && aa != ArticulationAnchor::BOTTOM_CHORD) continue; bool bottom; if ((aa == ArticulationAnchor::CHORD) && measure()->hasVoices(a->staffIdx())) bottom = !up(); else bottom = (aa == ArticulationAnchor::BOTTOM_CHORD) || (aa == ArticulationAnchor::CHORD && up()); bool headSide = bottom == up(); dy += distance1; qreal y; Chord* chord = static_cast<Chord*>(this); if (bottom) { int line = downLine(); y = chordBotY + dy; if (!headSide && type() == Element::Type::CHORD && chord->stem()) { Stem* stem = chord->stem(); y = chordTopY + stem->stemLen(); if (chord->beam()) y += score()->styleS(StyleIdx::beamWidth).val() * _spatium * .5; x = stem->pos().x(); int line = lrint((y+0.5*_spatium) / _spatium); if (line <= 4) // align between staff lines y = line * _spatium + _spatium * .5; else y += _spatium; } else { int lines = (staff()->lines() - 1) * 2; if (line < lines) y = (line & ~1) + 3; else y = line + 2; y *= _spatium * .5; } } else { int line = upLine(); y = chordTopY - dy; if (!headSide && type() == Element::Type::CHORD && chord->stem()) { Stem* stem = chord->stem(); y = chordBotY + stem->stemLen(); if (chord->beam()) y -= score()->styleS(StyleIdx::beamWidth).val() * _spatium * .5; x = stem->pos().x(); int line = lrint((y-0.5*_spatium) / _spatium); if (line >= 0) // align between staff lines y = line * _spatium - _spatium * .5; else y -= _spatium; } else { if (line > 0) y = ((line+1) & ~1) - 3; else y = line - 2; y *= _spatium * .5; } } dy += _spatium * .5; a->setPos(x, y); } // reserve space for slur bool botGap = false; bool topGap = false; #if 0 // TODO-S: optimize for (Spanner* sp = _spannerFor; sp; sp = sp->next()) { if (sp->type() != SLUR) continue; Slur* s = static_cast<Slur*>(sp); if (s->up()) topGap = true; else botGap = true; } for (Spanner* sp = _spannerBack; sp; sp = sp->next()) { if (sp->type() != SLUR) continue; Slur* s = static_cast<Slur*>(sp); if (s->up()) topGap = true; else botGap = true; } #endif if (botGap) chordBotY += _spatium; if (topGap) chordTopY -= _spatium; // // pass 2 // place all articulations with anchor at chord/rest // n = _articulations.size(); for (int i = 0; i < n; ++i) { Articulation* a = _articulations.at(i); a->layout(); ArticulationAnchor aa = a->anchor(); if ((a->articulationType() == ArticulationType::Tenuto) || (a->articulationType() == ArticulationType::Staccato)) continue; if (aa != ArticulationAnchor::CHORD && aa != ArticulationAnchor::TOP_CHORD && aa != ArticulationAnchor::BOTTOM_CHORD) continue; // for tenuto and staccate check for staff line collision bool staffLineCT = a->articulationType() == ArticulationType::Tenuto || a->articulationType() == ArticulationType::Staccato; // qreal sh = a->bbox().height() * mag(); bool bottom = (aa == ArticulationAnchor::BOTTOM_CHORD) || (aa == ArticulationAnchor::CHORD && up()); dy += distance1; if (bottom) { qreal y = chordBotY + dy; if (staffLineCT && (y <= staffBotY -.1 - dy)) { qreal l = y / _spatium; qreal delta = fabs(l - round(l)); if (delta < 0.4) { y += _spatium * .5; dy += _spatium * .5; } } a->setPos(x, y); // - a->bbox().y() + a->bbox().height() * .5); } else { qreal y = chordTopY - dy; if (staffLineCT && (y >= (staffTopY +.1 + dy))) { qreal l = y / _spatium; qreal delta = fabs(l - round(l)); if (delta < 0.4) { y -= _spatium * .5; dy += _spatium * .5; } } a->setPos(x, y); // + a->bbox().y() - a->bbox().height() * .5); } } // // pass 3 // now place all articulations with staff top or bottom anchor // qreal dyTop = staffTopY; qreal dyBot = staffBotY; /* if ((upPos() - _spatium) < dyTop) dyTop = upPos() - _spatium; if ((downPos() + _spatium) > dyBot) dyBot = downPos() + _spatium; */ for (int i = 0; i < n; ++i) { Articulation* a = _articulations.at(i); ArticulationAnchor aa = a->anchor(); if (aa == ArticulationAnchor::TOP_STAFF || aa == ArticulationAnchor::BOTTOM_STAFF) { if (a->up()) { a->setPos(x, dyTop); dyTop -= distance0; } else { a->setPos(x, dyBot); dyBot += distance0; } } a->adjustReadPos(); } }
void drawControlPanel(void) { controlPanelStruct *cp; int i,strlength; char *s; cp = viewport->controlPanel; /* Draw border lines to separate the potentiometer, message, graph select and button regions of the control panel. */ GSetForeground(trashGC,(float)foregroundColor,Xoption); GSetLineAttributes(trashGC,3,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, cp->controlWindow, 0, potA, controlWidth, potA, Xoption); GSetLineAttributes(trashGC,2,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, cp->controlWindow, 0, potB, controlWidth, potB, Xoption); GDrawLine(trashGC, cp->controlWindow, 0, messageBot, controlWidth, messageBot, Xoption); GDrawLine(trashGC, cp->controlWindow, 0, 286, controlWidth, 286, Xoption); /** put the line width as 1 last because used below as well **/ GSetLineAttributes(trashGC,1,LineSolid,CapButt,JoinMiter,Xoption); GDrawRectangle(trashGC,cp->controlWindow,closeLeft,closeTop, (controlWidth-closeLeft+8),(controlHeight-closeTop+8),Xoption); /* Write potentiometer titles on the control panel. */ writeControlTitle(); GSetForeground(globGC,(float)controlPotHeaderColor,Xoption); s = "Scale"; strlength = strlen(s); GDrawString(globGC,cp->controlWindow, centerX(globGC,s,strlength, cp->buttonQueue[scale2D].buttonWidth) + cp->buttonQueue[scale2D].buttonX, 31+headerHeight,s,strlength,Xoption); s = "Translate"; strlength = strlen(s); GDrawString(globGC,cp->controlWindow, centerX(globGC,s,strlength, cp->buttonQueue[translate2D].buttonWidth) + cp->buttonQueue[translate2D].buttonX, 31+headerHeight,s,strlen(s),Xoption); GSetForeground(globGC,(float)controlColorColor,Xoption); /* Write title of the graph selection window. */ s = "Graphs"; strlength = strlen(s); GDrawString(globGC,cp->controlWindow, centerX(globGC,s,strlength,controlWidth),graphHeaderHeight, s,strlength,Xoption); /* Write titles on regular buttons and draw pixmaps on potentiometers. */ for (i=0; i<(maxButtons2D); i++) { if ((cp->buttonQueue[i]).pot) { GSetForeground(globalGC1,(float)buttonColor,Xoption); GDrawRectangle(globalGC1,cp->controlWindow, (cp->buttonQueue[i]).buttonX, (cp->buttonQueue[i]).buttonY, (cp->buttonQueue[i]).buttonWidth, (cp->buttonQueue[i]).buttonHeight,Xoption); GSetForeground(trashGC, (float)monoColor((cp->buttonQueue[i]).textColor),Xoption); GDrawLine(globalGC1,cp->controlWindow, /* trashGC, */ (cp->buttonQueue[i]).buttonX + (cp->buttonQueue[i]).xHalf, (cp->buttonQueue[i]).buttonY, (cp->buttonQueue[i]).buttonX + (cp->buttonQueue[i]).xHalf, (cp->buttonQueue[i]).buttonY + 2*(cp->buttonQueue[i]).yHalf,Xoption); GDrawLine(globalGC1,cp->controlWindow, /* trashGC, */ (cp->buttonQueue[i]).buttonX, (cp->buttonQueue[i]).buttonY + (cp->buttonQueue[i]).yHalf, (cp->buttonQueue[i]).buttonX + 2*(cp->buttonQueue[i]).xHalf, (cp->buttonQueue[i]).buttonY + (cp->buttonQueue[i]).yHalf,Xoption); switch (i) { case scale2D: GDrawLines(trashGC,cp->controlWindow,scaleArrow, scaleArrowN,CoordModeOrigin,Xoption); break; case translate2D: GDrawLines(trashGC,cp->controlWindow,translateArrow, translateArrowN,CoordModeOrigin,Xoption); break; } /* switch i */ } else if (cp->buttonQueue[i].graphNum) { if (mono) { if (graphStateArray[i-graphStart].showing) { GSetForeground(graphGC,(float)backgroundColor,Xoption); GSetBackground(graphGC,(float)foregroundColor,Xoption); } else { GSetForeground(graphGC,(float)foregroundColor,Xoption); GSetBackground(graphGC,(float)backgroundColor,Xoption); } strlength = strlen((cp->buttonQueue[i]).text); GDrawImageString(graphGC,cp->controlWindow, (cp->buttonQueue[i]).buttonX + centerX(graphGC,cp->buttonQueue[i].text, strlength,(cp->buttonQueue[i]).buttonWidth), (cp->buttonQueue[i]).buttonY + centerY(graphGC,(cp->buttonQueue[i]).buttonHeight), cp->buttonQueue[i].text,strlength,Xoption); } else { if (graphStateArray[i-graphStart].showing) GSetForeground(graphGC,(float)graphBarShowingColor,Xoption); else GSetForeground(graphGC,(float)graphBarHiddenColor,Xoption); strlength = strlen((cp->buttonQueue[i]).text); GDrawString(graphGC,cp->controlWindow, (cp->buttonQueue[i]).buttonX + centerX(graphGC,cp->buttonQueue[i].text, strlength,(cp->buttonQueue[i]).buttonWidth), (cp->buttonQueue[i]).buttonY + centerY(graphGC,(cp->buttonQueue[i]).buttonHeight), cp->buttonQueue[i].text,strlength,Xoption); } } else if (cp->buttonQueue[i].graphSelect) { /* The select characters are defined as: "^" for on and "-" for off. */ if (graphStateArray[i-graphSelectStart].selected) { GSetForeground(graphGC,(float)graphBarSelectColor,Xoption); strcpy((cp->buttonQueue[i]).text,"^"); } else { GSetForeground(graphGC,(float)graphBarNotSelectColor,Xoption); *(cp->buttonQueue[i]).text = '-'; strcpy((cp->buttonQueue[i]).text,"-"); } GDrawString(graphGC,cp->controlWindow, (cp->buttonQueue[i]).buttonX + centerX(graphGC,cp->buttonQueue[i].text, strlength,(cp->buttonQueue[i]).buttonWidth), (cp->buttonQueue[i]).buttonY + centerY(graphGC,(cp->buttonQueue[i]).buttonHeight), cp->buttonQueue[i].text,strlength,Xoption); } else { /* a regular button */ int isOn = 1; switch(i) { case pointsOnOff: isOn = pointsON = graphStateArray[0].pointsOn; if (graphStateArray[0].pointsOn) strcpy((cp->buttonQueue[i]).text,"Pts On "); else strcpy((cp->buttonQueue[i]).text,"Pts Off"); break; case spline2D: isOn = splineON = graphStateArray[0].splineOn; if (graphStateArray[0].splineOn) strcpy((cp->buttonQueue[i]).text, "Box On "); else strcpy((cp->buttonQueue[i]).text, "Box Off"); break; case connectOnOff: isOn = connectON = graphStateArray[0].connectOn; if (graphStateArray[0].connectOn) strcpy((cp->buttonQueue[i]).text, "Lines On "); else strcpy((cp->buttonQueue[i]).text, "Lines Off"); break; case axesOnOff2D: isOn = axesON = graphStateArray[0].axesOn; if (graphStateArray[0].axesOn) strcpy((cp->buttonQueue[i]).text , "Axes On "); else strcpy((cp->buttonQueue[i]).text , "Axes Off"); break; case unitsOnOff2D: isOn = unitsON = graphStateArray[0].unitsOn; if (graphStateArray[0].unitsOn) strcpy( (cp->buttonQueue[i]).text , "Units On "); else strcpy( (cp->buttonQueue[i]).text , "Units Off"); break; case closeAll2D: isOn = 0; default: break; } /* switch i */ s = (cp->buttonQueue[i]).text; strlength = strlen(s); GDrawPushButton(dsply, globalGC1, trashGC, processGC, cp->controlWindow, (cp->buttonQueue[i]).buttonX, (cp->buttonQueue[i]).buttonY, (cp->buttonQueue[i]).buttonWidth, (cp->buttonQueue[i]).buttonHeight, isOn, s,buttonColor, monoColor((cp->buttonQueue[i]).textColor), Xoption); } /* else a regular button */ } /* for each button */ /* Refresh the latest message */ makeMessageFromData(0); writeControlMessage(); XFlush(dsply); } /*** drawControlPanel ***/
// Redraw the active part of the widget static void update(GDISPLAY_WIDGET* widget){ GDISPLAY* display = widget->_owner_; DIAL_WIDGET* dial = (DIAL_WIDGET*)widget; VECTOR2D north = MAKE_VECTOR2D(0,getRadius(dial) * -0.8); VECTOR2D west = MAKE_VECTOR2D(-3,0); // Create the rotation matrix for the current value MATRIX2D rotate; double angle = interpolatef(dial->_props_.setting.value, dial->_props_.setting.min, dial->_props_.setting.max, dial->_props_.minAng, dial->_props_.maxAng); matrix2d_SetRotate(&rotate, angle * M_PI/180.0); // Rotate the North vector to find the new tip VECTOR2D tip; matrix2d_Transform(&tip, &north, &rotate); vector2d_Round(&tip, &tip); // Create the rotation matrix for the previous value MATRIX2D rotateOld; double angleOld = interpolatef(dial->_props_.setting.old, dial->_props_.setting.min, dial->_props_.setting.max, dial->_props_.minAng, dial->_props_.maxAng); matrix2d_SetRotate(&rotateOld, angleOld * M_PI/180.0); // Rotate the North vector to find the old tip VECTOR2D oldtip; matrix2d_Transform(&oldtip, &north, &rotateOld); vector2d_Round(&oldtip,&oldtip); // Rotate the West Vector to find the needle start left and right VECTOR2D left,right; matrix2d_Transform(&left , &west, &rotate); right.x = - left.x; right.y = - left.y; vector2d_Round(&left, &left); vector2d_Round(&right, &right); // Rotate the West Vector to find the needle start left and right VECTOR2D oldleft,oldright; matrix2d_Transform(&oldleft , &west, &rotateOld); oldright.x = - oldleft.x; oldright.y = - oldleft.y; vector2d_Round(&oldleft, &oldleft); vector2d_Round(&oldright, &oldright); // Define the origin VECTOR2D origin = MAKE_VECTOR2D(centerX(dial),centerY(dial)); // Make everything relative to the origin vector2d_Add(&tip,&origin); vector2d_Add(&left,&origin); vector2d_Add(&right,&origin); vector2d_Add(&oldtip,&origin); vector2d_Add(&oldleft,&origin); vector2d_Add(&oldright,&origin); // Replace the variable content colour with the background colour _displaySetInk(display,&dial->_props_.dial); _displayTriangleAt(display, oldtip.x,oldtip.y, oldleft.x,oldleft.y, oldright.x,oldright.y,TRUE); // Draw it _displaySetInk(display,&dial->_widget_.content); _displayTriangleAt(display, tip.x,tip.y, left.x,left.y, right.x,right.y,TRUE); }
//Overlays "Saved" text over save button //Used when button is pressed to inform the user values have been stored void Window::printSavedButton() { _lcd->setColor(grey[0],grey[1],grey[2]); _lcd->print(pmChar(savedText),centerX(savedText),_flowButtonY); }
void drawVolumePanel (void) { int i,strlength; /* Draw some lines for volume panel. */ GSetForeground(trashGC,(float)foregroundColor,Xoption); GSetLineAttributes(trashGC,3,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, volumeWindow, 0, potA, controlWidth, potA, Xoption); GSetLineAttributes(trashGC,2,LineSolid,CapButt,JoinMiter,Xoption); GDrawLine(trashGC, volumeWindow, 0, volumeTitleA, controlWidth, volumeTitleA, Xoption); GDrawLine(trashGC, volumeWindow, 0, volumeTitleB, controlWidth, volumeTitleB, Xoption); writeControlTitle(volumeWindow); s = "Viewing Volume Panel"; strlength = strlen(s); GSetForeground(anotherGC,(float)volumeTitleColor,Xoption); GDrawString(anotherGC,volumeWindow, centerX(anotherGC,s,strlength,controlWidth), volumeTitleA+18,s,strlength,Xoption); GSetForeground(anotherGC,(float)monoColor(toggleColor),Xoption); GDrawString(anotherGC,volumeWindow, control->buttonQueue[perspectiveBut].buttonX + 4, control->buttonQueue[perspectiveBut].buttonY - 17, "Settings", 8, Xoption); GSetForeground(trashGC,(float)monoColor(toggleColor),Xoption); GDraw3DButtonOut(trashGC,volumeWindow, control->buttonQueue[perspectiveBut].buttonX - 7, control->buttonQueue[perspectiveBut].buttonY - 36, 100,100,Xoption); for (i=0; i<strlen(clipMess); i++) GDrawString(trashGC,volumeWindow,clipMessX,clipMessY + i*clipMessDy, &(clipMess[i]),1,Xoption); for (i=0; i<strlen(eyeMess1); i++) GDrawString(trashGC,volumeWindow,eyeMess1X,eyeMess1Y + i*eyeMess1Dy, &(eyeMess1[i]),1,Xoption); for (i=0; i<strlen(eyeMess2); i++) GDrawString(trashGC,volumeWindow,eyeMess2X,eyeMess2Y + i*eyeMess2Dy, &(eyeMess2[i]),1,Xoption); GSetLineAttributes(trashGC,0,LineSolid,CapButt,JoinMiter,Xoption); GSetForeground(trashGC,(float)volumeButtonColor,Xoption); for (i=volumeButtonsStart; i<(volumeButtonsEnd); i++) { GSetForeground(trashGC, (float)monoColor((control->buttonQueue[i]).textColor),Xoption); switch (i) { case perspectiveBut: case clipRegionBut: case clipSurfaceBut: GSetForeground(volumeGC,(float)monoColor(toggleColor),Xoption); GDraw3DButtonOut(volumeGC,volumeWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); GSetForeground(volumeGC, (float)monoColor((control->buttonQueue[i]).textColor),Xoption); GDrawString(volumeGC,volumeWindow, (control->buttonQueue[i]).buttonX + (control->buttonQueue[i]).buttonWidth + 4, (control->buttonQueue[i]).buttonY + centerY(volumeGC,(control->buttonQueue[i]).buttonHeight), (control->buttonQueue[i]).text, strlen(control->buttonQueue[i].text),Xoption); if (i==perspectiveBut && viewData.perspective) GDrawString(volumeGC,volumeWindow, (control->buttonQueue[i]).buttonX + centerX(volumeGC,"x",1, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(volumeGC,(control->buttonQueue[i]).buttonHeight), "x",1,Xoption); else if (i==clipRegionBut && viewData.clipbox) GDrawString(volumeGC,volumeWindow, (control->buttonQueue[i]).buttonX + centerX(volumeGC,"x",1, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(volumeGC,(control->buttonQueue[i]).buttonHeight), "x",1,Xoption); else if (i==clipSurfaceBut && viewData.clipStuff) GDrawString(volumeGC,volumeWindow, (control->buttonQueue[i]).buttonX + centerX(volumeGC,"x",1, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(volumeGC,(control->buttonQueue[i]).buttonHeight), "x",1,Xoption); break; case clipXBut: drawClipXBut(); break; case clipYBut: drawClipYBut(); break; case clipZBut: drawClipZBut(); break; case frustrumBut: break; default: GDraw3DButtonOut(trashGC,volumeWindow, (control->buttonQueue[i]).buttonX, (control->buttonQueue[i]).buttonY, (control->buttonQueue[i]).buttonWidth, (control->buttonQueue[i]).buttonHeight,Xoption); s = (control->buttonQueue[i]).text; strlength = strlen(s); GSetForeground(trashGC, (float)monoColor((control->buttonQueue[i]).textColor),Xoption); GDrawString(trashGC,volumeWindow, (control->buttonQueue[i]).buttonX + centerX(processGC,s,strlength, (control->buttonQueue[i]).buttonWidth), (control->buttonQueue[i]).buttonY + centerY(processGC,(control->buttonQueue[i]).buttonHeight), s,strlen(s),Xoption); } /* switch */ } /* for i in volumeButtons */ drawFrustrum(); drawClipVolume(); /*** put in header ***/ drawClipXBut(); drawClipYBut(); drawClipZBut(); } /* drawVolumePanel() */