Exemplo n.º 1
0
int	XNav::help( char *help_key, char *help_bookmark, 
		navh_eHelpFile file_type, char *file_name, int pop)
{
  int sts;
  brow_tNode bookmark_node;
  brow_tNode prev, first;
  NavHelp *navhelp = new NavHelp( (void *)this, "$pwr_exe/xtt_help.dat",
				  "$pwrp_exe/xtt_help.dat");
  navhelp->insert_cb = xnav_help_insert_cb;

  if ( pop)
    init_help = 1;
  else {
    init_help = 2;
    brow_SetNodraw( brow->ctx);
  }
  sts = navhelp->help( help_key, help_bookmark, file_type, 
		       file_name, &bookmark_node, false);
  if ( EVEN(sts)) {
    if ( !pop || (pop && init_help != 1)) {
      brow_push();
      brow_ResetNodraw( brow->ctx);
    }
    return sts;
  }

  brow_ResetNodraw( brow->ctx);
  brow_Redraw( brow->ctx, 0);
  if ( bookmark_node) {
    brow_CenterObject( brow->ctx, bookmark_node, 0.0);
    sts = brow_GetPrevious( brow->ctx, bookmark_node, &prev);
    if ( ODD(sts))
    {
      brow_SelectClear( brow->ctx);
      brow_SetInverse( prev, 1);
      brow_SelectInsert( brow->ctx, prev);
    }
  }
  else {
    sts = brow_GetFirst( brow->ctx, &first);
    if ( ODD(sts))
      brow_CenterObject( brow->ctx, first, 0.0);
  }
  delete navhelp;

  return XNAV__SUCCESS;
}
Exemplo n.º 2
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;
}
Exemplo n.º 3
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;
}