Subversion Repositories Kolibri OS

Rev

Rev 7576 | Rev 7579 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7576 Rev 7577
1
align 16
1
align 16
2
draw_window:
2
draw_window:
3
	mcall SF_REDRAW,SSF_BEGIN_DRAW
3
	mcall SF_REDRAW,SSF_BEGIN_DRAW
4
 
4
 
5
	mov edx,[sc.work]
5
	mov edx,[sc.work]
6
	or  edx,0x73000000
6
	or  edx,0x73000000
7
	mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4],,,hed
7
	mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4],,,hed
8
 
8
 
9
	mcall SF_THREAD_INFO,procinfo,-1
9
	mcall SF_THREAD_INFO,procinfo,-1
10
	mov edi,tedit0 ;çíà÷åíèå edi íóæíî äëÿ EvSize è ted_wnd_t
10
	mov edi,tedit0 ;çíà÷åíèå edi íóæíî äëÿ EvSize è ted_wnd_t
11
	call EvSize
11
	call EvSize
12
 
12
 
13
	movzx ebx,word[procinfo.client_box.width]
13
	movzx ebx,word[procinfo.client_box.width]
14
	inc bx
14
	inc bx
15
	mcall SF_DRAW_RECT,,ted_wnd_t ;âåðõíèé ïðÿìîóãîëüíèê, äëÿ î÷èñòêè âåðõíåé ïàíåëè
15
	mcall SF_DRAW_RECT,,ted_wnd_t ;âåðõíèé ïðÿìîóãîëüíèê, äëÿ î÷èñòêè âåðõíåé ïàíåëè
16
	call draw_but_toolbar
16
	call draw_but_toolbar
17
	stdcall [kmainmenu_draw], [main_menu]
17
	stdcall [kmainmenu_draw], [main_menu]
18
	stdcall [ted_draw], tedit0
18
	stdcall [ted_draw], tedit0
19
 
19
 
20
	mcall SF_REDRAW,SSF_END_DRAW
20
	mcall SF_REDRAW,SSF_END_DRAW
21
	ret
21
	ret
22
 
22
 
23
align 4
23
align 4
24
draw_but_toolbar: ;ôóíêöèÿ äëÿ ðèñîâàíèÿ ïàíåëè èíñòðóìåíòîâ
24
draw_but_toolbar: ;ôóíêöèÿ äëÿ ðèñîâàíèÿ ïàíåëè èíñòðóìåíòîâ
25
	pushad
25
	pushad
26
	mov edi,tedit0
26
	mov edi,tedit0
27
 
27
 
28
	mov ecx,0x40000000+ID_BUT_NEW
28
	mov ecx,0x40000000+ID_BUT_NEW
29
	mov edx,(5 shl 16)+25
29
	mov edx,(5 shl 16)+25
30
	bt word[panel_but],0
30
	bt word[panel_but],0
31
	jnc @f
31
	jnc @f
32
		call draw_but_icon ;New
32
		call draw_but_icon ;New
33
	@@:
33
	@@:
34
 
34
 
35
	mov cx,ID_BUT_OPEN
35
	mov cx,ID_BUT_OPEN
36
	bt word[panel_but+1],0
36
	bt word[panel_but+1],0
37
	jnc @f
37
	jnc @f
38
		add edx,25 shl 16
38
		add edx,25 shl 16
39
		call draw_but_icon ;Open
39
		call draw_but_icon ;Open
40
	@@:
40
	@@:
41
 
41
 
42
	stdcall [ted_can_save],edi
42
	stdcall [ted_can_save],edi
43
	cmp al,1
43
	cmp al,1
44
	je @f
44
	je @f
45
		and ecx,0xffff
45
		and ecx,0xffff
46
	@@:
46
	@@:
47
	mov cx,ID_BUT_SAVE
47
	mov cx,ID_BUT_SAVE
48
	bt word[panel_but+2],0
48
	bt word[panel_but+2],0
49
	jnc @f
49
	jnc @f
50
		add edx,25 shl 16
50
		add edx,25 shl 16
51
		call draw_but_icon ;Save
51
		call draw_but_icon ;Save
52
	@@:
52
	@@:
53
	or ecx,0x40000000
53
	or ecx,0x40000000
54
 
54
 
55
	mov cx,ID_BUT_SAVE_AS
55
	mov cx,ID_BUT_SAVE_AS
56
	bt word[panel_but+3],0
56
	bt word[panel_but+3],0
57
	jnc @f
57
	jnc @f
58
		add edx,25 shl 16
58
		add edx,25 shl 16
59
		call draw_but_icon ;Save as
59
		call draw_but_icon ;Save as
60
	@@:
60
	@@:
61
 
61
 
62
	mov cx,ID_BUT_SELECT
62
	mov cx,ID_BUT_SELECT
63
	bt word[panel_but+4],0
63
	bt word[panel_but+4],0
64
	jnc @f
64
	jnc @f
65
		add edx,30 shl 16
65
		add edx,30 shl 16
66
		call draw_but_icon ;Select word
66
		call draw_but_icon ;Select word
67
	@@:
67
	@@:
68
 
68
 
69
	call [ted_is_select]
69
	call [ted_is_select]
70
	or al,al
70
	or al,al
71
	jnz @f
71
	jnz @f
72
		and ecx,0xffff
72
		and ecx,0xffff
73
	@@:
73
	@@:
74
	mov cx,ID_BUT_CUT
74
	mov cx,ID_BUT_CUT
75
	bt word[panel_but+5],0
75
	bt word[panel_but+5],0
76
	jnc @f
76
	jnc @f
77
		add edx,25 shl 16
77
		add edx,25 shl 16
78
		call draw_but_icon ;Cut
78
		call draw_but_icon ;Cut
79
	@@:
79
	@@:
80
 
80
 
81
	mov cx,ID_BUT_COPY
81
	mov cx,ID_BUT_COPY
82
	bt word[panel_but+6],0
82
	bt word[panel_but+6],0
83
	jnc @f
83
	jnc @f
84
		add edx,25 shl 16
84
		add edx,25 shl 16
85
		call draw_but_icon ;Copy
85
		call draw_but_icon ;Copy
86
	@@:
86
	@@:
87
	or ecx,0x40000000
87
	or ecx,0x40000000
88
 
88
 
89
	cmp dword[buf],0
89
	cmp dword[buf],0
90
	jne @f
90
	jne @f
91
		and ecx,0xffff
91
		and ecx,0xffff
92
	@@:
92
	@@:
93
	mov cx,ID_BUT_PASTE
93
	mov cx,ID_BUT_PASTE
94
	bt word[panel_but+7],0
94
	bt word[panel_but+7],0
95
	jnc @f
95
	jnc @f
96
		add edx,25 shl 16
96
		add edx,25 shl 16
97
		call draw_but_icon ;Paste
97
		call draw_but_icon ;Paste
98
	@@:
98
	@@:
99
	or ecx,0x40000000
99
	or ecx,0x40000000
100
 
100
 
101
	mov cx,ID_BUT_FIND
101
	mov cx,ID_BUT_FIND
102
	bt word[panel_but+8],0
102
	bt word[panel_but+8],0
103
	jnc @f
103
	jnc @f
104
		add edx,25 shl 16
104
		add edx,25 shl 16
105
		call draw_but_icon ;Found
105
		call draw_but_icon ;Found
106
	@@:
106
	@@:
107
 
107
 
108
	mov cx,ID_BUT_REPLACE
108
	mov cx,ID_BUT_REPLACE
109
	bt word[panel_but+9],0
109
	bt word[panel_but+9],0
110
	jnc @f
110
	jnc @f
111
		add edx,25 shl 16
111
		add edx,25 shl 16
112
		call draw_but_icon ;Replace
112
		call draw_but_icon ;Replace
113
	@@:
113
	@@:
114
 
114
 
115
	mov cx,ID_BUT_KEY_WORDS
115
	mov cx,ID_BUT_KEY_WORDS
116
	bt word[panel_but+10],0
116
	bt word[panel_but+10],0
117
	jnc @f
117
	jnc @f
118
		add edx,25 shl 16
118
		add edx,25 shl 16
119
		call draw_but_icon ;Key words
119
		call draw_but_icon ;Key words
120
	@@:
120
	@@:
121
 
121
 
122
	call [ted_is_select]
122
	call [ted_is_select]
123
	or al,al
123
	or al,al
124
	jnz @f
124
	jnz @f
125
		and ecx,0xffff
125
		and ecx,0xffff
126
	@@:
126
	@@:
127
	mov cx,ID_BUT_UPPER
127
	mov cx,ID_BUT_UPPER
128
	bt word[panel_but+11],0
128
	bt word[panel_but+11],0
129
	jnc @f
129
	jnc @f
130
		add edx,30 shl 16
130
		add edx,30 shl 16
131
		call draw_but_icon ;Upper
131
		call draw_but_icon ;Upper
132
	@@:
132
	@@:
133
 
133
 
134
	mov cx,ID_BUT_LOWER
134
	mov cx,ID_BUT_LOWER
135
	bt word[panel_but+12],0
135
	bt word[panel_but+12],0
136
	jnc @f
136
	jnc @f
137
		add edx,25 shl 16
137
		add edx,25 shl 16
138
		call draw_but_icon ;Lower
138
		call draw_but_icon ;Lower
139
	@@:
139
	@@:
140
 
140
 
141
	mov cx,ID_BUT_REVERSE
141
	mov cx,ID_BUT_REVERSE
142
	bt word[panel_but+13],0
142
	bt word[panel_but+13],0
143
	jnc @f
143
	jnc @f
144
		add edx,25 shl 16
144
		add edx,25 shl 16
145
		call draw_but_icon ;Reverse
145
		call draw_but_icon ;Reverse
146
	@@:
146
	@@:
147
	or ecx,0x40000000
147
	or ecx,0x40000000
148
 
148
 
149
	mov ebx,ted_tim_undo
149
	mov ebx,ted_tim_undo
150
	cmp ted_tim_ch,ebx
150
	cmp ted_tim_ch,ebx
151
	jg @f
151
	jg @f
152
		and ecx,0xffff
152
		and ecx,0xffff
153
	@@:
153
	@@:
154
	mov cx,ID_BUT_UNDO
154
	mov cx,ID_BUT_UNDO
155
	bt word[panel_but+14],0
155
	bt word[panel_but+14],0
156
	jnc @f
156
	jnc @f
157
		add edx,30 shl 16
157
		add edx,30 shl 16
158
		call draw_but_icon ;Undo
158
		call draw_but_icon ;Undo
159
	@@:
159
	@@:
160
	or ecx,0x40000000
160
	or ecx,0x40000000
161
 
161
 
162
	cmp ted_tim_undo,1
162
	cmp ted_tim_undo,1
163
	jge @f
163
	jge @f
164
		and ecx,0xffff
164
		and ecx,0xffff
165
	@@:
165
	@@:
166
	mov cx,ID_BUT_REDO
166
	mov cx,ID_BUT_REDO
167
	bt word[panel_but+15],0
167
	bt word[panel_but+15],0
168
	jnc @f
168
	jnc @f
169
		add edx,25 shl 16
169
		add edx,25 shl 16
170
		call draw_but_icon ;Redo
170
		call draw_but_icon ;Redo
171
	@@:
171
	@@:
172
	or ecx,0x40000000
172
	or ecx,0x40000000
173
 
173
 
174
	mov cx,ID_BUT_INVISIBLE
174
	mov cx,ID_BUT_INVISIBLE
175
	bt word[panel_but+16],0
175
	bt word[panel_but+16],0
176
	jnc @f
176
	jnc @f
177
		add edx,30 shl 16
177
		add edx,30 shl 16
178
		call draw_but_icon ;Invisible on|off
178
		call draw_but_icon ;Invisible on|off
179
	@@:
179
	@@:
180
 
180
 
181
	mov cx,ID_BUT_SYNTAX_LIST
181
	mov cx,ID_BUT_SYNTAX_LIST
182
	bt word[panel_but+17],0
182
	bt word[panel_but+17],0
183
	jnc @f
183
	jnc @f
184
		add edx,25 shl 16
184
		add edx,25 shl 16
185
		call draw_but_icon ;Âûáîð ôàéëà ïîäñâåòêè
185
		call draw_but_icon ;Âûáîð ôàéëà ïîäñâåòêè
186
	@@:
186
	@@:
187
 
187
 
188
	mov cx,ID_BUT_SYNTAX_MODE
188
	mov cx,ID_BUT_SYNTAX_MODE
189
	bt word[panel_but+18],0
189
	bt word[panel_but+18],0
190
	jnc @f
190
	jnc @f
191
		add edx,25 shl 16
191
		add edx,25 shl 16
192
		call draw_but_icon ;Ïîäñâåòêà âêë|âûêë
192
		call draw_but_icon ;Ïîäñâåòêà âêë|âûêë
193
	@@:
193
	@@:
194
 
194
 
195
	mov cx,ID_BUT_CONVERT_1251_866
195
	mov cx,ID_BUT_CONVERT_1251_866
196
	bt word[panel_but+19],0
196
	bt word[panel_but+19],0
197
	jnc @f
197
	jnc @f
198
		add edx,30 shl 16
198
		add edx,30 shl 16
199
		call draw_but_icon ;cp 1251 -> 866
199
		call draw_but_icon ;cp 1251 -> 866
200
	@@:
200
	@@:
201
 
201
 
202
	mov cx,ID_BUT_CONVERT_866_1251
202
	mov cx,ID_BUT_CONVERT_866_1251
203
	bt word[panel_but+20],0
203
	bt word[panel_but+20],0
204
	jnc @f
204
	jnc @f
205
		add edx,25 shl 16
205
		add edx,25 shl 16
206
		call draw_but_icon ;cp 866 -> 1251
206
		call draw_but_icon ;cp 866 -> 1251
207
	@@:
207
	@@:
208
 
208
 
209
	popad
209
	popad
210
	ret
210
	ret
211
 
211
 
212
;txtBUp db 24
212
;txtBUp db 24
213
;txtBDn db 25
213
;txtBDn db 25
214
;txtBRi db 26
214
;txtBRi db 26
215
;txtBLe db 27
215
;txtBLe db 27
216
 
216
 
217
;input:
217
;input:
218
; edi = pointer to tedit struct
218
; edi = pointer to tedit struct
219
align 4
219
align 4
220
proc draw_panel_find
220
proc draw_panel_find
221
	cmp ted_panel_id,TED_PANEL_FIND
221
	cmp ted_panel_id,TED_PANEL_FIND
222
	jne @f
222
	jne @f
223
		call p_find
223
		call p_find
224
		jmp .end_f
224
		jmp .end_f
225
	@@:
225
	@@:
226
	cmp ted_panel_id,TED_PANEL_REPLACE
226
	cmp ted_panel_id,TED_PANEL_REPLACE
227
	jne @f
227
	jne @f
228
		call p_replace
228
		call p_replace
229
		jmp .end_f
229
		jmp .end_f
230
	@@:
230
	@@:
231
	push eax edx
231
	push eax edx
232
		mcall SF_DEFINE_BUTTON,,,0x80000000+201
232
		mcall SF_DEFINE_BUTTON,,,0x80000000+201
233
		mcall ,,,0x80000000+202
233
		mcall ,,,0x80000000+202
234
		mcall ,,,0x80000000+203
234
		mcall ,,,0x80000000+203
235
	pop edx eax
235
	pop edx eax
236
	.end_f:
236
	.end_f:
237
	ret
237
	ret
238
endp
238
endp
239
 
239
 
240
align 4
240
align 4
241
p_find:
241
p_find:
242
	push eax ebx ecx edx
242
	push eax ebx ecx edx
243
		mov ecx,ted_wnd_t
243
		mov ecx,ted_wnd_t
244
		shl ecx,16
244
		shl ecx,16
245
		mov cx,20
245
		mov cx,20
246
		mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
246
		mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
247
 
247
 
248
		mov ecx,ted_wnd_t
248
		mov ecx,ted_wnd_t
249
		add cx,20+15 ; 15 - height text box
249
		add cx,20+15 ; 15 - height text box
250
		shl ecx,16
250
		shl ecx,16
251
		add ecx,ted_wnd_h
251
		add ecx,ted_wnd_h
252
		mov edx,ted_scr_h
252
		mov edx,ted_scr_h
253
		add cx,word[edx+sb_offs_size_y]
253
		add cx,word[edx+sb_offs_size_y]
254
		sub cx,20+15-1 ; 15 - height text box
254
		sub cx,20+15-1 ; 15 - height text box
255
		mcall ,,,[sc.work]
255
		mcall ,,,[sc.work]
256
 
256
 
257
		stdcall [edit_box_draw], edit2
257
		stdcall [edit_box_draw], edit2
258
 
258
 
259
		mov ecx,ted_wnd_t
259
		mov ecx,ted_wnd_t
260
		shl ecx,16
260
		shl ecx,16
261
		add ecx,(93 shl 16)+20
261
		add ecx,(93 shl 16)+20
262
		mcall SF_DEFINE_BUTTON,(5 shl 16)+85,,201,[sc.work_button] ;201 - button id
262
		mcall SF_DEFINE_BUTTON,(5 shl 16)+85,,201,[sc.work_button] ;201 - button id
263
 
263
 
264
		mov ebx,(23 shl 16)+7
264
		mov ebx,(23 shl 16)+7
265
		add ebx,ted_wnd_t
265
		add ebx,ted_wnd_t
266
		mov ecx,[sc.work_text]
266
		mov ecx,[sc.work_text]
267
		or ecx,0x80000000
267
		or ecx,0x80000000
268
		mcall SF_DRAW_TEXT,,,txtFindCapt
268
		mcall SF_DRAW_TEXT,,,txtFindCapt
269
 
269
 
270
		mov ecx,[sc.work_button_text]
270
		mov ecx,[sc.work_button_text]
271
		or ecx,0x80000000
271
		or ecx,0x80000000
272
		mov ebx,(15 shl 16)+100
272
		mov ebx,(15 shl 16)+100
273
		add ebx,ted_wnd_t
273
		add ebx,ted_wnd_t
274
		mcall ,,,txtFindNext
274
		mcall ,,,txtFindNext
275
 
275
 
276
		stdcall [option_box_draw], opt_grlist1
276
		stdcall [option_box_draw], opt_grlist1
277
	pop edx ecx ebx eax
277
	pop edx ecx ebx eax
278
	ret
278
	ret
279
 
279
 
280
align 4
280
align 4
281
p_replace:
281
p_replace:
282
	push eax ebx ecx edx
282
	push eax ebx ecx edx
283
		mov ecx,ted_wnd_t
283
		mov ecx,ted_wnd_t
284
		shl ecx,16
284
		shl ecx,16
285
		mov cx,20
285
		mov cx,20
286
		mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
286
		mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
287
 
287
 
288
		mov ecx,ted_wnd_t
288
		mov ecx,ted_wnd_t
289
		add cx,20+15 ; 15 - height text box
289
		add cx,20+15 ; 15 - height text box
290
		shl ecx,16
290
		shl ecx,16
291
		add ecx,ted_wnd_h
291
		add ecx,ted_wnd_h
292
		mov edx,ted_scr_h
292
		mov edx,ted_scr_h
293
		add cx,word[edx+sb_offs_size_y]
293
		add cx,word[edx+sb_offs_size_y]
294
		sub cx,20+15-1 ; 15 - height text box
294
		sub cx,20+15-1 ; 15 - height text box
295
		mcall ,,,[sc.work]
295
		mcall ,,,[sc.work]
296
 
296
 
297
		stdcall [edit_box_draw], edit1
297
		stdcall [edit_box_draw], edit1
298
		stdcall [edit_box_draw], edit2
298
		stdcall [edit_box_draw], edit2
299
 
299
 
300
		mov ecx,ted_wnd_t
300
		mov ecx,ted_wnd_t
301
		shl ecx,16
301
		shl ecx,16
302
		add ecx,(133 shl 16)+20
302
		add ecx,(133 shl 16)+20
303
		mcall SF_DEFINE_BUTTON,(5 shl 16)+95,,202,[sc.work_button] ;replace next
303
		mcall SF_DEFINE_BUTTON,(5 shl 16)+95,,202,[sc.work_button] ;replace next
304
 
304
 
305
		add ecx,(26 shl 16)
305
		add ecx,(26 shl 16)
306
		mcall ,,,203 ;replace all
306
		mcall ,,,203 ;replace all
307
 
307
 
308
		mov ebx,ted_wnd_t
308
		mov ebx,ted_wnd_t
309
		add ebx,(23 shl 16)+7
309
		add ebx,(23 shl 16)+7
310
		mov ecx,[sc.work_text]
310
		mov ecx,[sc.work_text]
311
		or ecx,0x80000000
311
		or ecx,0x80000000
312
		mcall SF_DRAW_TEXT,,,txtFindCapt
312
		mcall SF_DRAW_TEXT,,,txtFindCapt
313
		add ebx,93
313
		add ebx,93
314
		mcall SF_DRAW_TEXT,,,txtRerlaceCapt
314
		mcall SF_DRAW_TEXT,,,txtRerlaceCapt
315
 
315
 
316
		mov ecx,[sc.work_button_text]
316
		mov ecx,[sc.work_button_text]
317
		or ecx,0x80000000
317
		or ecx,0x80000000
318
		mov ebx,ted_wnd_t
318
		mov ebx,ted_wnd_t
319
		add ebx,(15 shl 16)+140
319
		add ebx,(15 shl 16)+140
320
		mcall ,,,txtRerlace
320
		mcall ,,,txtRerlace
321
		add ebx,26
321
		add ebx,26
322
		mcall ,,,txtRerlaceAll
322
		mcall ,,,txtRerlaceAll
323
 
323
 
324
		stdcall [option_box_draw], opt_grlist1
324
		stdcall [option_box_draw], opt_grlist1
325
	pop edx ecx ebx eax
325
	pop edx ecx ebx eax
326
	ret
326
	ret
327
 
327
 
328
;input:
328
;input:
329
; edi = pointer to tedit struct
329
; edi = pointer to tedit struct
330
align 4
330
align 4
331
proc draw_panel_syntax
331
proc draw_panel_syntax
332
	cmp ted_panel_id,TED_PANEL_SYNTAX ;if not panel
332
	cmp ted_panel_id,TED_PANEL_SYNTAX ;if not panel
333
	jne @f
333
	jne @f
334
	pushad
334
	pushad
335
 
335
 
336
	mov ecx,ted_wnd_t
336
	mov ecx,ted_wnd_t
337
	shl ecx,16
337
	shl ecx,16
338
	mov cx,20
338
	mov cx,20
339
	mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work] ;ðèñîâàíèå âåðõíåãî ôîíîâîãî ïðÿìîóãîëüíèêà
339
	mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work] ;ðèñîâàíèå âåðõíåãî ôîíîâîãî ïðÿìîóãîëüíèêà
340
 
340
 
341
	stdcall dword[tl_draw], tree1
341
	stdcall [tl_draw], tree1
342
	mov [ws_dir_lbox.all_redraw],1 ;äëÿ ïîëíîé ïåðåðèñîâêè äî÷åðíåãî ñêðîëëèíãà
342
	mov [ws_dir_lbox.all_redraw],1 ;äëÿ ïîëíîé ïåðåðèñîâêè äî÷åðíåãî ñêðîëëèíãà
343
	stdcall dword[scrollbar_ver_draw], dword ws_dir_lbox
343
	stdcall [scrollbar_ver_draw], ws_dir_lbox
344
 
344
 
345
	ror ecx,16
345
	ror ecx,16
346
	add ecx,dword[tree1.box_height]
346
	add ecx,[tree1.box_height]
347
	add ecx,20
347
	add ecx,20
348
	and ecx,0xffff
348
	and ecx,0xffff
349
	ror ecx,16
349
	ror ecx,16
350
	add ecx,ted_wnd_h
350
	add ecx,ted_wnd_h
351
	mov esi,ted_scr_h
351
	mov esi,ted_scr_h
352
	add cx,word[esi+sb_offs_size_y]
352
	add cx,word[esi+sb_offs_size_y]
353
	sub cx,20
353
	sub cx,20
354
	sub ecx,dword[tree1.box_height]
354
	sub ecx,[tree1.box_height]
355
	inc cx
355
	inc cx
356
	int 0x40 ;ðèñîâàíèå íèæíåãî ôîíîâîãî ïðÿìîóãîëüíèêà
356
	int 0x40 ;ðèñîâàíèå íèæíåãî ôîíîâîãî ïðÿìîóãîëüíèêà
357
 
357
 
358
	mov ecx,ted_wnd_t
358
	mov ecx,ted_wnd_t
359
	add ecx,25
359
	add ecx,25
360
	add ecx,dword[tree1.box_height]
360
	add ecx,[tree1.box_height]
361
	shl ecx,16
361
	shl ecx,16
362
	mov cx,20
362
	mov cx,20
363
	mcall SF_DEFINE_BUTTON,(5 shl 16)+65,,200,[sc.work_button] ;200 - button id
363
	mcall SF_DEFINE_BUTTON,(5 shl 16)+65,,200,[sc.work_button] ;200 - button id
364
 
364
 
365
	mov ebx,(30 shl 16)+5
365
	mov ebx,(30 shl 16)+5
366
	add ebx,ted_wnd_t
366
	add ebx,ted_wnd_t
367
	mov ecx,[sc.work_text]
367
	mov ecx,[sc.work_text]
368
	or ecx,0x80000000
368
	or ecx,0x80000000
369
	mcall SF_DRAW_TEXT,,,txtFormatCapt
369
	mcall SF_DRAW_TEXT,,,txtFormatCapt
370
 
370
 
371
	mov ebx,(10 shl 16)+31
371
	mov ebx,(10 shl 16)+31
372
	add ebx,dword[tree1.box_height]
372
	add ebx,[tree1.box_height]
373
	add ebx,ted_wnd_t
373
	add ebx,ted_wnd_t
374
	mcall ,,,txtFormatApply
374
	mov ecx,[sc.work_button_text]
375
 
375
	or ecx,0x80000000
-
 
376
	mcall ,,,txtFormatApply
-
 
377
 
376
	popad
378
	popad
377
	jmp .end_f
379
	jmp .end_f
378
	@@:
380
	@@:
379
		push eax edx
381
		push eax edx
380
		mov edx,200
382
		mov edx,0x80000000+200
381
		or edx,0x80000000
383
		mcall SF_DEFINE_BUTTON ;åñëè íåò ïàíåëè òî óäàëÿåì êíîïêó
382
		mcall SF_DEFINE_BUTTON ;åñëè íåò ïàíåëè òî óäàëÿåì êíîïêó
-
 
383
		pop edx eax
384
		pop edx eax
384
	.end_f:
385
	.end_f:
385
	ret
386
	ret
386
endp
387
endp
387
 
388
 
388
MIN_M_WND_H equ 100 ;ìèíèìàëüíàÿ âûñîòà ãëàâíîãî îêíà
389
MIN_M_WND_H equ 100 ;ìèíèìàëüíàÿ âûñîòà ãëàâíîãî îêíà
389
;input:
390
;input:
390
; edi = pointer to tedit struct
391
; edi = pointer to tedit struct
391
align 4
392
align 4
392
EvSize:
393
EvSize:
393
	pushad
394
	pushad
394
	mov ebx,ted_scr_h
395
	mov ebx,ted_scr_h
395
	mov esi,ted_scr_w
396
	mov esi,ted_scr_w
396
 
397
 
397
	m2m ted_wnd_w,[procinfo.client_box.width] ;ñòàâèì øèðèíó îêíà ðåäàêòîðà ðàâíîé øèðèíå âñåãî îêíà
398
	m2m ted_wnd_w,[procinfo.client_box.width] ;ñòàâèì øèðèíó îêíà ðåäàêòîðà ðàâíîé øèðèíå âñåãî îêíà
398
	mov eax,ted_wnd_l
399
	mov eax,ted_wnd_l
399
	sub ted_wnd_w,eax ;îòíèìàåì îòñòóï ñëåâà
400
	sub ted_wnd_w,eax ;îòíèìàåì îòñòóï ñëåâà
400
	movzx eax,word[esi+sb_offs_size_x]
401
	movzx eax,word[esi+sb_offs_size_x]
401
	sub ted_wnd_w,eax ;îòíèìàåì øèðèíó âåðò. ñêðîëëèíãà
402
	sub ted_wnd_w,eax ;îòíèìàåì øèðèíó âåðò. ñêðîëëèíãà
402
 
403
 
403
	m2m ted_wnd_h,[procinfo.client_box.height] ;ñòàâèì âûñîòó îêíà ðåäàêòîðà ðàâíîé âûñîòå âñåãî îêíà
404
	m2m ted_wnd_h,[procinfo.client_box.height] ;ñòàâèì âûñîòó îêíà ðåäàêòîðà ðàâíîé âûñîòå âñåãî îêíà
404
	cmp ted_wnd_h,MIN_M_WND_H
405
	cmp ted_wnd_h,MIN_M_WND_H
405
	jg @f
406
	jg @f
406
		mov ted_wnd_h,MIN_M_WND_H
407
		mov ted_wnd_h,MIN_M_WND_H
407
	@@:
408
	@@:
408
 
409
 
409
	movzx eax,word[ebx+sb_offs_size_y]
410
	movzx eax,word[ebx+sb_offs_size_y]
410
	sub ted_wnd_h,eax	      ;îòíèìàåì âûñîòó ãîðèç. ñêðîëëèíãà
411
	sub ted_wnd_h,eax	      ;îòíèìàåì âûñîòó ãîðèç. ñêðîëëèíãà
411
	mov eax,ted_wnd_t
412
	mov eax,ted_wnd_t
412
	sub ted_wnd_h,eax	      ;îòíèìàåì îòñòóï ñâåðõó
413
	sub ted_wnd_h,eax	      ;îòíèìàåì îòñòóï ñâåðõó
413
 
414
 
414
	stdcall [ted_init_scroll_bars], tedit0,2
415
	stdcall [ted_init_scroll_bars], tedit0,2
415
 
416
 
416
	mov eax,ted_wnd_t
417
	mov eax,ted_wnd_t
417
	mov edi,tree1
418
	mov edi,tree1
418
	mov tl_box_top,eax ;=ted_wnd_t
419
	mov tl_box_top,eax ;=ted_wnd_t
419
	add tl_box_top,20
420
	add tl_box_top,20
420
 
421
 
421
	mov [edit2.top],eax ;=ted_wnd_t
422
	mov [edit2.top],eax ;=ted_wnd_t
422
	add dword[edit2.top],20
423
	add dword[edit2.top],20
423
	mov [edit1.top],eax ;=ted_wnd_t
424
	mov [edit1.top],eax ;=ted_wnd_t
424
	add dword[edit1.top],113
425
	add dword[edit1.top],113
425
	popad
426
	popad
426
	ret
427
	ret
427
 
428
 
428
;input:
429
;input:
429
;  ecx = 0x4000____
430
;  ecx = 0x4000____
430
;   cx = ID button
431
;   cx = ID button
431
;  edx = x*2^16+y
432
;  edx = x*2^16+y
432
align 4
433
align 4
433
draw_but_icon:
434
draw_but_icon:
434
	push eax ebx
435
	push eax ebx
435
 
436
 
436
	mov eax,SF_DEFINE_BUTTON
437
	mov eax,SF_DEFINE_BUTTON
437
	push ecx edx esi
438
	push ecx edx esi
438
		mov ebx,edx
439
		mov ebx,edx
439
		mov edx,ecx
440
		mov edx,ecx
440
		mov cx,bx
441
		mov cx,bx
441
		shl ecx,16
442
		shl ecx,16
442
		mov cx,19 ;=20-1
443
		mov cx,19 ;=20-1
443
		mov bx,19 ;=20-1
444
		mov bx,19 ;=20-1
444
		mov esi,ebx
445
		mov esi,ebx
445
		shr esi,16
446
		shr esi,16
446
		add esi,20
447
		add esi,20
447
		cmp esi,[procinfo.client_box.width]
448
		cmp esi,[procinfo.client_box.width]
448
		jge @f ;êíîïêà íå âëåçëà â îêíî
449
		jge @f ;êíîïêà íå âëåçëà â îêíî
449
			mov esi,[sc.work_button]
450
			mov esi,[sc.work_button]
450
			int 0x40 ;ñòàâèì êíîïêó
451
			int 0x40 ;ñòàâèì êíîïêó
451
			mov eax,SF_PUT_IMAGE
452
			mov eax,SF_PUT_IMAGE
452
		@@:
453
		@@:
453
	pop esi edx ecx
454
	pop esi edx ecx
454
 
455
 
455
	cmp eax,SF_PUT_IMAGE
456
	cmp eax,SF_PUT_IMAGE
456
	jne @f ;êíîïêà íå âëåçëà â îêíî
457
	jne @f ;êíîïêà íå âëåçëà â îêíî
457
		mov ebx,[bmp_icon]
458
		mov ebx,[bmp_icon]
458
		bt ecx,30 ;if (ecx & 0x40000000)
459
		bt ecx,30 ;if (ecx & 0x40000000)
459
		jc .gray
460
		jc .gray
460
			add ebx,TOOLBAR_ICONS_SIZE ;ïåðåìåùàåìñÿ íà ñåðûå êíîïêè
461
			add ebx,TOOLBAR_ICONS_SIZE ;ïåðåìåùàåìñÿ íà ñåðûå êíîïêè
461
		.gray:
462
		.gray:
462
		push ecx
463
		push ecx
463
		sub ecx,ID_BUT_0
464
		sub ecx,ID_BUT_0
464
		and ecx,0xffff
465
		and ecx,0xffff
465
		imul ecx,1200
466
		imul ecx,1200
466
		add ebx,ecx
467
		add ebx,ecx
467
		mov ecx,(20 shl 16)+20
468
		mov ecx,(20 shl 16)+20
468
		int 0x40 ;ñòàâèì ðèñóíîê íà êíîïêó
469
		int 0x40 ;ñòàâèì ðèñóíîê íà êíîïêó
469
		pop ecx
470
		pop ecx
470
	@@:
471
	@@:
471
	pop ebx eax
472
	pop ebx eax
472
	ret
473
	ret
473
 
474
 
474
;descrition:
475
;descrition:
475
; ôóíêöèÿ äëÿ ãåíåðèðîâàíèÿ ñåðûõ èêîíîê
476
; ôóíêöèÿ äëÿ ãåíåðèðîâàíèÿ ñåðûõ èêîíîê
476
;input:
477
;input:
477
; buf_rgb - áóôåð ñ âõîäíûì 24 áèòíûì öâåòíûì èçîáðàæåíèåì
478
; buf_rgb - áóôåð ñ âõîäíûì 24 áèòíûì öâåòíûì èçîáðàæåíèåì
478
; buf_g24 - áóôåð ñ âûõîäíûì 24 áèòíûì ñåðûì èçîáðàæåíèåì
479
; buf_g24 - áóôåð ñ âûõîäíûì 24 áèòíûì ñåðûì èçîáðàæåíèåì
479
; pixels - ÷èñëî ïèêñåëåé â èçîáðàæåíèè
480
; pixels - ÷èñëî ïèêñåëåé â èçîáðàæåíèè
480
align 4
481
align 4
481
proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword
482
proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword
482
pushad
483
pushad
483
	mov esi,[buf_rgb]
484
	mov esi,[buf_rgb]
484
	mov edi,[buf_g24]
485
	mov edi,[buf_g24]
485
	mov ecx,[pixels]
486
	mov ecx,[pixels]
486
	mov ebx,3
487
	mov ebx,3
487
	@@:
488
	@@:
488
		movzx eax,byte[esi]
489
		movzx eax,byte[esi]
489
		movzx edx,byte[esi+1]
490
		movzx edx,byte[esi+1]
490
		add eax,edx
491
		add eax,edx
491
		movzx edx,byte[esi+2]
492
		movzx edx,byte[esi+2]
492
		add eax,edx
493
		add eax,edx
493
		xor edx,edx
494
		xor edx,edx
494
		div ebx ;shr eax,2
495
		div ebx ;shr eax,2
495
		mov ah,al
496
		mov ah,al
496
		mov word[edi],ax
497
		mov word[edi],ax
497
		mov byte[edi+2],al
498
		mov byte[edi+2],al
498
		add esi,3
499
		add esi,3
499
		add edi,3
500
		add edi,3
500
		loop @b
501
		loop @b
501
popad
502
popad
502
	ret
503
	ret
503
endp
504
endp