void FilteredView::keyPressEvent( QKeyEvent* keyEvent ) { bool noModifier = keyEvent->modifiers() == Qt::NoModifier; if ( keyEvent->key() == Qt::Key_BracketLeft && noModifier ) { for ( qint64 i = static_cast<qint64>( getViewPosition() ) - 1; i >= 0; --i ) { if ( lineType( i ) == Marked ) { selectAndDisplayLine( static_cast<LineNumber>( i ) ); break; } } keyEvent->accept(); } else if ( keyEvent->key() == Qt::Key_BracketRight && noModifier ) { for ( qint64 i = getViewPosition() + 1; i < logFilteredData_->getNbLine(); ++i ) { if ( lineType( i ) == Marked ) { selectAndDisplayLine( static_cast<LineNumber>( i ) ); break; } } keyEvent->accept(); } else { keyEvent->ignore(); AbstractLogView::keyPressEvent( keyEvent ); } }
QString AsmFormatter::tidyAsm( QStringList lines ) { // Update our indentation values from config m_indentAsmName = KTLConfig::indentAsmName(); m_indentAsmData = KTLConfig::indentAsmData(); m_indentEqu = KTLConfig::indentEqu(); m_indentEquValue = KTLConfig::indentEquValue(); m_indentComment = m_indentEquComment = KTLConfig::indentComment(); QStringList::iterator end = lines.end(); for ( QStringList::iterator slit = lines.begin(); slit != end; ++slit ) { switch ( lineType(*slit) ) { case Other: break; case Equ: *slit = tidyEqu( *slit ); break; case Instruction: *slit = tidyInstruction( *slit ); break; } } QString code; for ( QStringList::iterator slit = lines.begin(); slit != end; ++slit ) code.append( *slit + '\n' ); return code; }
QVariant SlurTie::getProperty(P_ID propertyId) const { switch(propertyId) { case P_LINE_TYPE: return lineType(); case P_SLUR_DIRECTION: return slurDirection(); default: return Spanner::getProperty(propertyId); } }
int main (int argc, char** argv) { if (argc < 3) { std::cout << "Usage: mixingfit fitfile graphicsfile" << std::endl; return 1; } std::ifstream fitOpts(argv[1]); if (fitOpts.fail()) { std::cout << "Failed to open fitting file " << argv[1] << std::endl; return 1; } std::ifstream grpOpts(argv[2]); if (grpOpts.fail()) { std::cout << "Failed to open graphics file " << argv[2] << std::endl; return 1; } int numActive = 0; char token[10000]; MixingResult* res = 0; std::ofstream my_out_file; std::string my_string = std::string(argv[1])+"_out.tex"; // std::cout<<"my_string = "<<my_string<<std::endl; my_out_file.open(my_string.c_str()); my_out_file<<"\\begin{table}[htdp]"<<std::endl <<"\\caption{All CPV allowed inputs}"<<std::endl <<"\\begin{center}"<<std::endl <<"\\begin{tabular}{|c|c|c|}"<<std::endl <<"\\hline"<<std::endl <<"Result & Value & Correlation Coefficients \\\\"<<std::endl <<"\\hline \\hline"<<std::endl; bool which_override = false; while (!fitOpts.eof()) { fitOpts >> token; if (token[0] == '#') { fitOpts.getline(token, 10000); continue; } std::string lineType(token); if (lineType == "result") { char name[1000]; char rtype[1000]; char ptype[1000]; double result = 0; double stat = 0; double syst = 0; double modl = 0; double coef = 0; fitOpts >> name >> rtype >> ptype >> result >> stat >> syst >> modl >> coef; res = new MixingResult(name, rtype, ptype, result, stat, syst, modl, coef); my_out_file<<"$" <<name <<"("<<ptype<<")"<<"$"<<" & $"<<result<<"\\pm"<<stat<<"\\pm"<<syst<<"$ & \\\\"<<std::endl; } else if (lineType == "correlation") {
void CGnuPlotBorderData:: save(std::ostream &os) const { int s = sides().getValue(31); os << "set border " << s << " " << CStrUniqueMatch::valueToString<DrawLayer>(layer()) << " lt " << lineType() << " linewidth " << lineWidth() << " dashtype solid" << std::endl; }
void CGnuPlotBorderData:: show(std::ostream &os) const { int s = sides().getValue(31); if (s) os << "border is not drawn" << std::endl; else os << "border " << s << " is drawn in" << CStrUniqueMatch::valueToString<DrawLayer>(layer()) << " layer with" << " linecolor " << lineStyle() << " linewidth " << lineWidth() << " lineType " << lineType() << std::endl; }
void Tie::computeBezier(SlurSegment* ss, QPointF p6o) { qreal _spatium = spatium(); qreal shoulderW; // height as fraction of slur-length qreal shoulderH; // // pp1 start of slur // pp2 end of slur // pp3 bezier 1 // pp4 bezier 2 // pp5 drag // pp6 shoulder // QPointF pp1 = ss->ups[GRIP_START].p + ss->ups[GRIP_START].off * _spatium; QPointF pp2 = ss->ups[GRIP_END].p + ss->ups[GRIP_END].off * _spatium; QPointF p2 = pp2 - pp1; // normalize to zero if (p2.x() == 0.0) { qDebug("zero tie"); return; } qreal sinb = atan(p2.y() / p2.x()); QTransform t; t.rotateRadians(-sinb); p2 = t.map(p2); p6o = t.map(p6o); double smallH = 0.38; qreal d = p2.x() / _spatium; shoulderH = d * 0.4 * smallH; if (shoulderH > 1.3) // maximum tie shoulder height shoulderH = 1.3; shoulderH *= _spatium; shoulderW = .6; if (!up()) shoulderH = -shoulderH; qreal c = p2.x(); qreal c1 = (c - c * shoulderW) * .5 + p6o.x(); qreal c2 = c1 + c * shoulderW + p6o.x(); QPointF p5 = QPointF(c * .5, 0.0); QPointF p3(c1, -shoulderH); QPointF p4(c2, -shoulderH); qreal w = (score()->styleS(ST_SlurMidWidth).val() - score()->styleS(ST_SlurEndWidth).val()) * _spatium; QPointF th(0.0, w); // thickness of slur QPointF p3o = p6o + t.map(ss->ups[GRIP_BEZIER1].off * _spatium); QPointF p4o = p6o + t.map(ss->ups[GRIP_BEZIER2].off * _spatium); // ss->ups[GRIP_BEZIER1].off = t.inverted().map(p3o) / _spatium; // ss->ups[GRIP_BEZIER2].off = t.inverted().map(p4o) / _spatium; //-----------------------------------calculate p6 QPointF pp3 = p3 + p3o; QPointF pp4 = p4 + p4o; QPointF ppp4 = pp4 - pp3; qreal r2 = atan(ppp4.y() / ppp4.x()); t.reset(); t.rotateRadians(-r2); QPointF p6 = QPointF(t.map(ppp4).x() * .5, 0.0); t.rotateRadians(2 * r2); p6 = t.map(p6) + pp3; // - p6o; //----------------------------------- ss->path = QPainterPath(); ss->path.moveTo(QPointF()); ss->path.cubicTo(p3 + p3o - th, p4 + p4o - th, p2); if (lineType() == 0) ss->path.cubicTo(p4 +p4o + th, p3 + p3o + th, QPointF()); th = QPointF(0.0, 3.0 * w); ss->shapePath = QPainterPath(); ss->shapePath.moveTo(QPointF()); ss->shapePath.cubicTo(p3 + p3o - th, p4 + p4o - th, p2); ss->shapePath.cubicTo(p4 +p4o + th, p3 + p3o + th, QPointF()); // translate back t.reset(); t.translate(pp1.x(), pp1.y()); t.rotateRadians(sinb); ss->path = t.map(ss->path); ss->shapePath = t.map(ss->shapePath); ss->ups[GRIP_BEZIER1].p = t.map(p3); ss->ups[GRIP_BEZIER2].p = t.map(p4); ss->ups[GRIP_END].p = t.map(p2) - ss->ups[GRIP_END].off * _spatium; ss->ups[GRIP_DRAG].p = t.map(p5); ss->ups[GRIP_SHOULDER].p = t.map(p6); }
void Slur::computeBezier(SlurSegment* ss, QPointF p6o) { qreal _spatium = spatium(); qreal shoulderW; // height as fraction of slur-length qreal shoulderH; // // p1 and p2 are the end points of the slur // QPointF pp1 = ss->ups[GRIP_START].p + ss->ups[GRIP_START].off * _spatium; QPointF pp2 = ss->ups[GRIP_END].p + ss->ups[GRIP_END].off * _spatium; QPointF p2 = pp2 - pp1; if (p2.x() == 0.0) { qDebug("zero slur"); Measure* m1 = startChord()->segment()->measure(); Measure* m2 = endChord()->segment()->measure(); Page* page = m1->system()->page(); qDebug(" at tick %d in measure %d-%d page %d", m1->tick(), m1->no(), m2->no(), page->no()); return; } qreal sinb = atan(p2.y() / p2.x()); QTransform t; t.rotateRadians(-sinb); p2 = t.map(p2); p6o = t.map(p6o); double smallH = 0.5; qreal d = p2.x() / _spatium; if (d <= 2.0) { shoulderH = d * 0.5 * smallH * _spatium; shoulderW = .6; } else { qreal dd = log10(1.0 + (d - 2.0) * .5) * 2.0; if (dd > 3.0) dd = 3.0; shoulderH = (dd + smallH) * _spatium; if (d > 18.0) shoulderW = 0.8; else if (d > 10) shoulderW = 0.7; else shoulderW = 0.6; } if (!up()) shoulderH = -shoulderH; // shoulderH -= p6o.y(); qreal c = p2.x(); qreal c1 = (c - c * shoulderW) * .5 + p6o.x(); qreal c2 = c1 + c * shoulderW + p6o.x(); QPointF p5 = QPointF(c * .5, 0.0); QPointF p3(c1, -shoulderH); QPointF p4(c2, -shoulderH); qreal w = (score()->styleS(ST_SlurMidWidth).val() - score()->styleS(ST_SlurEndWidth).val()) * _spatium; if (((c2 - c1) / _spatium) <= _spatium) w *= .5; QPointF th(0.0, w); // thickness of slur QPointF p3o = p6o + t.map(ss->ups[GRIP_BEZIER1].off * _spatium); QPointF p4o = p6o + t.map(ss->ups[GRIP_BEZIER2].off * _spatium); //?? ss->ups[GRIP_BEZIER1].off = t.inverted().map(p3o) / _spatium; //?? ss->ups[GRIP_BEZIER2].off = t.inverted().map(p4o) / _spatium; //-----------------------------------calculate p6 QPointF pp3 = p3 + p3o; QPointF pp4 = p4 + p4o; QPointF ppp4 = pp4 - pp3; qreal r2 = atan(ppp4.y() / ppp4.x()); t.reset(); t.rotateRadians(-r2); QPointF p6 = QPointF(t.map(ppp4).x() * .5, 0.0); t.rotateRadians(2 * r2); p6 = t.map(p6) + pp3; // - p6o; //----------------------------------- ss->path = QPainterPath(); ss->path.moveTo(QPointF()); ss->path.cubicTo(p3 + p3o - th, p4 + p4o - th, p2); if (lineType() == 0) ss->path.cubicTo(p4 +p4o + th, p3 + p3o + th, QPointF()); th = QPointF(0.0, 3.0 * w); ss->shapePath = QPainterPath(); ss->shapePath.moveTo(QPointF()); ss->shapePath.cubicTo(p3 + p3o - th, p4 + p4o - th, p2); ss->shapePath.cubicTo(p4 +p4o + th, p3 + p3o + th, QPointF()); // translate back t.reset(); t.translate(pp1.x(), pp1.y()); t.rotateRadians(sinb); ss->path = t.map(ss->path); ss->shapePath = t.map(ss->shapePath); ss->ups[GRIP_BEZIER1].p = t.map(p3); ss->ups[GRIP_BEZIER2].p = t.map(p4); ss->ups[GRIP_END].p = t.map(p2) - ss->ups[GRIP_END].off * _spatium; ss->ups[GRIP_DRAG].p = t.map(p5); ss->ups[GRIP_SHOULDER].p = t.map(p6); }
void Tie::computeBezier(SlurSegment* ss, QPointF p6o) { qreal _spatium = spatium(); qreal shoulderW; // height as fraction of slur-length qreal shoulderH; // // pp1 start of slur // pp2 end of slur // pp3 bezier 1 // pp4 bezier 2 // pp5 drag // pp6 shoulder // QPointF pp1 = ss->ups(Grip::START).p + ss->ups(Grip::START).off * _spatium; QPointF pp2 = ss->ups(Grip::END).p + ss->ups(Grip::END).off * _spatium; QPointF p2 = pp2 - pp1; // normalize to zero if (p2.x() == 0.0) { qDebug("zero tie"); return; } qreal sinb = atan(p2.y() / p2.x()); QTransform t; t.rotateRadians(-sinb); p2 = t.map(p2); p6o = t.map(p6o); double smallH = 0.38; qreal d = p2.x() / _spatium; shoulderH = d * 0.4 * smallH; shoulderH = qBound(0.4, shoulderH, 1.3); shoulderH *= _spatium; shoulderW = .6; shoulderH -= p6o.y(); if (!up()) shoulderH = -shoulderH; qreal c = p2.x(); qreal c1 = (c - c * shoulderW) * .5 + p6o.x(); qreal c2 = c1 + c * shoulderW + p6o.x(); QPointF p5 = QPointF(c * .5, 0.0); QPointF p3(c1, -shoulderH); QPointF p4(c2, -shoulderH); qreal w = (score()->styleS(StyleIdx::SlurMidWidth).val() - score()->styleS(StyleIdx::SlurEndWidth).val()) * _spatium; QPointF th(0.0, w); // thickness of slur QPointF p3o = p6o + t.map(ss->ups(Grip::BEZIER1).off * _spatium); QPointF p4o = p6o + t.map(ss->ups(Grip::BEZIER2).off * _spatium); if(!p6o.isNull()) { QPointF p6i = t.inverted().map(p6o) / _spatium; ss->ups(Grip::BEZIER1).off += p6i ; ss->ups(Grip::BEZIER2).off += p6i; } //-----------------------------------calculate p6 QPointF pp3 = p3 + p3o; QPointF pp4 = p4 + p4o; QPointF ppp4 = pp4 - pp3; qreal r2 = atan(ppp4.y() / ppp4.x()); t.reset(); t.rotateRadians(-r2); QPointF p6 = QPointF(t.map(ppp4).x() * .5, 0.0); t.rotateRadians(2 * r2); p6 = t.map(p6) + pp3 - p6o; //----------------------------------- ss->path = QPainterPath(); ss->path.moveTo(QPointF()); ss->path.cubicTo(p3 + p3o - th, p4 + p4o - th, p2); if (lineType() == 0) ss->path.cubicTo(p4 +p4o + th, p3 + p3o + th, QPointF()); th = QPointF(0.0, 3.0 * w); ss->shapePath = QPainterPath(); ss->shapePath.moveTo(QPointF()); ss->shapePath.cubicTo(p3 + p3o - th, p4 + p4o - th, p2); ss->shapePath.cubicTo(p4 +p4o + th, p3 + p3o + th, QPointF()); // translate back t.reset(); t.translate(pp1.x(), pp1.y()); t.rotateRadians(sinb); ss->path = t.map(ss->path); ss->shapePath = t.map(ss->shapePath); ss->ups(Grip::BEZIER1).p = t.map(p3); ss->ups(Grip::BEZIER2).p = t.map(p4); ss->ups(Grip::END).p = t.map(p2) - ss->ups(Grip::END).off * _spatium; ss->ups(Grip::DRAG).p = t.map(p5); ss->ups(Grip::SHOULDER).p = t.map(p6); QPointF staffOffset; if (ss->system() && ss->track() >= 0) staffOffset = QPointF(0.0, -ss->system()->staff(ss->staffIdx())->y()); ss->path.translate(staffOffset); ss->shapePath.translate(staffOffset); }