Esempio n. 1
0
static gboolean
create_custom_texture_pages (GtkNotebook *notebook, const gchar *texture_path)
{
  gboolean has_custom_texture = FALSE;

  const gchar *gimp_dir = gimp_directory ();
  const gchar *texture_dir = g_build_filename (gimp_dir, texture_path, NULL);
  GDir *dir = g_dir_open (texture_dir, 0, NULL);
  if (dir)
  {
    const gchar *dir_ent;
    while (dir_ent = g_dir_read_name (dir))
    {
      if (is_hidden (dir_ent))
        continue;

      gchar *filename = g_build_filename (texture_dir, dir_ent, NULL);
      if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
        create_custom_texture_page (GTK_NOTEBOOK (notebook), dir_ent, filename);
        has_custom_texture = TRUE;
      }
    }
  }

  return has_custom_texture;
}
Esempio n. 2
0
void Sprite::hide()
{
    if (is_hidden())
        return;

    state_ |= kIsHidden | kStaleMask;
}
Esempio n. 3
0
    void widget_group::
    add (
        drawable& widget,
        unsigned long x,
        unsigned long y
    )
    {
        auto_mutex M(m); 
        drawable* w = &widget;
        relpos rp;
        rp.x = x;
        rp.y = y;
        if (widgets.is_in_domain(w))
        {
            widgets[w].x = x;
            widgets[w].y = y;
        }
        else
        {
            widgets.add(w,rp);
        }
        if (is_hidden())
            widget.hide();
        else
            widget.show();

        if (is_enabled())
            widget.enable();
        else
            widget.disable();

        widget.set_z_order(z_order());
        widget.set_pos(x+rect.left(),y+rect.top());
    }
Esempio n. 4
0
static char *mk_desc(t_pargs *pa, char *time_unit_str)
{
  char *newdesc=NULL,*ndesc=NULL,*ptr=NULL;
  int  len,k;
  
  /* First compute length for description */
  len = strlen(pa->desc)+1;
  if ((ptr = strstr(pa->desc,"HIDDEN")) != NULL)
    len += 4;
  if (pa->type == etENUM) {
    len += 10;
    for(k=1; (pa->u.c[k] != NULL); k++) {
      len += strlen(pa->u.c[k])+12;
    }
  }
  snew(newdesc,len);
  
  /* add label for hidden options */
  if (is_hidden(pa)) 
    sprintf(newdesc,"[hidden] %s",ptr+6);
  else
    strcpy(newdesc,pa->desc);
  
  /* change '%t' into time_unit */
#define TUNITLABEL "%t"
#define NTUNIT strlen(TUNITLABEL)
  if (pa->type == etTIME)
    while( (ptr=strstr(newdesc,TUNITLABEL)) != NULL ) {
      ptr[0]='\0';
      ptr+=NTUNIT;
      len+=strlen(time_unit_str)-NTUNIT;
      snew(ndesc,len);
      strcpy(ndesc,newdesc);
      strcat(ndesc,time_unit_str);
      strcat(ndesc,ptr);
      sfree(newdesc);
      newdesc=ndesc;
      ndesc=NULL;
    }
#undef TUNITLABEL
#undef NTUNIT
  
  /* Add extra comment for enumerateds */
  if (pa->type == etENUM) {
    strcat(newdesc,": ");
    for(k=1; (pa->u.c[k] != NULL); k++) {
      strcat(newdesc,"[TT]");
      strcat(newdesc,pa->u.c[k]);
      strcat(newdesc,"[tt]");
      /* Print a comma everywhere but at the last one */
      if (pa->u.c[k+1] != NULL) {
	if (pa->u.c[k+2] == NULL)
	  strcat(newdesc," or ");
	else
	  strcat(newdesc,", ");
      }
    }
  }
  return newdesc;
}
Esempio n. 5
0
static void		display_file(char **tab, char *option)
{
	int j;

	j = 0;
	while (tab[j])
	{
		if ((IS_A_2 && !is_main(tab[j])) || IS_A || IS_F)
		{
			ft_putstr_name(tab[j++]);
			if (IS_P && is_file_or_dir(tab[j - 1]) == 2)
				ft_putchar('/');
			ft_putchar('\n');
		}
		else if (!(is_hidden(tab[j])))
		{
			ft_putstr_name(tab[j++]);
			if (IS_P && is_file_or_dir(tab[j - 1]) == 2)
				ft_putchar('/');
			ft_putchar('\n');
		}
		else
			++j;
	}
}
Esempio n. 6
0
// Returns whether or not we succeeded
bool get_relative_name_recursive(Block* block, Term* term, std::stringstream& output)
{
    if (name_is_reachable_from(term, block)) {
        output << term->name();
        return true;
    }

    Term* parentTerm = parent_term(term);

    if (parentTerm == NULL)
        return false;

    // Don't include the names of hidden or builtin blocks.
    if (is_hidden(parentTerm)) {
        output << term->name();
        return true;
    }
    
    if (parentTerm->nestedContents != NULL &&
        block_get_bool_prop(parentTerm->nestedContents, s_Builtins, false))
    {
        output << term->name();
        return true;
    }

    bool success = get_relative_name_recursive(block, parentTerm, output);

    if (!success)
        return false;

    output << ":" << term->name();
    return true;
}
Esempio n. 7
0
void print_pargs(FILE *fp, int npargs,t_pargs pa[],bool bLeadingSpace)
{
  bool bShowHidden;
  char buf[32],buf2[256],tmp[256];
  char *wdesc;
  int  i;
  
  /* Cannot call opt2parg_bSet here, because it crashes when the option
   * is not in the list (mdrun)
   */
  bShowHidden = FALSE;
  for(i=0; (i<npargs); i++) 
    if ((strcmp(pa[i].option,"-hidden")==0) && (pa[i].bSet))
      bShowHidden = TRUE;
  
  if (npargs > 0) {
    fprintf(fp,"%s%-12s %-6s %-6s  %-s\n",
	    bLeadingSpace ? " " : "","Option","Type","Value","Description");
    fprintf(fp,"%s------------------------------------------------------\n",
	    bLeadingSpace ? " " : "");
    for(i=0; (i<npargs); i++) {
      if (bShowHidden || !is_hidden(&pa[i])) {
	wdesc = pargs_print_line(&pa[i],bLeadingSpace);
	fprintf(fp,"%s",wdesc);
	sfree(wdesc);
      }
    }
    fprintf(fp,"\n");
  }
}
Esempio n. 8
0
void Sprite::show()
{
    if (!is_hidden())
        return;

    state_ &= ~kIsHidden;
    state_ |= kStaleMask;
}
void Button::draw()
{
    if (is_hidden()) return;

    image.draw(x, y);

    if (!is_active()) return;

    sf2d_draw_rectangle(x, y, width, height, blend_color.color());
}
void Slider::draw()
{
    if (is_hidden()) return;

    sf2d_draw_rectangle(x, y, width, height, RGBA8(0x40, 0x40, 0x40, 255));
    int percent = value * width / (max - min);
    sf2d_draw_rectangle(x + percent - 2, y - 6 + height / 2, 5, 12, RGBA8(0x60, 0x60, 0x60, 255));
    sf2d_draw_rectangle(x + percent - 2 + 1, y - 6 + height / 2 + 1, 3, 10, !is_active() ? color.start() : color.color());
    if (style & LABELS)
        font->draw(value, x + width, y);
}
void EditorAssetLibrary::_notification(int p_what) {

	if (p_what==NOTIFICATION_READY) {
		TextureFrame *tf = memnew(TextureFrame);
		tf->set_texture(get_icon("Error","EditorIcons"));
		reverse->set_icon(get_icon("Updown","EditorIcons"));

		error_hb->add_child(tf);
		error_label->raise();
	}

	if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
		if(!is_hidden()) {
			_repository_changed(0); // Update when shown for the first time
		}
	}

	if (p_what==NOTIFICATION_PROCESS) {

		HTTPClient::Status s = request->get_http_client_status();
		bool visible = s!=HTTPClient::STATUS_DISCONNECTED;

		if (visible != !load_status->is_hidden()) {
			load_status->set_hidden(!visible);
		}

		if (visible) {
			switch(s) {

				case HTTPClient::STATUS_RESOLVING: {
					load_status->set_val(0.1);
				} break;
				case HTTPClient::STATUS_CONNECTING: {
					load_status->set_val(0.2);
				} break;
				case HTTPClient::STATUS_REQUESTING: {
					load_status->set_val(0.3);
				} break;
				case HTTPClient::STATUS_BODY: {
					load_status->set_val(0.4);
				} break;
				default: {}

			}
		}

		bool no_downloads = downloads_hb->get_child_count()==0;
		if (no_downloads != downloads_scroll->is_hidden()) {
			downloads_scroll->set_hidden(no_downloads);
		}
	}

}
Esempio n. 12
0
void write_man(FILE *out,char *mantp,
	       char *program,
	       int nldesc,char **desc,
	       int nfile,t_filenm *fnm,
	       int npargs,t_pargs *pa,
	       int nbug,char **bugs,bool bHidden)
{
  char    *pr;
  int     i,npar;
  t_pargs *par;
 
  /* Don't write hidden options to completions, it just
   * makes the options more complicated for normal users
   */

  if (bHidden) {
    npar=npargs;
    par=pa;
  }
  else {
    snew(par,npargs);
    npar=0;
    for(i=0;i<npargs;i++)
      if (!is_hidden(&pa[i])) {
	par[npar]=pa[i];
	npar++;
      }
  }
  
  if ((pr=strrchr(program,'/')) == NULL)
    pr=program;
  else
    pr+=1;
  if (strcmp(mantp,"tex")==0)
    write_texman(out,pr,nldesc,desc,nfile,fnm,npar,par,nbug,bugs);
  if (strcmp(mantp,"nroff")==0)
    write_nroffman(out,pr,nldesc,desc,nfile,fnm,npar,par,nbug,bugs);
  if (strcmp(mantp,"ascii")==0)
    write_ttyman(out,pr,nldesc,desc,nfile,fnm,npar,par,nbug,bugs,TRUE);
  if (strcmp(mantp,"help")==0)
    write_ttyman(out,pr,nldesc,desc,nfile,fnm,npar,par,nbug,bugs,FALSE);
  if (strcmp(mantp,"html")==0)
    write_htmlman(out,pr,nldesc,desc,nfile,fnm,npar,par,nbug,bugs);
  if (strcmp(mantp,"completion-zsh")==0)
    write_zshcompl(out,nfile,fnm,npar,par);
  if (strcmp(mantp,"completion-bash")==0)
    write_bashcompl(out,nfile,fnm,npar,par);
  if (strcmp(mantp,"completion-csh")==0)
    write_cshcompl(out,nfile,fnm,npar,par);

  if (!bHidden)
    sfree(par);
}
Esempio n. 13
0
void
Feeder::AddEntry(entry_ref *ref)
{
	BEntry entry(ref) ;
	entry_ref *ref_ptr ;

	if(entry.InitCheck() == B_OK && entry.IsFile() && !is_hidden(ref)
		&& !Excluded(ref)) {
			ref_ptr = new entry_ref(*ref) ;
			fIndexQueue.AddItem((entry_ref*)ref_ptr) ;
	}
}
Esempio n. 14
0
bool is_considered_config(Term* term)
{
    if (term == NULL) return false;
    if (has_empty_name(term)) return false;
    if (!is_value(term)) return false;
    if (is_declared_state(term)) return false;
    if (is_hidden(term)) return false;
    if (is_function(term)) return false;
    if (is_type(term)) return false;

    return true;
}
Esempio n. 15
0
static void _draw_item(const madshelf_state_t* state, Evas_Object* item,
                       int item_num)
{
    item_clear(item);

    _loc_t* _loc = (_loc_t*)state->loc;
    char* filename = eina_array_data_get(_loc->files, item_num);

    fileinfo_t* fileinfo = fileinfo_create(filename);
    fileinfo_render(item, fileinfo, is_hidden(state, filename));
    fileinfo_destroy(fileinfo);
}
Esempio n. 16
0
File: talk.c Progetto: yrchen/Athena
char *
modestring(user_info *uentp, int simple)
{
    static char modestr[40];
    static char *notonline="不在站上";
    register int mode = uentp->mode;
    register char *word;

    word = ModeTypeTable[mode];

    if (!(HAS_PERM(PERM_SYSOP) || HAS_PERM(PERM_SEECLOAK)) &&
            (uentp->invisible || (is_rejected(uentp) & HRM)))
        return (notonline);
    else if (mode == EDITING)
    {
        sprintf(modestr, "E:%s",
                ModeTypeTable[uentp->destuid < EDITING ? uentp->destuid : EDITING]);
        word = modestr;
    }
    else if (!mode && *uentp->chatid == 1)
    {
        if (!simple)
            sprintf(modestr, "回應 %s", getuserid(uentp->destuid));
        else
            sprintf(modestr, "回應呼叫");
    }

    else if (!mode && *uentp->chatid == 3)
        sprintf(modestr, "水球準備中");
    else if (!mode)
        return (uentp->destuid == 6) ? uentp->chatid :
               IdleTypeTable[(0 <= uentp->destuid & uentp->destuid < 6) ?
                             uentp->destuid: 0];
    else if (simple)
        return (word);

    else if (uentp->in_chat & mode == CHATING)
        sprintf(modestr, "%s (%s)", word, uentp->chatid);
    else if (mode == TALK)
    {
        if (is_hidden(getuserid(uentp->destuid)))    /* Leeym 對方(紫色)隱形 */
            sprintf(modestr, "%s", "自言自語中"); /* Leeym 大家自己發揮吧! */
        else
            sprintf(modestr, "%s %s", word, getuserid(uentp->destuid));
    }
    else if (mode != PAGE && mode != QUERY)
        return (word);
    else
        sprintf(modestr, "%s %s", word, getuserid(uentp->destuid));

    return (modestr);
}
Esempio n. 17
0
// Insert a directory entry if it is not a hidden file.
void insert (slist_ref slist, char *path, char *ename) {
   char buffer[MAX_BUFFER_SIZE];
   pathstr (buffer, path, ename);
   struct stat fs;
   int stat_rc = stat (buffer, &fs);
   if (stat_rc >= 0) {
      slist_node node = new_slistnode (&fs, ename);

      if (! is_hidden (node)) insert_slist (slist, node);
                         else free_slistnode (node);
      
   }else {
      print_error (ename, strerror (errno));
   }
}
Esempio n. 18
0
    void formatSource(caValue* source, Term* term)
    {
        format_name_binding(source, term);

        Block* contents = nested_contents(term);

        int index = 0;
        while (contents->get(index)->function == FUNCS.input)
            index++;

        bool firstCase = true;

        for (; index < contents->length(); index++) {
            Term* caseTerm = contents->get(index);

            if (caseTerm->function != FUNCS.case_func)
                break;

            if (is_hidden(caseTerm))
                continue;

            append_phrase(source,
                    caseTerm->stringProp("syntax:preWhitespace", ""),
                    caseTerm, tok_Whitespace);

            if (firstCase) {
                append_phrase(source, "if ", caseTerm, sym_Keyword);
                format_source_for_input(source, caseTerm, 0);
                firstCase = false;
            } else if (caseTerm->input(0) != NULL) {
                append_phrase(source, "elif ", caseTerm, sym_Keyword);
                format_source_for_input(source, caseTerm, 0);
            }
            else
                append_phrase(source, "else", caseTerm, sym_None);

            // whitespace following the if/elif/else
            append_phrase(source,
                    caseTerm->stringProp("syntax:lineEnding", ""),
                    caseTerm, tok_Whitespace);

            format_block_source(source, nested_contents(caseTerm), caseTerm);
        }
    }
Esempio n. 19
0
void
add_task (Window win, int focus)
{
	task *tk, *list;

	if (win == tb.win)
		return;

	/* is this window on a different desktop? */
	if (tb.my_desktop != find_desktop (win) || is_hidden (win))
		return;

	tk = calloc (1, sizeof (task));
	tk->win = win;
	tk->focused = focus;
	tk->name = get_prop_data (win, XA_WM_NAME, XA_STRING, 0);
	tk->iconified = is_iconified (win);

	get_task_kdeicon (tk);
	if (tk->icon == None)
		get_task_hinticon (tk);

	XSelectInput (dd, win, PropertyChangeMask | FocusChangeMask |
					  StructureNotifyMask);

	/* now append it to our linked list */
	tb.num_tasks++;

	list = tb.task_list;
	if (!list)
	{
		tb.task_list = tk;
		return;
	}
	while (1)
	{
		if (!list->next)
		{
			list->next = tk;
			return;
		}
		list = list->next;
	}
}
Esempio n. 20
0
int			max_group(char **tab, char *option)
{
	int			max;
	t_stat		*buf;
	int			j;

	j = 0;
	max = 0;
	(!(buf = (t_stat*)malloc(sizeof(t_stat)))) ? perror_malloc() : 0;
	while (tab[j])
	{
		if ((IS_A_2 && !is_main(tab[j]))
				|| IS_A || IS_F || !(is_hidden(tab[j])))
		{
			init_buf(tab[j], &buf);
			if ((int)ft_strlen(group_name(buf->st_gid)) > max)
				max = ft_strlen(group_name(buf->st_gid));
		}
		++j;
	}
	ft_tstatdel(&buf);
	return (max);
}
Esempio n. 21
0
bool Spatial::_is_visible_() const {

	return !is_hidden();
}
Esempio n. 22
0
/*
 * Initiate a AX.25, NET/ROM, ROSE or TCP connection to the host
 * specified by `address'.
 */
static ax25io *connect_to(char **addr, int family, int escape, int compr)
{
  int fd;
  ax25io *riop;
  fd_set read_fdset;
  fd_set write_fdset;
  int salen;
  union {
    struct full_sockaddr_ax25 ax;
#ifdef HAVE_ROSE
    struct sockaddr_rose      rs;
#endif		
    struct sockaddr_in        in;
  } sa;
  char call[10], path[20], *cp, *eol;
  int ret, retlen = sizeof(int);
  int paclen;
  struct hostent *hp;
  struct servent *sp;
  struct user u;
#ifdef HAVE_NETROM
  struct proc_nr_nodes *np;
#endif

  strcpy(call, User.call);
  /*
   * Fill in protocol spesific stuff.
   */
  switch (family) {
#ifdef HAVE_ROSE	
  case AF_ROSE:
    if (aliascmd==0) {
      if (check_perms(PERM_ROSE, 0L) == -1) {
	axio_printf(NodeIo,"Permission denied");
	if (User.ul_type == AF_NETROM) {
	  node_msg("");
	}
	node_log(LOGLVL_GW, "Permission denied: rose");
	return NULL;
      }
    }
    if ((fd = socket(AF_ROSE, SOCK_SEQPACKET, 0)) < 0) {
      node_perror("connect_to: socket", errno);
      return NULL;
    }
    sa.rs.srose_family = AF_ROSE;
    sa.rs.srose_ndigis = 0;
    ax25_aton_entry(call, sa.rs.srose_call.ax25_call);
    rose_aton(rs_config_get_addr(NULL), sa.rs.srose_addr.rose_addr);
    salen = sizeof(struct sockaddr_rose);
    if (bind(fd, (struct sockaddr *)&sa, salen) == -1) {
      node_perror("connect_to: bind", errno);
      close(fd);
      return NULL;
    }
    memset(path, 0, 11);
    memcpy(path, rs_config_get_addr(NULL), 4);
    salen = strlen(addr[1]);
    if ((salen != 6) && (salen != 10))
      {
	axio_printf(NodeIo,"Invalid ROSE address");
	if (User.ul_type == AF_NETROM) {
	  node_msg("");
	}
	return(NULL);
      }
    memcpy(path + (10-salen), addr[1], salen);
    sprintf(User.dl_name, "%s @ %s", addr[0], path);
    sa.rs.srose_family = AF_ROSE;
    sa.rs.srose_ndigis = 0;
    if (ax25_aton_entry(addr[0], sa.rs.srose_call.ax25_call) < 0) {
      close(fd);
      return NULL;
    }
    if (rose_aton(path, sa.rs.srose_addr.rose_addr) < 0) {
      close(fd);
      return NULL;
    }
    if (addr[2] != NULL) {
      if (ax25_aton_entry(addr[2], sa.rs.srose_digi.ax25_call) < 0) {
	close(fd);
	return NULL;
      }
      sa.rs.srose_ndigis = 1;
    }
    salen = sizeof(struct sockaddr_rose);
    paclen = rs_config_get_paclen(NULL);
    eol = ROSE_EOL;
    /* Uncomment the below if you wish to have the node show a 'Trying' state */
    /*    node_msg("%s Trying %s... Type <RETURN> to abort", User.dl_name); */
    break;
#endif		
#ifdef HAVE_NETROM
  case AF_NETROM:
    if (aliascmd==0) {
      if (check_perms(PERM_NETROM, 0L) == -1) {
	axio_printf(NodeIo,"Permission denied");
	if (User.ul_type == AF_NETROM) {
	  node_msg("");
	}
	node_log(LOGLVL_GW, "Permission denied: netrom");
	return NULL;
      }
    }
    if ((fd = socket(AF_NETROM, SOCK_SEQPACKET, 0)) < 0) {
      node_perror("connect_to: socket", errno);
      return NULL;
    }
    /* Why on earth is this different from ax.25 ????? */
    sprintf(path, "%s %s", nr_config_get_addr(NrPort), call); 
    ax25_aton(path, &sa.ax);
    sa.ax.fsa_ax25.sax25_family = AF_NETROM;
    salen = sizeof(struct full_sockaddr_ax25);
    if (bind(fd, (struct sockaddr *)&sa, salen) == -1) {
      node_perror("connect_to: bind", errno);
      close(fd);
      return NULL;
    }
    if ((np = find_node(addr[0], NULL)) == NULL) {
      axio_printf(NodeIo,"No such node");
      if (User.ul_type == AF_NETROM) {
	node_msg("");
      }
      return NULL;
    }
    strcpy(User.dl_name, print_node(np->alias, np->call));
    if (ax25_aton(np->call, &sa.ax) == -1) {
      close(fd);
      return NULL;
    }
    sa.ax.fsa_ax25.sax25_family = AF_NETROM;
    salen = sizeof(struct sockaddr_ax25);
    paclen = nr_config_get_paclen(NrPort); 
    eol = NETROM_EOL;
    /* Uncomment the below if you wish the node to show a 'Trying' state */
    if (check_perms(PERM_ANSI, 0L) != -1) {
      if (User.ul_type == AF_NETROM) {
	break;
      }
      node_msg("\e[01;36mTrying %s... hit <Enter> to abort", User.dl_name);
    }
    break;
#endif
#ifdef HAVE_AX25
  case AF_FLEXNET:
  case AF_AX25:
    if (aliascmd==0) {    
      if (check_perms(PERM_AX25, 0L) == -1 || (is_hidden(addr[0]) && check_perms(PERM_HIDDEN, 0L) == -1)) {
	axio_printf(NodeIo,"Permission denied");
	if (User.ul_type == AF_NETROM) {
	  node_msg("");
	}
	node_log(LOGLVL_GW, "Permission denied: ax.25 port %s", addr[0]);
	return NULL;
      }
    }
    if (ax25_config_get_addr(addr[0]) == NULL) {
      if (User.ul_type == AF_NETROM) {
	axio_printf(NodeIo,"%s} ", NodeId);
      }
      axio_printf(NodeIo,"Invalid port");
      if (User.ul_type == AF_NETROM) {
      	node_msg("");
      }
      return NULL;
    }
    if ((fd = socket(AF_AX25, SOCK_SEQPACKET, 0)) < 0) {
      node_perror("connect_to: socket", errno);
      return NULL;
    }
    /*
     * Invert the SSID only if user is coming in with AX.25
     * and going out on the same port he is coming in via.
     */
    if (User.ul_type == AF_AX25 && !strcasecmp(addr[0], User.ul_name))
      invert_ssid(call, User.call);
    sprintf(path, "%s %s", call, ax25_config_get_addr(addr[0]));
    ax25_aton(path, &sa.ax);
    sa.ax.fsa_ax25.sax25_family = AF_AX25;
    salen = sizeof(struct full_sockaddr_ax25);
    if (bind(fd, (struct sockaddr *)&sa, salen) < 0) {
      node_perror("connect_to: bind", errno);
      close(fd);
      return NULL;
    }
    if (ax25_aton_arglist((const char **)addr+1, &sa.ax) < 0) {
      close(fd);
      return NULL;
    }
    strcpy(User.dl_name, strupr(addr[1]));
    strcpy(User.dl_port, strlwr(addr[0]));
    sa.ax.fsa_ax25.sax25_family = AF_AX25;
    salen = sizeof(struct full_sockaddr_ax25);
    paclen = ax25_config_get_paclen(addr[0]);
    eol = AX25_EOL;
    /* Uncomment the below if you wish the node to show a 'Trying' state */
    /*    if (family==AF_FLEXNET) node_msg("Trying %s via FlexNet... Type <RETURN> to abort", User.dl_name); */
    if ((family==AF_FLEXNET) || (family == AF_AX25)) { 
      if (!strcmp(User.dl_port,User.ul_name)) {
        if (check_perms(PERM_ANSI, 0L) != -1) {
	  axio_printf(NodeIo, "\e[05;31m");
	}
        axio_printf(NodeIo,"\aLoop detected on ");
      }
      if (check_perms(PERM_ANSI, 0L) != -1) {
	axio_printf(NodeIo, "\e[0;m");
      }
      if (User.ul_type == AF_NETROM) {
	axio_printf(NodeIo, "%s} ", NodeId);
      }
      if (check_perms(PERM_ANSI, 0L) != -1) {
	axio_printf(NodeIo, "\e[01;33m");
      }
void Choice::draw()
{
    if (is_hidden()) return;
    font->draw(choices[index], x, y);
}
Esempio n. 24
0
void
gimp_datafiles_read_directories (const gchar            *path_str,
                                 GFileTest               flags,
                                 GimpDatafileLoaderFunc  loader_func,
                                 gpointer                user_data)
{
  gchar *local_path;
  GList *path;
  GList *list;

  g_return_if_fail (path_str != NULL);
  g_return_if_fail (loader_func != NULL);

  local_path = g_strdup (path_str);

  path = gimp_path_parse (local_path, 256, TRUE, NULL);

  for (list = path; list; list = g_list_next (list))
    {
      const gchar *dirname = list->data;
      GDir        *dir;

      dir = g_dir_open (dirname, 0, NULL);

      if (dir)
        {
          const gchar *dir_ent;

          while ((dir_ent = g_dir_read_name (dir)))
            {
              struct stat  filestat;
              gchar       *filename;

              if (is_hidden (dir_ent))
                continue;

              filename = g_build_filename (dirname, dir_ent, NULL);

              if (! g_stat (filename, &filestat))
                {
                  GimpDatafileData  file_data;

                  file_data.filename = filename;
                  file_data.dirname  = dirname;
                  file_data.basename = dir_ent;
                  file_data.atime    = filestat.st_atime;
                  file_data.mtime    = filestat.st_mtime;
                  file_data.ctime    = filestat.st_ctime;

                  if (flags & G_FILE_TEST_EXISTS)
                    {
                      (* loader_func) (&file_data, user_data);
                    }
                  else if ((flags & G_FILE_TEST_IS_REGULAR) &&
                           S_ISREG (filestat.st_mode))
                    {
                      (* loader_func) (&file_data, user_data);
                    }
                  else if ((flags & G_FILE_TEST_IS_DIR) &&
                           S_ISDIR (filestat.st_mode))
                    {
                      (* loader_func) (&file_data, user_data);
                    }
#ifndef G_OS_WIN32
                  else if ((flags & G_FILE_TEST_IS_SYMLINK) &&
                           S_ISLNK (filestat.st_mode))
                    {
                      (* loader_func) (&file_data, user_data);
                    }
#endif
                  else if ((flags & G_FILE_TEST_IS_EXECUTABLE) &&
                           (((filestat.st_mode & S_IXUSR) &&
                             !S_ISDIR (filestat.st_mode)) ||
                            (S_ISREG (filestat.st_mode) &&
                             is_script (filename))))
                    {
                      (* loader_func) (&file_data, user_data);
                    }
                }

              g_free (filename);
            }

          g_dir_close (dir);
        }
    }

  gimp_path_free (path);
  g_free (local_path);
}
Esempio n. 25
0
static void write_xmlman(FILE *out,
			 const char *program,
			 int nldesc,const char **desc,
			 int nfile,t_filenm *fnm,
			 int npargs,t_pargs *pa,
			 int nbug,const char **bugs,
			 t_linkdata *links)
{
  int i;
  char link[10],buf[256],opt[10];

#define NSR2(s) check_xml(s,program,links)
#define FLAG(w,f) (((w) & (f))==(f)) 

  fprintf(out,"<gromacs-manual version=\"%s\" date=\"%s\" www=\"http://www.gromacs.org\">\n",GromacsVersion(),mydate(buf,255,FALSE));
  /* fprintf(out,"<LINK rel=stylesheet href=\"style.css\" type=\"text/css\">\n"); */

  fprintf(out,"<program name=\"%s\">",program);  
  if (nldesc > 0) {
    fprintf(out,"\n<description>\n<par>\n");
    for(i=0; (i<nldesc); i++) 
      fprintf(out,"%s\n",NSR2(desc[i]));
  }
  fprintf(out,"</par>\n</description>\n");

  if (nfile > 0) {
    fprintf(out,"\n<files>\n");
    for(i=0; (i<nfile); i++) {
      strcpy(link,ftp2ext(fnm[i].ftp));
      if (strcmp(link,"???")==0)
	strcpy(link,"files");
        if (fnm[i].opt[0]=='-') strcpy(opt,fnm[i].opt+1);
	else strcpy(opt,fnm[i].opt);
      fprintf(out,
	      "<file type=\"%s\" typeid=\"%d\">\n"
              "\t<flags read=\"%d\" write=\"%d\" optional=\"%d\"/>\n"
	      "\t<option>%s</option>\n"
	      "\t<default-name link=\"%s.html\">%s</default-name>\n"
	      "\t<description>%s</description>\n"
	      "</file>\n",
	      ftp2defnm(fnm[i].ftp),	/* from gmxlib/filenm.c */
	      fnm[i].ftp,
	      FLAG(fnm[i].flag,ffREAD), FLAG(fnm[i].flag,ffWRITE), FLAG(fnm[i].flag,ffOPT), 
	      opt,link,fnm[i].fn,/*fileopt(fnm[i].flag),*/
	      NSR(ftp2desc(fnm[i].ftp)));
    }
    fprintf(out,"</files>\n");
  }

  if (npargs > 0) {
    fprintf(out,"\n<options>\n");
    for(i=0; (i<npargs); i++)
      fprintf(out,
	      "<option type=\"%s\" hidden=\"%d\">\n"
	      "\t<name >%s</name>\n"
	      "\t<default-value>%s</default-value>\n"
	      "\t<description>%s</description>\n"
	      "</option>\n",
	      argtp[pa[i].type], is_hidden(&pa[i]),
	      pa[i].option+1,	               /* +1 - with no trailing '-' */
	      pa_val(&(pa[i]),buf,255),pa[i].desc); /*argtp[pa[i].type],*/
    fprintf(out,"</options>\n");
  }

  if (nbug > 0) {
    fprintf(out,"\n<bugs>\n");
    for(i=0; (i<nbug); i++)
      fprintf(out,"\t<bug>%s</bug>\n",NSR(bugs[i]));
    fprintf(out,"</bugs>\n");
  }
  fprintf(out,"\n</program>\n</gromacs-manual>\n");
#undef FLAG  
}
Esempio n. 26
0
static void dest_populate(Dest_Data *dd, const gchar *path)
{
	DIR *dp;
	struct dirent *dir;
	struct stat ent_sbuf;
	GList *path_list = NULL;
	GList *file_list = NULL;
	GList *list;
	GtkListStore *store;
	gchar *pathl;

	if (!path) return;

	pathl = path_from_utf8(path);
	dp = opendir(pathl);
	if (!dp)
		{
		/* dir not found */
		g_free(pathl);
		return;
		}
	while ((dir = readdir(dp)) != NULL)
		{
		if (!options->file_filter.show_dot_directory
		    && dir->d_name[0] == '.' && dir->d_name[1] == '\0')
			continue;
		if (dir->d_name[0] == '.' && dir->d_name[1] == '.' && dir->d_name[2] == '\0'
		    && pathl[0] == G_DIR_SEPARATOR && pathl[1] == '\0')
			continue; /* no .. for root directory */
		if (dd->show_hidden || !is_hidden(dir->d_name))
			{
			gchar *name = dir->d_name;
			gchar *filepath = g_build_filename(pathl, name, NULL);
			if (stat(filepath, &ent_sbuf) >= 0 && S_ISDIR(ent_sbuf.st_mode))
				{
				path_list = g_list_prepend(path_list, path_to_utf8(name));
				}
			else if (dd->f_view)
				{
				if (!dd->filter || (dd->filter && dest_check_filter(dd->filter, name)))
					file_list = g_list_prepend(file_list, path_to_utf8(name));
				}
			g_free(filepath);
			}
		}
	closedir(dp);
	g_free(pathl);

	path_list = g_list_sort(path_list, (GCompareFunc) dest_sort_cb);
	file_list = g_list_sort(file_list, (GCompareFunc) dest_sort_cb);

	store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dd->d_view)));
	gtk_list_store_clear(store);

	list = path_list;
	while (list)
		{
		GtkTreeIter iter;
		gchar *filepath;

		if (strcmp(list->data, ".") == 0)
			{
			filepath = g_strdup(path);
			}
		else if (strcmp(list->data, "..") == 0)
			{
			gchar *p;
			filepath = g_strdup(path);
			p = (gchar *)filename_from_path(filepath);
			if (p - 1 != filepath) p--;
			p[0] = '\0';
			}
		else
			{
			filepath = g_build_filename(path, list->data, NULL);
			}

		gtk_list_store_append(store, &iter);
		gtk_list_store_set(store, &iter, 0, list->data, 1, filepath, -1);

		g_free(filepath);
		list = list->next;
		}

	string_list_free(path_list);


	if (dd->f_view)
		{
		store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dd->f_view)));
		gtk_list_store_clear(store);

		list = file_list;
		while (list)
			{
			GtkTreeIter iter;
			gchar *filepath;
			const gchar *name = list->data;

			filepath = g_build_filename(path, name, NULL);

			gtk_list_store_append(store, &iter);
			gtk_list_store_set(store, &iter, 0, name, 1, filepath, -1);

			g_free(filepath);
			list = list->next;
			}

		string_list_free(file_list);
		}

	g_free(dd->path);
	dd->path = g_strdup(path);
}
Esempio n. 27
0
static void
textures_switch_page (GtkNotebook *notebook, GtkWidget *page, guint page_num, const gchar *texture_path)
{
  if (page_num == 0 || g_array_index (textures_timestamps, time_t, page_num) > 0)
    return;

  // fix gtk2
  page = gtk_notebook_get_nth_page (notebook, page_num);

  gtk_container_set_border_width (GTK_CONTAINER (page), 0);
  gtk_widget_set_size_request (page, -1, 480);

  const gchar *category = gtk_notebook_get_tab_label_text(notebook, page);

  /* scrolled window */
  GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_box_pack_start (GTK_BOX (page), scrolled_window, TRUE, TRUE, 0);
  gtk_widget_show (scrolled_window);

  /* table */
  gint rows = 5;
  gint cols = 3;
  GtkWidget *table = gtk_table_new (rows, cols, FALSE);
  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  gtk_container_set_border_width (GTK_CONTAINER (table), 10);
  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table);
  gtk_widget_show (table);

  gint row = 1;
  gint col = 1;

  const gchar *gimp_dir = gimp_directory ();
  const gchar *texture_dir = g_build_filename (gimp_dir, texture_path, NULL);
  const gchar *path = g_build_filename (texture_dir, category, NULL);

  GDir *dir = g_dir_open (path, 0, NULL);
  if (dir)
  {
    const gchar *dir_ent;
    while (dir_ent = g_dir_read_name (dir))
    {
      if (is_hidden (dir_ent))
        continue;

      gchar *filename = g_build_filename (path, dir_ent, NULL);
      GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
      pixbuf = gdk_pixbuf_scale_simple (pixbuf, THUMBNAIL_SIZE, THUMBNAIL_SIZE, GDK_INTERP_BILINEAR);
      GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
      GtkWidget *event_box = gtk_event_box_new ();
      gtk_container_add (GTK_CONTAINER (event_box), image);
      gtk_widget_show (image);
      gtk_table_attach_defaults (GTK_TABLE (table), event_box, col - 1, col, row - 1, row);
      gtk_widget_show (event_box);

      col++;
      if (col > cols)
      {
        row++;
        col = 1;
      }

      g_signal_connect (event_box, "button_press_event", G_CALLBACK (custom_texture_press), filename);
    }
  }

  g_array_index (textures_timestamps, time_t, page_num) = time (NULL);
}
Esempio n. 28
0
static void write_py(FILE *out,const char *program,
		     int nldesc,const char **desc,
		     int nfile,t_filenm *fnm,
		     int npargs,t_pargs *pa,
		     int nbug,const char **bugs,
		     t_linkdata *links)
{
  gmx_bool bHidden;
  const char *cls = program;
  char *tmp;
  int  i,j;

  /* Header stuff */  
  fprintf(out,"#!/usr/bin/python\n\nfrom GmxDialog import *\n\n");
  
  /* Class definition */
  fprintf(out,"class %s:\n",cls);
  fprintf(out,"    def __init__(self,tk):\n");
  
  /* Help text */
  fprintf(out,"        %s_help = \"\"\"\n",cls);
  fprintf(out,"        DESCRIPTION\n");
  print_tty_formatted(out,nldesc,desc,8,links,program,FALSE);
  if (nbug > 0) {
    fprintf(out,"\n        BUGS and PROBLEMS\n");
    for(i=0; i<nbug; i++) {
      snew(tmp,strlen(bugs[i])+3);
      strcpy(tmp,"* ");
      strcpy(tmp+2,check_tty(bugs[i]));
      fprintf(out,"%s\n",wrap_lines(tmp,78,10,TRUE));
      sfree(tmp);
    }
  }
  fprintf(out,"        \"\"\"\n\n        # Command line options\n");
  /* File options */
  fprintf(out,"        flags = []\n");
  for(i=0; (i<nfile); i++) 
    fprintf(out,"        flags.append(pca_file('%s',\"%s\",0,%d))\n",
	    ftp2ext_generic(fnm[i].ftp),fnm[i].opt ? fnm[i].opt : "k",
	    is_optional(&(fnm[i])));
	    
	    
  /* Other options */
  for(i=0; (i<npargs); i++) {
    switch(pa[i].type) {
    case etINT:
      fprintf(out,"        flags.append(pca_int(\"%s\",\"%s\",%d,%d))\n",
	      pa[i].option,pa[i].desc,*pa[i].u.i,is_hidden(&(pa[i])));
      break;
    case etREAL:
    case etTIME:
      fprintf(out,"        flags.append(pca_float(\"%s\",\"%s\",%f,%d))\n",
	      pa[i].option,pa[i].desc,*pa[i].u.r,is_hidden(&(pa[i])));
      break;
    case etSTR:
    case etBOOL:
      fprintf(out,"        flags.append(pca_gmx_bool(\"%s\",\"%s\",%d,%d))\n",
	      pa[i].option,pa[i].desc,*pa[i].u.b,is_hidden(&(pa[i])));
      break;
    case etRVEC:
      fprintf(stderr,"Sorry, no rvecs yet...\n");
      break;
    case etENUM:
      fprintf(out,"        flags.append(pca_enum(\"%s\",\"%s\",\n",
	      pa[i].option,pa[i].desc);
      fprintf(out,"        ['%s'",pa[i].u.c[1]);
      for(j=2; (pa[i].u.c[j] != NULL); j++)
	fprintf(out,",'%s'",pa[i].u.c[j]);
      fprintf(out,"],%d))\n",is_hidden(&(pa[i])));
    default:
      break;
    }
  }
    
  /* Make the dialog box */
  fprintf(out,"        gmxd = gmx_dialog(tk,\"%s\",flags,%s_help)\n\n",
	  cls,cls);
	  
  /* Main loop */
  fprintf(out,"#####################################################\n");
  fprintf(out,"tk     = Tk()\n");
  fprintf(out,"my%s = %s(tk)\n",cls,cls);
  fprintf(out,"tk.mainloop()\n");
}
Esempio n. 29
0
bool CanvasItem::_is_visible_() const {

	return !is_hidden();
}
Esempio n. 30
0
/*
 * List depends on:
 *  - state->sort
 *  - state->tags
 *  - state->filter
 *  - dir contents on FS
 */
static Eina_Array *
_fill_files(const madshelf_state_t *state, const char *dir, int *old_pos)
{
    char *old_file = curdir_get(dir);
    if(old_pos) *old_pos = -1;

    Eina_Array *files = eina_array_new(10);

    /* HACK: using global variable to pas state into sort function */
    cur_dir = !strcmp(dir, "/") ? "" : dir;

    Eina_List *ls = ecore_file_ls(dir);
    ls = eina_list_sort(ls, eina_list_count(ls),
                        state->sort == MADSHELF_SORT_NAME ? &_name
                        : (state->sort == MADSHELF_SORT_NAMEREV ? &_namerev
                           : &_daterev));

    /* First select directories */
    for (Eina_List *i = ls; i; i = eina_list_next(i)) {
        const char *file = eina_list_data_get(i);
        char *filename = xasprintf("%s/%s", !strcmp(dir, "/") ? "" : dir, file);

        if (!ecore_file_is_dir(filename)) {
            free(filename);
            continue;
        }

        if (!state->show_hidden && is_hidden(state, filename)) {
            free(filename);
            continue;
        }

        if (old_file && old_pos)
            if (!strcmp(old_file, file))
                *old_pos = eina_array_count_get(files);
        eina_array_push(files, filename);
    }

    /* Then files */
    for (Eina_List *i = ls; i; i = eina_list_next(i)) {
        const char *file = eina_list_data_get(i);
        char *filename = xasprintf("%s/%s", !strcmp(dir, "/") ? "" : dir, file);

        if (ecore_file_is_dir(filename)) {
            free(filename);
            continue;
        }

        if (!state->show_hidden && is_hidden(state, filename)) {
            free(filename);
            continue;
        }

        if (old_file && old_pos)
            if (!strcmp(old_file, file))
                *old_pos = eina_array_count_get(files);
        eina_array_push(files, filename);
    }

    char* s;
    EINA_LIST_FREE(ls, s)
        free(s);

    free(old_file);

    return files;
}