Subversion Repositories Kolibri OS

Rev

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

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