Subversion Repositories Kolibri OS

Rev

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

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