home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d111 / amyload.lha / AmyLoad / scrollwindow.c < prev    next >
C/C++ Source or Header  |  1987-11-15  |  2KB  |  65 lines

  1. #include    <intuition/intuition.h>
  2. #include    <devices/load.h>
  3. #include    "execdef.h"
  4. #include    "intuidef.h"
  5. #include    "windowinfo.h"
  6. #include    "loadrecord.h"
  7.  
  8. #include    "ScrollWindow.proto"
  9.  
  10. #include    <exec/proto.h>
  11. #include    <graphics/proto.h>
  12.  
  13. #include    "NewScale.proto"
  14. #include    "FindMaxDataPoint.proto"
  15. #include    "DrawScaleReferenceLines.proto"
  16. #include    "RedrawWindow.proto"
  17.  
  18. void
  19. ScrollWindow(window)
  20.     Window *window;
  21. {
  22.     WindowInfo *window_info;
  23.     short scroll_distance;
  24.     Bool  new_scale;
  25.     LoadRecord *record;
  26.  
  27.     window_info = WINDOWINFO(window);
  28.     new_scale = FALSE;
  29.     scroll_distance = (window_info->width + 1) >> 1;
  30.  
  31.     for (record = (LoadRecord *)window_info->loadrecords.mlh_Head;
  32.      record->node.mln_Succ; record = (LoadRecord *)record->node.mln_Succ)
  33.     {
  34.     /* Scroll the data. */
  35.     CopyMemQuick(record->start_data + scroll_distance,
  36.              record->start_data,
  37.              (window_info->width - scroll_distance) * sizeof(LoadDataValue));
  38.     record->next_data -= scroll_distance;
  39.     record->max_data -= scroll_distance;
  40.     if (record->max_data < record->start_data)
  41.         FindMaxDataPoint(record);
  42.     if (record->scale)
  43.         new_scale = NewScale(window_info, record, *record->max_data) || new_scale;
  44.     }
  45.  
  46.     /* Scroll the window. */
  47.     if (new_scale)
  48.     RedrawWindow(window);
  49.     else
  50.     {
  51.     ScrollRaster(window->RPort,
  52.              (short)((window_info->width + 1) >> 1),
  53.              (short)0,
  54.              window_info->leftedge,
  55.              window_info->topedge,
  56.              window_info->rightedge,
  57.              window_info->bottomedge);
  58.  
  59.     for (record = (LoadRecord *)window_info->loadrecords.mlh_Head;
  60.          record->node.mln_Succ; record = (LoadRecord *)record->node.mln_Succ)
  61.         if (record->scale)
  62.         DrawScaleReferenceLines(window, record, (short)(window_info->width - scroll_distance));
  63.     }
  64. }
  65.