コード例 #1
0
ファイル: Process.cpp プロジェクト: jarda-manana/LK8000
// VENTA3 Alternate destinations
TCHAR *FormatterAlternate::RenderTitle(int *color) {
  
  LockTaskData();
  if(ValidWayPoint(ActiveAlternate))
    {
      if ( DisplayTextType == DISPLAYFIRSTTHREE)
        {
          _tcsncpy(Text,WayPointList[ActiveAlternate].Name,3);
          Text[3] = '\0';
        }
      else if( DisplayTextType == DISPLAYNUMBER)
        {
          _stprintf(Text,TEXT("%d"),
		    WayPointList[ActiveAlternate].Number );
        }
      else
        {
          _tcsncpy(Text,WayPointList[ActiveAlternate].Name,
                   (sizeof(Text)/sizeof(TCHAR))-1);
          Text[(sizeof(Text)/sizeof(TCHAR))-1] = '\0';
        }
    }
  else
    {
      Valid = false;
      RenderInvalid(color);
    }
  UnlockTaskData();

  return(Text);
}
コード例 #2
0
ファイル: Base.cpp プロジェクト: bugburner/xcsoar
const TCHAR *InfoBoxFormatter::RenderTitle(int *color) { // VENTA3
  if (Valid) {
    _stprintf(Text,
              Format,
              Value );
    *color = 0;
  } else {
    RenderInvalid(color);
  }
  return(Text);
}
コード例 #3
0
ファイル: Process.cpp プロジェクト: jarda-manana/LK8000
TCHAR *InfoBoxFormatter::Render(int *color) {
  if (Valid) {
    _stprintf(Text,
              Format,
              Value );
    *color = 0;
  } else {
    RenderInvalid(color);
  }
  return(Text);
}
コード例 #4
0
ファイル: Process.cpp プロジェクト: jarda-manana/LK8000
TCHAR *FormatterAATTime::Render(int *color) {
  if (!Valid) {
    RenderInvalid(color);
    _stprintf(Text,TEXT("--:--"));
  } else {

    *color = status;

    if ((hours<0) || (mins<0) || (seconds<0)) {
      // Time is negative
      if (hours<0) { // hh:mm, ss
        _stprintf(Text,
                  TEXT("%02d:%02d"),
                  hours, mins );
        _stprintf(CommentText,
                  TEXT("%02d"),
                  seconds);
      } else if (mins<0) { // mm:ss
        _stprintf(Text,
                  TEXT("%02d:%02d"),
                  mins, seconds );
        _stprintf(CommentText,
                  TEXT(""));
      } else {
        _stprintf(Text,
                  TEXT("-00:%02d"),
                  abs(seconds));
        _stprintf(CommentText,
                  TEXT(""));
      }
    } else {
      // Time is positive
      if (hours>0) { // hh:mm, ss
        _stprintf(Text,
                  TEXT("%02d:%02d"),
                  hours, mins );
        _stprintf(CommentText,
                  TEXT("%02d"),
                  seconds);
      } else { // mm:ss
        _stprintf(Text,
                  TEXT("%02d:%02d"),
                  mins, seconds );
        _stprintf(CommentText,
                  TEXT(""));
      }
    }
  }
  return(Text);
}
コード例 #5
0
ファイル: Process.cpp プロジェクト: jarda-manana/LK8000
TCHAR *FormatterTeamCode::Render(int *color) {

  if(ValidWayPoint(TeamCodeRefWaypoint))
    {
      *color = 0; // black text
       _tcsncpy(Text,CALCULATED_INFO.OwnTeamCode,5);
       Text[5] = '\0';
    }
  else
    {
      RenderInvalid(color);
    }

  return(Text);
}
コード例 #6
0
ファイル: Process.cpp プロジェクト: jarda-manana/LK8000
TCHAR *FormatterLowWarning::Render(int *color) {

  if (Valid) {
    _stprintf(Text,
              Format,
              Value );
    if (Value<minimum) {
      *color = 1; // red
    } else {
      *color = 0;
    }
  } else {
    RenderInvalid(color);
  }
  return(Text);
}
コード例 #7
0
ファイル: Process.cpp プロジェクト: jarda-manana/LK8000
/*
 * Currently even if set for FIVV, colors are not used.
 */
TCHAR *FormatterAlternate::Render(int *color) {
 //int active=ActiveAlternate; REMOVE
  LockTaskData();
  if(Valid && ValidWayPoint(ActiveAlternate)) {
	switch (WayPointCalc[ActiveAlternate].VGR ) {
		case 0:
			// impossible, give a magenta debug color;
			*color = 5; 
			break;
		case 1:
#ifdef FIVV
			*color = 0; // green
#else
			*color = 0; // blue
#endif
			break;
		case 2:
#ifdef FIVV
			*color = 0; // yellow 4
#else
			*color = 0; // normale white
#endif
			break;
		case 3:
			*color = 1; // red
			break;
		default:
			// even more impossible, give debug color magenta
			*color = 5;
			break;
	}

//	Value=WayPointCalc[ActiveAlternate].GR;    BUGFIX 090918

	_stprintf(Text,Format,Value);
  } else {
	Valid = false;
	RenderInvalid(color);
  }
   UnlockTaskData();
   return(Text);
}
コード例 #8
0
ファイル: Process.cpp プロジェクト: jarda-manana/LK8000
TCHAR *FormatterDiffTeamBearing::Render(int *color) {

  if(ValidWayPoint(TeamCodeRefWaypoint) && TeammateCodeValid) {
    Valid = true;
    
    Value = CALCULATED_INFO.TeammateBearing -  GPS_INFO.TrackBearing;
    
    if (Value < -180.0)
      Value += 360.0;
    else
      if (Value > 180.0)
        Value -= 360.0;
    
#ifndef __MINGW32__
    if (Value > 1)
      _stprintf(Text, TEXT("%2.0f°»"), Value);
    else if (Value < -1)
      _stprintf(Text, TEXT("«%2.0f°"), -Value);
    else
      _tcscpy(Text, TEXT("«»"));
#else
    if (Value > 1)
      _stprintf(Text, TEXT("%2.0f°»"), Value);
    else if (Value < -1)
      _stprintf(Text, TEXT("«%2.0f°"), -Value);
    else
      _tcscpy(Text, TEXT("«»"));
#endif
    *color = 0;
    
  } else {
    Valid = false;
    RenderInvalid(color);
  }
  
  return(Text);
}
コード例 #9
0
ファイル: Process.cpp プロジェクト: jarda-manana/LK8000
TCHAR *FormatterWaypoint::Render(int *color) {
  int thewaypoint = ActiveWayPoint;
  LockTaskData();
  if(ValidTaskPoint(thewaypoint))
    {
      int index = Task[thewaypoint].Index;
      if ((index>=0) && (WayPointList[index].Reachable)) {
	*color = 2; // blue text
      } else {
	*color = 0; // black text
      }
      if ( DisplayTextType == DISPLAYFIRSTTHREE)
        {
          _tcsncpy(Text,WayPointList[index].Name,3);
          Text[3] = '\0';
        }
      else if( DisplayTextType == DISPLAYNUMBER)
        {
          _stprintf(Text,TEXT("%d"),
		    WayPointList[index].Number );
        }
      else
        {
          _tcsncpy(Text,WayPointList[index].Name,
                   (sizeof(Text)/sizeof(TCHAR))-1);
          Text[(sizeof(Text)/sizeof(TCHAR))-1] = '\0';
        }
    }
  else
    {
      Valid = false;
      RenderInvalid(color);
    }
  UnlockTaskData();

  return(Text);
}