add color selection to WinGui plots
This commit is contained in:
parent
901ce79509
commit
a709512a86
|
|
@ -0,0 +1,53 @@
|
|||
* test de titré
|
||||
.control
|
||||
set hcopydevtype = postscript
|
||||
set hcopypscolor=25
|
||||
set hcopypstxcolor=21
|
||||
set hcopyscale=1
|
||||
*set color2=rgb:F/0/0
|
||||
|
||||
setcs hcopyfont=Arial
|
||||
set hcopyfontsize=18
|
||||
|
||||
|
||||
let x = vector(5)
|
||||
let y = exp(x)
|
||||
setcs wfont=Arial
|
||||
set wfont_size=18
|
||||
setcs xfont='Noto Sans'
|
||||
*set xfont_size=18
|
||||
|
||||
set gridwidth=4
|
||||
set xbrushwidth=1
|
||||
set color0=white
|
||||
set color2=brown
|
||||
plot y vs x xlabel 'Labellisé X' ylabel 'Labellisé Y: ÜüÖöÄäÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ' title 'Titré'
|
||||
set color0=black
|
||||
plot y vs x xlabel '我能吞下玻璃而不伤身体' ylabel 'Я могу есть стекло, оно мне не вредит' title ' أنا قادر على أكل الزجاج و هذا لا يؤلمني.'
|
||||
* With Linux the next one requires: export LC_CTYPE ="de_DE.UTF-8"
|
||||
*gnuplot test.gn y vs x xlabel 'Labellisé X' ylabel 'tüTÄtö Äü @µ€~' title 'ฉันกินกระจกได้ แต่มันไม่ทำให้ฉันเจ็บ '
|
||||
set color0=yellow
|
||||
set color1=black
|
||||
set color2=blue
|
||||
set gridwidth=1
|
||||
set xbrushwidth=4
|
||||
plot y vs x+0.001 xlabel 'Labellisé X' ylabel 'Labellisé Y' title 'Titré 私はガラスを食べられます。それは私を傷つけません' loglog
|
||||
*plot y vs x+0.001 xlabel 'Labellisé X' title 'Titré' loglog
|
||||
set color0=black
|
||||
set color2=pink
|
||||
unset color1
|
||||
plot y vs x xlabel '래도 아프지 않아요' ylabel '私はガラスを食べられます' title ' أنا قادر على أكل الزجاج و هذا لا يؤلمني.'
|
||||
|
||||
* With Linux the next one requires: export LC_CTYPE ="de_DE.UTF-8"
|
||||
*gnuplot test2.gn y vs x xlabel 'Labellisé X' ylabel 'tüTÄtö Äü @µ€~' title 'ฉันกินกระจกได้ แต่มันไม่ทำให้ฉันเจ็บ '
|
||||
|
||||
*hardcopy plot_5.ps y vs x xlabel 'Labellisé X' ylabel 'Labellisé Y' title 'Titré Äü @µ€~'
|
||||
*shell Start /B plot_5.ps
|
||||
*shell gv plot_5.ps &
|
||||
|
||||
echo 나는 유리를 먹을 수 있어요. 그래도 아프지 않아요
|
||||
echo 私はガラスを食べられます。それは私を傷つけません
|
||||
echo 我能吞下玻璃而不伤身体
|
||||
|
||||
*quit
|
||||
.endc
|
||||
|
|
@ -103,6 +103,9 @@ static bool isblackold = TRUE;
|
|||
static int linewidth = 0; /* linewidth of grid and plot */
|
||||
static int gridlinewidth = 0; /* linewidth of grid */
|
||||
|
||||
extern void wincolor_init(COLORREF *ColorTable, int noc);
|
||||
extern void wincolor_redo(COLORREF *ColorTable, int noc);
|
||||
|
||||
/******************************************************************************
|
||||
WIN_Init() makes connection to graphics. We have to determine
|
||||
|
||||
|
|
@ -117,7 +120,6 @@ WIN_Init() does not yet open a window, this happens only in WIN_NewViewport()
|
|||
******************************************************************************/
|
||||
int WIN_Init(void)
|
||||
{
|
||||
char colorstring[BSIZE_SP];
|
||||
char facename[32];
|
||||
|
||||
#ifdef EXT_ASC
|
||||
|
|
@ -132,75 +134,11 @@ int WIN_Init(void)
|
|||
dispdev->numlinestyles = 5; /* see implications in WinPrint! */
|
||||
dispdev->numcolors = NumWinColors;
|
||||
|
||||
/* always, user may have set color0 to white */
|
||||
/* get background color information from spinit, only "white"
|
||||
is recognized as a suitable option! */
|
||||
if (cp_getvar("color0", CP_STRING, colorstring, sizeof(colorstring))) {
|
||||
if (cieq(colorstring, "white")) isblack = FALSE;
|
||||
else isblack = TRUE;
|
||||
}
|
||||
|
||||
/* get linewidth information from spinit */
|
||||
if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth, 0)) {
|
||||
linewidth = 0;
|
||||
}
|
||||
if (linewidth < 0) {
|
||||
linewidth = 0;
|
||||
}
|
||||
|
||||
/* get linewidth for grid from spinit */
|
||||
if (!cp_getvar("gridwidth", CP_NUM, &gridlinewidth, 0))
|
||||
gridlinewidth = linewidth;
|
||||
if (gridlinewidth < 0)
|
||||
gridlinewidth = 0;
|
||||
|
||||
/* only for the first time: */
|
||||
if (!IsRegistered) {
|
||||
|
||||
isblackold = isblack;
|
||||
wincolor_init(ColorTable, NumWinColors);
|
||||
|
||||
/* Initialize colors */
|
||||
if (isblack) {
|
||||
ColorTable[0] = RGB( 0, 0, 0); /* black = background */
|
||||
ColorTable[1] = RGB(255, 255, 255); /* white = text and grid */
|
||||
}
|
||||
else {
|
||||
ColorTable[0] = RGB(255, 255, 255); /* white = background */
|
||||
ColorTable[1] = RGB( 0, 0, 0); /* black = text and grid */
|
||||
}
|
||||
|
||||
ColorTable[2] = RGB( 0, 255, 0); /* green = first line */
|
||||
ColorTable[3] = RGB(255, 0, 0); /* red */
|
||||
ColorTable[4] = RGB( 0, 0, 255); /* blue */
|
||||
ColorTable[5] = RGB(255, 255, 0); /* yellow */
|
||||
ColorTable[6] = RGB(255, 0, 255); /* violett */
|
||||
ColorTable[7] = RGB( 0, 255, 255); /* azur */
|
||||
ColorTable[8] = RGB(255, 128, 0); /* orange */
|
||||
ColorTable[9] = RGB(128, 64, 0); /* brown */
|
||||
ColorTable[10] = RGB(128, 0, 255); /* light violett */
|
||||
ColorTable[11] = RGB(255, 128, 128); /* pink */
|
||||
|
||||
/* 2. color bank (with different line style */
|
||||
if (isblack) {
|
||||
ColorTable[12] = RGB(255, 255, 255); /* white */
|
||||
}
|
||||
else {
|
||||
ColorTable[12] = RGB( 0, 0, 0); /* black */
|
||||
}
|
||||
|
||||
ColorTable[13] = RGB( 0, 255, 0); /* green */
|
||||
ColorTable[14] = RGB(255, 0, 0); /* red */
|
||||
ColorTable[15] = RGB( 0, 0, 255); /* blue */
|
||||
ColorTable[16] = RGB(255, 255, 0); /* yellow */
|
||||
ColorTable[17] = RGB(255, 0, 255); /* violett */
|
||||
ColorTable[18] = RGB( 0, 255, 255); /* azur */
|
||||
ColorTable[19] = RGB(255, 128, 0); /* orange */
|
||||
ColorTable[20] = RGB(128, 64, 0); /* brown */
|
||||
ColorTable[21] = RGB(128, 0, 255); /* light violett */
|
||||
ColorTable[22] = RGB(255, 128, 128); /* pink */
|
||||
|
||||
/* Ansii fixed font */
|
||||
// PlotFont = GetStockFont(ANSI_FIXED_FONT);
|
||||
#ifdef EXT_ASC
|
||||
/* register window class */
|
||||
TheWndClass.lpszClassName = WindowName;
|
||||
|
|
@ -241,28 +179,11 @@ int WIN_Init(void)
|
|||
TheWndClassW.cbWndExtra = sizeof(GRAPH *);
|
||||
if (!RegisterClassW(&TheWndClassW)) return 1;
|
||||
#endif
|
||||
|
||||
IsRegistered = 1;
|
||||
}
|
||||
/* not first time */
|
||||
else if (isblackold != isblack) {
|
||||
if (isblack) {
|
||||
ColorTable[0] = RGB( 0, 0, 0); /* black = background */
|
||||
ColorTable[1] = RGB(255, 255, 255); /* white = text and grid */
|
||||
}
|
||||
else {
|
||||
ColorTable[0] = RGB(255, 255, 255); /* white = background */
|
||||
ColorTable[1] = RGB( 0, 0, 0); /* black = text and grid */
|
||||
}
|
||||
if (isblack) {
|
||||
ColorTable[12] = RGB(255, 255, 255); /* white */
|
||||
}
|
||||
else {
|
||||
ColorTable[12] = RGB( 0, 0, 0); /* black */
|
||||
}
|
||||
else
|
||||
wincolor_redo(ColorTable, NumWinColors);
|
||||
|
||||
isblackold = isblack;
|
||||
}
|
||||
IsRegistered = 1;
|
||||
#ifdef EXT_ASC
|
||||
// lf.lfHeight = 18;
|
||||
lf.lfWidth = 0;
|
||||
|
|
@ -756,15 +677,15 @@ int WIN_NewViewport(GRAPH *graph)
|
|||
if (!window)
|
||||
return 1;
|
||||
|
||||
/* change the background color of all windows (both new and already plotted)
|
||||
by assessing the registered window class */
|
||||
if (isblack) {
|
||||
SetClassLongPtr(window, GCLP_HBRBACKGROUND, (LONG_PTR)GetStockObject(BLACK_BRUSH));
|
||||
}
|
||||
else {
|
||||
SetClassLongPtr(window, GCLP_HBRBACKGROUND, (LONG_PTR)GetStockObject(WHITE_BRUSH));
|
||||
}
|
||||
SetClassLongPtr(window, GCLP_HBRBACKGROUND, (LONG_PTR)GetStockObject(DC_BRUSH));
|
||||
|
||||
/* get the DC */
|
||||
dc = GetDC(window);
|
||||
wd->hDC = dc;
|
||||
|
||||
/* set the background color */
|
||||
SelectObject(dc, GetStockObject(DC_BRUSH));
|
||||
SetDCBrushColor(dc, ColorTable[0]);
|
||||
|
||||
wd->wnd = window;
|
||||
SetWindowLongPtr(window, 0, (LONG_PTR)graph);
|
||||
|
|
@ -775,9 +696,8 @@ int WIN_NewViewport(GRAPH *graph)
|
|||
/* get the mask */
|
||||
GetClientRect(window, &(wd->Area));
|
||||
|
||||
/* get the DC */
|
||||
dc = GetDC(window);
|
||||
wd->hDC = dc;
|
||||
|
||||
|
||||
|
||||
/* set the Color Index */
|
||||
wd->ColorIndex = 0;
|
||||
|
|
|
|||
|
|
@ -922,6 +922,7 @@
|
|||
<ClInclude Include="..\src\frontend\variable.h" />
|
||||
<ClInclude Include="..\src\frontend\vectors.h" />
|
||||
<ClInclude Include="..\src\frontend\wdisp\ftegraf.h" />
|
||||
<ClInclude Include="..\src\frontend\wdisp\wincolor.h" />
|
||||
<ClInclude Include="..\src\frontend\wdisp\windisp.h" />
|
||||
<ClInclude Include="..\src\frontend\wdisp\winprint.h" />
|
||||
<ClInclude Include="..\src\frontend\where.h" />
|
||||
|
|
@ -939,6 +940,7 @@
|
|||
<ClInclude Include="..\src\include\ngspice\cmconstants.h" />
|
||||
<ClInclude Include="..\src\include\ngspice\cmproto.h" />
|
||||
<ClInclude Include="..\src\include\ngspice\cmtypes.h" />
|
||||
<ClInclude Include="..\src\include\ngspice\wincolornames.h" />
|
||||
<ClInclude Include="..\src\include\ngspice\compatmode.h" />
|
||||
<ClInclude Include="..\src\include\ngspice\complex.h" />
|
||||
<ClInclude Include="..\src\include\ngspice\const.h" />
|
||||
|
|
@ -1531,6 +1533,7 @@
|
|||
<ClCompile Include="..\src\frontend\typesdef.c" />
|
||||
<ClCompile Include="..\src\frontend\variable.c" />
|
||||
<ClCompile Include="..\src\frontend\vectors.c" />
|
||||
<ClCompile Include="..\src\frontend\wdisp\wincolor.c" />
|
||||
<ClCompile Include="..\src\frontend\wdisp\windisp.c" />
|
||||
<ClCompile Include="..\src\frontend\wdisp\winprint.c" />
|
||||
<ClCompile Include="..\src\frontend\where.c" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue