home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <exec/types.h>
- #include <intuition/intuition.h>
- #include <graphics/rastport.h>
- #include <graphics/gfxmacros.h>
- #include <proto/intuition.h>
- #include <proto/graphics.h>
- #include <proto/exec.h>
-
- #include "hame.h"
- #include "View_Define.h"
- #include "ViewProtos.h"
-
- extern float min, max;
- extern struct HamePort *hamePort;
- extern struct Library *HameBase;
- extern struct TextAttr textAttr;
-
- /* NewWindow structure for palette window */
-
- struct NewWindow NW =
- {
- 1, 1,
- 256, 26,
- 0, 0,
- ACTIVEWINDOW,
- WINDOWDRAG|SMART_REFRESH|BORDERLESS,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,0,
- 0,0,
- CUSTOMSCREEN
- };
-
- struct IntuiText it2 = {
- 15, 0,
- JAM1,
- 8, 10,
- &textAttr,
- "Some string",
- NULL
- };
-
- extern struct MsgPort *messagePort;
- extern int isscale;
-
- /* Show the palette window */
- struct Window *
- showScale(struct Screen *s, int mode)
- {
- int i,j;
- struct Window *sw;
-
- if(max > min) NW.Height = 46;
- else NW.Height = 26;
-
-
-
- NW.Screen = s;
- NW.LeftEdge = s->Width/2 - 128;
- NW.Width = 256;
- if( (mode==HAME) || (mode==HAME_LACE) )
- {
- NW.LeftEdge=64;
- NW.Width=512;
- NW.TopEdge=11;
- }
-
- sw = OpenWindow(&NW);
- if(sw == NULL) myExit("Can't Open Scale Window");
- isscale=1;
-
- if(sw->UserPort) DeletePort(sw->UserPort);
- sw->UserPort = messagePort;
- ModifyIDCMP(sw,INACTIVEWINDOW|MOUSEBUTTONS);
-
- if( (mode==COLORS_32) || (mode==COLORS_LACE_32) )
- {
- for(i=0;i<256;i++)
- {
- SetAPen(sw->RPort,i/8);
- RectFill(sw->RPort,i,SYSGADHEIGHT,i,26);
- }
- }
-
- if( (mode==COLORS_16) || (mode==COLORS_LACE_16) )
- {
- for(i=0;i<256;i++)
- {
- SetAPen(sw->RPort,i/16);
- RectFill(sw->RPort,i,SYSGADHEIGHT,i,26);
- }
- }
-
- if( (mode==HAME) || (mode==HAME_LACE) )
- {
-
- for(i=0;i<256;i++)
- {
- HAME_SetAPen(hamePort,i);
- for(j=11;j<27;j++) HAME_WriteWPixel(hamePort,sw,i,j);
- }
-
- }
-
- if(max>min)
- {
- sprintf(it2.IText,"Min: %3.2e",min);
- PrintIText(sw->RPort,&it2,4,25);
- sprintf(it2.IText,"Max: %3.2e",max);
- PrintIText(sw->RPort,&it2,144,25);
- }
-
-
- return(sw);
- }
-
-
-