Subversion Repositories Kolibri OS

Rev

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

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