source: titan/titan/numinput.h @ 15272

Last change on this file since 15272 was 14082, checked in by nit, 12 years ago

[titan] first step anim screens

File size: 1.8 KB
RevLine 
[12752]1#ifndef NUMINPUT_H
2#define NUMINPUT_H
3
4char* numinput(char* title, char* num, char* mask, int isip)
5{
6        debug(1000, "in");
7        int rcret = -1, tmpscreencalc = 0, fromthread = 0, height = 0;
[12755]8        struct skin* numinput = getscreen("numinput");
9        struct skin* input = getscreennode(numinput, "input");
[12752]10        struct skin* framebuffer = getscreen("framebuffer");
11        char* ret = NULL, *bg = NULL;
12        char* numtmp = NULL;
13
14        if(pthread_self() != status.mainthread)
15                fromthread = 1;
16
[12755]17        changetitle(numinput, title);
18        height = numinput->height;
[12752]19        if(title != NULL)
[12755]20                numinput->height += numinput->fontsize + 6 + (numinput->bordersize * 2);
[12752]21
22        if(isip == 1)
23                numtmp = fixip(num, 0);
24        else
25                numtmp = ostrcat(num, NULL, 0, 0);
26
27        changemask(input, mask);
28        changeinput(input, numtmp);
29        free(numtmp); numtmp = NULL;
30
31        if(fromthread == 1)
32        {
33                m_lock(&status.drawingmutex, 0);
34                m_lock(&status.rcmutex, 10);
[13961]35                tmpscreencalc = status.screencalc;
[12752]36                status.screencalc = 2;
[12755]37                setnodeattr(numinput, framebuffer);
[13961]38                status.screencalc = tmpscreencalc;
[12755]39                status.rcowner = numinput;
40                bg = savescreen(numinput);
[12752]41                tmpscreencalc = status.screencalc;
42                status.screencalc = 0;
[12755]43                drawscreen(numinput, 2);
[12752]44        }
45        else
[12755]46                drawscreen(numinput, 0);
47        addscreenrc(numinput, input);
[12752]48
49        while(1)
50        {
[12755]51                rcret = waitrc(numinput, 0, 0);
[12752]52                if(rcret == getrcconfigint("rcexit", NULL)) break;
53                if(rcret == getrcconfigint("rcok", NULL))
54                {
55                        ret = ostrcat(input->input, NULL, 0, 0);
56                        break;
57                }
58        }
59
[12755]60        delownerrc(numinput);
[12752]61
62        if(fromthread == 1)
63        {
[12755]64                clearscreennolock(numinput);
65                restorescreen(bg, numinput);
[14082]66                blitfb(0);
[12752]67                status.screencalc = tmpscreencalc;
68                sleep(1);
69                status.rcowner = NULL;
70                m_unlock(&status.rcmutex, 3);
71                m_unlock(&status.drawingmutex, 0);
72        }
73        else
74        {
[12755]75                clearscreen(numinput);
[12752]76                drawscreen(skin, 0);
77        }
78
[12755]79        numinput->height = height;
[12752]80        debug(1000, "out");
81        return ret;
82}
83
84#endif
Note: See TracBrowser for help on using the repository browser.