Commit e41c1778 authored by claes's avatar claes

Bit type in GeDynInvisible

parent afe2116a
/*
* Proview $Id: jpwr_rt_gdh.c,v 1.12 2005-12-13 15:11:11 claes Exp $
* Proview $Id: jpwr_rt_gdh.c,v 1.13 2006-06-14 05:06:05 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -31,6 +31,11 @@
#include "co_cdh_msg.h"
#include "rt_gdh_msg.h"
// Defined in ge_graph.h...
typedef enum {
graph_eType_Bit = (1 << 15) + 1 //!< Type for a bit in a bitmask
} graph_eType;
typedef struct {
char TypeStr[32];
pwr_eType Type;
......@@ -444,6 +449,11 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_refObjectInfo
/* Extract the type and size from the suffix */
if ( gdh_ExtractNameSuffix( cstr, &suffix_p)) {
gdh_TranslateSuffixToClassData( suffix_p, &typeid, &size, &elements);
if ( typeid == graph_eType_Bit) {
char *s = strrchr( cstr, '[');
if ( s)
*s = 0;
}
}
else
{
......@@ -1489,7 +1499,8 @@ static void gdh_TranslateSuffixToClassData (
{"DELTATIME" ,pwr_eType_DeltaTime, sizeof(pwr_tDeltaTime)},
{"ATTRREF" ,pwr_eType_AttrRef, sizeof(pwr_sAttrRef)},
{"STATUS" ,pwr_eType_Status, sizeof(pwr_tStatus)},
{"NETSTATUS" ,pwr_eType_NetStatus, sizeof(pwr_tNetStatus)}
{"NETSTATUS" ,pwr_eType_NetStatus, sizeof(pwr_tNetStatus)},
{"BIT" ,graph_eType_Bit, sizeof(pwr_tBit)}
};
static const int XlationTblLen = sizeof(XlationTbl)/sizeof(XlationTbl[0]);
......
/*
* Proview $Id: GeDyn.java,v 1.8 2005-09-01 14:57:50 claes Exp $
* Proview $Id: GeDyn.java,v 1.9 2006-06-14 05:06:05 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -88,6 +88,7 @@ public class GeDyn {
public static final int eEvent_ValueChanged = 5;
public static final int eEvent_FocusLost = 6;
public static final int eType_Bit = (1 << 15) + 1;
public int dynType;
public int actionType;
......@@ -296,6 +297,8 @@ public class GeDyn {
return Pwr.eType_DeltaTime;
else if ( suffix.equalsIgnoreCase("AttrRef"))
return Pwr.eType_AttrRef;
else if ( suffix.equalsIgnoreCase("Bit"))
return GeDyn.eType_Bit;
return -1;
}
......
/*
* Proview $Id: GeDynInvisible.java,v 1.3 2005-09-01 14:57:50 claes Exp $
* Proview $Id: GeDynInvisible.java,v 1.4 2006-06-14 05:06:05 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -30,10 +30,12 @@ public class GeDynInvisible extends GeDynElem {
int p;
boolean inverted;
boolean oldValueB;
int oldValueI;
String oldValueS;
boolean firstScan = true;
boolean cmd = false;
boolean valueCmd = false;
int bitNum;
public GeDynInvisible( GeDyn dyn, String attribute, int dimmed) {
super( dyn, GeDyn.mDynType_Invisible, GeDyn.mActionType_No);
......@@ -57,6 +59,21 @@ public class GeDynInvisible extends GeDynElem {
subid = ret.refid;
typeId = ret.typeId;
inverted = GeDyndata.getAttrInverted( attribute);
if ( typeId == GeDyn.eType_Bit) {
// Get bit number from name
int i1, i2;
i1 = attrName.lastIndexOf('[');
i2 = attrName.lastIndexOf(']');
if ( i1 != -1 && i2 != -1 && i2 > i1) {
try {
bitNum = Integer.valueOf( attrName.substring( i1+1, i2));
}
catch ( NumberFormatException e) {
System.out.println( "DigInvisible: " + attrName);
attrFound = false;
}
}
}
}
}
}
......@@ -124,6 +141,28 @@ public class GeDynInvisible extends GeDynElem {
}
break;
}
case GeDyn.eType_Bit: {
int value0;
value0 = dyn.en.gdh.getObjectRefInfoInt( p);
if ( firstScan || value0 != oldValueI) {
boolean bitval = (value0 & (1 << bitNum)) != 0;
if ( ( !inverted && bitval) || ( inverted && !bitval)) {
if ( dimmed == 0)
dyn.comp.setVisibility( Ge.VISIBILITY_INVISIBLE);
else
dyn.comp.setVisibility( Ge.VISIBILITY_DIMMED);
}
else {
dyn.comp.setVisibility( Ge.VISIBILITY_VISIBLE);
}
dyn.repaintNow = true;
oldValueI = value0;
if ( firstScan)
firstScan = false;
}
break;
}
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment