Commit c42adf4a authored by Claes Sjofors's avatar Claes Sjofors

Wb method PostRename added and implemented for XttGraph and ProjectReg objects.

parent a617e56c
......@@ -54,6 +54,11 @@ SObject pwrb:Class
EndBody
EndObject
EndObject
Object PostRename $DbCallBack
Body SysBody
Attr MethodName = "ProjectReg-PostRename"
EndBody
EndObject
Object NavigatorPosnn $Menu
Object Pointed $Menu
Object OpenProject $MenuButton
......
......@@ -182,6 +182,11 @@ SObject pwrb:Class
Attr UpdateInterval = 1.0
EndBody
EndObject
Object PostRename $DbCallBack
Body SysBody
Attr MethodName = "XttGraph-PostRename"
EndBody
EndObject
Object NavigatorPosnn $Menu
Object Pointed $Menu
Object OpenGraph $MenuButton
......
......@@ -130,4 +130,5 @@
090507 cs wb Bugfix in directory wizard, for nodenames containing '-' NodeConfig object was not configured correctly.
090515 cs wtt Ctrl/Doubleclick MB1 to insert selected object into an objid attribute also works on attrref attributes.
090515 cs wtt Popup menu on attributes. Methods HelpClass, InsertSelectedObject and ChangeValue added.
090515 cs wtt Bugfix in ConnectGraph method for PlantHier objects.
\ No newline at end of file
090515 cs wtt Bugfix in ConnectGraph method for PlantHier objects.
090518 cs wb Wb method PostRename added and implemented for XttGraph and ProjectReg objects.
......@@ -19,6 +19,8 @@
/* wb_c_projectref.c -- work bench methods of the ProjectReg class. */
#include <ctype.h>
#undef Status
#include <string.h>
#include "co_dcli.h"
......@@ -111,6 +113,35 @@ static pwr_tStatus CopyProject (
return 1;
}
static pwr_tStatus PostRename (
ldh_tSesContext Session,
pwr_tOid Object
) {
pwr_tStatus sts;
int size;
pwr_tString80 name;
char *project;
sts = ldh_GetObjectPar( Session, Object, "RtBody",
"Project", &project, &size);
if ( EVEN(sts)) return sts;
if ( strcmp( project, "") == 0 ||
(project[0] == 'o' && isdigit( project[1]))) {
sts = ldh_ObjidToName( Session, Object, ldh_eName_Object, name, sizeof(name), &size);
if ( EVEN(sts)) return sts;
cdh_ToLower( name, name);
sts = ldh_SetObjectPar( Session, Object, "RtBody", "Project", name,
sizeof(name));
if ( EVEN(sts)) return sts;
}
free( project);
return PWRB__SUCCESS;
}
/*----------------------------------------------------------------------------*\
......@@ -120,5 +151,6 @@ static pwr_tStatus CopyProject (
pwr_dExport pwr_BindMethods(ProjectReg) = {
pwr_BindMethod(OpenProject),
pwr_BindMethod(CopyProject),
pwr_BindMethod(PostRename),
pwr_NullMethod
};
......@@ -21,6 +21,7 @@
using namespace std;
#include "co_cdh.h"
#include "wb_wnav.h"
#include "wb_pwrb_msg.h"
#include "wb_build.h"
......@@ -67,6 +68,35 @@ static pwr_tStatus Build (
return build.sts();
}
static pwr_tStatus PostRename (
ldh_tSesContext Session,
pwr_tOid Object
) {
pwr_tStatus sts;
int size;
pwr_tString80 name;
char *action;
sts = ldh_GetObjectPar( Session, Object, "RtBody",
"Action", &action, &size);
if ( EVEN(sts)) return sts;
if ( strcmp( action, "") == 0) {
sts = ldh_ObjidToName( Session, Object, ldh_eName_Object, name, sizeof(name), &size);
if ( EVEN(sts)) return sts;
cdh_ToLower( name, name);
strcat( name, ".pwg");
sts = ldh_SetObjectPar( Session, Object, "RtBody", "Action", name,
sizeof(name));
if ( EVEN(sts)) return sts;
}
free( action);
return PWRB__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
......@@ -75,6 +105,7 @@ static pwr_tStatus Build (
pwr_dExport pwr_BindMethods(XttGraph) = {
pwr_BindMethod(OpenGraph),
pwr_BindMethod(Build),
pwr_BindMethod(PostRename),
pwr_NullMethod
};
......
......@@ -73,7 +73,7 @@ typedef struct {
\*----------------------------------------------------------------------------*/
typedef pwr_tStatus (* wb_tMethodMenu)( ldh_sMenuCall *);
typedef pwr_tStatus (* wb_tMethodMenuFilter)( ldh_sMenuCall *, pwr_sMenuButton *);
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_tOid);
......@@ -82,6 +82,7 @@ typedef pwr_tStatus (* wb_tMethodAnteAdopt) (ldh_tSesContext, pwr_tOid, pwr_tCi
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_tMethodPostRename) (ldh_tSesContext, pwr_tOid);
typedef pwr_tStatus (* wb_tMethodSyntaxCheck)(ldh_tSesContext, pwr_tOid, int *, int *);
......
......@@ -262,6 +262,8 @@ bool wb_session::renameObject(wb_object o, wb_name name)
bool ok = m_vrep->renameObject(&m_sts, (wb_orep*)o, name);
if (!ok) return ok;
triggPostRename(o);
m_srep->update();
ldh_sEvent *ep = m_srep->eventStart(o.oid(), ldh_eEvent_ObjectRenamed);
m_srep->eventSend(ep);
......
......@@ -750,6 +750,26 @@ pwr_tStatus wb_volume::triggPostUnadopt(wb_object& father, wb_object& o)
return sts;
}
pwr_tStatus wb_volume::triggPostRename(wb_object& o)
{
pwr_tStatus sts;
char *methodName;
wb_tMethod method;
wb_cdrep *cdrep = m_vrep->merep()->cdrep(&sts, o.cid());
if (EVEN(sts)) return sts;
cdrep->dbCallBack(&sts, ldh_eDbCallBack_PostRename, &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_tMethodPostRename) (method))((ldh_tSesContext)this, o.oid());
return sts;
}
ldh_sRefInfo *wb_volume::refinfo(wb_object o, ldh_sRefInfo *rp)
{
int rows;
......
......@@ -113,6 +113,7 @@ public:
pwr_tStatus triggPostCreate( wb_object& o);
pwr_tStatus triggPostMove( wb_object& o);
pwr_tStatus triggPostUnadopt( wb_object& father, wb_object& o);
pwr_tStatus triggPostRename(wb_object& o);
ldh_sRefInfo *refinfo( wb_object o, ldh_sRefInfo *rp);
......
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