From: Kevin M. Rosenberg Date: Mon, 25 Dec 2000 21:54:26 +0000 (+0000) Subject: r313: *** empty log message *** X-Git-Tag: debian-4.5.3-3~704 X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=commitdiff_plain;h=5ec5449357eaae253d6b1026621262480e2efa63 r313: *** empty log message *** --- diff --git a/ChangeLog b/ChangeLog index 89179db..b8cd410 100644 --- 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 diff --git a/include/ezplot.h b/include/ezplot.h index 6ad4b5b..a7559da 100644 --- a/include/ezplot.h +++ b/include/ezplot.h @@ -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, + S_CURVE, S_SOLID, S_DASH, S_NOLINE, @@ -215,7 +211,32 @@ private: static const int NKEYS; std::vector m_vecCurves; - + std::vector m_veciColor; + std::vector m_vecbColorSet; + std::vector m_veciSymbol; + std::vector m_vecbSymbolSet; + std::vector m_veciSymbolFreq; + std::vector m_vecbSymbolFreqSet; + std::vector m_veciLinestyle; + std::vector m_vecbLinestyleSet; + std::vector m_vecsLegend; + std::vector m_vecbLegendSet; + + int getColor (unsigned int iCurve) const; + int getSymbol (unsigned int iCurve) const; + const std::string* getLegend (unsigned int iCurve) const; + int getSymbolFreq (unsigned int iCurve) const; + int getLinestyle (unsigned int iCurve) const; + + void setColor (unsigned int iCurve, int iColor); + void setSymbol (unsigned int iCurve, int iSymbol); + void setSymbolFreq (unsigned int iCurve, int iSymbolFreq); + void setLinestyle (unsigned int iCurve, int iLinestyle); + void setLegend (unsigned int iCurve, const std::string& strLegend); + void setLegend (unsigned int iCurve, const char* const pszLegend); + + int m_iCurrentCurve; + // 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); + bool ezcmd (const char* const comm); 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); - 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); diff --git a/include/pol.h b/include/pol.h index cf5d8e0..54ff9f0 100644 --- a/include/pol.h +++ b/include/pol.h @@ -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 @@ -19,26 +19,28 @@ ******************************************************************************/ #ifndef __H_POL #define __H_POL + -/* 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 { + P_USE_STR = 1, // use string as input source + P_USE_FILE, // use file as input source +}; -#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 +}; + #define LETTER 'a' #define DIGIT '0' @@ -51,22 +53,23 @@ #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 */ + + +// 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 +}; + 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; + /* 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 -#endif diff --git a/include/sgp.h b/include/sgp.h index 36b3b75..2a1472b 100644 --- a/include/sgp.h +++ b/include/sgp.h @@ -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; // 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(); void drawCircle (const double r); void drawArc (const double r, double start, double stop); diff --git a/libctgraphics/ezplot.cpp b/libctgraphics/ezplot.cpp index c009535..8c385e0 100644 --- a/libctgraphics/ezplot.cpp +++ b/libctgraphics/ezplot.cpp @@ -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(); - + + m_iCurrentCurve = -1; + 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 +EZPlot::setColor (unsigned int iCurve, int iColor) +{ + if (m_veciColor.size() <= iCurve) { + m_veciColor.resize ((m_iCurrentCurve + 1) * 2); + m_vecbColorSet.resize ((m_iCurrentCurve + 1) * 2); + } + m_veciColor [iCurve] = iColor; + m_vecbColorSet [iCurve] = true; +} + +void +EZPlot::setSymbol (unsigned int iCurve, int iSymbol) +{ + if (m_veciSymbol.size() <= iCurve) { + m_veciSymbol.resize ((m_iCurrentCurve + 1) * 2); + m_vecbSymbolSet.resize ((m_iCurrentCurve + 1) * 2); + } + m_veciSymbol [iCurve] = iSymbol; + m_vecbSymbolSet [iCurve] = true; +} + +void +EZPlot::setSymbolFreq (unsigned int iCurve, int iSymbolFreq) +{ + if (m_veciSymbolFreq.size() <= iCurve) { + m_veciSymbolFreq.resize ((m_iCurrentCurve + 1) * 2); + m_vecbSymbolFreqSet.resize ((m_iCurrentCurve + 1) * 2); + } + m_veciSymbolFreq [iCurve] = iSymbolFreq; + m_vecbSymbolFreqSet [iCurve] = true; +} + +void +EZPlot::setLinestyle (unsigned int iCurve, int iLinestyle) +{ + if (m_veciLinestyle.size() <= iCurve) { + m_veciLinestyle.resize ((m_iCurrentCurve + 1) * 2); + m_vecbLinestyleSet.resize ((m_iCurrentCurve + 1) * 2); + } + m_veciLinestyle [iCurve] = iLinestyle; + m_vecbLinestyleSet [iCurve] = true; +} + +void +EZPlot::setLegend (unsigned int iCurve, const std::string& strLegend) +{ + if (m_vecsLegend.size() <= iCurve) { + m_vecsLegend.resize ((m_iCurrentCurve + 1) * 2); + m_vecbLegendSet.resize ((m_iCurrentCurve + 1) * 2); + } + m_vecsLegend [iCurve] = strLegend; + m_vecbLegendSet [iCurve] = true; +} + +void +EZPlot::setLegend (unsigned int iCurve, const char* const pszLegend) +{ + if (m_vecsLegend.size() <= iCurve) { + m_vecsLegend.resize ((m_iCurrentCurve + 1) * 2); + m_vecbLegendSet.resize ((m_iCurrentCurve + 1) * 2); + } + m_vecsLegend [iCurve] = pszLegend; + m_vecbLegendSet [iCurve] = true; +} + +int +EZPlot::getColor (unsigned int iCurve) const +{ + if (m_veciColor.size() > iCurve && m_vecbColorSet[iCurve]) + return m_veciColor[iCurve]; + else + return o_color; +} + +int +EZPlot::getSymbol (unsigned int iCurve) const +{ + if (m_veciSymbol.size() > iCurve && m_vecbSymbolSet[iCurve]) + return m_veciSymbol[iCurve]; + else + return o_symbol; +} + +int +EZPlot::getSymbolFreq (unsigned int iCurve) const +{ + if (m_veciSymbolFreq.size() > iCurve && m_vecbSymbolFreqSet[iCurve]) + return m_veciSymbolFreq[iCurve]; + else + return o_symfreq; +} + +int +EZPlot::getLinestyle (unsigned int iCurve) const +{ + if (m_veciLinestyle.size() > iCurve && m_vecbLinestyleSet[iCurve]) + return m_veciLinestyle[iCurve]; + else + return o_linestyle; +} + +const std::string* +EZPlot::getLegend (unsigned int iCurve) const +{ + if (m_vecsLegend.size() > iCurve && m_vecbLegendSet[iCurve]) + return &m_vecsLegend[iCurve]; + else + return NULL; +} + + /* NAME * plot Plots all curves collected by addCurves () * @@ -219,41 +327,34 @@ EZPlot::initPlotSettings () void EZPlot::plot () { -#if 0 - wxFont* myFont = new wxFont (12, wxMODERN, wxNORMAL, wxNORMAL); - rSGP.getDriver().idWX()->SetFont (*myFont); -#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); + charheight = rSGP.getCharHeight(); + charwidth = rSGP.getCharWidth(); + + const EZPlotCurve& firstCurve = *m_vecCurves[0]; 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; + 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;; 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) - nLegend = max_leg; + int num_leg = 0; // number of legend titles + for (iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) { + const std::string* pstrLegend = getLegend (iCurve); + if (pstrLegend && pstrLegend->length() > 0) { + int nLegend = pstrLegend->length(); + if (nLegend > 0) { + ++num_leg; + if (nLegend > max_leg) + nLegend = max_leg; + } } } @@ -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 + 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); + rSGP.drawText (pstrLegend->c_str()); + rSGP.setColor (getColor (iCurve)); + 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) { + } + 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 () double clipRect[4]; clipRect[0] = xgn_min; clipRect[1] = ygn_min; clipRect[2] = xgn_max; clipRect[3] = ygn_max; - - for (EZPlotCurveIterator iterCurve3 = m_vecCurves.begin(); iterCurve3 != m_vecCurves.end(); iterCurve3++) { - const EZPlotCurve& curve = **iterCurve3; - - rSGP.setColor (curve.m_iColor); + + for (iCurve = 0; iCurve < m_vecCurves.size(); iCurve++) { + const EZPlotCurve* const pCurve = m_vecCurves [iCurve]; - 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]); - for (int i = 1; i < curve.m_iPointCount; i++) { - double x2 = convertWorldToNDC_X (curve.x[i]); - double y2 = convertWorldToNDC_Y (curve.y[i]); + rSGP.setColor (getColor (iCurve)); + int iSym = getSymbol (iCurve); + int iLS = getLinestyle (iCurve); + + if (iLS != SGP::LS_NOLINE) { + rSGP.setLineStyle (iLS); + double x1 = convertWorldToNDC_X (pCurve->x[0]); + double y1 = convertWorldToNDC_Y (pCurve->y[0]); + for (int i = 1; i < pCurve->m_iPointCount; i++) { + double x2 = convertWorldToNDC_X (pCurve->x[i]); + double y2 = convertWorldToNDC_Y (pCurve->y[i]); double x2Clip = x2; double y2Clip = y2; if (clip_rect (x1, y1, x2Clip, y2Clip, clipRect)) { @@ -555,19 +660,20 @@ EZPlot::plot () y1 = y2; } } - if (curve.m_iSymbol > 0) { + if (iSym > 0) { + 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]); + 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]); if (y >= ygn_min && y <= ygn_max) { rSGP.moveAbs (x, y); - symbol (curve.m_iSymbol, symwidth, symheight); + symbol (iSym, symwidth, symheight); } } } @@ -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); - rSGP.getDriver().idWX()->SetFont(*wxSWISS_FONT); + } +#if 0 + rSGP.moveAbs(.5,.5); + char s[128]; + snprintf(s,sizeof(s),"%f, %f",charwidth, charheight); + rSGP.drawText(s); +#endif rSGP.setTextAngle (HALFPI); rSGP.setTextSize (1.5 * charheight); - rSGP.setTextColor (clr_label, -1); + rSGP.setTextColor (clr_label, -1); + double xExtent, yExtent; + rSGP.getTextExtent (c_ylabel.c_str(), &xExtent, &yExtent); + rSGP.moveAbs (ylbl_col, ya_min + (ya_max-ya_min)/2 - yExtent); + rSGP.drawText (c_ylabel); rSGP.setTextAngle (0.0); rSGP.setTextSize (charheight); minorinc = yn_tickinc / (o_yminortick + 1); diff --git a/libctgraphics/ezset.cpp b/libctgraphics/ezset.cpp index 1b8741d..b380e9a 100644 --- a/libctgraphics/ezset.cpp +++ b/libctgraphics/ezset.cpp @@ -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 EZPlot::ezset (const std::string& command) { - return ezset (command.c_str()); + return ezset (command.c_str()); } 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)); + if (m_iCurrentCurve >= 0) + 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; + ls = SGP::LS_DASH1; + if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) { + 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) + ls = SGP::LS_DASH4; + else if (n == 5) + ls = SGP::LS_DOTTED; + } + if (m_iCurrentCurve < 0) + o_linestyle = ls; + else + setLinestyle (m_iCurrentCurve, ls); + 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) { + if (m_iCurrentCurve < 0) + o_color = n; + else + setColor (m_iCurrentCurve, 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) { + if (m_iCurrentCurve < 0) + o_symbol = n; + else + setSymbol (m_iCurrentCurve, n); + } + } else { + if (pol_word("every",5) == TRUE) { + if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) { + int sym = 1; + if (n > 0) + sym = n; + if (m_iCurrentCurve < 0) + o_symfreq = sym; + else + setSymbolFreq (m_iCurrentCurve, sym); + } + } else if (pol_word ("none",4) == TRUE) { + o_symbol = -1; + } + } + break; + case S_CURVE: + if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) { + if (n > 0) + m_iCurrentCurve = n - 1; + } else { + if (pol_word ("all",3) == TRUE) + m_iCurrentCurve = -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; } pol_reader (); @@ -379,13 +401,13 @@ EZPlot::do_cmd (int lx) } - + void EZPlot::bad_option (char *opt) { - sys_error (ERR_WARNING, "INVALID option: %s", opt); + sys_error (ERR_WARNING, "INVALID option: %s", opt); } - + //---------------------------------------------------------------------- // KEYWORDS / CODES TABLE @@ -393,89 +415,90 @@ EZPlot::bad_option (char *opt) const struct KeywordCodeTable EZPlot::m_sKeywords[] = { {"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}, + {"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}, }; 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]"); } diff --git a/libctgraphics/pol.cpp b/libctgraphics/pol.cpp index d4a162f..5ba4900 100644 --- a/libctgraphics/pol.cpp +++ b/libctgraphics/pol.cpp @@ -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 @@ -32,15 +32,16 @@ #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 + 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 */ - + +// 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 { + 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, +}; + 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)); + 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; diff --git a/libctgraphics/sgp.cpp b/libctgraphics/sgp.cpp index d3ea434..4b2d5dc 100644 --- a/libctgraphics/sgp.cpp +++ b/libctgraphics/sgp.cpp @@ -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; + m_pFont = new wxFont (wxROMAN, wxNORMAL, wxNORMAL, wxNORMAL); + m_pFont->SetPointSize (iTestPointSize); + m_pFont->SetWeight (wxNORMAL); + m_pFont->SetStyle (wxNORMAL); + m_pFont->SetFamily (wxROMAN); +#ifdef MSVC + m_pFont->SetFaceName(wxString("times new roman")); +#endif + m_driver.idWX()->SetFont (*m_pFont); double dTestCharHeight = m_driver.idWX()->GetCharHeight(); m_dPointsPerPixel = iTestPointSize / dTestCharHeight; -// wxWHITE_BRUSH->SetColour (255, 255, 255); -// wxWHITE_BRUSH->SetStyle (wxSOLID); - 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); + setLineStyle (LS_SOLID); } +SGP::~SGP() +{ +#if HAVE_WXWINDOWS + if (m_driver.isWX()) { + m_driver.idWX()->SetFont (wxNullFont); + delete m_pFont; + } +#endif +} void SGP::stylusNDC (double x, double y, bool beam) @@ -380,7 +394,37 @@ SGP::setMarker (int idMarke, int iColor) //============================================================== void SGP::setLineStyle (int style) -{ +{ + m_iLinestyle = style; + +#if HAVE_WXWINDOWS + if (m_driver.isWX()) { + switch (m_iLinestyle) { + case LS_SOLID: + m_pen.SetStyle (wxSOLID); + break; + case LS_DASH1: + m_pen.SetStyle (wxLONG_DASH); + break; + case LS_DASH2: + m_pen.SetStyle (wxSHORT_DASH); + break; + case LS_DASH3: + m_pen.SetStyle (wxDOT_DASH); + break; + case LS_DASH4: + m_pen.SetStyle (wxCROSS_HATCH); + break; + case LS_DOTTED: + m_pen.SetStyle (wxDOT); + break; + default: + m_pen.SetStyle (wxSOLID); + break; + } + m_driver.idWX()->SetPen (m_pen); + } +#endif } //============================================================== @@ -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(dHeightPoints)); - m_driver.idWX()->SetFont (m_font); + m_pFont->SetPointSize (nearest(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(dHeightPoints)); - m_driver.idWX()->SetFont (m_font); + m_pFont->SetPointSize (nearest(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(height+0.5)); - m_driver.idWX()->SetFont (m_font); + m_pFont->SetPointSize (static_cast(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(deviceW) / static_cast(m_iPhysicalXSize);; - *worldH = static_cast(deviceH) / static_cast(m_iPhysicalYSize); - *worldW *= (xw_max - xw_min); - *worldH *= (yw_max - yw_min); + *worldW = (xw_max - xw_min) * deviceW / static_cast(m_iPhysicalXSize);; + *worldH = (yw_max - yw_min) * deviceH / static_cast(m_iPhysicalYSize); } #endif } diff --git a/msvc/ctsim.dsw b/msvc/ctsim.dsw index 998c9ae..15389c4 100644 --- a/msvc/ctsim.dsw +++ b/msvc/ctsim.dsw @@ -3,6 +3,18 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### +Project: "DrawingVC"="..\..\wx2\samples\drawing\DrawingVC.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "FFTW2st"="..\..\fftw-2.1.3\Win32\FFTW2st\FFTW2st.dsp" - Package Owner=<4> Package=<5> diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index 89fc5c6..2f9de80 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -6,13 +6,13 @@ --------------------Configuration: libctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFC.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP26F.tmp" with contents [ /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 "C:\ctsim-2.0.6\libctgraphics\ezplot.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFC.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFD.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP26F.tmp" +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP270.tmp" with contents [ /nologo /out:"Debug\libctsim.lib" ".\Debug\array2dfile.obj" @@ -42,7 +42,7 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFD.tmp" with content ".\Debug\transformmatrix.obj" ".\Debug\xform.obj" ] -Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFD.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP270.tmp"

Output Window

Compiling... ezplot.cpp @@ -51,7 +51,16 @@ Creating library... --------------------Configuration: ctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFE.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP271.tmp" with contents +[ +/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 +"C:\ctsim-2.0.6\src\ctsim.cpp" +"C:\ctsim-2.0.6\src\dialogs.cpp" +"C:\ctsim-2.0.6\src\docs.cpp" +"C:\ctsim-2.0.6\src\views.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP271.tmp" +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP272.tmp" with contents [ 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" ".\Debug\ctsim.obj" @@ -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" "\wx2\lib\wxd.lib" ] -Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPFE.tmp" +Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP272.tmp"

Output Window

+Compiling... +views.cpp +Skipping... (no relevant changes detected) +ctsim.cpp +dialogs.cpp +docs.cpp Linking... +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"" +Creating browse info file... +BSCMAKE: warning BK4503 : minor error in .SBR file '.\Debug\views.sbr' ignored +

Output Window

Results

-ctsim.exe - 0 error(s), 0 warning(s) +ctsim.exe - 0 error(s), 1 warning(s) diff --git a/src/ctsim.h b/src/ctsim.h index dddf210..24ef0a2 100644 --- a/src/ctsim.h +++ b/src/ctsim.h @@ -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(); void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector& vecIF); + + bool getSetModifyNewDocs() const + { return false; } private: wxDocManager* m_docManager; diff --git a/src/views.cpp b/src/views.cpp index 8b1abce..9188b34 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -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) } if (event.LeftUp()) { std::ostringstream os; - os << "Selected column" << pt.x << " and row" << pt.y << "\n"; + os << "Selected column " << pt.x << " , row " << pt.y << "\n"; *theApp->getLog() << os.str().c_str(); } } @@ -284,7 +284,8 @@ ImageFileView::OnCompare (wxCommandEvent& event) return; } - pDifferenceDoc->Modify(true); + if (theApp->getSetModifyNewDocs()) + pDifferenceDoc->Modify(true); pDifferenceDoc->UpdateAllViews(this); pDifferenceDoc->GetFirstView()->OnUpdate (this, NULL); } @@ -508,7 +509,8 @@ ImageFileView::OnPlotRow (wxCommandEvent& event) } delete pX; delete pY; - pPlotDoc->Modify(true); + if (theApp->getSetModifyNewDocs()) + pPlotDoc->Modify(true); } } @@ -554,7 +556,8 @@ ImageFileView::OnPlotCol (wxCommandEvent& event) } delete pX; delete pY; - pPlotDoc->Modify(true); + if (theApp->getSetModifyNewDocs()) + pPlotDoc->Modify(true); } } @@ -606,6 +609,11 @@ ImageFileView::OnCompareCol (wxCommandEvent& event) rPlotFile.addEzsetCommand (title.c_str()); rPlotFile.addEzsetCommand ("xlabel Row"); rPlotFile.addEzsetCommand ("ylabel Pixel Value"); + rPlotFile.addEzsetCommand ("curve 1"); + rPlotFile.addEzsetCommand ("color 2"); + rPlotFile.addEzsetCommand ("curve 2"); + rPlotFile.addEzsetCommand ("color 4"); + rPlotFile.addEzsetCommand ("dash 5"); rPlotFile.addEzsetCommand ("box"); rPlotFile.addEzsetCommand ("grid"); rPlotFile.setCurveSize (3, nx); @@ -616,7 +624,8 @@ ImageFileView::OnCompareCol (wxCommandEvent& event) delete pX; delete pY1; delete pY2; - pPlotDoc->Modify(true); + if (theApp->getSetModifyNewDocs()) + pPlotDoc->Modify(true); } } } @@ -671,6 +680,11 @@ ImageFileView::OnCompareRow (wxCommandEvent& event) rPlotFile.addEzsetCommand (title.c_str()); rPlotFile.addEzsetCommand ("xlabel Column"); rPlotFile.addEzsetCommand ("ylabel Pixel Value"); + rPlotFile.addEzsetCommand ("curve 1"); + rPlotFile.addEzsetCommand ("color 2"); + rPlotFile.addEzsetCommand ("curve 2"); + rPlotFile.addEzsetCommand ("color 4"); + rPlotFile.addEzsetCommand ("dash 5"); rPlotFile.addEzsetCommand ("box"); rPlotFile.addEzsetCommand ("grid"); rPlotFile.setCurveSize (3, ny); @@ -681,7 +695,8 @@ ImageFileView::OnCompareRow (wxCommandEvent& event) delete pX; delete pY1; delete pY2; - pPlotDoc->Modify(true); + if (theApp->getSetModifyNewDocs()) + pPlotDoc->Modify(true); } } } @@ -824,7 +839,8 @@ PhantomView::OnProjections (wxCommandEvent& event) theApp->getDocManager()->ActivateView (pView, true, false); } ::wxYield(); - pProjectionDoc->Modify(true); + if (theApp->getSetModifyNewDocs()) + pProjectionDoc->Modify(true); pProjectionDoc->UpdateAllViews(this); } } @@ -860,7 +876,8 @@ PhantomView::OnRasterize (wxCommandEvent& event) return; } } - pRasterDoc->Modify(true); + if (theApp->getSetModifyNewDocs()) + pRasterDoc->Modify(true); pRasterDoc->UpdateAllViews(this); ImageFileView* rasterView = dynamic_cast(pRasterDoc->GetFirstView()); if (rasterView) { @@ -1146,7 +1163,8 @@ ProjectionFileView::OnReconstruct (wxCommandEvent& event) } } delete pReconstruct; - pReconDoc->Modify(true); + if (theApp->getSetModifyNewDocs()) + pReconDoc->Modify(true); pReconDoc->UpdateAllViews(this); ImageFileView* rasterView = dynamic_cast(pReconDoc->GetFirstView()); if (rasterView) {