r313: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 25 Dec 2000 21:54:26 +0000 (21:54 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 25 Dec 2000 21:54:26 +0000 (21:54 +0000)
12 files changed:
ChangeLog
include/ezplot.h
include/pol.h
include/sgp.h
libctgraphics/ezplot.cpp
libctgraphics/ezset.cpp
libctgraphics/pol.cpp
libctgraphics/sgp.cpp
msvc/ctsim.dsw
msvc/ctsim/ctsim.plg
src/ctsim.h
src/views.cpp

index 89179dbd9d16535f90a6cc8f4f652d42f36494b8..b8cd410aeb6fb799913232ee225fc2837a2fe5b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,18 +1,13 @@
 TODO
        Read PlotFile's.
 
-       Fix display of ylabel.
-
-       Review old ezset.c and add in concept of curve number. Add to ezset
-       std::vector for individual curve parameters such as color, linestyle,
-       symbol. Read these vectors during plot generation
-
        Add help button onto dialog's for reconstruction & projections.
        Consider use of wxWindows help file classes.
 
        Consider changing POL into a Class. Consider making it read tag tokens.
 
-       Consider being able to write Phantom files as text
+       Consider being able to write Phantom files as text and view as
+       text in ctsim.
        
 3.0alpha1 - Released 12/30/00
 
@@ -26,8 +21,8 @@ TODO
        * ctsim: Added row and column plot comparisons between two image
        files.
 
-       * Reworked statistics algorithm to share between imagefile and
-       plotfile classes.
+       * mathfuncs.cpp: Reworked statistics algorithm to share between
+       imagefile and plotfile classes.
 
        * imagefile.cpp: Fixed scaling bug when rasterizing Phantom with
        nsamples > 2.  Added generic mage math functions, moved from
@@ -41,7 +36,10 @@ TODO
 
        * if1: Updated to use new ImageFile class math functions
 
-       * ezplot.h: Updated to more C++ conventions
+       * ezplot: Reworked to better store colors/linestyles/symbols with
+       Individual curves. Updated to more C++ conventions. 
+
+       * sgp: Added linestyle settings
        
 2.5.0 - 12/18/00 
    First Microsoft Windows GUI version
index 6ad4b5b3b1e9901c813cf940390d4db6a5458bea..a7559da265de0bfc90bc32a5cb27117581a1d4a1 100644 (file)
@@ -7,7 +7,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezplot.h,v 1.20 2000/12/23 18:12:35 kevin Exp $
+**  $Id: ezplot.h,v 1.21 2000/12/25 21:54:26 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -40,13 +40,8 @@ public:
   double *x;
   double *y;
   int m_iPointCount;
-  int m_iLineStyle;
-  int m_iSymbol;
-  int m_iSymbolFreq;
-  int m_iColor;
-  std::string m_sLegend;
   
-  EZPlotCurve (const double* x, const double* y, int n, int color, int linestyle, int symbol, int sumbolFreq, const std::string& legend);
+  EZPlotCurve (const double* x, const double* y, int n);
   
   ~EZPlotCurve();
 };
@@ -141,7 +136,8 @@ private:
   enum {
     S_DATA = 2,
       S_HELP,
-      S_EXIT,
+      S_EXIT,\r
+      S_CURVE,
       S_SOLID,
       S_DASH,      
       S_NOLINE,
@@ -215,7 +211,32 @@ private:
   static const int NKEYS;\r
   
   std::vector<class EZPlotCurve*> m_vecCurves;
-  
+  std::vector<int> m_veciColor;\r
+  std::vector<bool> m_vecbColorSet;\r
+  std::vector<int> m_veciSymbol;\r
+  std::vector<bool> m_vecbSymbolSet;\r
+  std::vector<int> m_veciSymbolFreq;\r
+  std::vector<bool> m_vecbSymbolFreqSet;\r
+  std::vector<int> m_veciLinestyle;\r
+  std::vector<bool> m_vecbLinestyleSet;\r
+  std::vector<std::string> m_vecsLegend;\r
+  std::vector<bool> m_vecbLegendSet;\r
+\r
+  int getColor (unsigned int iCurve) const;\r
+  int getSymbol (unsigned int iCurve) const;\r
+  const std::string* getLegend (unsigned int iCurve) const;\r
+  int getSymbolFreq (unsigned int iCurve) const;\r
+  int getLinestyle (unsigned int iCurve) const;\r
+\r
+  void setColor (unsigned int iCurve, int iColor);\r
+  void setSymbol (unsigned int iCurve, int iSymbol);\r
+  void setSymbolFreq (unsigned int iCurve, int iSymbolFreq);\r
+  void setLinestyle (unsigned int iCurve, int iLinestyle);\r
+  void setLegend (unsigned int iCurve, const std::string& strLegend);\r
+  void setLegend (unsigned int iCurve, const char* const pszLegend);\r
+\r
+  int m_iCurrentCurve;\r
+
   // Colors
   int clr_axis;                        // color of all axis lines 
   int clr_title;                       // color of main title 
@@ -231,7 +252,6 @@ private:
   std::string c_xlabel;        // label for x axis 
   std::string c_ylabel;        // label for y axis 
   std::string c_title;         // title to print above graph 
-  std::string c_legend;;       // current legend specified 
   
   int o_linestyle, o_color;    // style to use for curves all subsequent curves to EZPLOT 
   int o_xaxis, o_yaxis;                // Specifies where axis & labels are drawn 
@@ -293,7 +313,7 @@ private:
   double m_dVP_xscale, m_dVP_yscale;
   double m_xWorldScale, m_yWorldScale;
   
-  void drawAxes(void);
+  void drawAxes();
   void symbol (int sym, double symwidth, double symheight);
   void make_numfmt(char *fmtstr, int *fldwid, int *nfrac, double min, double max, int nint);
   int axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp);
@@ -302,12 +322,12 @@ private:
   
   void clearCurves ();
   
-  bool ezcmd (const char const *comm);\r
+  bool ezcmd (const char* const comm);\r
   bool do_cmd(int lx);
   void bad_option(char *opt);
   void initPlotSettings();
   
-  static void initkw(void);
+  static void initKeywords ();
   
   static bool ezset_initialized;
   
@@ -322,7 +342,7 @@ private:
    ~EZPlot ();
    
    bool ezset (const std::string& command);\r
-   bool ezset (const char const *command);
+   bool ezset (const char* const command);
    
    void addCurve (const float* x, const double* y, int num);
    void addCurve (const double* x, const float* y, int num);
index cf5d8e096ae270fef7974ce02e2877bffe8a37fb..54ff9f01435fe8f7dc4f6977dc718084bbb16960 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: pol.h,v 1.5 2000/12/20 14:39:09 kevin Exp $
+**  $Id: pol.h,v 1.6 2000/12/25 21:54:26 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
 ******************************************************************************/
 #ifndef __H_POL
 #define __H_POL
+\r
 
-/* codes for pol_usefile */
-
-#define P_USE_STR  1           /* use string as input source */
-#define P_USE_FILE 2           /* use file as input source */
-
-/* codes for pol_int and pol_float */
-/* if in reject catagory, get new number from terminal */
-
-#define P_FLTINT   1   /* get a real or integer number */
-#define P_BFLTINT  2   /* get a real or integer number, clip against bounds */
-#define P_CBFLTINT 3   /* get real or int, reject if outside bounds */
-
-#define P_FLT     4    /* get a real number */
-#define P_BFLT     5   /* get a real, clip against bounds */
-#define P_CBFLT    6   /* get a floating, reject if outside bounds */
+// codes for pol_usefile 
+enum {\r
+  P_USE_STR = 1,               // use string as input source 
+  P_USE_FILE,            // use file as input source \r
+};
 
-#define P_INT     7    /* get a integer number */
-#define P_BINT     8   /* get a integer, clip against bounds */
-#define P_CBINT    9   /* get a integer, reject if outside bounds */
+// codes for pol_int and pol_float 
+// if in reject catagory, get new number from terminal 
+enum {
+  P_FLTINT = 1,         // get a real or integer number 
+  P_BFLTINT,     // get a real or integer number, clip against bounds 
+  P_CBFLTINT,   // get real or int, reject if outside bounds 
+  P_FLT,          // get a real number 
+  P_BFLT,        // get a real, clip against bounds 
+  P_CBFLT,       // get a floating, reject if outside bounds 
+  P_INT,         // get a integer number 
+  P_BINT,        // get a integer, clip against bounds 
+  P_CBINT,       // get a integer, reject if outside bounds 
+};\r
+\r
 
 #define LETTER   'a'
 #define DIGIT    '0'
 
 #define MIN_INT        -32768
 #define MAX_INT  32767
-
-/* token types */
-
-#define TT_STRING       1              /* string token */
-#define TT_INT          2              /* integer token */
-#define TT_REAL                 3              /* floating point token */
-#define TT_ALPHA        4              /* alphabetic token */
-#define TT_ALPNUM       5              /* alphanumeric token */
-#define TT_NUMALPHA     6
-#define TT_SPECLCHAR    7
-
-#define TT_EOF          8              /* end of file reached */
-#define TT_ERROR        9              /* error in token, caused by call to wrong */
-                                       /*  type of token reader */
-#define TT_BLANK       10              /* white space token.  pol_tok() skips these */
-#define TT_USERTOK     11              /* user defined token */
+\r
+
+// token types 
+enum {
+  TT_STRING = 1,  // string token 
+  TT_INT,         // integer token 
+  TT_REAL,             // floating point token 
+  TT_ALPHA,            // alphabetic token 
+  TT_ALPNUM,                   // alphanumeric token 
+  TT_NUMALPHA,
+  TT_SPECLCHAR,
+  TT_EOF,         // end of file reached 
+  TT_ERROR,       // error in token, caused by call to wrong type of token reader 
+  TT_BLANK,        // white space token.  pol_tok() skips these 
+  TT_USERTOK,     // user defined token 
+};\r
+\r
 
 struct symlist {
        char *name;
@@ -77,16 +80,17 @@ struct symlist {
 typedef struct symlist SYMBOL;
 
 struct token_st {
-    int ready;                         /* TRUE if token is ready */
-    char tokstr[MAXTOK+1];             /* token string */
-    int type;                          /* type of token 'TT_' */
-    int code;                          /* holds code for user defined tokens */
-    double fnum;                       /* real value of token */
-    int inum;                          /* integer value of token */
+    int ready;                         // TRUE if token is ready 
+    char tokstr[MAXTOK+1];     // token string 
+    int type;                            // type of token 'TT_' 
+    int code;                            // holds code for user defined tokens 
+    double fnum;                       // real value of token 
+    int inum;                      // integer value of token 
 };
 
 typedef struct token_st TOKEN;
 
+\r
 /* pol.c */
 void pol_init (void);
 void pol_skpword (char *w);
@@ -106,6 +110,7 @@ int pol_lookchar (void);
 int pol_inchar (void);
 void pol_ungetch (int c);
 int get_inputline (FILE *fp);
-void set_inputline (const char const *line);
+void set_inputline (const char* const line);
+
+#endif\r
 
-#endif
index 36b3b759db29c7dae3469a5f729d9dd64accd72c..2a1472b20ee9ba80c4c144b80d09e3d8d5e86266 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: sgp.h,v 1.22 2000/12/16 06:12:47 kevin Exp $
+**  $Id: sgp.h,v 1.23 2000/12/25 21:54:26 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -127,6 +127,7 @@ private:
   double m_dTextAngle;
   bool m_bRecalcTransform;
   double m_dPointsPerPixel;  // points (72pt/in) per screen pixel;
+  int m_iLinestyle;\r
 
   // Master coordinates are coordinates before CTM transformation
   // World coordinates are coordinates defined by setWindow()
@@ -143,7 +144,7 @@ private:
 
 #if HAVE_WXWINDOWS
   wxPen m_pen;
-  wxFont m_font;
+  wxFont* m_pFont;
 #endif
 
 public:
@@ -174,6 +175,7 @@ public:
   static const unsigned char MARKER_BITMAP[MARK_COUNT][5];
 
   SGP (const SGPDriver& driver);
+  ~SGP();\r
 
   void drawCircle (const double r);
   void drawArc (const double r, double start, double stop);
index c00953554e2c087436a2e4092c0ef0df7885280c..8c385e057cd6c73f46b4b4fd33e3d2852051b6d9 100644 (file)
@@ -6,7 +6,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezplot.cpp,v 1.21 2000/12/23 18:12:35 kevin Exp $
+**  $Id: ezplot.cpp,v 1.22 2000/12/25 21:54:26 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -35,8 +35,8 @@ static const int MAXNUMFMT = 15;      // maximum length of a numeric format
 static const int DEF_CURVE_CLR = C_RED;
 
 
-EZPlotCurve::EZPlotCurve (const double* xData, const double* yData, int n, int color, int linestyle, int symbol, int symfreq, const std::string& legend)
-: x(NULL), y(NULL), m_sLegend (legend)
+EZPlotCurve::EZPlotCurve (const double* xData, const double* yData, int n)
+: x(NULL), y(NULL)
 {
   x = new double [n];
   y = new double [n];
@@ -46,10 +46,6 @@ EZPlotCurve::EZPlotCurve (const double* xData, const double* yData, int n, int c
   memcpy (y, yData, copyCount);
   
   m_iPointCount = n;
-  m_iColor = color;
-  m_iLineStyle = linestyle;
-  m_iSymbol = symbol;
-  m_iSymbolFreq = symfreq;
 }
 
 EZPlotCurve::~EZPlotCurve ()
@@ -117,7 +113,7 @@ EZPlot::addCurve (const double x[], const double y[], int num)
   if (num < 1)
     return;
   
-  EZPlotCurve* pCurve = new EZPlotCurve (x, y, num, o_color, o_linestyle, o_symbol, o_symfreq, c_legend);
+  EZPlotCurve* pCurve = new EZPlotCurve (x, y, num);
   m_vecCurves.push_back (pCurve);
 }
 
@@ -149,11 +145,12 @@ EZPlot::initPlotSettings ()
 {
   charheight = rSGP.getCharHeight();
   charwidth = rSGP.getCharWidth();
-  
+\r
+  m_iCurrentCurve = -1;\r
+
   c_xlabel = "";
   c_ylabel =  "";
   c_title = "";
-  c_legend = "";
   
   o_xporigin = 0.0;
   o_yporigin = 0.0;
@@ -195,14 +192,125 @@ EZPlot::initPlotSettings ()
   s_textsize = FALSE;
   
   clr_axis   = C_BLACK;                // set fixed colors 
-  clr_title  = C_CYAN;
-  clr_label  = C_CYAN;
-  clr_legend = C_RED;
+  clr_title  = C_RED;
+  clr_label  = C_BLUE;
+  clr_legend = C_CYAN;
   clr_number = C_GREEN;
   clr_grid   = C_LTGRAY;
 }
 
-
+void\r
+EZPlot::setColor (unsigned int iCurve, int iColor)\r
+{\r
+  if (m_veciColor.size() <= iCurve) {\r
+    m_veciColor.resize ((m_iCurrentCurve + 1) * 2);\r
+    m_vecbColorSet.resize ((m_iCurrentCurve + 1) * 2);\r
+  }\r
+  m_veciColor [iCurve] = iColor;\r
+  m_vecbColorSet [iCurve] = true;\r
+}\r
+\r
+void\r
+EZPlot::setSymbol (unsigned int iCurve, int iSymbol)\r
+{\r
+  if (m_veciSymbol.size() <= iCurve) {\r
+    m_veciSymbol.resize ((m_iCurrentCurve + 1) * 2);\r
+    m_vecbSymbolSet.resize ((m_iCurrentCurve + 1) * 2);\r
+  }\r
+  m_veciSymbol [iCurve] = iSymbol;\r
+  m_vecbSymbolSet [iCurve] = true;\r
+}\r
+\r
+void\r
+EZPlot::setSymbolFreq (unsigned int iCurve, int iSymbolFreq)\r
+{\r
+  if (m_veciSymbolFreq.size() <= iCurve) {\r
+    m_veciSymbolFreq.resize ((m_iCurrentCurve + 1) * 2);\r
+    m_vecbSymbolFreqSet.resize ((m_iCurrentCurve + 1) * 2);\r
+  }\r
+  m_veciSymbolFreq [iCurve] = iSymbolFreq;\r
+  m_vecbSymbolFreqSet [iCurve] = true;\r
+}\r
+\r
+void\r
+EZPlot::setLinestyle (unsigned int iCurve, int iLinestyle)\r
+{\r
+  if (m_veciLinestyle.size() <= iCurve) {\r
+    m_veciLinestyle.resize ((m_iCurrentCurve + 1) * 2);\r
+    m_vecbLinestyleSet.resize ((m_iCurrentCurve + 1) * 2);\r
+  }\r
+  m_veciLinestyle [iCurve] = iLinestyle;\r
+  m_vecbLinestyleSet [iCurve] = true;\r
+}\r
+\r
+void\r
+EZPlot::setLegend (unsigned int iCurve, const std::string& strLegend)\r
+{\r
+  if (m_vecsLegend.size() <= iCurve) {\r
+    m_vecsLegend.resize ((m_iCurrentCurve + 1) * 2);\r
+    m_vecbLegendSet.resize ((m_iCurrentCurve + 1) * 2);\r
+  }\r
+  m_vecsLegend [iCurve] = strLegend;\r
+  m_vecbLegendSet [iCurve] = true;\r
+}\r
+\r
+void\r
+EZPlot::setLegend (unsigned int iCurve, const char* const pszLegend)\r
+{\r
+  if (m_vecsLegend.size() <= iCurve) {\r
+    m_vecsLegend.resize ((m_iCurrentCurve + 1) * 2);\r
+    m_vecbLegendSet.resize ((m_iCurrentCurve + 1) * 2);\r
+  }\r
+  m_vecsLegend [iCurve] = pszLegend;\r
+  m_vecbLegendSet [iCurve] = true;\r
+}\r
+\r
+int\r
+EZPlot::getColor (unsigned int iCurve) const\r
+{\r
+  if (m_veciColor.size() > iCurve && m_vecbColorSet[iCurve])\r
+    return m_veciColor[iCurve];\r
+  else\r
+    return o_color;\r
+}\r
+    \r
+int\r
+EZPlot::getSymbol (unsigned int iCurve) const\r
+{\r
+  if (m_veciSymbol.size() > iCurve && m_vecbSymbolSet[iCurve])\r
+    return m_veciSymbol[iCurve];\r
+  else\r
+    return o_symbol;\r
+}\r
+    \r
+int\r
+EZPlot::getSymbolFreq (unsigned int iCurve) const\r
+{\r
+  if (m_veciSymbolFreq.size() > iCurve && m_vecbSymbolFreqSet[iCurve])\r
+    return m_veciSymbolFreq[iCurve];\r
+  else\r
+    return o_symfreq;\r
+}\r
+    \r
+int\r
+EZPlot::getLinestyle (unsigned int iCurve) const\r
+{\r
+  if (m_veciLinestyle.size() > iCurve && m_vecbLinestyleSet[iCurve])\r
+    return m_veciLinestyle[iCurve];\r
+  else\r
+    return o_linestyle;\r
+}\r
+    \r
+const std::string*\r
+EZPlot::getLegend (unsigned int iCurve) const\r
+{\r
+  if (m_vecsLegend.size() > iCurve && m_vecbLegendSet[iCurve])\r
+    return &m_vecsLegend[iCurve];\r
+  else\r
+    return NULL;\r
+}\r
+    \r
+\r
 /* NAME
 *   plot               Plots all curves collected by addCurves ()
 *
@@ -219,41 +327,34 @@ EZPlot::initPlotSettings ()
 void
 EZPlot::plot ()
 {\r
-#if 0\r
-  wxFont* myFont = new wxFont (12, wxMODERN, wxNORMAL, wxNORMAL);\r
-  rSGP.getDriver().idWX()->SetFont (*myFont);\r
-#endif
   if (m_vecCurves.size() <= 0)
     return;
   
   rSGP.setWindow (0., 0., 1., 1.);
   
-  if (s_textsize == TRUE) {
-    charheight = v_textsize;
-    charwidth = rSGP.getCharWidth();
-  } else {
-    charheight = rSGP.getCharHeight();
-    charwidth = rSGP.getCharWidth();
-  }
-  
-  const EZPlotCurve& firstCurve = *m_vecCurves[0];
+  if (s_textsize == TRUE)
+    rSGP.setTextPointSize (v_textsize);\r
+  charheight = rSGP.getCharHeight();
+  charwidth = rSGP.getCharWidth();
+  const EZPlotCurve& firstCurve = *m_vecCurves[0];\r
   double xmin = firstCurve.x[0];   // extent of curves in world coord
   double xmax = xmin;       
   double ymin = firstCurve.y[0];
-  double ymax = ymin;
-  
-  for (EZPlotCurveConstIterator iterCurve = m_vecCurves.begin(); iterCurve != m_vecCurves.end(); iterCurve++) {
-    const EZPlotCurve& curve = **iterCurve;
+  double ymax = ymin; \r
+  unsigned int iCurve;
+  for (iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) {
+    const EZPlotCurve* const pCurve = m_vecCurves [iCurve];
     
-    for (int ip = 0; ip < curve.m_iPointCount; ip++) {
-      if (curve.x[ip] > xmax)
-        xmax = curve.x[ip];
-      else if (curve.x[ip] < xmin)
-        xmin = curve.x[ip];
-      if (curve.y[ip] > ymax)
-        ymax = curve.y[ip];
-      else if (curve.y[ip] < ymin)
-        ymin = curve.y[ip];
+    for (int ip = 0; ip < pCurve->m_iPointCount; ip++) {
+      if (pCurve->x[ip] > xmax)
+        xmax = pCurve->x[ip];
+      else if (pCurve->x[ip] < xmin)
+        xmin = pCurve->x[ip];
+      if (pCurve->y[ip] > ymax)
+        ymax = pCurve->y[ip];
+      else if (pCurve->y[ip] < ymin)
+        ymin = pCurve->y[ip];
     }
   }
   
@@ -338,20 +439,22 @@ EZPlot::plot ()
   ya_max = yp_max;
   
   // adjust frame for title 
+  title_row = ya_max;;\r
   if (c_title.length() > 0)
     ya_max -= 2 * charheight;
-  title_row = ya_max + 2 * charheight;
   
   // calculate legend box boundaries 
   int max_leg = 0;                     // longest legend in characters 
-  int num_leg = 0;                     // number of legend titles 
-  for (EZPlotCurveConstIterator iterCurve2 = m_vecCurves.begin(); iterCurve2 != m_vecCurves.end(); iterCurve2++) {
-    const EZPlotCurve& curve = **iterCurve2;
-    int nLegend = curve.m_sLegend.length();
-    if (nLegend > 0) {
-      ++num_leg;
-      if (nLegend > max_leg)\r
-        nLegend = max_leg;
+  int num_leg = 0;                     // number of legend titles \r
+  for (iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) {
+    const std::string* pstrLegend = getLegend (iCurve);\r
+    if (pstrLegend && pstrLegend->length() > 0) {\r
+      int nLegend = pstrLegend->length();
+      if (nLegend > 0) {
+        ++num_leg;
+        if (nLegend > max_leg)\r
+          nLegend = max_leg;\r
+      }
     }
   }
   
@@ -378,31 +481,32 @@ EZPlot::plot ()
     rSGP.setColor (clr_legend);
     rSGP.drawRect (xl_min, yl_min, xl_max, yl_max);
     
-    int iLegend = 0;                   // current legend position 
-    for (EZPlotCurveIterator iterCurve = m_vecCurves.begin(); iterCurve != m_vecCurves.end(); iterCurve++) {
-      const EZPlotCurve& curve = **iterCurve;
-      
-      if (curve.m_sLegend.length() == 0)
+    int iLegend = 0;                   // current legend position \r
+    for (iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) {
+      const std::string* pstrLegend = getLegend (iCurve);
+      if (! pstrLegend || pstrLegend->length() == 0)
         continue;
       
       double xmin = xl_min + 1.0 * charwidth;
       double xmax = xl_max - 1.0 * charwidth;
       double y = yl_max - (2.0 + iLegend * 3) * charheight;
       
-      rSGP.moveAbs (xmin, y + 0.5 * charheight);
-      rSGP.drawText (curve.m_sLegend);
-      rSGP.setColor (curve.m_iColor);
-      if (curve.m_iLineStyle != SGP::LS_NOLINE) {
-        rSGP.setLineStyle (curve.m_iLineStyle);
+      rSGP.moveAbs (xmin, y + 0.5 * charheight);\r
+      rSGP.drawText (pstrLegend->c_str());
+      rSGP.setColor (getColor (iCurve));\r
+      int iLS = getLinestyle (iCurve);
+      if (iLS != SGP::LS_NOLINE) {
+        rSGP.setLineStyle (iLS);
         rSGP.moveAbs (xmin, y);
         rSGP.lineAbs (xmax, y);
-      }
-      if (curve.m_iSymbol > 0) {
+      }\r
+      int iSymbol = getSymbol (iCurve);
+      if (iSymbol > 0) {
         double xinc = (xmax - xmin) / (5 - 1);
         rSGP.setLineStyle (SGP::LS_SOLID);
         for (int j = 0; j < 5; j++) {
           rSGP.moveAbs (xmin + j * xinc, y);
-          symbol(curve.m_iSymbol, 0.5 * charwidth, 0.5 * charheight);
+          symbol(iSymbol, 0.5 * charwidth, 0.5 * charheight);
         }
       }
       ++iLegend;       // move to next legend position 
@@ -417,13 +521,13 @@ EZPlot::plot ()
   
   // X-Label 
   if (c_xlabel.length() > 0)
-    ya_min += 3.0 * charheight;
+    ya_min += 2.0 * charheight;
   xlbl_row = xp_min;           // put x-label on bottom of plot frame 
   
   // Y-Label 
   if (c_ylabel.length() > 0)
-    xa_min += 3.0 * charwidth; // reverse rSGP.setTextSize because writing text sideways 
-  ylbl_col = xp_min + 2 * charwidth;
+    xa_min += 2.0 * charheight;        
+  ylbl_col = xp_min;
   
   /*------------------------------*/
   /* adjust frame for tick labels */
@@ -433,7 +537,7 @@ EZPlot::plot ()
   if (o_xaxis == NOAXIS || o_xtlabel == FALSE)
     xtl_ofs = 0.0;
   else if (o_xticks == BELOW)
-    xtl_ofs = -1.5 * charheight;  // kr
+    xtl_ofs = -1.5 * charheight;
   else if (o_xticks == ABOVE)
     xtl_ofs = 1.5 * charheight;
   
@@ -531,20 +635,21 @@ EZPlot::plot ()
   \r
   double clipRect[4];\r
   clipRect[0] = xgn_min; clipRect[1] = ygn_min; clipRect[2] = xgn_max; clipRect[3] = ygn_max;\r
-
-  for (EZPlotCurveIterator iterCurve3 = m_vecCurves.begin(); iterCurve3 != m_vecCurves.end(); iterCurve3++) {
-    const EZPlotCurve& curve = **iterCurve3;
-    
-    rSGP.setColor (curve.m_iColor);
+\r
+  for (iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) {
+    const EZPlotCurve* const pCurve = m_vecCurves [iCurve];
     \r
-    bool bOutside = false;
-    if (curve.m_iLineStyle != SGP::LS_NOLINE) {
-      rSGP.setLineStyle (curve.m_iLineStyle);
-      double x1 = convertWorldToNDC_X (curve.x[0]);
-      double y1 = convertWorldToNDC_Y (curve.y[0]);\r
-      for (int i = 1; i < curve.m_iPointCount; i++) {
-        double x2 = convertWorldToNDC_X (curve.x[i]);
-        double y2 = convertWorldToNDC_Y (curve.y[i]);\r
+    rSGP.setColor (getColor (iCurve));\r
+    int iSym = getSymbol (iCurve);\r
+    int iLS = getLinestyle (iCurve);\r
+\r
+    if (iLS != SGP::LS_NOLINE) {
+      rSGP.setLineStyle (iLS);
+      double x1 = convertWorldToNDC_X (pCurve->x[0]);
+      double y1 = convertWorldToNDC_Y (pCurve->y[0]);\r
+      for (int i = 1; i < pCurve->m_iPointCount; i++) {
+        double x2 = convertWorldToNDC_X (pCurve->x[i]);
+        double y2 = convertWorldToNDC_Y (pCurve->y[i]);\r
         double x2Clip = x2;\r
         double y2Clip = y2;\r
         if (clip_rect (x1, y1, x2Clip, y2Clip, clipRect)) {\r
@@ -555,19 +660,20 @@ EZPlot::plot ()
         y1 = y2;\r
       } 
     }
-    if (curve.m_iSymbol > 0) {
+    if (iSym > 0) {\r
+      int iSymFreq = getSymbolFreq (iCurve);
       rSGP.setLineStyle (SGP::LS_SOLID);
-      double x = convertWorldToNDC_X (curve.x[0]);
-      double y = convertWorldToNDC_Y (curve.y[0]);
+      double x = convertWorldToNDC_X (pCurve->x[0]);
+      double y = convertWorldToNDC_Y (pCurve->y[0]);
       rSGP.moveAbs (x, y);
-      symbol (curve.m_iSymbol, symwidth, symheight);
-      for (int i = 1; i < curve.m_iPointCount; i++)
-        if (i % curve.m_iSymbolFreq == 0 || i == curve.m_iPointCount - 1) {
-          x = convertWorldToNDC_X (curve.x[i]);
-          y = convertWorldToNDC_Y (curve.y[i]);\r
+      symbol (iSym, symwidth, symheight);
+      for (int i = 1; i < pCurve->m_iPointCount; i++)
+        if (i % iSymFreq == 0 || i == pCurve->m_iPointCount - 1) {
+          x = convertWorldToNDC_X (pCurve->x[i]);
+          y = convertWorldToNDC_Y (pCurve->y[i]);\r
           if (y >= ygn_min && y <= ygn_max) {
             rSGP.moveAbs (x, y);
-            symbol (curve.m_iSymbol, symwidth, symheight);\r
+            symbol (iSym, symwidth, symheight);\r
           }
         }
     }
@@ -735,12 +841,20 @@ EZPlot::drawAxes()
         rSGP.moveAbs (xa_max, y);
         rSGP.lineAbs (xa_min, y);
       }
-    }
-    rSGP.moveAbs (ylbl_col, ya_min + (ya_max-ya_min)/2 - c_ylabel.length()*charheight*1.5);\r
-    rSGP.getDriver().idWX()->SetFont(*wxSWISS_FONT);
+    }\r
+#if 0\r
+    rSGP.moveAbs(.5,.5);\r
+    char s[128];\r
+    snprintf(s,sizeof(s),"%f, %f",charwidth, charheight);\r
+    rSGP.drawText(s);\r
+#endif\r
     rSGP.setTextAngle (HALFPI);
     rSGP.setTextSize (1.5 * charheight);
-    rSGP.setTextColor (clr_label, -1);
+    rSGP.setTextColor (clr_label, -1);\r
+    double xExtent, yExtent;\r
+    rSGP.getTextExtent (c_ylabel.c_str(), &xExtent, &yExtent);\r
+    rSGP.moveAbs (ylbl_col, ya_min + (ya_max-ya_min)/2 - yExtent);\r
+    rSGP.drawText (c_ylabel);
     rSGP.setTextAngle (0.0);
     rSGP.setTextSize (charheight);
     minorinc = yn_tickinc / (o_yminortick + 1);
index 1b8741d5e2c62f1d2a89949901ef4fc47bfa4d71..b380e9a00ff4f021eef71ff1d5d030c421dd056b 100644 (file)
@@ -6,7 +6,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezset.cpp,v 1.11 2000/12/23 18:12:35 kevin Exp $
+**  $Id: ezset.cpp,v 1.12 2000/12/25 21:54:26 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -32,346 +32,368 @@ bool EZPlot::ezset_initialized = false;
 bool\r
 EZPlot::ezset (const std::string& command)\r
 {\r
-       return ezset (command.c_str());\r
+  return ezset (command.c_str());\r
 }\r
 
 bool 
-EZPlot::ezset (const char const *command)
+EZPlot::ezset (const char* const command)
 {
-       if (! ezset_initialized) {
-               pol_init();
-               initkw();
-               pol_skpword ("please");
-               pol_skpword ("use");
-               pol_skpword ("are");
-               pol_skpword ("and");
-               pol_skpword ("is");
-               pol_skpword ("the");
-               pol_skpword ("equals");
-               pol_skpchar ("=");
-               
-               pol_usefile (P_USE_STR,"");
-               set_inputline ("!eoc ,");
-               pol_reader ();
-               pol_closefile ();
-               ezset_initialized = true;
-       }
-       return ezcmd (command);
+  if (! ezset_initialized) {
+    pol_init();
+    initKeywords();
+    pol_skpword ("please");
+    pol_skpword ("use");
+    pol_skpword ("are");
+    pol_skpword ("and");
+    pol_skpword ("is");
+    pol_skpword ("the");
+    pol_skpword ("equals");
+    pol_skpchar ("=");
+    
+    pol_usefile (P_USE_STR,"");
+    set_inputline ("!eoc ,");
+    pol_reader ();
+    pol_closefile ();
+    ezset_initialized = true;
+  }
+  return ezcmd (command);
 }
 
 bool 
-EZPlot::ezcmd (const char const *comm)
+EZPlot::ezcmd (const char* const comm)
 {
-       pol_usefile (P_USE_STR, "");
-       set_inputline (comm);
-       
-       char str[MAXTOK+1];
-       int code;
-       bool retval = true;
-       if (! pol_usertok (str, &code)) {
-               sys_error(ERR_WARNING, "Illegal EZSET command: %s", str);
-               pol_reader();
-               retval = false;
-       }
-       else
-               retval = do_cmd (code);
-       
-       pol_closefile();                        /* close input string file */
-       return (retval);
+  pol_usefile (P_USE_STR, "");
+  set_inputline (comm);
+  
+  char str[MAXTOK+1];
+  int code;
+  bool retval = true;
+  if (! pol_usertok (str, &code)) {
+    sys_error(ERR_WARNING, "Illegal EZSET command: %s", str);
+    pol_reader();
+    retval = false;
+  }
+  else
+    retval = do_cmd (code);
+  
+  pol_closefile();                     /* close input string file */
+  return (retval);
 }
 
 
 bool
 EZPlot::do_cmd (int lx)
 {
-       char str [1024];
-       char strIn [1024];
-       int n;
-       double f;
-       
-       switch (lx) {
-       case S_TEXTSIZE:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
-               {
-                       if (f >= 0.0 && f <= 1.0) {
-                               v_textsize = f;
-                               s_textsize = TRUE;
-                       } else
-                               s_textsize = FALSE;
-               }
-               break;
-       case S_REPLOT:
-               plot ();
-               break;
-       case S_CLEAR:
-               clearCurves ();
-               break;
-       case S_TITLE:
-               gettext (strIn, sizeof(strIn));
-               c_title = strIn;
-               break;
-       case S_LEGEND:
-               gettext (strIn, sizeof(strIn));
-               c_legend = strIn;
-               break;
-       case S_XLABEL:
-               gettext (strIn, sizeof(strIn));
-               c_xlabel = strIn;
-               break;
-       case S_YLABEL:
-               gettext (strIn, sizeof(strIn));
-               c_ylabel = strIn;
-               break;
-       case S_XCROSS:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
-                       v_xcross = f;
-                       s_xcross = TRUE;
-               } else
-                       s_xcross = FALSE;
-               break;
-       case S_YCROSS:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
-                       v_ycross = f;
-                       s_ycross = TRUE;
-               } else
-                       s_ycross = FALSE;
-               break;
-       case S_NOXAXIS:
-               o_xaxis = NOAXIS;
-               break;
-       case S_NOYAXIS:
-               o_yaxis = NOAXIS;
-               break;
-       case S_XLIN:
-               o_xaxis = LINEAR;
-               break;
-       case S_YLIN:
-               o_yaxis = LINEAR;
-               break;
-       case S_XLOG:
-               o_xaxis = LOG;
-               break;
-       case S_YLOG:
-               o_yaxis = LOG;
-               break;
-       case S_XAUTOSCALE:
-               s_xmin = FALSE;
-               s_xmax = FALSE;
-               break;
-       case S_YAUTOSCALE:
-               s_ymin = FALSE;
-               s_ymax = FALSE;
-               break;
-       case S_XMIN:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
-                       v_xmin = f;
-                       s_xmin = TRUE;
-               }
-               break;
-       case S_XMAX:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
-                       v_xmax = f;
-                       s_xmax = TRUE;
-               }
-               break;
-       case S_YMIN:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
-                       v_ymin = f;
-                       s_ymin = TRUE;
-               }
-               break;
-       case S_YMAX:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
-                       v_ymax = f;
-                       s_ymax = TRUE;
-               }
-               break;
-       case S_SOLID:
-               o_linestyle = SGP::LS_SOLID;
-               break;
-       case S_DASH:
-               if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
-                       if (n == 1)
-                               o_linestyle = SGP::LS_DASH1;
-                       else if (n == 2)
-                               o_linestyle = SGP::LS_DASH2;
-                       else if (n == 3)
-                               o_linestyle = SGP::LS_DASH3;
-                       else if (n == 4)
-                               o_linestyle = SGP::LS_DASH4;
-                       else
-                               o_linestyle = SGP::LS_DASH1;
-               } else
-                       o_linestyle = SGP::LS_DASH1;
-               break;
-       case S_NOLINE:
-               o_linestyle = SGP::LS_NOLINE;
-               break;
-       case S_PEN:
-       case S_COLOR:
-               if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
-               {
-                       if (n >= 0)
-                               o_color = n;
-                       else
-                               bad_option("The color you picked");
-               }
-               break;
-       case S_BOX:
-               o_box = TRUE;
-               break;
-       case S_NOBOX:
-               o_box = FALSE;
-               break;
-       case S_GRID:
-               o_grid = TRUE;
-               break;
-       case S_NOGRID:
-               o_grid = FALSE;
-               break;
-       case S_XLENGTH:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
-                       if (f > 0.0 && f <= 1.0)
-                               o_xlength = f;
-                       break;
-       case S_YLENGTH:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
-                       if (f > 0.0 && f <= 1.0)
-                               o_ylength = f;
-                       break;
-       case S_XPORIGIN:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
-                       if (f >= 0.0 && f < 1.0)
-                               o_xporigin = f;
-                       break;
-       case S_YPORIGIN:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
-                       if (f >= 0.0 && f < 1.0)
-                               o_yporigin = f;
-                       break;
-       case S_TAG:
-               if (pol_word("no", 2) == TRUE)
-                       o_tag = FALSE;
-               else if (pol_word("off", 2) == TRUE)
-                       o_tag = FALSE;
-               else
-                       o_tag = TRUE;
-               break;
-       case S_LEGENDBOX:
-               if (pol_word("inside", 2) == TRUE)
-                       o_legendbox = INSIDE;
-               else if (pol_word("outside", 3) == TRUE)
-                       o_legendbox = OUTSIDE;
-               else if (pol_word("none",2) == TRUE)
-                       o_legendbox = NOLEGEND;
-               else {
-                       gettext (str, MAXTOK);
-                       bad_option(str);
-               }
-               break;
-       case S_XLEGEND:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
-               {
-                       if (f >= 0.0 && f < 1.0) {
-                               v_xlegend = f;
-                               s_xlegend = TRUE;
-                       }
-                       else
-                               s_xlegend = FALSE;
-               }
-               break;
-       case S_YLEGEND:
-               if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
-               {
-                       if (f >= 0.0 && f < 1.0) {
-                               v_ylegend = f;
-                               s_ylegend = TRUE;
-                       }
-                       else
-                               s_ylegend = FALSE;
-               }
-               break;
-       case S_SYMBOL:
-               if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
-                       if (n > 0 && n <= MAXSYMBOL)
-                               o_symbol = n;
-                       else
-                               o_symbol = 1;
-               } else {
-                       if (pol_word("every",5) == TRUE) {
-                               if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
-                                       if (n > 0)
-                                               o_symfreq = n;
-                                       else
-                                               o_symfreq = 1;
-                               }
-                       } else if (pol_word ("none",4) == TRUE) {
-                               o_symbol = -1;
-                       }
-               }
-               break;
-       case S_XTICKS:
-               if (pol_usertok(str,&lx) == FALSE)
-                       break;
-               if (lx == S_ABOVE)
-                       o_xticks = ABOVE;
-               else if (lx == S_BELOW)
-                       o_xticks = BELOW;
-               else if (lx == S_NOLABEL)
-                       o_xtlabel = FALSE;
-               else if (lx == S_LABEL)
-                       o_xtlabel = TRUE;
-               else if (lx == S_MAJOR) {
-                       if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
-                               if (n > 1 && n < 100)
-                                       o_xmajortick = n;
-               } else if (lx == S_MINOR)
-                       if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
-                               if (n >= 0 && n < 100)
-                                       o_xminortick = n;
-                               break;
-       case S_YTICKS:
-               if (pol_usertok(str,&lx) == FALSE)
-                       break;
-               if (lx == S_RIGHT)
-                       o_yticks = RIGHT;
-               else if (lx == S_LEFT)
-                       o_yticks = LEFT;
-               else if (lx == S_NOLABEL)
-                       o_ytlabel = FALSE;
-               else if (lx == S_LABEL)
-                       o_ytlabel = TRUE;
-               else if (lx == S_MAJOR) {
-                       if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
-                               if (n > 1 && n < 100)
-                                       o_ymajortick = n;
-               } else if (lx == S_MINOR)
-                       if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
-                               if (n >= 0 && n < 100)
-                                       o_yminortick = n;
-                               break;
-       case S_LXFRAC:
-               if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
-                       if (n >= 0) {
-                               v_lxfrac = n;
-                               s_lxfrac = TRUE;
-                       }
-               } else
-                       s_lxfrac = FALSE;
-               break;
-       case S_LYFRAC:
-               if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
-                       if (n >= 0) {
-                               v_lyfrac = n;
-                               s_lyfrac = TRUE;
-                       }
-               } else
-                       s_lyfrac = FALSE;
-               break;
-               break;
-       default:
-               fprintf (stderr, "Unimplemented EZPLOT command\n");
-               break;
+  char str [1024];
+  char strIn [1024];
+  int n;
+  double f;
+  
+  switch (lx) {
+  case S_TEXTSIZE:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+      if (f >= 0.0 && f <= 1.0) {
+        v_textsize = f;
+        s_textsize = TRUE;
+      } else
+        s_textsize = FALSE;
+    }
+    break;
+  case S_REPLOT:
+    plot ();
+    break;
+  case S_CLEAR:
+    clearCurves ();
+    break;
+  case S_TITLE:
+    gettext (strIn, sizeof(strIn));
+    c_title = strIn;
+    break;
+  case S_LEGEND:
+    gettext (strIn, sizeof(strIn));\r
+    if (m_iCurrentCurve >= 0)\r
+      setLegend (m_iCurrentCurve, strIn);
+    break;
+  case S_XLABEL:
+    gettext (strIn, sizeof(strIn));
+    c_xlabel = strIn;
+    break;
+  case S_YLABEL:
+    gettext (strIn, sizeof(strIn));
+    c_ylabel = strIn;
+    break;
+  case S_XCROSS:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+      v_xcross = f;
+      s_xcross = TRUE;
+    } else
+      s_xcross = FALSE;
+    break;
+  case S_YCROSS:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+      v_ycross = f;
+      s_ycross = TRUE;
+    } else
+      s_ycross = FALSE;
+    break;
+  case S_NOXAXIS:
+    o_xaxis = NOAXIS;
+    break;
+  case S_NOYAXIS:
+    o_yaxis = NOAXIS;
+    break;
+  case S_XLIN:
+    o_xaxis = LINEAR;
+    break;
+  case S_YLIN:
+    o_yaxis = LINEAR;
+    break;
+  case S_XLOG:
+    o_xaxis = LOG;
+    break;
+  case S_YLOG:
+    o_yaxis = LOG;
+    break;
+  case S_XAUTOSCALE:
+    s_xmin = FALSE;
+    s_xmax = FALSE;
+    break;
+  case S_YAUTOSCALE:
+    s_ymin = FALSE;
+    s_ymax = FALSE;
+    break;
+  case S_XMIN:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+      v_xmin = f;
+      s_xmin = TRUE;
+    }
+    break;
+  case S_XMAX:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+      v_xmax = f;
+      s_xmax = TRUE;
+    }
+    break;
+  case S_YMIN:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+      v_ymin = f;
+      s_ymin = TRUE;
+    }
+    break;
+  case S_YMAX:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+      v_ymax = f;
+      s_ymax = TRUE;
+    }
+    break;
+  case S_SOLID:
+    o_linestyle = SGP::LS_SOLID;
+    break;
+  case S_DASH:
+    int ls;\r
+    ls = SGP::LS_DASH1;\r
+    if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {\r
+      if (n == 1)
+        ls = SGP::LS_DASH1;
+      else if (n == 2)
+        ls = SGP::LS_DASH2;
+      else if (n == 3)
+        ls = SGP::LS_DASH3;
+      else if (n == 4)\r
+        ls = SGP::LS_DASH4;\r
+      else if (n == 5)\r
+        ls = SGP::LS_DOTTED;\r
+    }\r
+    if (m_iCurrentCurve < 0)\r
+      o_linestyle = ls;\r
+    else \r
+      setLinestyle (m_iCurrentCurve, ls);\r
+    break;
+  case S_NOLINE:
+    o_linestyle = SGP::LS_NOLINE;
+    break;
+  case S_PEN:
+  case S_COLOR:
+    if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
+    {
+      if (n >= 0) {\r
+        if (m_iCurrentCurve < 0)
+          o_color = n;\r
+        else \r
+          setColor (m_iCurrentCurve, n);\r
+      } else
+        bad_option("The color you picked");
+    }
+    break;
+  case S_BOX:
+    o_box = TRUE;
+    break;
+  case S_NOBOX:
+    o_box = FALSE;
+    break;
+  case S_GRID:
+    o_grid = TRUE;
+    break;
+  case S_NOGRID:
+    o_grid = FALSE;
+    break;
+  case S_XLENGTH:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+      if (f > 0.0 && f <= 1.0)
+        o_xlength = f;
+      break;
+  case S_YLENGTH:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+      if (f > 0.0 && f <= 1.0)
+        o_ylength = f;
+      break;
+  case S_XPORIGIN:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+      if (f >= 0.0 && f < 1.0)
+        o_xporigin = f;
+      break;
+  case S_YPORIGIN:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+      if (f >= 0.0 && f < 1.0)
+        o_yporigin = f;
+      break;
+  case S_TAG:
+    if (pol_word("no", 2) == TRUE)
+      o_tag = FALSE;
+    else if (pol_word("off", 2) == TRUE)
+      o_tag = FALSE;
+    else
+      o_tag = TRUE;
+    break;
+  case S_LEGENDBOX:
+    if (pol_word("inside", 2) == TRUE)
+      o_legendbox = INSIDE;
+    else if (pol_word("outside", 3) == TRUE)
+      o_legendbox = OUTSIDE;
+    else if (pol_word("none",2) == TRUE)
+      o_legendbox = NOLEGEND;
+    else {
+      gettext (str, MAXTOK);
+      bad_option(str);
+    }
+    break;
+  case S_XLEGEND:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+    {
+      if (f >= 0.0 && f < 1.0) {
+        v_xlegend = f;
+        s_xlegend = TRUE;
+      }
+      else
+        s_xlegend = FALSE;
+    }
+    break;
+  case S_YLEGEND:
+    if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+    {
+      if (f >= 0.0 && f < 1.0) {
+        v_ylegend = f;
+        s_ylegend = TRUE;
+      }
+      else
+        s_ylegend = FALSE;
+    }
+    break;
+  case S_SYMBOL:
+    if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
+      if (n > 0 && n <= MAXSYMBOL) {
+        if (m_iCurrentCurve < 0)\r
+          o_symbol = n;\r
+        else\r
+          setSymbol (m_iCurrentCurve, n);\r
+      }\r
+    } else {
+      if (pol_word("every",5) == TRUE) {
+        if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {\r
+          int sym = 1;
+          if (n > 0)\r
+            sym = n;\r
+          if (m_iCurrentCurve < 0)\r
+            o_symfreq = sym;\r
+          else \r
+            setSymbolFreq (m_iCurrentCurve, sym);\r
+        }
+      } else if (pol_word ("none",4) == TRUE) {
+        o_symbol = -1;
+      }
+    }
+    break;
+  case S_CURVE:\r
+    if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {\r
+      if (n > 0)\r
+        m_iCurrentCurve = n - 1;\r
+    } else {\r
+      if (pol_word ("all",3) == TRUE) \r
+        m_iCurrentCurve = -1;\r
+    }\r
+    break;\r
+  case S_XTICKS:
+    if (pol_usertok(str,&lx) == FALSE)
+      break;
+    if (lx == S_ABOVE)
+      o_xticks = ABOVE;
+    else if (lx == S_BELOW)
+      o_xticks = BELOW;
+    else if (lx == S_NOLABEL)
+      o_xtlabel = FALSE;
+    else if (lx == S_LABEL)
+      o_xtlabel = TRUE;
+    else if (lx == S_MAJOR) {
+      if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
+        if (n > 1 && n < 100)
+          o_xmajortick = n;
+    } else if (lx == S_MINOR)
+      if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
+        if (n >= 0 && n < 100)
+          o_xminortick = n;
+        break;
+  case S_YTICKS:
+    if (pol_usertok(str,&lx) == FALSE)
+      break;
+    if (lx == S_RIGHT)
+      o_yticks = RIGHT;
+    else if (lx == S_LEFT)
+      o_yticks = LEFT;
+    else if (lx == S_NOLABEL)
+      o_ytlabel = FALSE;
+    else if (lx == S_LABEL)
+      o_ytlabel = TRUE;
+    else if (lx == S_MAJOR) {
+      if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
+        if (n > 1 && n < 100)
+          o_ymajortick = n;
+    } else if (lx == S_MINOR)
+      if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
+        if (n >= 0 && n < 100)
+          o_yminortick = n;
+        break;
+  case S_LXFRAC:
+    if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
+      if (n >= 0) {
+        v_lxfrac = n;
+        s_lxfrac = TRUE;
+      }
+    } else
+      s_lxfrac = FALSE;
+    break;
+  case S_LYFRAC:
+    if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
+      if (n >= 0) {
+        v_lyfrac = n;
+        s_lyfrac = TRUE;
+      }
+    } else
+      s_lyfrac = FALSE;
+    break;
+    break;
+  default:
+    fprintf (stderr, "Unimplemented EZPLOT command\n");
+    break;
   }
   
   pol_reader ();
@@ -379,13 +401,13 @@ EZPlot::do_cmd (int lx)
 }
 
 
-
+\r
 void 
 EZPlot::bad_option (char *opt)
 {
-       sys_error (ERR_WARNING, "INVALID option: %s", opt);
+  sys_error (ERR_WARNING, "INVALID option: %s", opt);
 }
-
+\r
 
 //----------------------------------------------------------------------
 //                     KEYWORDS / CODES TABLE
@@ -393,89 +415,90 @@ EZPlot::bad_option (char *opt)
 const struct KeywordCodeTable EZPlot::m_sKeywords[] =\r
 {\r
   {"solid",    S_SOLID},
-       {"dash", S_DASH},
-       {"noline",      S_NOLINE},
-       {"black",       S_BLACK},
-       {"red",         S_RED},
-       {"blue",                S_BLUE},
-       {"green",       S_GREEN},
-                               {"pen",         S_PEN},
-       {"symbol",      S_SYMBOL},
-       {"every",       S_EVERY},    
-       {"none",                S_NONE},  
-       {"legend",      S_LEGEND},
-       {"xlegend",     S_XLEGEND},
-       {"ylegend",     S_YLEGEND},
-       
-       {"xlin",                S_XLIN},
-                               {"ylin",                S_YLIN},
-       {"xlog",                S_XLOG},
-       {"ylog",                S_YLOG},
-       {"xlabel",      S_XLABEL},
-       {"ylabel",      S_YLABEL},
-       {"xlength",     S_XLENGTH},
-       {"ylength",     S_YLENGTH},
-       
-       {"xticks",      S_XTICKS},
-       {"yticks",      S_YTICKS},
-       {"above",       S_ABOVE},
-       {"label",       S_LABEL},
-       {"below",       S_BELOW},
-       {"nolabel",     S_NOLABEL},
-       {"right",       S_RIGHT},
-       {"left",                S_LEFT},
-       
-       {"xautoscale",  S_XAUTOSCALE},
-       {"yautoscale",  S_YAUTOSCALE},
-       {"xmin",                S_XMIN},
-       {"ymin",                S_YMIN},
-       {"xmax",                S_XMAX},
-       {"ymax",                S_YMAX},
-       {"lxfrac",      S_LXFRAC},
-       {"lyfrac",      S_LYFRAC},
-       {"xcross",      S_XCROSS},
-       {"ycross",      S_YCROSS},
-       {"noxaxis",     S_NOXAXIS},
-       {"noyaxis",     S_NOYAXIS},
-       {"xporigin",    S_XPORIGIN},
-       {"yporigin",    S_YPORIGIN},
-       {"title",       S_TITLE},
-       {"xtitle",      S_XTITLE},
-       {"ytitle",      S_YTITLE},
-       
-       {"replot",      S_REPLOT},
-       {"clear",       S_CLEAR},
-       {"store",       S_STORE},
-       {"restore",     S_RESTORE},
-       {"amark",       S_AMARK},
-       {"units",       S_UNITS},
-       {"inches",      S_INCHES},
-       {"user",                S_USER},
-       
-       {"data",                S_DATA},
-       {"help",                S_HELP},
-       {"exit",                S_EXIT},
-       
-       {"box",         S_BOX},
-       {"nobox",       S_NOBOX},
-       {"grid",                S_GRID},
-       {"nogrid",      S_NOGRID},
-       {"major",       S_MAJOR},
-       {"minor",       S_MINOR},
-       {"color",       S_COLOR},
-       {"legendbox",   S_LEGENDBOX},
-       
-       {"no",          S_NO},
-       
-       {"textsize",    S_TEXTSIZE},
+  {"dash", S_DASH},\r
+  {"curve", S_CURVE},
+  {"noline",   S_NOLINE},
+  {"black",    S_BLACK},
+  {"red",              S_RED},
+  {"blue",             S_BLUE},
+  {"green",    S_GREEN},
+  {"pen",              S_PEN},
+  {"symbol",   S_SYMBOL},
+  {"every",    S_EVERY},    
+  {"none",             S_NONE},  
+  {"legend",   S_LEGEND},
+  {"xlegend",  S_XLEGEND},
+  {"ylegend",  S_YLEGEND},
+  
+  {"xlin",             S_XLIN},
+  {"ylin",             S_YLIN},
+  {"xlog",             S_XLOG},
+  {"ylog",             S_YLOG},
+  {"xlabel",   S_XLABEL},
+  {"ylabel",   S_YLABEL},
+  {"xlength",  S_XLENGTH},
+  {"ylength",  S_YLENGTH},
+  
+  {"xticks",   S_XTICKS},
+  {"yticks",   S_YTICKS},
+  {"above",    S_ABOVE},
+  {"label",    S_LABEL},
+  {"below",    S_BELOW},
+  {"nolabel",  S_NOLABEL},
+  {"right",    S_RIGHT},
+  {"left",             S_LEFT},
+  
+  {"xautoscale",       S_XAUTOSCALE},
+  {"yautoscale",       S_YAUTOSCALE},
+  {"xmin",             S_XMIN},
+  {"ymin",             S_YMIN},
+  {"xmax",             S_XMAX},
+  {"ymax",             S_YMAX},
+  {"lxfrac",   S_LXFRAC},
+  {"lyfrac",   S_LYFRAC},
+  {"xcross",   S_XCROSS},
+  {"ycross",   S_YCROSS},
+  {"noxaxis",  S_NOXAXIS},
+  {"noyaxis",  S_NOYAXIS},
+  {"xporigin", S_XPORIGIN},
+  {"yporigin", S_YPORIGIN},
+  {"title",    S_TITLE},
+  {"xtitle",   S_XTITLE},
+  {"ytitle",   S_YTITLE},
+  
+  {"replot",   S_REPLOT},
+  {"clear",    S_CLEAR},
+  {"store",    S_STORE},
+  {"restore",  S_RESTORE},
+  {"amark",    S_AMARK},
+  {"units",    S_UNITS},
+  {"inches",   S_INCHES},
+  {"user",             S_USER},
+  
+  {"data",             S_DATA},
+  {"help",             S_HELP},
+  {"exit",             S_EXIT},
+  
+  {"box",              S_BOX},
+  {"nobox",    S_NOBOX},
+  {"grid",             S_GRID},
+  {"nogrid",   S_NOGRID},
+  {"major",    S_MAJOR},
+  {"minor",    S_MINOR},
+  {"color",    S_COLOR},
+  {"legendbox",        S_LEGENDBOX},
+  
+  {"no",               S_NO},
+  
+  {"textsize", S_TEXTSIZE},
 };
 \r
 const int EZPlot::NKEYS = (sizeof(EZPlot::m_sKeywords) / sizeof (struct KeywordCodeTable));
 
 void 
-EZPlot::initkw(void)
+EZPlot::initKeywords ()
 {
-       for (unsigned int i = 0; i < NKEYS; i++)
-               if (! pol_install (m_sKeywords[i].keyword, m_sKeywords [i].code))
-                       sys_error(ERR_SEVERE, "error installing ezset keywords [EZPlot::initkw]");
+  for (int i = 0; i < NKEYS; i++)
+    if (! pol_install (m_sKeywords[i].keyword, m_sKeywords [i].code))
+      sys_error(ERR_SEVERE, "error installing ezset keywords [EZPlot::initKeywords]");
 }
index d4a162fab9a0c0dcced845928a2538ccca3a7d2e..5ba490028b29b371648ef806fd5e714d14798457 100644 (file)
@@ -6,7 +6,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: pol.cpp,v 1.4 2000/12/20 14:39:09 kevin Exp $
+**  $Id: pol.cpp,v 1.5 2000/12/25 21:54:26 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
 #include "pol.h"
 
 
-static const int HASHSIZE=20;
+static const int HASHSIZE=100;
 
 
-/* Tables words stored with install() & found with lookup() */
-static SYMBOL *skiptable[HASHSIZE];            /* words to ignore and skip */
-static SYMBOL *cmdtable[HASHSIZE];             /* pol parameter commands */
-static SYMBOL *usertable[HASHSIZE];            /* user defined symbols */
+// Tables words stored with install() & found with lookup() 
+static SYMBOL *skiptable[HASHSIZE];            // words to ignore and skip 
+static SYMBOL *cmdtable[HASHSIZE];             // pol parameter commands 
+static SYMBOL *usertable[HASHSIZE];            // user defined symbols 
 
-static struct token_st token;                          /* current token */
+static struct token_st token;                          // current token 
+\r
 
 static struct metachar {
     char eoc;          /* end of command character */
@@ -54,12 +55,12 @@ static struct metachar {
     char inb;          /* input from graphics device */
 } meta;
 
-/* current pol state */
-
+\r
+// current pol state 
 static struct pol_st {
-    char skipchars[MAXSKIPCHAR];       /* characters to skip */
-    int nl_eoc;                                /* TRUE if newline character ends a command */
-    int trace;                         /* TRUE if trace is on */
+    char skipchars[MAXSKIPCHAR];       // characters to skip 
+    int nl_eoc;                                // TRUE if newline character ends a command 
+    int trace;                         // TRUE if trace is on 
 } pol;
 
 struct key {
@@ -67,24 +68,25 @@ struct key {
     int  code;
 };
 
-/* internal codes for pol commands */
-
-#define PC_EOC     1
-#define PC_STR     2
-#define PC_COM     3
-#define PC_CMD     4
-#define PC_PRG     5
-#define PC_CON     6
-#define PC_OUT     7
-#define PC_TER     8
-#define PC_INB     9
-#define PC_NL_EOC  10
-#define PC_NL_NEOC 11
-#define PC_TRON           12
-#define PC_TROFF   13
-#define PC_FILE           14
-#define PC_DUMP           15
-
+// Internal codes for pol commands 
+enum {\r
+   PC_EOC = 1,
+   PC_STR,
+   PC_COM,
+   PC_CMD,
+   PC_PRG,
+   PC_CON,     
+   PC_OUT,
+   PC_TER,
+   PC_INB,        
+   PC_NL_EOC,
+   PC_NL_NEOC,
+   PC_TRON,
+   PC_TROFF,
+   PC_FILE,
+   PC_DUMP,
+};
+\r
 static struct key cmdlist[] = {
   {    "eoc",  PC_EOC,},
   {    "str",  PC_STR,},
@@ -104,7 +106,8 @@ static struct key cmdlist[] = {
   {    "dump",  PC_DUMP,},
 };
 
-#define NUMCMD (sizeof(cmdlist) / sizeof (struct key))
+const int NUMCMD = (sizeof(cmdlist) / sizeof (struct key));
+\r
 
 static int skiptok(char term[]);
 static int pol_tok(struct token_st *token);
@@ -126,7 +129,6 @@ static void freetable(SYMBOL *table[]);
 static int hash(char *s);
 static SYMBOL *lookup(SYMBOL *table[], char *s);
 static SYMBOL *install(SYMBOL *table[], char *s, int def);
-static void synerr(char *msg);
 static int pol_getch(FILE *fp);
 
 
@@ -193,7 +195,7 @@ pol_install (char *str, int code)
 {
     if (install (usertable, str, code) == NULL)
        {
-           synerr ("Out ot memory installing user tokens");
+           sys_error  (ERR_SEVERE, "Out of memory installing user tokens");
            return (FALSE);
        }
     
@@ -467,12 +469,12 @@ static int getcmd(void)
 
        tt = getalpha (str, MAXTOK);
        if (tt == TT_ERROR) {
-           synerr ("error in pol parameter command");
+           sys_error (ERR_WARNING, "Error in POL parameter command");
            pol_reader();
            return(FALSE);
        }
        if ((cmd = lookup (cmdtable,str)) == NULL) {
-           synerr ("unrecognized command");
+           sys_error  (ERR_WARNING, "POL: Unrecognized command %s", cmd);
            pol_reader();
            return (FALSE);
        } else {
@@ -510,7 +512,7 @@ static int getcmd(void)
            if (found == FALSE) {
                tt = gettok (&tok);
                if (tt != TT_SPECLCHAR) {
-                   synerr("illegal command character");
+                   sys_error (ERR_SEVERE, "POL: Illegal command character");
                    return (FALSE);
                }
                switch(cmd->code) {
@@ -641,7 +643,7 @@ getalpha (char *s, int toksiz)
        pol_ungetch(s[i]);
 
        if (i >= toksiz)
-           synerr("token too long.");
+           sys_error (ERR_SEVERE, "POL token too long.");
 
        s[i] = EOS;                     /* terminate token */
        return (alphatype);
@@ -671,16 +673,16 @@ getescape (       /* reads up to delim */
 
        for (i = 0; (c = pol_inchar()) != delim; i++) {
            if (c == NEWLINE) {
-               synerr ("Missing closing delimiter.");
+               sys_error (ERR_WARNING, "Missing closing delimiter.");
                break;
            }
            if (i >= toksiz) {
-               synerr("string too long.");
+               sys_error (ERR_SEVERE, "string too long.");
                break;
            }
            if (c == EOF) {
                pol_ungetch(c);
-               synerr("end of file inside quotation");
+               sys_error (ERR_SEVERE, "end of file inside quotation");
                break;
            } else if (c == BSLASH) {   /* escape character */
                s[i++] = c;
@@ -949,11 +951,11 @@ install (SYMBOL *table[], char *name, int def)
     if ((np = lookup (table, name)) == NULL) { /* not found */
        np = (SYMBOL *) malloc (sizeof(*np));
        if (np == NULL) {
-           synerr(installerr);
+           sys_error (ERR_SEVERE, installerr);
            return (NULL);
        }
        if ((np->name = strdup(name)) == NULL) {
-           synerr(installerr);
+           sys_error (ERR_SEVERE, installerr);
            return (NULL);
        }
        str_lower (np->name);
@@ -979,17 +981,10 @@ static char *fname[MAXFILE];              /* pointer to filename */
 static char inputline[MAXLINE];                /* current input line */
 static int lineptr;                    /* current position in inputline */
 
-static void 
-synerr (char *msg)
-{
-       fputs (fname[currentf], stderr);
-       fputs (msg, stderr);
-       fputc (NEWLINE, stderr);
-}
 
-/*----------------------------------------------------------------------*/
-/*                             POL INPUT                               */
-/*----------------------------------------------------------------------*/
+//----------------------------------------------------------------------
+//                             POL INPUT                               
+//----------------------------------------------------------------------
 
 #define BUFSIZE 100
 static int bp = 0;             /* pointer to next free position */
@@ -1011,7 +1006,7 @@ pol_usefile (int source, char *fn)
        ++currentf;
        if (currentf >= MAXFILE) {
            --currentf;
-           synerr ("files nested too deeply");
+           sys_error (ERR_SEVERE, "files nested too deeply");
            return;
        }
 
@@ -1024,7 +1019,7 @@ pol_usefile (int source, char *fn)
                fp = stdin;
            } else if ((fp = fopen(fn, "r")) == NULL) {
                --currentf;
-               synerr ("can't open file");
+               sys_error (ERR_SEVERE, "can't open file");
                return;
            }
            filep[currentf] = fp;
@@ -1118,7 +1113,7 @@ get_inputline (FILE *fp)
 }
 
 void 
-set_inputline (const char const *line)
+set_inputline (const char* const line)
 {
        lineptr = 0;
        bp = 0;
index d3ea434b9b27a2cd8946f41b516d6d7bdced3543..4b2d5dcfea9cf1c52a8211b0a3d656dfd65ef821 100644 (file)
@@ -7,7 +7,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: sgp.cpp,v 1.22 2000/12/18 06:47:03 kevin Exp $
+**  $Id: sgp.cpp,v 1.23 2000/12/25 21:54:26 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -92,21 +92,25 @@ SGP::SGP (const SGPDriver& driver)
   m_ctm.setIdentity();
 
 #if HAVE_WXWINDOWS
-  m_pen.SetWidth(1);
-  m_pen.SetStyle(wxSOLID);
+  m_pen.SetWidth (1);
 
   if (m_driver.isWX()) {
     static const double dScreenDPI = 82;
     static const double dPointsPerInch = 72.;
     m_dPointsPerPixel = dPointsPerInch / dScreenDPI;
-    const int iTestPointSize = 12;
-    m_font.SetPointSize (iTestPointSize);
-    m_driver.idWX()->SetFont(m_font);
+    const int iTestPointSize = 12;\r
+    m_pFont = new wxFont (wxROMAN, wxNORMAL, wxNORMAL, wxNORMAL);
+    m_pFont->SetPointSize (iTestPointSize);\r
+    m_pFont->SetWeight (wxNORMAL);\r
+    m_pFont->SetStyle (wxNORMAL);
+    m_pFont->SetFamily (wxROMAN);\r
+#ifdef MSVC\r
+    m_pFont->SetFaceName(wxString("times new roman"));\r
+#endif\r
+    m_driver.idWX()->SetFont (*m_pFont);
     double dTestCharHeight = m_driver.idWX()->GetCharHeight();
     m_dPointsPerPixel = iTestPointSize / dTestCharHeight;\r
-//     wxWHITE_BRUSH->SetColour (255, 255, 255);\r
-//     wxWHITE_BRUSH->SetStyle (wxSOLID);\r
-       m_driver.idWX()->SetBackground (*wxWHITE_BRUSH);
+       m_driver.idWX()->SetBackground (*wxWHITE_BRUSH);
   }
 #endif
 
@@ -117,9 +121,19 @@ SGP::SGP (const SGPDriver& driver)
   
   setTextAngle (0.);
   setTextPointSize (12);
-  setColor (C_BLACK);
+  setColor (C_BLACK);\r
+  setLineStyle (LS_SOLID);
 }
 
+SGP::~SGP()\r
+{\r
+#if HAVE_WXWINDOWS\r
+  if (m_driver.isWX()) {\r
+    m_driver.idWX()->SetFont (wxNullFont);\r
+    delete m_pFont;\r
+  }\r
+#endif\r
+}\r
 
 void
 SGP::stylusNDC (double x, double y, bool beam)
@@ -380,7 +394,37 @@ SGP::setMarker (int idMarke, int iColor)
 //==============================================================
 void 
 SGP::setLineStyle (int style)
-{
+{\r
+  m_iLinestyle = style;\r
+
+#if HAVE_WXWINDOWS\r
+  if (m_driver.isWX()) {\r
+    switch (m_iLinestyle) {\r
+    case LS_SOLID:\r
+      m_pen.SetStyle (wxSOLID);\r
+      break;\r
+    case LS_DASH1:\r
+      m_pen.SetStyle (wxLONG_DASH);\r
+      break;\r
+    case LS_DASH2:\r
+      m_pen.SetStyle (wxSHORT_DASH);\r
+      break;\r
+    case LS_DASH3:\r
+      m_pen.SetStyle (wxDOT_DASH);\r
+      break;\r
+    case LS_DASH4:\r
+      m_pen.SetStyle (wxCROSS_HATCH);\r
+      break;\r
+    case LS_DOTTED:\r
+      m_pen.SetStyle (wxDOT);\r
+      break;\r
+    default:\r
+      m_pen.SetStyle (wxSOLID);\r
+      break;\r
+    }\r
+    m_driver.idWX()->SetPen (m_pen);\r
+  }\r
+#endif\r
 }
 
 //==============================================================
@@ -443,8 +487,8 @@ SGP::setTextSize (double height)
   if (m_driver.isWX()) {
       double dHeightPixels = height * m_iPhysicalYSize;
       double dHeightPoints = dHeightPixels * m_dPointsPerPixel;
-      m_font.SetPointSize (nearest<int>(dHeightPoints));
-      m_driver.idWX()->SetFont (m_font);
+      m_pFont->SetPointSize (nearest<int>(dHeightPoints));
+      m_driver.idWX()->SetFont (*m_pFont);
   }
 #endif
 }
@@ -460,8 +504,8 @@ SGP::setTextNDCSize (double height)
 #if HAVE_WXWINDOWS
   if (m_driver.isWX()) {
       double dHeightPoints = dHeightPixels * m_dPointsPerPixel;
-      m_font.SetPointSize (nearest<int>(dHeightPoints));
-      m_driver.idWX()->SetFont (m_font);
+      m_pFont->SetPointSize (nearest<int>(dHeightPoints));
+      m_driver.idWX()->SetFont (*m_pFont);
   }
 #endif
 }
@@ -475,8 +519,8 @@ SGP::setTextPointSize (double height)
 #endif
 #if HAVE_WXWINDOWS
   if (m_driver.isWX()) {
-      m_font.SetPointSize (static_cast<int>(height+0.5));
-      m_driver.idWX()->SetFont (m_font);
+      m_pFont->SetPointSize (static_cast<int>(height+0.5));
+      m_driver.idWX()->SetFont (*m_pFont);
   }
 #endif
 }
@@ -489,10 +533,8 @@ SGP::getTextExtent (const char* szText, double* worldW, double* worldH)
     wxString sText (szText);
     wxCoord deviceW, deviceH;
     m_driver.idWX()->GetTextExtent (sText, &deviceW, &deviceH);
-    *worldW = static_cast<double>(deviceW) / static_cast<double>(m_iPhysicalXSize);;
-    *worldH = static_cast<double>(deviceH) / static_cast<double>(m_iPhysicalYSize);
-    *worldW *= (xw_max - xw_min);
-    *worldH *= (yw_max - yw_min);
+    *worldW = (xw_max - xw_min) * deviceW / static_cast<double>(m_iPhysicalXSize);;
+    *worldH = (yw_max - yw_min) * deviceH / static_cast<double>(m_iPhysicalYSize);
   }
 #endif
 }
index 998c9aedb7cd95e775e0f2a9e868fc0af4149d07..15389c4ef1dad43681505975b47cae5dff53db33 100644 (file)
@@ -3,6 +3,18 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
 \r
 ###############################################################################\r
 \r
+Project: "DrawingVC"="..\..\wx2\samples\drawing\DrawingVC.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
 Project: "FFTW2st"="..\..\fftw-2.1.3\Win32\FFTW2st\FFTW2st.dsp" - Package Owner=<4>\r
 \r
 Package=<5>\r
index 89fc5c63c3a26ccb3bedf03ed8b86587401228a2..2f9de80597fd9ae7ad45ad0a68b11ee67fcf0f0b 100644 (file)
@@ -6,13 +6,13 @@
 --------------------Configuration: libctsim - Win32 Debug--------------------\r
 </h3>\r
 <h3>Command Lines</h3>\r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFC.tmp" with contents\r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP26F.tmp" with contents\r
 [\r
 /nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\..\..\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c \r
 "C:\ctsim-2.0.6\libctgraphics\ezplot.cpp"\r
 ]\r
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFC.tmp" \r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFD.tmp" with contents\r
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP26F.tmp" \r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP270.tmp" with contents\r
 [\r
 /nologo /out:"Debug\libctsim.lib" \r
 ".\Debug\array2dfile.obj"\r
@@ -42,7 +42,7 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFD.tmp" with content
 ".\Debug\transformmatrix.obj"\r
 ".\Debug\xform.obj"\r
 ]\r
-Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFD.tmp"\r
+Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP270.tmp"\r
 <h3>Output Window</h3>\r
 Compiling...\r
 ezplot.cpp\r
@@ -51,7 +51,16 @@ Creating library...
 --------------------Configuration: ctsim - Win32 Debug--------------------\r
 </h3>\r
 <h3>Command Lines</h3>\r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFE.tmp" with contents\r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP271.tmp" with contents\r
+[\r
+/nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "\wx2\include" /I "." /I "..\..\include" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\zlib" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"2.5.0\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"2.5.0\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c \r
+"C:\ctsim-2.0.6\src\ctsim.cpp"\r
+"C:\ctsim-2.0.6\src\dialogs.cpp"\r
+"C:\ctsim-2.0.6\src\docs.cpp"\r
+"C:\ctsim-2.0.6\src\views.cpp"\r
+]\r
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP271.tmp" \r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP272.tmp" with contents\r
 [\r
 comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libctsim/Debug/libctsim.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\lpng108\msvc\win32\libpng\lib_dbg\libpng.lib ..\..\..\lpng108\msvc\win32\zlib\lib_dbg\zlib.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib ../../../wx2/lib/wxd.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrtd.lib" /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" \r
 ".\Debug\ctsim.obj"\r
@@ -66,14 +75,24 @@ comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib w
 "\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib"\r
 "\wx2\lib\wxd.lib"\r
 ]\r
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFE.tmp"\r
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP272.tmp"\r
 <h3>Output Window</h3>\r
+Compiling...\r
+views.cpp\r
+Skipping... (no relevant changes detected)\r
+ctsim.cpp\r
+dialogs.cpp\r
+docs.cpp\r
 Linking...\r
+Creating command line "bscmake.exe /nologo /o"Debug/ctsim.bsc"  ".\Debug\ctsim.sbr" ".\Debug\dialogs.sbr" ".\Debug\dlgprojections.sbr" ".\Debug\dlgreconstruct.sbr" ".\Debug\docs.sbr" ".\Debug\views.sbr""\r
+Creating browse info file...\r
+BSCMAKE: warning BK4503 : minor error in .SBR file '.\Debug\views.sbr' ignored\r
+<h3>Output Window</h3>\r
 \r
 \r
 \r
 <h3>Results</h3>\r
-ctsim.exe - 0 error(s), 0 warning(s)\r
+ctsim.exe - 0 error(s), 1 warning(s)\r
 </pre>\r
 </body>\r
 </html>\r
index dddf2105547c339dab97cf758d431ba826b3f128..24ef0a299f716cbaca41b4660d955e95e5a12055 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsim.h,v 1.12 2000/12/22 04:18:00 kevin Exp $
+**  $Id: ctsim.h,v 1.13 2000/12/25 21:54:26 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -111,6 +111,9 @@ public:
     wxString getUntitledFilename();
 \r
     void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF);\r
+\r
+    bool getSetModifyNewDocs() const\r
+    { return false; }\r
 
 private:
     wxDocManager* m_docManager;
index 8b1abce2803d6167fa5d90ad2addf1d6166342e2..9188b34714abb25b48898c89476271b96d76c679 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.37 2000/12/23 18:12:35 kevin Exp $
+**  $Id: views.cpp,v 1.38 2000/12/25 21:54:26 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -152,7 +152,7 @@ ImageFileCanvas::OnMouseEvent(wxMouseEvent& event)
   }\r
   if (event.LeftUp()) {\r
     std::ostringstream os;\r
-    os << "Selected column" << pt.x << " and row" << pt.y << "\n";\r
+    os << "Selected column " << pt.x << " , row " << pt.y << "\n";\r
     *theApp->getLog() << os.str().c_str();\r
   }\r
 }
@@ -284,7 +284,8 @@ ImageFileView::OnCompare (wxCommandEvent& event)
           return;\r
         }\r
 \r
-        pDifferenceDoc->Modify(true);\r
+        if (theApp->getSetModifyNewDocs())\r
+          pDifferenceDoc->Modify(true);\r
         pDifferenceDoc->UpdateAllViews(this);\r
         pDifferenceDoc->GetFirstView()->OnUpdate (this, NULL);\r
       }\r
@@ -508,7 +509,8 @@ ImageFileView::OnPlotRow (wxCommandEvent& event)
     }\r
     delete pX;\r
     delete pY;\r
-    pPlotDoc->Modify(true);\r
+    if (theApp->getSetModifyNewDocs())\r
+       pPlotDoc->Modify(true);\r
   }\r
   \r
 }\r
@@ -554,7 +556,8 @@ ImageFileView::OnPlotCol (wxCommandEvent& event)
     }\r
     delete pX;\r
     delete pY;\r
-    pPlotDoc->Modify(true);\r
+    if (theApp->getSetModifyNewDocs())\r
+      pPlotDoc->Modify(true);\r
   }\r
 }\r
 \r
@@ -606,6 +609,11 @@ ImageFileView::OnCompareCol (wxCommandEvent& event)
         rPlotFile.addEzsetCommand (title.c_str());\r
         rPlotFile.addEzsetCommand ("xlabel Row");\r
         rPlotFile.addEzsetCommand ("ylabel Pixel Value");\r
+        rPlotFile.addEzsetCommand ("curve 1");\r
+        rPlotFile.addEzsetCommand ("color 2");\r
+        rPlotFile.addEzsetCommand ("curve 2");\r
+        rPlotFile.addEzsetCommand ("color 4");\r
+        rPlotFile.addEzsetCommand ("dash 5");\r
         rPlotFile.addEzsetCommand ("box");\r
         rPlotFile.addEzsetCommand ("grid");\r
         rPlotFile.setCurveSize (3, nx);\r
@@ -616,7 +624,8 @@ ImageFileView::OnCompareCol (wxCommandEvent& event)
       delete pX;\r
       delete pY1;\r
       delete pY2;\r
-      pPlotDoc->Modify(true);\r
+      if (theApp->getSetModifyNewDocs())\r
+        pPlotDoc->Modify(true);\r
     }\r
   }\r
 }\r
@@ -671,6 +680,11 @@ ImageFileView::OnCompareRow (wxCommandEvent& event)
         rPlotFile.addEzsetCommand (title.c_str());\r
         rPlotFile.addEzsetCommand ("xlabel Column");\r
         rPlotFile.addEzsetCommand ("ylabel Pixel Value");\r
+        rPlotFile.addEzsetCommand ("curve 1");\r
+        rPlotFile.addEzsetCommand ("color 2");\r
+        rPlotFile.addEzsetCommand ("curve 2");\r
+        rPlotFile.addEzsetCommand ("color 4");\r
+        rPlotFile.addEzsetCommand ("dash 5");\r
         rPlotFile.addEzsetCommand ("box");\r
         rPlotFile.addEzsetCommand ("grid");\r
         rPlotFile.setCurveSize (3, ny);\r
@@ -681,7 +695,8 @@ ImageFileView::OnCompareRow (wxCommandEvent& event)
       delete pX;\r
       delete pY1;\r
       delete pY2;\r
-      pPlotDoc->Modify(true);\r
+      if (theApp->getSetModifyNewDocs())\r
+        pPlotDoc->Modify(true);\r
     }\r
   }\r
 }\r
@@ -824,7 +839,8 @@ PhantomView::OnProjections (wxCommandEvent& event)
         theApp->getDocManager()->ActivateView (pView, true, false);
       }
       ::wxYield();
-      pProjectionDoc->Modify(true);
+      if (theApp->getSetModifyNewDocs())\r
+        pProjectionDoc->Modify(true);
       pProjectionDoc->UpdateAllViews(this);
     }
   }
@@ -860,7 +876,8 @@ PhantomView::OnRasterize (wxCommandEvent& event)
           return;
         }
       }
-      pRasterDoc->Modify(true);
+      if (theApp->getSetModifyNewDocs())\r
+        pRasterDoc->Modify(true);
       pRasterDoc->UpdateAllViews(this);
       ImageFileView* rasterView = dynamic_cast<ImageFileView*>(pRasterDoc->GetFirstView());\r
       if (rasterView) {\r
@@ -1146,7 +1163,8 @@ ProjectionFileView::OnReconstruct (wxCommandEvent& event)
         }
       }
       delete pReconstruct;
-      pReconDoc->Modify(true);
+      if (theApp->getSetModifyNewDocs())\r
+        pReconDoc->Modify(true);
       pReconDoc->UpdateAllViews(this);
       ImageFileView* rasterView = dynamic_cast<ImageFileView*>(pReconDoc->GetFirstView());\r
       if (rasterView) {\r