Commit b963ac2c authored by claes's avatar claes

PostCreate methods

parent 3571d0b0
......@@ -54,6 +54,7 @@
#include "rt_bckdef.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
#define check4a(sts,str) if((sts)==-1)perror(str)
......@@ -570,6 +571,8 @@ bck_file_process (
pwr_tUInt32 c;
pwr_tUInt32 csts;
pwr_tUInt32 cnt;
char fname[200];
#if defined OS_VMS || defined OS_ELN
pwr_tUInt32 sts;
......@@ -618,7 +621,8 @@ bck_file_process (
#else
if (backup_confp->DiskStatus == 0) {
bckfile = fopen(backup_confp->BackupFile, "r+" A_MODE);
dcli_translate_filename( fname, backup_confp->BackupFile);
bckfile = fopen(fname, "r+" A_MODE);
if (bckfile != NULL) {
errh_Info("BACKUP opened existing backupfile %s\n", FGETNAME);
csts = fread(&filehead, sizeof filehead, 1, bckfile);
......@@ -657,7 +661,8 @@ bck_file_process (
}
#else
bckfile = fopen(backup_confp->BackupFile, "w+" A_MODE);
dcli_translate_filename( fname, backup_confp->BackupFile);
bckfile = fopen(fname, "w+" A_MODE);
if (bckfile == NULL)
perror("BACKUP cannot create backupfile");
else {
......
......@@ -216,6 +216,11 @@ SObject pwrb:Class
! Template for Backup_Conf
!
Object Template Backup_Conf
Body RtBody
Attr BackupFile = "$pwrp_load:pwr_console.log"
Attr CycleFast = 100
Attr CycleSlow = 600
EndBody
EndObject
EndObject
EndSObject
......@@ -136,6 +136,11 @@ SObject pwrb:Class
EndBody
EndObject
EndObject
Object PostCreate $DbCallBack
Body SysBody
Attr MethodName = "NodeConfig-PostCreate"
EndBody
EndObject
EndObject
EndSObject
......
......@@ -449,5 +449,10 @@ SObject pwrb:Class
Attr GraphicsUpdateInterval = 0.25
EndBody
EndObject
Object PostCreate $DbCallBack
Body SysBody
Attr MethodName = "OpPlace-PostCreate"
EndBody
EndObject
EndObject
EndSObject
......@@ -102,5 +102,10 @@ SObject pwrb:Class
Attr SubscriptionInterval = 1.0
EndBody
EndObject
Object PostCreate $DbCallBack
Body SysBody
Attr MethodName = "PlcProcess-PostCreate"
EndBody
EndObject
EndObject
EndSObject
......@@ -242,5 +242,10 @@ SObject pwrb:Class
EndBody
EndObject
EndObject
Object PostCreate $DbCallBack
Body SysBody
Attr MethodName = "PlcThread-PostCreate"
EndBody
EndObject
EndObject
EndSObject
......@@ -87,5 +87,10 @@ SObject pwrb:Class
Attr DefaultVMSNode = ""
EndBody
EndObject
Object PostCreate $DbCallBack
Body SysBody
Attr MethodName = "RttConfig-PostCreate"
EndBody
EndObject
EndObject
EndSObject
......@@ -162,5 +162,10 @@ SObject pwrb:Class
Attr MaxConnections = 50
EndBody
EndObject
Object PostCreate $DbCallBack
Body SysBody
Attr MethodName = "WebHandler-PostCreate"
EndBody
EndObject
EndObject
EndSObject
......@@ -23,6 +23,24 @@ static pwr_tStatus PostCreate (
sts = ldh_ClassNameToId(Session, &cid, "IOHandler");
sts = ldh_CreateObject(Session, &oid, "IOHandler", cid, Object, ldh_eDest_IntoLast);
sts = ldh_ClassNameToId(Session, &cid, "Backup_Conf");
sts = ldh_CreateObject(Session, &oid, "Backup", cid, Object, ldh_eDest_IntoLast);
sts = ldh_ClassNameToId(Session, &cid, "OpPlace");
sts = ldh_CreateObject(Session, &oid, "Op", cid, Object, ldh_eDest_IntoLast);
sts = ldh_CreateObject(Session, &oid, "Maintenance", cid, Object, ldh_eDest_IntoLast);
sts = ldh_ClassNameToId(Session, &cid, "RttConfig");
sts = ldh_CreateObject(Session, &oid, "RttConfig", cid, Object, ldh_eDest_IntoLast);
sts = ldh_ClassNameToId(Session, &cid, "PlcProcess");
sts = ldh_CreateObject(Session, &oid, "Plc", cid, Object, ldh_eDest_IntoLast);
sts = ldh_ClassNameToId(Session, &cid, "WebHandler");
sts = ldh_CreateObject(Session, &oid, "WebHandler", cid, Object, ldh_eDest_IntoLast);
sts = ldh_ClassNameToId(Session, &cid, "WebBrowserConfig");
sts = ldh_CreateObject(Session, &oid, "WebBrowser", cid, Object, ldh_eDest_IntoLast);
return PWRS__SUCCESS;
}
......@@ -35,3 +53,7 @@ pwr_dExport pwr_BindMethods($Node) = {
/* wb_c_nodeconfig.c -- work bench methods of the NodeConfig class.
PROVIEW/R
Copyright (C) 1994 by Comator Process AB. */
#include "wb_pwrs.h"
#include "wb_pwrs_msg.h"
#include "wb_ldh.h"
static pwr_tStatus PostCreate (
ldh_tSesContext Session,
pwr_tObjid Object,
pwr_tObjid Father,
pwr_tClassId Class
) {
pwr_tObjid oid, poid;
pwr_tClassId cid;
pwr_tStatus sts;
char source[80];
sts = ldh_ClassNameToId(Session, &cid, "RootVolumeLoad");
sts = ldh_CreateObject(Session, &oid, "O1", cid, Object, ldh_eDest_IntoLast);
sts = ldh_ClassNameToId(Session, &cid, "$NodeHier");
sts = ldh_CreateObject(Session, &poid, "Distribute", cid, Object, ldh_eDest_IntoLast);
sts = ldh_ClassNameToId(Session, &cid, "GraphDistribute");
sts = ldh_CreateObject(Session, &oid, "AllPwg", cid, poid, ldh_eDest_IntoLast);
strcpy( source, "$pwrp_pop/*.pwg");
sts = ldh_SetObjectPar(Session, oid, "DevBody", "Source", source,
sizeof(source));
if ( EVEN(sts)) return sts;
return PWRS__SUCCESS;
}
pwr_dExport pwr_BindMethods(NodeConfig) = {
pwr_BindMethod(PostCreate),
pwr_NullMethod
};
/* wb_c_opplace.c -- work bench methods of the OpPlace class.
PROVIEW/R
Copyright (C) 1994 by Comator Process AB. */
#include "wb_pwrs.h"
#include "wb_pwrs_msg.h"
#include "wb_ldh.h"
static pwr_tStatus PostCreate (
ldh_tSesContext Session,
pwr_tOid Object,
pwr_tOid Father,
pwr_tCid Class
) {
pwr_tOid oid;
pwr_tCid cid;
pwr_tStatus sts;
pwr_tInt32 *number;
pwr_tInt32 max_number = 0;
int size;
sts = ldh_ClassNameToId(Session, &cid, "OpPlace");
if ( EVEN(sts)) return sts;
// Get next OpNumber
sts = ldh_GetClassList(Session, cid, &oid);
while ( ODD(sts)) {
sts = ldh_GetObjectPar(Session, oid, "RtBody", "OpNumber", (char **)&number,
&size);
if ( EVEN(sts)) return sts;
if ( *number > max_number)
max_number = *number;
free( (char *) number);
sts = ldh_GetNextObject(Session, oid, &oid);
}
sts = ldh_ClassNameToId(Session, &cid, "User");
if ( EVEN(sts)) return sts;
sts = ldh_GetClassList(Session, cid, &oid);
while ( ODD(sts)) {
sts = ldh_GetObjectPar(Session, oid, "RtBody", "OpNumber", (char **)&number,
&size);
if ( EVEN(sts)) return sts;
if ( *number > max_number)
max_number = *number;
free( (char *) number);
sts = ldh_GetNextObject(Session, oid, &oid);
}
max_number++;
sts = ldh_CreateObject(Session, &oid, "User", cid, Object, ldh_eDest_IntoLast);
if ( EVEN(sts)) return sts;
sts = ldh_SetObjectPar(Session, Object, "RtBody", "OpNumber", (char *)&max_number,
sizeof(max_number));
if ( EVEN(sts)) return sts;
sts = ldh_SetObjectPar(Session, oid, "RtBody", "OpNumber", (char *)&max_number,
sizeof(max_number));
if ( EVEN(sts)) return sts;
return PWRS__SUCCESS;
}
pwr_dExport pwr_BindMethods(OpPlace) = {
pwr_BindMethod(PostCreate),
pwr_NullMethod
};
/* wb_c_plcprocess.c -- work bench methods of the PlcProcess class.
PROVIEW/R
Copyright (C) 1994 by Comator Process AB. */
#include "wb_pwrs.h"
#include "wb_pwrs_msg.h"
#include "wb_ldh.h"
static pwr_tStatus PostCreate (
ldh_tSesContext Session,
pwr_tOid Object,
pwr_tOid Father,
pwr_tCid Class
) {
pwr_tOid oid;
pwr_tCid cid;
pwr_tStatus sts;
pwr_tFloat32 scan_time = 0.1;
sts = ldh_ClassNameToId(Session, &cid, "PlcThread");
if ( EVEN(sts)) return sts;
sts = ldh_CreateObject(Session, &oid, "100ms", cid, Object, ldh_eDest_IntoLast);
if ( EVEN(sts)) return sts;
sts = ldh_SetObjectPar(Session, oid, "RtBody", "ScanTime", (char *)&scan_time,
sizeof(scan_time));
if ( EVEN(sts)) return sts;
return PWRS__SUCCESS;
}
pwr_dExport pwr_BindMethods(PlcProcess) = {
pwr_BindMethod(PostCreate),
pwr_NullMethod
};
/* wb_c_plcthread.c -- work bench methods of the PlcThread class.
PROVIEW/R
Copyright (C) 1994 by Comator Process AB. */
#include "wb_pwrs.h"
#include "wb_pwrs_msg.h"
#include "wb_ldh.h"
static pwr_tStatus PostCreate (
ldh_tSesContext Session,
pwr_tOid Object,
pwr_tOid Father,
pwr_tCid Class
) {
pwr_tOid oid;
pwr_tCid cid;
pwr_tStatus sts;
pwr_tEnum delay_action;
pwr_tString80 detect_text = "Plc thread delayed";
pwr_tFloat32 max_delay;
sts = ldh_ClassNameToId(Session, &cid, "CycleSup");
if ( EVEN(sts)) return sts;
sts = ldh_CreateObject(Session, &oid, "Alarm", cid, Object, ldh_eDest_IntoLast);
if ( EVEN(sts)) return sts;
delay_action = 1;
sts = ldh_SetObjectPar(Session, oid, "RtBody", "DelayAction", (char *)&delay_action,
sizeof(delay_action));
if ( EVEN(sts)) return sts;
max_delay = 0.1;
sts = ldh_SetObjectPar(Session, oid, "RtBody", "MaxDelay", (char *)&max_delay,
sizeof(max_delay));
if ( EVEN(sts)) return sts;
sts = ldh_SetObjectPar(Session, oid, "RtBody", "DetectText", (char *)&detect_text,
sizeof(detect_text));
if ( EVEN(sts)) return sts;
sts = ldh_CreateObject(Session, &oid, "Halt", cid, Object, ldh_eDest_IntoLast);
if ( EVEN(sts)) return sts;
delay_action = 2;
sts = ldh_SetObjectPar(Session, oid, "RtBody", "DelayAction", (char *)&delay_action,
sizeof(delay_action));
if ( EVEN(sts)) return sts;
max_delay = 1.0;
sts = ldh_SetObjectPar(Session, oid, "RtBody", "MaxDelay", (char *)&max_delay,
sizeof(max_delay));
if ( EVEN(sts)) return sts;
return PWRS__SUCCESS;
}
pwr_dExport pwr_BindMethods(PlcThread) = {
pwr_BindMethod(PostCreate),
pwr_NullMethod
};
/* wb_c_rttconfig.c -- work bench methods of the RttConfig class.
PROVIEW/R
Copyright (C) 1994 by Comator Process AB. */
#include "wb_pwrs.h"
#include "wb_pwrs_msg.h"
#include "wb_ldh.h"
static pwr_tStatus PostCreate (
ldh_tSesContext Session,
pwr_tOid Object,
pwr_tOid Father,
pwr_tCid Class
) {
pwr_tOid oid;
pwr_tCid cid;
pwr_tStatus sts;
pwr_tInt32 *number;
pwr_tInt32 max_number = 0;
int size;
sts = ldh_ClassNameToId(Session, &cid, "OpPlace");
if ( EVEN(sts)) return sts;
// Get next OpNumber
sts = ldh_GetClassList(Session, cid, &oid);
while ( ODD(sts)) {
sts = ldh_GetObjectPar(Session, oid, "RtBody", "OpNumber", (char **)&number,
&size);
if ( EVEN(sts)) return sts;
if ( *number > max_number)
max_number = *number;
free( (char *) number);
sts = ldh_GetNextObject(Session, oid, &oid);
}
sts = ldh_ClassNameToId(Session, &cid, "User");
if ( EVEN(sts)) return sts;
sts = ldh_GetClassList(Session, cid, &oid);
while ( ODD(sts)) {
sts = ldh_GetObjectPar(Session, oid, "RtBody", "OpNumber", (char **)&number,
&size);
if ( EVEN(sts)) return sts;
if ( *number > max_number)
max_number = *number;
free( (char *) number);
sts = ldh_GetNextObject(Session, oid, &oid);
}
max_number++;
sts = ldh_CreateObject(Session, &oid, "User", cid, Object, ldh_eDest_IntoLast);
if ( EVEN(sts)) return sts;
sts = ldh_SetObjectPar(Session, oid, "RtBody", "OpNumber", (char *)&max_number,
sizeof(max_number));
if ( EVEN(sts)) return sts;
sts = ldh_SetObjectPar(Session, Object, "RtBody", "UserObject", (char *)&oid,
sizeof(oid));
if ( EVEN(sts)) return sts;
return PWRS__SUCCESS;
}
pwr_dExport pwr_BindMethods(RttConfig) = {
pwr_BindMethod(PostCreate),
pwr_NullMethod
};
/* wb_c_webhandler.c -- work bench methods of the WebHandler class.
PROVIEW/R
Copyright (C) 1994 by Comator Process AB. */
#include "wb_pwrs.h"
#include "wb_pwrs_msg.h"
#include "wb_ldh.h"
static pwr_tStatus PostCreate (
ldh_tSesContext Session,
pwr_tOid Object,
pwr_tOid Father,
pwr_tCid Class
) {
pwr_tOid oid;
pwr_tCid cid;
pwr_tStatus sts;
pwr_tInt32 *number;
pwr_tInt32 max_number = 0;
int size;
sts = ldh_ClassNameToId(Session, &cid, "OpPlace");
if ( EVEN(sts)) return sts;
// Get next OpNumber
sts = ldh_GetClassList(Session, cid, &oid);
while ( ODD(sts)) {
sts = ldh_GetObjectPar(Session, oid, "RtBody", "OpNumber", (char **)&number,
&size);
if ( EVEN(sts)) return sts;
if ( *number > max_number)
max_number = *number;
free( (char *) number);
sts = ldh_GetNextObject(Session, oid, &oid);
}
sts = ldh_ClassNameToId(Session, &cid, "User");
if ( EVEN(sts)) return sts;
sts = ldh_GetClassList(Session, cid, &oid);
while ( ODD(sts)) {
sts = ldh_GetObjectPar(Session, oid, "RtBody", "OpNumber", (char **)&number,
&size);
if ( EVEN(sts)) return sts;
if ( *number > max_number)
max_number = *number;
free( (char *) number);
sts = ldh_GetNextObject(Session, oid, &oid);
}
max_number++;
sts = ldh_CreateObject(Session, &oid, "User", cid, Object, ldh_eDest_IntoLast);
if ( EVEN(sts)) return sts;
sts = ldh_SetObjectPar(Session, oid, "RtBody", "OpNumber", (char *)&max_number,
sizeof(max_number));
if ( EVEN(sts)) return sts;
sts = ldh_SetObjectPar(Session, Object, "RtBody", "UserObject", (char *)&oid,
sizeof(oid));
if ( EVEN(sts)) return sts;
return PWRS__SUCCESS;
}
pwr_dExport pwr_BindMethods(WebHandler) = {
pwr_BindMethod(PostCreate),
pwr_NullMethod
};
#include "wb_destination.h"
#include "wb_object.h"
#include "pwr_systemclasses.h"
#include "pwr_baseclasses.h"
wb_destination::wb_destination(pwr_tOid oid, ldh_eDest code) :
m_oid(oid), m_code(code)
......@@ -10,3 +12,14 @@ wb_destination::wb_destination(wb_object &o, ldh_eDest code) :
m_oid(o.oid()), m_code(code)
{
}
bool wb_destination::canAdopt( pwr_tCid cid)
{
switch ( cid) {
case pwr_cClass_MountObject:
case pwr_cClass_CreateVolume:
return false;
default:
return true;
}
}
......@@ -17,7 +17,7 @@ public:
wb_destination(pwr_tOid oid, ldh_eDest code);
bool canAdopt(pwr_tCid cid) {return true;} // Fix
bool canAdopt(pwr_tCid cid);
bool canAdopt(pwr_tOid oid) {return true;} // Fix
pwr_tOid oid() { return m_oid;}
ldh_eDest code() { return m_code;}
......
......@@ -44,6 +44,12 @@ pwr_dImport pwr_BindMethods(Co);
pwr_dImport pwr_BindMethods(Po);
pwr_dImport pwr_BindMethods(XttGraph);
pwr_dImport pwr_BindMethods(WebGraph);
pwr_dImport pwr_BindMethods(OpPlace);
pwr_dImport pwr_BindMethods(RttConfig);
pwr_dImport pwr_BindMethods(WebHandler);
pwr_dImport pwr_BindMethods(PlcProcess);
pwr_dImport pwr_BindMethods(PlcThread);
pwr_dImport pwr_BindMethods(NodeConfig);
pwr_dExport pwr_BindClasses(Base) = {
pwr_BindClass(ASup),
......@@ -85,6 +91,19 @@ pwr_dExport pwr_BindClasses(Base) = {
pwr_BindClass(Po),
pwr_BindClass(XttGraph),
pwr_BindClass(WebGraph),
pwr_BindClass(OpPlace),
pwr_BindClass(RttConfig),
pwr_BindClass(WebHandler),
pwr_BindClass(PlcProcess),
pwr_BindClass(PlcThread),
pwr_BindClass(NodeConfig),
pwr_NullClass
};
......@@ -524,9 +524,9 @@ pwr_tStatus wb_session::getMenu( ldh_sMenuCall *ip)
o_menu = cdrep->menuAfter( &sts, o_menu, &o_menu_body);
prev->unref();
}
delete cdrep;
o->unref();
}
delete cdrep;
switch (ip->SelectedSet) {
case ldh_eMenuSet_Attribute:
......@@ -552,9 +552,9 @@ pwr_tStatus wb_session::getMenu( ldh_sMenuCall *ip)
o_menu = cdrep->menuAfter( &sts, o_menu, &o_menu_body);
prev->unref();
}
delete cdrep;
o->unref();
}
delete cdrep;
/* Find specific menues for selected object(s) */
if (ip->PointedSet == ldh_eMenuSet_Class) {
......@@ -588,9 +588,9 @@ pwr_tStatus wb_session::getMenu( ldh_sMenuCall *ip)
o_menu = cdrep->menuAfter( &sts, o_menu, &o_menu_body);
prev->unref();
}
delete cdrep;
o->unref();
}
delete cdrep;
break;
default:
......
......@@ -121,6 +121,18 @@ wb_object wb_volume::object(pwr_tOid oid) const
return o;
}
wb_object wb_volume::object(pwr_tCid cid) const
{
pwr_tStatus sts;
wb_orep *orep;
wb_object o;
orep = m_vrep->object( &sts, cid);
o = wb_object(sts, orep);
return o;
}
wb_object wb_volume::object(const char *name) const
{
pwr_tStatus sts;
......
......@@ -49,7 +49,7 @@ public:
wb_object object() const; // Get root list
wb_object object(pwr_tOid oid) const;
wb_object object(pwr_tCid cid) const { wb_object o; return o;} // Fix
wb_object object(pwr_tCid cid) const;
wb_object object(const char *name) const;
wb_attribute attribute(pwr_tOid oid, const char *bname, const char *aname) const;
......
......@@ -69,6 +69,7 @@ public:
virtual wb_orep *object(pwr_tStatus *sts, pwr_tOid oid) = 0;
virtual wb_orep *object(pwr_tStatus *sts, wb_name &name) = 0;
virtual wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name) = 0;
virtual wb_orep *object(pwr_tStatus *sts, pwr_tCid cid) = 0;
virtual wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name) = 0;
......
......@@ -53,6 +53,7 @@ public:
virtual wb_orep *object(pwr_tStatus *sts);
virtual wb_orep *object(pwr_tStatus *sts, pwr_tOid oid);
virtual wb_orep *object(pwr_tStatus *sts, pwr_tCid cid) { *sts = LDH__NYI; return 0;}
virtual wb_orep *object(pwr_tStatus *sts, wb_name &name);
virtual wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name);
......
......@@ -59,6 +59,7 @@ public:
virtual wb_orep *object(pwr_tStatus *sts, pwr_tOid oid);
virtual wb_orep *object(pwr_tStatus *sts, pwr_tCid cid) { *sts = LDH__NYI; return 0;}
virtual wb_orep *object(pwr_tStatus *sts, wb_name &name);
virtual wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name);
......
......@@ -71,6 +71,25 @@ wb_orep *wb_vrepmem::object(pwr_tStatus *sts, pwr_tOid oid)
return new wb_orepmem( this, n);
}
wb_orep *wb_vrepmem::object(pwr_tStatus *sts, pwr_tCid cid)
{
if ( root_object) {
mem_object *n;
if ( root_object->m_cid == cid)
n = root_object;
else {
pwr_tOix oix = 0;
n = root_object->next( cid, &oix);
}
if ( n) {
*sts = LDH__SUCCESS;
return new wb_orepmem( this, n);
}
}
*sts = LDH__NOSUCHOBJ;
return 0;
}
wb_orep *wb_vrepmem::object(pwr_tStatus *sts, wb_name &name)
{
mem_object *n = find( name.name());
......@@ -351,6 +370,16 @@ wb_orep *wb_vrepmem::last(pwr_tStatus *sts, const wb_orep *o)
wb_orep *wb_vrepmem::next(pwr_tStatus *sts, const wb_orep *o)
{
mem_object *mem = findObject( o->oid().oix);
if ( mem) {
pwr_tOix oix = mem->m_oid.oix;
mem_object *next = root_object->next( mem->m_cid, &oix);
if ( next) {
wb_orepmem *orep = new wb_orepmem( this, next);
return orep;
}
}
*sts = LDH__NOSUCHOBJ;
return 0;
}
......@@ -547,6 +576,11 @@ wb_orep *wb_vrepmem::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination
*sts = LDH__BADDEST;
return 0;
}
// Check that name is unic
if ( name && !nameCheck( dest, name.segment(), code)) {
*sts = LDH__NAMALREXI;
return 0;
}
}
pwr_tOix oix = nextOix();
......@@ -744,6 +778,9 @@ bool wb_vrepmem::moveObject(pwr_tStatus *sts, wb_orep *orep, wb_destination &d)
mem_object *dest;
ldh_eDest code = d.code();
if ( cdh_ObjidIsEqual( d.oid(), orep->oid()))
return false;
if ( cdh_ObjidIsNull( d.oid())) {
dest = root_object;
if ( code == ldh_eDest_After)
......@@ -1325,6 +1362,31 @@ bool wb_vrepmem::nameCheck( mem_object *memo)
return true;
}
bool wb_vrepmem::nameCheck( mem_object *dest, char *name, ldh_eDest code)
{
mem_object *o;
switch ( code) {
case ldh_eDest_After:
case ldh_eDest_Before:
o = dest;
while ( o->bws)
o = o->bws;
break;
case ldh_eDest_IntoFirst:
case ldh_eDest_IntoLast:
o = dest->fch;
break;
default:
return false;
}
while ( o) {
if ( cdh_NoCaseStrcmp( name, o->name()) == 0)
return false;
o = o->fws;
}
return true;
}
......
......@@ -76,6 +76,32 @@ class mem_object
return true;
}
mem_object *next( pwr_tCid cid, pwr_tOix *oix) {
// search is turned on when oix = 0
if ( *oix == m_oid.oix)
*oix = 0;
mem_object *n;
if ( fch) {
if ( !*oix && fch->m_cid == cid)
return fch;
else {
n = fch->next( cid, oix);
if ( n)
return n;
}
}
if ( fws) {
if ( !*oix && fws->m_cid == cid)
return fws;
else {
n = fws->next( cid, oix);
if ( n)
return n;
}
}
return 0;
}
mem_object *find( wb_name *oname, int level);
size_t rbody_size;
......@@ -171,6 +197,7 @@ public:
wb_orep *object(pwr_tStatus *sts);
wb_orep *object(pwr_tStatus *sts, pwr_tOid oid);
wb_orep *object(pwr_tStatus *sts, pwr_tCid cid);
wb_orep *object(pwr_tStatus *sts, wb_name &name);
wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name) {return 0;}
......@@ -249,6 +276,7 @@ public:
private:
bool nameCheck( mem_object *memo);
bool nameCheck( mem_object *parent, char *name, ldh_eDest code);
void deleteChildren( mem_object *memo);
};
......
......@@ -126,6 +126,7 @@ public:
wb_orep *object(pwr_tStatus *sts);
wb_orep *object(pwr_tStatus *sts, pwr_tOid oid);
wb_orep *object(pwr_tStatus *sts, pwr_tCid cid) { *sts = LDH__NYI; return 0;}
wb_orep *object(pwr_tStatus *sts, wb_name &name);
wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name) {return 0;}
......
......@@ -2905,51 +2905,63 @@ void WNav::ldh_refresh( pwr_tObjid new_open)
brow_Redraw( brow->ctx, 0);
}
void WNav::ldh_event( ldh_sEvent *event)
void WNav::ldh_event( ldh_sEvent *e)
{
WItem *item;
ldh_sEvent *event = e;
switch (event->Event)
{
case ldh_eEvent_ObjectCopied:
case ldh_eEvent_ObjectCreated:
if ( cdh_ObjidIsNull(event->NewParent) ||
find( event->NewParent, (void **) &item))
ldh_refresh( event->NewParent);
break;
case ldh_eEvent_ObjectDeleted:
if ( cdh_ObjidIsNull(event->NewParent) ||
find( event->OldParent, (void **) &item))
ldh_refresh( event->NewParent);
break;
case ldh_eEvent_ObjectMoved:
if ( cdh_ObjidIsNull(event->NewParent) ||
cdh_ObjidIsNull(event->OldParent) ||
find( event->NewParent, (void **) &item) ||
find( event->OldParent, (void **) &item))
ldh_refresh( event->NewParent);
break;
case ldh_eEvent_AttributeModified:
case ldh_eEvent_ObjectRenamed:
case ldh_eEvent_BodyModified:
if ( find( event->Object, (void **) &item))
ldh_refresh( pwr_cNObjid);
break;
case ldh_eEvent_ObjectTreeCopied:
if ( find( event->Object, (void **) &item))
ldh_refresh( event->Object);
break;
if ( e->nep)
// Multiple events
brow_SetNodraw( brow->ctx);
case ldh_eEvent_SessionReverted:
ldh_refresh( pwr_cNObjid);
break;
while ( event) {
switch (event->Event)
{
case ldh_eEvent_ObjectCopied:
case ldh_eEvent_ObjectCreated:
if ( cdh_ObjidIsNull(event->NewParent) ||
find( event->NewParent, (void **) &item))
ldh_refresh( event->NewParent);
break;
case ldh_eEvent_ObjectDeleted:
if ( cdh_ObjidIsNull(event->NewParent) ||
find( event->OldParent, (void **) &item))
ldh_refresh( event->NewParent);
break;
case ldh_eEvent_ObjectMoved:
if ( cdh_ObjidIsNull(event->NewParent) ||
cdh_ObjidIsNull(event->OldParent) ||
find( event->NewParent, (void **) &item) ||
find( event->OldParent, (void **) &item))
ldh_refresh( event->NewParent);
break;
case ldh_eEvent_AttributeModified:
case ldh_eEvent_ObjectRenamed:
case ldh_eEvent_BodyModified:
if ( find( event->Object, (void **) &item))
ldh_refresh( pwr_cNObjid);
break;
case ldh_eEvent_ObjectTreeCopied:
if ( find( event->Object, (void **) &item))
ldh_refresh( event->Object);
break;
case ldh_eEvent_SessionReverted:
ldh_refresh( pwr_cNObjid);
break;
default:
break;
default:
break;
}
event = event->nep;
}
if ( e->nep) {
brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, 0);
}
}
......
......@@ -216,7 +216,7 @@ Widget wtt_create_popup_menu( Wtt *wtt, pwr_tObjid objid)
else
sel2_cnt = 0;
if (sel1_cnt + sel2_cnt != 0)
if (sel1_cnt + sel2_cnt != 0)
{
mcp->SelectedSet = sel1_cnt + sel2_cnt > 1 ? ldh_eMenuSet_Many : ldh_eMenuSet_Object;
}
......@@ -238,6 +238,20 @@ Widget wtt_create_popup_menu( Wtt *wtt, pwr_tObjid objid)
mcp->Selected[sel1_cnt + sel2_cnt].Objid = pwr_cNObjid;
mcp->SelectCount = sel1_cnt + sel2_cnt;
if ( sel1_cnt + sel2_cnt == 0) {
pwr_tCid cid;
sts = wtt->palette->get_select( &cid);
if ( ODD(sts)) {
XtFree( (char *) mcp->Selected);
mcp->Selected = (pwr_sAttrRef *) XtCalloc( 2, sizeof (pwr_sAttrRef));
mcp->SelectedSet = ldh_eMenuSet_Class;
mcp->Selected[0].Objid = cdh_ClassIdToObjid( cid);
mcp->Selected[1].Objid = pwr_cNObjid;
mcp->SelectCount = 1;
}
}
sts = ldh_GetMenu( wtt->ldhses, mcp);
if (EVEN(sts) || mcp->ItemList[0].Level == 0) {
return NULL;
......
......@@ -124,12 +124,8 @@ static pwr_tStatus wtt_ldh_this_session_cb (
{
Wtt *wtt = (Wtt *) ctx;
while (event)
{
wtt->wnav->ldh_event( event);
wtt->wnavnode->ldh_event( event);
event = event->nep;
}
wtt->wnav->ldh_event( event);
wtt->wnavnode->ldh_event( event);
return 1;
}
......
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