Commit cf62149e authored by Christoffer Ackelman's avatar Christoffer Ackelman

Generate documentation pdf files by default in addition to postscript.

parent cb2469f5
...@@ -46,7 +46,7 @@ extern "C" { ...@@ -46,7 +46,7 @@ extern "C" {
#include "cnv_ctx.h" #include "cnv_ctx.h"
#include "co_string.h" #include "co_string.h"
CnvCtx::CnvCtx() : generate_html(0), generate_xtthelp(0), generate_src(0), generate_struct(0), generate_ps(0), generate_cdp(0), common_structfile_only(0), hpp(0), verbose(0), first_class(1), setup(0), wblto(0), rw(0), rx(0) CnvCtx::CnvCtx() : generate_html(0), generate_xtthelp(0), generate_src(0), generate_struct(0), generate_ps(0), generate_pdf(0), generate_cdp(0), common_structfile_only(0), hpp(0), verbose(0), first_class(1), setup(0), wblto(0), rw(0), rx(0)
{ {
strcpy(dir, ""); strcpy(dir, "");
strcpy(setup_filename, ""); strcpy(setup_filename, "");
......
...@@ -60,6 +60,7 @@ class CnvCtx { ...@@ -60,6 +60,7 @@ class CnvCtx {
int generate_src; int generate_src;
int generate_struct; int generate_struct;
int generate_ps; int generate_ps;
int generate_pdf;
int generate_cdp; int generate_cdp;
int common_structfile_only; int common_structfile_only;
int hpp; int hpp;
......
...@@ -103,8 +103,8 @@ void CnvPdfObj::print_begin() ...@@ -103,8 +103,8 @@ void CnvPdfObj::print_begin()
<< " << /Type /Page\n" << " << /Type /Page\n"
<< " /Parent " << topdf->v_outline.size() + 1 << " /Parent " << topdf->v_outline.size() + 1
<< " 0 R\n" << " 0 R\n"
<< " /Mediabox [0 0 " << pdf_cPageWidth << " " << " /Mediabox [0 0 " << ps_cPageWidth << " "
<< pdf_cPageHeight << "]\n" << ps_cPageHeight << "]\n"
<< " /Contents " << " /Contents "
<< number - 1 + topdf->v_outline.size() << number - 1 + topdf->v_outline.size()
+ topdf->v_pages.size() + topdf->v_pages.size()
...@@ -309,78 +309,48 @@ int CnvPdfObj::print_image() ...@@ -309,78 +309,48 @@ int CnvPdfObj::print_image()
return 1; return 1;
} }
void CnvToPdf::cnv_text(char* to, const char* from)
{
if (!from) {
strcpy(to, "");
return;
}
char* t = to;
char* s = (char*)from;
for (; *s; s++) {
switch (*s) {
case '(':
*t++ = '\\';
*t++ = '(';
break;
case ')':
*t++ = '\\';
*t++ = ')';
break;
case '\\':
*t++ = '\\';
*t++ = '\\';
default:
*t++ = *s;
}
}
*t = 0;
}
void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode) void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode)
{ {
char str[1000]; char str[1000];
cnv_text(str, text); cnv_text(str, text);
if (style.sidebreak && mode & pdf_mPrintMode_Pos) { if (style.sidebreak && mode & ps_mPrintMode_Pos) {
if (page_number[cf] == 0) { if (page_number[cf] == 0) {
// First header, no pagebreak // First header, no pagebreak
page_number[cf] = 1; page_number[cf] = 1;
} else { } else {
print_pagebreak(0); print_pagebreak(0);
} }
} else if (style.pagebreak && mode & pdf_mPrintMode_Pos) { } else if (style.pagebreak && mode & ps_mPrintMode_Pos) {
print_pagebreak(0); print_pagebreak(0);
} }
if (mode & pdf_mPrintMode_Pos || mode & pdf_mPrintMode_Start) { if (mode & ps_mPrintMode_Pos || mode & ps_mPrintMode_Start) {
y -= style.top_offset; y -= style.top_offset;
if (y - style.bottom_offset < pdf_cBottomMargin) { if (y - style.bottom_offset < ps_cBottomMargin) {
print_pagebreak(0); print_pagebreak(0);
} }
} else } else
y += style.bottom_offset; y += style.bottom_offset;
if (!(mode & pdf_mPrintMode_FixX)) { if (!(mode & ps_mPrintMode_FixX)) {
if (style.alignment == cnv_eAlignment_Center) { if (style.alignment == cnv_eAlignment_Center) {
x = pdf_cLeftMargin / 2 + (pdf_cPageWidth - pdf_cLeftMargin / 2) / 2 x = ps_cLeftMargin / 2 + (ps_cPageWidth - ps_cLeftMargin / 2) / 2
- 0.50 * strlen(text) * style.font_size / 2; - 0.50 * strlen(text) * style.font_size / 2;
if (x < pdf_cLeftMargin / 2) if (x < ps_cLeftMargin / 2)
x = pdf_cLeftMargin / 2; x = ps_cLeftMargin / 2;
} else } else
x = pdf_cLeftMargin + style.indentation; x = ps_cLeftMargin + style.indentation;
} }
int pmode = mode & 31; int pmode = mode & 31;
if (!streq(text, "")) { if (!streq(text, "")) {
switch (pmode) { switch (pmode) {
case pdf_mPrintMode_Pos: case ps_mPrintMode_Pos:
case pdf_mPrintMode_KeepY: { case ps_mPrintMode_KeepY: {
// Full path with beginning and end // Full path with beginning and end
fp[cf] << " BT\n" fp[cf] << " BT\n"
<< " " << fontname(style) << " " << style.font_size << " Tf\n" << " " << fontname(style) << " " << style.font_size << " Tf\n"
...@@ -389,7 +359,7 @@ void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode) ...@@ -389,7 +359,7 @@ void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode)
<< " ET" << '\n'; << " ET" << '\n';
break; break;
} }
case pdf_mPrintMode_Start: { case ps_mPrintMode_Start: {
// Start new path // Start new path
fp[cf] << " BT\n" fp[cf] << " BT\n"
<< " " << fontname(style) << " " << style.font_size << " Tf\n" << " " << fontname(style) << " " << style.font_size << " Tf\n"
...@@ -397,14 +367,14 @@ void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode) ...@@ -397,14 +367,14 @@ void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode)
<< " (" << str << ") Tj\n"; << " (" << str << ") Tj\n";
break; break;
} }
case pdf_mPrintMode_Continue: { case ps_mPrintMode_Continue: {
// Continue current path // Continue current path
fp[cf] << " " << fontname(style) << " " << style.font_size << " Tf\n" fp[cf] << " " << fontname(style) << " " << style.font_size << " Tf\n"
<< " " << x << " " << y << " Td\n" << " " << x << " " << y << " Td\n"
<< " (" << str << ") Tj\n"; << " (" << str << ") Tj\n";
break; break;
} }
case pdf_mPrintMode_End: { case ps_mPrintMode_End: {
// Continue and close current path // Continue and close current path
fp[cf] << " " << fontname(style) << " " << style.font_size << " Tf\n" fp[cf] << " " << fontname(style) << " " << style.font_size << " Tf\n"
<< " (" << str << ") Tj\n" << " (" << str << ") Tj\n"
...@@ -415,13 +385,13 @@ void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode) ...@@ -415,13 +385,13 @@ void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode)
} }
} else { } else {
switch (pmode) { switch (pmode) {
case pdf_mPrintMode_Start: { case ps_mPrintMode_Start: {
// Start new path // Start new path
fp[cf] << " BT\n" fp[cf] << " BT\n"
<< " " << x << " " << y << " Td\n"; << " " << x << " " << y << " Td\n";
break; break;
} }
case pdf_mPrintMode_End: { case ps_mPrintMode_End: {
// Continue and close current path // Continue and close current path
fp[cf] << " ET" << '\n'; fp[cf] << " ET" << '\n';
break; break;
...@@ -523,32 +493,33 @@ void CnvToPdf::print_pagebreak(int last) ...@@ -523,32 +493,33 @@ void CnvToPdf::print_pagebreak(int last)
if (page_number[cf] != 1 || last) { if (page_number[cf] != 1 || last) {
double page_x; double page_x;
page_x = pdf_cPageNumX; page_x = ps_cPageNumX;
if (!(prev_ci == pdf_eId_TitlePage || prev_ci == pdf_eId_InfoPage)) { if (!(prev_ci == ps_eId_TitlePage || prev_ci == ps_eId_InfoPage)) {
prev_ci = ci; prev_ci = ci;
fp[cf] << " 1 w\n" fp[cf] << " 1 w\n"
<< " " << 10 << " " << pdf_cPageHeight - 20 << " m\n" << " " << 10 << " " << ps_cPageHeight - 20 << " m\n"
<< " " << pdf_cPageWidth + 65 << " " << pdf_cPageHeight - 20 << " " << ps_cPageWidth + 65 << " " << ps_cPageHeight - 20
<< " l\n" << " l\n"
<< " S\n" << " S\n"
<< " BT\n" << " BT\n"
<< " /F1 10 Tf\n" << " /F1 10 Tf\n"
<< " " << " "
<< pdf_cPageWidth / 2 - 10 * 0.5 * strlen(previous_chapter) << " " << ps_cPageWidth / 2 - 10 * 0.5 * strlen(previous_chapter) << " "
<< pdf_cPageNumY << " Td\n" << ps_cPageNumY << " Td\n"
<< " (" << previous_chapter << ") Tj\n" << " (" << previous_chapter << ") Tj\n"
<< " ET\n" << " ET\n"
<< " BT\n" << " BT\n"
<< " /F1 10 Tf\n" << " /F1 10 Tf\n"
<< " " << page_x << " " << pdf_cPageNumY << " Td\n" << " " << page_x << " " << ps_cPageNumY << " Td\n"
<< " (" << page_number[cf] - 1 << ") Tj\n" << " (" << page_number[cf] - 1 << ") Tj\n"
<< " ET\n"; << " ET\n";
} }
if (page_number[cf] > 1 && v_content.size() > 0) if (page_number[cf] > 1 && v_content.size() > 0) {
v_content[page_number[cf] - 2].print_end(); v_content[page_number[cf] - 2].print_end();
}
} }
if (last) if (last)
...@@ -567,7 +538,7 @@ void CnvToPdf::print_pagebreak(int last) ...@@ -567,7 +538,7 @@ void CnvToPdf::print_pagebreak(int last)
page_number[cf]++; page_number[cf]++;
y = pdf_cPageHeight - pdf_cTopMargin; y = ps_cPageHeight - ps_cTopMargin;
} }
void CnvToPdf::print_content() void CnvToPdf::print_content()
...@@ -634,7 +605,7 @@ CnvToPdf::~CnvToPdf() ...@@ -634,7 +605,7 @@ CnvToPdf::~CnvToPdf()
void CnvToPdf::close() void CnvToPdf::close()
{ {
cf = pdf_eFile_Body; cf = ps_eFile_Body;
print_pagebreak(1); print_pagebreak(1);
// print_content(); // print_content();
...@@ -704,7 +675,7 @@ void CnvToPdf::close() ...@@ -704,7 +675,7 @@ void CnvToPdf::close()
<< xref_offset - start_offset << '\n' << xref_offset - start_offset << '\n'
<< "%%EOF\n"; << "%%EOF\n";
fp[pdf_eFile_Body].close(); fp[ps_eFile_Body].close();
} }
static void image_pixel(void* userdata, std::ofstream& fp, unsigned char* rgb) static void image_pixel(void* userdata, std::ofstream& fp, unsigned char* rgb)
...@@ -724,8 +695,8 @@ void CnvToPdf::print_horizontal_line() ...@@ -724,8 +695,8 @@ void CnvToPdf::print_horizontal_line()
{ {
y -= 3; y -= 3;
fp[cf] << " 1 w\n" fp[cf] << " 1 w\n"
<< " " << pdf_cLeftMargin - 50 << " " << y << " m\n" << " " << ps_cLeftMargin - 50 << " " << y << " m\n"
<< " " << pdf_cPageWidth << " " << y << " l\n" << " " << ps_cPageWidth << " " << y << " l\n"
<< " S\n"; << " S\n";
y -= 3; y -= 3;
...@@ -741,7 +712,7 @@ int CnvToPdf::print_image_inline(const char* filename) ...@@ -741,7 +712,7 @@ int CnvToPdf::print_image_inline(const char* filename)
double scalex = 0.71; double scalex = 0.71;
double scaley = 0.78; double scaley = 0.78;
x = pdf_cLeftMargin; x = ps_cLeftMargin;
// Try $pwr_doc/help/ // Try $pwr_doc/help/
strcpy(fname, "$pwr_doc/help/"); strcpy(fname, "$pwr_doc/help/");
...@@ -771,17 +742,17 @@ int CnvToPdf::print_image_inline(const char* filename) ...@@ -771,17 +742,17 @@ int CnvToPdf::print_image_inline(const char* filename)
width = cnv_image_width(image); width = cnv_image_width(image);
height = cnv_image_height(image); height = cnv_image_height(image);
if (width * scalex > pdf_cPageWidth - pdf_cLeftMargin) { if (width * scalex > ps_cPageWidth - ps_cLeftMargin) {
x = pdf_cPageWidth - width * scalex; x = ps_cPageWidth - width * scalex;
if (x < 50) { if (x < 50) {
double scale_factor = (pdf_cPageWidth - 50) / (width * scalex); double scale_factor = (ps_cPageWidth - 50) / (width * scalex);
x = 50; x = 50;
scalex = scalex * scale_factor; scalex = scalex * scale_factor;
scaley = scaley * scale_factor; scaley = scaley * scale_factor;
} }
} }
if (y - height * scaley + 20 < pdf_cBottomMargin) if (y - height * scaley + 20 < ps_cBottomMargin)
print_pagebreak(0); print_pagebreak(0);
fp[cf] << " q\n" fp[cf] << " q\n"
...@@ -820,7 +791,7 @@ int CnvToPdf::print_image(const char* filename) ...@@ -820,7 +791,7 @@ int CnvToPdf::print_image(const char* filename)
double scaley = 0.78; double scaley = 0.78;
im_cnt++; im_cnt++;
x = pdf_cLeftMargin; x = ps_cLeftMargin;
if (strchr(filename, '/') != 0) if (strchr(filename, '/') != 0)
dcli_translate_filename(fname, filename); dcli_translate_filename(fname, filename);
...@@ -853,17 +824,17 @@ int CnvToPdf::print_image(const char* filename) ...@@ -853,17 +824,17 @@ int CnvToPdf::print_image(const char* filename)
width = cnv_image_width(image); width = cnv_image_width(image);
height = cnv_image_height(image); height = cnv_image_height(image);
if (width * scalex > pdf_cPageWidth - pdf_cLeftMargin) { if (width * scalex > ps_cPageWidth - ps_cLeftMargin) {
x = pdf_cPageWidth - width * scalex; x = ps_cPageWidth - width * scalex;
if (x < 50) { if (x < 50) {
double scale_factor = (pdf_cPageWidth - 50) / (width * scalex); double scale_factor = (ps_cPageWidth - 50) / (width * scalex);
x = 50; x = 50;
scalex = scalex * scale_factor; scalex = scalex * scale_factor;
scaley = scaley * scale_factor; scaley = scaley * scale_factor;
} }
} }
if (y - height * scaley + 20 < pdf_cBottomMargin) if (y - height * scaley + 20 < ps_cBottomMargin)
print_pagebreak(0); print_pagebreak(0);
fp[cf] << " q\n" fp[cf] << " q\n"
...@@ -896,86 +867,15 @@ int CnvToPdf::print_image(const char* filename) ...@@ -896,86 +867,15 @@ int CnvToPdf::print_image(const char* filename)
return 1; return 1;
} }
void CnvToPdf::set_pageheader(const char* text)
{
strcpy(previous_chapter, current_chapter);
strcpy(current_chapter, text);
}
void CnvToPdf::print_h1(const char* text, int hlevel, char* subject)
{
char hnum[40];
if (ci == pdf_eId_Chapter) {
set_pageheader(text);
}
if (style[ci].h1.display_number) {
if (hlevel < 0)
hlevel = 0;
if (hlevel > pdf_cMaxLevel - 1)
hlevel = pdf_cMaxLevel - 1;
header_number[hlevel]++;
switch (hlevel) {
case 0:
sprintf(hnum, "%d", header_number[0]);
break;
case 1:
sprintf(hnum, "%d.%d", header_number[0], header_number[1]);
break;
case 2:
sprintf(hnum, "%d.%d.%d", header_number[0], header_number[1],
header_number[2]);
break;
case 3:
sprintf(hnum, "%d.%d.%d.%d", header_number[0], header_number[1],
header_number[2], header_number[3]);
break;
default:;
}
x = pdf_cLeftMargin - 50;
print_text(hnum, style[ci].h1, pdf_mPrintMode_Pos | pdf_mPrintMode_FixX);
double x0 = x + 12.0 * (strlen(hnum) + 1) * style[ci].h1.font_size / 24;
x = pdf_cLeftMargin;
if (x0 > x)
x = x0;
print_text(text, style[ci].h1, pdf_mPrintMode_KeepY | pdf_mPrintMode_FixX);
} else
print_text(text, style[ci].h1);
if (conf_pass && !(ci == pdf_eId_TitlePage || ci == pdf_eId_InfoPage)) {
CnvContentElem cnt;
cnt.page_number = page_number[cf];
cnt.header_level = hlevel;
strcpy(cnt.header_number, hnum);
strcpy(cnt.text, text);
strcpy(cnt.subject, subject);
content.add(cnt);
}
strcpy(previous_chapter, current_chapter);
}
void CnvToPdf::print_h2(const char* text)
{
print_text(text, style[ci].h2);
}
void CnvToPdf::print_h3(const char* text)
{
print_text(text, style[ci].h3);
}
void CnvToPdf::open() void CnvToPdf::open()
{ {
y = pdf_cPageHeight - pdf_cTopMargin; y = ps_cPageHeight - ps_cTopMargin;
im_cnt = 0; im_cnt = 0;
if (conf_pass) { if (conf_pass) {
fp[pdf_eFile_Body].open(filename[pdf_eFile_Body]); fp[ps_eFile_Body].open(filename[ps_eFile_Body]);
fp[pdf_eFile_Body] << setiosflags(std::ios::fixed) << std::setprecision(6); fp[ps_eFile_Body] << setiosflags(std::ios::fixed) << std::setprecision(6);
start_offset = fp[pdf_eFile_Body].tellp(); start_offset = fp[ps_eFile_Body].tellp();
} else { } else {
print_content(); print_content();
...@@ -988,14 +888,14 @@ void CnvToPdf::open() ...@@ -988,14 +888,14 @@ void CnvToPdf::open()
v_image[i].print_end(); v_image[i].print_end();
} }
// if ( v_content.size() > 0 && v_content[v_content.size()-1].length == 0) // if ( v_content.size() > 0 && v_content[v_content.size()-1].length == 0)
// v_content[v_content.size()-1].length = (int) fp[pdf_eFile_Body].tellp() // v_content[v_content.size()-1].length = (int) fp[ps_eFile_Body].tellp()
// - // -
// v_content[v_content.size()-1].start; // v_content[v_content.size()-1].start;
fp[pdf_eFile_Body].seekp(start_offset); fp[ps_eFile_Body].seekp(start_offset);
strcpy(previous_chapter, ""); strcpy(previous_chapter, "");
strcpy(current_chapter, ""); strcpy(current_chapter, "");
} }
cf = pdf_eFile_Body; cf = ps_eFile_Body;
page_number[cf] = 0; page_number[cf] = 0;
if (conf_pass) { if (conf_pass) {
...@@ -1049,31 +949,7 @@ void CnvToPdf::open() ...@@ -1049,31 +949,7 @@ void CnvToPdf::open()
print_pagebreak(0); print_pagebreak(0);
for (int i = 1; i < pdf_cMaxLevel; i++) for (int i = 1; i < ps_cMaxLevel; i++)
header_number[i] = 0;
}
void CnvToPdf::incr_headerlevel()
{
ci++;
if (ci > pdf_eId_TopicL3)
ci = pdf_eId_TopicL3;
if (ci < pdf_eId_TopicL1)
ci = pdf_eId_TopicL1;
header_number[ci - (int)pdf_eId_Chapter] = 0;
}
void CnvToPdf::decr_headerlevel()
{
ci--;
if (ci < pdf_eId_Chapter)
ci = pdf_eId_Chapter;
}
void CnvToPdf::reset_headernumbers(int level)
{
for (int i = level; i < pdf_cMaxLevel; i++)
header_number[i] = 0; header_number[i] = 0;
} }
......
...@@ -41,43 +41,12 @@ ...@@ -41,43 +41,12 @@
#include <fstream> #include <fstream>
#include "cnv_content.h" #include "cnv_tops.h"
#define pdf_cMaxLevel 4 #undef ps_cPageHeight
#define pdf_cPageHeight 842 #define ps_cPageHeight 842
#define pdf_cPageWidth 595 #undef ps_cPageWidth
#define pdf_cPageNumX (pdf_cPageWidth - 10) #define ps_cPageWidth 595
#define pdf_cPageNumY (pdf_cPageHeight - 13)
#define pdf_cLeftMargin 100
#define pdf_cTopMargin 100
#define pdf_cBottomMargin 50
#define pdf_cCellSize 110
#define pdf_cTmpFile "/tmp/ptmp.ps"
typedef enum {
pdf_mPrintMode_Pos = 1 << 0,
pdf_mPrintMode_Start = 1 << 1,
pdf_mPrintMode_Continue = 1 << 2,
pdf_mPrintMode_End = 1 << 3,
pdf_mPrintMode_KeepY = 1 << 4,
pdf_mPrintMode_FixX = 1 << 5
} pdf_mPrintMode;
typedef enum { pdf_eFile_Body, pdf_eFile__ } pdf_eFile;
typedef enum {
pdf_eId_TitlePage,
pdf_eId_InfoPage,
pdf_eId_Content,
pdf_eId_Chapter,
pdf_eId_TopicL1,
pdf_eId_TopicL2,
pdf_eId_TopicL3,
pdf_eId_Function,
pdf_eId_Class,
pdf_eId_Report,
pdf_eId__
} pdf_eId;
typedef enum { typedef enum {
pdf_eObjType_Catalog, pdf_eObjType_Catalog,
...@@ -129,67 +98,14 @@ class CnvPdfObj { ...@@ -129,67 +98,14 @@ class CnvPdfObj {
int xobject[40]; int xobject[40];
}; };
class CnvToPdf { class CnvToPdf : public CnvToPs {
public: public:
CnvToPdf() CnvToPdf() : CnvToPs(), prev_ci(0), xref_offset(0), im_cnt(0), use_outlines(1) {}
: cf(0), ci(0), prev_ci(0), conf_pass(false), xref_offset(0), im_cnt(0),
use_outlines(1)
{
for (int i = 0; i < pdf_cMaxLevel; i++)
header_number[i] = 0;
for (int i = 0; i < pdf_eFile__; i++)
page_number[i] = 0;
strcpy(previous_chapter, "");
strcpy(current_chapter, "");
style[pdf_eId_TitlePage].h1 = CnvStyle("Helvetica-Bold-ISOLatin1", 35, 0, 0,
0, cnv_eAlignment_Center, 0, 0, 0);
style[pdf_eId_TitlePage].h2 = CnvStyle("Helvetica-Bold-ISOLatin1", 25, 0,
50, 20, cnv_eAlignment_Center, 0, 0, 0);
style[pdf_eId_TitlePage].h3 = CnvStyle("Helvetica-Bold-ISOLatin1", 15, 0,
25, 10, cnv_eAlignment_Center, 0, 0, 0);
style[pdf_eId_TitlePage].text = CnvStyle(
"Helvetica-ISOLatin1", 8, 0, 9, 1, cnv_eAlignment_Center, 0, 0, 0);
style[pdf_eId_TitlePage].boldtext = CnvStyle(
"Helvetica-Bold-ISOLatin1", 8, 0, 9, 1, cnv_eAlignment_Center, 0, 0, 0);
style[pdf_eId_InfoPage].h1 = CnvStyle("Helvetica-Bold-ISOLatin1", 24, 0,
100, 20, cnv_eAlignment_Left, 0, 0, 0);
style[pdf_eId_Chapter].h1 = CnvStyle("Helvetica-Bold-ISOLatin1", 24, 0, 24,
40, cnv_eAlignment_Left, 0, 1, 1);
style[pdf_eId_TopicL2].h1 = CnvStyle("Helvetica-Bold-ISOLatin1", 12, 0, 20,
10, cnv_eAlignment_Left, 0, 0, 1);
style[pdf_eId_TopicL2].h2 = CnvStyle(
"Helvetica-Bold-ISOLatin1", 10, 0, 16, 8, cnv_eAlignment_Left, 0, 0, 0);
style[pdf_eId_TopicL3].h1 = CnvStyle(
"Helvetica-Bold-ISOLatin1", 10, 0, 16, 8, cnv_eAlignment_Left, 0, 0, 1);
style[pdf_eId_TopicL3].h2 = CnvStyle(
"Helvetica-Bold-ISOLatin1", 8, 0, 16, 5, cnv_eAlignment_Left, 0, 0, 0);
style[pdf_eId_Function].h1 = CnvStyle("Helvetica-Bold-ISOLatin1", 24, 0, 24,
20, cnv_eAlignment_Left, 1, 0, 1);
style[pdf_eId_Class].h1 = CnvStyle("Helvetica-Bold-ISOLatin1", 24, 0, 24,
20, cnv_eAlignment_Left, 1, 0, 1);
style[pdf_eId_Class].h2 = CnvStyle(
"Helvetica-Bold-ISOLatin1", 20, 0, 24, 8, cnv_eAlignment_Left, 0, 0, 0);
style[pdf_eId_Class].h3 = CnvStyle("Helvetica-Bold-ISOLatin1", 16, -40, 24,
6, cnv_eAlignment_Left, 0, 0, 0);
style[pdf_eId_Content].boldtext = CnvStyle(
"Helvetica-Bold-ISOLatin1", 10, 0, 11, 1, cnv_eAlignment_Left, 0, 0, 0);
style[pdf_eId_Chapter].text = CnvStyle(
"TimesNewRoman-ISOLatin1", 10, 0, 11, 1, cnv_eAlignment_Left, 0, 0, 0);
style[pdf_eId_TopicL1].text = CnvStyle(
"TimesNewRoman-ISOLatin1", 10, 0, 11, 1, cnv_eAlignment_Left, 0, 0, 0);
style[pdf_eId_TopicL2].text = CnvStyle(
"TimesNewRoman-ISOLatin1", 10, 0, 11, 1, cnv_eAlignment_Left, 0, 0, 0);
style[pdf_eId_TopicL3].text = CnvStyle(
"TimesNewRoman-ISOLatin1", 10, 0, 11, 1, cnv_eAlignment_Left, 0, 0, 0);
style[pdf_eId_Report].h1 = CnvStyle("Helvetica-Bold-ISOLatin1", 20, 0, 14,
20, cnv_eAlignment_Left, 0, 0, 0);
}
~CnvToPdf(); ~CnvToPdf();
void close(); void close();
void print_text( void print_text(
const char* text, CnvStyle& style, int mode = pdf_mPrintMode_Pos); const char* text, CnvStyle& style, int mode = ps_mPrintMode_Pos);
void draw_rect(double lw, double x, double y, double w, double h); void draw_rect(double lw, double x, double y, double w, double h);
void draw_arc(double lw, double x, double y, double w, double h, int angle1, void draw_arc(double lw, double x, double y, double w, double h, int angle1,
int angle2); int angle2);
...@@ -200,44 +116,18 @@ class CnvToPdf { ...@@ -200,44 +116,18 @@ class CnvToPdf {
double y3, int gray); double y3, int gray);
void print_pagebreak(int print_num); void print_pagebreak(int print_num);
void print_content(); void print_content();
void print_h1(const char* text, int hlevel, char* subject);
void print_h2(const char* text);
void print_h3(const char* text);
void print_horizontal_line(); void print_horizontal_line();
int print_image(const char* filename); int print_image(const char* filename);
int print_image_inline(const char* filename); int print_image_inline(const char* filename);
void cnv_text(char* to, const char* from); void set_cf(int val)
void set_confpass(bool conf)
{ {
conf_pass = conf;
if (!conf) {
// Reset
for (int i = 0; i < pdf_cMaxLevel; i++)
header_number[i] = 0;
for (int i = 0; i < pdf_eFile__; i++)
page_number[i] = 0;
cf = 0;
ci = 0;
}
} }
void set_ci(int val) void set_ci(int val)
{ {
prev_ci = ci; prev_ci = ci;
ci = val; ci = val;
} }
void set_cf(int val)
{
cf = val;
}
void set_filename(int idx, char* name)
{
strcpy(filename[idx], name);
}
void open(); void open();
void incr_headerlevel();
void decr_headerlevel();
void reset_headernumbers(int level);
void set_pageheader(const char* text);
void set_useoutlines(int u) void set_useoutlines(int u)
{ {
use_outlines = u; use_outlines = u;
...@@ -250,20 +140,7 @@ class CnvToPdf { ...@@ -250,20 +140,7 @@ class CnvToPdf {
std::vector<CnvPdfObj> v_font; std::vector<CnvPdfObj> v_font;
std::vector<CnvPdfObj> v_resource; std::vector<CnvPdfObj> v_resource;
std::vector<CnvPdfObj> v_image; std::vector<CnvPdfObj> v_image;
CnvContent content;
CnvIdStyle style[pdf_eId__];
std::ofstream fp[pdf_eFile__];
pwr_tFileName filename[pdf_eFile__];
int cf;
int ci;
int prev_ci; int prev_ci;
double x;
double y;
int page_number[pdf_eFile__];
int header_number[pdf_cMaxLevel];
bool conf_pass;
char current_chapter[160];
char previous_chapter[160];
int start_offset; int start_offset;
int xref_offset; int xref_offset;
int im_cnt; int im_cnt;
......
...@@ -131,18 +131,18 @@ class CnvToPs { ...@@ -131,18 +131,18 @@ class CnvToPs {
style[ps_eId_Report].h1 = CnvStyle("Helvetica-Bold-ISOLatin1", 24, 0, 24, style[ps_eId_Report].h1 = CnvStyle("Helvetica-Bold-ISOLatin1", 24, 0, 24,
20, cnv_eAlignment_Left, 0, 0, 0); 20, cnv_eAlignment_Left, 0, 0, 0);
} }
~CnvToPs(); virtual ~CnvToPs();
void close(); virtual void close();
void print_text( virtual void print_text(
const char* text, CnvStyle& style, int mode = ps_mPrintMode_Pos); const char* text, CnvStyle& style, int mode = ps_mPrintMode_Pos);
void print_pagebreak(int print_num); virtual void print_pagebreak(int print_num);
void print_content(); virtual void print_content();
void print_h1(const char* text, int hlevel, char* subject); void print_h1(const char* text, int hlevel, char* subject);
void print_h2(const char* text); void print_h2(const char* text);
void print_h3(const char* text); void print_h3(const char* text);
void print_horizontal_line(); virtual void print_horizontal_line();
int print_image(const char* filename); virtual int print_image(const char* filename);
void cnv_text(char* to, const char* from); void cnv_text(char* to, const char* from);
void set_confpass(bool conf) void set_confpass(bool conf)
{ {
...@@ -157,11 +157,11 @@ class CnvToPs { ...@@ -157,11 +157,11 @@ class CnvToPs {
ci = 0; ci = 0;
} }
} }
void set_ci(int val) virtual void set_ci(int val)
{ {
ci = val; ci = val;
} }
void set_cf(int val) virtual void set_cf(int val)
{ {
cf = val; cf = val;
} }
...@@ -169,7 +169,7 @@ class CnvToPs { ...@@ -169,7 +169,7 @@ class CnvToPs {
{ {
strcpy(filename[idx], name); strcpy(filename[idx], name);
} }
void open(); virtual void open();
void incr_headerlevel(); void incr_headerlevel();
void decr_headerlevel(); void decr_headerlevel();
void reset_headernumbers(int level); void reset_headernumbers(int level);
......
...@@ -42,12 +42,13 @@ ...@@ -42,12 +42,13 @@
#include "co_lng.h" #include "co_lng.h"
#include "co_string.h" #include "co_string.h"
#include "cnv_wbltops.h"
#include "cnv_ctx.h" #include "cnv_ctx.h"
#include "cnv_wbltops.h"
CnvWblToPs::~CnvWblToPs() CnvWblToPs::~CnvWblToPs()
{ {
tops.close(); tops->close();
delete tops;
} }
int CnvWblToPs::init(char* first) int CnvWblToPs::init(char* first)
...@@ -57,51 +58,59 @@ int CnvWblToPs::init(char* first) ...@@ -57,51 +58,59 @@ int CnvWblToPs::init(char* first)
strcpy(fname, ctx->dir); strcpy(fname, ctx->dir);
strcat(fname, ctx->rw->volume_name); strcat(fname, ctx->rw->volume_name);
strcat(fname, ".ps"); if (ctx->generate_pdf) {
strcat(fname, ".pdf");
} else {
strcat(fname, ".ps");
}
tops.set_filename(ps_eFile_Info, fname); if (ctx->generate_pdf) {
tops.set_filename(ps_eFile_Body, ps_cTmpFile); tops->set_filename(ps_eFile_Body, fname);
tops.open(); } else {
tops->set_filename(ps_eFile_Info, fname);
tops->set_filename(ps_eFile_Body, ps_cTmpFile);
}
tops->open();
// Print first page // Print first page
tops.set_cf(ps_eFile_Info); tops->set_cf(ps_eFile_Info);
tops.set_ci(ps_eId_TitlePage); tops->set_ci(ps_eId_TitlePage);
tops.y -= 100; tops->y -= 100;
tops.print_image("pwr_logga.gif"); tops->print_image("pwr_logga.gif");
tops.y -= 100; tops->y -= 100;
tops.print_h2(Lng::translate("Object Reference Manual")); tops->print_h2(Lng::translate("Object Reference Manual"));
tops.print_h3(Lng::translate("Volume")); tops->print_h3(Lng::translate("Volume"));
tops.print_h2(ctx->rw->volume_name); tops->print_h2(ctx->rw->volume_name);
tops.y -= 150; tops->y -= 150;
tops.print_horizontal_line(); tops->print_horizontal_line();
tops.print_text("Version " pwrv_cPwrVersionStr, tops.style[tops.ci].text); tops->print_text("Version " pwrv_cPwrVersionStr, tops->style[tops->ci].text);
tops.print_horizontal_line(); tops->print_horizontal_line();
tops.print_pagebreak(0); tops->print_pagebreak(0);
tops.set_cf(ps_eFile_Info); tops->set_cf(ps_eFile_Info);
tops.set_ci(ps_eId_InfoPage); tops->set_ci(ps_eId_InfoPage);
tops.y = ps_cPageHeight - ps_cTopMargin - 450; tops->y = ps_cPageHeight - ps_cTopMargin - 450;
tops.print_text(pwrv_cPwrCopyright, tops.style[tops.ci].text); tops->print_text(pwrv_cPwrCopyright, tops->style[tops->ci].text);
tops.print_text("", tops.style[tops.ci].text); tops->print_text("", tops->style[tops->ci].text);
tops.print_text( tops->print_text(
"Permission is granted to copy, distribute and/or modify this document", "Permission is granted to copy, distribute and/or modify this document",
tops.style[tops.ci].text); tops->style[tops->ci].text);
tops.print_text( tops->print_text(
"under the terms of the GNU Free Documentation License, Version 1.2", "under the terms of the GNU Free Documentation License, Version 1.2",
tops.style[tops.ci].text); tops->style[tops->ci].text);
tops.print_text( tops->print_text(
"or any later version published by the Free Software Foundation;", "or any later version published by the Free Software Foundation;",
tops.style[tops.ci].text); tops->style[tops->ci].text);
tops.print_text( tops->print_text(
"with no Invariant Sections, no Front-Cover Texts, and no Back-Cover", "with no Invariant Sections, no Front-Cover Texts, and no Back-Cover",
tops.style[tops.ci].text); tops->style[tops->ci].text);
tops.print_text("Texts.", tops.style[tops.ci].text); tops->print_text("Texts.", tops->style[tops->ci].text);
tops.y = ps_cPageHeight - ps_cTopMargin; tops->y = ps_cPageHeight - ps_cTopMargin;
tops.set_cf(ps_eFile_Body); tops->set_cf(ps_eFile_Body);
tops.set_ci(ps_eId_Class); tops->set_ci(ps_eId_Class);
sprintf(text, "Volume %s", ctx->rw->volume_name); sprintf(text, "Volume %s", ctx->rw->volume_name);
tops.set_pageheader(text); tops->set_pageheader(text);
return 1; return 1;
} }
...@@ -126,37 +135,37 @@ int CnvWblToPs::class_exec() ...@@ -126,37 +135,37 @@ int CnvWblToPs::class_exec()
strcat(full_class_name, ":"); strcat(full_class_name, ":");
strcat(full_class_name, ctx->rw->class_name); strcat(full_class_name, ctx->rw->class_name);
tops.set_pageheader(full_class_name); tops->set_pageheader(full_class_name);
sprintf(txt, "%s %s", Lng::translate("Class"), ctx->rw->class_name); sprintf(txt, "%s %s", Lng::translate("Class"), ctx->rw->class_name);
tops.print_h1(txt, 0, CnvCtx::low(ctx->rw->class_name)); tops->print_h1(txt, 0, CnvCtx::low(ctx->rw->class_name));
if (!lng_sts) { if (!lng_sts) {
sprintf(txt, "(%s)", Lng::translate("English text not available")); sprintf(txt, "(%s)", Lng::translate("English text not available"));
tops.print_text(txt, tops.style[tops.ci].link); tops->print_text(txt, tops->style[tops->ci].link);
} }
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_author, "")) { if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_author, "")) {
sprintf(txt, "%s %s", Lng::translate("Author"), ctx->rw->doc_author); sprintf(txt, "%s %s", Lng::translate("Author"), ctx->rw->doc_author);
tops.print_text(txt, tops.style[tops.ci].text); tops->print_text(txt, tops->style[tops->ci].text);
} }
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_creator, "")) { if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_creator, "")) {
sprintf(txt, "%s %s", Lng::translate("Creator"), ctx->rw->doc_creator); sprintf(txt, "%s %s", Lng::translate("Creator"), ctx->rw->doc_creator);
tops.print_text(txt, tops.style[tops.ci].text); tops->print_text(txt, tops->style[tops->ci].text);
} }
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_version, "")) { if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_version, "")) {
sprintf(txt, "%s %s", Lng::translate("Version"), ctx->rw->doc_version); sprintf(txt, "%s %s", Lng::translate("Version"), ctx->rw->doc_version);
tops.print_text(txt, tops.style[tops.ci].text); tops->print_text(txt, tops->style[tops->ci].text);
} }
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_code, "")) { if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_code, "")) {
sprintf(txt, "%s %s", Lng::translate("Code"), ctx->rw->doc_code); sprintf(txt, "%s %s", Lng::translate("Code"), ctx->rw->doc_code);
tops.print_text(txt, tops.style[tops.ci].text); tops->print_text(txt, tops->style[tops->ci].text);
} }
tops.print_h2(Lng::translate("Description")); tops->print_h2(Lng::translate("Description"));
if (ctx->rw->doc_fresh) { if (ctx->rw->doc_fresh) {
for (i = 0; i < ctx->rw->doc_cnt; i++) { for (i = 0; i < ctx->rw->doc_cnt; i++) {
CnvCtx::remove_spaces(ctx->rw->doc_text[i], txt); CnvCtx::remove_spaces(ctx->rw->doc_text[i], txt);
...@@ -164,17 +173,17 @@ int CnvWblToPs::class_exec() ...@@ -164,17 +173,17 @@ int CnvWblToPs::class_exec()
char imagefile[80]; char imagefile[80];
CnvCtx::remove_spaces(txt + 6, imagefile); CnvCtx::remove_spaces(txt + 6, imagefile);
tops.print_image(imagefile); tops->print_image(imagefile);
} else if (str_StartsWith(CnvCtx::low(txt), "@b")) { } else if (str_StartsWith(CnvCtx::low(txt), "@b")) {
tops.print_text(txt + 2, tops.style[tops.ci].boldtext); tops->print_text(txt + 2, tops->style[tops->ci].boldtext);
} else if (str_StartsWith(CnvCtx::low(txt), "@h1")) { } else if (str_StartsWith(CnvCtx::low(txt), "@h1")) {
tops.print_h2(txt + 3); tops->print_h2(txt + 3);
} else if (str_StartsWith(CnvCtx::low(txt), "@h2")) { } else if (str_StartsWith(CnvCtx::low(txt), "@h2")) {
tops.print_h3(txt + 3); tops->print_h3(txt + 3);
} else if (str_StartsWith(CnvCtx::low(txt), "@i")) { } else if (str_StartsWith(CnvCtx::low(txt), "@i")) {
tops.print_text(txt + 2, tops.style[tops.ci].text); tops->print_text(txt + 2, tops->style[tops->ci].text);
} else } else
tops.print_text(ctx->rw->doc_text[i], tops.style[tops.ci].text); tops->print_text(ctx->rw->doc_text[i], tops->style[tops->ci].text);
} }
} }
for (i = 0; i < ctx->rw->doc_clink_cnt; i++) { for (i = 0; i < ctx->rw->doc_clink_cnt; i++) {
...@@ -196,22 +205,22 @@ int CnvWblToPs::class_exec() ...@@ -196,22 +205,22 @@ int CnvWblToPs::class_exec()
if ((s = strrchr(link_ref, '.'))) if ((s = strrchr(link_ref, '.')))
*s = 0; *s = 0;
int sts = tops.content.find_link(link_ref, text, &page); int sts = tops->content.find_link(link_ref, text, &page);
if (ODD(sts)) { if (ODD(sts)) {
sprintf(str, " (%s %s ", Lng::translate("See"), text); sprintf(str, " (%s %s ", Lng::translate("See"), text);
sprintf(&str[strlen(str)], "%s %d)", Lng::translate("page"), page); sprintf(&str[strlen(str)], "%s %d)", Lng::translate("page"), page);
tops.print_text(ctx->rw->doc_clink_text[i], tops.style[tops.ci].text, tops->print_text(ctx->rw->doc_clink_text[i], tops->style[tops->ci].text,
ps_mPrintMode_Start); ps_mPrintMode_Start);
tops.print_text(str, tops.style[tops.ci].link, ps_mPrintMode_End); tops->print_text(str, tops->style[tops->ci].link, ps_mPrintMode_End);
} else { } else {
tops.print_text(ctx->rw->doc_clink_text[i], tops.style[tops.ci].text, tops->print_text(ctx->rw->doc_clink_text[i], tops->style[tops->ci].text,
ps_mPrintMode_Start); ps_mPrintMode_Start);
sprintf( sprintf(
str, " (%s %s)", Lng::translate("See"), ctx->rw->doc_clink_ref[i]); str, " (%s %s)", Lng::translate("See"), ctx->rw->doc_clink_ref[i]);
tops.print_text(str, tops.style[tops.ci].link, ps_mPrintMode_End); tops->print_text(str, tops->style[tops->ci].link, ps_mPrintMode_End);
} }
} else } else
tops.print_text(ctx->rw->doc_clink_text[i], tops.style[tops.ci].text); tops->print_text(ctx->rw->doc_clink_text[i], tops->style[tops->ci].text);
} }
return 1; return 1;
} }
...@@ -220,15 +229,15 @@ int CnvWblToPs::body_exec() ...@@ -220,15 +229,15 @@ int CnvWblToPs::body_exec()
{ {
char text[80]; char text[80];
tops.y -= 10; tops->y -= 10;
tops.print_horizontal_line(); tops->print_horizontal_line();
sprintf(text, "%s %s", Lng::translate("Body"), ctx->rw->body_name); sprintf(text, "%s %s", Lng::translate("Body"), ctx->rw->body_name);
tops.print_h2(text); tops->print_h2(text);
sprintf(text, "Struct pwr_sClass_%s", ctx->rw->body_structname); sprintf(text, "Struct pwr_sClass_%s", ctx->rw->body_structname);
tops.print_text(text, tops.style[tops.ci].boldtext); tops->print_text(text, tops->style[tops->ci].boldtext);
if (!streq(ctx->rw->body_flags, "")) { if (!streq(ctx->rw->body_flags, "")) {
sprintf(text, "Flags %s", ctx->rw->body_flags); sprintf(text, "Flags %s", ctx->rw->body_flags);
tops.print_text(text, tops.style[tops.ci].boldtext); tops->print_text(text, tops->style[tops->ci].boldtext);
} }
return 1; return 1;
} }
...@@ -254,7 +263,7 @@ int CnvWblToPs::attribute_exec() ...@@ -254,7 +263,7 @@ int CnvWblToPs::attribute_exec()
if (Lng::current() != lng_eLanguage_en_US) if (Lng::current() != lng_eLanguage_en_US)
lng_sts = ctx->rw->read_lng(ctx->rw->class_name, ctx->rw->attr_name); lng_sts = ctx->rw->read_lng(ctx->rw->class_name, ctx->rw->attr_name);
tops.print_h3(ctx->rw->attr_name); tops->print_h3(ctx->rw->attr_name);
if (ctx->rw->attr_array && ctx->rw->attr_pointer) if (ctx->rw->attr_array && ctx->rw->attr_pointer)
sprintf(txt, "%s Array[%s] of pointers to %s", Lng::translate("Type"), sprintf(txt, "%s Array[%s] of pointers to %s", Lng::translate("Type"),
ctx->rw->attr_elements, ctx->rw->attr_typeref); ctx->rw->attr_elements, ctx->rw->attr_typeref);
...@@ -268,27 +277,27 @@ int CnvWblToPs::attribute_exec() ...@@ -268,27 +277,27 @@ int CnvWblToPs::attribute_exec()
sprintf(txt, "%s %s", Lng::translate("Type"), ctx->rw->attr_typeref); sprintf(txt, "%s %s", Lng::translate("Type"), ctx->rw->attr_typeref);
int sts int sts
= tops.content.find_link(CnvCtx::low(ctx->rw->attr_typeref), text, &page); = tops->content.find_link(CnvCtx::low(ctx->rw->attr_typeref), text, &page);
if (ODD(sts)) { if (ODD(sts)) {
tops.print_text(txt, tops.style[tops.ci].boldtext, ps_mPrintMode_Start); tops->print_text(txt, tops->style[tops->ci].boldtext, ps_mPrintMode_Start);
sprintf(txt, " (%s ", Lng::translate("See")); sprintf(txt, " (%s ", Lng::translate("See"));
sprintf(&txt[strlen(txt)], "%s %d)", Lng::translate("page"), page); sprintf(&txt[strlen(txt)], "%s %d)", Lng::translate("page"), page);
tops.print_text(txt, tops.style[tops.ci].link, ps_mPrintMode_End); tops->print_text(txt, tops->style[tops->ci].link, ps_mPrintMode_End);
} else } else
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
sprintf(txt, "%s %s", Lng::translate("Class"), ctx->rw->attr_type); sprintf(txt, "%s %s", Lng::translate("Class"), ctx->rw->attr_type);
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
if (!streq(ctx->rw->attr_flags, "")) { if (!streq(ctx->rw->attr_flags, "")) {
sprintf(txt, "Flags %s", ctx->rw->attr_flags); sprintf(txt, "Flags %s", ctx->rw->attr_flags);
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
} }
if (!streq(ctx->rw->attr_pgmname, "")) { if (!streq(ctx->rw->attr_pgmname, "")) {
sprintf(txt, "PmgName %s", ctx->rw->attr_pgmname); sprintf(txt, "PmgName %s", ctx->rw->attr_pgmname);
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
} }
tops.print_text("", tops.style[tops.ci].text); tops->print_text("", tops->style[tops->ci].text);
if (ctx->rw->doc_fresh) { if (ctx->rw->doc_fresh) {
for (i = 0; i < ctx->rw->doc_cnt; i++) { for (i = 0; i < ctx->rw->doc_cnt; i++) {
...@@ -296,9 +305,9 @@ int CnvWblToPs::attribute_exec() ...@@ -296,9 +305,9 @@ int CnvWblToPs::attribute_exec()
char imagefile[80]; char imagefile[80];
CnvCtx::remove_spaces(s + 6, imagefile); CnvCtx::remove_spaces(s + 6, imagefile);
tops.print_image(imagefile); tops->print_image(imagefile);
} else } else
tops.print_text(ctx->rw->doc_text[i], tops.style[tops.ci].text); tops->print_text(ctx->rw->doc_text[i], tops->style[tops->ci].text);
} }
} }
return 1; return 1;
...@@ -320,47 +329,47 @@ int CnvWblToPs::typedef_exec() ...@@ -320,47 +329,47 @@ int CnvWblToPs::typedef_exec()
strcat(full_class_name, ":"); strcat(full_class_name, ":");
strcat(full_class_name, ctx->rw->typedef_name); strcat(full_class_name, ctx->rw->typedef_name);
tops.set_pageheader(full_class_name); tops->set_pageheader(full_class_name);
sprintf(txt, "%s %s", Lng::translate("Type"), ctx->rw->typedef_name); sprintf(txt, "%s %s", Lng::translate("Type"), ctx->rw->typedef_name);
tops.print_h1(txt, 0, CnvCtx::low(ctx->rw->typedef_name)); tops->print_h1(txt, 0, CnvCtx::low(ctx->rw->typedef_name));
if (!lng_sts) { if (!lng_sts) {
sprintf(txt, "(%s)", Lng::translate("English text not available")); sprintf(txt, "(%s)", Lng::translate("English text not available"));
tops.print_text(txt, tops.style[tops.ci].link); tops->print_text(txt, tops->style[tops->ci].link);
} }
if (ctx->rw->doc_fresh && !streq(ctx->rw->typedef_typeref, "")) { if (ctx->rw->doc_fresh && !streq(ctx->rw->typedef_typeref, "")) {
sprintf(txt, "TypeRef %s", ctx->rw->typedef_typeref); sprintf(txt, "TypeRef %s", ctx->rw->typedef_typeref);
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
} }
if (ctx->rw->typedef_elements > 1) { if (ctx->rw->typedef_elements > 1) {
sprintf(txt, "Elements %d", ctx->rw->typedef_elements); sprintf(txt, "Elements %d", ctx->rw->typedef_elements);
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
} }
if (!streq(ctx->rw->typedef_pgmname, "")) { if (!streq(ctx->rw->typedef_pgmname, "")) {
sprintf(txt, "Pgmname %s", ctx->rw->typedef_pgmname); sprintf(txt, "Pgmname %s", ctx->rw->typedef_pgmname);
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
} }
tops.print_text("", tops.style[tops.ci].text); tops->print_text("", tops->style[tops->ci].text);
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_author, "")) { if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_author, "")) {
sprintf(txt, "%s %s", Lng::translate("Author"), ctx->rw->doc_author); sprintf(txt, "%s %s", Lng::translate("Author"), ctx->rw->doc_author);
tops.print_text(txt, tops.style[tops.ci].text); tops->print_text(txt, tops->style[tops->ci].text);
} }
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_version, "")) { if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_version, "")) {
sprintf(txt, "%s %s", Lng::translate("Version"), ctx->rw->doc_version); sprintf(txt, "%s %s", Lng::translate("Version"), ctx->rw->doc_version);
tops.print_text(txt, tops.style[tops.ci].text); tops->print_text(txt, tops->style[tops->ci].text);
} }
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_code, "")) { if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_code, "")) {
sprintf(txt, "%s %s", Lng::translate("Code"), ctx->rw->doc_code); sprintf(txt, "%s %s", Lng::translate("Code"), ctx->rw->doc_code);
tops.print_text(txt, tops.style[tops.ci].text); tops->print_text(txt, tops->style[tops->ci].text);
} }
tops.print_h2(Lng::translate("Description")); tops->print_h2(Lng::translate("Description"));
if (ctx->rw->doc_fresh) { if (ctx->rw->doc_fresh) {
for (i = 0; i < ctx->rw->doc_cnt; i++) { for (i = 0; i < ctx->rw->doc_cnt; i++) {
CnvCtx::remove_spaces(ctx->rw->doc_text[i], txt); CnvCtx::remove_spaces(ctx->rw->doc_text[i], txt);
...@@ -368,15 +377,15 @@ int CnvWblToPs::typedef_exec() ...@@ -368,15 +377,15 @@ int CnvWblToPs::typedef_exec()
char imagefile[80]; char imagefile[80];
CnvCtx::remove_spaces(txt + 6, imagefile); CnvCtx::remove_spaces(txt + 6, imagefile);
tops.print_image(imagefile); tops->print_image(imagefile);
} else if (str_StartsWith(CnvCtx::low(txt), "@b")) { } else if (str_StartsWith(CnvCtx::low(txt), "@b")) {
tops.print_text(txt + 2, tops.style[tops.ci].boldtext); tops->print_text(txt + 2, tops->style[tops->ci].boldtext);
} else if (str_StartsWith(CnvCtx::low(txt), "@h1")) { } else if (str_StartsWith(CnvCtx::low(txt), "@h1")) {
tops.print_h2(txt + 3); tops->print_h2(txt + 3);
} else if (str_StartsWith(CnvCtx::low(txt), "@h2")) { } else if (str_StartsWith(CnvCtx::low(txt), "@h2")) {
tops.print_h3(txt + 3); tops->print_h3(txt + 3);
} else } else
tops.print_text(ctx->rw->doc_text[i], tops.style[tops.ci].text); tops->print_text(ctx->rw->doc_text[i], tops->style[tops->ci].text);
} }
} }
for (i = 0; i < ctx->rw->doc_clink_cnt; i++) { for (i = 0; i < ctx->rw->doc_clink_cnt; i++) {
...@@ -398,22 +407,22 @@ int CnvWblToPs::typedef_exec() ...@@ -398,22 +407,22 @@ int CnvWblToPs::typedef_exec()
if ((s = strrchr(link_ref, '.'))) if ((s = strrchr(link_ref, '.')))
*s = 0; *s = 0;
int sts = tops.content.find_link(link_ref, text, &page); int sts = tops->content.find_link(link_ref, text, &page);
if (ODD(sts)) { if (ODD(sts)) {
sprintf(str, " (%s %s ", Lng::translate("See"), text); sprintf(str, " (%s %s ", Lng::translate("See"), text);
sprintf(&str[strlen(str)], "%s %d)", Lng::translate("page"), page); sprintf(&str[strlen(str)], "%s %d)", Lng::translate("page"), page);
tops.print_text(ctx->rw->doc_clink_text[i], tops.style[tops.ci].text, tops->print_text(ctx->rw->doc_clink_text[i], tops->style[tops->ci].text,
ps_mPrintMode_Start); ps_mPrintMode_Start);
tops.print_text(str, tops.style[tops.ci].link, ps_mPrintMode_End); tops->print_text(str, tops->style[tops->ci].link, ps_mPrintMode_End);
} else { } else {
tops.print_text(ctx->rw->doc_clink_text[i], tops.style[tops.ci].text, tops->print_text(ctx->rw->doc_clink_text[i], tops->style[tops->ci].text,
ps_mPrintMode_Start); ps_mPrintMode_Start);
sprintf( sprintf(
str, " (%s %s)", Lng::translate("See"), ctx->rw->doc_clink_ref[i]); str, " (%s %s)", Lng::translate("See"), ctx->rw->doc_clink_ref[i]);
tops.print_text(str, tops.style[tops.ci].link, ps_mPrintMode_End); tops->print_text(str, tops->style[tops->ci].link, ps_mPrintMode_End);
} }
} else } else
tops.print_text(ctx->rw->doc_clink_text[i], tops.style[tops.ci].text); tops->print_text(ctx->rw->doc_clink_text[i], tops->style[tops->ci].text);
} }
return 1; return 1;
} }
...@@ -428,21 +437,21 @@ int CnvWblToPs::bit_exec() ...@@ -428,21 +437,21 @@ int CnvWblToPs::bit_exec()
if (Lng::current() != lng_eLanguage_en_US) if (Lng::current() != lng_eLanguage_en_US)
lng_sts = ctx->rw->read_lng(ctx->rw->typedef_name, ctx->rw->bit_name); lng_sts = ctx->rw->read_lng(ctx->rw->typedef_name, ctx->rw->bit_name);
tops.print_h3(ctx->rw->bit_name); tops->print_h3(ctx->rw->bit_name);
sprintf(txt, "%s %s", Lng::translate("Type"), ctx->rw->bit_type); sprintf(txt, "%s %s", Lng::translate("Type"), ctx->rw->bit_type);
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
sprintf(txt, "Value %d", ctx->rw->bit_value); sprintf(txt, "Value %d", ctx->rw->bit_value);
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
sprintf(txt, "Text %s", ctx->rw->bit_text); sprintf(txt, "Text %s", ctx->rw->bit_text);
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
if (!streq(ctx->rw->bit_pgmname, "")) { if (!streq(ctx->rw->bit_pgmname, "")) {
sprintf(txt, "PmgName %s", ctx->rw->bit_pgmname); sprintf(txt, "PmgName %s", ctx->rw->bit_pgmname);
tops.print_text(txt, tops.style[tops.ci].boldtext); tops->print_text(txt, tops->style[tops->ci].boldtext);
} }
tops.print_text("", tops.style[tops.ci].text); tops->print_text("", tops->style[tops->ci].text);
if (ctx->rw->doc_fresh) { if (ctx->rw->doc_fresh) {
for (i = 0; i < ctx->rw->doc_cnt; i++) { for (i = 0; i < ctx->rw->doc_cnt; i++) {
...@@ -450,9 +459,9 @@ int CnvWblToPs::bit_exec() ...@@ -450,9 +459,9 @@ int CnvWblToPs::bit_exec()
char imagefile[80]; char imagefile[80];
CnvCtx::remove_spaces(s + 6, imagefile); CnvCtx::remove_spaces(s + 6, imagefile);
tops.print_image(imagefile); tops->print_image(imagefile);
} else } else
tops.print_text(ctx->rw->doc_text[i], tops.style[tops.ci].text); tops->print_text(ctx->rw->doc_text[i], tops->style[tops->ci].text);
} }
} }
return 1; return 1;
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#define cnv_wbltops_h #define cnv_wbltops_h
#include "cnv_wblto.h" #include "cnv_wblto.h"
#include "cnv_topdf.h"
#include "cnv_tops.h" #include "cnv_tops.h"
class CnvReadWbl; class CnvReadWbl;
...@@ -46,11 +47,16 @@ class CnvWblToPs : public CnvWblTo { ...@@ -46,11 +47,16 @@ class CnvWblToPs : public CnvWblTo {
public: public:
CnvWblToPs(CnvCtx* cnv_ctx) : ctx(cnv_ctx), conf_pass(false) CnvWblToPs(CnvCtx* cnv_ctx) : ctx(cnv_ctx), conf_pass(false)
{ {
if (ctx->generate_pdf) {
tops = new CnvToPdf();
} else {
tops = new CnvToPs();
}
} }
virtual ~CnvWblToPs(); virtual ~CnvWblToPs();
CnvCtx* ctx; CnvCtx* ctx;
CnvToPs tops; CnvToPs *tops;
bool conf_pass; bool conf_pass;
int init(char* first); int init(char* first);
...@@ -71,7 +77,7 @@ class CnvWblToPs : public CnvWblTo { ...@@ -71,7 +77,7 @@ class CnvWblToPs : public CnvWblTo {
} }
void set_confpass(bool conf) void set_confpass(bool conf)
{ {
tops.set_confpass(conf); tops->set_confpass(conf);
conf_pass = conf; conf_pass = conf;
} }
bool confpass() bool confpass()
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* cnv_xtthelptopdf.cpp --
Convert xtt help file to PDF. */
/*_Include files_________________________________________________________*/
#include <stdlib.h>
extern "C" {
#include "co_cdh.h"
#include "co_dcli.h"
}
#include "co_lng.h"
#include "co_string.h"
#include "cnv_ctx.h"
#include "cnv_readxtthelp.h"
#include "cnv_xtthelptopdf.h"
#include "cnv_image.h"
#define pdf_cCellSize 110
void CnvXtthelpToPdf::subject_to_fname(
char* fname, const char* subject, int path)
{
if (path) {
strcpy(fname, ctx->dir);
strcat(fname, ctx->rx->name);
} else
strcpy(fname, ctx->rx->name);
strcat(fname, ".pdf");
}
CnvXtthelpToPdf::~CnvXtthelpToPdf()
{
if (!first_topic) {
if (status & pdf_mStatus_xtthelp) {
status &= ~pdf_mStatus_xtthelp;
}
}
topdf.close();
}
void* CnvXtthelpToPdf::insert(navh_eItemType item_type, const char* text1,
const char* text2, const char* text3, const char* alink,
const char* link_bookmark, const char* file_name, navh_eHelpFile file_type,
int help_index, const char* bookmark, int coding)
{
char link[80];
if (alink)
strcpy(link, alink);
if (option & pdf_mOption_printDisable && item_type != navh_eItemType_Option)
return NULL;
if ((text2 && !streq(text2, "")) || (text3 && !streq(text3, ""))) {
if (!(status & pdf_mStatus_table))
status |= pdf_mStatus_table;
} else {
if (status & pdf_mStatus_table) {
// Close table (keep if empty line)
if (!(text1 && streq(text1, "")
&& (item_type == navh_eItemType_Help
|| item_type == navh_eItemType_HelpCode
|| item_type == navh_eItemType_HelpBold)))
status &= ~pdf_mStatus_table;
}
}
switch (item_type) {
case navh_eItemType_DocTitlePage:
case navh_eItemType_DocInfoPage:
case navh_eItemType_Topic: {
strcpy(current_subject, text1);
if (item_type == navh_eItemType_DocTitlePage) {
topdf.set_ci(pdf_eId_TitlePage);
} else if (item_type == navh_eItemType_DocInfoPage) {
topdf.set_ci(pdf_eId_InfoPage);
topdf.print_pagebreak(0);
} else {
if (topdf.ci == pdf_eId_Chapter) {
if (!first_chaptertopic)
topdf.set_ci(pdf_eId_TopicL1);
else {
first_chaptertopic = 0;
topdf.y = pdf_cPageHeight - pdf_cTopMargin;
}
} else {
// topdf.set_ci( pdf_eId_TopicL1);
}
}
if (first_topic) {
pwr_tFileName fname;
subject_to_fname(fname, text1, 1);
topdf.set_filename(pdf_eFile_Body, fname);
topdf.open();
status |= pdf_mStatus_xtthelp;
first_topic = 0;
}
status |= pdf_mStatus_topic;
return NULL;
}
case navh_eItemType_EndTopic: {
if (status & pdf_mStatus_table)
status &= ~pdf_mStatus_table;
if (status & pdf_mStatus_paragraph)
status &= ~pdf_mStatus_paragraph;
if (status & pdf_mStatus_topic)
status &= ~pdf_mStatus_topic;
if (user_style) {
user_style = 0;
topdf.set_ci(base_ci);
}
return NULL;
}
case navh_eItemType_Style: {
if (str_NoCaseStrcmp(text1, "function") == 0) {
base_ci = topdf.ci;
topdf.set_ci(pdf_eId_Function);
user_style = 1;
} else if (str_NoCaseStrcmp(text1, "report") == 0) {
base_ci = topdf.ci;
topdf.set_ci(pdf_eId_Report);
}
return NULL;
}
case navh_eItemType_EndChapter: {
if (status & pdf_mStatus_table)
status &= ~pdf_mStatus_table;
if (status & pdf_mStatus_paragraph)
status &= ~pdf_mStatus_paragraph;
if (status & pdf_mStatus_topic)
status &= ~pdf_mStatus_topic;
topdf.set_ci(pdf_eId_TopicL1);
user_style = 0;
return NULL;
}
case navh_eItemType_Chapter: {
if (status & pdf_mStatus_table)
status &= ~pdf_mStatus_table;
if (status & pdf_mStatus_paragraph)
status &= ~pdf_mStatus_paragraph;
if (status & pdf_mStatus_topic)
status &= ~pdf_mStatus_topic;
topdf.set_ci(pdf_eId_Chapter);
first_chaptertopic = 1;
user_style = 0;
topdf.reset_headernumbers(1);
return NULL;
}
case navh_eItemType_HeaderLevel: {
if (user_style) {
user_style = 0;
topdf.set_ci(base_ci);
}
topdf.incr_headerlevel();
return NULL;
}
case navh_eItemType_EndHeaderLevel: {
if (user_style) {
user_style = 0;
topdf.set_ci(base_ci);
}
topdf.decr_headerlevel();
return NULL;
}
case navh_eItemType_PageBreak: {
topdf.print_pagebreak(0);
return NULL;
}
case navh_eItemType_Help:
case navh_eItemType_HelpCode:
case navh_eItemType_HelpBold: {
int printmode;
CnvStyle* hstyle = NULL;
// Unable to calculate lenght because link i not known in confpass
strcpy(link, "");
if (item_type == navh_eItemType_Help)
hstyle = &topdf.style[topdf.ci].text;
else if (item_type == navh_eItemType_HelpBold)
hstyle = &topdf.style[topdf.ci].boldtext;
else if (item_type == navh_eItemType_HelpCode)
hstyle = &topdf.style[topdf.ci].code;
if (!streq(link, ""))
printmode = pdf_mPrintMode_Start;
else
printmode = pdf_mPrintMode_Pos;
if (!(status & pdf_mStatus_table)) {
topdf.x = pdf_cLeftMargin;
topdf.print_text(text1, *hstyle, printmode);
} else {
topdf.x = pdf_cLeftMargin;
topdf.print_text(text1, *hstyle);
if (text2 && !streq(text2, "")) {
topdf.x = pdf_cLeftMargin + pdf_cCellSize;
topdf.print_text(
text2, *hstyle, pdf_mPrintMode_KeepY | pdf_mPrintMode_FixX);
}
if (text3 && !streq(text3, "")) {
topdf.x = pdf_cLeftMargin + 2 * pdf_cCellSize;
topdf.print_text(
text3, *hstyle, pdf_mPrintMode_KeepY | pdf_mPrintMode_FixX);
}
}
if (!streq(link, "") && !conf_pass) {
pwr_tFileName fname;
char str[200];
int page;
if (str_StartsWith(link, "$web:")) {
if (str_StartsWith(&link[5], "$pwrp_web/"))
strcpy(fname, &link[15]);
else
strcpy(fname, &link[5]);
sprintf(str, " (%s %s)", Lng::translate("See"), fname);
if (!(status & pdf_mStatus_table))
topdf.print_text(str, topdf.style[topdf.ci].link,
pdf_mPrintMode_End | pdf_mPrintMode_FixX);
else {
topdf.x = pdf_cLeftMargin + 3 * pdf_cCellSize;
if (pdf_cLeftMargin + 2 * pdf_cCellSize
+ strlen(text3) * hstyle->font_size * 0.65
> topdf.x)
topdf.x = pdf_cLeftMargin + 2 * pdf_cCellSize
+ strlen(text3) * hstyle->font_size * 0.65;
topdf.print_text(str, topdf.style[topdf.ci].link,
pdf_mPrintMode_End | pdf_mPrintMode_FixX);
}
} else if ((strstr(link, ".htm") != 0) || (strstr(link, ".pdf") != 0)) {
strcpy(fname, link);
sprintf(str, " (%s %s)", Lng::translate("See"), fname);
if (!(status & pdf_mStatus_table))
topdf.print_text(str, topdf.style[topdf.ci].link,
pdf_mPrintMode_End | pdf_mPrintMode_FixX);
else {
topdf.x = pdf_cLeftMargin + 3 * pdf_cCellSize;
if (pdf_cLeftMargin + 2 * pdf_cCellSize
+ strlen(text3) * hstyle->font_size * 0.65
> topdf.x)
topdf.x = pdf_cLeftMargin + 2 * pdf_cCellSize
+ strlen(text3) * hstyle->font_size * 0.65;
topdf.print_text(str, topdf.style[topdf.ci].link,
pdf_mPrintMode_End | pdf_mPrintMode_FixX);
}
} else {
char text[80];
int sts = topdf.content.find_link(link, text, &page);
if (ODD(sts)) {
sprintf(str, " (%s %s ", Lng::translate("See"), text);
sprintf(&str[strlen(str)], "%s %d)", Lng::translate("page"), page);
if (!(status & pdf_mStatus_table))
topdf.print_text(str, topdf.style[topdf.ci].link,
pdf_mPrintMode_End | pdf_mPrintMode_FixX);
else {
}
} else if (!(status & pdf_mStatus_table))
topdf.print_text("", topdf.style[topdf.ci].link,
pdf_mPrintMode_End | pdf_mPrintMode_FixX);
}
} else if (bookmark) {
// fp[cf] << tags[pdf_eTag_link].start << " name=\"" << bookmark << "\">";
}
return NULL;
}
case navh_eItemType_HelpHeader: {
int hlevel;
if (!user_style)
hlevel = topdf.ci - (int)pdf_eId_Chapter;
else
hlevel = base_ci - (int)pdf_eId_Chapter;
topdf.print_h1(text1, hlevel, current_subject);
return NULL;
}
case navh_eItemType_Header: {
topdf.print_h3(text1);
return NULL;
}
case navh_eItemType_HeaderLarge: {
topdf.print_h2(text1);
return NULL;
}
case navh_eItemType_HorizontalLine: {
topdf.print_horizontal_line();
return NULL;
}
case navh_eItemType_Image: {
int sts = topdf.print_image(text1);
if (EVEN(sts))
printf("Image: %s not found\n", text1);
return NULL;
}
case navh_eItemType_Option: {
if (streq(text1, "printdisable"))
option |= pdf_mOption_printDisable;
else if (streq(text1, "printenable"))
option &= ~pdf_mOption_printDisable;
return NULL;
}
default:
return 0;
}
}
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#ifndef cnv_xtthelptopdf_h
#define cnv_xtthelptopdf_h
#include "cnv_xtthelpto.h"
#include "cnv_topdf.h"
class CnvCtx;
typedef enum {
pdf_mStatus_xtthelp = 1 << 0,
pdf_mStatus_paragraph = 1 << 1,
pdf_mStatus_table = 1 << 2,
pdf_mStatus_topic = 1 << 3
} pdf_mStatus;
typedef enum { pdf_mOption_printDisable = 1 << 0 } pdf_mOption;
class CnvXtthelpToPdf : public CnvXtthelpTo {
public:
CnvXtthelpToPdf(CnvCtx* cnv_ctx)
: ctx(cnv_ctx), base_ci(0), first_topic(1), user_style(0), status(0),
conf_pass(false), option(0)
{
strcpy(current_subject, "");
}
virtual ~CnvXtthelpToPdf();
Cnv_eXtthelpToType type()
{
return Cnv_eXtthelpToType_Ps;
}
void* insert(navh_eItemType item_type, const char* text1, const char* text2,
const char* text3, const char* link, const char* link_bookmark,
const char* file_name, navh_eHelpFile file_type, int help_index,
const char* bookmark, int coding);
void subject_to_fname(char* fname, const char* subject, int path);
bool confpass()
{
return true;
}
void set_confpass(bool conf)
{
topdf.set_confpass(conf);
conf_pass = conf;
if (!conf) {
// Reset
base_ci = 0;
user_style = 0;
first_topic = 1;
status = 0;
}
}
CnvCtx* ctx;
CnvToPdf topdf;
int base_ci;
int first_topic;
int first_chaptertopic;
int user_style;
unsigned int status;
bool conf_pass;
char current_subject[80];
unsigned int option;
};
#endif
...@@ -63,7 +63,11 @@ void CnvXtthelpToPs::subject_to_fname( ...@@ -63,7 +63,11 @@ void CnvXtthelpToPs::subject_to_fname(
strcat(fname, ctx->rx->name); strcat(fname, ctx->rx->name);
} else } else
strcpy(fname, ctx->rx->name); strcpy(fname, ctx->rx->name);
strcat(fname, ".ps"); if (ctx->generate_pdf) {
strcat(fname, ".pdf");
} else {
strcat(fname, ".ps");
}
} }
CnvXtthelpToPs::~CnvXtthelpToPs() CnvXtthelpToPs::~CnvXtthelpToPs()
...@@ -73,14 +77,19 @@ CnvXtthelpToPs::~CnvXtthelpToPs() ...@@ -73,14 +77,19 @@ CnvXtthelpToPs::~CnvXtthelpToPs()
status &= ~ps_mStatus_xtthelp; status &= ~ps_mStatus_xtthelp;
} }
} }
tops.close(); tops->close();
delete tops;
} }
void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1, void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
const char* text2, const char* text3, const char* link, const char* text2, const char* text3, const char* alink,
const char* link_bookmark, const char* file_name, navh_eHelpFile file_type, const char* link_bookmark, const char* file_name, navh_eHelpFile file_type,
int help_index, const char* bookmark, int coding) int help_index, const char* bookmark, int coding)
{ {
char link[80];
if (alink)
strcpy(link, alink);
if (option & ps_mOption_printDisable && item_type != navh_eItemType_Option) if (option & ps_mOption_printDisable && item_type != navh_eItemType_Option)
return NULL; return NULL;
...@@ -104,33 +113,40 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1, ...@@ -104,33 +113,40 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
strcpy(current_subject, text1); strcpy(current_subject, text1);
if (item_type == navh_eItemType_DocTitlePage) { if (item_type == navh_eItemType_DocTitlePage) {
tops.set_cf(ps_eFile_Info); tops->set_cf(ps_eFile_Info);
tops.set_ci(ps_eId_TitlePage); tops->set_ci(ps_eId_TitlePage);
} else if (item_type == navh_eItemType_DocInfoPage) { } else if (item_type == navh_eItemType_DocInfoPage) {
tops.set_cf(ps_eFile_Info); tops->set_cf(ps_eFile_Info);
tops.set_ci(ps_eId_InfoPage); tops->set_ci(ps_eId_InfoPage);
tops.print_pagebreak(0); tops->print_pagebreak(0);
} else { } else {
if (tops.ci == ps_eId_Chapter) { if (tops->ci == ps_eId_Chapter) {
if (!first_chaptertopic) if (!first_chaptertopic)
tops.set_ci(ps_eId_TopicL1); tops->set_ci(ps_eId_TopicL1);
else else {
first_chaptertopic = 0; first_chaptertopic = 0;
} else if (ctx->generate_pdf) tops->y = ps_cPageHeight - ps_cTopMargin;
tops.set_ci(ps_eId_TopicL1); }
} else {
if (!ctx->generate_pdf) tops->set_ci(ps_eId_TopicL1);
}
if (tops.cf == ps_eFile_Info) if (!ctx->generate_pdf && tops->cf == ps_eFile_Info)
tops.y = ps_cPageHeight - ps_cTopMargin; tops->y = ps_cPageHeight - ps_cTopMargin;
tops.set_cf(ps_eFile_Body); tops->set_cf(ps_eFile_Body);
} }
if (first_topic) { if (first_topic) {
pwr_tFileName fname; pwr_tFileName fname;
subject_to_fname(fname, text1, 1); subject_to_fname(fname, text1, 1);
tops.set_filename(ps_eFile_Info, fname); if (ctx->generate_pdf) {
tops.set_filename(ps_eFile_Body, ps_cTmpFile); tops->set_filename(ps_eFile_Body, fname);
tops.open(); } else {
tops->set_filename(ps_eFile_Info, fname);
tops->set_filename(ps_eFile_Body, ps_cTmpFile);
}
tops->open();
status |= ps_mStatus_xtthelp; status |= ps_mStatus_xtthelp;
first_topic = 0; first_topic = 0;
...@@ -147,18 +163,18 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1, ...@@ -147,18 +163,18 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
status &= ~ps_mStatus_topic; status &= ~ps_mStatus_topic;
if (user_style) { if (user_style) {
user_style = 0; user_style = 0;
tops.set_ci(base_ci); tops->set_ci(base_ci);
} }
return NULL; return NULL;
} }
case navh_eItemType_Style: { case navh_eItemType_Style: {
if (str_NoCaseStrcmp(text1, "function") == 0) { if (str_NoCaseStrcmp(text1, "function") == 0) {
base_ci = tops.ci; base_ci = tops->ci;
tops.set_ci(ps_eId_Function); tops->set_ci(ps_eId_Function);
user_style = 1; user_style = 1;
} else if (str_NoCaseStrcmp(text1, "report") == 0) { } else if (str_NoCaseStrcmp(text1, "report") == 0) {
base_ci = tops.ci; base_ci = tops->ci;
tops.set_ci(ps_eId_Report); tops->set_ci(ps_eId_Report);
} }
return NULL; return NULL;
} }
...@@ -170,7 +186,7 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1, ...@@ -170,7 +186,7 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
if (status & ps_mStatus_topic) if (status & ps_mStatus_topic)
status &= ~ps_mStatus_topic; status &= ~ps_mStatus_topic;
tops.set_ci(ps_eId_TopicL1); tops->set_ci(ps_eId_TopicL1);
user_style = 0; user_style = 0;
return NULL; return NULL;
} }
...@@ -182,31 +198,31 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1, ...@@ -182,31 +198,31 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
if (status & ps_mStatus_topic) if (status & ps_mStatus_topic)
status &= ~ps_mStatus_topic; status &= ~ps_mStatus_topic;
tops.set_ci(ps_eId_Chapter); tops->set_ci(ps_eId_Chapter);
first_chaptertopic = 1; first_chaptertopic = 1;
user_style = 0; user_style = 0;
tops.reset_headernumbers(1); tops->reset_headernumbers(1);
return NULL; return NULL;
} }
case navh_eItemType_HeaderLevel: { case navh_eItemType_HeaderLevel: {
if (user_style) { if (user_style) {
user_style = 0; user_style = 0;
tops.set_ci(base_ci); tops->set_ci(base_ci);
} }
tops.incr_headerlevel(); tops->incr_headerlevel();
return NULL; return NULL;
} }
case navh_eItemType_EndHeaderLevel: { case navh_eItemType_EndHeaderLevel: {
if (user_style) { if (user_style) {
user_style = 0; user_style = 0;
tops.set_ci(base_ci); tops->set_ci(base_ci);
} }
tops.decr_headerlevel(); tops->decr_headerlevel();
return NULL; return NULL;
} }
case navh_eItemType_PageBreak: { case navh_eItemType_PageBreak: {
tops.print_pagebreak(1); tops->print_pagebreak(1);
return NULL; return NULL;
} }
case navh_eItemType_Help: case navh_eItemType_Help:
...@@ -215,31 +231,34 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1, ...@@ -215,31 +231,34 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
int printmode; int printmode;
CnvStyle* hstyle = NULL; CnvStyle* hstyle = NULL;
// Unable to calculate lenght because link i not known in confpass
if (ctx->generate_pdf) strcpy(link, "");
if (item_type == navh_eItemType_Help) if (item_type == navh_eItemType_Help)
hstyle = &tops.style[tops.ci].text; hstyle = &tops->style[tops->ci].text;
else if (item_type == navh_eItemType_HelpBold) else if (item_type == navh_eItemType_HelpBold)
hstyle = &tops.style[tops.ci].boldtext; hstyle = &tops->style[tops->ci].boldtext;
else if (item_type == navh_eItemType_HelpCode) else if (item_type == navh_eItemType_HelpCode)
hstyle = &tops.style[tops.ci].code; hstyle = &tops->style[tops->ci].code;
if (!streq(link, "")) if (!streq(link, ""))
printmode = ps_mPrintMode_Start; printmode = ps_mPrintMode_Start;
else else
printmode = ps_mPrintMode_Pos; printmode = ps_mPrintMode_Pos;
if (!(status & ps_mStatus_table)) { if (!(status & ps_mStatus_table)) {
tops.x = ps_cLeftMargin; tops->x = ps_cLeftMargin;
tops.print_text(text1, *hstyle, printmode); tops->print_text(text1, *hstyle, printmode);
} else { } else {
tops.x = ps_cLeftMargin; tops->x = ps_cLeftMargin;
tops.print_text(text1, *hstyle); tops->print_text(text1, *hstyle);
if (text2 && !streq(text2, "")) { if (text2 && !streq(text2, "")) {
tops.x = ps_cLeftMargin + ps_cCellSize; tops->x = ps_cLeftMargin + ps_cCellSize;
tops.print_text( tops->print_text(
text2, *hstyle, ps_mPrintMode_KeepY | ps_mPrintMode_FixX); text2, *hstyle, ps_mPrintMode_KeepY | ps_mPrintMode_FixX);
} }
if (text3 && !streq(text3, "")) { if (text3 && !streq(text3, "")) {
tops.x = ps_cLeftMargin + 2 * ps_cCellSize; tops->x = ps_cLeftMargin + 2 * ps_cCellSize;
tops.print_text( tops->print_text(
text3, *hstyle, ps_mPrintMode_KeepY | ps_mPrintMode_FixX); text3, *hstyle, ps_mPrintMode_KeepY | ps_mPrintMode_FixX);
} }
} }
...@@ -255,46 +274,48 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1, ...@@ -255,46 +274,48 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
strcpy(fname, &link[5]); strcpy(fname, &link[5]);
sprintf(str, " (%s %s)", Lng::translate("See"), fname); sprintf(str, " (%s %s)", Lng::translate("See"), fname);
if (!(status & ps_mStatus_table)) if (!(status & ps_mStatus_table))
tops.print_text(str, tops.style[tops.ci].link, tops->print_text(str, tops->style[tops->ci].link,
ps_mPrintMode_End | ps_mPrintMode_FixX); ps_mPrintMode_End | ps_mPrintMode_FixX);
else { else {
tops.x = ps_cLeftMargin + 3 * ps_cCellSize; tops->x = ps_cLeftMargin + 3 * ps_cCellSize;
if (ps_cLeftMargin + 2 * ps_cCellSize if (ps_cLeftMargin + 2 * ps_cCellSize
+ strlen(text3) * hstyle->font_size * 0.65 + strlen(text3) * hstyle->font_size * 0.65
> tops.x) > tops->x)
tops.x = ps_cLeftMargin + 2 * ps_cCellSize tops->x = ps_cLeftMargin + 2 * ps_cCellSize
+ strlen(text3) * hstyle->font_size * 0.65; + strlen(text3) * hstyle->font_size * 0.65;
tops.print_text(str, tops.style[tops.ci].link, tops->print_text(str, tops->style[tops->ci].link,
ps_mPrintMode_End | ps_mPrintMode_FixX); ps_mPrintMode_End | ps_mPrintMode_FixX);
} }
} else if ((strstr(link, ".htm") != 0) || (strstr(link, ".pdf") != 0)) { } else if ((strstr(link, ".htm") != 0) || (strstr(link, ".pdf") != 0)) {
strcpy(fname, link); strcpy(fname, link);
sprintf(str, " (%s %s)", Lng::translate("See"), fname); sprintf(str, " (%s %s)", Lng::translate("See"), fname);
if (!(status & ps_mStatus_table)) if (!(status & ps_mStatus_table))
tops.print_text(str, tops.style[tops.ci].link, tops->print_text(str, tops->style[tops->ci].link,
ps_mPrintMode_End | ps_mPrintMode_FixX); ps_mPrintMode_End | ps_mPrintMode_FixX);
else { else {
tops.x = ps_cLeftMargin + 3 * ps_cCellSize; tops->x = ps_cLeftMargin + 3 * ps_cCellSize;
if (ps_cLeftMargin + 2 * ps_cCellSize if (ps_cLeftMargin + 2 * ps_cCellSize
+ strlen(text3) * hstyle->font_size * 0.65 + strlen(text3) * hstyle->font_size * 0.65
> tops.x) > tops->x)
tops.x = ps_cLeftMargin + 2 * ps_cCellSize tops->x = ps_cLeftMargin + 2 * ps_cCellSize
+ strlen(text3) * hstyle->font_size * 0.65; + strlen(text3) * hstyle->font_size * 0.65;
tops.print_text(str, tops.style[tops.ci].link, tops->print_text(str, tops->style[tops->ci].link,
ps_mPrintMode_End | ps_mPrintMode_FixX); ps_mPrintMode_End | ps_mPrintMode_FixX);
} }
} else { } else {
char text[80]; char text[80];
int sts = tops.content.find_link(link, text, &page); int sts = tops->content.find_link(link, text, &page);
if (ODD(sts)) { if (ODD(sts)) {
sprintf(str, " (%s %s ", Lng::translate("See"), text); sprintf(str, " (%s %s ", Lng::translate("See"), text);
sprintf(&str[strlen(str)], "%s %d)", Lng::translate("page"), page); sprintf(&str[strlen(str)], "%s %d)", Lng::translate("page"), page);
if (!(status & ps_mStatus_table)) if (!(status & ps_mStatus_table))
tops.print_text(str, tops.style[tops.ci].link, tops->print_text(str, tops->style[tops->ci].link,
ps_mPrintMode_End | ps_mPrintMode_FixX); ps_mPrintMode_End | ps_mPrintMode_FixX);
else { else {
} }
} } else if (ctx->generate_pdf && !(status & ps_mStatus_table))
tops->print_text("", tops->style[tops->ci].link,
ps_mPrintMode_End | ps_mPrintMode_FixX);
} }
} else if (bookmark) { } else if (bookmark) {
// fp[cf] << tags[ps_eTag_link].start << " name=\"" << bookmark << "\">"; // fp[cf] << tags[ps_eTag_link].start << " name=\"" << bookmark << "\">";
...@@ -306,26 +327,26 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1, ...@@ -306,26 +327,26 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
int hlevel; int hlevel;
if (!user_style) if (!user_style)
hlevel = tops.ci - (int)ps_eId_Chapter; hlevel = tops->ci - (int)ps_eId_Chapter;
else else
hlevel = base_ci - (int)ps_eId_Chapter; hlevel = base_ci - (int)ps_eId_Chapter;
tops.print_h1(text1, hlevel, current_subject); tops->print_h1(text1, hlevel, current_subject);
return NULL; return NULL;
} }
case navh_eItemType_Header: { case navh_eItemType_Header: {
tops.print_h3(text1); tops->print_h3(text1);
return NULL; return NULL;
} }
case navh_eItemType_HeaderLarge: { case navh_eItemType_HeaderLarge: {
tops.print_h2(text1); tops->print_h2(text1);
return NULL; return NULL;
} }
case navh_eItemType_HorizontalLine: { case navh_eItemType_HorizontalLine: {
tops.print_horizontal_line(); tops->print_horizontal_line();
return NULL; return NULL;
} }
case navh_eItemType_Image: { case navh_eItemType_Image: {
int sts = tops.print_image(text1); int sts = tops->print_image(text1);
if (EVEN(sts)) if (EVEN(sts))
printf("Image: %s not found\n", text1); printf("Image: %s not found\n", text1);
return NULL; return NULL;
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#define cnv_xtthelptops_h #define cnv_xtthelptops_h
#include "cnv_xtthelpto.h" #include "cnv_xtthelpto.h"
#include "cnv_topdf.h"
#include "cnv_tops.h" #include "cnv_tops.h"
class CnvCtx; class CnvCtx;
...@@ -58,6 +59,11 @@ class CnvXtthelpToPs : public CnvXtthelpTo { ...@@ -58,6 +59,11 @@ class CnvXtthelpToPs : public CnvXtthelpTo {
conf_pass(false), option(0) conf_pass(false), option(0)
{ {
strcpy(current_subject, ""); strcpy(current_subject, "");
if (ctx->generate_pdf) {
tops = new CnvToPdf();
} else {
tops = new CnvToPs();
}
} }
virtual ~CnvXtthelpToPs(); virtual ~CnvXtthelpToPs();
...@@ -69,14 +75,14 @@ class CnvXtthelpToPs : public CnvXtthelpTo { ...@@ -69,14 +75,14 @@ class CnvXtthelpToPs : public CnvXtthelpTo {
const char* text3, const char* link, const char* link_bookmark, const char* text3, const char* link, const char* link_bookmark,
const char* file_name, navh_eHelpFile file_type, int help_index, const char* file_name, navh_eHelpFile file_type, int help_index,
const char* bookmark, int coding); const char* bookmark, int coding);
void subject_to_fname(char* fname, const char* subject, int path); virtual void subject_to_fname(char* fname, const char* subject, int path);
bool confpass() bool confpass()
{ {
return true; return true;
} }
void set_confpass(bool conf) void set_confpass(bool conf)
{ {
tops.set_confpass(conf); tops->set_confpass(conf);
conf_pass = conf; conf_pass = conf;
if (!conf) { if (!conf) {
// Reset // Reset
...@@ -88,7 +94,7 @@ class CnvXtthelpToPs : public CnvXtthelpTo { ...@@ -88,7 +94,7 @@ class CnvXtthelpToPs : public CnvXtthelpTo {
} }
CnvCtx* ctx; CnvCtx* ctx;
CnvToPs tops; CnvToPs *tops;
int base_ci; int base_ci;
int first_topic; int first_topic;
int first_chaptertopic; int first_chaptertopic;
......
...@@ -49,7 +49,6 @@ extern "C" { ...@@ -49,7 +49,6 @@ extern "C" {
#include "cnv_xtthelptohtml.h" #include "cnv_xtthelptohtml.h"
#include "cnv_xtthelptoxml.h" #include "cnv_xtthelptoxml.h"
#include "cnv_xtthelptops.h" #include "cnv_xtthelptops.h"
#include "cnv_xtthelptopdf.h"
#include "cnv_xtthelptotext.h" #include "cnv_xtthelptotext.h"
#include "cnv_pwgtoxtthelp.h" #include "cnv_pwgtoxtthelp.h"
#include "cnv_classdep.h" #include "cnv_classdep.h"
...@@ -108,7 +107,6 @@ int main(int argc, char* argv[]) ...@@ -108,7 +107,6 @@ int main(int argc, char* argv[])
int xtthelp_to_html = 0; int xtthelp_to_html = 0;
int xtthelp_to_xml = 0; int xtthelp_to_xml = 0;
int xtthelp_to_ps = 0; int xtthelp_to_ps = 0;
int xtthelp_to_pdf = 0;
int xtthelp_to_text = 0; int xtthelp_to_text = 0;
int pwg_to_xtthelp = 0; int pwg_to_xtthelp = 0;
int changelog = 0; int changelog = 0;
...@@ -177,6 +175,10 @@ int main(int argc, char* argv[]) ...@@ -177,6 +175,10 @@ int main(int argc, char* argv[])
ctx->generate_ps = 1; ctx->generate_ps = 1;
ctx->common_structfile_only = 1; ctx->common_structfile_only = 1;
break; break;
case 'Q':
ctx->generate_pdf = 1;
ctx->common_structfile_only = 1;
break;
case 'p': case 'p':
ctx->generate_struct = 1; ctx->generate_struct = 1;
ctx->hpp = 1; ctx->hpp = 1;
...@@ -198,9 +200,11 @@ int main(int argc, char* argv[]) ...@@ -198,9 +200,11 @@ int main(int argc, char* argv[])
break; break;
case 'n': case 'n':
xtthelp_to_ps = 1; xtthelp_to_ps = 1;
ctx->generate_ps = 1;
break; break;
case 'f': case 'f':
xtthelp_to_pdf = 1; xtthelp_to_ps = 1;
ctx->generate_pdf = 1;
break; break;
case 'j': case 'j':
xtthelp_to_text = 1; xtthelp_to_text = 1;
...@@ -272,14 +276,6 @@ int main(int argc, char* argv[]) ...@@ -272,14 +276,6 @@ int main(int argc, char* argv[])
delete xtthelpto; delete xtthelpto;
exit(0); exit(0);
} }
if (xtthelp_to_pdf) {
CnvXtthelpToPdf* xtthelpto = new CnvXtthelpToPdf(ctx);
ctx->rx = new CnvReadXtthelp(files, ctx->dir, xtthelpto);
ctx->rx->read_xtthelp();
delete ctx->rx;
delete xtthelpto;
exit(0);
}
if (xtthelp_to_text) { if (xtthelp_to_text) {
CnvXtthelpToText* xtthelpto = new CnvXtthelpToText(ctx); CnvXtthelpToText* xtthelpto = new CnvXtthelpToText(ctx);
ctx->rx = new CnvReadXtthelp(files, ctx->dir, xtthelpto); ctx->rx = new CnvReadXtthelp(files, ctx->dir, xtthelpto);
...@@ -341,7 +337,7 @@ int main(int argc, char* argv[]) ...@@ -341,7 +337,7 @@ int main(int argc, char* argv[])
ctx->wblto = new CnvWblToH(ctx); ctx->wblto = new CnvWblToH(ctx);
else if (ctx->generate_xtthelp) else if (ctx->generate_xtthelp)
ctx->wblto = new CnvWblToXtthelp(ctx); ctx->wblto = new CnvWblToXtthelp(ctx);
else if (ctx->generate_ps) else if (ctx->generate_ps || ctx->generate_pdf)
ctx->wblto = new CnvWblToPs(ctx); ctx->wblto = new CnvWblToPs(ctx);
ctx->rw = new CnvReadWbl(ctx, ctx->wblto); ctx->rw = new CnvReadWbl(ctx, ctx->wblto);
......
...@@ -72,6 +72,8 @@ export_wbl_html_en_us := $(patsubst %.wb_load,$(doc_dir)/en_us/orm/%_allclasses. ...@@ -72,6 +72,8 @@ export_wbl_html_en_us := $(patsubst %.wb_load,$(doc_dir)/en_us/orm/%_allclasses.
export_wbl_html_sv_se := $(patsubst %.wb_load,$(doc_dir)/sv_se/orm/%_allclasses.html,$(wbl_sources)) export_wbl_html_sv_se := $(patsubst %.wb_load,$(doc_dir)/sv_se/orm/%_allclasses.html,$(wbl_sources))
export_wbl_ps_en_us := $(patsubst %.wb_load,$(doc_dir)/en_us/%.ps,$(wbl_sources)) export_wbl_ps_en_us := $(patsubst %.wb_load,$(doc_dir)/en_us/%.ps,$(wbl_sources))
export_wbl_ps_sv_se := $(patsubst %.wb_load,$(doc_dir)/sv_se/%.ps,$(wbl_sources)) export_wbl_ps_sv_se := $(patsubst %.wb_load,$(doc_dir)/sv_se/%.ps,$(wbl_sources))
export_wbl_pdf_en_us := $(patsubst %.wb_load,$(doc_dir)/en_us/%.pdf,$(wbl_sources))
export_wbl_pdf_sv_se := $(patsubst %.wb_load,$(doc_dir)/sv_se/%.pdf,$(wbl_sources))
bld_dir := $(addprefix $(release_root)/bld/$(type_name)/, $(patsubst %.wb_load,%,$(wbl_sources))) bld_dir := $(addprefix $(release_root)/bld/$(type_name)/, $(patsubst %.wb_load,%,$(wbl_sources)))
dbs_dependencies := $(bld_dir)/mcomp.d_wbl dbs_dependencies := $(bld_dir)/mcomp.d_wbl
...@@ -134,6 +136,14 @@ $(doc_dir)/sv_se/%.ps : ../../%.wb_load ...@@ -134,6 +136,14 @@ $(doc_dir)/sv_se/%.ps : ../../%.wb_load
@ echo "Generating postscript file for $(source) classes sv_se..." @ echo "Generating postscript file for $(source) classes sv_se..."
@ $(co_convert) -q -l sv_se -d $(doc_dir)/sv_se "$(source)" @ $(co_convert) -q -l sv_se -d $(doc_dir)/sv_se "$(source)"
$(doc_dir)/en_us/%.pdf : ../../%.wb_load
@ echo "Generating pdf file for $(source) classes en_us..."
@ $(co_convert) -Q -l en_us -d $(doc_dir)/en_us "$(source)"
$(doc_dir)/sv_se/%.pdf : ../../%.wb_load
@ echo "Generating pdf file for $(source) classes sv_se..."
@ $(co_convert) -Q -l sv_se -d $(doc_dir)/sv_se "$(source)"
$(exe_dir)/en_us/%_xtthelp.dat : ../../%.wb_load $(exe_dir)/en_us/%_xtthelp.dat : ../../%.wb_load
@ echo "Generating xtt help files for $(source) classes en_us" @ echo "Generating xtt help files for $(source) classes en_us"
@ $(co_convert) -x -d $(exe_dir)/en_us "$(source)" @ $(co_convert) -x -d $(exe_dir)/en_us "$(source)"
...@@ -176,6 +186,8 @@ exe: $(export_wbl_xtthelp_en_us) \ ...@@ -176,6 +186,8 @@ exe: $(export_wbl_xtthelp_en_us) \
$(export_wbl_html_sv_se) \ $(export_wbl_html_sv_se) \
$(export_wbl_ps_en_us) \ $(export_wbl_ps_en_us) \
$(export_wbl_ps_sv_se) \ $(export_wbl_ps_sv_se) \
$(export_wbl_pdf_en_us) \
$(export_wbl_pdf_sv_se) \
$(export_pdf_en_us) \ $(export_pdf_en_us) \
$(export_pdf_sv_se) \ $(export_pdf_sv_se) \
| silent | silent
......
...@@ -54,6 +54,8 @@ exe : $(doc_dir)/en_us/orm/pwrb_allclasses.html \ ...@@ -54,6 +54,8 @@ exe : $(doc_dir)/en_us/orm/pwrb_allclasses.html \
$(doc_dir)/sv_se/orm/rt_csup_c.html \ $(doc_dir)/sv_se/orm/rt_csup_c.html \
$(doc_dir)/en_us/pwrb.ps \ $(doc_dir)/en_us/pwrb.ps \
$(doc_dir)/sv_se/pwrb.ps \ $(doc_dir)/sv_se/pwrb.ps \
$(doc_dir)/en_us/pwrb.pdf \
$(doc_dir)/sv_se/pwrb.pdf \
$(exe_dir)/en_us/pwrb_xtthelp.dat \ $(exe_dir)/en_us/pwrb_xtthelp.dat \
$(exe_dir)/sv_se/pwrb_xtthelp.dat \ $(exe_dir)/sv_se/pwrb_xtthelp.dat \
| silent | silent
...@@ -144,6 +146,14 @@ $(doc_dir)/sv_se/pwrb.ps : ...@@ -144,6 +146,14 @@ $(doc_dir)/sv_se/pwrb.ps :
@ echo "Generating postscript file for pwrb classes..." @ echo "Generating postscript file for pwrb classes..."
@ $(co_convert) -q -l sv_se -d $(doc_dir)/sv_se "$(pwre_sroot)/wbl/pwrb/src/pwrb_*.wb_load" @ $(co_convert) -q -l sv_se -d $(doc_dir)/sv_se "$(pwre_sroot)/wbl/pwrb/src/pwrb_*.wb_load"
$(doc_dir)/en_us/pwrb.pdf :
@ echo "Generating pdf file for pwrb classes..."
@ $(co_convert) -Q -d $(doc_dir)/en_us "$(pwre_sroot)/wbl/pwrb/src/pwrb_*.wb_load"
$(doc_dir)/sv_se/pwrb.pdf :
@ echo "Generating pdf file for pwrb classes..."
@ $(co_convert) -Q -l sv_se -d $(doc_dir)/sv_se "$(pwre_sroot)/wbl/pwrb/src/pwrb_*.wb_load"
$(exe_dir)/en_us/pwrb_xtthelp.dat : $(exe_dir)/en_us/pwrb_xtthelp.dat :
@ echo "Generating xtt help files for pwrb classes en_us" @ echo "Generating xtt help files for pwrb classes en_us"
@ $(co_convert) -x -d $(exe_dir)/en_us -y $(bld_dir)/pwrb.d_en_us_xtthelp_wbl "$(pwre_sroot)/wbl/pwrb/src/pwrb_c_*.wb_load" @ $(co_convert) -x -d $(exe_dir)/en_us -y $(bld_dir)/pwrb.d_en_us_xtthelp_wbl "$(pwre_sroot)/wbl/pwrb/src/pwrb_c_*.wb_load"
......
...@@ -46,6 +46,8 @@ exe : $(doc_dir)/en_us/orm/pwrs_allclasses.html \ ...@@ -46,6 +46,8 @@ exe : $(doc_dir)/en_us/orm/pwrs_allclasses.html \
$(doc_dir)/sv_se/orm/pwr_class_h.html \ $(doc_dir)/sv_se/orm/pwr_class_h.html \
$(doc_dir)/en_us/pwrs.ps \ $(doc_dir)/en_us/pwrs.ps \
$(doc_dir)/sv_se/pwrs.ps \ $(doc_dir)/sv_se/pwrs.ps \
$(doc_dir)/en_us/pwrs.pdf \
$(doc_dir)/sv_se/pwrs.pdf \
$(exe_dir)/en_us/pwrs_xtthelp.dat \ $(exe_dir)/en_us/pwrs_xtthelp.dat \
$(exe_dir)/sv_se/pwrs_xtthelp.dat \ $(exe_dir)/sv_se/pwrs_xtthelp.dat \
| silent | silent
...@@ -112,6 +114,14 @@ $(doc_dir)/sv_se/pwrs.ps : ...@@ -112,6 +114,14 @@ $(doc_dir)/sv_se/pwrs.ps :
@ echo "Generating postscript file for pwrs classes..." @ echo "Generating postscript file for pwrs classes..."
@ $(co_convert) -q -l sv_se -d $(doc_dir)/sv_se "$(pwre_sroot)/wbl/pwrs/src/pwrs_*.wb_load" @ $(co_convert) -q -l sv_se -d $(doc_dir)/sv_se "$(pwre_sroot)/wbl/pwrs/src/pwrs_*.wb_load"
$(doc_dir)/en_us/pwrs.pdf :
@ echo "Generating pdf file for pwrs classes..."
@ $(co_convert) -Q -d $(doc_dir)/en_us "$(pwre_sroot)/wbl/pwrs/src/pwrs_*.wb_load"
$(doc_dir)/sv_se/pwrs.pdf :
@ echo "Generating pdf file for pwrs classes..."
@ $(co_convert) -Q -l sv_se -d $(doc_dir)/sv_se "$(pwre_sroot)/wbl/pwrs/src/pwrs_*.wb_load"
$(exe_dir)/en_us/pwrs_xtthelp.dat : $(exe_dir)/en_us/pwrs_xtthelp.dat :
@ echo "Generating xtt help files for pwrs classes en_us" @ echo "Generating xtt help files for pwrs classes en_us"
@ $(co_convert) -x -d $(exe_dir)/en_us -y $(bld_dir)/pwrs.d_en_us_xtthelp_wbl "$(pwre_sroot)/wbl/pwrs/src/pwrs_*.wb_load" @ $(co_convert) -x -d $(exe_dir)/en_us -y $(bld_dir)/pwrs.d_en_us_xtthelp_wbl "$(pwre_sroot)/wbl/pwrs/src/pwrs_*.wb_load"
......
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