home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d1xx
/
d111
/
amyload
/
newwindowsize.c
< prev
next >
Wrap
C/C++ Source or Header
|
1987-11-15
|
2KB
|
51 lines
#include <intuition/intuition.h>
#include <devices/load.h>
#include <clib/macros.h>
#include "execdef.h"
#include "intuidef.h"
#include "windowinfo.h"
#include "loadrecord.h"
#include "NewWindowSize.proto"
#include <exec/proto.h>
#include "SetWindowInfo.proto"
#include "FindMaxDataPoint.proto"
#include "RedrawWindow.proto"
Bool
NewWindowSize(window)
Window *window;
{
LoadDataValue *new_start_data;
short number_data_points_to_copy;
LoadRecord old_record, *record;
SetWindowInfo(window);
for (record = (LoadRecord *)WINDOWINFO(window)->loadrecords.mlh_Head;
record->node.mln_Succ;
record = (LoadRecord *)record->node.mln_Succ)
{
old_record = *record;
if (!(new_start_data = (LoadDataValue *)AllocMem(WINDOWINFO(window)->width * sizeof(LoadDataValue), 0)))
return FALSE;
record->start_data = new_start_data;
record->end_data = record->start_data + WINDOWINFO(window)->width;
number_data_points_to_copy = MIN(old_record.next_data - old_record.start_data, WINDOWINFO(window)->width);
record->next_data = record->start_data + number_data_points_to_copy;
record->max_data = record->start_data + (old_record.max_data - old_record.start_data);
CopyMemQuick(old_record.next_data - number_data_points_to_copy, record->start_data, number_data_points_to_copy * sizeof(LoadDataValue));
if (record->max_data >= record->next_data)
FindMaxDataPoint(record);
FreeMem((char *)old_record.start_data, (old_record.end_data - old_record.start_data) * sizeof(LoadDataValue));
if (record->scale)
{
record->deltay = WINDOWINFO(window)->height / record->scale;
record->moduloy = WINDOWINFO(window)->height / record->scale;
}
}
return TRUE;
}