Esempio n. 1
0
void
TextContent::handleSpec( const InputEvent &e) { 
    _inp.setEvent(e);
   
    switch(_inp.lastSpec) { 

    case KEY_UPARROW:
        moveToLine(_loc.line-1);
        break;
    case KEY_DOWNARROW:
        moveToLine(_loc.line+1);
        break;
    case KEY_LEFTARROW:
        moveToChar(_loc.chr-1 );
        break;
    case KEY_RIGHTARROW:
        moveToChar(_loc.chr+1 );
        break;
    case KEY_F2:
        parse();
    
    }

    if ( !_inp.shiftDown ) _markLoc  = _loc;
    _markSpan = TextSpan(_loc, _markLoc );
    _buf->closeEdit();
}
Esempio n. 2
0
void InterlinearChunkEditor::goTo()
{
    bool ok;
    int newPosition = QInputDialog::getInt(this, tr("Go to"), tr("Go to the chunk with line... (1-%1)").arg(mText->phraseCount()), mPosition, 1, mText->phraseCount(), 1, &ok );
    if( ok )
        moveToLine( newPosition );
}
Esempio n. 3
0
void
TextContent::setLoc(TextLoc n, bool mark ) { 
    moveToLine(n.line);
    moveToChar(n.chr );
    if ( mark ) {
        _markSpan.end = _loc;
        _markSpan.close();
        _markLoc = _markSpan.end;
    }
}
void emitMethodImplHeader(PINTERFACE pif, PMETHOD pm)
{
  PPARSEINFO pParseInfo=(PPARSEINFO)gScanner->user_data; 
  
  if(!pif->fIsForwardDeclaration)
  {
    g_printf("\n");
    moveToLine(pParseInfo->uiTokenLine);

    g_printf("NOMDLLEXPORT NOM_Scope ");
    emitReturnType(pParseInfo, pif, pm);
    g_printf(" NOMLINK impl_%s_%s(%s* nomSelf, ", pif->chrName, pm->chrName, pif->chrName);
    emitMethodParams(pParseInfo, pif, pm->pParamArray);
    g_printf(" CORBA_Environment *ev)");    
#if 0
    if((pParseInfo->outFile=openOutfile(gScanner, "-"))!=NULL)
    {
      g_print("ok");

      closeOutfile(pParseInfo->outFile);
      pParseInfo->outFile = NULL;

    }
#endif
    
  }
#if 0
  /* Do return type */
  fprintf(fh, "NOMDLLEXPORT NOM_Scope ");
  emitReturnType(pLocalPI, pif, pm);
  
  fprintf(fh, " NOMLINK impl_%s_%s(%s* nomSelf,\n", pif->chrName,  pm->chrName, pif->chrName);
  /* Do parameters */
  emitMethodParams(pLocalPI, pif, pm->pParamArray);
  fprintf(fh, "    CORBA_Environment *ev)\n");
  fprintf(fh, "{\n");
  fprintf(fh, "  /* %sData* nomThis = %sGetData(nomSelf); */\n", pif->chrName, pif->chrName);
  if(queryMessageReturnsAValue(pm)){
    fprintf(fh, "  ");
    emitReturnType(pLocalPI, pif, pm);
    fprintf(fh, " nomRetval;\n\n");
    fprintf(fh, "#warning In impl_%s_%s(): return value must be customized!\n",  pif->chrName,  pm->chrName);
    fprintf(fh, "  return nomRetval;\n");
  }
  else
    fprintf(fh, "\n");
  
  fprintf(fh, "}\n\n");
#endif
}
Esempio n. 5
0
void NavigationControl::LineCallback(const Robosub::Line msg) {
	if(LINEMODE == OFF)
		return;

    OnLine = moveToLine(msg.x, msg.y);
    //Once it's on top of the line, rotate
    if (!OnLine){
        return; //keep rotating
    }

    int target_rot = sanitize(msg.rotation);
    if(!target_rot){
	 start_rot = 0;
         Rotating = 0;
	 setTurn(0);
	 return; //Stoppped by Higher Level
    }
    if(!Rotating){
        start_rot = target_rot;
    }

    float per_rot = (target_rot/180);//start_rot);


    //This needs to be implemented better (any ideas?)
    //int direction = 1; //always rotate right?
    int direction = target_rot>0 ? 1 : -1; //-1 Rotate left


    int rate = 0;
    int range=40;
    int minR = 50;

    if(abs(per_rot)<MAX_THRESHOLD ){
        if(abs(per_rot)>.01)
            rate = -60*direction;
        else
            rate = 0;
    } else {
        rate = (range*per_rot+minR)*direction;
    }

    setTurn(rate);

}
Esempio n. 6
0
void InterlinearChunkEditor::end()
{
    moveToLine( mText->phraseCount() );
}
Esempio n. 7
0
void InterlinearChunkEditor::beginning()
{
    moveToLine( 0 );
}
Esempio n. 8
0
void printToFile(GTokenType token)
{
  GTokenValue value=gScanner->value;
  PPARSEINFO pParseInfo=(PPARSEINFO)gScanner->user_data;

  if(!pParseInfo->fPrintToken)
    return;

  //g_printf("---> %d %d\n", gScanner->position, pParseInfo->uiCurPos);
  
  moveToLine(pParseInfo->uiTokenLine);

  //g_message("Token: %d ()\t\t:", token);

  switch(token)
  {
    case G_TOKEN_SYMBOL:
    {
      PSYMBOL pCurSymbol=value.v_symbol;
      
      moveToPos(g_scanner_cur_position(gScanner)-strlen(pCurSymbol->chrSymbolName)+1);
      //g_printf("->%s<-", pCurSymbol->chrSymbolName);
      g_printf("%s", pCurSymbol->chrSymbolName);
      pParseInfo->uiCurPos+=strlen(pCurSymbol->chrSymbolName);
      break;
    }
    case G_TOKEN_STRING:
      moveToPos(g_scanner_cur_position(gScanner)-strlen(value.v_string)-1);
      
      g_print("\"%s\"", value.v_string);
      pParseInfo->uiCurPos+=strlen(value.v_string)+2;
      break;
    case G_TOKEN_INT:
    {
      gchar tmp[100];
      
      g_snprintf(tmp, sizeof(tmp), "%d", value.v_int);
      
      moveToPos(g_scanner_cur_position(gScanner)-strlen(tmp)+1);
      g_print("%d", value.v_int);
      pParseInfo->uiCurPos+=strlen(tmp);
      
      break;
    }
    case G_TOKEN_IDENTIFIER:
      moveToPos(g_scanner_cur_position(gScanner)-strlen(value.v_identifier)+1);
      
      g_print("%s", value.v_identifier);
      //g_print("-->%s<--", value.v_identifier);
      pParseInfo->uiCurPos+=strlen(value.v_identifier);
      break;
      
      //case '.':
      //g_message("Token: %d (.)\t\t:", token);

    default:
    {        
      moveToPos(g_scanner_cur_position(gScanner));
      g_print("%c", token);
      pParseInfo->uiCurPos++;
      break;
    } /* default */      
  } /* switch */
}