aboutsummaryrefslogtreecommitdiff
path: root/wind.c
blob: 20f6bdc257d023a4bd0de3e1f34e37ad81ee18ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 * Ache - 2017-08-14 - GPLv3
 */

#include "wind.h"

/* Managed windows */

extern int w_menuContact,h_menuContact;
extern int x_WMessage,y_WMessage;
extern int w_WMessage,h_WMessage;

static short my_fg = COLOR_WHITE;
static short my_bg = COLOR_BLACK;
//extern char status[10];
extern WINDOW *cmd_win;
//extern WINDOW *sep_win;

void resize() {
    h_menuContact = LINES-2;
    w_menuContact =  COLS/5-1;

    x_WMessage = w_menuContact + 2;
    y_WMessage = 1;

    w_WMessage = (4*COLS)/5-2;
    h_WMessage = LINES-2;

    clear();
    showContactListW();
    move(1, x_WMessage-1);
    vline(ACS_VLINE, h_menuContact);
    showMessageWind();

    cmd_win_redisplay(true);
    CHECK(doupdate);
    move(LINES-1, 1);
}
void runtimeHelp(void) {
    int x = COLS/8;
    int y = LINES/7;

    int w = COLS*2/7;
    int h = LINES/7;

    clear();
    move(y,x);
    printw("This is the help");
    y+=2;
    move(y,0);
    printw(RUNTIME_HELP_STRING);


    move(LINES*6/7,x);
    printw("Type h or q to exit");
    int c = 0;
    while( (c = getch()) && c != EOF && !strchr("hHqQ", c) ) ;

    clear();
}
int confirmSend(char* txt, char* autheur) {
    int x = COLS/6;
    int y = LINES/3;

    int w = COLS*2/3;
    int h = LINES/3;

    clear();
    move(y,x);
    printw("Voulez-vous vraiment envoyé ce SMS à %s ?", autheur);
    y++;
    move(y,x);

    {
        char line[w];
        memset(line, 0, w);

        int X = 0, Y=0, iS= 0;
        while( txt[iS] ) {
            X = 0;
            while( X < w-1 && txt[iS]) {
                if( txt[iS] == '\n' ) {
                    iS++;
                    break;
                }
                line[X++] = txt[iS++];
            }
            line[X] = 0;
            if( Y+1 >= h_WMessage -1 )  {
                break;
            }
            Y++;
            move(Y+y, x+2);
            printw("%s", line);
        }
    }

    int c = 0;
    while( (c = getch()) && c != EOF && !strchr("oyneqOYNEQ", c) ) ;

    clear();
    return (c == 'e' || c =='E') ? 2 : (!!strchr("yYoO", c)) ;
}