Subversion Repositories Kolibri OS

Rev

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

Rev 6159 Rev 6832
1
DEBUG equ 0
1
DEBUG equ 0
2
 
2
 
3
    LIST_WIDTH equ 256
3
    LIST_WIDTH equ 256
4
    WIN_WIDTH equ (LIST_WIDTH + 16 + 12)
4
    WIN_WIDTH equ (LIST_WIDTH + 16 + 12)
5
    LIST_SIZE equ 12
5
    LIST_SIZE equ 12
6
    LINE_SIZE equ 40
6
    LINE_SIZE equ 40
7
    LIST_HEIGHT equ (LIST_SIZE * LINE_SIZE / 2)
7
    LIST_HEIGHT equ (LIST_SIZE * LINE_SIZE / 2)
8
    WIN_HEIGHT equ (LIST_HEIGHT + 80)
8
    WIN_HEIGHT equ (LIST_HEIGHT + 80)
9
 
9
 
10
    use32
10
    use32
11
    org     0
11
    org     0
12
    db	    'MENUET01'
12
    db	    'MENUET01'
13
    dd	    1, main, dataend, memory, memory, params, 0
13
    dd	    1, main, dataend, memory, memory, params, 0
14
 
14
 
15
    include "../../proc32.inc"
15
    include "../../proc32.inc"
16
    include "../../macros.inc"
16
    include "../../macros.inc"
17
    include "../../dll.inc"
17
    include "../../dll.inc"
18
    include "../../cmp.inc"
-
 
19
    include "../../string.inc"
18
    include "../../string.inc"
20
    include "../../develop/libraries/box_lib/trunk/box_lib.mac"
19
    include "../../develop/libraries/box_lib/trunk/box_lib.mac"
21
 
20
 
22
    include "lang.inc"
21
    include "lang.inc"
23
 
22
 
24
if DEBUG eq 1
23
if DEBUG eq 1
25
    include "../../debug.inc"
24
    include "../../debug.inc"
26
end if
25
end if
27
 
26
 
28
 ;===============================
27
 ;===============================
29
 
28
 
30
if lang eq ru
29
if lang eq ru
31
 title db "Žâªàëâì á ¯®¬®éìî", 0
30
 title db "Žâªàëâì á ¯®¬®éìî", 0
32
 browse_txt db "Ž¡§®à...", 0
31
 browse_txt db "Ž¡§®à...", 0
33
 notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
32
 notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
34
 checkbox_txt db "ˆá¯®«ì§®¢ âì ¢á¥£¤ ", 0
33
 checkbox_txt db "ˆá¯®«ì§®¢ âì ¢á¥£¤ ", 0
35
else if lang eq et
34
else if lang eq et
36
 title db "Open with", 0
35
 title db "Open with", 0
37
 browse_txt db "Browse...", 0
36
 browse_txt db "Browse...", 0
38
 notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
37
 notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
39
 checkbox_txt db "Always use selected program", 0
38
 checkbox_txt db "Always use selected program", 0
40
else if lang eq it
39
else if lang eq it
41
 title db "Open with", 0
40
 title db "Open with", 0
42
 browse_txt db "Browse...", 0
41
 browse_txt db "Browse...", 0
43
 notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
42
 notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
44
 checkbox_txt db "Always use selected program", 0
43
 checkbox_txt db "Always use selected program", 0
45
else
44
else
46
 title db "Open with", 0
45
 title db "Open with", 0
47
 browse_txt db "Browse...", 0
46
 browse_txt db "Browse...", 0
48
 notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
47
 notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0
49
 checkbox_txt db "Always use selected program", 0
48
 checkbox_txt db "Always use selected program", 0
50
end if
49
end if
51
 
50
 
52
 sys_dir db "/sys", 0
51
 sys_dir db "/sys", 0
53
 slash db "/", 0
52
 slash db "/", 0
54
 open_dialog_path db "/sys/file managers/opendial", 0
53
 open_dialog_path db "/sys/file managers/opendial", 0
55
 app_link db "$", 0
54
 app_link db "$", 0
56
 icons db "/sys/icons32.png", 0
55
 icons db "/sys/icons32.png", 0
57
 communication_area_name db "FFFFFF_open_dialog", 0
56
 communication_area_name db "FFFFFF_open_dialog", 0
58
 assoc_ini db "/sys/settings/assoc.ini", 0
57
 assoc_ini db "/sys/settings/assoc.ini", 0
59
  .sec db "Assoc", 0
58
  .sec db "Assoc", 0
60
  .exec db "exec", 0
59
  .exec db "exec", 0
61
  .next db "next", 0
60
  .next db "next", 0
62
  .icon db "icon", 0
61
  .icon db "icon", 0
63
 
62
 
64
 sb_apps scrollbar \
63
 sb_apps scrollbar \
65
  13, WIN_WIDTH - 25, LIST_HEIGHT, 10 + 12, \  ;; w, x, h, y
64
  13, WIN_WIDTH - 25, LIST_HEIGHT, 10 + 12, \  ;; w, x, h, y
66
  0, 0, LIST_SIZE / 2, 0, \		       ;; b.h, max, area, pos
65
  0, 0, LIST_SIZE / 2, 0, \		       ;; b.h, max, area, pos
67
  0, 0, 0, 2
66
  0, 0, 0, 2
68
 
67
 
69
 cb_always check_box2 \
68
 cb_always check_box2 \
70
  5 shl 16 + 16, (LIST_HEIGHT + 33) shl 16 + 16, 6, 0, 0, 0, checkbox_txt, ch_flag_middle
69
  5 shl 16 + 16, (LIST_HEIGHT + 33) shl 16 + 16, 6, 0, 0, 0, checkbox_txt, ch_flag_middle
71
 
70
 
72
 opendialog:
71
 opendialog:
73
  .type dd 0
72
  .type dd 0
74
  .procinfo dd buffer3
73
  .procinfo dd buffer3
75
  .com_area_name dd communication_area_name
74
  .com_area_name dd communication_area_name
76
  .com_area dd 0
75
  .com_area dd 0
77
  .opendir_path dd buffer4
76
  .opendir_path dd buffer4
78
  .dir_default_path dd sys_dir
77
  .dir_default_path dd sys_dir
79
  .start_path dd open_dialog_path
78
  .start_path dd open_dialog_path
80
  .draw_window dd draw_window
79
  .draw_window dd draw_window
81
  .status dd 0
80
  .status dd 0
82
  .openfile_pach dd buffer
81
  .openfile_pach dd buffer
83
  .filename_area dd buffer5
82
  .filename_area dd buffer5
84
  .filter_area dd .filter
83
  .filter_area dd .filter
85
  .x:
84
  .x:
86
  .x_size dw 420
85
  .x_size dw 420
87
  .x_start dw 200
86
  .x_start dw 200
88
  .y:
87
  .y:
89
  .y_size dw 320
88
  .y_size dw 320
90
  .y_start dw 120
89
  .y_start dw 120
91
 
90
 
92
 .filter dd 0
91
 .filter dd 0
93
 
92
 
94
 ps_addres:
93
 ps_addres:
95
  dd 0		;; type
94
  dd 0		;; type
96
  dw 7		;; y
95
  dw 7		;; y
97
  dw 4		;; x
96
  dw 4		;; x
98
  dw 6		;; font.w
97
  dw 6		;; font.w
99
  dw LIST_WIDTH ;; w
98
  dw LIST_WIDTH ;; w
100
  dd 0		;; mono
99
  dd 0		;; mono
101
  dd 0		;; without bg
100
  dd 0		;; without bg
102
  .color dd 0	;; text color
101
  .color dd 0	;; text color
103
  dd 0		;; bg color
102
  dd 0		;; bg color
104
  .txt dd 0	;; text
103
  .txt dd 0	;; text
105
  dd buffer2
104
  dd buffer2
106
  dd 0
105
  dd 0
107
 
106
 
108
 is_execute:
107
 is_execute:
109
  dd 7, 0, 0, 0, 0
108
  dd 7, 0, 0, 0, 0
110
  db 0
109
  db 0
111
  dd buffer
110
  dd buffer
112
 
111
 
113
 is_openas:
112
 is_openas:
114
  dd 7, 0, 0, 0, 0
113
  dd 7, 0, 0, 0, 0
115
  db 0
114
  db 0
116
  dd buffer
115
  dd buffer
117
 
116
 
118
 is_open:
117
 is_open:
119
  dd 7, 0, 0, 0, 0
118
  dd 7, 0, 0, 0, 0
120
  db 0
119
  db 0
121
  dd buffer
120
  dd buffer
122
 
121
 
123
 is_undefined:
122
 is_undefined:
124
  dd 7, 0, notify_txt, 0, 0
123
  dd 7, 0, notify_txt, 0, 0
125
  db "/sys/@notify", 0
124
  db "/sys/@notify", 0
126
 
125
 
127
 is_openimg_info:
126
 is_openimg_info:
128
  dd 5, 0, 0, 0, img.buf
127
  dd 5, 0, 0, 0, img.buf
129
  db 0
128
  db 0
130
  dd icons
129
  dd icons
131
 
130
 
132
 is_openimg:
131
 is_openimg:
133
  dd 0, 0, 0, 0, 0
132
  dd 0, 0, 0, 0, 0
134
  db 0
133
  db 0
135
  dd icons
134
  dd icons
136
 
135
 
137
 is_file_exists:
136
 is_file_exists:
138
  dd 0, 0, 0, 0, buffer6
137
  dd 0, 0, 0, 0, buffer6
139
  db 0
138
  db 0
140
  dd buffer
139
  dd buffer
141
 
140
 
142
  last_x dd -1
141
  last_x dd -1
143
  last_y dd -1
142
  last_y dd -1
144
 
143
 
145
if DEBUG eq 1
144
if DEBUG eq 1
146
    std_param db "~/sys/example.asm", 0
145
    std_param db "~/sys/example.asm", 0
147
end if
146
end if
148
 
147
 
149
 imports:
148
 imports:
150
    library libini, "libini.obj"
149
    library libini, "libini.obj"
151
    import  libini, libini.get_str, "ini_get_str", \
150
    import  libini, libini.get_str, "ini_get_str", \
152
		    libini.set_str, "ini_set_str", \
151
		    libini.set_str, "ini_set_str", \
153
		    libini.get_num, "ini_get_int", \
152
		    libini.get_num, "ini_get_int", \
154
		    libini.for_each_section, "ini_enum_sections"
153
		    libini.for_each_section, "ini_enum_sections"
155
 
154
 
156
 imports_add:
155
 imports_add:
157
    library libimg, "libimg.obj", \
156
    library libimg, "libimg.obj", \
158
	    boxlib, "box_lib.obj", \
157
	    boxlib, "box_lib.obj", \
159
	    prclib, "proc_lib.obj"
158
	    prclib, "proc_lib.obj"
160
    import  libimg, libimg.init, "lib_init", \
159
    import  libimg, libimg.init, "lib_init", \
161
		    libimg.toRGB, "img_to_rgb2", \
160
		    libimg.toRGB, "img_to_rgb2", \
162
		    libimg.decode, "img_decode", \
161
		    libimg.decode, "img_decode", \
163
		    libimg.destroy, "img_destroy"
162
		    libimg.destroy, "img_destroy"
164
    import  boxlib, scrollbar.draw, "scrollbar_v_draw", \
163
    import  boxlib, scrollbar.draw, "scrollbar_v_draw", \
165
		    scrollbar.mouse, "scrollbar_v_mouse", \
164
		    scrollbar.mouse, "scrollbar_v_mouse", \
166
		    pathshow.init, "PathShow_prepare", \
165
		    pathshow.init, "PathShow_prepare", \
167
		    pathshow.draw, "PathShow_draw", \
166
		    pathshow.draw, "PathShow_draw", \
168
		    checkbox.init, "init_checkbox2", \
167
		    checkbox.init, "init_checkbox2", \
169
		    checkbox.draw, "check_box_draw2", \
168
		    checkbox.draw, "check_box_draw2", \
170
		    checkbox.mouse, "check_box_mouse2"
169
		    checkbox.mouse, "check_box_mouse2"
171
    import  prclib, opendialog.lib_init, "lib_init", \
170
    import  prclib, opendialog.lib_init, "lib_init", \
172
		    opendialog.init, "OpenDialog_init", \
171
		    opendialog.init, "OpenDialog_init", \
173
		    opendialog.start, "OpenDialog_start"
172
		    opendialog.start, "OpenDialog_start"
174
 
173
 
175
 ;===============================
174
 ;===============================
176
 
175
 
177
 main:
176
 main:
178
    mcall   68, 11
177
    mcall   68, 11
179
    stdcall dll.Load, imports
178
    stdcall dll.Load, imports
180
 
179
 
181
if DEBUG eq 1
180
if DEBUG eq 1
182
    stdcall string.copy, std_param, params
181
    stdcall string.copy, std_param, params
183
end if
182
end if
184
 
183
 
185
 ;; trim params
184
 ;; trim params
186
    stdcall string.to_lower_case, params
185
    stdcall string.to_lower_case, params
187
    stdcall string.trim_last, params
186
    stdcall string.trim_last, params
188
    stdcall string.trim_first, params
187
    stdcall string.trim_first, params
189
    mov     [param_s], eax
188
    mov     [param_s], eax
190
 
189
 
191
 ;; if empty - exit
190
 ;; if empty - exit
192
    cmpe    [eax], byte 0, exit
191
    cmpe    [eax], byte 0, exit
193
 
192
 
194
 ;; if folder
193
 ;; if folder
195
    stdcall string.length, [param_s]
194
    stdcall string.length, [param_s]
196
    add     eax, [param_s]
195
    add     eax, [param_s]
197
    cmpe    [eax - 1], byte '/', open
196
    cmpe    [eax - 1], byte '/', open
198
 
197
 
199
 ;; if dialog
198
 ;; if dialog
200
    mov     eax, [param_s]
199
    mov     eax, [param_s]
201
    mov     [is_openas + 8], eax
200
    mov     [is_openas + 8], eax
202
    cmpne   [eax], byte '~', @f
201
    cmpne   [eax], byte '~', @f
203
    inc     [param_s]
202
    inc     [param_s]
204
    mov     eax, [param_s]
203
    mov     eax, [param_s]
205
    mov     [is_openas + 8], eax
204
    mov     [is_openas + 8], eax
206
    jmp     start_dialog
205
    jmp     start_dialog
207
  @@:
206
  @@:
208
 
207
 
209
 ;; if without '.' - execute
208
 ;; if without '.' - execute
210
    stdcall string.last_index_of, [param_s], '.', 1
209
    stdcall string.last_index_of, [param_s], '.', 1
211
    cmpe    eax, -1, execute
210
    cmpe    eax, -1, execute
212
 ;; if '.' is part of path - execute
211
 ;; if '.' is part of path - execute
213
    mov     esi, eax
212
    mov     esi, eax
214
    stdcall string.last_index_of, [param_s], '/', 1
213
    stdcall string.last_index_of, [param_s], '/', 1
215
    cmpg    eax, esi, execute
214
    cmpg    eax, esi, execute
216
 
215
 
217
 ;; if ext == "kex" - execute
216
 ;; if ext == "kex" - execute
218
    add     esi, [param_s]
217
    add     esi, [param_s]
219
    mov     [param_e], esi
218
    mov     [param_e], esi
220
    cmpe    [esi], dword "kex", execute
219
    cmpe    [esi], dword "kex", execute
221
 
220
 
222
 open_as:
221
 open_as:
223
    invoke  libini.get_str, assoc_ini, assoc_ini.sec, esi, buffer8, 2048, undefined
222
    invoke  libini.get_str, assoc_ini, assoc_ini.sec, esi, buffer8, 2048, undefined
224
    cmpe    byte [buffer8], 0, start_dialog_pre
223
    cmpe    byte [buffer8], 0, start_dialog_pre
225
 .run:
224
 .run:
226
    mov     edi, 0
225
    mov     edi, 0
227
    cmpne   byte [buffer8], "$", .pre_open
226
    cmpne   byte [buffer8], "$", .pre_open
228
    mov     edi, 1
227
    mov     edi, 1
229
    invoke  libini.get_str, assoc_ini, buffer8 + 1, assoc_ini.exec, buffer, 2048, undefined
228
    invoke  libini.get_str, assoc_ini, buffer8 + 1, assoc_ini.exec, buffer, 2048, undefined
230
    cmpe    byte [buffer], 0, ini_error
229
    cmpe    byte [buffer], 0, ini_error
231
    jmp     @f
230
    jmp     @f
232
 .pre_open:
231
 .pre_open:
233
    stdcall string.copy, buffer8, buffer
232
    stdcall string.copy, buffer8, buffer
234
  @@:
233
  @@:
235
    mcall   70, is_openas
234
    mcall   70, is_openas
236
    cmpge   eax, 0, exit
235
    cmpge   eax, 0, exit
237
    cmpe    edi, 0, start_dialog
236
    cmpe    edi, 0, start_dialog
238
    invoke  libini.get_str, assoc_ini, buffer8 + 1, assoc_ini.next, buffer8, 2048, undefined
237
    invoke  libini.get_str, assoc_ini, buffer8 + 1, assoc_ini.next, buffer8, 2048, undefined
239
    cmpne   byte [buffer], 0, .run
238
    cmpne   byte [buffer], 0, .run
240
    jmp     start_dialog
239
    jmp     start_dialog
241
 
240
 
242
 execute:
241
 execute:
243
    mov     eax, [param_s]
242
    mov     eax, [param_s]
244
    mov     [is_execute + 21], eax
243
    mov     [is_execute + 21], eax
245
    mcall   70, is_execute
244
    mcall   70, is_execute
246
    jmp     exit
245
    jmp     exit
247
 
246
 
248
 open:
247
 open:
249
    invoke  libini.get_str, assoc_ini, assoc_ini.sec, slash, buffer, 2048, undefined
248
    invoke  libini.get_str, assoc_ini, assoc_ini.sec, slash, buffer, 2048, undefined
250
    cmpne   [buffer], byte "$", @f
249
    cmpne   [buffer], byte "$", @f
251
    invoke  libini.get_str, assoc_ini, buffer + 1, assoc_ini.exec, buffer, 2048, undefined
250
    invoke  libini.get_str, assoc_ini, buffer + 1, assoc_ini.exec, buffer, 2048, undefined
252
    cmpe    [buffer], byte 0, ini_error
251
    cmpe    [buffer], byte 0, ini_error
253
  @@:
252
  @@:
254
    mov     eax, [param_s]
253
    mov     eax, [param_s]
255
    mov     [is_open + 8], eax
254
    mov     [is_open + 8], eax
256
    mcall   70, is_open
255
    mcall   70, is_open
257
    jmp     exit
256
    jmp     exit
258
 
257
 
259
 ini_error:
258
 ini_error:
260
    mcall   70, is_undefined
259
    mcall   70, is_undefined
261
    jmp     exit
260
    jmp     exit
262
 
261
 
263
 ;----------------------
262
 ;----------------------
264
 
263
 
265
 start_dialog_pre:
264
 start_dialog_pre:
266
    or	    [cb_always.flags], ch_flag_en
265
    or	    [cb_always.flags], ch_flag_en
267
 
266
 
268
 start_dialog:
267
 start_dialog:
269
    stdcall dll.Load, imports_add
268
    stdcall dll.Load, imports_add
270
    invoke  opendialog.lib_init
269
    invoke  opendialog.lib_init
271
 
270
 
272
    mcall   40, 100111b
271
    mcall   40, 100111b
273
 
272
 
274
 ;; get title
273
 ;; get title
275
    stdcall string.copy, title, win.title
274
    stdcall string.copy, title, win.title
276
 
275
 
277
 ;; get positions
276
 ;; get positions
278
    mcall   14
277
    mcall   14
279
    movzx   ebx, ax
278
    movzx   ebx, ax
280
    shr     ebx, 1
279
    shr     ebx, 1
281
    shr     eax, 16 + 1
280
    shr     eax, 16 + 1
282
    sub     eax, WIN_WIDTH / 2 - 1
281
    sub     eax, WIN_WIDTH / 2 - 1
283
    sub     ebx, WIN_HEIGHT / 2 - 1
282
    sub     ebx, WIN_HEIGHT / 2 - 1
284
    mov     [win.x], eax
283
    mov     [win.x], eax
285
    mov     [win.y], ebx
284
    mov     [win.y], ebx
286
 
285
 
287
 ;; get colors
286
 ;; get colors
288
    mcall   48, 3, skin, sizeof.system_colors
287
    mcall   48, 3, skin, sizeof.system_colors
289
 
288
 
290
 ;; get opendialog
289
 ;; get opendialog
291
    invoke  opendialog.init, opendialog
290
    invoke  opendialog.init, opendialog
292
 
291
 
293
 ;; get pathshow
292
 ;; get pathshow
294
    mov     eax, [param_s]
293
    mov     eax, [param_s]
295
    mov     ebx, [skin.work_text]
294
    mov     ebx, [skin.work_text]
296
    mov     [ps_addres.txt], eax
295
    mov     [ps_addres.txt], eax
297
    mov     [ps_addres], ebx
296
    mov     [ps_addres], ebx
298
    invoke  pathshow.init, ps_addres
297
    invoke  pathshow.init, ps_addres
299
 
298
 
300
 ;; get checkbox
299
 ;; get checkbox
301
    mov     eax, 0xFFFfff
300
    mov     eax, 0xFFFfff
302
    mov     ebx, [skin.work_graph]
301
    mov     ebx, [skin.work_graph]
303
    mov     ecx, [skin.work_text]
302
    mov     ecx, [skin.work_text]
304
    mov     [cb_always.color], eax
303
    mov     [cb_always.color], eax
305
    mov     [cb_always.border_color], ebx
304
    mov     [cb_always.border_color], ebx
306
    mov     [cb_always.text_color], ecx
305
    mov     [cb_always.text_color], ecx
307
    invoke  checkbox.init, cb_always
306
    invoke  checkbox.init, cb_always
308
 
307
 
309
 ;; get list
308
 ;; get list
310
    invoke  libini.for_each_section, assoc_ini, section_cb
309
    invoke  libini.for_each_section, assoc_ini, section_cb
311
    stdcall sort_list
310
    stdcall sort_list
312
    mov     eax, [sb_apps.max_area]
311
    mov     eax, [sb_apps.max_area]
313
    and     eax, 1b
312
    and     eax, 1b
314
    shr     [sb_apps.max_area], 1
313
    shr     [sb_apps.max_area], 1
315
    add     [sb_apps.max_area], eax
314
    add     [sb_apps.max_area], eax
316
 
315
 
317
    mov     eax, 0xFFFfff
316
    mov     eax, 0xFFFfff
318
    mov     ebx, 0xCCCccc ;[skin.3d]
317
    mov     ebx, 0xCCCccc ;[skin.3d]
319
    mov     [sb_apps.bg_color], eax
318
    mov     [sb_apps.bg_color], eax
320
    mov     [sb_apps.front_color], ebx
319
    mov     [sb_apps.front_color], ebx
321
    mov     [sb_apps.line_color], ebx
320
    mov     [sb_apps.line_color], ebx
322
 
321
 
323
 ;; get icons
322
 ;; get icons
324
    mcall   70, is_openimg_info
323
    mcall   70, is_openimg_info
325
    mov     edx, dword [img.buf + 32]
324
    mov     edx, dword [img.buf + 32]
326
    shl     edx, 4
325
    shl     edx, 4
327
    stdcall mem.Alloc, edx
326
    stdcall mem.Alloc, edx
328
    mov     [img.rgb], eax
327
    mov     [img.rgb], eax
329
 
328
 
330
    mov     [is_openimg + 12], edx
329
    mov     [is_openimg + 12], edx
331
    m2m     dword[is_openimg + 16], dword[img.rgb]
330
    m2m     dword[is_openimg + 16], dword[img.rgb]
332
    mcall   70, is_openimg
331
    mcall   70, is_openimg
333
 
332
 
334
    invoke  libimg.decode, dword[img.rgb], ebx, 0
333
    invoke  libimg.decode, dword[img.rgb], ebx, 0
335
    mov     [img], eax
334
    mov     [img], eax
336
 
335
 
337
  ;; alpha
336
  ;; alpha
338
    mov     edi, [eax + 8]
337
    mov     edi, [eax + 8]
339
    shl     edi, 7
338
    shl     edi, 7
340
    sub     edi, 4
339
    sub     edi, 4
341
    mov     eax, [eax + 24]
340
    mov     eax, [eax + 24]
342
 .setalpha:
341
 .setalpha:
343
    mov     ebx, [eax + edi]
342
    mov     ebx, [eax + edi]
344
    shr     ebx, 24
343
    shr     ebx, 24
345
    cmpne   ebx, 0, @f
344
    cmpne   ebx, 0, @f
346
    mov     ecx, 0xFFFfff
345
    mov     ecx, 0xFFFfff
347
    mov     [eax + edi], ecx
346
    mov     [eax + edi], ecx
348
 @@:
347
 @@:
349
    cmpe    edi, 0, @f
348
    cmpe    edi, 0, @f
350
    sub     edi, 4
349
    sub     edi, 4
351
    jmp     .setalpha
350
    jmp     .setalpha
352
 @@:
351
 @@:
353
 
352
 
354
    invoke  libimg.toRGB, [img], [img.rgb]
353
    invoke  libimg.toRGB, [img], [img.rgb]
355
    invoke  libimg.destroy, [img]
354
    invoke  libimg.destroy, [img]
356
 
355
 
357
 ;----------------------
356
 ;----------------------
358
 
357
 
359
 update:
358
 update:
360
    mcall   10
359
    mcall   10
361
    cmpe    eax, EV_REDRAW, event_redraw
360
    cmpe    eax, EV_REDRAW, event_redraw
362
    cmpe    eax, EV_KEY, event_key
361
    cmpe    eax, EV_KEY, event_key
363
    cmpe    eax, EV_BUTTON, event_button
362
    cmpe    eax, EV_BUTTON, event_button
364
    cmpe    eax, EV_MOUSE, event_mouse
363
    cmpe    eax, EV_MOUSE, event_mouse
365
    jmp     update
364
    jmp     update
366
 
365
 
367
 ;----------------------
366
 ;----------------------
368
 
367
 
369
 event_redraw:
368
 event_redraw:
370
    call    draw_window
369
    call    draw_window
371
    jmp     update
370
    jmp     update
372
 
371
 
373
 ;----------------------
372
 ;----------------------
374
 
373
 
375
 event_key:
374
 event_key:
376
    mcall   2
375
    mcall   2
377
    cmpe    ah, 27, exit
376
    cmpe    ah, 27, exit
378
 
377
 
379
    cmpe    ah,  13, list_item_activate
378
    cmpe    ah,  13, list_item_activate
380
    cmpe    ah,   9, event_button.opendialog
379
    cmpe    ah,   9, event_button.opendialog
381
    cmpe    ah,  32, .toggle_cb
380
    cmpe    ah,  32, .toggle_cb
382
    cmpe    ah, 179, .go_right
381
    cmpe    ah, 179, .go_right
383
    cmpe    ah, 176, .go_left
382
    cmpe    ah, 176, .go_left
384
    cmpe    ah, 178, .go_up
383
    cmpe    ah, 178, .go_up
385
    cmpe    ah, 177, .go_down
384
    cmpe    ah, 177, .go_down
386
 
385
 
387
    cmpl    ah, "a", @f
386
    cmpl    ah, "a", @f
388
    cmpg    ah, "z", @f
387
    cmpg    ah, "z", @f
389
    jmp     .letter
388
    jmp     .letter
390
  @@:
389
  @@:
391
 
390
 
392
    cmpl    ah, " ", @f
391
    cmpl    ah, " ", @f
393
    cmpg    ah, "ï", @f
392
    cmpg    ah, "ï", @f
394
    jmp     .letter
393
    jmp     .letter
395
  @@:
394
  @@:
396
 
395
 
397
    cmpl    ah, "A", @f
396
    cmpl    ah, "A", @f
398
    cmpg    ah, "Z", @f
397
    cmpg    ah, "Z", @f
399
    jmp     .letter_big
398
    jmp     .letter_big
400
  @@:
399
  @@:
401
 
400
 
402
    cmpl    ah, "€", @f
401
    cmpl    ah, "€", @f
403
    cmpg    ah, "Ÿ", @f
402
    cmpg    ah, "Ÿ", @f
404
    jmp     .letter_big
403
    jmp     .letter_big
405
  @@:
404
  @@:
406
 
405
 
407
    cmpl    ah, "0", @f
406
    cmpl    ah, "0", @f
408
    cmpg    ah, "9", @f
407
    cmpg    ah, "9", @f
409
    jmp     .letter
408
    jmp     .letter
410
  @@:
409
  @@:
411
 
410
 
412
    jmp     update
411
    jmp     update
413
 
412
 
414
 .letter_big:
413
 .letter_big:
415
    movzx   ebx, ah
414
    movzx   ebx, ah
416
    stdcall downcase_char, ebx
415
    stdcall downcase_char, ebx
417
    mov     ah, al
416
    mov     ah, al
418
 
417
 
419
 .letter:
418
 .letter:
420
    push    eax
419
    push    eax
421
 
420
 
422
    stdcall get_index
421
    stdcall get_index
423
    inc     eax
422
    inc     eax
424
 
423
 
425
    mov     ecx, eax
424
    mov     ecx, eax
426
 
425
 
427
    imul    ebx, eax, 32
426
    imul    ebx, eax, 32
428
    add     ebx, list
427
    add     ebx, list
429
 
428
 
430
    pop     eax
429
    pop     eax
431
 
430
 
432
    mov     edi, 0
431
    mov     edi, 0
433
    mov     esi, [list.size]
432
    mov     esi, [list.size]
434
 .search:
433
 .search:
435
    shl     esi, 5
434
    shl     esi, 5
436
    add     esi, list
435
    add     esi, list
437
 @@:
436
 @@:
438
    cmpe    ebx, esi, @f
437
    cmpe    ebx, esi, @f
439
 
438
 
440
    movzx   edx, byte [ebx]
439
    movzx   edx, byte [ebx]
441
    stdcall downcase_char, edx
440
    stdcall downcase_char, edx
442
    cmpne   ah, al, .next
441
    cmpne   ah, al, .next
443
    stdcall set_index, ecx
442
    stdcall set_index, ecx
444
    stdcall draw_list
443
    stdcall draw_list
445
    jmp     update
444
    jmp     update
446
 
445
 
447
 .next:
446
 .next:
448
    inc     ecx
447
    inc     ecx
449
    add     ebx, 32
448
    add     ebx, 32
450
    jmp     @b
449
    jmp     @b
451
  @@:
450
  @@:
452
    cmpe    edi, 1, update
451
    cmpe    edi, 1, update
453
    mov     ebx, list
452
    mov     ebx, list
454
    mov     ecx, 0
453
    mov     ecx, 0
455
    mov     edi, 1
454
    mov     edi, 1
456
    push    eax
455
    push    eax
457
    stdcall get_index
456
    stdcall get_index
458
    mov     esi, eax
457
    mov     esi, eax
459
    pop     eax
458
    pop     eax
460
    jmp     .search
459
    jmp     .search
461
 
460
 
462
 .toggle_cb:
461
 .toggle_cb:
463
    mov     eax, [cb_always.flags]
462
    mov     eax, [cb_always.flags]
464
    mov     ebx, eax
463
    mov     ebx, eax
465
    and     ebx, ch_flag_en
464
    and     ebx, ch_flag_en
466
    cmpe    ebx, 0, @f
465
    cmpe    ebx, 0, @f
467
    sub     eax, ch_flag_en
466
    sub     eax, ch_flag_en
468
    jmp     .toggle_cb.redraw
467
    jmp     .toggle_cb.redraw
469
  @@:
468
  @@:
470
    add     eax, ch_flag_en
469
    add     eax, ch_flag_en
471
 .toggle_cb.redraw:
470
 .toggle_cb.redraw:
472
    mov     [cb_always.flags], eax
471
    mov     [cb_always.flags], eax
473
    invoke  checkbox.draw, cb_always
472
    invoke  checkbox.draw, cb_always
474
    jmp     update
473
    jmp     update
475
 
474
 
476
 .go_right:
475
 .go_right:
477
    mov     esi, 1
476
    mov     esi, 1
478
    jmp     .go_anyway
477
    jmp     .go_anyway
479
 
478
 
480
 .go_left:
479
 .go_left:
481
    mov     esi, -1
480
    mov     esi, -1
482
    jmp     .go_anyway
481
    jmp     .go_anyway
483
 
482
 
484
 .go_up:
483
 .go_up:
485
    mov     esi, -2
484
    mov     esi, -2
486
    jmp     .go_anyway
485
    jmp     .go_anyway
487
 
486
 
488
 .go_down:
487
 .go_down:
489
    mov     esi, 2
488
    mov     esi, 2
490
 
489
 
491
 .go_anyway:
490
 .go_anyway:
492
;; HIDE OLD SELECTION
491
;; HIDE OLD SELECTION
493
    stdcall draw_item, [last_x], [last_y], 0
492
    stdcall draw_item, [last_x], [last_y], 0
494
 
493
 
495
;; [X, Y] -> INDEX
494
;; [X, Y] -> INDEX
496
    stdcall get_index
495
    stdcall get_index
497
 
496
 
498
;; CHANGE INDEX
497
;; CHANGE INDEX
499
 .check_p2:
498
 .check_p2:
500
    cmpne   esi, 2, .check_m2
499
    cmpne   esi, 2, .check_m2
501
    mov     ebx, [list.size]
500
    mov     ebx, [list.size]
502
    dec     ebx
501
    dec     ebx
503
    sub     ebx, eax
502
    sub     ebx, eax
504
    cmpg    ebx, 1, .add
503
    cmpg    ebx, 1, .add
505
    jmp     .check
504
    jmp     .check
506
 
505
 
507
 .check_m2:
506
 .check_m2:
508
    cmpne   esi, -2, .add
507
    cmpne   esi, -2, .add
509
    cmpg    eax, 1, .add
508
    cmpg    eax, 1, .add
510
    jmp     .check
509
    jmp     .check
511
 
510
 
512
 .add:
511
 .add:
513
    add     eax, esi
512
    add     eax, esi
514
 
513
 
515
 .check:
514
 .check:
516
    cmpl    eax, [list.size], @f
515
    cmpl    eax, [list.size], @f
517
    mov     eax, [list.size]
516
    mov     eax, [list.size]
518
    dec     eax
517
    dec     eax
519
  @@:
518
  @@:
520
 
519
 
521
    cmpge   eax, 0, @f
520
    cmpge   eax, 0, @f
522
    mov     eax, 0
521
    mov     eax, 0
523
  @@:
522
  @@:
524
 
523
 
525
;; INDEX -> [X, Y]
524
;; INDEX -> [X, Y]
526
    stdcall set_index, eax
525
    stdcall set_index, eax
527
    cmpe    eax, 1, @f
526
    cmpe    eax, 1, @f
528
 
527
 
529
;; PARTLY REDRAW
528
;; PARTLY REDRAW
530
    stdcall draw_item, [last_x], [last_y], 1
529
    stdcall draw_item, [last_x], [last_y], 1
531
    jmp     update
530
    jmp     update
532
 
531
 
533
;; FULL REDRAW
532
;; FULL REDRAW
534
  @@:
533
  @@:
535
    stdcall draw_list
534
    stdcall draw_list
536
    jmp     update
535
    jmp     update
537
 
536
 
538
 ;----------------------
537
 ;----------------------
539
 
538
 
540
 event_button:
539
 event_button:
541
    mcall   17
540
    mcall   17
542
    cmpe    ah, 1, exit
541
    cmpe    ah, 1, exit
543
    cmpe    ah, 2, .opendialog
542
    cmpe    ah, 2, .opendialog
544
    jmp     list_item_activate
543
    jmp     list_item_activate
545
 
544
 
546
 .opendialog:
545
 .opendialog:
547
    invoke  opendialog.start, opendialog
546
    invoke  opendialog.start, opendialog
548
    cmpne   [opendialog.status], 1, update
547
    cmpne   [opendialog.status], 1, update
549
    mcall   70, is_openas
548
    mcall   70, is_openas
550
 
549
 
551
    mov     edi, 0
550
    mov     edi, 0
552
    jmp     save_assoc
551
    jmp     save_assoc
553
 
552
 
554
 ;----------------------
553
 ;----------------------
555
 
554
 
556
 list_item_activate:
555
 list_item_activate:
557
    stdcall get_index
556
    stdcall get_index
558
    shl     eax, 5
557
    shl     eax, 5
559
    add     eax, list
558
    add     eax, list
560
    cmpe    byte [eax], 0, update
559
    cmpe    byte [eax], 0, update
561
    mov     [param_a], eax
560
    mov     [param_a], eax
562
    invoke  libini.get_str, assoc_ini, eax, assoc_ini.exec, buffer, 256, undefined
561
    invoke  libini.get_str, assoc_ini, eax, assoc_ini.exec, buffer, 256, undefined
563
    cmpe    byte [buffer], 0, ini_error
562
    cmpe    byte [buffer], 0, ini_error
564
    mcall   70, is_openas
563
    mcall   70, is_openas
565
 
564
 
566
    mov     edi, 1
565
    mov     edi, 1
567
    jmp     save_assoc
566
    jmp     save_assoc
568
 
567
 
569
 ;----------------------
568
 ;----------------------
570
 
569
 
571
 save_assoc:
570
 save_assoc:
572
    mov     eax, [cb_always.flags]
571
    mov     eax, [cb_always.flags]
573
    and     eax, ch_flag_en
572
    and     eax, ch_flag_en
574
    cmpe    eax, 0, exit
573
    cmpe    eax, 0, exit
575
 
574
 
576
    cmpe    edi, 0, @f
575
    cmpe    edi, 0, @f
577
    stdcall string.copy, app_link, buffer
576
    stdcall string.copy, app_link, buffer
578
    stdcall string.concatenate, [param_a], buffer
577
    stdcall string.concatenate, [param_a], buffer
579
  @@:
578
  @@:
580
 
579
 
581
    invoke  libini.set_str, assoc_ini, assoc_ini.sec, [param_e], buffer, 33
580
    invoke  libini.set_str, assoc_ini, assoc_ini.sec, [param_e], buffer, 33
582
    jmp     exit
581
    jmp     exit
583
 
582
 
584
 ;----------------------
583
 ;----------------------
585
 
584
 
586
 event_mouse:
585
 event_mouse:
587
    invoke  checkbox.mouse, cb_always
586
    invoke  checkbox.mouse, cb_always
588
    mov     edi, [sb_apps.position]
587
    mov     edi, [sb_apps.position]
589
    invoke  scrollbar.mouse, sb_apps
588
    invoke  scrollbar.mouse, sb_apps
590
    sub     edi, [sb_apps.position]
589
    sub     edi, [sb_apps.position]
591
    jz	    @f
590
    jz	    @f
592
    call    draw_list
591
    call    draw_list
593
  @@:
592
  @@:
594
 
593
 
595
    mcall   37, 1
594
    mcall   37, 1
596
    movzx   edi, ax
595
    movzx   edi, ax
597
    shr     eax, 16
596
    shr     eax, 16
598
    mov     esi, eax
597
    mov     esi, eax
599
    sub     esi, 4
598
    sub     esi, 4
600
    sub     edi, 10 + 12
599
    sub     edi, 10 + 12
601
    cmpl    esi, 0, .out
600
    cmpl    esi, 0, .out
602
    cmpge   esi, LIST_WIDTH, .out
601
    cmpge   esi, LIST_WIDTH, .out
603
    cmpl    edi, 0, .out
602
    cmpl    edi, 0, .out
604
    cmpge   edi, LIST_HEIGHT, .out
603
    cmpge   edi, LIST_HEIGHT, .out
605
 
604
 
606
    mcall   37, 7
605
    mcall   37, 7
607
    and     eax, 0xFFFF
606
    and     eax, 0xFFFF
608
    cmpe    eax, 65535, .scroll_up
607
    cmpe    eax, 65535, .scroll_up
609
    cmpe    eax, 0, @f
608
    cmpe    eax, 0, @f
610
 
609
 
611
 .scroll_down:
610
 .scroll_down:
612
    mov     eax, [sb_apps.position]
611
    mov     eax, [sb_apps.position]
613
    add     eax, LIST_SIZE / 2
612
    add     eax, LIST_SIZE / 2
614
    shl     eax, 1
613
    shl     eax, 1
615
    cmpge   eax, [list.size], @f
614
    cmpge   eax, [list.size], @f
616
    inc     [sb_apps.position]
615
    inc     [sb_apps.position]
617
    stdcall draw_list
616
    stdcall draw_list
618
    jmp     update
617
    jmp     update
619
 
618
 
620
 .scroll_up:
619
 .scroll_up:
621
    cmpe    [sb_apps.position], 0, @f
620
    cmpe    [sb_apps.position], 0, @f
622
    dec     [sb_apps.position]
621
    dec     [sb_apps.position]
623
    stdcall draw_list
622
    stdcall draw_list
624
    jmp     update
623
    jmp     update
625
 
624
 
626
  @@:
625
  @@:
627
 
626
 
628
    mov     eax, esi
627
    mov     eax, esi
629
    mov     ebx, LIST_WIDTH / 2
628
    mov     ebx, LIST_WIDTH / 2
630
    mov     edx, 0
629
    mov     edx, 0
631
    div     ebx
630
    div     ebx
632
    mov     esi, eax
631
    mov     esi, eax
633
 
632
 
634
    mov     eax, edi
633
    mov     eax, edi
635
    mov     ebx, LINE_SIZE
634
    mov     ebx, LINE_SIZE
636
    mov     edx, 0
635
    mov     edx, 0
637
    div     ebx
636
    div     ebx
638
    mov     edi, eax
637
    mov     edi, eax
639
 
638
 
640
    cmpne   esi, [last_x], .redraw
639
    cmpne   esi, [last_x], .redraw
641
    cmpne   edi, [last_y], .redraw
640
    cmpne   edi, [last_y], .redraw
642
    jmp     @f
641
    jmp     @f
643
 
642
 
644
 .redraw:
643
 .redraw:
645
    stdcall draw_item, [last_x], [last_y], 0
644
    stdcall draw_item, [last_x], [last_y], 0
646
    mov     [last_x], esi
645
    mov     [last_x], esi
647
    mov     [last_y], edi
646
    mov     [last_y], edi
648
    stdcall draw_item, esi, edi, 1
647
    stdcall draw_item, esi, edi, 1
649
    jmp     @f
648
    jmp     @f
650
 
649
 
651
 .out:
650
 .out:
652
    cmpe    [last_x], -1, @f
651
    cmpe    [last_x], -1, @f
653
    stdcall draw_item, [last_x], [last_y], 0
652
    stdcall draw_item, [last_x], [last_y], 0
654
    mov     [last_x], -1
653
    mov     [last_x], -1
655
    mov     [last_y], -1
654
    mov     [last_y], -1
656
  @@:
655
  @@:
657
 
656
 
658
    jmp     update
657
    jmp     update
659
 
658
 
660
 ;----------------------
659
 ;----------------------
661
 
660
 
662
 exit:
661
 exit:
663
    mcall   -1
662
    mcall   -1
664
 
663
 
665
 ;----------------------
664
 ;----------------------
666
 
665
 
667
 proc draw_window
666
 proc draw_window
668
    mcall   12, 1
667
    mcall   12, 1
669
 
668
 
670
    mov     edx, [skin.work]
669
    mov     edx, [skin.work]
671
    or	    edx, 0x34 shl 24
670
    or	    edx, 0x34 shl 24
672
    mcall   0, <[win.x], WIN_WIDTH>, <[win.y], WIN_HEIGHT>, , , win.title
671
    mcall   0, <[win.x], WIN_WIDTH>, <[win.y], WIN_HEIGHT>, , , win.title
673
    stdcall draw_list
672
    stdcall draw_list
674
    invoke  pathshow.draw, ps_addres
673
    invoke  pathshow.draw, ps_addres
675
    invoke  checkbox.draw, cb_always
674
    invoke  checkbox.draw, cb_always
676
 
675
 
677
    mcall   8, <208, 63>, , 2, [skin.work_button]
676
    mcall   8, <208, 63>, , 2, [skin.work_button]
678
;
677
;
679
    mov     ecx, [skin.work_button_text]
678
    mov     ecx, [skin.work_button_text]
680
    add     ecx, 0x80 shl 24
679
    add     ecx, 0x80 shl 24
681
    mcall   4, <214, LIST_HEIGHT + 36>, , browse_txt
680
    mcall   4, <214, LIST_HEIGHT + 36>, , browse_txt
682
 
681
 
683
 ;; buttons
682
 ;; buttons
684
    mov     eax, 8
683
    mov     eax, 8
685
    mov     ebx, 4 shl 16 + LIST_WIDTH / 2
684
    mov     ebx, 4 shl 16 + LIST_WIDTH / 2
686
    mov     ecx, (10 + 12) shl 16 + LINE_SIZE - 1
685
    mov     ecx, (10 + 12) shl 16 + LINE_SIZE - 1
687
    mov     edx, 0x60 shl 24 + 10
686
    mov     edx, 0x60 shl 24 + 10
688
    mov     edi, LIST_SIZE
687
    mov     edi, LIST_SIZE
689
    mov     esi, 0
688
    mov     esi, 0
690
  @@:
689
  @@:
691
    cmpe    edi, 0, @f
690
    cmpe    edi, 0, @f
692
    mcall
691
    mcall
693
 
692
 
694
    cmpe    esi, 0, .doA
693
    cmpe    esi, 0, .doA
695
 .doB:
694
 .doB:
696
    sub     ebx, LIST_WIDTH shl 16
695
    sub     ebx, LIST_WIDTH shl 16
697
    add     ecx, LINE_SIZE shl 16
696
    add     ecx, LINE_SIZE shl 16
698
 .doA:
697
 .doA:
699
    add     ebx, (LIST_WIDTH / 2) shl 16
698
    add     ebx, (LIST_WIDTH / 2) shl 16
700
    sub     ecx, LINE_SIZE shl 16
699
    sub     ecx, LINE_SIZE shl 16
701
 
700
 
702
    not     esi
701
    not     esi
703
    add     ecx, LINE_SIZE shl 16
702
    add     ecx, LINE_SIZE shl 16
704
    inc     edx
703
    inc     edx
705
    dec     edi
704
    dec     edi
706
    jmp     @b
705
    jmp     @b
707
  @@:
706
  @@:
708
 
707
 
709
    mcall   12, 2
708
    mcall   12, 2
710
    ret
709
    ret
711
  endp
710
  endp
712
 
711
 
713
 ;----------------------
712
 ;----------------------
714
 
713
 
715
 proc draw_list
714
 proc draw_list
716
    mcall   13, <3, LIST_WIDTH + 2 + 12>, <9 + 12, 1>, [skin.work_graph]
715
    mcall   13, <3, LIST_WIDTH + 2 + 12>, <9 + 12, 1>, [skin.work_graph]
717
    mcall     , 			, 
716
    mcall     , 			, 
718
    mcall     , <3, 1>, <9 + 12, LIST_HEIGHT + 1>
717
    mcall     , <3, 1>, <9 + 12, LIST_HEIGHT + 1>
719
    mcall     , <3 + LIST_WIDTH + 12 + 1, 1>
718
    mcall     , <3 + LIST_WIDTH + 12 + 1, 1>
720
    mcall     , <4, LIST_WIDTH>, <10 + 12, LIST_HEIGHT>, 0xFFFfff
719
    mcall     , <4, LIST_WIDTH>, <10 + 12, LIST_HEIGHT>, 0xFFFfff
721
 
720
 
722
    mov     esi, 1
721
    mov     esi, 1
723
    mov     edi, LIST_SIZE / 2 - 1
722
    mov     edi, LIST_SIZE / 2 - 1
724
 .draw_loop:
723
 .draw_loop:
725
    mov     edx, 0
724
    mov     edx, 0
726
    cmpne   [last_x], esi, @f
725
    cmpne   [last_x], esi, @f
727
    cmpne   [last_y], edi, @f
726
    cmpne   [last_y], edi, @f
728
    mov     edx, 1
727
    mov     edx, 1
729
  @@:
728
  @@:
730
    stdcall draw_item, esi, edi, edx
729
    stdcall draw_item, esi, edi, edx
731
    dec     esi
730
    dec     esi
732
    cmpne   esi, -1, @f
731
    cmpne   esi, -1, @f
733
    mov     esi, 1
732
    mov     esi, 1
734
    dec     edi
733
    dec     edi
735
  @@:
734
  @@:
736
    cmpne   edi, -1, .draw_loop
735
    cmpne   edi, -1, .draw_loop
737
 
736
 
738
    invoke  scrollbar.draw, sb_apps
737
    invoke  scrollbar.draw, sb_apps
739
 
738
 
740
    ret
739
    ret
741
 endp
740
 endp
742
 
741
 
743
 ;----------------------
742
 ;----------------------
744
 
743
 
745
 proc draw_item uses edx edi esi, _x, _y, _sel
744
 proc draw_item uses edx edi esi, _x, _y, _sel
746
 ;; get index
745
 ;; get index
747
    stdcall get_index_cur, [_x], [_y]
746
    stdcall get_index_cur, [_x], [_y]
748
    mov     edi, eax
747
    mov     edi, eax
749
 
748
 
750
    cmpge   edi, [list.size], .break
749
    cmpge   edi, [list.size], .break
751
 
750
 
752
 ;; background
751
 ;; background
753
    mov     ebx, [_x]
752
    mov     ebx, [_x]
754
    shl     ebx, 7 + 16
753
    shl     ebx, 7 + 16
755
    add     ebx, 4 shl 16 + LIST_WIDTH / 2
754
    add     ebx, 4 shl 16 + LIST_WIDTH / 2
756
 
755
 
757
    imul    ecx, [_y], LINE_SIZE
756
    imul    ecx, [_y], LINE_SIZE
758
    shl     ecx, 16
757
    shl     ecx, 16
759
    add     ecx, (10 + 12) shl 16 + LINE_SIZE
758
    add     ecx, (10 + 12) shl 16 + LINE_SIZE
760
 
759
 
761
    mov     edx, 0xFFFfff
760
    mov     edx, 0xFFFfff
762
    cmpe    [_sel], 0, @f
761
    cmpe    [_sel], 0, @f
763
    mov     edx, 0x94AECE
762
    mov     edx, 0x94AECE
764
  @@:
763
  @@:
765
    mcall   13
764
    mcall   13
766
 
765
 
767
 ;; shadows
766
 ;; shadows
768
    push    ecx
767
    push    ecx
769
    cmpe    [_sel], 1, .after_shadows
768
    cmpe    [_sel], 1, .after_shadows
770
    mov     edx, 0xCCCccc ;[skin.3d]
769
    mov     edx, 0xCCCccc ;[skin.3d]
771
 
770
 
772
    cmpne   [_x], 0, @f
771
    cmpne   [_x], 0, @f
773
    imul     ecx, [_y], LINE_SIZE
772
    imul     ecx, [_y], LINE_SIZE
774
    shl      ecx, 16
773
    shl      ecx, 16
775
    add      ecx, (10 + 12) shl 16 + LINE_SIZE
774
    add      ecx, (10 + 12) shl 16 + LINE_SIZE
776
    mcall     , <4, 1>
775
    mcall     , <4, 1>
777
  @@:
776
  @@:
778
 
777
 
779
    cmpne   [_y], 0, @f
778
    cmpne   [_y], 0, @f
780
    imul     ebx, [_x], LIST_WIDTH / 2
779
    imul     ebx, [_x], LIST_WIDTH / 2
781
    shl      ebx, 16
780
    shl      ebx, 16
782
    add      ebx, 4 shl 16 + LIST_WIDTH / 2
781
    add      ebx, 4 shl 16 + LIST_WIDTH / 2
783
    mcall     , , <10 + 12, 1>
782
    mcall     , , <10 + 12, 1>
784
  @@:
783
  @@:
785
 
784
 
786
 .after_shadows:
785
 .after_shadows:
787
    pop     ecx
786
    pop     ecx
788
 
787
 
789
 ;; icon
788
 ;; icon
790
    and     ebx, 0xFFFF shl 16
789
    and     ebx, 0xFFFF shl 16
791
    shr     ecx, 16
790
    shr     ecx, 16
792
    add     ecx, ebx
791
    add     ecx, ebx
793
    mov     edx, ecx
792
    mov     edx, ecx
794
    add     edx, 6 shl 16 + (LINE_SIZE - 32) / 2
793
    add     edx, 6 shl 16 + (LINE_SIZE - 32) / 2
795
 
794
 
796
    mov     ebx, edi
795
    mov     ebx, edi
797
    shl     ebx, 2
796
    shl     ebx, 2
798
    mov     ebx, [ebx + list.icon]
797
    mov     ebx, [ebx + list.icon]
799
    imul    ebx, 32 * 32 * 3
798
    imul    ebx, 32 * 32 * 3
800
    add     ebx, [img.rgb]
799
    add     ebx, [img.rgb]
801
    cmpe    [_sel], 0, .draw_icon
800
    cmpe    [_sel], 0, .draw_icon
802
 .selected:
801
 .selected:
803
    mov     eax, img.sel
802
    mov     eax, img.sel
804
    mov     ecx, 32 * 32
803
    mov     ecx, 32 * 32
805
    push    edx
804
    push    edx
806
  @@:
805
  @@:
807
    mov     edx, [ebx]
806
    mov     edx, [ebx]
808
    and     edx, 0xFFFFFF
807
    and     edx, 0xFFFFFF
809
    cmpne   edx, 0xFFFFFF, .not
808
    cmpne   edx, 0xFFFFFF, .not
810
    mov     edx, 0x94AECE
809
    mov     edx, 0x94AECE
811
 .not:
810
 .not:
812
    mov     [eax], edx
811
    mov     [eax], edx
813
    add     eax, 3
812
    add     eax, 3
814
    add     ebx, 3
813
    add     ebx, 3
815
    dec     ecx
814
    dec     ecx
816
    jnz     @b
815
    jnz     @b
817
    pop     edx
816
    pop     edx
818
    mov     ebx, img.sel
817
    mov     ebx, img.sel
819
 
818
 
820
 .draw_icon:
819
 .draw_icon:
821
    mcall   7, , <32, 32>
820
    mcall   7, , <32, 32>
822
 
821
 
823
 ;; text
822
 ;; text
824
    mov     ebx, edx
823
    mov     ebx, edx
825
    add     ebx, (32 + 6) shl 16 + 32 / 2 - 9 / 2
824
    add     ebx, (32 + 6) shl 16 + 32 / 2 - 9 / 2
826
 
825
 
827
    mov     ecx, 0x000000 ; inactive item text
826
    mov     ecx, 0x000000 ; inactive item text
828
    cmpe    [_sel], 0, @f
827
    cmpe    [_sel], 0, @f
829
    mov     ecx, 0x000000 ; active item text
828
    mov     ecx, 0x000000 ; active item text
830
  @@:
829
  @@:
831
    add     ecx, 0x80 shl 24
830
    add     ecx, 0x80 shl 24
832
 
831
 
833
    mov     edx, edi
832
    mov     edx, edi
834
    shl     edx, 5
833
    shl     edx, 5
835
    add     edx, list
834
    add     edx, list
836
 
835
 
837
    mcall   4
836
    mcall   4
838
 
837
 
839
  .break:
838
  .break:
840
    ret
839
    ret
841
 endp
840
 endp
842
 
841
 
843
 ;----------------------
842
 ;----------------------
844
 
843
 
845
 proc downcase_char uses ebx, _ch
844
 proc downcase_char uses ebx, _ch
846
    mov     ebx, [_ch]
845
    mov     ebx, [_ch]
847
 
846
 
848
    cmpl    bl, "A", @f
847
    cmpl    bl, "A", @f
849
    cmpg    bl, "Z", @f
848
    cmpg    bl, "Z", @f
850
    sub     bl, "A" - "a"
849
    sub     bl, "A" - "a"
851
    jmp     .ret
850
    jmp     .ret
852
  @@:
851
  @@:
853
 
852
 
854
    cmpl    bl, "€", @f
853
    cmpl    bl, "€", @f
855
    cmpg    bl, "Ÿ", @f
854
    cmpg    bl, "Ÿ", @f
856
    sub     bl, "€" - " "
855
    sub     bl, "€" - " "
857
  @@:
856
  @@:
858
 
857
 
859
 .ret:
858
 .ret:
860
    mov     al, bl
859
    mov     al, bl
861
    ret
860
    ret
862
 endp
861
 endp
863
 
862
 
864
 ;----------------------
863
 ;----------------------
865
 
864
 
866
 proc get_index_cur uses ebx, _x, _y
865
 proc get_index_cur uses ebx, _x, _y
867
    mov     eax, [_y]
866
    mov     eax, [_y]
868
    shl     eax, 1
867
    shl     eax, 1
869
    add     eax, [_x]
868
    add     eax, [_x]
870
    mov     ebx, [sb_apps.position]
869
    mov     ebx, [sb_apps.position]
871
    shl     ebx, 1
870
    shl     ebx, 1
872
    add     eax, ebx
871
    add     eax, ebx
873
 
872
 
874
    ret
873
    ret
875
 endp
874
 endp
876
 
875
 
877
 ;----------------------
876
 ;----------------------
878
 
877
 
879
 proc get_index
878
 proc get_index
880
    stdcall get_index_cur, [last_x], [last_y]
879
    stdcall get_index_cur, [last_x], [last_y]
881
    ret
880
    ret
882
 endp
881
 endp
883
 
882
 
884
 ;----------------------
883
 ;----------------------
885
 
884
 
886
 proc set_index uses ebx,_index
885
 proc set_index uses ebx,_index
887
    mov     eax, [_index]
886
    mov     eax, [_index]
888
    mov     ebx, [sb_apps.position]
887
    mov     ebx, [sb_apps.position]
889
    shl     ebx, 1
888
    shl     ebx, 1
890
    sub     eax, ebx
889
    sub     eax, ebx
891
 
890
 
892
    mov     ebx, eax
891
    mov     ebx, eax
893
    and     ebx, 1b
892
    and     ebx, 1b
894
    mov     [last_x], ebx
893
    mov     [last_x], ebx
895
    shr     eax, 1
894
    shr     eax, 1
896
    mov     [last_y], eax
895
    mov     [last_y], eax
897
 
896
 
898
    mov     eax, 0
897
    mov     eax, 0
899
 
898
 
900
    cmpl    [last_y], 0xFFFF, @f
899
    cmpl    [last_y], 0xFFFF, @f
901
    mov     ebx, 0xFFFFFFFF shr 1
900
    mov     ebx, 0xFFFFFFFF shr 1
902
    sub     ebx, [last_y]
901
    sub     ebx, [last_y]
903
    inc     ebx
902
    inc     ebx
904
    mov     [last_y], 0
903
    mov     [last_y], 0
905
    ;dec     [sb_apps.position]
904
    ;dec     [sb_apps.position]
906
    sub     [sb_apps.position], ebx
905
    sub     [sb_apps.position], ebx
907
    mov     eax, 1
906
    mov     eax, 1
908
    jmp     .exit
907
    jmp     .exit
909
  @@:
908
  @@:
910
 
909
 
911
    cmpl    [last_y], LIST_SIZE / 2, @f
910
    cmpl    [last_y], LIST_SIZE / 2, @f
912
    mov     ebx, [last_y]
911
    mov     ebx, [last_y]
913
    sub     ebx, LIST_SIZE / 2 - 1
912
    sub     ebx, LIST_SIZE / 2 - 1
914
    mov     [last_y], LIST_SIZE / 2 - 1
913
    mov     [last_y], LIST_SIZE / 2 - 1
915
    add     [sb_apps.position], ebx
914
    add     [sb_apps.position], ebx
916
    mov     eax, 1
915
    mov     eax, 1
917
    jmp     .exit
916
    jmp     .exit
918
  @@:
917
  @@:
919
 
918
 
920
 .exit:
919
 .exit:
921
    cmpge   [sb_apps.position], 0, @f
920
    cmpge   [sb_apps.position], 0, @f
922
    mov     [sb_apps.position], 0
921
    mov     [sb_apps.position], 0
923
  @@:
922
  @@:
924
 
923
 
925
    ret
924
    ret
926
 endp
925
 endp
927
 
926
 
928
 ;----------------------
927
 ;----------------------
929
 
928
 
930
 proc section_cb, _file, _sec
929
 proc section_cb, _file, _sec
931
 ;; CHECK IF EXISTS
930
 ;; CHECK IF EXISTS
932
    invoke  libini.get_str, assoc_ini, [_sec], assoc_ini.exec, buffer, 2048, undefined
931
    invoke  libini.get_str, assoc_ini, [_sec], assoc_ini.exec, buffer, 2048, undefined
933
    mcall   70, is_file_exists
932
    mcall   70, is_file_exists
934
    cmpe    ebx, -1, .exit
933
    cmpe    ebx, -1, .exit
935
 
934
 
936
    mov     ebx, [list.size]
935
    mov     ebx, [list.size]
937
    shl     ebx, 5
936
    shl     ebx, 5
938
    add     ebx, list
937
    add     ebx, list
939
    stdcall string.cmp, [_sec], assoc_ini.sec
938
    stdcall string.cmp, [_sec], assoc_ini.sec
940
    cmpe    eax, 0, @f
939
    cmpe    eax, 0, @f
941
    stdcall string.copy, [_sec], ebx
940
    stdcall string.copy, [_sec], ebx
942
    invoke  libini.get_num, [_file], [_sec], assoc_ini.icon, 0
941
    invoke  libini.get_num, [_file], [_sec], assoc_ini.icon, 0
943
    mov     ecx, [list.size]
942
    mov     ecx, [list.size]
944
    shl     ecx, 2
943
    shl     ecx, 2
945
    mov     [ecx + list.icon], eax
944
    mov     [ecx + list.icon], eax
946
    inc     [list.size]
945
    inc     [list.size]
947
    inc     [sb_apps.max_area]
946
    inc     [sb_apps.max_area]
948
  @@:
947
  @@:
949
    mov     eax, 1
948
    mov     eax, 1
950
  .exit:
949
  .exit:
951
    ret
950
    ret
952
 endp
951
 endp
953
 
952
 
954
 ;----------------------
953
 ;----------------------
955
 
954
 
956
 proc sort_list
955
 proc sort_list
957
    mov     eax, list
956
    mov     eax, list
958
    mov     ebx, list.lowercased
957
    mov     ebx, list.lowercased
959
  @@:
958
  @@:
960
    stdcall string.copy, eax, ebx
959
    stdcall string.copy, eax, ebx
961
    stdcall string.to_lower_case, ebx
960
    stdcall string.to_lower_case, ebx
962
    add     eax, 32
961
    add     eax, 32
963
    add     ebx, 32
962
    add     ebx, 32
964
    cmpne   byte [eax], 0, @b
963
    cmpne   byte [eax], 0, @b
965
 
964
 
966
    mov     edi, 0
965
    mov     edi, 0
967
    mov     ebx, list.lowercased ;; i = 0
966
    mov     ebx, list.lowercased ;; i = 0
968
    imul    ecx, [list.size], 32 ;; i < n - 1
967
    imul    ecx, [list.size], 32 ;; i < n - 1
969
    sub     ecx, 32
968
    sub     ecx, 32
970
    add     ecx, list.lowercased
969
    add     ecx, list.lowercased
971
 
970
 
972
 .loop1:
971
 .loop1:
973
    mov     edx, list.lowercased ;; j = 0
972
    mov     edx, list.lowercased ;; j = 0
974
    mov     esi, [list.size]	 ;; j < n - i - 1
973
    mov     esi, [list.size]	 ;; j < n - i - 1
975
    sub     esi, edi
974
    sub     esi, edi
976
    dec     esi
975
    dec     esi
977
    imul    esi, 32
976
    imul    esi, 32
978
    add     esi, list.lowercased
977
    add     esi, list.lowercased
979
 .loop2:
978
 .loop2:
980
    mov     eax, edx
979
    mov     eax, edx
981
    add     eax, 32
980
    add     eax, 32
982
    stdcall string.cmp, edx, eax, 32
981
    stdcall string.cmp, edx, eax, 32
983
    cmpne   eax, 1, .next2
982
    cmpne   eax, 1, .next2
984
;; swap names lw
983
;; swap names lw
985
    mov     eax, edx
984
    mov     eax, edx
986
    add     eax, 32
985
    add     eax, 32
987
    stdcall string.copy, edx, buffer7
986
    stdcall string.copy, edx, buffer7
988
    stdcall string.copy, eax, edx
987
    stdcall string.copy, eax, edx
989
    stdcall string.copy, buffer7, eax
988
    stdcall string.copy, buffer7, eax
990
;; swap names
989
;; swap names
991
    mov     eax, edx
990
    mov     eax, edx
992
    sub     eax, 256 * 32 - 32
991
    sub     eax, 256 * 32 - 32
993
    sub     edx, 256 * 32
992
    sub     edx, 256 * 32
994
    stdcall string.copy, edx, buffer7
993
    stdcall string.copy, edx, buffer7
995
    stdcall string.copy, eax, edx
994
    stdcall string.copy, eax, edx
996
    stdcall string.copy, buffer7, eax
995
    stdcall string.copy, buffer7, eax
997
    add     edx, 256 * 32
996
    add     edx, 256 * 32
998
;; swap icons
997
;; swap icons
999
    mov     eax, edx
998
    mov     eax, edx
1000
    sub     eax, list.lowercased
999
    sub     eax, list.lowercased
1001
    shr     eax, 3
1000
    shr     eax, 3
1002
    add     eax, list.icon
1001
    add     eax, list.icon
1003
    push    ebx ecx
1002
    push    ebx ecx
1004
    mov     ebx, [eax]
1003
    mov     ebx, [eax]
1005
    mov     ecx, [eax + 4]
1004
    mov     ecx, [eax + 4]
1006
    mov     [eax], ecx
1005
    mov     [eax], ecx
1007
    mov     [eax + 4], ebx
1006
    mov     [eax + 4], ebx
1008
    pop     ecx ebx
1007
    pop     ecx ebx
1009
 .next2:
1008
 .next2:
1010
    add     edx, 32
1009
    add     edx, 32
1011
    cmpne   edx, esi, .loop2
1010
    cmpne   edx, esi, .loop2
1012
 .next1:
1011
 .next1:
1013
    inc     edi
1012
    inc     edi
1014
    add     ebx, 32
1013
    add     ebx, 32
1015
    cmpne   ebx, ecx, .loop1
1014
    cmpne   ebx, ecx, .loop1
1016
 
1015
 
1017
    ret
1016
    ret
1018
 endp
1017
 endp
1019
 
1018
 
1020
 ;----------------------
1019
 ;----------------------
1021
 
1020
 
1022
 dataend:
1021
 dataend:
1023
 
1022
 
1024
 ;===============================
1023
 ;===============================
1025
 
1024
 
1026
 skin system_colors
1025
 skin system_colors
1027
 list rb 32 * 256
1026
 list rb 32 * 256
1028
  .lowercased rd 32 * 256
1027
  .lowercased rd 32 * 256
1029
  .icon rd 256
1028
  .icon rd 256
1030
  .size rd 1
1029
  .size rd 1
1031
 img  rd 1
1030
 img  rd 1
1032
  .rgb rd 1
1031
  .rgb rd 1
1033
  .size rd 1
1032
  .size rd 1
1034
  .buf rb 40
1033
  .buf rb 40
1035
  .sel rb 32 * 32 * 3
1034
  .sel rb 32 * 32 * 3
1036
 win:
1035
 win:
1037
  .x rd 1
1036
  .x rd 1
1038
  .y rd 1
1037
  .y rd 1
1039
 win.title rb 256
1038
 win.title rb 256
1040
 param_s rd 1
1039
 param_s rd 1
1041
 param_e rd 1
1040
 param_e rd 1
1042
 param_a rd 1
1041
 param_a rd 1
1043
 undefined rb 1
1042
 undefined rb 1
1044
 buffer  rb 2048
1043
 buffer  rb 2048
1045
 buffer2 rb 2048 ;OD
1044
 buffer2 rb 2048 ;OD
1046
 buffer3 rb 2048 ;OD
1045
 buffer3 rb 2048 ;OD
1047
 buffer4 rb 2048 ;OD
1046
 buffer4 rb 2048 ;OD
1048
 buffer5 rb 2048 ;OD
1047
 buffer5 rb 2048 ;OD
1049
 buffer6 rb 2048 ;check existance
1048
 buffer6 rb 2048 ;check existance
1050
 buffer7 rb 32	 ;for sorting
1049
 buffer7 rb 32	 ;for sorting
1051
 buffer8 rd 2048
1050
 buffer8 rd 2048
1052
 params rb 2048
1051
 params rb 2048
1053
 _stack rb 2048
1052
 _stack rb 2048
1054
 memory:
1053
 memory: