Commit efecce71 authored by claes's avatar claes

Merge branch 'master' of claes@62.20.65.89:/data1/git/pwr

parents 6720876d 0bb85b7d
......@@ -35,10 +35,15 @@ CoLog *CoLog::m_default_log = 0;
void CoLog::log( const char *category, const char *str, const char *cmt, unsigned int opt)
{
ofstream fp;
pwr_tStatus sts;
char timstr[40];
char username[80];
char comment[200] = "";
time_AtoAscii( 0, time_eFormat_DateAndTime, timstr, sizeof(timstr));
sts = syi_UserName( username, sizeof(username));
if ( EVEN(sts))
strcpy( username, "Unknown");
if ( cmt)
strncpy( comment, cmt, sizeof(comment));
......@@ -72,6 +77,10 @@ void CoLog::log( const char *category, const char *str, const char *cmt, unsigne
for ( int i = strlen(category); i < 11; i++)
fp << " ";
fp << " ";
fp << " " << username;
for ( int i = strlen(username); i < 11; i++)
fp << " ";
fp << " ";
fp << str;
if ( strcmp( comment, "") != 0)
fp << " \"" << comment << "\"";
......@@ -80,11 +89,11 @@ void CoLog::log( const char *category, const char *str, const char *cmt, unsigne
}
void CoLog::get( char categories[][20], char *item,
void item_cb( void *, pwr_tTime, char *, char *, char *), void *ctx)
void item_cb( void *, pwr_tTime, char *, char *, char *, char *), void *ctx)
{
ifstream fp;
char line[1024];
char line_array[7][512];
char line_array[8][512];
int parts;
int num;
unsigned int level;
......@@ -100,8 +109,8 @@ void CoLog::get( char categories[][20], char *item,
sizeof( line_array[0]), 0);
if ( item &&
!(item[strlen(item)-1] == '*' && cdh_NoCaseStrncmp( line_array[5], item, strlen(item)-1) == 0) &&
cdh_NoCaseStrcmp( line_array[5], item) != 0)
!(item[strlen(item)-1] == '*' && cdh_NoCaseStrncmp( line_array[6], item, strlen(item)-1) == 0) &&
cdh_NoCaseStrcmp( line_array[6], item) != 0)
continue;
int found = 0;
......@@ -125,10 +134,10 @@ void CoLog::get( char categories[][20], char *item,
if ( EVEN(sts))
continue;
if ( parts > 6)
item_cb( ctx, time, line_array[4], line_array[5], line_array[6]);
if ( parts > 7)
item_cb( ctx, time, line_array[4], line_array[5], line_array[6], line_array[7]);
else
item_cb( ctx, time, line_array[4], line_array[5], 0);
item_cb( ctx, time, line_array[4], line_array[5], line_array[6], 0);
}
}
......
......@@ -51,7 +51,7 @@ class CoLog
void set_default() { m_default_log = this;}
void log( const char *category, const char *str, const char *cmt, unsigned int opt = 0);
void get( char categories[][20], char *item,
void item_cb( void *, pwr_tTime, char *, char *, char *), void *ctx);
void item_cb( void *, pwr_tTime, char *, char *, char *, char *), void *ctx);
void push() { m_level++;}
void pull() {
m_level--;
......@@ -65,7 +65,7 @@ class CoLog
if ( m_default_log) m_default_log->push();}
static void dpull() {
if ( m_default_log) m_default_log->pull();}
static void dget( char categories[][20], char *item, void item_cb( void *, pwr_tTime, char *, char *, char *), void *ctx) {
static void dget( char categories[][20], char *item, void item_cb( void *, pwr_tTime, char *, char *, char *, char *), void *ctx) {
if ( m_default_log) m_default_log->get( categories, item, item_cb, ctx);}
};
......
......@@ -123,7 +123,10 @@ void CoLogWNavBrow::create_nodeclasses()
brow_AddAnnot( nc_log, 13, 0.6, 2,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
0);
brow_AddAnnot( nc_log, 30, 0.6, 3,
brow_AddAnnot( nc_log, 18, 0.6, 3,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
0);
brow_AddAnnot( nc_log, 35, 0.6, 4,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddFrame( nc_log, 0, 0, 35, 0.83, flow_eDrawType_LineGray, -1, 1);
......@@ -377,8 +380,8 @@ int CoLogWNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
}
ItemLog::ItemLog( CoLogWNav *item_logwnav, const char *item_name,
pwr_tTime item_time, char *item_category, char *item_comment,
brow_tNode dest, flow_eDest dest_code):
pwr_tTime item_time, char *item_category, char *item_user,
char *item_comment, brow_tNode dest, flow_eDest dest_code):
logwnav(item_logwnav), time(item_time)
{
char time_str[40];
......@@ -387,6 +390,7 @@ ItemLog::ItemLog( CoLogWNav *item_logwnav, const char *item_name,
type = logwitem_eItemType_Log;
strncpy( category, item_category, sizeof(category));
strncpy( user, item_user, sizeof(user));
if ( item_comment)
strncpy( comment, item_comment, sizeof(comment));
else
......@@ -402,6 +406,7 @@ ItemLog::ItemLog( CoLogWNav *item_logwnav, const char *item_name,
int annot = 0;
brow_SetAnnotation( node, annot++, time_str, strlen(time_str));
brow_SetAnnotation( node, annot++, category, strlen(category));
brow_SetAnnotation( node, annot++, user, strlen(user));
if ( logwnav->show_item)
brow_SetAnnotation( node, annot++, item_name, strlen(item_name));
if ( item_comment)
......@@ -420,12 +425,12 @@ ItemLog::ItemLog( CoLogWNav *item_logwnav, const char *item_name,
}
void CoLogWNav::item_cb( void *ctx, pwr_tTime time, char *category, char *item,
void CoLogWNav::item_cb( void *ctx, pwr_tTime time, char *category, char *user, char *item,
char *comment)
{
CoLogWNav *logwnav = (CoLogWNav *)ctx;
new ItemLog( logwnav, item, time, category, comment, 0, flow_eDest_IntoLast);
new ItemLog( logwnav, item, time, category, user, comment, 0, flow_eDest_IntoLast);
}
void CoLogWNav::show( char categories[][20], char *item)
......
......@@ -80,20 +80,21 @@ class CoLogWNav {
static int init_brow_cb( FlowCtx *fctx, void *client_data);
static int brow_cb( FlowCtx *ctx, flow_tEvent event);
static void item_cb( void *ctx, pwr_tTime time, char *category, char *item,
static void item_cb( void *ctx, pwr_tTime time, char *category, char *user, char *item,
char *comment);
};
class ItemLog {
public:
ItemLog( CoLogWNav *logwnav, const char *item_name,
pwr_tTime item_time, char *item_catogory, char *item_comment,
pwr_tTime item_time, char *item_catogory, char *item_user, char *item_comment,
brow_tNode dest, flow_eDest dest_code);
logwitem_eItemType type;
CoLogWNav *logwnav;
brow_tNode node;
pwr_tTime time;
char category[20];
char user[80];
char comment[256];
virtual ~ItemLog() {}
......
......@@ -144,3 +144,4 @@
091020 cs wb Expand/Compress in plc editor on GetATp, GetDTp, StoATp etc.
091021 cs wb Crossreferences on channels added.
091028 cs wb Syntax check works again with new check functions, and SyntaxCheck in configurator popup menu.
091030 cs wb History log in wb.
\ No newline at end of file
......@@ -102,6 +102,12 @@ void wb_log::category_to_string( wlog_eCategory category, char *str)
case wlog_eCategory_GeExport:
strcpy( str, "GeExport");
break;
case wlog_eCategory_UpdateClasses:
strcpy( str, "UpdateClasses");
break;
case wlog_eCategory_WbLoad:
strcpy( str, "WbLoad");
break;
default:
strcpy( str, "");
}
......@@ -131,6 +137,10 @@ void wb_log::string_to_category( char *str, wlog_eCategory *category)
*category = wlog_eCategory_CopyPackage;
else if ( strcmp( str, "GeExport") == 0)
*category = wlog_eCategory_GeExport;
else if ( strcmp( str, "UpdateClasses") == 0)
*category = wlog_eCategory_UpdateClasses;
else if ( strcmp( str, "WbLoad") == 0)
*category = wlog_eCategory_WbLoad;
else
*category = wlog_eCategory_;
}
......
......@@ -38,6 +38,8 @@ typedef enum {
wlog_eCategory_CreatePackage,
wlog_eCategory_CopyPackage,
wlog_eCategory_GeExport,
wlog_eCategory_UpdateClasses,
wlog_eCategory_WbLoad,
wlog_eCategory__,
} wlog_eCategory;
......
......@@ -1942,7 +1942,16 @@ void Wtt::activate_updateclasses()
if ( !focused_wnav)
set_focus_default();
set_clock_cursor();
unsigned int opt;
if ( focused_wnav->gbl.enable_comment)
opt = log_mOption_Comment;
else
opt = 0;
wb_log::log( (wb_session *)ldhses, wlog_eCategory_UpdateClasses, volid, opt);
focused_wnav->command( cmd);
reset_cursor();
}
......
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