Subversion Repositories Kolibri OS

Rev

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

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