Ejemplo n.º 1
0
/**
 * tifiles_vartype2icon:
 * @model: a calculator model.
 * @id: a vartype ID.
 *
 * Returns the type ID of variable as string ("Real", "Program", ...).
 * Same as #tifiles_vartype2type but un-localized.
 *
 * Return value: a string like "Assembly Program".
 **/
TIEXPORT2 const char *TICALL tifiles_vartype2icon(CalcModel model, uint8_t vartype)
{
  switch (model) 
  {
#ifndef DISABLE_TI8X
  case CALC_TI73:
    return ti73_byte2icon(vartype);
  case CALC_TI82:
    return ti82_byte2icon(vartype);
  case CALC_TI83:
    return ti83_byte2icon(vartype);
  case CALC_TI83P:
  case CALC_TI84P:
  case CALC_TI84P_USB:
    return ti83p_byte2icon(vartype);
  case CALC_TI85:
    return ti85_byte2icon(vartype);
  case CALC_TI86:
    return ti86_byte2icon(vartype);
#endif
#ifndef DISABLE_TI9X
  case CALC_TI89:
  case CALC_TI89T:
  case CALC_TI89T_USB:
    return ti89_byte2icon(vartype);
  case CALC_TI92:
    return ti92_byte2icon(vartype);
  case CALC_TI92P:
    return ti92p_byte2icon(vartype);
  case CALC_V200:
    return v200_byte2icon(vartype);
  case CALC_NSPIRE:
    return nsp_byte2icon(vartype);
#endif
  default:
    tifiles_critical("%s: invalid model argument.", __FUNCTION__);
    return "";
  }
}
Ejemplo n.º 2
0
/**
 * tifiles_file_get_icon:
 * @filename: a filename as string.
 *
 * Returns the type of file (function, program, ...).
 *
 * Return value: a string like "Assembly Program" (non localized).
 **/
TIEXPORT2 const char *TICALL tifiles_file_get_icon(const char *filename)
{
  char *ext;

  ext = tifiles_fext_get(filename);
  if (!strcmp(ext, ""))
    return "";

  if (!g_ascii_strcasecmp(ext, "tib"))
    return "OS upgrade";

  if (!g_ascii_strcasecmp(ext, "tno") || !g_ascii_strcasecmp(ext, "tnc") || !g_ascii_strcasecmp(ext, "tco") || !g_ascii_strcasecmp(ext, "tcc"))
    return "OS upgrade";

  if (!tifiles_file_is_ti(filename))
    return "";

  if(tifiles_file_is_tigroup(filename))
	  return "TiGroup";

  if (tifiles_file_is_group(filename)) 
  {
    switch (tifiles_file_get_model(filename)) 
	{
    case CALC_TI89:
	case CALC_TI89T:
	case CALC_TI89T_USB:
    case CALC_TI92P:
    case CALC_V200:
      return "Group/Backup";
    default:
      return "Group";
    }
  }

  switch (tifiles_file_get_model(filename)) 
  {
#ifndef DISABLE_TI8X
  case CALC_TI73:
    return ti73_byte2icon(ti73_fext2byte(ext));
  case CALC_TI82:
    return ti82_byte2icon(ti82_fext2byte(ext));
  case CALC_TI83:
    return ti83_byte2icon(ti83_fext2byte(ext));
  case CALC_TI83P:
  case CALC_TI84P:
  case CALC_TI84P_USB:
    return ti83p_byte2icon(ti83p_fext2byte(ext));
  case CALC_TI85:
    return ti85_byte2icon(ti85_fext2byte(ext));
  case CALC_TI86:
    return ti86_byte2icon(ti86_fext2byte(ext));
#endif
#ifndef DISABLE_TI9X
  case CALC_TI89:
  case CALC_TI89T:
  case CALC_TI89T_USB:
    return ti89_byte2icon(ti89_fext2byte(ext));
  case CALC_TI92:
    return ti92_byte2icon(ti92_fext2byte(ext));
  case CALC_TI92P:
    return ti92p_byte2icon(ti92p_fext2byte(ext));
  case CALC_V200:
    return v200_byte2icon(v200_fext2byte(ext));
#endif
  case CALC_NSPIRE:
	  return nsp_byte2icon(nsp_fext2byte(ext));
  case CALC_NONE:
  default:
    return "";
    break;
  }

  return "";
}