[go: up one dir, main page]

File: editable.h

package info (click to toggle)
cmus 2.0.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,092 kB
  • ctags: 2,405
  • sloc: ansic: 21,341; sh: 959; makefile: 165
file content (56 lines) | stat: -rw-r--r-- 1,728 bytes parent folder | download | duplicates (3)
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
51
52
53
54
55
56
/*
 * Copyright 2006 Timo Hirvonen
 */

#ifndef EDITABLE_H
#define EDITABLE_H

#include "window.h"
#include "list.h"
#include "track.h"
#include "locking.h"

struct editable {
	struct window *win;
	struct list_head head;
	unsigned int nr_tracks;
	unsigned int nr_marked;
	unsigned int total_time;
	const char **sort_keys;
	char sort_str[128];
	struct searchable *searchable;

	void (*free_track)(struct list_head *item);
};

extern pthread_mutex_t editable_mutex;

void editable_init(struct editable *e, void (*free_track)(struct list_head *item));
void editable_add(struct editable *e, struct simple_track *track);
void editable_remove_track(struct editable *e, struct simple_track *track);
void editable_remove_sel(struct editable *e);
void editable_sort(struct editable *e);
void editable_set_sort_keys(struct editable *e, const char **keys);
void editable_toggle_mark(struct editable *e);
void editable_move_after(struct editable *e);
void editable_move_before(struct editable *e);
void editable_clear(struct editable *e);
void editable_mark(struct editable *e, const char *filter);
void editable_unmark(struct editable *e);
void editable_invert_marks(struct editable *e);
int __editable_for_each_sel(struct editable *e, int (*cb)(void *data, struct track_info *ti),
		void *data, int reverse);
int editable_for_each_sel(struct editable *e, int (*cb)(void *data, struct track_info *ti),
		void *data, int reverse);

static inline void editable_track_to_iter(struct editable *e, struct simple_track *track, struct iter *iter)
{
	iter->data0 = &e->head;
	iter->data1 = track;
	iter->data2 = NULL;
}

#define editable_lock() cmus_mutex_lock(&editable_mutex)
#define editable_unlock() cmus_mutex_unlock(&editable_mutex)

#endif