Commit Graph

336 Commits

Author SHA1 Message Date
Holger Vogt 1398ee7aa0 set the proper preprocessor flag __MINGW32__ 2020-03-15 08:51:17 +01:00
Holger Vogt f24ed96cbd plug some memory leaks 2020-03-15 08:51:15 +01:00
Holger Vogt e53632c368 When plotting arrays of curves, plot lines only in the direction
of (in absolute terms) growing x values.
Example: MOS output characteristics.
In the rare case of plotting versus varying x directions
(e.g. example memristor.sp), one has to add the flag
'retraceplot' to the plot command.
2020-03-15 08:51:14 +01:00
Holger Vogt 14b154f5f3 Copy the scale vector as well and attach it to the data vector.
Remove it again when the graph is destroyed.
2020-03-15 08:51:14 +01:00
Holger Vogt f518766c66 add a slight offset between y axis labels and grid 2020-03-15 08:51:14 +01:00
Holger Vogt 1919cf5c94 replace variable 'gridwidth' by 'xgridwidth' 2020-03-15 08:51:13 +01:00
Holger Vogt c2cf4d7eda required for reliable re-plotting, however still has the
return line bug no #472
2020-03-15 08:51:13 +01:00
Holger Vogt acbec3ae81 Preliminary 'fix' to a plotting bug (visible return line in an array of curves):
Partially undo code added in commit 10415875f4/
This will need further discussion or updates
2020-03-15 08:51:13 +01:00
Holger Vogt 8d986e50cc remove the remains of the old xgraph program
that has not been supported for many years
2020-03-15 08:51:12 +01:00
Holger Vogt 32722ecc57 some missing brackets, typos 2020-03-15 08:51:12 +01:00
Holger Vogt 93a408598a switch to colorarray in graph to string all color data,
one set per each graph.
If we are zooming or selecting a cutout, copy the
source graph's colors to the new graph. Transfer the
old graphs id to the new graph via graph->graphid.
2020-03-15 08:51:12 +01:00
Vogt 728ddae41e Set the color tables and linewidths personal for each graph,
added to strucht graph
Use only these data for plotting.
If zooming a plot windows, set as an extra parameter the graph id
of the 'mother graph'. Copy its color and line data to the new graph.
This is done by an extra parameter sgraphid to the internal plot
command that is issued in fcn PlotWindowProc().
Thus zooming will keep the background, text/line and graph colors.
Function setcolor() will always look into the colorarray of the
current graph.
2020-03-15 08:51:12 +01:00
Holger Vogt a7aaac854f enable color and font selection for X11:
Add graphics context gridgc for plotting the grids.
Enable rgbd:, input of color by RGB 0 ... 255
If no color1 (text/grid) is given,
    select black or white according to backgrund color.
Error message, but no crash if font cannot be selected.
Enable separate linewidth selection for grid and graph.
2020-03-15 08:51:11 +01:00
Holger Vogt 800cd05f3d new variable nolegend: with 'set nolegend' plotting of
the legend is suppressed.
2020-03-15 08:51:11 +01:00
Holger Vogt fed7ef378f add variable ticchar, allow an arbitrary character as ticmark 2020-03-15 08:51:11 +01:00
Holger Vogt 38bb89663d replace old_x11 by HAVE_LIBXFT defined in configure 2020-03-15 08:51:09 +01:00
Holger Vogt bef9c70e71 Prepare font selection and rotation only once per graph
in func X11_DefineXft().
Only 0 and 90 degree are supported.
2020-03-15 08:51:08 +01:00
Holger Vogt 3eb04b2fdc improve on memory leaks
(not yet completely satisfying)
2020-03-15 08:51:08 +01:00
Holger Vogt 18f1e896f8 allow independent linewidth and gridwidth settings from within the .control section 2020-03-15 08:51:07 +01:00
Holger Vogt 3d009fef22 Variables xbrushwidth and gridwidth (to be set e.g. in
.spiceinit) allow setting separately the linewidths of the
graph (xbrushwidth) and the grid (gridwidth).
2020-03-15 08:51:06 +01:00
Holger Vogt c9edc6fcb3 Add function returning the true string length in pixels.
May be called from outside of x11.c.
2020-03-15 08:51:06 +01:00
Holger Vogt ca7c77315a add missing üarameter to DevDrawLine for X11 and HPGL 2020-03-15 08:51:06 +01:00
Holger Vogt 8751092812 Enable separate linewidths for grids and graphs.
New variable gridwidth overrides xbrushwidth for graphs.
Fcn DevDrawLine() with boolean flag if grid is plotted.
Postscript, Gnuplot and X11 not (yet) supported.
2020-03-15 08:51:05 +01:00
Holger Vogt 7690b64571 add missing declaration of old_x11 2020-03-15 08:51:05 +01:00
h_vogt 531c229b0e Add library xft for allowing text rotation.
Setting variabe 'old_x11' will retain previous behaviour.
2020-03-15 08:51:05 +01:00
h_vogt dbd0a5743a Enable utf-8 and UNICODE for string handling.
preprocessor flag EXT_ASC resets handling to old behaviour.
Add utf-16 wide char to all Windows string i/o.
Add translation between utf-8 and utf-16.
Add angle to fcn DevDrawText.
2020-03-15 08:51:04 +01:00
Jim Monte 2d9110bf65 Add const to some parameters, made function static 2020-03-15 08:51:02 +01:00
Holger Vogt b7012065ae remove compiler warning by setting variables to 0 2020-03-15 08:50:58 +01:00
Holger Vogt 46adeb5eaa plug memory leaks for the 'plot' command 2020-03-15 08:50:57 +01:00
Jim Monte a7946474fa Additional freeing of device-dependent information for bug #419 and related bugs. 2020-03-15 08:50:55 +01:00
Jim Monte 8141a634d7 Fixed several issues related to plotting and vector lifetimes and made ownership of vectors clearer. The issues in bugs 419, 423, 425, and 426 were related and were addressed here. 2020-03-15 08:50:54 +01:00
Jim Monte 57ffe1769f Fixed "phantom vector" issue with plots and crash when plots are resized. See bugs #419 and #423 for details. Also several parameters were changed from char * to const char * in the plotting functions. 2020-03-15 08:50:54 +01:00
Jim Monte 068df274bf Made ft_numparse() thread-safe (no internal static variables) and prepared to support ngspice variable type CP_NUM. 2020-03-15 08:50:52 +01:00
Holger Vogt 05f02f3662 On Linux: allow calling gnuplot without invoking a terminal.
Reported by Terry Pilling
2020-03-15 08:50:50 +01:00
Holger Vogt ec6d676920 Make CopyGraph safe against NULL argument.
Otherwise memcpy will fail.
2019-09-14 12:38:57 +02:00
Holger Vogt afdf3ff710 Partially undo commit 016c558d7, 2019-05-01
If sacles for plotting differ, issue a warning.
Skip this plot command only, when strict_errorhandling is set.
2019-08-13 23:27:15 +02:00
Holger Vogt 8af1663bba Try to detect, if one wants to plot vectors with
different scale vectors into the same graph.
Issue a warning and skip the plot command.
2019-08-13 23:26:58 +02:00
Holger Vogt 31db4228f5 fix a typo, correct writing to files under Linux 2019-08-13 22:53:41 +02:00
Holger Vogt 52584312c3 delete the plt and data files after writing eps or png
(only if gnuplot_terminal is set to eps/quit of png/quit)
2019-08-13 22:53:32 +02:00
Holger Vogt 8efa08602a no plotting, only saving to file
if gnuplot_terminal is eps/quit or png/quit
2019-08-13 22:53:24 +02:00
Holger Vogt 601dfbd781 sprintf -> snprintf: prevent buffer overflow 2019-08-13 22:53:13 +02:00
Holger Vogt ec4625eda6 redo gnuplot_terminal: Do not save eps/png automatically
none      1: do not print an eps or png file (default)
png       2: print png file, keep command window open
png/quit  3: print png file, quit command window
eps       4: print eps file, keep command window open
eps/quit  5: print eps file, quit command window
2019-08-13 22:53:00 +02:00
Holger Vogt 2344e3d012 patch no. 30 by astx:
don't show command window if gnuplot_terminal is set to png/quit
2019-08-13 22:52:49 +02:00
Holger Vogt 65ee87e0a2 grid.c, windisp.c, vertical text for postscript and WINGUI
Arial as standard font for WINGUI
2018-11-18 15:51:09 +01:00
Holger Vogt 56701e3d10 add rotation angle to text output, currently used only by postscript,
ignored by all others
2018-11-18 15:50:56 +01:00
dwarning cc4e4d9bad verify pointer before utilization 2018-11-18 15:45:12 +01:00
Holger Vogt 94fa272c9d A hack to repair bug reported by Clyde R. Shappee 2018-10-27 12:28:01 +02:00
Holger Vogt e3b2b395b9 fix an ancient bug in retrieving the data with the cursor
from a log y graph: use y-offset instead of x-offset
2018-07-26 20:55:21 +02:00
Holger Vogt 8fbcb16a57 add fourth parameter to cp_getvar(), in functions missing so far 2018-07-22 14:58:25 +02:00
Holger Vogt 09c876550f prevent string overflow by adding the string length
to the cp_getvar parameters. Used only with CP_STRING
2018-07-22 14:57:49 +02:00
Holger Vogt 417dbfef72 undo the previous commits dealing with snprintf,
use the C99 compliant function also with MS Visual Studio
2018-05-31 11:37:51 +02:00
Holger Vogt 3b4640dee4 _snprintf in Windows 7 does not automatically put a '\0'
to the end of the buffer, only if there is space available.
That will change in the future if Snprintf is used.
2018-05-31 10:24:09 +02:00
h_vogt c8cd763314 gnuplot.c, add 'noretraceplot' to prevent retracing of the graph if plotting against a vector which is not the original scale vector ('plot vec1 vs vec2') 2018-05-18 17:25:48 +02:00
h_vogt d4adb027d2 avoid retrace in output graph by adding label 'noretraceplot'
to the plot command, that creates a lin plot trying to avoid retracing
2018-05-18 17:08:27 +02:00
Holger Vogt 560cb6e970 plotting/grid.c, bug fix, avoid string buffer overflow
Prevent a crash of example/FFT_test.cir.
Buffer 'buf' in function drawlingrid() has been too small.
Increase 'buf' size, and add some protection.

The example file examples/plot/test-small-plot.cir
shows the limits of plotting:
  difference in two numbers at digit 14 is plotted well.
                            at digit 15 is plotted with bugs.
                            at digit 16 is reduced to integer.

consider compiling with
  -O1 -D_FORTIFY_SOURCE=2
for gcc, and
  /GS
for visual studio.
2018-01-27 21:58:15 +01:00
rlar 91c60c28df whitespace change, avoid gcc warnings due to missleading indentation 2017-09-16 20:38:27 +02:00
h_vogt b3827f6488 gnuplot.c, correct the setting of limits in log plots 2017-09-16 20:37:24 +02:00
h_vogt e5d70d0821 gnuplot.c, bug fix, allow gnuplot with MINGW 2017-04-09 17:53:40 +02:00
rlar 99e864b6bc graf.c, drop an excess cast 2016-10-15 15:06:18 +02:00
rlar aca1b3a374 use 'abs()' 2016-10-15 15:06:17 +02:00
h_vogt 6f609abc27 x11.c, fix bug #330, rename csh variable font -> xfont
reported by graahnul.grom in
  #330 setting xfont in .spiceinit has no effect
  https://sourceforge.net/p/ngspice/bugs/330/
2016-10-15 15:06:16 +02:00
h_vogt c0d5d054ab gnuplot.c, ft_gnuplot(), suppress generating the .eps and .png file
when the given output file name starts with "np_"
2016-10-15 12:58:29 +02:00
h_vogt 42ac9a2859 gnuplot.c, ft_writesimple(), upgrade command 'wrdata'
- remove a bug to allow printing of vectors with differing scale lengths
- add option 'numdgt' to specify the width of the numbers printed
- add variable wr_singlescale
  use 'set wr_singlescale' to print the scale vector only once
  (vectors need to have equal scale lengths)
- add variable wr_vecnames
  use 'set wr_vecnames' to print the vector names to the first row
2016-10-15 12:57:46 +02:00
h_vogt fef2e1439d gnuplot.c, ft_writesimple(), command 'wrdata', use the given filename literally 2016-10-15 12:43:19 +02:00
rlar 141ed61ec8 use memcpy() instead of deprecated bcopy() 2016-07-30 20:58:19 +02:00
h_vogt 841f2846fe plotit.c, properly free a reversed wordlist 2016-04-01 18:05:40 +02:00
rlar 9652cc46c8 plotting/graf.c, cleanup 2016-03-23 17:04:55 +01:00
rlar b1d8b99018 skip-ws, #6/6, rename to match inpcom.c 2016-03-22 15:26:10 +01:00
rlar 22875d056b skip-ws, #5/6, use functional style 2016-03-22 15:26:09 +01:00
rlar a86f2068c8 skip-ws, #3/6, use TEMPORARY macros, obj-invariant 2016-03-22 15:26:06 +01:00
rlar 6d1171ad6f skip-ws, #2/6, introduce "ngspice/stringskip.h"
with some temporary macros to skip whitespace
2016-03-22 15:26:05 +01:00
rlar 40a0cea0d2 swap some `SWAP' arguments for readability 2016-03-22 15:23:05 +01:00
rlar bd0bc3038b use `SWAP' macro 2016-03-22 13:04:13 +01:00
rlar 6fe937f931 drop unused `SWAPINT' macro 2016-03-21 21:22:23 +01:00
rlar 71a7c3459b use char variants of the <ctype.h> isxxxx() family 2016-03-09 20:24:36 +01:00
rlar 8ce99a3c66 plotting/graf.c, bug fix, dbfree1() is wanted instead of dbfree() 2016-03-09 18:23:22 +01:00
rlar df70661c3a dvec abstraction, #11/11, introduce `dvec_realloc()' 2015-12-28 20:34:42 +01:00
rlar c2a7821449 dvec abstraction, #10/11, introduce `dvec_trunc()' 2015-12-28 20:34:42 +01:00
rlar 3962453739 dvec abstraction, #9/11, introduce `dvec_free()' 2015-12-28 20:34:42 +01:00
rlar 8243696338 dvec abstraction, #8/11, upgrade `dvec_alloc()' 2015-12-28 20:34:42 +01:00
rlar 908c650f72 dvec abstraction, #3/11, use `dvec_alloc()' 2015-12-28 20:34:42 +01:00
rlar 08ad3f6ab5 dvec abstraction, #1/11, reorder 2015-12-28 20:34:42 +01:00
rlar 68bd883535 plotting/graf.c, collect related global variables in a struct 2015-12-27 12:08:48 +01:00
rlar c405d0ff86 plotting/graf.c, cleanup initialisation, `gr_init()' is in charge to do that 2015-12-27 12:08:44 +01:00
rlar 299849c0db plotting/gnuplot.c, ft_gnuplot(), bug fix, allow plotting a family of curves
in the vein of plotcurv.c, ft_graf()
2015-12-27 12:05:55 +01:00
rlar 5a678e38dc plotting/plotit.c, xtend(), #7/7 reorder 2015-12-27 11:21:46 +01:00
rlar 64d6a5d7c0 plotting/plotit.c, xtend(), #6/7 drop some local variables 2015-12-27 11:21:45 +01:00
rlar d1a68482a5 plotting/plotit.c, xtend(), #5/7 use `TREALLOC()' 2015-12-27 11:21:44 +01:00
rlar 64b43b0c68 plotting/plotit.c, xtend(), #4/7 support vector of zero length 2015-12-27 11:21:43 +01:00
rlar 7c6fc1343b plotting/plotit.c, xtend(), #3/7 complex assignment 2015-12-27 11:21:42 +01:00
rlar 13e649209c plotting/plotit.c, xtend(), #2/7 fix index `i' 2015-12-27 11:21:41 +01:00
rlar 83fc07e770 plotting/plotit.c, xtend(), #1/7 don't free already freed data 2015-12-27 11:21:40 +01:00
rlar 1b62c1f050 plotting/plotit.c, plotit(), `v_length' shall be updated (lpr device, asciiplot) 2015-12-23 10:30:47 +01:00
rlar 9473ec575f drop some remaining `NEW*' macros, use TMALLOC instead 2015-12-19 19:39:29 +01:00
rlar a1439f5d4d plotting/plotit.c, rename local variable `j' --> `y_type' 2015-12-15 19:58:11 +01:00
rlar f97e4a2a35 plotting/plotit.c, cleanup search for common y_type 2015-12-15 19:57:12 +01:00
rlar 73731bdf77 frontend/plotting/plotit.c, cleanup, reduce scope of `struct dvec *dv' 2015-10-04 15:38:27 +02:00
rlar 39fdeb0c9a src/frontend/plotting/gnuplot.c, enforce "noenhanced text" mode
Contrary to older versions gnuplot 5 uses "enhanced text mode" per default.
The strings which we pass to gnuplot don't have "latex" semantics,
  thus consistently enforce "noenhanced text mode".

Add a function quote_gnuplot_string() to escape and quote strings
  in such a way that they will arrive in gnuplot unmodified.
2015-05-17 17:34:29 +02:00
Marcel Hendrix 02fe549be7 src/frontend/plotting/plotit.c, allow "plot xlog ylog" (equiv to "plot loglog") 2015-05-14 15:56:45 +02:00
rlar 7bc6374138 cleanup, use '\0' instead of 0 in char context 2015-05-02 10:24:54 +02:00