コード例 #1
0
ファイル: pn_viewernav.cpp プロジェクト: siamect/proview
//
// Check that the current selected item is valid for change
//
int PnViewerNav::check_attr_value()
{
  brow_tNode* node_list;
  int node_count;
  ItemDeviceAttr* base_item;

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

  brow_GetUserData(node_list[0], (void**)&base_item);
  free(node_list);

  switch (base_item->type) {
  case viewitem_eItemType_DeviceAttr:
    if (type == viewer_eType_Network
        && (streq(base_item->name, "DeviceName")
               || streq(base_item->name, "IP Address")))
      return 1;
    else
      return PB__ATTRNOEDIT;
  default:
    return PB__ATTRNOEDIT;
  }
}
コード例 #2
0
ファイル: xtt_xattnav.cpp プロジェクト: Strongc/proview
int XAttNav::trace_connect_bc( brow_tObject object, char *name, 
			       char *attr, flow_eTraceType type, void **p)
{
  pwr_tAName   	attr_str;
  int		sts;
  Item 		*base_item;

  /*  printf( "Connecting %s.%s\n", name, attr);  */

  if ( strcmp(name,"") == 0)
    return 1;

  brow_GetUserData( object, (void **)&base_item);
  switch( base_item->type) {
  case xnav_eItemType_Attr:
  case xnav_eItemType_Enum:
  case xnav_eItemType_Mask:
  case xnav_eItemType_AttrArrayElem:
  case xnav_eItemType_Collect: {
    ItemAttr	*item;
    
    item = (ItemAttr *) base_item;
    strcpy( attr_str, name);
    strcat( attr_str, ".");
    strcat( attr_str, attr);
    sts = gdh_RefObjectInfo( attr_str, p, &item->subid, item->size);
    if ( EVEN(sts)) return sts;
    break;
  }
  default:
    ;
  }      
  return 1;
}
コード例 #3
0
int SubPalette::get_select( char *text, char *filename)
{
  brow_tNode	*node_list;
  int		node_count;
  Item		*item;
  int		sts;
  
  brow_GetSelectedNodes( brow->ctx, &node_list, &node_count);
  if ( !node_count)
    return 0;

  brow_GetUserData( node_list[0], (void **)&item);
  free( node_list);

  sts = 0;
  switch( item->type)
  {
    case subpalette_eItemType_File:
      strcpy( filename, ((ItemFile *)item)->filename);
      strcpy( text, ((ItemFile *)item)->name);
      sts = 1;
      break;
    default:
      ;
  }
  return sts;
}
コード例 #4
0
ファイル: xtt_xattnav.cpp プロジェクト: Strongc/proview
//
// Set attribute value
//
int XAttNav::set_attr_value( brow_tObject node, char *name, char *value_str)
{
  Item		*base_item;
  int		sts;
  char 		buff[1024];
  pwr_tAName    attr_str;

  // Check authorization
  if ( is_authorized_cb) {
    if ( !(is_authorized_cb( parent_ctx, 
			     pwr_mAccess_RtWrite | pwr_mAccess_System))) {
      message( 'E', "Not authorized for this operation");
      return XATT__NOTAUTHORIZED;
    }
  }

  // Check that object still exist
  if ( !object_exist( node))
    return XATT__DISAPPEARD;

  brow_GetUserData( node, (void **)&base_item);

  switch( base_item->type) {
    case xnav_eItemType_AttrArrayElem:
    case xnav_eItemType_Attr:
    case xnav_eItemType_Collect:
    {
      ItemAttr *item = (ItemAttr *)base_item;

      // Check that objid is still the same
      if ( strcmp(item->attr, name) != 0)
        return XATT__DISAPPEARD;

      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->attr);

      sts =  XNav::attr_string_to_value( item->type_id, 
	value_str, buff, sizeof(buff), item->size);
      if ( EVEN(sts))
        message( 'E', "Input syntax error");
      else
      {
        sts = gdh_SetObjectInfo( attr_str, buff, item->size);
        if ( EVEN(sts)) return sts;
      }
      return sts;
    }
    default:
      ;
  }
  return 1;
}
コード例 #5
0
ファイル: ge_subgraphs.cpp プロジェクト: Strongc/proview
static int subgraphs_trace_disconnect_bc( brow_tObject object)
{
  SubGraphBaseItem 		*base_item;

  brow_GetUserData( object, (void **)&base_item);
  switch( base_item->type)
  {
    default:
      ;
  }
  return 1;
}
コード例 #6
0
ファイル: ge_subgraphs.cpp プロジェクト: Strongc/proview
int SubGraphs::get_select( void **subgraph_item)
{
  brow_tNode	*node_list;
  int		node_count;
  SubGraphBaseItem *item;
  
  brow_GetSelectedNodes( brow->ctx, &node_list, &node_count);
  if ( !node_count)
    return 0;

  brow_GetUserData( node_list[0], (void **)&item);
  free( node_list);

  *subgraph_item = (void *)item;
  return 1;
}
コード例 #7
0
ファイル: xtt_xattnav.cpp プロジェクト: Strongc/proview
//
// Check that the current selected item is valid for change
//
int XAttNav::check_attr( int *multiline, brow_tObject *node, char *name,
		char **init_value, int *size)
{
  brow_tNode	*node_list;
  int		node_count;
  Item		*base_item;
  pwr_tStatus   sts;

  *init_value = 0;
  *multiline = 0;
  
  brow_GetSelectedNodes( brow->ctx, &node_list, &node_count);
  if ( !node_count)
    return XATT__NOSELECT;

  brow_GetUserData( node_list[0], (void **)&base_item);
  *node = node_list[0];
  free( node_list);

  switch( base_item->type) {

  case xnav_eItemType_Attr:
  case xnav_eItemType_AttrArrayElem:
  case xnav_eItemType_Collect: {

    pwr_tTypeId a_tid;
    pwr_tUInt32 a_size, a_offs, a_elem;
    ItemBaseAttr *item = (ItemBaseAttr *)base_item;

    if ( item->noedit)
      return XATT__NOCHANGE;
      
    strcpy( name, item->attr);

    sts = gdh_GetAttributeCharacteristics( name, &a_tid, &a_size, &a_offs, &a_elem);
    if ( ODD(sts))
      *size = cdh_TypeToMaxStrSize( (pwr_eType)item->type_id, a_size, a_elem);
    else
      *size = 80;
    
    return 1;
  }
  default:
    return XATT__NOCHANGE;
  }
}
コード例 #8
0
ファイル: ge_subgraphs.cpp プロジェクト: Strongc/proview
int SubGraphs::set_all_extern( int eval)
{
  brow_tNode	*node_list;
  int		node_count;
  SubGraphBaseItem *item;

  brow_GetObjectList( brow->ctx, &node_list, &node_count);
  if ( !node_count)
    return 0;
		      
  for ( int i = 0; i < node_count; i++) {
    brow_GetUserData( node_list[i], (void **)&item);
    if ( item->type == subgraphs_eItemType_SubGraph)
      ((ItemSubGraph *)item)->set_extern( eval);
  }
  return 1;
}
コード例 #9
0
ファイル: xtt_xattnav.cpp プロジェクト: Strongc/proview
int XAttNav::trace_disconnect_bc( brow_tObject object)
{
  Item 		*base_item;

  brow_GetUserData( object, (void **)&base_item);
  switch( base_item->type) {
  case xnav_eItemType_Attr:
  case xnav_eItemType_AttrArrayElem: {
    ItemAttr	*item = (ItemAttr *) base_item;
    
    gdh_UnrefObjectInfo( item->subid);
    break;
  }
  default:
    ;
  }
  return 1;
}
コード例 #10
0
ファイル: xtt_xattnav.cpp プロジェクト: Strongc/proview
int XAttNav::select_by_name( char *name)
{
  Item		*base_item;
  brow_tObject 	*object_list;
  int		object_cnt;
  int		i;
  int           found;
  brow_tObject  object;

  brow_GetObjectList( brow->ctx, &object_list, &object_cnt);
  found = 0;
  for ( i = 0; i < object_cnt; i++)
  {
    brow_GetUserData( object_list[i], (void **)&base_item);

    switch( base_item->type) {
      case xnav_eItemType_Attr:
      case xnav_eItemType_AttrArrayElem:
      {
        ItemBaseAttr *item = (ItemBaseAttr *)base_item;

	if ( strcmp( name, item->attr) == 0) {
          object = object_list[i];
          found = 1;
        }
        break;
      }
      default:
        ;
    }
    if ( found)
      break;
  }
  if ( !found)
    return XATT__ATTRNOTFOUND;

  brow_SelectClear( brow->ctx);
  brow_SetInverse( object, 1);
  brow_SelectInsert( brow->ctx, object);
  return XATT__SUCCESS;
}
コード例 #11
0
ファイル: xtt_tblnav.cpp プロジェクト: hfuhuang/proview
void TblNav::delete_item( TblNav_sevhistobject *hi)
{
  brow_tNode	*node_list;
  int		node_count;
  ItemBase 	*baseitem;
      
  brow_GetObjectList( brow->ctx, &node_list, &node_count);
  // Delete in tree
  for ( int i = 1; i < (int)tree.size(); i++) {
    if ( tree[i].deleted)
      continue;
    if ( tree[i].item &&
	 cdh_ObjidIsEqual( tree[i].item->oid, hi->oid) &&
	 strcmp( tree[i].item->objectattrlist[0].aname, hi->objectattrlist[0].aname) == 0) {
      tree[i].deleted = 1;
    }
  }

  // Delete node if visible
  brow_GetObjectList( brow->ctx, &node_list, &node_count);

  int found = 0;
  for ( int i = 0; i < node_count; i++) {
    brow_GetUserData( node_list[i], (void **)&baseitem);
    switch ( baseitem->type) {
    case tblnav_eItemType_Local:
    case tblnav_eItemType_TreeLocal: {
      ItemLocal *item = (ItemLocal *)baseitem;
      if ( cdh_ObjidIsEqual( hi->oid, item->item.oid) &&
	   strcmp( hi->objectattrlist[0].aname, item->item.objectattrlist[0].aname) == 0) {
	brow_DeleteNode( brow->ctx, item->node);
	found = 1;
      }
      break;
    }
    default: ;
    }
    if ( found)
      break;
  }
}
コード例 #12
0
ファイル: xtt_tblnav.cpp プロジェクト: hfuhuang/proview
int TblNav::get_select( TblNav_sevhistobject **hi)
{
  brow_tNode	*node_list;
  int		node_count;
  ItemLocal 		*item;
      
  brow_GetSelectedNodes( brow->ctx, &node_list, &node_count);

  if ( !node_count)
    return 0;

  brow_GetUserData( node_list[0], (void **)&item);
  switch ( item->type) {
  case tblnav_eItemType_Local:
  case tblnav_eItemType_TreeLocal:
    *hi = &item->item;
    return 1;
  default: ;
  }
  return 0;
}
コード例 #13
0
ファイル: pn_viewernav.cpp プロジェクト: siamect/proview
//
//  Get selected device
//
int PnViewerNav::get_selected_device(ItemDevice** device)
{
  brow_tNode* node_list;
  int node_count;
  ItemDevice* item;

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

  brow_GetUserData(node_list[0], (void**)&item);
  free(node_list);

  switch (item->type) {
  case viewitem_eItemType_Device:
    *device = item;
    break;
  default:
    return 0;
  }
  return 1;
}
コード例 #14
0
ファイル: xtt_xattnav.cpp プロジェクト: Strongc/proview
void XAttNav::start_trace()
{
  brow_tNode	*node_list;
  int		node_count;
  ItemCrossref	*item;

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

  brow_GetUserData( node_list[0], (void **)&item);
  free( node_list);

  switch( item->type)
  {
    case xnav_eItemType_Crossref:
      if ( start_trace_cb)
        (start_trace_cb)( parent_ctx, item->objid, item->ref_name);
      break;
    default:
      ;
  }
}
コード例 #15
0
ファイル: ge_subgraphs.cpp プロジェクト: Strongc/proview
static int subgraphs_trace_scan_bc( brow_tObject object, void *p)
{
  SubGraphBaseItem	*base_item;
  char		buf[20];
  int		len;

  brow_GetUserData( object, (void **)&base_item);
  switch( base_item->type)
  {
    case subgraphs_eItemType_SubGraph:
    {
      ItemSubGraph	*item;

      item = (ItemSubGraph *)base_item;
      if ( !item->first_scan)
      {
        if ( *item->extern_p == item->old_extern)
          // No change since last time
          return 1;
      }
      else
        item->first_scan = 0;

      if ( *item->extern_p)
        len = sprintf( buf, "Extern");
      else
        len = sprintf( buf, "Intern");
      brow_SetAnnotation( object, 1, buf, len);
      item->old_extern = *item->extern_p;
      break;
    }
    default:
      ;
  }
  return 1;
}
コード例 #16
0
ファイル: ge_subgraphs.cpp プロジェクト: Strongc/proview
static int subgraphs_trace_connect_bc( brow_tObject object, char *name, char *attr, 
	flow_eTraceType type, /* flow_eDrawType color, */ void **p)
{
  SubGraphBaseItem 	*base_item;

  if ( strcmp(name,"") == 0)
    return 1;

  brow_GetUserData( object, (void **)&base_item);
  switch( base_item->type)
  {
    case subgraphs_eItemType_SubGraph:
    {
      ItemSubGraph	*item;

      item = (ItemSubGraph *) base_item;
      *p = item->extern_p;
      break;
    }
    default:
      ;
  }      
  return 1;
}
コード例 #17
0
ファイル: xtt_xattnav.cpp プロジェクト: Strongc/proview
int XAttNav::get_select( pwr_tAttrRef *arp)
{
  brow_tNode	*node_list;
  int		node_count;
  ItemCollect	*item;
  pwr_tStatus 	sts;

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

  brow_GetUserData( node_list[0], (void **)&item);
  free( node_list);

  switch( item->type) {
  case xnav_eItemType_Collect:
    sts = gdh_NameToAttrref( pwr_cNObjid, item->name, arp);
    if ( EVEN(sts)) return sts;
    break;
  default:
    return 0;
  }
  return XATT__SUCCESS;
}
コード例 #18
0
ファイル: xtt_clognav.cpp プロジェクト: siamect/proview
//
// 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;
}
コード例 #19
0
ファイル: cow_logwnav.cpp プロジェクト: Strongc/proview
//
// 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;
}
コード例 #20
0
ファイル: pn_viewernav.cpp プロジェクト: siamect/proview
//
// Set attribute value
//
int PnViewerNav::set_attr_value(char* value_str)
{
  brow_tNode* node_list;
  int node_count;
  ItemDeviceAttr* base_item;
  int sts;

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

  brow_GetUserData(node_list[0], (void**)&base_item);
  free(node_list);

  switch (base_item->type) {
  case viewitem_eItemType_DeviceAttr: {
    ItemDeviceAttr* item;

    item = (ItemDeviceAttr*)base_item;

    if (streq(item->name, "IP Address")) {
      unsigned char address[4];
      int num;

      num = sscanf(value_str, "%hhu.%hhu.%hhu.%hhu", &address[3], &address[2],
          &address[1], &address[0]);
      if (num != 4)
        return PB__SYNTAX;

      // Change ip address in parent node
      brow_tNode parent;
      ItemDevice* pitem;

      sts = brow_GetParent(brow->ctx, item->node, &parent);
      if (EVEN(sts))
        return 0;

      brow_GetUserData(parent, (void**)&pitem);

      memcpy(pitem->ipaddress, address, sizeof(pitem->ipaddress));

      strcpy((char*)item->p, value_str);
      brow_SetAnnotation(item->node, 1, (char*)item->p, strlen((char*)item->p));
    } else if (streq(item->name, "DeviceName")) {
      strcpy((char*)item->p, value_str);
      brow_SetAnnotation(item->node, 1, (char*)item->p, strlen((char*)item->p));

      // Change parent annotation also
      brow_tNode parent;
      ItemDevice* pitem;

      sts = brow_GetParent(brow->ctx, item->node, &parent);
      if (EVEN(sts))
        return 0;

      brow_GetUserData(parent, (void**)&pitem);
      brow_SetAnnotation(
          pitem->node, 0, (char*)item->p, strlen((char*)item->p));
    }
    break;
  }
  default:;
  }
  return 1;
}
コード例 #21
0
ファイル: pn_viewernav.cpp プロジェクト: siamect/proview
//
// 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;
}
コード例 #22
0
ファイル: wb_pal_motif.cpp プロジェクト: Strongc/proview
static Boolean pal_sel_convert_cb(
    Widget  w,
    Atom    *selection,
    Atom    *target,
    Atom    *type_return,
    XtPointer	*value_return,
    unsigned long   *length_return,
    int	    *format_return)
{
  PalMotif     	*pal;
  brow_tCtx	browctx;
  char		name[200];
  PalItem	*item;

  BrowCtxFromWidget( w, (void **) &browctx);
  brow_GetCtxUserData( browctx, (void **) &pal);

  if (*target == XA_TARGETS(flow_Display(pal->brow_widget))) {
    Atom *targetP;
    Atom *std_targets;
    unsigned long std_length;
    XSelectionRequestEvent *req = XtGetSelectionRequest( w, *selection, 
       (XtRequestId)NULL);

    XmuConvertStandardSelection( w, req->time, selection, target, type_return,
		(caddr_t *)&std_targets, &std_length, format_return);

    *value_return = XtMalloc( sizeof(Atom) * (std_length + 2));
    targetP = *(Atom **) value_return;
    *targetP++ = XA_STRING;
    *targetP++ = XA_TEXT(flow_Display(pal->brow_widget));
    *length_return = std_length + (targetP - (*(Atom **) value_return));
    bcopy((char *)std_targets, (char *)targetP, sizeof(Atom) * std_length);
    XtFree( (char *)std_targets);
    *type_return = XA_ATOM;
    *format_return = 32;
    return True;
  }

  if (*target == XA_STRING ||
      *target == XA_TEXT(flow_Display(pal->brow_widget)) ||
      *target == XA_COMPOUND_TEXT(flow_Display(pal->brow_widget))) {
    brow_tNode	*node_list;
    int		node_count;
  
    brow_GetSelectedNodes( pal->brow_ctx, &node_list, &node_count);
    if ( !node_count)
      return FALSE;

    brow_GetUserData( node_list[0], (void **)&item);

    switch( item->type) {
      case pal_ePalItemType_ClassVolume: 
      case pal_ePalItemType_Class: 
      case pal_ePalItemType_Object: 
      default:
        brow_GetAnnotation( node_list[0], 0, name, sizeof(name));
        *value_return = XtNewString(name);      
        *length_return = strlen(name) + 1;
    }
    free( node_list);

    *type_return = XA_STRING;
    *format_return = 8;

    return TRUE;
  }
  return FALSE;
}
コード例 #23
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;
}
コード例 #24
0
ファイル: wb_wnav_motif.cpp プロジェクト: Strongc/proview
Boolean WNavMotif::sel_convert_cb(
    Widget  w,
    Atom    *selection,
    Atom    *target,
    Atom    *type_return,
    XtPointer	*value_return,
    unsigned long   *length_return,
    int	    *format_return)
{
    WNavMotif    	*wnav;
    brow_tCtx	browctx;
    int 		sts;
    int		size;
    WItem		*item;
    pwr_tAName   	attr_str;
    pwr_sAttrRef attrref;
    char          name[200];
    char		*buffp;

    BrowCtxFromWidget( w, (void **) &browctx);
    brow_GetCtxUserData( browctx, (void **) &wnav);

    if (*target == XA_TARGETS(flow_Display(wnav->brow_widget))) {
        Atom *targetP;
        Atom *std_targets;
        unsigned long std_length;
        XSelectionRequestEvent *req = XtGetSelectionRequest( w, *selection,
                                      (XtRequestId)NULL);

        XmuConvertStandardSelection( w, req->time, selection, target, type_return,
                                     (caddr_t *)&std_targets, &std_length, format_return);

        *value_return = XtMalloc( sizeof(Atom) * (std_length + 2));
        targetP = *(Atom **) value_return;
        *targetP++ = XA_STRING;
        *targetP++ = XA_TEXT(flow_Display(wnav->brow_widget));
        *length_return = std_length + (targetP - (*(Atom **) value_return));
        bcopy((char *)std_targets, (char *)targetP, sizeof(Atom) * std_length);
        XtFree( (char *)std_targets);
        *type_return = XA_ATOM;
        *format_return = 32;
        return True;
    }

    if (*target == XA_STRING ||
            *target == XA_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)
            return FALSE;

        brow_GetUserData( node_list[0], (void **)&item);

        switch( item->type) {
        case wnav_eItemType_Attr:
        case wnav_eItemType_AttrInput:
        case wnav_eItemType_AttrInputInv:
        case wnav_eItemType_AttrInputF:
        case wnav_eItemType_AttrOutput:
        case wnav_eItemType_AttrArray:
        case wnav_eItemType_AttrArrayOutput:
        case wnav_eItemType_AttrArrayElem:
        case wnav_eItemType_AttrObject: {
            WItemBaseAttr *aitem = (WItemBaseAttr *)item;

            sts = ldh_ObjidToName( wnav->ldhses, item->objid, ldh_eName_Hierarchy,
                                   attr_str, sizeof(attr_str), &size);
            if ( EVEN(sts)) return FALSE;

            strcat( attr_str, ".");
            strcat( attr_str, aitem->name);
            sts = ldh_NameToAttrRef( wnav->ldhses, attr_str, &attrref);
            if ( EVEN(sts)) return FALSE;
            sts = (wnav->format_selection_cb)( wnav->parent_ctx, attrref,
                                               &buffp, 0, 1, format);
            *value_return = XtNewString(buffp);
            *length_return = strlen(buffp) + 1;
            if ( !sts) return FALSE;
            break;
        }
        case wnav_eItemType_Object:
            memset( &attrref, 0, sizeof(attrref));
            attrref.Objid = item->objid;
            sts = (wnav->format_selection_cb)( wnav->parent_ctx, attrref,
                                               &buffp, 0, 0, format);
            *value_return = XtNewString(buffp);
            *length_return = strlen(buffp) + 1;
            if ( !sts) return FALSE;
            break;
        default:
            brow_GetAnnotation( node_list[0], 0, name, sizeof(name));
            *value_return = XtNewString(name);
            *length_return = strlen(name) + 1;
        }
        free( node_list);

        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;
        *format_return = 8;

        return TRUE;
    }
    return FALSE;
}
コード例 #25
0
void SubPalette::select_by_name( char *name)
{
  // Refresh
  brow_SetNodraw( brow->ctx);
  brow_DeleteAll( brow->ctx);
  ((ItemMenu *)root_item)->open_children( this, 0, 0);

  char *s = name;
  char *t = name;
  char itemname[200];
  int level = 0;
  brow_tObject *nodelist;
  brow_tObject current;
  brow_tObject child;
  int nodecnt;
  Item *item;
  int sts;

  for (;;) {
    if ( !t)
      break;

    level ++;
    strcpy( itemname, t);
    if ( (s = strchr( itemname, '-'))) {
      *s = 0;
      t += (s - itemname + 1);

    }
    else 
      t = 0;

    if ( level == 1) {
      brow_GetObjectList( brow->ctx, &nodelist, &nodecnt);
      for ( int i = 0; i < nodecnt; i++) {
  
	brow_GetUserData( nodelist[i], (void **)&item);
	if ( strcmp( itemname, item->name) == 0) {
	  current = nodelist[i];
	}
      }
    }
    else {
      current = 0;
      item->open_children( this, 0, 0);
      for ( sts = brow_GetChild( brow->ctx, item->node, &child);
	    ODD( sts);
	    sts = brow_GetNextSibling( brow->ctx, child, &child)) {

	brow_GetUserData( child, (void **)&item);
	if ( cdh_NoCaseStrcmp( itemname, item->name) == 0) {
	  current = child;
	  break;
	}
      }
      if ( !current)
	break;
    }

  }
  brow_ResetNodraw( brow->ctx);
  brow_Redraw( brow->ctx, 0);

  if ( current) {
    brow_SetInverse( current, 1);
    brow_SelectInsert( brow->ctx, current);
    if ( !brow_IsVisible( brow->ctx, current, flow_eVisible_Full))
      brow_CenterObject( brow->ctx, current, 0.25);
  }
}
コード例 #26
0
ファイル: xtt_tblnav.cpp プロジェクト: hfuhuang/proview
//
// 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;
}
コード例 #27
0
ファイル: xtt_xattnav.cpp プロジェクト: Strongc/proview
int XAttNav::trace_scan_bc( brow_tObject object, void *p)
{
  Item		*base_item;
  char		buf[500];
  int		len;

  brow_GetUserData( object, (void **)&base_item);
  switch( base_item->type)
  {
    case xnav_eItemType_Attr:
    case xnav_eItemType_AttrArrayElem:
    case xnav_eItemType_Collect:
    {
      ItemAttr	*item;

      item = (ItemAttr *)base_item;
      if ( !item->first_scan)
      {
        if ( item->size > (int) sizeof(item->old_value) && 
	     item->type_id == pwr_eType_String &&
	     strlen((char *)p) < sizeof(item->old_value) && 
	     strcmp( (char *)p, item->old_value) == 0)
          // No change since last time
          return 1;
        else if ( memcmp( item->old_value, p, item->size) == 0)
          // No change since last time
          return 1;
      }
      else
        item->first_scan = 0;

      XNav::attrvalue_to_string( item->type_id, item->tid, p, buf, sizeof(buf), &len, NULL,
				 item->conversion);
      brow_SetAnnotation( object, 1, buf, len);
      memcpy( item->old_value, p, min(item->size, (int) sizeof(item->old_value)));
      break;
    }
    case xnav_eItemType_Enum: {
      ItemEnum	*item;

      item = (ItemEnum *)base_item;
      if ( !item->first_scan) {
        if ( memcmp( item->old_value, p, sizeof(pwr_tEnum)) == 0)
          // No change since last time
          return 1;
      }
      else
        item->first_scan = 0;

      if ( *(pwr_tEnum *)p == item->num)
	brow_SetRadiobutton( object, 0, 1);
      else
	brow_SetRadiobutton( object, 0, 0);
      memcpy( item->old_value, p, sizeof(pwr_tEnum));
      break;
    }
    case xnav_eItemType_Mask: {
      ItemMask	*item;

      item = (ItemMask *)base_item;
      if ( !item->first_scan) {
        if ( memcmp( item->old_value, p, sizeof(pwr_tMask)) == 0)
          // No change since last time
          return 1;
      }
      else
        item->first_scan = 0;

      if ( *(pwr_tMask *)p & item->num)
	brow_SetRadiobutton( object, 0, 1);
      else
	brow_SetRadiobutton( object, 0, 0);
      memcpy( item->old_value, p, sizeof(pwr_tMask));
      break;
    }
    default:
      ;
  }
  return 1;
}
コード例 #28
0
ファイル: ge_subgraphs.cpp プロジェクト: Strongc/proview
//
// 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;
}
コード例 #29
0
//
// 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;
}
コード例 #30
0
ファイル: xtt_xattnav.cpp プロジェクト: Strongc/proview
//
// 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;
}