int mil_text_proc(int msg, DIALOG *d, int c)
{
   switch (msg)
   {
      case MSG_START:
         if (!(d->dp = calloc(16, sizeof(char))))
            fatal_error("Could not allocate enough memory for mil_text_proc buffer");
         strcpy(d->dp, "MIL is OFF");
         break;
         
      case MSG_END:
         free(d->dp);
         break;
         
      case MSG_DRAW:
         rectfill(screen, d->x-d->w, d->y, d->x+d->w-1, d->y+d->h-1, d->bg);  // clear the element
         break;
         
      case MSG_READY:
         if (mil_is_on)
            strcpy(d->dp, "MIL is ON");
         else
            strcpy(d->dp, "MIL is OFF");
      
         return D_REDRAWME;
   }
   
   return st_ctext_proc(msg, d, c);
}
int num_of_codes_proc(int msg, DIALOG *d, int c)
{
   switch (msg)
   {
      case MSG_START:
         d->dp2 = datafile[ARIAL18_FONT].dat;
         if (!(d->dp = calloc(8, sizeof(char))))
            fatal_error("Could not allocate enough memory for num_of_codes_proc buffer");
         strcpy(d->dp, "0");
         break;

      case MSG_END:
         free(d->dp);
         break;
         
      case MSG_DRAW:
         rectfill(screen, d->x-d->w, d->y, d->x+d->w-1, d->y+d->h-1, d->bg);  // clear the element
         break;

      case MSG_READY:
         sprintf(d->dp, "%i", num_of_codes_reported);
         return D_REDRAWME;
   }
   
   return st_ctext_proc(msg, d, c);
}
Esempio n. 3
0
int caption_proc(int msg, DIALOG *d, int c)
{
   if (msg == MSG_START)
   {
      d->dp2 = datafile[ARIAL12_BOLD_FONT].dat;
   }
   return st_ctext_proc(msg, d, c);
}
int current_code_proc(int msg, DIALOG *d, int c)
{
   switch (msg)
   {
      case MSG_START:
         d->dp2 = datafile[ARIAL18_FONT].dat;
         d->dp = empty_string;
         break;

      case MSG_READY:
         if (get_number_of_codes() == 0)
            d->dp = empty_string;
         else
            d->dp = get_trouble_code(current_code_index)->code;

         return D_REDRAWME;
      
      case MSG_DRAW:
         rectfill(screen, d->x-d->w, d->y, d->x+d->w-1, d->y+d->h-1, d->bg);  // clear the element
         break;
   }
      
   return st_ctext_proc(msg, d, c);
}