Subversion Repositories Kolibri OS

Rev

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

Rev 259 Rev 267
Line 1... Line 1...
1
sz s_defname,'Untitled',0
1
sz s_defname,'Untitled',0
Line 2... Line 2...
2
 
2
 
3
;-----------------------------------------------------------------------------
3
;-----------------------------------------------------------------------------
4
func flush_cur_tab ;//////////////////////////////////////////////////////////
4
func flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL ///////////////////
5
;-----------------------------------------------------------------------------
5
;-----------------------------------------------------------------------------
6
; EBP = TABITEM*
6
; EBP = TABITEM*
7
;-----------------------------------------------------------------------------
7
;-----------------------------------------------------------------------------
8
	push	ecx esi edi
8
	push	ecx esi edi
Line 15... Line 15...
15
	ret
15
	ret
16
endf
16
endf
17
 
17
 
Line 18... Line 18...
18
;-----------------------------------------------------------------------------
18
;-----------------------------------------------------------------------------
19
func set_cur_tab ;////////////////////////////////////////////////////////////
19
func set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) /////////////////
20
;-----------------------------------------------------------------------------
20
;-----------------------------------------------------------------------------
21
; EBP = TABITEM*
21
; EBP = TABITEM*
22
;-----------------------------------------------------------------------------
22
;-----------------------------------------------------------------------------
23
	push	ecx esi edi
23
	push	ecx esi edi
24
	cmp	[tab_bar.Current.Ptr],0
24
	cmp	[tab_bar.Current.Ptr],0
Line 34... Line 34...
34
	ret
34
	ret
35
endf
35
endf
36
 
36
 
Line 37... Line 37...
37
;-----------------------------------------------------------------------------
37
;-----------------------------------------------------------------------------
-
 
38
func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN ////
-
 
39
;-----------------------------------------------------------------------------
-
 
40
	push	ebp
-
 
41
	imul	eax,[tab_bar.Items.Left],sizeof.TABITEM
-
 
42
	add	eax,[tab_bar.Items]
-
 
43
	cmp	eax,ebp
-
 
44
	jb	.go_right
-
 
45
	ja	.go_left
-
 
46
	add	esp,4
-
 
47
	ret
-
 
48
 
-
 
49
  .go_right:
-
 
50
	call	get_hidden_tabitems_number
-
 
51
	cmp	ebp,[esp]
-
 
52
	ja	.lp1
-
 
53
    @@: inc	[tab_bar.Items.Left]
-
 
54
	call	get_hidden_tabitems_number
-
 
55
	cmp	ebp,[esp]
-
 
56
	jbe	@b
-
 
57
    @@: inc	[tab_bar.Items.Left]
-
 
58
  .lp1: pop	ebp
-
 
59
	ret
-
 
60
 
-
 
61
  .go_left:
-
 
62
	mov	eax,ebp
-
 
63
	sub	eax,[tab_bar.Items]
-
 
64
	jz	@f
-
 
65
	cwde
-
 
66
	mov	ebx,sizeof.TABITEM
-
 
67
	div	ebx
-
 
68
    @@: mov	[tab_bar.Items.Left],eax
-
 
69
	add	esp,4
-
 
70
	ret
-
 
71
endf
-
 
72
 
-
 
73
;-----------------------------------------------------------------------------
38
func create_tab ;/////////////////////////////////////////////////////////////
74
func create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
39
;-----------------------------------------------------------------------------
75
;-----------------------------------------------------------------------------
40
	push	eax ecx esi edi
76
	push	eax ecx esi edi
Line 41... Line 77...
41
 
77
 
42
	inc	[tab_bar.Items.Count]
78
	inc	[tab_bar.Items.Count]
Line 48... Line 84...
48
	sub	ecx,eax
84
	sub	ecx,eax
49
	sub	[tab_bar.Current.Ptr],ecx
85
	sub	[tab_bar.Current.Ptr],ecx
50
	lea	ebp,[eax+ebx-sizeof.TABITEM]
86
	lea	ebp,[eax+ebx-sizeof.TABITEM]
51
	call	set_cur_tab
87
	call	set_cur_tab
52
 
88
	call	make_tab_visible
-
 
89
 
Line 53... Line 90...
53
	mov	eax,1024
90
	mov	eax,1024
54
	call	mem.Alloc
91
	call	mem.Alloc
55
	mov	[cur_tab.Editor.Data],eax
92
	mov	[cur_editor.Lines],eax
56
	mov	[cur_tab.Editor.Lines],1
93
	mov	[cur_editor.Lines.Count],1
57
	mov	[cur_tab.Editor.Columns],1
94
	mov	[cur_editor.Columns.Count],1
58
	xor	eax,eax
95
	xor	eax,eax
59
	mov	[cur_tab.Editor.TopLeft.X],eax
96
	mov	[cur_editor.TopLeft.X],eax
60
	mov	[cur_tab.Editor.TopLeft.Y],eax
97
	mov	[cur_editor.TopLeft.Y],eax
61
	mov	[cur_tab.Editor.Caret.X],eax
98
	mov	[cur_editor.Caret.X],eax
62
	mov	[cur_tab.Editor.Caret.Y],eax
99
	mov	[cur_editor.Caret.Y],eax
63
	mov	[cur_tab.Editor.SelStart.X],eax
100
	mov	[cur_editor.SelStart.X],eax
64
	mov	[cur_tab.Editor.SelStart.Y],eax
101
	mov	[cur_editor.SelStart.Y],eax
65
	mov	edi,[cur_tab.Editor.Data]
102
	mov	edi,[cur_editor.Lines]
66
	add	edi,4
103
	add	edi,4
67
	mov	ecx,10
104
	mov	ecx,10
68
	mov	[edi-4],ecx
105
	mov	[edi-4],ecx
69
	mov	[edi+10],eax
106
	mov	[edi+10],eax
70
	mov	al,' '
107
	mov	al,' '
71
	cld
108
	cld
72
	rep	stosb
109
	rep	stosb
Line 73... Line 110...
73
 
110
 
74
	mov	esi,s_defname
111
	mov	esi,s_defname
75
	mov	edi,cur_tab.Editor.FilePath
112
	mov	edi,cur_editor.FilePath
76
	mov	ecx,s_defname.size
113
	mov	ecx,s_defname.size
77
	rep	movsb
114
	rep	movsb
Line 78... Line 115...
78
	mov	[cur_tab.Editor.FileName],0
115
	mov	[cur_editor.FileName],0
79
 
116
 
80
	mov	[f_info.length],0
117
	mov	[f_info.length],0
Line 81... Line 118...
81
	mov	[cur_tab.Editor.Modified],0
118
	mov	[cur_editor.Modified],0
82
	mov	[cur_tab.Editor.AsmMode],0
119
	mov	[cur_editor.AsmMode],0
83
 
120
 
Line 90... Line 127...
90
	ret
127
	ret
91
endf
128
endf
92
 
129
 
Line 93... Line 130...
93
;-----------------------------------------------------------------------------
130
;-----------------------------------------------------------------------------
94
func delete_tab ;/////////////////////////////////////////////////////////////
131
func delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
95
;-----------------------------------------------------------------------------
132
;-----------------------------------------------------------------------------
-
 
133
	mov	eax,[ebp+TABITEM.Editor.Lines]
-
 
134
	call	mem.Free
-
 
135
	imul	ecx,[tab_bar.Items.Count],sizeof.TABITEM
-
 
136
	add	ecx,[tab_bar.Items]
-
 
137
	sub	ecx,ebp
-
 
138
	sub	ecx,sizeof.TABITEM
-
 
139
	jle	@f
-
 
140
	cld
-
 
141
	shr	ecx,2
-
 
142
	mov	edi,ebp
-
 
143
	lea	esi,[edi+sizeof.TABITEM]
-
 
144
	rep	movsd
-
 
145
    @@: dec	[tab_bar.Items.Count]
-
 
146
	jz	.no_tabs
-
 
147
	imul	ebx,[tab_bar.Items.Count],sizeof.TABITEM
-
 
148
	push	ebx
-
 
149
	mov	eax,[tab_bar.Items]
-
 
150
	mov	ecx,eax
-
 
151
	call	mem.ReAlloc
-
 
152
	mov	[tab_bar.Items],eax
-
 
153
	sub	ecx,eax
-
 
154
	sub	ebp,ecx
-
 
155
 
-
 
156
	pop	ecx
-
 
157
	add	ecx,[tab_bar.Items]
-
 
158
	sub	ecx,ebp
-
 
159
	ja	@f
-
 
160
	add	ebp,-sizeof.TABITEM
-
 
161
 
-
 
162
    @@: mov	[tab_bar.Current.Ptr],0
-
 
163
	call	set_cur_tab
-
 
164
	call	make_tab_visible
-
 
165
	call	drawwindow
96
	ret
166
	ret
97
endf
-
 
Line 98... Line -...
98
 
-
 
99
;-----------------------------------------------------------------------------
-
 
100
func get_tab_size ;///////////////////////////////////////////////////////////
-
 
101
;-----------------------------------------------------------------------------
-
 
102
; EBP = TABITEM*
-
 
103
;-----------------------------------------------------------------------------
167
 
104
	push	eax
168
  .no_tabs:
105
	cmp	[tab_bar.Style],3
-
 
106
	jae	.lp1
-
 
107
	lea	eax,[ebp+TABITEM.Editor.FilePath]
-
 
108
	add	eax,[ebp+TABITEM.Editor.FileName]
169
	mov	eax,[tab_bar.Items]
109
	call	strlen
170
	call	mem.Free
110
	imul	ebx,eax,6
-
 
111
	add	ebx,9
-
 
112
	jmp	.lp2
171
	mov	[tab_bar.Items],0
113
  .lp1: call	get_max_tab_width
-
 
114
	mov	ebx,eax
-
 
115
  .lp2: mov	ecx,TBARH-1
-
 
116
	pop	eax
172
	mov	[tab_bar.Current.Ptr],0
117
	ret
173
	ret
Line 118... Line 174...
118
endf
174
endf
119
 
175
 
120
;-----------------------------------------------------------------------------
176
;-----------------------------------------------------------------------------
Line -... Line 177...
-
 
177
func draw_tabctl ;///// DRAW TAB CONTROL /////////////////////////////////////
-
 
178
;-----------------------------------------------------------------------------
-
 
179
 
-
 
180
	dec	[tab_bar.Items.Left]
-
 
181
	js	.lp1
-
 
182
    @@: call	get_hidden_tabitems_number
-
 
183
	or	eax,eax
-
 
184
	jnz	.lp1
-
 
185
	dec	[tab_bar.Items.Left]
-
 
186
	jns	@b
-
 
187
  .lp1: inc	[tab_bar.Items.Left]
-
 
188
	mov	eax,[tab_bar.Items.Count]
-
 
189
	cmp	[tab_bar.Items.Left],eax
-
 
190
	jb	@f
-
 
191
	dec	eax
-
 
192
	mov	[tab_bar.Items.Left],eax
-
 
193
    @@:
-
 
194
 
-
 
195
	mov	eax,8
-
 
196
	mov	edx,[tab_bar.Buttons.First]
-
 
197
    @@: cmp	edx,[tab_bar.Buttons.Last]
-
 
198
	ja	@f
-
 
199
	push	edx
-
 
200
	or	edx,0x80000000
-
 
201
	mcall
-
 
202
	pop	edx
-
 
203
	inc	edx
121
func draw_tabctl ;////////////////////////////////////////////////////////////
204
	jmp	@b
122
;-----------------------------------------------------------------------------
205
    @@:
123
 
206
 
124
	mov	ebx,[tab_bar.Bounds.Left-2]
207
	mov	ebx,[tab_bar.Bounds.Left-2]
125
	mov	bx,word[tab_bar.Bounds.Right]
208
	mov	bx,word[tab_bar.Bounds.Right]
Line 148... Line 231...
148
	mov	ecx,[tab_bar.Bounds.Top-2]
231
	mov	ecx,[tab_bar.Bounds.Top-2]
149
	xor	cx,cx
232
	xor	cx,cx
150
	add	ecx,1*65536+TBARH
233
	add	ecx,1*65536+TBARH
151
	mcall	13
234
	mcall	13
152
	add	ecx,(TBARH-2)*65536-(TBARH-3)
235
	add	ecx,(TBARH-1)*65536-(TBARH-1)
153
	mov	edx,[cl_3d_inset]
236
	mcall	,,,[sc.work]
-
 
237
	add	ecx,-1*65536+2
-
 
238
	mov	edx,[cl_3d_inset]
154
	call	draw_framerect
239
	call	draw_framerect
155
	ret
240
 
-
 
241
	mov	esi,[tab_bar.Bounds.Left]
-
 
242
	inc	esi
-
 
243
	mov	edi,[tab_bar.Bounds.Top]
-
 
244
	inc	edi
-
 
245
	push	.curr_top .check_horz .next_horz
-
 
246
	call	.draw_tabs
-
 
247
	ret
156
 
248
 
Line 157... Line 249...
157
  .tabs_on_bottom:
249
  .tabs_on_bottom:
158
	add	ebx,1*65536-2
250
	add	ebx,1*65536-2
159
	mov	ecx,[tab_bar.Bounds.Bottom-2]
251
	mov	ecx,[tab_bar.Bounds.Bottom-2]
160
	xor	cx,cx
252
	xor	cx,cx
161
	add	ecx,-TBARH*65536+TBARH
253
	add	ecx,-TBARH*65536+TBARH
162
	mcall	13
254
	mcall	13
163
	mov	cx,1
255
	mov	cx,1
164
	mcall	,,,[sc.work]
256
	mcall	,,,[sc.work]
165
	add	ecx,-1*65536+2;-(TBARH-3)
257
	add	ecx,-1*65536+2
166
	mov	edx,[cl_3d_inset]
258
	mov	edx,[cl_3d_inset]
167
	call	draw_framerect
259
	call	draw_framerect
Line 168... Line -...
168
 
-
 
169
	mov	ecx,[tab_bar.Items.Count]
-
 
170
	mov	ebp,[tab_bar.Items]
260
 
171
	mov	esi,[tab_bar.Bounds.Left]
261
	mov	esi,[tab_bar.Bounds.Left]
172
	inc	esi
262
	inc	esi
173
	mov	edi,[tab_bar.Bounds.Bottom]
263
	mov	edi,[tab_bar.Bounds.Bottom]
-
 
264
	add	edi,-TBARH+1
-
 
265
	push	.curr_bottom .check_horz .next_horz
-
 
266
	call	.draw_tabs
-
 
267
	ret
-
 
268
 
-
 
269
  .tabs_on_left:
-
 
270
	call	get_max_tab_width
-
 
271
	mov	ebx,[tab_bar.Bounds.Left-2]
-
 
272
	mov	bx,ax
-
 
273
	add	ebx,1*65536-1
-
 
274
	add	ecx,1*65536-2
-
 
275
	push	eax
-
 
276
	mcall	13
-
 
277
	pop	ebx
-
 
278
	shl	ebx,16
-
 
279
	add	ebx,1*65536+1
-
 
280
	mcall	,,,[sc.work]
-
 
281
	add	ebx,-1*65536+2
-
 
282
	mov	edx,[cl_3d_inset]
-
 
283
	call	draw_framerect
-
 
284
 
-
 
285
	mov	esi,[tab_bar.Bounds.Left]
-
 
286
	inc	esi
-
 
287
	mov	edi,[tab_bar.Bounds.Top]
-
 
288
	inc	edi
-
 
289
	push	.curr_left .check_vert .next_vert
-
 
290
	call	.draw_tabs
-
 
291
	ret
-
 
292
 
-
 
293
  .tabs_on_right:
-
 
294
	call	get_max_tab_width
-
 
295
	push	eax
-
 
296
	mov	ebx,[tab_bar.Bounds.Right-2]
-
 
297
	mov	bx,ax
-
 
298
	shl	eax,16
-
 
299
	sub	ebx,eax
-
 
300
	add	ecx,1*65536-2
-
 
301
	mcall	13
-
 
302
	add	ebx,-1*65536
-
 
303
	mov	bx,1
-
 
304
	mcall	,,,[sc.work]
-
 
305
	add	ebx,-1*65536+2
-
 
306
	mov	edx,[cl_3d_inset]
-
 
307
	call	draw_framerect
-
 
308
 
-
 
309
	mov	esi,[tab_bar.Bounds.Right]
-
 
310
	pop	eax
-
 
311
	sub	esi,eax
-
 
312
	mov	edi,[tab_bar.Bounds.Top]
-
 
313
	inc	edi
-
 
314
	push	.curr_right .check_vert .next_vert
-
 
315
	call	.draw_tabs
-
 
316
	ret
-
 
317
 
-
 
318
 
-
 
319
  .draw_tabs:
-
 
320
	mov	ecx,[tab_bar.Items.Count]
-
 
321
	mov	ebx,[tab_bar.Items.Left]
-
 
322
	imul	ebp,ebx,sizeof.TABITEM
-
 
323
	add	ebp,[tab_bar.Items]
-
 
324
	push	ecx
-
 
325
	sub	[esp],ebx
-
 
326
	add	ebx,1000
-
 
327
	mov	[tab_bar.Buttons.First],ebx
-
 
328
	dec	ebx
174
	add	edi,-TBARH+1
329
	mov	[tab_bar.Buttons.Last],ebx
Line 175... Line 330...
175
    @@: push	ecx
330
    @@: push	ecx
-
 
331
 
-
 
332
	call	get_tab_size
-
 
333
 
-
 
334
	call	dword[esp+(8+4)+4]
176
 
335
	jc	.draw_tabs.dontfit
177
	call	get_tab_size
336
 
178
	rol	ebx,16
337
	rol	ebx,16
179
	mov	bx,si
338
	mov	bx,si
180
	rol	ebx,16
339
	rol	ebx,16
181
	rol	ecx,16
340
	rol	ecx,16
182
	mov	cx,di
341
	mov	cx,di
183
	rol	ecx,16
342
	rol	ecx,16
Line -... Line 343...
-
 
343
	mov	edx,[cl_3d_inset]
184
	mov	edx,[cl_3d_inset]
344
	call	draw_framerect
185
	call	draw_framerect
345
 
186
 
346
	mov	edx,[sc.work_text]
187
	cmp	ebp,[tab_bar.Current.Ptr]
347
	cmp	ebp,[tab_bar.Current.Ptr]
188
	jne	.lp1
-
 
189
	push	ebx ecx
348
	jne	.draw_tabs.inactive
190
	add	ebx,1*65536-2
349
	push	ebx ecx
-
 
350
	call	dword[esp+(8+4)+8+8]
191
	dec	ecx
351
	mcall	13,,,[sc.work]
-
 
352
	pop	ecx ebx
192
	mcall	13,,,[sc.work]
353
	mov	edx,[color_tbl+4*0]
193
	pop	ecx ebx
354
  .draw_tabs.inactive:
194
  .lp1:
355
 
195
	pushad
356
	push	ebx ecx esi edx
196
	lea	eax,[ebp+TABITEM.Editor.FilePath]
357
	lea	eax,[ebp+TABITEM.Editor.FilePath]
197
	add	eax,[ebp+TABITEM.Editor.FileName]
358
	add	eax,[ebp+TABITEM.Editor.FileName]
198
	mov	edx,eax
359
	mov	edx,eax
199
	call	strlen
360
	call	strlen
200
	mov	esi,eax
361
	mov	esi,eax
-
 
362
	shr	ecx,16
201
	shr	ecx,16
363
	mov	bx,cx
202
	mov	bx,cx
364
	add	ebx,0x00050005
Line -... Line 365...
-
 
365
	pop	ecx
-
 
366
	mcall	4
-
 
367
	pop	esi ecx ebx
-
 
368
 
-
 
369
	inc	[tab_bar.Buttons.Last]
-
 
370
	cmp	ebp,[tab_bar.Current.Ptr]
-
 
371
	je	.draw_tabs.active
-
 
372
	push	ebx ecx
-
 
373
	dec	ebx
203
	add	ebx,0x00050005
374
	dec	ecx
-
 
375
	mov	edx,[tab_bar.Buttons.Last]
-
 
376
	or	edx,0x40000000
204
	mcall	4,,0x00000000
377
	mcall	8
205
	popad
378
	pop	ecx ebx
Line 206... Line 379...
206
 
379
  .draw_tabs.active:
207
	movzx	ebx,bx
380
 
-
 
381
	call	dword[esp+(8+4)+0]
208
	lea	esi,[esi+ebx+1]
382
	add	ebp,sizeof.TABITEM
Line -... Line 383...
-
 
383
 
-
 
384
	pop	ecx
209
	add	ebp,sizeof.TABITEM
385
	dec	ecx
Line -... Line 386...
-
 
386
	dec	dword[esp]
-
 
387
	jnz	@b
210
 
388
 
-
 
389
	add	esp,4
-
 
390
	or	ecx,ecx
-
 
391
	jnz	@f
-
 
392
 
-
 
393
	ret	8
-
 
394
 
-
 
395
  .draw_tabs.dontfit:
-
 
396
 
211
	pop	ecx
397
	add	esp,8
-
 
398
 
-
 
399
    @@: mov	ebx,[tab_bar.Bounds.Right]
-
 
400
	shl	ebx,16
-
 
401
	mov	ecx,[tab_bar.Bounds.Bottom]
-
 
402
	shl	ecx,16
-
 
403
	add	ecx,(-SCRLW-1)*65536+SCRLW
-
 
404
	call	get_max_tab_width
-
 
405
	mov	edx,eax
-
 
406
 
-
 
407
	mov	al,[tab_bar.Style]
-
 
408
	dec	al
-
 
409
	jz	.scroll_on_top
-
 
410
	dec	al
-
 
411
	jz	.scroll_on_bottom
-
 
412
	dec	al
-
 
413
	jz	.scroll_on_left
-
 
414
	dec	al
-
 
415
	jz	.scroll_on_right
-
 
416
	ret
-
 
417
 
-
 
418
  .scroll_on_top:
-
 
419
	add	ebx,(-SCRLW*2-1)*65536+SCRLW
-
 
420
	mov	ecx,[tab_bar.Bounds.Top]
212
	dec	ecx
421
	shl	ecx,16
-
 
422
	add	ecx,1*65536+SCRLW
-
 
423
	jmp	.draw_tabs.draw_scroll
-
 
424
  .scroll_on_bottom:
-
 
425
	add	ebx,(-SCRLW*2-1)*65536+SCRLW
-
 
426
	jmp	.draw_tabs.draw_scroll
-
 
427
  .scroll_on_left:
-
 
428
	mov	ebx,[tab_bar.Bounds.Left]
-
 
429
	add	ebx,edx
-
 
430
	shl	ebx,16
-
 
431
	add	ebx,(-SCRLW*2)*65536+SCRLW
-
 
432
	jmp	.draw_tabs.draw_scroll
-
 
433
  .scroll_on_right:
-
 
434
	shl	edx,16
-
 
435
	sub	ebx,edx
-
 
436
	add	ebx,SCRLW
-
 
437
 
-
 
438
  .draw_tabs.draw_scroll:
-
 
439
	mcall	8,,,'TBG' or 0x40000000
-
 
440
	push	ebx
-
 
441
	add	ebx,SCRLW*65536
-
 
442
	mcall	8,,,'TBL' or 0x40000000
-
 
443
	pop	ebx
-
 
444
	push	ebx ecx
-
 
445
	sar	ebx,16
-
 
446
	sar	ecx,16
-
 
447
	push	ebx ecx SCRLW SCRLW
-
 
448
	call	draw_3d_panel
213
	jnz	@b
449
	add	ebx,SCRLW
-
 
450
	push	ebx ecx SCRLW SCRLW
-
 
451
	call	draw_3d_panel
-
 
452
	pop	ecx ebx
-
 
453
 
-
 
454
	push	'<'
-
 
455
	shr	ecx,16
-
 
456
	mov	bx,cx
-
 
457
	add	ebx,(SCRLW/2-2)*65536+SCRLW/2-3
-
 
458
	mcall	4,,[sc.work_text],esp,1
-
 
459
	add	ebx,0x00020000
-
 
460
	mcall
-
 
461
	add	ebx,(SCRLW-2)*65536
-
 
462
	mov	byte[esp],'>'
-
 
463
	mcall
-
 
464
	add	ebx,0x00020000
-
 
465
	mcall
-
 
466
	add	esp,4
-
 
467
 
214
 
468
	ret	8
-
 
469
 
-
 
470
  .curr_left:
-
 
471
	add	ebx,0x00010000
-
 
472
	add	ecx,1*65536-2
215
	ret
473
	ret
-
 
474
  .curr_top:
-
 
475
	add	ebx,1*65536-2
-
 
476
	add	ecx,0x00010000
-
 
477
	ret
-
 
478
  .curr_right:
-
 
479
	dec	ebx
-
 
480
	add	ecx,1*65536-2
-
 
481
	ret
-
 
482
  .curr_bottom:
-
 
483
	add	ebx,1*65536-2
-
 
484
	dec	ecx
-
 
485
	ret
-
 
486
 
-
 
487
  .check_horz:
-
 
488
	lea	eax,[ebx-1]
-
 
489
	add	eax,esi
-
 
490
	sub	eax,[tab_bar.Bounds.Right]
-
 
491
	jge	.check.dontfit
-
 
492
	add	eax,SCRLW*2+2
-
 
493
	jl	.check.fit
-
 
494
	cmp	dword[esp+4],1
-
 
495
	jbe	.check.fit
-
 
496
  .check.dontfit:
-
 
497
	stc
-
 
498
	ret
-
 
499
  .check_vert:
-
 
500
	lea	eax,[ecx-1]
-
 
501
	add	eax,edi
-
 
502
	sub	eax,[tab_bar.Bounds.Bottom]
-
 
503
	jge	.check.dontfit
-
 
504
	add	eax,SCRLW+2
-
 
505
	jl	.check.fit
-
 
506
	cmp	dword[esp+4],1
-
 
507
	ja	.check.dontfit
-
 
508
  .check.fit:
-
 
509
	clc
-
 
510
	ret
-
 
511
 
-
 
512
  .next_horz:
-
 
513
	movzx	ebx,bx
-
 
514
	lea	esi,[esi+ebx+1]
-
 
515
	ret
-
 
516
  .next_vert:
-
 
517
	movzx	ecx,cx
-
 
518
	lea	edi,[edi+ecx+1]
-
 
519
	ret
216
 
520
endf
-
 
521
 
-
 
522
;-----------------------------------------------------------------------------
-
 
523
func get_tab_size ;///// GET TAB WIDTH ///////////////////////////////////////
-
 
524
;-----------------------------------------------------------------------------
217
  .tabs_on_left:
525
; EBP = TABITEM*
-
 
526
;-----------------------------------------------------------------------------
-
 
527
	push	eax
-
 
528
	cmp	[tab_bar.Style],3
-
 
529
	jae	.lp1
-
 
530
	lea	eax,[ebp+TABITEM.Editor.FilePath]
-
 
531
	add	eax,[ebp+TABITEM.Editor.FileName]
218
	call	get_max_tab_width
532
	call	strlen
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
533
	imul	ebx,eax,6
-
 
534
	add	ebx,9
Line -... Line 535...
-
 
535
	jmp	.lp2
-
 
536
  .lp1: call	get_max_tab_width
-
 
537
	mov	ebx,eax
226
	add	eax,-2
538
  .lp2: mov	ecx,TBARH-1
227
	shl	eax,16
539
	pop	eax
228
	add	ebx,eax
540
	ret
229
	mov	bx,3
541
endf
-
 
542
 
-
 
543
;-----------------------------------------------------------------------------
-
 
544
func get_max_tab_width ;///// GET WIDTH OF LONGEST TAB ///////////////////////
-
 
545
;-----------------------------------------------------------------------------
-
 
546
	push	ebx ecx ebp
-
 
547
	mov	ecx,[tab_bar.Items.Count]
230
	mov	edx,[cl_3d_inset]
548
	mov	ebp,[tab_bar.Items]
-
 
549
	xor	ebx,ebx
-
 
550
    @@: dec	ecx
-
 
551
	js	@f
231
	call	draw_framerect
552
 
-
 
553
	lea	eax,[ebp+TABITEM.Editor.FilePath]
232
	ret
554
	add	eax,[ebp+TABITEM.Editor.FileName]
233
 
555
	call	strlen
-
 
556
	imul	eax,6
234
  .tabs_on_right:
557
	add	eax,9
235
	call	get_max_tab_width
558
 
236
	mov	ebx,[tab_bar.Bounds.Right-2]
559
	add	ebp,sizeof.TABITEM
237
	mov	bx,ax
560
	cmp	ebx,eax
238
	shl	eax,16
561
	jae	@b
239
	sub	ebx,eax
562
	mov	ebx,eax
Line -... Line 563...
-
 
563
	jmp	@b
-
 
564
    @@: mov	eax,ebx
-
 
565
	cmp	eax,SCRLW*2+2
240
	add	ecx,1*65536-2
566
	jae	@f
-
 
567
	mov	eax,SCRLW*2+2
-
 
568
    @@: pop	ebp ecx ebx
-
 
569
	ret
-
 
570
endf
-
 
571
 
241
	mcall	13
572
;-----------------------------------------------------------------------------
-
 
573
func get_hidden_tabitems_number ;/////////////////////////////////////////////
-
 
574
;-----------------------------------------------------------------------------
-
 
575
	mov	al,[tab_bar.Style]
-
 
576
	dec	al
-
 
577
	dec	al
-
 
578
	jle	.tabs_horz
-
 
579
	dec	al
-
 
580
	dec	al
-
 
581
	jle	.tabs_vert
-
 
582
	ret
242
	add	ebx,-1*65536
583
 
-
 
584
  .tabs_horz:
-
 
585
	push	draw_tabctl.check_horz draw_tabctl.next_horz
-
 
586
	call	.calc_tabs
-
 
587
	ret
-
 
588
 
-
 
589
  .tabs_vert:
-
 
590
	push	draw_tabctl.check_vert draw_tabctl.next_vert
-
 
591
	call	.calc_tabs
-
 
592
	ret
-
 
593
 
-
 
594
  .calc_tabs:
-
 
595
	mov	esi,[tab_bar.Bounds.Left]
-
 
596
	inc	esi
-
 
597
	mov	edi,[tab_bar.Bounds.Top]
-
 
598
	inc	edi
-
 
599
	mov	ecx,[tab_bar.Items.Count]
-
 
600
	mov	ebp,[tab_bar.Items]
-
 
601
	imul	eax,[tab_bar.Items.Left],sizeof.TABITEM
-
 
602
	add	ebp,eax
-
 
603
	mov	eax,ecx
-
 
604
	sub	eax,[tab_bar.Items.Left]
-
 
605
	push	eax
-
 
606
    @@: push	ecx
-
 
607
 
-
 
608
	call	get_tab_size
-
 
609
 
-
 
610
	call	dword[esp+(8+4)+4]
-
 
611
	jc	.calc_tabs.dontfit
-
 
612
 
-
 
613
	call	dword[esp+(8+4)+0]
-
 
614
	add	ebp,sizeof.TABITEM
-
 
615
 
-
 
616
	pop	ecx
-
 
617
	dec	ecx
-
 
618
	dec	dword[esp]
-
 
619
	jnz	@b
243
	mov	bx,3
620
 
Line -... Line 621...
-
 
621
	jmp	@f
244
	mov	edx,[cl_3d_inset]
622
 
-
 
623
  .calc_tabs.dontfit:
245
	call	draw_framerect
624
 
246
	ret
625
	add	esp,4
247
endf
626
    @@: pop	ecx
248
 
627
	mov	eax,ecx
249
func get_max_tab_width
628
	ret	8
250
	mov	eax,100
629
endf
251
	ret
630
 
252
endf
631
;-----------------------------------------------------------------------------
253
 
632
func align_editor_in_tab ;///// ADJUST EDITOR POSITION TO FIT IN TAB /////////
-
 
633
;-----------------------------------------------------------------------------
-
 
634
	m2m	[cur_editor.Bounds.Left],[tab_bar.Bounds.Left]
-
 
635
	m2m	[cur_editor.Bounds.Top],[tab_bar.Bounds.Top]
Line 254... Line 636...
254
func align_editor_in_tab
636
	m2m	[cur_editor.Bounds.Right],[tab_bar.Bounds.Right]
255
	m2m	[cur_tab.Editor.Bounds.Left],[tab_bar.Bounds.Left]
637
	m2m	[cur_editor.Bounds.Bottom],[tab_bar.Bounds.Bottom]
256
	m2m	[cur_tab.Editor.Bounds.Top],[tab_bar.Bounds.Top]
638
 
257
	m2m	[cur_tab.Editor.Bounds.Right],[tab_bar.Bounds.Right]
639
	inc	[cur_editor.Bounds.Left]
Line 273... Line 655...
273
	jz	.tabs_on_right
655
	jz	.tabs_on_right
274
	ret
656
	ret
275
 
657
 
Line 276... Line 658...
276
  .tabs_on_top:
658
  .tabs_on_top:
277
	add	[cur_tab.Editor.Bounds.Top],TBARH
659
	add	[cur_editor.Bounds.Top],TBARH
278
	ret
660
	ret
Line 279... Line 661...
279
 
661
 
280
  .tabs_on_bottom:
662
  .tabs_on_bottom:
281
	sub	[cur_tab.Editor.Bounds.Bottom],TBARH
663
	sub	[cur_editor.Bounds.Bottom],TBARH
Line 282... Line 664...
282
	ret
664
	ret
283
 
-
 
284
  .tabs_on_left:
665
 
285
	call	get_max_tab_width
666
  .tabs_on_left:
Line 286... Line 667...
286
	add	[cur_tab.Editor.Bounds.Left],eax
667
	add	[cur_editor.Bounds.Left],ebx
287
	ret
-
 
288
 
668
	ret
289
  .tabs_on_right:
669
 
290
	call	get_max_tab_width
670
  .tabs_on_right:
291
	sub	[cur_tab.Editor.Bounds.Right],eax
671
	sub	[cur_editor.Bounds.Right],ebx