Subversion Repositories Kolibri OS

Rev

Rev 5579 | 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-mouse.asm',0,$
2
 
617 mikedld 3
proc check_mouse_in_edit_area
178 heavyiron 4
	mcall	37,1
5
	mov	ebx,eax
6
	and	ebx,0x0000FFFF
7
	shr	eax,16
297 mikedld 8
	mov	ecx,[cur_editor.Bounds.Top]
178 heavyiron 9
	inc	ecx
297 mikedld 10
	pushd	[cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx
178 heavyiron 11
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
12
	sub	[__rc+0x8],SCRLW+6
280 mikedld 13
	mov	ecx,[cur_editor.Gutter.Width]
14
	add	[__rc+0x0],ecx
5838 pathoswith 15
	mov	ecx,[lines.scr]
16
	imul	ecx,[lineHeight]
178 heavyiron 17
	dec	ecx
18
	add	[__rc+0xC],ecx
19
	mov	ecx,__rc
20
	call	pt_in_rect
21
	ret
617 mikedld 22
endp
178 heavyiron 23
 
617 mikedld 24
proc get_mouse_event
178 heavyiron 25
	mcall	37,2
26
	and	al,3
27
	mov	bl,[ecx]
28
	cmp	[ecx],al
29
	mov	[ecx],al
30
	jne	@f
617 mikedld 31
	mcall	37,7
32
	or	eax,eax
33
	jz	.mv
34
	add	[ecx+6],ax
35
	shr	eax,16
36
	add	[ecx+4],ax
37
	mov	eax,MEV_WHEEL
178 heavyiron 38
	ret
617 mikedld 39
  .mv:	mov	eax,MEV_MOVE
40
	ret
178 heavyiron 41
    @@: mov	bh,al
42
	and	ebx,0x0101
43
	cmp	bl,bh
44
	je	.rb
45
	test	al,1
46
	jz	@f
47
	mov	eax,MEV_LDOWN
48
	ret
49
    @@: mov	eax,MEV_LUP
50
	ret
51
  .rb:	test	al,2
52
	jz	@f
53
	mov	eax,MEV_RDOWN
54
	ret
55
    @@: mov	eax,MEV_RUP
56
	ret
617 mikedld 57
endp
178 heavyiron 58
 
617 mikedld 59
mouse_ev dd mouse.l_down,mouse.l_up,mouse.r_down,mouse.r_up,mouse.wheel,mouse.move
178 heavyiron 60
 
61
mouse:
2065 mario79 62
 
63
	mcall	9,p_info,-1
64
 
65
	mov	eax,[p_info+70] ;status of window
66
	test	eax,100b
67
	jne	still.skip_write
68
 
178 heavyiron 69
	mov	ecx,mst
70
	call	get_mouse_event
71
	cmp	[bot_mode],0
72
	je	@f
73
	mov	ah,al
74
	mov	al,4
75
	call	[bot_dlg_handler]
1480 mikedld 76
	jmp	still.skip_write
178 heavyiron 77
    @@: cmp	al,MEV_MOVE
78
	jne	.no_move
79
	cmp	[popup_active],1
80
	je	@f
81
  .no_move:
82
	mov	[s_status],0
83
 
84
	push	eax
85
	mcall	9,p_info,-1
86
	cmp	ax,[p_info.window_stack_position]
87
	pop	eax
88
	jne	still.skip_write
89
    @@:
297 mikedld 90
;!!!        cmp     [just_from_popup],0
91
;!!!        je      @f
92
;!!!        cmp     al,MEV_LUP
93
;!!!        jne     still.skip_write
178 heavyiron 94
    @@: mov	[mev],al
95
	jmp	[mouse_ev+eax*4-4]
96
 
617 mikedld 97
  .wheel:
98
	movsx	eax,word[mst+4]
99
	lea	eax,[eax*3]
100
	add	[cur_editor.TopLeft.X],eax
101
	movsx	eax,word[mst+6]
102
	lea	eax,[eax*3]
103
	add	[cur_editor.TopLeft.Y],eax
104
	xor	eax,eax
105
	mov	[mst+4],eax
106
	call	check_bottom_right
107
	call	draw_editor
108
	jmp	still.skip_write
109
 
178 heavyiron 110
  .move:
111
	mcall	37,1
112
	movsx	ebx,ax
113
	sar	eax,16
114
	cmp	[body_capt],0
115
	jge	.check_body.2
116
	cmp	[vscrl_capt],0
117
	jge	.check_vscroll.2
118
	cmp	[hscrl_capt],0
119
	jge	.check_hscroll.2
120
 
121
	cmp	[do_not_draw],0
122
	jne	still.skip_write
123
	mov	eax,[mi_cur]
124
	call	get_active_menu_item
125
	cmp	eax,[mi_cur]
126
	je	still.skip_write
127
	push	[mi_cur]
128
	cmp	[popup_active],0
129
	je	@f
130
	mov	[mi_cur],eax
131
    @@: call	draw_main_menu
132
	pop	[mi_cur]
133
	cmp	[popup_active],0
134
	je	still.skip_write
135
	mov	ecx,[mi_cur]
136
	or	ecx,ecx
137
	js	still.skip_write
138
	mov	eax,[main_menu.popups+ecx*4-4]
139
	mov	edx,main_menu
140
	call	dword[main_menu.onshow+ecx*4-4]
141
	call	setup_main_menu_popup
142
	mcall	60,2,[h_popup],POPUP_STACK,4
4665 gtament 143
 
144
	call draw_main_menu
178 heavyiron 145
 
146
	jmp	still.skip_write
147
 
148
 
149
  .r_down:
150
    @@: cmp	[popup_active],0
151
	je	@f
152
	mcall	5,1
153
	jmp	@b
154
    @@: cmp	[mouse_captured],0
155
	jne	still.skip_write
156
	call	check_mouse_in_edit_area
157
	jnc	still.skip_write
158
	mcall	37,0
259 mikedld 159
	mov	[mm.Edit+POPUP.pos],eax
178 heavyiron 160
    @@: mcall	37,2
161
	cmp	eax,ebx
162
	jnz	@f
163
	mcall	5,1
164
	jmp	@b
165
    @@: and	[mst],0xFD
166
	call	onshow.edit
259 mikedld 167
	mov	dword[POPUP_STACK],mm.Edit
178 heavyiron 168
	mcall	51,1,popup_thread_start,POPUP_STACK
169
	mov	[h_popup],eax
170
	jmp	still.skip_write
171
 
172
  .r_up:
173
	jmp	still.skip_write
174
 
175
  .l_down:
176
	call	check_mouse_in_edit_area
177
	jnc	.check_vscroll
178
	mov	[mouse_captured],1
179
	mov	[body_capt],1
180
 
181
	call	clear_selection
182
 
183
  .check_body.2:
297 mikedld 184
	sub	eax,[cur_editor.Bounds.Left]
185
	sub	ebx,[cur_editor.Bounds.Top]
280 mikedld 186
	sub	eax,[cur_editor.Gutter.Width]
187
	sub	eax,LCHGW
188
	sub	ebx,2
178 heavyiron 189
	push	eax
190
	mov	eax,ebx
297 mikedld 191
	cdq
5838 pathoswith 192
	mov	ecx,[lineHeight]
178 heavyiron 193
	idiv	ecx
297 mikedld 194
    @@: add	eax,[cur_editor.TopLeft.Y]
178 heavyiron 195
	mov	ebx,eax
196
	pop	eax
297 mikedld 197
	cdq
5838 pathoswith 198
	mov	ecx,[charWidth]
178 heavyiron 199
	idiv	ecx
297 mikedld 200
    @@: add	eax,[cur_editor.TopLeft.X]
5579 Pathoswith 201
	mov	ecx, ebx
202
	call	get_line_offset
203
	cmp	eax,[esi]
178 heavyiron 204
	jl	@f
5579 Pathoswith 205
	mov	eax,[esi]
297 mikedld 206
    @@: cmp	ebx,[cur_editor.Lines.Count]
178 heavyiron 207
	jl	@f
297 mikedld 208
	mov	ebx,[cur_editor.Lines.Count]
178 heavyiron 209
	dec	ebx
210
    @@:
297 mikedld 211
	cmp	[cur_editor.Caret.X],eax
178 heavyiron 212
	jne	.change_cur_pos
297 mikedld 213
	cmp	[cur_editor.Caret.Y],ebx
214
	jne	.change_cur_pos
215
	call	editor_check_for_changes
216
	jmp	still.skip_write
178 heavyiron 217
 
218
  .change_cur_pos:
297 mikedld 219
	mov	[cur_editor.Caret.X],eax
220
	mov	[cur_editor.Caret.Y],ebx
221
	call	editor_check_for_changes
178 heavyiron 222
	jmp	still
223
 
224
  .check_vscroll:
280 mikedld 225
	mov	ecx,[cur_editor.Bounds.Right]