Sindbad~EG File Manager
/* M Beeson, for Windows Mathpert.
6.23.00 Graph paper definitions
7.12.00 last modified
7.31.00 added light gray series
7.18.13 removed windows.h and defined RGB
7.21.13 changed RGB to the Windows definition
2.24.24 changed include cgraph.h to svgGraph.h
3.1.24 if-0'd out some obsolete code
6.25.24 removed 0x02000000L from some colors; that was Windows code.
*/
#include <assert.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <math.h> /* frexp */
#include "rgb.h"
#include "globals.h"
#include "mathpert.h"
#include "graphstr.h"
#include "svgGraph.h"
#include "grpaper.h"
#include "grafinit.h" /* needs_circular_aspect */
#include "wcolors.h" /* color name definitions */
#define NTEMPLATES (sizeof(templates)/sizeof(GraphPaper))
#define NCUSTOMPAPERS (sizeof(CustomPapers)/sizeof(GraphPaper))
#define NSCHEMES 3 /* blue, green, orange */
/*________________________________________________________________ */
/* graph paper definitions should use the color names
defined in wcolors.h.
*/
static GraphPaper NoPaper =
{ 0, /* index 0, the dummy entry */
0, /* black background */
0,
0,
0, /* four colors */
0, /* 0 in ncolors means this is the dummy */
1, /* nlines */
0, /* points between major lines, irrelevant for the dummy */
1,
1,
0, /* title background color */
YELLOW24, /* title color */
GREEN24, /* axes color */
YELLOW24 /* axes label color */
};
/*____________________________________________________________________*/
static GraphPaper templates[] =
{
{ 1,
VERYLIGHT_BLUE, /* very light blue background */
MEDIUM_BLUE, /* medium blue lines */
BLACK24, /* dummy entry, no minor lines in this paper */
0, /* no vellum lines */
1, /* ncolors-- only one style of lines */
0, /* nlines, irrelevant as there are no minor lines */
18, /* 4 lines per in */
1, /* thickness of major lines */
1, /* thickness of minor lines (dummy entry) */
VERYLIGHT_BLUE, /* title background color */
BLACK24, /* title color */
BLACK24, /* axes color */
BLACK24 /* axes label color */
},
{ 2,
VERYLIGHT_BLUE, /* very light blue background */
MEDIUM_BLUE, /* medium blue lines */
BLACK24, /* dummy entry, no minor lines in this paper */
0, /* no vellum lines */
1, /* ncolors-- only one style of lines */
0, /* nlines, irrelevant as there are no minor lines */
9, /* 8 lines per inch */
1, /* thickness of major lines */
1, /* thickness of minor lines (dummy entry) */
VERYLIGHT_BLUE, /* title background color */
BLACK24, /* title color */
BLACK24, /* axes color */
BLACK24 /* axes label color */
},
{ 3,
VERYLIGHT_BLUE, /* very light blue background */
MEDIUM_BLUE, /* medium blue lines */
MEDIUM_BLUE, /* dummy entry, no minor lines in this paper */
0, /* no vellum lines */
2, /* major and minor lines */
8, /* 8 minor lines per major line */
72, /* 1 inch beween major lines */
2, /* thickness of major lines */
1, /* thickness of minor lines (dummy entry) */
VERYLIGHT_BLUE, /* title background color */
BLACK24, /* title color */
BLACK24, /* axes color */
BLACK24 /* axes label color */
},
{ 4,
VERYLIGHT_BLUE, /* very light blue background */
MEDIUM_BLUE, /* medium blue lines */
MEDIUM_BLUE, /* minor line color */
0, /* no vellum lines */
2, /* both major and minor lines */
10, /* 10 minor lines per major line */
72, /* one major lines per inch appx. */
2, /* thickness of major lines */
1, /* thickness of minor lines (dummy entry) */
VERYLIGHT_BLUE, /* title background color */
BLACK24, /* title color */
BLACK24, /* axes color */
BLACK24 /* axes label color */
},
{ 5,
VERYLIGHT_BLUE, /* very light blue background */
MEDIUM_BLUE, /* medium blue lines */
MEDIUM_BLUE2, /* minor lines lighter */
MEDIUM_BLUE, /* vellum lines slightly darker again */
2, /* ncolors */
10, /* nlines */
72, /* 1 major lines per inch appx. */
2, /* thickness of major lines */
1, /* thickness of minor lines (dummy entry) */
VERYLIGHT_BLUE, /* title background color */
BLACK24, /* title color */
BLACK24, /* axes color */
BLACK24 /* axes label color */
}
};
/*__________________________________________________________________________*/
static GraphPaper CustomPapers[] =
{ /* The first one is the Factory Default */
{ 1, /* 5/1, 1/2-inch major squares */
VERYLIGHT_ORANGE, /* background */
MEDGRAY24, /* major line color */
MEDIUM_GREEN2, /* minor line color */
0, /* no vellum lines */
2, /* both major and minor lines */
5, /* minor lines per major line */
36, /* major lines 1/2 inch apart */
1, /* thickness of major lines */
1, /* thickness of minor lines */
VERYLIGHT_ORANGE, /* title background color */
BLACK24, /* title color */
BLACK24, /* axes color */
BLACK24 /* axes label color */
},
{ 2, /* 10/1, 1 inch major squares */
VERYLIGHT_ORANGE, /* background */
MEDGRAY24, /* major line color */
MEDIUM_GREEN2, /* minor line color */
MEDGRAY24, /* vellum lines */
2, /* both major and minor lines */
10, /* minor lines per major line */
72, /* major lines 1 inch apart */
2, /* thickness of major lines */
1, /* thickness of minor lines */
VERYLIGHT_ORANGE, /* title background color */
BLACK24, /* title color */
BLACK24, /* axes color */
BLACK24 /* axes label color */
},
{ 3, /* 10/1, 1 inch major squares */
VERYLIGHT_ORANGE, /* background */
BLACK24, /* major line color */
MEDIUM_GREEN2, /* minor line color */
MEDGRAY24, /* vellum lines */
2, /* both major and minor lines */
10, /* minor lines per major line */
72, /* major lines 1 inch apart */
1, /* thickness of major lines */
1, /* thickness of minor lines */
VERYLIGHT_ORANGE, /* title background color */
BLACK24, /* title color */
BLACK24, /* axes color */
BLACK24 /* axes label color */
},
{ 4, /* 5/1, 1/2-inch major squares */
VERYLIGHT_BLUE, /* background */
MEDGRAY24, /* major line color */
MEDIUM_BLUE2, /* minor line color */
0, /* no vellum lines */
2, /* both major and minor lines */
5, /* minor lines per major line */
36, /* major lines 1/2 inch apart */
1, /* thickness of major lines */
1, /* thickness of minor lines */
VERYLIGHT_BLUE, /* title background color */
BLACK24, /* title color */
BLACK24, /* axes color */
BLACK24 /* axes label color */
},
{ 5, /* 8/1, 1-inch major squares */
WHITE24, /* background */
VERYLIGHT_GRAY, /* major line color */
VERYLIGHT_GRAY, /* minor line color */
0, /* no vellum lines */
2, /* both major and minor lines */
10, /* minor lines per major line */
72, /* major lines 1 inch apart */
2, /* thickness of major lines */
1, /* thickness of minor lines */
WHITE24, /* title background color */
BLACK24, /* title color */
BLACK24, /* axes color */
BLACK24 /* axes label color */
}
};
/*____________________________________________________________________*/
int NGraphPapers(void)
{ return NTEMPLATES * NSCHEMES + NCUSTOMPAPERS + 1;
}
/*___________________________________________________________________*/
int GetFactoryGraphPaper(void)
/* return the index of the default graph paper */
{ return NSCHEMES * NTEMPLATES + 1;
}
/*___________________________________________________________________*/
GraphPaper GetGraphPaper(int n)
{ GraphPaper G;
int colorscheme,m;
if(n == 0)
return NoPaper;
if(n <= NSCHEMES * NTEMPLATES)
{ /* basic series in different colors*/
colorscheme = (n-1) / NTEMPLATES;
G = templates[(n-1) % NTEMPLATES];
G.index = n;
G.titlecolor = BLACK24;
G.axescolor = BLACK24;
G.axeslabelcolor = BLACK24;
switch(colorscheme)
{ case 0: /* blue series */
G.background = VERYLIGHT_BLUE;
G.color1 = MEDIUM_BLUE;
G.color2 = MEDIUM_BLUE2;
if(G.color3)
G.color3 = MEDIUM_BLUE;
break;
case 1: /* green series */
G.background = VERYLIGHT_GREEN;
G.color1 = MEDIUM_GREEN;
G.color2 = MEDIUM_GREEN2;
if(G.color3)
G.color3 = MEDIUM_GREEN;
break;
case 2: /* orange series */
G.background = VERYLIGHT_ORANGE;
G.color1 = MEDIUM_ORANGE;
G.color2 = MEDIUM_ORANGE2;
if(G.color3)
G.color3 = MEDIUM_ORANGE;
break;
default:
assert(0);
}
G.titlebackgroundcolor = G.background;
}
else
{ m = n - NSCHEMES*NTEMPLATES - 1;
if (m >= NCUSTOMPAPERS)
return NoPaper; /* assert(0) */
G = CustomPapers[m];
G.index = n;
}
if(G.thickness1 == 0 || G.thickness2 == 0)
assert(0);
return G;
}
/*___________________________________________________________________*/
void StoreDummyGraphPaper(GraphPaper p)
{ NoPaper = p;
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists