home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / cdplay2 / general.c < prev    next >
C/C++ Source or Header  |  1993-02-21  |  2KB  |  80 lines

  1. #include <aes.h>
  2. #include <vdi.h>
  3. #include <tos.h>
  4. #include "CDPlayer.h"
  5. #include "Chinon.h"
  6. #include "globals.h"
  7.  
  8. int          w_hand ;
  9. int          v_hand ;
  10. int          vw[4] ;
  11. int             cwidth, cheight, bwidth, bheight ;
  12. int          work_in[11] = {1,1,1,1,1,1,1,1,1,1,2} ;
  13. int          work_out[57] ;
  14.  
  15. void Create_Window(void)
  16. {
  17.   form_center(form_addr, cntr.x, cntr.y, cntr.w, cntr.h) ;
  18.   w_hand = wind_create(0, cx, cy, cw, ch) ;
  19.   wind_open(w_hand, cx, cy, cw, ch) ;
  20.   v_hand = graf_handle(&cwidth, &cheight, &bwidth, &bheight) ;
  21.   v_opnvwk(work_in, &v_hand, work_out) ;
  22.  
  23. }
  24.  
  25. void Update_Window(int object)
  26. {
  27.   wind_update(BEG_UPDATE) ;
  28.   wind_get(w_hand, WF_FIRSTXYWH, &cx, &cy, &cw, &ch) ;
  29.   while (cw && ch)
  30.   {
  31.     vw[0] = cx ;
  32.     vw[1] = cy ;
  33.     vw[2] = cx + cw - 1 ;
  34.     vw[3] = cy + ch - 1 ;
  35.     vs_clip(v_hand, 1, vw) ;
  36.     objc_draw(form_addr, object, MAX_DEPTH, cx, cy, cw, ch) ;
  37.     wind_get(w_hand, WF_NEXTXYWH, &cx, &cy, &cw, &ch) ;
  38.   }
  39.   wind_update(END_UPDATE) ;
  40. }
  41.  
  42. void Remove_Window(void)
  43. {
  44.   v_clsvwk(v_hand) ;
  45.   wind_close(w_hand) ;
  46.  
  47.   wind_delete(w_hand) ;
  48. }
  49.  
  50. int Process_Message(void)
  51. {
  52. int nowhere ;
  53.  
  54.   switch (ev_buffer[0])
  55.   {
  56.     case MN_SELECTED : if (ev_buffer[4] == QUIT)
  57.                          return TRUE ;
  58.     case WM_REDRAW   : Update_Window(panel_id) ;
  59.                        break ;
  60.     case WM_NEWTOP   :
  61.     case WM_TOPPED   : wind_set(ev_buffer[3], WF_TOP, &nowhere,
  62.                                 &nowhere, &nowhere, &nowhere) ;
  63.                        break ;
  64.   }
  65.   return FALSE ;
  66. }
  67.  
  68. double Get_Time_Remain()
  69. {
  70.   read_sub_channel() ;
  71.  
  72.   if (sub_channel.audio_status == AUDIO_STATUS_PLAY)
  73.   {
  74.     current_track = BCD_to_UCHAR(sub_channel.track) - 1 ;
  75.     return ( t_sec(&(toc.tracks[current_track + 1].addr)) 
  76.            - t_sec(&(sub_channel.abs_addr)) ) ;
  77.   }
  78.   else
  79.     return ((double)0.0) ;
  80. }