Example #1
0
//
// Callbacks from brow
//
int CLogNav::brow_cb(FlowCtx* ctx, flow_tEvent event)
{
  CLogNav* clognav;
  ItemMsg* item;

  if (event->event == flow_eEvent_ObjectDeleted) {
    brow_GetUserData(event->object.object, (void**)&item);
    delete item;
    return 1;
  }

  brow_GetCtxUserData((BrowCtx*)ctx, (void**)&clognav);
  switch (event->event) {
  case flow_eEvent_Key_Up: {
    brow_tNode* node_list;
    int node_count;
    brow_tObject object;
    int sts;

    brow_GetSelectedNodes(clognav->brow->ctx, &node_list, &node_count);
    if (!node_count) {
      sts = brow_GetLastVisible(clognav->brow->ctx, &object);
      if (EVEN(sts))
        return 1;
    } else {
      if (!brow_IsVisible(
              clognav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
        sts = brow_GetLastVisible(clognav->brow->ctx, &object);
        if (EVEN(sts))
          return 1;
      } else {
        sts = brow_GetPrevious(clognav->brow->ctx, node_list[0], &object);
        if (EVEN(sts)) {
          sts = brow_GetLast(clognav->brow->ctx, &object);
          if (EVEN(sts)) {
            if (node_count)
              free(node_list);
            return 1;
          }
        }
      }
    }
    brow_SelectClear(clognav->brow->ctx);
    brow_SetInverse(object, 1);
    brow_SelectInsert(clognav->brow->ctx, object);
    if (!brow_IsVisible(clognav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject(clognav->brow->ctx, object, 0.25);
    if (node_count)
      free(node_list);
    break;
  }
  case flow_eEvent_Key_Down: {
    brow_tNode* node_list;
    int node_count;
    brow_tObject object;
    int sts;

    brow_GetSelectedNodes(clognav->brow->ctx, &node_list, &node_count);
    if (!node_count) {
      sts = brow_GetFirstVisible(clognav->brow->ctx, &object);
      if (EVEN(sts))
        return 1;
    } else {
      if (!brow_IsVisible(
              clognav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
        sts = brow_GetFirstVisible(clognav->brow->ctx, &object);
        if (EVEN(sts))
          return 1;
      } else {
        sts = brow_GetNext(clognav->brow->ctx, node_list[0], &object);
        if (EVEN(sts)) {
          sts = brow_GetFirst(clognav->brow->ctx, &object);
          if (EVEN(sts)) {
            if (node_count)
              free(node_list);
            return 1;
          }
        }
      }
    }
    brow_SelectClear(clognav->brow->ctx);
    brow_SetInverse(object, 1);
    brow_SelectInsert(clognav->brow->ctx, object);
    if (!brow_IsVisible(clognav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject(clognav->brow->ctx, object, 0.75);
    if (node_count)
      free(node_list);
    break;
  }
  case flow_eEvent_Key_PageDown: {
    brow_Page(clognav->brow->ctx, 0.9);
    break;
  }
  case flow_eEvent_Key_PageUp: {
    brow_Page(clognav->brow->ctx, -0.9);
    break;
  }
  case flow_eEvent_ScrollDown: {
    brow_Page(clognav->brow->ctx, 0.1);
    break;
  }
  case flow_eEvent_ScrollUp: {
    brow_Page(clognav->brow->ctx, -0.1);
    break;
  }
  case flow_eEvent_SelectClear:
    brow_ResetSelectInverse(clognav->brow->ctx);
    break;
  case flow_eEvent_MB1Click:
    // Select
    switch (event->object.object_type) {
    case flow_eObjectType_Node:
      if (brow_FindSelectedObject(clognav->brow->ctx, event->object.object)) {
        brow_SelectClear(clognav->brow->ctx);
      } else {
        brow_SelectClear(clognav->brow->ctx);
        brow_SetInverse(event->object.object, 1);
        brow_SelectInsert(clognav->brow->ctx, event->object.object);
      }
      break;
    default:
      brow_SelectClear(clognav->brow->ctx);
    }
    break;
  case flow_eEvent_MB3Down: {
    brow_SetClickSensitivity(clognav->brow->ctx, flow_mSensitivity_MB3Press);
    break;
  }
  default:;
  }
  return 1;
}
Example #2
0
//
// Callbacks from brow
//
int MsgList::brow_cb( FlowCtx *ctx, flow_tEvent event)
{
  MsgList		*msglist;
  ItemMsg 		*item;

  if ( event->event == flow_eEvent_ObjectDeleted)
  {
    brow_GetUserData( event->object.object, (void **)&item);
    delete item;
    return 1;
  }

  brow_GetCtxUserData( (BrowCtx *)ctx, (void **) &msglist);
  switch ( event->event)
  {
    case flow_eEvent_Key_Up:
    {
      brow_tNode	*node_list;
      int		node_count;
      brow_tObject	object;
      int		sts;

      brow_GetSelectedNodes( msglist->brow->ctx, &node_list, &node_count);
      if ( !node_count) {
        sts = brow_GetLastVisible( msglist->brow->ctx, &object);
        if ( EVEN(sts)) return 1;
      }
      else {
	if ( !brow_IsVisible( msglist->brow->ctx, node_list[0], flow_eVisible_Partial)) {
	  sts = brow_GetLastVisible( msglist->brow->ctx, &object);
	  if ( EVEN(sts)) return 1;
	}
	else {
	  sts = brow_GetPrevious( msglist->brow->ctx, node_list[0], &object);
	  if ( EVEN(sts)) {
            if ( node_count)
	      free( node_list);
            return 1;
 	  }
        }
      }
      brow_SelectClear( msglist->brow->ctx);
      brow_SetInverse( object, 1);
      brow_SelectInsert( msglist->brow->ctx, object);
      if ( !brow_IsVisible( msglist->brow->ctx, object, flow_eVisible_Full))
        brow_CenterObject( msglist->brow->ctx, object, 0.25);
      if ( node_count)
        free( node_list);
      break;
    }
    case flow_eEvent_Key_Down:
    {
      brow_tNode	*node_list;
      int		node_count;
      brow_tObject	object;
      int		sts;

      brow_GetSelectedNodes( msglist->brow->ctx, &node_list, &node_count);
      if ( !node_count) {
        sts = brow_GetFirstVisible( msglist->brow->ctx, &object);
        if ( EVEN(sts)) return 1;
      }
      else {
	if ( !brow_IsVisible( msglist->brow->ctx, node_list[0], flow_eVisible_Partial)) {
	  sts = brow_GetFirstVisible( msglist->brow->ctx, &object);
	  if ( EVEN(sts)) return 1;
	}
	else {
	  sts = brow_GetNext( msglist->brow->ctx, node_list[0], &object);
	  if ( EVEN(sts)) {
            if ( node_count)
	      free( node_list);
            return 1;
 	  }
        }
      }
      brow_SelectClear( msglist->brow->ctx);
      brow_SetInverse( object, 1);
      brow_SelectInsert( msglist->brow->ctx, object);
      if ( !brow_IsVisible( msglist->brow->ctx, object, flow_eVisible_Full))
        brow_CenterObject( msglist->brow->ctx, object, 0.75);
      if ( node_count)
        free( node_list);
      break;
    }
    case flow_eEvent_SelectClear:
      brow_ResetSelectInverse( msglist->brow->ctx);
      break;
    case flow_eEvent_MB1Click:
      // Select
      double ll_x, ll_y, ur_x, ur_y;
      int		sts;

      switch ( event->object.object_type)
      {
        case flow_eObjectType_Node:
          brow_MeasureNode( event->object.object, &ll_x, &ll_y,
			&ur_x, &ur_y);
	  if ( event->object.x < ll_x + 1.0)
          {
            // Simulate doubleclick
            flow_tEvent doubleclick_event;

            doubleclick_event = (flow_tEvent) calloc( 1, sizeof(*doubleclick_event));
            memcpy( doubleclick_event, event, sizeof(*doubleclick_event));
            doubleclick_event->event = flow_eEvent_MB1DoubleClick;
            sts = MsgList::brow_cb( ctx, doubleclick_event);
            free( (char *) doubleclick_event);
            return sts;
          }

          if ( brow_FindSelectedObject( msglist->brow->ctx, event->object.object))
          {
            brow_SelectClear( msglist->brow->ctx);
          }
          else
          {
            brow_SelectClear( msglist->brow->ctx);
            brow_SetInverse( event->object.object, 1);
            brow_SelectInsert( msglist->brow->ctx, event->object.object);
          }
          break;
        default:
          brow_SelectClear( msglist->brow->ctx);
      }
      break;
    case flow_eEvent_Key_PageDown: {
      brow_Page( msglist->brow->ctx, 0.95);
      break;
    }
    case flow_eEvent_Key_PageUp: {
      brow_Page( msglist->brow->ctx, -0.95);
      break;
    }
    case flow_eEvent_ScrollDown: {
      brow_Page( msglist->brow->ctx, 0.10);
      break;
    }
    case flow_eEvent_ScrollUp: {
      brow_Page( msglist->brow->ctx, -0.10);
      break;
    }
    case flow_eEvent_Key_Left:
    {
      brow_tNode	*node_list;
      int		node_count;
      brow_tObject	object;
      int		sts;

      brow_GetSelectedNodes( msglist->brow->ctx, &node_list, &node_count);
      if ( !node_count)
        return 1;

      if ( brow_IsOpen( node_list[0]))
        // Close this node
        object = node_list[0];
      else
      {
        // Close parent
        sts = brow_GetParent( msglist->brow->ctx, node_list[0], &object);
        if ( EVEN(sts))
        {
          free( node_list);
          return 1;
        }
      }
      brow_GetUserData( object, (void **)&item);
      switch( item->type)
      {
        case msglist_eItemType_Msg:
//	  ((ItemLocal *)item)->close( msglist, 0, 0);
          break;
        default:
          ;
      }
      brow_SelectClear( msglist->brow->ctx);
      brow_SetInverse( object, 1);
      brow_SelectInsert( msglist->brow->ctx, object);
      if ( !brow_IsVisible( msglist->brow->ctx, object, flow_eVisible_Full))
        brow_CenterObject( msglist->brow->ctx, object, 0.25);
      free( node_list);
      break;
    }
    case flow_eEvent_Key_Right:
    {
      brow_tNode	*node_list;
      int		node_count;

      brow_GetSelectedNodes( msglist->brow->ctx, &node_list, &node_count);
      if ( !node_count)
        return 1;

      brow_GetUserData( node_list[0], (void **)&item);
      item->find();
      break;
    }
    case flow_eEvent_MB1DoubleClick:
      switch ( event->object.object_type)
      {
        case flow_eObjectType_Node:
          brow_GetUserData( event->object.object, (void **)&item);
	  item->find();
          break;
        default:
          ;
      }
      break;
    default:
      ;
  }
  return 1;
}
Example #3
0
//
// Callbacks from brow
//
int PnViewerNav::brow_cb(FlowCtx* ctx, flow_tEvent event)
{
  PnViewerNav* viewernav;
  ItemDevice* item;

  if (event->event == flow_eEvent_ObjectDeleted) {
    brow_GetUserData(event->object.object, (void**)&item);
    delete item;
    return 1;
  }

  brow_GetCtxUserData((BrowCtx*)ctx, (void**)&viewernav);
  viewernav->message(' ', "");
  switch (event->event) {
  case flow_eEvent_Key_Up: {
    brow_tNode* node_list;
    int node_count;
    brow_tObject object;
    int sts;

    brow_GetSelectedNodes(viewernav->brow->ctx, &node_list, &node_count);
    if (!node_count) {
      sts = brow_GetLastVisible(viewernav->brow->ctx, &object);
      if (EVEN(sts))
        return 1;
    } else {
      if (!brow_IsVisible(
              viewernav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
        sts = brow_GetLastVisible(viewernav->brow->ctx, &object);
        if (EVEN(sts))
          return 1;
      } else {
        sts = brow_GetPrevious(viewernav->brow->ctx, node_list[0], &object);
        if (EVEN(sts)) {
          if (node_count)
            free(node_list);
          return 1;
        }
      }
    }
    brow_SelectClear(viewernav->brow->ctx);
    brow_SetInverse(object, 1);
    brow_SelectInsert(viewernav->brow->ctx, object);
    if (!brow_IsVisible(viewernav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject(viewernav->brow->ctx, object, 0.25);
    if (node_count)
      free(node_list);
    break;
  }
  case flow_eEvent_Key_Down: {
    brow_tNode* node_list;
    int node_count;
    brow_tObject object;
    int sts;

    brow_GetSelectedNodes(viewernav->brow->ctx, &node_list, &node_count);
    if (!node_count) {
      sts = brow_GetFirstVisible(viewernav->brow->ctx, &object);
      if (EVEN(sts))
        return 1;
    } else {
      if (!brow_IsVisible(
              viewernav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
        sts = brow_GetFirstVisible(viewernav->brow->ctx, &object);
        if (EVEN(sts))
          return 1;
      } else {
        sts = brow_GetNext(viewernav->brow->ctx, node_list[0], &object);
        if (EVEN(sts)) {
          if (node_count)
            free(node_list);
          return 1;
        }
      }
    }
    brow_SelectClear(viewernav->brow->ctx);
    brow_SetInverse(object, 1);
    brow_SelectInsert(viewernav->brow->ctx, object);
    if (!brow_IsVisible(viewernav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject(viewernav->brow->ctx, object, 0.75);
    if (node_count)
      free(node_list);
    break;
  }
  case flow_eEvent_Key_Return:
  case flow_eEvent_Key_Right: {
    brow_tNode* node_list;
    int node_count;
    int sts;

    brow_GetSelectedNodes(viewernav->brow->ctx, &node_list, &node_count);
    if (!node_count)
      break;
    brow_GetUserData(node_list[0], (void**)&item);
    free(node_list);
    switch (item->type) {
    case viewitem_eItemType_Device:
      sts = item->open_children(viewernav);
      break;
    case viewitem_eItemType_DeviceAttr:
      (viewernav->change_value_cb)(viewernav->parent_ctx);
      break;
    default:;
    }
    break;
  }
  case flow_eEvent_Key_Left: {
    brow_tNode* node_list;
    int node_count;
    brow_tObject object;
    int sts;

    brow_GetSelectedNodes(viewernav->brow->ctx, &node_list, &node_count);
    if (!node_count)
      return 1;

    if (brow_IsOpen(node_list[0]))
      // Close this node
      object = node_list[0];
    else {
      // Close parent
      sts = brow_GetParent(viewernav->brow->ctx, node_list[0], &object);
      if (EVEN(sts))
        return 1;
    }
    brow_GetUserData(object, (void**)&item);
    item->close(viewernav);
    brow_SelectClear(viewernav->brow->ctx);
    brow_SetInverse(object, 1);
    brow_SelectInsert(viewernav->brow->ctx, object);
    if (!brow_IsVisible(viewernav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject(viewernav->brow->ctx, object, 0.25);
    free(node_list);
    break;
  }
  case flow_eEvent_SelectClear:
    brow_ResetSelectInverse(viewernav->brow->ctx);
    break;
  case flow_eEvent_MB1Click:
    // Select
    double ll_x, ll_y, ur_x, ur_y;
    int sts;

    viewernav->set_input_focus();

    switch (event->object.object_type) {
    case flow_eObjectType_Node:
      brow_MeasureNode(event->object.object, &ll_x, &ll_y, &ur_x, &ur_y);
      if (event->object.x < ll_x + 1.0) {
        // Simulate doubleclick
        flow_tEvent doubleclick_event;

        doubleclick_event = (flow_tEvent)calloc(1, sizeof(*doubleclick_event));
        memcpy(doubleclick_event, event, sizeof(*doubleclick_event));
        doubleclick_event->event = flow_eEvent_MB1DoubleClick;
        sts = PnViewerNav::brow_cb(ctx, doubleclick_event);
        free((char*)doubleclick_event);
        return sts;
      }

      if (brow_FindSelectedObject(viewernav->brow->ctx, event->object.object)) {
        brow_SelectClear(viewernav->brow->ctx);
      } else {
        brow_SelectClear(viewernav->brow->ctx);
        brow_SetInverse(event->object.object, 1);
        brow_SelectInsert(viewernav->brow->ctx, event->object.object);
      }
      break;
    default:
      brow_SelectClear(viewernav->brow->ctx);
    }
    break;
  case flow_eEvent_Key_PageDown: {
    brow_Page(viewernav->brow->ctx, 0.95);
    break;
  }
  case flow_eEvent_Key_PageUp: {
    brow_Page(viewernav->brow->ctx, -0.95);
    break;
  }
  case flow_eEvent_ScrollDown: {
    brow_Page(viewernav->brow->ctx, 0.10);
    break;
  }
  case flow_eEvent_ScrollUp: {
    brow_Page(viewernav->brow->ctx, -0.10);
    break;
  }
  case flow_eEvent_MB1DoubleClick:
    brow_GetUserData(event->object.object, (void**)&item);
    switch (item->type) {
    case viewitem_eItemType_Device:
      sts = item->open_children(viewernav);
      break;
    default:;
    }
    break;
  default:;
  }
  return 1;
}
Example #4
0
//
// Callbacks from brow
//
static int tblnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
{
  TblNav		*tblnav;
  ItemBase 		*item;

  if ( event->event == flow_eEvent_ObjectDeleted) {
    brow_GetUserData( event->object.object, (void **)&item);
    delete item;
    return 1;
  }

  brow_GetCtxUserData( (BrowCtx *)ctx, (void **) &tblnav);

  if ( !tblnav->is_authorized())
    return 1;

  tblnav->message( ' ', "");
  switch ( event->event) {
  case flow_eEvent_Key_PageDown: {
    brow_Page( tblnav->brow->ctx, 0.8);
    break;
  }
  case flow_eEvent_Key_PageUp: {
    brow_Page( tblnav->brow->ctx, -0.8);
    break;
  }
  case flow_eEvent_ScrollDown: {
    brow_Page( tblnav->brow->ctx, 0.1);
    break;
  }
  case flow_eEvent_ScrollUp: {
    brow_Page( tblnav->brow->ctx, -0.1);
    break;
  }
  case flow_eEvent_Key_Up: {
    brow_tNode	*node_list;
    int		node_count;
    brow_tObject	object;
    int		sts;
      
    brow_GetSelectedNodes( tblnav->brow->ctx, &node_list, &node_count);
    if ( !node_count) {
      sts = brow_GetLastVisible( tblnav->brow->ctx, &object);
      if ( EVEN(sts)) return 1;
    }
    else {
      if ( !brow_IsVisible( tblnav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
	sts = brow_GetLastVisible( tblnav->brow->ctx, &object);
	if ( EVEN(sts)) return 1;
      }
      else {
	sts = brow_GetPrevious( tblnav->brow->ctx, node_list[0], &object);
	if ( EVEN(sts)) {
	  if ( node_count)
	    free( node_list);
	  return 1;
	}
      }
    }
    brow_SelectClear( tblnav->brow->ctx);
    brow_SetInverse( object, 1);
    brow_SelectInsert( tblnav->brow->ctx, object);
    if ( !brow_IsVisible( tblnav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject( tblnav->brow->ctx, object, 0.25);
    if ( node_count)
      free( node_list);
    break;
  }
  case flow_eEvent_Key_Down: {
    brow_tNode	*node_list;
    int		node_count;
    brow_tObject	object;
    int		sts;

    brow_GetSelectedNodes( tblnav->brow->ctx, &node_list, &node_count);
    if ( !node_count) {
      sts = brow_GetFirstVisible( tblnav->brow->ctx, &object);
      if ( EVEN(sts)) return 1;
    }
    else {
      if ( !brow_IsVisible( tblnav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
	sts = brow_GetFirstVisible( tblnav->brow->ctx, &object);
	if ( EVEN(sts)) return 1;
      }
      else {
	sts = brow_GetNext( tblnav->brow->ctx, node_list[0], &object);
	if ( EVEN(sts)) {
	  if ( node_count)
	    free( node_list);
	  return 1;
	}
      }
    }
    brow_SelectClear( tblnav->brow->ctx);
    brow_SetInverse( object, 1);
    brow_SelectInsert( tblnav->brow->ctx, object);
    if ( !brow_IsVisible( tblnav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject( tblnav->brow->ctx, object, 0.75);
    if ( node_count)
      free( node_list);
    break;
  }
  case flow_eEvent_SelectClear:
    brow_ResetSelectInverse( tblnav->brow->ctx);
    break;
  case flow_eEvent_MB1Click: {
    // Select
    double ll_x, ll_y, ur_x, ur_y;
    int sts;

    switch ( event->object.object_type) {
    case flow_eObjectType_Node:
      brow_MeasureNode( event->object.object, &ll_x, &ll_y,
			&ur_x, &ur_y);
      if ( event->object.x < ll_x + 1.0) {
	// Simulate doubleclick
	flow_tEvent doubleclick_event;

	doubleclick_event = (flow_tEvent) calloc( 1, sizeof(*doubleclick_event));
	memcpy( doubleclick_event, event, sizeof(*doubleclick_event));
	doubleclick_event->event = flow_eEvent_MB1DoubleClick;
	sts = tblnav_brow_cb( ctx, doubleclick_event);
	free( (char *) doubleclick_event);
	return sts;
      }

      if ( brow_FindSelectedObject( tblnav->brow->ctx, event->object.object)) {
	brow_SelectClear( tblnav->brow->ctx);
      }
      else {
	brow_SelectClear( tblnav->brow->ctx);
	brow_SetInverse( event->object.object, 1);
	brow_SelectInsert( tblnav->brow->ctx, event->object.object);
      }
      break;
    default:
      brow_SelectClear( tblnav->brow->ctx);
    }
    break;
  }
  case flow_eEvent_Key_Left: {
    brow_tNode	*node_list;
    int		node_count;
    brow_tObject	object;
    int		sts;
    
    brow_GetSelectedNodes( tblnav->brow->ctx, &node_list, &node_count);
    if ( !node_count)
      return 1;

    if ( brow_IsOpen( node_list[0]))
      // Close this node
      object = node_list[0];
    else {
      // Close parent
      sts = brow_GetParent( tblnav->brow->ctx, node_list[0], &object);
      if ( EVEN(sts)) {
	free( node_list);
	return 1;
      }
    }
    brow_GetUserData( object, (void **)&item);
    item->close( tblnav, 0, 0);

    brow_SelectClear( tblnav->brow->ctx);
    brow_SetInverse( object, 1);
    brow_SelectInsert( tblnav->brow->ctx, object);
    if ( !brow_IsVisible( tblnav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject( tblnav->brow->ctx, object, 0.25);
    free( node_list);
    break;
  }
  case flow_eEvent_Key_Right: {
    brow_tNode	*node_list;
    int		node_count;

    brow_GetSelectedNodes( tblnav->brow->ctx, &node_list, &node_count);
    if ( !node_count)
      return 1;

    brow_GetUserData( node_list[0], (void **)&item);
    switch( item->type) {
    case tblnav_eItemType_Local:
    case tblnav_eItemType_TreeLocal:
      ((ItemLocal *)item)->open_attributes( tblnav, 0, 0);
      break;
    case tblnav_eItemType_TreeNode:
      ((ItemTreeNode *)item)->open_children( tblnav, 0, 0);
      break;
    default:
      ;
    }
  }
  case flow_eEvent_MB1DoubleClick:
    switch ( event->object.object_type) {
    case flow_eObjectType_Node:
      brow_GetUserData( event->object.object, (void **)&item);
      switch( item->type) {
      case tblnav_eItemType_Local: 
      case tblnav_eItemType_TreeLocal: 
	((ItemLocal *)item)->open_attributes( tblnav,
					      event->object.x, event->object.y);
	break;
      case tblnav_eItemType_TreeNode: 
	((ItemTreeNode *)item)->open_children( tblnav,
						 event->object.x, event->object.y);
	break;
      default:
	;
      }
      break;
    default:
      ;
    }
    break;
  default:
    ;
  }
  return 1;
}
Example #5
0
//
// Callbacks from brow
//
static int subgraphs_brow_cb( FlowCtx *ctx, flow_tEvent event)
{
  SubGraphs		*subgraphs;
  ItemSubGraph 		*item;

  if ( event->event == flow_eEvent_ObjectDeleted)
  {
    brow_GetUserData( event->object.object, (void **)&item);
    delete item;
    return 1;
  }

  brow_GetCtxUserData( (BrowCtx *)ctx, (void **) &subgraphs);
  subgraphs->message( ' ', null_str);
  switch ( event->event)
  {
    case flow_eEvent_Key_Up:
    {
      brow_tNode	*node_list;
      int		node_count;
      brow_tObject	object;
      int		sts;

      brow_GetSelectedNodes( subgraphs->brow->ctx, &node_list, &node_count);
      if ( !node_count)
      {
        sts = brow_GetLast( subgraphs->brow->ctx, &object);
        if ( EVEN(sts)) return 1;
      }
      else
      {
        sts = brow_GetPrevious( subgraphs->brow->ctx, node_list[0], &object);
        if ( EVEN(sts))
        {
          sts = brow_GetLast( subgraphs->brow->ctx, &object);
          if ( EVEN(sts))
	  {
            if ( node_count)
	      free( node_list);
            return 1;
 	  }
        }
      }
      brow_SelectClear( subgraphs->brow->ctx);
      brow_SetInverse( object, 1);
      brow_SelectInsert( subgraphs->brow->ctx, object);
      if ( !brow_IsVisible( subgraphs->brow->ctx, object, flow_eVisible_Full))
        brow_CenterObject( subgraphs->brow->ctx, object, 0.25);
      if ( node_count)
        free( node_list);
      break;
    }
    case flow_eEvent_Key_Down:
    {
      brow_tNode	*node_list;
      int		node_count;
      brow_tObject	object;
      int		sts;

      brow_GetSelectedNodes( subgraphs->brow->ctx, &node_list, &node_count);
      if ( !node_count)
      {
        sts = brow_GetFirst( subgraphs->brow->ctx, &object);
        if ( EVEN(sts)) return 1;
      }
      else
      {
        sts = brow_GetNext( subgraphs->brow->ctx, node_list[0], &object);
        if ( EVEN(sts))
        {
          sts = brow_GetFirst( subgraphs->brow->ctx, &object);
          if ( EVEN(sts))
	  {
            if ( node_count)
	      free( node_list);
            return 1;
 	  }
        }
      }
      brow_SelectClear( subgraphs->brow->ctx);
      brow_SetInverse( object, 1);
      brow_SelectInsert( subgraphs->brow->ctx, object);
      if ( !brow_IsVisible( subgraphs->brow->ctx, object, flow_eVisible_Full))
        brow_CenterObject( subgraphs->brow->ctx, object, 0.75);
      if ( node_count)
        free( node_list);
      break;
    }
    case flow_eEvent_SelectClear:
      brow_ResetSelectInverse( subgraphs->brow->ctx);
      break;
    case flow_eEvent_MB1Click:
      // Select
      switch ( event->object.object_type)
      {
        case flow_eObjectType_Node:
          if ( brow_FindSelectedObject( subgraphs->brow->ctx, event->object.object))
          {
            brow_SelectClear( subgraphs->brow->ctx);
          }
          else
          {
            brow_SelectClear( subgraphs->brow->ctx);
            brow_SetInverse( event->object.object, 1);
            brow_SelectInsert( subgraphs->brow->ctx, event->object.object);
          }
          break;
        default:
          brow_SelectClear( subgraphs->brow->ctx);
      }
      break;
    case flow_eEvent_Key_Return:
    case flow_eEvent_Key_Right:
    {
      brow_tNode	*node_list;
      int		node_count;

      brow_GetSelectedNodes( subgraphs->brow->ctx, &node_list, &node_count);
      if ( !node_count)
        break;
      brow_GetUserData( node_list[0], (void **)&item);
      free( node_list);
      switch( item->type)
      {
        case subgraphs_eItemType_SubGraph: 
          break;
        default:
          ;
      }
      break;
    }
    case flow_eEvent_Key_PF4:
    case flow_eEvent_Key_Left:
    {
      brow_tNode	*node_list;
      int		node_count;

      brow_GetSelectedNodes( subgraphs->brow->ctx, &node_list, &node_count);
      if ( !node_count)
        break;
      if ( !node_count)
        break;
      brow_GetUserData( node_list[0], (void **)&item);
      switch( item->type)
      {
        case subgraphs_eItemType_SubGraph: 
          break;
        default:
          ;
      }
      brow_SelectClear( subgraphs->brow->ctx);
      brow_SetInverse( node_list[0], 1);
      brow_SelectInsert( subgraphs->brow->ctx, node_list[0]);
      if ( !brow_IsVisible( subgraphs->brow->ctx, node_list[0], flow_eVisible_Full))
        brow_CenterObject( subgraphs->brow->ctx, node_list[0], 0.25);
      free( node_list);
      break;
    }
    case flow_eEvent_MB1DoubleClick:
      switch ( event->object.object_type)
      {
        case flow_eObjectType_Node:
          brow_GetUserData( event->object.object, (void **)&item);
          switch( item->type)
          {
            case subgraphs_eItemType_SubGraph: 
              subgraphs->edit_attributes( item->nodeclass);
              break;
            default:
              ;
          }
          break;
        default:
          ;
      }
      break;
    default:
      ;
  }
  return 1;
}
//
// Callbacks from brow
//
static int subpalette_brow_cb( FlowCtx *ctx, flow_tEvent event)
{
  SubPalette		*subpalette;
  ItemLocalSubGraphs 	*item;

  if ( event->event == flow_eEvent_ObjectDeleted)
  {
    brow_GetUserData( event->object.object, (void **)&item);
    delete item;
    return 1;
  }

  brow_GetCtxUserData( (BrowCtx *)ctx, (void **) &subpalette);
  subpalette->message( ' ', null_str);
  switch ( event->event)
  {
    case flow_eEvent_Key_PageDown: {
      brow_Page( subpalette->brow->ctx, 0.9);
      break;
    }
    case flow_eEvent_Key_PageUp: {
      brow_Page( subpalette->brow->ctx, -0.9);
      break;
    }
    case flow_eEvent_ScrollDown: {
      brow_Page( subpalette->brow->ctx, 0.1);
      break;
    }
    case flow_eEvent_ScrollUp: {
      brow_Page( subpalette->brow->ctx, -0.1);
      break;
    }
    case flow_eEvent_Key_Up:
    {
      brow_tNode	*node_list;
      int		node_count;
      brow_tObject	object;
      int		sts;

      brow_GetSelectedNodes( subpalette->brow->ctx, &node_list, &node_count);
      if ( !node_count) {
        sts = brow_GetLastVisible( subpalette->brow->ctx, &object);
        if ( EVEN(sts)) return 1;
      }
      else {
	if ( !brow_IsVisible( subpalette->brow->ctx, node_list[0], flow_eVisible_Partial)) {
	  sts = brow_GetLastVisible( subpalette->brow->ctx, &object);
	  if ( EVEN(sts)) return 1;
	}
	else {
	  sts = brow_GetPrevious( subpalette->brow->ctx, node_list[0], &object);
	  if ( EVEN(sts)) {
            if ( node_count)
	      free( node_list);
            return 1;
 	  }
        }
      }
      brow_SelectClear( subpalette->brow->ctx);
      brow_SetInverse( object, 1);
      brow_SelectInsert( subpalette->brow->ctx, object);
      if ( !brow_IsVisible( subpalette->brow->ctx, object, flow_eVisible_Full))
        brow_CenterObject( subpalette->brow->ctx, object, 0.25);
      if ( node_count)
        free( node_list);
      break;
    }
    case flow_eEvent_Key_Down:
    {
      brow_tNode	*node_list;
      int		node_count;
      brow_tObject	object;
      int		sts;

      brow_GetSelectedNodes( subpalette->brow->ctx, &node_list, &node_count);
      if ( !node_count) {
        sts = brow_GetFirstVisible( subpalette->brow->ctx, &object);
        if ( EVEN(sts)) return 1;
      }
      else {
	if ( !brow_IsVisible( subpalette->brow->ctx, node_list[0], flow_eVisible_Partial)) {
	  sts = brow_GetFirstVisible( subpalette->brow->ctx, &object);
	  if ( EVEN(sts)) return 1;
	}
	else {
	  sts = brow_GetNext( subpalette->brow->ctx, node_list[0], &object);
	  if ( EVEN(sts)) {
            if ( node_count)
	      free( node_list);
            return 1;
 	  }
        }
      }
      brow_SelectClear( subpalette->brow->ctx);
      brow_SetInverse( object, 1);
      brow_SelectInsert( subpalette->brow->ctx, object);
      if ( !brow_IsVisible( subpalette->brow->ctx, object, flow_eVisible_Full))
        brow_CenterObject( subpalette->brow->ctx, object, 0.75);
      if ( node_count)
        free( node_list);
      break;
    }
    case flow_eEvent_SelectClear:
      brow_ResetSelectInverse( subpalette->brow->ctx);
      break;
    case flow_eEvent_MB1Click:
      // Select
      double ll_x, ll_y, ur_x, ur_y;
      int		sts;

      if ( subpalette->set_focus_cb)
        (subpalette->set_focus_cb)( subpalette->parent_ctx, subpalette);

      switch ( event->object.object_type)
      {
        case flow_eObjectType_Node:
          brow_MeasureNode( event->object.object, &ll_x, &ll_y,
			&ur_x, &ur_y);
	  if ( event->object.x < ll_x + 1.0)
          {
            // Simulate doubleclick
            flow_tEvent doubleclick_event;

            doubleclick_event = (flow_tEvent) calloc( 1, sizeof(*doubleclick_event));
            memcpy( doubleclick_event, event, sizeof(*doubleclick_event));
            doubleclick_event->event = flow_eEvent_MB1DoubleClick;
            sts = subpalette_brow_cb( ctx, doubleclick_event);
            free( (char *) doubleclick_event);
            return sts;
          }

          if ( brow_FindSelectedObject( subpalette->brow->ctx, event->object.object))
          {
            brow_SelectClear( subpalette->brow->ctx);
          }
          else
          {
            brow_SelectClear( subpalette->brow->ctx);
            brow_SetInverse( event->object.object, 1);
            brow_SelectInsert( subpalette->brow->ctx, event->object.object);
          }
          break;
        default:
          brow_SelectClear( subpalette->brow->ctx);
      }
      break;
    case flow_eEvent_MB3Press: {            
      switch ( event->object.object_type) {
        case flow_eObjectType_Node:
	  ItemFile 	*item;
          brow_GetUserData( event->object.object, (void **)&item);
          if ( item->type != subpalette_eItemType_File)
            break;

	  subpalette->create_popup_menu( item->filename,
					 event->any.x_pixel, event->any.y_pixel);
          break;
        default:
          ;
      }
      break;
    }
    case flow_eEvent_Key_Return:
    case flow_eEvent_Key_Right:
    {
      brow_tNode	*node_list;
      int		node_count;

      brow_GetSelectedNodes( subpalette->brow->ctx, &node_list, &node_count);
      if ( !node_count)
        break;
      brow_GetUserData( node_list[0], (void **)&item);
      free( node_list);

      item->open_children( subpalette, 0, 0);
      break;
    }
    case flow_eEvent_Key_PF4:
    case flow_eEvent_Key_Left:
    {
      brow_tNode	*node_list;
      int		node_count;
      brow_tObject	object;

      brow_GetSelectedNodes( subpalette->brow->ctx, &node_list, &node_count);
      if ( !node_count)
        break;
      if ( !node_count)
        break;

      if ( brow_IsOpen( node_list[0]))
        // Close this node
        object = node_list[0];
      else {
        // Close parent
        sts = brow_GetParent( subpalette->brow->ctx, node_list[0], &object);
        if ( EVEN(sts)) {
          free( node_list);
          return 1;
        }
      }

      brow_GetUserData( object, (void **)&item);
      item->close( subpalette, 0, 0);

      brow_SelectClear( subpalette->brow->ctx);
      brow_SetInverse( object, 1);
      brow_SelectInsert( subpalette->brow->ctx, object);
      if ( !brow_IsVisible( subpalette->brow->ctx, object, flow_eVisible_Full))
        brow_CenterObject( subpalette->brow->ctx, object, 0.25);
      free( node_list);
      break;
    }
    case flow_eEvent_MB1DoubleClick:
      switch ( event->object.object_type)
      {
        case flow_eObjectType_Node:
          brow_GetUserData( event->object.object, (void **)&item);
	  item->open_children( subpalette, event->object.x, event->object.y);
          break;
        default:
          ;
      }
      break;
    case flow_eEvent_Key_Tab:
    {
      if ( subpalette->traverse_focus_cb)
        (subpalette->traverse_focus_cb)( subpalette->parent_ctx, subpalette);
      break;
    }
    case flow_eEvent_Map:
    {
      subpalette->displayed = 1;
      break;
    }
    default:
      ;
  }
  return 1;
}
Example #7
0
//
// Callbacks from brow
//
int CoLogWNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
{
  CoLogWNav		*logwnav;
  ItemLog 		*item;

  if ( event->event == flow_eEvent_ObjectDeleted)
  {
    brow_GetUserData( event->object.object, (void **)&item);
    delete item;
    return 1;
  }

  brow_GetCtxUserData( (BrowCtx *)ctx, (void **) &logwnav);
  switch ( event->event)
  {
    case flow_eEvent_Key_Up:
    {
      brow_tNode	*node_list;
      int		node_count;
      brow_tObject	object;
      int		sts;

      brow_GetSelectedNodes( logwnav->brow->ctx, &node_list, &node_count);
      if ( !node_count) {
        sts = brow_GetLastVisible( logwnav->brow->ctx, &object);
        if ( EVEN(sts)) return 1;
      }
      else {
	if ( !brow_IsVisible( logwnav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
	  sts = brow_GetLastVisible( logwnav->brow->ctx, &object);
	  if ( EVEN(sts)) return 1;
	}
	else {
	  sts = brow_GetPrevious( logwnav->brow->ctx, node_list[0], &object);
	  if ( EVEN(sts)) {
            if ( node_count)
	      free( node_list);
            return 1;
 	  }
        }
      }
      brow_SelectClear( logwnav->brow->ctx);
      brow_SetInverse( object, 1);
      brow_SelectInsert( logwnav->brow->ctx, object);
      if ( !brow_IsVisible( logwnav->brow->ctx, object, flow_eVisible_Full))
        brow_CenterObject( logwnav->brow->ctx, object, 0.25);
      if ( node_count)
        free( node_list);
      break;
    }
    case flow_eEvent_Key_Down:
    {
      brow_tNode	*node_list;
      int		node_count;
      brow_tObject	object;
      int		sts;

      brow_GetSelectedNodes( logwnav->brow->ctx, &node_list, &node_count);
      if ( !node_count) {
        sts = brow_GetFirstVisible( logwnav->brow->ctx, &object);
        if ( EVEN(sts)) return 1;
      }
      else {
	if ( !brow_IsVisible( logwnav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
	  sts = brow_GetFirstVisible( logwnav->brow->ctx, &object);
	  if ( EVEN(sts)) return 1;
	}
	else {
	  sts = brow_GetNext( logwnav->brow->ctx, node_list[0], &object);
	  if ( EVEN(sts)) {
            if ( node_count)
	      free( node_list);
            return 1;
 	  }
        }
      }
      brow_SelectClear( logwnav->brow->ctx);
      brow_SetInverse( object, 1);
      brow_SelectInsert( logwnav->brow->ctx, object);
      if ( !brow_IsVisible( logwnav->brow->ctx, object, flow_eVisible_Full))
        brow_CenterObject( logwnav->brow->ctx, object, 0.75);
      if ( node_count)
        free( node_list);
      break;
    }
    case flow_eEvent_SelectClear:
      brow_ResetSelectInverse( logwnav->brow->ctx);
      break;
    case flow_eEvent_MB1Click:
      // Select
      double ll_x, ll_y, ur_x, ur_y;
      int		sts;

      switch ( event->object.object_type)
      {
        case flow_eObjectType_Node:
          brow_MeasureNode( event->object.object, &ll_x, &ll_y,
			&ur_x, &ur_y);
	  if ( event->object.x < ll_x + 1.0)
          {
            // Simulate doubleclick
            flow_tEvent doubleclick_event;

            doubleclick_event = (flow_tEvent) calloc( 1, sizeof(*doubleclick_event));
            memcpy( doubleclick_event, event, sizeof(*doubleclick_event));
            doubleclick_event->event = flow_eEvent_MB1DoubleClick;
            sts = CoLogWNav::brow_cb( ctx, doubleclick_event);
            free( (char *) doubleclick_event);
            return sts;
          }

          if ( brow_FindSelectedObject( logwnav->brow->ctx, event->object.object))
          {
            brow_SelectClear( logwnav->brow->ctx);
          }
          else
          {
            brow_SelectClear( logwnav->brow->ctx);
            brow_SetInverse( event->object.object, 1);
            brow_SelectInsert( logwnav->brow->ctx, event->object.object);
          }
          break;
        default:
          brow_SelectClear( logwnav->brow->ctx);
      }
      break;
    case flow_eEvent_Key_PageDown: {
      brow_Page( logwnav->brow->ctx, 0.95);
      break;
    }
    case flow_eEvent_Key_PageUp: {
      brow_Page( logwnav->brow->ctx, -0.95);
      break;
    }
    case flow_eEvent_ScrollDown: {
      brow_Page( logwnav->brow->ctx, 0.10);
      break;
    }
    case flow_eEvent_ScrollUp: {
      brow_Page( logwnav->brow->ctx, -0.10);
      break;
    }
    case flow_eEvent_MB1DoubleClick:
      break;
    default:
      ;
  }
  return 1;
}
Example #8
0
//
// Callbacks from brow
//
int XAttNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
{
  XAttNav		*xattnav;
  Item	 		*item;

  if ( event->event == flow_eEvent_ObjectDeleted) {
    brow_GetUserData( event->object.object, (void **)&item);
    delete item;
    return 1;
  }

  brow_GetCtxUserData( (BrowCtx *)ctx, (void **) &xattnav);
  xattnav->message( ' ', "");

  switch ( event->event) {
  case flow_eEvent_Key_Up: {
    brow_tNode	*node_list;
    int		node_count;
    brow_tObject	object;
    int		sts;

    brow_GetSelectedNodes( xattnav->brow->ctx, &node_list, &node_count);
    if ( !node_count) {
      sts = brow_GetLastVisible( xattnav->brow->ctx, &object);
      if ( EVEN(sts)) return 1;
    }
    else {
      if ( !brow_IsVisible( xattnav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
	sts = brow_GetLastVisible( xattnav->brow->ctx, &object);
	if ( EVEN(sts)) return 1;
      }
      else {
	sts = brow_GetPrevious( xattnav->brow->ctx, node_list[0], &object);
	if ( EVEN(sts)) {
	  if ( node_count)
	    free( node_list);
	  return 1;
	}
      }
    }
    brow_SelectClear( xattnav->brow->ctx);
    brow_SetInverse( object, 1);
    brow_SelectInsert( xattnav->brow->ctx, object);
    if ( !brow_IsVisible( xattnav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject( xattnav->brow->ctx, object, 0.25);
    if ( node_count)
      free( node_list);
    break;
  }
  case flow_eEvent_Key_Down: {
    brow_tNode	*node_list;
    int		node_count;
    brow_tObject	object;
    int		sts;

    brow_GetSelectedNodes( xattnav->brow->ctx, &node_list, &node_count);
    if ( !node_count) {
      sts = brow_GetFirstVisible( xattnav->brow->ctx, &object);
      if ( EVEN(sts)) return 1;
    }
    else {
      if ( !brow_IsVisible( xattnav->brow->ctx, node_list[0], flow_eVisible_Partial)) {
	sts = brow_GetFirstVisible( xattnav->brow->ctx, &object);
	if ( EVEN(sts)) return 1;
      }
      else {
	sts = brow_GetNext( xattnav->brow->ctx, node_list[0], &object);
	if ( EVEN(sts)) {
	  if ( node_count)
	    free( node_list);
	  return 1;
	}
      }
    }
    brow_SelectClear( xattnav->brow->ctx);
    brow_SetInverse( object, 1);
    brow_SelectInsert( xattnav->brow->ctx, object);
    if ( !brow_IsVisible( xattnav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject( xattnav->brow->ctx, object, 0.75);
    if ( node_count)
      free( node_list);
    break;
  }
  case flow_eEvent_SelectClear:
    brow_ResetSelectInverse( xattnav->brow->ctx);
    break;
  case flow_eEvent_MB1Click: {
    // Select
    double ll_x, ll_y, ur_x, ur_y;
    int		sts;

    switch ( event->object.object_type) {
    case flow_eObjectType_Node:
      brow_MeasureNode( event->object.object, &ll_x, &ll_y,
			&ur_x, &ur_y);
      if ( event->object.x < ll_x + 1.0) {
	// Simulate doubleclick
	flow_tEvent doubleclick_event;

	doubleclick_event = (flow_tEvent) calloc( 1, sizeof(*doubleclick_event));
	memcpy( doubleclick_event, event, sizeof(*doubleclick_event));
	doubleclick_event->event = flow_eEvent_MB1DoubleClick;
	sts = brow_cb( ctx, doubleclick_event);
	free( (char *) doubleclick_event);
	return sts;
      }

      if ( brow_FindSelectedObject( xattnav->brow->ctx, event->object.object)) {
	brow_SelectClear( xattnav->brow->ctx);
      }
      else {
	brow_SelectClear( xattnav->brow->ctx);
	brow_SetInverse( event->object.object, 1);
	brow_SelectInsert( xattnav->brow->ctx, event->object.object);
      }
      break;
    default:
      brow_SelectClear( xattnav->brow->ctx);
    }
    break;
  }
  case flow_eEvent_Key_PageDown: {
    brow_Page( xattnav->brow->ctx, 0.8);
    break;
  }
  case flow_eEvent_Key_PageUp: {
    brow_Page( xattnav->brow->ctx, -0.8);
    break;
  }
  case flow_eEvent_ScrollDown: {
    brow_Page( xattnav->brow->ctx, 0.1);
    break;
  }
  case flow_eEvent_ScrollUp: {
    brow_Page( xattnav->brow->ctx, -0.1);
    break;
  }
  case flow_eEvent_Key_Left: {
    brow_tNode	*node_list;
    int		node_count;
    brow_tObject	object;
    int		sts;

    brow_GetSelectedNodes( xattnav->brow->ctx, &node_list, &node_count);
    if ( !node_count)
      return 1;

    if ( brow_IsOpen( node_list[0]))
      // Close this node
      object = node_list[0];
    else {
      // Close parent
      sts = brow_GetParent( xattnav->brow->ctx, node_list[0], &object);
      if ( EVEN(sts)) {
	free( node_list);
	return 1;
      }
    }
    brow_GetUserData( object, (void **)&item);
    switch( item->type) {
    case xnav_eItemType_Attr: 
      ((ItemAttr *)item)->close( xattnav->brow, 0, 0);
      break;
    case xnav_eItemType_AttrArrayElem: 
      ((ItemAttrArrayElem *)item)->close( xattnav->brow, 0, 0);
      break;
    case xnav_eItemType_AttrArray: 
      ((ItemAttrArray *)item)->close( xattnav->brow, 0, 0);
      break;
    case xnav_eItemType_AttrObject: 
      ((ItemAttrObject *)item)->close( xattnav->brow, 0, 0);
      break;
    default:
      ;
    }
    brow_SelectClear( xattnav->brow->ctx);
    brow_SetInverse( object, 1);
    brow_SelectInsert( xattnav->brow->ctx, object);
    if ( !brow_IsVisible( xattnav->brow->ctx, object, flow_eVisible_Full))
      brow_CenterObject( xattnav->brow->ctx, object, 0.25);
    free( node_list);
    break;
  }
  case flow_eEvent_MB3Down: {
    brow_SetClickSensitivity( xattnav->brow->ctx, 
			      flow_mSensitivity_MB3Press);
    break;
  }
  case flow_eEvent_MB3Press: {
    // Popup menu
    int x, y;
    pwr_sAttrRef attrref;
    int sts;

    switch ( event->object.object_type) {
    case flow_eObjectType_Node:
      brow_GetUserData( event->object.object, (void **)&item);
      if ( cdh_ObjidIsNull( item->objid))
	break;

      xattnav->popup_position( event->any.x_pixel + 8, event->any.y_pixel, &x, &y);

      memset( &attrref, 0, sizeof(attrref));
      switch ( item->type) {
      case xnav_eItemType_Attr:
      case xnav_eItemType_AttrArrayElem:
      case xnav_eItemType_AttrObject: {
	pwr_tAName attr_str;

	sts = gdh_ObjidToName( item->objid, 
			       attr_str, sizeof(attr_str), cdh_mName_volumeStrict);
	if ( EVEN(sts)) return sts;

	strcat( attr_str, ".");
	strcat( attr_str, item->name);
	sts = gdh_NameToAttrref( pwr_cNObjid, attr_str, &attrref);
	if ( EVEN(sts)) return sts;

	(xattnav->popup_menu_cb)( xattnav->parent_ctx, attrref,
				  (unsigned long)xmenu_eItemType_Attribute,
				  (unsigned long)xmenu_mUtility_AttrEditor, NULL, x, y);

	break;
      }
      case xnav_eItemType_Collect: {
	sts = gdh_NameToAttrref( pwr_cNObjid, item->name, &attrref);
	if ( EVEN(sts)) return sts;

	(xattnav->popup_menu_cb)( xattnav->parent_ctx, attrref,
				  (unsigned long)xmenu_eItemType_Attribute,
				  (unsigned long)xmenu_mUtility_AttrEditor, NULL, x, y);

	break;
      }
      case xnav_eItemType_Crossref: {
	ItemCrossref *itemc = (ItemCrossref *)item;

	memset( &attrref, 0, sizeof(attrref));
	attrref.Objid = itemc->objid;
	(xattnav->popup_menu_cb)( xattnav->parent_ctx, attrref,
				  (unsigned long)xmenu_eItemType_Crossref,
				  (unsigned long)xmenu_mUtility_AttrEditor, 
				  itemc->ref_name, x, y);
	break;
      }
      default:
	;
      }
      break;
    default:
      ;
    }
    break;
  }
  case flow_eEvent_Key_Right: {
    brow_tNode	*node_list;
    int		node_count;
    pwr_tStatus	sts;

    brow_GetSelectedNodes( xattnav->brow->ctx, &node_list, &node_count);
    if ( !node_count)
      return 1;

    brow_GetUserData( node_list[0], (void **)&item);
    switch( item->type) {
    case xnav_eItemType_Attr:
    case xnav_eItemType_AttrArrayElem:
    case xnav_eItemType_Collect:
      sts = item->open_children( xattnav->brow, 0, 0);
      if (ODD(sts)) break;

      if ( xattnav->advanced_user && xattnav->change_value_cb)
	(xattnav->change_value_cb)( xattnav->parent_ctx);
      break;
    case xnav_eItemType_AttrArray: 
      ((ItemAttrArray *)item)->open_attributes( xattnav->brow, 0, 0);
      break;
    case xnav_eItemType_AttrObject: 
      ((ItemAttrObject *)item)->open_attributes( xattnav->brow, 0, 0);
      break;
    case xnav_eItemType_Enum:
      if ( xattnav->advanced_user)
	((ItemEnum *)item)->set_value();
      break;
    case xnav_eItemType_Mask:
      if ( xattnav->advanced_user)
	((ItemMask *)item)->toggle_value();
      break;
    default:
      ;
    }
    free( node_list);
    break;
  }
  case flow_eEvent_MB1DoubleClick:
    switch ( event->object.object_type) {
    case flow_eObjectType_Node:
      brow_GetUserData( event->object.object, (void **)&item);

      switch( item->type) {
      case xnav_eItemType_Attr:
	((ItemAttr *)item)->open_children( xattnav->brow,
					   event->object.x, event->object.y);
	break;
      case xnav_eItemType_AttrArray:
	((ItemAttrArray *)item)->open_attributes( xattnav->brow,
						  event->object.x, event->object.y);
	break;
      case xnav_eItemType_AttrObject:
	((ItemAttrObject *)item)->open_attributes( xattnav->brow,
						   event->object.x, event->object.y);
	break;
      case xnav_eItemType_AttrArrayElem:
	((ItemAttrArrayElem *)item)->open_children( xattnav->brow,
						    event->object.x, event->object.y);
	break;
      case xnav_eItemType_Crossref:
	if ( xattnav->start_trace_cb) {
	  (xattnav->start_trace_cb)( xattnav->parent_ctx, item->objid, 
				     ((ItemCrossref *)item)->ref_name);
	  if ( xattnav->close_cb) {
	    (xattnav->close_cb)( xattnav->parent_ctx);
	    return 1;
	  }
	}
	break;
      default:
	;
      }
      break;
    default:
      ;
    }
    break;
  case flow_eEvent_Radiobutton: {
    switch ( event->object.object_type) {
    case flow_eObjectType_Node:
      brow_GetUserData( event->object.object, (void **)&item);
      switch( item->type) {
      case xnav_eItemType_Enum: 
	if ( !event->radiobutton.value)
	  ((ItemEnum *)item)->set_value();
	break;
      case xnav_eItemType_Mask: 
	((ItemMask *)item)->set_value( !event->radiobutton.value);
	break;
      default:
	;
      }
      break;
    default:
      ;
    }
    break;
  }
  case flow_eEvent_Map: {
    xattnav->displayed = 1;
    break;
  }

  default:
    ;
  }
  return 1;
}