Subversion Repositories Kolibri OS

Rev

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

Rev 267 Rev 280
Line 36... Line 36...
36
 
36
 
Line 37... Line 37...
37
;-----------------------------------------------------------------------------
37
;-----------------------------------------------------------------------------
38
func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN ////
38
func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN ////
39
;-----------------------------------------------------------------------------
39
;-----------------------------------------------------------------------------
40
	push	ebp
-
 
41
	imul	eax,[tab_bar.Items.Left],sizeof.TABITEM
40
	imul	eax,[tab_bar.Items.Left],sizeof.TABITEM
42
	add	eax,[tab_bar.Items]
41
	add	eax,[tab_bar.Items]
43
	cmp	eax,ebp
42
	cmp	eax,ebp
44
	jb	.go_right
43
	jb	.go_right
45
	ja	.go_left
44
	ja	.go_left
46
	add	esp,4
-
 
47
	ret
45
	ret
Line 48... Line 46...
48
 
46
 
-
 
47
  .go_right:
49
  .go_right:
48
	push	ebp
50
	call	get_hidden_tabitems_number
49
	call	get_hidden_tabitems_number
51
	cmp	ebp,[esp]
50
	cmp	ebp,[esp]
52
	ja	.lp1
51
	ja	.lp1
53
    @@: inc	[tab_bar.Items.Left]
52
    @@: inc	[tab_bar.Items.Left]
Line 65... Line 64...
65
	cwde
64
	cwde
66
	mov	ebx,sizeof.TABITEM
65
	mov	ebx,sizeof.TABITEM
67
	div	ebx
66
	div	ebx
68
    @@: mov	[tab_bar.Items.Left],eax
67
    @@: mov	[tab_bar.Items.Left],eax
69
	add	esp,4
68
	ret
70
	ret
-
 
71
endf
69
endf
72
 
70
 
Line 73... Line 71...
73
;-----------------------------------------------------------------------------
71
;-----------------------------------------------------------------------------
74
func create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
72
func create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
75
;-----------------------------------------------------------------------------
73
;-----------------------------------------------------------------------------
-
 
74
;       DEBUGF  1,"items count before addition: %d\n",[tab_bar.Items.Count]
76
	push	eax ecx esi edi
75
	push	eax ecx esi edi
Line 77... Line 76...
77
 
76
 
78
	inc	[tab_bar.Items.Count]
77
	inc	[tab_bar.Items.Count]
79
	imul	ebx,[tab_bar.Items.Count],sizeof.TABITEM
78
	imul	ebx,[tab_bar.Items.Count],sizeof.TABITEM
80
	mov	eax,[tab_bar.Items]
79
	mov	eax,[tab_bar.Items]
81
	mov	ecx,eax
80
	mov	ecx,eax
82
	call	mem.ReAlloc
81
	call	mem.ReAlloc
83
	mov	[tab_bar.Items],eax
82
	mov	[tab_bar.Items],eax
84
	sub	ecx,eax
83
	sub	ecx,eax
-
 
84
	sub	[tab_bar.Current.Ptr],ecx
-
 
85
	cmp	[tab_bar.Default.Ptr],0
-
 
86
	je	@f
85
	sub	[tab_bar.Current.Ptr],ecx
87
	sub	[tab_bar.Default.Ptr],ecx
86
	lea	ebp,[eax+ebx-sizeof.TABITEM]
88
    @@: lea	ebp,[eax+ebx-sizeof.TABITEM]
87
	call	set_cur_tab
89
	call	set_cur_tab
Line 88... Line 90...
88
	call	make_tab_visible
90
	call	make_tab_visible
-
 
91
 
89
 
92
	mov	eax,1024
90
	mov	eax,1024
93
	mov	[cur_editor.Lines.Size],eax
91
	call	mem.Alloc
94
	call	mem.Alloc
92
	mov	[cur_editor.Lines],eax
95
	mov	[cur_editor.Lines],eax
93
	mov	[cur_editor.Lines.Count],1
96
	mov	[cur_editor.Lines.Count],1
Line 113... Line 116...
113
	mov	ecx,s_defname.size
116
	mov	ecx,s_defname.size
114
	rep	movsb
117
	rep	movsb
115
	mov	[cur_editor.FileName],0
118
	mov	[cur_editor.FileName],0
116
 
119
 
Line 117... Line -...
117
	mov	[f_info.length],0
-
 
118
	mov	[cur_editor.Modified],0
120
	mov	[cur_editor.Modified],0
119
	mov	[cur_editor.AsmMode],0
121
	mov	[cur_editor.AsmMode],0
Line 120... Line 122...
120
 
122
 
121
	call	flush_cur_tab
123
	call	flush_cur_tab
122
	call	update_caption
124
	call	update_caption
-
 
125
	;call    drawwindow
123
	call	drawwindow
126
	cmp	[do_not_draw],0
-
 
127
	jne	@f
-
 
128
	call	align_editor_in_tab
-
 
129
	call	draw_editor
-
 
130
	call	draw_tabctl
-
 
131
	call	draw_statusbar
124
 
132
    @@:
125
	mov	ebp,cur_tab
133
	mov	ebp,cur_tab
126
	pop	edi esi ecx eax
134
	pop	edi esi ecx eax
127
	ret
135
	ret
Line 128... Line 136...
128
endf
136
endf
129
 
137
 
130
;-----------------------------------------------------------------------------
138
;-----------------------------------------------------------------------------
-
 
139
func delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
-
 
140
;-----------------------------------------------------------------------------
-
 
141
;       DEBUGF  1,"items count before deletion: %d\n",[tab_bar.Items.Count]
-
 
142
	cmp	[tab_bar.Default.Ptr],0
-
 
143
	je	@f
-
 
144
	cmp	ebp,[tab_bar.Default.Ptr]
-
 
145
	je	.lp1
-
 
146
	ja	@f
-
 
147
	sub	[tab_bar.Default.Ptr],sizeof.TABITEM
-
 
148
	jmp	@f
-
 
149
  .lp1:
131
func delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
150
	mov	[tab_bar.Default.Ptr],0
132
;-----------------------------------------------------------------------------
151
 
133
	mov	eax,[ebp+TABITEM.Editor.Lines]
152
    @@: mov	eax,[ebp+TABITEM.Editor.Lines]
134
	call	mem.Free
153
	call	mem.Free
135
	imul	ecx,[tab_bar.Items.Count],sizeof.TABITEM
154
	imul	ecx,[tab_bar.Items.Count],sizeof.TABITEM
136
	add	ecx,[tab_bar.Items]
155
	add	ecx,[tab_bar.Items]
Line 151... Line 170...
151
	call	mem.ReAlloc
170
	call	mem.ReAlloc
152
	mov	[tab_bar.Items],eax
171
	mov	[tab_bar.Items],eax
153
	sub	ecx,eax
172
	sub	ecx,eax
154
	sub	ebp,ecx
173
	sub	ebp,ecx
155
 
174
	cmp	[tab_bar.Default.Ptr],0
-
 
175
	je	@f
156
	pop	ecx
176
	sub	[tab_bar.Default.Ptr],ecx
-
 
177
    @@:
-
 
178
	pop	ecx
157
	add	ecx,[tab_bar.Items]
179
	add	ecx,[tab_bar.Items]
158
	sub	ecx,ebp
180
	sub	ecx,ebp
159
	ja	@f
181
	ja	@f
160
	add	ebp,-sizeof.TABITEM
182
	add	ebp,-sizeof.TABITEM
161
 
183
 
Line 162... Line 184...
162
    @@: mov	[tab_bar.Current.Ptr],0
184
    @@: mov	[tab_bar.Current.Ptr],0
163
	call	set_cur_tab
185
	call	set_cur_tab
164
	call	make_tab_visible
186
	call	make_tab_visible
165
	call	drawwindow
187
	;call    drawwindow
-
 
188
	call	align_editor_in_tab
-
 
189
	call	draw_editor
-
 
190
	call	draw_tabctl
-
 
191
	call	draw_statusbar
166
	ret
192
	ret
Line 167... Line 193...
167
 
193
 
168
  .no_tabs:
194
  .no_tabs:
169
	mov	eax,[tab_bar.Items]
195
	mov	eax,[tab_bar.Items]
-
 
196
	call	mem.Free
170
	call	mem.Free
197
	xor	eax,eax
171
	mov	[tab_bar.Items],0
198
	mov	[tab_bar.Items],eax
-
 
199
	mov	[tab_bar.Current.Ptr],eax
172
	mov	[tab_bar.Current.Ptr],0
200
	mov	[tab_bar.Default.Ptr],eax
173
	ret
201
	ret
Line 174... Line 202...
174
endf
202
endf
175
 
203
 
Line 352... Line 380...
352
	pop	ecx ebx
380
	pop	ecx ebx
353
	mov	edx,[color_tbl+4*0]
381
	mov	edx,[color_tbl+4*0]
354
  .draw_tabs.inactive:
382
  .draw_tabs.inactive:
355
 
383
 
Line -... Line 384...
-
 
384
	cmp	ebp,[tab_bar.Default.Ptr]
-
 
385
	jne	.draw_tabs.notdefault
-
 
386
	push	ebx ecx edx
-
 
387
	add	ebx,3*65536
-
 
388
	add	ecx,(TBARH/2-6)*65536
-
 
389
	mov	bx,11
-
 
390
	mov	cx,bx
-
 
391
	call	draw_framerect
-
 
392
	add	ebx,1*65536-2
-
 
393
	add	ecx,1*65536-2
-
 
394
	mcall	13,,,[sc.work]
-
 
395
	shr	ebx,16
-
 
396
	shr	ecx,16
-
 
397
	add	ebx,2
-
 
398
	add	ecx,3
-
 
399
	mov	edx,[esp]
-
 
400
	call	draw_check
-
 
401
	pop	edx ecx ebx
-
 
402
  .draw_tabs.notdefault:
-
 
403
 
356
	push	ebx ecx esi edx
404
	push	ebx ecx esi edx
357
	lea	eax,[ebp+TABITEM.Editor.FilePath]
405
	lea	eax,[ebp+TABITEM.Editor.FilePath]
358
	add	eax,[ebp+TABITEM.Editor.FileName]
406
	add	eax,[ebp+TABITEM.Editor.FileName]
359
	mov	edx,eax
407
	mov	edx,eax
360
	call	strlen
408
	call	strlen
361
	mov	esi,eax
409
	mov	esi,eax
362
	shr	ecx,16
410
	shr	ecx,16
363
	mov	bx,cx
411
	mov	bx,cx
364
	add	ebx,0x00050005
412
	add	ebx,5*65536+TBARH/2-4
365
	pop	ecx
413
	pop	ecx
-
 
414
	cmp	ebp,[tab_bar.Default.Ptr]
-
 
415
	jne	.lp2
-
 
416
	add	ebx,13*65536
366
	mcall	4
417
  .lp2: mcall	4
367
	pop	esi ecx ebx
418
	pop	esi ecx ebx
Line 368... Line 419...
368
 
419
 
369
	inc	[tab_bar.Buttons.Last]
420
	inc	[tab_bar.Buttons.Last]
370
	cmp	ebp,[tab_bar.Current.Ptr]
421
	cmp	ebp,[tab_bar.Current.Ptr]
Line 531... Line 582...
531
	add	eax,[ebp+TABITEM.Editor.FileName]
582
	add	eax,[ebp+TABITEM.Editor.FileName]
532
	call	strlen
583
	call	strlen
533
	imul	ebx,eax,6
584
	imul	ebx,eax,6
534
	add	ebx,9
585
	add	ebx,9
535
	jmp	.lp2
586
	cmp	ebp,[tab_bar.Default.Ptr]
-
 
587
	jne	.lp2
-
 
588
	add	ebx,13
-
 
589
	jmp	.lp2
536
  .lp1: call	get_max_tab_width
590
  .lp1: call	get_max_tab_width
537
	mov	ebx,eax
591
	mov	ebx,eax
538
  .lp2: mov	ecx,TBARH-1
592
  .lp2: mov	ecx,TBARH-1
539
	pop	eax
593
	pop	eax
540
	ret
594
	ret
Line 564... Line 618...
564
    @@: mov	eax,ebx
618
    @@: mov	eax,ebx
565
	cmp	eax,SCRLW*2+2
619
	cmp	eax,SCRLW*2+2
566
	jae	@f
620
	jae	@f
567
	mov	eax,SCRLW*2+2
621
	mov	eax,SCRLW*2+2
568
    @@: pop	ebp ecx ebx
622
    @@: cmp	[tab_bar.Default.Ptr],0
-
 
623
	je	@f
-
 
624
	add	eax,13
-
 
625
    @@: pop	ebp ecx ebx
569
	ret
626
	ret
570
endf
627
endf
571
 
628
 
Line 572... Line 629...
572
;-----------------------------------------------------------------------------
629
;-----------------------------------------------------------------------------
Line 596... Line 653...
596
	inc	esi
653
	inc	esi
597
	mov	edi,[tab_bar.Bounds.Top]
654
	mov	edi,[tab_bar.Bounds.Top]
598
	inc	edi
655
	inc	edi
599
	mov	ecx,[tab_bar.Items.Count]
656
	mov	ecx,[tab_bar.Items.Count]
600
	mov	ebp,[tab_bar.Items]
657
	imul	ebp,[tab_bar.Items.Left],sizeof.TABITEM
601
	imul	eax,[tab_bar.Items.Left],sizeof.TABITEM
-
 
602
	add	ebp,eax
658
	add	ebp,[tab_bar.Items]
603
	mov	eax,ecx
659
	mov	eax,ecx
604
	sub	eax,[tab_bar.Items.Left]
660
	sub	eax,[tab_bar.Items.Left]
605
	push	eax
661
	push	eax
606
    @@: push	ecx
662
    @@: push	ecx
607
 
663