Commit 73a393eb authored by Claes Sjofors's avatar Claes Sjofors

Wb revision handler added

parent 027a8fa5
......@@ -8468,6 +8468,15 @@ The path is the root directory of this tree.
</topic>
</chapter>
<chapter>
<topic> revisions
Revisions
<h1>Revisions window
Revisions are handled from the Revisions window. It's opened from the menu in the configurator,
File/Revisions.
</topic>
</chapter>
<chapter>
<topic> dg_tools
Verktyg
......
......@@ -1551,6 +1551,9 @@ pwrc_save_file_func()
old_file=$new_file.$version
old_file_ren=$new_file.$((version+1))
if [ -e $old_file ]; then
if [ $version -eq 9 ] && [ -e $old_file_ren ] && [ -d $old_file_ren ]; then
rm -rf $old_file_ren
fi
mv $old_file $old_file_ren
fi
let version=$version-1
......
......@@ -45,6 +45,7 @@
211 CSUP
220 LDH
221 WSX
222 REV
240 GOEN
250 GRE
260 VLDH
......
......@@ -33,3 +33,18 @@
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! wb_rev_msg.msg -- Revision handling
!
.facility REV,222 /prefix = REV__ ! Revision handling
success <successful completion> /succ
vollock <Volume is locked> /error
revfile <Revision file for volume is missing> /error
create <Create revision error> /error
voltype <Can't create revision for this type of volume> /error
giterror <Error from git> /error
noselect <No revision is selected> /error
createpos <Unable to create a new revision from current> /error
nosuchrev <No such revision> /error
nobranch <No branch is checked out> /info
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2017 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_td_versionmanagerenum.wb_load -- Defines the enum type VersionManager
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Enumeration for version manager.
!*/
Object VersionManagerEnum $TypeDef 87
Body SysBody
Attr TypeRef = "pwrs:Type-$Enum"
Attr PgmName = "VersionManagerEnum"
EndBody
!/**
! None.
!*/
Object None $Value
Body SysBody
Attr PgmName = "None"
Attr Text = "None"
Attr Value = 0
EndBody
EndObject
!/**
! Git.
!*/
Object Git $Value
Body SysBody
Attr PgmName = "Git"
Attr Text = "Git"
Attr Value = 1
EndBody
EndObject
EndObject
EndSObject
......@@ -49,6 +49,7 @@
#include "ge.h"
#include "rt_load.h"
#include "wb_foe_msg.h"
#include "co_dcli.h"
#include "co_dcli_input.h"
#include "flow.h"
#include "flow_ctx.h"
......@@ -124,6 +125,16 @@ int main(int argc, char *argv[])
else
cout << "Syntax error, volume is missing" << endl;
break;
case 'c':
// Load specified class volume
if ( argc >= i) {
strcpy( Cmd::cmd_classvolume, argv[i+1]);
i++;
continue;
}
else
cout << "Syntax error, volume is missing" << endl;
break;
case 'q':
// Quiet
quiet = 1;
......@@ -159,11 +170,25 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n\
GNU General Public License for more details.\n\n";
if ( str[0] != 0) {
int nr;
char cmd_array[10][200];
dcli_remove_blank( str, str);
sts = cmd->wnav->command(str);
if ( ODD(sts))
return 0;
exit(sts);
nr = dcli_parse( str, ";", "", (char *)cmd_array,
sizeof(cmd_array)/sizeof(cmd_array[0]),
sizeof(cmd_array[0]), 1);
for ( int i = 0; i < nr; i++) {
dcli_remove_blank( cmd_array[i], cmd_array[i]);
printf( "-- Executing \"%s\"\n", cmd_array[i]);
sts = cmd->wnav->command(cmd_array[i]);
if ( ODD(sts)) {
sts = cmd->wnav->get_command_sts();
if ( EVEN(sts)) exit(sts);
}
else
exit(sts);
}
exit(0);
}
sts = dcli_input_init( &cmd->chn, &cmd->recall_buf);
if ( EVEN(sts)) exit(sts);
......
......@@ -65,10 +65,14 @@
#include "wb_wnav_msg.h"
#include "wb_cmdc.h"
#include "wb.h"
#include "wb_erep.h"
#include "wb_vrepmem.h"
#include "wb_env.h"
#include "cow_msgwindow.h"
char Cmd::cmd_volume[80];
char *Cmd::cmd_volume_p = 0;
char Cmd::cmd_classvolume[80] = "";
unsigned int Cmd::cmd_options = 0;
void Cmd::usage()
......@@ -154,11 +158,31 @@ int Cmd::attach_volume_cb( void *ctx,
}
}
cmd->volid = volid;
if ( strcmp( Cmd::cmd_classvolume, "") != 0) {
// Load volume as extern
pwr_tFileName filename;
wb_erep *erep = (wb_erep *)(*(wb_env *)cmd->wbctx);
// Open ldh session
sts = ldh_AttachVolume( cmd->wbctx, cmd->volid, &cmd->volctx);
if ( EVEN(sts)) return sts;
sprintf( filename, "$pwrp_db/%s.wb_load", Cmd::cmd_classvolume);
dcli_translate_filename( filename, filename);
wb_vrepmem *vrep = new wb_vrepmem(erep, 0);
vrep->loadWbl( filename, &sts);
if ( EVEN(sts)) {
delete vrep;
return sts;
}
erep->addExtern( &sts, vrep);
cmd->volid = vrep->vid();
cmd->volctx = (ldh_tVolume *) new wb_volume(vrep);
}
else {
cmd->volid = volid;
// Open ldh session
sts = ldh_AttachVolume( cmd->wbctx, cmd->volid, &cmd->volctx);
if ( EVEN(sts)) return sts;
}
sts = ldh_OpenSession( &cmd->ldhses,
cmd->volctx,
......
......@@ -72,6 +72,7 @@ class Cmd {
dcli_sRecall *recall_buf;
static char cmd_volume[80];
static char *cmd_volume_p;
static char cmd_classvolume[80];
static unsigned int cmd_options;
int detach_volume();
......
#!/bin/bash
declare -i pwrc__success=0
declare -i pwrc__dblocked=1
declare -i pwrc__loaddb=2
declare -i pwrc_status=$pwrc__success
snp_save_file()
{
new_file=$1
if [ -e $new_file ]; then
let version=9
while [ $version -ge 1 ]
do
old_file=$new_file.$version
old_file_ren=$new_file.$((version+1))
if [ -e $old_file ]; then
mv $old_file $old_file_ren
fi
let version=$version-1
done
old_file=$new_file.1
echo "-- Saving file $new_file -> $old_file"
mv $new_file $old_file
fi
}
#
# Get the databases in a project
#
# Arguments 1: project root
# Returns pwrc_status : 0 Success
#
#
pwrc_dblist_read()
{
local volume
local volid
local volclass
local volcnf
local volenum
local volserver
local dbfile
local db
local proot=$1
let i=0
let j=0
let k=0
pwrc_status=$pwrc__success
#set -o xtrace
echo "arg1: \"$1\" arg2: \"$2\" arg3: \"$3\""
if [ -n "${db_array[*]}" ]; then
unset db_array
fi
dbfile=$proot/src/db/pwrp_cnf_volumelist.dat
if [ ! -e $dbfile ]; then
echo "Can't find $dbfile"
return
fi
while read volume volid volclass volcnf volenum volserver; do
if [ -n "$volume" ] && [ "${volume:0:1}" != "!" ] && [ $volume != "$2" ]; then
if [ $volcnf == "cnf" ]; then
if [ $volclass == "ClassVolume" ]; then
if [ $volenum -eq 0 ]; then
wbl_array[$k]=`eval echo $volume | tr "[:upper:]" "[:lower:]"`
k=$k+1
elif [ $volenum -eq 1 ]; then
db_array[$i]=`eval echo $volume | tr "[:upper:]" "[:lower:]"`
i=$i+1
elif [ $volenum -eq 2 ]; then
dbms_array[$j]=`eval echo $volume | tr "[:upper:]" "[:lower:]"`
dbms_server_array[$j]=$volserver
j=$j+1
fi
else
if [ $volenum -eq 0 ]; then
db_array[$i]=`eval echo $volume | tr "[:upper:]" "[:lower:]"`
i=$i+1
elif [ $volenum -eq 1 ]; then
dbms_array[$j]=`eval echo $volume | tr "[:upper:]" "[:lower:]"`
dbms_server_array[$j]=$volserver
j=$j+1
fi
fi
fi
fi
done < $dbfile
}
action=$1
proot=$2
current_volume=$3
pwrc_dblist_read $proot $current_volume
# Check that no database is not locked
let i=0
while [ "${db_array[$i]}" != "" ]; do
echo $i Database ${db_array[$i]}
lockfile="$proot/src/db/${db_array[$((i++))]}.db.lock"
echo $lockfile
if [ -e $lockfile ]; then
echo "Database is locked..."
exit $pwrc__dblocked
fi
done
if [ $action == "create" ]; then
# Create revision files
let i=0
while [ "${db_array[$i]}" != "" ]; do
wb_cmd -v ${db_array[$i]} wb dump/nofo/out=\"$proot/src/db/${db_array[$((i++))]}.wb_rev\"
done
elif [ $action == "restore" ]; then
# Load revision files
# Rename old databases
let i=0
while [ "${db_array[$i]}" != "" ]; do
snp_save_file $pwrp_db/${db_array[$i]}.db
let $((i++))
done
while [ "${dbms_array[$i]}" != "" ]; do
dbname="pwrp_"$pwrp_projectname"__"${dbms_array[$i]}
mysqldump -h ${dbms_server_array[$i]} -upwrp $dbname > $pwrp_db/${dbms_array[$i]}.dbms/$dbname.mysqldump
mysqladmin -h ${dbms_server_array[$i]} -upwrp drop -f $dbname
snp_save_file $pwrp_db/${dbms_array[$i]}.dbms
i=$i+1
done
# Load revision files
let i=0
while [ "${db_array[$i]}" != "" ]; do
dump_file=$pwrp_db/${db_array[$i]}.wb_dmp
list_file=$pwrp_db/${db_array[$((i++))]}.lis
if wb_cmd -q wb load/nofocode/load=\"$dump_file\"/out=\"$list_file\"
then
echo "sts: ok $pwrc_status"
else
cat $list_file
pwrc_status=$pwrc__loaddb
echo "sts: no $pwrc_status"
fi
done
echo sts: $pwrc_status
exit $pwrc_status
fi
exit $pwrc__success
......@@ -74,6 +74,7 @@ extern "C" {
#include "wb_bckw_gtk.h"
#include "wb_expw_gtk.h"
#include "wb_watttext_gtk.h"
#include "wb_wrev_gtk.h"
#define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#define min(Dragon,Eagle) ((Dragon) < (Eagle) ? (Dragon) : (Eagle))
......@@ -294,6 +295,12 @@ wb_utl *WNavGtk::utl_new()
return utl;
}
WRev *WNavGtk::rev_new()
{
WRev *rev = new WRevGtk( parent_wid, this, ldhses);
return rev;
}
void WNavGtk::logw_new( char *item, wlog_eCategory *categories, int show_item)
{
char categories_str[10][20];
......
......@@ -93,6 +93,7 @@ class WNavGtk : public WNav {
void wge_modal_loop( WGe *wge);
bool has_window() {return parent_wid ? true : false;}
wb_utl *utl_new();
WRev *rev_new();
void logw_new( char *item, wlog_eCategory *categories, int show_item);
CoLogin *login_new( const char *name, const char *groupname,
void (* bc_success)( void *), void (* bc_cancel)( void *), pwr_tStatus *status);
......
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 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.
**/
#ifndef wb_wrev_gtk_h
#define wb_wrev_gtk_h
/* wb_wrev_gtk.h -- Package window */
#ifndef wb_wrev_h
# include "wb_wrev.h"
#endif
#ifndef cow_wow_gtk_h
# include "cow_wow_gtk.h"
#endif
class WRevGtk : public WRev {
public:
WRevGtk(
GtkWidget *wa_parent_wid,
void *wa_parent_ctx,
ldh_tSession wb_ldhses);
~WRevGtk();
GtkWidget *parent_wid;
GtkWidget *brow_widget;
GtkWidget *form_widget;
GtkWidget *toplevel;
GtkWidget *msg_label;
GtkWidget *wrevnav_form;
GtkWidget *india_widget;
GtkWidget *india_label1;
GtkWidget *india_label2;
GtkWidget *india_text1;
GtkWidget *india_text2;
GdkCursor *clock_cursor;
CoWowFocusTimerGtk focustimer;
void message( char severity, const char *message);
void pop();
void set_clock_cursor();
void reset_cursor();
void flush();
void create_input_dialog();
void open_input_dialog( const char *text1, const char *text2, const char *title,
const char *init_text1, const char *init_text2,
void (*ok_cb)( WRev *, char *, char *));
static void activate_store( GtkWidget *w, gpointer data);
static void activate_restore( GtkWidget *w, gpointer data);
static void activate_delete( GtkWidget *w, gpointer data);
static void activate_build( GtkWidget *w, gpointer data);
static void activate_history( 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);
static void activate_exit( GtkWidget *w, gpointer data);
static void activate_help( GtkWidget *w, gpointer data);
static void activate_india_ok( GtkWidget *w, gpointer data);
static void activate_india_cancel( GtkWidget *w, gpointer data);
static gboolean action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
};
#endif
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 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.
**/
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "rt_load.h"
#include "wb_pkg_msg.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "flow_browwidget_gtk.h"
#include "wb_wrev_gtk.h"
#include "wb_wrevnav_gtk.h"
#include "wb_wnav.h"
#include "wb_wnav_brow.h"
#include "wb_wnav_item.h"
#include "wb_error.h"
//
// Create the navigator widget
//
WRevNavGtk::WRevNavGtk(
void *wa_parent_ctx,
GtkWidget *wa_parent_wid,
ldh_tSession wa_ldhses,
const char *wa_name,
wb_eUtility wa_utility,
GtkWidget **w,
pwr_tStatus *status) :
WRevNav(wa_parent_ctx,wa_ldhses,wa_name,wa_utility,status), parent_wid(wa_parent_wid)
{
form_widget = scrolledbrowwidgetgtk_new(
init_brow_cb, this, &brow_widget);
gtk_widget_show_all( brow_widget);
*w = form_widget;
*status = 1;
}
//
// Delete a nav context
//
WRevNavGtk::~WRevNavGtk()
{
delete brow;
gtk_widget_destroy( form_widget);
}
void WRevNavGtk::set_inputfocus()
{
if ( !displayed)
return;
gtk_widget_grab_focus( brow_widget);
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 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.
**/
#ifndef wb_wrevnav_gtk_h
#define wb_wrevnav_gtk_h
#ifndef wb_wrevnav_h
# include "wb_wrevnav.h"
#endif
class WRevNavGtk : public WRevNav {
public:
WRevNavGtk(
void *wa_parent_ctx,
GtkWidget *wa_parent_wid,
ldh_tSession wb_ldhses,
const char *wa_name,
wb_eUtility wa_utility,
GtkWidget **w,
pwr_tStatus *status);
~WRevNavGtk();
GtkWidget *parent_wid;
GtkWidget *brow_widget;
GtkWidget *form_widget;
GtkWidget *toplevel;
void set_inputfocus();
};
#endif
......@@ -43,12 +43,14 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "pwr_privilege.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
#include "pwr_baseclasses.h"
#include "wb_ldh.h"
#include "cow_wow.h"
#include "cow_login.h"
#include "wb_utl_api.h"
#include "wb_lfu.h"
#include "pwr_names.h"
......@@ -80,6 +82,7 @@
#include "wb_pwrs.h"
#include "wb_build.h"
#include "wb_wcast_gtk.h"
#include "wb_revision.h"
#include "ge_gtk.h"
......@@ -1132,6 +1135,12 @@ void WttGtk::activate_history( GtkWidget *w, gpointer data)
logw->show( categories, vname);
}
void WttGtk::activate_revisions( GtkWidget *w, gpointer data)
{
Wtt *wtt = (Wtt *)data;
wtt->activate_revisions();
}
void WttGtk::activate_find( GtkWidget *w, gpointer data)
{
Wtt *wtt = (Wtt *)data;
......@@ -2082,7 +2091,17 @@ WttGtk::WttGtk(
char title_w1[40];
char title_w2[40];
pwr_tFileName fname;
wb_rev_info rev_info;
char version[80];
wb_revision::info( &rev_info);
if ( !rev_info.in_master)
strcpy( version, rev_info.name);
else
strcpy( version, "");
if ( wbctx && volid) {
// Get the volume class and decide what type of navigator */
sts = ldh_GetVolumeClass( wbctx, volid, &volclass);
......@@ -2121,7 +2140,7 @@ WttGtk::WttGtk(
switch( volclass) {
case pwr_eClass_DirectoryVolume:
wb_type = wb_eType_Directory;
sprintf( title, "PwR Directory, %s", name);
sprintf( title, "PwR Directory, %s %s", name, version);
strcpy( layout_w1, "ProjectNavigatorW1");
strcpy( layout_w2, "ProjectNavigatorW2");
strcpy( layout_palette, "ProjectNavigatorPalette");
......@@ -2135,11 +2154,11 @@ WttGtk::WttGtk(
if ( ldh_VolRepType( ldhses) == ldh_eVolRep_Mem ||
ldh_VolRepType( ldhses) == ldh_eVolRep_Ced) {
wb_type = wb_eType_ClassEditor;
sprintf( title, "PwR ClassEditor %s, %s", volname, name);
sprintf( title, "PwR ClassEditor %s, %s %s", volname, name, version);
}
else {
wb_type = wb_eType_Class;
sprintf( title, "PwR %s, %s", volname, name);
sprintf( title, "PwR %s, %s %s", volname, name, version);
}
strcpy( layout_w1, "ClassNavigatorW1");
strcpy( layout_w2, "ClassNavigatorW2");
......@@ -2204,7 +2223,7 @@ WttGtk::WttGtk(
strcpy( layout_palette, "NavigatorPalette");
strcpy( title_w1, "Plant Configuration");
strcpy( title_w2, "Node Configuration");
sprintf( title, "PwR %s, %s", volname, name);
sprintf( title, "PwR %s, %s %s", volname, name, version);
}
break;
}
......@@ -2215,7 +2234,7 @@ WttGtk::WttGtk(
strcpy( layout_palette, "NavigatorPalette");
strcpy( title_w1, "Plant Configuration");
strcpy( title_w2, "Node Configuration");
sprintf( title, "PwR %s, %s", volname, name);
sprintf( title, "PwR %s, %s %s", volname, name, version);
}
}
else {
......@@ -2306,6 +2325,9 @@ WttGtk::WttGtk(
GtkWidget *file_history = gtk_menu_item_new_with_mnemonic( "_History");
g_signal_connect(file_history, "activate", G_CALLBACK(WttGtk::activate_history), this);
GtkWidget *file_revisions = gtk_menu_item_new_with_mnemonic( "R_evisions");
g_signal_connect(file_revisions, "activate", G_CALLBACK(WttGtk::activate_revisions), this);
GtkMenu *file_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_open_volume);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_open);
......@@ -2314,6 +2336,7 @@ WttGtk::WttGtk(
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu_save_w);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu_revert_w);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_history);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_revisions);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
GtkWidget *file = gtk_menu_item_new_with_mnemonic("_File");
......@@ -3071,6 +3094,11 @@ WttGtk::WttGtk(
menu_setup();
update_title();
if ( !rev_info.in_end_of_branch) {
wnav->wow->DisplayError( "Revision", "Revision is not at end o branch.\nNo changes can be made.");
CoLogin::reduce_privilege( pwr_mPrv_DevConfig | pwr_mPrv_DevPlc | pwr_mPrv_DevClass);
}
*status = 1;
}
......
......@@ -207,6 +207,7 @@ class WttGtk : public Wtt {
static void activate_revert( GtkWidget *w, gpointer data);
static void activate_syntax( GtkWidget *w, gpointer data);
static void activate_history( GtkWidget *w, gpointer data);
static void activate_revisions( GtkWidget *w, gpointer data);
static void activate_find( GtkWidget *w, gpointer data);
static void activate_findregex( GtkWidget *w, gpointer data);
static void activate_findnext( GtkWidget *w, gpointer data);
......
......@@ -53,6 +53,7 @@
#include "wb_foe.h"
#include "wb_merep.h"
#include "wb_log.h"
#include "wb_dblock.h"
#include "glow.h"
#include "glow_growctx.h"
......@@ -121,6 +122,199 @@ void wb_build::classlist( pwr_tCid cid)
m_sts = sumsts;
}
void wb_build::all( int no_export, int no_classvolumes, int no_flowfiles)
{
pwr_tFileName fname;
int rebuild = 1;
char currentnode[80];
pwr_tFileName db_dir = "$pwrp_db";
int sts;
pwr_tTime t;
pwr_tCmd cmd;
vector<lfu_volume_info> vol;
vector<lfu_boot_info> bvect;
pwr_tStatus sumsts = PWRB__NOBUILT;
dcli_translate_filename( db_dir, db_dir);
sts = lfu_GetVolumeCnfAll( vol);
// Check that no volume is locked
for ( unsigned int i = 0; i < vol.size(); i++) {
switch ( vol[i].cid) {
case pwr_eClass_RootVolume:
case pwr_eClass_SubVolume:
case pwr_eClass_SharedVolume:
case pwr_eClass_ClassVolume:
case pwr_eClass_DetachedClassVolume:
if ( vol[i].volrep == ldh_eVolRep_Dbms)
sprintf( fname, "%s/%s.dbms.lock", db_dir, cdh_Low(vol[i].name));
else if ( vol[i].volrep == ldh_eVolRep_Wbl)
sprintf( fname, "%s/%s.wb_load.lock", db_dir, cdh_Low(vol[i].name));
else
sprintf( fname, "%s/%s.db.lock", db_dir, cdh_Low(vol[i].name));
if ( ODD( dcli_file_time( fname, &t))) {
char msg[200];
sprintf( msg, "Build: Volume is locked %s.", vol[i].name);
MsgWindow::message('E', msg, msgw_ePop_Yes);
return;
}
break;
default: ;
}
}
printf( "-- Build all\n");
wb_log::log( wlog_eCategory_BuildAll, 0, 0);
wb_log::push();
if ( !opt.manual)
rebuild = 0;
int force = opt.force;
opt.force = 1;
import_files( bld_ePass_BeforeNode);
if ( evenSts())
sumsts = m_sts;
else if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT && m_sts != PWRB__INLIBHIER)
sumsts = m_sts;
directories( 0, bld_ePass_BeforeNode);
if ( m_sts == PWRB__MAKEUPDATED) {
rebuild = 1;
m_sts = PWRB__SUCCESS;
}
else if ( evenSts())
sumsts = m_sts;
else if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT && m_sts != PWRB__INLIBHIER)
sumsts = m_sts;
if ( !no_export) {
export_files( bld_ePass_BeforeNode);
if ( evenSts())
sumsts = m_sts;
else if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT && m_sts != PWRB__INLIBHIER)
sumsts = m_sts;
}
opt.force = force;
// Build class volumes
if ( !no_classvolumes) {
for ( unsigned int i = 0; i < vol.size(); i++) {
switch ( vol[i].cid) {
case pwr_eClass_ClassVolume:
case pwr_eClass_DetachedClassVolume:
sprintf( cmd, "create snapshot/file=\"$pwrp_db/%s.wb_load\"/out=\"$pwrp_load/%s.dbs\"",
cdh_Low(vol[i].name), cdh_Low(vol[i].name));
m_wnav->command( cmd);
if ( !no_flowfiles) {
sprintf( cmd, "wb_cmd -c %s create flow/templ/all", cdh_Low(vol[i].name));
sts = system( cmd);
if ( sts != 0) {
printf( "** Create flow for classvolume %s error\n", vol[i].name);
}
}
break;
default: ;
}
}
}
if ( !no_flowfiles) {
for ( unsigned int i = 0; i < vol.size(); i++) {
switch ( vol[i].cid) {
case pwr_eClass_ClassVolume:
case pwr_eClass_DetachedClassVolume: {
bool lock = false;
if ( wb_dblock::is_locked( (char *)"$pwrp_db/directory.wb_load")) {
wb_dblock::dbunlock( (char *)"$pwrp_db/directory.wb_load");
lock = true;
}
sprintf( cmd, "wb_cmd -c %s create flow/templ/all", cdh_Low(vol[i].name));
sts = system( cmd);
if ( lock)
wb_dblock::dblock( (char *)"$pwrp_db/directory.wb_load");
if ( sts != 0) {
printf( "** Create flow for classvolume %s error\n", vol[i].name);
}
break;
}
default: ;
}
}
}
// Build root, sub and shared volumes
for ( unsigned int i = 0; i < vol.size(); i++) {
switch ( vol[i].cid) {
case pwr_eClass_RootVolume:
case pwr_eClass_SubVolume:
case pwr_eClass_SharedVolume:
if ( !no_classvolumes)
sprintf( cmd, "wb_cmd -v %s update classes\\;build volume/name=%s/force", cdh_Low(vol[i].name), vol[i].name);
else
sprintf( cmd, "wb_cmd -v %s build volume/name=%s/force", cdh_Low(vol[i].name), vol[i].name);
sts = system( cmd);
if ( sts != 0) {
char msg[200];
sprintf( msg, "Build: Volume build error %s, build all terminated", vol[i].name);
MsgWindow::message('E', msg, msgw_ePop_Yes);
m_sts = 0;
wb_log::pull();
return;
}
if ( !no_flowfiles) {
sprintf( cmd, "wb_cmd -v %s create flow/all\\; create cross", cdh_Low(vol[i].name));
system( cmd);
}
break;
default: ;
}
}
// Build all nodes
m_sts = lfu_create_bootfiles( 0, 0, 1);
if ( EVEN(m_sts)) {
char msg[200];
sprintf( msg, "Build node error. Build all terminated");
MsgWindow::message('E', msg, msgw_ePop_Yes);
wb_log::pull();
return;
}
syi_NodeName( &m_sts, currentnode, sizeof(currentnode));
opt.force = 1;
import_files( bld_ePass_AfterNode);
if ( evenSts())
sumsts = m_sts;
else if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT && m_sts != PWRB__INLIBHIER)
sumsts = m_sts;
directories( 0, bld_ePass_AfterNode);
if ( evenSts())
sumsts = m_sts;
else if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT && m_sts != PWRB__INLIBHIER)
sumsts = m_sts;
export_files( bld_ePass_AfterNode);
if ( evenSts())
sumsts = m_sts;
else if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT && m_sts != PWRB__INLIBHIER)
sumsts = m_sts;
opt.force = force;
wb_log::pull();
m_sts = sumsts;
}
void wb_build::node( char *nodename, void *volumelist, int volumecnt)
{
lfu_t_volumelist *vlist = (lfu_t_volumelist *)volumelist;
......@@ -201,8 +395,10 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
if ( vlist[i].volume_id == m_session.vid()) {
// Build current volume
volume();
if ( evenSts())
if ( evenSts()) {
wb_log::pull();
return;
}
}
cdh_ToLower( vname, vlist[i].volume_name);
......@@ -216,6 +412,7 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
char msg[200];
sprintf( msg, "Loadfile for volume %s not created", vname);
MsgWindow::message('E', msg, msgw_ePop_Yes);
wb_log::pull();
return;
}
if ( vtime.tv_sec > btime.tv_sec)
......@@ -224,7 +421,6 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
}
}
}
wb_log::pull();
if ( m_wnav && m_wnav->ldhses) {
wb_erep *erep = *(wb_env *)ldh_SessionToWB( m_wnav->ldhses);
......@@ -274,6 +470,7 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
sprintf( msg, "Build: Node %s", nodename);
MsgWindow::message('I', msg, msgw_ePop_No);
}
wb_log::pull();
m_sts = sumsts;
......
......@@ -64,6 +64,7 @@ class wb_build : public wb_status
m_session(ses), m_wnav(wnav), m_hierarchy(pwr_cNOid) {};
void classlist( pwr_tCid cid);
void all( int no_export = 0, int no_classvolumes = 0, int no_flowfiles = 0);
void node( char *nodename, void *volumelist, int volumecnt);
void volume();
void rootvolume( pwr_tVid vid);
......
......@@ -1967,7 +1967,7 @@ ldh_WbLoad( ldh_tSession session, char *loadfile, int ignore_oix)
return e.sts();
}
}
else if ( strstr( loadfile, ".wb_load") || strstr( loadfile, ".wb_dmp")) {
else if ( strstr( loadfile, ".wb_load") || strstr( loadfile, ".wb_dmp") || strstr( loadfile, ".wb_rev")) {
// load vrepwbl
try {
dcli_translate_filename( fname, loadfile);
......
......@@ -82,6 +82,7 @@
#include "wb_session.h"
#include "wb_object.h"
#include "wb_vrepdb.h"
#include "wb_revision.h"
#define LFU_MAX_NODE_VOLUMES 100
......@@ -2991,6 +2992,25 @@ pwr_tStatus lfu_SaveDirectoryVolume(
pwr_tObjName oname;
pwr_tOName fullname;
pwr_tOid poid;
pwr_tOid buildconfig_oid;
// Build config object, check version manager
sts = ldh_GetClassList( ldhses, pwr_cClass_BuildConfig, &buildconfig_oid);
if ( ODD(sts)) {
pwr_tEnum version_manager;
wb_attribute a = sp->attribute( buildconfig_oid, "DevBody", "VersionManager");
if ( !a) return a.sts();
a.value( &version_manager);
if ( !a) return sts;
wb_revision rev( 0, 0);
if ( rev.manager_enum() != version_manager) {
rev.set_manager_enum( (pwr_eVersionManagerEnum)version_manager);
rev.write_file();
}
}
for ( sts = ldh_GetClassList( ldhses, pwr_cClass_BuildDirectory, &builddir_oid);
ODD(sts);
......@@ -3708,6 +3728,151 @@ pwr_tStatus lfu_GetVolumeCnf( char *name, pwr_tVid *vid, pwr_tCid *cid, ldh_eVol
return 0;
}
pwr_tStatus lfu_GetVolumeCnfAll( vector<lfu_volume_info>& vect)
{
pwr_tStatus sts;
pwr_tFileName fname;
char line[200];
char vol_array[7][80];
int found = 0;
strcpy( fname, pwr_cNameVolumeList);
dcli_translate_filename( fname, fname);
ifstream fpm( fname, ios::in);
if ( !fpm)
return 0;
while ( fpm.getline( line, sizeof(line))) {
int nr;
lfu_volume_info vol;
if ( line[0] == '#')
continue;
nr = dcli_parse( line, " ", "", (char *)vol_array,
sizeof(vol_array)/sizeof(vol_array[0]),
sizeof(vol_array[0]), 0);
strncpy( vol.name, vol_array[0], sizeof(vol.name));
found = 1;
sts = cdh_StringToVolumeId( vol_array[1], &vol.vid);
if ( EVEN(sts)) return sts;
if ( cdh_NoCaseStrcmp( vol_array[2], "RootVolume") == 0)
vol.cid = pwr_eClass_RootVolume;
else if ( cdh_NoCaseStrcmp( vol_array[2], "SubVolume") == 0)
vol.cid = pwr_eClass_SubVolume;
else if ( cdh_NoCaseStrcmp( vol_array[2], "SharedVolume") == 0)
vol.cid = pwr_eClass_SharedVolume;
else if ( cdh_NoCaseStrcmp( vol_array[2], "ClassVolume") == 0)
vol.cid = pwr_eClass_ClassVolume;
else if ( cdh_NoCaseStrcmp( vol_array[2], "DetachedClassVolume") == 0)
vol.cid = pwr_eClass_DetachedClassVolume;
switch ( vol.cid) {
case pwr_eClass_RootVolume:
case pwr_eClass_SubVolume:
case pwr_eClass_SharedVolume:
vol.volrep = ldh_eVolRep_Db;
if ( nr > 4 && strcmp( vol_array[4], "1") == 0) {
vol.volrep = ldh_eVolRep_Dbms;
if ( nr > 5)
strncpy( vol.server, vol_array[5], sizeof(vol.server));
else
strcpy( vol.server, "");
}
break;
case pwr_eClass_ClassVolume:
case pwr_eClass_DetachedClassVolume:
vol.volrep = ldh_eVolRep_Wbl;
if ( nr > 4 && strcmp( vol_array[4], "1") == 0)
vol.volrep = ldh_eVolRep_Db;
else if ( nr > 4 && strcmp( vol_array[4], "2") == 0) {
vol.volrep = ldh_eVolRep_Dbms;
if ( nr > 5)
strncpy( vol.server, vol_array[5], sizeof(vol.server));
else
strcpy( vol.server, "");
}
break;
default: ;
}
vect.push_back(vol);
}
fpm.close();
if ( found)
return LFU__SUCCESS;
return 0;
}
pwr_tStatus lfu_GetBootList( vector<lfu_boot_info>& vect, int *nodes)
{
pwr_tStatus sts;
pwr_tFileName fname;
char line[200];
char boot_array[7][80];
int found = 0;
int cnt = 0;
strcpy( fname, pwr_cNameBootList);
dcli_translate_filename( fname, fname);
ifstream fpm( fname, ios::in);
if ( !fpm)
return 0;
while ( fpm.getline( line, sizeof(line))) {
int nr;
lfu_boot_info boot;
if ( line[0] == '#')
continue;
nr = dcli_parse( line, " ", "", (char *)boot_array,
sizeof(boot_array)/sizeof(boot_array[0]),
sizeof(boot_array[0]), 0);
strncpy( boot.volume_name, boot_array[0], sizeof(boot.volume_name));
strncpy( boot.node_name, boot_array[3], sizeof(boot.node_name));
sts = sscanf( boot_array[4], "%d", &boot.bus);
if ( sts != 1)
printf( "File syntax error %s\n", fname);
sts = sscanf( boot_array[5], "%d", &boot.opsys);
if ( sts != 1)
printf( "File syntax error %s\n", fname);
found = 1;
sts = cdh_StringToVolumeId( boot_array[1], &boot.vid);
if ( EVEN(sts)) return sts;
bool num_found = false;
for ( unsigned int j = 0; j < vect.size(); j++) {
if ( strcmp( vect[j].node_name, boot.node_name) == 0) {
boot.number = vect[j].number;
num_found = true;
}
}
if ( !num_found)
boot.number = cnt++;
vect.push_back(boot);
}
fpm.close();
*nodes = cnt;
if ( found)
return LFU__SUCCESS;
return 0;
}
pwr_tStatus lfu_ParseDbmsServer( char *server, char *user, char *password,
unsigned int *port, char *host)
{
......
......@@ -34,6 +34,8 @@
* General Public License plus this exception.
**/
#include <vector>
#ifndef wb_lfu_h
#define wb_lfu_h
......@@ -77,6 +79,48 @@ typedef struct {
char name[80];
} lfu_t_volref;
class lfu_volume_info
{
public:
pwr_tObjName name;
pwr_tVid vid;
pwr_tCid cid;
ldh_eVolRep volrep;
char server[80];
lfu_volume_info() : vid(0), cid(0), volrep(ldh_eVolRep_Db) {
strcpy( name, "");
strcpy( server, "");
}
lfu_volume_info( const lfu_volume_info& x) : vid(x.vid), cid(x.cid), volrep(x.volrep) {
strncpy( name, x.name, sizeof(name));
strncpy( server, x.server, sizeof(server));
}
};
class lfu_boot_info
{
public:
pwr_tObjName node_name;
pwr_tString80 node_text;
pwr_tObjName volume_name;
pwr_tVid vid;
pwr_tUInt32 bus;
pwr_tOpSysEnum opsys;
int number;
lfu_boot_info() : vid(0), bus(0), opsys(0), number(0) {
strcpy( node_name, "");
strcpy( node_text, "");
strcpy( volume_name, "");
}
lfu_boot_info( const lfu_boot_info& x) : vid(x.vid), bus(x.bus), opsys(x.opsys), number(x.number) {
strncpy( node_name, x.node_name, sizeof(node_name));
strncpy( node_text, x.node_text, sizeof(node_text));
strncpy( volume_name, x.volume_name, sizeof(volume_name));
}
};
pwr_tStatus lfu_volumelist_load( const char *filename,
lfu_t_volumelist **vollist,
int *volcount);
......@@ -142,6 +186,10 @@ pwr_tStatus lfu_check_appl_file( ldh_tSesContext ldhses,
char *nodename, int bus_number);
pwr_tStatus lfu_check_opt_file( ldh_tSesContext ldhses, char *nodename, int bus_number, pwr_mOpSys opsys);
pwr_tStatus lfu_GetVolumeCnfAll( vector<lfu_volume_info>& vect);
pwr_tStatus lfu_GetBootList( vector<lfu_boot_info>& vect, int *nodes);
#ifdef __cplusplus
}
#endif
......
......@@ -137,6 +137,15 @@ void wb_log::category_to_string( wlog_eCategory category, char *str)
case wlog_eCategory_DirectoryBuild:
strcpy( str, "DirectoryBuild");
break;
case wlog_eCategory_NewRevision:
strcpy( str, "NewRevision");
break;
case wlog_eCategory_RevisionRestore:
strcpy( str, "RevisionRestore");
break;
case wlog_eCategory_BuildAll:
strcpy( str, "BuildAll");
break;
default:
strcpy( str, "");
}
......@@ -174,6 +183,12 @@ void wb_log::string_to_category( char *str, wlog_eCategory *category)
*category = wlog_eCategory_VolumeClone;
else if ( strcmp( str, "DirectoryBuild") == 0)
*category = wlog_eCategory_DirectoryBuild;
else if ( strcmp( str, "NewRevision") == 0)
*category = wlog_eCategory_NewRevision;
else if ( strcmp( str, "RevisionRestore") == 0)
*category = wlog_eCategory_RevisionRestore;
else if ( strcmp( str, "BuildAll") == 0)
*category = wlog_eCategory_BuildAll;
else
*category = wlog_eCategory_;
}
......@@ -272,6 +287,8 @@ DirectoryBuild Directory built. Directory displayed in item.\n\
UpdateClasses Classes updated.\n\
CreatePackage Distribution package created. Created package displayed in item.\n\
CopyPackage Package distributed to process or operator station. Package displayed in item.\n\
NewRevision A new reivison is created. Revision displayed in item\n\
RevisionRestored A revision is restored. Revision displayed in item.\n\
</XMP>\n\
</body>\n\
</html>\n");
......
......@@ -63,6 +63,9 @@ typedef enum {
wlog_eCategory_WbLoad,
wlog_eCategory_VolumeClone,
wlog_eCategory_DirectoryBuild,
wlog_eCategory_NewRevision,
wlog_eCategory_RevisionRestore,
wlog_eCategory_BuildAll,
wlog_eCategory__,
} wlog_eCategory;
......
This diff is collapsed.
This diff is collapsed.
......@@ -47,6 +47,8 @@
#include <iostream>
#include "pwr_class.h"
#include "wb_ldh.h"
#include "co_tree.h"
using namespace std;
......@@ -61,6 +63,7 @@ class wb_print_wbl
{
protected:
int m_errCnt;
int m_lineCnt;
bool m_idxFlag;
bool m_noFoCodeFlag;
bool m_timeFlag;
......@@ -70,47 +73,35 @@ protected:
bool m_keepName;
bool m_isTemplateObject;
ostream& m_os;
tree_sTable *m_body_cache;
ostream& indent(int levelIncr = 0);
void printAttribute(wb_volume& v,
wb_attribute& attr,
wb_attribute& tattr, ///< template attribute
wb_adef& adef,
int force);
void printBody(wb_volume& v,
wb_object& o,
wb_object& templ,
wb_cdef& cdef,
pwr_eBix bix);
void printBuffer(wb_volume& v,
wb_attribute& attr,
wb_attribute& tattr, ///< template attribute
wb_adef& adef);
void printClass(wb_volume& v,
wb_attribute& attr,
wb_attribute& tattr, ///< template attribute
wb_adef& adef);
void printParameter(wb_volume& v,
wb_attribute& attr,
wb_attribute& tattr, ///< template attribute
wb_adef& adef);
void printBody( wb_volume& vol, pwr_tOid oid, pwr_tOid toid, pwr_tCid cid,
pwr_eBix bix);
bool printValue( wb_volume& v,
pwr_eType type,
unsigned int flags,
void *val,
int varSize,
char **svalp);
void printBuffer( wb_volume& vol,
ldh_sParDef *par_bd,
char *body);
void printClass( wb_volume& vol,
ldh_sParDef *par_bd,
char *body,
char *tbody,
char *par_path);
void printText(wb_volume& v,
wb_adef& adef,
const char* text,
int varSize);
bool printValue(wb_volume& v,
wb_adef& adef,
void *val,
int varSize,
char **svalp);
const char *aname,
const char *text,
int varSize);
pwr_tStatus getBody( wb_volume& vol, pwr_tCid cid, const char *bname, int tsize,
ldh_sParDef **bdef, int *rows, char **tbody);
void bodyCacheFree();
int attrCmp( char *a1, char *a2, int size, pwr_eType type);
bool isFoCodeObject( wb_volume& v,
wb_object& o);
......
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 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.
**/
#ifndef wb_revision_h
#define wb_revision_h
#include <vector>
#include "pwr.h"
#include "wb_ldh.h"
#include "wb_session.h"
#include "wb_wnav.h"
#include "pwr_baseclasses.h"
typedef struct {
char name[80];
bool in_master;
bool in_end_of_branch;
} wb_rev_info;
class wb_rev_item {
public:
char name[80];
int level;
char description[80];
char version[40];
pwr_tTime date;
bool current;
bool current_branch;
bool in_manager;
int idx;
vector<wb_rev_item> vect;
wb_rev_item() : level(0), current(false), current_branch(false), in_manager(false), idx(0) {
strcpy(name,""); strcpy(description,""); strcpy(version,"");}
wb_rev_item( const wb_rev_item& x) : level(x.level), date(x.date), current(x.current),
current_branch(x.current_branch), in_manager(x.in_manager), idx(x.idx), vect(x.vect) {
strcpy( name, x.name); strcpy( description, x.description); strcpy( version, x.version);
}
};
class wb_version_manager
{
private:
pwr_eVersionManagerEnum m_manager;
public:
wb_version_manager( pwr_eVersionManagerEnum manager) : m_manager(manager) {}
virtual ~wb_version_manager() {}
virtual void init() {}
virtual int store_revision( char *name, char *descr, bool new_branch) { return 0;}
virtual int restore_revision( char *name, char *branch, int checkout_master, int checkout_branch) { return 0;}
virtual int get_current( char *name) { return 0;}
virtual int check( vector<wb_rev_item>& v) { return 0;}
};
class wb_version_manager_git : public wb_version_manager
{
public:
wb_version_manager_git() : wb_version_manager(pwr_eVersionManagerEnum_None) { init();}
~wb_version_manager_git() {}
void init();
int store_revision( char *name, char *descr, bool new_branch);
int restore_revision( char *name, char *branch, int checkout_master, int checkout_branch);
int get_current( char *name);
int check( vector<wb_rev_item>& v);
};
class wb_revision : public wb_status
{
private:
void *m_parent_ctx;
wb_session *m_session;
wb_version_manager *m_manager;
pwr_eVersionManagerEnum m_manager_enum;
vector<wb_rev_item> m_vect;
bool m_read;
int m_current_idx;
int m_current_main_idx;
int m_current_sub_idx;
int (*m_command_cb)( void *ctx, char *cmd);
public:
wb_revision( void *parent_ctx, wb_session *ses);
~wb_revision() {
if ( m_manager)
delete m_manager;
}
pwr_tStatus create( int all, char *name, char *descr);
pwr_tStatus restore( char *name);
pwr_tStatus build_all();
pwr_tStatus remove( char *name);
void read_file();
void write_file();
int add( char *name, char *description, char *version, pwr_tTime *date, bool in_main, int sub_idx);
void list();
void *parent_ctx() { return m_parent_ctx;}
void command_cb( int (*cmd_cb)(void *, char *)) { m_command_cb = cmd_cb;}
wb_rev_item *vect( int idx) { return &m_vect[idx];}
int size() { return (int) m_vect.size();}
pwr_eVersionManagerEnum manager_enum() { return m_manager_enum;}
void set_manager_enum( pwr_eVersionManagerEnum manager_enum) { m_manager_enum = manager_enum;}
wb_rev_item *current();
pwr_tStatus create_check();
void get_info( wb_rev_info *info);
void next_name( char *name);
static char *branch_name( char *name);
static void info( wb_rev_info *info);
};
#endif
......@@ -1410,7 +1410,13 @@ int wb_utl::exec_plcpgms( ldh_tSesContext ldhses,
class_vect[1] = 0;
classp = class_vect;
if ( !all) {
if ( templ) {
/* Get objdid for the hierarchy object */
sts = ldh_NameToObjid( ldhses, &hierobjdid, "Class");
if ( EVEN(sts))
return FOE__HIERNAME;
}
else if ( !all) {
/* Get objdid for the hierarchy object */
sts = ldh_NameToObjid( ldhses, &hierobjdid, hiername);
if ( EVEN(sts))
......
......@@ -170,6 +170,12 @@ wb_vrepmem::~wb_vrepmem()
clear();
}
void wb_vrepmem::reloadWbl( pwr_tStatus *sts)
{
clear();
loadWbl( m_filename, sts, true);
}
void wb_vrepmem::loadWbl( const char *filename, pwr_tStatus *sts, bool reload)
{
if ( !reload && m_erep->refMerepOccupied()) {
......@@ -2097,7 +2103,9 @@ bool wb_vrepmem::commit(pwr_tStatus *sts)
}
if ( m_classeditor) {
printf("Check commit\n");
classeditorCheckCommit();
printf("Commit\n");
classeditorCommit();
}
......@@ -2111,6 +2119,7 @@ bool wb_vrepmem::commit(pwr_tStatus *sts)
return false;
}
printf( "Print wbl\n");
try {
wb_volume vol(this);
......
......@@ -413,6 +413,7 @@ public:
virtual bool importDocBlock(pwr_tOid oid, size_t size, char *block);
virtual bool importMeta(dbs_sMenv *mep) { return true;}
bool importBuildObject( mem_object *memo);
void reloadWbl( pwr_tStatus *sts);
void loadWbl( const char *filename, pwr_tStatus *sts, bool reload = false);
void freeObject( mem_object *mem);
void clear();
......
......@@ -264,7 +264,7 @@ int wb_vrepwbl::load( const char *fname)
MsgWindow::dset_nodraw();
if ( strstr( fname, ".wb_load") != 0 || strstr( fname, ".wb_dmp") != 0) {
if ( strstr( fname, ".wb_load") != 0 || strstr( fname, ".wb_dmp") != 0 || strstr( fname, ".wb_rev") != 0) {
sts = load_files( fname);
if ( EVEN(sts)) {
MsgWindow::dreset_nodraw();
......
......@@ -49,6 +49,7 @@
#include "wb_name.h"
#include "wb_treeimport.h"
#include "pwr_baseclasses.h"
#include "pwr_remoteclasses.h"
#include "pwr_basecomponentclasses.h"
/* Datatypes */
......@@ -293,6 +294,17 @@ static wbl_sSym classes[] =
,{ "pwr_cClass_AlarmView", pwr_cClass_AlarmView }
,{ "pwr_cClass_DsTrend", pwr_cClass_DsTrend }
,{ "pwr_cClass_DsTrendCurve", pwr_cClass_DsTrendCurve }
,{ "pwr_cClass_CircBuff1k", pwr_cClass_CircBuff1k }
,{ "pwr_cClass_CircBuff2k", pwr_cClass_CircBuff2k }
,{ "pwr_cClass_CircBuff10k", pwr_cClass_CircBuff10k }
,{ "pwr_cClass_CircBuff20k", pwr_cClass_CircBuff20k }
,{ "pwr_cClass_CircBuff100k", pwr_cClass_CircBuff100k }
,{ "pwr_cClass_CircBuff200k", pwr_cClass_CircBuff200k }
,{ "pwr_cClass_Buff256", pwr_cClass_Buff256 }
,{ "pwr_cClass_Buff1440", pwr_cClass_Buff1440 }
,{ "pwr_cClass_Buff4096", pwr_cClass_Buff4096 }
,{ "pwr_cClass_Buff32k", pwr_cClass_Buff32k }
,{ "pwr_cClass_BuffStr80", pwr_cClass_BuffStr80 }
,{ "BaseComponent:Class-CompModePID", pwr_cClass_CompModePID }
,{ "BaseComponent:Class-CompPID", pwr_cClass_CompPID }
,{ "BaseComponent:Class-CompModeIMC", pwr_cClass_CompModeIMC }
......
......@@ -639,7 +639,7 @@ WNav::WNav(
layout_objid(pwr_cNObjid), search_last(pwr_cNObjid), search_compiled(0),
search_type(wnav_eSearchType_No), selection_owner(0), last_selected(0),
prev_selected(0), displayed(0), scriptmode(0), dialog_width(0), dialog_height(0),
dialog_x(0), dialog_y(0), menu(0), admin_login(0), nodraw(0)
dialog_x(0), dialog_y(0), menu(0), admin_login(0), nodraw(0), rev(0)
{
strcpy( name, xn_name);
......
......@@ -95,7 +95,6 @@
#include "wb_watttext.h"
#endif
#define wnav_cVersion "X3.3a"
#define wnav_cScriptDescKey "!** Description"
#define wnav_cScriptInvisKey "!** Invisible"
......@@ -171,6 +170,7 @@ class WGe;
class wb_utl;
class CoLogin;
class WCrr;
class WRev;
class ApplListElem {
public:
......@@ -322,6 +322,7 @@ class WNav : public WUtility{
CoWow *wow;
int admin_login;
int nodraw;
WRev *rev;
virtual void pop() {}
virtual void set_inputfocus( int focus) {}
......@@ -346,6 +347,7 @@ class WNav : public WUtility{
virtual void wge_modal_loop( WGe *wge) {}
virtual bool has_window() {return false;}
virtual wb_utl *utl_new() {return 0;}
virtual WRev *rev_new() {return 0;}
virtual void logw_new( char *item, wlog_eCategory *categories, int show_item) {}
virtual CoLogin *login_new( const char *name, const char *groupname,
void (* bc_success)( void *), void (* bc_cancel)( void *),
......@@ -426,6 +428,7 @@ class WNav : public WUtility{
int show_volume( int pop);
int get_rootlist();
int check_toplevel_class( pwr_tCid cid);
pwr_tStatus get_command_sts();
int command( char* input_str);
int readcmdfile( char *incommand);
int get_current_object(
......
This diff is collapsed.
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 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.
**/
#ifndef wb_wrev_h
#define wb_wrev_h
/* wb_wrev.h -- Revision window */
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef wb_utility_h
# include "wb_utility.h"
#endif
#ifndef wb_ldh_h
# include "wb_ldh.h"
#endif
#ifndef wb_revision_h
# include "wb_wrevnav.h"
#endif
class WRevNav;
class CoWow;
class WRev {
public:
WRev( void *wa_parent_ctx, ldh_tSession wa_ldhses);
virtual ~WRev();
void *parent_ctx;
ldh_tSession ldhses;
char name[80];
WRevNav *wrevnav;
void (*close_cb) ( void *);
int (*command_cb) ( void *, char *);
void (*india_ok_cb)( WRev *, char *, char *);
wb_eUtility utility;
CoWow *wow;
int dialog_count;
void activate_store();
void activate_restore();
void activate_delete();
void activate_build();
void activate_zoom_in();
void activate_zoom_out();
void activate_zoom_reset();
void next_name( char *name);
virtual void message( char severity, const char *message) {}
virtual void pop() {}
virtual void set_clock_cursor() {}
virtual void reset_cursor() {}
virtual void flush() {}
virtual void open_input_dialog( const char *text1, const char *text2, const char *title,
const char *init_text1, const char *init_text2,
void (*ok_cb)( WRev *, char *, char *)) {}
static void message_cb( void *wrev, char severity, const char *message);
static void set_clock_cursor_cb( void *wrev);
static void reset_cursor_cb( void *wrev);
static int rev_command_cb( void *ctx, char *cmd);
static void restore_cancel( void *ctx, void *data);
static void restore_ok( void *ctx, void *data);
static void delete_cancel( void *ctx, void *data);
static void delete_ok( void *ctx, void *data);
static void store_ok_cb( WRev *wrev, char *text1, char *text2);
};
#endif
This diff is collapsed.
This diff is collapsed.
......@@ -1002,6 +1002,11 @@ void Wtt::activate_revert()
&Wtt::revert_ok, NULL);
}
void Wtt::activate_revisions()
{
wnavnode->command( (char *)"open revisions");
}
void Wtt::activate_syntax()
{
int sts;
......
......@@ -224,6 +224,7 @@ class Wtt : public WUtility {
void activate_collapse();
void activate_save();
void activate_revert();
void activate_revisions();
void activate_syntax();
void activate_find();
void activate_findregex();
......
#define xnav_bitmap_current10_width 10
#define xnav_bitmap_current10_height 10
static unsigned char xnav_bitmap_current10_bits[] = {
0x7c, 0x00, 0x82, 0x00, 0x39, 0x01, 0x7d, 0x01, 0x7d, 0x01, 0x7d, 0x01,
0x39, 0x01, 0x82, 0x00, 0x7c, 0x00, 0x00, 0x00};
#define xnav_bitmap_current12_width 12
#define xnav_bitmap_current12_height 12
static unsigned char xnav_bitmap_current12_bits[] = {
0xf8, 0x00, 0x04, 0x01, 0x72, 0x02, 0xf9, 0x04, 0xfd, 0x05, 0xfd, 0x05,
0xfd, 0x05, 0xf9, 0x04, 0x72, 0x02, 0x04, 0x01, 0xf8, 0x00, 0x00, 0x00};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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