Commit ec8f4569 authored by claes's avatar claes

*** empty log message ***

parent 38cdffbc
......@@ -474,7 +474,8 @@ union pwr_m_ClassDef {
pwr_Bits( NoAdopt , 1), /* object can not have children */
pwr_Bits( Template , 1), /* object is a template object */
pwr_Bits( IO , 1), /* object is an IO object */
pwr_Bits( fill_0 , 4),,,,
pwr_Bits( HasCallBack , 1), /* object has DbCallBack */
pwr_Bits( fill_0 , 3),,,
pwr_Bits( fill_1 , 8),,,,,,,,
pwr_Bits( fill_2 , 8),,,,,,,
) b;
......@@ -491,6 +492,7 @@ union pwr_m_ClassDef {
#define pwr_mClassDef_NoAdopt pwr_Bit(9)
#define pwr_mClassDef_Template pwr_Bit(10)
#define pwr_mClassDef_IO pwr_Bit(11)
#define pwr_mClassDef_HasCallBack pwr_Bit(12)
#define pwr_mClassDef_HasRef (pwr_mClassDef_ObjXRef|pwr_mClassDef_AttrXRef|\
pwr_mClassDef_ObjRef|pwr_mClassDef_AttrRef)
......
......@@ -93,7 +93,7 @@ notype <no type exist> /error
nobase <no base system> /error
projconfig <project is not configured> /info
wblparse <error when parsing wb_load file> /error
nomethod <no such method> /error
......
......@@ -7,6 +7,26 @@
#include "wb_bdrep.h"
#include "wb_adrep.h"
static pwr_tString32 callBackName[] = {
"__", // ldh_eDbCallBack__
"AnteCreate", // ldh_eDbCallBack_AnteCreate
"PostCreate", // ldh_eDbCallBack_PostCreate
"AnteDelete", // ldh_eDbCallBack_AnteDelete
"PostDelete", // ldh_eDbCallBack_PostDelete
"AnteMove", // ldh_eDbCallBack_AnteMove
"PostMove", // ldh_eDbCallBack_PostMove
"AnteRename", // ldh_eDbCallBack_AnteRename
"PostRename", // ldh_eDbCallBack_PostRename
"AnteAdopt", // ldh_eDbCallBack_AnteAdopt
"PostAdopt", // ldh_eDbCallBack_PostAdopt
"AnteUnadopt",// ldh_eDbCallBack_AnteUnadopt
"PostUnadopt",// ldh_eDbCallBack_PostUnadopt
"AnteUpdate", // ldh_eDbCallBack_AnteUpdate
"PostUpdate", // ldh_eDbCallBack_PostUpdate
"SyntaxCheck",// ldh_eDbCallBack_SyntaxCheck
"-" // ldh_eDbCallBack_
};
void wb_cdrep::unref()
{
if ( --m_nRef == 0)
......@@ -191,3 +211,144 @@ wb_name wb_cdrep::longName()
{
return m_orep->longName();
}
void wb_cdrep::dbCallBack( pwr_tStatus *sts, ldh_eDbCallBack cb, char **methodName,
pwr_sDbCallBack **o)
{
wb_name cb_name = wb_name( callBackName[cb]);
wb_orepdbs *orep = (wb_orepdbs *)m_orep->m_vrep->child( sts, m_orep, cb_name);
if ( EVEN(*sts)) return;
orep->ref();
if ( orep->cid() != pwr_eClass_DbCallBack) {
*sts = LDH__NOSUCHOBJ;
orep->unref();
return;
}
pwr_sDbCallBack *dbcallback;
dbcallback = (pwr_sDbCallBack *) m_orep->m_vrep->readBody( sts, orep, pwr_eBix_sys, 0);
if ( EVEN(*sts)) {
orep->unref();
return;
}
*methodName = dbcallback->MethodName;
if ( o)
*o = dbcallback;
}
// Get first menu object
wb_orep *wb_cdrep::menu( pwr_tStatus *sts, void **o)
{
wb_orepdbs *prev;
wb_orepdbs *orep = (wb_orepdbs *)m_orep->m_vrep->first( sts, m_orep);
while ( ODD(*sts)) {
switch ( orep->cid()) {
case pwr_eClass_Menu:
case pwr_eClass_MenuButton:
case pwr_eClass_MenuCascade:
case pwr_eClass_MenuSeparator:
break;
default:
;
}
prev = orep;
orep = (wb_orepdbs *)orep->after( sts);
prev->ref();
prev->unref();
}
if ( EVEN(*sts)) {
*sts = LDH__NOSUCHOBJ;
return 0;
}
void *menubody;
menubody = m_orep->m_vrep->readBody( sts, orep, pwr_eBix_sys, 0);
if ( EVEN(*sts)) {
orep->ref();
orep->unref();
return 0;
}
if ( o)
*o = menubody;
return orep;
}
// Get next menu sibling
wb_orep *wb_cdrep::menuAfter( pwr_tStatus *sts, wb_orep *orep, void **o)
{
wb_orepdbs *prev;
wb_orepdbs *after = (wb_orepdbs *)orep->after( sts);
if ( EVEN(*sts)) return 0;
while ( ODD(*sts)) {
switch ( after->cid()) {
case pwr_eClass_Menu:
case pwr_eClass_MenuButton:
case pwr_eClass_MenuCascade:
case pwr_eClass_MenuSeparator:
break;
default:
;
}
prev = after;
after = (wb_orepdbs *)orep->after( sts);
prev->ref();
prev->unref();
}
if ( EVEN(*sts)) {
*sts = LDH__NOSUCHOBJ;
return 0;
}
void *menubody;
menubody = m_orep->m_vrep->readBody( sts, after, pwr_eBix_sys, 0);
if ( EVEN(*sts)) {
after->ref();
after->unref();
return 0;
}
if ( o)
*o = menubody;
return after;
}
// Get first menu child of a menu object
wb_orep *wb_cdrep::menuFirst( pwr_tStatus *sts, wb_orep *orep, void **o)
{
wb_orepdbs *first = (wb_orepdbs *)orep->first( sts);
if ( EVEN(*sts)) return 0;
switch ( first->cid()) {
case pwr_eClass_Menu:
case pwr_eClass_MenuButton:
case pwr_eClass_MenuCascade:
case pwr_eClass_MenuSeparator:
break;
default:
*sts = LDH__NOSUCHOBJ;
return 0;
}
void *menubody;
menubody = m_orep->m_vrep->readBody( sts, first, pwr_eBix_sys, 0);
if ( EVEN(*sts)) {
first->ref();
first->unref();
return 0;
}
if ( o)
*o = menubody;
return first;
}
......@@ -4,6 +4,7 @@
#include "pwr.h"
#include "pwr_class.h"
#include "wb_name.h"
#include "wb_ldh.h"
class wb_adrep;
class wb_bdrep;
......@@ -47,6 +48,12 @@ public:
wb_orep *classBody( pwr_tStatus *sts, const char *bname);
void templateBody( pwr_tStatus *sts, pwr_eBix bix, void *p);
void dbCallBack( pwr_tStatus *sts, ldh_eDbCallBack cb, char **methodName,
pwr_sDbCallBack **o);
wb_orep *menu( pwr_tStatus *sts, void **o);
wb_orep *menuAfter( pwr_tStatus *sts, wb_orep *orep, void **o);
wb_orep *menuFirst( pwr_tStatus *sts, wb_orep *orep, void **o);
pwr_tStatus sts() { return m_sts;}
};
......
......@@ -18,8 +18,12 @@ extern "C" {
#include "co_dcli.h"
#include "co_cdh.h"
#include "rt_load.h"
#include "wb_pwrs.h"
}
pwr_dImport pwr_BindClasses(System);
pwr_dImport pwr_BindClasses(Base);
wb_erep::wb_erep() : m_dir_cnt(0)
{
m_merep = new wb_merep(0);
......@@ -222,14 +226,18 @@ void wb_erep::load( pwr_tStatus *sts)
else if ( *sts == LDH__PROJCONFIG) {
pwr_tStatus status;
loadCommonMeta( &status);
if ( EVEN(status))
if ( EVEN(status)) {
*sts = status;
return;
}
bindMethods();
return;
}
loadCommonMeta( sts);
if ( EVEN(*sts)) return;
loadMeta( sts);
bindMethods();
loadLocalWb( sts);
}
......@@ -516,7 +524,62 @@ wb_orep *wb_erep::object(pwr_tStatus *sts, wb_name &name)
}
void wb_erep::method( pwr_tStatus *sts, char *methodName, wb_tMethod *method)
{
string key = string( methodName);
methods_iterator it = m_methods.find( key);
if ( it == m_methods.end()) {
*sts = LDH__NOMETHOD;
return;
}
*sts = LDH__SUCCESS;
*method = it->second;
}
void wb_erep::bindMethods()
{
int i, j;
pwr_tStatus sts;
char str[200];
for (i = 0;; i++) {
if (pwr_gSystem_ClassMethods[i].ClassName[0] == '\0')
break;
for (j = 0;; j++) {
if ((*pwr_gSystem_ClassMethods[i].Methods)[j].MethodName[0] == '\0')
break;
strcpy( str, pwr_gSystem_ClassMethods[i].ClassName);
strcat( str, "-");
strcat( str, (*pwr_gSystem_ClassMethods[i].Methods)[j].MethodName);
string key = string( str);
m_methods[ key] = (*pwr_gSystem_ClassMethods[i].Methods)[j].Method;
}
}
for (i = 0;; i++) {
if (pwr_gBase_ClassMethods[i].ClassName[0] == '\0') break;
wb_name cname = wb_name( pwr_gBase_ClassMethods[i].ClassName);
wb_cdrep *cdrep = m_merep->cdrep( &sts, cname);
if ( EVEN(sts))
continue;
for (j = 0;; j++) {
if ((*pwr_gBase_ClassMethods[i].Methods)[j].MethodName[0] == '\0')
break;
strcpy( str, pwr_gBase_ClassMethods[i].ClassName);
strcat( str, "-");
strcat( str, (*pwr_gBase_ClassMethods[i].Methods)[j].MethodName);
string key = string( str);
m_methods[ key] = (*pwr_gBase_ClassMethods[i].Methods)[j].Method;
}
delete cdrep;
}
for ( methods_iterator it = m_methods.begin(); it != m_methods.end(); it++) {
cout << " Method: " << it->first << endl;
}
}
......
......@@ -2,6 +2,7 @@
#define wb_erep_h
#include <map>
#include "wb_pwrs.h"
using namespace std;
......@@ -15,17 +16,19 @@ class wb_name;
class wb_erep
{
typedef map<pwr_tVid, wb_vrep*>::iterator vrep_iterator;
typedef map< string, wb_tMethod>::iterator methods_iterator;
unsigned int m_nRef;
wb_merep *m_merep;
map<pwr_tVid, wb_vrep*> m_vrepdb;
map<pwr_tVid, wb_vrep*> m_vrepdbs;
map<pwr_tVid, wb_vrep*> m_vrepextern;
map< string, wb_tMethod> m_methods;
char m_dir_list[10][200];
int m_dir_cnt;
typedef map<pwr_tVid, wb_vrep*>::iterator vrep_iterator;
public:
wb_erep();
~wb_erep();
......@@ -53,12 +56,14 @@ public:
wb_cdrep *cdrep( pwr_tStatus *sts, const wb_orep& o);
wb_tdrep *tdrep( pwr_tStatus *sts, const wb_adrep& a);
void method( pwr_tStatus *sts, char *methodName, wb_tMethod *method);
private:
void loadDirList( pwr_tStatus *status);
void loadCommonMeta( pwr_tStatus *status);
void loadMeta( pwr_tStatus *status);
void loadLocalWb( pwr_tStatus *sts);
void bindMethods();
};
#endif
......
......@@ -218,18 +218,9 @@ ldh_OpenVolume(ldh_tWorkbench workbench, ldh_tSession *session, pwr_tVid vid)
pwr_tStatus
ldh_CallMenuMethod(ldh_sMenuCall *mcp, int index)
{
pwr_tStatus sts = LDH__SUCCESS;
// pwr_tStatus (*method)(ldh_sMenuCall*) = mcp->ItemList[index].Method;
//ldhi_sSession *sp = mcp->PointedSession;
wb_session *sp = (wb_session *) mcp->PointedSession;
//wb_event e = sp->event(pwr_cNOid, ldh_eEvent_MenuMethodCalled);
//if (method != NULL)
//sts = (*method)(mcp);
//e.send();
return sts;
return sp->callMenuMethod( mcp, index);
}
pwr_tStatus
......@@ -519,9 +510,11 @@ ldh_GetNextObject(ldh_tSession session, pwr_tOid oid, pwr_tOid *new_oid)
}
pwr_tStatus
ldh_GetMenu(ldh_sMenuCall *ip)
ldh_GetMenu(ldh_tSession session, ldh_sMenuCall *ip)
{
return LDH__NYI;
wb_session *sp = (wb_session *)session;
return sp->getMenu( ip);
}
pwr_tStatus
......@@ -1160,20 +1153,15 @@ ldh_ReadAttribute(ldh_tSession session, pwr_sAttrRef *arp, void *value, int size
/* Reads a named body of an object into a buffer supplied in the call. */
pwr_tStatus
ldh_ReadObjectBody(ldh_tSession *session, pwr_tObjid oid, char *bname, void *value, int size)
ldh_ReadObjectBody(ldh_tSession session, pwr_tObjid oid, char *bname, void *value, int size)
{
#if NOT_YET_IMPLEMENTED
wb_session *sp = (wb_session*)session;
wb_body b = sp->body(oid, bname);
if (!b) return b.sts();
wb_value v(value, size);
if (!v) return v.sts();
wb_session *sp = (wb_session *)session;
wb_object o = sp->object(oid);
wb_attribute a = sp->attribute(o, bname);
v = b.value();
return v.sts();
#else
return LDH__NYI;
#endif
a.value( value);
return LDH__SUCCESS;
}
pwr_tStatus
......@@ -1339,9 +1327,11 @@ ldh_LocalObject(ldh_tSession session, pwr_tOid oid)
pwr_tStatus
ldh_SyntaxCheck(ldh_tSession session, int *errorcount, int *warningcount)
{
//wb_session *sp = (wb_session*)session;
wb_session *sp = (wb_session*)session;
pwr_tStatus sts;
return LDH__NYI;
sts = sp->syntaxCheck( errorcount, warningcount);
return sts;
}
pwr_tStatus
......
......@@ -122,6 +122,26 @@ typedef enum {
ldh_eMenuSet_
} ldh_eMenuSet;
typedef enum {
ldh_eDbCallBack__ = 0,
ldh_eDbCallBack_AnteCreate,
ldh_eDbCallBack_PostCreate,
ldh_eDbCallBack_AnteDelete,
ldh_eDbCallBack_PostDelete,
ldh_eDbCallBack_AnteMove,
ldh_eDbCallBack_PostMove,
ldh_eDbCallBack_AnteRename,
ldh_eDbCallBack_PostRename,
ldh_eDbCallBack_AnteAdopt,
ldh_eDbCallBack_PostAdopt,
ldh_eDbCallBack_AnteUnadopt,
ldh_eDbCallBack_PostUnadopt,
ldh_eDbCallBack_AnteUpdate,
ldh_eDbCallBack_PostUpdate,
ldh_eDbCallBack_SyntaxCheck,
ldh_eDbCallBack_
} ldh_eDbCallBack;
typedef enum {
ldh_eName_Object = cdh_mName_object,
ldh_eName_Default = cdh_mName_object,
......@@ -534,6 +554,7 @@ pwr_tStatus ldh_GetClassList (
pwr_tObjid *objid
);
pwr_tStatus ldh_GetMenu (
ldh_tSession Session,
ldh_sMenuCall *CallStruct
);
pwr_tStatus ldh_GetNextObject (
......
......@@ -57,6 +57,20 @@ typedef struct {
Prototypes for DbCallbacks
\*----------------------------------------------------------------------------*/
typedef pwr_tStatus (* wb_tMethod)();
typedef pwr_tStatus (* wb_tMethodMenu)( ldh_sMenuCall *);
typedef pwr_tStatus (* wb_tMethodMenuFilter)( ldh_sMenuCall *, pwr_sMenuButton *);
typedef pwr_tStatus (* wb_tMethodAnteCreate) (ldh_tSesContext, pwr_tOid, pwr_tCid);
typedef pwr_tStatus (* wb_tMethodPostCreate) (ldh_tSesContext, pwr_tOid, pwr_tOid, pwr_tCid);
typedef pwr_tStatus (* wb_tMethodAnteMove) (ldh_tSesContext, pwr_tOid, pwr_tOid, pwr_tCid);
typedef pwr_tStatus (* wb_tMethodPostMove) (ldh_tSesContext, pwr_tOid, pwr_tOid, pwr_tCid);
typedef pwr_tStatus (* wb_tMethodAnteAdopt) (ldh_tSesContext, pwr_tOid, pwr_tCid);
typedef pwr_tStatus (* wb_tMethodPostAdopt) (ldh_tSesContext, pwr_tOid, pwr_tOid, pwr_tCid);
typedef pwr_tStatus (* wb_tMethodAnteUnadopt)(ldh_tSesContext, pwr_tOid, pwr_tOid, pwr_tCid);
typedef pwr_tStatus (* wb_tMethodPostUnadopt)(ldh_tSesContext, pwr_tOid, pwr_tOid, pwr_tCid);
typedef pwr_tStatus (* wb_tMethodSyntaxCheck)(ldh_tSesContext, pwr_tOid, int *, int *);
#if defined OS_VMS
static pwr_tStatus AnteAdopt (
ldh_tSesContext Session,
......
#include "wb_session.h"
#include "wb_error.h"
#include "wb_ldh_msg.h"
#include "wb_cdrep.h"
#include "wb_merep.h"
#include "wb_ldh.h"
static ldh_sMenuItem ldh_lMenuItem[100];
static struct {
pwr_tString32 Name;
ldh_eUtility Value;
} ldh_lUtility[] = {
{"__", ldh_eUtility__},
{"Navigator", ldh_eUtility_Navigator},
{"Configurator", ldh_eUtility_Configurator},
{"-", ldh_eUtility_}
};
static struct {
pwr_tString32 Name;
pwr_tChar Char;
ldh_eMenuSet Value;
} ldh_lMenuSet[] = {
{"__", '\0', ldh_eMenuSet__},
{"Attribute", 'a', ldh_eMenuSet_Attribute},
{"Class", 'c', ldh_eMenuSet_Class},
{"Many", 'm', ldh_eMenuSet_Many},
{"None", 'n', ldh_eMenuSet_None},
{"Object", 'o', ldh_eMenuSet_Object},
{"-", '\0', ldh_eMenuSet_}
};
wb_session::wb_session(wb_volume &v) : wb_volume(v)
{
......@@ -94,7 +123,252 @@ bool wb_session::deleteFamily(wb_object o)
return m_vrep->deleteFamily(&m_sts, (wb_orep*)o);
}
pwr_tStatus wb_session::getMenu( ldh_sMenuCall *ip)
{
pwr_tStatus sts;
ldh_sMenuItem *Item = (ldh_sMenuItem *) &ldh_lMenuItem;
pwr_tUInt32 i;
pwr_tObjName MenuFolder;
pwr_tString80 Menu;
pwr_tBoolean isSame = FALSE;
pwr_tClassId Class;
pwr_tObjid Object;
int nItems = 0;
wb_name cn;
for (i = 0; i < ip->SelectCount; i++) {
if (cdh_ObjidIsEqual(ip->Pointed.Objid, ip->Selected[i].Objid)) {
isSame = TRUE;
break;
}
}
sprintf(MenuFolder, "%sP%cs%c%c",
ldh_lUtility[((wb_session *)ip->PointedSession)->utility()].Name,
ldh_lMenuSet[ip->PointedSet].Char,
ldh_lMenuSet[ip->SelectedSet].Char,
(isSame ? 's' : 'n')
);
/* Find generic menues of pointed object */
sprintf(Menu, "pwrs:Class-$Object-%s-Pointed", MenuFolder);
wb_cdrep *cdrep = m_vrep->merep()->cdrep( &sts, pwr_eClass_Object);
if ( EVEN(sts)) return sts;
wb_orep *o = m_vrep->erep()->object( &sts, Menu);
if ( EVEN(sts)) return sts;
o->ref();
Object = o->oid();
void *o_menu_body;
wb_orep *o_menu = cdrep->menuFirst( &sts, o, &o_menu_body);
if ( ODD(sts)) {
o_menu->ref();
getAllMenuItems( ip, &Item, cdrep, o_menu, o_menu_body, 0, &nItems, 0);
o_menu->unref();
}
delete cdrep;
o->unref();
/* Find specific menues of pointed object */
if (ip->PointedSet == ldh_eMenuSet_Class) {
Class = cdh_ClassObjidToId(ip->Pointed.Objid);
}
else {
o = m_vrep->erep()->object( &sts, ip->Pointed.Objid);
if ( EVEN(sts)) return sts;
o->ref();
Class = o->cid();
o->unref();
}
cdrep = m_vrep->merep()->cdrep( &sts, Class);
if ( EVEN(sts)) return sts;
cn = cdrep->longName();
sprintf(Menu, "%s-%s-Pointed", cn.name(), MenuFolder);
o = m_vrep->erep()->object( &sts, Menu);
if ( ODD(sts)) {
o->ref();
Object = o->oid();
o_menu = cdrep->menuFirst( &sts, o, &o_menu_body);
if ( ODD(sts)) {
o_menu->ref();
getAllMenuItems( ip, &Item, cdrep, o_menu, o_menu_body, 0, &nItems, 0);
o_menu->unref();
}
delete cdrep;
o->unref();
}
switch (ip->SelectedSet) {
case ldh_eMenuSet_Attribute:
case ldh_eMenuSet_Class:
case ldh_eMenuSet_Many:
case ldh_eMenuSet_Object:
/* Find generic menues for selected object(s) */
sprintf(Menu, "pwrs:Class-$Object-%s-Selected", MenuFolder);
cdrep = m_vrep->merep()->cdrep( &sts, pwr_eClass_Object);
if ( EVEN(sts)) return sts;
o = m_vrep->erep()->object( &sts, Menu);
if ( ODD(sts)) {
o->ref();
Object = o->oid();
o_menu = cdrep->menuFirst( &sts, o, &o_menu_body);
if ( ODD(sts)) {
o_menu->ref();
getAllMenuItems( ip, &Item, cdrep, o_menu, o_menu_body, 0, &nItems, 0);
o_menu->unref();
}
delete cdrep;
o->unref();
}
/* Find specific menues for selected object(s) */
if (ip->PointedSet == ldh_eMenuSet_Class) {
Class = cdh_ClassObjidToId(ip->Pointed.Objid);
}
else {
o = m_vrep->erep()->object( &sts, ip->Pointed.Objid);
if ( EVEN(sts)) return sts;
o->ref();
Class = o->cid();
o->unref();
}
cdrep = m_vrep->merep()->cdrep( &sts, Class);
if ( EVEN(sts)) return sts;
cn = cdrep->longName();
sprintf(Menu, "%s-%s-Selected", cn.name(), MenuFolder);
o = m_vrep->erep()->object( &sts, Menu);
if ( ODD(sts)) {
o->ref();
Object = o->oid();
o_menu = cdrep->menuFirst( &sts, o, &o_menu_body);
if ( ODD(sts)) {
o_menu->ref();
getAllMenuItems( ip, &Item, cdrep, o_menu, o_menu_body, 0, &nItems, 0);
o_menu->unref();
}
delete cdrep;
o->unref();
}
break;
default:
break;
}
Item->Level = 0;
ip->ItemList = ldh_lMenuItem;
ip->ItemCount = nItems - 1;
return LDH__SUCCESS;
}
void wb_session::getAllMenuItems( ldh_sMenuCall *ip, ldh_sMenuItem **Item, wb_cdrep *cdrep,
wb_orep *o, void *o_body, pwr_tUInt32 Level,
int *nItems, int AddSeparator)
{
pwr_sMenuButton *mbp;
pwr_sMenuCascade *mcp;
wb_tMethod method;
wb_tMethod filter;
pwr_tStatus sts;
Level++;
memset(*Item, 0, sizeof(**Item));
if(AddSeparator) {
(*Item)->Level = Level;
(*Item)->Item = ldh_eMenuItem_Separator;
(*Item)->MenuObject = pwr_cNObjid;
(*Item)++;
(*nItems)++;
}
else if ( o->cid() == pwr_eClass_MenuButton) {
mbp = (pwr_sMenuButton *)o_body;
(*Item)->Level = Level;
(*Item)->Item = ldh_eMenuItem_Button;
(*Item)->MenuObject = o->oid();
(*Item)->Flags.f.Sensitive = 0;
if ( mbp->MethodName[0] != 0) {
m_vrep->erep()->method( &sts, mbp->MethodName, &method);
if ( ODD(sts))
(*Item)->Flags.f.Sensitive = 1;
}
if ( (*Item)->Flags.f.Sensitive == 1) {
m_vrep->erep()->method( &sts, mbp->FilterName, &filter);
if ( ODD(sts))
(*Item)->Flags.f.Sensitive = ((wb_tMethodMenuFilter) filter)( ip, mbp);
}
strcpy((*Item)->Name, mbp->ButtonName);
(*Item)->Method = method;
(*Item)++;
(*nItems)++;
}
else if ( o->cid() == pwr_eClass_MenuSeparator) {
(*Item)->Level = Level;
(*Item)->Item = ldh_eMenuItem_Separator;
(*Item)->MenuObject = o->oid();
(*Item)++;
(*nItems)++;
} else if (o->cid() == pwr_eClass_MenuCascade) {
mcp = (pwr_sMenuCascade *)o_body;
(*Item)->Level = Level;
(*Item)->Item = ldh_eMenuItem_Cascade;
(*Item)->Flags.f.Sensitive = 1;
strcpy((*Item)->Name, mcp->ButtonName);
(*Item)->MenuObject = o->oid();
(*Item)++;
(*nItems)++;
void *child_body;
wb_orep *child = cdrep->menuFirst( &sts, o, &child_body);
if ( ODD(sts)) {
child->ref();
getAllMenuItems(ip, Item, cdrep, child, child_body, Level, nItems, 0);
child->unref();
}
void *next_body;
wb_orep *next = cdrep->menuAfter( &sts, o, &next_body);
if ( ODD(sts)) {
next->ref();
getAllMenuItems(ip, Item, cdrep, next, next_body, Level, nItems, 0);
next->unref();
}
}
}
pwr_tStatus wb_session::callMenuMethod( ldh_sMenuCall *mcp, int Index)
{
pwr_tStatus sts = LDH__SUCCESS;
wb_tMethodMenu method = (wb_tMethodMenu) mcp->ItemList[Index].Method;
// ldh_sEvent *ep;
// ep = eventStart(sp, pwr_cNObjid, ldh_eEvent_MenuMethodCalled);
if (method != NULL)
sts = (*method)(mcp);
// eventSend(sp, ep);
return sts;
}
......@@ -71,8 +71,12 @@ public:
bool writeAttribute() {return false;} // Fix
bool writeBody() {return false;} // Fix
//
void getAllMenuItems( ldh_sMenuCall *ip, ldh_sMenuItem **Item, wb_cdrep *cdrep,
wb_orep *o, void *o_body, pwr_tUInt32 Level,
int *nItems, int AddSeparator);
pwr_tStatus getMenu( ldh_sMenuCall *ip);
pwr_tStatus callMenuMethod( ldh_sMenuCall *mcp, int Index);
};
......
......@@ -295,7 +295,258 @@ wb_attribute wb_volume::attribute(const pwr_sAttrRef* arp) const
return wb_attribute();
}
pwr_tStatus wb_volume::syntaxCheck( int *errorcount, int *warningcount)
{
pwr_tStatus sts;
wb_orep *orep = m_vrep->object(&sts);
if ( ODD(sts)) {
orep->ref();
sts = syntaxCheckObject( orep, errorcount, warningcount);
orep->unref();
return sts;
}
return LDH__SUCCESS;
}
pwr_tStatus wb_volume::syntaxCheckObject( wb_orep *orep, int *errorcount, int *warningcount)
{
pwr_tStatus sts;
wb_orep *first, *after;
sts = triggSyntaxCheck( orep, errorcount, warningcount);
if ( EVEN(sts)) return sts;
switch ( orep->cid()) {
case pwr_eClass_LibHier:
break;
default:
first = orep->first( &sts);
if ( ODD(sts)) {
first->ref();
sts = syntaxCheckObject( first, errorcount, warningcount);
first->unref();
if ( EVEN(sts)) return sts;
}
after = orep->after( &sts);
if ( ODD(sts)) {
after->ref();
sts = syntaxCheckObject( after, errorcount, warningcount);
after->unref();
if ( EVEN(sts)) return sts;
}
}
return LDH__SUCCESS;
}
pwr_tStatus wb_volume::triggSyntaxCheck( wb_orep *orep, int *errorcount, int *warningcount)
{
pwr_tStatus sts;
char methodName[] = "SyntaxCheck";
wb_tMethod method;
// wb_cdrep *cdrep = m_vrep->merep()->cdrep( &sts, orep->cid());
// if ( EVEN(sts)) return sts;
// cdrep->dbCallBack( &sts, ldh_eDbCallBack_SyntaxCheck, &methodName, 0);
// delete cdrep;
// if ( EVEN(sts)) return LDH__SUCCESS;
m_vrep->erep()->method( &sts, methodName, &method);
if ( EVEN(sts)) return LDH__SUCCESS;
sts = ((wb_tMethodSyntaxCheck) (method))( (ldh_tSesContext)this, orep->oid(), errorcount, warningcount);
return sts;
}
pwr_tStatus wb_volume::triggAnteAdopt( wb_orep *father, pwr_tCid cid)
{
pwr_tStatus sts;
char *methodName;
wb_tMethod method;
wb_cdrep *cdrep = m_vrep->merep()->cdrep( &sts, father->cid());
if ( EVEN(sts)) return sts;
cdrep->dbCallBack( &sts, ldh_eDbCallBack_AnteAdopt, &methodName, 0);
delete cdrep;
if ( EVEN(sts)) return LDH__SUCCESS;
m_vrep->erep()->method( &sts, methodName, &method);
if ( EVEN(sts)) return LDH__SUCCESS;
sts = ((wb_tMethodAnteAdopt) (method))( (ldh_tSesContext)this, father->oid(), cid);
return sts;
}
pwr_tStatus wb_volume::triggAnteCreate( wb_orep *father, pwr_tCid cid)
{
pwr_tStatus sts;
char *methodName;
wb_tMethod method;
wb_cdrep *cdrep = m_vrep->merep()->cdrep( &sts, cid);
if ( EVEN(sts))
return sts;
cdrep->dbCallBack( &sts, ldh_eDbCallBack_AnteCreate, &methodName, 0);
delete cdrep;
if ( EVEN(sts))
return LDH__SUCCESS;
m_vrep->erep()->method( &sts, methodName, &method);
if ( EVEN(sts)) return LDH__SUCCESS;
sts = ((wb_tMethodAnteCreate) (method))( (ldh_tSesContext)this, father->oid(), cid);
return sts;
}
pwr_tStatus wb_volume::triggAnteMove( wb_orep *orep, wb_orep *father)
{
pwr_tStatus sts;
char *methodName;
wb_tMethod method;
wb_cdrep *cdrep = m_vrep->merep()->cdrep( &sts, orep->cid());
if ( EVEN(sts)) return sts;
cdrep->dbCallBack( &sts, ldh_eDbCallBack_AnteCreate, &methodName, 0);
delete cdrep;
if ( EVEN(sts)) return LDH__SUCCESS;
m_vrep->erep()->method( &sts, methodName, &method);
if ( EVEN(sts)) return LDH__SUCCESS;
if ( father)
sts = ((wb_tMethodAnteMove) (method))( (ldh_tSesContext)this, orep->oid(), father->oid(),
father->cid());
else
sts = ((wb_tMethodAnteMove) (method))( (ldh_tSesContext)this, orep->oid(), pwr_cNObjid,
pwr_cNClassId);
return sts;
}
pwr_tStatus wb_volume::triggAnteUnadopt( wb_orep *father, wb_orep *orep)
{
pwr_tStatus sts;
char *methodName;
wb_tMethod method;
wb_cdrep *cdrep = m_vrep->merep()->cdrep( &sts, father->cid());
if ( EVEN(sts)) return sts;
cdrep->dbCallBack( &sts, ldh_eDbCallBack_AnteCreate, &methodName, 0);
delete cdrep;
if ( EVEN(sts)) return LDH__SUCCESS;
m_vrep->erep()->method( &sts, methodName, &method);
if ( EVEN(sts)) return LDH__SUCCESS;
sts = ((wb_tMethodAnteUnadopt) (method))( (ldh_tSesContext)this, father->oid(), orep->oid(),
orep->cid());
return sts;
}
pwr_tStatus wb_volume::triggPostAdopt( wb_orep *father, wb_orep *orep)
{
pwr_tStatus sts;
char *methodName;
wb_tMethod method;
wb_cdrep *cdrep = m_vrep->merep()->cdrep( &sts, father->cid());
if ( EVEN(sts)) return sts;
cdrep->dbCallBack( &sts, ldh_eDbCallBack_PostAdopt, &methodName, 0);
delete cdrep;
if ( EVEN(sts)) return LDH__SUCCESS;
m_vrep->erep()->method( &sts, methodName, &method);
if ( EVEN(sts)) return LDH__SUCCESS;
sts = ((wb_tMethodPostAdopt) (method))( (ldh_tSesContext)this, father->oid(), orep->oid(),
orep->cid());
return sts;
}
pwr_tStatus wb_volume::triggPostCreate( wb_orep *orep)
{
pwr_tStatus sts;
char *methodName;
wb_tMethod method;
wb_cdrep *cdrep = m_vrep->merep()->cdrep( &sts, orep->cid());
if ( EVEN(sts)) return sts;
cdrep->dbCallBack( &sts, ldh_eDbCallBack_PostCreate, &methodName, 0);
delete cdrep;
if ( EVEN(sts)) return LDH__SUCCESS;
m_vrep->erep()->method( &sts, methodName, &method);
if ( EVEN(sts)) return LDH__SUCCESS;
wb_orep *father = orep->parent( &sts);
if ( ODD(sts)) {
father->ref();
sts = ((wb_tMethodPostCreate) (method))( (ldh_tSesContext)this, orep->oid(), father->oid(),
father->cid());
father->unref();
}
else
sts = ((wb_tMethodPostCreate) (method))( (ldh_tSesContext)this, orep->oid(), pwr_cNObjid,
pwr_cNClassId);
return sts;
}
pwr_tStatus wb_volume::triggPostMove( wb_orep *orep)
{
pwr_tStatus sts;
char *methodName;
wb_tMethod method;
wb_cdrep *cdrep = m_vrep->merep()->cdrep( &sts, orep->cid());
if ( EVEN(sts)) return sts;
cdrep->dbCallBack( &sts, ldh_eDbCallBack_PostMove, &methodName, 0);
delete cdrep;
if ( EVEN(sts)) return LDH__SUCCESS;
m_vrep->erep()->method( &sts, methodName, &method);
if ( EVEN(sts)) return LDH__SUCCESS;
wb_orep *father = orep->parent( &sts);
if ( ODD(sts)) {
father->ref();
sts = ((wb_tMethodPostMove) (method))( (ldh_tSesContext)this, orep->oid(), father->oid(),
father->cid());
father->unref();
}
else
sts = ((wb_tMethodPostMove) (method))( (ldh_tSesContext)this, orep->oid(), pwr_cNObjid,
pwr_cNClassId);
return sts;
}
pwr_tStatus wb_volume::triggPostUnadopt( wb_orep *father, wb_orep *orep)
{
pwr_tStatus sts;
char *methodName;
wb_tMethod method;
wb_cdrep *cdrep = m_vrep->merep()->cdrep( &sts, father->cid());
if ( EVEN(sts)) return sts;
cdrep->dbCallBack( &sts, ldh_eDbCallBack_PostUnadopt, &methodName, 0);
delete cdrep;
if ( EVEN(sts)) return LDH__SUCCESS;
m_vrep->erep()->method( &sts, methodName, &method);
if ( EVEN(sts)) return LDH__SUCCESS;
sts = ((wb_tMethodPostUnadopt) (method))( (ldh_tSesContext)this, father->oid(), orep->oid(),
orep->cid());
return sts;
}
......
......@@ -79,6 +79,18 @@ public:
bool createSnapshot(const char *fileName) { return m_vrep->createSnapshot(fileName);}
pwr_tStatus syntaxCheck( int *errorcount, int *warningcount);
pwr_tStatus syntaxCheckObject( wb_orep *orep, int *errorcount, int *warningcount);
pwr_tStatus triggSyntaxCheck( wb_orep *orep, int *errorcount, int *warningcount);
pwr_tStatus triggAnteAdopt( wb_orep *orep, pwr_tCid cid);
pwr_tStatus triggAnteCreate( wb_orep *father, pwr_tCid cid);
pwr_tStatus triggAnteMove( wb_orep *orep, wb_orep *father);
pwr_tStatus triggAnteUnadopt( wb_orep *father, wb_orep *orep);
pwr_tStatus triggPostAdopt( wb_orep *father, wb_orep *orep);
pwr_tStatus triggPostCreate( wb_orep *orep);
pwr_tStatus triggPostMove( wb_orep *orep);
pwr_tStatus triggPostUnadopt( wb_orep *father, wb_orep *orep);
};
#endif
......@@ -469,6 +469,11 @@ void wb_wblnode::build( bool recursive)
attr = attr->o_fws;
}
}
else if ( cdh_NoCaseStrcmp( child->cname, "$DbCallBack") == 0 &&
!child->isTemplate() ) {
((pwr_sClassDef *)rbody)->Flags.b.HasCallBack = 1;
}
child = child->o_fws;
m_flags = ((pwr_sClassDef *)rbody)->Flags;
......
......@@ -238,7 +238,7 @@ 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;
sts = ldh_GetMenu( mcp);
sts = ldh_GetMenu( wtt->ldhses, mcp);
if (EVEN(sts) || mcp->ItemList[0].Level == 0) {
return NULL;
}
......
......@@ -493,6 +493,9 @@ static void wtt_create_popup_menu_cb( void *ctx, pwr_tObjid objid,
XtGetValues( wtt->toplevel, args, 2);
popup = wtt_create_popup_menu( wtt, objid);
if ( !popup)
return;
i = 0;
XtSetArg(args[i], XmNx, x + x1 + x2 + x3 + 8);i++;
XtSetArg(args[i], XmNy, y + y1 + y2 + y3);i++;
......
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