Esempio n. 1
0
void traite_pleinecran(GEM_WINDOW *gwnd)
{
  GEM_WINDOW *wprog ;
  VXIMAGE    *vimage ;
  MFDB       out ;
  float      x_level, y_level, level ;
  int        xy[8] ;
  int        cp ;

  if ( gwnd == NULL ) return ;
  vimage = (VXIMAGE *) gwnd->Extension ;

  mouse_busy() ;
  x_level = (float)(Xmax-2)/(float)vimage->raster.fd_w ;
  y_level = (float)(Ymax-2)/(float)vimage->raster.fd_h ;
  if (x_level > y_level) level = y_level ;
  else                   level = x_level ;
  wprog = DisplayStdProg(msg[MSG_CALCREDUC], "", "", CLOSER ) ;
  out.fd_addr = NULL ;
  out.fd_w    = (int) ( 0.5 + (float)vimage->raster.fd_w * level ) ;
  out.fd_h    = (int) ( 0.5 + (float)vimage->raster.fd_h * level ) ;
/*  if (raster_pczoom(&vimage->raster, &out, level, level, wprog))*/
  if ( RasterZoom( &vimage->raster, &out, wprog ) )
  {
    GWDestroyWindow( wprog ) ;
    form_error(8) ;
    mouse_restore() ;
    return ;
  }
  GWDestroyWindow( wprog ) ;

  mouse_restore() ;

  cp = config.color_protect ;
  config.color_protect = 0 ;
  set_imgpalette( vimage ) ;
  cls_gemscreen() ;

  clear_buffers( MU_KEYBD | MU_BUTTON ) ;
  xy[0] = 0 ;
  xy[1] = 0 ;
  xy[2] = out.fd_w-1 ;
  xy[3] = out.fd_h-1 ;
  xy[4] = (Xmax-xy[2])/2 ;
  xy[5] = (Ymax-xy[3])/2 ;
  xy[6] = xy[4]+xy[2] ;
  xy[7] = xy[5]+xy[3] ;
  v_hide_c(handle) ;

  wind_update(BEG_UPDATE) ;
  vro_cpyfm(handle, S_ONLY, xy, &out, &screen) ;
  wait_for( MU_KEYBD | MU_BUTTON ) ;
  wind_update(END_UPDATE) ;

  free(out.fd_addr) ;
  restore_gemscreen(GemApp.Menu) ;
  v_show_c(handle, 1) ;
  config.color_protect = cp ;
  set_imgpalette( vimage ) ;
}
Esempio n. 2
0
main()
{
int i;
  init_screens ();                          /* Initialisiation du 2Šme ‚cran */

  gem_init();                    /* Se trouve dans fichier Include GEM_INEX.C */

  v_hide_c (handle);                        /* D‚sactiver pointeur souris */
  
  for (i=20; i<=300; i++)
  {
     Cconws ("\33E");                        /* Effacer ‚cran */
     v_gtext (handle, i, i, "Salut!");       /* Affichage texte sous GEM */
     swap_screens ();                        /* Commuter ‚crans log./phys. */
     
     Vsync();                                /* Attente retour image */
  }

  Crawcin();                                 /* Attente appui touche */

  Setscreen (screen1, screen1, -1);          /* Retour … l'‚cran normal */
  v_show_c (handle, 1);                      /* Pointeur souris actif */

  gem_exit();
}
Esempio n. 3
0
int cdecl draw_albumimg(PARMBLK *paramblk)
{
  WEXTENSION_ALBUM *wext = (WEXTENSION_ALBUM *) paramblk->pb_parm ;
  int              cxy[4] ;
  int              xy[8] ;

  if (wext->albumimg.fd_addr != NULL)
  {
    xy[0] = 0 ;
    xy[1] = 0 ;
    xy[2] = wext->albumimg.fd_w-1 ;
    xy[3] = wext->albumimg.fd_h-1 ;
    xy[4] = paramblk->pb_x ;
    xy[5] = paramblk->pb_y ;
    xy[6] = xy[4]+wext->albumimg.fd_w-1 ;
    xy[7] = xy[5]+wext->albumimg.fd_h-1 ;
    cxy[0] = paramblk->pb_xc ;
    cxy[1] = paramblk->pb_yc ;
    cxy[2] = paramblk->pb_xc+paramblk->pb_wc-1 ;
    cxy[3] = paramblk->pb_yc+paramblk->pb_hc-1 ;
    vs_clip(handle, 1, cxy) ;
    v_hide_c(handle) ;
    vro_cpyfm(handle, S_ONLY, xy, &wext->albumimg, &screen) ;
    v_show_c(handle, 1) ;
    vs_clip(handle, 0, cxy) ;
  }

  return(0) ;
}
Esempio n. 4
0
void display_status(int status)
{
  int x_align, y_align ;
  int xy[8] ;
  char txt[50] ;

  switch (status )
  {
    case STATUS_LOADING : strcpy( txt, "Loading..." ) ;
                          break ;

    case STATUS_SCALING : strcpy( txt, "Scaling..." ) ;
                          break ;

    case STATUS_WAITING : strcpy( txt, "Waiting..." ) ;
                          break ;

    default             : strcpy( txt, "          " ) ;
  }
  vsf_color( handle, back_color ) ;
  vsf_interior( handle, FIS_SOLID ) ;
  vqt_extent( handle, txt, xy ) ;
  xy[2] = xy[4] ; xy[3] = xy[5] ;
  yprog = xy[3] + ttype.hcar ;
  v_hide_c(handle) ;
  vr_recfl( handle, xy ) ;
  v_show_c(handle, 1) ;
  vst_alignment( handle, 0, 1, &x_align, &y_align ) ;
  aff_text( txt, 0, ttype.hcar, txt_color ) ;
  vst_alignment( handle, x_align, y_align, &x_align, &y_align ) ;
}
Esempio n. 5
0
int cdecl draw_currentcolor(PARMBLK *parmblock)
{ 
  WEXTENSION_PAL *wext = (WEXTENSION_PAL *) parmblock->pb_parm ;
  int            xyc[4], xy[4] ;
  	
  if (parmblock->pb_prevstate != parmblock->pb_currstate) return(0) ;
  
  xyc[0] = parmblock->pb_xc ;
  xyc[1] = parmblock->pb_yc ;
  xyc[2] = xyc[0]+parmblock->pb_wc ;
  xyc[3] = xyc[1]+parmblock->pb_hc ;
  vs_clip(handle, 1, xyc);
	
  vswr_mode(handle, MD_REPLACE) ;
  vsf_interior(handle, FIS_SOLID) ;	
  vsf_style(handle, 7) ;
  vsf_perimeter(handle, 1) ;
  vsf_color(handle, wext->index) ;
  xy[0] = parmblock->pb_x ;
  xy[1] = parmblock->pb_y ;
  xy[2] = parmblock->pb_x+parmblock->pb_w-1 ;
  xy[3] = parmblock->pb_y+parmblock->pb_h-1 ;
  v_hide_c(handle) ;
  v_bar(handle, xy) ;
  v_show_c(handle, 1) ;
  vs_clip(handle, 0, xyc) ;

  return(0) ;
}
Esempio n. 6
0
void update_raster(GEM_WINDOW *gwnd, int xmin, int ymin, int xmax, int ymax)
{
  VXIMAGE *vimage ;
  MFDB    zoom ;
  int     xy[8] ;
  int     cxy[4] ;
  int     xi, yi, wx, wy ;
  int     posx, posy ;
  int     zoom_level ;

  if ( gwnd == NULL ) return ;
  vimage = (VXIMAGE *) gwnd->Extension ;

  gwnd->GetWorkXYWH( gwnd, &xi, &yi, &wx, &wy ) ;
  posx = vimage->x1 ;
  posy = vimage->y1 ;

  if (xmax > Xmax) xmax = Xmax ;
  if (ymax > Ymax) ymax = Ymax ;
  zoom_level = vimage->zoom_level ;
  xy[0]  = xmin ; xy[1] = ymin ;
  xy[2]  = xmax ; xy[3] = ymax ;
  xy[4]  = posx+(xmin-xi) ;
  xy[5]  = posy+(ymin-yi) ;
  xy[6]  = xy[4]+(1+xmax-xmin)/zoom_level-1 ;
  xy[7]  = xy[5]+(1+ymax-ymin)/zoom_level-1 ;
  cxy[0] = xdesk ;         cxy[1] = ydesk ;
  cxy[2] = xdesk+wdesk-1 ; cxy[3] = ydesk+hdesk-1 ;
  vs_clip( handle, 1, cxy ) ;
  v_hide_c( handle ) ;
  if ( zoom_level == 1 )
    vro_cpyfm( handle, S_ONLY, xy, &screen, &vimage->raster ) ;
  else
  {
    int xyarray[8] ;

    memcpy(xyarray, xy, 8) ;
    xyarray[4] = xmin-xi ;
    xyarray[5] = ymin-yi ;
    xyarray[6] = xmax-xi ;
    xyarray[7] = ymax-yi ;
    vro_cpyfm(handle, S_ONLY, xyarray, &screen, &vimage->zoom) ;
    if (raster_zoom(&screen, &zoom, xy, -zoom_level, -zoom_level) == 0)
    {
      xy[0] = 0 ; xy[1] = 0 ;
      xy[2] = (1+xmax-xmin)/zoom_level-1 ;
      xy[3] = (1+ymax-ymin)/zoom_level-1 ;
      vro_cpyfm(handle, S_ONLY, xy, &zoom, &vimage->raster) ;
      free(zoom.fd_addr) ;
    }
  }
  v_show_c(handle, 0) ;
  vs_clip(handle, 0, cxy) ;
}
Esempio n. 7
0
void display_img( MFDB *mfdb, INFO_IMAGE *inf, VSS_INFO *vss_info,  char *name )
{
  int yt ;
  int xy[8] ;
  int off_x, off_y ;
  int x_align, y_align ;

  off_x = off_y = 0 ;
  xy[0] = xy[1] = 0 ;
  xy[2] = mfdb->fd_w - 1 ;
  if ( xy[2] > Xmax ) xy[2] = Xmax ;
  xy[3] = mfdb->fd_h - 1 ;
  if ( xy[3] > Ymax ) xy[3] = Ymax ;

  if ( Xmax > mfdb->fd_w )
    off_x = (Xmax-mfdb->fd_w)/2 ;
  if ( Ymax > mfdb->fd_h )
    off_y = (Ymax-mfdb->fd_h)/2 ;

  xy[4] = off_x ;
  xy[5] = off_y ;
  xy[6] = off_x + xy[2] ;
  xy[7] = off_y + xy[3] ;

  if ( !Truecolor && ( inf->palette != NULL ) )
    set_tospalette( inf->palette, (int) (inf->nb_cpal) ) ;

  if ( !vss_info->do_not_show_mouse )
    v_hide_c(handle) ;
    
  show_img( mfdb, xy, vss_info->transition ) ;
  if ( vss_info->aff_name )
  {
    yt = ttype.hcar ;
    vst_alignment( handle, 1, 1, &x_align, &y_align ) ;
    vqt_extent( handle, name, xy ) ;  
    aff_text( name, ( Xmax - xy[0] - xy[2] ) /2, yt, txt_color ) ;
    vst_alignment( handle, x_align, y_align, &x_align, &y_align ) ;
  }

  if ( vss_info->aff_prog )
  {
    char txt_prog[20] ;
  
    sprintf( txt_prog, "%d/%d", 1+num_courant, num_total ) ;
    vst_alignment( handle, 0, 2, &x_align, &y_align ) ;
    aff_text( txt_prog, 0, yprog, txt_color ) ;
    vst_alignment( handle, x_align, y_align, &x_align, &y_align ) ;
  }

  if ( !vss_info->do_not_show_mouse )
    v_show_c(handle, 1) ;
}
Esempio n. 8
0
static void GEM_ClearScreen(_THIS)
{
	short pxy[4];

	v_hide_c(VDI_handle);

	pxy[0] = pxy[1] = 0;
	pxy[2] = VDI_w - 1;
	pxy[3] = VDI_h - 1;
	GEM_ClearRect(this, pxy);

	v_show_c(VDI_handle, 1);
}
Esempio n. 9
0
void done( void )
{
	v_show_c( handle, 0 );
	v_clsvwk( handle );
	if (score>hiscore)
	{
		puts("\033HSie haben einen neuen Highscore erreicht!");
		printf("Geben Sie Ihren Namen ein: ");
		scanf("%126s",hiname);
		highfile=(int)Fcreate("HISCORE.DAT",0);
		Fwrite(highfile, 4, &score );
		Fwrite(highfile, 128, hiname );
		Fclose(highfile);
	}
}
Esempio n. 10
0
void sldcls_screen( VSS_INFO *vss_info, INFO_IMAGE *inf )
{
  int xyarray[4] ;

  compute_colors( vss_info, inf ) ;

  if ( !vss_info->do_not_cls_scr )
  {
    xyarray[0] = 0 ; xyarray[1] = 0 ;
    xyarray[2] = Xmax ; xyarray[3] = Ymax ;
    vsf_color( handle, back_color ) ;
    vsf_interior( handle, FIS_SOLID ) ;
    if ( !vss_info->do_not_show_mouse )
      v_hide_c(handle) ;
    vr_recfl(handle, xyarray) ;
    if ( !vss_info->do_not_show_mouse )
      v_show_c(handle, 1) ;
  }
}
Esempio n. 11
0
static void ShowCursor(GEM_WINDOW *gwnd, char show)
{
  HEX_DUMP *hex_dump = (HEX_DUMP *) gwnd->Extension ;

  if ( hex_dump->sel_is_xor != show )
  {
    int xy[8] ;
    int x, y, w, h, htline ;

    htline = hex_dump->h_char + hex_dump->interline ;
    GWGetWorkXYWH( gwnd, &x, &y, &w, &h ) ;
    xy[0] = xy[4] = x + ( hex_dump->nb_digits + 2 + (int)hex_dump->xcursor ) * hex_dump->w_char ;
    xy[1] = xy[5] = y + (int)(hex_dump->ycursor - hex_dump->ystart)* htline ;
    xy[2] = xy[6] = xy[0] + hex_dump->w_char - 1 ;
    xy[3] = xy[7] = xy[1] + hex_dump->h_char - 1 ;
    v_hide_c( handle ) ;
    vro_cpyfm( handle, D_INVERT, xy, &screen, &screen ) ;
    v_show_c( handle, 1 ) ;
    hex_dump->sel_is_xor = show ;
  }
}
Esempio n. 12
0
static void GEM_ClearScreen(_THIS)
{
    short rgb[3]= {0,0,0};
    short oldrgb[3];
    short pxy[4];

    v_hide_c(VDI_handle);

    vq_color(VDI_handle, vdi_index[0], 0, oldrgb);
    vs_color(VDI_handle, vdi_index[0], rgb);

    pxy[0] = pxy[1] = 0;
    pxy[2] = VDI_w - 1;
    pxy[3] = VDI_h - 1;
    vsf_color(VDI_handle,0);
    vsf_interior(VDI_handle,1);
    vsf_perimeter(VDI_handle,0);
    v_bar(VDI_handle,pxy);

    vs_color(VDI_handle, vdi_index[0], oldrgb);

    v_show_c(VDI_handle, 1);
}
Esempio n. 13
0
void rtzoom_display(int mx, int my, int from_screen)
{
  GEM_WINDOW *gwnd ;
  VXIMAGE *vimage = NULL ;
  FZOOM_DATA rt_data ;
  MFDB       *src ;
  char       *ck_code = (char *) reset ;
  clock_t    t0, t01 ;
  int        x1, x2, y1, y2 ;
  int        xi, yi, wx, wy ;
  int        xx1, yy1 ;
  int        xlimit, ylimit ;
  int        xy[8] ;
  int        do_it = 1 ;
  int        hide_mouse = ( from_screen && config.rt_hidemouse ) ;

  if ( WndRTZoom == NULL ) return ;
  if ( !config.use_rtzoom || RTZoomDisable ) return ;
  gwnd = GWGetWindow( mx, my ) ;
  if ( ( gwnd == NULL ) && !from_screen ) return ;
  if ( !from_screen && strcmp( gwnd->ClassName, VIMG_CLASSNAME ) ) return ;
  if ( gwnd ) vimage = (VXIMAGE *) gwnd->Extension ;

  t0 = clock() ;
  xx1 = yy1 = 0 ;
  if ( from_screen )
  {
    xi = yi = 0 ;
    wx = 1 + Xmax ;
    wy = 1 + Ymax ;
  }
  else
    gwnd->GetWorkXYWH( gwnd, &xi ,&yi, &wx, &wy ) ;

  if ( ( mx >= xi ) && ( my >= yi ) && ( mx < xi+wx ) && ( my < yi+wy ) )
  {
    if ( !from_screen )
    {
      x1     = vimage->x1 + ( mx - xi ) / vimage->zoom_level ;
      y1     = vimage->y1 + ( my - yi ) / vimage->zoom_level ;
      xlimit = vimage->raster.fd_w ;
      ylimit = vimage->raster.fd_h ;
      src    = &vimage->raster ;
    }
    else
    {
      x1     = mx ;
      y1     = my ;
      xlimit = 1 + Xmax ;
      ylimit = 1 + Ymax ;
      src    = &screen ;
    }
  }
  else
  {
    img_raz( &RTZoomSrc ) ;
    do_it = 0 ;
  }

  if ( do_it )
  {
    x2 = -1 + x1 + deltax ;
    x1 = x1 - deltax ;
    y2 = -1 + y1 + deltay ;
    y1 = y1 - deltay ;
    if ( ( x1 < 0 ) || ( y1 < 0 ) || ( x2 >= xlimit ) || ( y2 >= ylimit ) )
    {
      if ( x1 < 0 )
      {
        xx1 = -x1 ;
        x1  = 0 ;
        x2 += xx1 ;
      }
      if ( y1 < 0 )
      {
        yy1 = -y1 ;
        y1  = 0 ;
        y2 += yy1 ;
      }
      if ( x2 >= xlimit ) x2 = xlimit - 1 ;
      if ( y2 >= ylimit ) y2 = ylimit - 1 ;
      img_raz( &RTZoomSrc ) ;
      if ( StdVDINeeded ) img_raz( &RTZoomDstStd ) ;
      else                img_raz( &RTZoomDst ) ;
    }

    xy[0] = x1 ; xy[1] = y1 ;
    xy[2] = x2 ; xy[3] = y2 ;
    xy[4] = 0 ;  xy[5] = 0 ;
    xy[6] = x2 - x1 ;
    xy[7] = y2 - y1 ;
    if ( hide_mouse ) v_hide_c(handle) ;
    vro_cpyfm( handle, S_ONLY, xy, src, &RTZoomSrc ) ;
    if ( hide_mouse ) v_show_c(handle, 1) ;
    x1 = xy[4] ; y1 = xy[5] ;
    x2 = xy[6] ; y2 = xy[7] ;

    switch( config.rt_zoomlevel )
    {
      case 1 : 
                xy[0] = x1 ;  xy[1] = y1 ;
                xy[2] = x2 ;  xy[3] = y2 ;
                xy[4] = 0 ; xy[5] = 0 ;
                xy[6] = x2 - x1 ;
                xy[7] = y2 - y1 ;
                vro_cpyfm( handle, S_ONLY, xy, &RTZoomSrc, &RTZoomDst ) ;
                rtoffx = xx1 ;
                rtoffy = yy1 ;
                break ;
      default : 
                rt_data.src  = &RTZoomSrc ;
                rt_data.zoom = config.rt_zoomlevel ;
                rt_data.dst  = &RTZoomDst ;
                if ( StdVDINeeded )
                {
                  rt_data.std_src = &RTZoomSrcStd ;
                  rt_data.std_dst = &RTZoomDstStd ;
                }
                else
                {
                  rt_data.std_src = NULL ;
                  rt_data.std_dst = NULL ;
                }
                t01 = clock() ;
                FastZoom( &rt_data ) ;
                t1 += clock() - t01 ;
                nb++ ;
                rtoffx = xx1 * config.rt_zoomlevel ;
                rtoffy = yy1 * config.rt_zoomlevel ;
                break ;
    }
  }

  /* ANTI-CRACK */
  if ( ck_code[16] != 0x4E )
    key_protect2++ ; /* Crash en sortie */

  GWRePaint( WndRTZoom ) ;
  t += clock() - t0 ;
}
Esempio n. 14
0
int OnObjectNotifyPal(void *w, int obj)
{
  GEM_WINDOW     *wnd = (GEM_WINDOW *) w ;
  WEXTENSION_PAL *wext = wnd->DlgData->UserData ;
  OBJECT         *adr_mkpal = wnd->DlgData->BaseObject ;
  int            off_x, off_y ;
  int            xm, ym, dummy ;
  int            pb_x, pb_y ;
  int            x1, y1, x2, y2 ;
  int            code = -1 ;
  char           buf[15] ;

  graf_mkstate( &xm, &ym, &dummy, &dummy ) ;

  switch( obj )
  {
    case MKPAL_MRED      :
    case MKPAL_PRED      : if ( obj == MKPAL_PRED ) wext->curr_rgb[0]++ ;
                           else                     wext->curr_rgb[0]-- ;
                           if (wext->curr_rgb[0] < 1)    wext->curr_rgb[0] = 1 ;
                           if (wext->curr_rgb[0] > 1000) wext->curr_rgb[0] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[0])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_RED].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[0]) ;
                           write_text(adr_mkpal, MKPAL_TRED, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TRED ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_MGREEN    :
    case MKPAL_PGREEN    : if ( obj == MKPAL_PGREEN ) wext->curr_rgb[1]++ ;
                           else                       wext->curr_rgb[1]-- ;
                           if (wext->curr_rgb[1] < 1)    wext->curr_rgb[1] = 1 ;
                           if (wext->curr_rgb[1] > 1000) wext->curr_rgb[1] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[1])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[1]) ;
                           write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TGREEN ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_MBLUE     :
    case MKPAL_PBLUE     : if ( obj == MKPAL_PBLUE ) wext->curr_rgb[2]++ ;
                           else                      wext->curr_rgb[2]-- ;
                           if (wext->curr_rgb[2] < 1)    wext->curr_rgb[2] = 1 ;
                           if (wext->curr_rgb[2] > 1000) wext->curr_rgb[2] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[2])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[2]) ;
                           write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TBLUE ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_REDBOX    : 
                           objc_offset(adr_mkpal, MKPAL_RED, &off_x, &off_y) ;
                           if (ym > off_y) wext->curr_rgb[0] = wext->curr_rgb[0]-20 ;
                           else            wext->curr_rgb[0] = wext->curr_rgb[0]+20 ;
                           if (wext->curr_rgb[0] < 1)    wext->curr_rgb[0] = 1 ;
                           if (wext->curr_rgb[0] > 1000) wext->curr_rgb[0] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[0])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_RED].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[0]) ;
                           write_text(adr_mkpal, MKPAL_TRED, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TRED ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_GREENBOX  : 
                           objc_offset(adr_mkpal, MKPAL_GREEN, &off_x, &off_y) ;
                           if (ym > off_y) wext->curr_rgb[1] = wext->curr_rgb[1]-20 ;
                           else            wext->curr_rgb[1] = wext->curr_rgb[1]+20 ;
                           if (wext->curr_rgb[1] < 1)  wext->curr_rgb[1] = 1 ;
                           if (wext->curr_rgb[1] > 1000) wext->curr_rgb[1] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[1])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[1]) ;
                           write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TGREEN ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_BLUEBOX   : 
                           objc_offset(adr_mkpal, MKPAL_BLUE, &off_x, &off_y) ;
                           if (ym > off_y) wext->curr_rgb[2] = wext->curr_rgb[2]-20 ;
                           else            wext->curr_rgb[2] = wext->curr_rgb[2]+20 ;
                           if (wext->curr_rgb[2] < 1)    wext->curr_rgb[2] = 1 ;
                           if (wext->curr_rgb[2] > 1000) wext->curr_rgb[2] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[2])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[2]) ;
                           write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TBLUE ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_RED       : wext->curr_rgb[0] = (float) graf_slidebox(adr_mkpal, MKPAL_REDBOX, MKPAL_RED, 1) ;
                           off_y = (int) (wext->curr_rgb[0]*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_RED].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                           wext->curr_rgb[0] = 1000-wext->curr_rgb[0] ;
                           sprintf(buf, "%.4d", wext->curr_rgb[0]) ;
                           write_text(adr_mkpal, MKPAL_TRED, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TRED ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
     case MKPAL_GREEN    : wext->curr_rgb[1] = (float) graf_slidebox(adr_mkpal, MKPAL_GREENBOX, MKPAL_GREEN, 1) ;
                           off_y = (int) (wext->curr_rgb[1]*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                           wext->curr_rgb[1] = 1000-wext->curr_rgb[1] ;
                           sprintf(buf, "%.4d", wext->curr_rgb[1]) ;
                           write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TGREEN ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_BLUE      : wext->curr_rgb[2] = (float) graf_slidebox(adr_mkpal, MKPAL_BLUEBOX, MKPAL_BLUE, 1) ;
                           off_y = (int) (wext->curr_rgb[2]*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                           wext->curr_rgb[2] = 1000-wext->curr_rgb[2] ;
                           sprintf(buf, "%.4d", wext->curr_rgb[2]) ;
                           write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TBLUE ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_LOAD     : charge_palette() ;
                          deselect(adr_mkpal, obj) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, obj ) ;
                          wext->flag_aff = 0 ;
                          break ;
    case MKPAL_SAVE     : sauve_palette() ;
                          deselect(adr_mkpal, obj) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, obj ) ;
                          wext->flag_aff = 0 ;
                          break ;
    case MKPAL_START    :
    case MKPAL_END      : if ( obj == MKPAL_START ) wext->stdeg  = wext->index ;
                          else                      wext->enddeg = wext->index ;
                          if (selected(adr_mkpal, MKPAL_START) && selected(adr_mkpal, MKPAL_END))
                          {
                            deselect(adr_mkpal, MKPAL_START) ;
                            deselect(adr_mkpal, MKPAL_END) ;
                            xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_START ) ;
                            xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_END ) ;
                            cree_degrade(wext->stdeg, wext->enddeg) ;
                            wext->stdeg = wext->enddeg = 500 ;
                          }
                          break ;
    case MKPAL_APPLIQUE : read_text(adr_mkpal, MKPAL_TRED, buf) ;
                          wext->rgb[0] = atoi(buf) ;
                          off_y = (int) ((1000-wext->rgb[0])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_RED].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                          read_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                          wext->rgb[1] = atoi(buf) ;
                          off_y = (int) ((1000-wext->rgb[1])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                          read_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                          wext->rgb[2] = atoi(buf) ;
                          off_y = (int) ((1000-wext->rgb[2])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                          vs_color(handle, wext->index, wext->rgb) ;
                          deselect(adr_mkpal, obj) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, obj ) ;
                          break ;
    case MKPAL_BOX      : objc_offset(adr_mkpal, obj, &pb_x, &pb_y) ;
                          if (wext->flag_aff)
                          {
                            x1 = pb_x+(wext->index % wext->nb_col_x)*wext->ww ;
                            y1 = pb_y+(wext->index / wext->nb_col_x)*wext->hh ;
                            x2 = x1+wext->ww-1 ;
                            y2 = y1+wext->hh-1 ;
                            vsf_color(handle, 1) ;
                            vswr_mode(handle, MD_XOR) ;
                            vsl_width(handle, 3) ;
                            v_hide_c(handle) ;
                            rectangle(x1, y1, x2, y2) ;
                            v_show_c(handle, 1) ;
                          }
                          else wext->flag_aff = 1 ;
                          graf_mkstate(&xm, &ym, &dummy, &dummy) ;
                          wext->index = (xm-pb_x)/wext->ww+ wext->nb_col_x*((ym-pb_y)/wext->hh) ;
                          vq_color(handle, wext->index, 0, wext->rgb) ;
                          sprintf(buf, "%.4d", wext->rgb[0]) ;
                          write_text(adr_mkpal, MKPAL_TRED, buf) ;
                          sprintf(buf, "%.4d", wext->rgb[1]) ;
                          write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                          sprintf(buf, "%.4d", wext->rgb[2]) ;
                          write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_RGB ) ;
                          x1 = pb_x+wext->ww*((xm-pb_x)/wext->ww) ;
                          y1 = pb_y+wext->hh*((ym-pb_y)/wext->hh) ;
                          x2 = x1+wext->ww-1 ;
                          y2 = y1+wext->hh-1 ;
                          vsf_color(handle, 1) ;
                          v_hide_c(handle) ;
                          vswr_mode(handle, MD_XOR) ;
                          vsl_width(handle, 3) ;
                          rectangle(x1, y1, x2, y2) ;
                          v_show_c(handle, 1) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_CURRCOL ) ;
                          off_y = (int) ((1000-wext->rgb[0])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_RED].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                          off_y = (int) ((1000-wext->rgb[1])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                          off_y = (int) ((1000-wext->rgb[2])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                          break ;
     case MKPAL_OK      : code = IDOK ;
                          break ;
     case MKPAL_CANCEL  : code = IDCANCEL ;
                          break ;
  }

  if ( code == IDOK )
  {

  }

  return( code ) ;
}
Esempio n. 15
0
void vss_doslideshow( VSS_INFO *vss_info )
{
  GEM_WINDOW *wprog ;
  int        (*OnKeyPressed)(int key) ;
  INFO_IMAGE inf ;
  MFDB       mfdb ;
  CMD        *cmd ;
  int        fini = 0 ;
  int        current_pal[256*3] ;
  int        n ;
  int        load_ret ;

  OnKeyPressed        = GemApp.OnKeyPressed ;
  GemApp.OnKeyPressed = OnKeyPressedSldShow ;
  get_tospalette( current_pal ) ;
  cmd = vss_info->cmds ;
  if ( cmd == NULL ) fini = 1 ;
  if ( vss_info->do_not_show_mouse )
    v_hide_c( handle ) ;

  /* Prend la configuration courante */
  vss_info->wait_mini_sec     = config.wait_mini_sec ;
  vss_info->do_not_show_mouse = config.do_not_show_mouse ;
  vss_info->do_not_cls_scr    = config.do_not_cls_scr ;
  vss_info->back              = config.back ;
  vss_info->display_type      = config.display_type ;
  vss_info->transition        = config.transition ;
  vss_info->cycle             = config.cycle ;
  vss_info->ignore_vss        = config.ignore_vss ;
  vss_info->aff_name          = config.aff_name ;
  vss_info->aff_prog          = config.aff_prog ;

  if ( Truecolor )
  {
    int rvb_blanc[3] = { 1000, 1000, 1000 } ;
    int rvb_noir[3]  = {    0,    0,    0 } ;
  
    vs_color(handle, 20, rvb_blanc) ;
    vs_color(handle, 21, rvb_noir) ;
  }  
  stop_sldshow = 0 ;
  num_courant  = 0 ;
  wprog = DisplayStdProg( "", "", "", 0 ) ;
  GWShowWindow( wprog, 0 ) ;
  while ( !fini )
  {
    nb_steps = 0 ;
    switch( cmd->cmd_id )
    {
      case CMD_DISPLAY     : load_ret = load_nextimg( cmd->params, &mfdb, &inf, vss_info, wprog ) ;
                             if ( load_ret == 0 )
                             {
                               compute_colors( vss_info, &inf ) ;
                               if ( ( num_courant > 0 ) && ( wait_for_event( vss_info ) < 0 ) )
                                 fini = 1 ;
                               else
                               {
                                 sldcls_screen( vss_info, &inf ) ;
                                 display_img( &mfdb, &inf, vss_info, cmd->params ) ;
                               }
                             }
                             if ( load_ret == 0 )
                             {
                               if ( inf.palette != NULL ) free( inf.palette ) ;
                               if ( mfdb.fd_addr != NULL ) free( mfdb.fd_addr ) ;
                             }
                             nb_steps++ ;
                             break ;
      default              : /* Impossible */
                             break ;
    }

    for (n = 0; n < nb_steps; n++ )
    {
      if ( cmd != NULL )
      {
        cmd = cmd->next_cmd ;
        num_courant++ ;
      }

      if ( (cmd == NULL ) && vss_info->cycle )
      {
        cmd = vss_info->cmds ;
        num_courant = 0 ;
      }
    }
    if ( stop_sldshow || !cmd ) fini = 1 ;
  }

  if ( !cmd )
  {
    PerfInfo.total_load_time = 0 ;
    wait_for_event( vss_info ) ;
  }
  restore_gemscreen( GemApp.Menu ) ;
  set_tospalette( current_pal, nb_colors ) ;
  if ( vss_info->do_not_show_mouse )
    v_show_c( handle, 1 ) ;

  GWDestroyWindow( wprog ) ;
  GemApp.OnKeyPressed = OnKeyPressed ;
}
Esempio n. 16
0
global
void showm(void)
{	v_show_c(C.vh, 1);	}
Esempio n. 17
0
global
void forcem(void)
{
	v_show_c(C.vh, 0);
}
Esempio n. 18
0
cz1pars()
{
   FDB savefdb;
   int mousex,mousey,mstate,i,kstate;
   int done=0;
   int mbefore=0;
   int key,event;

/* grab mouse control off of AES */
   wind_update(3);
/* turn clipping off during all of module 7 */
   vs_clip(gl_hand,0,&dummy);   

/* save screen which will lie under cz1pars window */
   savefdb.fd_addr= saveptr;
   savefdb.fd_w= 640;
   savefdb.fd_h= 200*rez;
   savefdb.fd_wdwidth= 40;
   savefdb.fd_stand= 0;
   if (rez==1)
      savefdb.fd_nplanes= 2;
   else
      savefdb.fd_nplanes= 1;
   xyarray[0]= cz1_xy[0]; xyarray[1]= rez*cz1_xy[1]; 
   xyarray[2]= cz1_xy[2]; xyarray[3]= rez*cz1_xy[7];
   xyarray[4]= 0;   xyarray[5]= 0;
   xyarray[6]= cz1_xy[2]-cz1_xy[0];   xyarray[7]= rez*(cz1_xy[7]-cz1_xy[1]);
   v_hide_c(gl_hand);   
   if (saveptr) vro_cpyfm(gl_hand,3,xyarray,&scrfdb,&savefdb);
   v_show_c(gl_hand,0); 
   graf_growbox((cz1_xy[0]+cz1_xy[2])/2,rez*(cz1_xy[1]+cz1_xy[5])/2,1,1,
                cz1_xy[0],cz1_xy[1],
                cz1_xy[2]-cz1_xy[0]+1,rez*(cz1_xy[7]-cz1_xy[1])+1);
   cz1_wind();     /* put up cz1pars window */

/* executive loop */
   while (!done)
   {
      vq_mouse(gl_hand,&mstate,&mousex,&mousey);
      kstate=Kbshift(0xffff);
      if ((mstate&3)&&!mbefore)
         done= do_cz1(mousex,mousey,mstate,kstate);
      event= evnt_multi(MU_TIMER|MU_KEYBD,0,0,0,0,0,0,0,0,0,0,0,0,0,
             &dummy,1,0,&mousex,&mousey,&dummy,&dummy,&key,&dummy);    
      if ((event & MU_KEYBD)&&(key==0x6100)) cz1_undo(mousex,mousey);
      mbefore=mstate;
   }

   vs_clip(gl_hand,0,&dummy);   /* turn clipping off (clobbered by redraw */
/* restore the screen */
   xyarray[0]= 0;    xyarray[1]= 0;   
   xyarray[2]= cz1_xy[2]-cz1_xy[0];   xyarray[3]= rez*(cz1_xy[7]-cz1_xy[1]);
   xyarray[4]= cz1_xy[0];  xyarray[5]= rez*cz1_xy[1];  
   xyarray[6]= cz1_xy[2];  xyarray[7]= rez*cz1_xy[7];
   if (saveptr)
   {
      v_hide_c(gl_hand);
      vro_cpyfm(gl_hand,3,xyarray,&savefdb,&scrfdb);
      v_show_c(gl_hand,0);
   }
   else
      redraw(ws_hand,cz1_xy[0],rez*cz1_xy[1],
             cz1_xy[2]-cz1_xy[0]+1,rez*(cz1_xy[7]-cz1_xy[1])+1);
   graf_shrinkbox((cz1_xy[0]+cz1_xy[2])/2,rez*(cz1_xy[1]+cz1_xy[5])/2,1,1,
                cz1_xy[0],cz1_xy[1],
                cz1_xy[2]-cz1_xy[0]+1,rez*(cz1_xy[7]-cz1_xy[1])+1);   
/* return mouse control to AES */
   wind_update(2);

} /* end cz1pars() */
Esempio n. 19
0
/*
	area: the browser canvas
*/
void browser_redraw_caret( struct gui_window * gw, LGRECT * area )
{
	// TODO: only redraw caret when window is topped.
	if( gw->browser->caret.redraw && gw->browser->caret.requested.g_w > 0 ){
		LGRECT caret;
		struct s_browser * b = gw->browser;
		struct rect old_clip;
		struct rect clip;

		if( b->caret.current.g_w > 0 && b->caret.background.fd_addr != NULL ){
			browser_restore_caret_background( gw, area );
		}

		caret = b->caret.requested;
		caret.g_x -= b->scroll.current.x - area->g_x;
		caret.g_y -= b->scroll.current.y - area->g_y;

		if( !rc_lintersect( area, &caret ) ) {
			return;
		}

		MFDB screen;
		short pxy[8];

		/* save background: */
		//assert( b->caret.background.fd_addr == NULL );
		init_mfdb( app.nplanes, caret.g_w, caret.g_h, 0,
					&b->caret.background );
		init_mfdb( 0, caret.g_w, caret.g_h, 0, &screen );
		pxy[0] = caret.g_x;
		pxy[1] = caret.g_y;
		pxy[2] = caret.g_x + caret.g_w - 1;
		pxy[3] = caret.g_y + caret.g_h - 1;
		pxy[4] = 0;
		pxy[5] = 0;
		pxy[6] = caret.g_w - 1;
		pxy[7] = caret.g_h - 1;
		/* hide the mouse */
		v_hide_c ( app.graf.handle);
		/* copy screen image */
		vro_cpyfm ( app.graf.handle, S_ONLY, pxy, &screen, &b->caret.background);
		/* draw caret: */
		caret.g_x -= area->g_x;
		caret.g_y -= area->g_y;
		clip.x0 = caret.g_x;
		clip.y0 = caret.g_y;
		clip.x1 = caret.g_x + caret.g_w-1;
		clip.y1 = caret.g_y + caret.g_h-1;
		/* store old clip before adjusting it: */
		plot_get_clip( &old_clip );
		/* clip to cursor: */
		plot_clip( &clip );
		plot_line( caret.g_x, caret.g_y, caret.g_x, caret.g_y + caret.g_h,
					plot_style_caret );
		/* restore old clip area: */
		plot_clip( &old_clip );
		/* restore the mouse */
		v_show_c ( app.graf.handle, 1);
		b->caret.current.g_x = caret.g_x + gw->browser->scroll.current.x;
		b->caret.current.g_y = caret.g_y + gw->browser->scroll.current.y;
		b->caret.current.g_w = caret.g_w;
		b->caret.current.g_h = caret.g_h;
	}
}
Esempio n. 20
0
static void SmartRePaint(GEM_WINDOW *gwnd, long old_ystart)
{
  HEX_DUMP      *hex_dump = (HEX_DUMP *) gwnd->Extension ;
  long          i, dy, line_size ;
  int           xy[8], xyr[8], xyc[4] ;
  int           rx, ry, rw, rh, x, y, w, h  ;
  int           htline ;
  int           smart_possible = 0 ;
  unsigned char *fmt_txt = (unsigned char*)hex_dump->formatted_txt + hex_dump->nb_max_lines_on_window * sizeof(char*) ;

  wind_get( gwnd->window_handle, WF_FIRSTXYWH, &rx, &ry, &rw, &rh ) ;
  GWGetWorkXYWH( gwnd, &x, &y, &w, &h ) ;
  if ( ( rx == x ) && ( ry == y ) && ( rw == w ) && ( rh == h ) ) smart_possible = 1 ;

  hex_dump->ystart_fmt = hex_dump->ystart ;
  if ( smart_possible )
  {
    line_size = 1L + hex_dump->total_nb_char_on_line ;
    htline    = hex_dump->h_char + hex_dump->interline ;
    dy        = hex_dump->ystart - old_ystart ;
    if ( labs( dy ) < hex_dump->nb_lines_on_window )
    {
      xy[0]  = xy[4] = xyr[0] = x ;
      xy[2]  = xy[6] = xyr[2] = x + w - 1 ;
      if ( dy > 0 )
      {
        xy[1]  = y + (int)dy * htline ;
        xy[3]  = y + (int)hex_dump->nb_lines_on_window * htline - 1 ;
        xy[5]  = y ;
        xy[7]  = y + (int)( hex_dump->nb_lines_on_window - dy ) * htline - 1 ;
        xyr[1] = 1 + xy[7] ;
        xyr[3] = (int)dy * htline - 1 ;
        memmove( fmt_txt, fmt_txt + dy * line_size, ( hex_dump->nb_lines_on_window - dy ) * line_size ) ;
        for ( i = dy; i > 0; i-- ) FormatLine( hex_dump, old_ystart + hex_dump->nb_lines_on_window + i - 1 ) ;
      }
      else
      {
        xy[1]  = y ;
        xy[3]  = y + (int)( hex_dump->nb_lines_on_window + dy ) * htline - 1 ;
        xy[5]  = y - (int)dy * htline ;
        xy[7]  = y + (int)hex_dump->nb_lines_on_window * htline - 1 ;
        xyr[1] = xy[1] ;
        xyr[3] = (int)( hex_dump->nb_lines_on_window + dy ) * htline  - 1 ;
        memmove( fmt_txt - dy * line_size, fmt_txt, ( hex_dump->nb_lines_on_window + dy ) * line_size ) ;
        for ( i = dy; i < 0; i++ ) FormatLine( hex_dump, old_ystart + i ) ;
      }
      v_hide_c( handle ) ;
      vro_cpyfm( handle, S_ONLY, xy, &screen, &screen ) ;
      xyc[0] = x ; xyc[1] = y ; xyc[2] = x + w - 1 ; xyc[3] = y + h - 1 ;
      vs_clip( handle, 1, xyc ) ;
      OnDraw( gwnd, xyr ) ;
      vs_clip( handle, 0, xyc ) ;
      v_show_c( handle, 1 ) ;
    }
    else smart_possible = 0 ;
  }

  if ( !smart_possible )
  {
    for ( i = hex_dump->ystart_fmt; i < hex_dump->ystart_fmt + hex_dump->nb_lines_on_window; i++ )
      FormatLine( hex_dump, i ) ;
    GWRePaint( gwnd ) ;
  }
  UpdateVSlider( gwnd ) ;
}
Esempio n. 21
0
static int OnKeyPressed(void *wnd, int key)
{
  GEM_WINDOW    *gwnd = (GEM_WINDOW *) wnd ;
  HEX_DUMP      *hex_dump = (HEX_DUMP *) gwnd->Extension ;
  long          old_xcursor, old_ycursor, old_ystart, offset ;
  int           htline, code = GW_EVTCONTINUEROUTING ;
  unsigned char new_val, input_valid = 0, plus = 0 ;

  old_xcursor = hex_dump->xcursor ;
  old_ycursor = hex_dump->ycursor ;
  old_ystart  = hex_dump->ystart ;
  ShowCursor( gwnd, 0 ) ;
  switch( key )
  {
	case FERMER      : gwnd->OnClose( gwnd ) ;
                       code = GW_EVTSTOPROUTING ;
				  	   break ;

	case SAUVE       : SaveFile( gwnd, 0 ) ;
                       code = GW_EVTSTOPROUTING ;
					   break ;

	case SAUVES      : SaveFile( gwnd, 1 ) ;
                       code = GW_EVTSTOPROUTING ;
  					   break ;

    case CURSOR_RT :   hex_dump->xcursor++ ;
                       if ( hex_dump->xcursor >= hex_dump->sizeof_raw_offset_array ) hex_dump->xcursor = hex_dump->sizeof_raw_offset_array - 1 ;
                       plus = 1 ;
                       code = GW_EVTSTOPROUTING ;
                       break ;

    case CURSOR_SLT :  hex_dump->xcursor = SearchNextBlock( hex_dump, hex_dump->xcursor, -1L ) ;
                       code = GW_EVTSTOPROUTING ;
                       break ;

    case CURSOR_LT :   hex_dump->xcursor-- ;
                       if ( hex_dump->xcursor < 0 ) hex_dump->xcursor = 0 ;
                       code = GW_EVTSTOPROUTING ;
                       break ;

    case CURSOR_SRT :  hex_dump->xcursor = SearchNextBlock( hex_dump, hex_dump->xcursor, 1L ) ;
                       code = GW_EVTSTOPROUTING ;
                       break ;

    case CURSOR_UP :   hex_dump->ycursor-- ;
                       if ( hex_dump->ycursor < 0 ) hex_dump->ycursor = 0 ;
                       code = GW_EVTSTOPROUTING ;
                       break ;

    case CURSOR_SUP :  hex_dump->ystart  -= hex_dump->nb_lines_on_window ;
                       hex_dump->ycursor -= hex_dump->nb_lines_on_window ;
                       code = GW_EVTSTOPROUTING ;
                       break ; 

    case CURSOR_DN :   hex_dump->ycursor++ ;
                       if ( hex_dump->ycursor > hex_dump->total_nb_lines ) hex_dump->ycursor = hex_dump->total_nb_lines ;
                       code = GW_EVTSTOPROUTING ;
                       break ;

    case CURSOR_SDN :  hex_dump->ystart  += hex_dump->nb_lines_on_window ;
                       hex_dump->ycursor += hex_dump->nb_lines_on_window ;
                       code = GW_EVTSTOPROUTING ;
                       break ; 

    default         :  offset = GetOffset( hex_dump, GetRawOffsetForXCursor( hex_dump, hex_dump->xcursor ), hex_dump->ycursor ) ;
                       key   &= 0xFF ;
                       input_valid = KeyPressed( hex_dump, offset, key, &new_val ) ;
                       if ( input_valid )
                       {
                         int xy[4] ;

                         hex_dump->raw_data[offset] = new_val ;
                         FormatLine( hex_dump, hex_dump->ycursor ) ;
                         hex_dump->xcursor++ ;
                         if ( hex_dump->xcursor >= hex_dump->sizeof_raw_offset_array ) hex_dump->xcursor = hex_dump->sizeof_raw_offset_array - 1 ;
                         htline = hex_dump->h_char + hex_dump->interline ;
                         GWGetWorkXYWH( gwnd, &xy[0], &xy[1], &xy[2], &xy[3] ) ;
                         xy[1] += (int)( hex_dump->ycursor - hex_dump->ystart ) * htline ;
                         xy[3]  = htline ;
                         v_hide_c( handle ) ;
                         OnDraw( gwnd, xy ) ;
                         v_show_c( handle, 1 ) ;
                         plus = 1 ;
                         SetModif( gwnd, 1 ) ;
                         code = GW_EVTSTOPROUTING ;
                       }
                       break ;
  }

  CheckYCursorValid( hex_dump ) ;
  CheckXCursorValid( hex_dump, plus ) ;
  CheckValid( hex_dump ) ;

  if ( ( old_xcursor != hex_dump->xcursor ) || ( old_ycursor != hex_dump->ycursor ) ) SmartInfos( gwnd ) ;
  if ( old_ystart != hex_dump->ystart ) SmartRePaint( gwnd, old_ystart ) ;

  return( code ) ;
}
Esempio n. 22
0
void pleine_page(GEM_WINDOW *gwnd)
{
  VXIMAGE *vimage ;
  EVENT evnt ;
  int   xyarray[8] ;
  int   largeur, hauteur ;
  int   posx, posy ;
  int   which ;
  int   unit ;
  char  xscroll, yscroll ;
  char  fin = 0 ;
  char  cp ;
  
  if ( gwnd == NULL ) return ;
  vimage = (VXIMAGE *) gwnd->Extension ;

  memset( &evnt, 0, sizeof(EVENT) ) ;
  evnt.ev_mflags    = MU_KEYBD | MU_BUTTON | MU_TIMER ;
  evnt.ev_mbclicks  = 258 ; evnt.ev_bmask = 3 ;
 
  cls_gemscreen() ;
  wind_update(BEG_UPDATE) ;
  cp = config.color_protect ;
  config.color_protect = 0 ;
  set_imgpalette( vimage ) ;
  v_hide_c(handle) ;
  
  largeur = vimage->raster.fd_w ;
  hauteur = vimage->raster.fd_h ;
  posx    = (1+Xmax-largeur)/2 ;
  if (posx < 0) posx = 0 ;
  posy = (1+Ymax-hauteur)/2 ;
  if (posy < 0) posy = 0 ;
  xscroll = 0 ;
  yscroll = 0 ;
  
  if (posx == 0)
  {
    xyarray[0] = 0 ;
    xyarray[2] = Xmax ;
    xscroll    = 1 ;
  }
  else
  {
    xyarray[0] = 0 ;
    xyarray[2] = largeur-1 ;
  }
  
  if (posy == 0)
  {
    xyarray[1] = 0 ;
    xyarray[3] = Ymax ;
    yscroll    = 1 ;
  }
  else
  {
    xyarray[1] = 0 ;
    xyarray[3] = hauteur-1 ;
  }
  
  xyarray[4] = posx ; xyarray[5] = posy ;
  xyarray[6] = posx+xyarray[2]-xyarray[0] ;
  xyarray[7] = posy+xyarray[3]-xyarray[1]  ;
  vro_cpyfm(handle, S_ONLY, xyarray, &vimage->raster, &screen) ;

  do
  {
    which = EvntMulti( &evnt ) ;
    if ( which & MU_KEYBD )
    {
      unit = 4 ;
	  switch( evnt.ev_mkreturn )
	  {
        case CURSOR_SUP: unit = 32 ;
	    case CURSOR_UP : if ( yscroll )
	                     {
	                       xyarray[1] -= unit ;
	                       xyarray[3] -= unit ;
	                       if (xyarray[1] < 0)
	                       {
	                         xyarray[1] = 0 ;
	                         xyarray[3] = Ymax ;
	                       }
                           vro_cpyfm(handle, S_ONLY, xyarray, &vimage->raster, &screen) ;
                         }
	                     break ;

        case CURSOR_SDN: unit = 32 ;
	    case CURSOR_DN : if (yscroll)
	                     {
	                       xyarray[1] += unit ;
	                       xyarray[3] += unit ;
	                       if (xyarray[3] > hauteur-1)
	                       {
	                         xyarray[3] = hauteur-1 ;
	                         xyarray[1] = hauteur-Ymax-1 ;
	                       }
                           vro_cpyfm(handle, S_ONLY, xyarray, &vimage->raster, &screen) ;
                         }
	                     break ;

        case CURSOR_SLT: unit = 32 ;
	    case CURSOR_LT : if (xscroll)
	                     {
	                       xyarray[0] -= unit ;
	                       xyarray[2] -= unit ;
	                       if (xyarray[0] < 0)
	                       {
	                         xyarray[0] = 0 ;
	                         xyarray[2] = Xmax ;
	                       }
                           vro_cpyfm(handle, S_ONLY, xyarray, &vimage->raster, &screen) ;
                         }
	                     break ;

        case CURSOR_SRT: unit = 32 ;
	    case CURSOR_RT : if (xscroll)
	                     {
	                       xyarray[0] += unit ;
	                       xyarray[2] += unit ;
	                       if (xyarray[2] > largeur-1)
	                       {
	                         xyarray[2] = largeur-1 ;
	                         xyarray[0] = largeur-Xmax-1 ;
	                       }
                           vro_cpyfm(handle, S_ONLY, xyarray, &vimage->raster, &screen) ;
                         }
	                     break ;

        case QUITTER :   fin = 1 ;
                         break ;

	    default        : fin = 1 ;
	                     break ;
      }
    }
    if ( which & MU_BUTTON ) fin = 1 ;
  }
  while ( !fin ) ;

  restore_gemscreen(GemApp.Menu) ;
  v_show_c(handle, 1) ;
  config.color_protect = cp ;
  set_imgpalette( vimage ) ;
  wind_update(END_UPDATE) ;
}