ektoplayer 0.1.6 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -12
  3. data/lib/ektoplayer/application.rb +6 -5
  4. data/lib/ektoplayer/bindings.rb +61 -55
  5. data/lib/ektoplayer/common.rb +19 -6
  6. data/lib/ektoplayer/compat.rb +3 -3
  7. data/lib/ektoplayer/config.rb +1 -11
  8. data/lib/ektoplayer/controllers/browser.rb +7 -5
  9. data/lib/ektoplayer/controllers/help.rb +1 -1
  10. data/lib/ektoplayer/controllers/info.rb +1 -1
  11. data/lib/ektoplayer/controllers/playlist.rb +24 -12
  12. data/lib/ektoplayer/icurses.rb +21 -0
  13. data/lib/ektoplayer/icurses/curses.rb +53 -0
  14. data/lib/ektoplayer/icurses/ffi_ncurses.rb +69 -0
  15. data/lib/ektoplayer/icurses/ncurses.rb +79 -0
  16. data/lib/ektoplayer/icurses/ncursesw.rb +1 -0
  17. data/lib/ektoplayer/icurses/sugar.rb +65 -0
  18. data/lib/ektoplayer/icurses/test.rb +99 -0
  19. data/lib/ektoplayer/models/player.rb +2 -2
  20. data/lib/ektoplayer/{mp3player.rb → players/mpg_portaudio_player.rb} +3 -3
  21. data/lib/ektoplayer/players/mpg_wrapper_player.rb +107 -0
  22. data/lib/ektoplayer/theme.rb +1 -6
  23. data/lib/ektoplayer/ui.rb +100 -129
  24. data/lib/ektoplayer/ui/colors.rb +14 -14
  25. data/lib/ektoplayer/ui/widgets.rb +4 -4
  26. data/lib/ektoplayer/ui/widgets/labelwidget.rb +1 -1
  27. data/lib/ektoplayer/ui/widgets/listwidget.rb +115 -46
  28. data/lib/ektoplayer/views/help.rb +7 -10
  29. data/lib/ektoplayer/views/info.rb +29 -38
  30. data/lib/ektoplayer/views/mainwindow.rb +2 -5
  31. data/lib/ektoplayer/views/playinginfo.rb +15 -20
  32. data/lib/ektoplayer/views/progressbar.rb +30 -10
  33. data/lib/ektoplayer/views/splash.rb +24 -25
  34. data/lib/ektoplayer/views/tabbar.rb +6 -5
  35. data/lib/ektoplayer/views/trackrenderer.rb +20 -14
  36. metadata +15 -47
  37. data/lib/ektoplayer/views/volumemeter.rb +0 -76
@@ -1,76 +0,0 @@
1
- require_relative '../ui/widgets'
2
- require_relative '../config'
3
- require_relative '../theme'
4
-
5
- module Ektoplayer
6
- module Views
7
- class VolumeMeter < UI::Window
8
- def layout
9
- super
10
- load_colors(true)
11
- end
12
-
13
- def load_colors(force=false)
14
- return if @fade and not force
15
-
16
- if Theme.current == 256
17
- fader = UI::ColorFader.new([25,26,27,32,39,38,44,44,45,51,87,159,195])
18
- elsif Theme.current == 8
19
- fader = UI::ColorFader.new([:blue])
20
- else
21
- fader = UI::ColorFader.new([-1])
22
- end
23
-
24
- @fade = fader.fade(@size.width)
25
- @level_width = @size.width
26
- @level_char = Config[:'volumemeter.level_char']
27
- @rest_char = Config[:'volumemeter.rest_char']
28
- end
29
-
30
- def level=(level)
31
- return unless visible?
32
-
33
- new_level_width = (1.4 * level * @size.width).to_i.clamp(0, @size.width - 1) rescue 0
34
- return if @level_width == new_level_width
35
- load_colors
36
-
37
- if new_level_width > @level_width
38
- @win.setpos(0, @level_width)
39
- (@level_width).upto(new_level_width).each do |i|
40
- @win.attron(@fade[i])
41
- @win << @level_char
42
- end
43
- else
44
- @win.setpos(0, new_level_width)
45
- end
46
-
47
- if (repeat = @size.width - @win.curx - 1) > 0
48
- @win.attron(Theme[:'volumemeter.rest'])
49
- @win << @rest_char * (repeat + 1)
50
- end
51
-
52
- @level_width = new_level_width
53
- @win.refresh
54
- end
55
-
56
- def attach(player)
57
- player.events.on(:position_change) { self.level=(player.level) }
58
- player.events.on(:stop) { self.level=(90) }
59
- player.events.on(:pause) { self.level=(90) }
60
- end
61
-
62
- def draw
63
- load_colors
64
- @win.setpos(0,0)
65
-
66
- @level_width.times do |i|
67
- @win.attron(@fade[i])
68
- @win << @level_char
69
- end
70
-
71
- @win.attron(Theme[:'volumemeter.rest'])
72
- @win << @rest_char * (@size.width - @win.curx)
73
- end
74
- end
75
- end
76
- end