Example #1
0
static void ShowParamBuff(void)
{
  if (GetParamDevice(iwPrm) == 0)
    ShowLo(szNoParam);
  else
  {
    if (mpboEnblParams[iwPrm] == false)
      ShowLo(szBlocked); 
    else
    {
      switch (ibVal)
      {
        case 0:  sprintf(szLo,"%12.3f", mpreParamsBuff[ibSoftTim][iwPrm]); break;
        case 1:  ShowTime(mptiParamsBuff[iwPrm]);  break;
        case 2:  ShowDate(mptiParamsBuff[iwPrm]);  break;
      }
    }
  }
}
Example #2
0
void DirectoryViewer::ShowEntry(const FileList::FileEntry& fileEntry, const ConfigFile& configFile, unsigned int columnNumber, unsigned int numColumns)
{
   unsigned char color = static_cast<unsigned char>(configFile.GetColorByExtension(fileEntry.Extension()));
   color += color < 10 ? '0' : 'a' - 10;

   unsigned int columnWidth = m_console.Width() / numColumns;

   if (columnWidth > 89)
   {
      m_console.Printf("^4³"); // 1
      ShowDate(fileEntry.m_time, false); // 11
      ShowTime(fileEntry.m_time, false); // 9
      ShowAttributes(fileEntry.m_attributes); // 6
      m_console.Printf(" "); // 1
      ShowSize(fileEntry.m_size, fileEntry.m_attributes, false); // 16

      int remainingSpace = columnWidth - 1 - 11 - 9 - 6 - 1 - 16 - 1;
      m_console.Printf("^%c%-*s^7", color, remainingSpace, fileEntry.m_name.c_str());
   }
   else if (columnWidth > 80)
   {
      m_console.Printf("^4³"); // 1
      ShowDate(fileEntry.m_time, false); // 11
      ShowTime(fileEntry.m_time, false); // 9
      ShowAttributes(fileEntry.m_attributes); // 6
      m_console.Printf(" "); // 1
      ShowSize(fileEntry.m_size, fileEntry.m_attributes, true); // 7
      m_console.Printf("^%c%-44.44s^7", color, fileEntry.m_name.c_str()); // 44
   }
   else if (columnWidth > 40)
   {
      m_console.Printf("^4³"); // 1
      ShowDate(fileEntry.m_time, true); // 9
      ShowTime(fileEntry.m_time, true); // 6
      ShowSize(fileEntry.m_size, fileEntry.m_attributes, true); // 7
      m_console.Printf("^%c%-17.17s^7", color, fileEntry.m_name.c_str()); // 17
   }
   else if (columnWidth > 26)
   {
      m_console.Printf("^4³"); // 1
      ShowAttributes(fileEntry.m_attributes); // 6
      ShowSize(fileEntry.m_size, fileEntry.m_attributes, true); // 7
      m_console.Printf("^%c%-12.12s", color, fileEntry.m_name.c_str()); // 12
      if (columnNumber + 1 == numColumns)
         m_console.Printf("^4³"); // 1
   }
   else if (columnWidth > 20)
   {
      m_console.Printf("^4³"); // 1
      ShowSize(fileEntry.m_size, fileEntry.m_attributes, true); // 7
      m_console.Printf("^%c%-12.12s", color, fileEntry.m_name.c_str()); // 12
   }
   else if (columnWidth > 16)
   {
      m_console.Printf("^4³^%c%-15.15s", color, fileEntry.m_name.c_str());
   }
   else if (columnWidth > 13)
   {
      m_console.Printf("^4³^%c%-12.12s^7", color, fileEntry.m_name.c_str());
      if (columnNumber + 1 == numColumns)
         m_console.Printf("^4³");
   }

   if (columnNumber + 1 == numColumns)
      m_console.Printf("\n");
}