playlist: ellipsis in long items
[amper.git] / amperopts.d
blobd6f51be1a4f9c302ae3a7fb93f2593837e292292
1 /* coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
2 * Understanding is not required. Only obedience.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 module amperopts;
19 import core.time;
21 import arsd.color;
22 import arsd.image;
23 import arsd.simpledisplay;
25 import iv.cmdcon;
26 import iv.cmdcongl;
27 import iv.strex;
28 import iv.vfs.io;
30 import aplayer;
32 import egfx;
35 // ////////////////////////////////////////////////////////////////////////// //
36 public __gshared bool amperStarted = false; // set to `true` after all UI and such was inited
39 // ////////////////////////////////////////////////////////////////////////// //
40 public __gshared EgfxWindow sdampwin;
41 public __gshared EgfxWindow sdplwin;
43 public void delegate () dgGreatePListWindow;
46 // ////////////////////////////////////////////////////////////////////////// //
47 //__gshared string skinfile = "skins/WastedAMP1-0.zip";
48 //__gshared string skinfile = "skins/winamp2.zip";
49 //public __gshared string skinfile = "/mnt/bigass/src/xmms/skindev/winamp29x.zip";
50 public __gshared string skinfile = "!BUILTIN!";
51 public __gshared bool modeShuffle = false;
52 public __gshared bool modeRepeat = false;
53 public __gshared int softVolume = 31; // [0..63]; *100/31 will be volume in percents
54 public __gshared bool eqVisible = false;
55 public __gshared bool plVisible = true;
56 public __gshared bool modeRemaining = false;
57 public __gshared bool plEllipsisAtStart = false;
60 shared static this () {
61 conRegVar!plEllipsisAtStart("pl_ellipsis_at_start", "put ellipsis at start in too long playlist items",
62 delegate (ConVarBase self, bool oldval, bool newval) {
63 if (oldval != newval) glconPostScreenRebuild();
66 conRegVar!modeShuffle("mode_shuffle", "shuffle playlist",
67 delegate (ConVarBase self, bool oldval, bool newval) {
68 if (oldval != newval) glconPostScreenRebuild();
71 conRegVar!modeRepeat("mode_repeat", "repeat playlist",
72 delegate (ConVarBase self, bool oldval, bool newval) {
73 if (oldval != newval) glconPostScreenRebuild();
76 conRegVar!modeRemaining("mode_remaining", "show remaining time in song timer instead of passed",
77 delegate (ConVarBase self, bool oldval, bool newval) {
78 if (oldval != newval) glconPostScreenRebuild();
82 conRegVar!softVolume(0, 63, "soft_volume", "soft volume; 31 is normal",
83 delegate (ConVarBase self, int oldval, int newval) {
84 //conwriteln("volume changed: old=", oldval, "; new=", newval);
85 if (oldval != newval) glconPostScreenRebuild();
86 aplayPlayGain(newval*100/31-100);
89 conRegFunc!((int delta) {
90 int newval = softVolume+delta;
91 if (newval < 0) newval = 0;
92 if (newval > 63) newval = 63;
93 if (newval != softVolume) {
94 softVolume = newval;
95 glconPostScreenRebuild();
96 aplayPlayGain(newval*100/31-100);
98 })("soft_volume_rel", "soft volume, relative");
100 conRegVar!eqVisible("eq_visible", "toggle equalizer",
101 delegate (ConVarBase self, bool oldval, bool newval) {
102 if (oldval != newval) glconPostScreenRebuild();
105 conRegVar!plVisible("pl_visible", "toggle playlist",
106 delegate (ConVarBase self, bool oldval, bool newval) {
107 if (oldval != newval) {
108 if (sdplwin is null || sdplwin.closed) {
109 if (sdampwin is null || sdampwin.closed) return;
110 if (!newval) return;
111 if (dgGreatePListWindow !is null) dgGreatePListWindow();
112 } else {
113 if (sdplwin.hidden != !newval) {
114 if (newval) sdplwin.show(); else sdplwin.hide();
117 glconPostScreenRebuild();