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
c517727b
Commit
c517727b
authored
Jun 17, 2004
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integer attributes also supported
parent
066f5758
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
152 additions
and
54 deletions
+152
-54
java/jpwr/jop/src/GeDynIncrAnalog.java
java/jpwr/jop/src/GeDynIncrAnalog.java
+40
-12
java/jpwr/jop/src/GeDynSlider.java
java/jpwr/jop/src/GeDynSlider.java
+36
-15
src/jpwr/jop/src/GeDynIncrAnalog.java
src/jpwr/jop/src/GeDynIncrAnalog.java
+40
-12
src/jpwr/jop/src/GeDynSlider.java
src/jpwr/jop/src/GeDynSlider.java
+36
-15
No files found.
java/jpwr/jop/src/GeDynIncrAnalog.java
View file @
c517727b
...
...
@@ -31,23 +31,51 @@ public class GeDynIncrAnalog extends GeDynElem {
break
;
String
attrName
=
dyn
.
getAttrName
(
attribute
);
CdhrFloat
ret
=
dyn
.
en
.
gdh
.
getObjectInfoFloat
(
attrName
);
if
(
ret
.
evenSts
())
{
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
int
typeId
=
dyn
.
getTypeId
(
attribute
);
if
(
typeId
<
0
)
typeId
=
Pwr
.
eType_Float32
;
switch
(
typeId
)
{
case
Pwr
.
eType_Int32
:
{
CdhrInt
ret
=
dyn
.
en
.
gdh
.
getObjectInfoInt
(
attrName
);
if
(
ret
.
evenSts
())
{
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
break
;
}
ret
.
value
+=
(
int
)
increment
;
if
(
!(
min_value
==
0
&&
max_value
==
0
))
{
if
(
ret
.
value
<
(
int
)
min_value
)
ret
.
value
=
(
int
)
min_value
;
if
(
ret
.
value
>
(
int
)
max_value
)
ret
.
value
=
(
int
)
max_value
;
}
PwrtStatus
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attrName
,
ret
.
value
);
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
break
;
}
ret
.
value
+=
increment
;
if
(
!(
min_value
==
0
&&
max_value
==
0
))
{
if
(
ret
.
value
<
min_value
)
ret
.
value
=
(
float
)
min_value
;
if
(
ret
.
value
>
max_value
)
ret
.
value
=
(
float
)
max_value
;
default
:
{
CdhrFloat
ret
=
dyn
.
en
.
gdh
.
getObjectInfoFloat
(
attrName
);
if
(
ret
.
evenSts
())
{
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
break
;
}
ret
.
value
+=
increment
;
if
(
!(
min_value
==
0
&&
max_value
==
0
))
{
if
(
ret
.
value
<
min_value
)
ret
.
value
=
(
float
)
min_value
;
if
(
ret
.
value
>
max_value
)
ret
.
value
=
(
float
)
max_value
;
}
PwrtStatus
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attrName
,
ret
.
value
);
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
}
}
PwrtStatus
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attrName
,
ret
.
value
);
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
break
;
}
}
}
java/jpwr/jop/src/GeDynSlider.java
View file @
c517727b
...
...
@@ -15,7 +15,9 @@ public class GeDynSlider extends GeDynElem {
boolean
attrFound
;
PwrtRefId
subid
;
int
p
;
float
oldValue
;
public
int
typeId
;
float
oldValueF
;
int
oldValueI
;
boolean
firstScan
=
true
;
boolean
moveActive
=
false
;
Point
offset
=
new
Point
();
...
...
@@ -40,6 +42,7 @@ public class GeDynSlider extends GeDynElem {
attrFound
=
true
;
p
=
ret
.
id
;
subid
=
ret
.
refid
;
typeId
=
ret
.
typeId
;
}
}
}
...
...
@@ -51,36 +54,48 @@ public class GeDynSlider extends GeDynElem {
if
(
!
attrFound
||
moveActive
)
return
;
float
value
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
p
);
if
(
oldValue
!=
value
||
firstScan
)
{
Point
loc
=
((
JComponent
)
dyn
.
comp
).
getLocation
();
int
pos
;
float
value
;
switch
(
typeId
)
{
case
Pwr
.
eType_Int32
:
int
ivalue
=
dyn
.
en
.
gdh
.
getObjectRefInfoInt
(
p
);
if
(
oldValueI
==
ivalue
&&
!
firstScan
)
return
;
oldValueI
=
ivalue
;
value
=
(
float
)
ivalue
;
break
;
default
:
value
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
p
);
if
(
oldValueF
==
value
&&
!
firstScan
)
return
;
oldValueF
=
value
;
}
Point
loc
=
((
JComponent
)
dyn
.
comp
).
getLocation
();
int
pos
;
switch
(
direction
)
{
case
Ge
.
DIRECTION_RIGHT
:
switch
(
direction
)
{
case
Ge
.
DIRECTION_RIGHT
:
pos
=
(
int
)((
maxValue
-
value
)/(
maxValue
-
minValue
)
*
(
maxPos
-
minPos
)
+
minPos
);
loc
.
x
=
pos
;
break
;
case
Ge
.
DIRECTION_LEFT
:
case
Ge
.
DIRECTION_LEFT
:
pos
=
(
int
)(
value
/(
maxValue
-
minValue
)
*
(
maxPos
-
minPos
)
+
minPos
);
loc
.
x
=
pos
;
break
;
case
Ge
.
DIRECTION_UP
:
case
Ge
.
DIRECTION_UP
:
pos
=
(
int
)((
value
-
minValue
)/(
maxValue
-
minValue
)
*
(
maxPos
-
minPos
)
+
minPos
);
loc
.
y
=
pos
;
break
;
default
:
default
:
pos
=
(
int
)((
maxValue
-
value
)/(
maxValue
-
minValue
)
*
(
maxPos
-
minPos
)
+
minPos
);
loc
.
y
=
pos
;
}
((
JComponent
)
dyn
.
comp
).
setLocation
(
loc
);
((
JComponent
)
dyn
.
comp
).
repaint
();
}
oldValue
=
value
;
((
JComponent
)
dyn
.
comp
).
setLocation
(
loc
);
((
JComponent
)
dyn
.
comp
).
repaint
();
if
(
firstScan
)
firstScan
=
false
;
...
...
@@ -153,7 +168,13 @@ public class GeDynSlider extends GeDynElem {
}
((
JComponent
)
dyn
.
comp
).
setLocation
(
new_loc
);
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attribute
,
value
);
switch
(
typeId
)
{
case
Pwr
.
eType_Int32
:
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attribute
,
(
int
)
value
);
break
;
default
:
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attribute
,
value
);
}
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"GeSlider: "
+
sts
);
break
;
...
...
src/jpwr/jop/src/GeDynIncrAnalog.java
View file @
c517727b
...
...
@@ -31,23 +31,51 @@ public class GeDynIncrAnalog extends GeDynElem {
break
;
String
attrName
=
dyn
.
getAttrName
(
attribute
);
CdhrFloat
ret
=
dyn
.
en
.
gdh
.
getObjectInfoFloat
(
attrName
);
if
(
ret
.
evenSts
())
{
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
int
typeId
=
dyn
.
getTypeId
(
attribute
);
if
(
typeId
<
0
)
typeId
=
Pwr
.
eType_Float32
;
switch
(
typeId
)
{
case
Pwr
.
eType_Int32
:
{
CdhrInt
ret
=
dyn
.
en
.
gdh
.
getObjectInfoInt
(
attrName
);
if
(
ret
.
evenSts
())
{
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
break
;
}
ret
.
value
+=
(
int
)
increment
;
if
(
!(
min_value
==
0
&&
max_value
==
0
))
{
if
(
ret
.
value
<
(
int
)
min_value
)
ret
.
value
=
(
int
)
min_value
;
if
(
ret
.
value
>
(
int
)
max_value
)
ret
.
value
=
(
int
)
max_value
;
}
PwrtStatus
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attrName
,
ret
.
value
);
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
break
;
}
ret
.
value
+=
increment
;
if
(
!(
min_value
==
0
&&
max_value
==
0
))
{
if
(
ret
.
value
<
min_value
)
ret
.
value
=
(
float
)
min_value
;
if
(
ret
.
value
>
max_value
)
ret
.
value
=
(
float
)
max_value
;
default
:
{
CdhrFloat
ret
=
dyn
.
en
.
gdh
.
getObjectInfoFloat
(
attrName
);
if
(
ret
.
evenSts
())
{
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
break
;
}
ret
.
value
+=
increment
;
if
(
!(
min_value
==
0
&&
max_value
==
0
))
{
if
(
ret
.
value
<
min_value
)
ret
.
value
=
(
float
)
min_value
;
if
(
ret
.
value
>
max_value
)
ret
.
value
=
(
float
)
max_value
;
}
PwrtStatus
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attrName
,
ret
.
value
);
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
}
}
PwrtStatus
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attrName
,
ret
.
value
);
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"IncrAnalog "
+
attrName
);
break
;
}
}
}
src/jpwr/jop/src/GeDynSlider.java
View file @
c517727b
...
...
@@ -15,7 +15,9 @@ public class GeDynSlider extends GeDynElem {
boolean
attrFound
;
PwrtRefId
subid
;
int
p
;
float
oldValue
;
public
int
typeId
;
float
oldValueF
;
int
oldValueI
;
boolean
firstScan
=
true
;
boolean
moveActive
=
false
;
Point
offset
=
new
Point
();
...
...
@@ -40,6 +42,7 @@ public class GeDynSlider extends GeDynElem {
attrFound
=
true
;
p
=
ret
.
id
;
subid
=
ret
.
refid
;
typeId
=
ret
.
typeId
;
}
}
}
...
...
@@ -51,36 +54,48 @@ public class GeDynSlider extends GeDynElem {
if
(
!
attrFound
||
moveActive
)
return
;
float
value
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
p
);
if
(
oldValue
!=
value
||
firstScan
)
{
Point
loc
=
((
JComponent
)
dyn
.
comp
).
getLocation
();
int
pos
;
float
value
;
switch
(
typeId
)
{
case
Pwr
.
eType_Int32
:
int
ivalue
=
dyn
.
en
.
gdh
.
getObjectRefInfoInt
(
p
);
if
(
oldValueI
==
ivalue
&&
!
firstScan
)
return
;
oldValueI
=
ivalue
;
value
=
(
float
)
ivalue
;
break
;
default
:
value
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
p
);
if
(
oldValueF
==
value
&&
!
firstScan
)
return
;
oldValueF
=
value
;
}
Point
loc
=
((
JComponent
)
dyn
.
comp
).
getLocation
();
int
pos
;
switch
(
direction
)
{
case
Ge
.
DIRECTION_RIGHT
:
switch
(
direction
)
{
case
Ge
.
DIRECTION_RIGHT
:
pos
=
(
int
)((
maxValue
-
value
)/(
maxValue
-
minValue
)
*
(
maxPos
-
minPos
)
+
minPos
);
loc
.
x
=
pos
;
break
;
case
Ge
.
DIRECTION_LEFT
:
case
Ge
.
DIRECTION_LEFT
:
pos
=
(
int
)(
value
/(
maxValue
-
minValue
)
*
(
maxPos
-
minPos
)
+
minPos
);
loc
.
x
=
pos
;
break
;
case
Ge
.
DIRECTION_UP
:
case
Ge
.
DIRECTION_UP
:
pos
=
(
int
)((
value
-
minValue
)/(
maxValue
-
minValue
)
*
(
maxPos
-
minPos
)
+
minPos
);
loc
.
y
=
pos
;
break
;
default
:
default
:
pos
=
(
int
)((
maxValue
-
value
)/(
maxValue
-
minValue
)
*
(
maxPos
-
minPos
)
+
minPos
);
loc
.
y
=
pos
;
}
((
JComponent
)
dyn
.
comp
).
setLocation
(
loc
);
((
JComponent
)
dyn
.
comp
).
repaint
();
}
oldValue
=
value
;
((
JComponent
)
dyn
.
comp
).
setLocation
(
loc
);
((
JComponent
)
dyn
.
comp
).
repaint
();
if
(
firstScan
)
firstScan
=
false
;
...
...
@@ -153,7 +168,13 @@ public class GeDynSlider extends GeDynElem {
}
((
JComponent
)
dyn
.
comp
).
setLocation
(
new_loc
);
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attribute
,
value
);
switch
(
typeId
)
{
case
Pwr
.
eType_Int32
:
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attribute
,
(
int
)
value
);
break
;
default
:
sts
=
dyn
.
en
.
gdh
.
setObjectInfo
(
attribute
,
value
);
}
if
(
sts
.
evenSts
())
System
.
out
.
println
(
"GeSlider: "
+
sts
);
break
;
...
...
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