void countAA( struct alignDetail *detail, int cNum, void *closure) { int ii; FILE *f = (FILE *) closure; char firstChar; char *position; for(ii=0; ii < detail->numSpecies; ii++) { struct seqBuffer *sb = &detail->seqBuffers[ii]; if (ii == 0) { position = sb->position; firstChar = sb->buffer[cNum]; } else if ((firstChar != sb->buffer[cNum]) && (sb->buffer[cNum] != '-')) { char strand = position[strlen(position) - 1]; fprintf(f, "%s %s 1\n", getPosString(position, strand, cNum, detail->startFrame, detail->endFrame), sb->species); } } }
void KeyframeEdit::addParameter(const QDomElement &e, int activeKeyframe) { keyframe_list->blockSignals(true); m_params.append(e.cloneNode().toElement()); QDomElement na = e.firstChildElement(QStringLiteral("name")); QString paramName = i18n(na.text().toUtf8().data()); QDomElement commentElem = e.firstChildElement(QStringLiteral("comment")); QString comment; if (!commentElem.isNull()) comment = i18n(commentElem.text().toUtf8().data()); int columnId = keyframe_list->columnCount(); keyframe_list->insertColumn(columnId); keyframe_list->setHorizontalHeaderItem(columnId, new QTableWidgetItem(paramName)); DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, 0, m_params.at(columnId).attribute(QStringLiteral("min")).toDouble(), m_params.at(columnId).attribute(QStringLiteral("max")).toDouble(), m_params.at(columnId).attribute(QStringLiteral("default")).toDouble(), comment, columnId, m_params.at(columnId).attribute(QStringLiteral("suffix")), m_params.at(columnId).attribute(QStringLiteral("decimals")).toInt(), this); connect(doubleparam, SIGNAL(valueChanged(double)), this, SLOT(slotAdjustKeyframeValue(double))); connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool))); connect(doubleparam, SIGNAL(setInTimeline(int)), this, SLOT(slotUpdateVisibleParameter(int))); m_slidersLayout->addWidget(doubleparam, columnId, 0); if (e.attribute(QStringLiteral("intimeline")) == QLatin1String("1")) { doubleparam->setInTimelineProperty(true); } QStringList frames = e.attribute(QStringLiteral("keyframes")).split(';', QString::SkipEmptyParts); for (int i = 0; i < frames.count(); ++i) { int frame = frames.at(i).section('=', 0, 0).toInt(); bool found = false; int j; for (j = 0; j < keyframe_list->rowCount(); ++j) { int currentPos = getPos(j); if (frame == currentPos) { keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section('=', 1, 1))); found = true; break; } else if (currentPos > frame) { break; } } if (!found) { keyframe_list->insertRow(j); keyframe_list->setVerticalHeaderItem(j, new QTableWidgetItem(getPosString(frame))); keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section('=', 1, 1))); keyframe_list->resizeRowToContents(j); } if ((activeKeyframe > -1) && (activeKeyframe == frame)) { keyframe_list->setCurrentCell(i, columnId); keyframe_list->selectRow(i); } } keyframe_list->resizeColumnsToContents(); keyframe_list->blockSignals(false); keyframe_list->horizontalHeader()->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); keyframe_list->verticalHeader()->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); slotAdjustKeyframeInfo(false); button_delete->setEnabled(keyframe_list->rowCount() > 1); }
void KeyframeEdit::slotAdjustKeyframePos(int value) { QTableWidgetItem *item = keyframe_list->currentItem(); keyframe_list->verticalHeaderItem(item->row())->setText(getPosString(value)); slotGenerateParams(item->row(), -1); if (KdenliveSettings::keyframeseek()) emit seekToPos(value - m_min); }
void KeyframeEdit::slotAddKeyframe() { keyframe_list->blockSignals(true); QTableWidgetItem *item = keyframe_list->currentItem(); int row = keyframe_list->currentRow(); int col = keyframe_list->currentColumn(); int newrow = row; int pos1 = getPos(row); int result; if (row < (keyframe_list->rowCount() - 1)) { result = pos1 + (getPos(row + 1) - pos1) / 2; newrow++; } else if (row == 0) { if (pos1 == m_min) { result = m_max; newrow++; } else { result = m_min; } } else { if (pos1 < m_max) { // last keyframe selected and it is not at end of clip -> add keyframe at the end result = m_max; newrow++; } else { int pos2 = getPos(row - 1); result = pos2 + (pos1 - pos2) / 2; } } keyframe_list->insertRow(newrow); keyframe_list->setVerticalHeaderItem(newrow, new QTableWidgetItem(getPosString(result))); for (int i = 0; i < keyframe_list->columnCount(); ++i) keyframe_list->setItem(newrow, i, new QTableWidgetItem(keyframe_list->item(item->row(), i)->text())); keyframe_list->resizeRowsToContents(); slotAdjustKeyframeInfo(); keyframe_list->blockSignals(false); generateAllParams(); button_delete->setEnabled(keyframe_list->rowCount() > 1); keyframe_list->setCurrentCell(newrow, col); keyframe_list->selectRow(newrow); //slotGenerateParams(newrow, 0); }
void KeyframeEdit::slotGenerateParams(int row, int column) { if (column == -1) { // position of keyframe changed QTableWidgetItem *item = keyframe_list->item(row, 0); if (item == NULL) return; int pos = getPos(row); if (pos <= m_min) pos = m_min; if (m_max != -1 && pos > m_max) pos = m_max; QString val = getPosString(pos); if (val != keyframe_list->verticalHeaderItem(row)->text()) keyframe_list->verticalHeaderItem(row)->setText(val); for (int col = 0; col < keyframe_list->horizontalHeader()->count(); ++col) { item = keyframe_list->item(row, col); if (!item) continue; int v = item->text().toInt(); if (v >= m_params.at(col).attribute(QStringLiteral("max")).toInt()) item->setText(m_params.at(col).attribute(QStringLiteral("max"))); if (v <= m_params.at(col).attribute(QStringLiteral("min")).toInt()) item->setText(m_params.at(col).attribute(QStringLiteral("min"))); QString keyframes; for (int i = 0; i < keyframe_list->rowCount(); ++i) { if (keyframe_list->item(i, col)) keyframes.append(QString::number(getPos(i)) + '=' + keyframe_list->item(i, col)->text() + ';'); } m_params[col].setAttribute(getTag(), keyframes); } emit parameterChanged(); return; } QTableWidgetItem *item = keyframe_list->item(row, column); if (item == NULL) return; int pos = getPos(row); if (pos <= m_min) pos = m_min; if (m_max != -1 && pos > m_max) pos = m_max; /*QList<QTreeWidgetItem *> duplicates = keyframe_list->findItems(val, Qt::MatchExactly, 0); duplicates.removeAll(item); if (!duplicates.isEmpty()) { // Trying to insert a keyframe at existing value, revert it val = m_timecode.getTimecodeFromFrames(m_previousPos); }*/ QString val = getPosString(pos); if (val != keyframe_list->verticalHeaderItem(row)->text()) keyframe_list->verticalHeaderItem(row)->setText(val); int v = item->text().toInt(); if (v >= m_params.at(column).attribute(QStringLiteral("max")).toInt()) item->setText(m_params.at(column).attribute(QStringLiteral("max"))); if (v <= m_params.at(column).attribute(QStringLiteral("min")).toInt()) item->setText(m_params.at(column).attribute(QStringLiteral("min"))); slotAdjustKeyframeInfo(false); QString keyframes; for (int i = 0; i < keyframe_list->rowCount(); ++i) { if (keyframe_list->item(i, column)) keyframes.append(QString::number(getPos(i)) + '=' + keyframe_list->item(i, column)->text() + ';'); } m_params[column].setAttribute(getTag(), keyframes); emit parameterChanged(); }
void KeyframeEdit::slotAddKeyframe(int pos) { keyframe_list->blockSignals(true); int row = 0; int col = keyframe_list->currentColumn(); int newrow = row; int result = pos; if (result > 0) { // A position was provided for (; newrow < keyframe_list->rowCount(); newrow++) { int rowPos = getPos(newrow); if (rowPos > result) { break; } } } else { row = keyframe_list->currentRow(); newrow = row; int pos1 = getPos(row); if (row < (keyframe_list->rowCount() - 1)) { result = pos1 + (getPos(row + 1) - pos1) / 2; newrow++; } else if (row == 0) { if (pos1 == m_min) { result = m_max; newrow++; } else { result = m_min; } } else { if (pos1 < m_max) { // last keyframe selected and it is not at end of clip -> add keyframe at the end result = m_max; newrow++; } else { int pos2 = getPos(row - 1); result = pos2 + (pos1 - pos2) / 2; } } } // Calculate new values QList <double> previousValues; QList <double> nextValues; int rowCount = keyframe_list->rowCount(); // Insert new row keyframe_list->insertRow(newrow); keyframe_list->setVerticalHeaderItem(newrow, new QTableWidgetItem(getPosString(result))); // If keyframe is inserted at start if (newrow == 0) { for (int i = 0; i < keyframe_list->columnCount(); ++i) { int newValue = keyframe_list->item(1, i)->text().toDouble(); keyframe_list->setItem(newrow, i, new QTableWidgetItem(QString::number(newValue))); } } else if (newrow == rowCount){ // Keyframe inserted at end for (int i = 0; i < keyframe_list->columnCount(); ++i) { int newValue = keyframe_list->item(rowCount - 1, i)->text().toDouble(); keyframe_list->setItem(newrow, i, new QTableWidgetItem(QString::number(newValue))); } } else { // Interpolate int previousPos = getPos(newrow - 1); int nextPos = getPos(newrow + 1); if (nextPos > previousPos) { double factor = ((double) result - previousPos) / (nextPos - previousPos); for (int i = 0; i < keyframe_list->columnCount(); ++i) { double previousValues = keyframe_list->item(newrow - 1, i)->text().toDouble(); double nextValues = keyframe_list->item(newrow + 1, i)->text().toDouble(); int newValue = (int) (previousValues + (nextValues- previousValues) * factor); keyframe_list->setItem(newrow, i, new QTableWidgetItem(QString::number(newValue))); } } } keyframe_list->resizeRowsToContents(); keyframe_list->setCurrentCell(newrow, col); slotAdjustKeyframeInfo(); keyframe_list->blockSignals(false); generateAllParams(); if (rowCount == 1) { // there was only one keyframe before, so now enable keyframe mode slotKeyframeMode(); } button_delete->setEnabled(keyframe_list->rowCount() > 1); }
static unsigned int readEscape(FILE *out, uint8_t *text, uint8_t type, uint8_t size, size_t count) { uint32_t larg; uint16_t sarg; uint8_t carg; uint8_t subcode; uint8_t buffer[ 256 ]; switch( type ) { case 0x02: carg = text[ ++count ]; fprintf( out, "02: set left margin of current line to %2.2x (%u)>]", carg, carg ); break; case 0x03: carg = text[ ++count ]; fprintf( out, "03: set right margin to %2.2x (%u)>]", carg, carg ); break; case 0x04: carg = text[ ++count ]; fprintf( out, "04: set style to %2.2x ", carg ); if( carg == 0) fputs( "(plain text)>]", out ); else if( carg == 1 ) fputs( "(italic)>]", out ); else if( carg == 2 ) fputs( "(bold)>]", out ); else if( carg == 3 ) fputs( "(bold italic)>]", out ); else if( carg == 4 ) fputs( "(underscored)>]", out ); else if( carg == 5 ) fputs( "(italic underscored)>]", out ); else if( carg == 6 ) fputs( "(bold underscored)>]", out ); else if( carg == 7 ) fputs( "(bold italic underscored)>]", out ); break; case 0x05: sarg = (uint16_t)text[ ++count ]; sarg |= ( (uint16_t)text[ ++count ] ) << 8; fprintf( out, "05: begin cross-reference to TOC index %4.4x (%hu)", sarg, sarg ); if( size > 4 ) { uint8_t carg2 = 0; carg = text[ ++count ]; fprintf( out, ", flag byte1 %2.2x", carg ); if( size > 5 ) { carg2 = text[ ++count ]; fprintf( out, ", flag byte2 %2.2x", carg ); } if( carg & 0x01 ) { PanelOrigin p; memcpy( &p, &text[ count + 1 ], sizeof( PanelOrigin ) ); count += sizeof( PanelOrigin ); fprintf( out, ", target position supplied (" ); if( p.xPosType == DYNAMIC) fprintf( out, "%s %s, ", getDPosString( p.xpos ), getPosString( p.xPosType ) ); else fprintf( out, "%hu %s,", p.xpos, getPosString(p.xPosType)); if( p.yPosType == DYNAMIC) fprintf( out, "%s %s)", getDPosString( p.ypos ), getPosString( p.yPosType ) ); else fprintf( out, "%hu %s)", p.ypos, getPosString( p.yPosType ) ); } if( carg & 0x02 ) { PanelSize p; memcpy(&p, &text[ count + 1 ], sizeof( PanelSize ) ); count += sizeof( PanelSize ); fprintf( out, ", target size supplied (" ); if( p.widthType == DYNAMIC ) fprintf( out, "%s %s, ", getDPosString( p.width ), getPosString( p.widthType ) ); else fprintf( out, "%hu %s,", p.width, getPosString( p.widthType ) ); if( p.heightType == DYNAMIC ) fprintf( out, "%s %s)", getDPosString( p.height ), getPosString( p.heightType ) ); else fprintf( out, "%hu %s)", p.height, getPosString( p.heightType ) ); } if( carg & 0x04 ) fprintf( out, ", viewport" ); if( carg & 0x08 ) { PanelStyle style; memcpy( &style.word, &text[ count + 1 ], sizeof( PanelStyle ) ); count += sizeof( PanelStyle ); fprintf( out, ", window style specified (%4.4x)", style.word ); } if( carg & 0x40) fprintf( out, ", autolink" ); if( carg & 0x80) fprintf( out, ", split window" ); if( carg2 & 0x02) fprintf( out, ", dependent" ); if( carg2 & 0x04) { Group grp; memcpy( &grp, &text[ count + 1 ], sizeof( Group ) ); count += sizeof( Group ); fprintf( out, ", group supplied (%4.4x)", grp ); } } fprintf( out, ">]" ); break; case 0x07: sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, "07: begin link to footnote, TOC index %4.4x (%hu)>]", sarg, sarg ); break; case 0x08: fprintf( out, "08: end of link>]" ); break; case 0x0B: fprintf( out, "0B: begin monospaced>]" ); break; case 0x0C: fprintf( out, "0C: end monospaced>]" ); break; case 0x0D: carg = text[ ++count ]; fprintf( out, "0D: set special color %2.2x (%u)>]", carg, carg ); break; case 0x0E: carg = text[ ++count ]; larg = ( uint32_t )text[ ++count ]; larg |= ( ( uint32_t )text[ ++count ] ) << 8; larg |= ( ( uint32_t )text[ ++count ] ) << 16; larg |= ( ( uint32_t )text[ ++count ] ) << 24; fprintf( out, "0E: bitmap image" ); parseAlign( out, carg ); fprintf( out, ", from offset %8.8x (%lu)>]", larg, larg ); break; case 0x0F: carg = text[ ++count ]; fprintf( out, "0F: image map"); subcode = text[ ++count ]; fprintf( out, " subcode %2.2x (%u):", subcode, subcode); switch (subcode) { case 0: carg = text[ ++count ]; larg = ( uint32_t )text[ ++count ]; larg |= ( ( uint32_t )text[ ++count ] ) << 8; larg |= ( ( uint32_t )text[ ++count ] ) << 16; larg |= ( ( uint32_t )text[ ++count ] ) << 24; fprintf( out, " define" ); parseAlign( out, carg ); fprintf( out, ", from offset %8.8x (%lu)>]", larg, larg ); break; case 1: case 2: case 3: fprintf( out, " define partial bitmap to %s", subcode == 3 ? "?" : ( subcode == 1 ? "panel" : "footnote" ) ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " id %4.4x (%hu)", sarg, sarg); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " (xorg = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " yorg = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " width = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " height = %4.4x (%hu))>]", sarg, sarg ); break; case 4: case 5: case 6: fprintf( out, " define full bitmap to %s", subcode == 6 ? "?" : ( subcode == 4 ? "panel" : "footnote" ) ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " id %4.4x (%hu)", sarg, sarg ); break; case 7: carg = text[ ++count ]; memset( buffer, 0, 256) ; ++count; memcpy( buffer, &text[ count ], size - 5 ); count += size - 4; fprintf( out, " define full bitmap to application %s>]", buffer ); break; case 8: carg = text[ ++count ]; fprintf( out, " define full bitmap to application" ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " (xorg = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " yorg = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " width = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " height = %4.4x (%hu))", sarg, sarg ); memset( buffer, 0, 256 ); ++count; memcpy( buffer, &text[ count ], size - 12 ); count += size - 11; fprintf( out, " %s>]", buffer ); break; case 9: sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " define full bitmap, send message to application id %4.4x (%hu)>]", sarg, sarg ); break; case 10: sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " define partial bitmap, send message to application id %4.4x (%hu)", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " (xorg = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " yorg = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " width = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " height = %4.4x (%hu))>]", sarg, sarg ); break; case 12: case 13: sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " define partial bitmap to external id %4.4x (%hu)", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " (xorg = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " yorg = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " width = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " height = %4.4x (%hu))>]", sarg, sarg ); break; case 14: case 15: sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " define full bitmap to id %4.4x (%hu)>]", sarg, sarg ); break; case 16: carg = text[ ++count ]; fprintf( out, " define full bitmap to id %2.2x (%u)", carg, carg ); carg = text[ ++count ]; ++count; memset( buffer, 0, 256 ); ++count; memcpy( buffer, &text[ count ], carg ); count += carg - 1; fprintf( out, " in external file %s>]", buffer ); break; case 17: carg = text[ ++count ]; fprintf( out, " define partial bitmap to external file %2.2x (%u)", carg, carg ); carg = text[ ++count ]; sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " (xorg = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " yorg = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " width = %4.4x (%hu);", sarg, sarg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, " height = %4.4x (%hu))", sarg, sarg ); memset( buffer, 0, 256 ); ++count; memcpy( buffer, &text[ count ], carg ); count += carg - 1; fprintf( out, " id %s>]", buffer ); break; default: fprintf( out, " unknown subcode>]" ); break; } break; case 0x10: carg = text[ ++count ]; memset( buffer, 0, 256 ); ++count; memcpy( buffer, &text[ count ], size - 3 ); count += size - 2; fprintf( out, "10: begin link (launch application %s)>]", buffer ); break; case 0x11: carg = text[ ++count ]; fprintf( out, "11: set left margin to %2.2x (%u), start new line>]", carg, carg ); break; case 0x12: carg = text[ ++count ]; fprintf( out, "12: set left margin (fit) to %2.2x (%u), start new line>]", carg, carg ); break; case 0x13: carg = text[ ++count ]; fprintf( out, "13: set foreground color to %2.2x (%s)>]", carg, parseColor( carg ) ); break; case 0x14: carg = text[ ++count ]; fprintf( out, "14: set background color to %2.2x (%s)>]", carg, parseColor( carg ) ); break; case 0x15: memset( buffer, 0, 256 ); ++count; memcpy( buffer, &text[ count ], size - 2 ); count += size - 3; fprintf( out, "15: tutorial %s>]", buffer ); break; case 0x16: sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, "16: send message to id %4.4x (%hu)>]", sarg, sarg ); break; case 0x17: memset( buffer, 0, 256 ); ++count; memcpy( buffer, &text[ count ], size - 2 ); count += size - 3; fprintf( out, "17: hide text, key: %s>]", buffer ); break; case 0x18: fprintf( out, "18: end hide text>]" ); break; case 0x19: carg = text[ ++count ]; fprintf( out, "19: change font to %2.2x (%u)>]", carg, carg ); break; case 0x1A: carg = text[ ++count ]; fprintf( out, "1A: begin \"lines\" sequence, flags %2.2x, align ", carg ); if( carg & 0x01 ) fprintf( out, "left>]" ); if( carg & 0x02 ) fprintf( out, "right>]" ); if( carg & 0x04 ) fprintf( out, "center>]" ); break; case 0x1B: fprintf( out, "1B: end \"lines\" sequence>]" ); break; case 0x1C: fprintf( out, "1C: set left margin to current position>]" ); break; case 0x1D: sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, "1D: start link to external document id %4.4x (%hu)>]", sarg, sarg ); break; case 0x1F: carg = text[ ++count ]; fprintf( out, "1F: start link to external file id %2.2x (%u)", carg, carg ); memset( buffer, 0, 256 ); carg = text[ ++count ]; memcpy( buffer, &text[ ++count ], carg ); count += carg - 1; fprintf( out, " id %s>]", buffer ); break; case 0x20: sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, "20: begin ddf, resource id %4.4x (%hu)>]", sarg, sarg ); break; case 0x21: carg = text[ ++count ]; fprintf( out, "21: acviewport, reserved %2.2x (%hu)", carg, carg ); carg = text[ ++count ]; if( carg ) { size_t dataBytes = carg; fprintf( out, ", data length %2.2x (%hu)", carg, carg ); sarg = ( uint16_t )text[ ++count ]; sarg |= ( ( uint16_t )text[ ++count ] ) << 8; fprintf( out, ", objectid %4.4x (%hu)", sarg, sarg ); carg = text[ ++count ]; memset( buffer, 0, 256 ); memcpy( buffer, &text[ ++count ], carg - 1 ); count += carg - 2; fprintf( out, ", objectname \"%s\"", buffer ); carg = text[ ++count ]; if( carg > 1 ) { memset( buffer, 0, 256 ); memcpy( buffer, &text[ ++count ], carg - 1 ); count += carg - 2; fprintf( out, ", dll \"%s\"", buffer ); } carg = text[ ++count ]; if( carg > 1 ) { memset( buffer, 0, 256 ); memcpy( buffer, &text[ ++count ], carg - 1 ); count += carg - 2; fprintf( out, ", objectinfo \"%s\"", buffer ); } if( size - 6 - dataBytes ) { uint8_t carg2; carg = text[ ++count ]; carg2 = text[ ++count ]; fprintf( out, ", flag bytes %2.2x %2.2x", carg, carg2 ); if( carg & 0x01 ) { PanelOrigin p; memcpy( &p, &text[ count + 1 ], sizeof( PanelOrigin ) ); count += sizeof( PanelOrigin ); fprintf( out, ", position (" ); if( p.xPosType == DYNAMIC) fprintf( out, "%s %s, ", getDPosString( p.xpos ), getPosString( p.xPosType ) ); else fprintf( out, "%hu %s,", p.xpos, getPosString(p.xPosType)); if( p.yPosType == DYNAMIC) fprintf( out, "%s %s)", getDPosString( p.ypos ), getPosString( p.yPosType ) ); else fprintf( out, "%hu %s)", p.ypos, getPosString( p.yPosType ) ); } if( carg & 0x02 ) { PanelSize p; memcpy(&p, &text[ count + 1 ], sizeof( PanelSize ) ); count += sizeof( PanelSize ); fprintf( out, ", size (" ); if( p.widthType == DYNAMIC ) fprintf( out, "%s %s, ", getDPosString( p.width ), getPosString( p.widthType ) ); else fprintf( out, "%hu %s,", p.width, getPosString( p.widthType ) ); if( p.heightType == DYNAMIC ) fprintf( out, "%s %s)", getDPosString( p.height ), getPosString( p.heightType ) ); else fprintf( out, "%hu %s)", p.height, getPosString( p.heightType ) ); } } } fprintf( out, ">]" ); break; default: fprintf( out, "%2.2x: unknown type of size %2.2x (%u) bytes:", type, size, size ); while( --size > 1 ) fprintf( out, " %2.2x", text[ ++count ] ); fprintf( out, ">]" ); break; } return count; }