Ejemplo n.º 1
0
static int	place_tree(t_tree **tree)
{
  if (*tree == NULL)
    return (EXIT_SUCCESS);
  if (create_split(tree, OP_SMC) == QUIT_RET)
    return (QUIT_RET);
  if (place_tree(&((*tree)->left)) == QUIT_RET)
    return (QUIT_RET);
  if (place_tree(&((*tree)->right)) == QUIT_RET)
    return (QUIT_RET);
  return (EXIT_SUCCESS);
}
Ejemplo n.º 2
0
static bool opt_workspace_split(int dir, Tokenizer *tokz, int n, Token *toks)
{
	WRectangle geom;
	WWsSplit *split;
	int brs, tls;
	int w, h;
	
	if(!check_splits(tokz, toks[1].line))
		return FALSE;
	   
	tls=TOK_LONG_VAL(&(toks[1]));
	brs=TOK_LONG_VAL(&(toks[2]));
	
	geom=get_geom();
	
	if(dir==HORIZONTAL)
		tls=geom.w*tls/(tls+brs);
	else
		tls=geom.h*tls/(tls+brs);
	
	split=create_split(dir, NULL, NULL, geom);
	
	if(split==NULL)
		return FALSE;
		
	split->tmpsize=tls;
	
	if(current_split==NULL)
		current_ws->splitree=(WObj*)split;
	else if(current_split->tl==NULL)
		current_split->tl=(WObj*)split;
	else
		current_split->br=(WObj*)split;
	
	split->parent=current_split;
	
	current_split=split;
	
	return TRUE;
}