source: titan/titan/skinadjust.h @ 23983

Last change on this file since 23983 was 23983, checked in by nit, 11 years ago

[titan] optimize

File size: 5.9 KB
Line 
1#ifndef SKINADJUST_H
2#define SKINADJUST_H
3
4void screenskinadjust()
5{
6        int rcret = 0, oleftoffset = 0, orightoffset = 0, otopoffset = 0, obottomoffset = 0, reboot = 0;
7        struct skin* skinadjust = getscreen("skinadjust");
8        struct skin* listbox = getscreennode(skinadjust, "listbox");
9        struct skin* fontsizeadjust = getscreennode(skinadjust, "fontsizeadjust");
10        struct skin* listboxselecttype = getscreennode(skinadjust, "listboxselecttype");
11        struct skin* osdtransparent = getscreennode(skinadjust, "osdtransparent");
12        struct skin* leftoffset = getscreennode(skinadjust, "leftoffset");
13        struct skin* rightoffset = getscreennode(skinadjust, "rightoffset");
14        struct skin* topoffset = getscreennode(skinadjust, "topoffset");
15        struct skin* bottomoffset = getscreennode(skinadjust, "bottomoffset");
16        struct skin* showrecfreesize = getscreennode(skinadjust, "showrecfreesize");
17        struct skin* listboxselect = getscreennode(skinadjust, "listboxselect");
18        struct skin* tmp = NULL;
19        char* ret = NULL;
20
21        changeinput(fontsizeadjust, "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n-15\n-14\n-13\n-12\n-11\n-10\n-9\n-8\n-7\n-6\n-5\n-4\n-3\n-2\n-1");
22        setchoiceboxselection(fontsizeadjust, getskinconfig("fontsizeadjust", NULL));
23
24        addchoicebox(listboxselecttype, "0", _("border"));
25        addchoicebox(listboxselecttype, "1", _("bar"));
26        addchoicebox(listboxselecttype, "2", _("text"));
27        addchoicebox(listboxselecttype, "3", _("picture"));
28        setchoiceboxselection(listboxselecttype, getskinconfig("listboxselecttype", NULL));
29       
30        changeinput(osdtransparent, "0\n5\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60\n65\n70");
31        setchoiceboxselection(osdtransparent, getskinconfig("osdtransparent", NULL));
32
33        changeinput(leftoffset, "0\n10\n20\n30\n40\n50\n60\n70\n80\n90\n100");
34        setchoiceboxselection(leftoffset, getconfig("fbleftoffset", NULL));
35
36        changeinput(rightoffset, "0\n10\n20\n30\n40\n50\n60\n70\n80\n90\n100");
37        setchoiceboxselection(rightoffset, getconfig("fbrightoffset", NULL));
38
39        changeinput(topoffset, "0\n10\n20\n30\n40\n50\n60\n70\n80\n90\n100");
40        setchoiceboxselection(topoffset, getconfig("fbtopoffset", NULL));
41
42        changeinput(bottomoffset, "0\n10\n20\n30\n40\n50\n60\n70\n80\n90\n100");
43        setchoiceboxselection(bottomoffset, getconfig("fbbottomoffset", NULL));
44
45        oleftoffset = getconfigint("fbleftoffset", NULL);
46        orightoffset = getconfigint("fbrightoffset", NULL);
47        otopoffset = getconfigint("fbtopoffset", NULL);
48        obottomoffset = getconfigint("fbbottomoffset", NULL);
49
50        addchoicebox(showrecfreesize, "0", _("no"));
51        addchoicebox(showrecfreesize, "1", _("yes (Text in %)"));
52        addchoicebox(showrecfreesize, "2", _("yes (Text in MB)"));
53        setchoiceboxselection(showrecfreesize, getconfig("showrecfreesize", NULL));
54       
55        addchoicebox(listboxselect, "0", _("press red"));
56
57        drawscreen(skinadjust, 0, 0);
58        addscreenrc(skinadjust, listbox);
59
60        tmp = listbox->select;
61        while(1)
62        {
63                int offsetchange = 0;
64                addscreenrc(skinadjust, tmp);
65                rcret = waitrc(skinadjust, 0, 0);
66                tmp = listbox->select;
67
68                addconfigscreencheck("fbleftoffset", leftoffset, "0");
69                if(status.leftoffset != getconfigint("fbleftoffset", NULL)) offsetchange = 1;
70                status.leftoffset = getconfigint("fbleftoffset", NULL);
71               
72                addconfigscreencheck("fbrightoffset", rightoffset, "0");
73                if(status.rightoffset != getconfigint("fbrightoffset", NULL)) offsetchange = 1;
74                status.rightoffset = getconfigint("fbrightoffset", NULL);
75               
76                addconfigscreencheck("fbtopoffset", topoffset, "0");
77                if(status.topoffset != getconfigint("fbtopoffset", NULL)) offsetchange = 1;
78                status.topoffset = getconfigint("fbtopoffset", NULL);
79               
80                addconfigscreencheck("fbbottomoffset", bottomoffset, "0");
81                if(status.bottomoffset != getconfigint("fbbottomoffset", NULL)) offsetchange = 1;
82                status.bottomoffset = getconfigint("fbbottomoffset", NULL);
83               
84                if(offsetchange == 1 && (ostrcmp(getconfig("av_mode3d", NULL), "sbs") == 0 || ostrcmp(getconfig("av_mode3d", NULL), "tab") == 0)) clearfball();
85               
86                drawscreen(skinadjust, 0, 0);
87
88                if(rcret == getrcconfigint("rcexit", NULL))
89                {
90                        addconfigint("fbleftoffset", oleftoffset);
91                        status.leftoffset = getconfigint("fbleftoffset", NULL);
92                        addconfigint("fbrightoffset", orightoffset);
93                        status.rightoffset = getconfigint("fbrightoffset", NULL);
94                        addconfigint("fbtopoffset", otopoffset);
95                        status.topoffset = getconfigint("fbtopoffset", NULL);
96                        addconfigint("fbbottomoffset", obottomoffset);
97                        status.bottomoffset = getconfigint("fbbottomoffset", NULL);
98                        clearfball();
99                        break;
100                }
101               
102                if(rcret == getrcconfigint("rcred", NULL))
103                {
104                        if(listbox->select != NULL && ostrcmp(listbox->select->name, "listboxselect") == 0)
105                        {
106                                long oldlistboxselectcol = convertcol("listboxselect");
107                                char* tmpstr = screencolorpicker(getskinconfig("listboxselect", NULL), 0, 0, 0);
108                                if(tmpstr != NULL)
109                                        addskinconfigtmp("listboxselect", tmpstr);
110                                if(oldlistboxselectcol != convertcol("listboxselect")) reboot = 1;
111                                drawscreen(skinadjust, 0, 0);
112                        }
113                       
114                        continue;               
115                }
116
117                if(rcret == getrcconfigint("rcok", NULL))
118                {
119                        int oldfontsizeadjust = getskinconfigint("fontsizeadjust", NULL);
120                        addskinconfigscreencheck("fontsizeadjust", fontsizeadjust, "0");
121                        if(oldfontsizeadjust != getskinconfigint("fontsizeadjust", NULL)) reboot = 1;
122                        status.fontsizeadjust = getconfigint("fontsizeadjust", NULL);                   
123                       
124                        addskinconfigscreencheck("listboxselecttype", listboxselecttype, "0");
125                        status.listboxselecttype = getskinconfigint("listboxselecttype", NULL);
126                        addskinconfigscreencheck("osdtransparent", osdtransparent, "0");
127                        setosdtransparent(getskinconfigint("osdtransparent", NULL));
128                        addconfigscreencheck("showrecfreesize", showrecfreesize, "0");
129                        status.showrecfreesize = getconfigint("showrecfreesize", NULL);
130
131      writeskinconfigtmp();
132      if(reboot == 1)
133                        {
134                                textbox(_("Message"), _("Receiver now reboot !!!"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 0, 0);
135                                oshutdown(3, 0);
136                        }
137     
138                        break;
139                }
140        }
141
142  delskinconfigtmpall();
143        delownerrc(skinadjust);
144        clearscreen(skinadjust);
145}
146
147#endif
Note: See TracBrowser for help on using the repository browser.