Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
258 mikedld 1
;-----------------------------------------------------------------------------
2
func define_3d_button ;///////////////////////////////////////////////////////
3
;-----------------------------------------------------------------------------
4
; ebx = 
5
; ecx = 
6
; esp+4*3 = id
7
; esp+4*2 = text
8
; esp+4*1 = text length
9
;-----------------------------------------------------------------------------
10
	pushad
11
	mov	edx,[esp+4*8+4+4*2]
12
	or	edx,0x40000000
13
	mcall	8
14
	mov	eax,[esp+4*8+4*1]
15
	add	eax,2
16
	imul	eax,6
17
	pushad
18
	shr	ebx,16
19
	shr	ecx,16
20
	push	ebx ecx eax 15
21
	call	draw_3d_panel
22
	popad
23
	shr	ecx,16
24
	mov	bx,cx
25
	add	ebx,7*65536+4
26
	mcall	4,,[sc.work_text],[esp+4*8+4*2],[esp+4*8+4*1]
27
	popad
28
	ret	4*3
29
endf
30
 
31
finddlg_handler:
32
	cmp	al,1
33
	je	.draw
34
	cmp	al,2
35
	je	.key
36
	cmp	al,3
37
	je	botdlg.button
38
	ret
39
 
40
  .draw:
41
	mov	ebx,[bot_ofs]
42
	add	ebx,(1+3)*65536+6
43
	mcall	4,,[sc.work_text],s_2find,s_2find.size+1
44
	mov	ecx,[bot_ofs]
45
	shl	ecx,16
46
	add	ecx,(3+17)*65536+15
47
 
48
	push	ecx
49
	cmp	[bot_dlg_mode2],0
50
	je	@f
51
	add	ebx,18
52
	mcall	4,,[sc.work_text],s_2replace,s_2replace.size+1
53
	mov	ecx,[esp]
54
	add	ecx,18*65536
55
    @@:
56
 
57
	mov	ebx,[p_info.client_box.width]
58
	shl	ebx,16
59
 
60
	push	20003
61
	cmp	[bot_dlg_mode2],0
62
	jne	.draw.lp1
63
	add	ebx,-(2+6*(s_2find.size+2))*65536+6*(s_2find.size+2)
64
	push	s_2find s_2find.size
65
	jmp	@f
66
 
67
  .draw.lp1:
68
	add	ebx,-(2+6*(s_2replace.size+2))*65536+6*(s_2replace.size+2)
69
	push	s_2replace s_2replace.size
70
 
71
    @@: call	define_3d_button
72
	sub	ebx,(6*(s_2cancel.size+2)+3)*65536
73
	mov	bx,6*(s_2cancel.size+2)
74
	push	20001 s_2cancel s_2cancel.size
75
	call	define_3d_button
76
 
77
	mov	ecx,[esp]
78
 
79
	mov	ebp,tb_find
80
	mov	eax,[p_info.client_box.width]
81
	sub	eax,6*(s_2find.size+2)+1
82
	add	eax,6*(s_2find.size+2)*65536
297 mikedld 83
	mov	dword[tbox.width],eax
258 mikedld 84
	add	ecx,-18*65536+1
297 mikedld 85
	mov	dword[tbox.height],ecx
258 mikedld 86
	call	textbox.draw
87
 
88
	pop	ecx
89
 
90
	cmp	[bot_dlg_mode2],0
91
	je	@f
92
	mov	ebp,tb_replace
93
	mov	eax,[p_info.client_box.width]
94
	sub	eax,6*(s_2replace.size+2)+1
95
	add	eax,6*(s_2replace.size+2)*65536
297 mikedld 96
	mov	dword[tbox.width],eax
258 mikedld 97
	inc	ecx
297 mikedld 98
	mov	dword[tbox.height],ecx
258 mikedld 99
	call	textbox.draw
100
    @@:
101
 
102
	ret
103
 
104
  .key:
105
	cmp	ebx,KEY_ESCAPE
106
	je	btn.bot.cancel
107
	cmp	ebx,KEY_RETURN
108
	je	btn.bot.find
109
	cmp	ebx,KEY_NUMRETURN
110
	je	btn.bot.find
111
	cmp	ebx,KEY_TAB
112
	je	..tab
113
	call	textbox.key
114
	ret
115
 
116
  ..tab:
117
	cmp	[bot_dlg_mode2],0
118
	je	@f
119
	mov	eax,tb_replace
120
	cmp	eax,[focused_tb]
121
	jne	.key.lp1
122
	mov	eax,tb_find
123
  .key.lp1:
124
	mov	[focused_tb],eax
125
	call	.draw
126
    @@: ret
127
 
128
osdlg_handler:
129
	cmp	al,1
130
	je	.draw
131
	cmp	al,2
132
	je	.key
133
	cmp	al,3
134
	je	botdlg.button
135
	ret
136
 
137
  .draw:
138
	mov	ebx,[bot_ofs]
139
	add	ebx,(1+3)*65536+6
140
	mcall	4,,[sc.work_text],s_2filename,s_2filename.size
141
	mov	ebx,[p_info.client_box.width]
142
	shl	ebx,16
143
	mov	ecx,[bot_ofs]
144
	shl	ecx,16
145
	add	ecx,(2+18)*65536+15
146
 
147
	push	20002
148
	cmp	[bot_dlg_mode2],0
149
	jne	.draw.lp1
150
	add	ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2)
151
	push	s_2open s_2open.size
152
	jmp	@f
153
  .draw.lp1:
154
	add	ebx,-(2+6*(s_2save.size+2))*65536+6*(s_2save.size+2)
155
	push	s_2save s_2save.size
156
 
157
    @@: call	define_3d_button
158
	sub	ebx,(6*(s_2cancel.size+2)+3)*65536
159
	mov	bx,6*(s_2cancel.size+2)
160
	push	20001 s_2cancel s_2cancel.size
161
	call	define_3d_button
162
 
595 Rus 163
	cmp	[bot_dlg_mode2], 2	; exit-save dialog
164
	jne	@f
165
 
166
	sub	ebx,(6*(s_2save_no.size+2)+3)*65536
167
	mov	bx,6*(s_2save_no.size+2)
168
	push	20007 s_2save_no s_2save_no.size
169
	call	define_3d_button
170
 
171
    @@: mov	ebp,tb_opensave
258 mikedld 172
	mov	eax,[p_info.client_box.width]
173
	sub	eax,6*(s_2filename.size+1)+1
174
	add	eax,6*(s_2filename.size+1)*65536
297 mikedld 175
	mov	dword[tbox.width],eax
258 mikedld 176
	add	ecx,-18*65536+1
297 mikedld 177
	mov	dword[tbox.height],ecx
258 mikedld 178
	call	textbox.draw
179
 
180
	ret
181
 
182
  .key:
183
	cmp	ebx,KEY_ESCAPE
184
	je	btn.bot.cancel
185
	cmp	ebx,KEY_RETURN
186
	je	btn.bot.opensave
187
	cmp	ebx,KEY_NUMRETURN
188
	je	btn.bot.opensave
189
	call	textbox.key
190
	ret
191
 
192
gotodlg_handler:
193
	cmp	al,1
194
	je	.draw
195
	cmp	al,2
196
	je	.key
197
	cmp	al,3
198
	je	botdlg.button
199
	ret
200
 
201
  .draw:
202
	mov	ebx,[bot_ofs]
203
	add	ebx,(1+3)*65536+6
204
	mcall	4,,[sc.work_text],s_2filename,s_2filename.size
205
	mov	ebx,[p_info.box.width]
206
	shl	ebx,16
207
	mov	ecx,[bot_ofs]
208
	shl	ecx,16
209
	add	ecx,(2+18)*65536+15
210
 
211
	push	20002
212
	cmp	[bot_dlg_mode2],0
213
	jne	.draw.lp1
214
	add	ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2)
215
	push	s_2open s_2open.size
216
	jmp	@f
217
  .draw.lp1:
218
	add	ebx,-(2+6*(s_2save.size+2))*65536+6*(s_2save.size+2)
219
	push	s_2save s_2save.size
220
 
221
    @@: call	define_3d_button
222
	sub	ebx,(6*(s_2cancel.size+2)+3)*65536
223
	mov	bx,6*(s_2cancel.size+2)
224
	push	20001 s_2cancel s_2cancel.size
225
	call	define_3d_button
226
 
227
	mov	ebp,tb_opensave
228
	mov	eax,[p_info.box.width]
229
	sub	eax,6*(s_2filename.size+3)
230
	add	eax,6*(s_2filename.size+2)*65536
297 mikedld 231
	mov	dword[tbox.width],eax
258 mikedld 232
	add	ecx,-18*65536+1
297 mikedld 233
	mov	dword[tbox.height],ecx
258 mikedld 234
	call	textbox.draw
235
 
297 mikedld 236
	sub	ebx,(6*(s_2cancel.size+2)+3)*65536
237
	mov	bx,6*(s_2cancel.size+2)
238
	push	20010 s_2cancel s_2cancel.size
239
	call	define_3d_button
240
 
258 mikedld 241
	ret
242
 
243
  .key:
244
	cmp	ebx,KEY_ESCAPE
245
	je	btn.bot.cancel
246
	cmp	ebx,KEY_RETURN
247
	je	btn.bot.opensave
248
	cmp	ebx,KEY_NUMRETURN
249
	je	btn.bot.opensave
250
	call	textbox.key
251
	ret
252
 
297 mikedld 253
cur_part   dd ?
254
cur_color  dd ?
255
cur_colors rd 10
256
 
257
optsdlg_handler:
258
	cmp	al,1
259
	je	.draw
260
	cmp	al,2
261
	je	.key
262
	cmp	al,3
263
	je	botdlg.button
264
	cmp	al,4
265
	je	.mouse
266
	ret
267
 
268
  .xchg_colors:
269
	mov	ecx,10
270
	mov	esi,color_tbl
271
	mov	edi,cur_colors
272
    @@: lodsd
273
	xchg	eax,[edi]
274
	mov	[esi-4],eax
275
	add	edi,4
276
	loop	@b
277
	ret
278
 
279
  .draw:
280
	call	.draw_editor
281
 
282
	mov	ecx,[bot_ofs-2]
283
	mov	cx,word[bot_ofs]
284
	push	ecx
285
	add	ecx,128
286
	mcall	38,<2+3+165,2+3+165>,,[cl_3d_inset]
287
	mov	bx,word[p_info.client_box.width]
288
	pop	ecx
289
	add	ecx,35*65536+35
290
	mcall
291
	add	ecx,0x00240024
292
	mcall
293
 
294
	shr	ecx,16
295
	mov	bx,cx
296
	add	ebx,38*65536-21
297
	mcall	4,,[sc.work_text],s_tabpos,s_tabpos.size
298
 
299
	call	.draw_tabpos
300
 
301
	mov	ebx,[bot_ofs]
302
	add	ebx,(2+6+165+35)*65536+5+16
303
	mcall	4,,[sc.work_text],s_color,s_color.size
304
 
305
	mov	dword[tb_color.width],(2+6+6*s_color.size+165+35)*65536+(6*6+8)
306
	mov	eax,ebx
307
	add	ax,-3
308
	shl	eax,16
309
	mov	ax,14
310
	mov	dword[tb_color.height],eax
311
 
312
	call	.draw_color
313
 
314
	mov	ebx,[p_info.client_box.width]
315
	shl	ebx,16
316
	mov	ecx,[p_info.client_box.height]
317
	shl	ecx,16
318
	add	ecx,(-34)*65536+15
319
 
320
	add	ebx,-(2+6*(s_2save.size+2))*65536+6*(s_2save.size+2)
321
	push	20004 s_2save s_2save.size
322
	call	define_3d_button
323
	sub	ebx,(6*(s_2cancel.size+2)+3)*65536
324
	mov	bx,6*(s_2cancel.size+2)
325
	push	20001 s_2cancel s_2cancel.size
326
	call	define_3d_button
327
 
328
	ret
329
 
330
  .get_color:
331
	movzx	ecx,[tb_color.length]
332
	mov	esi,tb_color.text
333
	xor	eax,eax
334
	xor	ebx,ebx
335
	jecxz	.lp2
336
  .lp1: lodsb
337
	cmp	al,'9'
338
	mov	dl,-'0'
339
	jbe	@f
340
	mov	dl,-'A'+10
341
    @@: add	al,dl
342
	shl	ebx,4
343
	add	bl,al
344
	loop	.lp1
345
  .lp2: mov	eax,[cur_part]
346
	mov	[cur_colors+eax*4],ebx
347
	mov	[cur_color],ebx
348
	jmp	.draw_color.2
349
 
350
  .draw_editor:
351
	push	dword[options] [tab_bar.Current.Ptr]
352
	mov	[options],0
353
	mov	ebp,optsdlg_editor
354
	call	set_cur_tab
355
 
356
	call	.xchg_colors
357
	mov	[cur_editor.Bounds.Left],2
358
	mov	[cur_editor.Bounds.Right],2+165
359
	mov	eax,[p_info.client_box.height]
360
	add	eax,-125-STATH
361
	mov	[cur_editor.Bounds.Top],eax
362
	add	eax,122
363
	mov	[cur_editor.Bounds.Bottom],eax
364
	call	draw_editor
365
	call	.xchg_colors
366
 
367
	pop	ebp eax
368
	mov	[options],al
369
	call	set_cur_tab
370
	ret
371
 
372
  .draw_tabpos:
373
	mov	ecx,[bot_ofs-2]
374
	xor	cx,cx
375
	mov	ebx,(2+3+165+3)*65536+31
376
	add	ecx,38*65536+31
377
	mov	edx,[cl_3d_inset]
378
	mov	esi,[sc.work]
379
	call	draw_fillrect
380
	dec	ebx
381
	dec	ecx
382
	mcall	8,,,0x40000000+21001
383
	mov	esi,[cl_3d_normal]
384
	mov	al,[tab_pos]
385
 
386
TPOSH = 6
387
TPOSW = 10
388
 
389
	dec	al
390
	jnz	@f
391
	;// top
392
	inc	ebx
393
	mov	cx,TPOSH
394
	call	draw_fillrect
395
	add	ecx,2*65536-2
396
	jmp	.lp3
397
    @@: dec	al
398
	jnz	@f
399
	;// bottom
400
	inc	ebx
401
	mov	cx,TPOSH
402
	add	ecx,(31-TPOSH)*65536
403
	call	draw_fillrect
404
	add	ecx,-2
405
	jmp	.lp3
406
    @@: dec	al
407
	jnz	@f
408
	;// left
409
	inc	ecx
410
	mov	bx,TPOSW
411
	call	draw_fillrect
412
	add	ebx,2*65536-2
413
	jmp	.lp4
414
    @@: dec	al
415
	jnz	@f
416
	;// right
417
	inc	ecx
418
	mov	bx,TPOSW
419
	add	ebx,(31-TPOSW)*65536
420
	call	draw_fillrect
421
	add	ebx,-2
422
	jmp	.lp4
423
 
424
  .lp3:
425
	add	ebx,(2+TPOSW-2+1)*65536-31+TPOSW-2
426
	call	draw_fillrect
427
	add	ebx,-(TPOSW-2+1)*65536
428
	mov	esi,[sc.work]
429
	call	draw_fillrect
430
	ret
431
  .lp4:
432
	add	ecx,7*65536-31+4
433
	call	draw_fillrect
434
	add	ecx,-5*65536
435
	mov	esi,[sc.work]
436
	call	draw_fillrect
437
	ret
438
 
439
  .draw_color:
440
	mov	ecx,[cur_part]
441
	mov	edx,s_appearance+1
442
    @@: dec	ecx
443
	js	@f
444
	movzx	eax,byte[edx-1]
445
	lea	edx,[edx+eax+1]
446
	jmp	@b
447
    @@:
448
	movzx	esi,byte[edx-1]
449
	mov	ebx,[bot_ofs]
450
	add	ebx,(2+6+165+35)*65536+8
451
	push	ebx ecx edx
452
	mov	ecx,ebx
453
	shl	ecx,16
454
	mov	bx,s_appearance.maxl*6
455
	mov	cx,10
456
	mcall	13,,,[cl_3d_normal]
457
	pop	edx ecx ebx
458
	mcall	4,,[sc.work_text]
459
 
460
	mov	eax,[cur_color]
461
	mov	edi,tb_color.text
462
	mov	ebx,6
463
	mov	ecx,16
464
	call	uint2strz
465
	mov	[tb_color.length],6
466
	mov	[tb_color.sel.x],0
467
	mov	[tb_color.pos.x],6
468
 
469
	mov	ebp,tb_color
470
	call	textbox.draw
471
 
472
  .draw_color.2:
473
	mov	ecx,[p_info.client_box.height]
474
	sub	ecx,[bot_dlg_height]
475
	add	ecx,-STATH
476
	shl	ecx,16
477
	add	ecx,3*65536+31
478
	mov	ebx,(2+6+165)*65536+31
479
	mov	edx,[cl_3d_inset]
480
	mov	esi,[cur_color]
481
	call	draw_fillrect
482
 
483
	ret
484
 
485
  .key:
486
	cmp	ebx,KEY_ESCAPE
487
	je	btn.bot.cancel
488
	cmp	ebx,KEY_RETURN
489
	je	btn.bot.appearance
490
	cmp	ebx,KEY_NUMRETURN
491
	je	btn.bot.appearance
492
 
493
	cmp	ebx,KEY_BACKSPACE
494
	je	.key.tb.2
495
	cmp	ebx,KEY_TAB
496
	je	.key.tb.2
497
	cmp	bx,0x00FF
498
	ja	.key.tb.2
499
	;cmp     ebx,KEY_LSHIFT
500
	;je      .key.tb.2
501
	;cmp     ebx,KEY_RSHIFT
502
	;je      .key.tb.2
503
	;cmp     ebx,0x00000147
504
	;jb      .key.exit
505
	;cmp     ebx,0x00000153
506
	;jbe     .key.tb.2
507
 
508
	test	dword[shi],KM_CTRLALT
509
	jnz	.key.exit
510
	movzx	eax,[chr]
511
	movzx	eax,[eax+key0]
512
	or	al,al
513
	jz	.key.exit
514
	movzx	eax,[eax+key1]
515
 
516
	cmp	al,'0'
517
	jb	@f
518
	cmp	al,'9'
519
	jbe	.key.tb
520
    @@: cmp	al,'A'
521
	jb	@f
522
	cmp	al,'F'
523
	jbe	.key.tb
524
    @@: cmp	al,'a'
525
	jb	@f
526
	cmp	al,'f'
527
	jbe	.key.tb
528
    @@: ret
529
  .key.tb:
530
	cmp	[tb_color.length],6
531
	jb	@f
532
	mov	al,[tb_color.sel.x]
533
	cmp	al,[tb_color.pos.x]
534
	jne	@f
535
	ret
536
  .key.tb.2:
537
    @@: call	textbox.key
538
	call	.get_color
539
	call	.draw_editor
540
  .key.exit:
541
	ret
542
 
543
  .mouse:
544
	cmp	ah,MEV_LDOWN
545
	jne	.mouse.exit
546
	mcall	37,1
547
	movsx	ebx,ax
548
	sar	eax,16
549
	cmp	eax,[optsdlg_editor+EDITOR.Bounds.Right]
550
	jg	.mouse.exit
551
	cmp	ebx,[optsdlg_editor+EDITOR.Bounds.Bottom]
552
	jg	.mouse.exit
553
	sub	eax,[optsdlg_editor+EDITOR.Bounds.Left]
554
	js	.mouse.exit
555
	sub	ebx,[optsdlg_editor+EDITOR.Bounds.Top]
556
	js	.mouse.exit
557
	mov	esi,optsdlg_editor_parts-5
558
    @@: add	esi,5
559
	cmp	byte[esi+0],-1
560
	je	.mouse.exit
561
	cmp	al,byte[esi+1]
562
	jb	@b
563
	cmp	bl,byte[esi+2]
564
	jb	@b
565
	cmp	al,byte[esi+3]
566
	ja	@b
567
	cmp	bl,byte[esi+4]
568
	ja	@b
569
	movzx	ebp,byte[esi+0]
570
	mov	[cur_part],ebp
571
	m2m	[cur_color],[cur_colors+ebp*4]
572
	;mcall   13,<200,30>,<250,30>,[color_tbl+ebp*4]
573
	;call    .draw_color
574
	call	.draw
575
 
576
  .mouse.exit:
577
	ret
578
 
258 mikedld 579
botdlg.button:
580
	mov	esi,accel_table2_botdlg
581
  .acc: cmp	ebx,[esi]
582
	jne	@f
583
	call	dword[esi+4]
584
	ret
585
    @@: add	esi,8
586
	cmp	byte[esi],0
587
	jne	.acc
588
	ret
589
 
590
  btn.bot.cancel:
591
	xor	eax,eax
592
	mov	[bot_mode],al
593
	mov	[bot_dlg_height],eax
594
	mov	[s_status],eax
595
	call	drawwindow
596
	ret
597
 
598
  btn.bot.opensave:
599
	cmp	[bot_dlg_mode2],0
600
	je	.lp1
601
	call	save_file
602
	jnc	@f
603
	jmp	.lp2
297 mikedld 604
  .lp1: call	load_file
258 mikedld 605
	jnc	@f
606
  .lp2:
607
	ret
259 mikedld 608
    @@: ;call    update_caption
258 mikedld 609
	xor	eax,eax
610
	mov	[bot_mode],al
611
	mov	[bot_dlg_height],eax
612
	call	drawwindow
613
	ret
614
 
595 Rus 615
  btn.bot.no:
616
	call	key.ctrl_f4.close
617
	xor	eax,eax
618
	mov	[bot_mode],al
619
	mov	[bot_dlg_height],eax
620
	mov	[s_status],eax
621
	call	drawwindow
622
	ret
623
 
258 mikedld 624
  btn.bot.find:
625
	movzx	ecx,[tb_find.length]
626
	mov	[s_search.size],ecx
627
	mov	esi,tb_find.text
628
	mov	edi,s_search
629
	cld
630
	rep	movsb
631
 
632
	cmp	[bot_dlg_mode2],0
633
	je	@f
634
	call	search
635
	jnc	.found
297 mikedld 636
	call	editor_check_for_changes
258 mikedld 637
	ret
638
 
639
  .found:
259 mikedld 640
	push	[copy_size] [copy_count] [copy_buf]
258 mikedld 641
 
642
	movzx	eax,[tb_replace.length]
259 mikedld 643
	add	eax,10
644
	call	mem.Alloc
645
	mov	[copy_buf],eax
646
 
647
	movzx	eax,[tb_replace.length]
258 mikedld 648
	mov	esi,tb_replace.text
297 mikedld 649
	mov	edi,[copy_buf]
258 mikedld 650
	stosd
651
	mov	ecx,eax
652
	jecxz	.lp1
653
	rep	movsb
654
  .lp1: add	eax,4
655
	mov	[copy_size],eax
656
	mov	[copy_count],1
657
 
297 mikedld 658
	push	[cur_editor.SelStart.X]
659
	mov	ebp,cur_editor
258 mikedld 660
	call	init_sel_vars
661
	call	key.ctrl_v
297 mikedld 662
	pop	[cur_editor.SelStart.X]
258 mikedld 663
 
259 mikedld 664
	mov	eax,[copy_buf]
665
	call	mem.Free
258 mikedld 666
 
259 mikedld 667
	pop	[copy_buf] [copy_count] [copy_size]
258 mikedld 668
 
297 mikedld 669
	call	editor_check_for_changes
258 mikedld 670
	ret
671
    @@: xor	eax,eax
672
	mov	[bot_mode],al
673
	mov	[bot_dlg_height],eax
297 mikedld 674
	call	key.f3
258 mikedld 675
	call	drawwindow
676
	ret
297 mikedld 677
 
678
  btn.bot.appearance:
679
    @@: xor	eax,eax
680
	mov	[bot_mode],al
681
	mov	[bot_dlg_height],eax
682
	call	optsdlg_handler.xchg_colors
683
	mov	al,[tab_pos]
684
	mov	[tab_bar.Style],al
685
	call	drawwindow
686
	ret
687
 
688
tabpos_round db 4,3,1,2
689
 
690
  btn.bot.tabpos:
691
	movzx	eax,[tab_pos]
692
	mov	al,[tabpos_round+eax-1]
693
	mov	[tab_pos],al
694
    @@: call	optsdlg_handler.draw_tabpos
695
	ret