home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 6
/
FreshFish_September1994.bin
/
bbs
/
misc
/
cp-4.3.lha
/
cP
/
Source
/
plotgui.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-03
|
21KB
|
675 lines
/*
* Source machine generated by GadToolsBox V2.0
* which is (c) Copyright 1991-1993 Jaba Development
*
* GUI Designed by : Chris Conger
*/
#include <exec/types.h>
#include <intuition/intuition.h>
#include <intuition/classes.h>
#include <intuition/classusr.h>
#include <intuition/imageclass.h>
#include <intuition/gadgetclass.h>
#include <libraries/gadtools.h>
#include <graphics/displayinfo.h>
#include <graphics/gfxbase.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/graphics_protos.h>
#include <clib/utility_protos.h>
#include <string.h>
#include <clib/diskfont_protos.h>
#include "plotgui.h"
#include "cp.h"
extern UBYTE *version_string;
struct Screen *Scr = NULL;
APTR VisualInfo = NULL;
struct Window *PlotWindowWnd = NULL;
struct Window *delwinWnd = NULL;
struct Gadget *PlotWindowGList = NULL;
struct Gadget *delwinGList = NULL;
struct Menu *PlotWindowMenus = NULL;
struct IntuiMessage PlotWindowMsg;
struct IntuiMessage delwinMsg;
struct Gadget *PlotWindowGadgets[6];
struct Gadget *delwinGadgets[3];
UWORD SWIDTH = STDSCREENWIDTH;
UWORD SHEIGHT = STDSCREENHEIGHT;
UWORD delwinWidth;
UWORD delwinHeight;
UBYTE *PlotWindowWdt = (UBYTE *)"ChrisP";
UBYTE *delwinWdt = (UBYTE *)"Kill Trace";
struct Window *PreSlideWnd = NULL;
struct Gadget *PreSlideGList = NULL;
struct IntuiMessage PreSlideMsg;
struct Gadget *PreSlideGadgets[1];
UBYTE *PreSlideWdt = (UBYTE *)"Precision for Identify Feature";
WORD GADHEIGHT;
WORD GADWIDTH;
struct NewMenu PlotWindowNewMenu[] = {
NM_TITLE, (STRPTR)"Project", NULL, 0, NULL, NULL,
NM_ITEM, (STRPTR)"Open File", (STRPTR)"O", 0, 0L, (APTR)newfile,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)"Add File", (STRPTR)"A", 0, 0L, (APTR)addClicked,
NM_ITEM, (STRPTR)"Kill Set", (STRPTR)"K", 0, 0L, (APTR)deleteClicked,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)"Print", (STRPTR)"P", 0, 0L, (APTR)PlotDump,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)"About", NULL, 0, 0L, (APTR)PlotWindowItem0,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)"Die", (STRPTR)"Q", 0, 0L, (APTR)PlotWindowItem1,
NM_TITLE, (STRPTR)"Display", NULL, 0, NULL, NULL,
NM_ITEM, (STRPTR)"Full View", (STRPTR)"F", 0L, 0L, (APTR)fullClicked,
NM_ITEM, (STRPTR)"UnZoom", (STRPTR)"U", 0L, 0L, (APTR)UnZoom,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)"Cross Hair", (STRPTR)"H", 0L, 0L, (APTR)CrossHair,
NM_ITEM, (STRPTR)"Significant Digits", (STRPTR)"D", 0L, 0L, (APTR)PreOpenRequest,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)"Grid", (STRPTR)"G", NULL, 0L, (APTR)gridClicked,
NM_ITEM, (STRPTR)"Symbols", (STRPTR)"S", NULL, 0L, (APTR)PlotWindowItem6,
NM_ITEM, (STRPTR)"Control Panel", (STRPTR)"C", NULL, 0L, (APTR)PlotWindowItem7,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)"Screen Depth", NULL, 0, NULL, NULL,
NM_SUB, (STRPTR)"1", (STRPTR)"1", NULL, 0L, (APTR)NewDepth1,
NM_SUB, (STRPTR)"2", (STRPTR)"2", NULL, 0L, (APTR)NewDepth2,
NM_SUB, (STRPTR)"3", (STRPTR)"3", NULL, 0L, (APTR)NewDepth3,
NM_SUB, (STRPTR)"4", (STRPTR)"4", NULL, 0L, (APTR)NewDepth4,
NM_TITLE, (STRPTR)"Axis", NULL, 0, NULL, NULL,
NM_ITEM, (STRPTR)"XAxis", NULL, 0, NULL, NULL,
NM_SUB, (STRPTR)"Lin", NULL, 0, 0L, (APTR)PlotWindowItem2,
NM_SUB, (STRPTR)"Log", NULL, 0, 0L, (APTR)PlotWindowItem3,
NM_ITEM, (STRPTR)"YAxis", NULL, 0, NULL, NULL,
NM_SUB, (STRPTR)"Lin", NULL, 0, 0L, (APTR)PlotWindowItem4,
NM_SUB, (STRPTR)"Log", NULL, 0, 0L, (APTR)PlotWindowItem5,
NM_END, NULL, NULL, 0, 0L, NULL };
UWORD PlotWindowGTypes[] = {
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND
};
UWORD delwinGTypes[] = {
LISTVIEW_KIND,
BUTTON_KIND,
BUTTON_KIND
};
UWORD PreSlideGTypes[] = {
SLIDER_KIND
};
struct NewGadget PlotWindowNGad[] = {
NULL, NULL, NULL, NULL, (UBYTE *)"_Add", NULL, GD_add, PLACETEXT_IN, NULL, (APTR)addClicked,
NULL, NULL, NULL, NULL, (UBYTE *)"_Kill", NULL, GD_delete, PLACETEXT_IN, NULL, (APTR)deleteClicked,
NULL, NULL, NULL, NULL, (UBYTE *)"_Full", NULL, GD_full, PLACETEXT_IN, NULL, (APTR)fullClicked,
NULL, NULL, NULL, NULL, (UBYTE *)"_Zoom", NULL, GD_zoom, PLACETEXT_IN, NULL, (APTR)zoomClicked,
NULL, NULL, NULL, NULL, (UBYTE *)"_Hair", NULL, GD_grid, PLACETEXT_IN, NULL, (APTR)CrossHair,
NULL, NULL, NULL, NULL, (UBYTE *)"_Quit", NULL, GD_quit, PLACETEXT_IN, NULL, (APTR)quitClicked
};
struct NewGadget delwinNGad[] = {
NULL, NULL, NULL, NULL, NULL, NULL, GD_dellist, NULL, NULL, (APTR)dellistClicked,
NULL, NULL, NULL, NULL, (UBYTE *)"_Kill", NULL, GD_delset, PLACETEXT_IN, NULL, (APTR)delsetClicked,
NULL, NULL, NULL, NULL, (UBYTE *)"_Redraw", NULL, GD_canlist, PLACETEXT_IN, NULL, (APTR)canlistClicked
};
struct NewGadget PreSlideNGad[] = {
NULL, NULL, NULL, NULL, NULL, NULL, GD_pre, PLACETEXT_BELOW, NULL, (APTR)preClicked
};
ULONG PlotWindowGTags[] = {
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE)
};
ULONG delwinGTags[] = {
(GTLV_ShowSelected), NULL, (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE)
};
ULONG PreSlideGTags[] = {
(GTSL_Min), 1, (GTSL_Max), 9, (GTSL_Level), NULL, (GTSL_MaxLevelLen), 3, (GTSL_LevelFormat), (ULONG)"%ld", (PGA_Freedom), LORIENT_HORIZ, (GA_RelVerify), TRUE, (TAG_DONE)
};
struct ColorSpec MonoColors[] = {
0, 0x02, 0x01, 0x05,
1, 0x0F, 0x0E, 0x0D,
~0, 0x00, 0x00, 0x00 };
struct ColorSpec FourColors[] = {
0, 0x06, 0x07, 0x09,
1, 0x0B, 0x0A, 0x0A,
2, 0x03, 0x01, 0x03,
3, 0x0F, 0x06, 0x06,
~0, 0x00, 0x00, 0x00 };
struct ColorSpec EightColors[] = {
0, 0x08, 0x07, 0x08,
1, 0x00, 0x00, 0x00,
2, 0x0C, 0x0C, 0x0F,
3, 0x09, 0x07, 0x08,
4, 0x0A, 0x07, 0x0F,
5, 0x0F, 0x0E, 0x08,
6, 0x04, 0x04, 0x07,
7, 0x0F, 0x0F, 0x0F,
~0, 0x00, 0x00, 0x00 };
struct ColorSpec SixteenColors[] = {
0, 0x08, 0x07, 0x08,
1, 0x00, 0x00, 0x00,
2, 0x0F, 0x0F, 0x0F,
3, 0x07, 0x06, 0x09,
4, 0x08, 0x0B, 0x0F,
5, 0x00, 0x0E, 0x08,
6, 0x0F, 0x04, 0x08,
7, 0x0F, 0x0D, 0x07,
8, 0x0B, 0x07, 0x0F,
9, 0x0F, 0x0A, 0x08,
10, 0x0F, 0x08, 0x0D,
11, 0x06, 0x00, 0x0F,
12, 0x00, 0x0F, 0x0F,
13, 0x0F, 0x05, 0x00,
14, 0x05, 0x04, 0x07,
15, 0x0F, 0x0F, 0x0F,
~0, 0x00, 0x00, 0x00 };
int SetupScreen( void )
{
UBYTE PubNum[4];
struct List *publist;
struct PubScreenNode *psnode;
WORD s=0,t;
WORD len;
struct ColorSpec *ScreenColors;
UBYTE PubName[32];
UWORD DriPens[] = {
0,1,2,2,1,3,2,0,2,~0 };
UWORD TwoPens[] = {
0,1,2,1,2,3,2,0,2,~0 };
strcpy(PubName,MyName); /* OpenScreen will fail if MyName has already been used */
if ( Stricmp(PubName,&version_string[5])==0) /** if user didn't supply us a name **/
{
strcpy(PubName,"cP");
len = (WORD) strlen( PubName );
publist = LockPubScreenList(); /* Lock the public screen list */
for (psnode = (struct PubScreenNode *) publist->lh_Head; psnode->psn_Node.ln_Succ; psnode = (struct PubScreenNode *) psnode->psn_Node.ln_Succ)
{
if ( ! Strnicmp( psnode-> psn_Node.ln_Name, PubName, len))
{
t = 0;
sscanf( &psnode-> psn_Node.ln_Name [len],"%hd", &t);
s = max(s,t);
}
}
UnlockPubScreenList ();
sprintf( PubNum,"%hd", s+1 );
strcat ( PubName, PubNum)