Subversion Repositories Kolibri OS

Rev

Rev 5845 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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