Commit 60ddd53d authored by claes's avatar claes

Connect function via X selection implemented

parent 0a7e2802
......@@ -156,6 +156,7 @@ struct s_foe_ctx
struct s_widgets widgets ;
int set_focus_disabled;
XtIntervalId focus_timerid;
Atom objid_atom;
};
/* Methods */
......
......@@ -2201,6 +2201,7 @@ static foe_ctx foe_create_window(
(XtCallbackProc)foe_activate_quit, foectx);
}
wow_GetAtoms( foectx->cp.parent_wid, 0, &foectx->objid_atom, 0);
/* SG 09.02.91 a top level should always be realized !
* ML 16.03.94 changed Realize to Popup
......
......@@ -25,6 +25,7 @@
#include "wb_gre.h"
#include "wb_gobj.h"
#include "wb_api.h"
#include "co_wow.h"
#include "pwr_baseclasses.h"
#define BEEP putchar( '\7' );
......@@ -98,6 +99,51 @@ static int gobj_expand_m2( foe_ctx foectx,
int compress);
/*_Local procedues_______________________________________________________*/
static int gobj_get_select( foe_ctx foectx, pwr_sAttrRef *attrref, int *is_attr)
{
pwr_tStatus sts;
char str[200];
vldh_t_plc plc = foectx->grectx->window_object->hw.plcobject_pointer;
if ( foectx->nav_palette_managed) {
sts = nav_get_select( foectx->navctx, attrref, is_attr);
if ( ODD(sts))
return sts;
}
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, attrref,
is_attr);
if ( ODD(sts))
return sts;
sts = wow_GetSelection( foectx->cp.parent_wid, str, sizeof(str), foectx->objid_atom);
if ( ODD(sts)) {
sts = ldh_NameToAttrRef( foectx->grectx->window_object->hw.ldhsession, str, attrref);
if ( ODD(sts)) {
if ( strchr( str, '.') != 0)
*is_attr = 1;
else
*is_attr = 0;
}
return sts;
}
else {
sts = wow_GetSelection( foectx->cp.parent_wid, str, sizeof(str), XA_STRING);
if ( ODD(sts)) {
sts = ldh_NameToAttrRef( foectx->grectx->window_object->hw.ldhsession, str, attrref);
if ( ODD(sts)) {
if ( strchr( str, '.') != 0)
*is_attr = 1;
else
*is_attr = 0;
}
return sts;
}
}
return sts;
}
/*************************************************************************
*
......@@ -214,23 +260,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select a di object in the navigator");
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select a Di object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is a di object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -292,23 +329,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select a do object in the navigator");
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select a Do object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is a do object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -370,23 +398,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select a dv object in the navigator");
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select a Dv object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is a dv object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -447,23 +466,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select an ai object in the navigator");
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an Ai object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is a ai object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -524,23 +534,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select an ao object in the navigator");
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an Ao object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is an ao object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -601,23 +602,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select an av object in the navigator");
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an Av object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is an av object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -685,31 +677,20 @@ unsigned long index;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
parameter_found = 0;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an object in the navigator");
BEEP;
return sts;
}
objdid = attrref.Objid;
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
if ( (s = strrchr( name, '.')) != 0)
{
if ( (s = strrchr( name, '.')) != 0) {
strcpy( parameter, s+1);
parameter_found = 1;
}
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select an object in the navigator");
BEEP;
return sts;
}
}
/* Get a parameter of pwr_etype_ObjDId */
sts = ldh_GetObjectBodyDef( ldhses,
......@@ -800,23 +781,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select a di, do or dv object in the navigator");
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select a Di, Do or Dv object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is a di,do or dv object */
......@@ -881,23 +853,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select a co object in the navigator");
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select a Co object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is a co object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -959,23 +922,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select a do object in the navigator");
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select a Do object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is a do object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -1066,23 +1020,13 @@ unsigned long index;
( node_count == 0) )
{
/* Take the orderobject from the navigator */
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an order object in the navigator or in the current window");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
}
else if ( (node_count == 2) &&
(( *nodelist == node) || ( *(nodelist + 1) == node)))
......@@ -1199,24 +1143,14 @@ unsigned long index;
if ( ((node_count == 1) && (*nodelist == node)) ||
( node_count == 0) )
{
/* Take the orderobject from the navigator */
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
/* Take the document from the navigator */
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select a document object in the navigator or in the current window first");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
}
else if ( (node_count == 2) &&
(( *nodelist == node) || ( *(nodelist + 1) == node)))
......@@ -1328,23 +1262,13 @@ unsigned long index;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Take the object from the navigator */
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
/* Set the parameter value */
sts = ldh_SetObjectPar( ldhses,
......@@ -1415,28 +1339,14 @@ unsigned long index;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
parameter_found = 0;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
if ( is_attr)
{
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
if ( (s = strrchr( name, '.')) != 0)
{
strcpy( parameter, s+1);
parameter_found = 1;
}
}
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an digital signal in the navigator");
BEEP;
return sts;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( ODD(sts) && is_attr) {
if ( is_attr) {
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
......@@ -1445,12 +1355,6 @@ unsigned long index;
parameter_found = 1;
}
}
if ( EVEN(sts)) {
foe_message( foectx,"Select an digital signal in the navigator");
BEEP;
return sts;
}
}
/* Change the object to a matching get-type */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -1710,28 +1614,14 @@ unsigned long index;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
parameter_found = 0;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
if ( is_attr)
{
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
if ( (s = strrchr( name, '.')) != 0)
{
strcpy( parameter, s+1);
parameter_found = 1;
}
}
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an digital signal in the navigator");
BEEP;
return sts;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( ODD(sts) && is_attr) {
if ( is_attr) {
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
......@@ -1740,13 +1630,6 @@ unsigned long index;
parameter_found = 1;
}
}
if ( EVEN(sts))
{
foe_message( foectx,"Select an digital signal in the navigator");
BEEP;
return sts;
}
}
/* Change the object to a matching get-type */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -1996,28 +1879,14 @@ unsigned long index;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
parameter_found = 0;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
if ( is_attr)
{
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
if ( (s = strrchr( name, '.')) != 0)
{
strcpy( parameter, s+1);
parameter_found = 1;
}
}
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an digital signal in the navigator");
BEEP;
return sts;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( ODD(sts) && is_attr) {
if ( is_attr) {
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
......@@ -2026,13 +1895,6 @@ unsigned long index;
parameter_found = 1;
}
}
if ( EVEN(sts))
{
foe_message( foectx,"Select an digital signal in the navigator");
BEEP;
return sts;
}
}
/* Change the object to a matching get-type */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -2291,28 +2153,14 @@ unsigned long index;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
parameter_found = 0;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
if ( is_attr)
{
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
if ( (s = strrchr( name, '.')) != 0)
{
strcpy( parameter, s+1);
parameter_found = 1;
}
}
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an digital signal in the navigator");
BEEP;
return sts;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( ODD(sts) && is_attr) {
if ( is_attr) {
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
......@@ -2321,13 +2169,6 @@ unsigned long index;
parameter_found = 1;
}
}
if ( EVEN(sts))
{
foe_message( foectx,"Select an digital signal in the navigator");
BEEP;
return sts;
}
}
/* Change the object to a matching get-type */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -2556,23 +2397,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( EVEN(sts))
{
foe_message( foectx,"Select a sv object in the navigator");
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select Sv object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is an av object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -2653,28 +2485,14 @@ unsigned long index;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
parameter_found = 0;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
if ( is_attr)
{
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
if ( (s = strrchr( name, '.')) != 0)
{
strcpy( parameter, s+1);
parameter_found = 1;
}
}
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select string value in the navigator");
BEEP;
return sts;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( ODD(sts) && is_attr) {
if ( is_attr) {
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
......@@ -2683,13 +2501,6 @@ unsigned long index;
parameter_found = 1;
}
}
if ( EVEN(sts))
{
foe_message( foectx,"Select a string value in the navigator");
BEEP;
return sts;
}
}
/* Change the object to a matching get-type */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -2926,28 +2737,14 @@ unsigned long index;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
parameter_found = 0;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
if ( is_attr)
{
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
if ( (s = strrchr( name, '.')) != 0)
{
strcpy( parameter, s+1);
parameter_found = 1;
}
}
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select a string value in the navigator");
BEEP;
return sts;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( ODD(sts) && is_attr) {
if ( is_attr) {
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
......@@ -2956,13 +2753,6 @@ unsigned long index;
parameter_found = 1;
}
}
if ( EVEN(sts))
{
foe_message( foectx,"Select an digital signal in the navigator");
BEEP;
return sts;
}
}
/* Change the object to a matching get-type */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -3178,20 +2968,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts)) {
objdid = attrref.Objid;
}
else {
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an iv object in the navigator");
foe_message( foectx,"Select an Iv object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is an iv object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -3251,20 +3035,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts)) {
objdid = attrref.Objid;
}
else {
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an Ii object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is an ii object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -3324,20 +3102,14 @@ unsigned long index;
/* Get the selected object in the navigator */
plc = (node->hn.window_pointer)->hw.plcobject_pointer;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts)) {
objdid = attrref.Objid;
}
else {
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an Io object in the navigator");
BEEP;
return sts;
}
}
objdid = attrref.Objid;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
/* Check that the objdid is an io object */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -3416,28 +3188,14 @@ unsigned long index;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
parameter_found = 0;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
if ( is_attr)
{
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
if ( (s = strrchr( name, '.')) != 0)
{
strcpy( parameter, s+1);
parameter_found = 1;
}
}
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an integer signal in the navigator");
BEEP;
return sts;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( ODD(sts) && is_attr) {
if ( is_attr) {
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
......@@ -3446,13 +3204,6 @@ unsigned long index;
parameter_found = 1;
}
}
if ( EVEN(sts))
{
foe_message( foectx,"Select an integer signal in the navigator");
BEEP;
return sts;
}
}
/* Change the object to a matching get-type */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......@@ -3706,28 +3457,14 @@ unsigned long index;
ldhses =(node->hn.window_pointer)->hw.ldhsession;
parameter_found = 0;
sts = nav_get_select( foectx->navctx, &attrref, &is_attr);
if ( foectx->nav_palette_managed && ODD(sts))
{
objdid = attrref.Objid;
if ( is_attr)
{
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
if ( (s = strrchr( name, '.')) != 0)
{
strcpy( parameter, s+1);
parameter_found = 1;
}
}
sts = gobj_get_select( foectx, &attrref, &is_attr);
if ( EVEN(sts)) {
foe_message( foectx,"Select an integer signal in the navigator");
BEEP;
return sts;
}
else
{
sts = wtt_get_select_first( (wtt_tCtx)plc->hp.hinactx, &attrref,
&is_attr);
objdid = attrref.Objid;
if ( ODD(sts) && is_attr) {
if ( is_attr) {
sts = ldh_AttrRefToName( ldhses, &attrref, ldh_eName_ArefVol,
&name, &size);
if ( EVEN(sts)) return sts;
......@@ -3736,13 +3473,6 @@ unsigned long index;
parameter_found = 1;
}
}
if ( EVEN(sts))
{
foe_message( foectx,"Select an digital signal in the navigator");
BEEP;
return sts;
}
}
/* Change the object to a matching get-type */
sts = ldh_GetObjectClass( ldhses, objdid, &class);
......
......@@ -43,6 +43,7 @@ extern "C" {
#include "wb_wnav.h"
#include "wb_wnav_brow.h"
#include "wb_wnav_item.h"
#include "co_wow.h"
static char null_str[] = "";
......@@ -82,6 +83,7 @@ WAttNav::WAttNav(
wattnav_init_brow_cb, this, (Widget *)&brow_widget);
XtManageChild( form_widget);
wow_GetAtoms( form_widget, 0, &objid_atom, 0);
// Create the root item
*w = form_widget;
......@@ -564,6 +566,35 @@ static int wattnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
;
}
break;
case flow_eEvent_MB1DoubleClickCtrl:
switch ( event->object.object_type)
{
case flow_eObjectType_Node:
brow_GetUserData( event->object.object, (void **)&item);
switch( item->type) {
case wnav_eItemType_Attr:
case wnav_eItemType_AttrArrayElem: {
WItemBaseAttr *item_attr = (WItemBaseAttr *)item;
char str[200];
int sts;
if ( item_attr->type_id == pwr_eType_Objid) {
sts = wow_GetSelection( wattnav->form_widget, str, sizeof(str), wattnav->objid_atom);
if ( EVEN(sts))
sts = wow_GetSelection( wattnav->form_widget, str, sizeof(str), XA_STRING);
}
if ( ODD(sts))
wattnav->set_attr_value( item_attr->node, item_attr->attr, str);
break;
}
default:
;
}
break;
default:
;
}
break;
case flow_eEvent_Radiobutton:
{
switch ( event->object.object_type)
......@@ -833,6 +864,8 @@ void WAttNav::enable_events()
wattnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_MB1DoubleClick, flow_eEventType_CallBack,
wattnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_MB1DoubleClickCtrl, flow_eEventType_CallBack,
wattnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_SelectClear, flow_eEventType_CallBack,
wattnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_ObjectDeleted, flow_eEventType_CallBack,
......
......@@ -70,6 +70,7 @@ class WAttNav {
void (*change_value_cb)( void *);
wb_eUtility utility;
int displayed;
Atom objid_atom;
void start_trace( pwr_tObjid Objid, char *object_str);
int set_attr_value( brow_tObject node, char *name, char *value_str);
......
......@@ -113,7 +113,12 @@ int wnav_attr_string_to_value( ldh_tSesContext ldhses, int type_id, char *value
}
case pwr_eType_Char:
{
if ( sscanf( value_str, "%c", (char *)buffer_ptr) != 1)
pwr_tChar c;
if ( strcmp( value_str, "") == 0) {
c = '\0';
memcpy( buffer_ptr, &c, sizeof(c));
}
else if ( sscanf( value_str, "%c", (char *)buffer_ptr) != 1)
return WNAV__INPUT_SYNTAX;
break;
}
......@@ -181,12 +186,16 @@ int wnav_attr_string_to_value( ldh_tSesContext ldhses, int type_id, char *value
strncpy( (char *)buffer_ptr, value_str, min(attr_size, buff_size));
break;
}
case pwr_eType_ObjDId:
case pwr_eType_Objid:
{
pwr_tObjid objid;
if ( strcmp( value_str, "") == 0)
objid = pwr_cNObjid;
else {
sts = ldh_NameToObjid ( ldhses, &objid, value_str);
if (EVEN(sts)) return WNAV__OBJNOTFOUND;
}
memcpy( buffer_ptr, &objid, sizeof(objid));
break;
}
......@@ -365,9 +374,16 @@ void wnav_attrvalue_to_string( ldh_tSesContext ldhses, int type_id, void *value
}
case pwr_eType_Objid:
{
ldh_sVolumeInfo info;
ldh_GetVolumeInfo( ldh_SessionToVol( ldhses), &info);
objid = *(pwr_tObjid *)value_ptr;
if ( objid.vid == info.Volume)
sts = ldh_ObjidToName( ldhses, objid, ldh_eName_Hierarchy,
str, sizeof(str), len);
else
sts = ldh_ObjidToName( ldhses, objid, ldh_eName_VolPath,
str, sizeof(str), len);
if (EVEN(sts))
{
strcpy( str, "");
......@@ -379,9 +395,15 @@ void wnav_attrvalue_to_string( ldh_tSesContext ldhses, int type_id, void *value
case pwr_eType_AttrRef:
{
char *name_p;
ldh_sVolumeInfo info;
ldh_GetVolumeInfo( ldh_SessionToVol( ldhses), &info);
attrref = (pwr_sAttrRef *) value_ptr;
if ( attrref->Objid.vid == info.Volume)
sts = ldh_AttrRefToName( ldhses, attrref, ldh_eName_Aref, &name_p, len);
else
sts = ldh_AttrRefToName( ldhses, attrref, ldh_eName_ArefVol, &name_p, len);
if (EVEN(sts))
{
strcpy( str, "");
......@@ -586,6 +608,7 @@ WNav::WNav(
// Create the root item
*w = form_widget;
wow_GetAtoms( form_widget, &graph_atom, &objid_atom, &attrref_atom);
gbl.load_config( this);
if ( root_menu && !ldhses)
......@@ -1154,7 +1177,9 @@ static int wnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
if ( wnav->closing_down)
return 1;
if ( event->event != flow_eEvent_ObjectDeleted)
wnav->message( ' ', null_str);
switch ( event->event)
{
case flow_eEvent_Key_Up:
......@@ -1594,6 +1619,52 @@ static int wnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
;
}
break;
case flow_eEvent_MB1DoubleClickCtrl:
switch ( event->object.object_type) {
case flow_eObjectType_Node:
brow_GetUserData( event->object.object, (void **)&item);
switch( item->type) {
case wnav_eItemType_Attr:
case wnav_eItemType_AttrArrayElem: {
WItemBaseAttr *item_attr = (WItemBaseAttr *)item;
pwr_sAttrRef *sel_list;
int *sel_is_attr;
int sel_cnt = 0;
char str[200];
int size;
if ( item_attr->type_id == pwr_eType_Objid) {
if ( wnav->get_global_select_cb)
sts = (wnav->get_global_select_cb)( wnav->parent_ctx, &sel_list,
&sel_is_attr, &sel_cnt);
if ( sel_cnt > 1) {
wnav->message( 'E', "Select one object");
break;
}
else if ( sel_cnt) {
sts = ldh_ObjidToName( wnav->ldhses, sel_list[0].Objid, ldh_eName_VolPath, str,
sizeof(str), &size);
if ( EVEN(sts)) return sts;
}
else {
sts = wow_GetSelection( wnav->form_widget, str, sizeof(str), wnav->objid_atom);
if ( EVEN(sts))
sts = wow_GetSelection( wnav->form_widget, str, sizeof(str), XA_STRING);
}
if ( ODD(sts))
wnav->set_attr_value( item_attr->node, item_attr->objid, str);
break;
}
}
default:
;
}
break;
default:
;
}
break;
case flow_eEvent_MB1Click:
{
// Select
......@@ -1702,6 +1773,11 @@ static int wnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
brow_SetSelectInverse( wnav->brow->ctx);
break;
case flow_eEvent_MB3Down:
{
brow_SetClickSensitivity( wnav->brow->ctx, flow_mSensitivity_MB3Press);
break;
}
case flow_eEvent_MB3Press:
{
// Popup menu
......@@ -3018,7 +3094,7 @@ void WNav::enable_events( WNavBrow *brow)
wnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_MB1DoubleClick, flow_eEventType_CallBack,
wnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_MB1DoubleClickShiftCtrl, flow_eEventType_CallBack,
brow_EnableEvent( brow->ctx, flow_eEvent_MB1DoubleClickCtrl, flow_eEventType_CallBack,
wnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_MB1Click, flow_eEventType_CallBack,
wnav_brow_cb);
......@@ -3066,6 +3142,8 @@ void WNav::enable_events( WNavBrow *brow)
wnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_MB3Press, flow_eEventType_CallBack,
wnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_MB3Down, flow_eEventType_CallBack,
wnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_Map, flow_eEventType_CallBack,
wnav_brow_cb);
brow_EnableEvent( brow->ctx, flow_eEvent_Radiobutton, flow_eEventType_CallBack,
......@@ -3153,10 +3231,24 @@ static Boolean wnav_sel_convert_cb(
if (*target == XA_STRING ||
*target == XA_TEXT(flow_Display(wnav->brow_widget)) ||
*target == XA_COMPOUND_TEXT(flow_Display(wnav->brow_widget)))
*target == XA_COMPOUND_TEXT(flow_Display(wnav->brow_widget)) ||
*target == wnav->graph_atom ||
*target == wnav->objid_atom ||
*target == wnav->attrref_atom)
{
brow_tNode *node_list;
int node_count;
wnav_eSelectionFormat format;
if ( *target == wnav->graph_atom)
format = wnav_eSelectionFormat_Graph;
else if ( *target == wnav->objid_atom)
format = wnav_eSelectionFormat_Objid;
else if ( *target == wnav->attrref_atom)
format = wnav_eSelectionFormat_Attrref;
else
format = wnav_eSelectionFormat_User;
brow_GetSelectedNodes( wnav->brow->ctx, &node_list, &node_count);
if ( !node_count)
......@@ -3179,7 +3271,7 @@ static Boolean wnav_sel_convert_cb(
sts = ldh_NameToAttrRef( wnav->ldhses, attr_str, &attrref);
if ( EVEN(sts)) return FALSE;
sts = (wnav->format_selection_cb)( wnav->parent_ctx, attrref,
value_return, length_return, 0, 1);
value_return, length_return, 0, 1, format);
if ( !sts) return FALSE;
// sts = ldh_AttrRefToName( wnav->ldhses, &attrref, ldh_eName_Aref,
// &name_p, &size);
......@@ -3190,7 +3282,7 @@ static Boolean wnav_sel_convert_cb(
memset( &attrref, 0, sizeof(attrref));
attrref.Objid = item->objid;
sts = (wnav->format_selection_cb)( wnav->parent_ctx, attrref,
value_return, length_return, 0, 0);
value_return, length_return, 0, 0, format);
if ( !sts) return FALSE;
break;
default:
......@@ -3200,7 +3292,10 @@ static Boolean wnav_sel_convert_cb(
}
free( node_list);
if ( *target == XA_COMPOUND_TEXT(flow_Display(wnav->brow_widget)))
if ( *target == XA_COMPOUND_TEXT(flow_Display(wnav->brow_widget)) ||
*target == wnav->graph_atom ||
*target == wnav->objid_atom ||
*target == wnav->attrref_atom)
*type_return = *target;
else
*type_return = XA_STRING;
......
......@@ -59,6 +59,13 @@ extern "C" {
#define wnav_cSymbolFile "pwrp_login:wtt_symbols.pwr_com"
#define WNAV_BROW_MAX 25
typedef enum {
wnav_eSelectionFormat_User,
wnav_eSelectionFormat_Graph,
wnav_eSelectionFormat_Objid,
wnav_eSelectionFormat_Attrref
} wnav_eSelectionFormat;
typedef enum {
wnav_mOpen_All = ~0,
wnav_mOpen_Children = 1 << 0,
......@@ -226,7 +233,7 @@ class WNav {
void (*save_cb)( void *);
void (*revert_cb)( void *, int confirm);
pwr_tBoolean (*format_selection_cb)( void *, pwr_sAttrRef, XtPointer *,
unsigned long *, pwr_tBoolean, pwr_tBoolean);
unsigned long *, pwr_tBoolean, pwr_tBoolean, wnav_eSelectionFormat);
int (*get_global_select_cb)( void *, pwr_sAttrRef **,
int **, int *);
int (*global_unselect_objid_cb)( void *, pwr_tObjid objid);
......@@ -264,6 +271,9 @@ class WNav {
int init_help;
int avoid_deadlock;
XtIntervalId deadlock_timerid;
Atom graph_atom;
Atom objid_atom;
Atom attrref_atom;
int create_object_item( pwr_tObjid objid,
brow_tNode dest, flow_eDest dest_code, void **item,
......
......@@ -33,6 +33,9 @@ extern "C" {
#include <Xm/SeparatoG.h>
#include <Xm/ToggleB.h>
#include <Xm/ToggleBG.h>
#include <X11/Xatom.h>
#include <X11/Xmu/Atoms.h>
#include <X11/Xmu/StdSel.h>
#include "flow.h"
#include "flow_browctx.h"
......@@ -47,6 +50,7 @@ extern "C" {
extern "C" {
#include "co_api.h"
#include "co_wow.h"
}
#define MENU_BAR 1
......@@ -178,8 +182,8 @@ static Widget wnav_build_menu(
return MenuType == MENU_POPUP ? Menu : Cascade;
}
Widget wtt_create_popup_menu( Wtt *wtt, pwr_tObjid objid, pwr_tCid cid)
Widget wtt_create_popup_menu( Wtt *wtt, pwr_tObjid objid, pwr_tCid cid,
void (*message_cb)(void *, char, char *))
{
pwr_tStatus sts;
int i;
......@@ -194,6 +198,8 @@ Widget wtt_create_popup_menu( Wtt *wtt, pwr_tObjid objid, pwr_tCid cid)
if (mcp == NULL)
mcp = (ldh_sMenuCall *)XtCalloc(1, sizeof(ldh_sMenuCall));
mcp->message_cb = message_cb;
if ( cid != pwr_cNCid) {
// Popup in palette
mcp->EditorContext = (void *)wtt;
......@@ -268,6 +274,25 @@ Widget wtt_create_popup_menu( Wtt *wtt, pwr_tObjid objid, pwr_tCid cid)
mcp->Selected[1].Objid = pwr_cNObjid;
mcp->SelectCount = 1;
}
else {
// Get primary selection
char str[200];
sts = wow_GetSelection( wtt->wnav_form, str, sizeof(str), wtt->wnav->objid_atom);
if ( EVEN(sts))
sts = wow_GetSelection( wtt->wnav_form, str, sizeof(str), XA_STRING);
if ( ODD(sts)) {
sts = ldh_NameToObjid( mcp->PointedSession, &objid, str);
if ( ODD(sts)) {
XtFree( (char *) mcp->Selected);
mcp->Selected = (pwr_sAttrRef *) XtCalloc( 2, sizeof (pwr_sAttrRef));
mcp->SelectedSet = ldh_eMenuSet_Object;
mcp->Selected[0].Objid = objid;
mcp->Selected[1].Objid = pwr_cNObjid;
mcp->SelectCount = 1;
}
}
}
}
}
......
......@@ -65,6 +65,7 @@ extern "C" {
#include "wb_wnav_msg.h"
#include "wb_volume.h"
#include "wb_env.h"
#include "wb_wpkg.h"
#include "co_msgwindow.h"
......@@ -111,6 +112,7 @@ static void wtt_reset_avoid_deadlock( Wtt *wtt);
static void wtt_set_avoid_deadlock( Wtt *wtt, int time);
static void wtt_set_twowindows_cb( void *wtt, int two, int display_w1,
int display_w2);
static void wtt_message_cb( void *ctx, char severity, char *msg);
static void wtt_set_twowindows_cb( void *wtt, int two, int display_w1,
int display_w2)
......@@ -153,9 +155,10 @@ extern "C" void wtt_uted_quit_cb( void *ctx)
((Wtt *)ctx)->utedctx = NULL;
}
extern "C" void wtt_distrw_quit_cb( void *ctx)
extern "C" void wtt_wpkg_quit_cb( void *ctx)
{
((Wtt *)ctx)->distrwctx = NULL;
delete ((Wtt *)ctx)->wpkg;
((Wtt *)ctx)->wpkg = NULL;
}
static void wtt_open_vsel_cb( void *ctx, wb_eType type, char *filename, wow_eFileSelType file_type)
......@@ -503,6 +506,21 @@ static int wtt_set_focus_cb( void *ctx, void *component)
return ((Wtt *)ctx)->set_focus( component);
}
void wtt_set_selection_owner_proc( Wtt *wtt)
{
// Delay call to own selection, to make it possible to paste previous selection to value inputwith MB2
wtt->selection_timerid = 0;
if ( wtt->focused_wnav)
wtt->focused_wnav->set_selection_owner();
}
void wtt_set_palette_selection_owner_proc( Wtt *wtt)
{
// Delay call to own selection, to make it possible to paste previous selection to value inputwith MB2
wtt->selection_timerid = 0;
wtt->palette->set_selection_owner();
}
int Wtt::set_focus( void *component)
{
if ( component == (void *)wnav)
......@@ -511,7 +529,8 @@ int Wtt::set_focus( void *component)
wnavnode->set_inputfocus( 0);
palette->set_inputfocus( 0);
focused_wnav = (WNav *)component;
focused_wnav->set_selection_owner();
selection_timerid = XtAppAddTimeOut( XtWidgetToApplicationContext( toplevel), 200,
(XtTimerCallbackProc)wtt_set_selection_owner_proc, this);
}
else if ( component == (void *)wnavnode)
{
......@@ -519,15 +538,17 @@ int Wtt::set_focus( void *component)
wnavnode->set_inputfocus( 1);
palette->set_inputfocus( 0);
focused_wnav = (WNav *)component;
focused_wnav->set_selection_owner();
selection_timerid = XtAppAddTimeOut( XtWidgetToApplicationContext( toplevel), 200,
(XtTimerCallbackProc)wtt_set_selection_owner_proc, this);
}
else if ( component == (void *)palette)
{
wnav->set_inputfocus( 0);
wnavnode->set_inputfocus( 0);
palette->set_inputfocus( 1);
palette->set_selection_owner();
focused_wnav = 0;
selection_timerid = XtAppAddTimeOut( XtWidgetToApplicationContext( toplevel), 200,
(XtTimerCallbackProc)wtt_set_palette_selection_owner_proc, this);
}
return 1;
}
......@@ -540,6 +561,7 @@ static void wtt_create_popup_menu_cb( void *ctx, pwr_tObjid objid,
Arg args[5];
int i;
short x1, y1, x2, y2, x3, y3;
short menu_x, menu_y;
if ( !wtt->ldhses)
return;
......@@ -556,13 +578,15 @@ static void wtt_create_popup_menu_cb( void *ctx, pwr_tObjid objid,
XtSetArg( args[1], XmNy, &y3);
XtGetValues( wtt->toplevel, args, 2);
popup = wtt_create_popup_menu( wtt, objid, pwr_cNCid);
menu_x = x + x1 + x2 + x3 + 8;
menu_y = y + y1 + y2 + y3;
popup = wtt_create_popup_menu( wtt, objid, pwr_cNCid, wtt_message_cb);
if ( !popup)
return;
i = 0;
XtSetArg(args[i], XmNx, x + x1 + x2 + x3 + 8);i++;
XtSetArg(args[i], XmNy, y + y1 + y2 + y3);i++;
XtSetArg(args[i], XmNx, menu_x);i++;
XtSetArg(args[i], XmNy, menu_y);i++;
XtSetValues( popup ,args,i);
// XmMenuPosition(popup, (XButtonPressedEvent *)data->event);
......@@ -577,6 +601,7 @@ static void wtt_create_pal_popup_menu_cb( void *ctx, pwr_tCid cid,
Arg args[5];
int i;
short x1, y1, x2, y2, x3, y3;
short menu_x, menu_y;
if ( !wtt->ldhses)
return;
......@@ -593,13 +618,15 @@ static void wtt_create_pal_popup_menu_cb( void *ctx, pwr_tCid cid,
XtSetArg( args[1], XmNy, &y3);
XtGetValues( wtt->toplevel, args, 2);
popup = wtt_create_popup_menu( wtt, pwr_cNObjid, cid);
menu_x = x + x1 + x2 + x3 + 8;
menu_y = y + y1 + y2 + y3;
popup = wtt_create_popup_menu( wtt, pwr_cNObjid, cid, wtt_message_cb);
if ( !popup)
return;
i = 0;
XtSetArg(args[i], XmNx, x + x1 + x2 + x3 + 8);i++;
XtSetArg(args[i], XmNy, y + y1 + y2 + y3);i++;
XtSetArg(args[i], XmNx, menu_x);i++;
XtSetArg(args[i], XmNy, menu_y);i++;
XtSetValues( popup ,args,i);
// XmMenuPosition(popup, (XButtonPressedEvent *)data->event);
......@@ -1148,7 +1175,7 @@ void Wtt::set_twowindows( int two, int display_wnav, int display_wnavnode)
}
}
void wtt_message_cb( void *ctx, char severity, char *msg)
static void wtt_message_cb( void *ctx, char severity, char *msg)
{
((Wtt *)ctx)->message( severity, msg);
}
......@@ -2124,20 +2151,17 @@ static void wtt_activate_createboot( Widget w, Wtt *wtt, XmAnyCallbackStruct *da
static void wtt_activate_distribute( Widget w, Wtt *wtt, XmAnyCallbackStruct *data)
{
int sts;
wtt->message( ' ', "");
if ( wtt->distrwctx == NULL)
{
if ( wtt->wpkg == 0) {
wtt->set_clock_cursor();
sts = distrw_new( wtt, wtt->toplevel, "Distribute",
(distrw_ctx *)&wtt->distrwctx, wtt_distrw_quit_cb);
wtt->wpkg = new WPkg( wtt->toplevel, wtt);
wtt->wpkg->close_cb = wtt_wpkg_quit_cb;
wtt->reset_cursor();
if ( EVEN(sts)) MESSAGE_RETURN_STS(sts);
}
else
distrw_raise_window( (distrw_ctx) wtt->distrwctx);
wtt->wpkg->pop();
}
static void wtt_activate_showcrossref( Widget w, Wtt *wtt, XmAnyCallbackStruct *data)
......@@ -2406,7 +2430,7 @@ static void wtt_enable_set_focus( Wtt *wtt)
static void wtt_disable_set_focus( Wtt *wtt, int time)
{
wtt->set_focus_disabled++;
wtt->focus_timerid = XtAppAddTimeOut(
wtt->disfocus_timerid = XtAppAddTimeOut(
XtWidgetToApplicationContext( wtt->toplevel), time,
(XtTimerCallbackProc)wtt_enable_set_focus, wtt);
}
......@@ -2438,9 +2462,11 @@ static void wtt_action_inputfocus( Widget w, XmAnyCallbackStruct *data)
if ( wtt->set_focus_disabled)
return;
if ( wtt->focused_wnav)
if ( wtt->focused_wnav) {
wtt->set_focus( wtt->focused_wnav);
// wtt->focus_timerid = XtAppAddTimeOut( XtWidgetToApplicationContext( wtt->toplevel), 200,
// (XtTimerCallbackProc)wtt_set_focus_proc, wtt);
}
wtt_disable_set_focus( wtt, 400);
}
......@@ -3006,7 +3032,8 @@ static pwr_tBoolean wtt_format_selection(
XtPointer *value_return,
unsigned long *length_return,
pwr_tBoolean is_class,
pwr_tBoolean is_attr
pwr_tBoolean is_attr,
wnav_eSelectionFormat format
)
{
int ret_len, i, j, size, sts;
......@@ -3022,8 +3049,37 @@ static pwr_tBoolean wtt_format_selection(
Wtt *wtt = (Wtt *) ctx;
pwr_tObjid object = attrref.Objid;
char *s;
int select_syntax;
int select_volume, select_attr, select_type;
switch ( format) {
case wnav_eSelectionFormat_User:
select_syntax = wtt->select_syntax;
select_volume = wtt->select_volume;
select_attr = wtt->select_attr;
select_type = wtt->select_type;
break;
case wnav_eSelectionFormat_Graph:
select_syntax = wtt_eSelectionMode_Normal;
select_volume = 1;
select_attr = 1;
select_type = 1;
break;
case wnav_eSelectionFormat_Objid:
select_syntax = wtt_eSelectionMode_Normal;
select_volume = 1;
select_attr = 0;
select_type = 0;
break;
case wnav_eSelectionFormat_Attrref:
select_syntax = wtt_eSelectionMode_Normal;
select_volume = 1;
select_attr = 1;
select_type = 0;
break;
}
if ( wtt->select_syntax == wtt_eSelectionMode_Extern && !wtt->select_attr)
if ( select_syntax == wtt_eSelectionMode_Extern && !select_attr)
{
sts = ldh_ObjidToName( wtt->ldhses, object, ldh_eName_Objid,
name, sizeof(name), &ret_len);
......@@ -3032,13 +3088,13 @@ static pwr_tBoolean wtt_format_selection(
*length_return = strlen(name) + 1;
return TRUE;
}
else if ( wtt->select_syntax == wtt_eSelectionMode_Extern && wtt->select_attr)
else if ( select_syntax == wtt_eSelectionMode_Extern && select_attr)
{
sts = ldh_ObjidToName( wtt->ldhses, object, ldh_eName_Default,
name, sizeof(name), &ret_len);
if (EVEN(sts)) return FALSE;
}
else if ( wtt->select_volume)
else if ( select_volume)
{
sts = ldh_ObjidToName(wtt->ldhses, object, ldh_eName_VolPath,
name, sizeof(name), &ret_len);
......@@ -3051,7 +3107,7 @@ static pwr_tBoolean wtt_format_selection(
if (EVEN(sts)) return FALSE;
}
if (wtt->select_syntax == wtt_eSelectionMode_GMS)
if (select_syntax == wtt_eSelectionMode_GMS)
{
strcpy(hyphen, "\\-");
strcpy(dot, "\\.");
......@@ -3085,7 +3141,7 @@ static pwr_tBoolean wtt_format_selection(
// Fetch and add attribute name if nessecary
if (wtt->select_attr && !is_class)
if (select_attr && !is_class)
{
sts = ldh_GetObjectClass(wtt->ldhses, object, &classid);
if ( EVEN(sts)) return FALSE;
......@@ -3108,7 +3164,7 @@ static pwr_tBoolean wtt_format_selection(
sts = ldh_NameToAttrRef(wtt->ldhses, name, &attr_ref);
if (ODD(sts))
{
if (wtt->select_syntax == wtt_eSelectionMode_Extern && wtt->select_attr)
if (select_syntax == wtt_eSelectionMode_Extern && select_attr)
{
sts = ldh_AttrRefToName(wtt->ldhses, &attr_ref,
ldh_eName_ArefExport,
......@@ -3132,7 +3188,7 @@ static pwr_tBoolean wtt_format_selection(
strcat(buff, dot);
strcat(buff, attr_name);
if (wtt->select_type)
if (select_type)
{
// If attribute is an array element
// Get attribute definition for the array.
......@@ -3172,7 +3228,7 @@ static pwr_tBoolean wtt_format_selection(
}
}
}
if ( wtt->select_syntax == wtt_eSelectionMode_Extern && wtt->select_attr)
if ( select_syntax == wtt_eSelectionMode_Extern && select_attr)
{
sts = ldh_NameToAttrRef(wtt->ldhses, buff, &attr_ref);
if (EVEN(sts)) return False;
......@@ -3251,10 +3307,10 @@ Wtt::Wtt(
wbctx(wt_wbctx), volctx(wt_volctx), volid(wt_volid), ldhses(0),
editmode(0), twowindows(0), confirm_open(0), select_volume(0),
select_attr(0), select_type(0),
wnav_mapped(0), wnavnode_mapped(0), utedctx(0), distrwctx(0),
wnav_mapped(0), wnavnode_mapped(0), utedctx(0), wpkg(0),
close_cb(0), open_volume_cb(0), open_project_volume_cb(0), time_to_exit_cb(0),
set_focus_disabled(0), avoid_deadlock(0), clock_cursor(0),
cmd_current_recall(0), value_current_recall(0)
set_focus_disabled(0), disfocus_timerid(0), selection_timerid(0), avoid_deadlock(0),
clock_cursor(0), cmd_current_recall(0), value_current_recall(0)
{
char uid_filename[200] = {"pwr_exe:wb_wtt.uid"};
char *uid_filename_p = uid_filename;
......@@ -3389,7 +3445,7 @@ Wtt::Wtt(
{
case pwr_eClass_DirectoryVolume:
wb_type = wb_eType_Directory;
sprintf( title, "PwR Navigator Directory %s, %s", volname, name);
sprintf( title, "PwR Navigator Directory %s", name);
strcpy( layout_w1, "ProjectNavigatorW1");
strcpy( layout_w2, "ProjectNavigatorW2");
strcpy( layout_palette, "ProjectNavigatorPalette");
......@@ -3616,7 +3672,9 @@ Wtt::~Wtt()
free_cursor();
if ( set_focus_disabled)
XtRemoveTimeOut( focus_timerid);
XtRemoveTimeOut( disfocus_timerid);
if ( selection_timerid)
XtRemoveTimeOut( selection_timerid);
wnav->closing_down = 1;
wnavnode->closing_down = 1;
......
......@@ -52,6 +52,8 @@ extern "C" {
#include "co_wow.h"
#endif
class WPkg;
typedef enum {
wtt_eNoEdit_Save,
wtt_eNoEdit_Revert,
......@@ -205,7 +207,7 @@ class Wtt {
Widget menu_change_value_w;
Widget menu_edit_w;
uted_ctx utedctx;
void *distrwctx;
WPkg *wpkg;
WNav *input_wnav;
brow_tObject input_node;
pwr_tObjid input_objid;
......@@ -215,7 +217,8 @@ class Wtt {
void (*open_project_volume_cb)(void *ctx);
int (*time_to_exit_cb)(void *ctx);
int set_focus_disabled;
XtIntervalId focus_timerid;
XtIntervalId disfocus_timerid;
XtIntervalId selection_timerid;
int avoid_deadlock;
XtIntervalId deadlock_timerid;
int clock_cursor;
......@@ -253,7 +256,8 @@ class Wtt {
~Wtt();
};
Widget wtt_create_popup_menu( Wtt *wtt, pwr_tObjid objid, pwr_tCid cid);
Widget wtt_create_popup_menu( Wtt *wtt, pwr_tObjid objid, pwr_tCid cid,
void (*message_cb)(void *, char, char *));
#if defined __cplusplus
}
......
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