Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
824 mikedld 1
diff16 'tp-popup.asm',0,$
297 mikedld 2
 
178 heavyiron 3
;POP_WIDTH   = (popup_text.max_title+popup_text.max_accel+6)*6
4
POP_IHEIGHT = 16
629 mikedld 5
POP_SHEIGHT = 2
178 heavyiron 6
;POP_HEIGHT  = popup_text.cnt_item*POP_IHEIGHT+popup_text.cnt_sep*4+4
7
 
8
popup_thread_start:
9
	mov	[popup_active],1
10
	mov	[pi_cur],0
11
	mov	ebp,[esp]
12
	mcall	14
13
	movzx	ebx,ax
14
	shr	eax,16
15
	movzx	ecx,[ebp+POPUP.x]
16
	add	cx,[ebp+POPUP.width]
17
	cmp	ecx,eax
18
	jle	@f
19
	mov	cx,[ebp+POPUP.width]
20
	sub	[ebp+POPUP.x],cx
21
    @@: movzx	ecx,[ebp+POPUP.y]
22
	add	cx,[ebp+POPUP.height]
23
	cmp	ecx,ebx
24
	jle	@f
25
	mov	cx,[ebp+POPUP.height]
26
	sub	[ebp+POPUP.y],cx
27
    @@: mcall	40,01100111b		; ipc mouse button key redraw
28
	cmp	[mi_cur],0
29
	jl	.2
30
	sub	esp,32-16
31
	push	0 0 8 0
32
	mcall	60,1,esp,32
33
  .2:	call	draw_popup_wnd
34
 
35
  still_popup:
36
	cmp	[main_closed],1
37
	je	close_popup
38
	mcall	10
39
	cmp	eax,1
40
	je	popup_thread_start.2
41
	cmp	eax,2
42
	je	key_popup
43
	cmp	eax,3
44
	je	button_popup
45
	cmp	eax,6
46
	je	mouse_popup
47
	cmp	eax,7
48
	jne	still_popup
49
 
297 mikedld 50
	mov	ebp,[POPUP_STACK]
178 heavyiron 51
	mov	dword[POPUP_STACK-32+4],8
52
	movzx	ebx,[ebp+POPUP.x]
53
	movzx	ecx,[ebp+POPUP.y]
54
	movzx	edx,[ebp+POPUP.width]
55
	movzx	esi,[ebp+POPUP.height]
56
	mcall	67
57
	jmp	still_popup
58
 
59
  mouse_popup:
60
	mov	ecx,mst2
61
	call	get_mouse_event
62
	cmp	al,MEV_LDOWN
63
	je	check_popup_click
64
	cmp	al,MEV_MOVE
65
	je	check_popup_move
66
 
67
	mcall	9,p_info2,-1
68
	cmp	ax,[p_info2.window_stack_position]
69
	jne	close_popup
70
 
71
	jmp	still_popup
72
 
73
  check_popup_click:
74
	mov	eax,[pi_cur]
75
	or	al,al
76
	js	close_popup
77
	jz	still_popup
78
	mov	ebx,[ebp+POPUP.actions]
79
	mov	[just_from_popup],1
297 mikedld 80
	call	dword[ebx+eax*4-4]
178 heavyiron 81
	inc	[just_from_popup]
82
	jmp	close_popup
83
 
84
  check_popup_move:
85
	mov	eax,[pi_cur]
86
	call	get_active_popup_item
87
	cmp	eax,[pi_cur]
88
	je	still_popup
89
	call	draw_popup_wnd
90
	jmp	still_popup
91
 
92
  key_popup:
93
	mcall	;2
94
	cmp	ah,27
95
	jne	still_popup
96
 
97
  button_popup:
98
	mcall	17
99
 
100
  close_popup:
101
	mcall	18,3,[p_info.PID]
102
	mov	[popup_active],0
297 mikedld 103
	mov	[mi_cur],0
178 heavyiron 104
	mcall	-1
105
 
106
func draw_popup_wnd
107
	mcall	12,1
108
 
109
	mov	ebx,dword[ebp+POPUP.x-2]
110
	mov	bx,[ebp+POPUP.width]
111
	mov	ecx,dword[ebp+POPUP.y-2]
112
	mov	cx,[ebp+POPUP.height]
113
	mcall	0,,,0x01000000,0x01000000
114
 
115
	movzx	ebx,bx
116
	movzx	ecx,cx
297 mikedld 117
	pushd	0 0 ebx ecx
178 heavyiron 118
	call	draw_3d_panel
119
 
120
	mov	[pi_sel],0
121
	mov	eax,4
122
	mpack	ebx,3*6,3
123
	mov	ecx,[sc.work_text]
297 mikedld 124
	mov	edx,[ebp+POPUP.data]
178 heavyiron 125
    @@: inc	[pi_sel]
126
	inc	edx
127
	movzx	esi,byte[edx-1]
128
	cmp	byte[edx],'-'
129
	jne	.lp1
130
	pushad
131
	mov	ecx,ebx
132
	shl	ecx,16
133
	mov	cx,bx
134
	movzx	ebx,[ebp+POPUP.width]
135
	add	ebx,0x00010000-1
136
	add	ecx,0x00010001
297 mikedld 137
	mcall	38,,,[cl_3d_inset]
178 heavyiron 138
	add	ecx,0x00010001
297 mikedld 139
	mcall	,,,[cl_3d_outset]
178 heavyiron 140
	popad
141
	add	ebx,4
142
	jmp	.lp2
143
  .lp1: mov	edi,[pi_sel]
144
	cmp	edi,[pi_cur]
145
	jne	.lp3
297 mikedld 146
	test	byte[ebp+edi-1],0x01
178 heavyiron 147
	jz	.lp3
148
	pushad
149
	movzx	ecx,bx
150
	shl	ecx,16
151
	mov	cl,POP_IHEIGHT-1
152
	movzx	ebx,[ebp+POPUP.width]
153
	add	ebx,0x00010000-1
297 mikedld 154
	mcall	13,,,[cl_3d_pushed]
178 heavyiron 155
	rol	ecx,16
156
	mov	ax,cx
157
	rol	ecx,16
158
	mov	cx,ax
297 mikedld 159
	mcall	38,,,[cl_3d_inset]
178 heavyiron 160
	add	ecx,(POP_IHEIGHT-1)*65536+POP_IHEIGHT-1
297 mikedld 161
	mcall	,,,[cl_3d_outset]
178 heavyiron 162
	popad
163
  .lp3: add	ebx,(POP_IHEIGHT-7)/2
164
 
165
	pushad
166
	test	byte[ebp+edi-1],0x02
167
	jz	.lp8
168
	movzx	ecx,bx
169
	shr	ebx,16
280 mikedld 170
	add	ebx,-11
171
	add	ecx,2
172
	mov	edx,[sc.work_text]
173
	call	draw_check
178 heavyiron 174
  .lp8: popad
175
 
297 mikedld 176
	mov	ecx,[sc.work_text]
177
	test	byte[ebp+edi-1],0x01
178 heavyiron 178
	jnz	.lp5
179
	add	ebx,0x00010001
180
	mov	ecx,[cl_3d_outset]
181
	mcall
182
	sub	ebx,0x00010001
183
	mov	ecx,[cl_3d_inset]
184
  .lp5: mcall
185
	push	ebx
186
	add	edx,esi
187
	inc	edx
188
	movzx	esi,byte[edx-1]
297 mikedld 189
	add	ebx,[ebp+POPUP.acc_ofs]
178 heavyiron 190
	cmp	edi,[pi_cur]
191
	je	.lp4
297 mikedld 192
	mov	ecx,[cl_3d_inset]
193
  .lp4: test	byte[ebp+edi-1],0x01
178 heavyiron 194
	jnz	.lp6
195
	add	ebx,0x00010001
196
	mov	ecx,[cl_3d_outset]
197
	mcall
198
	sub	ebx,0x00010001
199
	mov	ecx,[cl_3d_inset]
200
  .lp6: mcall
201
	pop	ebx
202
	add	ebx,POP_IHEIGHT-(POP_IHEIGHT-7)/2
203
  .lp2: add	edx,esi
204
	cmp	byte[edx],0
205
	jne	@b
206
  .exit:
207
	mcall	12,2
208
	ret
209
endf
210
 
267 mikedld 211
func setup_main_menu_popup
212
	mov	ebx,[p_info.box.left]
213
	add	ebx,[p_info.client_box.left]
214
    @@: dec	ecx
215
	jz	@f
216
	add	edx,8+1
217
	movzx	esi,byte[edx-1]
218
	add	edx,esi
219
	jmp	@b
220
    @@: movzx	ecx,word[edx+2]
221
	add	ebx,ecx
222
 
223
	mov	[eax+POPUP.x],bx
224
	mov	ebx,[p_info.box.top]
225
	add	ebx,[p_info.client_box.top]
226
	add	ebx,ATOPH-1
227
	mov	[eax+POPUP.y],bx
228
	mov	[POPUP_STACK],eax
229
	ret
230
endf
231
 
232
onshow:
233
 
234
  .file:
235
	or	byte[mm.File+3],0x01
236
	cmp	[f_info.length],0
237
	jne	@f
238
	and	byte[mm.File+3],0xFE
239
    @@: ret
240
 
241
  .edit:
242
	or	byte[mm.Edit+2],0x01
243
	cmp	[copy_size],0
244
	jne	@f
245
	and	byte[mm.Edit+2],0xFE
246
    @@: or	dword[mm.Edit+0],0x01000101
247
	cmp	[sel.selected],0
248
	jne	@f
249
	and	dword[mm.Edit+0],0xFEFFFEFE
250
    @@: ret
251
 
252
  .search:
253
	mov	byte[mm.Search+0],0
254
	ret
255
  .run:
256
	ret
257
  .recode:
258
	ret
259
  .options:
297 mikedld 260
	;mov     word[mm.Options+0],0
267 mikedld 261
	mov	byte[mm.Options+5],0
262
	or	byte[mm.Options+2],0x02
263
	test	[options],OPTS_SECURESEL
264
	jnz	@f
265
	and	byte[mm.Options+2],0xFD
266
    @@: or	byte[mm.Options+3],0x02
267
	test	[options],OPTS_AUTOBRACES
268
	jnz	@f
269
	and	byte[mm.Options+3],0xFD
270
    @@: or	byte[mm.Options+4],0x02
271
	test	[options],OPTS_AUTOINDENT
272
	jnz	@f
273
	and	byte[mm.Options+4],0xFD
274
    @@: or	byte[mm.Options+6],0x02
275
	test	[options],OPTS_OPTIMSAVE
276
	jnz	@f
277
	and	byte[mm.Options+6],0xFD
278
    @@: or	byte[mm.Options+8],0x02
279
	test	[options],OPTS_LINENUMS
280
	jnz	@f
281
	and	byte[mm.Options+8],0xFD
282
    @@: ret
283
 
178 heavyiron 284
pi_sel	 dd ?
285
pi_cur	 dd ?
286
p_pos	 dd ?
297 mikedld 287
popup_active db 0