Commit c216641b authored by Claes Sjofors's avatar Claes Sjofors

Trend curves, faster and larger (refs #105)

parent 03bd1666
This diff is collapsed.
...@@ -2856,6 +2856,88 @@ int cdh_TypeToMaxStrSize( pwr_eType type, int attr_size, int attr_elements) ...@@ -2856,6 +2856,88 @@ int cdh_TypeToMaxStrSize( pwr_eType type, int attr_size, int attr_elements)
return size; return size;
} }
int cdh_TypeToSize( pwr_eType type)
{
int size;
switch( type) {
case pwr_eType_Boolean:
size = sizeof(pwr_tBoolean);
break;
case pwr_eType_Enum:
size = sizeof(pwr_tEnum);
break;
case pwr_eType_Mask:
size = sizeof(pwr_tMask);
break;
case pwr_eType_Status:
case pwr_eType_NetStatus:
size = sizeof(pwr_tStatus);
break;
case pwr_eType_Int64:
case pwr_eType_UInt64:
size = sizeof(pwr_tInt64);
break;
case pwr_eType_Int32:
case pwr_eType_UInt32:
size = sizeof(pwr_tInt32);
break;
case pwr_eType_Int16:
case pwr_eType_UInt16:
size = sizeof(pwr_tInt16);
break;
case pwr_eType_Int8:
case pwr_eType_UInt8:
size = sizeof(pwr_tInt8);
break;
case pwr_eType_Char:
size = sizeof(pwr_tChar);
break;
case pwr_eType_Float32:
size = sizeof(pwr_tFloat32);
break;
case pwr_eType_Float64:
size = sizeof(pwr_tFloat64);
break;
case pwr_eType_Time:
size = sizeof(pwr_tTime);
break;
case pwr_eType_DeltaTime:
size = sizeof(pwr_tDeltaTime);
break;
case pwr_eType_AttrRef:
size = sizeof(pwr_tAttrRef);
break;
case pwr_eType_TypeId:
size = sizeof(pwr_tTypeId);
break;
case pwr_eType_ClassId:
size = sizeof(pwr_tClassId);
break;
case pwr_eType_ObjectIx:
size = sizeof(pwr_tObjectIx);
break;
case pwr_eType_RefId:
size = sizeof(pwr_tRefId);
break;
case pwr_eType_CastId:
size = sizeof(pwr_tCastId);
break;
case pwr_eType_DisableAttr:
size = sizeof(pwr_tDisableAttr);
break;
case pwr_eType_Objid:
size = sizeof(pwr_tObjid);
break;
case pwr_eType_VolumeId:
size = sizeof(pwr_tVolumeId);
break;
default:
size = 0;
}
return size;
}
//! Convert string to valid object name. //! Convert string to valid object name.
/*! /*!
Invalid characters in the string are replaced by '_'. If the first char is invalid Invalid characters in the string are replaced by '_'. If the first char is invalid
......
...@@ -1060,6 +1060,8 @@ void cdh_SuppressSuperAll( char *out, char *in); ...@@ -1060,6 +1060,8 @@ void cdh_SuppressSuperAll( char *out, char *in);
int cdh_TypeToMaxStrSize( pwr_eType type, int attr_size, int attr_elements); int cdh_TypeToMaxStrSize( pwr_eType type, int attr_size, int attr_elements);
int cdh_TypeToSize( pwr_eType type);
char *cdh_StringToObjectName( char *t, const char *s); char *cdh_StringToObjectName( char *t, const char *s);
pwr_tStatus cdh_NextObjectName( char *t, const char *s); pwr_tStatus cdh_NextObjectName( char *t, const char *s);
......
...@@ -1308,6 +1308,20 @@ void time_Period( time_ePeriod period, pwr_tTime *from, pwr_tTime *to, pwr_tTime ...@@ -1308,6 +1308,20 @@ void time_Period( time_ePeriod period, pwr_tTime *from, pwr_tTime *to, pwr_tTime
pwr_tTime current; pwr_tTime current;
switch ( period) { switch ( period) {
case time_ePeriod_OneSecond:
if ( !center) {
time_Period( time_ePeriod_LastSecond, from, to, center, daybreak);
return;
}
time_PeriodSec( from, to, center, 1);
break;
case time_ePeriod_10Seconds:
if ( !center) {
time_Period( time_ePeriod_10Seconds, from, to, center, daybreak);
return;
}
time_PeriodSec( from, to, center, 10);
break;
case time_ePeriod_OneMinute: case time_ePeriod_OneMinute:
if ( !center) { if ( !center) {
time_Period( time_ePeriod_LastMinute, from, to, center, daybreak); time_Period( time_ePeriod_LastMinute, from, to, center, daybreak);
...@@ -1371,6 +1385,16 @@ void time_Period( time_ePeriod period, pwr_tTime *from, pwr_tTime *to, pwr_tTime ...@@ -1371,6 +1385,16 @@ void time_Period( time_ePeriod period, pwr_tTime *from, pwr_tTime *to, pwr_tTime
*to = current; *to = current;
} }
break; break;
case time_ePeriod_LastSecond:
sts = time_GetTime( to);
from->tv_sec = to->tv_sec - 1;
from->tv_nsec = to->tv_nsec;
break;
case time_ePeriod_Last10Seconds:
sts = time_GetTime( to);
from->tv_sec = to->tv_sec - 10;
from->tv_nsec = to->tv_nsec;
break;
case time_ePeriod_LastMinute: case time_ePeriod_LastMinute:
sts = time_GetTime( to); sts = time_GetTime( to);
from->tv_sec = to->tv_sec - 60; from->tv_sec = to->tv_sec - 60;
...@@ -1479,6 +1503,24 @@ void time_PreviousPeriod( time_ePeriod period, pwr_tTime *prev_from, pwr_tTime * ...@@ -1479,6 +1503,24 @@ void time_PreviousPeriod( time_ePeriod period, pwr_tTime *prev_from, pwr_tTime *
{ {
switch ( period) { switch ( period) {
case time_ePeriod_OneSecond:
case time_ePeriod_LastSecond:
*to = *from = *prev_from;
from->tv_sec -= 1;
if ( from->tv_sec < 0) {
from->tv_sec = 0;
to->tv_sec = 1;
}
break;
case time_ePeriod_10Seconds:
case time_ePeriod_Last10Seconds:
*to = *from = *prev_from;
from->tv_sec -= 10;
if ( from->tv_sec < 0) {
from->tv_sec = 0;
to->tv_sec = 10;
}
break;
case time_ePeriod_OneMinute: case time_ePeriod_OneMinute:
case time_ePeriod_LastMinute: case time_ePeriod_LastMinute:
*to = *from = *prev_from; *to = *from = *prev_from;
...@@ -1574,6 +1616,26 @@ void time_NextPeriod( time_ePeriod period, pwr_tTime *prev_from, pwr_tTime *prev ...@@ -1574,6 +1616,26 @@ void time_NextPeriod( time_ePeriod period, pwr_tTime *prev_from, pwr_tTime *prev
sts = time_GetTime( &current); sts = time_GetTime( &current);
switch ( period) { switch ( period) {
case time_ePeriod_OneSecond:
case time_ePeriod_LastSecond:
*to = *from = *prev_to;
to->tv_sec += 1;
if ( time_Acomp( &current, to) != 1) {
*to = current;
from->tv_sec = current.tv_sec - 1;
from->tv_nsec = current.tv_nsec;
}
break;
case time_ePeriod_10Seconds:
case time_ePeriod_Last10Seconds:
*to = *from = *prev_to;
to->tv_sec += 10;
if ( time_Acomp( &current, to) != 1) {
*to = current;
from->tv_sec = current.tv_sec - 10;
from->tv_nsec = current.tv_nsec;
}
break;
case time_ePeriod_OneMinute: case time_ePeriod_OneMinute:
case time_ePeriod_LastMinute: case time_ePeriod_LastMinute:
*to = *from = *prev_to; *to = *from = *prev_to;
...@@ -1671,6 +1733,14 @@ int time_PeriodZoomIn( time_ePeriod *period) ...@@ -1671,6 +1733,14 @@ int time_PeriodZoomIn( time_ePeriod *period)
{ {
int changed = 1; int changed = 1;
switch( *period) { switch( *period) {
case time_ePeriod_Last10Seconds:
case time_ePeriod_10Seconds:
*period = time_ePeriod_OneSecond;
break;
case time_ePeriod_LastMinute:
case time_ePeriod_OneMinute:
*period = time_ePeriod_10Seconds;
break;
case time_ePeriod_Last10Minutes: case time_ePeriod_Last10Minutes:
case time_ePeriod_10Minutes: case time_ePeriod_10Minutes:
*period = time_ePeriod_OneMinute; *period = time_ePeriod_OneMinute;
...@@ -1712,6 +1782,14 @@ int time_PeriodZoomOut( time_ePeriod *period) ...@@ -1712,6 +1782,14 @@ int time_PeriodZoomOut( time_ePeriod *period)
int changed = 1; int changed = 1;
switch( *period) { switch( *period) {
case time_ePeriod_OneSecond:
case time_ePeriod_LastSecond:
*period = time_ePeriod_10Seconds;
break;
case time_ePeriod_Last10Seconds:
case time_ePeriod_10Seconds:
*period = time_ePeriod_OneMinute;
break;
case time_ePeriod_OneMinute: case time_ePeriod_OneMinute:
case time_ePeriod_LastMinute: case time_ePeriod_LastMinute:
*period = time_ePeriod_10Minutes; *period = time_ePeriod_10Minutes;
......
...@@ -95,6 +95,8 @@ typedef enum { ...@@ -95,6 +95,8 @@ typedef enum {
typedef enum { typedef enum {
time_ePeriod_, time_ePeriod_,
time_ePeriod_UserDefined, time_ePeriod_UserDefined,
time_ePeriod_OneSecond,
time_ePeriod_10Seconds,
time_ePeriod_OneMinute, time_ePeriod_OneMinute,
time_ePeriod_10Minutes, time_ePeriod_10Minutes,
time_ePeriod_OneHour, time_ePeriod_OneHour,
...@@ -102,6 +104,8 @@ typedef enum { ...@@ -102,6 +104,8 @@ typedef enum {
time_ePeriod_OneWeek, time_ePeriod_OneWeek,
time_ePeriod_OneMonth, time_ePeriod_OneMonth,
time_ePeriod_OneYear, time_ePeriod_OneYear,
time_ePeriod_LastSecond,
time_ePeriod_Last10Seconds,
time_ePeriod_LastMinute, time_ePeriod_LastMinute,
time_ePeriod_Last10Minutes, time_ePeriod_Last10Minutes,
time_ePeriod_LastHour, time_ePeriod_LastHour,
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#include "rt_subc.h" #include "rt_subc.h"
#include "rt_sanc.h" #include "rt_sanc.h"
#include "rt_dl.h" #include "rt_dl.h"
#include "pwr_baseclasses.h"
#if defined(OS_ELN) #if defined(OS_ELN)
/* For ELN and Lynx , the 'gdh_Lock' code also takes out a mutex lock /* For ELN and Lynx , the 'gdh_Lock' code also takes out a mutex lock
...@@ -5049,3 +5050,239 @@ pwr_tStatus gdh_GetNextSubClass( pwr_tCid cid, pwr_tCid psubcid, pwr_tCid *subci ...@@ -5049,3 +5050,239 @@ pwr_tStatus gdh_GetNextSubClass( pwr_tCid cid, pwr_tCid psubcid, pwr_tCid *subci
return GDH__NOSUCHCLASS; return GDH__NOSUCHCLASS;
} }
pwr_tStatus
gdh_GetCircBuffInfo (
gdh_sCircBuffInfo *info,
int infosize
)
{
pwr_tStatus sts = GDH__SUCCESS;
mvol_sAttribute attribute;
mvol_sAttribute *ap;
pwr_sClass_CircBuffHeader *hp;
char *datap;
int split = 0;
int start_idx;
int first_index, last_index;
int samples;
int j;
memset(&attribute, 0, sizeof(attribute));
gdh_Lock;
for ( j = 0; j < infosize; j++) {
while ( 1) {
ap = vol_ArefToAttribute(&sts, &attribute, &info[j].circ_aref, gdb_mLo_global, vol_mTrans_all);
if (ap == NULL || ap->op == NULL) break;
touchObject(ap->op);
samples = info[j].samples;
hp = vol_AttributeToAddress(&sts, ap);
if (hp != NULL) {
if ( hp->FirstIndex == hp->LastIndex)
return 0;
if ( info[j].resolution <= 1) {
if ( samples > hp->Size)
samples = hp->Size;
datap = (char *)hp + pwr_AlignLW(sizeof(pwr_sClass_CircBuffHeader));
first_index = hp->FirstIndex;
last_index = hp->LastIndex;
start_idx = last_index - samples;
if ( first_index < last_index) {
if ( first_index > start_idx)
start_idx = first_index;
}
else {
if ( start_idx < 0) {
split = 1;
start_idx = hp->Size + start_idx;
if ( start_idx < first_index)
start_idx = first_index;
}
}
if ( split) {
memcpy( info[j].bufp, datap + start_idx * hp->ElementSize, (hp->Size - start_idx) * hp->ElementSize);
memcpy( info[j].bufp + (hp->Size - start_idx) * hp->ElementSize, datap, last_index * hp->ElementSize);
info[j].size = hp->Size - start_idx + last_index;
}
else {
memcpy( info[j].bufp, datap + start_idx * hp->ElementSize, (last_index - start_idx) * hp->ElementSize);
info[j].size = last_index - start_idx;
}
info[j].last_idx = last_index;
info[j].first_idx = first_index;
info[j].offset = 0;
}
else {
/* Resolution > 0 */
int elements;
char *dp, *bp;
int i;
int idx, tst_first_idx;
if ( samples > hp->Size / info[j].resolution)
samples = hp->Size / info[j].resolution;
datap = (char *)hp + pwr_AlignLW(sizeof(pwr_sClass_CircBuffHeader));
first_index = hp->FirstIndex;
last_index = hp->LastIndex;
start_idx = last_index - (samples - 1)* info[j].resolution;
tst_first_idx = first_index;
if ( first_index > last_index)
tst_first_idx -= hp->Size;
if ( start_idx < tst_first_idx)
start_idx += (tst_first_idx - start_idx)/ info[j].resolution * info[j].resolution;
elements = (last_index - start_idx) / info[j].resolution + 1;
info[j].size = elements;
info[j].offset = info[j].resolution;
if ( start_idx < 0)
start_idx += hp->Size;
bp = info[j].bufp;
idx = start_idx;
for ( i = 0; i < elements; i++) {
dp = datap + idx * hp->ElementSize;
memcpy( bp, dp, hp->ElementSize);
// printf( "sp1: %d\n", idx);
bp += hp->ElementSize;
idx += info[j].resolution;
if ( idx >= hp->Size)
idx -= hp->Size;
}
info[j].last_idx = last_index;
info[j].first_idx = first_index;
}
sts = GDH__SUCCESS;
}
else
sts = 0;
break;
}
gdh_Unlock;
}
return sts;
}
pwr_tStatus
gdh_UpdateCircBuffInfo (
gdh_sCircBuffInfo *info,
int infosize
)
{
pwr_tStatus sts = GDH__SUCCESS;
mvol_sAttribute attribute;
mvol_sAttribute *ap;
pwr_sClass_CircBuffHeader *hp;
char *datap;
int split = 0;
int start_idx;
int first_index, last_index;
int j;
memset(&attribute, 0, sizeof(attribute));
for ( j = 0; j < infosize; j++) {
gdh_Lock;
while ( 1) {
ap = vol_ArefToAttribute(&sts, &attribute, &info[j].circ_aref, gdb_mLo_global, vol_mTrans_all);
if (ap == NULL || ap->op == NULL) break;
touchObject(ap->op);
hp = vol_AttributeToAddress(&sts, ap);
if (hp != NULL) {
if ( hp->FirstIndex == hp->LastIndex) {
info[j].size = 0;
break;
}
if ( info[j].resolution <= 1) {
datap = (char *)hp + pwr_AlignLW(sizeof(pwr_sClass_CircBuffHeader));
first_index = info[j].last_idx;
last_index = hp->LastIndex;
start_idx = last_index - info[j].samples;
if ( first_index < last_index) {
if ( first_index > start_idx)
start_idx = first_index;
}
else {
if ( start_idx < 0) {
split = 1;
start_idx = hp->Size + start_idx;
if ( start_idx < first_index)
start_idx = first_index;
}
}
if ( split) {
memcpy( info[j].bufp, datap + start_idx * hp->ElementSize, (hp->Size - start_idx) * hp->ElementSize);
memcpy( info[j].bufp + (hp->Size - start_idx) * hp->ElementSize, datap, last_index * hp->ElementSize);
info[j].size = hp->Size - start_idx + last_index;
}
else {
memcpy( info[j].bufp, datap + start_idx * hp->ElementSize, (last_index - start_idx) * hp->ElementSize);
info[j].size = last_index - start_idx;
}
info[j].last_idx = last_index;
info[j].first_idx = first_index;
info[j].offset = 0;
}
else {
/* Resolution > 1 */
int elements;
char *dp;
int i;
int tst_idx;
datap = (char *)hp + pwr_AlignLW(sizeof(pwr_sClass_CircBuffHeader));
first_index = hp->FirstIndex;
last_index = hp->LastIndex;
tst_idx = last_index;
if ( tst_idx < info[j].last_idx)
tst_idx += hp->Size;
start_idx = info[j].last_idx + info[j].offset;
if ( start_idx > tst_idx) {
info[j].size = 0;
break;
}
elements = (tst_idx - start_idx) / info[j].resolution + 1;
info[j].offset = info[j].resolution - (tst_idx - start_idx - (elements - 1) * info[j].resolution);
if ( start_idx >= hp->Size)
start_idx -= hp->Size;
if ( elements > info[j].samples)
elements = info[j].samples;
info[j].size = elements;
for ( i = 0; i < elements; i++) {
dp = datap + start_idx * hp->ElementSize;
memcpy( info[j].bufp + i * hp->ElementSize, dp, hp->ElementSize);
// printf( "%d idx: %d %5.2f el:%d off:%d lidx: prev %d curr %d\n", i, start_idx, *(float *)dp, elements, info[j].offset, info[j].last_idx, last_index);
start_idx += info[j].resolution;
if ( start_idx >= hp->Size)
start_idx -= hp->Size;
}
info[j].last_idx = last_index;
info[j].first_idx = first_index;
}
sts = GDH__SUCCESS;
}
else
sts = 0;
break;
}
gdh_Unlock;
}
return sts;
}
...@@ -170,6 +170,20 @@ typedef struct { ...@@ -170,6 +170,20 @@ typedef struct {
} gdh_sBitDef; } gdh_sBitDef;
/**
* Circular buffer argument structure
*/
typedef struct {
pwr_sAttrRef circ_aref; /**< Attribute reference to circular buffer object */
unsigned int resolution; /**< Resolution of return data */
unsigned int samples; /**< number of data values */
void *bufp; /**< Data buffer that receives the requested information */
unsigned int bufsize; /**< The size in bytes of the data buffer */
unsigned int size; /**< Number of returned values */
unsigned int first_idx; /**< First index, this has to be saved to the next call */
unsigned int last_idx; /**< Last index, this has to be saved to the next call */
unsigned int offset; /**< Index offset to use in the next call */
} gdh_sCircBuffInfo;
/* GDH entrypoints (as function prototypes). */ /* GDH entrypoints (as function prototypes). */
...@@ -801,6 +815,18 @@ gdh_SetObjectReadOnly( ...@@ -801,6 +815,18 @@ gdh_SetObjectReadOnly(
pwr_tOid oid pwr_tOid oid
); );
pwr_tStatus
gdh_GetCircBuffInfo (
gdh_sCircBuffInfo *info,
int infosize
);
pwr_tStatus
gdh_UpdateCircBuffInfo (
gdh_sCircBuffInfo *info,
int infosize
);
/* Undocumented functions. For internal use only. */ /* Undocumented functions. For internal use only. */
pwr_tStatus pwr_tStatus
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 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.
!
! pwrb_c_a_circbuffheader.wb_load -- Defines the class CircBuffHead.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Header for circular buffer
! Header for circular buffer.
!
! This class is used as a header for a circular buffer object.
!*/
Object CircBuffHeader $ClassDef 594
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr PopEditor = 1
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "CircBuffHeader"
EndBody
!/**
! Index of the oldest elements.
!*/
Object FirstIndex $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
EndBody
EndObject
!/**
! Index of the last inserted element.
!*/
Object LastIndex $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
EndBody
EndObject
!/**
! Maximum number of elements in the buffer.
!*/
Object Size $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Element size in bytes.
!*/
Object ElementSize $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
EndObject
EndSObject
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 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.
!
! pwrb_c_circbuff1000.wb_load -- Defines the class CircBuff1000.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Circular buffer with buffer size 1000 byte
! Circular buffer with buffer size 1000 byte.
!*/
Object CircBuff1000 $ClassDef 595
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr PopEditor = 1
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "CircBuff1000"
EndBody
!/**
! Buffer header.
!*/
Object Head $Attribute 1
Body SysBody
Attr TypeRef = "pwrb:Class-CircBuffHeader"
Attr Flags |= PWR_MASK_CLASS
EndBody
EndObject
!/**
! Data buffer.
!*/
Object Data $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Elements = 250
EndBody
EndObject
EndObject
Object Template CircBuff1000
Body RtBody
Attr Head.Size = 250
Attr Head.ElementSize = 4
EndBody
EndObject
EndObject
EndSObject
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 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.
!
! pwrb_c_circbuff100k.wb_load -- Defines the class CircBuff100k.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Circular buffer with buffer size 100kB
! Circular buffer with buffer size 100kB.
!*/
Object CircBuff100k $ClassDef 598
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr PopEditor = 1
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "CircBuff100k"
EndBody
!/**
! Buffer header.
!*/
Object Head $Attribute 1
Body SysBody
Attr TypeRef = "pwrb:Class-CircBuffHeader"
Attr Flags |= PWR_MASK_CLASS
EndBody
EndObject
!/**
! Data buffer.
!*/
Object Data $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Elements = 25000
EndBody
EndObject
EndObject
Object Template CircBuff100k
Body RtBody
Attr Head.Size = 25000
Attr Head.ElementSize = 4
EndBody
EndObject
EndObject
EndSObject
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 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.
!
! pwrb_c_circbuff10k.wb_load -- Defines the class CircBuff10k.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Circular buffer with buffer size 10kB
! Circular buffer with buffer size 10kB.
!*/
Object CircBuff10k $ClassDef 596
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr PopEditor = 1
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "CircBuff10k"
EndBody
!/**
! Buffer header.
!*/
Object Head $Attribute 1
Body SysBody
Attr TypeRef = "pwrb:Class-CircBuffHeader"
Attr Flags |= PWR_MASK_CLASS
EndBody
EndObject
!/**
! Data buffer.
!*/
Object Data $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Elements = 2500
EndBody
EndObject
EndObject
Object Template CircBuff10k
Body RtBody
Attr Head.Size = 2500
Attr Head.ElementSize = 4
EndBody
EndObject
EndObject
EndSObject
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 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.
!
! pwrb_c_circbuff10k.wb_load -- Defines the class CircBuff10k.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Circular buffer with buffer size 200kB
! Circular buffer with buffer size 200kB.
!*/
Object CircBuff200k $ClassDef 599
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr PopEditor = 1
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "CircBuff200k"
EndBody
!/**
! Buffer header.
!*/
Object Head $Attribute 1
Body SysBody
Attr TypeRef = "pwrb:Class-CircBuffHeader"
Attr Flags |= PWR_MASK_CLASS
EndBody
EndObject
!/**
! Data buffer.
!*/
Object Data $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Elements = 50000
EndBody
EndObject
EndObject
Object Template CircBuff200k
Body RtBody
Attr Head.Size = 50000
Attr Head.ElementSize = 4
EndBody
EndObject
EndObject
EndSObject
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 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.
!
! pwrb_c_circbuff10k.wb_load -- Defines the class CircBuff10k.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Circular buffer with buffer size 20kB
! Circular buffer with buffer size 20kB.
!*/
Object CircBuff20k $ClassDef 597
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr PopEditor = 1
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "CircBuff20k"
EndBody
!/**
! Buffer header.
!*/
Object Head $Attribute 1
Body SysBody
Attr TypeRef = "pwrb:Class-CircBuffHeader"
Attr Flags |= PWR_MASK_CLASS
EndBody
EndObject
!/**
! Data buffer.
!*/
Object Data $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Elements = 5000
EndBody
EndObject
EndObject
Object Template CircBuff20k
Body RtBody
Attr Head.Size = 5000
Attr Head.ElementSize = 4
EndBody
EndObject
EndObject
EndSObject
...@@ -81,7 +81,7 @@ SObject pwrb:Class ...@@ -81,7 +81,7 @@ SObject pwrb:Class
!*/ !*/
Object ScanTime $Attribute 1 Object ScanTime $Attribute 1
Body SysBody Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32" Attr TypeRef = "pwrs:Type-$Float32"
EndBody EndBody
EndObject EndObject
EndObject EndObject
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 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.
!
! pwrb_c_dstrendcurve.wb_load -- Defines the class DsTrendCurve.
!
SObject pwrb:Class
!/**
! @Version 1.0
! Stores data for a fast graph à la storage oscilloscope.
!
! In one DsFastCurve object, up to 10 attributes can be specified.
! The storage of the attributes will be trigger by the same event,
! stored with the same frequency, and the curves will be plotted
! in the same fastcurve window.
!
! The names of the attributes is specified the the Attribute array.
! For every attribute, a storage area object also has to be specified.
! An attribute may be referred to by several different DsTrendCurve
! objects, for example to store at different frequencies.
!
! The sampling rate is specified the the ScanTime attribute.
! The sampling will start when a trigger event is detected. In some
! cases, when data before the trigger event is valid, the sampling will
! go on even before the trigger event.
!
! @b Storage arrays
! Storage arrays has to be supplied by the user, one array for the time axis data, and
! one for each configured attribute. For example, Buff1440, Buff4096 or Buff32k objects
! can be used for the data storage. These will store up to 360, 1024 resp. 8192 points of
! pwr_tFloat32 attributes.
!
! @b Data types
! The datatypes that can be stored is
! - pwr_tFloat32, pwr_tFloat64
! - pwr_tInt32, pwr_tUInt32, pwr_tInt16, pwr_tUInt16, pwr_tInt8, pwr_tUInt8
!
! The time is stored as pwr_tFloat32.
!
! @b Server
! DsTrendCurve objects is handled by the fast server rt_trend.
! The base frequency for the fast server process is configured in
! the DsTrendConf object.
!
! @b Se also
! @classlink Buff1440 ssab_buff1440.html
! @classlink Buff4096 ssab_buff4096.html
! @classlink Buff32k ssab_buff32k.html
! @classlink DsFastConf pwrb_dsfastconf.html
!*/
Object DsTrendCurve $ClassDef 593
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "DsTrendCurve"
EndBody
!/**
! Optional text.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Title of the trend window.
!*/
Object Title $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! @Summary Trend function.
! Bitmask for trend function.
! - UserStorage 1 Data inserted by user.
!*/
Object Function $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Mask"
Attr Flags |= PWR_MASK_BACKUP
EndBody
EndObject
!/**
! Scantime in seconds. Multiple of the base scantime configured in DsTrendConf object.
!*/
Object ScanTime $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_BACKUP
EndBody
EndObject
!/**
! Stores measurants data types. It has to be of any of
! the types pwr_tBoolean, pwr_tFloat32, pwr_tFloat64,
! pwr_tInt8, pwr_tInt16, pwr_tInt32, pwr_tUInt8,
! pwr_tUInt16, or pwr_tUInt32.
!*/
Object AttributeType $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$TypeId"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_ARRAY
Attr Elements = 10
EndBody
EndObject
!/**
! The complete name of analog sampled attributes, for
! example PROC1-TEMP1.ActualValue. The attributes have to
! be represented by local objects.
!*/
Object Attribute $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
Attr Flags |= PWR_MASK_ARRAY
Attr Elements = 10
EndBody
EndObject
!/**
! @Summary Data buffers. Array attributes that contains the data of the curves.
! Data buffers. Array attributes that contains the data of the curves.
! Objects for the databuffers has to be configured by the user. The extent of the
! buffer attributes should equal or exceed the storeage size, i.e. the size of the
! sampled attribute's type multiplied by NoOfPoints.
!*/
Object Buffers $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
Attr Flags |= PWR_MASK_ARRAY
Attr Elements = 10
EndBody
EndObject
!/**
! @Summary Time buffer. An array attribute that contain the time axis data for the curves.
! Time buffer. An array attribute that contain the time axis data for the curves.
! The object for the time buffer has to be configured by the user. The extent of the
! buffer attributes should equal or exceed the storeage size for the time data.
!*/
Object TimeBuffer $Attribute 8
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
EndBody
EndObject
!/**
! Resolution of time scale, seconds or nanoseconds.
! Seconds will require 4 bytes per point, and nanoseconds 8 bytes per point.
!*/
Object TimeResolution $Attribute 16
Body SysBody
Attr TypeRef = "pwrb:Type-TimeResolutionEnum"
EndBody
EndObject
!/**
! Length, in seconds, of the storage. If the time
! exceeds what is possible to store in DataBuffer, the
! storage is stopped when DataBuffer has been filled.
!*/
Object StorageTime $Attribute 9
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Length, in seconds, of the storage that is displayed
! in the trend window.
!*/
Object DisplayTime $Attribute 13
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Length, in seconds, of the storage that is displayed
! in the trend window.
!*/
Object DisplayResolution $Attribute 14
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Time between updates of the curve display in seconds.
!*/
Object DisplayUpdateTime $Attribute 15
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Number of samples.
!*/
Object NoOfSample $Attribute 10
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
!/**
! Specifies the first element in the data buffer with valid data.
!*/
Object FirstIndex $Attribute 11
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
!/**
! Specifies the last element in the data buffer with valid data.
!*/
Object LastIndex $Attribute 12
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject
Object Template DsTrendCurve
Body RtBody
Attr ScanTime = 1
Attr StorageTime = 200
Attr DisplayTime = 200
Attr DisplayResolution = 1
Attr DisplayUpdateTime = 1
EndBody
EndObject
EndObject
EndSObject
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 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.
!
! pwrb_td_timeresolutionenum.wb_load -- Defines the enum type TimeResolution
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Enumeration for time resolution
!*/
Object TimeResolutionEnum $TypeDef 64
Body SysBody
Attr TypeRef = "pwrs:Type-$Enum"
Attr PgmName = "TimeResolutionEnum"
EndBody
!/**
! Second.
!*/
Object Second $Value
Body SysBody
Attr PgmName = "Second"
Attr Text = "Second"
Attr Value = 0
EndBody
EndObject
!/**
! Nanosecond.
!*/
Object Nanosecond $Value
Body SysBody
Attr PgmName = "Nanosecond"
Attr Text = "Nanosecond"
Attr Value = 1
EndBody
EndObject
EndObject
EndSObject
...@@ -369,11 +369,13 @@ void Xtt::activate_opengraph() ...@@ -369,11 +369,13 @@ void Xtt::activate_opengraph()
if ( cdh_tidIsCid( classid)) { if ( cdh_tidIsCid( classid)) {
switch ( classid) { switch ( classid) {
case pwr_cClass_DsTrend: case pwr_cClass_DsTrend:
case pwr_cClass_DsTrendCurve:
// Open trend // Open trend
sprintf( cmd, "open trend /name=%s /title=\"%s\"", vname, name); sprintf( cmd, "open trend /name=%s /title=\"%s\"", vname, name);
xnav->command( cmd); xnav->command( cmd);
return; return;
case pwr_cClass_DsFast: case pwr_cClass_DsFast:
case pwr_cClass_DsFastCurve:
// Open fast // Open fast
sprintf( cmd, "open fast /name=%s /title=\"%s\"", vname, name); sprintf( cmd, "open fast /name=%s /title=\"%s\"", vname, name);
xnav->command( cmd); xnav->command( cmd);
...@@ -398,11 +400,13 @@ void Xtt::activate_opengraph() ...@@ -398,11 +400,13 @@ void Xtt::activate_opengraph()
switch ( classid) { switch ( classid) {
case pwr_cClass_DsTrend: case pwr_cClass_DsTrend:
case pwr_cClass_DsTrendCurve:
// Open trend // Open trend
sprintf( cmd, "open trend /name=%s /title=\"%s\"", vname, name); sprintf( cmd, "open trend /name=%s /title=\"%s\"", vname, name);
xnav->command( cmd); xnav->command( cmd);
return; return;
case pwr_cClass_DsFast: case pwr_cClass_DsFast:
case pwr_cClass_DsFastCurve:
// Open fast // Open fast
sprintf( cmd, "open fast /name=%s /title=\"%s\"", vname, name); sprintf( cmd, "open fast /name=%s /title=\"%s\"", vname, name);
xnav->command( cmd); xnav->command( cmd);
......
...@@ -73,6 +73,8 @@ typedef struct { ...@@ -73,6 +73,8 @@ typedef struct {
} ge_sTimeComboText; } ge_sTimeComboText;
ge_sTimeComboText curve_timecombo_text[] = { ge_sTimeComboText curve_timecombo_text[] = {
{"One Second", time_ePeriod_OneSecond},
{"10 Seconds", time_ePeriod_10Seconds},
{"One Minute", time_ePeriod_OneMinute}, {"One Minute", time_ePeriod_OneMinute},
{"10 Minutes", time_ePeriod_10Minutes}, {"10 Minutes", time_ePeriod_10Minutes},
{"One Hour", time_ePeriod_OneHour}, {"One Hour", time_ePeriod_OneHour},
...@@ -308,6 +310,13 @@ void GeCurveGtk::activate_xlimits( GtkWidget *w, gpointer data) ...@@ -308,6 +310,13 @@ void GeCurveGtk::activate_xlimits( GtkWidget *w, gpointer data)
curve->open_minmax(0); curve->open_minmax(0);
} }
void GeCurveGtk::activate_snapshot( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
curve->activate_snapshot();
}
void GeCurveGtk::activate_export( GtkWidget *w, gpointer data) void GeCurveGtk::activate_export( GtkWidget *w, gpointer data)
{ {
GeCurve *curve = (GeCurve *)data; GeCurve *curve = (GeCurve *)data;
...@@ -447,6 +456,11 @@ void GeCurveGtk::enable_export() ...@@ -447,6 +456,11 @@ void GeCurveGtk::enable_export()
g_object_set( menu_export, "visible", TRUE, NULL); g_object_set( menu_export, "visible", TRUE, NULL);
} }
void GeCurveGtk::enable_snapshot()
{
g_object_set( menu_snapshot, "visible", TRUE, NULL);
}
void GeCurveGtk::pop() void GeCurveGtk::pop()
{ {
gtk_window_present( GTK_WINDOW(toplevel)); gtk_window_present( GTK_WINDOW(toplevel));
...@@ -674,6 +688,11 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx, ...@@ -674,6 +688,11 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
menu_export = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Export")); menu_export = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Export"));
g_signal_connect(menu_export, "activate", G_CALLBACK(activate_export), this); g_signal_connect(menu_export, "activate", G_CALLBACK(activate_export), this);
menu_snapshot = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Snapshot"));
g_signal_connect(menu_snapshot, "activate", G_CALLBACK(activate_snapshot), this);
gtk_widget_add_accelerator( menu_snapshot, "activate", accel_g,'n',
GdkModifierType(GDK_CONTROL_MASK), GTK_ACCEL_VISIBLE);
GtkWidget *file_close = gtk_image_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Close")); GtkWidget *file_close = gtk_image_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Close"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(file_close), gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(file_close),
gtk_image_new_from_stock( "gtk-close", GTK_ICON_SIZE_MENU)); gtk_image_new_from_stock( "gtk-close", GTK_ICON_SIZE_MENU));
...@@ -684,6 +703,7 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx, ...@@ -684,6 +703,7 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
GtkMenu *file_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL); GtkMenu *file_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_refresh); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_refresh);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu_snapshot);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu_export); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu_export);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
...@@ -962,6 +982,7 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx, ...@@ -962,6 +982,7 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
gtk_paned_set_position( GTK_PANED(vpaned1), names_height); gtk_paned_set_position( GTK_PANED(vpaned1), names_height);
gtk_paned_set_position( GTK_PANED(vpaned2), window_height - names_height - nav_height - 50); gtk_paned_set_position( GTK_PANED(vpaned2), window_height - names_height - nav_height - 50);
g_object_set( sea_timebox, "visible", FALSE, NULL); g_object_set( sea_timebox, "visible", FALSE, NULL);
g_object_set( menu_snapshot, "visible", FALSE, NULL);
g_object_set( menu_export, "visible", FALSE, NULL); g_object_set( menu_export, "visible", FALSE, NULL);
wow = new CoWowGtk( toplevel); wow = new CoWowGtk( toplevel);
......
...@@ -64,6 +64,7 @@ class GeCurveGtk : public GeCurve { ...@@ -64,6 +64,7 @@ class GeCurveGtk : public GeCurve {
GtkWidget *minmax_widget; GtkWidget *minmax_widget;
GtkWidget *minmax_textmin_widget; GtkWidget *minmax_textmin_widget;
GtkWidget *minmax_textmax_widget; GtkWidget *minmax_textmax_widget;
GtkWidget *menu_snapshot;
GtkWidget *menu_export; GtkWidget *menu_export;
GtkWidget *export_widget; GtkWidget *export_widget;
GtkWidget *export_attrcombo_widget; GtkWidget *export_attrcombo_widget;
...@@ -89,6 +90,7 @@ class GeCurveGtk : public GeCurve { ...@@ -89,6 +90,7 @@ class GeCurveGtk : public GeCurve {
void set_inputfocus(); void set_inputfocus();
void enable_timebox(); void enable_timebox();
void enable_export(); void enable_export();
void enable_snapshot();
void set_times( pwr_tTime *from, pwr_tTime *to); void set_times( pwr_tTime *from, pwr_tTime *to);
void set_times_sensitivity( int sensitive); void set_times_sensitivity( int sensitive);
pwr_tStatus get_times( pwr_tTime *from, pwr_tTime *to); pwr_tStatus get_times( pwr_tTime *from, pwr_tTime *to);
...@@ -100,6 +102,7 @@ class GeCurveGtk : public GeCurve { ...@@ -100,6 +102,7 @@ class GeCurveGtk : public GeCurve {
static void activate_exit( GtkWidget *w, gpointer data); static void activate_exit( GtkWidget *w, gpointer data);
static void activate_configure( GtkWidget *w, gpointer data); static void activate_configure( GtkWidget *w, gpointer data);
static void activate_print( GtkWidget *w, gpointer data); static void activate_print( GtkWidget *w, gpointer data);
static void activate_snapshot( GtkWidget *w, gpointer data);
static void activate_export( GtkWidget *w, gpointer data); static void activate_export( GtkWidget *w, gpointer data);
static void activate_zoomin( GtkWidget *w, gpointer data); static void activate_zoomin( GtkWidget *w, gpointer data);
static void activate_zoomout( GtkWidget *w, gpointer data); static void activate_zoomout( GtkWidget *w, gpointer data);
......
...@@ -80,6 +80,12 @@ void GeCurve::activate_configure() ...@@ -80,6 +80,12 @@ void GeCurve::activate_configure()
configure_axes(); configure_axes();
} }
void GeCurve::activate_snapshot()
{
if ( snapshot_cb)
(snapshot_cb)( parent_ctx);
}
void GeCurve::activate_export() void GeCurve::activate_export()
{ {
double ll_x, ll_y, ur_x, ur_y; double ll_x, ll_y, ur_x, ur_y;
...@@ -1168,7 +1174,7 @@ void GeCurve::redraw() ...@@ -1168,7 +1174,7 @@ void GeCurve::redraw()
grow_Redraw( growcurve_ctx); grow_Redraw( growcurve_ctx);
} }
void GeCurve::points_added() void GeCurve::points_added( unsigned int no_of_points)
{ {
int i, idx; int i, idx;
glow_sCurveData gcd; glow_sCurveData gcd;
...@@ -1217,7 +1223,7 @@ void GeCurve::points_added() ...@@ -1217,7 +1223,7 @@ void GeCurve::points_added()
gcd.rows[0] = max_index - min_index + 1; gcd.rows[0] = max_index - min_index + 1;
gcd.x_reverse = cd->x_reverse; gcd.x_reverse = cd->x_reverse;
grow_CurveAddPoints( curve_object, &gcd); grow_CurveAddPoints( curve_object, &gcd, no_of_points);
// Simulate cursormotion and slidermoved event to update markvalues // Simulate cursormotion and slidermoved event to update markvalues
glow_sEvent e; glow_sEvent e;
...@@ -1372,7 +1378,7 @@ GeCurve::GeCurve( void *gc_parent_ctx, ...@@ -1372,7 +1378,7 @@ GeCurve::GeCurve( void *gc_parent_ctx,
border_bright(glow_eDrawType_Color22), border_bright(glow_eDrawType_Color22),
cd(0), axis_window_width(0), auto_refresh(1), axis_displayed(1), cd(0), axis_window_width(0), auto_refresh(1), axis_displayed(1),
minmax_idx(0), close_cb(0), help_cb(0), increase_period_cb(0), decrease_period_cb(0), reload_cb(0), minmax_idx(0), close_cb(0), help_cb(0), increase_period_cb(0), decrease_period_cb(0), reload_cb(0),
prev_period_cb(0), next_period_cb(0), add_cb(0), remove_cb(0), export_cb(0), prev_period_cb(0), next_period_cb(0), add_cb(0), remove_cb(0), export_cb(0), snapshot_cb(0),
initial_right_position(pos_right), last_cursor_x(0), last_mark1_x(0), last_mark2_x(0), initial_right_position(pos_right), last_cursor_x(0), last_mark1_x(0), last_mark2_x(0),
deferred_configure_axes(0), center_from_window(0) deferred_configure_axes(0), center_from_window(0)
{ {
......
...@@ -170,6 +170,7 @@ class GeCurve { ...@@ -170,6 +170,7 @@ class GeCurve {
void (*add_cb)( void *); void (*add_cb)( void *);
void (*remove_cb)( void *); void (*remove_cb)( void *);
int (*export_cb)( void *, pwr_tTime *, pwr_tTime *, int, int, char *); int (*export_cb)( void *, pwr_tTime *, pwr_tTime *, int, int, char *);
void (*snapshot_cb)( void *);
int initial_right_position; int initial_right_position;
char title[300]; char title[300];
double last_cursor_x; double last_cursor_x;
...@@ -189,6 +190,7 @@ class GeCurve { ...@@ -189,6 +190,7 @@ class GeCurve {
virtual void open_export( pwr_tTime *from, pwr_tTime *to, int rows, char *filename) {} virtual void open_export( pwr_tTime *from, pwr_tTime *to, int rows, char *filename) {}
virtual void axis_set_width( int width) {} virtual void axis_set_width( int width) {}
virtual void enable_timebox() {} virtual void enable_timebox() {}
virtual void enable_snapshot() {}
virtual void enable_export() {} virtual void enable_export() {}
virtual void set_times( pwr_tTime *from, pwr_tTime *to) {} virtual void set_times( pwr_tTime *from, pwr_tTime *to) {}
virtual void set_times_sensitivity( int sensitive) {} virtual void set_times_sensitivity( int sensitive) {}
...@@ -201,7 +203,7 @@ class GeCurve { ...@@ -201,7 +203,7 @@ class GeCurve {
int configure_curves(); int configure_curves();
int configure_axes(); int configure_axes();
int config_names(); int config_names();
void points_added(); void points_added( unsigned int no_of_points);
void set_title( char *str); void set_title( char *str);
void set_time( pwr_tTime time); void set_time( pwr_tTime time);
void print( char *filename); void print( char *filename);
...@@ -209,6 +211,7 @@ class GeCurve { ...@@ -209,6 +211,7 @@ class GeCurve {
void measure_window( double *ll_x, double *ll_y, double *ur_x, double *ur_y); void measure_window( double *ll_x, double *ll_y, double *ur_x, double *ur_y);
void activate_exit(); void activate_exit();
void activate_configure(); void activate_configure();
void activate_snapshot();
void activate_export(); void activate_export();
void activate_print(); void activate_print();
void activate_background(); void activate_background();
......
...@@ -4786,9 +4786,9 @@ void grow_CurveConfigure( grow_tObject object, glow_sCurveData *data) ...@@ -4786,9 +4786,9 @@ void grow_CurveConfigure( grow_tObject object, glow_sCurveData *data)
((GrowCurve *)object)->configure_curves( data); ((GrowCurve *)object)->configure_curves( data);
} }
void grow_CurveAddPoints( grow_tObject object, glow_sCurveData *data) void grow_CurveAddPoints( grow_tObject object, glow_sCurveData *data, unsigned int no_of_points)
{ {
((GrowCurve *)object)->add_points( data); ((GrowCurve *)object)->add_points( data, no_of_points);
} }
int grow_GetObjectGroup( grow_tCtx ctx, grow_tObject object, int grow_GetObjectGroup( grow_tCtx ctx, grow_tObject object,
......
...@@ -2677,7 +2677,7 @@ extern "C" { ...@@ -2677,7 +2677,7 @@ extern "C" {
Add the new value first in all the curves, and shift the other values one step forward. Add the new value first in all the curves, and shift the other values one step forward.
*/ */
void grow_CurveAddPoints( grow_tObject object, glow_sCurveData *data); void grow_CurveAddPoints( grow_tObject object, glow_sCurveData *data, unsigned int no_of_points);
//! Get the group the specified object is a member of. //! Get the group the specified object is a member of.
/*! /*!
......
...@@ -289,26 +289,54 @@ void GrowCurve::configure_curves( glow_sCurveData *data) ...@@ -289,26 +289,54 @@ void GrowCurve::configure_curves( glow_sCurveData *data)
} }
void GrowCurve::add_points( glow_sCurveData *data) void GrowCurve::add_points( glow_sCurveData *data, unsigned int no_of_points)
{ {
if ( data->type == glow_eCurveDataType_CommonX) { if ( data->type == glow_eCurveDataType_CommonX) {
int idx;
double y_value;
// Remove old curves // Remove old curves
ctx->nodraw++; ctx->nodraw++;
for ( idx = 0; idx < curve_cnt; idx++) { if ( no_of_points == 1) {
y_value = ur.y - (data->y_data[idx][0] - y_min_value[idx]) / double y_value;
(y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y); int idx;
y_value = max( ll.y, min( y_value, ur.y)); for ( idx = 0; idx < curve_cnt; idx++) {
y_value = ur.y - (data->y_data[idx][0] - y_min_value[idx]) /
(y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y);
if ( !fill) y_value = max( ll.y, min( y_value, ur.y));
erase( &ctx->mw);
if ( !fill_curve) if ( !fill)
curve[idx]->add_and_shift_y_value( y_value); erase( &ctx->mw);
else
curve[idx]->add_and_shift_y_value_filled( y_value); if ( !fill_curve)
curve[idx]->add_and_shift_y_value( y_value);
else
curve[idx]->add_and_shift_y_value_filled( y_value);
}
}
else {
double *y_values;
int i, idx;
for ( idx = 0; idx < curve_cnt; idx++) {
y_values = (double *)calloc( 1, no_of_points * sizeof(double));
for ( i = 0; i < (int)no_of_points; i++) {
y_values[i] = ur.y - (data->y_data[idx][i] - y_min_value[idx]) /
(y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y);
y_values[i] = max( ll.y, min( y_values[i], ur.y));
}
if ( !fill)
erase( &ctx->mw);
if ( !fill_curve)
curve[idx]->add_and_shift_y_values( y_values, no_of_points);
else
curve[idx]->add_and_shift_y_values_filled( y_values, no_of_points);
free( (char *)y_values);
}
} }
ctx->nodraw--; ctx->nodraw--;
......
...@@ -96,7 +96,7 @@ class GrowCurve : public GrowTrend { ...@@ -96,7 +96,7 @@ class GrowCurve : public GrowTrend {
Add the new value first in all the curves, and shift the other values one step forward. Add the new value first in all the curves, and shift the other values one step forward.
*/ */
void add_points( glow_sCurveData *data); void add_points( glow_sCurveData *data, unsigned int no_of_points);
}; };
......
...@@ -1396,6 +1396,20 @@ void GrowPolyLine::add_and_shift_y_value( double value) ...@@ -1396,6 +1396,20 @@ void GrowPolyLine::add_and_shift_y_value( double value)
nav_zoom(); nav_zoom();
} }
void GrowPolyLine::add_and_shift_y_values( double *values, unsigned int no_of_values)
{
if ( !no_of_values)
return;
for ( unsigned int i = a_points.size() - 1; i >= no_of_values; i--)
((GlowPoint *)a_points[i])->y = ((GlowPoint *)a_points[i-no_of_values])->y;
for ( unsigned int i = 0; i < no_of_values; i++)
((GlowPoint *)a_points[i])->y = *(values + i);
zoom();
nav_zoom();
}
void GrowPolyLine::add_and_shift_y_value_filled( double value) void GrowPolyLine::add_and_shift_y_value_filled( double value)
{ {
for ( int i = a_points.size() - 2; i > 1; i--) for ( int i = a_points.size() - 2; i > 1; i--)
...@@ -1407,6 +1421,20 @@ void GrowPolyLine::add_and_shift_y_value_filled( double value) ...@@ -1407,6 +1421,20 @@ void GrowPolyLine::add_and_shift_y_value_filled( double value)
nav_zoom(); nav_zoom();
} }
void GrowPolyLine::add_and_shift_y_values_filled( double *values, unsigned int no_of_values)
{
if ( !no_of_values)
return;
for ( unsigned int i = a_points.size() - 2; i >= no_of_values + 1; i--)
((GlowPoint *)a_points[i])->y = ((GlowPoint *)a_points[i-no_of_values])->y;
for ( unsigned int i = 0; i < no_of_values; i++)
((GlowPoint *)a_points[i+1])->y = *(values + i);
zoom();
nav_zoom();
}
void GrowPolyLine::align( double x, double y, glow_eAlignDirection direction) void GrowPolyLine::align( double x, double y, glow_eAlignDirection direction)
{ {
double dx, dy; double dx, dy;
......
...@@ -539,6 +539,7 @@ class GrowPolyLine : public GlowPolyLine { ...@@ -539,6 +539,7 @@ class GrowPolyLine : public GlowPolyLine {
is inserted in the first point. The x-value are kept intact. is inserted in the first point. The x-value are kept intact.
*/ */
void add_and_shift_y_value( double value); void add_and_shift_y_value( double value);
void add_and_shift_y_values( double *values, unsigned int no_of_values);
//! Add a new y-value for the first point for a filled curve, and shift the y-values one step forward. //! Add a new y-value for the first point for a filled curve, and shift the y-values one step forward.
/*! /*!
...@@ -548,6 +549,7 @@ class GrowPolyLine : public GlowPolyLine { ...@@ -548,6 +549,7 @@ class GrowPolyLine : public GlowPolyLine {
is inserted in the first point. The x-value are kept intact. is inserted in the first point. The x-value are kept intact.
*/ */
void add_and_shift_y_value_filled( double value); void add_and_shift_y_value_filled( double value);
void add_and_shift_y_values_filled( double *values, unsigned int no_of_values);
void get_ctx( void **c) { *c = (void *)ctx;}; //!< Should be replace by get_ctx() !! void get_ctx( void **c) { *c = (void *)ctx;}; //!< Should be replace by get_ctx() !!
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 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.
*/
#include "flow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <gtk/gtk.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "rt_gdh_msg.h"
#include "co_cdh.h"
#include "co_time.h"
#include "cow_wow_gtk.h"
#include "rt_xnav_msg.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "glow_growctx.h"
#include "glow_growapi.h"
#include "glow_curvectx.h"
#include "glow_curveapi.h"
#include "xtt_xnav.h"
#include "xtt_tcurve_gtk.h"
#include "ge_curve_gtk.h"
XttTCurveGtk::XttTCurveGtk( void *parent_ctx,
GtkWidget *parent_wid,
const char *name,
GtkWidget **w,
pwr_tAttrRef *xn_arefv,
int *sts) :
XttTCurve( parent_ctx, name, xn_arefv, sts),
parent_widget(parent_wid)
{
char title[250];
strncpy(title, name, sizeof(title));
if ( EVEN(*sts))
// Error from XttTCurve
return;
*sts = XNAV__SUCCESS;
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1);
curve->close_cb = tcurve_close_cb;
curve->help_cb = tcurve_help_cb;
curve->increase_period_cb = tcurve_increase_period_cb;
curve->decrease_period_cb = tcurve_decrease_period_cb;
curve->reload_cb = tcurve_reload_cb;
curve->prev_period_cb = tcurve_prev_period_cb;
curve->next_period_cb = tcurve_next_period_cb;
curve->add_cb = tcurve_add_cb;
curve->remove_cb = tcurve_remove_cb;
curve->export_cb = tcurve_export_cb;
curve->enable_timebox();
curve->enable_export();
wow = new CoWowGtk( parent_widget);
timerid = wow->timer_new();
timerid->add( 1000, tcurve_scan, this);
}
XttTCurveGtk::~XttTCurveGtk()
{
timerid->remove();
delete curve;
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 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.
*/
#ifndef xtt_tcurve_gtk_h
#define xtt_tcurve_gtk_h
/* xtt_tcurve_gtk.h -- TCurve curves */
#ifndef xtt_tcurve_h
# include "xtt_tcurve.h"
#endif
class XttTCurveGtk : public XttTCurve {
public:
GtkWidget *parent_widget; //!< Parent widget.
XttTCurveGtk( void *xn_parent_ctx,
GtkWidget *xn_parent_wid,
const char *xn_name,
GtkWidget **w,
pwr_tAttrRef *xn_arefv,
int *sts);
~XttTCurveGtk();
};
#endif
...@@ -76,6 +76,10 @@ XttTrendGtk::XttTrendGtk( void *parent_ctx, ...@@ -76,6 +76,10 @@ XttTrendGtk::XttTrendGtk( void *parent_ctx,
curve = new GeCurveGtk( this, parent_widget, name, NULL, gcd, 1); curve = new GeCurveGtk( this, parent_widget, name, NULL, gcd, 1);
curve->close_cb = trend_close_cb; curve->close_cb = trend_close_cb;
curve->help_cb = trend_help_cb; curve->help_cb = trend_help_cb;
curve->snapshot_cb = trend_snapshot_cb;
if ( trend_tid == pwr_cClass_DsTrendCurve)
curve->enable_snapshot();
wow = new CoWowGtk( parent_widget); wow = new CoWowGtk( parent_widget);
timerid = wow->timer_new(); timerid = wow->timer_new();
......
...@@ -79,6 +79,7 @@ typedef void *Widget; ...@@ -79,6 +79,7 @@ typedef void *Widget;
#include "xtt_block_gtk.h" #include "xtt_block_gtk.h"
#include "xtt_trend_gtk.h" #include "xtt_trend_gtk.h"
#include "xtt_sevhist_gtk.h" #include "xtt_sevhist_gtk.h"
#include "xtt_tcurve_gtk.h"
#include "xtt_fast_gtk.h" #include "xtt_fast_gtk.h"
#include "xtt_xattone_gtk.h" #include "xtt_xattone_gtk.h"
#include "xtt_clog_gtk.h" #include "xtt_clog_gtk.h"
...@@ -256,6 +257,13 @@ XttSevHist *XNavGtk::xttsevhist_new( char *name, pwr_tOid *oidv, pwr_tOName *ana ...@@ -256,6 +257,13 @@ XttSevHist *XNavGtk::xttsevhist_new( char *name, pwr_tOid *oidv, pwr_tOName *ana
return new XttSevHistGtk( this, parent_wid, name, &w, oidv, anamev, onamev, sevhistobjectv, scctx, sts); return new XttSevHistGtk( this, parent_wid, name, &w, oidv, anamev, onamev, sevhistobjectv, scctx, sts);
} }
XttTCurve *XNavGtk::xtttcurve_new( char *name, pwr_tAttrRef *arefv, pwr_tStatus *sts)
{
GtkWidget *w;
return new XttTCurveGtk( this, parent_wid, name, &w, arefv, sts);
}
XttFast *XNavGtk::xttfast_new( char *name, pwr_tAttrRef *objar, pwr_tStatus *sts) XttFast *XNavGtk::xttfast_new( char *name, pwr_tAttrRef *objar, pwr_tStatus *sts)
{ {
GtkWidget *w; GtkWidget *w;
......
...@@ -80,6 +80,7 @@ class XNavGtk : public XNav { ...@@ -80,6 +80,7 @@ class XNavGtk : public XNav {
XttSevHist *xttsevhist_new( char *name, pwr_tOid *oidv, pwr_tOName *anamev, XttSevHist *xttsevhist_new( char *name, pwr_tOid *oidv, pwr_tOName *anamev,
pwr_tOName *onamev, bool *sevhistobjectv, sevcli_tCtx scctx, pwr_tOName *onamev, bool *sevhistobjectv, sevcli_tCtx scctx,
pwr_tStatus *sts); pwr_tStatus *sts);
XttTCurve *xtttcurve_new( char *name, pwr_tAttrRef *arefv, pwr_tStatus *sts);
XttFast *xttfast_new( char *name, pwr_tAttrRef *objar, pwr_tStatus *sts); XttFast *xttfast_new( char *name, pwr_tAttrRef *objar, pwr_tStatus *sts);
XAttOne *xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv, XAttOne *xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv,
pwr_tStatus *sts); pwr_tStatus *sts);
......
...@@ -295,7 +295,9 @@ static pwr_tStatus OpenTrend( xmenu_sMenuCall *ip) ...@@ -295,7 +295,9 @@ static pwr_tStatus OpenTrend( xmenu_sMenuCall *ip)
sts = gdh_GetAttrRefTid( objar, &classid); sts = gdh_GetAttrRefTid( objar, &classid);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if ( classid == pwr_cClass_DsTrend || classid == pwr_cClass_PlotGroup) { if ( classid == pwr_cClass_DsTrend ||
classid == pwr_cClass_DsTrendCurve ||
classid == pwr_cClass_PlotGroup) {
sts = gdh_AttrrefToName( &ip->Pointed, name, sizeof(name), sts = gdh_AttrrefToName( &ip->Pointed, name, sizeof(name),
cdh_mName_volumeStrict); cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -317,7 +319,9 @@ static pwr_tStatus OpenTrend( xmenu_sMenuCall *ip) ...@@ -317,7 +319,9 @@ static pwr_tStatus OpenTrend( xmenu_sMenuCall *ip)
// Default XttGraph found // Default XttGraph found
sts = gdh_GetAttrRefTid( &deftrend, &classid); sts = gdh_GetAttrRefTid( &deftrend, &classid);
if ( ODD(sts) && if ( ODD(sts) &&
(classid == pwr_cClass_DsTrend || classid == pwr_cClass_PlotGroup)) { (classid == pwr_cClass_DsTrend ||
classid == pwr_cClass_DsTrendCurve ||
classid == pwr_cClass_PlotGroup)) {
sts = gdh_AttrrefToName( &deftrend, name, sizeof(name), sts = gdh_AttrrefToName( &deftrend, name, sizeof(name),
cdh_mName_volumeStrict); cdh_mName_volumeStrict);
...@@ -340,7 +344,8 @@ static pwr_tStatus OpenTrend( xmenu_sMenuCall *ip) ...@@ -340,7 +344,8 @@ static pwr_tStatus OpenTrend( xmenu_sMenuCall *ip)
sts = gdh_GetObjectClass( child, &classid); sts = gdh_GetObjectClass( child, &classid);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if ( classid == pwr_cClass_DsTrend) { if ( classid == pwr_cClass_DsTrend ||
classid == pwr_cClass_DsTrendCurve) {
found = 1; found = 1;
break; break;
} }
...@@ -380,6 +385,7 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip) ...@@ -380,6 +385,7 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip)
switch ( cid) { switch ( cid) {
case pwr_cClass_DsTrend: case pwr_cClass_DsTrend:
case pwr_cClass_DsTrendCurve:
return XNAV__SUCCESS; return XNAV__SUCCESS;
case pwr_cClass_PlotGroup: { case pwr_cClass_PlotGroup: {
sts = gdh_AttrrefToName( objar, name, sizeof(name), sts = gdh_AttrrefToName( objar, name, sizeof(name),
...@@ -409,7 +415,9 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip) ...@@ -409,7 +415,9 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip)
// Default XttGraph found // Default XttGraph found
sts = gdh_GetAttrRefTid( &deftrend, &classid); sts = gdh_GetAttrRefTid( &deftrend, &classid);
if ( ODD(sts) && if ( ODD(sts) &&
(classid == pwr_cClass_DsTrend || classid == pwr_cClass_PlotGroup)) (classid == pwr_cClass_DsTrend ||
classid == pwr_cClass_DsTrendCurve ||
classid == pwr_cClass_PlotGroup))
return XNAV__SUCCESS; return XNAV__SUCCESS;
} }
...@@ -425,7 +433,8 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip) ...@@ -425,7 +433,8 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip)
sts = gdh_GetObjectClass( child, &classid); sts = gdh_GetObjectClass( child, &classid);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if ( classid == pwr_cClass_DsTrend) if ( classid == pwr_cClass_DsTrend ||
classid == pwr_cClass_DsTrendCurve)
return XNAV__SUCCESS; return XNAV__SUCCESS;
sts = gdh_GetNextSibling( child, &child); sts = gdh_GetNextSibling( child, &child);
......
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 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.
*/
#ifndef xtt_tcurve_h
#define xtt_tcurve_h
/* xtt_tcurve.h -- Tcurve curves */
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef ge_curve_h
# include "ge_curve.h"
#endif
#ifndef rt_sevcli_h
# include "rt_sevcli.h"
#endif
/*! \file xtt_tcurve.h
\brief Contains the XttTCurve class. */
/*! \addtogroup Xtt */
/*@{*/
#define XTT_TCURVE_MAX 20
class CoWow;
class CoWowTimer;
typedef struct {
pwr_tAName name[10];
pwr_tAttrRef buf_aref[10];
pwr_tAttrRef timebuf_aref;
int element_size[10];
pwr_eType type[10];
int buf_size[10];
int buf_bsize[10];
int buf_samples[10];
char *vbuf[10];
int bufcnt;
int timeelement_size;
int timebuf_size;
int timebuf_bsize;
int timebuf_samples;
int time_resolution;
pwr_tTime first_time;
pwr_tTime last_time;
char *tbuf;
} tcurve_sTc;
//! Window that displays tcurve curve in a TCurve object.
/*!
A TCurveCurve references a data array for the time axis, and up to 10 data arrays
with stored data. These arrays are displayed in the XttTCurve window. The measurement
of these curves are triggered manually, on a digital signal, or on a level of one of
the attributes. When the measurement is completed this is signaled with the New attribute
in the TCurveCurve object. The XttTCurve window then has to read the new data and
reconfigure the curves. XttTCurve uses the GeCurve class to display the curves.
*/
class XttTCurve {
public:
void *xnav; //!< Pointer to parent XNav.
GeCurveData *gcd; //!< Curve data for GeCurve object.
GeCurve *curve; //!< Curve window.
int rows; //!< Max number of points in curves.
pwr_eType vtype;
unsigned int vsize;
CoWowTimer *timerid; //!< Time id for scan.
void (*close_cb)( void *, XttTCurve *); //!< Close callback to parent.
void (*help_cb)( void *, const char *); //!< Open help window.
int (*get_select_cb)( void *, pwr_tOid *, char *, char *); //!< Get selected TCurve object.
bool first_scan; //!< Indicates that this is the first scan.
char title[250]; //!< Window title
pwr_tAttrRef arefv[XTT_TCURVE_MAX];
int aref_cnt;
CoWow *wow;
long int time_low_old;
long int time_high_old;
tcurve_sTc tc;
//! Constructor
XttTCurve( void *xn_parent_ctx,
const char *xn_name,
pwr_tAttrRef* xn_arefv,
int *sts);
//! Destructor
virtual ~XttTCurve();
//! Pop tcurve window.
void pop();
int get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to);
int get_multidata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to);
void curve_add( pwr_tAttrRef aref);
int load_data( pwr_tStatus *sts, pwr_tAttrRef *aref);
static void tcurve_close_cb( void *ctx);
static void tcurve_increase_period_cb( void *ctx);
static void tcurve_decrease_period_cb( void *ctx);
static void tcurve_reload_cb( void *ctx);
static void tcurve_prev_period_cb( void *ctx);
static void tcurve_next_period_cb( void *ctx);
static void tcurve_add_cb( void *ctx);
static void tcurve_remove_cb( void *ctx);
static int tcurve_export_cb( void *ctx, pwr_tTime *from, pwr_tTime *to,
int rows, int idx, char *filename);
static void tcurve_help_cb( void *ctx);
static void tcurve_scan( void *data);
};
/*@}*/
#endif
This diff is collapsed.
...@@ -61,16 +61,22 @@ class XttTrend { ...@@ -61,16 +61,22 @@ class XttTrend {
pwr_tRefId subid[XTT_TREND_MAX]; pwr_tRefId subid[XTT_TREND_MAX];
pwr_sClass_DsTrend *trend_p[XTT_TREND_MAX]; pwr_sClass_DsTrend *trend_p[XTT_TREND_MAX];
int element_size[XTT_TREND_MAX]; int element_size[XTT_TREND_MAX];
pwr_eType element_type[XTT_TREND_MAX];
int interval[XTT_TREND_MAX]; int interval[XTT_TREND_MAX];
pwr_tAName trend_name[XTT_TREND_MAX];
int max_time; int max_time;
int min_interval; int min_interval;
int min_interval_idx; int min_interval_idx;
int max_points; int max_points;
pwr_tTid trend_tid;
int update_time;
gdh_sCircBuffInfo cb_info[XTT_TREND_MAX];
CoWowTimer *timerid; CoWowTimer *timerid;
int last_buffer[XTT_TREND_MAX]; int last_buffer[XTT_TREND_MAX];
int last_next_index[XTT_TREND_MAX]; int last_next_index[XTT_TREND_MAX];
void (*close_cb)( void *, XttTrend *); void (*close_cb)( void *, XttTrend *);
void (*help_cb)( void *, const char *); void (*help_cb)( void *, const char *);
void (*command_cb)( void *, const char *);
CoWow *wow; CoWow *wow;
XttTrend( void *xn_parent_ctx, XttTrend( void *xn_parent_ctx,
...@@ -83,6 +89,7 @@ class XttTrend { ...@@ -83,6 +89,7 @@ class XttTrend {
static void trend_close_cb( void *ctx); static void trend_close_cb( void *ctx);
static void trend_help_cb( void *ctx); static void trend_help_cb( void *ctx);
static void trend_snapshot_cb( void *ctx);
static void trend_scan( void *data); static void trend_scan( void *data);
}; };
......
...@@ -114,6 +114,7 @@ class XColWind; ...@@ -114,6 +114,7 @@ class XColWind;
class Block; class Block;
class XttTrend; class XttTrend;
class XttSevHist; class XttSevHist;
class XttTCurve;
class XttFast; class XttFast;
class XAttOne; class XAttOne;
class GeCurve; class GeCurve;
...@@ -373,6 +374,7 @@ class XNav { ...@@ -373,6 +374,7 @@ class XNav {
virtual XttSevHist *xttsevhist_new( char *name, pwr_tOid *oidv, pwr_tOName *aname, virtual XttSevHist *xttsevhist_new( char *name, pwr_tOid *oidv, pwr_tOName *aname,
pwr_tOName *oname, bool *sevhistobjectv, sevcli_tCtx scctx, pwr_tOName *oname, bool *sevhistobjectv, sevcli_tCtx scctx,
pwr_tStatus *sts) {return 0;} pwr_tStatus *sts) {return 0;}
virtual XttTCurve *xtttcurve_new( char *name, pwr_tAttrRef *arefv, pwr_tStatus *sts) {return 0;}
virtual XttFast *xttfast_new( char *name, pwr_tAttrRef *objar, pwr_tStatus *sts) {return 0;} virtual XttFast *xttfast_new( char *name, pwr_tAttrRef *objar, pwr_tStatus *sts) {return 0;}
virtual XAttOne *xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv, virtual XAttOne *xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv,
pwr_tStatus *sts) {return 0;} pwr_tStatus *sts) {return 0;}
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
#include "ge_curve.h" #include "ge_curve.h"
#include "xtt_trend.h" #include "xtt_trend.h"
#include "xtt_sevhist.h" #include "xtt_sevhist.h"
#include "xtt_tcurve.h"
#include "xtt_fast.h" #include "xtt_fast.h"
#include "xtt_xcrr.h" #include "xtt_xcrr.h"
#include "xtt_menu.h" #include "xtt_menu.h"
...@@ -169,7 +170,10 @@ static void xnav_op_map_cb( void *ctx); ...@@ -169,7 +170,10 @@ static void xnav_op_map_cb( void *ctx);
static int xnav_op_get_alarm_info_cb( void *xnav, evlist_sAlarmInfo *info); static int xnav_op_get_alarm_info_cb( void *xnav, evlist_sAlarmInfo *info);
static void xnav_op_ack_last_cb( void *xnav, unsigned long type, unsigned long prio); static void xnav_op_ack_last_cb( void *xnav, unsigned long type, unsigned long prio);
static void xnav_trend_close_cb( void *ctx, XttTrend *trend); static void xnav_trend_close_cb( void *ctx, XttTrend *trend);
static void xnav_trend_command_cb( void *ctx, const char *key);
static void xnav_trend_help_cb( void *ctx, const char *key); static void xnav_trend_help_cb( void *ctx, const char *key);
static void xnav_tcurve_close_cb( void *ctx, XttTCurve *trend);
static void xnav_tcurve_help_cb( void *ctx, const char *key);
static void xnav_sevhist_help_cb( void *ctx, const char *key); static void xnav_sevhist_help_cb( void *ctx, const char *key);
static int xnav_sevhist_get_select_cb( void *ctx, pwr_tOid *oid, char *aname, char *oname); static int xnav_sevhist_get_select_cb( void *ctx, pwr_tOid *oid, char *aname, char *oname);
static int xnav_get_select_cb( void *ctx, pwr_tAttrRef *aref, int *is_attr); static int xnav_get_select_cb( void *ctx, pwr_tAttrRef *aref, int *is_attr);
...@@ -3029,6 +3033,8 @@ static int xnav_open_func( void *client_data, ...@@ -3029,6 +3033,8 @@ static int xnav_open_func( void *client_data,
switch ( classid) { switch ( classid) {
case pwr_cClass_DsTrend: case pwr_cClass_DsTrend:
break; break;
case pwr_cClass_DsTrendCurve:
break;
case pwr_cClass_PlotGroup: case pwr_cClass_PlotGroup:
plotgroup = aref_vect[i]; plotgroup = aref_vect[i];
plotgroup_found = 1; plotgroup_found = 1;
...@@ -3070,7 +3076,9 @@ static int xnav_open_func( void *client_data, ...@@ -3070,7 +3076,9 @@ static int xnav_open_func( void *client_data,
xnav->message('E',"Error in trend configuration"); xnav->message('E',"Error in trend configuration");
else { else {
trend->close_cb = xnav_trend_close_cb; trend->close_cb = xnav_trend_close_cb;
trend->help_cb = xnav_trend_command_cb;
trend->help_cb = xnav_trend_help_cb; trend->help_cb = xnav_trend_help_cb;
trend->command_cb = xnav_trend_command_cb;
xnav->appl.insert( applist_eType_Trend, (void *)trend, &plotgroup, "", xnav->appl.insert( applist_eType_Trend, (void *)trend, &plotgroup, "",
NULL); NULL);
} }
...@@ -3087,6 +3095,7 @@ static int xnav_open_func( void *client_data, ...@@ -3087,6 +3095,7 @@ static int xnav_open_func( void *client_data,
xnav->message('E',"Error in trend configuration"); xnav->message('E',"Error in trend configuration");
else { else {
trend->close_cb = xnav_trend_close_cb; trend->close_cb = xnav_trend_close_cb;
trend->command_cb = xnav_trend_command_cb;
trend->help_cb = xnav_trend_help_cb; trend->help_cb = xnav_trend_help_cb;
xnav->appl.insert( applist_eType_Trend, (void *)trend, &aref_vect[0], "", xnav->appl.insert( applist_eType_Trend, (void *)trend, &aref_vect[0], "",
NULL); NULL);
...@@ -3096,7 +3105,8 @@ static int xnav_open_func( void *client_data, ...@@ -3096,7 +3105,8 @@ static int xnav_open_func( void *client_data,
else { else {
trend = xnav->xtttrend_new( title_str, aref_vect, 0, &sts); trend = xnav->xtttrend_new( title_str, aref_vect, 0, &sts);
if ( ODD(sts)) { if ( ODD(sts)) {
trend->help_cb = xnav_trend_help_cb; trend->close_cb = xnav_trend_close_cb;
trend->command_cb = xnav_trend_command_cb;
trend->help_cb = xnav_trend_help_cb; trend->help_cb = xnav_trend_help_cb;
} }
} }
...@@ -3168,6 +3178,56 @@ static int xnav_open_func( void *client_data, ...@@ -3168,6 +3178,56 @@ static int xnav_open_func( void *client_data,
xnav->wow->CreateList( "History List", (char *)cname, sizeof(cname[0]), xnav_open_shist_cb, xnav->wow->CreateList( "History List", (char *)cname, sizeof(cname[0]), xnav_open_shist_cb,
xnav_open_shist_cancel_cb, ctx); xnav_open_shist_cancel_cb, ctx);
} }
else if ( cdh_NoCaseStrncmp( arg1_str, "TCURVE", strlen( arg1_str)) == 0)
{
pwr_tAName name_str;
char *name_ptr;
pwr_tAttrRef aref_vect[2];
pwr_tStatus sts;
char title_str[80];
/* Get the name qualifier */
if ( ODD( dcli_get_qualifier( "dcli_arg2", name_str, sizeof(name_str)))) {
if ( name_str[0] != '/')
/* Assume that this is the namestring */
name_ptr = name_str;
else {
xnav->message('E', "Syntax error");
return XNAV__HOLDCOMMAND;
}
}
else {
if ( ODD( dcli_get_qualifier( "/NAME", name_str, sizeof(name_str))))
name_ptr = name_str;
else {
/* Get the selected object */
sts = xnav->get_current_aref( &aref_vect[0], name_str,
sizeof( name_str), cdh_mName_path | cdh_mName_object | cdh_mName_attribute);
if ( EVEN(sts)) {
xnav->message('E', "Enter name or select an object");
return XNAV__SUCCESS;
}
name_ptr = name_str;
}
}
if ( EVEN( dcli_get_qualifier( "/TITLE", title_str, sizeof(title_str)))) {
strcpy( title_str, "Trend");
}
memset( aref_vect, 0, sizeof(aref_vect));
sts = gdh_NameToAttrref( pwr_cNObjid, name_str, &aref_vect[0]);
if (EVEN(sts)) {
xnav->message('E', "Object not found");
return XNAV__HOLDCOMMAND;
}
XttTCurve *tcurve = xnav->xtttcurve_new( title_str, aref_vect, &sts);
if ( ODD(sts)) {
tcurve->close_cb = xnav_tcurve_close_cb;
tcurve->help_cb = xnav_tcurve_help_cb;
}
return XNAV__SUCCESS;
}
else if ( cdh_NoCaseStrncmp( arg1_str, "HISTORY", strlen( arg1_str)) == 0) else if ( cdh_NoCaseStrncmp( arg1_str, "HISTORY", strlen( arg1_str)) == 0)
{ {
...@@ -3909,6 +3969,7 @@ static int xnav_close_func( void *client_data, ...@@ -3909,6 +3969,7 @@ static int xnav_close_func( void *client_data,
switch ( classid) { switch ( classid) {
case pwr_cClass_PlotGroup: case pwr_cClass_PlotGroup:
case pwr_cClass_DsTrend: case pwr_cClass_DsTrend:
case pwr_cClass_DsTrendCurve:
plotgroup_found = 1; plotgroup_found = 1;
break; break;
default: default:
...@@ -4150,6 +4211,13 @@ static void xnav_trend_close_cb( void *ctx, XttTrend *trend) ...@@ -4150,6 +4211,13 @@ static void xnav_trend_close_cb( void *ctx, XttTrend *trend)
delete trend; delete trend;
} }
static void xnav_trend_command_cb( void *ctx, const char *cmd)
{
XNav *xnav = (XNav *) ctx;
xnav->command( (char *)cmd);
}
static void xnav_trend_help_cb( void *ctx, const char *key) static void xnav_trend_help_cb( void *ctx, const char *key)
{ {
XNav *xnav = (XNav *) ctx; XNav *xnav = (XNav *) ctx;
...@@ -4163,6 +4231,27 @@ static void xnav_trend_help_cb( void *ctx, const char *key) ...@@ -4163,6 +4231,27 @@ static void xnav_trend_help_cb( void *ctx, const char *key)
xnav->message( ' ', null_str); xnav->message( ' ', null_str);
} }
static void xnav_tcurve_close_cb( void *ctx, XttTCurve *trend)
{
XNav *xnav = (XNav *) ctx;
xnav->appl.remove( (void *)trend);
delete trend;
}
static void xnav_tcurve_help_cb( void *ctx, const char *key)
{
XNav *xnav = (XNav *) ctx;
int sts;
sts = CoXHelp::dhelp( key, "", navh_eHelpFile_Base, NULL, 0);
if ( EVEN(sts))
xnav->message( 'E', "Unable to find topic");
else
xnav->message( ' ', null_str);
}
static void xnav_sevhist_help_cb( void *ctx, const char *key) static void xnav_sevhist_help_cb( void *ctx, const char *key)
{ {
XNav *xnav = (XNav *) ctx; XNav *xnav = (XNav *) ctx;
...@@ -7893,6 +7982,7 @@ static void xnav_show_objectlist_cb( void *ctx, char *text) ...@@ -7893,6 +7982,7 @@ static void xnav_show_objectlist_cb( void *ctx, char *text)
switch ( cid) { switch ( cid) {
case pwr_cClass_DsTrend: case pwr_cClass_DsTrend:
case pwr_cClass_DsTrendCurve:
sprintf( cmd, "open trend/name=%s/title=\"%s\"", text, text); sprintf( cmd, "open trend/name=%s/title=\"%s\"", text, text);
break; break;
case pwr_cClass_DsFastCurve: case pwr_cClass_DsFastCurve:
......
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