File: col.c

package info (click to toggle)
wily 0.13.33-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,500 kB
  • ctags: 1,720
  • sloc: ansic: 12,830; sh: 245; makefile: 188
file content (50 lines) | stat: -rw-r--r-- 801 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "tile.h"

extern char* columntools;

/* Return the column enclosing 'tile', or 0 */
Tile*
tile_col(Tile*tile)
{
	if(tile && tile->ori != H)
		tile = tile->up;
	return tile;
}

/* Create and display a new column. */
void
col_new(View*v, char *arg)
{
	int	min, max;
	Tile	*col;
	Text	*tagt;

	findplace(wily, &min, &max);
	tagt = text_alloc(0, false);
	text_replaceutf(tagt, nr,  columntools);
	col = tile_new(H, min, max, MINWIDTH, wily, tagt, 0);
	list_add(wily, col);
}

/* Delete as many of the windows of 'tile' as possible.  Return 0
 * if we got them all.
 */
static int
col_delwins(Tile*tile)
{
	Tile	*t;
	int	problem = 0;

	for(t = tile->down; t; t= t->right) {
		if (win_del(t))
			problem = 1;
	}
	return problem;
}

void
col_del(Tile*t)
{
	if(t && !col_delwins(t))
		tile_del(t);
}