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
3b9b1b69
Commit
3b9b1b69
authored
Aug 26, 2015
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java dynamic ScrollingText and Animation added
parent
422a589c
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
558 additions
and
18 deletions
+558
-18
java/aapp/app/src/GraphCmn.java
java/aapp/app/src/GraphCmn.java
+1
-1
java/jpwr/jopg/src/Dyn.java
java/jpwr/jopg/src/Dyn.java
+327
-2
java/jpwr/jopg/src/GlowDimensionD.java
java/jpwr/jopg/src/GlowDimensionD.java
+42
-0
java/jpwr/jopg/src/GlowNodeClass.java
java/jpwr/jopg/src/GlowNodeClass.java
+15
-5
java/jpwr/jopg/src/Graph.java
java/jpwr/jopg/src/Graph.java
+37
-2
java/jpwr/jopg/src/GraphIfc.java
java/jpwr/jopg/src/GraphIfc.java
+1
-0
java/jpwr/jopg/src/GrowAnnot.java
java/jpwr/jopg/src/GrowAnnot.java
+49
-5
java/jpwr/jopg/src/GrowAnnotIfc.java
java/jpwr/jopg/src/GrowAnnotIfc.java
+43
-0
java/jpwr/jopg/src/GrowFrame.java
java/jpwr/jopg/src/GrowFrame.java
+4
-1
java/jpwr/jopg/src/GrowNode.java
java/jpwr/jopg/src/GrowNode.java
+37
-2
java/jpwr/jopg/src/os_templ/hw_templ/makefile
java/jpwr/jopg/src/os_templ/hw_templ/makefile
+2
-0
No files found.
java/aapp/app/src/GraphCmn.java
View file @
3b9b1b69
...
...
@@ -112,7 +112,7 @@ public class GraphCmn implements PlowCmnIfc {
graph.gdh.getObjectRefInfoAll();
*/
graph
.
cmn
.
setNodraw
();
graph
.
ctx
.
traceScan
();
graph
.
traceScan
();
graph
.
cmn
.
resetNodraw
();
}
public
void
setCanvas
(
Canvas
canvas
)
{
...
...
java/jpwr/jopg/src/Dyn.java
View file @
3b9b1b69
...
...
@@ -467,6 +467,7 @@ public class Dyn {
public
static
final
int
eSave_ScrollingText_attribute
=
4200
;
public
static
final
int
eSave_ScrollingText_direction
=
4201
;
public
static
final
int
eSave_ScrollingText_speed
=
4202
;
public
static
final
int
eSave_ScrollingText_bounce
=
4203
;
public
static
final
int
eSave_PopupMenu_ref_object
=
5000
;
public
static
final
int
eSave_SetDig_attribute
=
5100
;
public
static
final
int
eSave_SetDig_instance
=
5101
;
...
...
@@ -652,6 +653,7 @@ public class Dyn {
public
static
final
int
eSave_Script_script_len
=
7300
;
public
static
final
int
eSave_Script_script
=
7301
;
public
static
final
int
eAnimSequence_Inherit
=
0
;
public
static
final
int
eAnimSequence_Cycle
=
1
;
public
static
final
int
eAnimSequence_Dig
=
2
;
public
static
final
int
eAnimSequence_ForwBack
=
3
;
...
...
@@ -4909,14 +4911,17 @@ public class Dyn {
String
attribute
;
int
direction
;
double
speed
;
int
bounce
;
PwrtRefId
subid
;
int
a_typeid
;
int
p
;
int
database
;
boolean
inverted
;
boolean
attrFound
=
false
;
String
oldValue
;
boolean
firstScan
=
true
;
double
offset
=
0
;
double
osize
;
public
DynScrollingText
(
Dyn
dyn
)
{
super
(
dyn
,
Dyn
.
mDynType2_ScrollingText
,
0
,
0
,
0
,
Dyn
.
eDynPrio_ScrollingText
);
}
...
...
@@ -4931,15 +4936,158 @@ public class Dyn {
public
int
connect
(
GlowArrayElem
o
)
{
GrowNode
object
=
(
GrowNode
)
o
;
DynParsedAttrName
pname
=
dyn
.
parseAttrName
(
attribute
);
if
(
pname
==
null
||
pname
.
name
.
equals
(
""
))
return
1
;
if
(
!(
pname
.
type
==
Pwr
.
eType_String
||
pname
.
type
==
Pwr
.
eType_Text
))
return
1
;
GdhrRefObjectInfo
ret
=
null
;
switch
(
pname
.
database
)
{
case
GraphIfc
.
eDatabase_Gdh
:
ret
=
dyn
.
graph
.
getGdh
().
refObjectInfo
(
pname
.
tname
);
break
;
case
GraphIfc
.
eDatabase_Local
:
ret
=
dyn
.
graph
.
getLdb
().
refObjectInfo
(
graph
,
pname
.
name
);
break
;
default
:
ret
=
null
;
}
if
(
ret
==
null
||
ret
.
evenSts
())
{
System
.
out
.
println
(
"Value: "
+
attribute
);
return
1
;
}
GlowGeometry
geom
=
object
.
measure
();
switch
(
direction
)
{
case
Glow
.
eDirection_Left
:
case
Glow
.
eDirection_Right
:
osize
=
geom
.
ur_x
-
geom
.
ll_x
;
break
;
default
:
osize
=
geom
.
ur_y
-
geom
.
ll_y
;
}
p
=
ret
.
id
;
subid
=
ret
.
refid
;
a_typeid
=
pname
.
type
;
database
=
pname
.
database
;
attrFound
=
true
;
return
1
;
}
public
void
disconnect
()
{
if
(
attrFound
&&
database
==
GraphIfc
.
eDatabase_Gdh
)
dyn
.
graph
.
getGdh
().
unrefObjectInfo
(
subid
);
}
public
void
scan
(
GlowArrayElem
o
)
{
GrowNode
object
=
(
GrowNode
)
o
;
GlowDimensionD
d
=
object
.
getAnnotationTextExtent
(
1
);
if
(
d
==
null
)
return
;
switch
(
direction
)
{
case
Glow
.
eDirection_Left
:
{
offset
-=
speed
*
dyn
.
graph
.
getAnimationScanTime
();
if
(
bounce
!=
0
)
{
if
(
d
.
width
<
osize
)
{
if
(
offset
<
0
)
{
offset
=
-
offset
;
direction
=
Glow
.
eDirection_Right
;
}
}
else
{
if
(
offset
<
osize
-
d
.
width
)
{
offset
+=
(
osize
-
d
.
width
)
-
offset
;
direction
=
Glow
.
eDirection_Right
;
}
}
}
else
{
if
(
offset
<
-
d
.
width
)
offset
=
osize
;
}
object
.
setAnnotationTextOffset
(
1
,
offset
,
0
);
break
;
}
case
Glow
.
eDirection_Right
:
{
offset
+=
speed
*
dyn
.
graph
.
getAnimationScanTime
();
if
(
bounce
!=
0
)
{
if
(
d
.
width
<
osize
)
{
if
(
offset
>
osize
-
d
.
width
)
{
offset
-=
offset
-
(
osize
-
d
.
width
);
direction
=
Glow
.
eDirection_Left
;
}
}
else
{
if
(
offset
>
0
)
{
offset
=
-
offset
;
direction
=
Glow
.
eDirection_Left
;
}
}
}
else
{
if
(
offset
>
osize
)
offset
=
-
d
.
width
;
}
object
.
setAnnotationTextOffset
(
1
,
offset
,
0
);
break
;
}
case
Glow
.
eDirection_Up
:
{
offset
+=
speed
*
dyn
.
graph
.
getAnimationScanTime
();
if
(
bounce
!=
0
)
{
if
(
offset
>
osize
-
d
.
height
)
{
offset
-=
offset
-
(
osize
-
d
.
height
);
direction
=
Glow
.
eDirection_Down
;
}
}
else
{
if
(
offset
>
osize
)
offset
=
-
d
.
height
;
}
object
.
setAnnotationTextOffset
(
1
,
0
,
offset
);
break
;
}
case
Glow
.
eDirection_Down
:
{
offset
-=
speed
*
dyn
.
graph
.
getAnimationScanTime
();
if
(
bounce
!=
0
)
{
if
(
offset
<
0
)
{
offset
=
-
offset
;
direction
=
Glow
.
eDirection_Up
;
}
}
else
{
if
(
offset
<
-
d
.
height
)
offset
=
osize
;
}
object
.
setAnnotationTextOffset
(
1
,
0
,
offset
);
break
;
}
default
:
;
}
String
value0
=
null
;
switch
(
database
)
{
case
GraphIfc
.
eDatabase_Gdh
:
value0
=
dyn
.
graph
.
getGdh
().
getObjectRefInfoString
(
p
,
a_typeid
);
break
;
case
GraphIfc
.
eDatabase_Local
:
value0
=
dyn
.
graph
.
getLdb
().
getObjectRefInfoString
(
p
,
a_typeid
);
break
;
}
if
(
firstScan
||
!
value0
.
equals
(
oldValue
))
{
object
.
setAnnotation
(
1
,
value0
);
dyn
.
repaintNow
=
true
;
oldValue
=
value0
;
}
if
(
firstScan
)
firstScan
=
false
;
}
public
void
open
(
BufferedReader
reader
)
{
...
...
@@ -4966,6 +5114,9 @@ public class Dyn {
case
Dyn
.
eSave_ScrollingText_speed
:
speed
=
new
Double
(
token
.
nextToken
()).
doubleValue
();
break
;
case
Dyn
.
eSave_ScrollingText_bounce
:
bounce
=
Integer
.
valueOf
(
token
.
nextToken
());
break
;
case
Dyn
.
eSave_End
:
end_found
=
true
;
break
;
...
...
@@ -4988,6 +5139,17 @@ public class Dyn {
public
class
DynAnimation
extends
DynElem
{
String
attribute
;
int
sequence
;
PwrtRefId
subid
;
int
p
;
int
database
;
boolean
inverted
;
boolean
attrFound
=
false
;
boolean
oldValue
;
boolean
firstScan
=
true
;
int
bitmask
;
int
a_typeid
;
int
animation_count
;
int
animation_direction
;
public
DynAnimation
(
Dyn
dyn
)
{
super
(
dyn
,
Dyn
.
mDynType1_Animation
,
0
,
0
,
0
,
Dyn
.
eDynPrio_Animation
);
...
...
@@ -4999,6 +5161,169 @@ public class Dyn {
sequence
=
x
.
sequence
;
}
public
int
connect
(
GlowArrayElem
o
)
{
GrowNode
object
=
(
GrowNode
)
o
;
DynParsedAttrName
pname
=
dyn
.
parseAttrName
(
attribute
);
if
(
pname
==
null
||
pname
.
name
.
equals
(
""
))
return
1
;
GdhrRefObjectInfo
ret
=
null
;
switch
(
pname
.
database
)
{
case
GraphIfc
.
eDatabase_Gdh
:
ret
=
dyn
.
graph
.
getGdh
().
refObjectInfo
(
pname
.
tname
);
break
;
default
:
ret
=
null
;
}
if
(
ret
==
null
||
ret
.
evenSts
())
{
System
.
out
.
println
(
"Animation: "
+
attribute
);
return
1
;
}
p
=
ret
.
id
;
subid
=
ret
.
refid
;
inverted
=
pname
.
inverted
;
a_typeid
=
pname
.
type
;
bitmask
=
pname
.
bitmask
;
database
=
pname
.
database
;
attrFound
=
true
;
System
.
out
.
println
(
"AnimSequence1: "
+
sequence
);
if
(
sequence
==
Dyn
.
eAnimSequence_Inherit
)
sequence
=
object
.
get_nodeclass_dyn_attr1
();
System
.
out
.
println
(
"AnimSequence2: "
+
sequence
);
return
1
;
}
public
void
disconnect
()
{
if
(
attrFound
&&
database
==
GraphIfc
.
eDatabase_Gdh
)
dyn
.
graph
.
getGdh
().
unrefObjectInfo
(
subid
);
}
public
void
scan
(
GlowArrayElem
o
)
{
GrowNode
object
=
(
GrowNode
)
o
;
int
max_count
;
int
sts
;
if
(
!
attrFound
)
return
;
boolean
value
=
dyn
.
getDig
(
p
,
a_typeid
,
bitmask
,
database
);
if
(
inverted
)
value
=
!
value
;
if
(
firstScan
)
{
animation_count
=
0
;
animation_direction
=
0
;
firstScan
=
false
;
if
(
sequence
==
Dyn
.
eAnimSequence_Dig
)
{
if
(
value
)
object
.
set_last_nodeclass
();
oldValue
=
value
;
}
}
if
(
sequence
==
Dyn
.
eAnimSequence_Dig
)
{
if
(
oldValue
!=
value
)
{
// Start animation
if
(
value
)
{
animation_count
=
0
;
animation_direction
=
1
;
}
else
if
(
!
value
)
{
animation_direction
=
2
;
animation_count
=
0
;
}
}
if
(
animation_direction
!=
0
)
{
max_count
=
object
.
get_animation_count
();
animation_count
++;
if
(
animation_count
>=
max_count
)
{
// Shift nodeclass
if
(
animation_direction
==
1
)
{
// Shift forward
sts
=
object
.
set_next_nodeclass
();
if
(
(
sts
&
1
)
==
0
)
{
// End of animation
animation_count
=
0
;
animation_direction
=
0
;
}
animation_count
=
0
;
}
else
{
// Shift backward
sts
=
object
.
set_previous_nodeclass
();
if
(
(
sts
&
1
)
==
0
)
{
// End of animation
animation_count
=
0
;
animation_direction
=
0
;
}
animation_count
=
0
;
}
}
}
}
else
{
if
(
value
)
{
if
(
animation_direction
==
0
)
{
// Animation has been stopped
animation_count
=
0
;
animation_direction
=
1
;
}
max_count
=
object
.
get_animation_count
();
animation_count
++;
if
(
animation_count
>=
max_count
)
{
// Shift nodeclass
if
(
animation_direction
==
1
)
{
// Shift forward
sts
=
object
.
set_next_nodeclass
();
if
((
sts
&
1
)
==
0
)
{
if
(
sequence
==
Dyn
.
eAnimSequence_Cycle
)
{
// Start from the beginning again
object
.
set_nodeclass_by_index
(
1
);
}
else
{
// Change direction
animation_direction
=
2
;
object
.
set_previous_nodeclass
();
}
}
animation_count
=
0
;
}
else
{
// Shift backward
sts
=
object
.
set_previous_nodeclass
();
if
(
(
sts
&
1
)
==
0
)
{
// Change direction
animation_direction
=
1
;
sts
=
object
.
set_next_nodeclass
();
}
animation_count
=
0
;
}
}
}
else
{
if
(
animation_direction
!=
0
)
{
// Stop and reset animation
animation_direction
=
0
;
object
.
set_first_nodeclass
();
}
}
}
oldValue
=
value
;
}
public
void
open
(
BufferedReader
reader
)
{
String
line
;
StringTokenizer
token
;
...
...
java/jpwr/jopg/src/GlowDimensionD.java
0 → 100644
View file @
3b9b1b69
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2015 SSAB EMEA 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.
*/
package
jpwr.jopg
;
public
class
GlowDimensionD
{
public
double
width
;
public
double
height
;
}
java/jpwr/jopg/src/GlowNodeClass.java
View file @
3b9b1b69
...
...
@@ -61,7 +61,7 @@ public class GlowNodeClass extends GlowArrayElem {
public
int
action_type1
;
public
int
action_type2
;
public
int
[]
dyn_color
=
new
int
[
4
];
String
[]
dyn_attr
=
new
String
[
4
];
public
int
[]
dyn_attr
=
new
int
[
4
];
GlowArrayElem
next_nc
;
GlowArrayElem
prev_nc
;
int
recursive_trace
;
...
...
@@ -125,19 +125,19 @@ public class GlowNodeClass extends GlowArrayElem {
break
;
case
Glow
.
eSave_NodeClass_dyn_attr1
:
if
(
token
.
hasMoreTokens
())
dyn_attr
[
0
]
=
token
.
nextToken
(
);
dyn_attr
[
0
]
=
Integer
.
valueOf
(
token
.
nextToken
()
);
break
;
case
Glow
.
eSave_NodeClass_dyn_attr2
:
if
(
token
.
hasMoreTokens
())
dyn_attr
[
1
]
=
token
.
nextToken
(
);
dyn_attr
[
1
]
=
Integer
.
valueOf
(
token
.
nextToken
()
);
break
;
case
Glow
.
eSave_NodeClass_dyn_attr3
:
if
(
token
.
hasMoreTokens
())
dyn_attr
[
2
]
=
token
.
nextToken
(
);
dyn_attr
[
2
]
=
Integer
.
valueOf
(
token
.
nextToken
()
);
break
;
case
Glow
.
eSave_NodeClass_dyn_attr4
:
if
(
token
.
hasMoreTokens
())
dyn_attr
[
3
]
=
token
.
nextToken
(
);
dyn_attr
[
3
]
=
Integer
.
valueOf
(
token
.
nextToken
()
);
break
;
case
Glow
.
eSave_NodeClass_java_name
:
break
;
...
...
@@ -285,4 +285,14 @@ public class GlowNodeClass extends GlowArrayElem {
;
return
base
;
}
GlowDimensionD
getAnnotationTextExtent
(
GlowTransform
t
,
Object
node
,
int
num
)
{
int
i
;
for
(
i
=
0
;
i
<
a
.
size
();
i
++)
{
if
(
a
.
get
(
i
).
type
()
==
Glow
.
eObjectType_GrowAnnot
&&
((
GrowAnnotIfc
)
a
.
get
(
i
)).
getNumber
()
==
num
)
return
((
GrowAnnotIfc
)
a
.
get
(
i
)).
getTextExtent
(
t
,
node
);
}
return
null
;
}
}
java/jpwr/jopg/src/Graph.java
View file @
3b9b1b69
...
...
@@ -51,6 +51,10 @@ public class Graph implements GraphIfc, GrowApplIfc {
public
GraphLocalDb
ldb
;
public
GrowSlider
currentSlider
;
public
double
scan_time
=
1
;
public
double
fast_scan_time
=
1
;
public
double
animation_scan_time
=
1
;
int
slow_scan_cnt
=
0
;
int
fast_scan_cnt
=
0
;
GrowCmn
[]
cmnStack
=
new
GrowCmn
[
10
];
int
cmnStackCnt
=
0
;
int
clickActive
=
0
;
...
...
@@ -87,6 +91,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
public
void
open
(
BufferedReader
reader
)
{
ctx
.
open
(
reader
);
animation_scan_time
=
ctx
.
cmn
.
animation_scantime
;
ctx
.
traceConnect
();
}
...
...
@@ -144,8 +149,32 @@ public class Graph implements GraphIfc, GrowApplIfc {
public
void
traceScan
(
GlowArrayElem
object
)
{
Dyn
dyn
=
(
Dyn
)
object
.
getUserData
();
if
(
dyn
!=
null
)
dyn
.
scan
(
object
);
if
(
dyn
==
null
)
return
;
if
(
dyn
.
cycle
==
Glow
.
eCycle_Slow
&&
slow_scan_cnt
!=
0
&&
!((
dyn
.
total_dyn_type1
&
Dyn
.
mDynType1_Animation
)
!=
0
||
(
dyn
.
total_dyn_type2
&
Dyn
.
mDynType2_ScrollingText
)
!=
0
))
return
;
if
(
dyn
.
cycle
==
Glow
.
eCycle_Fast
&&
fast_scan_cnt
!=
0
&&
!((
dyn
.
total_dyn_type1
&
Dyn
.
mDynType1_Animation
)
!=
0
||
(
dyn
.
total_dyn_type2
&
Dyn
.
mDynType2_ScrollingText
)
!=
0
))
return
;
dyn
.
scan
(
object
);
}
public
void
traceScan
()
{
ctx
.
traceScan
();
fast_scan_cnt
++;
if
(
fast_scan_cnt
>=
(
int
)(
fast_scan_time
/
animation_scan_time
+
0.5
))
fast_scan_cnt
=
0
;
slow_scan_cnt
++;
if
(
slow_scan_cnt
>=
(
int
)(
scan_time
/
animation_scan_time
+
0.5
))
slow_scan_cnt
=
0
;
}
int
stringToType
(
String
str
)
{
...
...
@@ -545,6 +574,12 @@ public class Graph implements GraphIfc, GrowApplIfc {
return
scan_time
;
}
public
double
getAnimationScanTime
()
{
if
(
scan_time
<
animation_scan_time
)
return
scan_time
;
return
animation_scan_time
;
}
public
void
setOwner
(
String
owner
)
{
cmn
.
setOwner
(
owner
);
}
...
...
java/jpwr/jopg/src/GraphIfc.java
View file @
3b9b1b69
...
...
@@ -64,6 +64,7 @@ public interface GraphIfc {
public
void
setCurrentSlider
(
GrowSlider
currentSlider
);
public
boolean
isAuthorized
(
int
access
);
public
double
getScanTime
();
public
double
getAnimationScanTime
();
public
String
getCommand
(
String
cmd
);
public
void
setClickActive
(
int
active
);
}
java/jpwr/jopg/src/GrowAnnot.java
View file @
3b9b1b69
...
...
@@ -39,7 +39,7 @@ import jpwr.rt.*;
import
java.io.*
;
import
java.util.*
;
public
class
GrowAnnot
extends
GlowArrayElem
{
public
class
GrowAnnot
extends
GlowArrayElem
implements
GrowAnnotIfc
{
GrowCmn
cmn
;
GlowPoint
p
;
int
adjustment
;
...
...
@@ -60,6 +60,14 @@ public class GrowAnnot extends GlowArrayElem {
trf
=
new
GlowTransform
();
}
public
int
type
()
{
return
Glow
.
eObjectType_GrowAnnot
;
}
public
int
getNumber
()
{
return
number
;
}
public
void
open
(
BufferedReader
reader
)
{
String
line
;
StringTokenizer
token
;
...
...
@@ -170,6 +178,8 @@ public class GrowAnnot extends GlowArrayElem {
int
color
;
int
rot
;
double
offset_x
=
0
;
double
offset_y
=
0
;
double
trf_scale
=
trf
.
vertical_scale
(
t
);
int
idx
=
(
int
)(
trf_scale
*
cmn
.
mw
.
zoom_factor_y
/
cmn
.
mw
.
base_zoom_factor
*
(
text_size
+
4
)
-
3
);
double
tsize
=
trf_scale
*
cmn
.
mw
.
zoom_factor_y
/
cmn
.
mw
.
base_zoom_factor
*
(
8
+
2
*
text_size
);
...
...
@@ -180,6 +190,11 @@ public class GrowAnnot extends GlowArrayElem {
int
lfont
;
int
ldraw_type
;
if
(
node
!=
null
&&
((
GrowNode
)
node
).
annot_scrollingtext
==
number
)
{
offset_x
=
((
GrowNode
)
node
).
annot_offset_x
;
offset_y
=
((
GrowNode
)
node
).
annot_offset_y
;
}
if
(
node
!=
null
&&
((
GrowNode
)
node
).
text_font
!=
Glow
.
eFont_No
)
{
lfont
=
((
GrowNode
)
node
).
text_font
;
ldraw_type
=
((
GrowNode
)
node
).
text_type
;
...
...
@@ -190,13 +205,13 @@ public class GrowAnnot extends GlowArrayElem {
}
if
(
t
==
null
)
{
x1
=
(
int
)(
trf
.
x
(
p
.
x
,
p
.
y
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
y1
=
(
int
)(
trf
.
y
(
p
.
x
,
p
.
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
x1
=
(
int
)(
(
trf
.
x
(
p
.
x
,
p
.
y
)
+
offset_x
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
y1
=
(
int
)(
(
trf
.
y
(
p
.
x
,
p
.
y
)
+
offset_
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
rot
=
(
int
)
trf
.
rot
();
}
else
{
x1
=
(
int
)(
trf
.
x
(
t
,
p
.
x
,
p
.
y
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
y1
=
(
int
)(
trf
.
y
(
t
,
p
.
x
,
p
.
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
x1
=
(
int
)(
(
trf
.
x
(
t
,
p
.
x
,
p
.
y
)
+
offset_x
)
*
cmn
.
mw
.
zoom_factor_x
)
-
cmn
.
mw
.
offset_x
;
y1
=
(
int
)(
(
trf
.
y
(
t
,
p
.
x
,
p
.
y
)
+
offset_
y
)
*
cmn
.
mw
.
zoom_factor_y
)
-
cmn
.
mw
.
offset_y
;
rot
=
(
int
)
trf
.
rot
(
t
);
}
rot
=
rot
<
0
?
rot
%
360
+
360
:
rot
%
360
;
...
...
@@ -331,4 +346,33 @@ public class GrowAnnot extends GlowArrayElem {
}
}
public
GlowDimensionD
getTextExtent
(
GlowTransform
t
,
Object
node
)
{
GlowDimensionD
dim
=
new
GlowDimensionD
();
if
(
((
GrowNode
)
node
).
annotv
[
number
]
==
null
||
((
GrowNode
)
node
).
annotv
[
number
].
isEmpty
())
{
dim
.
width
=
0
;
dim
.
height
=
0
;
return
dim
;
}
int
z_width
,
z_height
,
descent
;
double
trf_scale
=
trf
.
vertical_scale
(
t
);
int
idx
=
(
int
)(
trf_scale
*
cmn
.
mw
.
zoom_factor_y
/
cmn
.
mw
.
base_zoom_factor
*
(
text_size
+
4
)
-
4
);
double
tsize
=
trf_scale
*
cmn
.
mw
.
zoom_factor_y
/
cmn
.
mw
.
base_zoom_factor
*
(
8
+
2
*
text_size
);
if
(
idx
<
0
)
{
dim
.
width
=
0
;
dim
.
height
=
0
;
return
dim
;
}
idx
=
Math
.
min
(
idx
,
Glow
.
DRAW_TYPE_SIZE
-
1
);
GlowDimension
d
=
cmn
.
gdraw
.
getTextExtent
(
((
GrowNode
)
node
).
annotv
[
number
],
idx
,
font
,
draw_type
);
dim
.
width
=
(
double
)
d
.
width
/
cmn
.
mw
.
zoom_factor_x
;
dim
.
height
=
(
double
)
d
.
height
/
cmn
.
mw
.
zoom_factor_y
;
return
dim
;
}
}
java/jpwr/jopg/src/GrowAnnotIfc.java
0 → 100644
View file @
3b9b1b69
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2015 SSAB EMEA 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.
*/
package
jpwr.jopg
;
import
java.io.*
;
public
interface
GrowAnnotIfc
{
public
GlowDimensionD
getTextExtent
(
GlowTransform
t
,
Object
node
);
public
int
getNumber
();
}
java/jpwr/jopg/src/GrowFrame.java
View file @
3b9b1b69
...
...
@@ -328,6 +328,9 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
localPanel
.
addMouseListener
(
adapter
);
localPanel
.
addMouseMotionListener
(
adapter
);
scanTime
=
(
int
)
(
1000
*
graph
.
getAnimationScanTime
());
System
.
out
.
println
(
"scanTime: "
+
scanTime
);
timer
=
new
Timer
(
scanTime
,
this
);
timer
.
start
();
}
...
...
@@ -344,7 +347,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
if
(
scanCount
==
1
)
graph
.
gdh
.
getObjectRefInfoAll
();
graph
.
ctx
.
traceScan
();
graph
.
traceScan
();
localPanel
.
repaint
();
}
...
...
java/jpwr/jopg/src/GrowNode.java
View file @
3b9b1b69
...
...
@@ -96,7 +96,10 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
public
double
fill_level
=
1
;
public
int
level_fill_drawtype
;
public
int
level_color_tone
;
public
int
level_direction
;
public
int
level_direction
;
public
int
annot_scrollingtext
=
-
1
;
public
double
annot_offset_x
=
0
;
public
double
annot_offset_y
=
0
;
GrowCmn
cmn
;
...
...
@@ -415,6 +418,12 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
if
(
((
GrowNode
)
node
).
invisible
!=
0
||
invisible
!=
0
)
return
;
if
(
annot_scrollingtext
!=
-
1
)
cmn
.
gdraw
.
set_clip_rectangle
(
(
int
)(
x_left
*
cmn
.
mw
.
zoom_factor_x
-
cmn
.
mw
.
offset_x
),
(
int
)(
y_low
*
cmn
.
mw
.
zoom_factor_y
-
cmn
.
mw
.
offset_y
),
(
int
)(
x_right
*
cmn
.
mw
.
zoom_factor_x
-
cmn
.
mw
.
offset_x
),
(
int
)(
y_high
*
cmn
.
mw
.
zoom_factor_y
-
cmn
.
mw
.
offset_y
));
if
(
fill_level
==
1
)
{
if
(
t
!=
null
)
{
GlowTransform
trf_tot
=
t
.
multiply
(
trf
);
...
...
@@ -563,6 +572,8 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
}
}
if
(
annot_scrollingtext
!=
-
1
)
cmn
.
gdraw
.
reset_clip_rectangle
();
}
public
int
getClassTraceColor1
()
{
...
...
@@ -658,6 +669,18 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
public
void
setAnnotation
(
int
number
,
String
annot
)
{
annotv
[
number
]
=
annot
;
}
public
void
setAnnotationTextOffset
(
int
num
,
double
x
,
double
y
)
{
if
(
annot_scrollingtext
==
-
1
)
annot_scrollingtext
=
num
;
if
(
num
==
annot_scrollingtext
)
{
annot_offset_x
=
x
;
annot_offset_y
=
y
;
}
}
public
GlowDimensionD
getAnnotationTextExtent
(
int
num
)
{
return
nc
.
getAnnotationTextExtent
(
trf
,
this
,
num
);
}
public
void
setVisibility
(
int
visibility
)
{
switch
(
visibility
)
{
case
Glow
.
eVis_Visible
:
...
...
@@ -762,6 +785,10 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
return
0
;
}
void
set_first_nodeclass
()
{
set_root_nodeclass
();
}
void
set_last_nodeclass
()
{
GlowArrayElem
next
;
for
(
next
=
nc_root
;
...
...
@@ -800,6 +827,14 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
set_nodeclass
(
nc_root
);
}
int
get_animation_count
()
{
return
nc
.
animation_count
;
}
int
get_nodeclass_dyn_attr1
()
{
return
nc
.
dyn_attr
[
0
];
}
void
set_nodeclass
(
GlowNodeClass
new_nc
)
{
double
old_x_left
,
old_x_right
,
old_y_low
,
old_y_high
;
...
...
@@ -837,7 +872,7 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
double
x1
,
x2
,
y1
,
y2
;
double
rotation
;
// Calculate max and min
k
oordinates
// Calculate max and min
c
oordinates
x1
=
trf
.
x
(
0
,
nc
.
y0
);
y1
=
trf
.
y
(
0
,
nc
.
y0
);
...
...
java/jpwr/jopg/src/os_templ/hw_templ/makefile
View file @
3b9b1b69
...
...
@@ -26,6 +26,7 @@ local_java_sources := \
GlowPointX.java,
\
GlowPointDX.java,
\
GlowDimension.java,
\
GlowDimensionD.java,
\
GlowSliderInfo.java,
\
GlowTableInfo.java,
\
GlowMenuInfo.java,
\
...
...
@@ -47,6 +48,7 @@ local_java_sources := \
GlowEventTable.java,
\
GrowCtxIfc.java,
\
GrowCmn.java,
\
GrowAnnotIfc.java,
\
GlowNodeClass.java,
\
GlowNodeGroup.java,
\
GlowConClass.java,
\
...
...
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