File: statbar.c

package info (click to toggle)
dosemu-freedos 1%3A0.0.b9r5a-3
  • links: PTS
  • area: contrib
  • in suites: etch-m68k
  • size: 19,768 kB
  • ctags: 23,285
  • sloc: ansic: 143,966; asm: 20,397; makefile: 3,868; perl: 1,106; yacc: 690; sh: 553; pascal: 297; xml: 150; cpp: 67
file content (73 lines) | stat: -rw-r--r-- 1,965 bytes parent folder | download | duplicates (2)
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
/*  Status Bar

    Part of the FreeDOS Editor

*/

#include "dflat.h"

extern char time_string[];

int StatusBarProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
{
    char *statusbar;

    switch (msg)
        {
        case CREATE_WINDOW:
            SendMessage(wnd, CAPTURE_CLOCK, 0, 0);
            break;
        case KEYBOARD:
            if ((int)p1 == CTRL_F4)
                return TRUE;

            break;
        case PAINT: 
            if (!isVisible(wnd))
                break;

            statusbar = DFcalloc(1, WindowWidth(wnd)+1);
            memset(statusbar, ' ', WindowWidth(wnd));
            *(statusbar+WindowWidth(wnd)) = '\0';
            strncpy(statusbar+1, "F1=Help ", 9);
            if (wnd->text)
                {
                int len = min(strlen(wnd->text), WindowWidth(wnd)-9);

                if (len > 0)
                    {
                    int off=(WindowWidth(wnd)-67);

                    strncpy(statusbar+off, wnd->text, len);
                    }

                }

            strncpy(statusbar+WindowWidth(wnd)-10, "", 1);
            if (wnd->TimePosted)
                *(statusbar+WindowWidth(wnd)-8) = '\0';
            else
                strncpy(statusbar+WindowWidth(wnd)-8,time_string, 9);

            SetStandardColor(wnd);
            PutWindowLine(wnd, statusbar, 0, 0);
            free(statusbar);
            return TRUE;
        case BORDER:
            return TRUE;
        case CLOCKTICK:
            SetStandardColor(wnd);
            PutWindowLine(wnd, (char *)p1, WindowWidth(wnd)-8, 0);
            wnd->TimePosted = TRUE;
            SendMessage(wnd->PrevClock, msg, p1, p2);
            return TRUE;
        case CLOSE_WINDOW:
            SendMessage(wnd, RELEASE_CLOCK, 0, 0);
            break;
        default:
            break;
        }

    return BaseWndProc(STATUSBAR, wnd, msg, p1, p2);

}