コード例 #1
0
void QgsLayoutItemPolyline::drawEndMarker( QPainter *painter )
{
  if ( mPolygon.size() < 2 )
    return;

  switch ( mEndMarker )
  {
    case MarkerMode::NoMarker:
      break;

    case MarkerMode::ArrowHead:
    {
      // calculate angle at end of line
      QLineF endLine( mPolygon.at( mPolygon.count() - 2 ), mPolygon.at( mPolygon.count() - 1 ) );
      double angle = endLine.angle();

      //move end point depending on arrow width
      QVector2D dir = QVector2D( endLine.dx(), endLine.dy() ).normalized();
      QPointF endPoint = endLine.p2();
      endPoint += ( dir * 0.5 * mArrowHeadWidth ).toPointF();

      drawArrow( painter, endPoint, angle );
      break;
    }
    case MarkerMode::SvgMarker:
    {
      // calculate angle at end of line
      QLineF endLine( mPolygon.at( mPolygon.count() - 2 ), mPolygon.at( mPolygon.count() - 1 ) );
      double angle = endLine.angle();
      drawSvgMarker( painter, endLine.p2(), angle, mEndMarkerFile, mEndArrowHeadHeight );
      break;
    }
  }
}
コード例 #2
0
ファイル: ktb_list.c プロジェクト: Feechka/UOBP
static int
doListKeyTable (ListGenerationData *lgd) {
  if (!putUtf8String(lgd, gettext("Key Table"))) return 0;
  if (lgd->keyTable->title) {
    if (!putCharacterString(lgd, WS_C(": "))) return 0;
    if (!putCharacterString(lgd, lgd->keyTable->title)) return 0;
    if (!endLine(lgd)) return 0;
  }

  if (lgd->keyTable->noteCount) {
    unsigned int noteIndex;

    if (!endLine(lgd)) return 0;

    for (noteIndex=0; noteIndex<lgd->keyTable->noteCount; noteIndex+=1) {
      if (!putCharacterString(lgd, lgd->keyTable->noteTable[noteIndex])) return 0;
      if (!endLine(lgd)) return 0;
    }
  }

  {
    static const unsigned char contexts[] = {
      KTB_CTX_DEFAULT,
      KTB_CTX_MENU
    };

    const unsigned char *context = contexts;
    unsigned int count = ARRAY_COUNT(contexts);

    while (count) {
      const KeyContext *ctx = getKeyContext(lgd->keyTable, *context);

      if (ctx) {
        lgd->sectionTitle = ctx->title;
        if (!listKeyContext(lgd, ctx, NULL)) return 0;
      }

      context += 1, count -= 1;
    }
  }

  {
    unsigned int context;

    for (context=KTB_CTX_DEFAULT+1; context<lgd->keyTable->keyContextCount; context+=1) {
      const KeyContext *ctx = getKeyContext(lgd->keyTable, context);

      if (ctx && !isTemporaryKeyContext(lgd->keyTable, ctx)) {
        lgd->sectionTitle = ctx->title;
        if (!listKeyContext(lgd, ctx, NULL)) return 0;
      }
    }
  }

  return 1;
}
コード例 #3
0
static int
listKeyBinding (ListGenerationData *lgd, const KeyBinding *binding, int longPress, const wchar_t *keysPrefix) {
  const BoundCommand *cmd = longPress? &binding->secondaryCommand: &binding->primaryCommand;
  size_t keysOffset;

  if (cmd->value == BRL_CMD_NOOP) return 1;

  if (!putCommandDescription(lgd, cmd, !binding->keyCombination.anyKeyCount)) return 0;
  if (!putCharacterString(lgd, WS_C(": "))) return 0;
  keysOffset = lgd->line.length;

  if (keysPrefix) {
    if (!putCharacterString(lgd, keysPrefix)) return 0;
    if (!putCharacterString(lgd, WS_C(", "))) return 0;
  }

  if (longPress) {
    if (!putCharacterString(lgd, WS_C("long "))) return 0;
  }

  if (!putKeyCombination(lgd, &binding->keyCombination)) return 0;

  if ((cmd->value & BRL_MSK_BLK) == BRL_BLK_CONTEXT) {
    const KeyContext *c = getKeyContext(lgd->keyTable, (KTB_CTX_DEFAULT + (cmd->value & BRL_MSK_ARG)));
    if (!c) return 0;

    {
      size_t length = lgd->line.length - keysOffset;
      wchar_t keys[length + 1];

      wmemcpy(keys, &lgd->line.characters[keysOffset], length);
      keys[length] = 0;
      lgd->line.length = 0;

      if (isTemporaryKeyContext(lgd->keyTable, c)) {
        if (!listKeyContext(lgd, c, keys)) return 0;
      } else {
        if (!putCharacterString(lgd, WS_C("switch to "))) return 0;
        if (!putCharacterString(lgd, c->title)) return 0;
        if (!putCharacterString(lgd, WS_C(": "))) return 0;
        if (!putCharacterString(lgd, keys)) return 0;
        if (!endLine(lgd)) return 0;
      }
    }
  } else {
    if (!endLine(lgd)) return 0;
  }

  return 1;
}
コード例 #4
0
ファイル: PrintHandler.cpp プロジェクト: 1514louluo/poco
void PrintHandler::startArray()
{
	_out << '[' << endLine();
	_tab.append(indent(), ' ');
	_array = true;
	_value = false;
}
コード例 #5
0
ファイル: PrintHandler.cpp プロジェクト: 1514louluo/poco
void PrintHandler::endObject()
{
	if( _tab.length() >= indent())
		_tab.erase(_tab.length() - indent());

	_out << endLine() << _tab << '}';
}
コード例 #6
0
ファイル: PrintHandler.cpp プロジェクト: 1514louluo/poco
void PrintHandler::endArray()
{
	_tab.erase(_tab.length() - indent());
	_out << endLine() << _tab << ']';
	_array = false;
	_value = false;
}
コード例 #7
0
void PrintHandler::startObject()
{
	arrayValue();
	_out << '{';
	_out << endLine();
	_tab.append(indent(), ' ');
	_objStart = true;
}
コード例 #8
0
void PrintHandler::startArray()
{
	arrayValue();
	_out << '[' << endLine();
	_tab.append(indent(), ' ');
	++_array;
	_objStart = true;
}
コード例 #9
0
ファイル: pasm.c プロジェクト: neutered/propgcc
static void
PrintGasConstantDecl(FILE *f, AST *ast, int inlineAsm)
{
    startLine(f, inlineAsm);
    fprintf(f, "\t\t.equ\t%s, ", ast->d.string);
    PrintInteger(f, EvalConstExpr(ast));
    endLine(f, inlineAsm);
}
コード例 #10
0
void PrintHandler::endArray()
{
	_tab.erase(_tab.length() - indent());
	_out << endLine() << _tab << ']';
	--_array;
	poco_assert (_array >= 0);
	_objStart = false;
}
コード例 #11
0
/* public */
Geometry*
LinearGeometryBuilder::getGeometry()
{
	// end last line in case it was not done by user
	endLine();

	// NOTE: lines elements are cloned
	return geomFact->buildGeometry(lines);
}
コード例 #12
0
ファイル: csvsplitter.cpp プロジェクト: aa0/HPCC-Platform
void CSVOutputStream::writeHeaderLn(size32_t len, const char * data)
{
    append(len,data);
    if (!oldOutputFormat&&len) {
        size32_t tl = terminator.length();
        if ((tl>len)||(memcmp(data+len-tl,terminator.get(),tl)!=0))
            endLine();
    }
}   
コード例 #13
0
ファイル: Port.cpp プロジェクト: crenshaw/sensor_hive
/**
void Port::sendAll (void)
  Sends sensor data from each active port.
@param void
@return void
**/
void Port::sendAll (void){
    for (uint8_t portAddress = 1; portAddress <= PORT_MAX; portAddress++){
        if((*ports[portAddress-1]).isActive()){
            sendPortData (portAddress);
            if (portAddress != lastPort){
                endLine();
            }
        }
    }
}
コード例 #14
0
ファイル: ktb_list.c プロジェクト: Feechka/UOBP
static int
listKeyboardFunctions (ListGenerationData *lgd, const KeyContext *ctx) {
  const char *prefix = "braille keyboard ";

  {
    unsigned int index;

    for (index=0; index<ctx->mappedKeyCount; index+=1) {
      const MappedKeyEntry *map = &ctx->mappedKeyTable[index];
      const KeyboardFunction *kbf = map->keyboardFunction;

      if (!putUtf8String(lgd, prefix)) return 0;
      if (!putUtf8String(lgd, kbf->name)) return 0;
      if (!putCharacterString(lgd, WS_C(": "))) return 0;
      if (!putKeyName(lgd, &map->keyValue)) return 0;
      if (!endLine(lgd)) return 0;
    }
  }

  {
    const KeyboardFunction *kbf = keyboardFunctionTable;
    const KeyboardFunction *end = kbf + keyboardFunctionCount;

    while (kbf < end) {
      if (ctx->superimposedBits & kbf->bit) {
        if (!putUtf8String(lgd, prefix)) return 0;
        if (!putUtf8String(lgd, kbf->name)) return 0;
        if (!putCharacterString(lgd, WS_C(": superimposed"))) return 0;
        if (!endLine(lgd)) return 0;
      }

      kbf += 1;
    }
  }

  return 1;
}
コード例 #15
0
Graphics::Surface *TinyGLRenderer::getScreenshot() {
	Graphics::Surface *s = new Graphics::Surface();
	s->create(kOriginalWidth, kOriginalHeight, Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));
	Graphics::PixelBuffer buf(s->format, (byte *)s->getPixels());
	_fb->copyToBuffer(buf);
	//Vertical flip in place:
	Graphics::PixelBuffer startLine(s->format, kOriginalWidth, DisposeAfterUse::YES);
	Graphics::PixelBuffer endLine(s->format, kOriginalWidth, DisposeAfterUse::YES);
	for(int y = 0; y < kOriginalHeight / 2; y++)
	{
		startLine.copyBuffer(0, y * kOriginalWidth, kOriginalWidth, buf);
		endLine.copyBuffer(0, (kOriginalHeight - y - 1) * kOriginalWidth, kOriginalWidth, buf);
		buf.copyBuffer(y * kOriginalWidth, 0, kOriginalWidth, endLine);
		buf.copyBuffer((kOriginalHeight - y - 1) * kOriginalWidth, 0, kOriginalWidth, startLine);
	}
	return s;
}
コード例 #16
0
int main()
{
  Widget w;
  {
    std::cout << "Create auto from Widget:\n";
    std::cout << "  Direct init w/parens: ";   auto wcopy1(w);   endLine();       // now using auto
    std::cout << "  Copy init           : ";   auto wcopy2 = w;  endLine();
    std::cout << "  Direct init w/braces: ";   auto wcopy3 {w};  endLine();
    endLine();
  }
 
  const Widget cw;
  {
    std::cout << "Create auto from const Widget:\n";
    std::cout << "  Direct init w/parens: ";   auto wcopy1(cw);   endLine();
    std::cout << "  Copy init           : ";   auto wcopy2 = cw;  endLine();
    std::cout << "  Direct init w/braces: ";   auto wcopy3 {cw};  endLine();
    endLine();
  }
}
コード例 #17
0
ファイル: ktb_list.c プロジェクト: Feechka/UOBP
static int
listHotkeyEvent (ListGenerationData *lgd, const KeyValue *keyValue, const char *event, int command) {
  if (command != BRL_CMD_NOOP) {
    if ((command & BRL_MSK_BLK) == BRL_BLK_CONTEXT) {
      const KeyContext *c = getKeyContext(lgd->keyTable, (KTB_CTX_DEFAULT + (command & BRL_MSK_ARG)));
      if (!c) return 0;
      if (!putUtf8String(lgd, "switch to ")) return 0;
      if (!putCharacterString(lgd, c->title)) return 0;
    } else {
      if (!putCommandDescription(lgd, command, (keyValue->key != KTB_KEY_ANY))) return 0;
    }

    if (!putCharacterString(lgd, WS_C(": "))) return 0;
    if (!putUtf8String(lgd, event)) return 0;
    if (!putCharacter(lgd, WC_C(' '))) return 0;
    if (!putKeyName(lgd, keyValue)) return 0;
    if (!endLine(lgd)) return 0;
  }

  return 1;
}
コード例 #18
0
ファイル: Port.cpp プロジェクト: crenshaw/sensor_hive
/**
void Port::sendSavedData (uint16_t amount)
  Reads sensor data from EEPROM and sends to SCIO app
@param uint8_t amount
  The number of previous measurments to be sent to the scio application. If there are no 
  measurments stored on the EEPROM and ABORT response is sent. If the requested amount is greater
  than the number of measurments stored on the EEPROM all data is sent.
@return void
**/
void Port::sendSavedData (uint16_t amount){
    //create information block to store data once it is read from memory
    ExperimentBlock experiment;
    DataBlock dataBlock;
    //load experiement parameters from memory.
    (*memory).loadExperimentBlock(&experiment);
    //get memory pointers
    uint16_t ptr = (*memory).getPtr(amount*activePorts);
    uint16_t tail = (*memory).tail();
    //check if there is no sensor information
    if (ptr == (*memory).tail()){
        respond(SDI_ABORT);
    }
    //itterate through in time forwards order
    for (ptr ;  ptr != tail; (*memory).updatePtr(&ptr)){
        //load current data block
        (*memory).loadDataBlock(ptr, &dataBlock);
        //recover time measurment was taken.
        uint32_t Time = experiment.startTime + dataBlock.periodNumber* experiment.periodLgth;
        //recover port address
        uint8_t port = dataBlock.port;
        //recovering stored data type
        if ((*ports[port-1]).getType() == SENSOR_TYPE_A){
            SENSOR_RETURN_TYPE_A data = *(reinterpret_cast <SENSOR_RETURN_TYPE_A*> (&dataBlock.data));
            //send data report with correclty formateed sensor data
            dataReport(port, Time, data);
        }
        else if ((*ports[port-1]).getType() == SENSOR_TYPE_B){
            SENSOR_RETURN_TYPE_B data = *(reinterpret_cast <SENSOR_RETURN_TYPE_B*> (&dataBlock.data));
            //semd data report with correctly formated sensor data
            dataReport(port, Time, data);
        }
        //send terminator
        if (ptr == tail-1){
            terminate();
        }
        //send endline
        endLine();
    }
}
コード例 #19
0
ファイル: reader_ppm.c プロジェクト: bubuker/keggle_santa
/** appends extension to line and prints it to the give file stream if the line exceeded
    PPM_PRINTLEN */
static
void appendLine(
   SCIP*                 scip,               /**< SCIP data structure */
   FILE*                 file,               /**< output file (or NULL for standard output) */
   SCIP_READERDATA*      readerdata,         /**< information for reader */
   char*                 linebuffer,         /**< line */
   int*                  linecnt,            /**< number of characters in line */
   const char*           extension           /**< string to extent the line */
   )
{
   assert( scip != NULL );
   assert( linebuffer != NULL );
   assert( linecnt != NULL );
   assert( extension != NULL );

   if( *linecnt + strlen(extension) > PPM_MAX_LINELEN - 1 )
      endLine(scip, file, readerdata, linebuffer, linecnt);

   /* append extension to linebuffer */
   strncat(linebuffer, extension, PPM_MAX_LINELEN - (unsigned int)(*linecnt) - 1);
   (*linecnt) += (int) strlen(extension);
}
コード例 #20
0
bool disassembleExport(DisassembleState &state, latte::cf::inst id, latte::cf::Instruction &cf)
{
   auto eid = static_cast<latte::exp::inst>(cf.expWord1.inst);
   auto name = latte::exp::name[id];
   auto type = static_cast<latte::exp::Type::Type>(cf.expWord0.type);

   state.out
      << name
      << ": ";

   switch (type) {
   case latte::exp::Type::Pixel:
      state.out << "PIX";
      break;
   case latte::exp::Type::Position:
      state.out << "POS";
      break;
   case latte::exp::Type::Parameter:
      state.out << "PARAM";
      break;
   }

   state.out
      << cf.expWord0.dstReg;

   state.out
      << ", R"
      << cf.expWord0.srcReg
      << ".";

   writeSelectName(state, cf.expWord1.srcSelX);
   writeSelectName(state, cf.expWord1.srcSelY);
   writeSelectName(state, cf.expWord1.srcSelZ);
   writeSelectName(state, cf.expWord1.srcSelW);

   endLine(state);
   return true;
}
コード例 #21
0
QString toListViewFormatterHTML::getFormattedString(toExportSettings &settings,
                                       //const toResultModel *model);
                                       const QAbstractItemModel * model)
{
    int     columns   = model->columnCount();
    int     rows      = model->rowCount();

    QString output;
    QString indent;

    QVector<int> rlist = selectedRows(settings.selected);
    QVector<int> clist = selectedColumns(settings.selected);

    output = QString("<HTML><HEAD><TITLE>Export</TITLE></HEAD><BODY><TABLE>");
    endLine(output);

    QString bgcolor;
    if (settings.columnsHeader)
    {
        output += QString("<TR>");
        endLine(output);

        for (int j = 0; j < columns; j++)
        {
            if (settings.columnsExport == toExportSettings::ColumnsSelected && !clist.contains(j))
                continue;
            output += QString("\t<TH>");
            endLine(output);

            QString text(Qt::escape(model->headerData(j,
                                             Qt::Horizontal,
                                             Qt::DisplayRole).toString()));

            output += "\t\t" + text;

            endLine(output);
            output += QString("\t</TH>");
            endLine(output);
        }

        output += "</TR>";
        endLine(output);
    }

    QModelIndex mi;
    for (int row = 0; row < rows; row++)
    {
        if (settings.rowsExport == toExportSettings::RowsSelected && !rlist.contains(row))
            continue;

        output += "<TR>";
        endLine(output);

        for (int i = 0; i < columns; i++)
        {
            if (settings.columnsExport == toExportSettings::ColumnsSelected && !clist.contains(i))
                continue;
            if (!settings.rowsHeader && i == 0)
                continue;
            output += QString("\t<TD>");
            endLine(output);

            mi = model->index(row, i);
            QString text(Qt::escape(model->data(mi, Qt::EditRole).toString()));

            output += "\t\t" + text;
            endLine(output);

            output += QString("\t</TD>");
            endLine(output);
        }

        output += "</TR>";
        endLine(output);
    }

    output += "</TABLE></BODY></HTML>";
    return output;
}
コード例 #22
0
ファイル: ktb_list.c プロジェクト: Feechka/UOBP
static int
listKeyContext (ListGenerationData *lgd, const KeyContext *ctx, const wchar_t *keysPrefix) {
  {
    const HotkeyEntry *hotkey = ctx->hotkeyTable;
    unsigned int count = ctx->hotkeyCount;

    while (count) {
      if (!(hotkey->flags & HKF_HIDDEN)) {
        if (!listHotkeyEvent(lgd, &hotkey->keyValue, "press", hotkey->pressCommand)) return 0;
        if (!listHotkeyEvent(lgd, &hotkey->keyValue, "release", hotkey->releaseCommand)) return 0;
      }

      hotkey += 1, count -= 1;
    }
  }

  {
    const KeyBinding *binding = ctx->keyBindingTable;
    unsigned int count = ctx->keyBindingCount;

    while (count) {
      if (!(binding->flags & KBF_HIDDEN)) {
        size_t keysOffset;

        if (!putCommandDescription(lgd, binding->command, !binding->combination.anyKeyCount)) return 0;
        if (!putCharacterString(lgd, WS_C(": "))) return 0;
        keysOffset = lgd->lineLength;

        if (keysPrefix) {
          if (!putCharacterString(lgd, keysPrefix)) return 0;
          if (!putCharacterString(lgd, WS_C(", "))) return 0;
        }

        if (!putKeyCombination(lgd, &binding->combination)) return 0;

        if ((binding->command & BRL_MSK_BLK) == BRL_BLK_CONTEXT) {
          const KeyContext *c = getKeyContext(lgd->keyTable, (KTB_CTX_DEFAULT + (binding->command & BRL_MSK_ARG)));
          if (!c) return 0;

          {
            size_t length = lgd->lineLength - keysOffset;
            wchar_t keys[length + 1];

            wmemcpy(keys, &lgd->lineCharacters[keysOffset], length);
            keys[length] = 0;
            lgd->lineLength = 0;

            if (isTemporaryKeyContext(lgd->keyTable, c)) {
              if (!listKeyContext(lgd, c, keys)) return 0;
            } else {
              if (!putCharacterString(lgd, WS_C("switch to "))) return 0;
              if (!putCharacterString(lgd, c->title)) return 0;
              if (!putCharacterString(lgd, WS_C(": "))) return 0;
              if (!putCharacterString(lgd, keys)) return 0;
              if (!endLine(lgd)) return 0;
            }
          }
        } else {
          if (!endLine(lgd)) return 0;
        }
      }

      binding += 1, count -= 1;
    }
  }

  if (!listKeyboardFunctions(lgd, ctx)) return 0;
  return 1;
}
コード例 #23
0
ファイル: PrintHandler.cpp プロジェクト: 1514louluo/poco
void PrintHandler::startObject()
{
	_out << '{';
	_out << endLine();
	_tab.append(indent(), ' ');
}
コード例 #24
0
bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
{
    bool clockwise = true;      // drawing direction of the arc
    double startAngle = 0.0f;   // angle of the first arc line
    VECTOR2I cursorPos = m_controls->GetCursorPosition();

    DRAWSEGMENT helperLine;
    helperLine.SetShape( S_SEGMENT );
    helperLine.SetLayer( Dwgs_User );
    helperLine.SetWidth( 1 );

    // Add a VIEW_GROUP that serves as a preview for the new item
    KIGFX::VIEW_GROUP preview( m_view );
    m_view->Add( &preview );

    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
    m_controls->ShowCursor( true );
    m_controls->SetSnapping( true );

    Activate();

    enum ARC_STEPS
    {
        SET_ORIGIN = 0,
        SET_END,
        SET_ANGLE,
        FINISHED
    };
    int step = SET_ORIGIN;

    // Main loop: keep receiving events
    while( OPT_TOOL_EVENT evt = Wait() )
    {
        cursorPos = m_controls->GetCursorPosition();

        if( evt->IsCancel() || evt->IsActivate() )
        {
            preview.Clear();
            preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            delete aGraphic;
            aGraphic = NULL;
            break;
        }

        else if( evt->IsClick( BUT_LEFT ) )
        {
            switch( step )
            {
            case SET_ORIGIN:
            {
                LAYER_ID layer = m_frame->GetScreen()->m_Active_Layer;

                if( IsCopperLayer( layer ) )
                {
                    DisplayInfoMessage( NULL, _( "Graphic not allowed on Copper layers" ) );
                    --step;
                }
                else
                {
                    // Init the new item attributes
                    aGraphic->SetShape( S_ARC );
                    aGraphic->SetAngle( 0.0 );
                    aGraphic->SetWidth( getSegmentWidth( layer ) );
                    aGraphic->SetCenter( wxPoint( cursorPos.x, cursorPos.y ) );
                    aGraphic->SetLayer( layer );

                    helperLine.SetStart( aGraphic->GetCenter() );
                    helperLine.SetEnd( aGraphic->GetCenter() );

                    preview.Add( aGraphic );
                    preview.Add( &helperLine );

                    m_controls->SetAutoPan( true );
                    m_controls->CaptureCursor( true );
                }
            }
            break;

            case SET_END:
            {
                if( wxPoint( cursorPos.x, cursorPos.y ) != aGraphic->GetCenter() )
                {
                    VECTOR2D startLine( aGraphic->GetArcStart() - aGraphic->GetCenter() );
                    startAngle = startLine.Angle();
                    aGraphic->SetArcStart( wxPoint( cursorPos.x, cursorPos.y ) );
                }
                else
                    --step;     // one another chance to draw a proper arc
            }
            break;

            case SET_ANGLE:
            {
                if( wxPoint( cursorPos.x, cursorPos.y ) != aGraphic->GetArcStart() && aGraphic->GetAngle() != 0 )
                {
                    assert( aGraphic->GetArcStart() != aGraphic->GetArcEnd() );
                    assert( aGraphic->GetWidth() > 0 );

                    m_view->Add( aGraphic );
                    aGraphic->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );

                    preview.Remove( aGraphic );
                    preview.Remove( &helperLine );
                }
                else
                    --step;     // one another chance to draw a proper arc
            }
            break;
            }

            if( ++step == FINISHED )
                break;
        }

        else if( evt->IsMotion() )
        {
            switch( step )
            {
            case SET_END:
                helperLine.SetEnd( wxPoint( cursorPos.x, cursorPos.y ) );
                aGraphic->SetArcStart( wxPoint( cursorPos.x, cursorPos.y ) );
                break;

            case SET_ANGLE:
            {
                VECTOR2D endLine( wxPoint( cursorPos.x, cursorPos.y ) - aGraphic->GetCenter() );
                double newAngle = RAD2DECIDEG( endLine.Angle() - startAngle );

                // Adjust the new angle to (counter)clockwise setting
                if( clockwise && newAngle < 0.0 )
                    newAngle += 3600.0;
                else if( !clockwise && newAngle > 0.0 )
                    newAngle -= 3600.0;

                aGraphic->SetAngle( newAngle );
            }
            break;
            }

            // Show a preview of the item
            preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
        }

        else if( evt->IsAction( &COMMON_ACTIONS::incWidth ) )
        {
            aGraphic->SetWidth( aGraphic->GetWidth() + WIDTH_STEP );
            preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
        }

        else if( evt->IsAction( &COMMON_ACTIONS::decWidth ) )
        {
            int width = aGraphic->GetWidth();

            if( width > WIDTH_STEP )
            {
                aGraphic->SetWidth( width - WIDTH_STEP );
                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            }
        }

        else if( evt->IsAction( &COMMON_ACTIONS::arcPosture ) )
        {
            if( clockwise )
                aGraphic->SetAngle( aGraphic->GetAngle() - 3600.0 );
            else
                aGraphic->SetAngle( aGraphic->GetAngle() + 3600.0 );

            clockwise = !clockwise;
            preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
        }
    }

    m_controls->ShowCursor( false );
    m_controls->SetSnapping( false );
    m_controls->SetAutoPan( false );
    m_controls->CaptureCursor( false );
    m_view->Remove( &preview );

    return ( step > SET_ORIGIN );
}
コード例 #25
0
bool disassembleTEX(DisassembleState &state, latte::cf::inst cfID, latte::cf::Instruction &cf)
{
  const uint32_t *ptr = state.words + (latte::WordsPerCF * cf.word0.addr);

   state.out
      << latte::cf::name[cfID] << ": "
      << "ADDR(" << cf.word0.addr << ") CNT(" << (cf.word1.count + 1) << ")";

   endLine(state);
   increaseIndent(state);

   for (auto slot = 0u; slot <= cf.word1.count; ) {
      auto tex = *reinterpret_cast<const latte::tex::Instruction*>(ptr);
      auto name = latte::tex::name[tex.word0.inst];
      auto id = tex.word0.inst;

      if (id == latte::tex::VTX_FETCH || id == latte::tex::VTX_SEMANTIC || id == latte::tex::GET_BUFFER_RESINFO) {
         assert(false);
         ptr += latte::WordsPerVTX;
      } else if (id == latte::tex::MEM) {
         assert(false);
         ptr += latte::WordsPerMEM;
      } else {
         beginLine(state);

         state.out
            << fmt::pad(state.group, groupCounterSize, '0')
            << ' '
            << name
            << ' ';

         // Write dst
         if (tex.word1.dstRel != 0) {
            // TODO: relative address
            state.out << "__UNK_REL(" << tex.word1.dstRel << ")__";
         }

         writeRegisterName(state, tex.word1.dstReg);
         state.out << '.';
         writeSelectName(state, tex.word1.dstSelX);
         writeSelectName(state, tex.word1.dstSelY);
         writeSelectName(state, tex.word1.dstSelZ);
         writeSelectName(state, tex.word1.dstSelW);

         // Write src
         state.out << ", ";

         if (tex.word0.srcRel != 0) {
            // TODO: relative address
            state.out << "__UNK_REL(" << tex.word0.srcRel << ")__";
         }

         writeRegisterName(state, tex.word0.srcReg);
         state.out << '.';
         writeSelectName(state, tex.word2.srcSelX);
         writeSelectName(state, tex.word2.srcSelY);
         writeSelectName(state, tex.word2.srcSelZ);
         writeSelectName(state, tex.word2.srcSelW);

         state.out
            << ", t" << tex.word0.resourceID
            << ", s" << tex.word2.samplerID;

         if (tex.word2.offsetX || tex.word2.offsetY || tex.word2.offsetZ) {
            state.out
               << " OFFSET("
               << tex.word2.offsetX
               << ", "
               << tex.word2.offsetY
               << ", "
               << tex.word2.offsetZ
               << ")";
         }

         if (tex.word1.lodBias) {
            state.out << " LOD_BIAS(" << tex.word1.lodBias << ")";
         }

         if (!tex.word1.coordTypeX) {
            state.out << " CTX_UNORM";
         }

         if (!tex.word1.coordTypeY) {
            state.out << " CTY_UNORM";
         }

         if (!tex.word1.coordTypeZ) {
            state.out << " CTZ_UNORM";
         }

         if (!tex.word1.coordTypeW) {
            state.out << " CTW_UNORM";
         }

         if (tex.word0.bcFracMode) {
            state.out << " BFM";
         }

         if (tex.word0.fetchWholeQuad) {
            state.out << " FWQ";
         }

         endLine(state);
         ptr += latte::WordsPerTEX;
      }

      state.group++;
      slot++;
   }

   decreaseIndent(state);
   return true;
}
コード例 #26
0
bool disassembleALU(DisassembleState &state, latte::cf::inst id, latte::cf::Instruction &cf)
{
   const uint64_t *slots = reinterpret_cast<const uint64_t *>(state.words + (latte::WordsPerCF * cf.aluWord0.addr));

   state.out
      << latte::alu::name[cf.aluWord1.inst] << ": "
      << "ADDR(" << cf.aluWord0.addr << ") CNT(" << (cf.aluWord1.count + 1) << ")";

   increaseIndent(state);

   for (auto slot = 0u; slot <= cf.aluWord1.count; ) {
      static char unitName[] = { 'x', 'y', 'z', 'w', 't' };
      bool units[5] = { false, false, false, false, false };
      bool last = false;
      const uint32_t *literalPtr = reinterpret_cast<const uint32_t*>(slots + slot);
      auto literals = 0u;

      endLine(state);

      for (auto i = 0u; i < 5 && !last; ++i) {
         auto alu = *reinterpret_cast<const latte::alu::Instruction*>(slots + slot + i);
         literalPtr += 2;
         last = !!alu.word0.last;
      }

      last = false;

      for (auto i = 0u; i < 5 && !last; ++i) {
         auto alu = *reinterpret_cast<const latte::alu::Instruction*>(slots + slot);
         auto unit = getUnit(units, alu);
         const char *name = nullptr;
         bool abs0 = false, abs1 = false;
         auto &opcode = latte::alu::op2info[alu.op2.inst];

         if (alu.word1.encoding == latte::alu::Encoding::OP2) {
            opcode = latte::alu::op2info[alu.op2.inst];
            name = opcode.name;
            abs0 = !!alu.op2.src0Abs;
            abs1 = !!alu.op2.src1Abs;
         } else {
            opcode = latte::alu::op3info[alu.op3.inst];
            name = opcode.name;
         }

         beginLine(state);

         if (i == 0) {
            state.out << fmt::pad(state.group, groupCounterSize, '0');
         } else {
            state.out << std::string(groupCounterSize, ' ').c_str();
         }
         
         state.out
            << ' '
            << unitName[unit] << ": "
            << fmt::pad(name, instrNamePad, ' ');

         if (alu.word1.encoding == latte::alu::Encoding::OP2 && alu.op2.writeMask == 0) {
            state.out << "____";
         } else {
            writeAluSource(state, literalPtr, alu.word1.dstGpr, alu.word1.dstRel, alu.word1.dstChan, 0, false);
         }

         if (opcode.srcs > 0) {
            state.out << ", ";
            writeAluSource(state, literalPtr, alu.word0.src0Sel, alu.word0.src0Rel, alu.word0.src0Chan, alu.word0.src0Neg, abs0);
         }

         if (opcode.srcs > 1) {
            state.out << ", ";
            writeAluSource(state, literalPtr, alu.word0.src1Sel, alu.word0.src1Rel, alu.word0.src1Chan, alu.word0.src1Neg, abs1);
         }

         if (alu.word1.encoding == latte::alu::Encoding::OP2) {
            if (alu.op2.updateExecuteMask) {
               state.out << " UPDATE_EXECUTE_MASK";
            }

            if (alu.op2.updatePred) {
               state.out << " UPDATE_PRED";
            }

            switch (alu.op2.omod) {
            case latte::alu::OutputModifier::Divide2:
               state.out << " OMOD_D2";
               break;
            case latte::alu::OutputModifier::Multiply2:
               state.out << " OMOD_M2";
               break;
            case latte::alu::OutputModifier::Multiply4:
               state.out << " OMOD_M4";
               break;
            }
         } else {
            if (opcode.srcs > 2) {
               state.out << ", ";
               writeAluSource(state, literalPtr, alu.op3.src2Sel, alu.op3.src2Rel, alu.op3.src2Chan, alu.op3.src2Neg, false);
            }
         }

         switch (alu.word1.bankSwizzle) {
         case latte::alu::BankSwizzle::Vec021:
            state.out << " VEC_021";
            break;
         case latte::alu::BankSwizzle::Vec120:
            state.out << " VEC_120";
            break;
         case latte::alu::BankSwizzle::Vec102:
            state.out << " VEC_102";
            break;
         case latte::alu::BankSwizzle::Vec201:
            state.out << " VEC_201";
            break;
         case latte::alu::BankSwizzle::Vec210:
            state.out << " VEC_210";
            break;
         }

         if (alu.word1.clamp) {
            state.out << " CLAMP";
         }

         endLine(state);

         // Count number of literal used
         if (alu.word0.src0Sel == latte::alu::Source::SrcLiteral) {
            literals = std::max(literals, alu.word0.src0Chan + 1);
         }

         if (alu.word0.src1Sel == latte::alu::Source::SrcLiteral) {
            literals = std::max(literals, alu.word0.src1Chan + 1);
         }

         if ((alu.word1.encoding != latte::alu::Encoding::OP2) && (alu.op3.src2Sel == latte::alu::Source::SrcLiteral)) {
            literals = std::max(literals, alu.op3.src2Chan + 1);
         }

         // Increase slot id
         slot += 1;
         last = !!alu.word0.last;
      }

      if (literals) {
         slot += (literals + 1) >> 1;
      }

      state.group++;
   }

   decreaseIndent(state);
   return true;
}
コード例 #27
0
bool disassembleNormal(DisassembleState &state, latte::cf::inst id, latte::cf::Instruction &cf)
{
   auto name = latte::cf::name[id];

   switch (id) {
   case latte::cf::TEX:
      return disassembleTEX(state, id, cf);
   case latte::cf::LOOP_START:
   case latte::cf::LOOP_START_DX10:
   case latte::cf::LOOP_START_NO_AL:
      state.out
         << name
         << " FAIL_JUMP_ADDR(" << cf.word0.addr << ")";
      endLine(state);
      increaseIndent(state);
      break;
   case latte::cf::LOOP_END:
      state.out
         << name
         << " PASS_JUMP_ADDR(" << cf.word0.addr << ")";
      endLine(state);
      decreaseIndent(state);
      break;
   case latte::cf::ELSE:
   case latte::cf::JUMP:
      state.out
         << name
         << " POP_CNT(" << cf.word1.popCount << ")"
         << " ADDR(" << cf.word0.addr << ")";
      endLine(state);
      break;
   case latte::cf::NOP:
   case latte::cf::CALL_FS:
   case latte::cf::END_PROGRAM:
      state.out
         << name;
      endLine(state);
      break;
   case latte::cf::VTX:
   case latte::cf::VTX_TC:
   case latte::cf::LOOP_CONTINUE:
   case latte::cf::LOOP_BREAK:
   case latte::cf::POP_JUMP:
   case latte::cf::CALL:
   case latte::cf::RETURN:
   case latte::cf::EMIT_VERTEX:
   case latte::cf::EMIT_CUT_VERTEX:
   case latte::cf::CUT_VERTEX:
   case latte::cf::KILL:
   case latte::cf::PUSH:
   case latte::cf::PUSH_ELSE:
   case latte::cf::POP:
   case latte::cf::POP_PUSH:
   case latte::cf::POP_PUSH_ELSE:
   case latte::cf::WAIT_ACK:
   case latte::cf::TEX_ACK:
   case latte::cf::VTX_ACK:
   case latte::cf::VTX_TC_ACK:
   default:
      assert(false);
      break;
   }

   return true;
}
コード例 #28
0
ファイル: pasm.c プロジェクト: neutered/propgcc
void
PrintDataBlockForGas(FILE *f, ParserState *P, int inlineAsm)
{
    AST *ast;
    int saveState;

    if (gl_errors != 0)
        return;
    saveState = P->printLabelsVerbatim;
    P->printLabelsVerbatim = 1;

    if (inlineAsm) {
        fprintf(f, "__asm__(\n");
        fprintf(f, "\"\t\t.section .%s.cog, \\\"ax\\\"\\n\"\n",
                P->basename);
    }
    /* print constant declarations */
    PrintConstantsGas(f, P, inlineAsm);
    if (inlineAsm) {
        fprintf(f, "\"\t\t.compress off\\n\"\n");
    }
    startLine(f, inlineAsm);
    fprintf(f, "..start");
    endLine(f, inlineAsm);
    for (ast = P->datblock; ast; ast = ast->right) {
        /* print anything for start of line here */
        startLine(f, inlineAsm);
        switch (ast->kind) {
        case AST_BYTELIST:
            outputGasDataList(f, ".byte", ast->left);
            break;
        case AST_WORDLIST:
            outputGasDataList(f, ".word", ast->left);
            break;
        case AST_LONGLIST:
            outputGasDataList(f, ".long", ast->left);
            break;
        case AST_INSTRHOLDER:
            outputGasInstruction(f, ast->left);
            break;
        case AST_IDENTIFIER:
            outputGasLabel(f, ast);
            break;
        case AST_FILE:
            ERROR(ast, "File directive not supported in GAS output");
            break;
        case AST_ORG:
            outputGasDirective(f, ".org", ast->left);
            break;
        case AST_RES:
            outputGasDirective(f, ".res", ast->left);
            break;
        case AST_FIT:
            outputGasDirective(f, ".fit", ast->left ? ast->left : AstInteger(496));
            break;
        default:
            ERROR(ast, "unknown element in data block");
            break;
        }
        /* print end of line stuff here */
        endLine(f, inlineAsm);
    }

    if (inlineAsm) {
        fprintf(f, "\"\t\t.compress default\\n\"\n");
        fprintf(f, "\"\t\t.text\\n\"\n");
        fprintf(f, "\n);\n");
    }
    P->printLabelsVerbatim = saveState;
}
コード例 #29
0
QString toListViewFormatterText::getFormattedString(toExportSettings &settings,
        //const toResultModel *model);
        const QAbstractItemModel * model)
{
    int     columns   = model->columnCount();
    int     rows      = model->rowCount();

    QString output;
    QVector<int> sizes(columns);

    QVector<int> rlist = selectedRows(settings.selected);
    QVector<int> clist = selectedColumns(settings.selected);

    // must get widest length for each column
    // zero array or (if writing headers, set their size)
    for (int i = 0; i < columns - 1; i++)
    {
        if (settings.columnsHeader)
        {
            if (settings.columnsExport == toExportSettings::ColumnsSelected && !clist.contains(i))
                continue;
            sizes[i] = model->headerData(
                           i,
                           Qt::Horizontal,
                           Qt::DisplayRole).toString().length();
        }
        else
            sizes[i] = 0;
    }
    sizes[columns - 1] = 1;

    // loop through model and get column widths
    QModelIndex mi;
    for (int row = 0; row < rows; row++)
    {
        for (int column = 0; column < columns - 1; column++)
        {
            if (settings.columnsExport == toExportSettings::ColumnsSelected && !clist.contains(column))
                continue;
            if (!settings.rowsHeader && column == 0)
                continue;

            mi = model->index(row, column);
            QVariant data = model->data(mi, Qt::EditRole);
            QString v;
            if (data.isNull())
                v = "{null}";
            else
                v = data.toString();

            int len = v.length();
            if (len > sizes[column])
                sizes[column] = len;
        }
    }

    // write header data to fixed widths
    if (settings.columnsHeader)
    {
        for (int column = 0; column < columns; column++)
        {
            if (settings.columnsExport == toExportSettings::ColumnsSelected && !clist.contains(column))
                continue;
            if (!settings.rowsHeader && column == 0)
                continue;
            QString value = model->headerData(
                                column,
                                Qt::Horizontal,
                                Qt::DisplayRole).toString();

            output += value;
            for (int left = value.length(); left <= sizes[column]; left++)
                output += ' ';
        }

        endLine(output);

        // write ==== border
        for (int column = 0; column < columns; column++)
        {
            if (settings.columnsExport == toExportSettings::ColumnsSelected && !clist.contains(column))
                continue;
            if (!settings.rowsHeader && column == 0)
                continue;
            for (int left = 0; left < sizes[column]; left++)
                output += '=';
            output += ' ';
        }

        endLine(output);
    }

    // write data
    for (int row = 0; row < rows; row++)
    {
        if (settings.rowsExport == toExportSettings::RowsSelected && !rlist.contains(row))
            continue;

        for (int column = 0; column < columns; column++)
        {
            if (settings.columnsExport == toExportSettings::ColumnsSelected && !clist.contains(column))
                continue;
            if (!settings.rowsHeader && column == 0)
                continue;
            mi = model->index(row, column);
            QVariant data = model->data(mi, Qt::EditRole);
            QString value;
            if (data.isNull())
                value = "{null}";
            else
                value = data.toString();

            output += value;
            for (int left = value.length(); left <= sizes[column]; left++)
                output += ' ';
        }

        endLine(output);
    }

    return output;
}
コード例 #30
0
void PrintHandler::comma()
{
	_out << ',' << endLine();
}