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
ba705e5f
Commit
ba705e5f
authored
Dec 13, 2011
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
co_convert conversion from xtt help to text
parent
d3e70ab4
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
320 additions
and
6 deletions
+320
-6
src/exe/co_convert/src/cnv_topdf.h
src/exe/co_convert/src/cnv_topdf.h
+3
-0
src/exe/co_convert/src/cnv_tops.cpp
src/exe/co_convert/src/cnv_tops.cpp
+12
-5
src/exe/co_convert/src/cnv_tops.h
src/exe/co_convert/src/cnv_tops.h
+3
-0
src/exe/co_convert/src/cnv_xtthelpto.h
src/exe/co_convert/src/cnv_xtthelpto.h
+3
-1
src/exe/co_convert/src/cnv_xtthelptopdf.cpp
src/exe/co_convert/src/cnv_xtthelptopdf.cpp
+6
-0
src/exe/co_convert/src/cnv_xtthelptops.cpp
src/exe/co_convert/src/cnv_xtthelptops.cpp
+7
-0
src/exe/co_convert/src/cnv_xtthelptotext.cpp
src/exe/co_convert/src/cnv_xtthelptotext.cpp
+190
-0
src/exe/co_convert/src/cnv_xtthelptotext.h
src/exe/co_convert/src/cnv_xtthelptotext.h
+83
-0
src/exe/co_convert/src/co_convert.cpp
src/exe/co_convert/src/co_convert.cpp
+13
-0
No files found.
src/exe/co_convert/src/cnv_topdf.h
View file @
ba705e5f
...
@@ -85,6 +85,7 @@ typedef enum {
...
@@ -85,6 +85,7 @@ typedef enum {
pdf_eId_TopicL3
,
pdf_eId_TopicL3
,
pdf_eId_Function
,
pdf_eId_Function
,
pdf_eId_Class
,
pdf_eId_Class
,
pdf_eId_Report
,
pdf_eId__
pdf_eId__
}
pdf_eId
;
}
pdf_eId
;
...
@@ -188,6 +189,8 @@ class CnvToPdf {
...
@@ -188,6 +189,8 @@ class CnvToPdf {
CnvStyle
(
"TimesNewRoman-ISOLatin1"
,
10
,
0
,
11
,
1
,
cnv_eAlignment_Left
,
0
,
0
,
0
);
CnvStyle
(
"TimesNewRoman-ISOLatin1"
,
10
,
0
,
11
,
1
,
cnv_eAlignment_Left
,
0
,
0
,
0
);
style
[
pdf_eId_TopicL3
].
text
=
style
[
pdf_eId_TopicL3
].
text
=
CnvStyle
(
"TimesNewRoman-ISOLatin1"
,
10
,
0
,
11
,
1
,
cnv_eAlignment_Left
,
0
,
0
,
0
);
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
();
...
...
src/exe/co_convert/src/cnv_tops.cpp
View file @
ba705e5f
...
@@ -338,6 +338,8 @@ page_x << " " << ps_cPageNumY << " moveto" << endl <<
...
@@ -338,6 +338,8 @@ page_x << " " << ps_cPageNumY << " moveto" << endl <<
void
CnvToPs
::
print_content
()
void
CnvToPs
::
print_content
()
{
{
if
(
!
content
.
tab
.
size
())
return
;
cf
=
ps_eFile_Info
;
cf
=
ps_eFile_Info
;
ci
=
ps_eId_Content
;
ci
=
ps_eId_Content
;
...
@@ -382,10 +384,15 @@ CnvToPs::~CnvToPs()
...
@@ -382,10 +384,15 @@ CnvToPs::~CnvToPs()
void
CnvToPs
::
close
()
void
CnvToPs
::
close
()
{
{
if
(
ci
!=
ps_eId_Report
)
{
cf
=
ps_eFile_Body
;
cf
=
ps_eFile_Body
;
print_pagebreak
(
1
);
print_pagebreak
(
1
);
cf
=
ps_eFile_Info
;
cf
=
ps_eFile_Info
;
print_content
();
print_content
();
}
else
fp
[
cf
]
<<
"showpage"
<<
endl
;
if
(
!
conf_pass
)
{
if
(
!
conf_pass
)
{
fp
[
ps_eFile_Info
].
close
();
fp
[
ps_eFile_Info
].
close
();
fp
[
ps_eFile_Body
].
close
();
fp
[
ps_eFile_Body
].
close
();
...
@@ -560,7 +567,7 @@ void CnvToPs::print_h1( const char *text, int hlevel, char *subject)
...
@@ -560,7 +567,7 @@ void CnvToPs::print_h1( const char *text, int hlevel, char *subject)
else
else
print_text
(
text
,
style
[
ci
].
h1
);
print_text
(
text
,
style
[
ci
].
h1
);
if
(
conf_pass
)
{
if
(
conf_pass
&&
ci
!=
ps_eId_Report
)
{
CnvContentElem
cnt
;
CnvContentElem
cnt
;
cnt
.
page_number
=
page_number
[
cf
];
cnt
.
page_number
=
page_number
[
cf
];
cnt
.
header_level
=
hlevel
;
cnt
.
header_level
=
hlevel
;
...
...
src/exe/co_convert/src/cnv_tops.h
View file @
ba705e5f
...
@@ -86,6 +86,7 @@ typedef enum {
...
@@ -86,6 +86,7 @@ typedef enum {
ps_eId_TopicL3
,
ps_eId_TopicL3
,
ps_eId_Function
,
ps_eId_Function
,
ps_eId_Class
,
ps_eId_Class
,
ps_eId_Report
,
ps_eId__
ps_eId__
}
ps_eId
;
}
ps_eId
;
...
@@ -140,6 +141,8 @@ class CnvToPs {
...
@@ -140,6 +141,8 @@ class CnvToPs {
CnvStyle
(
"Times-Roman-ISOLatin1"
,
10
,
0
,
11
,
1
,
cnv_eAlignment_Left
,
0
,
0
,
0
);
CnvStyle
(
"Times-Roman-ISOLatin1"
,
10
,
0
,
11
,
1
,
cnv_eAlignment_Left
,
0
,
0
,
0
);
style
[
ps_eId_TopicL3
].
text
=
style
[
ps_eId_TopicL3
].
text
=
CnvStyle
(
"Times-Roman-ISOLatin1"
,
10
,
0
,
11
,
1
,
cnv_eAlignment_Left
,
0
,
0
,
0
);
CnvStyle
(
"Times-Roman-ISOLatin1"
,
10
,
0
,
11
,
1
,
cnv_eAlignment_Left
,
0
,
0
,
0
);
style
[
ps_eId_Report
].
h1
=
CnvStyle
(
"Helvetica-Bold-ISOLatin1"
,
24
,
0
,
24
,
20
,
cnv_eAlignment_Left
,
0
,
0
,
0
);
}
}
~
CnvToPs
();
~
CnvToPs
();
...
...
src/exe/co_convert/src/cnv_xtthelpto.h
View file @
ba705e5f
...
@@ -52,7 +52,9 @@ class CnvReadXtthelp;
...
@@ -52,7 +52,9 @@ class CnvReadXtthelp;
typedef
enum
{
typedef
enum
{
Cnv_eXtthelpToType_Html
,
Cnv_eXtthelpToType_Html
,
Cnv_eXtthelpToType_Xml
,
Cnv_eXtthelpToType_Xml
,
Cnv_eXtthelpToType_Ps
Cnv_eXtthelpToType_Ps
,
Cnv_eXtthelpToType_Pdf
,
Cnv_eXtthelpToType_Text
}
Cnv_eXtthelpToType
;
}
Cnv_eXtthelpToType
;
class
CnvXtthelpTo
{
class
CnvXtthelpTo
{
...
...
src/exe/co_convert/src/cnv_xtthelptopdf.cpp
View file @
ba705e5f
...
@@ -144,6 +144,8 @@ void *CnvXtthelpToPdf::insert( navh_eItemType item_type, const char *text1,
...
@@ -144,6 +144,8 @@ void *CnvXtthelpToPdf::insert( navh_eItemType item_type, const char *text1,
topdf
.
y
=
pdf_cPageHeight
-
pdf_cTopMargin
;
topdf
.
y
=
pdf_cPageHeight
-
pdf_cTopMargin
;
}
}
}
}
else
topdf
.
set_ci
(
pdf_eId_TopicL1
);
}
}
if
(
first_topic
)
{
if
(
first_topic
)
{
...
@@ -178,6 +180,10 @@ void *CnvXtthelpToPdf::insert( navh_eItemType item_type, const char *text1,
...
@@ -178,6 +180,10 @@ void *CnvXtthelpToPdf::insert( navh_eItemType item_type, const char *text1,
topdf
.
set_ci
(
pdf_eId_Function
);
topdf
.
set_ci
(
pdf_eId_Function
);
user_style
=
1
;
user_style
=
1
;
}
}
else
if
(
cdh_NoCaseStrcmp
(
text1
,
"report"
)
==
0
)
{
base_ci
=
topdf
.
ci
;
topdf
.
set_ci
(
pdf_eId_Report
);
}
return
NULL
;
return
NULL
;
}
}
case
navh_eItemType_EndChapter
:
{
case
navh_eItemType_EndChapter
:
{
...
...
src/exe/co_convert/src/cnv_xtthelptops.cpp
View file @
ba705e5f
...
@@ -140,6 +140,9 @@ void *CnvXtthelpToPs::insert( navh_eItemType item_type, const char *text1,
...
@@ -140,6 +140,9 @@ void *CnvXtthelpToPs::insert( navh_eItemType item_type, const char *text1,
else
else
first_chaptertopic
=
0
;
first_chaptertopic
=
0
;
}
}
else
tops
.
set_ci
(
ps_eId_TopicL1
);
if
(
tops
.
cf
==
ps_eFile_Info
)
if
(
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
);
...
@@ -178,6 +181,10 @@ void *CnvXtthelpToPs::insert( navh_eItemType item_type, const char *text1,
...
@@ -178,6 +181,10 @@ void *CnvXtthelpToPs::insert( navh_eItemType item_type, const char *text1,
tops
.
set_ci
(
ps_eId_Function
);
tops
.
set_ci
(
ps_eId_Function
);
user_style
=
1
;
user_style
=
1
;
}
}
else
if
(
cdh_NoCaseStrcmp
(
text1
,
"report"
)
==
0
)
{
base_ci
=
tops
.
ci
;
tops
.
set_ci
(
ps_eId_Report
);
}
return
NULL
;
return
NULL
;
}
}
case
navh_eItemType_EndChapter
:
{
case
navh_eItemType_EndChapter
:
{
...
...
src/exe/co_convert/src/cnv_xtthelptotext.cpp
0 → 100644
View file @
ba705e5f
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2011 SSAB Oxelosund AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. 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
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview 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 Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* cnv_xtthelptotext.cpp --
Convert xtt help file to TEXT. */
/*_Include files_________________________________________________________*/
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
extern
"C"
{
#include "co_cdh.h"
#include "co_dcli.h"
}
#include "co_nav_help.h"
#include "co_lng.h"
#include "cnv_ctx.h"
#include "cnv_readxtthelp.h"
#include "cnv_xtthelptotext.h"
#include "cnv_image.h"
#define text_cCellSize 110
/* Nice functions */
#define ODD(a) (((int)(a) & 1) != 0)
#define EVEN(a) (((int)(a) & 1) == 0)
#define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#define min(Dragon,Eagle) ((Dragon) < (Eagle) ? (Dragon) : (Eagle))
#ifndef __ALPHA
#define abs(Dragon) ((Dragon) >= 0 ? (Dragon) : (-(Dragon)))
#endif
#define CNV_TAB 25
void
CnvXtthelpToText
::
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
,
".txt"
);
cdh_ToLower
(
fname
,
fname
);
}
CnvXtthelpToText
::~
CnvXtthelpToText
()
{
if
(
cf
)
{
cf
->
f
.
close
();
delete
cf
;
}
}
void
*
CnvXtthelpToText
::
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
)
{
if
(
print_disable
)
return
NULL
;
if
(
item_type
!=
navh_eItemType_Topic
&&
!
in_topic
)
return
NULL
;
switch
(
item_type
)
{
case
navh_eItemType_DocTitlePage
:
case
navh_eItemType_DocInfoPage
:
case
navh_eItemType_Style
:
case
navh_eItemType_EndChapter
:
case
navh_eItemType_Chapter
:
case
navh_eItemType_HeaderLevel
:
case
navh_eItemType_EndHeaderLevel
:
case
navh_eItemType_Image
:
return
NULL
;
case
navh_eItemType_Topic
:
{
if
(
first_topic
)
{
pwr_tFileName
fname
;
subject_to_fname
(
fname
,
text1
,
1
);
cf
=
new
CnvFile
();
cf
->
f
.
open
(
fname
);
first_topic
=
0
;
}
in_topic
=
1
;
return
NULL
;
}
case
navh_eItemType_EndTopic
:
in_topic
=
0
;
break
;
case
navh_eItemType_PageBreak
:
{
cf
->
f
<<
"
\f
"
;
return
NULL
;
}
case
navh_eItemType_Help
:
case
navh_eItemType_HelpCode
:
case
navh_eItemType_HelpBold
:
case
navh_eItemType_Header
:
case
navh_eItemType_HeaderLarge
:
case
navh_eItemType_HelpHeader
:
{
cf
->
f
<<
text1
;
if
(
text2
)
{
cf
->
f
<<
" "
;
for
(
int
i
=
0
;
i
<
(
int
)(
CNV_TAB
-
strlen
(
text1
)
-
1
);
i
++
)
cf
->
f
<<
" "
;
cf
->
f
<<
text2
;
if
(
text3
)
{
cf
->
f
<<
" "
;
for
(
int
i
=
0
;
i
<
(
int
)(
CNV_TAB
-
strlen
(
text2
)
-
1
);
i
++
)
cf
->
f
<<
" "
;
cf
->
f
<<
text3
;
}
}
cf
->
f
<<
endl
;
break
;
}
case
navh_eItemType_HorizontalLine
:
{
for
(
int
i
=
0
;
i
<
80
;
i
++
)
cf
->
f
<<
"-"
;
cf
->
f
<<
endl
;
return
NULL
;
}
case
navh_eItemType_Option
:
{
if
(
strcmp
(
text1
,
"printdisable"
)
==
0
)
print_disable
=
1
;
else
if
(
strcmp
(
text1
,
"printenable"
)
==
0
)
print_disable
=
0
;
return
NULL
;
}
default:
return
0
;
}
return
0
;
}
src/exe/co_convert/src/cnv_xtthelptotext.h
0 → 100644
View file @
ba705e5f
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2011 SSAB Oxelosund AB.
*
* This file is part of Proview.
*
* 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. 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
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview 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 Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#ifndef cnv_xtthelptotext_h
#define cnv_xtthelptotext_h
using
namespace
std
;
#include <iostream>
#include <vector>
#include <string>
#include "pwr.h"
#include "cnv_xtthelpto.h"
#include "cnv_style.h"
#include "cnv_content.h"
#include "cnv_file.h"
class
CnvCtx
;
class
CnvXtthelpToText
:
public
CnvXtthelpTo
{
public:
CnvXtthelpToText
(
CnvCtx
*
cnv_ctx
)
:
ctx
(
cnv_ctx
),
cf
(
0
),
first_topic
(
1
),
in_topic
(
0
),
print_disable
(
0
)
{}
virtual
~
CnvXtthelpToText
();
Cnv_eXtthelpToType
type
()
{
return
Cnv_eXtthelpToType_Text
;}
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
);
CnvCtx
*
ctx
;
CnvFile
*
cf
;
int
first_topic
;
int
in_topic
;
int
print_disable
;
};
#endif
src/exe/co_convert/src/co_convert.cpp
View file @
ba705e5f
...
@@ -60,6 +60,7 @@ extern "C" {
...
@@ -60,6 +60,7 @@ extern "C" {
#include "cnv_xtthelptoxml.h"
#include "cnv_xtthelptoxml.h"
#include "cnv_xtthelptops.h"
#include "cnv_xtthelptops.h"
#include "cnv_xtthelptopdf.h"
#include "cnv_xtthelptopdf.h"
#include "cnv_xtthelptotext.h"
#include "cnv_pwgtoxtthelp.h"
#include "cnv_pwgtoxtthelp.h"
#include "cnv_classdep.h"
#include "cnv_classdep.h"
#include "cnv_changelog.h"
#include "cnv_changelog.h"
...
@@ -119,6 +120,7 @@ int main( int argc, char *argv[])
...
@@ -119,6 +120,7 @@ int main( int argc, char *argv[])
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_pdf
=
0
;
int
xtthelp_to_text
=
0
;
int
pwg_to_xtthelp
=
0
;
int
pwg_to_xtthelp
=
0
;
int
changelog
=
0
;
int
changelog
=
0
;
char
from
[
80
]
=
""
;
char
from
[
80
]
=
""
;
...
@@ -213,6 +215,9 @@ int main( int argc, char *argv[])
...
@@ -213,6 +215,9 @@ int main( int argc, char *argv[])
case
'f'
:
case
'f'
:
xtthelp_to_pdf
=
1
;
xtthelp_to_pdf
=
1
;
break
;
break
;
case
'j'
:
xtthelp_to_text
=
1
;
break
;
case
'a'
:
case
'a'
:
pwg_to_xtthelp
=
1
;
pwg_to_xtthelp
=
1
;
break
;
break
;
...
@@ -282,6 +287,14 @@ int main( int argc, char *argv[])
...
@@ -282,6 +287,14 @@ int main( int argc, char *argv[])
delete
xtthelpto
;
delete
xtthelpto
;
exit
(
0
);
exit
(
0
);
}
}
if
(
xtthelp_to_text
)
{
CnvXtthelpToText
*
xtthelpto
=
new
CnvXtthelpToText
(
ctx
);
ctx
->
rx
=
new
CnvReadXtthelp
(
files
,
ctx
->
dir
,
xtthelpto
);
ctx
->
rx
->
read_xtthelp
();
delete
ctx
->
rx
;
delete
xtthelpto
;
exit
(
0
);
}
if
(
ctx
->
generate_cdp
)
{
if
(
ctx
->
generate_cdp
)
{
CnvClassDep
*
classdep
=
new
CnvClassDep
(
ctx
);
CnvClassDep
*
classdep
=
new
CnvClassDep
(
ctx
);
classdep
->
read
();
classdep
->
read
();
...
...
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