Subversion Repositories Kolibri OS

Rev

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

Rev 2102 Rev 2125
1
struct FileInfoBlock
1
struct FileInfoBlock
2
	Function dd ?
2
	Function dd ?
3
	Position dd ?
3
	Position dd ?
4
	Flags	 dd ?
4
	Flags	 dd ?
5
	Count	 dd ?
5
	Count	 dd ?
6
	Buffer	 dd ?
6
	Buffer	 dd ?
7
		db ?
7
		db ?
8
	FileName dd ?
8
	FileName dd ?
9
ends
9
ends
10
 
10
 
11
struct symbol
11
struct symbol
12
  c db ?    ;  +0 ᨬ¢®«
12
	c db ?    ; +0 ᨬ¢®«
13
  col db ?  ;  +1 梥â
13
	col db ?  ; +1 梥â
14
  perv dd ? ;  +2
14
	perv dd ? ; +2
15
  next dd ? ;  +6 㪠§ â¥«¨
15
	next dd ? ; +6 㪠§ â¥«¨
16
  tc dd ?   ; +10 ¢à¥¬. ᮧ¤ ­¨ï
16
	tc dd ?   ;+10 ¢à¥¬. ᮧ¤ ­¨ï
17
  td dd ?   ; +14 ¢à¥¬. 㤠«¥­¨ï
17
	td dd ?   ;+14 ¢à¥¬. 㤠«¥­¨ï
18
ends
18
ends
19
 
19
 
20
 
20
 
21
hed db 'TextEditor 22.08.11',0 ;¯®¤¯¨áì ®ª­ 
21
hed db 'TextEditor 26.08.11',0 ;¯®¤¯¨áì ®ª­ 
22
sc system_colors
22
sc system_colors
23
 
23
 
24
fn_icon db 'te_icon.bmp',0
24
fn_icon db 'te_icon.bmp',0
25
bmp_icon dd 0
25
bmp_icon dd 0
26
run_file_70 FileInfoBlock 	  
26
run_file_70 FileInfoBlock 	  
27
 
27
 
28
 
28
 
29
;input:
29
;input:
30
; al = ª®¤ ®è¨¡ª¨
30
; al = ª®¤ ®è¨¡ª¨
31
align 4
31
align 4
32
ted_on_init_synt_err:
32
ted_on_init_synt_err:
33
	mov byte[msgbox_3.err],al
33
	mov byte[msgbox_3.err],al
34
	stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file!
34
	stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file!
35
	ret
35
	ret
36
 
36
 
37
 
37
 
38
align 4
38
align 4
39
ted_but_new_file:
39
ted_but_new_file:
40
  push eax ebx
40
  push eax ebx
41
  stdcall [ted_can_save], tedit0
41
  stdcall [ted_can_save], tedit0
42
  cmp al,1
42
  cmp al,1
43
  jne @f
43
  jne @f
44
    stdcall [mb_create],msgbox_2,thread ;message: save changes in file?
44
    stdcall [mb_create],msgbox_2,thread ;message: save changes in file?
45
    ;mov eax,5
45
    ;mov eax,5
46
    ;mov ebx,50
46
    ;mov ebx,50
47
    ;int 0x40
47
    ;int 0x40
48
    stdcall [mb_setfunctions],msgbox_2_funct
48
    stdcall [mb_setfunctions],msgbox_2_funct
49
    jmp .ret_f
49
    jmp .ret_f
50
  @@:
50
  @@:
51
  call On_NewFile
51
  call On_NewFile
52
  .ret_f:
52
  .ret_f:
53
  pop ebx eax
53
  pop ebx eax
54
  ret
54
  ret
55
 
55
 
56
align 4
56
align 4
57
On_NewFile:
57
On_NewFile:
58
  stdcall [ted_clear], tedit0,1
58
  stdcall [ted_clear], tedit0,1
59
  call draw_but_toolbar
59
  call draw_but_toolbar
60
  stdcall [ted_draw], tedit0
60
  stdcall [ted_draw], tedit0
61
  ret
61
  ret
62
 
62
 
63
align 4
63
align 4
64
On_SaveAndNewFile:
64
On_SaveAndNewFile:
65
  push edi
65
  push edi
66
  mov edi, tedit0
66
  mov edi, tedit0
67
 
67
 
68
  stdcall [ted_but_save_file],edi,run_file_70,[edit1.text]
68
  stdcall [ted_but_save_file],edi,run_file_70,[edit1.text]
69
  cmp ted_err_save,0
69
  cmp ted_err_save,0
70
  jne @f
70
  jne @f
71
    call On_NewFile
71
    call On_NewFile
72
  @@:
72
  @@:
73
  pop edi
73
  pop edi
74
  ret
74
  ret
75
 
75
 
76
;description:
76
;description:
77
; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  ¡¥§ ®ª­  á®®¡é¥­¨ï
77
; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  ¡¥§ ®ª­  á®®¡é¥­¨ï
78
align 4
78
align 4
79
but_no_msg_OpenFile:
79
but_no_msg_OpenFile:
80
	push eax ebx
80
	push eax ebx
81
	stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
81
	stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
82
	call ted_messages_after_open_file
82
	call ted_messages_after_open_file
83
	pop ebx eax
83
	pop ebx eax
84
	ret
84
	ret
85
 
85
 
86
;description:
86
;description:
87
; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  á ¢®§¬®¦­ë¬ ®ª­®¬ á®®¡é¥­¨ï (® ¢®§¬®¦­®á⨠®â¬¥­¨âì ®âªàë⨥)
87
; äã­ªæ¨ï ®âªàëâ¨ï ä ©«  á ¢®§¬®¦­ë¬ ®ª­®¬ á®®¡é¥­¨ï (® ¢®§¬®¦­®á⨠®â¬¥­¨âì ®âªàë⨥)
88
align 4
88
align 4
89
ted_but_open_file:
89
ted_but_open_file:
90
	pushad
90
	pushad
91
 
91
 
92
	stdcall [ted_can_save], tedit0
92
	stdcall [ted_can_save], tedit0
93
	cmp al,1
93
	cmp al,1
94
	jne @f
94
	jne @f
95
		stdcall [mb_create],msgbox_5,thread ;message: save changes in file?
95
		stdcall [mb_create],msgbox_5,thread ;message: save changes in file?
96
		stdcall [mb_setfunctions],msgbox_5_funct
96
		stdcall [mb_setfunctions],msgbox_5_funct
97
		jmp .ret_f
97
		jmp .ret_f
98
	@@:
98
	@@:
99
 
99
 
100
	copy_path open_dialog_name,communication_area_default_path,file_name,0
100
	copy_path open_dialog_name,communication_area_default_path,file_name,0
101
	mov [OpenDialog_data.type],0
101
	mov [OpenDialog_data.type],0
102
	stdcall [OpenDialog_Start],OpenDialog_data
102
	stdcall [OpenDialog_Start],OpenDialog_data
103
	cmp [OpenDialog_data.status],2
103
	cmp [OpenDialog_data.status],2
104
	jne @f
104
	jne @f
105
		stdcall mem_spac, msgbox_9.fdp,100
105
		stdcall mem_spac, msgbox_9.fdp,100
106
		mov esi,file_name
106
		mov esi,file_name
107
		call strlen
107
		call strlen
108
		cmp eax,100
108
		cmp eax,100
109
		jle .no_crop
109
		jle .no_crop
110
			mov eax,100
110
			mov eax,100
111
		.no_crop:
111
		.no_crop:
112
		stdcall mem_copy, esi,msgbox_9.fdp,eax
112
		stdcall mem_copy, esi,msgbox_9.fdp,eax
113
		stdcall [mb_create],msgbox_9,thread ;message: error run 'open file dialog'
113
		stdcall [mb_create],msgbox_9,thread ;message: error run 'open file dialog'
114
		jmp .ret_f
114
		jmp .ret_f
115
	@@:
115
	@@:
116
	mov esi,[OpenDialog_data.openfile_path]
116
	mov esi,[OpenDialog_data.openfile_path]
117
	call strlen
117
	call strlen
118
	mov [edit1.size],eax
118
	mov [edit1.size],eax
119
	mov [edit1.pos],eax
119
	mov [edit1.pos],eax
120
	stdcall [edit_box_draw], edit1
120
	stdcall [edit_box_draw], edit1
121
	stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
121
	stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
122
	call ted_messages_after_open_file
122
	call ted_messages_after_open_file
123
	.ret_f:
123
	.ret_f:
124
	popad
124
	popad
125
	ret
125
	ret
126
 
126
 
127
;description:
127
;description:
128
; ª®¯¨à®¢ ­¨¥ ¯ ¬ïâ¨
128
; ª®¯¨à®¢ ­¨¥ ¯ ¬ïâ¨
129
align 4
129
align 4
130
proc mem_copy, source:dword, destination:dword, len:dword
130
proc mem_copy, source:dword, destination:dword, len:dword
131
  push ecx esi edi
131
  push ecx esi edi
132
    cld
132
    cld
133
    mov esi, dword[source]
133
    mov esi, dword[source]
134
    mov edi, dword[destination]
134
    mov edi, dword[destination]
135
    mov ecx, dword[len]
135
    mov ecx, dword[len]
136
    rep movsb
136
    rep movsb
137
  pop edi esi ecx
137
  pop edi esi ecx
138
  ret
138
  ret
139
endp
139
endp
140
 
140
 
141
;description:
141
;description:
142
; § ¯®«­¥­¨¥ ¯ ¬ï⨠¯à®¡¥« ¬¨
142
; § ¯®«­¥­¨¥ ¯ ¬ï⨠¯à®¡¥« ¬¨
143
align 4
143
align 4
144
proc mem_spac, mem:dword, len:dword
144
proc mem_spac, mem:dword, len:dword
145
  push eax ecx edi
145
  push eax ecx edi
146
    cld
146
    cld
147
    mov al,' '
147
    mov al,' '
148
    mov edi, dword[mem]
148
    mov edi, dword[mem]
149
    mov ecx, dword[len]
149
    mov ecx, dword[len]
150
    repne stosb
150
    repne stosb
151
  pop edi ecx eax
151
  pop edi ecx eax
152
  ret
152
  ret
153
endp
153
endp
154
 
154
 
155
;input:
155
;input:
156
; eax = ª®¤ ®è¨¡ª¨
156
; eax = ª®¤ ®è¨¡ª¨
157
; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
157
; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
158
; edi = pointer to tedit struct
158
; edi = pointer to tedit struct
159
align 4
159
align 4
160
ted_messages_after_open_file:
160
ted_messages_after_open_file:
161
	push ecx
161
	push ecx
162
	cmp eax,0
162
	cmp eax,0
163
	je @f
163
	je @f
164
	cmp eax,6
164
	cmp eax,6
165
	je @f
165
	je @f
166
		cmp ax,10
166
		cmp ax,10
167
		jl .zifra_0_9
167
		jl .zifra_0_9
168
			mov al,'?'
168
			mov al,'?'
169
			sub ax,48
169
			sub ax,48
170
		.zifra_0_9:
170
		.zifra_0_9:
171
		add ax,48
171
		add ax,48
172
 
172
 
173
		mov byte[msgbox_4.err],al
173
		mov byte[msgbox_4.err],al
174
		stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file!
174
		stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file!
175
		jmp .ret_f
175
		jmp .ret_f
176
	@@:
176
	@@:
177
	cmp ebx,-1
177
	cmp ebx,-1
178
	je .ret_f
178
	je .ret_f
179
		;if open file
179
		;if open file
180
		mov ecx,ted_max_chars
180
		mov ecx,ted_max_chars
181
		sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
181
		sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
182
		cmp ebx,ecx
182
		cmp ebx,ecx
183
		jl .ret_f
183
		jl .ret_f
184
			stdcall [mb_create],msgbox_1,thread
184
			stdcall [mb_create],msgbox_1,thread
185
	.ret_f:
185
	.ret_f:
186
	pop ecx
186
	pop ecx
187
	ret
187
	ret
188
 
188
 
189
align 4
189
align 4
190
ted_save_err_msg:
190
ted_save_err_msg:
191
	mov byte[msgbox_6.err],al
191
	mov byte[msgbox_6.err],al
192
	stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file!
192
	stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file!
193
	ret
193
	ret
194
 
194
 
195
;description:
195
;description:
196
; äã­ªæ¨ï ­ ¦ â¨ï ­  ª­®¯ªã [à¨¬¥­¨âì] ¢ ¯ ­¥«¨ ᨭ⠪á¨á 
196
; äã­ªæ¨ï ­ ¦ â¨ï ­  ª­®¯ªã [à¨¬¥­¨âì] ¢ ¯ ­¥«¨ ᨭ⠪á¨á 
197
align 4
197
align 4
198
proc ted_but_open_syntax, edit:dword
198
proc ted_but_open_syntax, edit:dword
199
  push ebx edi
199
  push ebx edi
200
  mov edi,dword[edit]
200
  mov edi,dword[edit]
201
 
201
 
202
  cmp ted_panel_id,TED_PANEL_SYNTAX
202
  cmp ted_panel_id,TED_PANEL_SYNTAX
203
  jne @f
203
  jne @f
204
    stdcall dword[tl_node_get_data], tree1
204
    stdcall dword[tl_node_get_data], tree1
205
    pop dword[fn_col_option]
205
    pop dword[fn_col_option]
206
	mov ebx,dword[fn_col_option]
206
	mov ebx,dword[fn_col_option]
207
	copy_path ebx,fn_syntax_dir,file_name_rez,0x0
207
	copy_path ebx,fn_syntax_dir,file_name_rez,0x0
208
	copy_path file_name_rez,sys_path,file_name,0x0
208
	copy_path file_name_rez,sys_path,file_name,0x0
209
    stdcall [ted_init_syntax_file],edi,run_file_70,file_name
209
    stdcall [ted_init_syntax_file],edi,run_file_70,file_name
210
    call [ted_text_colored]
210
    call [ted_text_colored]
211
    stdcall [ted_draw],edi
211
    stdcall [ted_draw],edi
212
  @@:
212
  @@:
213
  pop edi ebx
213
  pop edi ebx
214
  ret
214
  ret
215
endp
215
endp
216
 
216
 
217
;description:
217
;description:
218
; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
218
; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
219
align 4
219
align 4
220
proc ted_but_find
220
proc ted_but_find
221
  push edi
221
  push edi
222
  mov edi,tedit0
222
  mov edi,tedit0
223
 
223
 
224
  cmp ted_panel_id,TED_PANEL_NULL
224
  cmp ted_panel_id,TED_PANEL_NULL
225
  je @f
225
  je @f
226
    mov ted_panel_id,TED_PANEL_NULL
226
    mov ted_panel_id,TED_PANEL_NULL
227
    mov ted_wnd_l,0
227
    mov ted_wnd_l,0
228
    jmp .e_if
228
    jmp .e_if
229
  @@:
229
  @@:
230
    mov ted_panel_id,TED_PANEL_FIND
230
    mov ted_panel_id,TED_PANEL_FIND
231
    mov ted_wnd_l,TED_PANEL_WIDTH
231
    mov ted_wnd_l,TED_PANEL_WIDTH
232
  .e_if:
232
  .e_if:
233
  stdcall EvSize,edi
233
  call EvSize
234
  stdcall [ted_draw],edi
234
  stdcall [ted_draw],edi
235
  pop edi
235
  pop edi
236
  ret
236
  ret
237
endp
237
endp
238
 
238
 
239
align 4
239
align 4
240
ted_on_find_err:
240
ted_on_find_err:
241
	stdcall [mb_create],msgbox_7,thread ;message: Can not find text
241
	stdcall [mb_create],msgbox_7,thread ;message: Can not find text
242
	ret
242
	ret
243
 
243
 
244
;description:
244
;description:
245
; ª­®¯ª  [‡ ¬¥­¨âì] ­  ¯ ­¥«¨
245
; ª­®¯ª  [‡ ¬¥­¨âì] ­  ¯ ­¥«¨
246
align 4
246
align 4
247
but_replace:
247
but_replace:
248
	; ¯®ª  ­¥ ᤥ« ­®
248
	; ¯®ª  ­¥ ᤥ« ­®
249
	ret
249
	ret
250
 
250
 
251
;description:
251
;description:
252
; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢
252
; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢
253
align 4
253
align 4
254
but_find_key_w:
254
but_find_key_w:
255
	; ¯®ª  ­¥ ᤥ« ­®
255
	; ¯®ª  ­¥ ᤥ« ­®
256
	ret
256
	ret
257
 
257
 
258
;description:
258
;description:
259
; ¢ë¤¥«¥­¨¥/áªàë⨥ ­¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
259
; ¢ë¤¥«¥­¨¥/áªàë⨥ ­¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
260
align 4
260
align 4
261
proc but_sumb_invis, edit:dword
261
proc but_sumb_invis, edit:dword
262
  push edi
262
  push edi
263
  mov edi,dword[edit]
263
  mov edi,dword[edit]
264
 
264
 
265
  xor ted_mode_invis,1
265
  xor ted_mode_invis,1
266
  call draw_but_toolbar
266
  call draw_but_toolbar
267
  stdcall [ted_draw],edi
267
  stdcall [ted_draw],edi
268
  pop edi
268
  pop edi
269
  ret
269
  ret
270
endp
270
endp
271
 
271
 
272
;description:
272
;description:
273
; ¢ë¤¥«¥­¨¥/áªàë⨥ ª«î祢ëå á«®¢
273
; ¢ë¤¥«¥­¨¥/áªàë⨥ ª«î祢ëå á«®¢
274
align 4
274
align 4
275
proc but_k_words_show, edit:dword
275
proc but_k_words_show, edit:dword
276
  push edi
276
  push edi
277
  mov edi,dword[edit]
277
  mov edi,dword[edit]
278
 
278
 
279
  xor ted_mode_color,1
279
  xor ted_mode_color,1
280
  cmp ted_mode_color,0
280
  cmp ted_mode_color,0
281
  je @f
281
  je @f
282
    call [ted_text_colored]
282
    call [ted_text_colored]
283
  @@:
283
  @@:
284
  call draw_but_toolbar
284
  call draw_but_toolbar
285
  stdcall [ted_draw],edi
285
  stdcall [ted_draw],edi
286
  pop edi
286
  pop edi
287
  ret
287
  ret
288
endp
288
endp
289
 
289
 
290
;description:
290
;description:
291
; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ á ä ©« ¬¨ ᨭ⠪á¨á 
291
; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ á ä ©« ¬¨ ᨭ⠪á¨á 
292
align 4
292
align 4
293
proc but_synt_show, edit:dword
293
proc but_synt_show, edit:dword
294
  push edi
294
  push edi
295
  mov edi,[edit]
295
  mov edi,[edit]
296
 
296
 
297
  cmp ted_panel_id,TED_PANEL_NULL
297
  cmp ted_panel_id,TED_PANEL_NULL
298
  je @f
298
  je @f
299
    mov ted_panel_id,TED_PANEL_NULL
299
    mov ted_panel_id,TED_PANEL_NULL
300
    mov ted_wnd_l,0
300
    mov ted_wnd_l,0
301
    jmp .e_if
301
    jmp .e_if
302
  @@:
302
  @@:
303
    mov ted_panel_id,TED_PANEL_SYNTAX
303
    mov ted_panel_id,TED_PANEL_SYNTAX
304
    mov ted_wnd_l,TED_PANEL_WIDTH
304
    mov ted_wnd_l,TED_PANEL_WIDTH
305
  .e_if:
305
  .e_if:
306
  stdcall EvSize,edi
306
  call EvSize
307
  stdcall [ted_draw],edi
307
  stdcall [ted_draw],edi
308
  pop edi
308
  pop edi
309
  ret
309
  ret
310
endp
310
endp