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
ac05ff75
Commit
ac05ff75
authored
Apr 21, 2005
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conversion xtthelp -> pdf added
parent
a02c4109
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1844 additions
and
0 deletions
+1844
-0
src/exe/co_convert/src/cnv_topdf.cpp
src/exe/co_convert/src/cnv_topdf.cpp
+1066
-0
src/exe/co_convert/src/cnv_topdf.h
src/exe/co_convert/src/cnv_topdf.h
+227
-0
src/exe/co_convert/src/cnv_xtthelptopdf.cpp
src/exe/co_convert/src/cnv_xtthelptopdf.cpp
+362
-0
src/exe/co_convert/src/cnv_xtthelptopdf.h
src/exe/co_convert/src/cnv_xtthelptopdf.h
+86
-0
src/exe/co_convert/src/co_convert.cpp
src/exe/co_convert/src/co_convert.cpp
+103
-0
No files found.
src/exe/co_convert/src/cnv_topdf.cpp
0 → 100644
View file @
ac05ff75
This diff is collapsed.
Click to expand it.
src/exe/co_convert/src/cnv_topdf.h
0 → 100644
View file @
ac05ff75
#ifndef cnv_topdf_h
#define cnv_topdf_h
/* cnv_topdf.h -- Postscript output
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
using
namespace
std
;
#include <iostream.h>
#include <vector.h>
#include <string>
#include "pwr.h"
#include "cnv_style.h"
#include "cnv_content.h"
#define pdf_cMaxLevel 4
#define pdf_cPageHeight 790
#define pdf_cPageWidth 535
#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__
}
pdf_eId
;
typedef
enum
{
pdf_eObjType_Catalog
,
pdf_eObjType_Page
,
pdf_eObjType_Pages
,
pdf_eObjType_Outline
,
pdf_eObjType_OutlineO
,
pdf_eObjType_Content
,
pdf_eObjType_Process
,
pdf_eObjType_Font
,
pdf_eObjType_Resource
,
pdf_eObjType_Image
}
pdf_eObjType
;
class
CnvToPdf
;
class
CnvPdfObj
{
public:
CnvPdfObj
(
CnvToPdf
*
otopdf
,
pdf_eObjType
otype
,
int
onumber
)
:
topdf
(
otopdf
),
type
(
otype
),
number
(
onumber
),
length
(
0
),
offset
(
0
),
start
(
0
),
parent
(
0
),
first
(
0
),
last
(
0
),
next
(
0
),
prev
(
0
),
dest
(
0
),
count
(
0
),
resource
(
-
1
),
xobject_cnt
(
0
)
{
strcpy
(
fontname
,
""
);
strcpy
(
text
,
""
);}
void
print_begin
();
void
print_end
();
int
print_image
();
CnvToPdf
*
topdf
;
pdf_eObjType
type
;
int
number
;
int
length
;
int
offset
;
int
start
;
char
fontname
[
80
];
int
parent
;
int
first
;
int
last
;
int
next
;
int
prev
;
int
dest
;
int
count
;
char
text
[
200
];
int
resource
;
int
xobject_cnt
;
int
xobject
[
40
];
};
class
CnvToPdf
{
public:
CnvToPdf
()
:
cf
(
0
),
ci
(
0
),
prev_ci
(
0
),
conf_pass
(
false
),
xref_offset
(
0
),
im_cnt
(
0
)
{
for
(
int
i
=
0
;
i
<
pdf_cMaxLevel
;
i
++
)
header_number
[
i
]
=
0
;
for
(
int
i
=
0
;
i
<
pdf_eFile__
;
i
++
)
page_number
[
i
]
=
0
;
style
[
pdf_eId_TitlePage
].
h1
=
CnvStyle
(
"Helvetica-Bold-ISOLatin1"
,
35
,
0
,
100
,
20
,
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
);
}
~
CnvToPdf
();
void
close
();
void
print_text
(
char
*
text
,
CnvStyle
&
style
,
int
mode
=
pdf_mPrintMode_Pos
);
void
print_pagebreak
(
int
print_num
);
void
print_content
();
void
print_h1
(
char
*
text
,
int
hlevel
,
char
*
subject
);
void
print_h2
(
char
*
text
);
void
print_h3
(
char
*
text
);
void
print_horizontal_line
();
int
print_image
(
char
*
filename
);
int
print_image_inline
(
char
*
filename
);
void
cnv_text
(
char
*
to
,
char
*
from
);
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
)
{
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
(
char
*
text
);
char
*
fontname
(
CnvStyle
&
style
);
vector
<
CnvPdfObj
>
v_pages
;
vector
<
CnvPdfObj
>
v_outline
;
vector
<
CnvPdfObj
>
v_content
;
vector
<
CnvPdfObj
>
v_font
;
vector
<
CnvPdfObj
>
v_resource
;
vector
<
CnvPdfObj
>
v_image
;
CnvContent
content
;
CnvIdStyle
style
[
pdf_eId__
];
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
;
};
#endif
src/exe/co_convert/src/cnv_xtthelptopdf.cpp
0 → 100644
View file @
ac05ff75
This diff is collapsed.
Click to expand it.
src/exe/co_convert/src/cnv_xtthelptopdf.h
0 → 100644
View file @
ac05ff75
#ifndef cnv_xtthelptopdf_h
#define cnv_xtthelptopdf_h
/* cnv_xtthelptodf.h -- Documentation
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
using
namespace
std
;
#include <iostream.h>
#include <vector.h>
#include <string>
#include "pwr.h"
#include "cnv_xtthelpto.h"
#include "cnv_style.h"
#include "cnv_content.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
,
char
*
text1
,
char
*
text2
,
char
*
text3
,
char
*
link
,
char
*
link_bookmark
,
char
*
file_name
,
navh_eHelpFile
file_type
,
int
help_index
,
char
*
bookmark
);
void
subject_to_fname
(
char
*
fname
,
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/co_convert.cpp
View file @
ac05ff75
...
@@ -22,6 +22,7 @@ extern "C" {
...
@@ -22,6 +22,7 @@ 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"
typedef
char
cnv_tName
[
200
];
typedef
char
cnv_tName
[
200
];
...
@@ -38,6 +39,7 @@ static void usage()
...
@@ -38,6 +39,7 @@ static void usage()
printf
(
" -t: Create html from xtthelp-file
\n
"
);
printf
(
" -t: Create html from xtthelp-file
\n
"
);
printf
(
" -m: Create xml from xtthelp-file
\n
"
);
printf
(
" -m: Create xml from xtthelp-file
\n
"
);
printf
(
" -n: Create postscript from xtthelp-file
\n
"
);
printf
(
" -n: Create postscript from xtthelp-file
\n
"
);
printf
(
" -f: Create pdf from xtthelp-file
\n
"
);
printf
(
" -q: Create postscript from wb_load-files
\n
"
);
printf
(
" -q: Create postscript from wb_load-files
\n
"
);
printf
(
" -d: Output directory
\n
"
);
printf
(
" -d: Output directory
\n
"
);
printf
(
" -g: Setup file
\n
"
);
printf
(
" -g: Setup file
\n
"
);
...
@@ -101,6 +103,7 @@ int main( int argc, char *argv[])
...
@@ -101,6 +103,7 @@ 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
;
if
(
argc
<
2
||
argc
>
9
)
{
if
(
argc
<
2
||
argc
>
9
)
{
usage
();
usage
();
...
@@ -185,6 +188,98 @@ int main( int argc, char *argv[])
...
@@ -185,6 +188,98 @@ int main( int argc, char *argv[])
case
'n'
:
case
'n'
:
xtthelp_to_ps
=
1
;
xtthelp_to_ps
=
1
;
break
;
break
;
case
'f'
:
xtthelp_to_pdf
=
1
;
break
;
default:
usage
();
exit
(
0
);
}
s
++
;
}
}
else
strcpy
(
files
,
argv
[
i
]);
}
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
strcmp
(
argv
[
i
],
"-d"
)
==
0
)
{
if
(
i
+
1
>=
argc
)
{
usage
();
exit
(
0
);
}
strcpy
(
ctx
->
dir
,
argv
[
i
+
1
]);
i
++
;
#if defined OS_VMS
if
(
ctx
->
dir
[
strlen
(
ctx
->
dir
)
-
1
]
!=
':'
&&
(
ctx
->
dir
[
strlen
(
ctx
->
dir
)
-
1
]
!=
'>'
&&
ctx
->
dir
[
strlen
(
ctx
->
dir
)
-
1
]
!=
']'
))
strcat
(
ctx
->
dir
,
":"
);
#else
if
(
ctx
->
dir
[
strlen
(
ctx
->
dir
)
-
1
]
!=
'/'
)
strcat
(
ctx
->
dir
,
"/"
);
#endif
}
if
(
strcmp
(
argv
[
i
],
"-g"
)
==
0
)
{
if
(
i
+
1
>=
argc
)
{
usage
();
exit
(
0
);
}
strcpy
(
ctx
->
setup_filename
,
argv
[
i
+
1
]);
i
++
;
}
if
(
strcmp
(
argv
[
i
],
"-l"
)
==
0
)
{
if
(
i
+
1
>=
argc
)
{
usage
();
exit
(
0
);
}
Lng
::
set
(
argv
[
i
+
1
]);
i
++
;
}
else
if
(
argv
[
i
][
0
]
==
'-'
)
{
s
=
&
argv
[
i
][
1
];
while
(
*
s
)
{
switch
(
*
s
)
{
case
'h'
:
help
();
exit
(
0
);
case
'w'
:
ctx
->
generate_html
=
1
;
break
;
case
'x'
:
ctx
->
generate_xtthelp
=
1
;
break
;
case
'c'
:
ctx
->
generate_src
=
1
;
break
;
case
's'
:
ctx
->
generate_struct
=
1
;
break
;
case
'q'
:
ctx
->
generate_ps
=
1
;
ctx
->
common_structfile_only
=
1
;
break
;
case
'p'
:
ctx
->
generate_struct
=
1
;
ctx
->
hpp
=
1
;
break
;
case
'o'
:
ctx
->
common_structfile_only
=
1
;
break
;
case
'v'
:
ctx
->
verbose
=
1
;
break
;
case
't'
:
xtthelp_to_html
=
1
;
break
;
case
'm'
:
xtthelp_to_xml
=
1
;
break
;
case
'n'
:
xtthelp_to_ps
=
1
;
break
;
case
'f'
:
xtthelp_to_pdf
=
1
;
break
;
default:
default:
usage
();
usage
();
exit
(
0
);
exit
(
0
);
...
@@ -225,6 +320,14 @@ int main( int argc, char *argv[])
...
@@ -225,6 +320,14 @@ 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
);
}
// Get the files and order them
// Get the files and order them
file_cnt
=
0
;
file_cnt
=
0
;
...
...
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