Commit 11dce64f authored by claes's avatar claes

New crossreference lists

parent 7e55bc8a
/* /*
* Proview $Id: rt_rtt_crr.c,v 1.4 2005-10-25 15:28:10 claes Exp $ * Proview $Id: rt_rtt_crr.c,v 1.5 2008-05-28 11:43:43 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -278,8 +278,6 @@ int rtt_crr_signal( ...@@ -278,8 +278,6 @@ int rtt_crr_signal(
pwr_tFileName default_filename; pwr_tFileName default_filename;
FILE *file; FILE *file;
char line[500]; char line[500];
int hierarchy_spaces;
pwr_tOName hierarchy;
int object_spaces; int object_spaces;
pwr_tOName object; pwr_tOName object;
pwr_tOName objname; pwr_tOName objname;
...@@ -352,48 +350,20 @@ int rtt_crr_signal( ...@@ -352,48 +350,20 @@ int rtt_crr_signal(
return RTT__NOPICTURE; return RTT__NOPICTURE;
} }
/* First line is a header, skip it */
sts = rtt_get_signal_line( file, line, sizeof( line),
&hierarchy_spaces, hierarchy, &lines);
if ( EVEN(sts)) goto finish;
/* Get the hierarchy */ /* Get the hierarchy */
sts = rtt_get_signal_line( file, line, sizeof( line), sts = rtt_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines); &spaces, object, &lines);
if ( EVEN(sts)) goto finish; if ( EVEN(sts)) goto finish;
hierarchy_spaces = spaces; object_spaces = spaces;
first = 1; first = 1;
while ( 1) while ( 1)
{ {
while ( spaces != hierarchy_spaces) if ( (s = strchr( object, ':')))
{ strcpy( objname, s+1);
sts = rtt_get_signal_line( file, line, sizeof( line), else
&spaces, object, &lines); strcpy( objname, object);
if ( EVEN(sts)) goto finish;
}
strcpy( hierarchy, object);
/* Next line is an object */
sts = rtt_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines);
if ( EVEN(sts)) goto finish;
if ( first)
{
object_spaces = spaces;
first = 0;
}
while ( spaces == object_spaces)
{
/* Put object and hierarchy together and check if this is
the object */
strcpy( objname, hierarchy);
strcat( objname, "-");
strcat( objname, object);
strcpy( show_objname, objname);
rtt_toupper( objname, objname);
sts = rtt_wildcard( signalname, objname); sts = rtt_wildcard( signalname, objname);
if ( !sts ) if ( !sts )
...@@ -444,7 +414,6 @@ int rtt_crr_signal( ...@@ -444,7 +414,6 @@ int rtt_crr_signal(
} }
} }
} }
}
finish: finish:
fclose( file); fclose( file);
...@@ -485,8 +454,6 @@ int rtt_crr_object( ...@@ -485,8 +454,6 @@ int rtt_crr_object(
pwr_tFileName default_filename; pwr_tFileName default_filename;
FILE *file; FILE *file;
char line[200]; char line[200];
int hierarchy_spaces;
char hierarchy[80];
int object_spaces; int object_spaces;
char object[80]; char object[80];
pwr_tOName objname; pwr_tOName objname;
...@@ -559,21 +526,7 @@ int rtt_crr_object( ...@@ -559,21 +526,7 @@ int rtt_crr_object(
return RTT__NOPICTURE; return RTT__NOPICTURE;
} }
/* First line is a header, skip it */ /* Get the object */
sts = rtt_get_signal_line( file, line, sizeof( line),
&hierarchy_spaces, hierarchy, &lines);
if ( EVEN(sts)) goto finish;
sts = rtt_get_signal_line( file, line, sizeof( line),
&hierarchy_spaces, hierarchy, &lines);
if ( EVEN(sts)) goto finish;
sts = rtt_get_signal_line( file, line, sizeof( line),
&hierarchy_spaces, hierarchy, &lines);
if ( EVEN(sts)) goto finish;
sts = rtt_get_signal_line( file, line, sizeof( line),
&hierarchy_spaces, hierarchy, &lines);
if ( EVEN(sts)) goto finish;
/* Get the hierarchy */
sts = rtt_get_signal_line( file, line, sizeof( line), sts = rtt_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines); &spaces, object, &lines);
if ( EVEN(sts)) goto finish; if ( EVEN(sts)) goto finish;
...@@ -583,18 +536,22 @@ int rtt_crr_object( ...@@ -583,18 +536,22 @@ int rtt_crr_object(
first = 1; first = 1;
while ( 1) while ( 1)
{ {
while ( spaces != object_spaces) if ( (s = strchr( object, ':')))
{ strcpy( objname, s+1);
sts = rtt_get_signal_line( file, line, sizeof( line), else
&spaces, object, &lines);
if ( EVEN(sts)) goto finish;
}
strcpy( objname, object); strcpy( objname, object);
strcpy( show_objname, objname); strcpy( show_objname, objname);
rtt_toupper( objname, objname); rtt_toupper( objname, objname);
sts = rtt_wildcard( objectname, objname); sts = rtt_wildcard( objectname, objname);
if ( sts) {
pwr_tAName subname;
strcpy( subname, objectname);
strcat( subname, ".*");
sts = rtt_wildcard( subname, objname);
}
if ( !sts ) if ( !sts )
{ {
/* Hit, print this object */ /* Hit, print this object */
...@@ -619,20 +576,24 @@ int rtt_crr_object( ...@@ -619,20 +576,24 @@ int rtt_crr_object(
goto finish; goto finish;
} }
if ( line[0] == '#' || line[0] == '&')
buffcnt += sprintf( buff+buffcnt, " %s\n", line);
else
buffcnt += sprintf( buff+buffcnt, " %s\n", line); buffcnt += sprintf( buff+buffcnt, " %s\n", line);
sts = rtt_get_signal_line( file, line, sizeof( line), sts = rtt_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines); &spaces, object, &lines);
if ( EVEN(sts)) goto finish; if ( EVEN(sts)) goto finish;
} }
if ( !wildcard)
goto finish;
} }
else else
{ {
if ( !wildcard && signalcount)
goto finish;
sts = rtt_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines);
if ( EVEN(sts)) goto finish;
}
while ( spaces != object_spaces) {
sts = rtt_get_signal_line( file, line, sizeof( line), sts = rtt_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines); &spaces, object, &lines);
if ( EVEN(sts)) goto finish; if ( EVEN(sts)) goto finish;
...@@ -683,9 +644,6 @@ int rtt_crr_code( ...@@ -683,9 +644,6 @@ int rtt_crr_code(
FILE *file; FILE *file;
char line[500]; char line[500];
char tst_line[500]; char tst_line[500];
int hierarchy_spaces;
pwr_tOName hierarchy;
int object_spaces;
pwr_tAName object; pwr_tAName object;
pwr_tOName objname; pwr_tOName objname;
int spaces; int spaces;
...@@ -745,44 +703,24 @@ int rtt_crr_code( ...@@ -745,44 +703,24 @@ int rtt_crr_code(
return RTT__NOPICTURE; return RTT__NOPICTURE;
} }
/* First line is a header, skip it */
sts = rtt_get_signal_line( file, line, sizeof( line),
&hierarchy_spaces, hierarchy, &lines);
if ( EVEN(sts)) goto finish;
sts = rtt_get_signal_line( file, line, sizeof( line),
&hierarchy_spaces, hierarchy, &lines);
if ( EVEN(sts)) goto finish;
sts = rtt_get_signal_line( file, line, sizeof( line),
&hierarchy_spaces, hierarchy, &lines);
if ( EVEN(sts)) goto finish;
sts = rtt_get_signal_line( file, line, sizeof( line),
&hierarchy_spaces, hierarchy, &lines);
if ( EVEN(sts)) goto finish;
/* Get the hierarchy */ /* Get the hierarchy */
while ( strncmp( line, " _Obj_ ", 7) != 0) {
sts = rtt_get_signal_line( file, line, sizeof( line), sts = rtt_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines); &spaces, object, &lines);
if ( EVEN(sts)) goto finish; if ( EVEN(sts)) goto finish;
object_spaces = spaces; }
first = 1; first = 1;
while ( 1) while ( 1)
{ {
while ( strncmp( line, "_Obj_ ", 6) != 0) strcpy( objname, &line[7]);
{
sts = rtt_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines);
if ( EVEN(sts)) goto finish;
}
strcpy( objname, &line[6]);
for ( s = objname; !(*s == 32 || *s == 9 || *s == 0); s++); for ( s = objname; !(*s == 32 || *s == 9 || *s == 0); s++);
*s = 0; *s = 0;
sts = rtt_get_signal_line( file, line, sizeof( line), sts = rtt_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines); &spaces, object, &lines);
objname_written = 0; objname_written = 0;
while ( strncmp( line, "_Obj_ ", 6) != 0) while ( strncmp( line, " _Obj_ ", 7) != 0)
{ {
if ( !case_sensitive) if ( !case_sensitive)
rtt_toupper( tst_line, line); rtt_toupper( tst_line, line);
...@@ -852,7 +790,7 @@ int rtt_crr_code( ...@@ -852,7 +790,7 @@ int rtt_crr_code(
if ( brief) if ( brief)
{ {
while ( strncmp( line, "_Obj_ ", 6) != 0) while ( strncmp( line, " _Obj_ ", 7) != 0)
{ {
sts = rtt_get_signal_line( file, line, sizeof( line), sts = rtt_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines); &spaces, object, &lines);
......
/* /*
* Proview $Id: rt_trace.cpp,v 1.6 2008-01-18 13:55:36 claes Exp $ * Proview $Id: rt_trace.cpp,v 1.7 2008-05-28 11:43:43 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -34,22 +34,19 @@ ...@@ -34,22 +34,19 @@
#include "co_cdh.h" #include "co_cdh.h"
#include "co_dcli.h" #include "co_dcli.h"
#include "co_wow.h" #include "co_wow.h"
#include "co_trace.h"
#include "rt_gdh.h" #include "rt_gdh.h"
#include "rt_trace.h" #include "rt_trace.h"
#include "xtt_menu.h"
#define GOEN_F_GRID 0.05 #define GOEN_F_GRID 0.05
// Until xtt_menu.h i unavailable...
#define xmenu_mUtility_Trace (1 << 1)
#define xmenu_mUtility_Simulate (1 << 2)
#define xmenu_eItemType_Object 1
void RtTrace::get_trace_attr( flow_tObject object, void RtTrace::get_trace_attr( flow_tObject object,
char *object_str, char *attr_str, flow_eTraceType *type, char *object_str, char *attr_str, flow_eTraceType *type,
int *inverted) int *inverted, unsigned int *options)
{ {
pwr_tOName name; pwr_tOName name;
char *s;
flow_GetTraceAttr( object, name, attr_str, type, inverted); flow_GetTraceAttr( object, name, attr_str, type, inverted);
if ( m_has_host) { if ( m_has_host) {
...@@ -63,6 +60,14 @@ void RtTrace::get_trace_attr( flow_tObject object, ...@@ -63,6 +60,14 @@ void RtTrace::get_trace_attr( flow_tObject object,
} }
else else
strcpy( object_str, name); strcpy( object_str, name);
// Get options in attr_str after #
if ( (s = strchr( attr_str, '#'))) {
*s = 0;
sscanf( s+1, "%u", options);
}
else
*options = 0;
} }
void RtTrace::get_save_filename( pwr_tObjid window_objid, char *filename) void RtTrace::get_save_filename( pwr_tObjid window_objid, char *filename)
...@@ -208,6 +213,9 @@ int RtTrace::connect_bc( flow_tObject object, char *name, char *attr, ...@@ -208,6 +213,9 @@ int RtTrace::connect_bc( flow_tObject object, char *name, char *attr,
strcpy( attr_str, name); strcpy( attr_str, name);
strcat( attr_str, "."); strcat( attr_str, ".");
strcat( attr_str, attr); strcat( attr_str, attr);
if ( (s = strchr( attr_str, '#')))
*s = 0;
if ( flow_GetObjectType( object) == flow_eObjectType_Node) if ( flow_GetObjectType( object) == flow_eObjectType_Node)
{ {
...@@ -369,22 +377,28 @@ void RtTrace::activate_display_object() ...@@ -369,22 +377,28 @@ void RtTrace::activate_display_object()
{ {
flow_tObject node; flow_tObject node;
int sts; int sts;
pwr_tObjid objid; pwr_tAttrRef attrref;
xmenu_eItemType itemtype;
sts = get_selected_node( &node); sts = get_selected_node( &node);
if (EVEN(sts)) return; if (EVEN(sts)) return;
sts = get_objid( node, &objid); sts = get_attrref( node, &attrref);
if (EVEN(sts)) return; if (EVEN(sts)) return;
if ( call_method_cb) { if ( attrref.Flags.b.ObjectAttr)
pwr_sAttrRef attrref = cdh_ObjidToAref( objid); itemtype = xmenu_eItemType_AttrObject;
else if ( attrref.Flags.b.Object)
itemtype = xmenu_eItemType_Object;
else
itemtype = xmenu_eItemType_Attribute;
if ( call_method_cb) {
(call_method_cb)( parent_ctx, (call_method_cb)( parent_ctx,
"$Object-RtNavigator", "$Object-RtNavigator",
"$Object-RtNavigatorFilter", "$Object-RtNavigatorFilter",
attrref, attrref,
xmenu_eItemType_Object, itemtype,
xmenu_mUtility_Trace, NULL); xmenu_mUtility_Trace, NULL);
} }
} }
...@@ -393,22 +407,29 @@ void RtTrace::activate_collect_insert() ...@@ -393,22 +407,29 @@ void RtTrace::activate_collect_insert()
{ {
flow_tObject node; flow_tObject node;
int sts; int sts;
pwr_tObjid objid; pwr_tAttrRef attrref;
xmenu_eItemType itemtype;
sts = get_selected_node( &node); sts = get_selected_node( &node);
if (EVEN(sts)) return; if (EVEN(sts)) return;
sts = get_objid( node, &objid); sts = get_attrref( node, &attrref);
if (EVEN(sts)) return; if (EVEN(sts)) return;
if ( attrref.Flags.b.ObjectAttr)
itemtype = xmenu_eItemType_AttrObject;
else if ( attrref.Flags.b.Object)
itemtype = xmenu_eItemType_Object;
else
itemtype = xmenu_eItemType_Attribute;
if ( call_method_cb) { if ( call_method_cb) {
pwr_sAttrRef attrref = cdh_ObjidToAref( objid);
(call_method_cb)( parent_ctx, (call_method_cb)( parent_ctx,
"$Object-Collect", "$Object-Collect",
"$Object-CollectFilter", "$Object-CollectFilter",
attrref, attrref,
xmenu_eItemType_Object, itemtype,
xmenu_mUtility_Trace, NULL); xmenu_mUtility_Trace, NULL);
} }
} }
...@@ -484,22 +505,28 @@ void RtTrace::activate_show_cross() ...@@ -484,22 +505,28 @@ void RtTrace::activate_show_cross()
{ {
flow_tObject node; flow_tObject node;
int sts; int sts;
pwr_tObjid objid; pwr_tAttrRef attrref;
xmenu_eItemType itemtype;
sts = get_selected_node( &node); sts = get_selected_node( &node);
if (EVEN(sts)) return; if (EVEN(sts)) return;
sts = get_objid( node, &objid); sts = get_attrref( node, &attrref);
if (EVEN(sts)) return; if (EVEN(sts)) return;
if ( call_method_cb) { if ( attrref.Flags.b.ObjectAttr)
pwr_sAttrRef attrref = cdh_ObjidToAref( objid); itemtype = xmenu_eItemType_AttrObject;
else if ( attrref.Flags.b.Object)
itemtype = xmenu_eItemType_Object;
else
itemtype = xmenu_eItemType_Attribute;
if ( call_method_cb) {
(call_method_cb)(parent_ctx, (call_method_cb)(parent_ctx,
"$Object-OpenCrossref", "$Object-OpenCrossref",
"$Object-OpenCrossrefFilter", "$Object-OpenCrossrefFilter",
attrref, attrref,
xmenu_eItemType_Object, itemtype,
xmenu_mUtility_Trace, NULL); xmenu_mUtility_Trace, NULL);
} }
} }
...@@ -508,22 +535,37 @@ void RtTrace::activate_open_classgraph() ...@@ -508,22 +535,37 @@ void RtTrace::activate_open_classgraph()
{ {
flow_tObject node; flow_tObject node;
int sts; int sts;
pwr_tObjid objid; pwr_tAttrRef attrref;
xmenu_eItemType itemtype;
sts = get_selected_node( &node); sts = get_selected_node( &node);
if (EVEN(sts)) return; if (EVEN(sts)) return;
sts = get_objid( node, &objid); sts = get_attrref( node, &attrref);
if (EVEN(sts)) return; if (EVEN(sts)) return;
if ( attrref.Flags.b.ObjectAttr)
itemtype = xmenu_eItemType_AttrObject;
else if ( attrref.Flags.b.Object)
itemtype = xmenu_eItemType_Object;
else
itemtype = xmenu_eItemType_Attribute;
if ( call_method_cb) { if ( call_method_cb) {
pwr_sAttrRef attrref = cdh_ObjidToAref( objid);
if ( itemtype == xmenu_eItemType_Attribute)
(call_method_cb)( parent_ctx,
"$Object-OpenTypeGraph",
"$Object-OpenTypeGraphFilter",
attrref,
itemtype,
xmenu_mUtility_Trace, NULL);
else
(call_method_cb)( parent_ctx, (call_method_cb)( parent_ctx,
"$Object-OpenObjectGraph", "$Object-OpenObjectGraph",
"$Object-OpenObjectGraphFilter", "$Object-OpenObjectGraphFilter",
attrref, attrref,
xmenu_eItemType_Object, itemtype,
xmenu_mUtility_Trace, NULL); xmenu_mUtility_Trace, NULL);
} }
} }
...@@ -693,68 +735,31 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event) ...@@ -693,68 +735,31 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event)
break; break;
} }
case flow_eEvent_MB3Press: { case flow_eEvent_MB3Press: {
flow_tTraceObj object_str;
flow_tTraceAttr attr_str;
flow_eTraceType trace_type;
int inverted;
pwr_sAttrRef attrref; pwr_sAttrRef attrref;
int sts; int sts;
int x, y; int x, y;
unsigned int utility; unsigned int utility;
pwr_tAName name; xmenu_eItemType itemtype;
char *s;
switch ( event->object.object_type) { switch ( event->object.object_type) {
case flow_eObjectType_Node: case flow_eObjectType_Node:
if ( flow_GetNodeGroup( event->object.object) != sts = tractx->get_attrref( event->object.object, &attrref);
flow_eNodeGroup_Trace) { if ( EVEN(sts)) return 1;
tractx->get_trace_attr( event->object.object, object_str, attr_str,
&trace_type, &inverted);
if ( tractx->m_has_host) { if ( attrref.Flags.b.ObjectAttr)
if ( strncmp( object_str, "$host", 5) == 0) { itemtype = xmenu_eItemType_AttrObject;
/* Replace "$host" with hostname */ else if ( attrref.Flags.b.Object)
strcpy( name, tractx->m_hostname); itemtype = xmenu_eItemType_Object;
strcat( name, &object_str[5]);
}
else if ( strncmp( object_str, "$PlcFo:", 7) == 0) {
/* Replace "$PlcFo:" with fo name */
s = strchr( object_str, '.');
if ( !s)
strcpy( name, tractx->m_hostname);
else {
strcpy( name, tractx->m_hostname);
strcat( name, s);
}
}
else if ( strncmp( object_str, "$PlcMain:", 9) == 0) {
/* Replace "$PlcMain:" with plcconnect name */
s = strchr( object_str, '.');
if ( !s)
strcpy( name, tractx->m_plcconnect);
else {
strcpy( name, tractx->m_plcconnect);
strcat( name, s);
}
}
else
strcpy( name, object_str);
}
else else
strcpy( name, object_str); itemtype = xmenu_eItemType_Attribute;
sts = gdh_NameToAttrref( pwr_cNObjid, name, &attrref);
if ( EVEN(sts)) return 1;
if ( tractx->popup_menu_cb) { if ( tractx->popup_menu_cb) {
// Display popup menu // Display popup menu
utility = xmenu_mUtility_Trace; utility = xmenu_mUtility_Trace;
tractx->popup_menu_position( event->any.x_pixel + 8, event->any.y_pixel, &x, &y); tractx->popup_menu_position( event->any.x_pixel + 8, event->any.y_pixel, &x, &y);
(tractx->popup_menu_cb)( tractx->parent_ctx, attrref, (tractx->popup_menu_cb)( tractx->parent_ctx, attrref, itemtype,
xmenu_eItemType_Object,
utility, NULL, x, y); utility, NULL, x, y);
} }
}
break; break;
default: default:
; ;
...@@ -765,28 +770,18 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event) ...@@ -765,28 +770,18 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event)
} }
case flow_eEvent_MB1DoubleClick: { case flow_eEvent_MB1DoubleClick: {
/* Open attribute editor */ /* Open attribute editor */
flow_tTraceObj object_str; pwr_tAttrRef attrref;
flow_tTraceAttr attr_str;
flow_eTraceType trace_type;
int inverted;
pwr_tObjid objid;
int sts; int sts;
/* Display object */ /* Display object */
switch ( event->object.object_type) { switch ( event->object.object_type) {
case flow_eObjectType_Node: case flow_eObjectType_Node:
if ( flow_GetNodeGroup( event->object.object) != sts = tractx->get_attrref( event->object.object, &attrref);
flow_eNodeGroup_Trace) { if (EVEN(sts)) return 1;
tractx->get_trace_attr( event->object.object, object_str, attr_str,
&trace_type, &inverted);
sts = gdh_NameToObjid( object_str, &objid);
if ( EVEN(sts)) return 1;
if ( tractx->call_method_cb) { if ( tractx->call_method_cb) {
// Display crossreferences // Display crossreferences
unsigned long utility = xmenu_mUtility_Trace; unsigned long utility = xmenu_mUtility_Trace;
pwr_sAttrRef attrref = cdh_ObjidToAref( objid);
(tractx->call_method_cb)(tractx->parent_ctx, (tractx->call_method_cb)(tractx->parent_ctx,
"$Object-OpenCrossref", "$Object-OpenCrossref",
...@@ -795,12 +790,6 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event) ...@@ -795,12 +790,6 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event)
xmenu_eItemType_Object, xmenu_eItemType_Object,
utility, NULL); utility, NULL);
} }
//if ( tractx->display_object_cb)
//{
// Display the object in the parent context
// (tractx->display_object_cb)(tractx->parent_ctx, objid);
//}
}
break; break;
default: default:
; ;
...@@ -875,9 +864,11 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event) ...@@ -875,9 +864,11 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event)
flow_ResetSelectInverse( ctx); flow_ResetSelectInverse( ctx);
break; break;
case flow_eEvent_ScrollDown: case flow_eEvent_ScrollDown:
flow_RemoveTipText( ctx);
flow_Scroll( ctx, 0, -0.05); flow_Scroll( ctx, 0, -0.05);
break; break;
case flow_eEvent_ScrollUp: case flow_eEvent_ScrollUp:
flow_RemoveTipText( ctx);
flow_Scroll( ctx, 0, 0.05); flow_Scroll( ctx, 0, 0.05);
break; break;
case flow_eEvent_TipText: { case flow_eEvent_TipText: {
...@@ -886,14 +877,15 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event) ...@@ -886,14 +877,15 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event)
flow_eTraceType trace_type; flow_eTraceType trace_type;
pwr_tAName aname; pwr_tAName aname;
pwr_tAName name; pwr_tAName name;
char tiptext[512]; char tiptext[512] = "";
pwr_tStatus sts; pwr_tStatus sts;
int inverted; int inverted;
char *s; char *s;
bool is_plcmain = false; bool is_plcmain = false;
bool is_plcfo = false; bool is_plcfo = false;
unsigned int options;
tractx->get_trace_attr( event->object.object, object_str, attr_str, &trace_type, &inverted); tractx->get_trace_attr( event->object.object, object_str, attr_str, &trace_type, &inverted, &options);
if ( tractx->m_has_host) { if ( tractx->m_has_host) {
if ( strncmp( object_str, "$host", 5) == 0) { if ( strncmp( object_str, "$host", 5) == 0) {
...@@ -942,16 +934,14 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event) ...@@ -942,16 +934,14 @@ int RtTrace::flow_cb( FlowCtx *ctx, flow_tEvent event)
strcat( aname, ".PlcConnect"); strcat( aname, ".PlcConnect");
sts = gdh_GetObjectInfo( aname, &aref, sizeof(aref)); sts = gdh_GetObjectInfo( aname, &aref, sizeof(aref));
if ( EVEN(sts)) break; if ( ODD(sts))
sts = gdh_AttrrefToName( &aref, aname, sizeof(aname), sts = gdh_AttrrefToName( &aref, aname, sizeof(aname),
cdh_mName_volumeStrict); cdh_mName_volumeStrict);
if ( EVEN(sts)) break; if ( ODD(sts)) {
strcat( aname, ".Description"); strcat( aname, ".Description");
sts = gdh_GetObjectInfo( aname, tiptext, sizeof(tiptext)); sts = gdh_GetObjectInfo( aname, tiptext, sizeof(tiptext));
if ( EVEN(sts)) break; }
} }
if ( is_plcfo) { if ( is_plcfo) {
...@@ -1064,6 +1054,7 @@ int RtTrace::get_objid( flow_tObject node, pwr_tObjid *oid) ...@@ -1064,6 +1054,7 @@ int RtTrace::get_objid( flow_tObject node, pwr_tObjid *oid)
flow_tTraceAttr attr_str; flow_tTraceAttr attr_str;
flow_eTraceType trace_type; flow_eTraceType trace_type;
int inverted; int inverted;
unsigned int options;
/* Try flow node name */ /* Try flow node name */
sts = gdh_ObjidToName( objid, name, sizeof(name), cdh_mNName); sts = gdh_ObjidToName( objid, name, sizeof(name), cdh_mNName);
...@@ -1076,7 +1067,7 @@ int RtTrace::get_objid( flow_tObject node, pwr_tObjid *oid) ...@@ -1076,7 +1067,7 @@ int RtTrace::get_objid( flow_tObject node, pwr_tObjid *oid)
sts = gdh_NameToObjid( name, oid); sts = gdh_NameToObjid( name, oid);
if ( EVEN(sts)) { if ( EVEN(sts)) {
/* Try trace object */ /* Try trace object */
get_trace_attr( node, object_name, attr_str, &trace_type, &inverted); get_trace_attr( node, object_name, attr_str, &trace_type, &inverted, &options);
sts = gdh_NameToObjid( object_name, oid); sts = gdh_NameToObjid( object_name, oid);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -1084,6 +1075,77 @@ int RtTrace::get_objid( flow_tObject node, pwr_tObjid *oid) ...@@ -1084,6 +1075,77 @@ int RtTrace::get_objid( flow_tObject node, pwr_tObjid *oid)
return 1; return 1;
} }
int RtTrace::get_attrref( flow_tObject node, pwr_tAttrRef *aref)
{
flow_tTraceObj object_str;
flow_tTraceAttr attr_str;
flow_eTraceType trace_type;
int inverted;
pwr_sAttrRef attrref;
int sts;
pwr_tAName name;
char *s;
unsigned int options;
if ( flow_GetNodeGroup( node) == flow_eNodeGroup_Trace)
return 0;
get_trace_attr( node, object_str, attr_str,
&trace_type, &inverted, &options);
if ( m_has_host) {
if ( strncmp( object_str, "$host", 5) == 0) {
/* Replace "$host" with hostname */
strcpy( name, m_hostname);
strcat( name, &object_str[5]);
}
else if ( strncmp( object_str, "$PlcFo:", 7) == 0) {
/* Replace "$PlcFo:" with fo name */
s = strchr( object_str, '.');
if ( !s)
strcpy( name, m_hostname);
else {
strcpy( name, m_hostname);
strcat( name, s);
}
}
else if ( strncmp( object_str, "$PlcMain:", 9) == 0) {
/* Replace "$PlcMain:" with plcconnect name */
s = strchr( object_str, '.');
if ( !s)
strcpy( name, m_plcconnect);
else {
strcpy( name, m_plcconnect);
strcat( name, s);
}
}
else
strcpy( name, object_str);
}
else
strcpy( name, object_str);
if ( options & trace_mAttrOptions_MenuAttr) {
if ( strcmp( attr_str, "") != 0) {
strcat( name, ".");
strcat( name, attr_str);
sts = gdh_NameToAttrref( pwr_cNObjid, name, &attrref);
if ( EVEN(sts)) return sts;
}
else {
sts = gdh_NameToAttrref( pwr_cNObjid, name, &attrref);
if ( EVEN(sts)) return sts;
}
}
else {
sts = gdh_NameToAttrref( pwr_cNObjid, name, &attrref);
if ( EVEN(sts)) return sts;
}
*aref = attrref;
return 1;
}
int RtTrace::get_selected_node( flow_tObject *node) int RtTrace::get_selected_node( flow_tObject *node)
{ {
flow_tNode *list; flow_tNode *list;
...@@ -1254,6 +1316,7 @@ void RtTrace::changevalue( flow_tNode fnode) ...@@ -1254,6 +1316,7 @@ void RtTrace::changevalue( flow_tNode fnode)
flow_tTraceAttr attr_str; flow_tTraceAttr attr_str;
flow_eTraceType trace_type; flow_eTraceType trace_type;
int inverted; int inverted;
unsigned int options;
if ( is_authorized_cb) { if ( is_authorized_cb) {
if ( !(is_authorized_cb)(parent_ctx, if ( !(is_authorized_cb)(parent_ctx,
...@@ -1272,7 +1335,7 @@ void RtTrace::changevalue( flow_tNode fnode) ...@@ -1272,7 +1335,7 @@ void RtTrace::changevalue( flow_tNode fnode)
} }
else { else {
/* Toggle the value, start to get the current value */ /* Toggle the value, start to get the current value */
get_trace_attr( fnode, object_str, attr_str, &trace_type, &inverted); get_trace_attr( fnode, object_str, attr_str, &trace_type, &inverted, &options);
strcpy( name, object_str); strcpy( name, object_str);
strcat( name, "."); strcat( name, ".");
strcat( name, attr_str); strcat( name, attr_str);
......
/* /*
* Proview $Id: rt_trace.h,v 1.10 2007-12-03 14:51:39 claes Exp $ * Proview $Id: rt_trace.h,v 1.11 2008-05-28 11:43:43 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -111,8 +111,9 @@ class RtTrace { ...@@ -111,8 +111,9 @@ class RtTrace {
protected: protected:
void get_trace_attr( flow_tObject object, void get_trace_attr( flow_tObject object,
char *object_str, char *attr_str, flow_eTraceType *type, char *object_str, char *attr_str, flow_eTraceType *type,
int *inverted); int *inverted, unsigned int *options);
int get_objid( flow_tObject node, pwr_tObjid *objid); int get_objid( flow_tObject node, pwr_tObjid *objid);
int get_attrref( flow_tObject node, pwr_tAttrRef *aref);
int get_selected_node( flow_tObject *node); int get_selected_node( flow_tObject *node);
pwr_tStatus viewsetup(); pwr_tStatus viewsetup();
pwr_tStatus simsetup(); pwr_tStatus simsetup();
......
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