iOS/libraries/allegro/allegro/src/modesel.c
/* change_proc:
 *  Stores the current driver in d1 and graphics mode in d2; if a new
 *  driver is selected in the listbox, it updates the resolution and 
 *  color depth listboxes so that they redraw; if a new resolution is
 *  selected in the listbox, it updates the color depth listbox. The
 *  current selection is kept across the changes as much as possible.
 */
Stores the current driver in d1 and graphics mode in d2; if a new
driver is selected in the listbox, it updates the resolution and
color depth listboxes so that they redraw; if a new resolution is
selected in the listbox, it updates the color depth listbox. The
current selection is kept across the changes as much as possible.
Stores the current driver in d1 and graphics mode in d2 ; if a new driver is selected in the listbox it updates the resolution and color depth listboxes so that they redraw ; if a new resolution is selected in the listbox it updates the color depth listbox . The current selection is kept across the changes as much as possible .
static int change_proc(int msg, DIALOG *d, int c)
{
   int width = driver_list[d->d1].mode_list[d->d2].w;
   int height = driver_list[d->d1].mode_list[d->d2].h;
   int depth = bpp_value_for_mode(what_dialog[GFX_DEPTHLIST].d1, d->d1, d->d2);
   int i;
   ASSERT(d);
   if (msg != MSG_IDLE)
      return D_O_K;
   if (what_dialog[GFX_DRIVERLIST].d1 != d->d1) {
      d->d1 = what_dialog[GFX_DRIVERLIST].d1;
      what_dialog[GFX_MODELIST].d1 = 0;
      for (i = 0; i < driver_list[d->d1].mode_count; i++) {
         if (driver_list[d->d1].mode_list[i].w == width &&
             driver_list[d->d1].mode_list[i].h == height) {
           what_dialog[GFX_MODELIST].d1 = i;
           break;
         }
      }
      what_dialog[GFX_MODELIST].d2 = 0;
      object_message(&what_dialog[GFX_MODELIST], MSG_DRAW, 0);
      d->d2 = what_dialog[GFX_MODELIST].d1;
      if (what_dialog == gfx_mode_ex_dialog) {
         what_dialog[GFX_DEPTHLIST].d1 = bpp_index_for_mode(depth, d->d1, d->d2);
         if (what_dialog[GFX_DEPTHLIST].d1 < 0)
            what_dialog[GFX_DEPTHLIST].d1 = 0;
         what_dialog[GFX_DEPTHLIST].d2 = 0;
         object_message(&what_dialog[GFX_DEPTHLIST], MSG_DRAW, 0);
      }
   }
   if (what_dialog[GFX_MODELIST].d1 != d->d2) {
      d->d2 = what_dialog[GFX_MODELIST].d1;
      if (what_dialog == gfx_mode_ex_dialog) {
         what_dialog[GFX_DEPTHLIST].d1 = bpp_index_for_mode(depth, d->d1, d->d2);
         if (what_dialog[GFX_DEPTHLIST].d1 < 0)
            what_dialog[GFX_DEPTHLIST].d1 = 0;
         what_dialog[GFX_DEPTHLIST].d2 = 0;
         object_message(&what_dialog[GFX_DEPTHLIST], MSG_DRAW, 0);
      }
   }
   return D_O_K;
}
static int change_proc ( int msg , DIALOG * d , int c ) { int width = driver_list [ d -> d1 ] . mode_list [ d -> d2 ] . w ; int height = driver_list [ d -> d1 ] . mode_list [ d -> d2 ] . h ; int depth = bpp_value_for_mode ( what_dialog [ GFX_DEPTHLIST ] . d1 , d -> d1 , d -> d2 ) ; int i ; ASSERT ( d ) ; if ( msg != MSG_IDLE ) return D_O_K ; if ( what_dialog [ GFX_DRIVERLIST ] . d1 != d -> d1 ) { d -> d1 = what_dialog [ GFX_DRIVERLIST ] . d1 ; what_dialog [ GFX_MODELIST ] . d1 = 0 ; for ( i = 0 ; i < driver_list [ d -> d1 ] . mode_count ; i ++ ) { if ( driver_list [ d -> d1 ] . mode_list [ i ] . w == width && driver_list [ d -> d1 ] . mode_list [ i ] . h == height ) { what_dialog [ GFX_MODELIST ] . d1 = i ; break ; } } what_dialog [ GFX_MODELIST ] . d2 = 0 ; object_message ( & what_dialog [ GFX_MODELIST ] , MSG_DRAW , 0 ) ; d -> d2 = what_dialog [ GFX_MODELIST ] . d1 ; if ( what_dialog == gfx_mode_ex_dialog ) { what_dialog [ GFX_DEPTHLIST ] . d1 = bpp_index_for_mode ( depth , d -> d1 , d -> d2 ) ; if ( what_dialog [ GFX_DEPTHLIST ] . d1 < 0 ) what_dialog [ GFX_DEPTHLIST ] . d1 = 0 ; what_dialog [ GFX_DEPTHLIST ] . d2 = 0 ; object_message ( & what_dialog [ GFX_DEPTHLIST ] , MSG_DRAW , 0 ) ; } } if ( what_dialog [ GFX_MODELIST ] . d1 != d -> d2 ) { d -> d2 = what_dialog [ GFX_MODELIST ] . d1 ; if ( what_dialog == gfx_mode_ex_dialog ) { what_dialog [ GFX_DEPTHLIST ] . d1 = bpp_index_for_mode ( depth , d -> d1 , d -> d2 ) ; if ( what_dialog [ GFX_DEPTHLIST ] . d1 < 0 ) what_dialog [ GFX_DEPTHLIST ] . d1 = 0 ; what_dialog [ GFX_DEPTHLIST ] . d2 = 0 ; object_message ( & what_dialog [ GFX_DEPTHLIST ] , MSG_DRAW , 0 ) ; } } return D_O_K ; }
change_proc:
  Stores the current driver in d1 and graphics mode in d2; if a new
  driver is selected in the listbox, it updates the resolution and
  color depth listboxes so that they redraw; if a new resolution is
  selected in the listbox, it updates the color depth listbox.
change_proc : Stores the current driver in d1 and graphics mode in d2 ; if a new driver is selected in the listbox it updates the resolution and color depth listboxes so that they redraw ; if a new resolution is selected in the listbox it updates the color depth listbox .
/* record the new setting */ /* try to preserve the resolution */ /* record the new setting */ /* try to preserve the color depth */ /* record the new setting */ /* try to preserve the color depth */