Subversion Repositories Kolibri OS

Rev

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