version 1.1, 2000/11/22 06:20:13 |
version 1.3, 2002/10/02 09:33:31 |
Line 96 void CChildView::OnPrint(CDC &dc) |
|
Line 96 void CChildView::OnPrint(CDC &dc) |
|
{ |
{ |
DOCINFO docinfo; |
DOCINFO docinfo; |
NODE n; |
NODE n; |
int width,height,ratio,x,y; |
int width,height,ratio,x,y,step; |
|
|
memset(&docinfo,0,sizeof(DOCINFO)); |
memset(&docinfo,0,sizeof(DOCINFO)); |
docinfo.cbSize = sizeof(DOCINFO); |
docinfo.cbSize = sizeof(DOCINFO); |
Line 123 void CChildView::OnPrint(CDC &dc) |
|
Line 123 void CChildView::OnPrint(CDC &dc) |
|
dc.StartPage(); |
dc.StartPage(); |
|
|
if ( can->mode == MODE_INTERACTIVE ) { |
if ( can->mode == MODE_INTERACTIVE ) { |
// We want to associate precisely one printer pixel to |
|
|
// We want to associate a rectangle of a fixed size to |
// one bitmap pixel |
// one bitmap pixel |
// if can->width/can->height > width/height |
// if can->width/can->height > width/height |
// then match the widths, else match the height |
// then match the widths, else match the height |
Line 139 void CChildView::OnPrint(CDC &dc) |
|
Line 140 void CChildView::OnPrint(CDC &dc) |
|
dc.SetViewportOrg(width/18,height/18); |
dc.SetViewportOrg(width/18,height/18); |
dc.SetViewportExt(width,height); |
dc.SetViewportExt(width,height); |
|
|
|
step = (ratio+4)/5; |
for ( n = can->history; n; n = NEXT(n) ) { |
for ( n = can->history; n; n = NEXT(n) ) { |
RealVect *rv = (RealVect *)n->body; |
RealVect *rv = (RealVect *)n->body; |
if ( rv->len == 2 ) { |
if ( rv->len == 2 ) { |
Line 146 void CChildView::OnPrint(CDC &dc) |
|
Line 148 void CChildView::OnPrint(CDC &dc) |
|
x = rv->body[0]*ratio; |
x = rv->body[0]*ratio; |
y = rv->body[1]*ratio; |
y = rv->body[1]*ratio; |
// dc.FillRect(CRect(x,y,x+1,y+1),&brush); |
// dc.FillRect(CRect(x,y,x+1,y+1),&brush); |
dc.FillRect(CRect(x-1,y-1,x+1,y+1),&brush); |
// dc.FillRect(CRect(x-1,y-1,x+1,y+1),&brush); |
|
dc.FillRect(CRect(x,y,x+step,y+step),&brush); |
} else if ( rv->len == 4 ) { |
} else if ( rv->len == 4 ) { |
dc.MoveTo(rv->body[0]*ratio,rv->body[1]*ratio); |
dc.MoveTo(rv->body[0]*ratio,rv->body[1]*ratio); |
dc.LineTo(rv->body[2]*ratio,rv->body[3]*ratio); |
dc.LineTo(rv->body[2]*ratio,rv->body[3]*ratio); |
Line 175 void CChildView::PrintAxis(CDC &dc) |
|
Line 178 void CChildView::PrintAxis(CDC &dc) |
|
{ |
{ |
#define D 5 |
#define D 5 |
|
|
double w,w1,k,e,n; |
double w,w1,e,n; |
int x0,y0,x,y,xadj,yadj; |
int x0,y0,x,y,xadj,yadj; |
char buf[BUFSIZ]; |
char buf[BUFSIZ]; |
|
|
Line 204 void CChildView::PrintAxis(CDC &dc) |
|
Line 207 void CChildView::PrintAxis(CDC &dc) |
|
w1 = w * DEFAULTWIDTH/can->width; |
w1 = w * DEFAULTWIDTH/can->width; |
e = adjust_scale(EXP10(floor(log10(w1))),w1); |
e = adjust_scale(EXP10(floor(log10(w1))),w1); |
for ( n = ceil(can->xmin/e); n*e<= can->xmax; n++ ) { |
for ( n = ceil(can->xmin/e); n*e<= can->xmax; n++ ) { |
x = (int)can->width*(n*e-can->xmin)/w; |
x = (int)(can->width*(n*e-can->xmin)/w); |
dc.MoveTo(x,y0); dc.LineTo(x,y0-D); |
dc.MoveTo(x,y0); dc.LineTo(x,y0-D); |
sprintf(buf,"%g",n*e); |
sprintf(buf,"%g",n*e); |
dc.TextOut(x+2,y0+2,buf,strlen(buf)); |
dc.TextOut(x+2,y0+2,buf,strlen(buf)); |
Line 213 void CChildView::PrintAxis(CDC &dc) |
|
Line 216 void CChildView::PrintAxis(CDC &dc) |
|
w1 = w * DEFAULTHEIGHT/can->height; |
w1 = w * DEFAULTHEIGHT/can->height; |
e = adjust_scale(EXP10(floor(log10(w1))),w1); |
e = adjust_scale(EXP10(floor(log10(w1))),w1); |
for ( n = ceil(can->ymin/e); n*e<= can->ymax; n++ ) { |
for ( n = ceil(can->ymin/e); n*e<= can->ymax; n++ ) { |
y = (int)can->height*(1-(n*e-can->ymin)/w); |
y = (int)(can->height*(1-(n*e-can->ymin)/w)); |
dc.MoveTo(x0,y); dc.LineTo(x0+D,y); |
dc.MoveTo(x0,y); dc.LineTo(x0+D,y); |
sprintf(buf,"%g",n*e); |
sprintf(buf,"%g",n*e); |
if ( can->xmax <= 0 ) { |
if ( can->xmax <= 0 ) { |