Subversion Repositories Kolibri OS

Rev

Rev 134 | Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
134 diamond 1
key_codes db 27,182,109,115,114,122,98,118,108,120,99,13,8,32,0,    0, 0,0
2
   db 180,181,93,91
3
; bottom actions
4
   db  0, 0, 0, 0, 0,185,0, 0, 0, 0,0,0,92
5
btn_codes db  1,  0,  0,  9, 10,  3, 7,  6,  8,  4, 5, 0,0, 0,101,100,11,2
6
   db   0,  0, 0, 0
7
; bottom actions
8
   db 35,49,48,37,31,32,41,42,40,36,103,104,0
9
jmps dw  _close, kDel,kMute, bList.shuf, bList.repe, bList.prev, bList.next
10
   dw  bList.stop, kLoad, Xpress, Rewind.space, auto_load,Rewind, Rewind.space
11
   dw  bReverse, bShade, bList, bBar, bOctU, bOctD, bSelTrack, bSelChannel
12
; bottom actions
13
   dw kDel,bLsave,bLload,bRemAll,bAdd,bAddDir,bSelZero,bInvSel,bSelAll,bRemCrop
14
   dw  bMinimize,bAbout,bResetTrk
15
 
16
jmps_end:
17
 
18
key:
19
    mov  eax,2
20
    int  0x40
21
    mov  edi,key_codes
22
    cmp  ah,48
23
    jb   .jump
24
    cmp  ah,57
25
    ja   .jump
26
    sub  ah,48
27
    mov  byte[channel],ah
28
    jmp  midi_kill
29
  .jump:
30
    mov  ecx,(jmps_end-jmps)/2
31
    mov  ebx,edi
32
    shr  eax,8
33
    repne scasb
34
    jne  play_.noplsel
35
    sub  edi,ebx
36
    jmp  word[jmps+edi*2-2]
37
  kDel:
38
    call PL_del
39
    call PL_show
40
    jmp  still
41
  kMute:
42
    xor  [flag],FL_MUTE
43
    jmp  still
44
  kLoad:
45
;    dps  'Load'
46
    cmp  [list_count],LISTITEMS
47
    jbe  noparam
48
    jmp  still
49
  Xpress:
50
    mov  eax,IPC_PLAY
51
    call ipc_send
52
    jmp  still;Rewind.space
53
 auto_load:
54
    call PL_get1stsel
55
    mov  eax,ebx
56
  play_:
57
    mov  [play_num],eax
58
    call PL_getbyindex
59
    mov  edi,filename;fnbuf
60
    rep  movsb
61
    xor  eax,eax
62
    mov  byte[edi],al
63
    and  [flag],not FL_ADD
64
    or   [flag],FL_PLAY
65
    jmp  open_file
66
  .noplsel:
67
    call PL_get1stsel
68
    test ebx,ebx
69
    jz   .noupward
70
    cmp  al,178
71
    jne  .noupa
72
  .seldec:
73
    dec  ebx;[listsel]
74
  .listdraw:
75
    call PL_clearsel
76
    mov  eax,ebx
77
    call PL_getbyindex
78
    or   word[esi-2],FL_MULSEL
79
    call PL_show
80
    jmp  still
81
  .noupa:
82
    cmp  al,184
83
    jne  .noupward
84
    dec  [listsel]
85
  .swap:
86
    dec  ebx
87
    call PL_swap
88
    jmp  .listdraw
89
  .noupward:
90
    inc  ebx
91
    cmp  bl,[list_count]
92
    jae  still
93
    cmp  al,177
94
    je  .listdraw
95
  .nodowna:
96
    cmp  al,183
97
    jne  still
98
    inc  [listsel]
99
    jmp  .swap
100
  Rewind:
101
    push [midi_limit]
102
    pop  [cur_ptr]
103
    and  [cur_tick],0
104
    jmp  red
105
  .space:
106
    cmp  [tick_count],0
107
    jz   still
108
    mov  eax,IPC_TRIG
109
    call ipc_send
110
    jmp  red
111
 
112
  button:
113
    mov  eax,17
114
    int  0x40
115
    cmp  ah,20
116
    jb   .nobott
117
    cmp  ah,25
118
    ja   .nobott
119
    sub  ah,20
120
    mov  [popup],ah
121
  .sh:
122
    or   [flag],FL_BOTTRED
123
    call PL_show
124
    jmp  still
125
  .nobott:
126
    cmp  ah,31
127
    jb   .nopop
128
    cmp  ah,50
129
    ja   .nopop
130
    mov  [popup],-1
131
    or   [flag],FL_BOTTRED
132
    call PL_show
133
 
134
SH_POPUP equ 10
135
  if SH_POPUP eq 1
136
    mov  ebx,eax
137
    shr  ebx,8
138
    dps  'Popup#='
139
    dpd  ebx
140
    jmp  .sh
141
  end if
142
  .nopop:
143
    mov  edi,btn_codes
144
    jmp  key.jump
145
  bReverse:
146
    xor  [flag],FL_REVERSE
147
    call draw_bar
148
    jmp  still
149
  _close:
150
    call kill
151
    or   eax,-1
152
    int  0x40
153
 
154
  bShade:
155
    call Shade
156
    jmp  still
157
  Shade:
158
    xor  [flag],FL_HIDDEN
159
    test [flag],FL_HIDDEN
160
    jz  .open
161
    mov  esi,14
162
    mov  [coo],main_coo2
163
    jmp  .op
164
  .open:
165
    mov  esi,WND_HEIGHT
166
    mov  [coo],main_coo
167
  .op:
168
    mov  ebx,-1
169
    mov  ecx,ebx
170
    mov  edx,ebx
171
    mov  eax,67
172
    int  0x40
173
    ret
174
  bMinimize:
175
;    mcall 18,10
176
    jmp  still
177
  bList:
178
    mov  [popup],-1
179
    mov  edx,[listsel]
180
    call PL_getitemclick
181
    mov  [listsel],eax
182
    mcall 66,3
183
    mov  ebx,eax
184
;    dph  ebx
185
    test ebx,1100b
186
    jnz  .mul
187
    call PL_clearsel
188
    test ebx,11b
189
    jz   .skipor
190
    mov  ecx,[listsel]
191
    mov  [listsel],edx
192
    cmp  ecx,edx
193
    je   .skipor
194
    ja   .above
195
    xchg ecx,edx
196
  .above:
197
    sub  ecx,edx
198
    inc  ecx
199
    mov  eax,edx
200
    push ecx
201
    call PL_getbyindex
202
    sub  esi,2
203
    pop  ecx
204
    call PL_shiftsel
205
    jmp  .plsh
206
  .mul:
207
    bts  [flag],15
208
    jc   .skipor
209
    mov  eax,edx
210
    call PL_getbyindex
211
    or  word[esi-2],FL_MULSEL
212
  .skipor:
213
    mov  eax,[listsel]
214
    call PL_getbyindex
215
    xor  word[esi-2],FL_MULSEL
216
  .plsh:
217
    call PL_show
218
    mcall 40,111b
219
    mcall 23,30
220
    push eax
221
    mcall 40,1000111b
222
    pop  eax
223
    cmp  eax,3
224
    jne  still
225
    mcall 17
226
    cmp  ah,11
227
    jne  still
228
    call PL_getitemclick
229
    cmp  eax,[listsel]
230
    je  auto_load
231
    mov  [listsel],eax
232
    call PL_show
233
    jmp  still
234
  .repe:
235
    xor  [flag],FL_REPEAT
236
    jmp  red
237
  .stop:
238
    mov  eax,IPC_PAUS
239
    call ipc_send
240
    jmp  Rewind
241
  .shuf:
242
    xor  [flag],FL_SHUFFLE
243
    jmp  red
244
  .prev:
245
    mov  eax,[play_num]
246
    test eax,eax
247
    jz   still
248
    dec  eax
249
    jmp  play_
250
  .next:
251
    mov  eax,[play_num]
252
    inc  eax
253
    cmp  al,[list_count]
254
    jae  still
255
    jmp  play_
256
  bBar:
257
    cmp  [tick_count],0
258
    jz   still
259
    mov  eax,37
260
    mov  ebx,1
261
    int  0x40
262
    mov  ebp,[coo]
263
    sub  eax,[ebp-16]
264
    shr  eax,16
265
    mov  ebx,[tick_count]
266
    mul  ebx
267
    mov  ebx,[ebp-20]
268
    div  ebx
269
    mov  ebx,eax ; ebx - selected tick
270
    xor  ecx,ecx
271
    mov  esi,[midi_limit]
272
  .further:
273
    lodsw
274
    and  eax,0x7f
275
    add  ecx,eax
276
    cmp  ecx,ebx
277
    jb   .further
278
    sub  ecx,eax
279
    mov  [cur_tick],ecx
280
    sub  esi,2
281
    mov  [cur_ptr],esi
282
  drw:
283
    jmp  red
284
 
285
OCT_CH equ 3
286
  bOctU:
287
    add  [octave],OCT_CH
288
    jmp  midi_kill
289
  bOctD:
290
    sub  [octave],OCT_CH
291
    jmp  midi_kill
292
  bSelChannel:
293
    call get_num
294
    cmp  eax,-1
295
    je   still
296
    dps  <13,10,'Channel#'>
297
    dpd  eax
298
    mov  [channel],eax
299
    jmp  midi_kill
300
  bSelTrack:
301
    call get_num
302
    cmp  eax,-1
303
    je   still
304
    dps  <13,10,'Track#'>
305
    dpd  eax
306
    mov  [sel_track],al
307
    jmp  midi_kill
308
  bResetTrk:
309
    xor  eax,eax
310
    mov  [sel_track],al
311
    mov  [channel],eax
312
    dps  <13,10,'Both track & channel are 0',13,10>
313
    jmp  midi_kill
314
  bLsave:
315
    call PL_save
316
  bLload:
317
    call PL_load
318
    jmp  red
319
  bRemAll:
320
    and  [list_count],0
321
    mov  [play_limit],playlist-2
322
    jmp  red
323
  bAdd:
324
    movzx eax,[list_count]
325
    dpd  eax
326
    call fopen
327
    mov  edi,filename
328
    cmp  byte[edi],0
329
    jz   still
330
    call str_len
331
    xchg eax,ecx
332
    mov  esi,edi
333
    jmp  add_song
334
  bAddDir:
335
    call fopen
336
    mov  edi,filename
337
    cmp  byte[edi],0
338
    jz   still
339
    call find_slash
340
    lea  edx,[edi-filename+fnbuf] ; edx -> '/'
341
    and  byte[edi],0
342
    mov  esi,filename
343
    mov  edi,fnbuf
139 diamond 344
    mov  ecx,1024/4
345
    rep  movsd
346
        and     dword [dir_info+4], 0
134 diamond 347
  .nxt2:
139 diamond 348
        mcall   70, dir_info
349
        cmp     ebx, 1
350
        jnz     red ;still
351
        test    byte [dir_table+32], 11000b     ; exclude directories & vol label
352
        jnz     .no
353
        mov     edi, dir_table+32+40
354
        mov     esi, edi
355
        xor     eax, eax
356
        or      ecx, -1
357
        repnz   scasb
358
        mov     eax, [edi-5]
359
        or      eax, 0x20202000
360
        cmp     eax, '.mid'
361
        jz      .ok
362
        cmp     eax, '.kar'
363
        jnz     .no
364
.ok:
365
        lea     ecx, [edi-dir_table-32-40-1]
366
        mov     edi, edx
367
        rep     movsb
368
        mov     ecx, edi
369
        mov     esi, fnbuf
370
        sub     ecx, esi
371
        call    PL_add
372
.no:
373
        inc     dword [dir_info+4]
374
        jmp     .nxt2
134 diamond 375
  bSelZero:
376
    call PL_clearsel
377
    jmp  red
378
  bInvSel:
379
    call PL_invsel
380
    jmp  red
381
  bSelAll:
382
    call PL_clearsel
383
    call PL_invsel
384
    jmp  red
385
  bRemCrop:
386
    call PL_invsel
387
    call PL_del
388
    jmp  bSelAll
389
  bAbout:
390
    mov  edx,about1
391
    call debug_outstr
392
    jmp  still
393
 
394
get_num:  ; out: eax-number entered
395
    or   [flag],FL_LOCK
396
    mcall 10
397
    dpd  eax
398
    cmp  eax,1
399
    jne  .nored
400
    call draw_window
401
    jmp  get_num
402
  .nored:
403
    cmp  eax,2
404
    jne  .nokey
405
    mcall 2
406
    movzx eax,ah
407
    sub  eax,'0'
408
    jl   .none
409
    cmp  eax,9
410
    jbe  .ok
411
  .none:
412
    mov  eax,-1
413
  .ok:
414
    and  [flag],not FL_LOCK
415
    ret
416
  .nokey:
417
    cmp  eax,3
418
    jne  get_num
419
    mcall 17
420
    jmp  get_num
421
 
422
find_slash:
423
; in: edi-filename, out: edi-slash ptr-1
424
    push eax ecx
425
    call str_len
426
    mov  ecx,eax
427
    std
428
    add  edi,eax
429
    mov  al,'/'
430
    repne scasb
431
    cld
432
    add  edi,2
433
    pop  ecx eax
434
    ret
435