Sindbad~EG File Manager

Current Path : /usr/home/beeson/MathXpert/cgraph/
Upload File :
Current File : /usr/home/beeson/MathXpert/cgraph/grpapers.c

/*  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.
8.10.24  changed title color on NOPAPER,  so it will be ok with a lightyellow background
*/

#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 */

/*________________________________________________________________ */

/* graph paper definitions should use the color names
defined in wcolors.h.
*/

static GraphPaper BlackPaper =
{ 0,         /* index 0, no graph lines   */
  0,         /* black background   */
  0,
  0,
  0,         /*  three entries for colors  */
  0,         /* 0 in ncolors means no graph paper lines */
  1,         /* nlines */
  0,         /* points between major lines, irrelevant for no paper */
  1,
  1,
  RGB(128,128,0),     /* title background color */
  BLACK24,           /* title color            */
  GREEN24,            /* axes color             */
  YELLOW24            /* axes label color       */
};

static GraphPaper WhitePaper =
{ 1,         /* index 0, no graph lines   */
  WHITE24,   /* white background   */
  0,
  0,
  0,         /* four colors */
  0,         /* 0 in ncolors means no graph paper lines */
  1,         /* nlines */
  0,         /* points between major lines, irrelevant for no paper */
  1,
  1,
  RGB(128,128,0),     /* title background color */
  BLACK24,           /* title color            */
  BLACK24,            /* axes color             */
  BLACK24            /* axes label color       */
};
static GraphPaper FactoryDefault = 
{ 2,                 /* 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       */
};
static GraphPaper YellowGray3 =
{ 3,                 /* 8/1, 1-inch major squares */
  LIGHT_YELLOW,    /* background       */
  LIGHT_GRAY,       /* major line color */
  VERYLIGHT_GRAY,    /* minor line color */
  0,                 /* no vellum lines */
  1,                 /* only major lines */
  10,                 /* minor lines per major line */
  72,                /* major lines 1 inch apart */
  1,                 /* thickness of major lines   */
  1,                 /* thickness of minor lines   */
  WHITE24,    /* title background color     */
  BLACK24,           /* title color            */
  BLACK24,           /* axes color             */
  BLACK24            /* axes label color       */
};
static GraphPaper BlueGray4 =
{ 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       */
};
static GraphPaper BlueGray5 =
{ 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       */
};
static GraphPaper BlueGray6 =
{ 6,                 /* 5/1, 1/2-inch major squares */
  VERYLIGHT_BLUE,    /* background       */
  MEDGRAY24,         /* major line color */
  MEDIUM_BLUE2,      /* minor line color */
  0,                 /* no vellum lines */
  1,                 /* only major 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       */
};
static GraphPaper BlackGrayBlue7 =
{ 7,                 /* 5/1, 1/2-inch major squares */
  BLACK24,    /* background       */
  DARKGRAY24,     /* major line color */
  MEDIUM_BLUE2,      /* minor line color */
  0,                 /* no vellum lines */
  1,                 /* only major 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            */
  GREEN24,           /* axes color             */
  YELLOW24            /* axes label color       */
};
static GraphPaper WhiteGrayBlueLittle8 =
{ 8,                 /* 5/1, 1/2-inch major squares */
  WHITE24,    /* background       */
  VERYLIGHT_GRAY,     /* major line color */
  MEDIUM_BLUE2,      /* minor line color */
  0,                 /* no vellum lines */
  1,                 /* only major 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       */
};
static GraphPaper BlackGrayBlue9 =
{ 9,                 /* 5/1, 1-inch major squares */
  BLACK24,    /* background       */
  DARKGRAY24,     /* major line color */
  MEDIUM_BLUE2,      /* minor line color */
  0,                 /* no vellum lines */
  1,                 /* only major lines */
  5,                 /* minor lines per major line */
  72,                /* major lines 1/2 inch apart */
  1,                 /* thickness of major lines   */
  1,                 /* thickness of minor lines   */
  VERYLIGHT_BLUE,    /* title background color     */
  BLACK24,           /* title color            */
  GREEN24,           /* axes color             */
  YELLOW24            /* axes label color       */
};

static GraphPaper WhiteGrayBlueBig10 =
{ 10,                 /* 5/1, 1-inch major squares */
  WHITE24,           /* background       */
  VERYLIGHT_GRAY,     /* major line color */
  MEDIUM_BLUE2,      /* minor line color */
  0,                 /* no vellum lines */
  1,                 /* only major lines */
  5,                 /* minor lines per major line */
  72,                /* major lines 1 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       */
};
static GraphPaper OrangeGray11 =
{ 11,                 /* 10/1, 1 inch major squares */
  VERYLIGHT_ORANGE,  /* background   */
  MEDGRAY24,         /* major line color */
  MEDIUM_GREEN2,     /* minor line color */
  LIGHT_GRAY,        /* 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       */
};
static GraphPaper OrangeBlack12 =
{ 12,                 /*  10/1, 1 inch major squares */
  VERYLIGHT_ORANGE,  /* background   */
  BLACK24,           /* major line color */
  MEDIUM_GREEN2,     /* minor line color */
  LIGHT_GRAY,         /* 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       */
};
/*____________________________________________________________________*/
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 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       */
},
{ 2,
  VERYLIGHT_BLUE,           /* very light blue background */
  MEDIUM_BLUE2,          /* 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_BLUE2,          /* medium blue lines */
  MEDIUM_BLUE2,          /* dummy entry, no minor lines in this paper */
  0,                    /* vellum line color, but there are none here */
  2,                    /* major and minor lines only, no vellum lines */
  8,                    /* 8 minor   lines per major line */
  72,                   /* 1 inch between 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_BLUE2,          /* medium blue lines */
  MEDIUM_BLUE2,          /* 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 */
  LIGHTBLUE24,         /*  minor lines lighter */
  MEDIUM_BLUE2,         /* vellum lines even lighter */
  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       */
}
};

/*___________________________________________________________________*/
int GetFactoryGraphPaper(void)
/* return the index of the default graph paper */
{ return 2;
}
/*___________________________________________________________________*/
GraphPaper GetGraphPaper(int n)
{ GraphPaper G;
  int colorscheme;
  switch(n)
  {
    case 0:  return BlackPaper;
    case 1:  return WhitePaper;
    case 2:  return FactoryDefault;
    case 3:  return YellowGray3;
    case 4:  return BlueGray4;
    case 5:  return BlueGray5;
    case 6:  return BlueGray6;
    case 7:  return BlackGrayBlue7;
    case 8:  return WhiteGrayBlueLittle8;
    case 9:  return BlackGrayBlue9;
    case 10: return WhiteGrayBlueBig10;
    case 11:  return OrangeGray11;
    case 12:  return OrangeBlack12;
    default: break;
  }
  if(n -12 <= NSCHEMES * NTEMPLATES-4)
     { /* basic series in different colors*/
       colorscheme = (n-12) / NTEMPLATES;
       G = templates[(n-12) % NTEMPLATES];
       G.index = n;
       G.titlecolor = BLACK24;
       G.axescolor = BLACK24;
       G.axeslabelcolor = BLACK24;
       switch(colorscheme)
          { case 0:  /* blue series */
               G.background = VERYLIGHT_BLUE;
               if(G.ncolors == 1)
                  { G.color1 = MEDIUM_BLUE2;
                  }
               else
                  { G.color1 = MEDIUM_BLUE;
                  }
               G.color2 = MEDIUM_BLUE2;
               if(G.color3)
                  { G.color2 = LIGHTBLUE24;
                    G.color3 = MEDIUM_BLUE2;
                  }
               break;
            case 1:  /* green series */
               G.background = VERYLIGHT_GREEN;
               G.color1 = MEDIUM_GREEN;
               G.color2 = LIGHT_GREEN24;
               if(G.color3)
                  G.color3 = VERYLIGHT_GRAY;
               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
      assert(0);
   return G;
}


Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists