Subversion Repositories Kolibri OS

Rev

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

Rev 5908 Rev 5913
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
 
-
 
432
    mov     edi, 0
-
 
433
    mov     esi, [list.size]
-
 
434
 .search:
-
 
435
    shl     esi, 5
431
 
436
    add     esi, list
432
  @@:
437
 @@:
433
    cmpe    byte [ebx], 0, @f
438
    cmpe    ebx, esi, @f
434
 
439
 
435
    movzx   edx, byte [ebx]
440
    movzx   edx, byte [ebx]
436
    stdcall downcase_char, edx
441
    stdcall downcase_char, edx
437
    cmpne   ah, al, .next
442
    cmpne   ah, al, .next
438
    stdcall set_index, ecx
443
    stdcall set_index, ecx
439
    stdcall draw_list
444
    stdcall draw_list
440
    jmp     update
445
    jmp     update
441
 
446
 
442
 .next:
447
 .next:
443
    inc     ecx
448
    inc     ecx
444
    add     ebx, 32
449
    add     ebx, 32
445
    jmp     @b
450
    jmp     @b
446
  @@:
451
  @@:
-
 
452
    cmpe    edi, 1, update
-
 
453
    mov     ebx, list
-
 
454
    mov     ecx, 0
-
 
455
    mov     edi, 1
-
 
456
    push    eax
-
 
457
    stdcall get_index
-
 
458
    mov     esi, eax
-
 
459
    pop     eax
447
    jmp     update
460
    jmp     .search
448
 
461
 
449
 .toggle_cb:
462
 .toggle_cb:
450
    mov     eax, [cb_always.flags]
463
    mov     eax, [cb_always.flags]
451
    mov     ebx, eax
464
    mov     ebx, eax
452
    and     ebx, ch_flag_en
465
    and     ebx, ch_flag_en
453
    cmpe    ebx, 0, @f
466
    cmpe    ebx, 0, @f
454
    sub     eax, ch_flag_en
467
    sub     eax, ch_flag_en
455
    jmp     .toggle_cb.redraw
468
    jmp     .toggle_cb.redraw
456
  @@:
469
  @@:
457
    add     eax, ch_flag_en
470
    add     eax, ch_flag_en
458
 .toggle_cb.redraw:
471
 .toggle_cb.redraw:
459
    mov     [cb_always.flags], eax
472
    mov     [cb_always.flags], eax
460
    invoke  checkbox.draw, cb_always
473
    invoke  checkbox.draw, cb_always
461
    jmp     update
474
    jmp     update
462
 
475
 
463
 .go_right:
476
 .go_right:
464
    mov     esi, 1
477
    mov     esi, 1
465
    jmp     .go_anyway
478
    jmp     .go_anyway
466
 
479
 
467
 .go_left:
480
 .go_left:
468
    mov     esi, -1
481
    mov     esi, -1
469
    jmp     .go_anyway
482
    jmp     .go_anyway
470
 
483
 
471
 .go_up:
484
 .go_up:
472
    mov     esi, -2
485
    mov     esi, -2
473
    jmp     .go_anyway
486
    jmp     .go_anyway
474
 
487
 
475
 .go_down:
488
 .go_down:
476
    mov     esi, 2
489
    mov     esi, 2
477
 
490
 
478
 .go_anyway:
491
 .go_anyway:
479
;; HIDE OLD SELECTION
492
;; HIDE OLD SELECTION
480
    stdcall draw_item, [last_x], [last_y], 0
493
    stdcall draw_item, [last_x], [last_y], 0
481
 
494
 
482
;; [X, Y] -> INDEX
495
;; [X, Y] -> INDEX
483
    stdcall get_index
496
    stdcall get_index
484
 
497
 
485
;; CHANGE INDEX
498
;; CHANGE INDEX
-
 
499
 .check_p2:
-
 
500
    cmpne   esi, 2, .check_m2
-
 
501
    mov     ebx, [list.size]
-
 
502
    dec     ebx
-
 
503
    sub     ebx, eax
-
 
504
    cmpg    ebx, 1, .add
-
 
505
    jmp     .check
-
 
506
 
-
 
507
 .check_m2:
-
 
508
    cmpne   esi, -2, .add
-
 
509
    cmpg    eax, 1, .add
-
 
510
    jmp     .check
-
 
511
 
-
 
512
 .add:
486
    add     eax, esi
513
    add     eax, esi
-
 
514
 
487
 
515
 .check:
488
    cmpl    eax, [list.size], @f
516
    cmpl    eax, [list.size], @f
489
    mov     eax, [list.size]
517
    mov     eax, [list.size]
490
    dec     eax
518
    dec     eax
491
  @@:
519
  @@:
492
 
520
 
493
    cmpge   eax, 0, @f
521
    cmpge   eax, 0, @f
494
    mov     eax, 0
522
    mov     eax, 0
495
  @@:
523
  @@:
496
 
524
 
497
;; INDEX -> [X, Y]
525
;; INDEX -> [X, Y]
498
    stdcall set_index, eax
526
    stdcall set_index, eax
499
    cmpe    eax, 1, @f
527
    cmpe    eax, 1, @f
500
 
528
 
501
;; PARTLY REDRAW
529
;; PARTLY REDRAW
502
    stdcall draw_item, [last_x], [last_y], 1
530
    stdcall draw_item, [last_x], [last_y], 1
503
    jmp     update
531
    jmp     update
504
 
532
 
505
;; FULL REDRAW
533
;; FULL REDRAW
506
  @@:
534
  @@:
507
    stdcall draw_list
535
    stdcall draw_list
508
    jmp     update
536
    jmp     update
509
 
537
 
510
 ;----------------------
538
 ;----------------------
511
 
539
 
512
 event_button:
540
 event_button:
513
    mcall   17
541
    mcall   17
514
    cmpe    ah, 1, exit
542
    cmpe    ah, 1, exit
515
    cmpe    ah, 2, .opendialog
543
    cmpe    ah, 2, .opendialog
516
    jmp     list_item_activate
544
    jmp     list_item_activate
517
 
545
 
518
 .opendialog:
546
 .opendialog:
519
    invoke  opendialog.start, opendialog
547
    invoke  opendialog.start, opendialog
520
    cmpne   [opendialog.status], 1, update
548
    cmpne   [opendialog.status], 1, update
521
    mcall   70, is_openas
549
    mcall   70, is_openas
522
 
550
 
523
    mov     edi, 0
551
    mov     edi, 0
524
    jmp     save_assoc
552
    jmp     save_assoc
525
 
553
 
526
 ;----------------------
554
 ;----------------------
527
 
555
 
528
 list_item_activate:
556
 list_item_activate:
529
    stdcall get_index
557
    stdcall get_index
530
    shl     eax, 5
558
    shl     eax, 5
531
    add     eax, list
559
    add     eax, list
532
    cmpe    byte [eax], 0, update
560
    cmpe    byte [eax], 0, update
533
    mov     [param_a], eax
561
    mov     [param_a], eax
534
    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
535
    cmpe    byte [buffer], 0, ini_error
563
    cmpe    byte [buffer], 0, ini_error
536
    mcall   70, is_openas
564
    mcall   70, is_openas
537
 
565
 
538
    mov     edi, 1
566
    mov     edi, 1
539
    jmp     save_assoc
567
    jmp     save_assoc
540
 
568
 
541
 ;----------------------
569
 ;----------------------
542
 
570
 
543
 save_assoc:
571
 save_assoc:
544
    mov     eax, [cb_always.flags]
572
    mov     eax, [cb_always.flags]
545
    and     eax, ch_flag_en
573
    and     eax, ch_flag_en
546
    cmpe    eax, 0, exit
574
    cmpe    eax, 0, exit
547
 
575
 
548
    cmpe    edi, 0, @f
576
    cmpe    edi, 0, @f
549
    stdcall string.copy, app_link, buffer
577
    stdcall string.copy, app_link, buffer
550
    stdcall string.concatenate, [param_a], buffer
578
    stdcall string.concatenate, [param_a], buffer
551
  @@:
579
  @@:
552
 
580
 
553
    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
554
    jmp     exit
582
    jmp     exit
555
 
583
 
556
 ;----------------------
584
 ;----------------------
557
 
585
 
558
 event_mouse:
586
 event_mouse:
559
    invoke  checkbox.mouse, cb_always
587
    invoke  checkbox.mouse, cb_always
560
    mov     edi, [sb_apps.position]
588
    mov     edi, [sb_apps.position]
561
    invoke  scrollbar.mouse, sb_apps
589
    invoke  scrollbar.mouse, sb_apps
562
    sub     edi, [sb_apps.position]
590
    sub     edi, [sb_apps.position]
563
    jz	    @f
591
    jz	    @f
564
    call    draw_list
592
    call    draw_list
565
  @@:
593
  @@:
566
 
594
 
567
    mcall   37, 1
595
    mcall   37, 1
568
    movzx   edi, ax
596
    movzx   edi, ax
569
    shr     eax, 16
597
    shr     eax, 16
570
    mov     esi, eax
598
    mov     esi, eax
571
    sub     esi, 4
599
    sub     esi, 4
572
    sub     edi, 10 + 12
600
    sub     edi, 10 + 12
573
    cmpl    esi, 0, .out
601
    cmpl    esi, 0, .out
574
    cmpge   esi, LIST_WIDTH, .out
602
    cmpge   esi, LIST_WIDTH, .out
575
    cmpl    edi, 0, .out
603
    cmpl    edi, 0, .out
576
    cmpge   edi, LIST_HEIGHT, .out
604
    cmpge   edi, LIST_HEIGHT, .out
577
 
605
 
578
    mcall   37, 7
606
    mcall   37, 7
579
    and     eax, 0xFFFF
607
    and     eax, 0xFFFF
580
    cmpe    eax, 65535, .scroll_up
608
    cmpe    eax, 65535, .scroll_up
581
    cmpe    eax, 0, @f
609
    cmpe    eax, 0, @f
582
 
610
 
583
 .scroll_down:
611
 .scroll_down:
584
    mov     eax, [sb_apps.position]
612
    mov     eax, [sb_apps.position]
585
    add     eax, LIST_SIZE / 2
613
    add     eax, LIST_SIZE / 2
586
    shl     eax, 1
614
    shl     eax, 1
587
    cmpge   eax, [list.size], @f
615
    cmpge   eax, [list.size], @f
588
    inc     [sb_apps.position]
616
    inc     [sb_apps.position]
589
    stdcall draw_list
617
    stdcall draw_list
590
    jmp     update
618
    jmp     update
591
 
619
 
592
 .scroll_up:
620
 .scroll_up:
593
    cmpe    [sb_apps.position], 0, @f
621
    cmpe    [sb_apps.position], 0, @f
594
    dec     [sb_apps.position]
622
    dec     [sb_apps.position]
595
    stdcall draw_list
623
    stdcall draw_list
596
    jmp     update
624
    jmp     update
597
 
625
 
598
  @@:
626
  @@:
599
 
627
 
600
    mov     eax, esi
628
    mov     eax, esi
601
    mov     ebx, LIST_WIDTH / 2
629
    mov     ebx, LIST_WIDTH / 2
602
    mov     edx, 0
630
    mov     edx, 0
603
    div     ebx
631
    div     ebx
604
    mov     esi, eax
632
    mov     esi, eax
605
 
633
 
606
    mov     eax, edi
634
    mov     eax, edi
607
    mov     ebx, LINE_SIZE
635
    mov     ebx, LINE_SIZE
608
    mov     edx, 0
636
    mov     edx, 0
609
    div     ebx
637
    div     ebx
610
    mov     edi, eax
638
    mov     edi, eax
611
 
639
 
612
    cmpne   esi, [last_x], .redraw
640
    cmpne   esi, [last_x], .redraw
613
    cmpne   edi, [last_y], .redraw
641
    cmpne   edi, [last_y], .redraw
614
    jmp     @f
642
    jmp     @f
615
 
643
 
616
 .redraw:
644
 .redraw:
617
    stdcall draw_item, [last_x], [last_y], 0
645
    stdcall draw_item, [last_x], [last_y], 0
618
    mov     [last_x], esi
646
    mov     [last_x], esi
619
    mov     [last_y], edi
647
    mov     [last_y], edi
620
    stdcall draw_item, esi, edi, 1
648
    stdcall draw_item, esi, edi, 1
621
    jmp     @f
649
    jmp     @f
622
 
650
 
623
 .out:
651
 .out:
624
    cmpe    [last_x], -1, @f
652
    cmpe    [last_x], -1, @f
625
    stdcall draw_item, [last_x], [last_y], 0
653
    stdcall draw_item, [last_x], [last_y], 0
626
    mov     [last_x], -1
654
    mov     [last_x], -1
627
    mov     [last_y], -1
655
    mov     [last_y], -1
628
  @@:
656
  @@:
629
 
657
 
630
    jmp     update
658
    jmp     update
631
 
659
 
632
 ;----------------------
660
 ;----------------------
633
 
661
 
634
 exit:
662
 exit:
635
    mcall   -1
663
    mcall   -1
636
 
664
 
637
 ;----------------------
665
 ;----------------------
638
 
666
 
639
 proc draw_window
667
 proc draw_window
640
    mcall   12, 1
668
    mcall   12, 1
641
 
669
 
642
    mov     edx, [skin.work]
670
    mov     edx, [skin.work]
643
    or	    edx, 0x34 shl 24
671
    or	    edx, 0x34 shl 24
644
    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
645
    stdcall draw_list
673
    stdcall draw_list
646
    invoke  pathshow.draw, ps_addres
674
    invoke  pathshow.draw, ps_addres
647
    invoke  checkbox.draw, cb_always
675
    invoke  checkbox.draw, cb_always
648
 
676
 
649
    mcall   13, <207, 66>, , [skin.work_graph]
677
    mcall   13, <207, 66>, , [skin.work_graph]
650
    mcall   8, <208, 63>, , 2, [skin.work_button]
678
    mcall   8, <208, 63>, , 2, [skin.work_button]
651
;
679
;
652
    mov     ecx, [skin.work_button_text]
680
    mov     ecx, [skin.work_button_text]
653
    add     ecx, 0x80 shl 24
681
    add     ecx, 0x80 shl 24
654
    mcall   4, <214, LIST_HEIGHT + 37>, , browse_txt
682
    mcall   4, <214, LIST_HEIGHT + 37>, , browse_txt
655
 
683
 
656
 ;; buttons
684
 ;; buttons
657
    mov     eax, 8
685
    mov     eax, 8
658
    mov     ebx, 4 shl 16 + LIST_WIDTH / 2
686
    mov     ebx, 4 shl 16 + LIST_WIDTH / 2
659
    mov     ecx, (10 + 12) shl 16 + LINE_SIZE - 1
687
    mov     ecx, (10 + 12) shl 16 + LINE_SIZE - 1
660
    mov     edx, 0x60 shl 24 + 10
688
    mov     edx, 0x60 shl 24 + 10
661
    mov     edi, LIST_SIZE
689
    mov     edi, LIST_SIZE
662
    mov     esi, 0
690
    mov     esi, 0
663
  @@:
691
  @@:
664
    cmpe    edi, 0, @f
692
    cmpe    edi, 0, @f
665
    mcall
693
    mcall
666
 
694
 
667
    cmpe    esi, 0, .doA
695
    cmpe    esi, 0, .doA
668
 .doB:
696
 .doB:
669
    sub     ebx, LIST_WIDTH shl 16
697
    sub     ebx, LIST_WIDTH shl 16
670
    add     ecx, LINE_SIZE shl 16
698
    add     ecx, LINE_SIZE shl 16
671
 .doA:
699
 .doA:
672
    add     ebx, (LIST_WIDTH / 2) shl 16
700
    add     ebx, (LIST_WIDTH / 2) shl 16
673
    sub     ecx, LINE_SIZE shl 16
701
    sub     ecx, LINE_SIZE shl 16
674
 
702
 
675
    not     esi
703
    not     esi
676
    add     ecx, LINE_SIZE shl 16
704
    add     ecx, LINE_SIZE shl 16
677
    inc     edx
705
    inc     edx
678
    dec     edi
706
    dec     edi
679
    jmp     @b
707
    jmp     @b
680
  @@:
708
  @@:
681
 
709
 
682
    mcall   12, 2
710
    mcall   12, 2
683
    ret
711
    ret
684
  endp
712
  endp
685
 
713
 
686
 ;----------------------
714
 ;----------------------
687
 
715
 
688
 proc draw_list
716
 proc draw_list
689
    mcall   13, <3, LIST_WIDTH + 2 + 12>, <9 + 12, 1>, [skin.work_graph]
717
    mcall   13, <3, LIST_WIDTH + 2 + 12>, <9 + 12, 1>, [skin.work_graph]
690
    mcall     , 			, 
718
    mcall     , 			, 
691
    mcall     , <3, 1>, <9 + 12, LIST_HEIGHT + 1>
719
    mcall     , <3, 1>, <9 + 12, LIST_HEIGHT + 1>
692
    mcall     , <3 + LIST_WIDTH + 12 + 1, 1>
720
    mcall     , <3 + LIST_WIDTH + 12 + 1, 1>
693
    mcall     , <4, LIST_WIDTH>, <10 + 12, LIST_HEIGHT>, 0xFFFfff
721
    mcall     , <4, LIST_WIDTH>, <10 + 12, LIST_HEIGHT>, 0xFFFfff
694
 
722
 
695
    mov     esi, 1
723
    mov     esi, 1
696
    mov     edi, LIST_SIZE / 2 - 1
724
    mov     edi, LIST_SIZE / 2 - 1
697
 .draw_loop:
725
 .draw_loop:
698
    mov     edx, 0
726
    mov     edx, 0
699
    cmpne   [last_x], esi, @f
727
    cmpne   [last_x], esi, @f
700
    cmpne   [last_y], edi, @f
728
    cmpne   [last_y], edi, @f
701
    mov     edx, 1
729
    mov     edx, 1
702
  @@:
730
  @@:
703
    stdcall draw_item, esi, edi, edx
731
    stdcall draw_item, esi, edi, edx
704
    dec     esi
732
    dec     esi
705
    cmpne   esi, -1, @f
733
    cmpne   esi, -1, @f
706
    mov     esi, 1
734
    mov     esi, 1
707
    dec     edi
735
    dec     edi
708
  @@:
736
  @@:
709
    cmpne   edi, -1, .draw_loop
737
    cmpne   edi, -1, .draw_loop
710
 
738
 
711
    invoke  scrollbar.draw, sb_apps
739
    invoke  scrollbar.draw, sb_apps
712
 
740
 
713
    ret
741
    ret
714
 endp
742
 endp
715
 
743
 
716
 ;----------------------
744
 ;----------------------
717
 
745
 
718
 proc draw_item uses edx edi esi, _x, _y, _sel
746
 proc draw_item uses edx edi esi, _x, _y, _sel
719
 ;; get index
747
 ;; get index
720
    stdcall get_index_cur, [_x], [_y]
748
    stdcall get_index_cur, [_x], [_y]
721
    mov     edi, eax
749
    mov     edi, eax
722
 
750
 
723
    cmpge   edi, [list.size], .break
751
    cmpge   edi, [list.size], .break
724
 
752
 
725
 ;; background
753
 ;; background
726
    mov     ebx, [_x]
754
    mov     ebx, [_x]
727
    shl     ebx, 7 + 16
755
    shl     ebx, 7 + 16
728
    add     ebx, 4 shl 16 + LIST_WIDTH / 2
756
    add     ebx, 4 shl 16 + LIST_WIDTH / 2
729
 
757
 
730
    imul    ecx, [_y], LINE_SIZE
758
    imul    ecx, [_y], LINE_SIZE
731
    shl     ecx, 16
759
    shl     ecx, 16
732
    add     ecx, (10 + 12) shl 16 + LINE_SIZE
760
    add     ecx, (10 + 12) shl 16 + LINE_SIZE
733
 
761
 
734
    mov     edx, 0xFFFfff
762
    mov     edx, 0xFFFfff
735
    cmpe    [_sel], 0, @f
763
    cmpe    [_sel], 0, @f
736
    mov     edx, 0x94AECE
764
    mov     edx, 0x94AECE
737
  @@:
765
  @@:
738
    mcall   13
766
    mcall   13
739
 
767
 
740
 ;; shadows
768
 ;; shadows
741
    push    ecx
769
    push    ecx
742
    cmpe    [_sel], 1, .after_shadows
770
    cmpe    [_sel], 1, .after_shadows
743
    mov     edx, 0xCCCccc ;[skin.3d]
771
    mov     edx, 0xCCCccc ;[skin.3d]
744
 
772
 
745
    cmpne   [_x], 0, @f
773
    cmpne   [_x], 0, @f
746
    imul     ecx, [_y], LINE_SIZE
774
    imul     ecx, [_y], LINE_SIZE
747
    shl      ecx, 16
775
    shl      ecx, 16
748
    add      ecx, (10 + 12) shl 16 + LINE_SIZE
776
    add      ecx, (10 + 12) shl 16 + LINE_SIZE
749
    mcall     , <4, 1>
777
    mcall     , <4, 1>
750
  @@:
778
  @@:
751
 
779
 
752
    cmpne   [_y], 0, @f
780
    cmpne   [_y], 0, @f
753
    imul     ebx, [_x], LIST_WIDTH / 2
781
    imul     ebx, [_x], LIST_WIDTH / 2
754
    shl      ebx, 16
782
    shl      ebx, 16
755
    add      ebx, 4 shl 16 + LIST_WIDTH / 2
783
    add      ebx, 4 shl 16 + LIST_WIDTH / 2
756
    mcall     , , <10 + 12, 1>
784
    mcall     , , <10 + 12, 1>
757
  @@:
785
  @@:
758
 
786
 
759
 .after_shadows:
787
 .after_shadows:
760
    pop     ecx
788
    pop     ecx
761
 
789
 
762
 ;; icon
790
 ;; icon
763
    and     ebx, 0xFFFF shl 16
791
    and     ebx, 0xFFFF shl 16
764
    shr     ecx, 16
792
    shr     ecx, 16
765
    add     ecx, ebx
793
    add     ecx, ebx
766
    mov     edx, ecx
794
    mov     edx, ecx
767
    add     edx, 6 shl 16 + (LINE_SIZE - 32) / 2
795
    add     edx, 6 shl 16 + (LINE_SIZE - 32) / 2
768
 
796
 
769
    mov     ebx, edi
797
    mov     ebx, edi
770
    shl     ebx, 2
798
    shl     ebx, 2
771
    mov     ebx, [ebx + list.icon]
799
    mov     ebx, [ebx + list.icon]
772
    imul    ebx, 32 * 32 * 3
800
    imul    ebx, 32 * 32 * 3
773
    add     ebx, [img.rgb]
801
    add     ebx, [img.rgb]
774
    cmpe    [_sel], 0, .draw_icon
802
    cmpe    [_sel], 0, .draw_icon
775
 .selected:
803
 .selected:
776
    mov     eax, img.sel
804
    mov     eax, img.sel
777
    mov     ecx, 32 * 32
805
    mov     ecx, 32 * 32
778
    push    edx
806
    push    edx
779
  @@:
807
  @@:
780
    mov     edx, [ebx]
808
    mov     edx, [ebx]
781
    and     edx, 0xFFFFFF
809
    and     edx, 0xFFFFFF
782
    cmpne   edx, 0xFFFFFF, .not
810
    cmpne   edx, 0xFFFFFF, .not
783
    mov     edx, 0x94AECE
811
    mov     edx, 0x94AECE
784
 .not:
812
 .not:
785
    mov     [eax], edx
813
    mov     [eax], edx
786
    add     eax, 3
814
    add     eax, 3
787
    add     ebx, 3
815
    add     ebx, 3
788
    dec     ecx
816
    dec     ecx
789
    jnz     @b
817
    jnz     @b
790
    pop     edx
818
    pop     edx
791
    mov     ebx, img.sel
819
    mov     ebx, img.sel
792
 
820
 
793
 .draw_icon:
821
 .draw_icon:
794
    mcall   7, , <32, 32>
822
    mcall   7, , <32, 32>
795
 
823
 
796
 ;; text
824
 ;; text
797
    mov     ebx, edx
825
    mov     ebx, edx
798
    add     ebx, (32 + 6) shl 16 + 32 / 2 - 9 / 2
826
    add     ebx, (32 + 6) shl 16 + 32 / 2 - 9 / 2
799
 
827
 
800
    mov     ecx, 0x000000 ; inactive item text
828
    mov     ecx, 0x000000 ; inactive item text
801
    cmpe    [_sel], 0, @f
829
    cmpe    [_sel], 0, @f
802
    mov     ecx, 0x000000 ; active item text
830
    mov     ecx, 0x000000 ; active item text
803
  @@:
831
  @@:
804
    add     ecx, 0x80 shl 24
832
    add     ecx, 0x80 shl 24
805
 
833
 
806
    mov     edx, edi
834
    mov     edx, edi
807
    shl     edx, 5
835
    shl     edx, 5
808
    add     edx, list
836
    add     edx, list
809
 
837
 
810
    mcall   4
838
    mcall   4
811
 
839
 
812
  .break:
840
  .break:
813
    ret
841
    ret
814
 endp
842
 endp
815
 
843
 
816
 ;----------------------
844
 ;----------------------
817
 
845
 
818
 proc downcase_char uses ebx, _ch
846
 proc downcase_char uses ebx, _ch
819
    mov     ebx, [_ch]
847
    mov     ebx, [_ch]
820
 
848
 
821
    cmpl    bl, "A", @f
849
    cmpl    bl, "A", @f
822
    cmpg    bl, "Z", @f
850
    cmpg    bl, "Z", @f
823
    sub     bl, "A" - "a"
851
    sub     bl, "A" - "a"
824
    jmp     .ret
852
    jmp     .ret
825
  @@:
853
  @@:
826
 
854
 
827
    cmpl    bl, "€", @f
855
    cmpl    bl, "€", @f
828
    cmpg    bl, "Ÿ", @f
856
    cmpg    bl, "Ÿ", @f
829
    sub     bl, "€" - " "
857
    sub     bl, "€" - " "
830
  @@:
858
  @@:
831
 
859
 
832
 .ret:
860
 .ret:
833
    mov     al, bl
861
    mov     al, bl
834
    ret
862
    ret
835
 endp
863
 endp
836
 
864
 
837
 ;----------------------
865
 ;----------------------
838
 
866
 
839
 proc get_index_cur uses ebx, _x, _y
867
 proc get_index_cur uses ebx, _x, _y
840
    mov     eax, [_y]
868
    mov     eax, [_y]
841
    shl     eax, 1
869
    shl     eax, 1
842
    add     eax, [_x]
870
    add     eax, [_x]
843
    mov     ebx, [sb_apps.position]
871
    mov     ebx, [sb_apps.position]
844
    shl     ebx, 1
872
    shl     ebx, 1
845
    add     eax, ebx
873
    add     eax, ebx
846
 
874
 
847
    ret
875
    ret
848
 endp
876
 endp
849
 
877
 
850
 ;----------------------
878
 ;----------------------
851
 
879
 
852
 proc get_index
880
 proc get_index
853
    stdcall get_index_cur, [last_x], [last_y]
881
    stdcall get_index_cur, [last_x], [last_y]
854
    ret
882
    ret
855
 endp
883
 endp
856
 
884
 
857
 ;----------------------
885
 ;----------------------
858
 
886
 
859
 proc set_index uses ebx,_index
887
 proc set_index uses ebx,_index
860
    mov     eax, [_index]
888
    mov     eax, [_index]
861
    mov     ebx, [sb_apps.position]
889
    mov     ebx, [sb_apps.position]
862
    shl     ebx, 1
890
    shl     ebx, 1
863
    sub     eax, ebx
891
    sub     eax, ebx
864
 
892
 
865
    mov     ebx, eax
893
    mov     ebx, eax
866
    and     ebx, 1b
894
    and     ebx, 1b
867
    mov     [last_x], ebx
895
    mov     [last_x], ebx
868
    shr     eax, 1
896
    shr     eax, 1
869
    mov     [last_y], eax
897
    mov     [last_y], eax
870
 
898
 
871
    mov     eax, 0
899
    mov     eax, 0
872
 
900
 
873
    cmpl    [last_y], 0xFFFF, @f
901
    cmpl    [last_y], 0xFFFF, @f
-
 
902
    mov     ebx, 0xFFFFFFFF shr 1
-
 
903
    sub     ebx, [last_y]
-
 
904
    inc     ebx
874
    mov     [last_y], 0
905
    mov     [last_y], 0
875
    dec     [sb_apps.position]
906
    ;dec     [sb_apps.position]
-
 
907
    sub     [sb_apps.position], ebx
876
    mov     eax, 1
908
    mov     eax, 1
877
    jmp     .exit
909
    jmp     .exit
878
  @@:
910
  @@:
879
 
911
 
880
    cmpl    [last_y], LIST_SIZE / 2, @f
912
    cmpl    [last_y], LIST_SIZE / 2, @f
881
    mov     ebx, [last_y]
913
    mov     ebx, [last_y]
882
    sub     ebx, LIST_SIZE / 2 - 1
914
    sub     ebx, LIST_SIZE / 2 - 1
883
    mov     [last_y], LIST_SIZE / 2 - 1
915
    mov     [last_y], LIST_SIZE / 2 - 1
884
    add     [sb_apps.position], ebx
916
    add     [sb_apps.position], ebx
885
    mov     eax, 1
917
    mov     eax, 1
886
    jmp     .exit
918
    jmp     .exit
887
  @@:
919
  @@:
888
 
920
 
889
 .exit:
921
 .exit:
890
    cmpge   [sb_apps.position], 0, @f
922
    cmpge   [sb_apps.position], 0, @f
891
    mov     [sb_apps.position], 0
923
    mov     [sb_apps.position], 0
892
  @@:
924
  @@:
893
 
925
 
894
    ret
926
    ret
895
 endp
927
 endp
896
 
928
 
897
 ;----------------------
929
 ;----------------------
898
 
930
 
899
 proc section_cb, _file, _sec
931
 proc section_cb, _file, _sec
900
 ;; CHECK IF EXISTS
932
 ;; CHECK IF EXISTS
901
    invoke  libini.get_str, assoc_ini, [_sec], assoc_ini.exec, buffer, 2048, undefined
933
    invoke  libini.get_str, assoc_ini, [_sec], assoc_ini.exec, buffer, 2048, undefined
902
    mcall   70, is_file_exists
934
    mcall   70, is_file_exists
903
    cmpe    ebx, -1, .exit
935
    cmpe    ebx, -1, .exit
904
 
936
 
905
    mov     ebx, [list.size]
937
    mov     ebx, [list.size]
906
    shl     ebx, 5
938
    shl     ebx, 5
907
    add     ebx, list
939
    add     ebx, list
908
    stdcall string.compare, [_sec], assoc_ini.sec
940
    stdcall string.cmp, [_sec], assoc_ini.sec
909
    cmpe    eax, 1, @f
941
    cmpe    eax, 0, @f
910
    stdcall string.copy, [_sec], ebx
942
    stdcall string.copy, [_sec], ebx
911
    invoke  libini.get_num, [_file], [_sec], assoc_ini.icon, 0
943
    invoke  libini.get_num, [_file], [_sec], assoc_ini.icon, 0
912
    mov     ecx, [list.size]
944
    mov     ecx, [list.size]
913
    shl     ecx, 2
945
    shl     ecx, 2
914
    mov     [ecx + list.icon], eax
946
    mov     [ecx + list.icon], eax
915
    inc     [list.size]
947
    inc     [list.size]
916
    inc     [sb_apps.max_area]
948
    inc     [sb_apps.max_area]
917
  @@:
949
  @@:
918
    mov     eax, 1
950
    mov     eax, 1
919
  .exit:
951
  .exit:
920
    ret
952
    ret
921
 endp
953
 endp
922
 
954
 
923
 ;----------------------
955
 ;----------------------
924
 
956
 
925
 proc sort_list
957
 proc sort_list
-
 
958
    mov     eax, list
-
 
959
    mov     ebx, list.lowercased
-
 
960
  @@:
-
 
961
    stdcall string.copy, eax, ebx
-
 
962
    stdcall string.to_lower_case, ebx
-
 
963
    add     eax, 32
-
 
964
    add     ebx, 32
-
 
965
    cmpne   byte [eax], 0, @b
-
 
966
 
926
    mov     edi, 0
967
    mov     edi, 0
927
    mov     ebx, list		 ;; i = 0
968
    mov     ebx, list.lowercased ;; i = 0
928
    imul    ecx, [list.size], 32 ;; i < n - 1
969
    imul    ecx, [list.size], 32 ;; i < n - 1
929
    sub     ecx, 32
970
    sub     ecx, 32
930
    add     ecx, list
971
    add     ecx, list.lowercased
931
 
972
 
932
 .loop1:
973
 .loop1:
933
    mov     edx, list		 ;; j = 0
974
    mov     edx, list.lowercased ;; j = 0
934
    mov     esi, [list.size]	 ;; j < n - i - 1
975
    mov     esi, [list.size]	 ;; j < n - i - 1
935
    sub     esi, edi
976
    sub     esi, edi
936
    dec     esi
977
    dec     esi
937
    imul    esi, 32
978
    imul    esi, 32
938
    add     esi, list
979
    add     esi, list.lowercased
939
 .loop2:
980
 .loop2:
940
    mov     eax, edx
981
    mov     eax, edx
941
    add     eax, 32
982
    add     eax, 32
942
    stdcall string.cmp, edx, eax, 32
983
    stdcall string.cmp, edx, eax, 32
943
    cmpne   eax, 1, .next2
984
    cmpne   eax, 1, .next2
944
;; swap names
985
;; swap names lw
945
    mov     eax, edx
986
    mov     eax, edx
946
    add     eax, 32
987
    add     eax, 32
947
    stdcall string.copy, edx, buffer7
988
    stdcall string.copy, edx, buffer7
948
    stdcall string.copy, eax, edx
989
    stdcall string.copy, eax, edx
949
    stdcall string.copy, buffer7, eax
990
    stdcall string.copy, buffer7, eax
-
 
991
;; swap names
-
 
992
    mov     eax, edx
-
 
993
    sub     eax, 256 * 32 - 32
-
 
994
    sub     edx, 256 * 32
-
 
995
    stdcall string.copy, edx, buffer7
-
 
996
    stdcall string.copy, eax, edx
-
 
997
    stdcall string.copy, buffer7, eax
-
 
998
    add     edx, 256 * 32
950
;; swap icons
999
;; swap icons
951
    mov     eax, edx
1000
    mov     eax, edx
952
    sub     eax, list
1001
    sub     eax, list.lowercased
953
    shr     eax, 3
1002
    shr     eax, 3
954
    add     eax, list.icon
1003
    add     eax, list.icon
955
    push    ebx ecx
1004
    push    ebx ecx
956
    mov     ebx, [eax]
1005
    mov     ebx, [eax]
957
    mov     ecx, [eax + 4]
1006
    mov     ecx, [eax + 4]
958
    mov     [eax], ecx
1007
    mov     [eax], ecx
959
    mov     [eax + 4], ebx
1008
    mov     [eax + 4], ebx
960
    pop     ecx ebx
1009
    pop     ecx ebx
961
 .next2:
1010
 .next2:
962
    add     edx, 32
1011
    add     edx, 32
963
    cmpne   edx, esi, .loop2
1012
    cmpne   edx, esi, .loop2
964
 .next1:
1013
 .next1:
965
    inc     edi
1014
    inc     edi
966
    add     ebx, 32
1015
    add     ebx, 32
967
    cmpne   ebx, ecx, .loop1
1016
    cmpne   ebx, ecx, .loop1
968
 
1017
 
969
    ret
1018
    ret
970
 endp
1019
 endp
971
 
1020
 
972
 ;----------------------
1021
 ;----------------------
973
 
1022
 
974
 dataend:
1023
 dataend:
975
 
1024
 
976
 ;===============================
1025
 ;===============================
977
 
1026
 
978
 skin system_colors
1027
 skin system_colors
979
 list rb 32 * 256
1028
 list rb 32 * 256
-
 
1029
  .lowercased rd 32 * 256
980
  .icon rd 256
1030
  .icon rd 256
981
  .size rd 1
1031
  .size rd 1
982
 img  rd 1
1032
 img  rd 1
983
  .rgb rd 1
1033
  .rgb rd 1
984
  .size rd 1
1034
  .size rd 1
985
  .buf rb 40
1035
  .buf rb 40
986
  .sel rb 32 * 32 * 3
1036
  .sel rb 32 * 32 * 3
987
 win:
1037
 win:
988
  .x rd 1
1038
  .x rd 1
989
  .y rd 1
1039
  .y rd 1
990
 win.title rb 256
1040
 win.title rb 256
991
 param_s rd 1
1041
 param_s rd 1
992
 param_e rd 1
1042
 param_e rd 1
993
 param_a rd 1
1043
 param_a rd 1
994
 undefined rb 1
1044
 undefined rb 1
995
 buffer  rb 2048
1045
 buffer  rb 2048
996
 buffer2 rb 2048 ;OD
1046
 buffer2 rb 2048 ;OD
997
 buffer3 rb 2048 ;OD
1047
 buffer3 rb 2048 ;OD
998
 buffer4 rb 2048 ;OD
1048
 buffer4 rb 2048 ;OD
999
 buffer5 rb 2048 ;OD
1049
 buffer5 rb 2048 ;OD
1000
 buffer6 rb 2048 ;check existance
1050
 buffer6 rb 2048 ;check existance
1001
 buffer7 rb 32	 ;for sorting
1051
 buffer7 rb 32	 ;for sorting
1002
 buffer8 rd 2048
1052
 buffer8 rd 2048
1003
 params rb 2048
1053
 params rb 2048
1004
 _stack rb 2048
1054
 _stack rb 2048
1005
 memory:
1055
 memory: