int simulate_proc(int msg, DIALOG *d, int c)
{
   int ret;

   switch (msg)
   {
      case MSG_READ_CODES: case MSG_CLEAR_CODES:
         // if we are currently reading or clearing codes, and the button is enabled,
         if (!(d->flags & D_DISABLED))
         {
            d->flags |= D_DISABLED;     // disable the button
            return D_REDRAWME;
         }
         break;

      case MSG_READY:
         // if we're not reading or clearing codes, and the button is disabled,
         if (d->flags & D_DISABLED)
         {
            d->flags &= ~D_DISABLED;   // enable it
            return D_REDRAWME;
         }
         break;
   }
   
   ret = d_check_proc(msg, d, c);

   if ((d->flags & D_SELECTED) && (d->d2 == 0))
   {
      d->d2 = 1;
      simulate = TRUE;
      trouble_codes_simulator(TRUE);
   }
   else if (!(d->flags & D_SELECTED) && (d->d2 == 1))
   {
      d->d2 = 0;
      simulate = FALSE;
      trouble_codes_simulator(FALSE);
   }

   return ret;
}   
Beispiel #2
0
int gui_d_check_proc(int msg, DIALOG *d, int c)
{
    struct callback_data *acd = d->dp3;
    int ret;

    ret = d_check_proc(msg, d, c);

    if (msg == MSG_CLICK) {
        if (d->dp3 != NULL) {
            if (d->flags & D_SELECTED)
                callback_set_int(acd, 1);
            else
                callback_set_int(acd, 0);

            ret = run_callback(acd, D_O_K);
        }
    }

    return ret;
}