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.
This commit is contained in:
parent
7bf2fbde75
commit
7f301cbe33
|
|
@ -233,9 +233,9 @@ DevClear(void)
|
|||
|
||||
|
||||
void
|
||||
DevDrawLine(int x1, int y1, int x2, int y2)
|
||||
DevDrawLine(int x1, int y1, int x2, int y2, bool isgrid)
|
||||
{
|
||||
dispdev->DrawLine (x1, y1, x2, y2);
|
||||
dispdev->DrawLine (x1, y1, x2, y2, isgrid);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ void DevInit(void);
|
|||
int NewViewport(GRAPH *pgraph);
|
||||
void DevClose(void);
|
||||
void DevClear(void);
|
||||
void DevDrawLine(int x1, int y1, int x2, int y2);
|
||||
void DevDrawLine(int x1, int y1, int x2, int y2, bool isgrid);
|
||||
void DevDrawArc(int x0, int y0, int radius, double theta, double delta_theta);
|
||||
void DevDrawText(char *text, int x, int y, int angle);
|
||||
void DefineColor(int colorid, double red, double green, double blue);
|
||||
|
|
|
|||
|
|
@ -294,9 +294,9 @@ void gr_point(struct dvec *dv,
|
|||
case PLOT_MONOLIN:
|
||||
/* If it's a linear plot, ignore first point since we don't
|
||||
want to connect with oldx and oldy. */
|
||||
if (np) {
|
||||
DevDrawLine(fromx, fromy, tox, toy);
|
||||
}
|
||||
if (np)
|
||||
DevDrawLine(fromx, fromy, tox, toy, FALSE);
|
||||
|
||||
if ((tics = currentgraph->ticdata) != NULL) {
|
||||
for (; *tics < HUGE; tics++)
|
||||
if (*tics == (double) np) {
|
||||
|
|
@ -326,7 +326,7 @@ void gr_point(struct dvec *dv,
|
|||
DatatoScreen(currentgraph,
|
||||
0.0, currentgraph->datawindow.ymin,
|
||||
&dummy, &ymin);
|
||||
DevDrawLine(tox, ymin, tox, toy);
|
||||
DevDrawLine(tox, ymin, tox, toy, FALSE);
|
||||
break;
|
||||
case PLOT_POINT:
|
||||
/* Here, gi_linestyle is the character used for the point. */
|
||||
|
|
@ -477,7 +477,7 @@ void drawlegend(GRAPH *graph, int plotno, struct dvec *dv)
|
|||
}
|
||||
else {
|
||||
SetLinestyle(dv->v_linestyle);
|
||||
DevDrawLine(x, i, x_base, i);
|
||||
DevDrawLine(x, i, x + graph->viewport.width / 20, i, FALSE);
|
||||
}
|
||||
SetColor(1);
|
||||
DevDrawText(dv->v_name, x_base + graph->fontwidth, y, 0);
|
||||
|
|
|
|||
|
|
@ -108,8 +108,11 @@ int Plt5_Clear(void)
|
|||
}
|
||||
|
||||
|
||||
int Plt5_DrawLine(int x1, int y1, int x2, int y2)
|
||||
int
|
||||
Plt5_DrawLine(int x1, int y1, int x2, int y2, bool isgrid)
|
||||
{
|
||||
NG_IGNORE(isgrid);
|
||||
|
||||
putc('l', plotfile);
|
||||
putsi(x1);
|
||||
putsi(y1);
|
||||
|
|
|
|||
|
|
@ -560,8 +560,9 @@ X11_Close(void)
|
|||
|
||||
|
||||
int
|
||||
X11_DrawLine(int x1, int y1, int x2, int y2)
|
||||
X11_DrawLine(int x1, int y1, int x2, int y2, bool isgrid)
|
||||
{
|
||||
NG_IGNORE(isgrid);
|
||||
if (DEVDEP(currentgraph).isopen)
|
||||
XDrawLine(display, DEVDEP(currentgraph).window,
|
||||
DEVDEP(currentgraph).gc,
|
||||
|
|
|
|||
|
|
@ -280,8 +280,10 @@ int PS_Clear(void)
|
|||
}
|
||||
|
||||
|
||||
int PS_DrawLine(int x1, int y1, int x2, int y2)
|
||||
int
|
||||
PS_DrawLine(int x1, int y1, int x2, int y2, bool isgrid)
|
||||
{
|
||||
NG_IGNORE(isgrid);
|
||||
/* note: this is not extendible to more than one graph
|
||||
=> will have to give NewViewport a writeable graph XXX */
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#pragma hdrstop
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#include "winprint.h" /* function prototypes */
|
||||
#include "winprint.h" /* function prototypes */
|
||||
|
||||
/* Typen */
|
||||
typedef struct { /* Extra Printdaten */
|
||||
|
|
@ -126,7 +126,7 @@ WPRINT_Init() gibt 0 zurueck, falls kein Fehler auftrat.
|
|||
int WPRINT_Init(void)
|
||||
{
|
||||
int pWidth;
|
||||
int pHeight;
|
||||
int pHeight;
|
||||
|
||||
/* Printer-DC holen */
|
||||
if (!PrinterDC) {
|
||||
|
|
@ -198,19 +198,19 @@ int WPRINT_Init(void)
|
|||
|
||||
/* Initialisierungen des Display-Descriptors */
|
||||
dispdev->width = PrinterWidth;
|
||||
dispdev->height = PrinterHeight;
|
||||
dispdev->height = PrinterHeight;
|
||||
dispdev->numlinestyles = NumLines;
|
||||
dispdev->numcolors = NumPrintColors;
|
||||
|
||||
/* Farben initialisieren */
|
||||
ColorTable[0] = RGB(255,255,255); /* Weisz */
|
||||
ColorTable[1] = RGB(0, 0, 0); /* Schwarz */
|
||||
ColorTable[0] = RGB(255,255,255); /* Weisz */
|
||||
ColorTable[1] = RGB(0, 0, 0); /* Schwarz */
|
||||
|
||||
/* LineStyles initialisieren */
|
||||
LineTable[0] = PS_SOLID;
|
||||
LineTable[1] = PS_DOT; /* Gitter */
|
||||
LineTable[1] = PS_DOT; /* Gitter */
|
||||
LineTable[2] = PS_SOLID; /* Erste Linie */
|
||||
LineTable[3] = PS_DOT; /* Zweite Linie */
|
||||
LineTable[3] = PS_DOT; /* Zweite Linie */
|
||||
LineTable[4] = PS_DASH; /* usw */
|
||||
LineTable[5] = PS_DASHDOT;
|
||||
LineTable[6] = PS_DASHDOTDOT;
|
||||
|
|
@ -239,9 +239,9 @@ int WPRINT_Init(void)
|
|||
|
||||
int WPRINT_NewViewport(GRAPH * graph)
|
||||
{
|
||||
TEXTMETRIC tm;
|
||||
tpPrintData pd;
|
||||
DOCINFO di;
|
||||
TEXTMETRIC tm;
|
||||
tpPrintData pd;
|
||||
DOCINFO di;
|
||||
|
||||
/* Parameter testen */
|
||||
if (!graph) {
|
||||
|
|
@ -276,8 +276,8 @@ int WPRINT_NewViewport(GRAPH * graph)
|
|||
pd->LineIndex = 0;
|
||||
|
||||
/* Viewport-Parameter setzen */
|
||||
graph->viewport.height = PrinterHeight;
|
||||
graph->viewport.width = PrinterWidth;
|
||||
graph->viewport.height = PrinterHeight;
|
||||
graph->viewport.width = PrinterWidth;
|
||||
|
||||
/* Absolut-Parameter setzen */
|
||||
graph->absolute.xpos = 0;
|
||||
|
|
@ -286,9 +286,9 @@ int WPRINT_NewViewport(GRAPH * graph)
|
|||
graph->absolute.height = PrinterHeight;
|
||||
|
||||
/* Druckauftrag anmelden */
|
||||
di.cbSize = sizeof(DOCINFO);
|
||||
di.lpszDocName = graph->plotname;
|
||||
di.lpszOutput = NULL;
|
||||
di.cbSize = sizeof(DOCINFO);
|
||||
di.lpszDocName = graph->plotname;
|
||||
di.lpszOutput = NULL;
|
||||
if (StartDoc(PrinterDC, &di) <= 0) {
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -333,12 +333,14 @@ int WPRINT_Clear(void)
|
|||
}
|
||||
|
||||
|
||||
int WPRINT_DrawLine(int x1, int y1, int x2, int y2)
|
||||
int WPRINT_DrawLine(int x1, int y1, int x2, int y2, bool isgrid)
|
||||
{
|
||||
NG_IGNORE(isgrid);
|
||||
|
||||
tpPrintData pd;
|
||||
HPEN OldPen;
|
||||
HPEN NewPen;
|
||||
int ColIndex;
|
||||
HPEN OldPen;
|
||||
HPEN NewPen;
|
||||
int ColIndex;
|
||||
|
||||
if (!currentgraph) return 0;
|
||||
pd = pPrintData(currentgraph);
|
||||
|
|
@ -350,12 +352,12 @@ int WPRINT_DrawLine(int x1, int y1, int x2, int y2)
|
|||
ColIndex = 1;
|
||||
|
||||
MoveToEx(PrinterDC, x1, PrinterHeight - y1, NULL);
|
||||
NewPen = CreatePen(LineTable[pd->LineIndex], 0, ColorTable[ColIndex] );
|
||||
NewPen = CreatePen( LineTable[pd->LineIndex], 0, ColorTable[ColIndex] );
|
||||
OldPen = SelectObject(PrinterDC, NewPen);
|
||||
LineTo(PrinterDC, x2, PrinterHeight - y2);
|
||||
OldPen = SelectObject(PrinterDC, OldPen);
|
||||
DeleteObject(NewPen);
|
||||
return 0;
|
||||
DeleteObject( NewPen);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ int WPRINT_Init(void);
|
|||
int WPRINT_NewViewport( GRAPH * graph);
|
||||
int WPRINT_Close(void);
|
||||
int WPRINT_Clear(void);
|
||||
int WPRINT_DrawLine(int x1, int y1, int x2, int y2);
|
||||
int WPRINT_DrawLine(int x1, int y1, int x2, int y2, bool isgrid);
|
||||
int WPRINT_Arc(int x0, int y0, int radius, double theta, double delta_theta);
|
||||
int WPRINT_Text( char * text, int x, int y, int degrees);
|
||||
int WPRINT_DefineColor(int colorid, double red, double green, double blue);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ typedef int disp_fn_Init_t (void);
|
|||
typedef int disp_fn_NewViewport_t (struct graph *);
|
||||
typedef int disp_fn_Close_t (void);
|
||||
typedef int disp_fn_Clear_t (void);
|
||||
typedef int disp_fn_DrawLine_t (int x1, int y1, int x2, int y2);
|
||||
typedef int disp_fn_DrawLine_t (int x1, int y1, int x2, int y2, bool isgrid);
|
||||
typedef int disp_fn_Arc_t (int x0, int y0, int radius, double theta, double delta_theta);
|
||||
typedef int disp_fn_Text_t (char *text, int x, int y, int angle);
|
||||
typedef int disp_fn_DefineColor_t (int colorid, double red, double green, double blue);
|
||||
|
|
|
|||
Loading…
Reference in New Issue