Commit 42547d4e authored by Claes Sjofors's avatar Claes Sjofors

Cloned volumes implemented

parent 2b08c23b
......@@ -3518,7 +3518,7 @@ Med kommandot
> open graph /class /instance=&(H1-ObjectList.ObjArray[0])
öppnas objektgrafen för objektet i första elementet. Man kan även age dubbla led av
öppnas objektgrafen för objektet i första elementet. Man kan även ange dubbla led av
attributreferenser med syntaxen &(&(attribut-referens)).
</topic>
......
......@@ -77,7 +77,9 @@ noplc <Object is not a plc object> /error
nofreevid <No free volume identity> /error
videxist <Volume identity already exist> /error
volnameexist <Volume name already exist> /error
createdbs <Create loadfile error> /error
edit <In edit mode> /error
notauthorized <User not authorized for requested operation> /error
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 SSAB EMEA AB.
!
! This file is part of Proview.
!
! 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 Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_RootVolumeConfig.wb_load -- Defines the class RootVolumeConfig.
!
SObject pwrb:Class
!/**
! @Group ProjectConfiguration
!*/
Object CloneVolumeConfig $ClassDef 604
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr Flags |= pwr_mClassDef_TopObject
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "CloneVolumeConfig"
EndBody
!/**
! Optional description.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Parent volume.
!*/
Object ParentVolume $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
EndObject
EndObject
EndSObject
......@@ -542,6 +542,7 @@ topobjects ProjectNavigatorW1
{
class RootVolumeConfig
class ClassVolumeConfig
class CloneVolumeConfig
class DetachedClassVolumeConfig
class SubVolumeConfig
class SharedVolumeConfig
......@@ -565,6 +566,7 @@ palette ProjectNavigatorPalette
{
class ClassVolumeConfig
class ClassVolumeLoad
class CloneVolumeConfig
class CommonClassDistribute
class DetachedClassVolumeConfig
class DetachedClassVolumeLoad
......
......@@ -157,6 +157,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( tools_buildnode_w, FALSE);
gtk_widget_set_sensitive( menu_classeditor_w, FALSE);
gtk_widget_set_sensitive( menu_updateclasses_w, TRUE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
else {
gtk_widget_set_sensitive( menu_save_w, FALSE);
......@@ -187,6 +188,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( tools_buildnode_w, TRUE);
gtk_widget_set_sensitive( menu_classeditor_w, TRUE);
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
break;
case wb_eType_Volume:
......@@ -222,6 +224,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
else
gtk_widget_set_sensitive( menu_updateclasses_w, TRUE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
else {
gtk_widget_set_sensitive( menu_save_w, FALSE);
......@@ -255,6 +258,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( tools_buildnode_w, TRUE);
gtk_widget_set_sensitive( menu_classeditor_w, FALSE);
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
gtk_widget_set_sensitive( menu_clonevolume_w, TRUE);
}
break;
case wb_eType_Class:
......@@ -287,6 +291,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( tools_buildnode_w, FALSE);
gtk_widget_set_sensitive( menu_classeditor_w, FALSE);
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
else {
gtk_widget_set_sensitive( menu_save_w, FALSE);
......@@ -317,6 +322,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( tools_buildnode_w, FALSE);
gtk_widget_set_sensitive( menu_classeditor_w, FALSE);
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
break;
case wb_eType_ClassEditor:
......@@ -356,6 +362,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( menu_updateclasses_w, TRUE);
else
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
else {
gtk_widget_set_sensitive( menu_save_w, FALSE);
......@@ -386,6 +393,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( tools_buildnode_w, TRUE);
gtk_widget_set_sensitive( menu_classeditor_w, FALSE);
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
break;
case wb_eType_Buffer:
......@@ -418,6 +426,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( tools_buildnode_w, FALSE);
gtk_widget_set_sensitive( menu_classeditor_w, FALSE);
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
else {
gtk_widget_set_sensitive( menu_save_w, FALSE);
......@@ -448,6 +457,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( tools_buildnode_w, FALSE);
gtk_widget_set_sensitive( menu_classeditor_w, FALSE);
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
break;
case wb_eType_ExternVolume:
......@@ -480,6 +490,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( tools_buildnode_w, FALSE);
gtk_widget_set_sensitive( menu_classeditor_w, FALSE);
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
else {
gtk_widget_set_sensitive( menu_save_w, FALSE);
......@@ -510,6 +521,7 @@ void WttGtk::menu_setup()
gtk_widget_set_sensitive( tools_buildnode_w, FALSE);
gtk_widget_set_sensitive( menu_classeditor_w, FALSE);
gtk_widget_set_sensitive( menu_updateclasses_w, FALSE);
gtk_widget_set_sensitive( menu_clonevolume_w, FALSE);
}
break;
default:
......@@ -1062,7 +1074,7 @@ void WttGtk::activate_history( GtkWidget *w, gpointer data)
{
Wtt *wtt = (Wtt *)data;
pwr_tStatus sts;
char categories[3][20];
char categories[4][20];
pwr_tObjName vname;
pwr_tOid oid;
int size;
......@@ -1070,7 +1082,8 @@ void WttGtk::activate_history( GtkWidget *w, gpointer data)
wb_log::category_to_string( wlog_eCategory_ConfiguratorSave, categories[0]);
wb_log::category_to_string( wlog_eCategory_VolumeBuild, categories[1]);
strcpy( categories[2], "");
wb_log::category_to_string( wlog_eCategory_VolumeClone, categories[2]);
strcpy( categories[3], "");
oid.oix = 0;
oid.vid = wtt->volid;
......@@ -1321,6 +1334,12 @@ void WttGtk::activate_updateclasses( GtkWidget *w, gpointer data)
wtt->activate_updateclasses();
}
void WttGtk::activate_clonevolume( GtkWidget *w, gpointer data)
{
Wtt *wtt = (Wtt *)data;
wtt->activate_clonevolume();
}
void WttGtk::activate_zoom_in( GtkWidget *w, gpointer data)
{
Wtt *wtt = (Wtt *)data;
......@@ -2470,6 +2489,10 @@ WttGtk::WttGtk(
g_signal_connect( menu_updateclasses_w, "activate",
G_CALLBACK(WttGtk::activate_updateclasses), this);
menu_clonevolume_w = gtk_menu_item_new_with_mnemonic( "C_lone Volume");
g_signal_connect( menu_clonevolume_w, "activate",
G_CALLBACK(WttGtk::activate_clonevolume), this);
GtkWidget *functions_showcrossref = gtk_menu_item_new_with_mnemonic( "Show C_rossreferences");
g_signal_connect( functions_showcrossref, "activate",
G_CALLBACK(WttGtk::activate_showcrossref), this);
......@@ -2506,6 +2529,7 @@ WttGtk::WttGtk(
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_openge);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), menu_classeditor_w);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), menu_updateclasses_w);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), menu_clonevolume_w);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_showcrossref);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_syntax);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), menu_change_value_w);
......
......@@ -117,6 +117,7 @@ class WttGtk : public Wtt {
GtkWidget *menu_edit_w;
GtkWidget *menu_classeditor_w;
GtkWidget *menu_updateclasses_w;
GtkWidget *menu_clonevolume_w;
GtkWidget *menu_creaobjafter_w;
GtkWidget *menu_creaobjfirst_w;
GtkWidget *menu_deleteobj_w;
......@@ -238,6 +239,7 @@ class WttGtk : public Wtt {
static void activate_distribute( GtkWidget *w, gpointer data);
static void activate_showcrossref( GtkWidget *w, gpointer data);
static void activate_updateclasses( GtkWidget *w, gpointer data);
static void activate_clonevolume( GtkWidget *w, gpointer data);
static void activate_zoom_in( GtkWidget *w, gpointer data);
static void activate_zoom_out( GtkWidget *w, gpointer data);
static void activate_zoom_reset( GtkWidget *w, gpointer data);
......
......@@ -2512,8 +2512,9 @@ int gcg_wind_comp_all(
free((char *) loaded_windlist);
free((char *) loaded_list);
if ( !wind_compiled)
if ( !wind_compiled && ODD(sumsts))
return GSX__NOMODIF;
return sumsts;
}
......
......@@ -840,6 +840,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
cid == pwr_cClass_ClassVolumeConfig ||
cid == pwr_cClass_DetachedClassVolumeConfig ||
cid == pwr_cClass_SharedVolumeConfig ||
cid == pwr_cClass_CloneVolumeConfig ||
cid == pwr_cClass_ExternVolumeConfig ) {
if ( ! (cid == pwr_cClass_ClassVolumeConfig || cid == pwr_cClass_DetachedClassVolumeConfig) &&
k == 0)
......@@ -899,6 +900,12 @@ pwr_tStatus lfu_SaveDirectoryVolume(
volumelist_ptr->volume_id > cdh_cUserVolMax)
out_of_range = true;
break;
case pwr_cClass_CloneVolumeConfig :
strcpy( classname, "RootVolume");
if ( volumelist_ptr->volume_id < cdh_cUserVolMin ||
volumelist_ptr->volume_id > cdh_cUserVolMax)
out_of_range = true;
break;
}
if ( out_of_range) {
......@@ -963,6 +970,36 @@ pwr_tStatus lfu_SaveDirectoryVolume(
free( rtprovider);
break;
}
case pwr_cClass_CloneVolumeConfig : {
char *parentvolume;
sts = ldh_GetObjectPar( ldhses, envobjid, "RtBody",
"ParentVolume", (char **)&parentvolume, &size);
if ( EVEN(sts)) return sts;
// Check parent volume
int parent_found = 0;
for ( int j = 0; j < volumecount; j++) {
if ( cdh_NoCaseStrcmp( parentvolume, volumelist[j].volume_name) == 0) {
parent_found = 1;
break;
}
}
if ( !parent_found) {
char msg[200];
sprintf( msg, "Error in VolumeConfig object '%s', parent volume is not configured in the global\
volume list", name);
MsgWindow::message( 'E', msg, msgw_ePop_Default);
syntax_error = 1;
}
fprintf( file, "%s %s %s clone %s\n",
volume_name,
cdh_VolumeIdToString( NULL, volumelist_ptr->volume_id, 0, 0),
classname, parentvolume);
free( parentvolume);
break;
}
}
break;
}
......
......@@ -125,6 +125,9 @@ void wb_log::category_to_string( wlog_eCategory category, char *str)
case wlog_eCategory_WbLoad:
strcpy( str, "WbLoad");
break;
case wlog_eCategory_VolumeClone:
strcpy( str, "VolumeClone");
break;
default:
strcpy( str, "");
}
......@@ -158,6 +161,8 @@ void wb_log::string_to_category( char *str, wlog_eCategory *category)
*category = wlog_eCategory_UpdateClasses;
else if ( strcmp( str, "WbLoad") == 0)
*category = wlog_eCategory_WbLoad;
else if ( strcmp( str, "VolumeClone") == 0)
*category = wlog_eCategory_VolumeClone;
else
*category = wlog_eCategory_;
}
......
......@@ -57,6 +57,7 @@ typedef enum {
wlog_eCategory_GeExport,
wlog_eCategory_UpdateClasses,
wlog_eCategory_WbLoad,
wlog_eCategory_VolumeClone,
wlog_eCategory__,
} wlog_eCategory;
......
......@@ -369,10 +369,41 @@ bool wb_session::writeAttribute(wb_attribute &a, void *p)
return sts;
}
bool wb_session::copyOset( pwr_sAttrRef *arp, bool keepref, bool keepsym, bool ignore_errors)
bool wb_session::clone( const char *vname, pwr_tVid vid, wb_vrepmem **vmem)
{
wb_vrepmem *mem;
m_sts = LDH__SUCCESS;
int cnt = 0;
for ( wb_object o = object(); ODD(o.sts()); o = o.after())
cnt++;
pwr_tAttrRef *arp = (pwr_tAttrRef *)calloc( cnt+1, sizeof(*arp));
cnt = 0;
for ( wb_object o = object(); ODD(o.sts()); o = o.after()) {
arp[cnt++] = cdh_ObjidToAref( o.oid());
}
copyOset( arp, true, true, false, vid, vname, &mem);
pwr_tOid voloid;
voloid.oix = 0;
voloid.vid = m_vrep->vid();
wb_object vo = object( voloid);
mem->createClonedVolumeObject( vo, vname);
*vmem = mem;
return true;
}
bool wb_session::copyOset( pwr_sAttrRef *arp, bool keepref, bool keepsym, bool ignore_errors, pwr_tVid vvid,
const char *vname, wb_vrepmem **vmem)
{
char name[32];
pwr_tStatus sts;
pwr_tVid vid;
m_sts = LDH__SUCCESS;
// Avoid copying objects in plcprograms
......@@ -395,11 +426,19 @@ bool wb_session::copyOset( pwr_sAttrRef *arp, bool keepref, bool keepsym, bool i
ap++;
}
pwr_tVid vid = m_vrep->erep()->nextVolatileVid( &m_sts, name);
if ( EVEN(m_sts)) return false;
if ( vvid)
vid = vvid;
else {
vid = m_vrep->erep()->nextVolatileVid( &m_sts, name);
if ( EVEN(m_sts)) return false;
}
wb_vrepmem *mem = new wb_vrepmem( m_vrep->erep(), vid);
mem->name( name);
if ( vvid)
mem->name( vname);
else
mem->name( name);
m_vrep->erep()->addBuffer( &sts, mem);
if ( ignore_errors)
mem->importIgnoreErrors();
......@@ -439,6 +478,10 @@ bool wb_session::copyOset( pwr_sAttrRef *arp, bool keepref, bool keepsym, bool i
}
ap++;
}
if ( vmem)
*vmem = mem;
return mem->importTree( keepref, keepsym);
}
......
......@@ -57,6 +57,7 @@ class wb_cdef;
class wb_destination;
class wb_volume;
class wb_recix;
class wb_vrepmem;
class wb_session : public wb_volume
......@@ -101,11 +102,13 @@ public:
bool writeAttribute(wb_attribute &a, void *p);
bool writeBody() {return false;} // Fix
bool copyOset( pwr_sAttrRef *arp, bool keepref, bool keepsym, bool ignore_errors);
bool copyOset( pwr_sAttrRef *arp, bool keepref, bool keepsym, bool ignore_errors, pwr_tVid vid = 0,
const char *vname = 0, wb_vrepmem **vmem = 0);
bool cutOset( pwr_sAttrRef *arp, bool keepref);
bool pasteOset( pwr_tOid doid, ldh_eDest dest,
bool keepoid, bool recycleix, char *buffer);
bool clone( const char *vname, pwr_tVid vid, wb_vrepmem **vmem);
void getAllMenuItems( ldh_sMenuCall *ip, ldh_sMenuItem **Item, wb_cdrep *cdrep,
wb_orep *o, void *o_body, pwr_tUInt32 Level,
......
......@@ -1097,12 +1097,12 @@ int wb_utl::redraw_plc(
ldhses, plc, ldh_eName_Objid,
plc_objid_str, sizeof( plc_objid_str), &size);
/* Redraw the plc */
printf( "Plcpgm %s %s\n",
plcstring, plc_objid_str);
/* Redraw the plc */
sts = redraw_windows( plc, ldhses, ldhwb);
printf( "-- Plc redrawn %s\n", plcstring);
/* Return to session access ReadWrite */
sts2 = ldh_SetSession( ldhses, ldh_eAccess_ReadWrite);
if ( EVEN(sts2)) return sts2;
......@@ -1479,8 +1479,7 @@ int wb_utl::exec_plcpgms( ldh_tSesContext ldhses,
plc_objid_str, sizeof( plc_objid_str), &size);
if ( EVEN (sts)) goto error_return;
printf( "Plcpgm %s %s\n",
plcname, plc_objid_str);
printf( "-- Executing Plcpgm %s\n", plcname);
sts = exec_plcpgm_windows( list_ptr->objid,
ldhses, ldhwb, no_focode, cb);
......@@ -1665,6 +1664,7 @@ int wb_utl::redraw_plc_hier( ldh_tSesContext ldhses,
int all,
int templ)
{
printf( "-- Redraw plc\n");
return exec_plcpgms( ldhses, ldhwb, hiername,fromname, all, templ, 1,
plc_redraw_cb);
}
......
......@@ -62,6 +62,84 @@
#include "co_dcli.h"
#include "wb_dblock.h"
bool mem_object::exportHead(wb_import &i)
{
mem_object *lch = get_lch();
pwr_tOid fthoid;
if ( !fth) {
fthoid.oix = 0;
if ( m_oid.oix != 0)
// Root object
fthoid.vid = m_oid.vid;
else
// Volume object
fthoid.vid = 0;
}
else
fthoid = fth->m_oid;
pwr_tOid fwsoid = fws ? fws->m_oid : pwr_cNOid;
pwr_tOid bwsoid = bws ? bws->m_oid : pwr_cNOid;
pwr_tOid fchoid = fch ? fch->m_oid : pwr_cNOid;
pwr_tOid lchoid = lch ? lch->m_oid : pwr_cNOid;
wb_name n = wb_name(name());
i.importHead( m_oid, m_cid, fthoid, bwsoid, fwsoid, fchoid, lchoid, name(),
n.normName(cdh_mName_object), m_flags,
m_ohtime, m_rbtime, m_dbtime, rbody_size, dbody_size);
if ( fch)
fch->exportHead( i);
if ( fws)
fws->exportHead( i);
return true;
}
bool mem_object::exportDbody( wb_import &i)
{
i.importDbody( m_oid, dbody_size, dbody);
if ( fch)
fch->exportDbody( i);
if ( fws)
fws->exportDbody( i);
return true;
}
bool mem_object::exportRbody( wb_import &i)
{
i.importRbody( m_oid, rbody_size, rbody);
if ( fch)
fch->exportRbody( i);
if ( fws)
fws->exportRbody( i);
return true;
}
bool mem_object::exportDocBlock( wb_import &i)
{
char *block;
int size;
if ( docblock && docBlock( &block, &size)) {
i.importDocBlock( m_oid, size, block);
free( block);
}
if ( fch)
fch->exportDocBlock( i);
if ( fws)
fws->exportDocBlock( i);
return true;
}
wb_vrepmem::wb_vrepmem( wb_erep *erep, pwr_tVid vid) :
wb_vrep(vid), m_erep(erep), m_merep(erep->merep()), m_nRef(0), root_object(0), volume_object(0),
......@@ -251,6 +329,11 @@ wb_vrepmem::exportVolume(wb_import &i)
bool wb_vrepmem::exportHead(wb_import &i)
{
if ( m_cloned)
return volume_object->exportHead(i);
else if ( volume_object)
volume_object->exportHead(i);
if ( root_object)
return root_object->exportHead(i);
else
......@@ -259,6 +342,11 @@ bool wb_vrepmem::exportHead(wb_import &i)
bool wb_vrepmem::exportDbody(wb_import &i)
{
if ( m_cloned)
return volume_object->exportDbody(i);
else if ( volume_object)
volume_object->exportDbody(i);
if ( root_object)
return root_object->exportDbody(i);
else
......@@ -268,6 +356,11 @@ bool wb_vrepmem::exportDbody(wb_import &i)
bool wb_vrepmem::exportRbody(wb_import &i)
{
if ( m_cloned)
return volume_object->exportRbody(i);
else if ( volume_object)
volume_object->exportRbody(i);
if ( root_object)
return root_object->exportRbody(i);
else
......@@ -709,12 +802,13 @@ void wb_vrepmem::clear()
void wb_vrepmem::freeObject( mem_object *memo)
{
// Free all children and siblings
if ( memo->fch)
freeObject( memo->fch);
if ( memo->fws)
freeObject( memo->fws);
if ( memo != volume_object) {
// Free all children and siblings
if ( memo->fch)
freeObject( memo->fch);
if ( memo->fws)
freeObject( memo->fws);
}
unregisterObject( memo->m_oid.oix);
delete memo;
}
......@@ -885,6 +979,42 @@ bool wb_vrepmem::createVolumeObject( char *name)
return true;
}
bool wb_vrepmem::createClonedVolumeObject( wb_object vo, const char *vname)
{
pwr_tStatus sts = LDH__SUCCESS;
mem_object *memo = new mem_object();
if ( vname)
strcpy( memo->m_name, vname);
else
strcpy( memo->m_name, vo.name());
memo->m_oid.vid = m_vid;
memo->m_oid.oix = 0;
memo->m_cid = vo.cid();
memo->m_flags = vo.flags();
memo->m_ohtime = vo.ohTime();
memo->rbody_size = vo.rbSize();
if ( memo->rbody_size) {
wb_attribute a( sts, (wb_orep *)vo, "SysBody");
if ( !a) return false;
memo->rbody = malloc( memo->rbody_size);
a.value( memo->rbody);
if ( !a) return false;
}
memo->dbody_size = 0;
if ( root_object) {
memo->fch = root_object;
memo->fchoid = root_object->m_oid;
}
volume_object = memo;
m_cloned = 1;
strcpy( volume_name, vname);
registerObject( memo->m_oid.oix, memo);
return true;
}
wb_orep *wb_vrepmem::copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d,
wb_name &name, pwr_tOix ix)
......@@ -1952,6 +2082,11 @@ bool wb_vrepmem::commit(pwr_tStatus *sts)
{
pwr_tCmd cmd;
if ( m_cloned) {
*sts = LDH__SUCCESS;
return true;
}
if ( m_classeditor) {
classeditorCheckCommit();
classeditorCommit();
......
......@@ -96,10 +96,10 @@ class mem_object
return c;
}
bool exportHead(wb_import &i) { return false;}
bool exportDbody(wb_import &i) { return false;}
bool exportRbody(wb_import &i) { return false;}
bool exportDocBlock(wb_import &i) { return false;}
bool exportHead(wb_import &i);
bool exportDbody(wb_import &i);
bool exportRbody(wb_import &i);
bool exportDocBlock(wb_import &i);
bool exportTree( wb_treeimport &i, bool isRoot) {
pwr_tOid fthoid = (fth && !isRoot) ? fth->m_oid : pwr_cNOid;
pwr_tOid bwsoid = (bws && !isRoot) ? bws->m_oid : pwr_cNOid;
......@@ -241,6 +241,7 @@ class wb_vrepmem : public wb_vrep, public wb_import
unsigned int m_nRef;
mem_object *root_object;
mem_object *volume_object;
int m_cloned;
int m_nextOix;
pwr_tVid m_source_vid;
char m_filename[200];
......@@ -254,7 +255,7 @@ class wb_vrepmem : public wb_vrep, public wb_import
public:
wb_vrepmem( wb_erep *erep) :
m_erep(erep), m_merep(erep->merep()), m_nRef(0), root_object(0),
volume_object(0), m_nextOix(0), m_source_vid(0), m_classeditor(false),
volume_object(0), m_cloned(0), m_nextOix(0), m_source_vid(0), m_classeditor(false),
m_ignore(false)
{ strcpy( m_filename, "");}
......@@ -288,6 +289,7 @@ public:
void registerVolume( const char *name, pwr_tCid cid, pwr_tVid vid, mem_object *node);
void info();
bool createVolumeObject( char *name);
bool createClonedVolumeObject( wb_object vo, const char *vname);
virtual pwr_tOid oid(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNOid;}
......
......@@ -408,6 +408,7 @@ class WNav : public WUtility{
int unselect_objid( pwr_tObjid objid);
void enable_events( WNavBrow *brow);
int clone_volume( char *vname, pwr_tVid vid);
int show_database();
int show_volume( int pop);
int get_rootlist();
......
This diff is collapsed.
......@@ -2101,6 +2101,27 @@ void Wtt::activate_updateclasses()
reset_cursor();
}
void Wtt::activate_clonevolume()
{
char cmd[80] = "clone volume";
if ( !focused_wnav)
set_focus_default();
set_clock_cursor();
#if 0
unsigned int opt;
if ( focused_wnav->gbl.enable_comment)
opt = log_mOption_Comment;
else
opt = 0;
wb_log::log( (wb_session *)ldhses, wlog_eCategory_VolumeClone, volid, opt);
#endif
focused_wnav->command( cmd);
reset_cursor();
}
void Wtt::activate_zoom_in()
{
double zoom_factor;
......
......@@ -255,6 +255,7 @@ class Wtt : public WUtility {
void activate_distribute();
void activate_showcrossref();
void activate_updateclasses();
void activate_clonevolume();
void activate_zoom_in();
void activate_zoom_out();
void activate_zoom_reset();
......
#define xnav_bitmap_clone12_width 12
#define xnav_bitmap_clone12_height 12
static unsigned char xnav_bitmap_clone12_bits[] = {
0x1c, 0x00, 0x22, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0xc2, 0x03,
0x3c, 0x04, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x40, 0x04, 0x80, 0x03};
......@@ -54,6 +54,7 @@
#include "xnav_bitmap_package12.h"
#include "xnav_bitmap_copy12.h"
#include "xnav_bitmap_export12.h"
#include "xnav_bitmap_clone12.h"
#include "cow_logwnav.h"
#include "cow_log.h"
......@@ -68,6 +69,7 @@ void CoLogWNavBrow::free_pixmaps()
brow_FreeAnnotPixmap( ctx, pixmap_package);
brow_FreeAnnotPixmap( ctx, pixmap_copy);
brow_FreeAnnotPixmap( ctx, pixmap_export);
brow_FreeAnnotPixmap( ctx, pixmap_clone);
}
//
......@@ -117,6 +119,14 @@ void CoLogWNavBrow::allocate_pixmaps()
}
brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_export);
for ( i = 0; i < 9; i++) {
pixmap_data[i].width =xnav_bitmap_clone12_width;
pixmap_data[i].height =xnav_bitmap_clone12_height;
pixmap_data[i].bits = (char *)xnav_bitmap_clone12_bits;
}
brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_clone);
}
//
......@@ -439,6 +449,8 @@ ItemLog::ItemLog( CoLogWNav *item_logwnav, const char *item_name,
brow_SetAnnotPixmap( node, 0, logwnav->brow->pixmap_package);
else if ( (s = strstr( category, "Export")))
brow_SetAnnotPixmap( node, 0, logwnav->brow->pixmap_export);
else if ( (s = strstr( category, "Clone")))
brow_SetAnnotPixmap( node, 0, logwnav->brow->pixmap_clone);
}
......
......@@ -72,6 +72,7 @@ class CoLogWNavBrow {
flow_sAnnotPixmap *pixmap_package;
flow_sAnnotPixmap *pixmap_copy;
flow_sAnnotPixmap *pixmap_export;
flow_sAnnotPixmap *pixmap_clone;
void free_pixmaps();
void allocate_pixmaps();
......
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