1 # $Id: player-main-buttons.rb 7 2005-04-24 10:46:14Z tilman $
3 c = EDJE.collection("euphoria")
8 def image_from_name(name)
9 md = name.match(/\.(.*)$/)
10 md.nil? ? name : md.captures.first.gsub(".", "-")
13 h = {"player.button.play" => ["playback.play", [121, 133]],
14 "player.button.pause" => ["playback.pause", [90, 133]],
15 "player.button.stop" => ["playback.stop", [155, 133]],
16 "player.button.next" => ["playback.next", [184, 135]],
17 "player.button.prev" => ["playback.prev", [60, 134]]}
18 h.each do |name, (sig, (x, y))|
19 buttons << SignalButton.new(c, name, root, image_from_name(name),
23 {"player.button.play.led" => [132, 142],
24 "player.button.pause.led" => [98, 142],
25 "player.button.stop.led" => [163, 142],
26 "player.button.next.led" => [194, 143],
27 "player.button.prev.led" => [68, 143]}.each do |name, (x, y)|
28 ButtonLed.new(c, name, root, image_from_name(name), x, y)
31 h = {"player.button.close" => ["close", [206, 5]],
32 "player.button.switch" => [nil, [186, 5]],
33 "player.button.minimize" => [nil, [166, 5]],
34 "player.button.system" => [nil, [50, 5]]}
35 h.each do |name, (sig, (x, y))|
36 args = [c, name, root, image_from_name(name), x, y]
37 args << sig unless sig.nil?
39 buttons << (sig.nil? ? Button : SignalButton).new(*args).part
42 c.part("player.background.buttons.clip", :rect) do |p|
44 d.rel[0].to = d.rel[1].to = root
45 d.rel[0].set_offset(45, 0)
46 d.rel[1].set_rel(0.0, 0.0)
47 d.rel[1].set_offset(240, 175)
50 buttons.each { |button| button.clip = p }