Beispiel #1
0
/*!
 * \brief
 *    Paints the combobox frame lines in the frame buffer
 * \param  fb     Pointer to the frame buffer
 * \param  items  Pointer to the active combo-box
 * \param  frame  The frame buffer's start position
 * \param  item   The frame buffer's active line
 * \param  ln     The language to use
 * \return none
 */
__Os__ void _cmb_frame_lines (fb_t *fb, combobox_item_t *items, int frame, int item, Lang_en ln)
{
   #define _LINE(_l)    (fb->c*(_l))
   int line, offset;
   int start;
   char post;

   // Print each line
   start = frame;
   for (line=1 ; line < fb->l ; ++line) {
      offset=0;
      if (frame == item) {
         offset = sprintf ((char*)&fb->fb[_LINE(line)], "[%s", (char*)items[frame].text[ln]);
         post = ']';
      }
      else {
         offset = sprintf ((char*)&fb->fb[_LINE(line)], "%s", (char*)items[frame].text[ln]);
         post = ' ';
      }
      // discard null termination inside frame buffer
      fb->fb[_LINE(line)+offset] = post;

      // Escape if no items left
      _cmb_next_item (items, &frame);
      if (frame == start)
         break;
   }
   #undef _LINE
}
Beispiel #2
0
/*!
 * \brief
 *    Paints the frame in the frame buffer
 * \param  tui    Pointer to the active tui_t structure
 * \param  menu   Pointer to current menu ARRAY
 * \param  ln     The language to use
 * \return none
 */
static void   _mk_frame (tui_t *tui, menu_item_t *menu, int frame, int item, Lang_en ln)
{
   #define _LINE(_l)    (tui->frame_buffer.c*(_l))
   int line, offset;
   int start;

   // CLear frame
   if (_tuix_clear_frame (&tui->frame_buffer))
      return;
   start = frame;
   for (line=1 ; line < tui->frame_buffer.l ; ++line) {
      offset=0;
      if (frame == item) {
         if (menu[frame].item_type == UI_RETURN)
            offset = sprintf ((char*)&tui->frame_buffer.fb[_LINE(line)], "<%s", (char*)menu[frame].text[ln]);
         else
            offset = sprintf ((char*)&tui->frame_buffer.fb[_LINE(line)], ">%s", (char*)menu[frame].text[ln]);
      }
      else
         offset = sprintf ((char*)&tui->frame_buffer.fb[_LINE(line)], "%s", (char*)menu[frame].text[ln]);
      // discard null termination inside frame buffer
      tui->frame_buffer.fb[_LINE(line)+offset] = ' ';

      // Escape if no items left
      if ( !_next_item (tui, menu, &frame) )
         break;
      if (frame == start)
         break;
   }
   #undef _LINE
}
Beispiel #3
0
/*!
 * \brief
 *    Paints the frame in the frame buffer
 * \param  tuid   Pointer to the active tuid_t struct
 * \param  ln     The language to use
 * \return none
 */
__Os__ static void _mk_frame (tuid_t *tuid, Lang_en ln)
{
   #define _LINE(_l)    (tuid->frame_buffer.c*(_l))
   int line, offset;
   int start, frame;

   // CLear frame
   if (_tuix_clear_frame (&tuid->frame_buffer))
      return;
   // Print each line
   start = frame = tuid->menu_data.mn_frm;
   for (line=1 ; line<tuid->frame_buffer.l ; ++line) {
      offset=0;
      if (frame == tuid->menu_data.mn_it) {
         if (tuid->menu_data.menu[frame].item_type == UI_RETURN)
            offset = sprintf ((char*)&tuid->frame_buffer.fb[_LINE(line)], "<%s", (char*)tuid->menu_data.menu[frame].text[ln]);
         else
            offset = sprintf ((char*)&tuid->frame_buffer.fb[_LINE(line)], ">%s", (char*)tuid->menu_data.menu[frame].text[ln]);
      }
      else
         offset = sprintf ((char*)&tuid->frame_buffer.fb[_LINE(line)], "%s", (char*)tuid->menu_data.menu[frame].text[ln]);

      // discard null termination inside frame buffer body
      tuid->frame_buffer.fb[_LINE(line)+offset] = ' ';
      // Keep null termination at end of each line
      tuid->frame_buffer.fb[_LINE(line)+tuid->frame_buffer.c-1] = 0;

      // Escape if no items left
      if ( !_next_item (tuid, &frame) )
         break;
      if (frame == start)
         break;
   }
   #undef _LINE
}
Beispiel #4
0
/*!
 * \brief
 *    Paints the frame in the frame buffer
 * \param  tui    Pointer to the active tui_t structure
 * \param  t      time value to print
 * \param  frm    Format string
 *    \arg UI_TIME_SS
 *    \arg UI_TIME_MM
 *    \arg UI_TIME_HH
 *    \arg UI_TIME_DD
 * \return none
 */
static void _mk_frame (tui_t *tui, time_t t, uint8_t frm)
{
   #define _LINE(_l)    (tui->frame_buffer.c*(_l))
   int i=0;
   struct tm *s;

   // CLear frame
   if (_tuix_clear_frame (&tui->frame_buffer))
      return;
   // Print value
   s = sgmtime(&t);
   i = sprintf ((char*)&tui->frame_buffer.fb[_LINE(1)], "= ");
   if (frm & UI_TIME_DD)   i += sprintf ((char*)&tui->frame_buffer.fb[_LINE(1)+i], "%dd ",   s->tm_yday);
   if (frm & UI_TIME_HH) {
      i += sprintf ((char*)&tui->frame_buffer.fb[_LINE(1)+i], "%02d",  s->tm_hour);
      if (frm & UI_TIME_MM) tui->frame_buffer.fb[_LINE(1)+i++] = ':';
   }
   if (frm & UI_TIME_MM) {
      i += sprintf ((char*)&tui->frame_buffer.fb[_LINE(1)+i], "%02d",  s->tm_min);
      if (frm & UI_TIME_SS) tui->frame_buffer.fb[_LINE(1)+i++] = ':';
      else                  tui->frame_buffer.fb[_LINE(1)+i++] = '\'';
   }
   if (frm & UI_TIME_SS)   i += sprintf ((char*)&tui->frame_buffer.fb[_LINE(1)+i], "%02d\"", s->tm_sec);
   // discard null termination inside frame buffer
   tui->frame_buffer.fb[_LINE(1)+i] = ' ';
   #undef _LINE
}
Beispiel #5
0
/*!
 * \brief
 *    Paints the frame in the frame buffer
 * \param  tuid   Pointer to the active tuid_t struct
 * \param  str    The string to print
 * \return none
 */
__Os__ static void _mk_frame (tuid_t *tuid, char* str)
{
   #define _LINE(_l)    (tuid->frame_buffer.c*(_l))
   int offset=0;

   // CLear frame
   if (_tuix_clear_frame (&tuid->frame_buffer))
      return;
   // Print text
   offset = sprintf ((char*)&tuid->frame_buffer.fb[_LINE(1)], ":%s<", str);
   // discard null termination inside frame buffer's body
   tuid->frame_buffer.fb[_LINE(1)+offset] = ' ';
   // Keep null termination at end of each line
   tuid->frame_buffer.fb[_LINE(1)+tuid->frame_buffer.c-1] = 0;
   #undef _LINE
}
Beispiel #6
0
void Line( int x1, int y1, int x2, int y2, int col ) {
	if ( x1 > x2 )
		_iswap( &x1, &x2 );
	if ( y1 > y2 )
		_iswap( &y1, &y2 );
	if ( y1 == y2 )
		SCANLINE( x1, x2, y1, col );
	else
		_LINE( x1, y1, x2, y2, col );
}