Fixed font issues by replacing acknowledge2 completely.
[multipass-eu.git] / src / playlist_item.rb
1 TEXT_COLOR_HILIGHT = "#f0fafd"
2
3 EDJE.collection("playlist_item") do |c|
4         c.set_size(150, 10)
5
6         c.part("background", :rect) do |p|
7                 p.description.color = "#00000000"
8                 p.description("selected").color = "#414141"
9         end
10
11         ["title", "duration"].each do |name|
12                 c.part(name, :text) do |p|
13                         p.effect = :outline
14
15                         {"default" => TEXT_COLOR,
16                          "hilighted" => TEXT_COLOR_HILIGHT}.each do |(state, color)|
17                                 p.description(state) do |d|
18                                         d.color = color
19                                         d.outline_color = OUTLINE_COLOR
20
21                                         d.font = "slkscrb.ttf"
22                                         d.font_size = 8
23                                         d.text = "Dark Tranquillity - Through Smudged Lenses"
24                                         d.set_text_align(0.0)
25                                 end
26                         end
27                 end
28         end
29
30         ["default", "hilighted"].each do |state|
31                 c.part("title").description(state) do |d|
32                         d.rel[1].set_to(c.part("duration"), nil)
33                         d.rel[1].set_rel(0.0, 1.0)
34
35                         #d.rel[0].set_offset(0, 0)
36                         d.rel[1].set_offset(5, 0)
37                 end
38
39                 c.part("duration").description(state) do |d|
40                         d.rel[0].set_rel(1.0, 0.0)
41                         d.rel[0].set_offset(-35, 0)
42
43                         d.text = "04:11"
44                         d.set_text_align(1.0)
45                 end
46         end
47
48         ["hilighted", "unhilighted"].each do |state|
49                 c.program("playlist_item.#{state}", :set_state) do |p|
50                         p.signal = "playlist_item.#{state}"
51                         p.source = "*"
52                         p.state = state == "unselected" ? "default" : state
53                         p.mode = state == "selected" ? :accelerate : :decelerate
54                         p.time = 0.5
55                         p.targets << ProgramTarget.new(c.part("title"))
56                         p.targets << ProgramTarget.new(c.part("duration"))
57                 end
58         end
59
60         ["selected", "unselected"].each do |state|
61                 c.program("playlist_item.#{state}", :set_state) do |p|
62                         p.signal = "playlist_item.#{state}"
63                         p.source = "*"
64                         p.state = state
65                         p.targets << ProgramTarget.new(c.part("background"))
66                 end
67         end
68
69         c.program("playlist_item.click", :emit_signal) do |p|
70                 p.signal = "mouse,clicked,1"
71                 p.source = "*"
72                 p.emission_signal = "playlist_item.selected"
73         end
74
75         c.program("playlist_item.doubleclick", :emit_signal) do |p|
76                 p.signal = "mouse,down,1,double"
77                 p.source = "*"
78                 p.emission_signal = "playlist_item.play"
79         end
80 end