Commit 3321e3e6 authored by claes's avatar claes

New message window in wb

parent a227aec0
#if defined OS_VMS && defined __ALPHA
# pragma message disable (NOSIMPINT,EXTROUENCUNNOBJ)
#endif
#if defined OS_VMS && !defined __ALPHA
# pragma message disable (LONGEXTERN)
#endif
#include <stdio.h>
#include <stdlib.h>
extern "C" { extern "C" {
#include "pwr.h" #include "pwr.h"
}
#include <Xm/Xm.h>
#include <Mrm/MrmPublic.h>
#ifndef _XtIntrinsic_h
#include <X11/Intrinsic.h>
#endif
#include <X11/IntrinsicP.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "flow_browwidget.h"
#include "co_msgwindow.h"
extern "C" {
#include "co_api.h" #include "co_api.h"
#include "co_dcli.h" #include "co_dcli.h"
} }
...@@ -88,3 +118,36 @@ char *lng_translate( char *str) ...@@ -88,3 +118,36 @@ char *lng_translate( char *str)
return Lng::translate( str); return Lng::translate( str);
} }
//
// c api to co_msgwindow
//
void msgw_message( int severity, char *text, msgw_ePop pop)
{
MsgWindow::message( severity, text, pop);
}
void msgw_message_sts( pwr_tStatus sts, char *text1, char *text2)
{
MsgWindow::message( wb_error(sts), text1, text2);
}
void msgw_message_object( pwr_tStatus sts, char *text1, char *text2, pwr_tOid oid)
{
MsgWindow::message( wb_error(sts), text1, text2, oid);
}
void msgw_message_plcobject( pwr_tStatus sts, char *text1, char *text2, pwr_tOid oid)
{
MsgWindow::message( wb_error(sts), text1, text2, oid, true);
}
void msgw_set_nodraw()
{
MsgWindow::dset_nodraw();
}
void msgw_reset_nodraw()
{
MsgWindow::dreset_nodraw();
}
...@@ -13,6 +13,14 @@ typedef enum { ...@@ -13,6 +13,14 @@ typedef enum {
} navc_eItemType; } navc_eItemType;
#endif #endif
#if !defined co_msgwindow_h
typedef enum {
msgw_ePop_No,
msgw_ePop_Yes,
msgw_ePop_Default
} msgw_ePop;
#endif
int user_CheckUser( char *systemgroup, char *user, char *password, int user_CheckUser( char *systemgroup, char *user, char *password,
unsigned int *priv); unsigned int *priv);
int user_CheckSystemGroup( char *systemgroup); int user_CheckSystemGroup( char *systemgroup);
...@@ -33,7 +41,21 @@ int crr_object( void *parent_ctx, char *objectname, ...@@ -33,7 +41,21 @@ int crr_object( void *parent_ctx, char *objectname,
int (*name_to_objid_cb)( void *, char *, pwr_tObjid *), int (*name_to_objid_cb)( void *, char *, pwr_tObjid *),
int (*get_volume_cb)( void *, pwr_tVolumeId *)); int (*get_volume_cb)( void *, pwr_tVolumeId *));
void msgw_message( int severity, char *text, msgw_ePop pop);
void msgw_message_sts( pwr_tStatus sts, char *text1, char *text2);
void msgw_message_object( pwr_tStatus sts, char *text1, char *text2, pwr_tOid oid);
void msgw_message_plcobject( pwr_tStatus sts, char *text1, char *text2, pwr_tOid oid);
void msgw_set_nodraw();
void msgw_reset_nodraw();
#if defined __cplusplus #if defined __cplusplus
} }
#endif #endif
#endif #endif
This diff is collapsed.
#ifndef xtt_msglist_h
#define xtt_msglist_h
/* xtt_msglist.h -- Alarm and event windows in xtt
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
// Status is defined as int i xlib...
#ifdef Status
# undef Status
#endif
#if defined __cplusplus
extern "C" {
#endif
#ifndef pwr_h
# include "pwr.h"
#endif
#if defined __cplusplus
}
#endif
#ifndef flow_h
#include "flow.h"
#endif
#ifndef flow_browctx_h
#include "flow_browctx.h"
#endif
#ifndef flow_browapi_h
#include "flow_browapi.h"
#endif
typedef enum {
msglist_eItemType_Msg
} msglist_eItemType;
class MsgListBrow {
public:
MsgListBrow( BrowCtx *brow_ctx, void *msgl) : ctx(brow_ctx), msglist(msgl) {};
~MsgListBrow();
BrowCtx *ctx;
void *msglist;
brow_tNodeClass nc_info;
brow_tNodeClass nc_error;
brow_tNodeClass nc_warning;
brow_tNodeClass nc_success;
brow_tNodeClass nc_default;
flow_sAnnotPixmap *pixmap_morehelp;
void free_pixmaps();
void allocate_pixmaps();
void create_nodeclasses();
void brow_setup();
};
class MsgList {
public:
MsgList(
void *ev_parent_ctx,
Widget ev_parent_wid,
Widget *w);
~MsgList();
void *parent_ctx;
Widget parent_wid;
Widget brow_widget;
Widget form_widget;
Widget toplevel;
MsgListBrow *brow;
void (*find_wnav_cb)( void *, pwr_tObjid);
void (*find_plc_cb)( void *, pwr_tObjid);
void set_input_focus();
void zoom( double zoom_factor);
void unzoom();
void set_nodraw();
void reset_nodraw();
void remove_oldest();
void clear();
};
class ItemMsg {
public:
ItemMsg( MsgList *msglist, char *item_name,
char *item_text, int item_severity,
brow_tNode dest, flow_eDest dest_code);
msglist_eItemType type;
MsgList *msglist;
brow_tNode node;
pwr_tTime time;
char text[200];
int severity;
virtual void find() {}
};
class ItemMsgObject : public ItemMsg {
public:
ItemMsgObject( MsgList *msglist, char *item_name,
char *item_text, int item_severity, pwr_tOid item_oid,
brow_tNode dest, flow_eDest dest_code);
pwr_tOid oid;
void find();
};
class ItemMsgObjectPlc : public ItemMsg {
public:
ItemMsgObjectPlc( MsgList *msglist, char *item_name,
char *item_text, int item_severity, pwr_tOid item_oid,
brow_tNode dest, flow_eDest dest_code);
pwr_tOid oid;
void find();
};
#endif
/* co_msgwindow.cpp -- Message window
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
extern "C" {
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "pwr_baseclasses.h"
}
#include <Xm/Xm.h>
#include <Xm/XmP.h>
#include <Xm/Text.h>
#include <Mrm/MrmPublic.h>
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
extern "C" {
#include "flow_x.h"
}
#include "co_lng.h"
#include "co_msgwindow.h"
static void msg_action_inputfocus( Widget w, XmAnyCallbackStruct *data);
static void msg_activate_exit( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data);
static void msg_activate_clear( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data);
static void msg_activate_zoom_in( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data);
static void msg_activate_zoom_out( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data);
static void msg_activate_zoom_reset( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data);
static void msg_create_form( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data);
MsgWindow *MsgWindow::default_window = 0;
static void msgw_find_wnav_cb( void *ctx, pwr_tOid oid)
{
MsgWindow *msgw = (MsgWindow *)ctx;
if ( msgw->find_wnav_cb)
(msgw->find_wnav_cb)( msgw->parent_ctx, oid);
}
static void msgw_find_plc_cb( void *ctx, pwr_tOid oid)
{
MsgWindow *msgw = (MsgWindow *)ctx;
if ( msgw->find_plc_cb)
(msgw->find_plc_cb)( msgw->parent_ctx, oid);
}
void MsgWindow::message( int severity, const char *text, msgw_ePop pop, pwr_tOid oid, bool is_plc)
{
if ( default_window) {
default_window->insert( severity, text, oid, is_plc);
}
else {
if ( severity == 'E' || severity == 'W' || severity == 'F' || severity == 'I')
printf( "%c %s\n", severity, text);
else
printf( "%s\n", text);
}
if ( default_window &&
(pop == msgw_ePop_Yes ||
(pop == msgw_ePop_Default && ( severity == 'E' || severity == 'F' || severity == 'W'))))
default_window->map();
}
void MsgWindow::message( const wb_error& e, const char *text1, const char *text2, pwr_tOid oid, bool is_plc)
{
pwr_tStatus sts = e.sts();
int severity;
switch( sts & 7) {
case 0:
severity = 'W';
break;
case 1:
severity = 'S';
break;
case 2:
severity = 'E';
break;
case 3:
severity = 'I';
break;
case 4:
severity = 'F';
break;
default:
severity = ' ';
}
message( severity, e.what().c_str(), text1, text2, oid, is_plc);
}
void MsgWindow::message( int severity, const char *text1, const char *text2, const char *text3,
pwr_tOid oid, bool is_plc)
{
char text[400];
strncpy( text, text1, sizeof(text));
text[sizeof(text)-1] = 0;
if ( text2) {
strncat( text, " ", sizeof(text) - strlen(text));
strncat( text, text2, sizeof(text) - strlen(text));
text[sizeof(text)-1] = 0;
}
if ( text3) {
strncat( text, " ", sizeof(text) - strlen(text));
strncat( text, text3, sizeof(text) - strlen(text));
text[sizeof(text)-1] = 0;
}
MsgWindow::message( severity, text, msgw_ePop_Default, oid, is_plc);
}
MsgWindow::MsgWindow(
void *msg_parent_ctx,
Widget msg_parent_wid,
char *msg_name,
pwr_tStatus *status) :
parent_ctx(msg_parent_ctx), parent_wid(msg_parent_wid), msgnav(NULL), displayed(0),
deferred_map(0), nodraw(0), size(0), max_size(500), find_wnav_cb(0), find_plc_cb(0)
{
char uid_filename[120] = {"$pwr_exe/wb_msgwindow.uid"};
char *uid_filename_p = uid_filename;
Arg args[20];
pwr_tStatus sts;
int i;
MrmHierarchy s_DRMh;
MrmType dclass;
static char msg_translations[] =
"<FocusIn>: msg_inputfocus()\n";
static XtTranslations msg_compiled_translations = NULL;
static XtActionsRec msg_actions[] =
{
{"msg_inputfocus", (XtActionProc) msg_action_inputfocus}
};
static MrmRegisterArg reglist[] = {
{ "msg_ctx", 0 },
{"msg_activate_exit",(caddr_t)msg_activate_exit },
{"msg_activate_clear",(caddr_t)msg_activate_clear },
{"msg_activate_zoom_in",(caddr_t)msg_activate_zoom_in },
{"msg_activate_zoom_out",(caddr_t)msg_activate_zoom_out },
{"msg_activate_zoom_reset",(caddr_t)msg_activate_zoom_reset },
{"msg_create_form",(caddr_t)msg_create_form }
};
static int reglist_num = (sizeof reglist / sizeof reglist[0]);
*status = 1;
reglist[0].value = (caddr_t) this;
// Motif
MrmInitialize();
// Save the context structure in the widget
i = 0;
XtSetArg(args[i], XmNuserData, (unsigned int) this);i++;
XtSetArg(args[i], XmNdeleteResponse, XmDO_NOTHING);i++;
dcli_translate_filename( uid_filename, uid_filename);
sts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh);
if (sts != MrmSUCCESS) printf("can't open %s\n", uid_filename);
MrmRegisterNames(reglist, reglist_num);
parent_wid = XtCreatePopupShell( name,
topLevelShellWidgetClass, parent_wid, args, i);
sts = MrmFetchWidgetOverride( s_DRMh, "msg_window", parent_wid,
name, args, 1, &toplevel, &dclass);
if (sts != MrmSUCCESS) printf("can't fetch %s\n", name);
MrmCloseHierarchy(s_DRMh);
if ( msg_compiled_translations == NULL)
{
XtAppAddActions( XtWidgetToApplicationContext( toplevel),
msg_actions, XtNumber(msg_actions));
msg_compiled_translations = XtParseTranslationTable( msg_translations);
}
XtOverrideTranslations( toplevel, msg_compiled_translations);
i = 0;
XtSetArg(args[i],XmNwidth,900);i++;
XtSetArg(args[i],XmNheight,600);i++;
XtSetValues( toplevel, args,i);
XtManageChild( toplevel);
// Create msgnav
msgnav = new MsgList( this, form, &nav_widget);
msgnav->find_wnav_cb = msgw_find_wnav_cb;
msgnav->find_plc_cb = msgw_find_plc_cb;
// XtManageChild( form_widget);
XtRealizeWidget( parent_wid);
// Connect the window manager close-button to exit
flow_AddCloseVMProtocolCb( parent_wid,
(XtCallbackProc)msg_activate_exit, this);
}
//
// Delete window
//
MsgWindow::~MsgWindow()
{
if ( parent_wid)
XtDestroyWidget( parent_wid);
if ( msgnav)
delete msgnav;
}
void MsgWindow::map()
{
if ( nodraw) {
deferred_map = 1;
return;
}
else
deferred_map = 0;
if ( !displayed)
{
flow_MapWidget( parent_wid);
displayed = 1;
}
else
{
flow_UnmapWidget( parent_wid);
flow_MapWidget( parent_wid);
}
}
void MsgWindow::unmap()
{
if ( displayed)
{
flow_UnmapWidget( parent_wid);
displayed = 0;
}
}
void MsgWindow::reset_nodraw()
{
msgnav->reset_nodraw();
nodraw--;
if ( !nodraw && deferred_map)
map();
}
void MsgWindow::insert( int severity, const char *text, pwr_tOid oid, bool is_plc)
{
if ( size > max_size - 1)
msgnav->set_nodraw();
if ( cdh_ObjidIsNull( oid))
new ItemMsg( msgnav, "", (char *)text, severity, NULL, flow_eDest_Before);
else if ( is_plc)
new ItemMsgObjectPlc( msgnav, "", (char *)text, severity, oid, NULL, flow_eDest_Before);
else
new ItemMsgObject( msgnav, "", (char *)text, severity, oid, NULL, flow_eDest_Before);
if ( size > max_size - 1) {
msgnav->remove_oldest();
msgnav->reset_nodraw();
}
else
size++;
}
static void msg_action_inputfocus( Widget w, XmAnyCallbackStruct *data)
{
Arg args[1];
MsgWindow *msgw;
XtSetArg (args[0], XmNuserData, &msgw);
XtGetValues (w, args, 1);
if ( msgw && msgw->displayed)
msgw->msgnav->set_input_focus();
}
static void msg_activate_exit( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data)
{
flow_UnmapWidget( msgw->parent_wid);
msgw->displayed = 0;
}
static void msg_activate_clear( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data)
{
msgw->msgnav->clear();
msgw->size = 0;
}
static void msg_activate_zoom_in( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data)
{
msgw->msgnav->zoom( 1.2);
}
static void msg_activate_zoom_out( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data)
{
msgw->msgnav->zoom( 5.0/6);
}
static void msg_activate_zoom_reset( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data)
{
msgw->msgnav->unzoom();
}
static void msg_create_form( Widget w, MsgWindow *msgw, XmAnyCallbackStruct *data)
{
msgw->form = w;
}
#ifndef co_msgwindow_h
#define co_msgwindow_h
/* co_msgwindow.h -- Message window
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#ifndef pwr_h
# include "pwr.h"
#endif
#include <Xm/Xm.h>
#if defined __cplusplus
}
#endif
#ifndef co_msglist_h
# include "co_msglist.h"
#endif
#ifndef wb_error_h
# include "wb_error.h"
#endif
typedef enum {
msgw_ePop_No,
msgw_ePop_Yes,
msgw_ePop_Default
} msgw_ePop;
class MsgWindow {
public:
MsgWindow(
void *msg_parent_ctx,
Widget msg_parent_wid,
char *msg_name,
pwr_tStatus *status);
~MsgWindow();
void *parent_ctx;
Widget parent_wid;
char name[80];
Widget toplevel;
Widget form;
Widget nav_widget;
MsgList *msgnav;
int displayed;
int deferred_map;
int nodraw;
int size;
int max_size;
void (*find_wnav_cb)( void *, pwr_tObjid);
void (*find_plc_cb)( void *, pwr_tObjid);
static MsgWindow *default_window;
void map();
void unmap();
int is_mapped() { return displayed;};
void insert( int severity, const char *text, pwr_tOid oid = pwr_cNOid, bool is_plc = false);
void set_nodraw() { msgnav->set_nodraw(); nodraw++;}
void reset_nodraw();
static void set_default( MsgWindow *msgw) { default_window = msgw;}
static void message( int severity, const char *text, msgw_ePop pop = msgw_ePop_Default,
pwr_tOid oid = pwr_cNOid, bool is_plc = false);
static void message( const wb_error& e, const char *text1 = 0, const char *text2 = 0,
pwr_tOid oid = pwr_cNOid, bool is_plc = false);
static void message( int severity, const char *text1, const char *text2, const char *text3 = 0,
pwr_tOid oid = pwr_cNOid, bool is_plc = false);
static void map_default() { if ( default_window) default_window->map();}
static void dset_nodraw() { if ( default_window) default_window->set_nodraw();}
static void dreset_nodraw() { if ( default_window) default_window->reset_nodraw();}
};
#endif
...@@ -38,3 +38,8 @@ cmdmode <Session is in command mode> /error ...@@ -38,3 +38,8 @@ cmdmode <Session is in command mode> /error
dbopen <Database is already open> /error dbopen <Database is already open> /error
co_convert <Error from co_convert> /error co_convert <Error from co_convert> /error
seltomany <Too many objects is selected> /error seltomany <Too many objects is selected> /error
noplc <Object is not a plc object> /error
...@@ -6,9 +6,10 @@ ...@@ -6,9 +6,10 @@
<Description>. */ <Description>. */
#include <stdio.h> #include <stdio.h>
# include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
# include <unistd.h> #include <unistd.h>
#include <map>
#include <Xm/Xm.h> #include <Xm/Xm.h>
#include "flow.h" #include "flow.h"
...@@ -36,6 +37,7 @@ extern "C" { ...@@ -36,6 +37,7 @@ extern "C" {
} }
#include "wb_vsel.h" #include "wb_vsel.h"
#include "co_msgwindow.h"
#include "wb_wtt.h" #include "wb_wtt.h"
#include "wb_env.h" #include "wb_env.h"
...@@ -43,6 +45,7 @@ extern "C" { ...@@ -43,6 +45,7 @@ extern "C" {
#include "wb_vrepwbl.h" #include "wb_vrepwbl.h"
#include "wb_vrepdbs.h" #include "wb_vrepdbs.h"
using namespace std;
/* Fallback resources */ /* Fallback resources */
...@@ -57,6 +60,9 @@ static String fbr[] = { ...@@ -57,6 +60,9 @@ static String fbr[] = {
NULL NULL
}; };
typedef map<pwr_tVid, Wtt*>::iterator wttlist_iterator;
static map<pwr_tVid, Wtt*> wttlist;
static Widget toplevel; static Widget toplevel;
static Widget mainwindow; static Widget mainwindow;
static ldh_tWBContext wbctx; static ldh_tWBContext wbctx;
...@@ -75,6 +81,40 @@ void pwr_wtt_close( void *wttctx); ...@@ -75,6 +81,40 @@ void pwr_wtt_close( void *wttctx);
void pwr_wtt_open_volume( void *wttctx, wb_eType type, char *filename, wow_eFileSelType file_type); void pwr_wtt_open_volume( void *wttctx, wb_eType type, char *filename, wow_eFileSelType file_type);
int pwr_time_to_exit( void *wttctx); int pwr_time_to_exit( void *wttctx);
void wttlist_add( pwr_tStatus *sts, Wtt *wtt, pwr_tVid vid)
{
wttlist_iterator it = wttlist.find( vid);
if ( it == wttlist.end()) {
wttlist[vid] = wtt;
*sts = LDH__SUCCESS;
}
else
*sts = LDH__VOLIDALREXI;
}
void wttlist_remove( pwr_tStatus *sts, Wtt* wtt)
{
for ( wttlist_iterator it = wttlist.begin(); it != wttlist.end(); it++) {
if ( it->second == wtt) {
wttlist.erase( it);
*sts = LDH__SUCCESS;
return;
}
}
*sts = LDH__NOSUCHVOL;
}
void wttlist_find( pwr_tStatus *sts, pwr_tVid vid, Wtt **wtt)
{
wttlist_iterator it = wttlist.find( vid);
if ( it == wttlist.end()) {
*sts = LDH__NOSUCHVOL;
return;
}
*sts = LDH__SUCCESS;
*wtt = it->second;
}
void void
help_error() help_error()
{ {
...@@ -112,14 +152,81 @@ int wb_get_db_id( void) ...@@ -112,14 +152,81 @@ int wb_get_db_id( void)
return sts; return sts;
} }
static void wb_find_wnav_cb( void *ctx, pwr_tOid oid)
{
char title[80];
char projectname[80];
pwr_tStatus sts;
Wtt *wtt;
printf( "Here in find wnav...\n");
wttlist_find( &sts, oid.vid, &wtt);
if ( ODD(sts)) {
printf( "Wtt Found\n");
sts = wtt->find( oid);
wtt->pop();
}
else {
utl_get_projectname( projectname);
strcpy( title, login_prv.username);
strcat( title, " on ");
strcat( title, projectname);
wtt = new Wtt( 0, toplevel, title, "Navigator", wbctx, oid.vid, 0, 0, &sts);
if (ODD(sts)) {
appl_count++;
wtt->close_cb = pwr_wtt_close;
wtt->open_volume_cb = pwr_wtt_open_volume;
wtt->time_to_exit_cb = pwr_time_to_exit;
wttlist_add( &sts, wtt, oid.vid);
sts = wtt->find( oid);
}
}
}
static void wb_find_plc_cb( void *ctx, pwr_tOid oid)
{
printf( "Here in find plc...\n");
char title[80];
char projectname[80];
pwr_tStatus sts;
Wtt *wtt;
printf( "Here in find wnav...\n");
wttlist_find( &sts, oid.vid, &wtt);
if ( ODD(sts)) {
printf( "Wtt Found\n");
sts = wtt->find_plc( oid);
}
else {
utl_get_projectname( projectname);
strcpy( title, login_prv.username);
strcat( title, " on ");
strcat( title, projectname);
wtt = new Wtt( 0, toplevel, title, "Navigator", wbctx, oid.vid, 0, 0, &sts);
if (ODD(sts)) {
appl_count++;
wtt->close_cb = pwr_wtt_close;
wtt->open_volume_cb = pwr_wtt_open_volume;
wtt->time_to_exit_cb = pwr_time_to_exit;
wttlist_add( &sts, wtt, oid.vid);
sts = wtt->find_plc( oid);
}
}
}
void pwr_login_success() void pwr_login_success()
{ {
char title[80]; char title[80];
char systemname[80]; char systemname[80];
char systemgroup[80]; char systemgroup[80];
pwr_tStatus sts; pwr_tStatus sts;
char msg[80];
printf( "-- Successfull login\n"); printf( "-- Successfull login\n");
sprintf( msg, "User %s logged in", login_prv.username);
MsgWindow::message( 'I', msg);
/* Successfull login, start the volume selection */ /* Successfull login, start the volume selection */
...@@ -144,6 +251,8 @@ void pwr_login_success() ...@@ -144,6 +251,8 @@ void pwr_login_success()
void pwr_wtt_close( void *wttctx) void pwr_wtt_close( void *wttctx)
{ {
pwr_tStatus sts;
wttlist_remove( &sts, (Wtt *)wttctx);
appl_count--; appl_count--;
if (appl_count == 0) if (appl_count == 0)
{ {
...@@ -186,7 +295,11 @@ void pwr_wtt_open_volume( void *wttctx, wb_eType type, char *filename, wow_eFile ...@@ -186,7 +295,11 @@ void pwr_wtt_open_volume( void *wttctx, wb_eType type, char *filename, wow_eFile
// Load volume as extern // Load volume as extern
wb_erep *erep = (wb_erep *)(*(wb_env *)wbctx); wb_erep *erep = (wb_erep *)(*(wb_env *)wbctx);
wb_vrepwbl *vrep = new wb_vrepwbl( erep); wb_vrepwbl *vrep = new wb_vrepwbl( erep);
vrep->load( filename); sts = vrep->load( filename);
if ( vrep->vid() == 0) {
delete vrep;
return;
}
erep->addExtern( &sts, vrep); erep->addExtern( &sts, vrep);
// Attach extern volume // Attach extern volume
...@@ -265,6 +378,7 @@ int pwr_vsel_success( void *vselctx, ...@@ -265,6 +378,7 @@ int pwr_vsel_success( void *vselctx,
wtt->close_cb = pwr_wtt_close; wtt->close_cb = pwr_wtt_close;
wtt->open_volume_cb = pwr_wtt_open_volume; wtt->open_volume_cb = pwr_wtt_open_volume;
wtt->time_to_exit_cb = pwr_time_to_exit; wtt->time_to_exit_cb = pwr_time_to_exit;
wttlist_add( &sts, wtt, volume);
} }
else else
sts = status; sts = status;
...@@ -356,6 +470,33 @@ int main( int argc, char *argv[]) ...@@ -356,6 +470,33 @@ int main( int argc, char *argv[])
} }
} }
/* REGISTER WITH MRM HERE. */
MrmInitialize();
toplevel = XtVaAppInitialize (
&app_ctx,
WB_CLASS_NAME,
NULL, 0,
&argc, argv,
fbr,
XtNallowShellResize, True,
XmNmappedWhenManaged, False,
NULL);
uilutil_fetch( &uid_filename_p, 1, 0, 0,
toplevel, "mainwindow", "svn_svn", 0, 0,
&mainwindow, NULL );
XtManageChild(mainwindow);
// Create message window
MsgWindow *msg_window = new MsgWindow( 0, mainwindow, "Workbench messages", &sts);
msg_window->find_wnav_cb = wb_find_wnav_cb;
msg_window->find_plc_cb = wb_find_plc_cb;
MsgWindow::set_default( msg_window);
MsgWindow::message( 'I', "Development environment started");
sts = ldh_OpenWB(&wbctx); sts = ldh_OpenWB(&wbctx);
psts(sts, NULL); psts(sts, NULL);
if (EVEN(sts)) exit(sts); if (EVEN(sts)) exit(sts);
...@@ -398,45 +539,28 @@ int main( int argc, char *argv[]) ...@@ -398,45 +539,28 @@ int main( int argc, char *argv[])
login_display = 1; login_display = 1;
} }
} }
if ( !login_display) {
char msg[80];
/* REGISTER WITH MRM HERE. */ sprintf( msg, "User %s logged in", login_prv.username);
MrmInitialize(); MsgWindow::message( 'I', msg);
strcpy( title, "PROVIEW/R Development "); strcpy( title, "PROVIEW/R Development ");
strcat( title, login_prv.username); strcat( title, login_prv.username);
strcat( title, " on "); strcat( title, " on ");
strcat( title, systemname); strcat( title, systemname);
XtSetArg(args[0],XmNtitle, title);
XtSetValues( toplevel, args, 1);
toplevel = XtVaAppInitialize ( }
&app_ctx,
WB_CLASS_NAME,
NULL, 0,
&argc, argv,
fbr,
XtNallowShellResize, True,
XtNtitle, title,
XmNmappedWhenManaged, False,
NULL);
uilutil_fetch( &uid_filename_p, 1, 0, 0,
toplevel, "mainwindow", "svn_svn", 0, 0,
&mainwindow, NULL );
XtManageChild(mainwindow);
sts = wb_get_db_id(); sts = wb_get_db_id();
psts(sts, NULL); psts(sts, NULL);
if ( sw_projectvolume) { if ( sw_projectvolume) {
#define ldh_cProjectVolume (0 + ((pwr_tVolumeId)254 << 24) + (254 << 16) + (254 << 8) + 253)
Wtt *wtt; Wtt *wtt;
char projectname[80]; char projectname[80];
pwr_tVolumeId volume = ldh_cProjectVolume; pwr_tVolumeId volume = ldh_cDirectoryVolume;
utl_get_projectname( projectname); utl_get_projectname( projectname);
strcpy( title, login_prv.username); strcpy( title, login_prv.username);
strcat( title, " on "); strcat( title, " on ");
...@@ -447,6 +571,7 @@ int main( int argc, char *argv[]) ...@@ -447,6 +571,7 @@ int main( int argc, char *argv[])
wtt->close_cb = pwr_wtt_close; wtt->close_cb = pwr_wtt_close;
wtt->open_volume_cb = pwr_wtt_open_volume; wtt->open_volume_cb = pwr_wtt_open_volume;
wtt->time_to_exit_cb = pwr_time_to_exit; wtt->time_to_exit_cb = pwr_time_to_exit;
wttlist_add( &sts, wtt, volume);
} }
else else
psts(sts, NULL); psts(sts, NULL);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "pwr.h" #include "pwr.h"
#include "wb_erep.h" #include "wb_erep.h"
#include "wb_merep.h" #include "wb_merep.h"
#include "wb_vrepwbl.h" // Should be wb_vrepdbs.h ... #include "wb_vrepwbl.h"
#include "wb_vrepdbs.h" #include "wb_vrepdbs.h"
#include "wb_vrepdb.h" #include "wb_vrepdb.h"
#include "wb_cdrep.h" #include "wb_cdrep.h"
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "wb_adrep.h" #include "wb_adrep.h"
#include "wb_name.h" #include "wb_name.h"
#include "wb_ldh_msg.h" #include "wb_ldh_msg.h"
#include "co_msgwindow.h"
extern "C" { extern "C" {
#include "co_dcli.h" #include "co_dcli.h"
...@@ -419,7 +420,7 @@ void wb_erep::loadCommonMeta( pwr_tStatus *status) ...@@ -419,7 +420,7 @@ void wb_erep::loadCommonMeta( pwr_tStatus *status)
sizeof(vol_array)/sizeof(vol_array[0]), sizeof(vol_array)/sizeof(vol_array[0]),
sizeof(vol_array[0]), 0); sizeof(vol_array[0]), 0);
if ( nr != 2) if ( nr != 2)
cout << "Syntax error in file: " << fname << endl; MsgWindow::message( 'E', "Syntax error in file:", fname);
// Load this volume // Load this volume
cdh_ToLower( vol_array[0], vol_array[0]); cdh_ToLower( vol_array[0], vol_array[0]);
...@@ -427,7 +428,7 @@ void wb_erep::loadCommonMeta( pwr_tStatus *status) ...@@ -427,7 +428,7 @@ void wb_erep::loadCommonMeta( pwr_tStatus *status)
strcat( vname, vol_array[0]); strcat( vname, vol_array[0]);
strcat( vname, ".dbs"); strcat( vname, ".dbs");
cdh_StringToVolumeId( vol_array[1], &vid); cdh_StringToVolumeId( vol_array[1], &vid);
cout << "Loading volume: " << vname << " " << vid << endl; MsgWindow::message( 'I', "Loading volume:", vname);
wb_vrepdbs *vrep = new wb_vrepdbs( this, vname); wb_vrepdbs *vrep = new wb_vrepdbs( this, vname);
try { try {
...@@ -435,7 +436,7 @@ void wb_erep::loadCommonMeta( pwr_tStatus *status) ...@@ -435,7 +436,7 @@ void wb_erep::loadCommonMeta( pwr_tStatus *status)
addDbs( &sts, vrep); addDbs( &sts, vrep);
} }
catch ( wb_error& e) { catch ( wb_error& e) {
cout << "** Unable to open volume " << vname << " " << e.what() << endl; MsgWindow::message( 'E', "Unable to open volume", vname, e.what().c_str());
} }
} }
fpm.close(); fpm.close();
...@@ -583,16 +584,15 @@ void wb_erep::loadLocalWb( pwr_tStatus *rsts) ...@@ -583,16 +584,15 @@ void wb_erep::loadLocalWb( pwr_tStatus *rsts)
addExtern( &sts, vrep); addExtern( &sts, vrep);
else { else {
*rsts = sts; *rsts = sts;
cout << "** Failiure loading local workbench volume" << endl; MsgWindow::message('E', "Failiure loading local workbench volume");
return; return;
} }
} }
catch ( wb_error& e) { catch ( wb_error& e) {
*rsts = e.sts(); *rsts = e.sts();
cout << "** Failiure loading local workbench volume" << endl; MsgWindow::message('E', "Failiure loading local workbench volume");
return ; return;
} }
cout << "-- Local workbench volume loaded" << endl;
} }
*rsts = LDH__SUCCESS; *rsts = LDH__SUCCESS;
} }
......
...@@ -203,6 +203,11 @@ int foe_search_object ( ...@@ -203,6 +203,11 @@ int foe_search_object (
char *searchstr char *searchstr
); );
int foe_center_object (
foe_ctx foectx,
pwr_tOid oid
);
int foe_attr_create ( int foe_attr_create (
foe_ctx foectx, foe_ctx foectx,
vldh_t_node node vldh_t_node node
......
...@@ -1537,6 +1537,7 @@ int foe_new_local( ...@@ -1537,6 +1537,7 @@ int foe_new_local(
on top of the stack ( ie to make is visible ) in any case */ on top of the stack ( ie to make is visible ) in any case */
XtUnmapWidget( foectx->cp.parent_wid ); XtUnmapWidget( foectx->cp.parent_wid );
XtMapWidget( foectx->cp.parent_wid ); XtMapWidget( foectx->cp.parent_wid );
*return_foectx = foectx;
return FOE__WINDEXIST; return FOE__WINDEXIST;
} }
else else
...@@ -2656,6 +2657,42 @@ int foe_search_object ( ...@@ -2656,6 +2657,42 @@ int foe_search_object (
return FOE__SUCCESS; return FOE__SUCCESS;
} }
/*************************************************************************
*
* Name: int foe_center_object()
*
* Type int
*
* Type Parameter IOGF Description
* foe_ctx *foectx I foe context.
* pwr_tOid oid I object to center.
*
* Description:
*
**************************************************************************/
int foe_center_object (
foe_ctx foectx,
pwr_tOid oid
)
{
int sts;
vldh_t_wind wind;
vldh_t_node node;
wind = foectx->grectx->window_object;
sts = vldh_get_node_objdid( oid, wind, &node);
if ( EVEN(sts)) return sts;
gre_unselect( foectx->grectx);
foe_message( foectx, "");
sts = gre_center_node( foectx->grectx, node);
gre_search_rectangle_create( foectx->grectx, node);
return FOE__SUCCESS;
}
/************************************************************************* /*************************************************************************
* *
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "co_dcli.h" #include "co_dcli.h"
#include "co_utl_batch.h" #include "co_utl_batch.h"
#include "co_msg.h" #include "co_msg.h"
#include "co_api.h"
#include "wb_foe_msg.h" #include "wb_foe_msg.h"
#include "wb_vldh_msg.h" #include "wb_vldh_msg.h"
#include "wb_ldh_msg.h" #include "wb_ldh_msg.h"
...@@ -3620,7 +3621,9 @@ static int gcg_error_msg( ...@@ -3620,7 +3621,9 @@ static int gcg_error_msg(
fprintf(logfile, "%s\n", msg); fprintf(logfile, "%s\n", msg);
else else
printf("%s\n", msg); printf("%s\n", msg);
if ( node != 0) if ( node == 0)
msgw_message_sts( sts, 0, 0);
else
{ {
/* Get the full hierarchy name for the node */ /* Get the full hierarchy name for the node */
status = ldh_ObjidToName( status = ldh_ObjidToName(
...@@ -3632,6 +3635,7 @@ static int gcg_error_msg( ...@@ -3632,6 +3635,7 @@ static int gcg_error_msg(
fprintf(logfile, " in object %s\n", hier_name); fprintf(logfile, " in object %s\n", hier_name);
else else
printf(" in object %s\n", hier_name); printf(" in object %s\n", hier_name);
msgw_message_plcobject( sts, " in object", hier_name, node->ln.object_did);
} }
if ( (sts & 2) && !(sts & 1)) if ( (sts & 2) && !(sts & 1))
gcgctx->errorcount++; gcgctx->errorcount++;
...@@ -3678,8 +3682,11 @@ int gcg_wind_msg( ...@@ -3678,8 +3682,11 @@ int gcg_wind_msg(
fprintf(logfile, "%s\n", msg); fprintf(logfile, "%s\n", msg);
else else
printf("%s\n", msg); printf("%s\n", msg);
if ( wind != 0) if ( wind == 0)
{ msgw_message_sts( sts, 0, 0);
else {
char str[80] = "";
/* Get the full hierarchy name for the wind */ /* Get the full hierarchy name for the wind */
status = ldh_ObjidToName( status = ldh_ObjidToName(
wind->hw.ldhsession, wind->hw.ldhsession,
...@@ -3696,6 +3703,7 @@ int gcg_wind_msg( ...@@ -3696,6 +3703,7 @@ int gcg_wind_msg(
fprintf(logfile, "%ld errors ", gcgctx->errorcount); fprintf(logfile, "%ld errors ", gcgctx->errorcount);
else else
printf("%ld errors ", gcgctx->errorcount); printf("%ld errors ", gcgctx->errorcount);
sprintf( &str[strlen(str)], "%ld errors ", gcgctx->errorcount);
} }
if ( gcgctx->warningcount > 0 ) if ( gcgctx->warningcount > 0 )
{ {
...@@ -3703,11 +3711,15 @@ int gcg_wind_msg( ...@@ -3703,11 +3711,15 @@ int gcg_wind_msg(
fprintf(logfile, "%ld warnings ", gcgctx->warningcount); fprintf(logfile, "%ld warnings ", gcgctx->warningcount);
else else
printf("%ld warnings ", gcgctx->warningcount); printf("%ld warnings ", gcgctx->warningcount);
sprintf( &str[strlen(str)], "%ld warnings ", gcgctx->warningcount);
} }
if (logfile != NULL) if (logfile != NULL)
fprintf(logfile, "in window %s\n", hier_name); fprintf(logfile, "in window %s\n", hier_name);
else else
printf("in window %s\n", hier_name); printf("in window %s\n", hier_name);
sprintf( &str[strlen(str)], " in window");
msgw_message_plcobject( sts, str, hier_name, wind->lw.objdid);
} }
return GSX__SUCCESS; return GSX__SUCCESS;
} }
...@@ -5411,6 +5423,8 @@ unsigned long spawn; ...@@ -5411,6 +5423,8 @@ unsigned long spawn;
} }
} }
msgw_set_nodraw();
/* Create a context for the window */ /* Create a context for the window */
gcg_ctx_new( &gcgctx, wind); gcg_ctx_new( &gcgctx, wind);
gcgctx->ldhses = wind->hw.ldhsession; gcgctx->ldhses = wind->hw.ldhsession;
...@@ -5569,6 +5583,8 @@ unsigned long spawn; ...@@ -5569,6 +5583,8 @@ unsigned long spawn;
gcg_wind_msg( gcgctx, GSX__SWINDSUCC, wind); gcg_wind_msg( gcgctx, GSX__SWINDSUCC, wind);
} }
msgw_reset_nodraw();
/* Close the files */ /* Close the files */
for( i = 0; i < GCGM1_MAXFILES; i++ ) for( i = 0; i < GCGM1_MAXFILES; i++ )
IF_PR fclose( gcgctx->files[i]); IF_PR fclose( gcgctx->files[i]);
...@@ -5666,6 +5682,7 @@ unsigned long spawn; ...@@ -5666,6 +5682,7 @@ unsigned long spawn;
classerror: classerror:
/* If error status from ldh */ /* If error status from ldh */
gcg_wind_msg( gcgctx, GSX__CLASSERR, 0); gcg_wind_msg( gcgctx, GSX__CLASSERR, 0);
msgw_reset_nodraw();
/* Revert the session */ /* Revert the session */
ldh_RevertSession( wind->hw.ldhsession); ldh_RevertSession( wind->hw.ldhsession);
......
...@@ -194,6 +194,7 @@ wb_orep* wb_vrepdb::object(pwr_tStatus *sts, pwr_tOid oid) ...@@ -194,6 +194,7 @@ wb_orep* wb_vrepdb::object(pwr_tStatus *sts, pwr_tOid oid)
wb_orep* wb_vrepdb::object(pwr_tStatus *sts, wb_name &name) wb_orep* wb_vrepdb::object(pwr_tStatus *sts, wb_name &name)
{ {
*sts = LDH__NYI;
return 0; return 0;
} }
...@@ -621,6 +622,10 @@ wb_orep *wb_vrepdb::parent(pwr_tStatus *sts, const wb_orep *orp) ...@@ -621,6 +622,10 @@ wb_orep *wb_vrepdb::parent(pwr_tStatus *sts, const wb_orep *orp)
*sts = LDH__SUCCESS; *sts = LDH__SUCCESS;
try { try {
m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).poid()); m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).poid());
if ( m_ohead.oid().oix == 0) {
*sts = LDH__NO_PARENT;
return 0;
}
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} }
catch (DbException &e) { catch (DbException &e) {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "wb_merep.h" #include "wb_merep.h"
#include "wb_tdrep.h" #include "wb_tdrep.h"
#include "wb_ldh_msg.h" #include "wb_ldh_msg.h"
#include "co_msgwindow.h"
extern "C" { extern "C" {
#include "co_dcli.h" #include "co_dcli.h"
...@@ -71,7 +72,10 @@ wb_vrep *wb_vrepwbl::next() ...@@ -71,7 +72,10 @@ wb_vrep *wb_vrepwbl::next()
void wb_vrepwbl::error( const char *msg, const char *file, int line_number) void wb_vrepwbl::error( const char *msg, const char *file, int line_number)
{ {
cout << "Wbl error: " << msg << ", " << file << " line: " << line_number << endl; char str[400];
sprintf( str, "Wbl error: %s, %s line: %d", msg, file, line_number);
MsgWindow::message( 'E', str);
// cout << "Wbl error: " << msg << ", " << file << " line: " << line_number << endl;
error_cnt++; error_cnt++;
} }
...@@ -208,9 +212,14 @@ int wb_vrepwbl::load( const char *fname) ...@@ -208,9 +212,14 @@ int wb_vrepwbl::load( const char *fname)
rsts = LDH__SUCCESS; rsts = LDH__SUCCESS;
MsgWindow::dset_nodraw();
if ( strstr( fname, ".wb_load") != 0) { if ( strstr( fname, ".wb_load") != 0) {
sts = load_files( fname); sts = load_files( fname);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) {
MsgWindow::dreset_nodraw();
return sts;
}
} }
else { else {
// Load all wb_load files in directory // Load all wb_load files in directory
...@@ -264,10 +273,15 @@ int wb_vrepwbl::load( const char *fname) ...@@ -264,10 +273,15 @@ int wb_vrepwbl::load( const char *fname)
root_object->postBuild(); root_object->postBuild();
} }
// info(); // info();
if ( error_cnt) if ( error_cnt) {
cout << "** Errors when loading volume: " << error_cnt << " errors found" << endl; char str[80];
sprintf( str, "Errors when loading volume: %d errors found", error_cnt);
MsgWindow::message( 'F', str);
}
else else
cout << "-- Volume " << volume_name << " loaded" << endl; MsgWindow::message( 'I', "Volume", volume_name, "loaded");
MsgWindow::dreset_nodraw();
// If classvolume, insert itself into its merep // If classvolume, insert itself into its merep
if ( cid() == pwr_eClass_ClassVolume ) { if ( cid() == pwr_eClass_ClassVolume ) {
......
...@@ -42,7 +42,7 @@ extern "C" { ...@@ -42,7 +42,7 @@ extern "C" {
#include "wb_foe_msg.h" #include "wb_foe_msg.h"
#include "wb_ldh_msg.h" #include "wb_ldh_msg.h"
} }
#include "co_msgwindow.h"
#define BEEP putchar( '\7' ); #define BEEP putchar( '\7' );
...@@ -630,6 +630,7 @@ pwr_tStatus WVsel::check_volumelist( ...@@ -630,6 +630,7 @@ pwr_tStatus WVsel::check_volumelist(
int volume_found; int volume_found;
int error_count; int error_count;
int errlen=0; int errlen=0;
int errlen_old = 0;
char errstr[800]; char errstr[800];
error_count = 0; error_count = 0;
...@@ -692,6 +693,8 @@ pwr_tStatus WVsel::check_volumelist( ...@@ -692,6 +693,8 @@ pwr_tStatus WVsel::check_volumelist(
errlen += sprintf( &errstr[errlen], errlen += sprintf( &errstr[errlen],
"** Error, Volume %s is configured with another name '%s'\n", "** Error, Volume %s is configured with another name '%s'\n",
name, volumelist_ptr->volume_name); name, volumelist_ptr->volume_name);
MsgWindow::message( 'E', &errstr[errlen_old], msgw_ePop_No);
errlen_old = errlen;
BEEP; BEEP;
} }
error_count++; error_count++;
...@@ -723,6 +726,8 @@ pwr_tStatus WVsel::check_volumelist( ...@@ -723,6 +726,8 @@ pwr_tStatus WVsel::check_volumelist(
errlen += sprintf( &errstr[errlen], errlen += sprintf( &errstr[errlen],
"** Error, Volume %s is configured with another class '%s'\n", "** Error, Volume %s is configured with another class '%s'\n",
name, volumelist_ptr->p2); name, volumelist_ptr->p2);
MsgWindow::message( 'E', &errstr[errlen_old], msgw_ePop_No);
errlen_old = errlen;
BEEP; BEEP;
} }
error_count++; error_count++;
...@@ -738,6 +743,8 @@ pwr_tStatus WVsel::check_volumelist( ...@@ -738,6 +743,8 @@ pwr_tStatus WVsel::check_volumelist(
errlen += sprintf( &errstr[errlen], errlen += sprintf( &errstr[errlen],
"** Error, Volume %s is not configured in the ProjectVolume\n", "** Error, Volume %s is not configured in the ProjectVolume\n",
name); name);
MsgWindow::message( 'E', &errstr[errlen_old], msgw_ePop_No);
errlen_old = errlen;
BEEP; BEEP;
} }
error_count++; error_count++;
...@@ -754,6 +761,8 @@ pwr_tStatus WVsel::check_volumelist( ...@@ -754,6 +761,8 @@ pwr_tStatus WVsel::check_volumelist(
errlen += sprintf( &errstr[errlen], errlen += sprintf( &errstr[errlen],
"\n %d syntax error%s found\n", "\n %d syntax error%s found\n",
error_count, (error_count == 1) ? "" : "s"); error_count, (error_count == 1) ? "" : "s");
MsgWindow::message( 'E', &errstr[errlen_old], msgw_ePop_No);
errlen_old = errlen;
wow_DisplayError( widgets.vsel_window, "Syntax control", wow_DisplayError( widgets.vsel_window, "Syntax control",
errstr); errstr);
} }
......
...@@ -665,10 +665,12 @@ void WNav::set_inputfocus( int focus) ...@@ -665,10 +665,12 @@ void WNav::set_inputfocus( int focus)
} }
else else
{ {
if ( flow_IsViewable( brow_widget)) {
XtCallAcceptFocus( brow_widget, CurrentTime); XtCallAcceptFocus( brow_widget, CurrentTime);
XtSetArg(args[0], XmNborderColor, fg); XtSetArg(args[0], XmNborderColor, fg);
XtSetValues( form_widget, args, 1); XtSetValues( form_widget, args, 1);
} }
}
} }
// //
...@@ -1057,7 +1059,7 @@ int WNav::open_plc() ...@@ -1057,7 +1059,7 @@ int WNav::open_plc()
if ( classid == pwr_cClass_plc) if ( classid == pwr_cClass_plc)
sts = wnav_foe_new( (void *)parent_ctx, parent_wid, "PlcProgram1", sts = wnav_foe_new( (void *)parent_ctx, parent_wid, "PlcProgram1",
item->objid, wbctx, ldhses, item->objid, wbctx, ldhses,
&foectx, 1, ldh_eAccess_ReadOnly); &foectx, 1, ldh_eAccess_ReadOnly, pwr_cNOid);
break; break;
default: default:
sts = 0; sts = 0;
...@@ -1065,6 +1067,37 @@ int WNav::open_plc() ...@@ -1065,6 +1067,37 @@ int WNav::open_plc()
return sts; return sts;
} }
//
// Open plc for specified object
//
int WNav::open_plc( pwr_tOid oid)
{
pwr_tCid cid;
int sts = WNAV__SUCCESS;
void *foectx;
pwr_tOid plc;
bool found;
plc = oid;
while ( ODD(sts)) {
sts = ldh_GetObjectClass( ldhses, plc, &cid);
if ( EVEN(sts)) return sts;
if ( cid == pwr_cClass_plc) {
found = true;
break;
}
sts = ldh_GetParent( ldhses, plc, &plc);
}
if ( !found)
return WNAV__NOPLC;
sts = wnav_foe_new( (void *)parent_ctx, parent_wid, "PlcProgram1",
plc, wbctx, ldhses,
&foectx, 1, ldh_eAccess_ReadOnly, oid);
return sts;
}
// //
// Convert type_id to name // Convert type_id to name
......
...@@ -301,6 +301,7 @@ class WNav { ...@@ -301,6 +301,7 @@ class WNav {
int menu_tree_delete( char *name); int menu_tree_delete( char *name);
void pop(); void pop();
int open_plc(); int open_plc();
int open_plc( pwr_tOid oid);
int is_editmode() { return editmode;}; int is_editmode() { return editmode;};
void set_editmode( int value); void set_editmode( int value);
int volume_attached( ldh_tSesContext ldhsession, int pop); int volume_attached( ldh_tSesContext ldhsession, int pop);
......
...@@ -65,6 +65,7 @@ extern "C" { ...@@ -65,6 +65,7 @@ extern "C" {
#include "wb_wnav_msg.h" #include "wb_wnav_msg.h"
#include "wb_volume.h" #include "wb_volume.h"
#include "wb_env.h" #include "wb_env.h"
#include "co_msgwindow.h"
#define MESSAGE_RETURN_STS(sts)\ #define MESSAGE_RETURN_STS(sts)\
...@@ -2148,6 +2149,11 @@ static void wtt_activate_twowindows( Widget w, Wtt *wtt, XmAnyCallbackStruct *da ...@@ -2148,6 +2149,11 @@ static void wtt_activate_twowindows( Widget w, Wtt *wtt, XmAnyCallbackStruct *da
wtt->set_twowindows( !wtt->twowindows, 0, 0); wtt->set_twowindows( !wtt->twowindows, 0, 0);
} }
static void wtt_activate_messages( Widget w, Wtt *wtt, XmAnyCallbackStruct *data)
{
MsgWindow::map_default();
}
static void wtt_activate_view( Widget w, Wtt *wtt, XmAnyCallbackStruct *data) static void wtt_activate_view( Widget w, Wtt *wtt, XmAnyCallbackStruct *data)
{ {
wtt->update_options_form(); wtt->update_options_form();
...@@ -3275,6 +3281,7 @@ Wtt::Wtt( ...@@ -3275,6 +3281,7 @@ Wtt::Wtt(
{"wtt_activate_zoom_out",(caddr_t)wtt_activate_zoom_out }, {"wtt_activate_zoom_out",(caddr_t)wtt_activate_zoom_out },
{"wtt_activate_zoom_reset",(caddr_t)wtt_activate_zoom_reset }, {"wtt_activate_zoom_reset",(caddr_t)wtt_activate_zoom_reset },
{"wtt_activate_twowindows",(caddr_t)wtt_activate_twowindows }, {"wtt_activate_twowindows",(caddr_t)wtt_activate_twowindows },
{"wtt_activate_messages",(caddr_t)wtt_activate_messages },
{"wtt_activate_view",(caddr_t)wtt_activate_view }, {"wtt_activate_view",(caddr_t)wtt_activate_view },
{"wtt_activate_savesettings",(caddr_t)wtt_activate_savesettings }, {"wtt_activate_savesettings",(caddr_t)wtt_activate_savesettings },
{"wtt_activate_restoresettings",(caddr_t)wtt_activate_restoresettings }, {"wtt_activate_restoresettings",(caddr_t)wtt_activate_restoresettings },
...@@ -3577,6 +3584,41 @@ Wtt::~Wtt() ...@@ -3577,6 +3584,41 @@ Wtt::~Wtt()
XtDestroyWidget( toplevel); XtDestroyWidget( toplevel);
} }
void Wtt::pop()
{
flow_UnmapWidget( toplevel);
flow_MapWidget( toplevel);
}
int Wtt::find( pwr_tOid oid)
{
pwr_tStatus sts;
sts = wnav->display_object( oid);
if ( ODD(sts)) {
if ( !wnav_mapped)
set_twowindows( 1, 0, 0);
return WNAV__SUCCESS;
}
else {
sts = wnavnode->display_object( oid);
if ( ODD(sts)) {
if ( !wnavnode_mapped)
set_twowindows( 1, 0, 0);
return WNAV__SUCCESS;
}
}
return sts;
}
int Wtt::find_plc( pwr_tOid oid)
{
if ( !focused_wnav)
set_focus_default();
pwr_tStatus sts = focused_wnav->open_plc( oid);
return sts;
}
WttApplListElem::WttApplListElem( wb_eUtility al_type, void *al_ctx, WttApplListElem::WttApplListElem( wb_eUtility al_type, void *al_ctx,
pwr_tObjid al_objid, char *al_name): pwr_tObjid al_objid, char *al_name):
type(al_type), ctx(al_ctx), objid(al_objid), next(NULL) type(al_type), ctx(al_ctx), objid(al_objid), next(NULL)
......
...@@ -246,6 +246,9 @@ class Wtt { ...@@ -246,6 +246,9 @@ class Wtt {
int get_select_first( pwr_sAttrRef *attrref, int *is_attr); int get_select_first( pwr_sAttrRef *attrref, int *is_attr);
void register_utility( void *ctx, wb_eUtility utility); void register_utility( void *ctx, wb_eUtility utility);
void set_focus_default(); void set_focus_default();
void pop();
int find( pwr_tOid oid);
int find_plc( pwr_tOid oid);
~Wtt(); ~Wtt();
}; };
......
...@@ -18,9 +18,11 @@ int wnav_foe_new( ...@@ -18,9 +18,11 @@ int wnav_foe_new(
ldh_tSesContext ldhsesctx, ldh_tSesContext ldhsesctx,
void **return_foectx, void **return_foectx,
int map_window, int map_window,
ldh_eAccess access) ldh_eAccess access,
pwr_tOid oid)
{ {
return foe_new( int sts;
sts = foe_new(
parent_ctx, parent_ctx,
parent_wid, parent_wid,
name, name,
...@@ -30,5 +32,7 @@ int wnav_foe_new( ...@@ -30,5 +32,7 @@ int wnav_foe_new(
(foe_ctx *)return_foectx, (foe_ctx *)return_foectx,
map_window, map_window,
access); access);
if ( ODD(sts) && cdh_ObjidIsNotNull(oid))
foe_center_object( *return_foectx, oid);
} }
...@@ -9,4 +9,5 @@ int wnav_foe_new( ...@@ -9,4 +9,5 @@ int wnav_foe_new(
ldh_tSesContext ldhsesctx, ldh_tSesContext ldhsesctx,
void **return_foectx, void **return_foectx,
int map_window, int map_window,
ldh_eAccess access); ldh_eAccess access,
pwr_tOid oid);
...@@ -45,6 +45,7 @@ procedure ...@@ -45,6 +45,7 @@ procedure
wtt_activate_createboot(integer); wtt_activate_createboot(integer);
wtt_activate_distribute(integer); wtt_activate_distribute(integer);
wtt_activate_twowindows(integer); wtt_activate_twowindows(integer);
wtt_activate_messages(integer);
wtt_activate_openplc(integer); wtt_activate_openplc(integer);
wtt_activate_compile(integer); wtt_activate_compile(integer);
wtt_activate_showcrossref(integer); wtt_activate_showcrossref(integer);
...@@ -881,6 +882,21 @@ object view_entry : XmCascadeButton ...@@ -881,6 +882,21 @@ object view_entry : XmCascadeButton
XmNactivateCallback = procedure wtt_activate_twowindows(wtt_ctx); XmNactivateCallback = procedure wtt_activate_twowindows(wtt_ctx);
}; };
}; };
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Messages");
XmNmnemonic = keysym('M');
!XmNaccelerator = "Ctrl<Key>W";
!XmNacceleratorText = compound_string('Ctrl+W');
XmNfontList = menu_font;
};
callbacks
{
XmNactivateCallback = procedure wtt_activate_messages(wtt_ctx);
};
};
}; };
}; };
}; };
......
...@@ -79,3 +79,11 @@ Window flow_Window( Widget w) ...@@ -79,3 +79,11 @@ Window flow_Window( Widget w)
return XtWindow(w); return XtWindow(w);
} }
int flow_IsViewable( Widget w)
{
XWindowAttributes xwa;
if ( XGetWindowAttributes( XtDisplay(w), XtWindow(w), &xwa) &&
xwa.map_state == IsViewable)
return 1;
return 0;
}
...@@ -25,6 +25,7 @@ void flow_MapWidget( Widget w); ...@@ -25,6 +25,7 @@ void flow_MapWidget( Widget w);
Screen *flow_Screen( Widget w); Screen *flow_Screen( Widget w);
Display *flow_Display( Widget w); Display *flow_Display( Widget w);
Window flow_Window( Widget w); Window flow_Window( Widget w);
int flow_IsViewable( Widget w);
#if defined __cplusplus #if defined __cplusplus
} }
......
...@@ -254,7 +254,7 @@ void EvListBrow::create_nodeclasses() ...@@ -254,7 +254,7 @@ void EvListBrow::create_nodeclasses()
brow_CreateNodeClass( ctx, "Info", brow_CreateNodeClass( ctx, "Info",
flow_eNodeGroup_Common, &nc_info); flow_eNodeGroup_Common, &nc_info);
brow_AddFrame( nc_info, 0, 0, 35, 0.8, flow_eDrawType_Line, -1, 1); brow_AddFrame( nc_info, 0, 0, 35, 0.8, flow_eDrawType_Line, -1, 1);
brow_AddFilledRect( nc_info, 0.15, 0.1, 0.4, 0.4, flow_eDrawType_Green); brow_AddFilledRect( nc_info, 0.2, 0.15, 0.4, 0.4, flow_eDrawType_Green);
brow_AddRect( nc_info, 0.2, 0.15, 0.4, 0.4, flow_eDrawType_Line, 0, 0); brow_AddRect( nc_info, 0.2, 0.15, 0.4, 0.4, flow_eDrawType_Line, 0, 0);
brow_AddAnnot( nc_info, 0.8, 0.6, 0, brow_AddAnnot( nc_info, 0.8, 0.6, 0,
flow_eDrawType_TextHelveticaBold, 2, flow_eAnnotType_OneLine, flow_eDrawType_TextHelveticaBold, 2, flow_eAnnotType_OneLine,
......
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