comparison src/ui3/bmi/mmiProgressBar.c @ 421:6a4d9f47793e

src/ui3/bmi: file renames to make the case consistent
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Jan 2018 03:28:53 +0000
parents src/ui3/bmi/mmiprogressbar.c@e8ddbb0837ed
children
comparison
equal deleted inserted replaced
420:e8ddbb0837ed 421:6a4d9f47793e
1 /* =========================================================
2 * Texas Instruments OMAP(TM) Platform Software
3 * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved.
4 *
5 * Use of this software is controlled by the terms and conditions found
6 * in the license agreement under which this software has been supplied.
7 * ========================================================== */
8
9 /*==========================================================
10 * @file mmiprogressbar
11 *
12 * This provides the functionality of File Manager Applications.
13 * It supports mp3/midi file plaback progress
14 *
15 * @path \bmi\condat\ms\src\mmi
16 *
17 * @rev 00.01
18 */
19 /* ========================================================== */
20 /*===========================================================
21 *!
22 *! Revision History
23 *! ===================================
24
25 July 03, 2007 DRT: OMAPS00137912 x0066814
26 Description: AAC player Forward and Rewind feature development
27 Solution: In mmi_progress_dialog_kbd_cb(), under case KCD_MNURIGHT and case KCD_MNULEFT
28 added a condition to check if the selected file is a AAC file.
29
30 Apr 10, 2007 DRT: OMAPS00125151 x0039928
31 Description: MMI displays Progress Bar for only one Minute not for the entire duration of media (MIDI, MP3) play.
32 Solution: playback time from AS is now received in seconds instead of milliseconds.
33
34 Apr 05, 2007 DRT: OMAPS00124890 x0039928
35 Description: MMI back ground screen is some time blue and some time white.
36 Solution: Back ground is set to White color.
37
38 Apr 05, 2007 DRT: OMAPS00124881 x0039928
39 Description: AAC progress bar does not work
40 Solution: Progress bar is displayed if the callback is called from audio service irrespective
41 of any conditions.
42
43 Mar 28, 2007 ER: OMAPS00106188 x0039928
44 Description: Align Midi application menu choices and audio Player menu choices
45
46 * =========================================================== */
47
48 /******************************************************************************
49 Include Files
50 *******************************************************************************/
51 #include <string.h>
52 #include <stdio.h>
53 #include <stdlib.h>
54
55
56 //#include "\bmi\Condat\MS\SRC\aci\aci_cmh.h"
57 //#include "\bmi\Condat\MS\SRC\mfw\mfw_phb.h"
58
59 //#include "\bmi\Condat\MS\SRC\bmi\mmiDummy.h"
60
61 //#include "\bmi\condat\ms\src\mms\mg4def.h"
62 //#include "\bmi\condat\ms\src\mms\Color.h"
63 #include "mfw_sys.h"
64 #include "ATBPb.h"
65 #include "Mfw_mfw.h"
66
67 //#include "\bmi\Condat\MS\SRC\mfw\Mfw_win.h"
68 //#include "MmiDummy.h"
69 #include "mfw_tim.h"
70 #include "mfw_icn.h"
71 #include "Mfw_mnu.h"
72 #include "Mfw_sat.h"
73 #include "mfw_kbd.h"
74 #include "mmiColours.h"
75 #include "MmiDummy.h"
76 #include "mfw_fm.h"
77 //#include "aci_cmh.h"
78
79 //#include "\bmi\Condat\MS\SRC\atb\ATBPb.h"
80 //#include "\bmi\gdi\dspl.h"
81 #include "MmiSoftKeys.h"
82 #include "MmiDialogs.h"
83 #include "MmiLists.h"
84 #include "mmiFileManager.h"
85 #include "Mmiprogressbar.h"
86
87 #define FWD_REW_TIME 10
88
89 #define PAUSE 0
90 #define RESUME 1
91 #define PB_FORWARD 2
92 #define PB_REWIND 4
93
94 UBYTE aud_state = 1;
95 BOOL pb_block_keys = 0;
96 extern T_MMI_FM_STRUCT *fm_data;
97 T_MFW_HND pb_win;
98 MfwHnd tim;
99 int progress;
100 extern BOOL IsMP3Playing;//Daisy tang added for Real Resume feature 20071107
101 extern BOOL IsRealPaused;//Daisy tang added for Real Resume feature 20071107
102
103 static int mmi_progress_dialog_kbd_cb (MfwEvt e, MfwKbd *k);
104
105 void pbar_update(int playback_time, int total_time)
106 {
107 int pp;
108
109 if(playback_time <= total_time)
110 {
111 /* Apr 10, 2007 DRT: OMAPS00125151 x0039928 */
112 pp = (playback_time * 100)/total_time;
113 MmiProgressIndication( x_screen, y_screen, bar_width, bar_height, playback_time, pp);
114 pb_block_keys = 0;
115 aud_state = RESUME;
116 }
117 }
118
119 /******************************************************************************************/
120 // Call-Back function
121
122 static int ProgressBar_cb(MfwEvt e, MfwWin *w)
123 {
124
125 switch(e)
126 {
127 case E_WIN_VISIBLE:
128 //playback_percentage
129 progress = 0;
130 MmiProgressIndication( x_screen, y_screen, bar_width, bar_height, download_percentage, 0);
131 displaySoftKeys(TxtPlayerPause,TxtSoftBack);
132 // winShow(w);
133 break;
134
135
136 default:
137 return 0;
138
139 }
140
141
142
143 return MFW_EVENT_CONSUMED;
144
145 }
146
147
148
149 // Entry Function
150
151 T_MFW_HND progress_bar(T_MFW_HND parent )
152
153 {
154 T_MFW_WIN * win;
155
156
157 tProgressData * data = (tProgressData *)ALLOC_MEMORY (sizeof (tProgressData));
158
159 // T_MFW_HND parent = mfwParent( mfw_header());
160
161
162
163
164 if (data EQ NULL)
165 {
166 return NULL;
167 }
168
169
170 data->win = win_create (parent, 0, E_WIN_VISIBLE, (T_MFW_CB)ProgressBar_cb);
171
172 if (data->win EQ NULL)
173 {
174
175 return NULL;
176 }
177
178 pb_win = data->win;
179 data->mmi_control.data = (void *)data;
180 win = ((T_MFW_HDR *)data->win)->data;
181 win->user = (void *)data;
182 data->parent_win = parent;
183
184 // MmiProgressIndication( x_screen, y_screen, bar_width, bar_height, download_percentage, playback_percentage);
185 data->kbd = kbd_create (data->win,KEY_ALL|KEY_MAKE,(T_MFW_CB)mmi_progress_dialog_kbd_cb);
186 winShow(data->win);
187 return data->win;
188
189
190 }
191
192 // Progress Bar Implementation
193
194 void MmiProgressIndication(UBYTE x, UBYTE y, UBYTE b_width, UBYTE b_height, int pt, int pp)
195 {
196
197
198 int txtId1, x1, y1;
199 char * str1;
200
201 char str3[10];
202 // colour to fill in the Bar for Download & PlayBack Progress
203 // U32 download_Col = COL_Magenta;
204 U32 playback_Col = COL_Blue;
205
206
207 // Width of Progress bar showing Download & Playback progress
208 // Float download_progress_width;
209 Float playback_progress_width;
210
211 /* Apr 05, 2007 DRT: OMAPS00124890 x0039928 */
212 dspl_SetBgdColour (COL_White);
213 dspl_ClearAll();
214
215 // Draw the Progress Bar whose Width = width & Height = height
216 dspl_DrawFilledColRect( x,y,x+b_width, y+b_height, COL_MidGrey);
217
218 #if 0
219 // dspl_Enable(1);
220
221 /*** DOWNLOAD PROGRESS ***/
222
223 if(download_percentage <=0 )
224 {
225
226 // Do nothing
227
228 return;
229
230 }
231
232 else if(download_percentage >=100)
233 {
234 // Fill the Entire Bar
235 dspl_DrawFilledColRect( x,y, x+b_width, y+b_height , download_Col);
236 //return;
237 // dspl_Enable(1);
238 }
239
240 else
241 {
242
243 // download_progress_width = (b_width/100)*download_percentage;
244
245 // Fill the Bar to Show the Download progress
246 // dspl_DrawFilledColRect( x,y, x+( int )download_progress_width, y+b_height , download_Col);
247
248 // dspl_Enable(1);
249
250 /*** PLAYBACK PROGRESS ***/
251
252 dspl_DrawFilledColRect( x,y, x+b_width, y+b_height , download_Col);
253
254 if(playback_percentage <= 0 )
255 {
256 // Do nothing
257
258 return;
259
260 }
261
262 else if(playback_percentage >=100)
263 {
264 // Fill the Entire Bar
265 dspl_DrawFilledColRect( x,y, x+b_width, y+b_height , playback_Col);
266 // dspl_Enable(1);
267 return;
268
269 }
270
271 else
272 {
273 #endif
274
275 /* // Clear the Area to show the Playback progress
276
277 dspl_Clear(x,y, x+playback_percentage,y+height);
278 */
279
280
281 playback_progress_width = (b_width/100.00)*pp;
282 switch(aud_state)
283 {
284 case PAUSE:
285 txtId1 = TxtPlayerPause;
286 break;
287 case RESUME:
288 txtId1 = TxtPlayerPlaying;
289 break;
290 case PB_FORWARD:
291 txtId1 = TxtPlayerForwarding;
292 break;
293 case PB_REWIND:
294 txtId1 = TxtPlayerRewinding;
295 break;
296 default:
297 txtId1=TxtNull;
298 break;
299 }
300 str1 = MmiRsrcGetText(txtId1);
301
302
303 // Fill the Bar to Show the Playback progress
304 dspl_DrawFilledColRect(x,y, x+(int)playback_progress_width ,y+b_height , playback_Col);
305 // displaySoftKeys(TxtSoftOptions,TxtSoftBack);
306 if(aud_state == PAUSE)
307 displaySoftKeys(TxtPlayerResume,TxtSoftBack);
308 else
309 displaySoftKeys(TxtPlayerPause,TxtSoftBack);
310
311 x1= (SCREEN_SIZE_X/2) - (dspl_GetTextExtent(str1,0) / 2) ;
312 y1= (SCREEN_SIZE_Y -Mmi_layout_softkeyHeight())/2 - Mmi_layout_line_height();
313
314 sprintf(str3,"%d:%d", pt/60, pt%60);
315 dspl_TextOut(x,y - 20,DSPL_TXTATTR_NORMAL,str3);
316 dspl_TextOut(x1,y1,DSPL_TXTATTR_NORMAL,str1);
317 dspl_Enable(1);
318
319 #if 0
320 }
321
322
323 }
324 #endif
325
326 }
327
328
329
330 /*******************************************************************************
331 $Function: mmi_progress_dialog_kbd_cb
332
333 $Description: Handler for key events for the copy progress window
334
335 $Returns: Execution status
336
337 $Arguments: e -window event Id
338 k -key event
339 *******************************************************************************/
340 static int mmi_progress_dialog_kbd_cb (MfwEvt e, MfwKbd *k)
341 {
342
343 T_MFW_HND win = mfwParent( mfw_header());
344
345 T_FM_CURDIR *cur_dir = fm_data->cur_dir;
346
347 TRACE_FUNCTION("mmi_progress_dialog_kbd_cb");
348 if (!(e & KEY_MAKE))
349 {
350 return MFW_EVENT_CONSUMED;
351 }
352
353 switch (k->code)
354 {
355 case KCD_LEFT:
356 if(aud_state == PAUSE)
357 {
358 IsMP3Playing = TRUE;//Daisy tang added for Real Resume feature 20071107
359 mfw_fm_audResume();
360 aud_state = RESUME;
361 displaySoftKeys(TxtPlayerPause,TxtSoftBack);
362 }
363 else
364 {
365 IsMP3Playing = FALSE;//Daisy tang added for Real Resume feature 20071107
366 mfw_fm_audPause();
367 aud_state = PAUSE;
368 displaySoftKeys(TxtPlayerResume,TxtSoftBack);
369 }
370 break;
371 case KCD_RIGHT:
372 case KCD_HUP:
373 IsMP3Playing = FALSE;//Daisy tang added for Real Resume feature 20071107
374 mfw_fm_audStop();
375 break;
376
377 case KCD_MNURIGHT:
378 if((cur_dir->obj_list[cur_dir->currentIndex]->type == OBJECT_TYPE_AUDIO_MP3)||
379 (cur_dir->obj_list[cur_dir->currentIndex]->type == OBJECT_TYPE_AUDIO_MIDI)||
380 /*July 03, 2007 DRT: OMAPS00137912 x0066814*/
381 (cur_dir->obj_list[cur_dir->currentIndex]->type == OBJECT_TYPE_AUDIO_AAC))
382 if(pb_block_keys == 0)
383 {
384 pb_block_keys = 1;
385 aud_state = PB_FORWARD;
386 displayMenuKeys(MENU_KEY_WAIT);
387 as_forward(FWD_REW_TIME,NULL);
388 }
389 break;
390
391 case KCD_MNULEFT:
392 if((cur_dir->obj_list[cur_dir->currentIndex]->type == OBJECT_TYPE_AUDIO_MP3)||
393 (cur_dir->obj_list[cur_dir->currentIndex]->type == OBJECT_TYPE_AUDIO_MIDI)||
394 /*July 03, 2007 DRT: OMAPS00137912 x0066814*/
395 (cur_dir->obj_list[cur_dir->currentIndex]->type == OBJECT_TYPE_AUDIO_AAC))
396 if(pb_block_keys == 0)
397 {
398 pb_block_keys = 1;
399 aud_state = PB_REWIND;
400 displayMenuKeys(MENU_KEY_WAIT);
401 as_rewind(FWD_REW_TIME, NULL);
402 }
403 break;
404 }
405 return MFW_EVENT_CONSUMED;
406 }
407
408
409
410
411
412
413
414
415
416
417
418