Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
cf62149e
Commit
cf62149e
authored
Sep 10, 2018
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate documentation pdf files by default in addition to postscript.
parent
cb2469f5
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
324 additions
and
950 deletions
+324
-950
src/exe/co_convert/src/cnv_ctx.cpp
src/exe/co_convert/src/cnv_ctx.cpp
+1
-1
src/exe/co_convert/src/cnv_ctx.h
src/exe/co_convert/src/cnv_ctx.h
+1
-0
src/exe/co_convert/src/cnv_topdf.cpp
src/exe/co_convert/src/cnv_topdf.cpp
+50
-174
src/exe/co_convert/src/cnv_topdf.h
src/exe/co_convert/src/cnv_topdf.h
+9
-132
src/exe/co_convert/src/cnv_tops.h
src/exe/co_convert/src/cnv_tops.h
+10
-10
src/exe/co_convert/src/cnv_wbltops.cpp
src/exe/co_convert/src/cnv_wbltops.cpp
+113
-104
src/exe/co_convert/src/cnv_wbltops.h
src/exe/co_convert/src/cnv_wbltops.h
+8
-2
src/exe/co_convert/src/cnv_xtthelptopdf.cpp
src/exe/co_convert/src/cnv_xtthelptopdf.cpp
+0
-348
src/exe/co_convert/src/cnv_xtthelptopdf.h
src/exe/co_convert/src/cnv_xtthelptopdf.h
+0
-102
src/exe/co_convert/src/cnv_xtthelptops.cpp
src/exe/co_convert/src/cnv_xtthelptops.cpp
+83
-62
src/exe/co_convert/src/cnv_xtthelptops.h
src/exe/co_convert/src/cnv_xtthelptops.h
+9
-3
src/exe/co_convert/src/co_convert.cpp
src/exe/co_convert/src/co_convert.cpp
+8
-12
src/tools/bld/src/os_linux/wbl_generic.mk
src/tools/bld/src/os_linux/wbl_generic.mk
+12
-0
src/wbl/pwrb/src/os_templ/hw_templ/makefile
src/wbl/pwrb/src/os_templ/hw_templ/makefile
+10
-0
src/wbl/pwrs/src/os_templ/hw_templ/makefile
src/wbl/pwrs/src/os_templ/hw_templ/makefile
+10
-0
No files found.
src/exe/co_convert/src/cnv_ctx.cpp
View file @
cf62149e
...
...
@@ -46,7 +46,7 @@ extern "C" {
#include "cnv_ctx.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
(
setup_filename
,
""
);
...
...
src/exe/co_convert/src/cnv_ctx.h
View file @
cf62149e
...
...
@@ -60,6 +60,7 @@ class CnvCtx {
int
generate_src
;
int
generate_struct
;
int
generate_ps
;
int
generate_pdf
;
int
generate_cdp
;
int
common_structfile_only
;
int
hpp
;
...
...
src/exe/co_convert/src/cnv_topdf.cpp
View file @
cf62149e
...
...
@@ -103,8 +103,8 @@ void CnvPdfObj::print_begin()
<<
" << /Type /Page
\n
"
<<
" /Parent "
<<
topdf
->
v_outline
.
size
()
+
1
<<
" 0 R
\n
"
<<
" /Mediabox [0 0 "
<<
p
df
_cPageWidth
<<
" "
<<
p
df
_cPageHeight
<<
"]
\n
"
<<
" /Mediabox [0 0 "
<<
p
s
_cPageWidth
<<
" "
<<
p
s
_cPageHeight
<<
"]
\n
"
<<
" /Contents "
<<
number
-
1
+
topdf
->
v_outline
.
size
()
+
topdf
->
v_pages
.
size
()
...
...
@@ -309,78 +309,48 @@ int CnvPdfObj::print_image()
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
)
{
char
str
[
1000
];
cnv_text
(
str
,
text
);
if
(
style
.
sidebreak
&&
mode
&
p
df
_mPrintMode_Pos
)
{
if
(
style
.
sidebreak
&&
mode
&
p
s
_mPrintMode_Pos
)
{
if
(
page_number
[
cf
]
==
0
)
{
// First header, no pagebreak
page_number
[
cf
]
=
1
;
}
else
{
print_pagebreak
(
0
);
}
}
else
if
(
style
.
pagebreak
&&
mode
&
p
df
_mPrintMode_Pos
)
{
}
else
if
(
style
.
pagebreak
&&
mode
&
p
s
_mPrintMode_Pos
)
{
print_pagebreak
(
0
);
}
if
(
mode
&
p
df_mPrintMode_Pos
||
mode
&
pdf
_mPrintMode_Start
)
{
if
(
mode
&
p
s_mPrintMode_Pos
||
mode
&
ps
_mPrintMode_Start
)
{
y
-=
style
.
top_offset
;
if
(
y
-
style
.
bottom_offset
<
p
df
_cBottomMargin
)
{
if
(
y
-
style
.
bottom_offset
<
p
s
_cBottomMargin
)
{
print_pagebreak
(
0
);
}
}
else
y
+=
style
.
bottom_offset
;
if
(
!
(
mode
&
p
df
_mPrintMode_FixX
))
{
if
(
!
(
mode
&
p
s
_mPrintMode_FixX
))
{
if
(
style
.
alignment
==
cnv_eAlignment_Center
)
{
x
=
p
df_cLeftMargin
/
2
+
(
pdf_cPageWidth
-
pdf
_cLeftMargin
/
2
)
/
2
x
=
p
s_cLeftMargin
/
2
+
(
ps_cPageWidth
-
ps
_cLeftMargin
/
2
)
/
2
-
0.50
*
strlen
(
text
)
*
style
.
font_size
/
2
;
if
(
x
<
p
df
_cLeftMargin
/
2
)
x
=
p
df
_cLeftMargin
/
2
;
if
(
x
<
p
s
_cLeftMargin
/
2
)
x
=
p
s
_cLeftMargin
/
2
;
}
else
x
=
p
df
_cLeftMargin
+
style
.
indentation
;
x
=
p
s
_cLeftMargin
+
style
.
indentation
;
}
int
pmode
=
mode
&
31
;
if
(
!
streq
(
text
,
""
))
{
switch
(
pmode
)
{
case
p
df
_mPrintMode_Pos
:
case
p
df
_mPrintMode_KeepY
:
{
case
p
s
_mPrintMode_Pos
:
case
p
s
_mPrintMode_KeepY
:
{
// Full path with beginning and end
fp
[
cf
]
<<
" BT
\n
"
<<
" "
<<
fontname
(
style
)
<<
" "
<<
style
.
font_size
<<
" Tf
\n
"
...
...
@@ -389,7 +359,7 @@ void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode)
<<
" ET"
<<
'\n'
;
break
;
}
case
p
df
_mPrintMode_Start
:
{
case
p
s
_mPrintMode_Start
:
{
// Start new path
fp
[
cf
]
<<
" BT
\n
"
<<
" "
<<
fontname
(
style
)
<<
" "
<<
style
.
font_size
<<
" Tf
\n
"
...
...
@@ -397,14 +367,14 @@ void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode)
<<
" ("
<<
str
<<
") Tj
\n
"
;
break
;
}
case
p
df
_mPrintMode_Continue
:
{
case
p
s
_mPrintMode_Continue
:
{
// Continue current path
fp
[
cf
]
<<
" "
<<
fontname
(
style
)
<<
" "
<<
style
.
font_size
<<
" Tf
\n
"
<<
" "
<<
x
<<
" "
<<
y
<<
" Td
\n
"
<<
" ("
<<
str
<<
") Tj
\n
"
;
break
;
}
case
p
df
_mPrintMode_End
:
{
case
p
s
_mPrintMode_End
:
{
// Continue and close current path
fp
[
cf
]
<<
" "
<<
fontname
(
style
)
<<
" "
<<
style
.
font_size
<<
" Tf
\n
"
<<
" ("
<<
str
<<
") Tj
\n
"
...
...
@@ -415,13 +385,13 @@ void CnvToPdf::print_text(const char* text, CnvStyle& style, int mode)
}
}
else
{
switch
(
pmode
)
{
case
p
df
_mPrintMode_Start
:
{
case
p
s
_mPrintMode_Start
:
{
// Start new path
fp
[
cf
]
<<
" BT
\n
"
<<
" "
<<
x
<<
" "
<<
y
<<
" Td
\n
"
;
break
;
}
case
p
df
_mPrintMode_End
:
{
case
p
s
_mPrintMode_End
:
{
// Continue and close current path
fp
[
cf
]
<<
" ET"
<<
'\n'
;
break
;
...
...
@@ -523,32 +493,33 @@ void CnvToPdf::print_pagebreak(int last)
if
(
page_number
[
cf
]
!=
1
||
last
)
{
double
page_x
;
page_x
=
p
df
_cPageNumX
;
page_x
=
p
s
_cPageNumX
;
if
(
!
(
prev_ci
==
p
df_eId_TitlePage
||
prev_ci
==
pdf
_eId_InfoPage
))
{
if
(
!
(
prev_ci
==
p
s_eId_TitlePage
||
prev_ci
==
ps
_eId_InfoPage
))
{
prev_ci
=
ci
;
fp
[
cf
]
<<
" 1 w
\n
"
<<
" "
<<
10
<<
" "
<<
p
df
_cPageHeight
-
20
<<
" m
\n
"
<<
" "
<<
p
df_cPageWidth
+
65
<<
" "
<<
pdf
_cPageHeight
-
20
<<
" "
<<
10
<<
" "
<<
p
s
_cPageHeight
-
20
<<
" m
\n
"
<<
" "
<<
p
s_cPageWidth
+
65
<<
" "
<<
ps
_cPageHeight
-
20
<<
" l
\n
"
<<
" S
\n
"
<<
" BT
\n
"
<<
" /F1 10 Tf
\n
"
<<
" "
<<
p
df
_cPageWidth
/
2
-
10
*
0.5
*
strlen
(
previous_chapter
)
<<
" "
<<
p
df
_cPageNumY
<<
" Td
\n
"
<<
p
s
_cPageWidth
/
2
-
10
*
0.5
*
strlen
(
previous_chapter
)
<<
" "
<<
p
s
_cPageNumY
<<
" Td
\n
"
<<
" ("
<<
previous_chapter
<<
") Tj
\n
"
<<
" ET
\n
"
<<
" BT
\n
"
<<
" /F1 10 Tf
\n
"
<<
" "
<<
page_x
<<
" "
<<
p
df
_cPageNumY
<<
" Td
\n
"
<<
" "
<<
page_x
<<
" "
<<
p
s
_cPageNumY
<<
" Td
\n
"
<<
" ("
<<
page_number
[
cf
]
-
1
<<
") Tj
\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
();
}
}
if
(
last
)
...
...
@@ -567,7 +538,7 @@ void CnvToPdf::print_pagebreak(int last)
page_number
[
cf
]
++
;
y
=
p
df_cPageHeight
-
pdf
_cTopMargin
;
y
=
p
s_cPageHeight
-
ps
_cTopMargin
;
}
void
CnvToPdf
::
print_content
()
...
...
@@ -634,7 +605,7 @@ CnvToPdf::~CnvToPdf()
void
CnvToPdf
::
close
()
{
cf
=
p
df
_eFile_Body
;
cf
=
p
s
_eFile_Body
;
print_pagebreak
(
1
);
// print_content();
...
...
@@ -704,7 +675,7 @@ void CnvToPdf::close()
<<
xref_offset
-
start_offset
<<
'\n'
<<
"%%EOF
\n
"
;
fp
[
p
df
_eFile_Body
].
close
();
fp
[
p
s
_eFile_Body
].
close
();
}
static
void
image_pixel
(
void
*
userdata
,
std
::
ofstream
&
fp
,
unsigned
char
*
rgb
)
...
...
@@ -724,8 +695,8 @@ void CnvToPdf::print_horizontal_line()
{
y
-=
3
;
fp
[
cf
]
<<
" 1 w
\n
"
<<
" "
<<
p
df
_cLeftMargin
-
50
<<
" "
<<
y
<<
" m
\n
"
<<
" "
<<
p
df
_cPageWidth
<<
" "
<<
y
<<
" l
\n
"
<<
" "
<<
p
s
_cLeftMargin
-
50
<<
" "
<<
y
<<
" m
\n
"
<<
" "
<<
p
s
_cPageWidth
<<
" "
<<
y
<<
" l
\n
"
<<
" S
\n
"
;
y
-=
3
;
...
...
@@ -741,7 +712,7 @@ int CnvToPdf::print_image_inline(const char* filename)
double
scalex
=
0.71
;
double
scaley
=
0.78
;
x
=
p
df
_cLeftMargin
;
x
=
p
s
_cLeftMargin
;
// Try $pwr_doc/help/
strcpy
(
fname
,
"$pwr_doc/help/"
);
...
...
@@ -771,17 +742,17 @@ int CnvToPdf::print_image_inline(const char* filename)
width
=
cnv_image_width
(
image
);
height
=
cnv_image_height
(
image
);
if
(
width
*
scalex
>
p
df_cPageWidth
-
pdf
_cLeftMargin
)
{
x
=
p
df
_cPageWidth
-
width
*
scalex
;
if
(
width
*
scalex
>
p
s_cPageWidth
-
ps
_cLeftMargin
)
{
x
=
p
s
_cPageWidth
-
width
*
scalex
;
if
(
x
<
50
)
{
double
scale_factor
=
(
p
df
_cPageWidth
-
50
)
/
(
width
*
scalex
);
double
scale_factor
=
(
p
s
_cPageWidth
-
50
)
/
(
width
*
scalex
);
x
=
50
;
scalex
=
scalex
*
scale_factor
;
scaley
=
scaley
*
scale_factor
;
}
}
if
(
y
-
height
*
scaley
+
20
<
p
df
_cBottomMargin
)
if
(
y
-
height
*
scaley
+
20
<
p
s
_cBottomMargin
)
print_pagebreak
(
0
);
fp
[
cf
]
<<
" q
\n
"
...
...
@@ -820,7 +791,7 @@ int CnvToPdf::print_image(const char* filename)
double
scaley
=
0.78
;
im_cnt
++
;
x
=
p
df
_cLeftMargin
;
x
=
p
s
_cLeftMargin
;
if
(
strchr
(
filename
,
'/'
)
!=
0
)
dcli_translate_filename
(
fname
,
filename
);
...
...
@@ -853,17 +824,17 @@ int CnvToPdf::print_image(const char* filename)
width
=
cnv_image_width
(
image
);
height
=
cnv_image_height
(
image
);
if
(
width
*
scalex
>
p
df_cPageWidth
-
pdf
_cLeftMargin
)
{
x
=
p
df
_cPageWidth
-
width
*
scalex
;
if
(
width
*
scalex
>
p
s_cPageWidth
-
ps
_cLeftMargin
)
{
x
=
p
s
_cPageWidth
-
width
*
scalex
;
if
(
x
<
50
)
{
double
scale_factor
=
(
p
df
_cPageWidth
-
50
)
/
(
width
*
scalex
);
double
scale_factor
=
(
p
s
_cPageWidth
-
50
)
/
(
width
*
scalex
);
x
=
50
;
scalex
=
scalex
*
scale_factor
;
scaley
=
scaley
*
scale_factor
;
}
}
if
(
y
-
height
*
scaley
+
20
<
p
df
_cBottomMargin
)
if
(
y
-
height
*
scaley
+
20
<
p
s
_cBottomMargin
)
print_pagebreak
(
0
);
fp
[
cf
]
<<
" q
\n
"
...
...
@@ -896,86 +867,15 @@ int CnvToPdf::print_image(const char* filename)
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
()
{
y
=
p
df_cPageHeight
-
pdf
_cTopMargin
;
y
=
p
s_cPageHeight
-
ps
_cTopMargin
;
im_cnt
=
0
;
if
(
conf_pass
)
{
fp
[
p
df_eFile_Body
].
open
(
filename
[
pdf
_eFile_Body
]);
fp
[
p
df
_eFile_Body
]
<<
setiosflags
(
std
::
ios
::
fixed
)
<<
std
::
setprecision
(
6
);
start_offset
=
fp
[
p
df
_eFile_Body
].
tellp
();
fp
[
p
s_eFile_Body
].
open
(
filename
[
ps
_eFile_Body
]);
fp
[
p
s
_eFile_Body
]
<<
setiosflags
(
std
::
ios
::
fixed
)
<<
std
::
setprecision
(
6
);
start_offset
=
fp
[
p
s
_eFile_Body
].
tellp
();
}
else
{
print_content
();
...
...
@@ -988,14 +888,14 @@ void CnvToPdf::open()
v_image
[
i
].
print_end
();
}
// if ( v_content.size() > 0 && v_content[v_content.size()-1].length == 0)
// v_content[v_content.size()-1].length = (int) fp[p
df
_eFile_Body].tellp()
// v_content[v_content.size()-1].length = (int) fp[p
s
_eFile_Body].tellp()
// -
// v_content[v_content.size()-1].start;
fp
[
p
df
_eFile_Body
].
seekp
(
start_offset
);
fp
[
p
s
_eFile_Body
].
seekp
(
start_offset
);
strcpy
(
previous_chapter
,
""
);
strcpy
(
current_chapter
,
""
);
}
cf
=
p
df
_eFile_Body
;
cf
=
p
s
_eFile_Body
;
page_number
[
cf
]
=
0
;
if
(
conf_pass
)
{
...
...
@@ -1049,31 +949,7 @@ void CnvToPdf::open()
print_pagebreak
(
0
);
for
(
int
i
=
1
;
i
<
pdf_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
++
)
for
(
int
i
=
1
;
i
<
ps_cMaxLevel
;
i
++
)
header_number
[
i
]
=
0
;
}
...
...
src/exe/co_convert/src/cnv_topdf.h
View file @
cf62149e
...
...
@@ -41,43 +41,12 @@
#include <fstream>
#include "cnv_
content
.h"
#include "cnv_
tops
.h"
#define pdf_cMaxLevel 4
#define pdf_cPageHeight 842
#define pdf_cPageWidth 595
#define pdf_cPageNumX (pdf_cPageWidth - 10)
#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
;
#undef ps_cPageHeight
#define ps_cPageHeight 842
#undef ps_cPageWidth
#define ps_cPageWidth 595
typedef
enum
{
pdf_eObjType_Catalog
,
...
...
@@ -129,67 +98,14 @@ class CnvPdfObj {
int
xobject
[
40
];
};
class
CnvToPdf
{
class
CnvToPdf
:
public
CnvToPs
{
public:
CnvToPdf
()
:
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
()
:
CnvToPs
(),
prev_ci
(
0
),
xref_offset
(
0
),
im_cnt
(
0
),
use_outlines
(
1
)
{}
~
CnvToPdf
();
void
close
();
void
print_text
(
const
char
*
text
,
CnvStyle
&
style
,
int
mode
=
p
df
_mPrintMode_Pos
);
const
char
*
text
,
CnvStyle
&
style
,
int
mode
=
p
s
_mPrintMode_Pos
);
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
,
int
angle2
);
...
...
@@ -200,44 +116,18 @@ class CnvToPdf {
double
y3
,
int
gray
);
void
print_pagebreak
(
int
print_num
);
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
();
int
print_image
(
const
char
*
filename
);
int
print_image_inline
(
const
char
*
filename
);
void
cnv_text
(
char
*
to
,
const
char
*
from
);
void
set_confpass
(
bool
conf
)
void
set_cf
(
int
val
)
{
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
)
{
prev_ci
=
ci
;
ci
=
val
;
}
void
set_cf
(
int
val
)
{
cf
=
val
;
}
void
set_filename
(
int
idx
,
char
*
name
)
{
strcpy
(
filename
[
idx
],
name
);
}
void
open
();
void
incr_headerlevel
();
void
decr_headerlevel
();
void
reset_headernumbers
(
int
level
);
void
set_pageheader
(
const
char
*
text
);
void
set_useoutlines
(
int
u
)
{
use_outlines
=
u
;
...
...
@@ -250,20 +140,7 @@ class CnvToPdf {
std
::
vector
<
CnvPdfObj
>
v_font
;
std
::
vector
<
CnvPdfObj
>
v_resource
;
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
;
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
xref_offset
;
int
im_cnt
;
...
...
src/exe/co_convert/src/cnv_tops.h
View file @
cf62149e
...
...
@@ -131,18 +131,18 @@ class CnvToPs {
style
[
ps_eId_Report
].
h1
=
CnvStyle
(
"Helvetica-Bold-ISOLatin1"
,
24
,
0
,
24
,
20
,
cnv_eAlignment_Left
,
0
,
0
,
0
);
}
~
CnvToPs
();
virtual
~
CnvToPs
();
void
close
();
void
print_text
(
v
irtual
v
oid
close
();
v
irtual
v
oid
print_text
(
const
char
*
text
,
CnvStyle
&
style
,
int
mode
=
ps_mPrintMode_Pos
);
void
print_pagebreak
(
int
print_num
);
void
print_content
();
v
irtual
v
oid
print_pagebreak
(
int
print_num
);
v
irtual
v
oid
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
();
int
print_image
(
const
char
*
filename
);
v
irtual
v
oid
print_horizontal_line
();
virtual
int
print_image
(
const
char
*
filename
);
void
cnv_text
(
char
*
to
,
const
char
*
from
);
void
set_confpass
(
bool
conf
)
{
...
...
@@ -157,11 +157,11 @@ class CnvToPs {
ci
=
0
;
}
}
void
set_ci
(
int
val
)
v
irtual
v
oid
set_ci
(
int
val
)
{
ci
=
val
;
}
void
set_cf
(
int
val
)
v
irtual
v
oid
set_cf
(
int
val
)
{
cf
=
val
;
}
...
...
@@ -169,7 +169,7 @@ class CnvToPs {
{
strcpy
(
filename
[
idx
],
name
);
}
void
open
();
v
irtual
v
oid
open
();
void
incr_headerlevel
();
void
decr_headerlevel
();
void
reset_headernumbers
(
int
level
);
...
...
src/exe/co_convert/src/cnv_wbltops.cpp
View file @
cf62149e
...
...
@@ -42,12 +42,13 @@
#include "co_lng.h"
#include "co_string.h"
#include "cnv_wbltops.h"
#include "cnv_ctx.h"
#include "cnv_wbltops.h"
CnvWblToPs
::~
CnvWblToPs
()
{
tops
.
close
();
tops
->
close
();
delete
tops
;
}
int
CnvWblToPs
::
init
(
char
*
first
)
...
...
@@ -57,51 +58,59 @@ int CnvWblToPs::init(char* first)
strcpy
(
fname
,
ctx
->
dir
);
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
);
tops
.
set_filename
(
ps_eFile_Body
,
ps_cTmpFile
);
tops
.
open
();
if
(
ctx
->
generate_pdf
)
{
tops
->
set_filename
(
ps_eFile_Body
,
fname
);
}
else
{
tops
->
set_filename
(
ps_eFile_Info
,
fname
);
tops
->
set_filename
(
ps_eFile_Body
,
ps_cTmpFile
);
}
tops
->
open
();
// Print first page
tops
.
set_cf
(
ps_eFile_Info
);
tops
.
set_ci
(
ps_eId_TitlePage
);
tops
.
y
-=
100
;
tops
.
print_image
(
"pwr_logga.gif"
);
tops
.
y
-=
100
;
tops
.
print_h2
(
Lng
::
translate
(
"Object Reference Manual"
));
tops
.
print_h3
(
Lng
::
translate
(
"Volume"
));
tops
.
print_h2
(
ctx
->
rw
->
volume_name
);
tops
.
y
-=
150
;
tops
.
print_horizontal_line
();
tops
.
print_text
(
"Version "
pwrv_cPwrVersionStr
,
tops
.
style
[
tops
.
ci
].
text
);
tops
.
print_horizontal_line
();
tops
.
print_pagebreak
(
0
);
tops
.
set_cf
(
ps_eFile_Info
);
tops
.
set_ci
(
ps_eId_InfoPage
);
tops
.
y
=
ps_cPageHeight
-
ps_cTopMargin
-
450
;
tops
.
print_text
(
pwrv_cPwrCopyright
,
tops
.
style
[
tops
.
ci
].
text
);
tops
.
print_text
(
""
,
tops
.
style
[
tops
.
ci
].
text
);
tops
.
print_text
(
tops
->
set_cf
(
ps_eFile_Info
);
tops
->
set_ci
(
ps_eId_TitlePage
);
tops
->
y
-=
100
;
tops
->
print_image
(
"pwr_logga.gif"
);
tops
->
y
-=
100
;
tops
->
print_h2
(
Lng
::
translate
(
"Object Reference Manual"
));
tops
->
print_h3
(
Lng
::
translate
(
"Volume"
));
tops
->
print_h2
(
ctx
->
rw
->
volume_name
);
tops
->
y
-=
150
;
tops
->
print_horizontal_line
();
tops
->
print_text
(
"Version "
pwrv_cPwrVersionStr
,
tops
->
style
[
tops
->
ci
].
text
);
tops
->
print_horizontal_line
();
tops
->
print_pagebreak
(
0
);
tops
->
set_cf
(
ps_eFile_Info
);
tops
->
set_ci
(
ps_eId_InfoPage
);
tops
->
y
=
ps_cPageHeight
-
ps_cTopMargin
-
450
;
tops
->
print_text
(
pwrv_cPwrCopyright
,
tops
->
style
[
tops
->
ci
].
text
);
tops
->
print_text
(
""
,
tops
->
style
[
tops
->
ci
].
text
);
tops
->
print_text
(
"Permission is granted to copy, distribute and/or modify this document"
,
tops
.
style
[
tops
.
ci
].
text
);
tops
.
print_text
(
tops
->
style
[
tops
->
ci
].
text
);
tops
->
print_text
(
"under the terms of the GNU Free Documentation License, Version 1.2"
,
tops
.
style
[
tops
.
ci
].
text
);
tops
.
print_text
(
tops
->
style
[
tops
->
ci
].
text
);
tops
->
print_text
(
"or any later version published by the Free Software Foundation;"
,
tops
.
style
[
tops
.
ci
].
text
);
tops
.
print_text
(
tops
->
style
[
tops
->
ci
].
text
);
tops
->
print_text
(
"with no Invariant Sections, no Front-Cover Texts, and no Back-Cover"
,
tops
.
style
[
tops
.
ci
].
text
);
tops
.
print_text
(
"Texts."
,
tops
.
style
[
tops
.
ci
].
text
);
tops
->
style
[
tops
->
ci
].
text
);
tops
->
print_text
(
"Texts."
,
tops
->
style
[
tops
->
ci
].
text
);
tops
.
y
=
ps_cPageHeight
-
ps_cTopMargin
;
tops
.
set_cf
(
ps_eFile_Body
);
tops
.
set_ci
(
ps_eId_Class
);
tops
->
y
=
ps_cPageHeight
-
ps_cTopMargin
;
tops
->
set_cf
(
ps_eFile_Body
);
tops
->
set_ci
(
ps_eId_Class
);
sprintf
(
text
,
"Volume %s"
,
ctx
->
rw
->
volume_name
);
tops
.
set_pageheader
(
text
);
tops
->
set_pageheader
(
text
);
return
1
;
}
...
...
@@ -126,37 +135,37 @@ int CnvWblToPs::class_exec()
strcat
(
full_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
);
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
)
{
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
,
""
))
{
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
,
""
))
{
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
,
""
))
{
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
,
""
))
{
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
)
{
for
(
i
=
0
;
i
<
ctx
->
rw
->
doc_cnt
;
i
++
)
{
CnvCtx
::
remove_spaces
(
ctx
->
rw
->
doc_text
[
i
],
txt
);
...
...
@@ -164,17 +173,17 @@ int CnvWblToPs::class_exec()
char
imagefile
[
80
];
CnvCtx
::
remove_spaces
(
txt
+
6
,
imagefile
);
tops
.
print_image
(
imagefile
);
tops
->
print_image
(
imagefile
);
}
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"
))
{
tops
.
print_h2
(
txt
+
3
);
tops
->
print_h2
(
txt
+
3
);
}
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"
))
{
tops
.
print_text
(
txt
+
2
,
tops
.
style
[
tops
.
ci
].
text
);
tops
->
print_text
(
txt
+
2
,
tops
->
style
[
tops
->
ci
].
text
);
}
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
++
)
{
...
...
@@ -196,22 +205,22 @@ int CnvWblToPs::class_exec()
if
((
s
=
strrchr
(
link_ref
,
'.'
)))
*
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
))
{
sprintf
(
str
,
" (%s %s "
,
Lng
::
translate
(
"See"
),
text
);
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
);
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
{
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
);
sprintf
(
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
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
;
}
...
...
@@ -220,15 +229,15 @@ int CnvWblToPs::body_exec()
{
char
text
[
80
];
tops
.
y
-=
10
;
tops
.
print_horizontal_line
();
tops
->
y
-=
10
;
tops
->
print_horizontal_line
();
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
);
tops
.
print_text
(
text
,
tops
.
style
[
tops
.
ci
].
boldtext
);
tops
->
print_text
(
text
,
tops
->
style
[
tops
->
ci
].
boldtext
);
if
(
!
streq
(
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
;
}
...
...
@@ -254,7 +263,7 @@ int CnvWblToPs::attribute_exec()
if
(
Lng
::
current
()
!=
lng_eLanguage_en_US
)
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
)
sprintf
(
txt
,
"%s Array[%s] of pointers to %s"
,
Lng
::
translate
(
"Type"
),
ctx
->
rw
->
attr_elements
,
ctx
->
rw
->
attr_typeref
);
...
...
@@ -268,27 +277,27 @@ int CnvWblToPs::attribute_exec()
sprintf
(
txt
,
"%s %s"
,
Lng
::
translate
(
"Type"
),
ctx
->
rw
->
attr_typeref
);
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
))
{
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
[
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
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
);
tops
.
print_text
(
txt
,
tops
.
style
[
tops
.
ci
].
boldtext
);
tops
->
print_text
(
txt
,
tops
->
style
[
tops
->
ci
].
boldtext
);
if
(
!
streq
(
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
,
""
))
{
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
)
{
for
(
i
=
0
;
i
<
ctx
->
rw
->
doc_cnt
;
i
++
)
{
...
...
@@ -296,9 +305,9 @@ int CnvWblToPs::attribute_exec()
char
imagefile
[
80
];
CnvCtx
::
remove_spaces
(
s
+
6
,
imagefile
);
tops
.
print_image
(
imagefile
);
tops
->
print_image
(
imagefile
);
}
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
;
...
...
@@ -320,47 +329,47 @@ int CnvWblToPs::typedef_exec()
strcat
(
full_class_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
);
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
)
{
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
,
""
))
{
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
)
{
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
,
""
))
{
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
,
""
))
{
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
,
""
))
{
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
,
""
))
{
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
)
{
for
(
i
=
0
;
i
<
ctx
->
rw
->
doc_cnt
;
i
++
)
{
CnvCtx
::
remove_spaces
(
ctx
->
rw
->
doc_text
[
i
],
txt
);
...
...
@@ -368,15 +377,15 @@ int CnvWblToPs::typedef_exec()
char
imagefile
[
80
];
CnvCtx
::
remove_spaces
(
txt
+
6
,
imagefile
);
tops
.
print_image
(
imagefile
);
tops
->
print_image
(
imagefile
);
}
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"
))
{
tops
.
print_h2
(
txt
+
3
);
tops
->
print_h2
(
txt
+
3
);
}
else
if
(
str_StartsWith
(
CnvCtx
::
low
(
txt
),
"@h2"
))
{
tops
.
print_h3
(
txt
+
3
);
tops
->
print_h3
(
txt
+
3
);
}
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
++
)
{
...
...
@@ -398,22 +407,22 @@ int CnvWblToPs::typedef_exec()
if
((
s
=
strrchr
(
link_ref
,
'.'
)))
*
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
))
{
sprintf
(
str
,
" (%s %s "
,
Lng
::
translate
(
"See"
),
text
);
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
);
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
{
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
);
sprintf
(
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
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
;
}
...
...
@@ -428,21 +437,21 @@ int CnvWblToPs::bit_exec()
if
(
Lng
::
current
()
!=
lng_eLanguage_en_US
)
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
);
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
);
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
);
tops
.
print_text
(
txt
,
tops
.
style
[
tops
.
ci
].
boldtext
);
tops
->
print_text
(
txt
,
tops
->
style
[
tops
->
ci
].
boldtext
);
if
(
!
streq
(
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
)
{
for
(
i
=
0
;
i
<
ctx
->
rw
->
doc_cnt
;
i
++
)
{
...
...
@@ -450,9 +459,9 @@ int CnvWblToPs::bit_exec()
char
imagefile
[
80
];
CnvCtx
::
remove_spaces
(
s
+
6
,
imagefile
);
tops
.
print_image
(
imagefile
);
tops
->
print_image
(
imagefile
);
}
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
;
...
...
src/exe/co_convert/src/cnv_wbltops.h
View file @
cf62149e
...
...
@@ -38,6 +38,7 @@
#define cnv_wbltops_h
#include "cnv_wblto.h"
#include "cnv_topdf.h"
#include "cnv_tops.h"
class
CnvReadWbl
;
...
...
@@ -46,11 +47,16 @@ class CnvWblToPs : public CnvWblTo {
public:
CnvWblToPs
(
CnvCtx
*
cnv_ctx
)
:
ctx
(
cnv_ctx
),
conf_pass
(
false
)
{
if
(
ctx
->
generate_pdf
)
{
tops
=
new
CnvToPdf
();
}
else
{
tops
=
new
CnvToPs
();
}
}
virtual
~
CnvWblToPs
();
CnvCtx
*
ctx
;
CnvToPs
tops
;
CnvToPs
*
tops
;
bool
conf_pass
;
int
init
(
char
*
first
);
...
...
@@ -71,7 +77,7 @@ class CnvWblToPs : public CnvWblTo {
}
void
set_confpass
(
bool
conf
)
{
tops
.
set_confpass
(
conf
);
tops
->
set_confpass
(
conf
);
conf_pass
=
conf
;
}
bool
confpass
()
...
...
src/exe/co_convert/src/cnv_xtthelptopdf.cpp
deleted
100644 → 0
View file @
cb2469f5
/*
* 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
;
}
}
src/exe/co_convert/src/cnv_xtthelptopdf.h
deleted
100644 → 0
View file @
cb2469f5
/*
* 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
src/exe/co_convert/src/cnv_xtthelptops.cpp
View file @
cf62149e
...
...
@@ -63,7 +63,11 @@ void CnvXtthelpToPs::subject_to_fname(
strcat
(
fname
,
ctx
->
rx
->
name
);
}
else
strcpy
(
fname
,
ctx
->
rx
->
name
);
strcat
(
fname
,
".ps"
);
if
(
ctx
->
generate_pdf
)
{
strcat
(
fname
,
".pdf"
);
}
else
{
strcat
(
fname
,
".ps"
);
}
}
CnvXtthelpToPs
::~
CnvXtthelpToPs
()
...
...
@@ -73,14 +77,19 @@ CnvXtthelpToPs::~CnvXtthelpToPs()
status
&=
~
ps_mStatus_xtthelp
;
}
}
tops
.
close
();
tops
->
close
();
delete
tops
;
}
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
*
a
link
,
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
&
ps_mOption_printDisable
&&
item_type
!=
navh_eItemType_Option
)
return
NULL
;
...
...
@@ -104,33 +113,40 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
strcpy
(
current_subject
,
text1
);
if
(
item_type
==
navh_eItemType_DocTitlePage
)
{
tops
.
set_cf
(
ps_eFile_Info
);
tops
.
set_ci
(
ps_eId_TitlePage
);
tops
->
set_cf
(
ps_eFile_Info
);
tops
->
set_ci
(
ps_eId_TitlePage
);
}
else
if
(
item_type
==
navh_eItemType_DocInfoPage
)
{
tops
.
set_cf
(
ps_eFile_Info
);
tops
.
set_ci
(
ps_eId_InfoPage
);
tops
.
print_pagebreak
(
0
);
tops
->
set_cf
(
ps_eFile_Info
);
tops
->
set_ci
(
ps_eId_InfoPage
);
tops
->
print_pagebreak
(
0
);
}
else
{
if
(
tops
.
ci
==
ps_eId_Chapter
)
{
if
(
tops
->
ci
==
ps_eId_Chapter
)
{
if
(
!
first_chaptertopic
)
tops
.
set_ci
(
ps_eId_TopicL1
);
else
tops
->
set_ci
(
ps_eId_TopicL1
);
else
{
first_chaptertopic
=
0
;
}
else
tops
.
set_ci
(
ps_eId_TopicL1
);
if
(
ctx
->
generate_pdf
)
tops
->
y
=
ps_cPageHeight
-
ps_cTopMargin
;
}
}
else
{
if
(
!
ctx
->
generate_pdf
)
tops
->
set_ci
(
ps_eId_TopicL1
);
}
if
(
tops
.
cf
==
ps_eFile_Info
)
tops
.
y
=
ps_cPageHeight
-
ps_cTopMargin
;
tops
.
set_cf
(
ps_eFile_Body
);
if
(
!
ctx
->
generate_pdf
&&
tops
->
cf
==
ps_eFile_Info
)
tops
->
y
=
ps_cPageHeight
-
ps_cTopMargin
;
tops
->
set_cf
(
ps_eFile_Body
);
}
if
(
first_topic
)
{
pwr_tFileName
fname
;
subject_to_fname
(
fname
,
text1
,
1
);
tops
.
set_filename
(
ps_eFile_Info
,
fname
);
tops
.
set_filename
(
ps_eFile_Body
,
ps_cTmpFile
);
tops
.
open
();
if
(
ctx
->
generate_pdf
)
{
tops
->
set_filename
(
ps_eFile_Body
,
fname
);
}
else
{
tops
->
set_filename
(
ps_eFile_Info
,
fname
);
tops
->
set_filename
(
ps_eFile_Body
,
ps_cTmpFile
);
}
tops
->
open
();
status
|=
ps_mStatus_xtthelp
;
first_topic
=
0
;
...
...
@@ -147,18 +163,18 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
status
&=
~
ps_mStatus_topic
;
if
(
user_style
)
{
user_style
=
0
;
tops
.
set_ci
(
base_ci
);
tops
->
set_ci
(
base_ci
);
}
return
NULL
;
}
case
navh_eItemType_Style
:
{
if
(
str_NoCaseStrcmp
(
text1
,
"function"
)
==
0
)
{
base_ci
=
tops
.
ci
;
tops
.
set_ci
(
ps_eId_Function
);
base_ci
=
tops
->
ci
;
tops
->
set_ci
(
ps_eId_Function
);
user_style
=
1
;
}
else
if
(
str_NoCaseStrcmp
(
text1
,
"report"
)
==
0
)
{
base_ci
=
tops
.
ci
;
tops
.
set_ci
(
ps_eId_Report
);
base_ci
=
tops
->
ci
;
tops
->
set_ci
(
ps_eId_Report
);
}
return
NULL
;
}
...
...
@@ -170,7 +186,7 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
if
(
status
&
ps_mStatus_topic
)
status
&=
~
ps_mStatus_topic
;
tops
.
set_ci
(
ps_eId_TopicL1
);
tops
->
set_ci
(
ps_eId_TopicL1
);
user_style
=
0
;
return
NULL
;
}
...
...
@@ -182,31 +198,31 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
if
(
status
&
ps_mStatus_topic
)
status
&=
~
ps_mStatus_topic
;
tops
.
set_ci
(
ps_eId_Chapter
);
tops
->
set_ci
(
ps_eId_Chapter
);
first_chaptertopic
=
1
;
user_style
=
0
;
tops
.
reset_headernumbers
(
1
);
tops
->
reset_headernumbers
(
1
);
return
NULL
;
}
case
navh_eItemType_HeaderLevel
:
{
if
(
user_style
)
{
user_style
=
0
;
tops
.
set_ci
(
base_ci
);
tops
->
set_ci
(
base_ci
);
}
tops
.
incr_headerlevel
();
tops
->
incr_headerlevel
();
return
NULL
;
}
case
navh_eItemType_EndHeaderLevel
:
{
if
(
user_style
)
{
user_style
=
0
;
tops
.
set_ci
(
base_ci
);
tops
->
set_ci
(
base_ci
);
}
tops
.
decr_headerlevel
();
tops
->
decr_headerlevel
();
return
NULL
;
}
case
navh_eItemType_PageBreak
:
{
tops
.
print_pagebreak
(
1
);
tops
->
print_pagebreak
(
1
);
return
NULL
;
}
case
navh_eItemType_Help
:
...
...
@@ -215,31 +231,34 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
int
printmode
;
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
)
hstyle
=
&
tops
.
style
[
tops
.
ci
].
text
;
hstyle
=
&
tops
->
style
[
tops
->
ci
].
text
;
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
)
hstyle
=
&
tops
.
style
[
tops
.
ci
].
code
;
hstyle
=
&
tops
->
style
[
tops
->
ci
].
code
;
if
(
!
streq
(
link
,
""
))
printmode
=
ps_mPrintMode_Start
;
else
printmode
=
ps_mPrintMode_Pos
;
if
(
!
(
status
&
ps_mStatus_table
))
{
tops
.
x
=
ps_cLeftMargin
;
tops
.
print_text
(
text1
,
*
hstyle
,
printmode
);
tops
->
x
=
ps_cLeftMargin
;
tops
->
print_text
(
text1
,
*
hstyle
,
printmode
);
}
else
{
tops
.
x
=
ps_cLeftMargin
;
tops
.
print_text
(
text1
,
*
hstyle
);
tops
->
x
=
ps_cLeftMargin
;
tops
->
print_text
(
text1
,
*
hstyle
);
if
(
text2
&&
!
streq
(
text2
,
""
))
{
tops
.
x
=
ps_cLeftMargin
+
ps_cCellSize
;
tops
.
print_text
(
tops
->
x
=
ps_cLeftMargin
+
ps_cCellSize
;
tops
->
print_text
(
text2
,
*
hstyle
,
ps_mPrintMode_KeepY
|
ps_mPrintMode_FixX
);
}
if
(
text3
&&
!
streq
(
text3
,
""
))
{
tops
.
x
=
ps_cLeftMargin
+
2
*
ps_cCellSize
;
tops
.
print_text
(
tops
->
x
=
ps_cLeftMargin
+
2
*
ps_cCellSize
;
tops
->
print_text
(
text3
,
*
hstyle
,
ps_mPrintMode_KeepY
|
ps_mPrintMode_FixX
);
}
}
...
...
@@ -255,46 +274,48 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
strcpy
(
fname
,
&
link
[
5
]);
sprintf
(
str
,
" (%s %s)"
,
Lng
::
translate
(
"See"
),
fname
);
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
);
else
{
tops
.
x
=
ps_cLeftMargin
+
3
*
ps_cCellSize
;
tops
->
x
=
ps_cLeftMargin
+
3
*
ps_cCellSize
;
if
(
ps_cLeftMargin
+
2
*
ps_cCellSize
+
strlen
(
text3
)
*
hstyle
->
font_size
*
0.65
>
tops
.
x
)
tops
.
x
=
ps_cLeftMargin
+
2
*
ps_cCellSize
>
tops
->
x
)
tops
->
x
=
ps_cLeftMargin
+
2
*
ps_cCellSize
+
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
);
}
}
else
if
((
strstr
(
link
,
".htm"
)
!=
0
)
||
(
strstr
(
link
,
".pdf"
)
!=
0
))
{
strcpy
(
fname
,
link
);
sprintf
(
str
,
" (%s %s)"
,
Lng
::
translate
(
"See"
),
fname
);
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
);
else
{
tops
.
x
=
ps_cLeftMargin
+
3
*
ps_cCellSize
;
tops
->
x
=
ps_cLeftMargin
+
3
*
ps_cCellSize
;
if
(
ps_cLeftMargin
+
2
*
ps_cCellSize
+
strlen
(
text3
)
*
hstyle
->
font_size
*
0.65
>
tops
.
x
)
tops
.
x
=
ps_cLeftMargin
+
2
*
ps_cCellSize
>
tops
->
x
)
tops
->
x
=
ps_cLeftMargin
+
2
*
ps_cCellSize
+
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
);
}
}
else
{
char
text
[
80
];
int
sts
=
tops
.
content
.
find_link
(
link
,
text
,
&
page
);
int
sts
=
tops
->
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
&
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
);
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
)
{
// fp[cf] << tags[ps_eTag_link].start << " name=\"" << bookmark << "\">";
...
...
@@ -306,26 +327,26 @@ void* CnvXtthelpToPs::insert(navh_eItemType item_type, const char* text1,
int
hlevel
;
if
(
!
user_style
)
hlevel
=
tops
.
ci
-
(
int
)
ps_eId_Chapter
;
hlevel
=
tops
->
ci
-
(
int
)
ps_eId_Chapter
;
else
hlevel
=
base_ci
-
(
int
)
ps_eId_Chapter
;
tops
.
print_h1
(
text1
,
hlevel
,
current_subject
);
tops
->
print_h1
(
text1
,
hlevel
,
current_subject
);
return
NULL
;
}
case
navh_eItemType_Header
:
{
tops
.
print_h3
(
text1
);
tops
->
print_h3
(
text1
);
return
NULL
;
}
case
navh_eItemType_HeaderLarge
:
{
tops
.
print_h2
(
text1
);
tops
->
print_h2
(
text1
);
return
NULL
;
}
case
navh_eItemType_HorizontalLine
:
{
tops
.
print_horizontal_line
();
tops
->
print_horizontal_line
();
return
NULL
;
}
case
navh_eItemType_Image
:
{
int
sts
=
tops
.
print_image
(
text1
);
int
sts
=
tops
->
print_image
(
text1
);
if
(
EVEN
(
sts
))
printf
(
"Image: %s not found
\n
"
,
text1
);
return
NULL
;
...
...
src/exe/co_convert/src/cnv_xtthelptops.h
View file @
cf62149e
...
...
@@ -38,6 +38,7 @@
#define cnv_xtthelptops_h
#include "cnv_xtthelpto.h"
#include "cnv_topdf.h"
#include "cnv_tops.h"
class
CnvCtx
;
...
...
@@ -58,6 +59,11 @@ class CnvXtthelpToPs : public CnvXtthelpTo {
conf_pass
(
false
),
option
(
0
)
{
strcpy
(
current_subject
,
""
);
if
(
ctx
->
generate_pdf
)
{
tops
=
new
CnvToPdf
();
}
else
{
tops
=
new
CnvToPs
();
}
}
virtual
~
CnvXtthelpToPs
();
...
...
@@ -69,14 +75,14 @@ class CnvXtthelpToPs : public CnvXtthelpTo {
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
);
v
irtual
v
oid
subject_to_fname
(
char
*
fname
,
const
char
*
subject
,
int
path
);
bool
confpass
()
{
return
true
;
}
void
set_confpass
(
bool
conf
)
{
tops
.
set_confpass
(
conf
);
tops
->
set_confpass
(
conf
);
conf_pass
=
conf
;
if
(
!
conf
)
{
// Reset
...
...
@@ -88,7 +94,7 @@ class CnvXtthelpToPs : public CnvXtthelpTo {
}
CnvCtx
*
ctx
;
CnvToPs
tops
;
CnvToPs
*
tops
;
int
base_ci
;
int
first_topic
;
int
first_chaptertopic
;
...
...
src/exe/co_convert/src/co_convert.cpp
View file @
cf62149e
...
...
@@ -49,7 +49,6 @@ extern "C" {
#include "cnv_xtthelptohtml.h"
#include "cnv_xtthelptoxml.h"
#include "cnv_xtthelptops.h"
#include "cnv_xtthelptopdf.h"
#include "cnv_xtthelptotext.h"
#include "cnv_pwgtoxtthelp.h"
#include "cnv_classdep.h"
...
...
@@ -108,7 +107,6 @@ int main(int argc, char* argv[])
int
xtthelp_to_html
=
0
;
int
xtthelp_to_xml
=
0
;
int
xtthelp_to_ps
=
0
;
int
xtthelp_to_pdf
=
0
;
int
xtthelp_to_text
=
0
;
int
pwg_to_xtthelp
=
0
;
int
changelog
=
0
;
...
...
@@ -177,6 +175,10 @@ int main(int argc, char* argv[])
ctx
->
generate_ps
=
1
;
ctx
->
common_structfile_only
=
1
;
break
;
case
'Q'
:
ctx
->
generate_pdf
=
1
;
ctx
->
common_structfile_only
=
1
;
break
;
case
'p'
:
ctx
->
generate_struct
=
1
;
ctx
->
hpp
=
1
;
...
...
@@ -198,9 +200,11 @@ int main(int argc, char* argv[])
break
;
case
'n'
:
xtthelp_to_ps
=
1
;
ctx
->
generate_ps
=
1
;
break
;
case
'f'
:
xtthelp_to_pdf
=
1
;
xtthelp_to_ps
=
1
;
ctx
->
generate_pdf
=
1
;
break
;
case
'j'
:
xtthelp_to_text
=
1
;
...
...
@@ -272,14 +276,6 @@ int main(int argc, char* argv[])
delete
xtthelpto
;
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
)
{
CnvXtthelpToText
*
xtthelpto
=
new
CnvXtthelpToText
(
ctx
);
ctx
->
rx
=
new
CnvReadXtthelp
(
files
,
ctx
->
dir
,
xtthelpto
);
...
...
@@ -341,7 +337,7 @@ int main(int argc, char* argv[])
ctx
->
wblto
=
new
CnvWblToH
(
ctx
);
else
if
(
ctx
->
generate_xtthelp
)
ctx
->
wblto
=
new
CnvWblToXtthelp
(
ctx
);
else
if
(
ctx
->
generate_ps
)
else
if
(
ctx
->
generate_ps
||
ctx
->
generate_pdf
)
ctx
->
wblto
=
new
CnvWblToPs
(
ctx
);
ctx
->
rw
=
new
CnvReadWbl
(
ctx
,
ctx
->
wblto
);
...
...
src/tools/bld/src/os_linux/wbl_generic.mk
View file @
cf62149e
...
...
@@ -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_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_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)
))
dbs_dependencies
:=
$(bld_dir)
/mcomp.d_wbl
...
...
@@ -134,6 +136,14 @@ $(doc_dir)/sv_se/%.ps : ../../%.wb_load
@
echo
"Generating postscript file for
$(source)
classes sv_se..."
@
$(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
@
echo
"Generating xtt help files for
$(source)
classes en_us"
@
$(co_convert)
-x
-d
$(exe_dir)
/en_us
"
$(source)
"
...
...
@@ -176,6 +186,8 @@ exe: $(export_wbl_xtthelp_en_us) \
$(export_wbl_html_sv_se)
\
$(export_wbl_ps_en_us)
\
$(export_wbl_ps_sv_se)
\
$(export_wbl_pdf_en_us)
\
$(export_wbl_pdf_sv_se)
\
$(export_pdf_en_us)
\
$(export_pdf_sv_se)
\
| silent
...
...
src/wbl/pwrb/src/os_templ/hw_templ/makefile
View file @
cf62149e
...
...
@@ -54,6 +54,8 @@ exe : $(doc_dir)/en_us/orm/pwrb_allclasses.html \
$(doc_dir)/sv_se/orm/rt_csup_c.html
\
$(doc_dir)/en_us/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)/sv_se/pwrb_xtthelp.dat
\
| silent
...
...
@@ -144,6 +146,14 @@ $(doc_dir)/sv_se/pwrb.ps :
@
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"
$(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
:
@
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"
...
...
src/wbl/pwrs/src/os_templ/hw_templ/makefile
View file @
cf62149e
...
...
@@ -46,6 +46,8 @@ exe : $(doc_dir)/en_us/orm/pwrs_allclasses.html \
$(doc_dir)/sv_se/orm/pwr_class_h.html
\
$(doc_dir)/en_us/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)/sv_se/pwrs_xtthelp.dat
\
| silent
...
...
@@ -112,6 +114,14 @@ $(doc_dir)/sv_se/pwrs.ps :
@
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"
$(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
:
@
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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment