Subversion Repositories Kolibri OS

Rev

Rev 2693 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2693 Rev 3068
Line 2... Line 2...
2
#include 
2
#include 
3
#include 
3
#include 
4
#include 
4
#include 
5
#include "winlib.h"
5
#include "winlib.h"
Line 6... Line -...
6
 
-
 
7
#define PANEL_HEIGHT        55
6
 
8
#define PANEL_CORNER_W      16
7
#define PANEL_CORNER_W       8
Line 9... Line 8...
9
#define FRAME_WIDTH          7
8
#define FRAME_WIDTH          7
-
 
9
 
-
 
10
#define ID_PLAY             100
-
 
11
#define ID_STOP             101
-
 
12
#define ID_PROGRESS         102
Line 10... Line 13...
10
 
13
#define ID_VOL_LEVEL        103
Line 11... Line 14...
11
#define ID_PLAY           100
14
#define ID_VOL_CTRL         104
12
 
15
 
Line 20... Line 23...
20
extern int res_play_btn_pressed[];
23
extern int res_play_btn_pressed[];
Line 21... Line 24...
21
 
24
 
22
extern int res_pause_btn[];
25
extern int res_pause_btn[];
Line -... Line 26...
-
 
26
extern int res_pause_btn_pressed[];
-
 
27
 
-
 
28
extern int res_stop_btn[];
23
extern int res_pause_btn_pressed[];
29
extern int res_stop_btn_pressed[];
24
 
30
 
25
//extern int res_minimize_btn[];
31
//extern int res_minimize_btn[];
Line 26... Line 32...
26
//extern int res_minimize_btn_hl[];
32
//extern int res_minimize_btn_hl[];
Line 32... Line 38...
32
 
38
 
33
int init_panel(window_t *win)
39
int init_panel(window_t *win)
34
{
40
{
35
    button_t     *btn;
41
    button_t     *btn;
-
 
42
    progress_t   *prg;
-
 
43
    level_t      *lvl;
Line 36... Line 44...
36
    progress_t   *prg;
44
    slider_t     *sld;
37
 
45
 
Line 38... Line 46...
38
    panel_t *panel = &win->panel;
46
    panel_t *panel = &win->panel;
39
    ctx_t   *ctx = &panel->ctx;
47
    ctx_t   *ctx = &panel->ctx;
Line 40... Line 48...
40
 
48
 
41
    link_initialize(&panel->ctrl.link);
49
    link_initialize(&panel->ctrl.link);
Line -... Line 50...
-
 
50
    list_initialize(&panel->ctrl.child);
-
 
51
 
42
    list_initialize(&panel->ctrl.child);
52
    panel->ctrl.handler = panel_proc;
43
 
53
    panel->ctrl.parent  = (ctrl_t*)win;
44
    panel->ctrl.handler = panel_proc;
54
 
45
    panel->ctrl.parent  = (ctrl_t*)win;
55
    panel->layout = 0;
46
 
56
 
Line 61... Line 71...
61
 
71
 
62
    btn->img_default = res_pause_btn;
72
    btn->img_default = res_pause_btn;
63
    btn->img_hilite  = res_pause_btn;
73
    btn->img_hilite  = res_pause_btn;
Line -... Line 74...
-
 
74
    btn->img_pressed = res_pause_btn_pressed;
-
 
75
 
-
 
76
    btn = create_button(NULL, ID_STOP,0,19,24,24,&panel->ctrl);
-
 
77
    panel->stop_btn = btn;
-
 
78
 
-
 
79
    btn->img_default = res_stop_btn;
-
 
80
    btn->img_hilite  = res_stop_btn;
64
    btn->img_pressed = res_pause_btn_pressed;
81
    btn->img_pressed = res_stop_btn_pressed;
65
 
82
 
Line -... Line 83...
-
 
83
    prg = create_progress(NULL,ID_PROGRESS,0,4,0,10,&panel->ctrl);
-
 
84
    panel->prg = prg;
-
 
85
 
-
 
86
    lvl = create_level(NULL, ID_VOL_LEVEL, 0, 20, 96, 10, &panel->ctrl);
-
 
87
    lvl->vol = -1875;
-
 
88
    panel->lvl = lvl;
-
 
89
 
66
    prg = create_progress(NULL,101,0,4,0,8,&panel->ctrl);
90
    sld = create_slider(NULL, ID_VOL_CTRL, 0, 20, 96+12, 12, &panel->ctrl);
67
    panel->prg = prg;
91
    panel->sld = sld;
Line 68... Line 92...
68
 
92
 
69
//    btn = create_button(NULL, ID_MINIMIZE,0,5,16,18,(ctrl_t*)cpt);
93
//    btn = create_button(NULL, ID_MINIMIZE,0,5,16,18,(ctrl_t*)cpt);
70
//    cpt->minimize_btn = btn;
94
//    cpt->minimize_btn = btn;
Line -... Line 95...
-
 
95
 
-
 
96
//    btn->img_default = res_minimize_btn;
71
 
97
//    btn->img_hilite  = res_minimize_btn_hl;
Line 72... Line 98...
72
//    btn->img_default = res_minimize_btn;
98
//    btn->img_pressed = res_minimize_btn_pressed;
73
//    btn->img_hilite  = res_minimize_btn_hl;
99
 
Line -... Line 100...
-
 
100
 
-
 
101
 
-
 
102
    update_panel_size(win);
-
 
103
 
-
 
104
    return 1;
-
 
105
};
-
 
106
 
-
 
107
 
-
 
108
static void panel_update_layout(panel_t *panel)
-
 
109
{
-
 
110
    progress_t *prg = panel->prg;
-
 
111
    level_t    *lvl = panel->lvl;
-
 
112
 
-
 
113
    if(panel->layout == 0)
-
 
114
    {
-
 
115
        prg->ctrl.rc.l = panel->ctrl.rc.l;
-
 
116
        prg->ctrl.rc.t = panel->ctrl.rc.t+7;
-
 
117
        prg->ctrl.rc.r = panel->ctrl.rc.r;
-
 
118
        prg->ctrl.rc.b = prg->ctrl.rc.t + prg->ctrl.h;
-
 
119
        prg->ctrl.w    = prg->ctrl.rc.r - prg->ctrl.rc.l;
-
 
120
 
-
 
121
        lvl->ctrl.rc.l = panel->ctrl.rc.l;
-
 
122
        lvl->ctrl.rc.t = panel->ctrl.rc.t+7;
-
 
123
        lvl->ctrl.rc.r = panel->lvl->ctrl.rc.l + panel->lvl->ctrl.w;
-
 
124
        lvl->ctrl.rc.b = panel->lvl->ctrl.rc.t + panel->lvl->ctrl.h;
-
 
125
    }
-
 
126
    else
-
 
127
    {
-
 
128
        lvl->ctrl.rc.l = panel->ctrl.rc.l;
-
 
129
        lvl->ctrl.rc.t = panel->ctrl.rc.t+7;
-
 
130
        lvl->ctrl.rc.r = lvl->ctrl.rc.l + lvl->ctrl.w;
-
 
131
        lvl->ctrl.rc.b = lvl->ctrl.rc.t + lvl->ctrl.h;
-
 
132
 
-
 
133
        prg->ctrl.rc.l = lvl->ctrl.rc.r;
-
 
134
        prg->ctrl.rc.t = panel->ctrl.rc.t+7;
-
 
135
        prg->ctrl.rc.r = panel->ctrl.rc.r;
-
 
136
        prg->ctrl.rc.b = prg->ctrl.rc.t + prg->ctrl.h;
-
 
137
        prg->ctrl.w    = prg->ctrl.rc.r - prg->ctrl.rc.l;
-
 
138
    };
-
 
139
};
-
 
140
 
-
 
141
void panel_set_layout(panel_t *panel, int layout)
-
 
142
{
-
 
143
    panel->layout = layout;
-
 
144
    panel->lvl->visible = layout;
-
 
145
 
-
 
146
    panel_update_layout(panel);
74
//    btn->img_pressed = res_minimize_btn_pressed;
147
 
75
 
148
    send_message(&panel->prg->ctrl, MSG_PAINT, 0, 0);
76
    update_panel_size(win);
149
 
Line 77... Line 150...
77
 
150
    if(layout)
Line 113... Line 186...
113
 
186
 
114
    panel->ctrl.w       = win->w;
187
    panel->ctrl.w       = win->w;
115
    panel->ctrl.h       = PANEL_HEIGHT;
188
    panel->ctrl.h       = PANEL_HEIGHT;
Line 116... Line 189...
116
    win->client.b       = win->h-PANEL_HEIGHT;
189
    win->client.b       = win->h-PANEL_HEIGHT;
117
 
190
 
118
    panel->play_btn->rc.l = win->w/2 - 16;
191
    panel->play_btn->ctrl.rc.l = win->w/2 - 16;
119
    panel->play_btn->rc.t = panel->ctrl.rc.t+19;
192
    panel->play_btn->ctrl.rc.t = panel->ctrl.rc.t+19;
120
    panel->play_btn->rc.r = panel->play_btn->rc.l + panel->play_btn->w;
193
    panel->play_btn->ctrl.rc.r = panel->play_btn->ctrl.rc.l + panel->play_btn->ctrl.w;
121
    panel->play_btn->rc.b = panel->play_btn->rc.t + panel->play_btn->h;
194
    panel->play_btn->ctrl.rc.b = panel->play_btn->ctrl.rc.t + panel->play_btn->ctrl.h;
122
 
195
 
123
    panel->prg->ctrl.rc.l = 8;
196
    panel->stop_btn->ctrl.rc.l = win->w/2 - 44;
124
    panel->prg->ctrl.rc.t = panel->ctrl.rc.t+7;
197
    panel->stop_btn->ctrl.rc.t = panel->ctrl.rc.t+23;
125
    panel->prg->ctrl.rc.r = panel->ctrl.rc.r-8;
-
 
126
    panel->prg->ctrl.rc.b = panel->prg->ctrl.rc.t+8;
-
 
127
    panel->prg->ctrl.w = panel->prg->ctrl.rc.r -
198
    panel->stop_btn->ctrl.rc.r = panel->stop_btn->ctrl.rc.l + panel->stop_btn->ctrl.w;
128
                        panel->prg->ctrl.rc.l;
199
    panel->stop_btn->ctrl.rc.b = panel->stop_btn->ctrl.rc.t + panel->stop_btn->ctrl.h;
129
 
200
 
130
    panel->prg->ctrl.h = panel->prg->ctrl.rc.b -
-
 
131
                         panel->prg->ctrl.rc.t;
201
    panel->sld->ctrl.rc.l = panel->ctrl.rc.l;
132
 
202
    panel->sld->ctrl.rc.t = panel->ctrl.rc.t+28;
133
//    cpt->minimize_btn->rc.l = win->w - 25 - 16 - 5;
-
 
Line -... Line 203...
-
 
203
    panel->sld->ctrl.rc.r = panel->sld->ctrl.rc.l + panel->sld->ctrl.w;
134
//    cpt->minimize_btn->rc.r = cpt->minimize_btn->rc.l +
204
    panel->sld->ctrl.rc.b = panel->sld->ctrl.rc.t + panel->sld->ctrl.h;
Line 135... Line 205...
135
//                           cpt->minimize_btn->w;
205
 
136
 
206
    panel_update_layout(panel);
Line 232... Line 302...
232
 
302
 
233
        case MSG_COMMAND:
303
        case MSG_COMMAND:
234
            switch((short)arg1)
304
            switch((short)arg1)
235
            {
305
            {
236
                case ID_PLAY:
306
                case ID_PLAY:
-
 
307
                case ID_STOP:
-
 
308
                case ID_PROGRESS:
237
                case 101: 
309
                case ID_VOL_CTRL:
238
                    win = get_parent_window(ctrl);
310
                    win = get_parent_window(ctrl);
239
                    send_message(win, msg, arg1, arg2);
311
                    send_message(win, msg, arg1, arg2);
Line 240... Line 312...
240
                    break;
312
                    break;