Removed RCS-style IDs.
[multipass-eu.git] / src / playlist_item.rb
index 40b6c63a42acaae8235521d34a191816584975ce..56b298c44a3a8fd8f4537ce60cb601117a9215c4 100644 (file)
@@ -1,33 +1,80 @@
-# $Id: playlist_item.rb 8 2005-04-24 10:49:53Z tilman $
+TEXT_COLOR_HILIGHT = "#f0fafd"
 
 EDJE.collection("playlist_item") do |c|
        c.set_size(150, 10)
 
-       c.part("title", :text) do |p|
-               p.effect = :outline
+       c.part("background", :rect) do |p|
+               p.description.color = "#00000000"
+               p.description("selected").color = "#414141"
+       end
+
+       ["title", "duration"].each do |name|
+               c.part(name, :text) do |p|
+                       p.effect = :outline
 
-               p.description do |d|
-                       d.color = TEXT_COLOR
-                       d.outline_color = OUTLINE_COLOR
+                       {"default" => TEXT_COLOR,
+                        "hilighted" => TEXT_COLOR_HILIGHT}.each do |(state, color)|
+                               p.description(state) do |d|
+                                       d.color = color
+                                       d.outline_color = OUTLINE_COLOR
 
-                       d.font = "fonts/acknowledge2.ttf"
-                       d.font_size = 12
-                       d.text = "Dark Tranquillity - Through Smudged Lenses"
-                       d.set_text_align(0.0)
+                                       d.font = "acknowledge2.ttf"
+                                       d.font_size = 12
+                                       d.text = "Dark Tranquillity - Through Smudged Lenses"
+                                       d.set_text_align(0.0)
+                               end
+                       end
                end
        end
 
-       c.part("length", :text) do |p|
-               p.effect = :outline
+       ["default", "hilighted"].each do |state|
+               c.part("title").description(state) do |d|
+                       d.rel[1].set_to(c.part("duration"), nil)
+                       d.rel[1].set_rel(0.0, 1.0)
+
+                       #d.rel[0].set_offset(0, 0)
+                       d.rel[1].set_offset(5, 0)
+               end
 
-               p.description do |d|
-                       d.color = TEXT_COLOR
-                       d.outline_color = OUTLINE_COLOR
+               c.part("duration").description(state) do |d|
+                       d.rel[0].set_rel(1.0, 0.0)
+                       d.rel[0].set_offset(-35, 0)
 
-                       d.font = "fonts/acknowledge2.ttf"
-                       d.font_size = 12
                        d.text = "04:11"
                        d.set_text_align(1.0)
                end
        end
+
+       ["hilighted", "unhilighted"].each do |state|
+               c.program("playlist_item.#{state}", :set_state) do |p|
+                       p.signal = "playlist_item.#{state}"
+                       p.source = "*"
+                       p.state = state == "unselected" ? "default" : state
+                       p.mode = state == "selected" ? :accelerate : :decelerate
+                       p.time = 0.5
+                       p.targets << ProgramTarget.new(c.part("title"))
+                       p.targets << ProgramTarget.new(c.part("duration"))
+               end
+       end
+
+       ["selected", "unselected"].each do |state|
+               c.program("playlist_item.#{state}", :set_state) do |p|
+                       p.signal = "playlist_item.#{state}"
+                       p.source = "*"
+                       p.state = state
+                       p.targets << ProgramTarget.new(c.part("background"))
+               end
+       end
+
+       c.program("playlist_item.click", :emit_signal) do |p|
+               p.signal = "mouse,clicked,1"
+               p.source = "*"
+               p.emission_signal = "playlist_item.selected"
+       end
+
+       c.program("playlist_item.doubleclick", :emit_signal) do |p|
+               p.signal = "mouse,down,1,double"
+               p.source = "*"
+               p.emission_signal = "playlist_item.play"
+       end
 end