Exemple #1
0
int ItemTreeNode::open_children( TblNav *tblnav, double x, double y)
{
  double	node_x, node_y;

  brow_GetNodePosition( node, &node_x, &node_y);

  if ( brow_IsOpen( node) & tblnav_mOpen_Children) {
    // Attributes is open, close
    brow_SetNodraw( tblnav->brow->ctx);
    brow_CloseNode( tblnav->brow->ctx, node);
    brow_ResetOpen( node, tblnav_mOpen_Children);
    brow_RemoveAnnotPixmap( node, 1);
    brow_ResetNodraw( tblnav->brow->ctx);
    brow_Redraw( tblnav->brow->ctx, node_y);
  }
  else {

    brow_SetNodraw( tblnav->brow->ctx);
    for ( int i = tblnav->tree[idx].fch; i; i = tblnav->tree[i].fws) {
      if ( tblnav->tree[i].deleted)
	continue;

      if ( tblnav->tree[i].item)
	  new ItemTreeLocal( tblnav, tblnav->tree[i].item, i, node, flow_eDest_IntoLast);
      else
	  new ItemTreeNode( tblnav, tblnav->tree[i].sname, i, node, flow_eDest_IntoLast);
    }
    brow_SetOpen( node, tblnav_mOpen_Children);
    brow_SetAnnotPixmap( node, 1, tblnav->brow->pixmap_openmap);
    brow_ResetNodraw( tblnav->brow->ctx);
    brow_Redraw( tblnav->brow->ctx, node_y);
  }
  return 1;
}
int ItemMenu::close( SubPalette *subpalette, double x, double y)
{
  double	node_x, node_y;

  if ( brow_IsOpen( node))
  {
    // Close
    brow_GetNodePosition( node, &node_x, &node_y);
    brow_SetNodraw( subpalette->brow->ctx);
    brow_CloseNode( subpalette->brow->ctx, node);
    if ( brow_IsOpen( node) & subpalette_mOpen_Attributes)
      brow_RemoveAnnotPixmap( node, 1);
    if ( brow_IsOpen( node) & subpalette_mOpen_Children)
      brow_SetAnnotPixmap( node, 0, subpalette->brow->pixmap_map);
    brow_ResetOpen( node, subpalette_mOpen_All);
    brow_ResetNodraw( subpalette->brow->ctx);
    brow_Redraw( subpalette->brow->ctx, node_y);
  }
  return 1;
}
int ItemLocalSubGraphs::open_children( SubPalette *subpalette, double x, double y)
{
  double	node_x, node_y;
  int		child_exist;

  brow_GetNodePosition( node, &node_x, &node_y);

  if ( brow_IsOpen( node))
  {
    // Close
    brow_SetNodraw( subpalette->brow->ctx);
    brow_CloseNode( subpalette->brow->ctx, node);
    if ( brow_IsOpen( node) & subpalette_mOpen_Attributes)
      brow_RemoveAnnotPixmap( node, 1);
    if ( brow_IsOpen( node) & subpalette_mOpen_Children)
      brow_SetAnnotPixmap( node, 0, subpalette->brow->pixmap_map);
    brow_ResetOpen( node, subpalette_mOpen_All);
    brow_ResetNodraw( subpalette->brow->ctx);
    brow_Redraw( subpalette->brow->ctx, node_y);
  }
  else
  {
    int			sts;
    char		found_file[120];
    char		fname[120];
    char		dev[80], dir[80], file[80], type[80];
    int			version;
    char		text[80];
    char		*s;
    int			idx;
    char		file_str[5][80];
    int		        nr;
    int                 i;
    vector<LocalFile> fvect;

    // Create some children
    brow_SetNodraw( subpalette->brow->ctx);

    child_exist = 0;

    nr = dcli_parse( filename, ",", "", (char *)file_str,
		sizeof( file_str) / sizeof( file_str[0]), sizeof( file_str[0]), 0);
    for ( i = 0; i < nr; i++) {
      dcli_translate_filename( fname, file_str[i]);
      sts = dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_INIT);
      if ( ODD(sts)) {
	LocalFile f;
	strcpy( f.name, found_file);
	fvect.push_back( f);
      }
      while ( ODD(sts)) {
        sts = dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_NEXT);
        if ( ODD(sts)) {
	  LocalFile f;
	  strcpy( f.name, found_file);
	  fvect.push_back( f);
	}
      }
      dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_END);
    }

    subpalette_sort( fvect);

    for ( i = 0; i < (int) fvect.size(); i++) {
      dcli_parse_filename( fvect[i].name, dev, dir, file, type, &version);
      cdh_ToLower( text, file);
      text[0] = toupper( text[0]);
      
      // Skip next pages in animations
      if ( !((s = strstr( text, "__p")) && sscanf( s+3, "%d", &idx))) {
	new ItemFile( subpalette, text, fvect[i].name, 0, node, flow_eDest_IntoLast);
	child_exist = 1;
      }
    }

    if ( child_exist)
    {
      brow_SetOpen( node, subpalette_mOpen_Children);
      brow_SetAnnotPixmap( node, 0, subpalette->brow->pixmap_openmap);
    }
    brow_ResetNodraw( subpalette->brow->ctx);
    if ( child_exist)
      brow_Redraw( subpalette->brow->ctx, node_y);
  }
  return 1;
}