Commit a0e6d66a authored by claes's avatar claes

Print to pdf

parent e5c03a7e
/*
* Proview $Id: flow_annot.cpp,v 1.6 2007-01-04 07:53:34 claes Exp $
* Proview $Id: flow_annot.cpp,v 1.7 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -73,7 +73,7 @@ void FlowAnnot::print( void *pos, void *node, int highlight)
}
else
x = p.print_z_x + ((FlowPoint *)pos)->print_z_x;
ctx->print_ps->text( x,
ctx->current_print->text( x,
p.print_z_y + ((FlowPoint *)pos)->print_z_y,
((FlowNode *) node)->annotv[number],
strlen(((FlowNode *) node)->annotv[number]), draw_type, size);
......@@ -94,7 +94,7 @@ void FlowAnnot::print( void *pos, void *node, int highlight)
if ( *s == 10)
{
if ( len)
ctx->print_ps->text( z_x, z_y + line_cnt * z_height, line, len,
ctx->current_print->text( z_x, z_y + line_cnt * z_height, line, len,
draw_type, size);
len = 0;
line = s+1;
......@@ -104,7 +104,7 @@ void FlowAnnot::print( void *pos, void *node, int highlight)
len++;
}
if ( len)
ctx->print_ps->text( z_x, z_y + line_cnt * z_height, line,
ctx->current_print->text( z_x, z_y + line_cnt * z_height, line,
len, draw_type, size);
break;
}
......
/*
* Proview $Id: flow_annotpixmap.cpp,v 1.5 2007-01-04 07:53:34 claes Exp $
* Proview $Id: flow_annotpixmap.cpp,v 1.6 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -82,7 +82,7 @@ void FlowAnnotPixmap::print( void *pos, void *node, int highlight)
}
else
x = p.print_z_x + ((FlowPoint *)pos)->print_z_x;
ctx->print_ps->pixmap( x,
ctx->current_print->pixmap( x,
p.print_z_y + ((FlowPoint *)pos)->print_z_y,
&((FlowNode *)node)->annotpixmapv[number]->pixmap_data[pixmap_size],
draw_type);
......
/*
* Proview $Id: flow_api.cpp,v 1.10 2007-07-18 09:26:43 claes Exp $
* Proview $Id: flow_api.cpp,v 1.11 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -432,6 +432,12 @@ int flow_PrintRegion( flow_tCtx ctx, double ll_x, double ll_y,
return ctx->print_region( ll_x, ll_y, ur_x, ur_y, filename);
}
int flow_PrintPdfRegion( flow_tCtx ctx, double ll_x, double ll_y,
double ur_x, double ur_y, char *filename)
{
return ctx->print_pdf_region( ll_x, ll_y, ur_x, ur_y, filename);
}
void flow_GetUserData( flow_tObject object, void **user_data)
{
((FlowArrayElem *)object)->get_user_data( user_data);
......
/*
* Proview $Id: flow_api.h,v 1.10 2007-07-18 09:26:43 claes Exp $
* Proview $Id: flow_api.h,v 1.11 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -183,6 +183,8 @@ void flow_MeasureNode( flow_tNode node, double *ll_x, double *ll_y,
double *ur_x, double *ur_y);
int flow_PrintRegion( flow_tCtx ctx, double ll_x, double ll_y,
double ur_x, double ur_y, char *filename);
int flow_PrintPdfRegion( flow_tCtx ctx, double ll_x, double ll_y,
double ur_x, double ur_y, char *filename);
void flow_GetUserData( flow_tObject object, void **user_data);
void flow_SetUserData( flow_tObject object, void *user_data);
void flow_GetCtxUserData( flow_tCtx ctx, void **user_data);
......
/*
* Proview $Id: flow_arc.cpp,v 1.6 2007-01-04 07:53:34 claes Exp $
* Proview $Id: flow_arc.cpp,v 1.7 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -54,7 +54,7 @@ void FlowArc::print( void *pos, void *node, int highlight)
line_width;
idx = MAX( 0.5, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->print_ps->arc( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ctx->current_print->arc( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ll.print_z_y + ((FlowPoint *)pos)->print_z_y,
ur.print_z_x - ll.print_z_x, ur.print_z_y - ll.print_z_y, angel1, angel2,
draw_type, idx, highlight);
......
/*
* Proview $Id: flow_arrow.cpp,v 1.6 2007-01-04 07:53:34 claes Exp $
* Proview $Id: flow_arrow.cpp,v 1.7 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -115,7 +115,7 @@ void FlowArrow::print( void *pos, void *node, int highlight)
line_width;
idx = MAX( 0.5, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->print_ps->arrow(
ctx->current_print->arrow(
p_dest.print_z_x + ((FlowPoint *)pos)->print_z_x,
p_dest.print_z_y + ((FlowPoint *)pos)->print_z_y,
p1.print_z_x + ((FlowPoint *)pos)->print_z_x,
......
/*
* Proview $Id: flow_browctx.cpp,v 1.6 2007-01-04 07:53:34 claes Exp $
* Proview $Id: flow_browctx.cpp,v 1.7 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -178,10 +178,10 @@ int BrowCtx::print( char *filename)
width = height / 0.70;
}
print_ps = new FlowPscript( filename, this, 1, &sts);
current_print = new FlowPscript( filename, this, 1, &sts);
if ( EVEN(sts))
{
delete print_ps;
delete current_print;
return 0;
}
......@@ -194,9 +194,9 @@ int BrowCtx::print( char *filename)
if ( ll_y > y_high)
break;
print_ps->print_page( ll_x, ll_y, ur_x, ur_y);
current_print->print_page( ll_x, ll_y, ur_x, ur_y);
}
delete print_ps;
delete current_print;
return 1;
}
......
/*
* Proview $Id: flow_ctx.cpp,v 1.11 2007-07-18 09:26:43 claes Exp $
* Proview $Id: flow_ctx.cpp,v 1.12 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -592,17 +592,33 @@ void FlowCtx::print_zoom()
}
int FlowCtx::print_region( double ll_x, double ll_y, double ur_x,
double ur_y, char *filename)
double ur_y, char *filename)
{
int sts;
print_ps = new FlowPscript( filename, this, 0, &sts);
current_print = new FlowPscript( filename, this, 0, &sts);
if ( ODD(sts)) {
if ( trace_started)
print_ps->set_showred(1);
print_ps->print_page( ll_x, ll_y, ur_x, ur_y);
current_print->set_showred(1);
current_print->print_page( ll_x, ll_y, ur_x, ur_y);
}
delete print_ps;
delete current_print;
return sts;
}
int FlowCtx::print_pdf_region( double ll_x, double ll_y, double ur_x,
double ur_y, char *filename)
{
int sts;
current_print = new FlowPdf( filename, this, 0, &sts);
if ( ODD(sts)) {
if ( trace_started)
current_print->set_showred(1);
current_print->print_page( ll_x, ll_y, ur_x, ur_y);
}
delete current_print;
return sts;
}
......
/*
* Proview $Id: flow_ctx.h,v 1.7 2007-07-18 09:26:43 claes Exp $
* Proview $Id: flow_ctx.h,v 1.8 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -24,6 +24,7 @@
#include "flow.h"
#include "flow_pscript.h"
#include "flow_pdf.h"
#include "flow_array.h"
class FlowDraw;
......@@ -250,9 +251,11 @@ class FlowCtx {
double grid_size_x;
double grid_size_y;
int grid_on;
FlowPscript *print_ps;
FlowPrint *current_print;
int print_region( double ll_x, double ll_y, double ur_x,
double ur_y, char *filename);
double ur_y, char *filename);
int print_pdf_region( double ll_x, double ll_y, double ur_x,
double ur_y, char *filename);
double draw_delta;
double grafcet_con_delta;
int refcon_cnt;
......
/*
* Proview $Id: flow_image.cpp,v 1.8 2007-02-05 09:42:57 claes Exp $
* Proview $Id: flow_image.cpp,v 1.9 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -96,12 +96,12 @@ void FlowImage::print( void *pos, void *node, int highlight)
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
ctx->print_ps->rect( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ctx->current_print->rect( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ll.print_z_y + ((FlowPoint *)pos)->print_z_y,
ur.print_z_x - ll.print_z_x, ur.print_z_y - ll.print_z_y,
draw_type, idx, 0);
else
ctx->print_ps->filled_rect( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ctx->current_print->filled_rect( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ll.print_z_y + ((FlowPoint *)pos)->print_z_y,
ur.print_z_x - ll.print_z_x, ur.print_z_y - ll.print_z_y,
draw_type, idx);
......
/*
* Proview $Id: flow_line.cpp,v 1.6 2007-01-04 07:53:35 claes Exp $
* Proview $Id: flow_line.cpp,v 1.7 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -55,7 +55,7 @@ void FlowLine::print( void *pos, void *node, int highlight)
line_width;
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->print_ps->line( p1.print_z_x + ((FlowPoint *)pos)->print_z_x,
ctx->current_print->line( p1.print_z_x + ((FlowPoint *)pos)->print_z_x,
p1.print_z_y + ((FlowPoint *)pos)->print_z_y,
p2.print_z_x + ((FlowPoint *)pos)->print_z_x,
p2.print_z_y + ((FlowPoint *)pos)->print_z_y,
......
/*
* Proview $Id: flow_pdf.cpp,v 1.1 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#include "flow_std.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <float.h>
#include "flow_ctx.h"
#include "flow_pdf.h"
#include "cnv_topdf.h"
FlowPdf::FlowPdf( char *filename, void *flow_ctx, int page_border,
int *sts) :
border(page_border), ctx(flow_ctx), show_red(1), topdf(0)
{
topdf = new CnvToPdf();
topdf->set_filename( pdf_eFile_Body, filename);
topdf->set_useoutlines( 0);
*sts = 1;
}
FlowPdf::~FlowPdf()
{
if ( topdf) {
topdf->close();
delete topdf;
}
}
int FlowPdf::print_page( double ll_x, double ll_y, double ur_x, double ur_y)
{
FlowCtx *cx = (FlowCtx *) ctx;
if ( ur_x - ll_x > ur_y - ll_y)
cx->print_zoom_factor = 730 / (ur_x - ll_x);
else
cx->print_zoom_factor = 730 / (ur_y - ll_y);
cx->print_zoom();
offset_x = ll_x * cx->print_zoom_factor;
offset_y = ur_y * cx->print_zoom_factor;
#if 0
if ( ur_x - ll_x > ur_y - ll_y)
{
/* Landscape orientation */
fprintf( file, "%f %f translate\n", (ur_y - ll_y) *
cx->print_zoom_factor + 40, 20.0);
fprintf( file, "90 rotate\n");
}
else
fprintf( file, "%f %f translate\n", 40.0, 20.0);
/* Clip the region */
fprintf( file, "newpath\n");
fprintf( file, "%f %f moveto\n", ll_x * cx->print_zoom_factor - offset_x,
offset_y - ll_y * cx->print_zoom_factor);
fprintf( file, "%f %f lineto\n", ll_x * cx->print_zoom_factor - offset_x,
offset_y - ur_y * cx->print_zoom_factor);
fprintf( file, "%f %f lineto\n", ur_x * cx->print_zoom_factor - offset_x,
offset_y - ur_y * cx->print_zoom_factor);
fprintf( file, "%f %f lineto\n", ur_x * cx->print_zoom_factor - offset_x,
offset_y - ll_y * cx->print_zoom_factor);
fprintf( file, "%f %f lineto\n", ll_x * cx->print_zoom_factor - offset_x,
offset_y - ll_y * cx->print_zoom_factor);
fprintf( file, "closepath\n");
fprintf( file, "clip\n");
#endif
((FlowCtx *)ctx)->current_print = this;
topdf->set_confpass( true);
topdf->open();
((FlowCtx *)ctx)->print( ll_x, ll_y, ur_x, ur_y);
//topdf->print_pagebreak(0);
topdf->set_confpass( false);
topdf->open();
((FlowCtx *)ctx)->print( ll_x, ll_y, ur_x, ur_y);
//topdf->print_pagebreak(0);
return 1;
}
int FlowPdf::rect( double x, double y, double width, double height, flow_eDrawType type,
double idx, int highlight)
{
topdf->draw_rect( idx, x - offset_x, offset_y - y - height, width, height);
return 1;
}
int FlowPdf::filled_rect( double x, double y, double width, double height,
flow_eDrawType type, double idx)
{
return 1;
}
int FlowPdf::arc( double x, double y, double width, double height, int angel1, int angel2,
flow_eDrawType type, double idx, int highlight)
{
topdf->draw_arc( idx, x - offset_x, offset_y - y - height, width, height, angel1, angel2);
return 1;
}
int FlowPdf::text( double x, double y, char *text, int len, flow_eDrawType type,
double size)
{
char t[500];
int tlen = len < int(sizeof(t)-1) ? len : sizeof(t)-1;
strncpy( t, text, tlen);
t[tlen] = 0;
int bold = (type == flow_eDrawType_TextHelveticaBold);
topdf->draw_text( x - offset_x , offset_y - y, t, bold, 0.87 * size);
return 1;
}
int FlowPdf::pixmap( double x, double y, flow_sPixmapDataElem *data,
flow_eDrawType type)
{
return 1;
}
int FlowPdf::line( double x1, double y1, double x2, double y2,
flow_eDrawType type, double idx, int hightlight)
{
topdf->draw_line( idx, x1 - offset_x, offset_y - y1, x2 - offset_x, offset_y - y2,
type == flow_eDrawType_LineDashed, type == flow_eDrawType_LineGray);
return 1;
}
int FlowPdf::arrow( double x1, double y1, double x2, double y2,
double x3, double y3, flow_eDrawType type, double idx)
{
topdf->draw_arrow( x1 - offset_x, offset_y - y1, x2 - offset_x, offset_y - y2,
x3 - offset_x, offset_y - y3, type == flow_eDrawType_LineGray);
#if 0
if ( type == flow_eDrawType_LineGray)
{
fprintf( file, "gsave\n");
fprintf( file, "0.5 setgray\n");
}
setlinewidth( idx);
fprintf( file, "newpath\n");
fprintf( file, "%f %f moveto\n", x1-offset_x, offset_y-y1);
fprintf( file, "%f %f lineto\n", x2-offset_x, offset_y-y2);
fprintf( file, "%f %f lineto\n", x3-offset_x, offset_y-y3);
fprintf( file, "%f %f lineto\n", x1-offset_x, offset_y-y1);
fprintf( file, "closepath\n");
fprintf( file, "fill\n");
if ( type == flow_eDrawType_LineGray)
fprintf( file, "grestore\n");
#endif
return 1;
}
void FlowPdf::move( double x, double y)
{
fprintf( file, "%f %f moveto", x, y);
}
void FlowPdf::setlinewidth( double idx)
{
fprintf( file,"%f setlinewidth\n", idx);
}
/*
* Proview $Id: flow_pdf.h,v 1.1 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef flow_pdf_h
#define flow_pdf_h
#include <stdio.h>
#include "flow.h"
#include "flow_print.h"
class CnvToPdf;
class FlowPdf : public FlowPrint {
public:
FlowPdf( char *filename, void *flow_ctx, int page_border, int *sts);
~FlowPdf();
int print_page( double ll_x, double ll_y, double ur_x, double ur_y);
int rect( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight);
int filled_rect( double x, double y, double width, double height, flow_eDrawType type, double idx);
int arc( double x, double y, double width, double height, int angel1, int angel2,
flow_eDrawType type, double idx, int highlight);
int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight);
int text( double x, double y, char *text, int len, flow_eDrawType type, double size);
int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type);
int arrow( double x1, double y1, double x2, double y2,
double x3, double y3, flow_eDrawType type, double idx);
void move( double x, double y);
void setlinewidth( double idx);
void rowbreak();
void set_showred( int show) { show_red = show;}
double offset_x;
double offset_y;
FILE *file;
char fname[80];
int border;
void *ctx;
int show_red;
CnvToPdf *topdf;
};
#endif
/*
* Proview $Id: flow_pixmap.cpp,v 1.5 2007-01-04 07:53:35 claes Exp $
* Proview $Id: flow_pixmap.cpp,v 1.6 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -75,7 +75,7 @@ void FlowPixmap::print( void *pos, void *node, int highlight)
return;
idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->print_ps->pixmap( p.print_z_x + ((FlowPoint *)pos)->print_z_x,
ctx->current_print->pixmap( p.print_z_x + ((FlowPoint *)pos)->print_z_x,
p.print_z_y + ((FlowPoint *)pos)->print_z_y,
&pixmap_data[pixmap_size],
draw_type);
......
/*
* Proview $Id: flow_print.h,v 1.1 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef flow_print_h
#define flow_print_h
#include <stdio.h>
#include "flow.h"
class FlowPrint {
public:
FlowPrint() {};
FlowPrint( char *filename, void *flow_ctx, int page_border, int *sts) {}
virtual ~FlowPrint() {}
virtual int print_page( double ll_x, double ll_y, double ur_x, double ur_y) {return 1;}
virtual int rect( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight) { return 1;}
virtual int filled_rect( double x, double y, double width, double height, flow_eDrawType type, double idx) {return 1;}
virtual int arc( double x, double y, double width, double height, int angel1, int angel2,
flow_eDrawType type, double idx, int highlight) {return 1;}
virtual int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight) {return 1;}
virtual int text( double x, double y, char *text, int len, flow_eDrawType type, double size) {return 1;}
virtual int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type) {return 1;}
virtual int arrow( double x1, double y1, double x2, double y2,
double x3, double y3, flow_eDrawType type, double idx) {return 1;}
virtual void set_showred( int show) {}
};
#endif
/*
* Proview $Id: flow_pscript.cpp,v 1.5 2007-01-24 12:35:54 claes Exp $
* Proview $Id: flow_pscript.cpp,v 1.6 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -111,7 +111,7 @@ int FlowPscript::print_page( double ll_x, double ll_y, double ur_x, double ur_y)
fprintf( file, "stroke\n");
fprintf( file, "newpath\n");
((FlowCtx *)ctx)->print_ps = this;
((FlowCtx *)ctx)->current_print = this;
((FlowCtx *)ctx)->print( ll_x, ll_y, ur_x, ur_y);
fprintf( file, "showpage\n\n");
......@@ -261,7 +261,7 @@ int FlowPscript::line( double x1, double y1, double x2, double y2, flow_eDrawTyp
}
int FlowPscript::text( double x, double y, char *text, int len, flow_eDrawType type,
int size)
double size)
{
char font[40];
char c;
......@@ -280,7 +280,7 @@ int FlowPscript::text( double x, double y, char *text, int len, flow_eDrawType t
}
fprintf( file, "/%s findfont\n", font);
fprintf( file, "%d scalefont\n", size);
fprintf( file, "%d scalefont\n", (int)size);
fprintf( file, "setfont\n");
fprintf( file, "newpath\n");
fprintf( file, "%f %f moveto\n", x-offset_x, offset_y-y);
......
/*
* Proview $Id: flow_pscript.h,v 1.4 2005-09-01 14:56:12 claes Exp $
* Proview $Id: flow_pscript.h,v 1.5 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -22,8 +22,9 @@
#include <stdio.h>
#include "flow.h"
#include "flow_print.h"
class FlowPscript {
class FlowPscript : public FlowPrint {
public:
FlowPscript( char *filename, void *flow_ctx, int page_border, int *sts);
~FlowPscript();
......@@ -33,7 +34,7 @@ class FlowPscript {
int arc( double x, double y, double width, double height, int angel1, int angel2,
flow_eDrawType type, double idx, int highlight);
int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight);
int text( double x, double y, char *text, int len, flow_eDrawType type, int size);
int text( double x, double y, char *text, int len, flow_eDrawType type, double size);
int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type);
int arrow( double x1, double y1, double x2, double y2,
double x3, double y3, flow_eDrawType type, double idx);
......
/*
* Proview $Id: flow_radiobutton.cpp,v 1.4 2007-01-04 07:53:35 claes Exp $
* Proview $Id: flow_radiobutton.cpp,v 1.5 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -60,30 +60,30 @@ void FlowRadiobutton::print( void *pos, void *node, int highlight)
ll_y = int( ll.print_z_y + ((FlowPoint *)pos)->print_z_y);
ur_x = int( ll_x + ur.print_z_x - ll.print_z_x);
ur_y = int( ll_y + ur.print_z_y - ll.print_z_y);
ctx->print_ps->rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
ctx->current_print->rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
draw_type, idx, 0);
if ( ((FlowNode *)node)->rbuttonv[number])
{
ctx->print_ps->line( ll_x + sc*1, ll_y + sc*1, ur_x - sc*1, ll_y + sc*1,
ctx->current_print->line( ll_x + sc*1, ll_y + sc*1, ur_x - sc*1, ll_y + sc*1,
flow_eDrawType_LineGray, idx, 0);
ctx->print_ps->line( ll_x + sc*2, ll_y + sc*2, ur_x - sc*2, ll_y + sc*2,
ctx->current_print->line( ll_x + sc*2, ll_y + sc*2, ur_x - sc*2, ll_y + sc*2,
flow_eDrawType_LineGray, idx, 0);
ctx->print_ps->line( ll_x + sc*1, ll_y + sc*1, ll_x + sc*1, ur_y - sc*1,
ctx->current_print->line( ll_x + sc*1, ll_y + sc*1, ll_x + sc*1, ur_y - sc*1,
flow_eDrawType_LineGray, idx, 0);
ctx->print_ps->line( ll_x + sc*2, ll_y + sc*2, ll_x + sc*2, ur_y - sc*2,
ctx->current_print->line( ll_x + sc*2, ll_y + sc*2, ll_x + sc*2, ur_y - sc*2,
flow_eDrawType_LineGray, idx, 0);
ctx->print_ps->filled_rect( ll_x + sc*3, ll_y + sc*3, ur_x - ll_x - sc*5,
ctx->current_print->filled_rect( ll_x + sc*3, ll_y + sc*3, ur_x - ll_x - sc*5,
ur_y - ll_y - sc*5, flow_eDrawType_Line, idx);
}
else
{
ctx->print_ps->line( ur_x - sc*1, ur_y - sc*1, ll_x + sc*1, ur_y - sc*1,
ctx->current_print->line( ur_x - sc*1, ur_y - sc*1, ll_x + sc*1, ur_y - sc*1,
flow_eDrawType_LineGray, idx, 0);
ctx->print_ps->line( ur_x - sc*2, ur_y - sc*2, ll_x + sc*2, ur_y - sc*2,
ctx->current_print->line( ur_x - sc*2, ur_y - sc*2, ll_x + sc*2, ur_y - sc*2,
flow_eDrawType_LineGray, idx, 0);
ctx->print_ps->line( ur_x - sc*1, ur_y - sc*1, ur_x - sc*1, ll_y + sc*1,
ctx->current_print->line( ur_x - sc*1, ur_y - sc*1, ur_x - sc*1, ll_y + sc*1,
flow_eDrawType_LineGray, idx, 0);
ctx->print_ps->line( ur_x - sc*2, ur_y - sc*2, ur_x - sc*2, ll_y + sc*2,
ctx->current_print->line( ur_x - sc*2, ur_y - sc*2, ur_x - sc*2, ll_y + sc*2,
flow_eDrawType_LineGray, idx, 0);
}
}
......
/*
* Proview $Id: flow_rect.cpp,v 1.7 2007-05-11 15:07:21 claes Exp $
* Proview $Id: flow_rect.cpp,v 1.8 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -62,12 +62,12 @@ void FlowRect::print( void *pos, void *node, int highlight)
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
ctx->print_ps->rect( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ctx->current_print->rect( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ll.print_z_y + ((FlowPoint *)pos)->print_z_y,
ur.print_z_x - ll.print_z_x, ur.print_z_y - ll.print_z_y,
draw_type, idx, highlight);
else
ctx->print_ps->filled_rect( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ctx->current_print->filled_rect( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ll.print_z_y + ((FlowPoint *)pos)->print_z_y,
ur.print_z_x - ll.print_z_x, ur.print_z_y - ll.print_z_y,
draw_type, idx);
......
/*
* Proview $Id: flow_text.cpp,v 1.5 2007-01-04 07:53:35 claes Exp $
* Proview $Id: flow_text.cpp,v 1.6 2007-09-25 13:11:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -48,12 +48,12 @@ void FlowText::print( void *pos, void *node, int highlight)
{
int idx = int( ctx->print_zoom_factor / ctx->base_zoom_factor *
(text_size +4) - 4);
int size = int( 8.0 + 6.0/3*idx);
double size = 8.0 + 6.0/3*idx;
if ( size <= 0)
return;
idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->print_ps->text( p.print_z_x + ((FlowPoint *)pos)->print_z_x ,
ctx->current_print->text( p.print_z_x + ((FlowPoint *)pos)->print_z_x ,
p.print_z_y + ((FlowPoint *)pos)->print_z_y, text, strlen(text),
draw_type, size);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment