Subversion Repositories Kolibri OS

Rev

Rev 267 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
259 mikedld 1
 
2
3
 
4
func flush_cur_tab ;//////////////////////////////////////////////////////////
5
;-----------------------------------------------------------------------------
6
; EBP = TABITEM*
7
;-----------------------------------------------------------------------------
8
	push	ecx esi edi
9
	mov	esi,cur_tab
10
	mov	edi,[tab_bar.Current.Ptr]
11
	mov	ecx,sizeof.TABITEM/4
12
	cld
13
	rep	movsd
14
	pop	edi esi ecx
15
	ret
16
endf
17
18
 
19
func set_cur_tab ;////////////////////////////////////////////////////////////
20
;-----------------------------------------------------------------------------
21
; EBP = TABITEM*
22
;-----------------------------------------------------------------------------
23
	push	ecx esi edi
24
	cmp	[tab_bar.Current.Ptr],0
25
	je	@f
26
	call	flush_cur_tab
27
    @@: mov	esi,ebp
28
	mov	edi,cur_tab
29
	mov	ecx,sizeof.TABITEM/4
30
	rep	movsd
31
	mov	[tab_bar.Current.Ptr],ebp
32
	call	update_caption
33
	pop	edi esi ecx
34
	ret
35
endf
36
37
 
38
func create_tab ;/////////////////////////////////////////////////////////////
39
;-----------------------------------------------------------------------------
40
	push	eax ecx esi edi
41
42
 
43
	imul	ebx,[tab_bar.Items.Count],sizeof.TABITEM
44
	mov	eax,[tab_bar.Items]
45
	mov	ecx,eax
46
	call	mem.ReAlloc
47
	mov	[tab_bar.Items],eax
48
	sub	ecx,eax
49
	sub	[tab_bar.Current.Ptr],ecx
50
	lea	ebp,[eax+ebx-sizeof.TABITEM]
51
	call	set_cur_tab
52
53
 
54
	call	mem.Alloc
55
	mov	[cur_tab.Editor.Data],eax
56
	mov	[cur_tab.Editor.Lines],1
57
	mov	[cur_tab.Editor.Columns],1
58
	xor	eax,eax
59
	mov	[cur_tab.Editor.TopLeft.X],eax
60
	mov	[cur_tab.Editor.TopLeft.Y],eax
61
	mov	[cur_tab.Editor.Caret.X],eax
62
	mov	[cur_tab.Editor.Caret.Y],eax
63
	mov	[cur_tab.Editor.SelStart.X],eax
64
	mov	[cur_tab.Editor.SelStart.Y],eax
65
	mov	edi,[cur_tab.Editor.Data]
66
	add	edi,4
67
	mov	ecx,10
68
	mov	[edi-4],ecx
69
	mov	[edi+10],eax
70
	mov	al,' '
71
	cld
72
	rep	stosb
73
74
 
75
	mov	edi,cur_tab.Editor.FilePath
76
	mov	ecx,s_defname.size
77
	rep	movsb
78
	mov	[cur_tab.Editor.FileName],0
79
80
 
81
	mov	[cur_tab.Editor.Modified],0
82
	mov	[cur_tab.Editor.AsmMode],0
83
84
 
85
	call	update_caption
86
	call	drawwindow
87
88
 
89
	pop	edi esi ecx eax
90
	ret
91
endf
92
93
 
94
func delete_tab ;/////////////////////////////////////////////////////////////
95
;-----------------------------------------------------------------------------
96
	ret
97
endf
98
99
 
100
func get_tab_size ;///////////////////////////////////////////////////////////
101
;-----------------------------------------------------------------------------
102
; EBP = TABITEM*
103
;-----------------------------------------------------------------------------
104
	push	eax
105
	cmp	[tab_bar.Style],3
106
	jae	.lp1
107
	lea	eax,[ebp+TABITEM.Editor.FilePath]
108
	add	eax,[ebp+TABITEM.Editor.FileName]
109
	call	strlen
110
	imul	ebx,eax,6
111
	add	ebx,9
112
	jmp	.lp2
113
  .lp1: call	get_max_tab_width
114
	mov	ebx,eax
115
  .lp2: mov	ecx,TBARH-1
116
	pop	eax
117
	ret
118
endf
119
120
 
121
func draw_tabctl ;////////////////////////////////////////////////////////////
122
;-----------------------------------------------------------------------------
123
124
 
125
	mov	bx,word[tab_bar.Bounds.Right]
126
	sub	bx,word[tab_bar.Bounds.Left]
127
	inc	ebx
128
	mov	ecx,[tab_bar.Bounds.Top-2]
129
	mov	cx,word[tab_bar.Bounds.Bottom]
130
	sub	cx,word[tab_bar.Bounds.Top]
131
	inc	ecx
132
	mov	edx,[cl_3d_normal]
133
	call	draw_framerect
134
135
 
136
	dec	al
137
	jz	.tabs_on_top
138
	dec	al
139
	jz	.tabs_on_bottom
140
	dec	al
141
	jz	.tabs_on_left
142
	dec	al
143
	jz	.tabs_on_right
144
	ret
145
146
 
147
	add	ebx,1*65536-2
148
	mov	ecx,[tab_bar.Bounds.Top-2]
149
	xor	cx,cx
150
	add	ecx,1*65536+TBARH
151
	mcall	13
152
	add	ecx,(TBARH-2)*65536-(TBARH-3)
153
	mov	edx,[cl_3d_inset]
154
	call	draw_framerect
155
	ret
156
157
 
158
	add	ebx,1*65536-2
159
	mov	ecx,[tab_bar.Bounds.Bottom-2]
160
	xor	cx,cx
161
	add	ecx,-TBARH*65536+TBARH
162
	mcall	13
163
	mov	cx,1
164
	mcall	,,,[sc.work]
165
	add	ecx,-1*65536+2;-(TBARH-3)
166
	mov	edx,[cl_3d_inset]
167
	call	draw_framerect
168
169
 
170
	mov	ebp,[tab_bar.Items]
171
	mov	esi,[tab_bar.Bounds.Left]
172
	inc	esi
173
	mov	edi,[tab_bar.Bounds.Bottom]
174
	add	edi,-TBARH+1
175
    @@: push	ecx
176
177
 
178
	rol	ebx,16
179
	mov	bx,si
180
	rol	ebx,16
181
	rol	ecx,16
182
	mov	cx,di
183
	rol	ecx,16
184
	mov	edx,[cl_3d_inset]
185
	call	draw_framerect
186
187
 
188
	jne	.lp1
189
	push	ebx ecx
190
	add	ebx,1*65536-2
191
	dec	ecx
192
	mcall	13,,,[sc.work]
193
	pop	ecx ebx
194
  .lp1:
195
	pushad
196
	lea	eax,[ebp+TABITEM.Editor.FilePath]
197
	add	eax,[ebp+TABITEM.Editor.FileName]
198
	mov	edx,eax
199
	call	strlen
200
	mov	esi,eax
201
	shr	ecx,16
202
	mov	bx,cx
203
	add	ebx,0x00050005
204
	mcall	4,,0x00000000
205
	popad
206
207
 
208
	lea	esi,[esi+ebx+1]
209
	add	ebp,sizeof.TABITEM
210
211
 
212
	dec	ecx
213
	jnz	@b
214
215
 
216
217
 
218
	call	get_max_tab_width
219
	mov	ebx,[tab_bar.Bounds.Left-2]
220
	mov	bx,ax
221
	add	ebx,1*65536
222
	add	ecx,1*65536-2
223
	push	eax
224
	mcall	13
225
	pop	eax
226
	add	eax,-2
227
	shl	eax,16
228
	add	ebx,eax
229
	mov	bx,3
230
	mov	edx,[cl_3d_inset]
231
	call	draw_framerect
232
	ret
233
234
 
235
	call	get_max_tab_width
236
	mov	ebx,[tab_bar.Bounds.Right-2]
237
	mov	bx,ax
238
	shl	eax,16
239
	sub	ebx,eax
240
	add	ecx,1*65536-2
241
	mcall	13
242
	add	ebx,-1*65536
243
	mov	bx,3
244
	mov	edx,[cl_3d_inset]
245
	call	draw_framerect
246
	ret
247
endf
248
249
 
250
	mov	eax,100
251
	ret
252
endf
253
254
 
255
	m2m	[cur_tab.Editor.Bounds.Left],[tab_bar.Bounds.Left]
256
	m2m	[cur_tab.Editor.Bounds.Top],[tab_bar.Bounds.Top]
257
	m2m	[cur_tab.Editor.Bounds.Right],[tab_bar.Bounds.Right]
258
	m2m	[cur_tab.Editor.Bounds.Bottom],[tab_bar.Bounds.Bottom]
259
260
 
261
	inc	[cur_tab.Editor.Bounds.Top]
262
	dec	[cur_tab.Editor.Bounds.Right]
263
	dec	[cur_tab.Editor.Bounds.Bottom]
264
265
 
266
	dec	al
267
	jz	.tabs_on_top
268
	dec	al
269
	jz	.tabs_on_bottom
270
	dec	al
271
	jz	.tabs_on_left
272
	dec	al
273
	jz	.tabs_on_right
274
	ret
275
276
 
277
	add	[cur_tab.Editor.Bounds.Top],TBARH
278
	ret
279
280
 
281
	sub	[cur_tab.Editor.Bounds.Bottom],TBARH
282
	ret
283
284
 
285
	call	get_max_tab_width
286
	add	[cur_tab.Editor.Bounds.Left],eax
287
	ret
288
289
 
290
	call	get_max_tab_width
291
	sub	[cur_tab.Editor.Bounds.Right],eax
292
	ret
293
endf
294