Commit 6c337b1c authored by claes's avatar claes

More work on project list as extern volume

parent 3b0a1fb7
#! /bin/bash #! /bin/bash
# #
# Proview $Id: pwrp_env.sh,v 1.8 2005-09-01 14:57:49 claes Exp $ # Proview $Id: pwrp_env.sh,v 1.9 2005-10-25 12:05:37 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
...@@ -50,6 +50,7 @@ declare -i pwrc__projnameinv=26 ...@@ -50,6 +50,7 @@ declare -i pwrc__projnameinv=26
declare -i pwrc__mysqldbcopy=27 declare -i pwrc__mysqldbcopy=27
declare -i pwrc__mysqldbrena=28 declare -i pwrc__mysqldbrena=28
declare -i pwrc__mysql=29 declare -i pwrc__mysql=29
declare -i pwrc__noroot=30
pwrc_get_variables() pwrc_get_variables()
......
#! /bin/bash #!/bin/bash
# #
# Proview $Id: wb_admin.sh,v 1.4 2005-09-01 14:57:49 claes Exp $ # Proview $Id: wb_admin.sh,v 1.5 2005-10-25 12:05:37 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
...@@ -42,7 +42,7 @@ echo "args: $1 $2 $3 $4 $5" ...@@ -42,7 +42,7 @@ echo "args: $1 $2 $3 $4 $5"
source pwrp_env.sh setdb $database source pwrp_env.sh setdb $database
fi fi
wb "$username" "$password" $volume & wb -q "$username" "$password" $volume &
} }
wb_adm_create_func () wb_adm_create_func ()
......
# #
# Proview $Id: wb_open_db.sh,v 1.3 2005-09-01 14:57:49 claes Exp $ # Proview $Id: wb_open_db.sh,v 1.4 2005-10-25 12:05:37 claes Exp $
# Copyright (C) 2005 SSAB Oxelösund AB. # Copyright (C) 2005 SSAB Oxelösund AB.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
...@@ -33,4 +33,4 @@ if [ -z $database ]; then ...@@ -33,4 +33,4 @@ if [ -z $database ]; then
fi fi
echo "-- Opening volume '$database'" echo "-- Opening volume '$database'"
wb $username $password $database wb -q $username $password $database
#!/bin/bash
#
# Proview $Id: wb_pvd_pl.sh,v 1.1 2005-10-25 12:05:37 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
set -o xtrace
declare -ix pwrc_status=$pwrc__success
declare -i pwrc__success=0
declare -i pwrc__dbnotfound=1
declare -i pwrc__noproj=3
declare -i pwrc__rootexist=4
declare -i pwrc__notconfigured=5
declare -i pwrc__projlistfile=6
declare -i pwrc__projalrexist=7
declare -i pwrc__basealrexist=8
declare -i pwrc__nobase=9
declare -i pwrc__projlistfileacc=10
declare -i pwrc__syntax=11
declare -i pwrc__rootacc=12
declare -i pwrc__rootcreate=13
declare -i pwrc__rootdelete=14
declare -i pwrc__dbdelete=15
declare -i pwrc__baseexist=16
declare -i pwrc__move=17
declare -i pwrc__notmysqlsrv=18
declare -i pwrc__datadir=19
declare -i pwrc__nodb=20
declare -i pwrc__notemplatedb=21
declare -i pwrc__dbalrexist=22
declare -i pwrc__copy=23
declare -i pwrc__dbcreate=24
declare -i pwrc__projnotset=25
declare -i pwrc__projnameinv=26
declare -i pwrc__mysqldbcopy=27
declare -i pwrc__mysqldbrena=28
declare -i pwrc__mysql=29
declare -i pwrc__noroot=30
wb_pl_opendb_func ()
{
#
# Command is "opendb"
#
# Arguments 1: project
# 2: username
# 3: password
# 4: database
# 5: volume
local project=$1
local username=$2
local password=$3
local database=$4
local volume=$5
echo "args: $1 $2 $3 $4 $5"
source pwrp_env.sh set project $project
if [ "$database" != "dbdirectory" ]; then
source pwrp_env.sh setdb $database
fi
wb -q "$username" "$password" $volume &
}
wb_pl_check_func ()
{
cmd="move"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
#
# Command is "check move"
#
# Arguments 2: source root
# 3: destination root
local srcroot=$2
local destroot=$3
local destdir=${destroot%/*}
if [ ! -e "$srcroot" ]; then
echo "Source root not found"
pwrc_status=$pwrc_noroot
fi
if [ -e "$destroot" ]; then
if [ ! -w "$destroot" ]; then
echo "No write access to project root"
pwrc_status=$pwrc__rootacc
return
else
if [ -e "$destroot/common" ]; then
echo "Error: destination root already exist"
pwrc_status=$pwrc__rootexist
return
fi
fi
else
if [ ! -e "$destdir" ]; then
echo "Can't create destination root"
pwrc_status=$pwrc__rootcreate
return
else
if [ ! -w "$destdir" ]; then
echo "No write access to project root"
pwrc_status=$pwrc__rootacc
return
fi
fi
fi
pwrc_status=$pwrc__success
return
fi
cmd="create"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
#
# Command is "check move"
#
# Arguments 2: destination root
local destroot=$2
local destdir=${destroot%/*}
if [ -e "$destroot" ]; then
if [ ! -w "$destroot" ]; then
echo "No write access to project root"
pwrc_status=$pwrc__rootacc
return
else
if [ -e "$destroot/common" ]; then
echo "Error: destination root already exist"
pwrc_status=$pwrc__rootexist
return
fi
fi
else
if [ ! -e "$destdir" ]; then
echo "Can't create destination root"
pwrc_status=$pwrc__rootcreate
return
else
if [ ! -w "$destdir" ]; then
echo "No write access to project root"
pwrc_status=$pwrc__rootacc
return
fi
fi
fi
pwrc_status=$pwrc__success
return
fi
}
wb_pl_create_func ()
{
local cmd
cmd="project"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
#
# Command is "create project"
#
# Arguments 2: project name
# 3: base name
# 4: project root
# 5: project hierarchy
# 6-: description
pname=$2
bname=$3
proot=$4
source pwrp_env.sh create $@
if [ $pwrc_status -ne 0 ]; then
return $pwrc_status
fi
#source pwrp_env.sh set project $pname
#if [ $pwrc_status -ne 0 ]; then
# return $pwrc_status
#fi
#wb_cmd create volume/name=\"directory\"/ident=254.254.254.253/class=\$DirectoryVolume
fi
}
wb_pl_parse ()
{
local cmd
cmd="opendb"
if [ -z $1 ] || [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
shift
wb_pl_opendb_func $1 $2 $3 $4 $5
return
fi
cmd="create"
if [ -z $1 ] || [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
shift
wb_pl_create_func $@
return
fi
cmd="check"
if [ -z $1 ] || [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
shift
wb_pl_check_func $@
return $pwrc_status
fi
echo "Unknown command"
}
#set -o xtrace
wb_pl_parse $@
#set +o xtrace
# #
# Proview $Id: wb_start.sh,v 1.3 2005-09-01 14:57:49 claes Exp $ # Proview $Id: wb_start.sh,v 1.4 2005-10-25 12:05:37 claes Exp $
# Copyright (C) 2005 SSAB Oxelösund AB. # Copyright (C) 2005 SSAB Oxelösund AB.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
...@@ -25,3 +25,8 @@ password=$2 ...@@ -25,3 +25,8 @@ password=$2
volume=$3 volume=$3
wb $username $password $volume wb $username $password $volume
/* /*
* Proview $Id: wb.h,v 1.8 2005-09-06 10:43:30 claes Exp $ * Proview $Id: wb.h,v 1.9 2005-10-25 12:04:25 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
...@@ -33,7 +33,8 @@ typedef enum { ...@@ -33,7 +33,8 @@ typedef enum {
wb_eType_Directory, wb_eType_Directory,
wb_eType_Class, wb_eType_Class,
wb_eType_Buffer, wb_eType_Buffer,
wb_eType_ClassEditor wb_eType_ClassEditor,
wb_eType_ExternVolume
} wb_eType; } wb_eType;
typedef enum { typedef enum {
......
/*
* Proview $Id: wb_c_projectreg.c,v 1.1 2005-10-25 12:04:25 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
/* wb_c_projectref.c -- work bench methods of the ProjectReg class. */
#include <X11/Intrinsic.h>
#undef Status
#include "co_dcli.h"
#include "wb_pwrs.h"
#include "pwr_baseclasses.h"
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_pwrb_msg.h"
#include "wb_login.h"
/*----------------------------------------------------------------------------*\
To open a PLC program with the PLC editor.
\*----------------------------------------------------------------------------*/
static pwr_tStatus OpenProject (
ldh_sMenuCall *ip
)
{
char *project;
pwr_tStatus sts;
int size;
pwr_tFileName fname;
pwr_tCmd cmd;
sts = ldh_GetObjectPar( ip->PointedSession, ip->Pointed.Objid, "RtBody",
"Project", &project, &size);
if ( EVEN(sts)) return sts;
printf( "Open %s\n", project);
dcli_translate_filename( fname, "$pwr_exe/wb_pvd_pl.sh");
sprintf( cmd,
"%s opendb \"%s\" \"%s\" \"%s\" &",
fname, project, login_prv.username, login_prv.password);
free( project);
sts = system( cmd);
if ( sts == -1 || sts == 127) {
printf("-- Error when creating process.\n");
return sts;
}
return 1;
}
static pwr_tStatus CopyProject (
ldh_sMenuCall *ip
)
{
pwr_tStatus sts;
int size;
pwr_tObjName oname;
pwr_tCid cid;
pwr_tOid oid;
pwr_sClass_ProjectReg *body;
char description[120];
sts = ldh_ObjidToName( ip->PointedSession, ip->Pointed.Objid, ldh_eName_Object,
oname, sizeof(oname), &size);
if ( EVEN(sts)) return sts;
sts = ldh_GetObjectClass( ip->PointedSession, ip->Pointed.Objid, &cid);
if ( EVEN(sts)) return sts;
sts = ldh_GetObjectBody( ip->PointedSession, ip->Pointed.Objid, "RtBody",
(void **)&body, &size);
if ( EVEN(sts)) return sts;
strcat( oname, "2");
strcat( body->Path, "2");
sprintf( description, "%s (Copy of %s)", body->Description, body->Project);
description[79] = 0;
strcpy( body->Description, description);
strcpy( body->CopyFrom, body->Project);
strcat( body->Project, "2");
sts = ldh_CreateObject( ip->PointedSession, &oid, oname, cid,
ip->Pointed.Objid, ldh_eDest_After);
if ( EVEN(sts)) return sts;
sts = ldh_SetObjectBody( ip->PointedSession, oid, "RtBody",
(char *)body, sizeof( *body));
if ( EVEN(sts)) return sts;
free(body);
return 1;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindMethods(ProjectReg) = {
pwr_BindMethod(OpenProject),
pwr_BindMethod(CopyProject),
pwr_NullMethod
};
/* /*
* Proview $Id: wb_i_base_methods.c,v 1.6 2005-09-06 10:43:31 claes Exp $ * Proview $Id: wb_i_base_methods.c,v 1.7 2005-10-25 12:04:25 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
...@@ -36,7 +36,7 @@ pwr_dImport pwr_BindMethods(DsHist); ...@@ -36,7 +36,7 @@ pwr_dImport pwr_BindMethods(DsHist);
pwr_dImport pwr_BindMethods(DsTrend); pwr_dImport pwr_BindMethods(DsTrend);
pwr_dImport pwr_BindMethods(DSup); pwr_dImport pwr_BindMethods(DSup);
pwr_dImport pwr_BindMethods(PlcPgm); pwr_dImport pwr_BindMethods(PlcPgm);
pwr_dImport pwr_BindMethods(DbConfig); pwr_dImport pwr_BindMethods(ProjectReg);
pwr_dImport pwr_BindMethods(RootVolumeConfig); pwr_dImport pwr_BindMethods(RootVolumeConfig);
pwr_dImport pwr_BindMethods(SubVolumeConfig); pwr_dImport pwr_BindMethods(SubVolumeConfig);
pwr_dImport pwr_BindMethods(SharedVolumeConfig); pwr_dImport pwr_BindMethods(SharedVolumeConfig);
...@@ -83,7 +83,7 @@ pwr_dExport pwr_BindClasses(Base) = { ...@@ -83,7 +83,7 @@ pwr_dExport pwr_BindClasses(Base) = {
pwr_BindClass(DsTrend), pwr_BindClass(DsTrend),
pwr_BindClass(DSup), pwr_BindClass(DSup),
pwr_BindClass(PlcPgm), pwr_BindClass(PlcPgm),
pwr_BindClass(DbConfig), pwr_BindClass(ProjectReg),
pwr_BindClass(RootVolumeConfig), pwr_BindClass(RootVolumeConfig),
pwr_BindClass(SubVolumeConfig), pwr_BindClass(SubVolumeConfig),
pwr_BindClass(SharedVolumeConfig), pwr_BindClass(SharedVolumeConfig),
......
/* /*
* Proview $Id: wb_pvd_file.cpp,v 1.1 2005-09-20 13:14:28 claes Exp $ * Proview $Id: wb_pvd_file.cpp,v 1.2 2005-10-25 12:04:25 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
...@@ -168,9 +168,10 @@ void wb_pvd_file::createObject( wb_procom *pcom, pwr_tOix destoix, int desttype, ...@@ -168,9 +168,10 @@ void wb_pvd_file::createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
} }
} }
switch (cid) { switch (cid) {
case pwr_eClass_PlantHier: case pwr_eClass_Hier:
item.body_size = sizeof(pwr_sPlantHier); item.body_size = sizeof(pwr_sHier);
item.body = calloc( 1, item.body_size); item.body = calloc( 1, item.body_size);
break; break;
case pwr_cClass_VolumeReg: case pwr_cClass_VolumeReg:
...@@ -185,11 +186,20 @@ void wb_pvd_file::createObject( wb_procom *pcom, pwr_tOix destoix, int desttype, ...@@ -185,11 +186,20 @@ void wb_pvd_file::createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
item.body_size = sizeof( pwr_sClass_UserReg); item.body_size = sizeof( pwr_sClass_UserReg);
item.body = calloc( 1, item.body_size); item.body = calloc( 1, item.body_size);
break; break;
case pwr_cClass_ProjectReg:
item.body_size = sizeof( pwr_sClass_ProjectReg);
item.body = calloc( 1, item.body_size);
break;
case pwr_cClass_BaseReg:
item.body_size = sizeof( pwr_sClass_BaseReg);
item.body = calloc( 1, item.body_size);
break;
} }
if ( strcmp( name, "") == 0) if ( strcmp( name, "") == 0)
sprintf( item.name, "O%d", item.oix); sprintf( item.name, "O%d", item.oix);
else else
strcpy( item.name, name); strcpy( item.name, name);
item.flags |= pitem_mFlags_Created;
m_list.push_back(item); m_list.push_back(item);
pcom->provideObject( 1, item.oix, item.fthoix, item.bwsoix, item.fwsoix, pcom->provideObject( 1, item.oix, item.fthoix, item.bwsoix, item.fwsoix,
...@@ -442,5 +452,19 @@ char *wb_pvd_file::longname( pwr_tOix oix) ...@@ -442,5 +452,19 @@ char *wb_pvd_file::longname( pwr_tOix oix)
return m_list[oix].lname; return m_list[oix].lname;
} }
bool wb_pvd_file::find( pwr_tOix fthoix, char *name, pwr_tOix *oix)
{
for ( int i = 0; i < (int) m_list.size(); i++) {
if ( !m_list[i].flags & pitem_mFlags_Deleted) {
if ( m_list[i].fthoix == fthoix &&
cdh_NoCaseStrcmp( name, m_list[i].name) == 0) {
*oix = m_list[i].oix;
return true;
}
}
}
return false;
}
/* /*
* Proview $Id: wb_pvd_file.h,v 1.1 2005-09-20 13:14:28 claes Exp $ * Proview $Id: wb_pvd_file.h,v 1.2 2005-10-25 12:04:25 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
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
typedef enum { typedef enum {
pitem_mFlags_Deleted = 1 << 0, pitem_mFlags_Deleted = 1 << 0,
pitem_mFlags_Created = 1 << 1, pitem_mFlags_Created = 1 << 1
} pitem_mFlags; } pitem_mFlags;
class pitem { class pitem {
...@@ -41,24 +41,32 @@ public: ...@@ -41,24 +41,32 @@ public:
unsigned long flags; unsigned long flags;
void *body; void *body;
unsigned int body_size; unsigned int body_size;
void *userdata;
unsigned int userdata_size;
pitem() : fthoix(0), bwsoix(0), fwsoix(0), fchoix(0), lchoix(0), flags(0), pitem() : fthoix(0), bwsoix(0), fwsoix(0), fchoix(0), lchoix(0), flags(0),
body(0), body_size(0) body(0), body_size(0), userdata(0), userdata_size(0)
{ strcpy(lname,"");} { strcpy(lname,"");}
~pitem() ~pitem()
{ {
if ( body) if ( body)
free(body); free(body);
if ( userdata)
free(userdata);
} }
pitem( const pitem& x) pitem( const pitem& x)
{ {
memcpy( this, &x, sizeof(pitem)); memcpy( this, &x, sizeof(pitem));
if ( x.body) { if ( x.body) {
body = calloc( 1, body_size); body = malloc( body_size);
memcpy( body, x.body, body_size); memcpy( body, x.body, body_size);
} }
if ( x.userdata) {
userdata = malloc( userdata_size);
memcpy( userdata, x.userdata, userdata_size);
}
} }
pitem& operator=(const pitem& x) pitem& operator=(const pitem& x)
{ {
...@@ -67,6 +75,10 @@ public: ...@@ -67,6 +75,10 @@ public:
body = calloc( 1, body_size); body = calloc( 1, body_size);
memcpy( body, x.body, body_size); memcpy( body, x.body, body_size);
} }
if ( userdata) {
userdata = calloc( 1, userdata_size);
memcpy( userdata, x.userdata, userdata_size);
}
return *this; return *this;
} }
}; };
...@@ -97,6 +109,8 @@ public: ...@@ -97,6 +109,8 @@ public:
virtual void save( pwr_tStatus *sts) {} virtual void save( pwr_tStatus *sts) {}
virtual void load( pwr_tStatus *sts) {} virtual void load( pwr_tStatus *sts) {}
virtual bool find( pwr_tOix fthoix, char *name, pwr_tOix *oix);
vector<pitem> m_list; vector<pitem> m_list;
pwr_tOix root; pwr_tOix root;
......
/* /*
* Proview $Id: wb_pvd_gvl.cpp,v 1.1 2005-09-20 13:14:28 claes Exp $ * Proview $Id: wb_pvd_gvl.cpp,v 1.2 2005-10-25 12:04:25 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
...@@ -57,8 +57,8 @@ void wb_pvd_gvl::save( pwr_tStatus *sts) ...@@ -57,8 +57,8 @@ void wb_pvd_gvl::save( pwr_tStatus *sts)
void wb_pvd_gvl::save_item( pwr_tOix oix, ofstream& of) void wb_pvd_gvl::save_item( pwr_tOix oix, ofstream& of)
{ {
switch ( m_list[oix].cid) { switch ( m_list[oix].cid) {
case pwr_eClass_PlantHier: { case pwr_eClass_Hier: {
pwr_sPlantHier *body = (pwr_sPlantHier *)m_list[oix].body; pwr_sHier *body = (pwr_sHier *)m_list[oix].body;
of << "!**Menu " << m_list[oix].name << " { // " << body->Description << endl; of << "!**Menu " << m_list[oix].name << " { // " << body->Description << endl;
for ( int ix = m_list[oix].fchoix; ix; ix = m_list[ix].fwsoix) for ( int ix = m_list[oix].fchoix; ix; ix = m_list[ix].fwsoix)
...@@ -106,7 +106,7 @@ void wb_pvd_gvl::load( pwr_tStatus *rsts) ...@@ -106,7 +106,7 @@ void wb_pvd_gvl::load( pwr_tStatus *rsts)
// Create Root object // Create Root object
pitem rootitem; pitem rootitem;
strcpy( rootitem.name, "GlobalVolumeList"); strcpy( rootitem.name, "GlobalVolumeList");
rootitem.cid = pwr_eClass_PlantHier; rootitem.cid = pwr_eClass_Hier;
rootitem.oix = 0; rootitem.oix = 0;
m_list.push_back(rootitem); m_list.push_back(rootitem);
menu_stack[menu_cnt] = rootitem.oix; menu_stack[menu_cnt] = rootitem.oix;
...@@ -117,7 +117,7 @@ void wb_pvd_gvl::load( pwr_tStatus *rsts) ...@@ -117,7 +117,7 @@ void wb_pvd_gvl::load( pwr_tStatus *rsts)
line_cnt++; line_cnt++;
if ( line[0] == '!') { if ( line[0] == '!') {
if ( strncmp( line, "!**Menu", 7) == 0) { if ( strncmp( line, "!**Menu", 7) == 0) {
// Add PlantHier // Add Hier
char *s = strstr( line, "// "); char *s = strstr( line, "// ");
if ( s) { if ( s) {
strncpy( description, s+3, sizeof(description)); strncpy( description, s+3, sizeof(description));
...@@ -136,13 +136,13 @@ void wb_pvd_gvl::load( pwr_tStatus *rsts) ...@@ -136,13 +136,13 @@ void wb_pvd_gvl::load( pwr_tStatus *rsts)
pitem plantitem; pitem plantitem;
strcpy( plantitem.name, line_item[1]); strcpy( plantitem.name, line_item[1]);
plantitem.cid = pwr_eClass_PlantHier; plantitem.cid = pwr_eClass_Hier;
plantitem.oix = next_oix++; plantitem.oix = next_oix++;
plantitem.fthoix = menu_stack[menu_cnt - 1]; plantitem.fthoix = menu_stack[menu_cnt - 1];
plantitem.bwsoix = m_list[plantitem.fthoix].lchoix; plantitem.bwsoix = m_list[plantitem.fthoix].lchoix;
plantitem.fwsoix = 0; plantitem.fwsoix = 0;
plantitem.body_size = sizeof(pwr_sPlantHier); plantitem.body_size = sizeof(pwr_sHier);
pwr_sPlantHier *plantbody = (pwr_sPlantHier *) calloc( 1, plantitem.body_size); pwr_sHier *plantbody = (pwr_sHier *) calloc( 1, plantitem.body_size);
plantitem.body = plantbody; plantitem.body = plantbody;
strcpy( plantbody->Description, description); strcpy( plantbody->Description, description);
......
/* /*
* Proview $Id: wb_pvd_pl.cpp,v 1.2 2005-09-22 08:31:51 claes Exp $ * Proview $Id: wb_pvd_pl.cpp,v 1.3 2005-10-25 12:04:25 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
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "pwr.h" #include "pwr.h"
#include "pwr_class.h" #include "pwr_class.h"
#include "pwr_baseclasses.h" #include "pwr_baseclasses.h"
#include "co_wow.h"
#include "co_msgwindow.h"
#include "wb_vext.h" #include "wb_vext.h"
#include "wb_pvd_pl.h" #include "wb_pvd_pl.h"
#include "wb_ldh.h" #include "wb_ldh.h"
...@@ -33,6 +35,48 @@ ...@@ -33,6 +35,48 @@
extern "C" { extern "C" {
#include "co_cdh.h" #include "co_cdh.h"
#include "co_dcli.h" #include "co_dcli.h"
#include "co_cnf.h"
}
static char *pwrp_status_to_string( int value)
{
static char str[80];
switch ( value)
{
case 2: strcpy( str, "Database doesn't exist"); break;
case 3: strcpy( str, "No such project"); break;
case 4: strcpy( str, "Project root already exist"); break;
case 5: strcpy( str, "Project is not yet configured"); break;
case 6: strcpy( str, "Projectlist file not found"); break;
case 7: strcpy( str, "Project already exist"); break;
case 8: strcpy( str, "Base already exist"); break;
case 9: strcpy( str, "No such base"); break;
case 10: strcpy( str, "No write access to projectlist file"); break;
case 11: strcpy( str, "Syntax error"); break;
case 12: strcpy( str, "No write access to project root"); break;
case 13: strcpy( str, "Unable to create project root"); break;
case 14: strcpy( str, "Unable to delete project root"); break;
case 15: strcpy( str, "Unable to delete database"); break;
case 16: strcpy( str, "Base doesn't exist"); break;
case 17: strcpy( str, "Error in move"); break;
case 18: strcpy( str, "Current node is not mysql server"); break;
case 19: strcpy( str, "Unable to find mysql datadir"); break;
case 20: strcpy( str, "Unable to find database"); break;
case 21: strcpy( str, "Unable to find template database"); break;
case 22: strcpy( str, "Database already exist"); break;
case 23: strcpy( str, "Error in copy"); break;
case 24: strcpy( str, "Error when creating database"); break;
case 25: strcpy( str, "No project is set"); break;
case 26: strcpy( str, "Invalid project name"); break;
case 27: strcpy( str, "Unable to copy mysql database"); break;
case 28: strcpy( str, "Unable to rename mysql database"); break;
case 29: strcpy( str, "Unable to find mysql"); break;
case 30: strcpy( str, "No such root"); break;
default:
sprintf( str, "Errorcode from pwrp: %d", value);
}
return str;
} }
void wb_pvd_pl::writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offset, void wb_pvd_pl::writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offset,
...@@ -47,10 +91,13 @@ void wb_pvd_pl::writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offs ...@@ -47,10 +91,13 @@ void wb_pvd_pl::writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offs
case pwr_cClass_ProjectReg: { case pwr_cClass_ProjectReg: {
pwr_sClass_ProjectReg body; pwr_sClass_ProjectReg body;
if ( offset == (unsigned int)((char *)&body.Project - (char *)&body)) if ( offset == (unsigned int)((char *)&body.Project - (char *)&body)) {
m_list[oix].flags |= pl_mFlags_ProjectModified; m_list[oix].flags |= pl_mFlags_ProjectModified;
else if ( offset == (unsigned int)((char *)&body.Path - (char *)&body)) cdh_ToLower( buffer, buffer);
}
else if ( offset == (unsigned int)((char *)&body.Path - (char *)&body)) {
m_list[oix].flags |= pl_mFlags_PathModified; m_list[oix].flags |= pl_mFlags_PathModified;
}
break; break;
} }
default: ; default: ;
...@@ -59,31 +106,309 @@ void wb_pvd_pl::writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offs ...@@ -59,31 +106,309 @@ void wb_pvd_pl::writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offs
wb_pvd_file::writeAttribute( pcom, oix, offset, size, buffer); wb_pvd_file::writeAttribute( pcom, oix, offset, size, buffer);
} }
void wb_pvd_pl::createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name)
{
pwr_tOix oix = next_oix;
wb_pvd_file::createObject( pcom, destoix, desttype, cid, name);
switch ( cid) {
case pwr_cClass_ProjectReg: {
char defaultpath[80];
pwr_tObjName lowname;
pwr_tOix boix;
pwr_sClass_ProjectReg *body = (pwr_sClass_ProjectReg *)m_list[oix].body;
// Set default values to project, version and path
cnf_get_value( "defaultProjectRoot", defaultpath);
cdh_ToLower( lowname, m_list[oix].name);
strcat( defaultpath, "/");
strcat( defaultpath, lowname);
find( root, "Bases", &boix);
if ( m_list[boix].lchoix != 0) {
pwr_sClass_BaseReg *basebody =
(pwr_sClass_BaseReg *)m_list[m_list[boix].lchoix].body;
strcpy( body->Version, basebody->Version);
}
strcpy( body->Path, defaultpath);
strcpy( body->Project, lowname);
// Store original body in userdata to detect any modifications
m_list[oix].userdata_size = m_list[oix].body_size;
m_list[oix].userdata = calloc( 1, m_list[oix].userdata_size);
break;
}
case pwr_cClass_BaseReg:
m_list[oix].userdata_size = m_list[oix].body_size;
m_list[oix].userdata = calloc( 1, m_list[oix].userdata_size);
break;
default: ;
}
}
void wb_pvd_pl::save( pwr_tStatus *sts) void wb_pvd_pl::save( pwr_tStatus *sts)
{ {
if ( !check_list(sts))
return;
process_list( sts); process_list( sts);
save_list( sts); save_list( sts);
} }
void wb_pvd_pl::confirm_actions_ok( void *ctx, void *data)
{
wb_pvd_pl *pl = (wb_pvd_pl *)ctx;
pwr_tStatus sts;
pl->process_list( &sts);
pl->save_list( &sts);
}
bool wb_pvd_pl::check_list( pwr_tStatus *sts)
{
int error_cnt = 0;
char msg[200];
char text[4000] = "Do you wan't to execute these actions \n\n";
int actions_found = 0;
pwr_tCmd cmd;
int csts;
for ( int i = 0; i < (int) m_list.size(); i++) {
if ( m_list[i].flags & pl_mFlags_Disabled)
continue;
switch ( m_list[i].cid) {
case pwr_cClass_BaseReg: {
pwr_sClass_BaseReg *body = (pwr_sClass_BaseReg *)m_list[i].body;
pwr_sClass_BaseReg *origbody = (pwr_sClass_BaseReg *)m_list[i].userdata;
pwr_tOid oid;
oid.oix = m_list[i].oix;
oid.vid = ldh_cProjectListVolume;
if ( m_list[i].flags & pitem_mFlags_Deleted &&
!(m_list[i].flags & pitem_mFlags_Created)) {
}
else if ( !(m_list[i].flags & pitem_mFlags_Deleted)) {
if ( strcmp( body->Path, "") == 0) {
sprintf( msg, "Path is missing, in object %s", longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_No, oid);
error_cnt++;
}
if ( strcmp( body->Version, "") == 0) {
sprintf( msg, "Version is missing, in object %s", longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_No, oid);
error_cnt++;
}
if ( strcmp( body->Path, origbody->Path) != 0) {
// Check new path
}
}
break;
}
case pwr_cClass_ProjectReg: {
pwr_sClass_ProjectReg *body = (pwr_sClass_ProjectReg *)m_list[i].body;
pwr_sClass_ProjectReg *origbody = (pwr_sClass_ProjectReg *)m_list[i].userdata;
pwr_tOid oid;
oid.oix = m_list[i].oix;
oid.vid = ldh_cProjectListVolume;
if ( m_list[i].flags & pitem_mFlags_Deleted &&
!(m_list[i].flags & pitem_mFlags_Created)) {
// Project deleted
sprintf( msg, "delete project %s with file tree and databases\n", body->Project);
if ( strlen(text) + strlen(msg) < sizeof(text))
strcat( text, msg);
actions_found++;
}
else if ( !(m_list[i].flags & pitem_mFlags_Deleted)) {
if ( strcmp( body->Project, "") == 0) {
sprintf( msg, "Project is missing, in object %s", longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_No, oid);
error_cnt++;
}
if ( strcmp( body->Version, "") == 0) {
sprintf( msg, "Version is missing, in object %s", longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_No, oid);
error_cnt++;
}
else {
pwr_tOix boix;
find( root, "Bases", &boix);
if ( !find( boix, basename( body->Version), &boix)) {
sprintf( msg, "Version not found, in object %s", longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_No, oid);
error_cnt++;
}
if ( m_list[i].flags & pitem_mFlags_Created) {
if ( strcmp( body->CopyFrom, "") == 0) {
// Create project
// Check destination path
sprintf( cmd, "wb_pvd_pl.sh check create %s", body->Path);
csts = system( cmd);
if ( (csts >>= 8) != 0) {
sprintf( msg, "%s, in object %s", pwrp_status_to_string(csts),
longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_No);
error_cnt++;
}
sprintf( msg, "create project %s, version %s, path %s\n", body->Project,
body->Version, body->Path);
if ( strlen(text) + strlen(msg) < sizeof(text))
strcat( text, msg);
actions_found++;
}
else {
// Copy project
// Check destination path
sprintf( cmd, "wb_pvd_pl.sh check create %s", body->Path);
csts = system( cmd);
if ( (csts >>= 8) != 0) {
sprintf( msg, "%s, in object %s", pwrp_status_to_string(csts),
longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_No);
error_cnt++;
}
sprintf( msg, "copy project %s to %s, path %s\n", body->CopyFrom,
body->Project, body->Path);
if ( strlen(text) + strlen(msg) < sizeof(text))
strcat( text, msg);
actions_found++;
}
}
else if ( m_list[i].flags & pl_mFlags_PathModified &&
strcmp( body->Path, origbody->Path) != 0) {
// Move project
// Check source and destination path
sprintf( cmd, "wb_pvd_pl.sh check move %s %s",
origbody->Path, body->Path);
csts = system( cmd);
if ( (csts >>= 8) != 0) {
sprintf( msg, "%s, in object %s", pwrp_status_to_string(csts),
longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_No);
error_cnt++;
}
sprintf( msg, "move project %s from %s to %s\n", body->Project,
origbody->Path, body->Path);
if ( strlen(text) + strlen(msg) < sizeof(text))
strcat( text, msg);
actions_found++;
}
}
}
break;
}
default: ;
}
}
if ( error_cnt) {
sprintf( msg, "%d error(s) found, Save aborted", error_cnt);
MsgWindow::message('E', msg, msgw_ePop_Yes);
*sts = LDH__SYNTAX;
return false;
}
if ( actions_found) {
Widget toplevel;
MsgWindow::get_parent_widget( &toplevel);
if ( toplevel)
wow_DisplayQuestion( (void *)this, toplevel, "Confirm Actions", text,
confirm_actions_ok, 0, 0);
*sts = LDH__CONFIRM;
return false;
}
*sts = LDH__SUCCESS;
return true;
}
void wb_pvd_pl::process_list( pwr_tStatus *sts) void wb_pvd_pl::process_list( pwr_tStatus *sts)
{ {
char msg[200];
pwr_tCmd cmd;
int csts;
for ( int i = 0; i < (int) m_list.size(); i++) { for ( int i = 0; i < (int) m_list.size(); i++) {
if ( m_list[i].flags & pl_mFlags_Disabled)
continue;
switch ( m_list[i].cid) { switch ( m_list[i].cid) {
case pwr_cClass_ProjectReg: { case pwr_cClass_ProjectReg: {
pwr_sClass_ProjectReg *body = (pwr_sClass_ProjectReg *)m_list[i].body;
if ( m_list[i].flags & pitem_mFlags_Deleted && if ( m_list[i].flags & pitem_mFlags_Deleted &&
!(m_list[i].flags & pitem_mFlags_Created)) { !(m_list[i].flags & pitem_mFlags_Created)) {
printf( "Project deleted %s\n", longname(i)); printf( "Project deleted %s\n", longname(i));
sprintf( cmd, "pwrp_env.sh delete project %s noconfirm",
body->Project);
csts = system( cmd);
if ( (csts >>= 8) != 0) {
sprintf( msg, "%s, in object %s", pwrp_status_to_string(csts),
longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_Yes);
return;
}
} }
else if ( m_list[i].flags & pitem_mFlags_Created && else if ( m_list[i].flags & pitem_mFlags_Created &&
!(m_list[i].flags & pitem_mFlags_Deleted)) { !(m_list[i].flags & pitem_mFlags_Deleted)) {
printf( "Project deleted %s\n", longname(i)); if ( strcmp( body->CopyFrom, "") == 0) {
printf( "Project created %s\n", longname(i));
sprintf( cmd, "wb_pvd_pl.sh create project %s %s %s \"%s\" \"%s\"",
body->Project, body->Version, body->Path, longname(m_list[i].oix),
body->Description);
csts = system( cmd);
if ( (csts >>= 8) != 0) {
sprintf( msg, "%s, in object %s", pwrp_status_to_string(csts),
longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_Yes);
return;
}
}
else {
sprintf( cmd, "pwrp_env.sh copy project %s %s %s %s noconfirm",
body->CopyFrom, body->Project, body->Path, longname(m_list[i].oix));
printf( cmd);
csts = system( cmd);
if ( (csts >>= 8) != 0) {
sprintf( msg, "%s, in object %s", pwrp_status_to_string(csts),
longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_Yes);
return;
}
}
} }
else if ( !(m_list[i].flags & pitem_mFlags_Deleted)) { else if ( !(m_list[i].flags & pitem_mFlags_Deleted)) {
pwr_sClass_ProjectReg *body = (pwr_sClass_ProjectReg *)m_list[i].body;
pwr_sClass_ProjectReg *origbody = (pwr_sClass_ProjectReg *)m_list[i].userdata;
if ( m_list[i].flags & pl_mFlags_ProjectModified) { if ( m_list[i].flags & pl_mFlags_ProjectModified) {
printf( "Project modified %s\n", longname(i)); printf( "Project modified %s\n", longname(i));
} }
if ( m_list[i].flags & pl_mFlags_PathModified) { if ( m_list[i].flags & pl_mFlags_PathModified &&
strcmp( body->Path, origbody->Path) != 0) {
printf( "Path modified %s\n", longname(i)); printf( "Path modified %s\n", longname(i));
sprintf( cmd, "pwrp_env.sh modify project %s -r %s", origbody->Project,
body->Path);
csts = system( cmd);
if ( (csts >>= 8) != 0) {
sprintf( msg, "%s, in object %s", pwrp_status_to_string(csts),
longname(m_list[i].oix));
MsgWindow::message('E', msg, msgw_ePop_Yes);
return;
}
} }
} }
break; break;
...@@ -97,9 +422,10 @@ void wb_pvd_pl::save_list( pwr_tStatus *sts) ...@@ -97,9 +422,10 @@ void wb_pvd_pl::save_list( pwr_tStatus *sts)
{ {
ofstream of; ofstream of;
pwr_tFileName fname; pwr_tFileName fname;
*sts = LDH__SUCCESS; *sts = LDH__SUCCESS;
dcli_translate_filename( fname, "$pwra_db/pwr_projectlist.tst"); dcli_translate_filename( fname, "$pwra_db/pwr_projectlist.dat");
of.open( fname); of.open( fname);
if ( !of) { if ( !of) {
*sts = LDH__FILEOPEN; *sts = LDH__FILEOPEN;
...@@ -107,22 +433,33 @@ void wb_pvd_pl::save_list( pwr_tStatus *sts) ...@@ -107,22 +433,33 @@ void wb_pvd_pl::save_list( pwr_tStatus *sts)
} }
for ( int oix = m_list[0].fchoix; oix; oix = m_list[oix].fwsoix) { for ( int oix = m_list[0].fchoix; oix; oix = m_list[oix].fwsoix) {
if ( !(m_list[oix].flags & pitem_mFlags_Deleted)) save_item( oix, of);
save_item( oix, of);
} }
of.close(); of.close();
// Disable deletet objects
for ( int i = 0; i < (int) m_list.size(); i++) {
if ( m_list[i].flags & pitem_mFlags_Deleted)
m_list[i].flags |= pl_mFlags_Disabled;
}
} }
void wb_pvd_pl::save_item( pwr_tOix oix, ofstream& of) void wb_pvd_pl::save_item( pwr_tOix oix, ofstream& of)
{ {
if ( m_list[oix].flags & pitem_mFlags_Deleted)
return;
m_list[oix].flags = 0;
if ( m_list[oix].userdata)
memcpy( m_list[oix].userdata, m_list[oix].body, m_list[oix].userdata_size);
switch ( m_list[oix].cid) { switch ( m_list[oix].cid) {
case pwr_eClass_Hier: { case pwr_eClass_Hier: {
pwr_sHier *body = (pwr_sHier *)m_list[oix].body; pwr_sHier *body = (pwr_sHier *)m_list[oix].body;
if ( oix != 1) if ( oix != 1)
of << "!**Menu " << m_list[oix].name << " { // " << body->Description << endl; of << "!**Menu " << m_list[oix].name << " { // " << body->Description << endl;
for ( int ix = m_list[oix].fchoix; ix; ix = m_list[ix].fwsoix) { for ( int ix = m_list[oix].fchoix; ix; ix = m_list[ix].fwsoix) {
if ( !(m_list[ix].flags & pitem_mFlags_Deleted)) save_item( ix, of);
save_item( ix, of);
} }
if ( oix != 1) if ( oix != 1)
of << "!**}" << endl; of << "!**}" << endl;
...@@ -131,6 +468,7 @@ void wb_pvd_pl::save_item( pwr_tOix oix, ofstream& of) ...@@ -131,6 +468,7 @@ void wb_pvd_pl::save_item( pwr_tOix oix, ofstream& of)
case pwr_cClass_ProjectReg: { case pwr_cClass_ProjectReg: {
char hname[120]; char hname[120];
pwr_sClass_ProjectReg *body = (pwr_sClass_ProjectReg *)m_list[oix].body; pwr_sClass_ProjectReg *body = (pwr_sClass_ProjectReg *)m_list[oix].body;
strcpy( body->CopyFrom, "");
strcpy( hname, longname(oix)); strcpy( hname, longname(oix));
...@@ -138,8 +476,7 @@ void wb_pvd_pl::save_item( pwr_tOix oix, ofstream& of) ...@@ -138,8 +476,7 @@ void wb_pvd_pl::save_item( pwr_tOix oix, ofstream& of)
<< " \"" << body->Description << "\"" << endl; << " \"" << body->Description << "\"" << endl;
for ( int ix = m_list[oix].fchoix; ix; ix = m_list[ix].fwsoix) { for ( int ix = m_list[oix].fchoix; ix; ix = m_list[ix].fwsoix) {
if ( !(m_list[ix].flags & pitem_mFlags_Deleted)) save_item( ix, of);
save_item( ix, of);
} }
break; break;
} }
...@@ -168,7 +505,7 @@ void wb_pvd_pl::load( pwr_tStatus *rsts) ...@@ -168,7 +505,7 @@ void wb_pvd_pl::load( pwr_tStatus *rsts)
*rsts = LDH__SUCCESS; *rsts = LDH__SUCCESS;
dcli_translate_filename( fname, "$pwra_db/pwr_projectlist.tst"); dcli_translate_filename( fname, "$pwra_db/pwr_projectlist.dat");
is.open( fname); is.open( fname);
if ( !is) { if ( !is) {
*rsts = LDH__NEWFILE; *rsts = LDH__NEWFILE;
...@@ -274,6 +611,10 @@ void wb_pvd_pl::load( pwr_tStatus *rsts) ...@@ -274,6 +611,10 @@ void wb_pvd_pl::load( pwr_tStatus *rsts)
strcpy( basebody->Description, ""); strcpy( basebody->Description, "");
strcpy( basebody->Version, line_item[1]); strcpy( basebody->Version, line_item[1]);
strcpy( basebody->Path, line_item[2]); strcpy( basebody->Path, line_item[2]);
// Store original body in userdata to identify any changes when saving
baseitem.userdata_size = baseitem.body_size;
baseitem.userdata = calloc( 1, baseitem.userdata_size);
memcpy( baseitem.userdata, baseitem.body, baseitem.userdata_size);
m_list.push_back(baseitem); m_list.push_back(baseitem);
...@@ -290,6 +631,13 @@ void wb_pvd_pl::load( pwr_tStatus *rsts) ...@@ -290,6 +631,13 @@ void wb_pvd_pl::load( pwr_tStatus *rsts)
continue; continue;
} }
// For backward compability, create the path (pre V4.1)
bool hier_created;
pwr_tOix hieroix;
if ( (hier_created = create_hier( line_item[3], &hieroix))) {
menu_stack[menu_cnt++] = hieroix;
}
pitem projitem; pitem projitem;
if ( (s = strrchr( line_item[3], '-'))) if ( (s = strrchr( line_item[3], '-')))
strcpy( projitem.name, s + 1); strcpy( projitem.name, s + 1);
...@@ -312,6 +660,11 @@ void wb_pvd_pl::load( pwr_tStatus *rsts) ...@@ -312,6 +660,11 @@ void wb_pvd_pl::load( pwr_tStatus *rsts)
projitem.fwsoix = 0; projitem.fwsoix = 0;
strcpy( projbody->Description, line_item[4]); strcpy( projbody->Description, line_item[4]);
strcpy( projbody->Path, line_item[2]); strcpy( projbody->Path, line_item[2]);
// Store original body in userdata to identify any changes when saving
projitem.userdata_size = projitem.body_size;
projitem.userdata = calloc( 1, projitem.userdata_size);
memcpy( projitem.userdata, projitem.body, projitem.userdata_size);
m_list.push_back(projitem); m_list.push_back(projitem);
...@@ -321,7 +674,58 @@ void wb_pvd_pl::load( pwr_tStatus *rsts) ...@@ -321,7 +674,58 @@ void wb_pvd_pl::load( pwr_tStatus *rsts)
if ( m_list[projitem.fthoix].fchoix == 0) if ( m_list[projitem.fthoix].fchoix == 0)
m_list[projitem.fthoix].fchoix = projitem.oix; m_list[projitem.fthoix].fchoix = projitem.oix;
if ( hier_created)
menu_cnt--;
}
}
// Create a path from hierarchy string
// Used to be compatible with projectlists of V4.0 and previous
bool wb_pvd_pl::create_hier( char *hier, pwr_tOix *oix)
{
pwr_tObjName segment_name[20];
int num;
pwr_tOix fthoix = root;
pwr_tOix ix;
bool created = false;
num = dcli_parse( hier, "-", "", (char *)segment_name,
sizeof(segment_name)/sizeof(segment_name[0]),
sizeof(segment_name[0]), 0);
for ( int i = 0; i < num - 1; i++) {
// Check if name exist
if ( !find( fthoix, segment_name[i], &ix)) {
// Create this hierarchy object
pitem hieritem;
strcpy( hieritem.name, segment_name[i]);
hieritem.cid = pwr_eClass_Hier;
hieritem.oix = next_oix++;
hieritem.fthoix = fthoix;
hieritem.bwsoix = m_list[hieritem.fthoix].lchoix;
hieritem.fwsoix = 0;
hieritem.body_size = sizeof(pwr_sHier);
pwr_sHier *hierbody = (pwr_sHier *) calloc( 1, hieritem.body_size);
hieritem.body = hierbody;
strcpy( hierbody->Description, "");
m_list.push_back(hieritem);
if ( hieritem.bwsoix != 0)
m_list[hieritem.bwsoix].fwsoix = hieritem.oix;
m_list[hieritem.fthoix].lchoix = hieritem.oix;
if ( m_list[hieritem.fthoix].fchoix == 0)
m_list[hieritem.fthoix].fchoix = hieritem.oix;
fthoix = hieritem.oix;
created = true;
}
else
fthoix = ix;
} }
*oix = fthoix;
return created;
} }
// Convert version to a valid object name // Convert version to a valid object name
......
/* /*
* Proview $Id: wb_pvd_pl.h,v 1.1 2005-09-20 13:14:28 claes Exp $ * Proview $Id: wb_pvd_pl.h,v 1.2 2005-10-25 12:04:25 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
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
typedef enum { typedef enum {
pl_mFlags_ProjectModified = 1 << 16, pl_mFlags_ProjectModified = 1 << 16,
pl_mFlags_PathModified = 1 << 17 pl_mFlags_PathModified = 1 << 17,
pl_mFlags_Disabled = 1 << 18
} pl_mFlags; } pl_mFlags;
class wb_pvd_pl : public wb_pvd_file { class wb_pvd_pl : public wb_pvd_file {
...@@ -36,12 +37,18 @@ public: ...@@ -36,12 +37,18 @@ public:
} }
void writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offset, void writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size, char *buffer); unsigned int size, char *buffer);
void createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name);
void load( pwr_tStatus *sts); void load( pwr_tStatus *sts);
void save( pwr_tStatus *sts); void save( pwr_tStatus *sts);
bool check_list( pwr_tStatus *sts);
void process_list( pwr_tStatus *sts); void process_list( pwr_tStatus *sts);
void save_list( pwr_tStatus *sts); void save_list( pwr_tStatus *sts);
void save_item( pwr_tOix oix, ofstream &of); void save_item( pwr_tOix oix, ofstream &of);
char *basename( char *version); char *basename( char *version);
bool create_hier( char *hier, pwr_tOix *oix);
static void confirm_actions_ok( void *ctx, void *data);
}; };
#endif #endif
......
/* /*
* Proview $Id: wb_vrepext.h,v 1.5 2005-09-20 13:14:28 claes Exp $ * Proview $Id: wb_vrepext.h,v 1.6 2005-10-25 12:04:25 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
...@@ -49,6 +49,8 @@ class ext_object ...@@ -49,6 +49,8 @@ class ext_object
m_flags.m = 0; m_flags.m = 0;
m_oid.oix = 0; m_oid.oix = 0;
m_oid.vid = 0; m_oid.vid = 0;
time.tv_sec = 0;
time.tv_nsec = 0;
} }
ext_object( vext_sAMsgObject *msg, pwr_tVid vid, wb_cdef &cdef) : ext_object( vext_sAMsgObject *msg, pwr_tVid vid, wb_cdef &cdef) :
rbody_size(0), dbody_size(0), rbody(0), dbody(0) rbody_size(0), dbody_size(0), rbody(0), dbody(0)
...@@ -69,6 +71,8 @@ class ext_object ...@@ -69,6 +71,8 @@ class ext_object
lchoid.vid = vid; lchoid.vid = vid;
m_cid = msg->cid; m_cid = msg->cid;
m_flags = cdef.flags(); m_flags = cdef.flags();
time.tv_sec = 0;
time.tv_nsec = 0;
} }
~ext_object() { ~ext_object() {
if ( rbody_size) free( rbody); if ( rbody_size) free( rbody);
......
/* /*
* Proview $Id: wb_wnav.cpp,v 1.25 2005-10-18 05:14:05 claes Exp $ * Proview $Id: wb_wnav.cpp,v 1.26 2005-10-25 12:04:25 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
...@@ -1092,7 +1092,7 @@ int WNav::get_select( pwr_sAttrRef **attrref, int **is_attr, int *cnt) ...@@ -1092,7 +1092,7 @@ int WNav::get_select( pwr_sAttrRef **attrref, int **is_attr, int *cnt)
sts = ldh_NameToAttrRef( ldhses, attr_str, ap); sts = ldh_NameToAttrRef( ldhses, attr_str, ap);
if ( EVEN(sts)) { if ( EVEN(sts)) {
// ldh_NameToAttrRef doesn't handle objects with no RtBody... // ldh_NameToAttrRef doesn't handle objects with no RtBody...
ap->Objid = item->objid; *ap = cdh_ObjidToAref( item->objid);
} }
*is_attr_p = 0; *is_attr_p = 0;
} }
...@@ -3465,14 +3465,15 @@ static int wnav_init_brow_base_cb( FlowCtx *fctx, void *client_data) ...@@ -3465,14 +3465,15 @@ static int wnav_init_brow_base_cb( FlowCtx *fctx, void *client_data)
wnav_trace_scan( wnav); wnav_trace_scan( wnav);
// Execute the init file // Execute the init file
strcpy( cmd, "@"); if ( wnav->script_filename_cb) {
dcli_translate_filename( &cmd[1], wnav_cInitFile); strcpy( cmd, "@");
((WNav *)wnav)->command( cmd); strcat( cmd, (wnav->script_filename_cb)( wnav->parent_ctx));
((WNav *)wnav)->command( cmd);
// Execute the symbolfile
if ( wnav->window_type == wnav_eWindowType_W1)
wnav->gbl.symbolfile_exec( wnav);
// Execute the symbolfile
if ( wnav->window_type == wnav_eWindowType_W1)
wnav->gbl.symbolfile_exec( wnav);
}
return 1; return 1;
} }
......
/* /*
* Proview $Id: wb_wnav.h,v 1.11 2005-09-06 10:43:32 claes Exp $ * Proview $Id: wb_wnav.h,v 1.12 2005-10-25 12:04:25 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
...@@ -69,7 +69,7 @@ extern "C" { ...@@ -69,7 +69,7 @@ extern "C" {
#define wnav_cVersion "X3.3a" #define wnav_cVersion "X3.3a"
#define wnav_cScriptDescKey "!** Description" #define wnav_cScriptDescKey "!** Description"
#define wnav_cScriptInvisKey "!** Invisible" #define wnav_cScriptInvisKey "!** Invisible"
#define wnav_cInitFile "pwrp_login:wtt_init.pwr_com" #define wnav_cInitFile "pwrp_login:wtt_init"
#define wnav_cSymbolFile "pwrp_login:wtt_symbols.pwr_com" #define wnav_cSymbolFile "pwrp_login:wtt_symbols.pwr_com"
#define WNAV_BROW_MAX 25 #define WNAV_BROW_MAX 25
...@@ -247,6 +247,7 @@ class WNav { ...@@ -247,6 +247,7 @@ class WNav {
void (*create_popup_menu_cb)( void *, pwr_sAttrRef, int, int); void (*create_popup_menu_cb)( void *, pwr_sAttrRef, int, int);
void (*save_cb)( void *); void (*save_cb)( void *);
void (*revert_cb)( void *, int confirm); void (*revert_cb)( void *, int confirm);
char *(*script_filename_cb)( void *);
pwr_tBoolean (*format_selection_cb)( void *, pwr_sAttrRef, XtPointer *, pwr_tBoolean (*format_selection_cb)( void *, pwr_sAttrRef, XtPointer *,
unsigned long *, pwr_tBoolean, pwr_tBoolean, wnav_eSelectionFormat); unsigned long *, pwr_tBoolean, pwr_tBoolean, wnav_eSelectionFormat);
int (*get_global_select_cb)( void *, pwr_sAttrRef **, int (*get_global_select_cb)( void *, pwr_sAttrRef **,
......
/* /*
* Proview $Id: wb_wnav_command.cpp,v 1.32 2005-10-21 16:11:23 claes Exp $ * Proview $Id: wb_wnav_command.cpp,v 1.33 2005-10-25 12:04:25 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
...@@ -326,7 +326,7 @@ dcli_tCmdTable wnav_command_table[] = { ...@@ -326,7 +326,7 @@ dcli_tCmdTable wnav_command_table[] = {
{ {
"LOGIN", "LOGIN",
&wnav_login_func, &wnav_login_func,
{ "dcli_arg1", "dcli_arg2", ""} { "dcli_arg1", "dcli_arg2", "/ADMINISTRATOR", ""}
}, },
{ {
"TWO", "TWO",
...@@ -774,14 +774,53 @@ static int wnav_login_func( void *client_data, ...@@ -774,14 +774,53 @@ static int wnav_login_func( void *client_data,
char systemgroup[80]; char systemgroup[80];
unsigned int priv; unsigned int priv;
char msg[80]; char msg[80];
int administrator;
if ( EVEN( dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str)))) administrator = ODD(dcli_get_qualifier( "/ADMINISTRATOR", 0, 0));
{
if ( administrator) {
sts = user_CheckSystemGroup( "administrator");
if ( EVEN(sts)) {
// Username and password are not required
strcpy( wnav->user, "Administrator");
wnav->priv = pwr_mPrv_Administrator;
strcpy( login_prv.username, "Administrator");
login_prv.priv = (pwr_mPrv) wnav->priv;
wnav->message('I', "Administrator logged in");
return WNAV__SUCCESS;
}
else {
// Check user and password in systemgroup "aministrator"
if ( EVEN( dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str)))) {
wnav->message('E',"Username and password required");
return WNAV__SYNTAX;
}
if ( EVEN( dcli_get_qualifier( "dcli_arg2", arg2_str, sizeof(arg2_str)))) {
wnav->message('E',"Password required");
return WNAV__SYNTAX;
}
cdh_ToLower( arg1_str, arg1_str);
cdh_ToLower( arg2_str, arg2_str);
sts = user_CheckUser( "administrator", arg1_str, arg2_str, &priv);
if ( EVEN(sts))
wnav->message('E',"Login failure");
else {
strcpy( wnav->user, arg1_str);
wnav->priv = pwr_mPrv_Administrator;
strcpy( login_prv.username, arg1_str);
login_prv.priv = (pwr_mPrv) wnav->priv;
sprintf( msg, "User %s logged in", arg1_str);
wnav->message('I', msg);
}
return WNAV__SUCCESS;
}
}
if ( EVEN( dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str)))) {
wnav->message('E',"Syntax error"); wnav->message('E',"Syntax error");
return WNAV__SYNTAX; return WNAV__SYNTAX;
} }
if ( EVEN( dcli_get_qualifier( "dcli_arg2", arg2_str, sizeof(arg2_str)))) if ( EVEN( dcli_get_qualifier( "dcli_arg2", arg2_str, sizeof(arg2_str)))) {
{
wnav->message('E',"Syntax error"); wnav->message('E',"Syntax error");
return WNAV__SYNTAX; return WNAV__SYNTAX;
} }
......
/* /*
* Proview $Id: wb_wtt.cpp,v 1.26 2005-09-20 13:14:28 claes Exp $ * Proview $Id: wb_wtt.cpp,v 1.27 2005-10-25 12:04:25 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
...@@ -436,6 +436,45 @@ void Wtt::menu_setup() ...@@ -436,6 +436,45 @@ void Wtt::menu_setup()
XtSetValues( menu_classeditor_w, nosensitive, 1); XtSetValues( menu_classeditor_w, nosensitive, 1);
} }
break; break;
case wb_eType_ExternVolume:
XtUnmanageChild( menu_createstruct_w);
if ( editmode) {
XtSetValues( menu_save_w, sensitive, 1);
XtSetValues( menu_revert_w, sensitive, 1);
XtSetValues( menu_cut_w, sensitive, 1);
XtSetValues( menu_copy_w, sensitive, 1);
XtSetValues( menu_paste_w, sensitive, 1);
XtSetValues( menu_pasteinto_w, sensitive, 1);
XtSetValues( menu_rename_w, sensitive, 1);
XtSetValues( menu_utilities_w, nosensitive, 1);
XtSetValues( menu_openplc_w, nosensitive, 1);
XtSetValues( menu_compile_w, nosensitive, 1);
XtSetValues( menu_createload_w, nosensitive, 1);
XtSetValues( menu_createboot_w, nosensitive, 1);
XtSetValues( menu_distribute_w, nosensitive, 1);
XtSetValues( menu_change_value_w, sensitive, 1);
XtSetValues( menu_edit_w, sensitive, 1);
XtSetValues( menu_classeditor_w, nosensitive, 1);
}
else {
XtSetValues( menu_save_w, nosensitive, 1);
XtSetValues( menu_revert_w, nosensitive, 1);
XtSetValues( menu_cut_w, nosensitive, 1);
XtSetValues( menu_copy_w, nosensitive, 1);
XtSetValues( menu_paste_w, nosensitive, 1);
XtSetValues( menu_pasteinto_w, nosensitive, 1);
XtSetValues( menu_rename_w, nosensitive, 1);
XtSetValues( menu_utilities_w, nosensitive, 1);
XtSetValues( menu_openplc_w, nosensitive, 1);
XtSetValues( menu_compile_w, nosensitive, 1);
XtSetValues( menu_createload_w, nosensitive, 1);
XtSetValues( menu_createboot_w, nosensitive, 1);
XtSetValues( menu_distribute_w, nosensitive, 1);
XtSetValues( menu_change_value_w, nosensitive, 1);
XtSetValues( menu_edit_w, sensitive, 1);
XtSetValues( menu_classeditor_w, nosensitive, 1);
}
break;
default: default:
; ;
} }
...@@ -452,17 +491,31 @@ int Wtt::restore_settings() ...@@ -452,17 +491,31 @@ int Wtt::restore_settings()
return 1; return 1;
} }
static char *wtt_script_filename_cb( void *ctx)
{
return ((Wtt *)ctx)->script_filename();
}
char *Wtt::script_filename()
{
static pwr_tFileName fname;
if ( wb_type == wb_eType_Volume)
sprintf( fname, "%s.pwr_com", wnav_cInitFile);
else
sprintf( fname, "%s%d.pwr_com", wnav_cInitFile, (int)wb_type);
dcli_translate_filename( fname, fname);
return fname;
}
int Wtt::save_settings() int Wtt::save_settings()
{ {
ofstream fp; ofstream fp;
char filename[80];
Arg args[5]; Arg args[5];
int i; int i;
short width, height; short width, height;
dcli_get_defaultfilename( wnav_cInitFile, filename, ".pwr_com"); fp.open( script_filename());
dcli_translate_filename( filename, filename);
fp.open( filename);
i = 0; i = 0;
XtSetArg(args[i], XmNwidth, &width);i++; XtSetArg(args[i], XmNwidth, &width);i++;
...@@ -769,7 +822,8 @@ static void wtt_save_cb( void *ctx) ...@@ -769,7 +822,8 @@ static void wtt_save_cb( void *ctx)
return; return;
} }
} }
wtt->message( 'I', "Session saved"); if ( sts != LDH__CONFIRM)
wtt->message( 'I', "Session saved");
} }
static void wtt_revert_ok( Wtt *wtt) static void wtt_revert_ok( Wtt *wtt)
...@@ -1103,10 +1157,22 @@ int Wtt::set_edit() ...@@ -1103,10 +1157,22 @@ int Wtt::set_edit()
return 1; return 1;
} }
if ( !(login_prv.priv & pwr_mPrv_DevConfig)) switch ( volid) {
{ case ldh_cProjectListVolume:
message( 'E', "User is not authorized to configure"); case ldh_cGlobalVolumeListVolume:
return 1; case ldh_cUserDatabaseVolume:
// Privilege Administrator required
if ( !(login_prv.priv & pwr_mPrv_Administrator)) {
message( 'E', "User is not authorized to administrate");
return 1;
}
break;
default:
// Privilege DevConfig required
if ( !(login_prv.priv & pwr_mPrv_DevConfig)) {
message( 'E', "User is not authorized to configure");
return 1;
}
} }
sts = ldh_CloseSession( ldhses); sts = ldh_CloseSession( ldhses);
...@@ -2089,7 +2155,7 @@ static void wtt_activate_openpl( Widget w, Wtt *wtt, XmAnyCallbackStruct *data) ...@@ -2089,7 +2155,7 @@ static void wtt_activate_openpl( Widget w, Wtt *wtt, XmAnyCallbackStruct *data)
{ {
wtt->set_clock_cursor(); wtt->set_clock_cursor();
if ( wtt->open_volume_cb) if ( wtt->open_volume_cb)
(wtt->open_volume_cb) ( wtt, wb_eType_Volume, "ProjectList", wow_eFileSelType_); (wtt->open_volume_cb) ( wtt, wb_eType_ExternVolume, "ProjectList", wow_eFileSelType_);
wtt->reset_cursor(); wtt->reset_cursor();
} }
...@@ -2097,7 +2163,7 @@ static void wtt_activate_opengvl( Widget w, Wtt *wtt, XmAnyCallbackStruct *data) ...@@ -2097,7 +2163,7 @@ static void wtt_activate_opengvl( Widget w, Wtt *wtt, XmAnyCallbackStruct *data)
{ {
wtt->set_clock_cursor(); wtt->set_clock_cursor();
if ( wtt->open_volume_cb) if ( wtt->open_volume_cb)
(wtt->open_volume_cb) ( wtt, wb_eType_Volume, "GlobalVolumeList", wow_eFileSelType_); (wtt->open_volume_cb) ( wtt, wb_eType_ExternVolume, "GlobalVolumeList", wow_eFileSelType_);
wtt->reset_cursor(); wtt->reset_cursor();
} }
...@@ -2105,7 +2171,7 @@ static void wtt_activate_openudb( Widget w, Wtt *wtt, XmAnyCallbackStruct *data) ...@@ -2105,7 +2171,7 @@ static void wtt_activate_openudb( Widget w, Wtt *wtt, XmAnyCallbackStruct *data)
{ {
wtt->set_clock_cursor(); wtt->set_clock_cursor();
if ( wtt->open_volume_cb) if ( wtt->open_volume_cb)
(wtt->open_volume_cb) ( wtt, wb_eType_Volume, "UserDatabase", wow_eFileSelType_); (wtt->open_volume_cb) ( wtt, wb_eType_ExternVolume, "UserDatabase", wow_eFileSelType_);
wtt->reset_cursor(); wtt->reset_cursor();
} }
...@@ -3322,6 +3388,7 @@ Wtt::Wtt( ...@@ -3322,6 +3388,7 @@ Wtt::Wtt(
char layout_palette[80]; char layout_palette[80];
char title_w1[40]; char title_w1[40];
char title_w2[40]; char title_w2[40];
int hide_wnavnode = 0;
static char translations[] = "\ static char translations[] = "\
<FocusIn>: wtt_inputfocus()\n"; <FocusIn>: wtt_inputfocus()\n";
...@@ -3489,7 +3556,51 @@ Wtt::Wtt( ...@@ -3489,7 +3556,51 @@ Wtt::Wtt(
strcpy( title_w1, "Plant Configuration"); strcpy( title_w1, "Plant Configuration");
strcpy( title_w2, "Node Configuration"); strcpy( title_w2, "Node Configuration");
sprintf( title, "PwR Navigator Buffer %s, %s", volname, name); sprintf( title, "PwR Navigator Buffer %s, %s", volname, name);
hide_wnavnode = 1;
break; break;
case pwr_eClass_ExternVolume: {
switch ( volid) {
case ldh_cProjectListVolume:
wb_type = wb_eType_ExternVolume;
strcpy( layout_w1, "PrListNavigatorW1");
strcpy( layout_w2, "PrListNavigatorW1");
strcpy( layout_palette, "PrListNavigatorPalette");
strcpy( title_w1, "Project List");
strcpy( title_w2, "");
sprintf( title, "PwR Project List");
hide_wnavnode = 1;
break;
case ldh_cGlobalVolumeListVolume:
wb_type = wb_eType_ExternVolume;
strcpy( layout_w1, "GvListNavigatorW1");
strcpy( layout_w2, "GvListNavigatorW1");
strcpy( layout_palette, "GvListNavigatorPalette");
strcpy( title_w1, "Global Volume List");
strcpy( title_w2, "");
sprintf( title, "PwR Global Volume List");
hide_wnavnode = 1;
break;
case ldh_cUserDatabaseVolume:
wb_type = wb_eType_ExternVolume;
strcpy( layout_w1, "UserDbNavigatorW1");
strcpy( layout_w2, "UserDbNavigatorW1");
strcpy( layout_palette, "UserDbNavigatorPalette");
strcpy( title_w1, "User Database");
strcpy( title_w2, "");
sprintf( title, "PwR User Database");
hide_wnavnode = 1;
break;
default:
wb_type = wb_eType_ExternVolume;
strcpy( layout_w1, "NavigatorW1");
strcpy( layout_w2, "NavigatorW2");
strcpy( layout_palette, "NavigatorPalette");
strcpy( title_w1, "Plant Configuration");
strcpy( title_w2, "Node Configuration");
sprintf( title, "PwR Navigator Volume %s, %s", volname, name);
}
break;
}
default: default:
wb_type = wb_eType_Volume; wb_type = wb_eType_Volume;
strcpy( layout_w1, "NavigatorW1"); strcpy( layout_w1, "NavigatorW1");
...@@ -3580,6 +3691,7 @@ Wtt::Wtt( ...@@ -3580,6 +3691,7 @@ Wtt::Wtt(
wnav->create_popup_menu_cb = &wtt_create_popup_menu_cb; wnav->create_popup_menu_cb = &wtt_create_popup_menu_cb;
wnav->save_cb = &wtt_save_cb; wnav->save_cb = &wtt_save_cb;
wnav->revert_cb = &wtt_revert_cb; wnav->revert_cb = &wtt_revert_cb;
wnav->script_filename_cb = &wtt_script_filename_cb;
wnav->format_selection_cb = wtt_format_selection; wnav->format_selection_cb = wtt_format_selection;
wnav->get_global_select_cb = wtt_get_global_select_cb; wnav->get_global_select_cb = wtt_get_global_select_cb;
wnav->global_unselect_objid_cb = wtt_global_unselect_objid_cb; wnav->global_unselect_objid_cb = wtt_global_unselect_objid_cb;
...@@ -3611,6 +3723,7 @@ Wtt::Wtt( ...@@ -3611,6 +3723,7 @@ Wtt::Wtt(
wnavnode->create_popup_menu_cb = &wtt_create_popup_menu_cb; wnavnode->create_popup_menu_cb = &wtt_create_popup_menu_cb;
wnavnode->save_cb = &wtt_save_cb; wnavnode->save_cb = &wtt_save_cb;
wnavnode->revert_cb = &wtt_revert_cb; wnavnode->revert_cb = &wtt_revert_cb;
wnavnode->script_filename_cb = &wtt_script_filename_cb;
wnavnode->format_selection_cb = wtt_format_selection; wnavnode->format_selection_cb = wtt_format_selection;
wnavnode->get_global_select_cb = wtt_get_global_select_cb; wnavnode->get_global_select_cb = wtt_get_global_select_cb;
wnavnode->global_unselect_objid_cb = wtt_global_unselect_objid_cb; wnavnode->global_unselect_objid_cb = wtt_global_unselect_objid_cb;
......
/* /*
* Proview $Id: wb_wtt.h,v 1.13 2005-09-20 13:14:28 claes Exp $ * Proview $Id: wb_wtt.h,v 1.14 2005-10-25 12:04:25 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
...@@ -267,6 +267,7 @@ class Wtt { ...@@ -267,6 +267,7 @@ class Wtt {
void pop(); void pop();
int find( pwr_tOid oid); int find( pwr_tOid oid);
int find_plc( pwr_tOid oid); int find_plc( pwr_tOid oid);
char *script_filename();
~Wtt(); ~Wtt();
}; };
......
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