Added playlist buttons.
authorTilman Sauerbeck <tilman@code-monkey.de>
Sun, 24 Apr 2005 10:46:14 +0000 (10:46 +0000)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sun, 24 Apr 2005 10:46:14 +0000 (10:46 +0000)
multipass.rb
src/player-main-buttons.rb
src/playlist-buttons.rb [new file with mode: 0644]

index ea542de2af8b7121dd3283b853683f1767c3d4c0..c0a47d977800a95e032413fe065177dc1b8ec46d 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: multipass.rb 6 2005-04-24 09:36:27Z tilman $
+# $Id: multipass.rb 7 2005-04-24 10:46:14Z tilman $
 
 require "src/slider.rb"
 require "src/button.rb"
@@ -76,6 +76,7 @@ EDJE.collection("playlist") do |c|
        end
 
        load "src/playlist-background.rb"
+       load "src/playlist-buttons.rb"
 end
 
 EDJE.collection("playlist_item") do |c|
index 2b376891acef92826f31da77032cc8274c04f053..fea63dced1efb085caa7e0a49842d164539dbbe3 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: player-main-buttons.rb 4 2005-04-23 16:06:34Z tilman $
+# $Id: player-main-buttons.rb 7 2005-04-24 10:46:14Z tilman $
 
 c = EDJE.collection("euphoria")
 root = c.part("root")
@@ -6,7 +6,7 @@ root = c.part("root")
 buttons = []
 
 def image_from_name(name)
-       md = name.match(/^player\.(.*)$/)
+       md = name.match(/\.(.*)$/)
        md.nil? ? name : md.captures.first.gsub(".", "-")
 end
 
diff --git a/src/playlist-buttons.rb b/src/playlist-buttons.rb
new file mode 100644 (file)
index 0000000..34b78c2
--- /dev/null
@@ -0,0 +1,17 @@
+# $Id: playlist-buttons.rb 7 2005-04-24 10:46:14Z tilman $
+
+c = EDJE.collection("playlist")
+root = c.part("root")
+right = c.part("playlist.background.titlebar.right")
+
+buttons = []
+
+h = {"playlist.button.close" => ["close", [right, -10, 5]],
+     "playlist.button.switch" => [nil, [right, -30, 5]],
+     "playlist.button.system" => [nil, [root, 5, 5]]}
+h.each do |name, (sig, (rel, x, y))|
+       args = [c, name, rel, image_from_name(name), x, y]
+       args << sig unless sig.nil?
+
+       buttons << (sig.nil? ? Button : SignalButton).new(*args).part
+end