Commit 6f989254 authored by Claes Sjofors's avatar Claes Sjofors

Connect Attribute method added to SevHist

parent 44da3e53
...@@ -129,6 +129,19 @@ SObject pwrb:Class ...@@ -129,6 +129,19 @@ SObject pwrb:Class
Attr MethodName = "SevHist-PostMove" Attr MethodName = "SevHist-PostMove"
EndBody EndBody
EndObject EndObject
Object ConfiguratorPosan $Menu
Object Pointed $Menu
Object ConnectAttribute $MenuButton
Body SysBody
Attr ButtonName = "Connect Attribute"
Attr MethodName = "$Object-ConnectAttribute"
Attr MethodArguments[0] = "Attribute"
Attr FilterName = "$Object-ConnectAttributeFilter"
Attr FilterArguments[0] = "Attribute"
EndBody
EndObject
EndObject
EndObject
Object ConfiguratorPoson $Menu Object ConfiguratorPoson $Menu
Object Pointed $Menu Object Pointed $Menu
Object ConnectThread $MenuButton Object ConnectThread $MenuButton
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "co_cdh.h" #include "co_cdh.h"
#include "co_dcli.h" #include "co_dcli.h"
#include "co_api.h" #include "co_api.h"
#include "co_msg.h"
#include "cow_login.h" #include "cow_login.h"
#include "wb_wtt.h" #include "wb_wtt.h"
...@@ -1111,6 +1112,67 @@ static pwr_tStatus PM_SyntaxCheckFilter( ldh_sMenuCall *ip) ...@@ -1111,6 +1112,67 @@ static pwr_tStatus PM_SyntaxCheckFilter( ldh_sMenuCall *ip)
return 1; return 1;
} }
/*----------------------------------------------------------------------------*\
To connect an object to an attribute
\*----------------------------------------------------------------------------*/
static pwr_tStatus ConnectAttribute (
ldh_sMenuCall *ip
) {
pwr_tStatus sts;
pwr_sMenuButton mb;
pwr_sAttrRef PattrRef;
sts = ldh_ReadObjectBody(ip->PointedSession,
ip->ItemList[ip->ChosenItem].MenuObject,
"SysBody", &mb, sizeof(pwr_sMenuButton));
if (EVEN(sts)) return sts;
// Assume RtBody or SysBody
char *aname_p;
pwr_tAName aname;
int size;
sts = ldh_AttrRefToName( ip->PointedSession, &ip->Pointed, ldh_eName_ArefVol, &aname_p, &size);
if ( EVEN(sts)) return 0;
strncpy( aname, aname_p, sizeof(aname));
strcat( aname, ".");
strcat( aname, mb.MethodArguments[0]);
sts = ldh_NameToAttrRef( ip->PointedSession, aname, &PattrRef);
if (ODD(sts))
sts = ldh_WriteAttribute(ip->PointedSession, &PattrRef, &ip->Selected[0],
sizeof(pwr_tAttrRef));
if ( ip->message_cb) {
char msg[200];
if ( ODD(sts)) {
pwr_tOName name;
sts = ldh_AttrRefToName( ip->PointedSession, &ip->Selected[0], ldh_eName_Hierarchy,
&aname_p, &size);
if ( ODD(sts))
strncpy( name, aname_p, sizeof(name));
else
cdh_ObjidToString( name, ip->Selected[0].Objid, 1);
sprintf( msg, "%s connected to: %s", mb.MethodArguments[0], name);
ip->wtt->message( 'I', msg);
}
else {
msg_GetMsg( sts, msg, sizeof(msg));
ip->wtt->message( 'E', msg);
}
}
return LDH__SUCCESS;
}
static pwr_tStatus ConnectAttributeFilter( ldh_sMenuCall *ip)
{
return 1;
}
pwr_dExport pwr_BindMethods($Object) = { pwr_dExport pwr_BindMethods($Object) = {
pwr_BindMethod(CreateObject), pwr_BindMethod(CreateObject),
...@@ -1144,6 +1206,8 @@ pwr_dExport pwr_BindMethods($Object) = { ...@@ -1144,6 +1206,8 @@ pwr_dExport pwr_BindMethods($Object) = {
pwr_BindMethod(CrossreferencesFilter), pwr_BindMethod(CrossreferencesFilter),
pwr_BindMethod(PM_SyntaxCheck), pwr_BindMethod(PM_SyntaxCheck),
pwr_BindMethod(PM_SyntaxCheckFilter), pwr_BindMethod(PM_SyntaxCheckFilter),
pwr_BindMethod(ConnectAttribute),
pwr_BindMethod(ConnectAttributeFilter),
pwr_NullMethod pwr_NullMethod
}; };
......
...@@ -592,7 +592,7 @@ pwr_tStatus wb_session::getMenu( ldh_sMenuCall *ip) ...@@ -592,7 +592,7 @@ pwr_tStatus wb_session::getMenu( ldh_sMenuCall *ip)
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
wb_orep *o = m_vrep->erep()->object( &sts, Menu); wb_orep *o = m_vrep->erep()->object( &sts, Menu);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) break;
o->ref(); o->ref();
Object = o->oid(); Object = o->oid();
......
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