Subversion Repositories Kolibri OS

Rev

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

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