Subversion Repositories Kolibri OS

Rev

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

Rev 8442 Rev 9568
1
include '../../load_img.inc'
1
include '../../load_img.inc'
2
include '../../develop/libraries/libs-dev/libimg/libimg.inc'
2
include '../../develop/libraries/libs-dev/libimg/libimg.inc'
3
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
3
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
4
include '../../load_lib.mac'
4
include '../../load_lib.mac'
5
 
5
 
6
@use_library
6
@use_library
7
 
7
 
8
icon_tl_sys dd 0
8
icon_tl_sys dd 0
9
icon_tl_nod dd 0
9
icon_tl_nod dd 0
10
 
10
 
11
TLIST_SZ = 325+16 ;=341. 16 is x-size of scroll bar
11
TLIST_SZ = 325+16 ;=341. 16 is x-size of scroll bar
12
TLIST1_X = 50
12
TLIST1_X = 50
13
TLIST2_X = 409
13
TLIST2_X = 409
14
BT_SZ_X  = 40
14
BT_SZ_X  = 40
15
SYS_COL  = 0xe6e6e6
15
SYS_COL  = 0xe6e6e6
16
BT_COL   = 0xcccccc
16
BT_COL   = 0xcccccc
17
STR_COL  = 0x595959 ;0x000000
17
STR_COL  = 0x595959 ;0x000000
18
 
18
 
19
; TODO: automatic resizing of GUI elements on window resizing
19
; TODO: automatic resizing of GUI elements on window resizing
20
 
20
 
21
align 4
21
align 4
22
;;================================================================================================;;
22
;;================================================================================================;;
23
gui: ;////////////////////////////////////////////////////////////////////////////////////////////;;
23
gui: ;////////////////////////////////////////////////////////////////////////////////////////////;;
24
;;------------------------------------------------------------------------------------------------;;
24
;;------------------------------------------------------------------------------------------------;;
25
;? GUI-specific functions                                                                         ;;
25
;? GUI-specific functions                                                                         ;;
26
;;------------------------------------------------------------------------------------------------;;
26
;;------------------------------------------------------------------------------------------------;;
27
;> none                                                                                           ;;
27
;> none                                                                                           ;;
28
;;------------------------------------------------------------------------------------------------;;
28
;;------------------------------------------------------------------------------------------------;;
29
;< none                                                                                           ;;
29
;< none                                                                                           ;;
30
;;================================================================================================;;
30
;;================================================================================================;;
31
 
31
 
32
    dd .init
32
    dd .init
33
    dd .server_addr
33
    dd .server_addr
34
    dd .get_username
34
    dd .get_username
35
    dd .get_cmd
35
    dd .get_cmd
36
    dd .print
36
    dd .print
37
    dd .set_flags
37
    dd .set_flags
38
    dd .list
38
    dd .list
39
    dd .progress
39
    dd .progress
40
    dd .error
40
    dd .error
41
 
41
 
42
    .init:
42
    .init:
43
        ; load libraries
43
        ; load libraries
44
        stdcall dll.Load, @IMPORT_GUI_LIBS
44
        stdcall dll.Load, @IMPORT_GUI_LIBS
45
        test    eax, eax
45
        test    eax, eax
46
        jnz     .exit
46
        jnz     .exit
47
 
47
 
48
        mcall   48, 3, sc, sizeof.system_colors
48
        mcall   48, 3, sc, sizeof.system_colors
49
        mcall   40, 0xC0000027 ; set event mask
49
        mcall   40, 0xC0000027 ; set event mask
50
        ret
50
        ret
51
 
51
 
52
    .server_addr:
52
    .server_addr:
53
        mov     [auto_list], 1
53
        mov     [auto_list], 1
54
        jmp     login_gui.server_addr
54
        jmp     login_gui.server_addr
55
 
55
 
56
    .get_username:
56
    .get_username:
57
        jmp     login_gui.get_username
57
        jmp     login_gui.get_username
58
 
58
 
59
 
59
 
60
;;================================================================================================;;
60
;;================================================================================================;;
61
    .main: ;//////////////////////////////////////////////////////////////////////////////////////;;
61
    .main: ;//////////////////////////////////////////////////////////////////////////////////////;;
62
;;------------------------------------------------------------------------------------------------;;
62
;;------------------------------------------------------------------------------------------------;;
63
;? Initialize tree list, editbox and textedit elements                                            ;;
63
;? Initialize tree list, editbox and textedit elements                                            ;;
64
;;------------------------------------------------------------------------------------------------;;
64
;;------------------------------------------------------------------------------------------------;;
65
;> none                                                                                           ;;
65
;> none                                                                                           ;;
66
;;------------------------------------------------------------------------------------------------;;
66
;;------------------------------------------------------------------------------------------------;;
67
;< none                                                                                           ;;
67
;< none                                                                                           ;;
68
;;================================================================================================;;
68
;;================================================================================================;;
69
 
69
 
70
        stdcall [ted_init], tedit0
70
        stdcall [ted_init], tedit0
71
        stdcall [edit_box_set_text], edit_volume, root_dir
71
        stdcall [edit_box_set_text], edit_volume, root_dir
72
 
72
 
73
        ; initialize tree list elements
73
        ; initialize tree list elements
74
        stdcall [tl_data_init], tree1
74
        stdcall [tl_data_init], tree1
75
        stdcall [tl_data_init], tree2
75
        stdcall [tl_data_init], tree2
76
		
76
		
77
		or dword[tree1.style], 8 ;tl_cursor_pos_limited - restrict cursor move to existing nodes
77
		or dword[tree1.style], 8 ;tl_cursor_pos_limited - restrict cursor move to existing nodes
78
		or dword[tree2.style], 8 ;tl_cursor_pos_limited
78
		or dword[tree2.style], 8 ;tl_cursor_pos_limited
79
		
79
		
80
        ; read icons
80
        ; read icons
81
        load_image_file 'ftpc_sys.png', icon_tl_sys
81
        load_image_file 'ftpc_sys.png', icon_tl_sys
82
 
82
 
83
        mov     [filestruct.ptr], eax
83
        mov     [filestruct.ptr], eax
84
        mov     [filestruct.subfn], 0
84
        mov     [filestruct.subfn], 0
85
        mov     [filestruct.offset], 54
85
        mov     [filestruct.offset], 54
86
        mov     [filestruct.size], ecx
86
        mov     [filestruct.size], ecx
87
        mcall   70, filestruct
87
        mcall   70, filestruct
88
        cmp     ebx, 0
88
        cmp     ebx, 0
89
        jl      @f
89
        jl      @f
90
        m2m     dword[tree1.data_img_sys], dword[icon_tl_sys]
90
        m2m     dword[tree1.data_img_sys], dword[icon_tl_sys]
91
        m2m     dword[tree2.data_img_sys], dword[icon_tl_sys]
91
        m2m     dword[tree2.data_img_sys], dword[icon_tl_sys]
92
 
92
 
93
      @@:
93
      @@:
94
        ; read nodes icon file
94
        ; read nodes icon file
95
        load_image_file 'ftpc_nod.png', icon_tl_nod
95
        load_image_file 'ftpc_nod.png', icon_tl_nod
96
 
96
 
97
        mov     [filestruct.ptr], eax
97
        mov     [filestruct.ptr], eax
98
        ;mov    [filestruct.subfn], 0
98
        ;mov    [filestruct.subfn], 0
99
        ;mov    [filestruct.offset], 54
99
        ;mov    [filestruct.offset], 54
100
        mov     [filestruct.size], ecx
100
        mov     [filestruct.size], ecx
101
        mcall   70, filestruct
101
        mcall   70, filestruct
102
        cmp     ebx, 0
102
        cmp     ebx, 0
103
        jl      @f
103
        jl      @f
104
        m2m     dword[tree1.data_img], dword[icon_tl_nod]
104
        m2m     dword[tree1.data_img], dword[icon_tl_nod]
105
        m2m     dword[tree2.data_img], dword[icon_tl_nod]
105
        m2m     dword[tree2.data_img], dword[icon_tl_nod]
106
    
106
    
107
      @@:
107
      @@:
108
        call    .draw
108
        call    .draw
109
        ; create initial tree list for root_dir
109
        ; create initial tree list for root_dir
110
        call    populate_local_tree_list
110
        call    populate_local_tree_list
111
        jmp     arg_handler.connect
111
        jmp     arg_handler.connect
112
 
112
 
113
    .get_cmd:
113
    .get_cmd:
114
        dec     [auto_list]
114
        dec     [auto_list]
115
        jnz     .redraw
115
        jnz     .redraw
116
        call    .clear_remote_tree
116
        call    .clear_remote_tree
117
        jmp     cmd_list
117
        jmp     cmd_list
118
 
118
 
119
    .redraw:
119
    .redraw:
120
        call     .draw
120
        call     .draw
121
 
121
 
122
    align 4
122
    align 4
123
    .still:
123
    .still:
124
        mcall   10
124
        mcall   10
125
 
125
 
126
        dec     eax
126
        dec     eax
127
        jz      .redraw
127
        jz      .redraw
128
        dec     eax
128
        dec     eax
129
        jz      .key
129
        jz      .key
130
        dec     eax
130
        dec     eax
131
        jz      .button
131
        jz      .button
132
        sub     eax, 3
132
        sub     eax, 3
133
        jz      .mouse
133
        jz      .mouse
134
 
134
 
135
        jmp     .still
135
        jmp     .still
136
 
136
 
137
    .error:
137
    .error:
138
        jmp     login_gui.error
138
        jmp     login_gui.error
139
 
139
 
140
    .exit:
140
    .exit:
141
    ;   stdcall mem.Free,[bmp_icon]
141
    ;   stdcall mem.Free,[bmp_icon]
142
        stdcall [tl_data_clear], tree1
142
        stdcall [tl_data_clear], tree1
143
        stdcall [tl_data_clear], tree2
143
        stdcall [tl_data_clear], tree2
144
        stdcall [ted_delete], tedit0
144
        stdcall [ted_delete], tedit0
145
        jmp     exit
145
        jmp     exit
146
 
146
 
147
    align 4
147
    align 4
148
    .draw:
148
    .draw:
149
        mcall   12, 1
149
        mcall   12, 1
150
        ; main window
150
        ; main window
151
        mcall   0, <35,830>, <20,555>, 0x34000000+SYS_COL, 0x805080DD, str_title
151
        mcall   0, <35,830>, <20,555>, 0x34000000+SYS_COL, 0x805080DD, str_title
152
 
152
 
153
        ;-------------------------
153
        ;-------------------------
154
        ; textedit components
154
        ; textedit components
155
        ;-------------------------
155
        ;-------------------------
156
        mcall   9, procinfo, -1
156
        mcall   9, procinfo, -1
157
        mov     edi, tedit0
157
        mov     edi, tedit0
158
        call    EvSize
158
        call    EvSize
159
 
159
 
160
        movzx   ebx,word[procinfo.client_box.width]
160
        movzx   ebx,word[procinfo.client_box.width]
161
        inc     bx
161
        inc     bx
162
        mcall   13, , ted_wnd_t
162
        mcall   13, , ted_wnd_t
163
        stdcall [ted_draw], tedit0
163
        stdcall [ted_draw], tedit0
164
 
164
 
165
        ; draw "disconnect" button
165
        ; draw "disconnect" button
166
        mcall   8, <50,95>, <25,25>, 3, BT_COL
166
        mcall   8, <50,95>, <25,25>, 3, BT_COL
167
        ; string "disconnect"
167
        ; string "disconnect"
168
        mcall   4, <50+5,25+5>, 0xb0000000+STR_COL, str_disconnect
168
        mcall   4, <50+5,25+5>, 0xb0000000+STR_COL, str_disconnect
169
        ; draw "Copy" button
169
        ; draw "Copy" button
170
        mcall   8, <50,40>, <326,25>, 4, BT_COL
170
        mcall   8, <50,40>, <326,25>, 4, BT_COL
171
        ; string "copy"
171
        ; string "copy"
172
        mcall   4, <50+5,326+5>, 0xb0000000+STR_COL, str_copy
172
        mcall   4, <50+5,326+5>, 0xb0000000+STR_COL, str_copy
173
        ; draw "Search" button
173
        ; draw "Search" button
174
        mcall   8, , <20,25>, 5, BT_COL
174
        mcall   8, , <20,25>, 5, BT_COL
175
        ; string "Search"
175
        ; string "Search"
176
        mcall   4, , 0xb0000000+STR_COL, str_search
176
        mcall   4, , 0xb0000000+STR_COL, str_search
177
 
177
 
178
        ; draw "LIST" button
178
        ; draw "LIST" button
179
        mcall   8, , <50,25>, 12, BT_COL
179
        mcall   8, , <50,25>, 12, BT_COL
180
        ; string "LIST"
180
        ; string "LIST"
181
        mcall   4, , 0xb0000000+STR_COL, str_list
181
        mcall   4, , 0xb0000000+STR_COL, str_list
182
        ; draw "DELE" button
182
        ; draw "DELE" button
183
        mcall   8, , <50,25>, 7, BT_COL
183
        mcall   8, , <50,25>, 7, BT_COL
184
        ; string "DELE"
184
        ; string "DELE"
185
        mcall   4, , 0xb0000000+STR_COL, str_dele
185
        mcall   4, , 0xb0000000+STR_COL, str_dele
186
        ; draw "RDIR" button
186
        ; draw "RDIR" button
187
        mcall   8, , <50,25>, 8, BT_COL
187
        mcall   8, , <50,25>, 8, BT_COL
188
        ; string "RDIR"
188
        ; string "RDIR"
189
        mcall   4, , 0xb0000000+STR_COL, str_rdir
189
        mcall   4, , 0xb0000000+STR_COL, str_rdir
190
        ; draw "RMD" button
190
        ; draw "RMD" button
191
        mcall   8, , <50,25>, 9, BT_COL
191
        mcall   8, , <50,25>, 9, BT_COL
192
        ; string "RMD"
192
        ; string "RMD"
193
        mcall   4, , 0xb0000000+STR_COL, str_rmd
193
        mcall   4, , 0xb0000000+STR_COL, str_rmd
194
 
194
 
195
        ; draw "mkd" button
195
        ; draw "mkd" button
196
        mcall   8, , <80,20>, 6, BT_COL
196
        mcall   8, , <80,20>, 6, BT_COL
197
        ; string "mkd"
197
        ; string "mkd"
198
        mcall   4, , 0xb0000000+STR_COL, str_mkd
198
        mcall   4, , 0xb0000000+STR_COL, str_mkd
199
        
199
        
200
        ; draw "cancel" button
200
        ; draw "cancel" button
201
        ;mcall   8, <555,55>, <308,25>, 10, BT_COL
201
        ;mcall   8, <555,55>, <308,25>, 10, BT_COL
202
        ; string "Cancel"
202
        ; string "Cancel"
203
        ;mcall   4, <555+5,308+5>, 0xb0000000+STR_COL, str_abort
203
        ;mcall   4, <555+5,308+5>, 0xb0000000+STR_COL, str_abort
204
        ; draw "change volume" button
204
        ; draw "change volume" button
205
        mcall   8, , <100-20,22>, 11, BT_COL
205
        mcall   8, , <100-20,22>, 11, BT_COL
206
        ; string "Change"
206
        ; string "Change"
207
        mcall   4, , 0xb0000000+STR_COL, str_change
207
        mcall   4, , 0xb0000000+STR_COL, str_change
208
 
208
 
209
        ;--------------------------
209
        ;--------------------------
210
        ; tree list components
210
        ; tree list components
211
        ;--------------------------
211
        ;--------------------------
212
        stdcall [tl_draw], tree1
212
        stdcall [tl_draw], tree1
213
        stdcall [tl_draw], tree2
213
        stdcall [tl_draw], tree2
214
     
214
     
215
        mov     dword[wScr.all_redraw], 1
215
        mov     dword[wScr.all_redraw], 1
216
        stdcall [scrollbar_ver_draw], wScr
216
        stdcall [scrollbar_ver_draw], wScr
217
 
217
 
218
        mov     dword[wScr2.all_redraw],1
218
        mov     dword[wScr2.all_redraw],1
219
        stdcall [scrollbar_ver_draw], wScr2
219
        stdcall [scrollbar_ver_draw], wScr2
220
 
220
 
221
        stdcall [edit_box_draw], edit_mkd
221
        stdcall [edit_box_draw], edit_mkd
222
        stdcall [edit_box_draw], edit_volume
222
        stdcall [edit_box_draw], edit_volume
223
        stdcall [edit_box_draw], edit_search
223
        stdcall [edit_box_draw], edit_search
224
 
224
 
225
        mcall   12,2
225
        mcall   12,2
226
        ret
226
        ret
227
 
227
 
228
    align 16
228
    align 16
229
    .mouse:
229
    .mouse:
230
        mcall   37, 1
230
        mcall   37, 1
231
        cmp     word[tedit0.wnd.top], ax
231
        cmp     word[tedit0.wnd.top], ax
232
        jg      .no_edit
232
        jg      .no_edit
233
 
233
 
234
        shr     eax, 16
234
        shr     eax, 16
235
        cmp     word[tedit0.wnd.left], ax
235
        cmp     word[tedit0.wnd.left], ax
236
        jg      .no_edit
236
        jg      .no_edit
237
 
237
 
238
        mcall   37, 3
238
        mcall   37, 3
239
        bt      eax, 24
239
        bt      eax, 24
240
        jnc     @f
240
        jnc     @f
241
 
241
 
242
        stdcall [ted_but_select_word], tedit0
242
        stdcall [ted_but_select_word], tedit0
243
        jmp     .still
243
        jmp     .still
244
 
244
 
245
      @@:
245
      @@:
246
        stdcall [ted_mouse], tedit0
246
        stdcall [ted_mouse], tedit0
247
        jmp     .still
247
        jmp     .still
248
 
248
 
249
      .no_edit:
249
      .no_edit:
250
        stdcall [tl_mouse], tree1
250
        stdcall [tl_mouse], tree1
251
        stdcall [tl_mouse], tree2
251
        stdcall [tl_mouse], tree2
252
        stdcall [edit_box_mouse], edit_mkd
252
        stdcall [edit_box_mouse], edit_mkd
253
        stdcall [edit_box_mouse], edit_volume
253
        stdcall [edit_box_mouse], edit_volume
254
        stdcall [edit_box_mouse], edit_search
254
        stdcall [edit_box_mouse], edit_search
255
        jmp     .still
255
        jmp     .still
256
 
256
 
257
    align 16
257
    align 16
258
    .key:
258
    .key:
259
        mcall   2
259
        mcall   2
260
        stdcall [tl_key], tree1
260
        stdcall [tl_key], tree1
261
        stdcall [tl_key], tree2
261
        stdcall [tl_key], tree2
262
        stdcall [edit_box_key], edit_mkd
262
        stdcall [edit_box_key], edit_mkd
263
        stdcall [edit_box_key], edit_volume
263
        stdcall [edit_box_key], edit_volume
264
        stdcall [edit_box_key], edit_search
264
        stdcall [edit_box_key], edit_search
265
        jmp     .still
265
        jmp     .still
266
 
266
 
267
    align 16
267
    align 16
268
    .button:
268
    .button:
269
        mcall   17
269
        mcall   17
270
 
270
 
271
        cmp     ah, 3
271
        cmp     ah, 3
272
        jne     @f
272
        jne     @f
273
        ijmp    eax, interface_addr, interface.server_addr
273
        ijmp    eax, interface_addr, interface.server_addr
274
        jmp     .still
274
        jmp     .still
275
 
275
 
276
      @@:
276
      @@:
277
        cmp     ah, 4
277
        cmp     ah, 4
278
        jne     @f
278
        jne     @f
279
        stdcall [ted_but_copy], tedit0
279
        stdcall [ted_but_copy], tedit0
280
        jmp     .still
280
        jmp     .still
281
 
281
 
282
      @@:
282
      @@:
283
        cmp     ah, 5
283
        cmp     ah, 5
284
        jne     @f
284
        jne     @f
285
        je      filter_remote_list
285
        je      filter_remote_list
286
 
286
 
287
      @@:
287
      @@:
288
        cmp     ah, 6
288
        cmp     ah, 6
289
        je      create_remote_dir
289
        je      create_remote_dir
290
 
290
 
291
        cmp     ah, 7
291
        cmp     ah, 7
292
        je      delete_file
292
        je      delete_file
293
 
293
 
294
        cmp     ah, 8
294
        cmp     ah, 8
295
        je      cmd_rdir
295
        je      cmd_rdir
296
 
296
 
297
        cmp     ah, 9
297
        cmp     ah, 9
298
        je      remove_dir
298
        je      remove_dir
299
 
299
 
300
        cmp     ah, 11
300
        cmp     ah, 11
301
        jne     @f
301
        jne     @f
302
        call    populate_local_tree_list
302
        call    populate_local_tree_list
303
 
303
 
304
      @@:
304
      @@:
305
        cmp     ah, 12
305
        cmp     ah, 12
306
        jne     @f
306
        jne     @f
307
        call    .clear_remote_tree
307
        call    .clear_remote_tree
308
        je      cmd_list
308
        je      cmd_list
309
 
309
 
310
      @@:
310
      @@:
311
        cmp     ah, 1
311
        cmp     ah, 1
312
        je      .exit
312
        je      .exit
313
      
313
      
314
        jmp     .still
314
        jmp     .still
315
 
315
 
316
    .print:
316
    .print:
317
        pushad
317
        pushad
318
        mov     ebx, ted_opt_ed_change_time + ted_opt_ed_move_cursor
318
        mov     ebx, ted_opt_ed_change_time + ted_opt_ed_move_cursor
319
        mov     ecx, 2 ; 0a0d
319
        mov     ecx, 2 ; 0a0d
320
        mov     esi, [esp+36]
320
        mov     esi, [esp+36]
321
        mov     word[tedit_buffer], 0x0a0d
321
        mov     word[tedit_buffer], 0x0a0d
322
        lea     edi, [tedit_buffer+2]
322
        lea     edi, [tedit_buffer+2]
323
 
323
 
324
      @@:
324
      @@:
325
        movsb
325
        movsb
326
        inc     ecx
326
        inc     ecx
327
        cmp     byte[esi], 0
327
        cmp     byte[esi], 0
328
        jne     @b
328
        jne     @b
329
        stdcall [ted_text_add], tedit0, tedit_buffer, ecx, ebx
329
        stdcall [ted_text_add], tedit0, tedit_buffer, ecx, ebx
330
        stdcall [ted_draw], tedit0
330
        stdcall [ted_draw], tedit0
331
        ; write to log file
331
        ; write to log file
332
        mov     eax, [esp+36]
332
        mov     eax, [esp+36]
333
        sub     ecx, 2 ; 0a0d is not included
333
        sub     ecx, 2 ; 0a0d is not included
334
        call    write_to_file
334
        call    write_to_file
335
 
335
 
336
      @@:
336
      @@:
337
        popad
337
        popad
338
        ret     4
338
        ret     4
339
 
339
 
340
    .set_flags:
340
    .set_flags:
341
        ret     4
341
        ret     4
342
 
342
 
343
 
343
 
344
;;================================================================================================;;
344
;;================================================================================================;;
345
    .list: ;//////////////////////////////////////////////////////////////////////////////////////;;
345
    .list: ;//////////////////////////////////////////////////////////////////////////////////////;;
346
;;------------------------------------------------------------------------------------------------;;
346
;;------------------------------------------------------------------------------------------------;;
347
;? update tree2 with remote directory listing                                                     ;;
347
;? update tree2 with remote directory listing                                                     ;;
348
;;------------------------------------------------------------------------------------------------;;
348
;;------------------------------------------------------------------------------------------------;;
349
;> buf_buffer2 = received data buffer                                                             ;;
349
;> buf_buffer2 = received data buffer                                                             ;;
350
;> eax = size of data                                                                             ;;
350
;> eax = size of data                                                                             ;;
351
;> remote_list_buf = buffer containing last incomplete entry (if any)                             ;;
351
;> remote_list_buf = buffer containing last incomplete entry (if any)                             ;;
352
;;------------------------------------------------------------------------------------------------;;
352
;;------------------------------------------------------------------------------------------------;;
353
;< none                                                                                           ;;
353
;< none                                                                                           ;;
354
;;================================================================================================;;
354
;;================================================================================================;;
355
 
355
 
356
        push    edx
356
        push    edx
357
        push    eax
357
        push    eax
358
        ; check if any incomplete entry to be parsed
358
        ; check if any incomplete entry to be parsed
359
        cmp     byte[remote_list_buf], 0
359
        cmp     byte[remote_list_buf], 0
360
        je      .no_backlog
360
        je      .no_backlog
361
        ; find end of remote_list_buf
361
        ; find end of remote_list_buf
362
        mov     edi, remote_list_buf
362
        mov     edi, remote_list_buf
363
        mov     al, 0
363
        mov     al, 0
364
        repne   scasb
364
        repne   scasb
365
        ; copy rest of the incomplete entry to remote_list_buf
365
        ; copy rest of the incomplete entry to remote_list_buf
366
        mov     esi, buf_buffer2
366
        mov     esi, buf_buffer2
367
        dec     edi
367
        dec     edi
368
 
368
 
369
      @@:
369
      @@:
370
        movsb
370
        movsb
371
        cmp     word[esi-2], 0x0a0d
371
        cmp     word[esi-2], 0x0a0d
372
        jne     @b
372
        jne     @b
373
        mov     byte[edi], 0
373
        mov     byte[edi], 0
374
        mov     ecx, edi
374
        mov     ecx, edi
375
        sub     ecx, remote_list_buf ; ecx = length of remote_list_buf
375
        sub     ecx, remote_list_buf ; ecx = length of remote_list_buf
376
        mov     ebx, esi ; ebx = address at which next parse should start
376
        mov     ebx, esi ; ebx = address at which next parse should start
377
        mov     edi, remote_list_buf
377
        mov     edi, remote_list_buf
378
        jmp     .start_parsing
378
        jmp     .start_parsing
379
 
379
 
380
      .no_backlog:
380
      .no_backlog:
381
        mov     ecx, eax    ; ecx = number of bytes remaining to parse in buf_buffer2
381
        mov     ecx, eax    ; ecx = number of bytes remaining to parse in buf_buffer2
382
        mov     edi, buf_buffer2
382
        mov     edi, buf_buffer2
383
 
383
 
384
      .start_parsing:
384
      .start_parsing:
385
        ; find pointer to name
385
        ; find pointer to name
386
        cmp     byte[edi], 'd' ; file is a directory
386
        cmp     byte[edi], 'd' ; file is a directory
387
        je      @f
387
        je      @f
388
        cmp     byte[edi], 'l' ; link
388
        cmp     byte[edi], 'l' ; link
389
        je      @f
389
        je      @f
390
        mov     word[node_entry2], 'fi'
390
        mov     word[node_entry2], 'fi'
391
        jmp     .parse
391
        jmp     .parse
392
 
392
 
393
      @@:
393
      @@:
394
        mov     word[node_entry2], 'fo'
394
        mov     word[node_entry2], 'fo'
395
 
395
 
396
      .parse:
396
      .parse:
397
        mov     edx, 8
397
        mov     edx, 8
398
 
398
 
399
      @@:
399
      @@:
400
        mov     al, ' '
400
        mov     al, ' '
401
        mov     ecx, [esp]
401
        mov     ecx, [esp]
402
        add     ecx, buf_buffer2
402
        add     ecx, buf_buffer2
403
        sub     ecx, edi
403
        sub     ecx, edi
404
        
404
        
405
        repne   scasb
405
        repne   scasb
406
 
406
 
407
        ; check if the (last) entry is incomplete
407
        ; check if the (last) entry is incomplete
408
        test    ecx, ecx
408
        test    ecx, ecx
409
        jz      .store_last_entry
409
        jz      .store_last_entry
410
 
410
 
411
        rep     scasb
411
        rep     scasb
412
        test    ecx, ecx
412
        test    ecx, ecx
413
        jz      .store_last_entry
413
        jz      .store_last_entry
414
        
414
        
415
        dec     edx
415
        dec     edx
416
        jnz     @b
416
        jnz     @b
417
 
417
 
418
        lea     esi, [edi-1]
418
        lea     esi, [edi-1]
419
        lea     edi, [node_entry2+4]
419
        lea     edi, [node_entry2+4]
420
      @@:
420
      @@:
421
        movsb
421
        movsb
422
        cmp     word[esi], 0x0a0d ; end of entry
422
        cmp     word[esi], 0x0a0d ; end of entry
423
        jne     @b
423
        jne     @b
424
        mov     byte[edi], 0
424
        mov     byte[edi], 0
425
 
425
 
426
        ; add node to tree list
426
        ; add node to tree list
427
        cmp     word[node_entry2], 'fi'
427
        cmp     word[node_entry2], 'fi'
428
        jne     @f
428
        jne     @f
429
        stdcall [tl_node_add], tree2, 0, node_entry2
429
        stdcall [tl_node_add], tree2, 0, node_entry2
430
        jmp     .added_remote_node
430
        jmp     .added_remote_node
431
 
431
 
432
      @@:
432
      @@:
433
        stdcall [tl_node_add], tree2, 0x10000, node_entry2
433
        stdcall [tl_node_add], tree2, 0x10000, node_entry2
434
 
434
 
435
      .added_remote_node:
435
      .added_remote_node:
436
        ; check whether we are parsing remote_list_buf
436
        ; check whether we are parsing remote_list_buf
437
        cmp     byte[remote_list_buf], 0
437
        cmp     byte[remote_list_buf], 0
438
        je      @f
438
        je      @f
439
        mov     byte[remote_list_buf], 0 ; done parsing remote_list_buf
439
        mov     byte[remote_list_buf], 0 ; done parsing remote_list_buf
440
        mov     edi, ebx
440
        mov     edi, ebx
441
        mov     eax, [esp]
441
        mov     eax, [esp]
442
        mov     ecx, buf_buffer2
442
        mov     ecx, buf_buffer2
443
        add     ecx, eax
443
        add     ecx, eax
444
        sub     ecx, ebx
444
        sub     ecx, ebx
445
        jmp     .start_parsing
445
        jmp     .start_parsing
446
 
446
 
447
      @@:
447
      @@:
448
        ; any more entries to parse?
448
        ; any more entries to parse?
449
        lea     edi, [esi+2] ; skip 0a0d
449
        lea     edi, [esi+2] ; skip 0a0d
450
        cmp     byte[edi], 0
450
        cmp     byte[edi], 0
451
        jne     .start_parsing
451
        jne     .start_parsing
452
        jmp     .done_parsing
452
        jmp     .done_parsing
453
 
453
 
454
      .store_last_entry:
454
      .store_last_entry:
455
        ; find index of the last incomplete entry
455
        ; find index of the last incomplete entry
456
        mov     ecx, -1
456
        mov     ecx, -1
457
        mov     eax, [esp]
457
        mov     eax, [esp]
458
        lea     edi, [buf_buffer2+eax-2]
458
        lea     edi, [buf_buffer2+eax-2]
459
        mov     al, 0x0a
459
        mov     al, 0x0a
460
        std
460
        std
461
        repne   scasb
461
        repne   scasb
462
        cld
462
        cld
463
 
463
 
464
        ; copy last (incomplete) entry of buf_buffer2 to remote_list_buf
464
        ; copy last (incomplete) entry of buf_buffer2 to remote_list_buf
465
        lea     esi, [edi+2]
465
        lea     esi, [edi+2]
466
        mov     edi, remote_list_buf
466
        mov     edi, remote_list_buf
467
      @@:
467
      @@:
468
        movsb
468
        movsb
469
        cmp     byte[esi-1], 0
469
        cmp     byte[esi-1], 0
470
        jne     @b
470
        jne     @b
471
 
471
 
472
      .done_parsing:
472
      .done_parsing:
473
        call    .draw ; to update tree list immediately in case of "auto_list"
473
        call    .draw ; to update tree list immediately in case of "auto_list"
474
        pop     eax
474
        pop     eax
475
        pop     edx
475
        pop     edx
476
        jmp     data_loop
476
        jmp     data_loop
477
 
477
 
478
        ; clear tree list and add ".." node before executing "LIST"
478
        ; clear tree list and add ".." node before executing "LIST"
479
      .clear_remote_tree:
479
      .clear_remote_tree:
480
        stdcall [tl_info_clear], tree2
480
        stdcall [tl_info_clear], tree2
481
        mov     dword[node_entry2+4], 0x2E2E
481
        mov     dword[node_entry2+4], 0x2E2E
482
        stdcall [tl_node_add], tree2, 0x10000, node_entry2
482
        stdcall [tl_node_add], tree2, 0x10000, node_entry2
483
        ret
483
        ret
484
 
484
 
485
 
485
 
486
;;================================================================================================;;
486
;;================================================================================================;;
487
    .progress: ;//////////////////////////////////////////////////////////////////////////////////;;
487
    .progress: ;//////////////////////////////////////////////////////////////////////////////////;;
488
;;------------------------------------------------------------------------------------------------;;
488
;;------------------------------------------------------------------------------------------------;;
489
;? Update progress bar every time new data is received from data_loop block                       ;;
489
;? Update progress bar every time new data is received from data_loop block                       ;;
490
;;------------------------------------------------------------------------------------------------;;
490
;;------------------------------------------------------------------------------------------------;;
491
;> edx = no. of bytes downloaded                                                                  ;;
491
;> edx = no. of bytes downloaded                                                                  ;;
492
;;------------------------------------------------------------------------------------------------;;
492
;;------------------------------------------------------------------------------------------------;;
493
;< none                                                                                           ;;
493
;< none                                                                                           ;;
494
;;================================================================================================;;
494
;;================================================================================================;;
495
 
495
 
496
        ; detect abort
496
        ; detect abort
497
        mcall   17
497
        mcall   17
498
        cmp     ah, 10
498
        cmp     ah, 10
499
        je      cmd_abor
499
        je      cmd_abor
500
 
500
 
501
        push    eax ebx ecx edx
501
        push    eax ebx ecx edx
502
        mov     ebx, [file_size]
502
        mov     ebx, [file_size]
503
        mov     ecx, 100
503
        mov     ecx, 100
504
        mov     eax, edx
504
        mov     eax, edx
505
        mul     ecx
505
        mul     ecx
506
        div     ebx
506
        div     ebx
507
        cmp     eax, 100
507
        cmp     eax, 100
508
        jle     @f
508
        jle     @f
509
        mov     eax, 100
509
        mov     eax, 100
510
 
510
 
511
      @@:
511
      @@:
512
        mov     dword[pb], eax
512
        mov     dword[pb], eax
513
        push    pb
513
        push    pb
514
        call    [progressbar_draw]
514
        call    [progressbar_draw]
515
        pop     edx ecx ebx eax
515
        pop     edx ecx ebx eax
516
        ret
516
        ret
517
 
517
 
518
 
518
 
519
remove_dir:
519
remove_dir:
520
 
520
 
521
    stdcall [tl_node_get_data], tree2
521
    stdcall [tl_node_get_data], tree2
522
    cmp     word[eax], 'fo'
522
    cmp     word[eax], 'fo'
523
    jne     gui.still
523
    jne     gui.still
524
    lea     esi, [eax+4]
524
    lea     esi, [eax+4]
525
    lea     edi, [buf_cmd+4]
525
    lea     edi, [buf_cmd+4]
526
  @@:
526
  @@:
527
    movsb
527
    movsb
528
    cmp     byte[esi], 0
528
    cmp     byte[esi], 0
529
    jne     @b
529
    jne     @b
530
    mov     word[edi], 0x000a
530
    mov     word[edi], 0x000a
531
    jmp     cmd_rmd
531
    jmp     cmd_rmd
532
 
532
 
533
 
533
 
534
delete_file:
534
delete_file:
535
 
535
 
536
    stdcall [tl_node_get_data], tree2
536
    stdcall [tl_node_get_data], tree2
537
    cmp     word[eax], 'fi'
537
    cmp     word[eax], 'fi'
538
    jne     gui.still
538
    jne     gui.still
539
    lea     esi, [eax+4]
539
    lea     esi, [eax+4]
540
    lea     edi, [buf_cmd+5]
540
    lea     edi, [buf_cmd+5]
541
  @@:
541
  @@:
542
    movsb
542
    movsb
543
    cmp     byte[esi], 0
543
    cmp     byte[esi], 0
544
    jne     @b
544
    jne     @b
545
    mov     word[edi], 0x000a
545
    mov     word[edi], 0x000a
546
    jmp     cmd_dele
546
    jmp     cmd_dele
547
 
547
 
548
 
548
 
549
create_remote_dir:
549
create_remote_dir:
550
 
550
 
551
    lea     edi, [buf_cmd+4]
551
    lea     edi, [buf_cmd+4]
552
    mov     esi, new_dir_buf
552
    mov     esi, new_dir_buf
553
  @@:
553
  @@:
554
    movsb
554
    movsb
555
    cmp     byte[esi], 0
555
    cmp     byte[esi], 0
556
    jne     @b
556
    jne     @b
557
    mov     word[edi], 0x000a
557
    mov     word[edi], 0x000a
558
    jmp     cmd_mkd
558
    jmp     cmd_mkd
559
 
559
 
560
 
560
 
561
; Function to call when you press [Enter]
561
; Function to call when you press [Enter]
562
align 4
562
align 4
563
fun_on_enter:
563
fun_on_enter:
564
 
564
 
565
    stdcall [tl_node_get_data], tree1
565
    stdcall [tl_node_get_data], tree1
566
    cmp     word[eax], 'fi'
566
    cmp     word[eax], 'fi'
567
    je      @f
567
    je      @f
568
    lea     ecx, [eax+4] ; discard first 4 bytes
568
    lea     ecx, [eax+4] ; discard first 4 bytes
569
    call    populate_local_tree_list.read_new_dir
569
    call    populate_local_tree_list.read_new_dir
570
    ;stdcall [tl_draw], tree1
570
    ;stdcall [tl_draw], tree1
571
    ret
571
    ret
572
 
572
 
573
  @@:
573
  @@:
574
    lea     esi, [eax+4]
574
    lea     esi, [eax+4]
575
    lea     edi, [buf_cmd+5]
575
    lea     edi, [buf_cmd+5]
576
  @@:
576
  @@:
577
    movsb
577
    movsb
578
    cmp     byte[esi], 0
578
    cmp     byte[esi], 0
579
    jne     @b
579
    jne     @b
580
    mov     word[edi], 0x000a
580
    mov     word[edi], 0x000a
581
    jmp     cmd_stor
581
    jmp     cmd_stor
582
 
582
 
583
 
583
 
584
; Function to call when you press [Enter]
584
; Function to call when you press [Enter]
585
; for treelist with remote directory listing
585
; for treelist with remote directory listing
586
align 4
586
align 4
587
fun_on_enter2:
587
fun_on_enter2:
588
 
588
 
589
    stdcall [tl_node_get_data], tree2
589
    stdcall [tl_node_get_data], tree2
590
    lea     esi, [eax+4]
590
    lea     esi, [eax+4]
591
    cmp     dword[esi], 0x2E2E
591
    cmp     dword[esi], 0x2E2E
592
    jne     @f
592
    jne     @f
593
    mov     [auto_list], 1
593
    mov     [auto_list], 1
594
    jmp     cmd_cdup
594
    jmp     cmd_cdup
595
 
595
 
596
  @@:
596
  @@:
597
    cmp     word[eax], 'fo'
597
    cmp     word[eax], 'fo'
598
    je      @f
598
    je      @f
599
    lea     edi, [buf_cmd+5]
599
    lea     edi, [buf_cmd+5]
600
    jmp     .copy
600
    jmp     .copy
601
 
601
 
602
  @@:
602
  @@:
603
    lea     edi, [buf_cmd+4]
603
    lea     edi, [buf_cmd+4]
604
 
604
 
605
  .copy:
605
  .copy:
606
    movsb
606
    movsb
607
    cmp     byte[esi], 0
607
    cmp     byte[esi], 0
608
    jne     .copy
608
    jne     .copy
609
    mov     word[edi], 0x000a ; extra character before 0 to compensate for
609
    mov     word[edi], 0x000a ; extra character before 0 to compensate for
610
                                ; newline in console code
610
                                ; newline in console code
611
    cmp     word[eax], 'fo'
611
    cmp     word[eax], 'fo'
612
    je      @f
612
    je      @f
613
    jmp     cmd_retr
613
    jmp     cmd_retr
614
 
614
 
615
  @@:
615
  @@:
616
    stdcall [tl_info_clear], tree2
616
    stdcall [tl_info_clear], tree2
617
    mov     [auto_list], 1
617
    mov     [auto_list], 1
618
    jmp     cmd_cwd
618
    jmp     cmd_cwd
619
 
619
 
620
 
620
 
621
;;================================================================================================;;
621
;;================================================================================================;;
622
populate_local_tree_list: ;///////////////////////////////////////////////////////////////////////;;
622
populate_local_tree_list: ;///////////////////////////////////////////////////////////////////////;;
623
;;------------------------------------------------------------------------------------------------;;
623
;;------------------------------------------------------------------------------------------------;;
624
;? Update tree1 with file names from current working directory                                    ;;
624
;? Update tree1 with file names from current working directory                                    ;;
625
;;------------------------------------------------------------------------------------------------;;
625
;;------------------------------------------------------------------------------------------------;;
626
;> none                                                                                           ;;
626
;> none                                                                                           ;;
627
;;------------------------------------------------------------------------------------------------;;
627
;;------------------------------------------------------------------------------------------------;;
628
;< none                                                                                           ;;
628
;< none                                                                                           ;;
629
;;================================================================================================;;
629
;;================================================================================================;;
630
 
630
 
631
    mov     [filestruct.subfn], 1
631
    mov     [filestruct.subfn], 1
632
    mov     [filestruct.size], 32
632
    mov     [filestruct.size], 32
633
    mov     [filestruct.ptr], folder_data
633
    mov     [filestruct.ptr], folder_data
634
    mov     ecx, root_dir
634
    mov     ecx, root_dir
635
 
635
 
636
  .read_new_dir: ; ecx = pointer to folder name
636
  .read_new_dir: ; ecx = pointer to folder name
637
    ; parse ".."
637
    ; parse ".."
638
    cmp     word[ecx], '..'
638
    cmp     word[ecx], '..'
639
    jne     @f
639
    jne     @f
640
    cmp     byte[ecx+2], 0
640
    cmp     byte[ecx+2], 0
641
    jne     @f
641
    jne     @f
642
 
642
 
643
    ; removes last file name from filestruct.name
643
    ; removes last file name from filestruct.name
644
    mcall   30, 2, filestruct.name,1024 ; get absolute path for cwd
644
    mcall   30, 2, filestruct.name,1024 ; get absolute path for cwd
645
    lea     edi, [filestruct.name+eax] ; edi = pointer to the tail of file name
645
    lea     edi, [filestruct.name+eax] ; edi = pointer to the tail of file name
646
    mov     al, '/'
646
    mov     al, '/'
647
    mov     ecx, -1
647
    mov     ecx, -1
648
    std
648
    std
649
    repne   scasb
649
    repne   scasb
650
    cld
650
    cld
651
    mov     byte[edi+1], 0
651
    mov     byte[edi+1], 0
652
    mov     ecx, filestruct.name
652
    mov     ecx, filestruct.name
653
 
653
 
654
  @@:
654
  @@:
655
    mcall   30, 1, ; set cwd
655
    mcall   30, 1, ; set cwd
656
    mcall   30, 2, filestruct.name, 1024 ; get absolute path for cwd
656
    mcall   30, 2, filestruct.name, 1024 ; get absolute path for cwd
657
    ; clear all nodes in tree list
657
    ; clear all nodes in tree list
658
    stdcall [tl_info_clear], tree1
658
    stdcall [tl_info_clear], tree1
659
    mov     [filestruct.offset], 0
659
    mov     [filestruct.offset], 0
660
 
660
 
661
  ; read 32 blocks
661
  ; read 32 blocks
662
  .outer:
662
  .outer:
663
    mcall   70, filestruct
663
    mcall   70, filestruct
664
    ;int3
664
    ;int3
665
    test    eax, eax
665
    test    eax, eax
666
    jz      @f
666
    jz      @f
667
    cmp     eax, 6 ; EOF
667
    cmp     eax, 6 ; EOF
668
    je      @f
668
    je      @f
669
    call    error_fs
669
    call    error_fs
670
    jmp     .done
670
    jmp     .done
671
  @@:
671
  @@:
672
    test    ebx, ebx
672
    test    ebx, ebx
673
    je      .done ; when no. of blocks is multiple of 32
673
    je      .done ; when no. of blocks is multiple of 32
674
    add     [filestruct.offset], ebx
674
    add     [filestruct.offset], ebx
675
    mov     ecx, ebx
675
    mov     ecx, ebx
676
    mov     edx, folder_data+32+40 ; pointer to first file's name in BDFE
676
    mov     edx, folder_data+32+40 ; pointer to first file's name in BDFE
677
 
677
 
678
  .inner:   ; ebx = total number of BDFEs
678
  .inner:   ; ebx = total number of BDFEs
679
            ; ecx = number of BDFEs remaining
679
            ; ecx = number of BDFEs remaining
680
            ; edx = pointer to file's name in BDFE
680
            ; edx = pointer to file's name in BDFE
681
    ; ignore "." entry
681
    ; ignore "." entry
682
    cmp     word[edx], 0x002E
682
    cmp     word[edx], 0x002E
683
    je      .added
683
    je      .added
684
    ; copy file/folder name to node_entry
684
    ; copy file/folder name to node_entry
685
    mov     esi, edx
685
    mov     esi, edx
686
    mov     edi, node_entry+4
686
    mov     edi, node_entry+4
687
  @@:
687
  @@:
688
    movsb
688
    movsb
689
    cmp     byte [esi-1], 0
689
    cmp     byte [esi-1], 0
690
    jne     @b
690
    jne     @b
691
    ; check whether this is a file or a folder
691
    ; check whether this is a file or a folder
692
    mov     al, byte[edx-40]
692
    mov     al, byte[edx-40]
693
    and     al, 0x10
693
    and     al, 0x10
694
    jz      @f
694
    jz      @f
695
    ; add a folder to tree
695
    ; add a folder to tree
696
    mov     word[node_entry], 'fo'
696
    mov     word[node_entry], 'fo'
697
    stdcall [tl_node_add], tree1, 0x10000, node_entry
697
    stdcall [tl_node_add], tree1, 0x10000, node_entry
698
    jmp     .added
698
    jmp     .added
699
 
699
 
700
  @@:
700
  @@:
701
    ; add a file to tree
701
    ; add a file to tree
702
    mov     word[node_entry], 'fi'
702
    mov     word[node_entry], 'fi'
703
    stdcall [tl_node_add], tree1, 0, node_entry
703
    stdcall [tl_node_add], tree1, 0, node_entry
704
 
704
 
705
  .added:
705
  .added:
706
    add     edx, 304 ; 304 = length of BDFE. jump to next file's name
706
    add     edx, 304 ; 304 = length of BDFE. jump to next file's name
707
    loop    .inner
707
    loop    .inner
708
    stdcall [tl_draw], tree1
708
    stdcall [tl_draw], tree1
709
    cmp     ebx, 32
709
    cmp     ebx, 32
710
    je      .outer ; more BDFEs to come
710
    je      .outer ; more BDFEs to come
711
 
711
 
712
  .done:
712
  .done:
713
    ret    
713
    ret    
714
 
714
 
715
 
715
 
716
MIN_M_WND_H equ 500 ;
716
MIN_M_WND_H equ 500 ;
717
;input:
717
;input:
718
; edi = pointer to tedit struct
718
; edi = pointer to tedit struct
719
align 4
719
align 4
720
EvSize:
720
EvSize:
721
    pushad
721
    pushad
722
    mov     ebx, ted_scr_h
722
    mov     ebx, ted_scr_h
723
    mov     esi, ted_scr_w
723
    mov     esi, ted_scr_w
724
 
724
 
725
    m2m     ted_wnd_w, [procinfo.client_box.width]
725
    m2m     ted_wnd_w, [procinfo.client_box.width]
726
    mov     eax, ted_wnd_l
726
    mov     eax, ted_wnd_l
727
    sub     ted_wnd_w, eax
727
    sub     ted_wnd_w, eax
728
    sub     ted_wnd_w, 70
728
    sub     ted_wnd_w, 70
729
    movzx   eax, word[esi+sb_offs_size_x]
729
    movzx   eax, word[esi+sb_offs_size_x]
730
    sub     ted_wnd_w, eax
730
    sub     ted_wnd_w, eax
731
 
731
 
732
    ;m2m    ted_wnd_h,[procinfo.client_box.height] ;
732
    ;m2m    ted_wnd_h,[procinfo.client_box.height] ;
733
    ;cmp    ted_wnd_h,MIN_M_WND_H
733
    ;cmp    ted_wnd_h,MIN_M_WND_H
734
    ;jg     @f
734
    ;jg     @f
735
    mov     ted_wnd_h, MIN_M_WND_H
735
    mov     ted_wnd_h, MIN_M_WND_H
736
    ;@@:
736
    ;@@:
737
 
737
 
738
    movzx   eax, word[ebx+sb_offs_size_y]
738
    movzx   eax, word[ebx+sb_offs_size_y]
739
    sub     ted_wnd_h, eax
739
    sub     ted_wnd_h, eax
740
    mov     eax, ted_wnd_t
740
    mov     eax, ted_wnd_t
741
    sub     ted_wnd_h, eax
741
    sub     ted_wnd_h, eax
742
 
742
 
743
    stdcall [ted_init_scroll_bars], tedit0,2
743
    stdcall [ted_init_scroll_bars], tedit0,2
744
 
744
 
745
    popad
745
    popad
746
    ret
746
    ret
747
 
747
 
748
 
748
 
749
;;================================================================================================;;
749
;;================================================================================================;;
750
filter_remote_list: ;/////////////////////////////////////////////////////////////////////////////;;
750
filter_remote_list: ;/////////////////////////////////////////////////////////////////////////////;;
751
;;------------------------------------------------------------------------------------------------;;
751
;;------------------------------------------------------------------------------------------------;;
752
;? Filter tree list according to pattern specified in 'filter'                                    ;;
752
;? Filter tree list according to pattern specified in 'filter'                                    ;;
753
;;------------------------------------------------------------------------------------------------;;
753
;;------------------------------------------------------------------------------------------------;;
754
;> none                                                                                           ;;
754
;> none                                                                                           ;;
755
;;------------------------------------------------------------------------------------------------;;
755
;;------------------------------------------------------------------------------------------------;;
756
;< none                                                                                           ;;
756
;< none                                                                                           ;;
757
;;================================================================================================;;
757
;;================================================================================================;;
758
        stdcall [tl_cur_beg], tree2
758
        stdcall [tl_cur_beg], tree2
759
 
759
 
760
    .next_node:
760
    .next_node:
761
        stdcall [tl_node_get_data], tree2
761
        stdcall [tl_node_get_data], tree2
762
        ; check whether any nodes left
762
        ; check whether any nodes left
763
        test    eax, eax
763
        test    eax, eax
764
        jnz     @f
764
        jnz     @f
765
        stdcall [tl_draw], tree2
765
        stdcall [tl_draw], tree2
766
        stdcall dword[edit_box_set_text], edit_search, str_null
766
        stdcall dword[edit_box_set_text], edit_search, str_null
767
        je      gui.still
767
        je      gui.still
768
 
768
 
769
    @@:
769
    @@:
770
        cmp     byte[filter], 0
770
        cmp     byte[filter], 0
771
        je      gui.still
771
        je      gui.still
772
 
772
 
773
        ; calculate size of node entry
773
        ; calculate size of node entry
774
        lea     esi, [eax+4]
774
        lea     esi, [eax+4]
775
        mov     edi, esi
775
        mov     edi, esi
776
        mov     ecx, -1
776
        mov     ecx, -1
777
    @@:
777
    @@:
778
        lodsb
778
        lodsb
779
        inc     ecx
779
        inc     ecx
780
        test    al, al
780
        test    al, al
781
        jnz     @b
781
        jnz     @b
782
 
782
 
783
        ; calculate size of pattern
783
        ; calculate size of pattern
784
        mov     esi, filter
784
        mov     esi, filter
785
        mov     edx, -1
785
        mov     edx, -1
786
    @@:
786
    @@:
787
        lodsb
787
        lodsb
788
        inc     edx
788
        inc     edx
789
        test    al, al
789
        test    al, al
790
        jnz     @b
790
        jnz     @b
791
 
791
 
792
        mov     esi, filter
792
        mov     esi, filter
793
 
793
 
794
        call    search
794
        call    search
795
        pop     esi
795
        pop     esi
796
        test    al, al
796
        test    al, al
797
 
797
 
798
        jnz     .get_next
798
        jnz     .get_next
799
        stdcall [tl_node_delete], tree2
799
        stdcall [tl_node_delete], tree2
800
        jmp     @f
800
        jmp     @f
801
 
801
 
802
    .get_next:
802
    .get_next:
803
        stdcall [tl_cur_next], tree2
803
        stdcall [tl_cur_next], tree2
804
 
804
 
805
    @@:
805
    @@:
806
        jmp     .next_node
806
        jmp     .next_node
807
 
807
 
808
 
808
 
809
;;================================================================================================;;
809
;;================================================================================================;;
810
search: ;/////////////////////////////////////////////////////////////////////////////////////////;;
810
search: ;/////////////////////////////////////////////////////////////////////////////////////////;;
811
;;------------------------------------------------------------------------------------------------;;
811
;;------------------------------------------------------------------------------------------------;;
812
;? Search for a substring within a string                                                         ;;
812
;? Search for a substring within a string                                                         ;;
813
;;------------------------------------------------------------------------------------------------;;
813
;;------------------------------------------------------------------------------------------------;;
814
;> edi = pointer to haystack                                                                      ;;
814
;> edi = pointer to haystack                                                                      ;;
815
;> ecx = size of haystack                                                                         ;;
815
;> ecx = size of haystack                                                                         ;;
816
;> esi = pointer to needle                                                                        ;;
816
;> esi = pointer to needle                                                                        ;;
817
;> edx = size of needle                                                                           ;;
817
;> edx = size of needle                                                                           ;;
818
;;------------------------------------------------------------------------------------------------;;
818
;;------------------------------------------------------------------------------------------------;;
819
;< al = 0 (not found) / 1 (found)                                                                 ;;
819
;< al = 0 (not found) / 1 (found)                                                                 ;;
820
;;================================================================================================;;
820
;;================================================================================================;;
821
    
821
    
822
    push    ebx ecx edx esi edi
822
    push    ebx ecx edx esi edi
823
    ; if length of haystack < length of needle
823
    ; if length of haystack < length of needle
824
    cmp     ecx, edx
824
    cmp     ecx, edx
825
    jge     @f
825
    jge     @f
826
    mov     bh, 0
826
    mov     bh, 0
827
    jmp     .done
827
    jmp     .done
828
  @@:
828
  @@:
829
    mov     bh, 1 ; flag (0 = not found, 1 = found)
829
    mov     bh, 1 ; flag (0 = not found, 1 = found)
830
    sub     ecx, edx
830
    sub     ecx, edx
831
    dec     edi
831
    dec     edi
832
 
832
 
833
  .outer:
833
  .outer:
834
    cmp     ecx, 0
834
    cmp     ecx, 0
835
    jl      .done
835
    jl      .done
836
    dec     ecx
836
    dec     ecx
837
    inc     edi
837
    inc     edi
838
    mov     bh, 1 ; flag (0 = not found, 1 = found)
838
    mov     bh, 1 ; flag (0 = not found, 1 = found)
839
    mov     edx, [esp+8]
839
    mov     edx, [esp+8]
840
    mov     esi, [esp+4]
840
    mov     esi, [esp+4]
841
 
841
 
842
  .inner:
842
  .inner:
843
    test    edx, edx
843
    test    edx, edx
844
    jz      .done
844
    jz      .done
845
    dec     edx
845
    dec     edx
846
 
846
 
847
    mov     eax, esi
847
    mov     eax, esi
848
    sub     eax, [esp+4]
848
    sub     eax, [esp+4]
849
    mov     al, byte[edi+eax]
849
    mov     al, byte[edi+eax]
850
    mov     bl, byte[esi]
850
    mov     bl, byte[esi]
851
 
851
 
852
    inc     esi
852
    inc     esi
853
    cmp     al, bl
853
    cmp     al, bl
854
    je      .inner
854
    je      .inner
855
    mov     bh, 0
855
    mov     bh, 0
856
    jmp     .outer
856
    jmp     .outer
857
 
857
 
858
 
858
 
859
  .done:
859
  .done:
860
    mov     al, bh
860
    mov     al, bh
861
    pop     edi esi edx ecx ebx
861
    pop     edi esi edx ecx ebx
862
    ret
862
    ret
863
 
863
 
864
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
864
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
865
 
865
 
866
;hed             db 'FTP Client for KolibriOS',0
866
;hed             db 'FTP Client for KolibriOS',0
867
str_change      db 'Change',0
867
str_change      db 'Change',0
868
str_disconnect  db 'Disconnect',0
868
str_disconnect  db 'Disconnect',0
869
str_copy        db 'Copy',0
869
str_copy        db 'Copy',0
870
str_mkd         db 'MKD',0
870
str_mkd         db 'MKD',0
871
str_dele        db 'DELE',0
871
str_dele        db 'DELE',0
872
str_rdir        db 'RDIR',0
872
str_rdir        db 'RDIR',0
873
str_rmd         db 'RMD',0
873
str_rmd         db 'RMD',0
874
str_abort       db 'Cancel',0
874
str_abort       db 'Cancel',0
875
str_search      db 'Search',0
875
str_search      db 'Search',0
876
str_list        db 'LIST',0
876
str_list        db 'LIST',0
877
str_null        db 0
877
str_null        db 0
878
 
878
 
879
;----------------------
879
;----------------------
880
; tree list elements
880
; tree list elements
881
;----------------------
881
;----------------------
882
tree1 tree_list 64, 500, tl_list_box_mode, 16, 16, \
882
tree1 tree_list 64, 500, tl_list_box_mode, 16, 16, \
883
    0xffffff, BT_COL, 0x000000, TLIST1_X, 105, TLIST_SZ-16, 185, 14, 4,\
883
    0xffffff, BT_COL, 0x000000, TLIST1_X, 105, TLIST_SZ-16, 185, 14, 4,\
884
    0, el_focus, wScr, fun_on_enter
884
    0, el_focus, wScr, fun_on_enter
885
 
885
 
886
tree2 tree_list 64, 500, tl_list_box_mode, 16, 16, \
886
tree2 tree_list 64, 500, tl_list_box_mode, 16, 16, \
887
    0xffffff, BT_COL, 0x000000, TLIST2_X, 105, TLIST_SZ-16, 185, 14, 4, \
887
    0xffffff, BT_COL, 0x000000, TLIST2_X, 105, TLIST_SZ-16, 185, 14, 4, \
888
    0, el_focus, wScr2, fun_on_enter2
888
    0, el_focus, wScr2, fun_on_enter2
889
 
889
 
890
; editbox for mkd
890
; editbox for mkd
891
edit_mkd edit_box TLIST_SZ-45, TLIST2_X, 80, 0xffffff, 0x94AECE, 0, \
891
edit_mkd edit_box TLIST_SZ-45, TLIST2_X, 80, 0xffffff, 0x94AECE, 0, \
892
    0xAABBCC, 0x10000000, 63, new_dir_buf, mouse_dd, 0
892
    0xAABBCC, 0x10000000, 63, new_dir_buf, mouse_dd, 0
893
 
893
 
894
; editbox for default volume
894
; editbox for default volume
895
edit_volume edit_box TLIST_SZ-60, TLIST1_X, 80, 0xffffff, 0x94AECE, 0, \
895
edit_volume edit_box TLIST_SZ-60, TLIST1_X, 80, 0xffffff, 0x94AECE, 0, \
896
    0xAABBCC, 0x10000000, 99, root_dir, mouse_dd, 0
896
    0xAABBCC, 0x10000000, 99, root_dir, mouse_dd, 0
897
 
897
 
898
; editbox for search
898
; editbox for search
899
edit_search edit_box TLIST_SZ-60, TLIST2_X, 22, 0xffffff, 0x94AECE, 0, \
899
edit_search edit_box TLIST_SZ-60, TLIST2_X, 22, 0xffffff, 0x94AECE, 0, \
900
    0xAABBCC, 0x10000000, 99, filter,mouse_dd, 0
900
    0xAABBCC, 0x10000000, 99, filter,mouse_dd, 0
901
 
901
 
902
; A subsidiary structure for scrolling
902
; A subsidiary structure for scrolling
903
align 4
903
align 4
904
wScr:
904
wScr:
905
    .x:
905
    .x:
906
    .size_x     dw 16 ;+0
906
    .size_x     dw 16 ;+0
907
    .start_x    dw 250+50-16 ;+2
907
    .start_x    dw 250+50-16 ;+2
908
    .y:
908
    .y:
909
    .size_y     dw 185 ;+4
909
    .size_y     dw 185 ;+4
910
    .start_y    dw 105 ;+6
910
    .start_y    dw 105 ;+6
911
    .btn_high   dd 15 ;+8
911
    .btn_high   dd 15 ;+8
912
    .type       dd 1  ;+12
912
    .type       dd 1  ;+12
913
    .max_area   dd 100  ;+16
913
    .max_area   dd 100  ;+16
914
    .cur_area   dd 30  ;+20
914
    .cur_area   dd 30  ;+20
915
    .position   dd 0  ;+24
915
    .position   dd 0  ;+24
916
    .bckg_col   dd 0xeeeeee ;+28
916
    .bckg_col   dd 0xeeeeee ;+28
917
    .frnt_col   dd 0xbbddff ;+32
917
    .frnt_col   dd 0xbbddff ;+32
918
    .line_col   dd 0  ;+36
918
    .line_col   dd 0  ;+36
919
    .redraw     dd 0  ;+40
919
    .redraw     dd 0  ;+40
920
    .delta      dw 0  ;+44
920
    .delta      dw 0  ;+44
921
    .delta2     dw 0  ;+46
921
    .delta2     dw 0  ;+46
922
    .run_x:
922
    .run_x:
923
    .r_size_x   dw 0  ;+48
923
    .r_size_x   dw 0  ;+48
924
    .r_start_x  dw 0  ;+50
924
    .r_start_x  dw 0  ;+50
925
    .run_y:
925
    .run_y:
926
    .r_size_y   dw 0 ;+52
926
    .r_size_y   dw 0 ;+52
927
    .r_start_y  dw 0 ;+54
927
    .r_start_y  dw 0 ;+54
928
    .m_pos      dd 0 ;+56
928
    .m_pos      dd 0 ;+56
929
    .m_pos_2    dd 0 ;+60
929
    .m_pos_2    dd 0 ;+60
930
    .m_keys     dd 0 ;+64
930
    .m_keys     dd 0 ;+64
931
    .run_size   dd 0 ;+68
931
    .run_size   dd 0 ;+68
932
    .position2  dd 0 ;+72
932
    .position2  dd 0 ;+72
933
    .work_size  dd 0 ;+76
933
    .work_size  dd 0 ;+76
934
    .all_redraw dd 0 ;+80
934
    .all_redraw dd 0 ;+80
935
    .ar_offset  dd 1 ;+84
935
    .ar_offset  dd 1 ;+84
936
 
936
 
937
align 4
937
align 4
938
wScr2:
938
wScr2:
939
    .x:
939
    .x:
940
    .size_x     dw 16 ;+0
940
    .size_x     dw 16 ;+0
941
    .start_x    dw 675+50-16 ;+2
941
    .start_x    dw 675+50-16 ;+2
942
    .y:
942
    .y:
943
    .size_y     dw 185 ;+4
943
    .size_y     dw 185 ;+4
944
    .start_y    dw 105 ;+6
944
    .start_y    dw 105 ;+6
945
    .btn_high   dd 15 ;+8
945
    .btn_high   dd 15 ;+8
946
    .type       dd 1  ;+12
946
    .type       dd 1  ;+12
947
    .max_area   dd 100  ;+16
947
    .max_area   dd 100  ;+16
948
    .cur_area   dd 30  ;+20
948
    .cur_area   dd 30  ;+20
949
    .position   dd 0  ;+24
949
    .position   dd 0  ;+24
950
    .bckg_col   dd 0xeeeeee ;+28
950
    .bckg_col   dd 0xeeeeee ;+28
951
    .frnt_col   dd 0xbbddff ;+32
951
    .frnt_col   dd 0xbbddff ;+32
952
    .line_col   dd 0  ;+36
952
    .line_col   dd 0  ;+36
953
    .redraw     dd 0  ;+40
953
    .redraw     dd 0  ;+40
954
    .delta      dw 0  ;+44
954
    .delta      dw 0  ;+44
955
    .delta2     dw 0  ;+46
955
    .delta2     dw 0  ;+46
956
    .run_x:
956
    .run_x:
957
    .r_size_x   dw 0  ;+48
957
    .r_size_x   dw 0  ;+48
958
    .r_start_x  dw 0  ;+50
958
    .r_start_x  dw 0  ;+50
959
    .run_y:
959
    .run_y:
960
    .r_size_y   dw 0 ;+52
960
    .r_size_y   dw 0 ;+52
961
    .r_start_y  dw 0 ;+54
961
    .r_start_y  dw 0 ;+54
962
    .m_pos      dd 0 ;+56
962
    .m_pos      dd 0 ;+56
963
    .m_pos_2    dd 0 ;+60
963
    .m_pos_2    dd 0 ;+60
964
    .m_keys     dd 0 ;+64
964
    .m_keys     dd 0 ;+64
965
    .run_size   dd 0 ;+68
965
    .run_size   dd 0 ;+68
966
    .position2  dd 0 ;+72
966
    .position2  dd 0 ;+72
967
    .work_size  dd 0 ;+76
967
    .work_size  dd 0 ;+76
968
    .all_redraw dd 0 ;+80
968
    .all_redraw dd 0 ;+80
969
    .ar_offset  dd 1 ;+84
969
    .ar_offset  dd 1 ;+84
970
;----------------------
970
;----------------------
971
; end tree list element
971
; end tree list element
972
;----------------------
972
;----------------------
973
 
973
 
974
;----------------------
974
;----------------------
975
; textedit elements
975
; textedit elements
976
;----------------------
976
;----------------------
977
align 4
977
align 4
978
tedit0:
978
tedit0:
979
    .wnd BOX 50,355,325,240 ;+ 0 195,5+40,325,240
979
    .wnd BOX 50,355,325,240 ;+ 0 195,5+40,325,240
980
    .rec BOX 30,13,6,10   ;+16
980
    .rec BOX 30,13,6,10   ;+16
981
    .drag_m db 0 ;+32
981
    .drag_m db 0 ;+32
982
    .drag_k db 0 ;+33
982
    .drag_k db 0 ;+33
983
    .sel rb 16 ;+34
983
    .sel rb 16 ;+34
984
    .seln rb 16 ;+50
984
    .seln rb 16 ;+50
985
    .tex      dd 0 ;+66 text memory pointer
985
    .tex      dd 0 ;+66 text memory pointer
986
    .tex_1    dd 0 ;+70 text first symbol pointer
986
    .tex_1    dd 0 ;+70 text first symbol pointer
987
    .tex_end  dd 0 ;+74 text end memory pointer
987
    .tex_end  dd 0 ;+74 text end memory pointer
988
    .cur_x    dd 0 ;+78
988
    .cur_x    dd 0 ;+78
989
    .cur_y    dd 0 ;+82
989
    .cur_y    dd 0 ;+82
990
    .max_chars dd 4096 ;+86
990
    .max_chars dd 4096 ;+86
991
    .count_colors_text dd 1 ;+90
991
    .count_colors_text dd 1 ;+90
992
    .count_key_words   dd 0 ;+94
992
    .count_key_words   dd 0 ;+94
993
    .color_cursor      dd SYS_COL  ;+98
993
    .color_cursor      dd SYS_COL  ;+98
994
    .color_wnd_capt    dd BT_COL   ;+102
994
    .color_wnd_capt    dd BT_COL   ;+102
995
    .color_wnd_work    dd 0xffffff ;+106
995
    .color_wnd_work    dd 0xffffff ;+106
996
    .color_wnd_bord    dd 0x737373 ;+110
996
    .color_wnd_bord    dd 0x737373 ;+110
997
    .color_select      dd 0xA4C4E4 ;+114
997
    .color_select      dd 0xA4C4E4 ;+114
998
    .color_cur_text    dd 0xffff00 ;+118
998
    .color_cur_text    dd 0xffff00 ;+118
999
    .color_wnd_text    dd 0x000000 ;+122
999
    .color_wnd_text    dd 0x000000 ;+122
1000
    .syntax_file       dd 0 ;+126
1000
    .syntax_file       dd 0 ;+126
1001
    .syntax_file_size  dd 500 ;+130
1001
    .syntax_file_size  dd 500 ;+130
1002
    .text_colors       dd 0 ;+134
1002
    .text_colors       dd 0 ;+134
1003
    .help_text_f1      dd 0 ;+138
1003
    .help_text_f1      dd 0 ;+138
1004
    .help_id       dd -1 ;+142
1004
    .help_id       dd -1 ;+142
1005
    .key_words_data    dd 0 ;+146
1005
    .key_words_data    dd 0 ;+146
1006
    .tim_ch      dd ? ;+150
1006
    .tim_ch      dd ? ;+150
1007
    .tim_undo    dd ? ;+154
1007
    .tim_undo    dd ? ;+154
1008
    .tim_ls      dd ? ;+158
1008
    .tim_ls      dd ? ;+158
1009
    .tim_co      dd ? ;+162
1009
    .tim_co      dd ? ;+162
1010
    .el_focus    dd el_focus ;+166
1010
    .el_focus    dd el_focus ;+166
1011
    .err_save    db 0 ;+170
1011
    .err_save    db 0 ;+170
1012
    .panel_id    db 0 ;+171
1012
    .panel_id    db 0 ;+171
1013
    .key_new     db 0 ;+172
1013
    .key_new     db 0 ;+172
1014
    .symbol_new_line db 20 ;+173
1014
    .symbol_new_line db 20 ;+173
1015
    .scr_w       dd scrol_w1 ;+174
1015
    .scr_w       dd scrol_w1 ;+174
1016
    .scr_h       dd scrol_h1 ;+178
1016
    .scr_h       dd scrol_h1 ;+178
1017
    .arr_key_pos dd 0 ;+182
1017
    .arr_key_pos dd 0 ;+182
1018
    .buffer      dd ed_buffer ;+186
1018
    .buffer      dd ed_buffer ;+186
1019
    .buffer_find dd 0 ;+190
1019
    .buffer_find dd 0 ;+190
1020
    .cur_ins     db 1 ;+194
1020
    .cur_ins     db 1 ;+194
1021
    .mode_color  db 1 ;+195
1021
    .mode_color  db 1 ;+195
1022
    .mode_invis  db 0 ;+196
1022
    .mode_invis  db 0 ;+196
1023
    .gp_opt      db 0 ;+197
1023
    .gp_opt      db 0 ;+197
1024
    dd 0 ;.fun_on_key_ctrl_all dd but_ctrl_all ;+198 
1024
    dd 0 ;.fun_on_key_ctrl_all dd but_ctrl_all ;+198 
1025
    dd 0,0,0 ;reserved
1025
    dd 0,0,0 ;reserved
1026
    .buffer_size       dd 4096 ;+214
1026
    .buffer_size       dd 4096 ;+214
1027
    .fun_find_err      dd 0 ;+218
1027
    .fun_find_err      dd 0 ;+218
1028
    .fun_init_synt_err dd 0 ;+222
1028
    .fun_init_synt_err dd 0 ;+222
1029
    .fun_draw_panel_buttons dd 0 ;+226
1029
    .fun_draw_panel_buttons dd 0 ;+226
1030
    .fun_draw_panels    dd 0 ;+230
1030
    .fun_draw_panels    dd 0 ;+230
1031
    dd 0 ;+234 reserved
1031
    dd 0 ;+234 reserved
1032
    .fun_save_err       dd 0 ;+238
1032
    .fun_save_err       dd 0 ;+238
1033
    .increase_size dd 1000 ;+242
1033
    .increase_size dd 1000 ;+242
1034
    .ptr_free_symb dd ? ;+246
1034
    .ptr_free_symb dd ? ;+246
1035
    .font_size     dd 16 shl 16 ; +250
1035
    .font_size     dd 16 shl 16 ; +250
1036
 
1036
 
1037
align 4
1037
align 4
1038
scrol_w1:
1038
scrol_w1:
1039
    .x:
1039
    .x:
1040
    .size_x   dw 16 ;+0
1040
    .size_x   dw 16 ;+0
1041
    .start_x  dw 85 ;+2
1041
    .start_x  dw 85 ;+2
1042
    .y:
1042
    .y:
1043
    .size_y   dw 100 ; +4
1043
    .size_y   dw 100 ; +4
1044
    .start_y  dw  15 ; +6
1044
    .start_y  dw  15 ; +6
1045
    .btn_high dd  15 ; +8
1045
    .btn_high dd  15 ; +8
1046
    .type     dd   1 ;+12
1046
    .type     dd   1 ;+12
1047
    .max_area dd 100 ;+16
1047
    .max_area dd 100 ;+16
1048
    rb 4+4
1048
    rb 4+4
1049
    .bckg_col dd 0xeeeeee ;+28
1049
    .bckg_col dd 0xeeeeee ;+28
1050
    .frnt_col dd 0xbbddff ;+32
1050
    .frnt_col dd 0xbbddff ;+32
1051
    .line_col dd 0x808080 ;+36
1051
    .line_col dd 0x808080 ;+36
1052
    .redraw   dd   0 ;+40
1052
    .redraw   dd   0 ;+40
1053
    .delta    dw   0 ;+44
1053
    .delta    dw   0 ;+44
1054
    .delta2   dw   0 ;+46
1054
    .delta2   dw   0 ;+46
1055
    .run_x:
1055
    .run_x:
1056
    rb 2*4+4*6
1056
    rb 2*4+4*6
1057
    .all_redraw dd 0 ;+80
1057
    .all_redraw dd 0 ;+80
1058
    .ar_offset  dd 1 ;+84
1058
    .ar_offset  dd 1 ;+84
1059
;---------------------------------------------------------------------
1059
;---------------------------------------------------------------------
1060
align 4
1060
align 4
1061
scrol_h1:
1061
scrol_h1:
1062
    .x:
1062
    .x:
1063
    .size_x     dw 85 ;+0
1063
    .size_x     dw 85 ;+0
1064
    .start_x    dw 30 ;+2
1064
    .start_x    dw 30 ;+2
1065
    .y:
1065
    .y:
1066
    .size_y     dw 16 ;+4
1066
    .size_y     dw 16 ;+4
1067
    .start_y    dw 100 ;+6
1067
    .start_y    dw 100 ;+6
1068
    .btn_high   dd 15 ;+8
1068
    .btn_high   dd 15 ;+8
1069
    .type       dd 1  ;+12
1069
    .type       dd 1  ;+12
1070
    .max_area   dd 100 ;+16
1070
    .max_area   dd 100 ;+16
1071
    rb 4+4
1071
    rb 4+4
1072
    .bckg_col   dd 0xeeeeee ;+28
1072
    .bckg_col   dd 0xeeeeee ;+28
1073
    .frnt_col   dd 0xbbddff ;+32
1073
    .frnt_col   dd 0xbbddff ;+32
1074
    .line_col   dd 0x808080 ;+36
1074
    .line_col   dd 0x808080 ;+36
1075
    .redraw     dd 0  ;+40
1075
    .redraw     dd 0  ;+40
1076
    .delta      dw 0  ;+44
1076
    .delta      dw 0  ;+44
1077
    .delta2     dw 0  ;+46
1077
    .delta2     dw 0  ;+46
1078
    .run_x:
1078
    .run_x:
1079
    rb 2*4+4*6
1079
    rb 2*4+4*6
1080
    .all_redraw dd 0 ;+80
1080
    .all_redraw dd 0 ;+80
1081
    .ar_offset  dd 1 ;+84
1081
    .ar_offset  dd 1 ;+84
1082
 
1082
 
1083
;------------
1083
;------------
1084
;Progress bar
1084
;Progress bar
1085
;------------
1085
;------------
1086
struc pb
1086
struc pb
1087
{
1087
{
1088
    dd 0  ; PB_VALUE          equ +0
1088
    dd 0  ; PB_VALUE          equ +0
1089
    dd (TLIST2_X+TLIST1_X+TLIST_SZ)/2-150 ; PB_LEFT equ +4. 150 = PB_WIDTH/2
1089
    dd (TLIST2_X+TLIST1_X+TLIST_SZ)/2-150 ; PB_LEFT equ +4. 150 = PB_WIDTH/2
1090
    dd 315; PB_TOP            equ +8
1090
    dd 315; PB_TOP            equ +8
1091
    dd 300; PB_WIDTH          equ +12
1091
    dd 300; PB_WIDTH          equ +12
1092
    dd 15 ; PB_HEIGHT         equ +16
1092
    dd 15 ; PB_HEIGHT         equ +16
1093
    dd ?  ; PB_STYLE          equ +20
1093
    dd ?  ; PB_STYLE          equ +20
1094
    dd 0  ; PB_MIN            equ +24
1094
    dd 0  ; PB_MIN            equ +24
1095
    dd 100; PB_MAX            equ +28
1095
    dd 100; PB_MAX            equ +28
1096
    dd 0xffffff; PB_BACK_COLOR     equ +32
1096
    dd 0xffffff; PB_BACK_COLOR     equ +32
1097
    dd 0x00ff40; PB_PROGRESS_COLOR equ +36
1097
    dd 0x00ff40; PB_PROGRESS_COLOR equ +36
1098
    dd 0x808080; PB_FRAME_COLOR    equ +40
1098
    dd 0x808080; PB_FRAME_COLOR    equ +40
1099
}
1099
}
1100
pb pb
1100
pb pb
1101
 
1101
 
1102
 
1102
 
1103
align 4
1103
align 4
1104
@IMPORT_GUI_LIBS:
1104
@IMPORT_GUI_LIBS:
1105
 
1105
 
1106
library box_lib, 'box_lib.obj', libimg, 'libimg.obj'
1106
library box_lib, 'box_lib.obj', libimg, 'libimg.obj'
1107
 
1107
 
1108
import  box_lib, \
1108
import  box_lib, \
1109
        edit_box_draw,      'edit_box', \
1109
        edit_box_draw,      'edit_box_draw', \
1110
        edit_box_key,       'edit_box_key', \
1110
        edit_box_key,       'edit_box_key', \
1111
        edit_box_mouse,     'edit_box_mouse', \
1111
        edit_box_mouse,     'edit_box_mouse', \
1112
        edit_box_set_text,  'edit_box_set_text', \
1112
        edit_box_set_text,  'edit_box_set_text', \
1113
        version_ed,         'version_ed', \
1113
        version_ed,         'version_ed', \
1114
        scrollbar_ver_draw ,'scrollbar_v_draw', \
1114
        scrollbar_ver_draw ,'scrollbar_v_draw', \
1115
        scrollbar_ver_mouse,'scrollbar_v_mouse', \
1115
        scrollbar_ver_mouse,'scrollbar_v_mouse', \
1116
        scrollbar_hor_draw, 'scrollbar_h_draw', \
1116
        scrollbar_hor_draw, 'scrollbar_h_draw', \
1117
        scrollbar_hor_mouse,'scrollbar_h_mouse', \
1117
        scrollbar_hor_mouse,'scrollbar_h_mouse', \
1118
        version_scrollbar,  'version_scrollbar', \
1118
        version_scrollbar,  'version_scrollbar', \
1119
        tl_data_init,       'tl_data_init', \
1119
        tl_data_init,       'tl_data_init', \
1120
        tl_data_clear,      'tl_data_clear', \
1120
        tl_data_clear,      'tl_data_clear', \
1121
        tl_info_clear,      'tl_info_clear', \
1121
        tl_info_clear,      'tl_info_clear', \
1122
        tl_key,             'tl_key', \
1122
        tl_key,             'tl_key', \
1123
        tl_mouse,           'tl_mouse', \
1123
        tl_mouse,           'tl_mouse', \
1124
        tl_draw,            'tl_draw', \
1124
        tl_draw,            'tl_draw', \
1125
        tl_node_add,        'tl_node_add', \
1125
        tl_node_add,        'tl_node_add', \
1126
        tl_node_set_data,   'tl_node_set_data', \
1126
        tl_node_set_data,   'tl_node_set_data', \
1127
        tl_node_get_data,   'tl_node_get_data', \
1127
        tl_node_get_data,   'tl_node_get_data', \
1128
        tl_node_delete,     'tl_node_delete', \
1128
        tl_node_delete,     'tl_node_delete', \
1129
        tl_cur_beg,         'tl_cur_beg', \
1129
        tl_cur_beg,         'tl_cur_beg', \
1130
        tl_cur_next,        'tl_cur_next', \
1130
        tl_cur_next,        'tl_cur_next', \
1131
        tl_cur_perv,        'tl_cur_perv', \
1131
        tl_cur_perv,        'tl_cur_perv', \
1132
        tl_node_close_open, 'tl_node_close_open', \
1132
        tl_node_close_open, 'tl_node_close_open', \
1133
        ted_but_sumb_upper, 'ted_but_sumb_upper', \
1133
        ted_but_sumb_upper, 'ted_but_sumb_upper', \
1134
        ted_but_sumb_lover, 'ted_but_sumb_lover', \
1134
        ted_but_sumb_lover, 'ted_but_sumb_lover', \
1135
        ted_can_save,       'ted_can_save', \
1135
        ted_can_save,       'ted_can_save', \
1136
        ted_clear,          'ted_clear', \
1136
        ted_clear,          'ted_clear', \
1137
        ted_delete,         'ted_delete', \
1137
        ted_delete,         'ted_delete', \
1138
        ted_draw,           'ted_draw', \
1138
        ted_draw,           'ted_draw', \
1139
        ted_init,           'ted_init', \
1139
        ted_init,           'ted_init', \
1140
        ted_init_scroll_bars, 'ted_init_scroll_bars', \
1140
        ted_init_scroll_bars, 'ted_init_scroll_bars', \
1141
        ted_init_syntax_file, 'ted_init_syntax_file', \
1141
        ted_init_syntax_file, 'ted_init_syntax_file', \
1142
        ted_is_select,      'ted_is_select', \
1142
        ted_is_select,      'ted_is_select', \
1143
        ted_key,            'ted_key', \
1143
        ted_key,            'ted_key', \
1144
        ted_mouse,          'ted_mouse', \
1144
        ted_mouse,          'ted_mouse', \
1145
        ted_open_file,      'ted_open_file', \
1145
        ted_open_file,      'ted_open_file', \
1146
        ted_save_file,      'ted_save_file', \
1146
        ted_save_file,      'ted_save_file', \
1147
        ted_text_add,       'ted_text_add', \
1147
        ted_text_add,       'ted_text_add', \
1148
        ted_but_select_word,'ted_but_select_word', \
1148
        ted_but_select_word,'ted_but_select_word', \
1149
        ted_but_cut,        'ted_but_cut', \
1149
        ted_but_cut,        'ted_but_cut', \
1150
        ted_but_copy,       'ted_but_copy', \
1150
        ted_but_copy,       'ted_but_copy', \
1151
        ted_but_paste,      'ted_but_paste', \
1151
        ted_but_paste,      'ted_but_paste', \
1152
        ted_but_undo,       'ted_but_undo', \
1152
        ted_but_undo,       'ted_but_undo', \
1153
        ted_but_redo,       'ted_but_redo', \
1153
        ted_but_redo,       'ted_but_redo', \
1154
        ted_but_reverse,    'ted_but_reverse', \
1154
        ted_but_reverse,    'ted_but_reverse', \
1155
        ted_but_find,       'ted_but_find', \
1155
        ted_but_find,       'ted_but_find', \
1156
        ted_but_replace,    'ted_but_replace', \
1156
        ted_but_replace,    'ted_but_replace', \
1157
        ted_text_colored,   'ted_text_colored', \
1157
        ted_text_colored,   'ted_text_colored', \
1158
        ted_go_to_position, 'ted_go_to_position', \
1158
        ted_go_to_position, 'ted_go_to_position', \
1159
        progressbar_draw,   'progressbar_draw'
1159
        progressbar_draw,   'progressbar_draw'
1160
 
1160
 
1161
import  libimg, \
1161
import  libimg, \
1162
        lib_init1         , 'lib_init', \
1162
        lib_init1         , 'lib_init', \
1163
        img_is_img        , 'img_is_img', \;определяет по данным, может ли библиотека сделать из них изображение \
1163
        img_is_img        , 'img_is_img', \;определяет по данным, может ли библиотека сделать из них изображение \
1164
        img_info          , 'img_info', \
1164
        img_info          , 'img_info', \
1165
        img_from_file     , 'img_from_file', \
1165
        img_from_file     , 'img_from_file', \
1166
        img_to_file       , 'img_to_file', \
1166
        img_to_file       , 'img_to_file', \
1167
        img_from_rgb      , 'img_from_rgb', \
1167
        img_from_rgb      , 'img_from_rgb', \
1168
        img_to_rgb        , 'img_to_rgb', \;преобразование изображения в данные RGB \
1168
        img_to_rgb        , 'img_to_rgb', \;преобразование изображения в данные RGB \
1169
        img_to_rgb2       , 'img_to_rgb2', \
1169
        img_to_rgb2       , 'img_to_rgb2', \
1170
        img_decode        , 'img_decode', \ ;автоматически определяет формат графических данных \
1170
        img_decode        , 'img_decode', \ ;автоматически определяет формат графических данных \
1171
        img_encode        , 'img_encode', \
1171
        img_encode        , 'img_encode', \
1172
        img_create        , 'img_create', \
1172
        img_create        , 'img_create', \
1173
        img_destroy       , 'img_destroy', \
1173
        img_destroy       , 'img_destroy', \
1174
        img_destroy_layer , 'img_destroy_layer', \
1174
        img_destroy_layer , 'img_destroy_layer', \
1175
        img_count         , 'img_count', \
1175
        img_count         , 'img_count', \
1176
        img_lock_bits     , 'img_lock_bits', \
1176
        img_lock_bits     , 'img_lock_bits', \
1177
        img_unlock_bits   , 'img_unlock_bits', \
1177
        img_unlock_bits   , 'img_unlock_bits', \
1178
        img_flip          , 'img_flip', \
1178
        img_flip          , 'img_flip', \
1179
        img_flip_layer    , 'img_flip_layer', \
1179
        img_flip_layer    , 'img_flip_layer', \
1180
        img_rotate        , 'img_rotate', \
1180
        img_rotate        , 'img_rotate', \
1181
        img_rotate_layer  , 'img_rotate_layer', \
1181
        img_rotate_layer  , 'img_rotate_layer', \
1182
        img_draw          , 'img_draw'
1182
        img_draw          , 'img_draw'
1183
 
1183
 
1184
 
1184
 
1185
auto_list   db 1 ; to run LIST immediately after CWD
1185
auto_list   db 1 ; to run LIST immediately after CWD
1186
filter      rb 512
1186
filter      rb 512
1187
root_dir    db '/tmp0/1'
1187
root_dir    db '/tmp0/1'
1188
            rb 505
1188
            rb 505
1189
node_entry  db '1111'
1189
node_entry  db '1111'
1190
            rb 512
1190
            rb 512
1191
node_entry2 db '1111'
1191
node_entry2 db '1111'
1192
            rb 512
1192
            rb 512