version 1.1, 2000/11/22 06:20:13 |
version 1.5, 2014/05/13 20:07:23 |
Line 13 static char THIS_FILE[] = __FILE__; |
|
Line 13 static char THIS_FILE[] = __FILE__; |
|
|
|
#include <math.h> |
#include <math.h> |
|
|
|
#include "gmpxx.h" |
extern "C" { |
extern "C" { |
#include "ca.h" |
#include "ca.h" |
#include "ifplot.h" |
#include "ifplot.h" |
Line 80 void CChildView::OnPaint() |
|
Line 81 void CChildView::OnPaint() |
|
// TODO: メッセージ ハンドラのコードをここに追加してください。 |
// TODO: メッセージ ハンドラのコードをここに追加してください。 |
|
|
// 描画のために CWnd::OnPaint を呼び出してはいけません。 |
// 描画のために CWnd::OnPaint を呼び出してはいけません。 |
if ( can->mode == MODE_INTERACTIVE ) { |
if ( can->mode == modeNO(INTERACTIVE) ) { |
::BitBlt(dc.m_hDC,0,0,can->width,can->height,can->pix,0,0,SRCCOPY); |
::BitBlt(dc.m_hDC,0,0,can->width,can->height,can->pix,0,0,SRCCOPY); |
} else { |
} else { |
if ( !can->wide ) { |
if ( !can->wide ) { |
Line 96 void CChildView::OnPrint(CDC &dc) |
|
Line 97 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 122 void CChildView::OnPrint(CDC &dc) |
|
Line 123 void CChildView::OnPrint(CDC &dc) |
|
dc.StartDoc(&docinfo); |
dc.StartDoc(&docinfo); |
dc.StartPage(); |
dc.StartPage(); |
|
|
if ( can->mode == MODE_INTERACTIVE ) { |
if ( can->mode == modeNO(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 141 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 149 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 160 void CChildView::OnPrint(CDC &dc) |
|
Line 164 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); |
|
|
if ( can->mode == MODE_PLOT ) |
if ( can->mode == modeNO(PLOT) ) |
dc.Polyline(can->pa[0].pos,can->pa[0].length); |
dc.Polyline(can->pa[0].pos,can->pa[0].length); |
else |
else |
::StretchBlt(dc.m_hDC,0,0,can->width,can->height,can->pix, |
::StretchBlt(dc.m_hDC,0,0,can->width,can->height,can->pix, |
Line 175 void CChildView::PrintAxis(CDC &dc) |
|
Line 179 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]; |
|
|
/* XXX : should be cleaned up */ |
/* XXX : should be cleaned up */ |
if ( can->noaxis || (can->mode == MODE_PLOT && !can->pa) ) |
if ( can->noaxis || (can->mode == modeNO(PLOT) && !can->pa) ) |
return; |
return; |
if ( can->mode == MODE_INTERACTIVE ) |
if ( can->mode == modeNO(INTERACTIVE) ) |
return; |
return; |
|
|
xadj = yadj = 0; |
xadj = yadj = 0; |
Line 204 void CChildView::PrintAxis(CDC &dc) |
|
Line 208 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 217 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 ) { |