Subversion Repositories Kolibri OS

Rev

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

Rev 1004 Rev 1016
1
use32
1
use32
2
org 0x0
2
org 0x0
3
 
3
 
4
db 'MENUET01'
4
db 'MENUET01'
5
dd 0x01, START, I_END, 0x4000, 0x4000, @PARAMS, 0x0
5
dd 0x01, START, I_END, 0x4000, 0x4000, @PARAMS, 0x0
6
 
6
 
7
;-----------------------------------------------------------------------------
7
;-----------------------------------------------------------------------------
8
 
8
 
9
FALSE = 0
9
FALSE = 0
10
TRUE  = 1
10
TRUE  = 1
11
 
11
 
12
include '../../../../../proc32.inc'
12
include '../../../../../proc32.inc'
13
include '../../../../../macros.inc'
13
include '../../../../../macros.inc'
14
include 'dll.inc'
14
include 'dll.inc'
15
 
15
 
16
include '../../../develop/libraries/libs-dev/libio/libio.inc'
16
include '../../../develop/libraries/libs-dev/libio/libio.inc'
17
include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
17
include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
18
 
18
 
19
;-----------------------------------------------------------------------------
19
;-----------------------------------------------------------------------------
20
 
20
 
21
START:
21
START:
22
	mcall	68, 11
22
	mcall	68, 11
23
 
23
 
24
	stdcall dll.Load, @IMPORT
24
	stdcall dll.Load, @IMPORT
25
	or	eax, eax
25
	or	eax, eax
26
	jnz	exit
26
	jnz	exit
-
 
27
 
-
 
28
	invoke	sort.START, 1
27
 
29
 
28
	mov	ecx, 1	; for 15.4: 1 = tile
30
	mov	ecx, 1	; for 15.4: 1 = tile
29
	cmp	word [@PARAMS], '\T'
31
	cmp	word [@PARAMS], '\T'
30
	jz	set_bgr
32
	jz	set_bgr
31
	inc	ecx	; for 15.4: 2 = stretch
33
	inc	ecx	; for 15.4: 2 = stretch
32
	cmp	word [@PARAMS], '\S'
34
	cmp	word [@PARAMS], '\S'
33
	jz	set_bgr
35
	jz	set_bgr
34
 
36
 
35
	cmp	byte [@PARAMS], 0
37
	cmp	byte [@PARAMS], 0
36
	jnz	params_given
38
	jnz	params_given
37
 
39
 
38
	call	opendialog
40
	call	opendialog
39
	jc	exit
41
	jc	exit
40
	mov	esi, path
42
	mov	esi, path
41
	mov	edi, @PARAMS
43
	mov	edi, @PARAMS
42
	mov	ecx, 512/4
44
	mov	ecx, 512/4
43
	rep	movsd
45
	rep	movsd
44
	mov	byte [edi-1], 0
46
	mov	byte [edi-1], 0
45
	jmp	params_given
47
	jmp	params_given
46
 
48
 
47
set_bgr:
49
set_bgr:
48
	mcall	15, 4
50
	mcall	15, 4
49
	mov	eax, @PARAMS + 4
51
	mov	eax, @PARAMS + 4
50
	call	load_image
52
	call	load_image
51
	jc	exit_bgr
53
	jc	exit
52
 
-
 
53
	mov	esi, [image]
-
 
54
	mov	ecx, [esi + Image.Width]
-
 
55
	mov	edx, [esi + Image.Height]
-
 
56
	mcall	15, 1
-
 
57
 
-
 
58
	mcall	15, 6
-
 
59
	test	eax, eax
-
 
60
	jz	exit_bgr
-
 
61
 
-
 
62
	push	eax
-
 
63
	invoke	img.to_rgb2, esi, eax
-
 
64
	pop	ecx
-
 
65
	mcall	15, 7
-
 
66
 
-
 
67
exit_bgr:
54
 
68
	mcall	15, 3
55
	call	set_as_bgr
69
	jmp	exit
56
	jmp	exit
70
 
57
 
71
params_given:
58
params_given:
72
 
59
 
73
	mov	eax, @PARAMS
60
	mov	eax, @PARAMS
74
	call	load_image
61
	call	load_image
75
	jc	exit
62
	jc	exit
76
 
63
 
77
;-----------------------------------------------------------------------------
64
;-----------------------------------------------------------------------------
78
 
65
 
79
red:
66
red:
80
	call	draw_window
67
	call	draw_window
81
 
68
 
82
still:
69
still:
83
	mcall	10
70
	mcall	10
84
	dec	eax
71
	dec	eax
85
	jz	red
72
	jz	red
86
	dec	eax
73
	dec	eax
87
	jnz	button
74
	jnz	button
88
 
75
 
89
  key:
76
  key:
90
	mcall	2
77
	mcall	2
91
	jmp	still
78
	jmp	still
92
 
79
 
93
  button:
80
  button:
94
	mcall	17
81
	mcall	17
95
	shr	eax, 8
82
	shr	eax, 8
96
 
83
 
97
	; flip horizontally
84
	; flip horizontally
98
	cmp	eax, 'flh'
85
	cmp	eax, 'flh'
99
	jne	@f
86
	jne	@f
100
 
87
 
101
	invoke	img.flip, [image], FLIP_HORIZONTAL
88
	invoke	img.flip, [image], FLIP_HORIZONTAL
102
	jmp	redraw_image
89
	jmp	redraw_image
103
 
90
 
104
	; flip vertically
91
	; flip vertically
105
    @@: cmp	eax, 'flv'
92
    @@: cmp	eax, 'flv'
106
	jne	@f
93
	jne	@f
107
 
94
 
108
	invoke	img.flip, [image], FLIP_VERTICAL
95
	invoke	img.flip, [image], FLIP_VERTICAL
109
	jmp	redraw_image
96
	jmp	redraw_image
110
 
97
 
111
	; flip both horizontally and vertically
98
	; flip both horizontally and vertically
112
    @@: cmp	eax, 'flb'
99
    @@: cmp	eax, 'flb'
113
	jne	@f
100
	jne	@f
114
 
101
 
115
	invoke	img.flip, [image], FLIP_BOTH
102
	invoke	img.flip, [image], FLIP_BOTH
116
	jmp	redraw_image
103
	jmp	redraw_image
117
 
104
 
118
	; rotate left
105
	; rotate left
119
    @@: cmp	eax, 'rtl'
106
    @@: cmp	eax, 'rtl'
120
	jne	@f
107
	jne	@f
121
 
108
 
122
	push	ROTATE_90_CCW
109
	push	ROTATE_90_CCW
123
.rotate_common:
110
.rotate_common:
124
	invoke	img.rotate, [image]
111
	invoke	img.rotate, [image]
125
	mov	eax, [image]
112
	mov	eax, [image]
126
	test	eax, eax	; clear ZF flag
113
	test	eax, eax	; clear ZF flag
127
	call	update_image_sizes
114
	call	update_image_sizes
128
	jmp	redraw_image
115
	jmp	redraw_image
129
 
116
 
130
	; rotate right
117
	; rotate right
131
    @@: cmp	eax, 'rtr'
118
    @@: cmp	eax, 'rtr'
132
	jne	@f
119
	jne	@f
133
 
120
 
134
	push	ROTATE_90_CW
121
	push	ROTATE_90_CW
135
	jmp	.rotate_common
122
	jmp	.rotate_common
136
 
123
 
137
	; open new file
124
	; open new file
138
    @@: cmp	eax, 'opn'
125
    @@: cmp	eax, 'opn'
139
	jne	@f
126
	jne	@f
140
	
127
	
141
	call	opendialog
128
	call	opendialog
142
	jc	still
129
	jc	still
143
	push	[image]
130
	push	[image]
144
	mov	eax, path
131
	mov	eax, path
145
	call	load_image
132
	call	load_image
146
	jc	.restore_old
133
	jc	.restore_old
147
	mov	esi, path
134
	mov	esi, path
148
	mov	edi, @PARAMS
135
	mov	edi, @PARAMS
149
	mov	ecx, 512/4
136
	mov	ecx, 512/4
150
	rep	movsd
137
	rep	movsd
151
	invoke	img.destroy
-
 
152
	mov	byte [edi-1], 0
138
	mov	byte [edi-1], 0
-
 
139
	invoke	img.destroy
-
 
140
	call	free_directory
153
	jmp	red
141
	jmp	red
154
    .restore_old:
142
    .restore_old:
155
	pop	[image]
143
	pop	[image]
156
	jmp	still
144
	jmp	still
-
 
145
 
-
 
146
	; set background
-
 
147
    @@:
-
 
148
	cmp	eax, 'bgr'
-
 
149
	jne	@f
-
 
150
 
-
 
151
	call	set_as_bgr
-
 
152
	jmp	still
-
 
153
 
-
 
154
    @@:
-
 
155
 
-
 
156
	cmp	eax, 'bck'
-
 
157
	jnz	@f
-
 
158
	call	prev_image
-
 
159
	jmp	still
-
 
160
    @@:
-
 
161
	cmp	eax, 'fwd'
-
 
162
	jnz	@f
-
 
163
	call	next_image
-
 
164
	jmp	still
-
 
165
    @@:
157
 
166
 
158
    @@: cmp	eax, 1
167
	cmp	eax, 1
159
	jne	still
168
	jne	still
160
 
169
 
161
  exit:
170
  exit:
162
	mcall	-1
171
	mcall	-1
163
 
172
 
164
  redraw_image = red
173
  redraw_image = red
165
 
174
 
166
load_image:
175
load_image:
167
	and	[img_data], 0
176
	and	[img_data], 0
168
	push	eax
177
	push	eax
169
	invoke	file.open, eax, O_READ
178
	invoke	file.open, eax, O_READ
170
	or	eax, eax
179
	or	eax, eax
171
	jz	.error_pop
180
	jz	.error_pop
172
	mov	[fh], eax
181
	mov	[fh], eax
173
	invoke	file.size
182
	invoke	file.size
174
	mov	[img_data_len], ebx
183
	mov	[img_data_len], ebx
175
	stdcall mem.Alloc, ebx
184
	stdcall mem.Alloc, ebx
176
	test	eax, eax
185
	test	eax, eax
177
	jz	.error_close
186
	jz	.error_close
178
	mov	[img_data], eax
187
	mov	[img_data], eax
179
	invoke	file.read, [fh], eax, [img_data_len]
188
	invoke	file.read, [fh], eax, [img_data_len]
180
	cmp	eax, -1
189
	cmp	eax, -1
181
	jz	.error_close
190
	jz	.error_close
182
	cmp	eax, [img_data_len]
191
	cmp	eax, [img_data_len]
183
	jnz	.error_close
192
	jnz	.error_close
184
	invoke	file.close, [fh]
193
	invoke	file.close, [fh]
185
	inc	eax
194
	inc	eax
186
	jz	.error
195
	jz	.error
187
 
196
 
188
; img.decode checks for img.is_img
197
; img.decode checks for img.is_img
189
;	invoke	img.is_img, [img_data], [img_data_len]
198
;	invoke	img.is_img, [img_data], [img_data_len]
190
;	or	eax, eax
199
;	or	eax, eax
191
;	jz	exit
200
;	jz	exit
192
	invoke	img.decode, [img_data], [img_data_len]
201
	invoke	img.decode, [img_data], [img_data_len]
193
	or	eax, eax
202
	or	eax, eax
194
	jz	.error
203
	jz	.error
195
	cmp	[image], 0
204
	cmp	[image], 0
196
	mov	[image], eax
205
	mov	[image], eax
197
	call	update_image_sizes
206
	call	update_image_sizes
198
	call	free_img_data
207
	call	free_img_data
199
	clc
208
	clc
200
	ret
209
	ret
201
 
210
 
202
.error_free:
211
.error_free:
203
	invoke	img.destroy, [image]
212
	invoke	img.destroy, [image]
204
	jmp	.error
213
	jmp	.error
205
 
214
 
206
.error_pop:
215
.error_pop:
207
	pop	eax
216
	pop	eax
208
	jmp	.error
217
	jmp	.error
209
.error_close:
218
.error_close:
210
	invoke	file.close, [fh]
219
	invoke	file.close, [fh]
211
.error:
220
.error:
212
	call	free_img_data
221
	call	free_img_data
213
	stc
222
	stc
214
	ret
223
	ret
215
 
224
 
216
free_img_data:
225
free_img_data:
217
	mov	eax, [img_data]
226
	mov	eax, [img_data]
218
	test	eax, eax
227
	test	eax, eax
219
	jz	@f
228
	jz	@f
220
	stdcall	mem.Free, eax
229
	stdcall	mem.Free, eax
221
@@:
230
@@:
222
	ret
231
	ret
223
 
232
 
224
update_image_sizes:
233
update_image_sizes:
225
	pushf
234
	pushf
226
	mov	edx, [eax + Image.Width]
235
	mov	edx, [eax + Image.Width]
227
	add	edx, 19
236
	add	edx, 19
228
	cmp	edx, 50 + 25*5
237
	cmp	edx, 40 + 25*9
229
	jae	@f
238
	jae	@f
230
	mov	edx, 50 + 25*5
239
	mov	edx, 40 + 25*9
231
@@:
240
@@:
232
	mov	[wnd_width], edx
241
	mov	[wnd_width], edx
233
	mov	esi, [eax + Image.Height]
242
	mov	esi, [eax + Image.Height]
234
	add	esi, 44
243
	add	esi, 44
235
	mov	[wnd_height], esi
244
	mov	[wnd_height], esi
236
	popf
245
	popf
237
	jz	.no_resize
246
	jz	.no_resize
238
	mcall	48, 4
247
	mcall	48, 4
239
	add	esi, eax
248
	add	esi, eax
240
	mcall	67,-1,-1
249
	mcall	67,-1,-1
241
.no_resize:
250
.no_resize:
242
	ret
251
	ret
-
 
252
 
-
 
253
set_as_bgr:
-
 
254
	mov	esi, [image]
-
 
255
	mov	ecx, [esi + Image.Width]
-
 
256
	mov	edx, [esi + Image.Height]
-
 
257
	mcall	15, 1
-
 
258
 
-
 
259
	mcall	15, 6
-
 
260
	test	eax, eax
-
 
261
	jz	@f
-
 
262
 
-
 
263
	push	eax
-
 
264
	invoke	img.to_rgb2, esi, eax
-
 
265
	pop	ecx
-
 
266
	mcall	15, 7
-
 
267
 
-
 
268
@@:
-
 
269
	mcall	15, 3
-
 
270
	ret
243
 
271
 
-
 
272
prev_image:
-
 
273
	call	load_directory
-
 
274
	cmp	[directory_ptr], 0
-
 
275
	jz	.ret
-
 
276
	mov	ebx, [directory_ptr]
-
 
277
	mov	eax, [cur_file_idx]
-
 
278
	cmp	eax, -1
-
 
279
	jnz	@f
-
 
280
	mov	eax, [ebx+4]
-
 
281
@@:
-
 
282
	push	[image]
-
 
283
.scanloop:
-
 
284
	dec	eax
-
 
285
	jns	@f
-
 
286
	mov	eax, [ebx+4]
-
 
287
	dec	eax
-
 
288
	cmp	[cur_file_idx], -1
-
 
289
	jz	.notfound
-
 
290
@@:
-
 
291
	cmp	eax, [cur_file_idx]
-
 
292
	jz	.notfound
-
 
293
	push	eax
-
 
294
	imul	esi, eax, 304
-
 
295
	add	esi, [directory_ptr]
-
 
296
	add	esi, 32 + 40
-
 
297
	mov	edi, curdir
-
 
298
@@:
-
 
299
	inc	edi
-
 
300
	cmp	byte [edi-1], 0
-
 
301
	jnz	@b
-
 
302
	mov	byte [edi-1], '/'
-
 
303
@@:
-
 
304
	lodsb
-
 
305
	stosb
-
 
306
	test	al, al
-
 
307
	jnz	@b
-
 
308
	mov	eax, curdir
-
 
309
	call	load_image
-
 
310
	pop	eax
-
 
311
	jc	.scanloop
-
 
312
	mov	[cur_file_idx], eax
-
 
313
	invoke	img.destroy
-
 
314
	mov	esi, curdir
-
 
315
	mov	edi, @PARAMS
-
 
316
	mov	ecx, 512/4
-
 
317
	rep	movsd
-
 
318
	mov	byte [edi-1], 0
-
 
319
.ret:
-
 
320
	ret
-
 
321
.notfound:
-
 
322
	pop	[image]
-
 
323
	ret
-
 
324
 
-
 
325
next_image:
-
 
326
	call	load_directory
-
 
327
	cmp	[directory_ptr], 0
-
 
328
	jz	.ret
-
 
329
	mov	ebx, [directory_ptr]
-
 
330
	mov	eax, [cur_file_idx]
-
 
331
	push	[image]
-
 
332
.scanloop:
-
 
333
	inc	eax
-
 
334
	cmp	eax, [ebx+4]
-
 
335
	jb	@f
-
 
336
	xor	eax, eax
-
 
337
	cmp	[cur_file_idx], -1
-
 
338
	jz	.notfound
-
 
339
@@:
-
 
340
	cmp	eax, [cur_file_idx]
-
 
341
	jz	.notfound
-
 
342
	push	eax ebx
-
 
343
	imul	esi, eax, 304
-
 
344
	add	esi, [directory_ptr]
-
 
345
	add	esi, 32 + 40
-
 
346
	mov	edi, curdir
-
 
347
@@:
-
 
348
	inc	edi
-
 
349
	cmp	byte [edi-1], 0
-
 
350
	jnz	@b
-
 
351
	mov	byte [edi-1], '/'
-
 
352
@@:
-
 
353
	lodsb
-
 
354
	stosb
-
 
355
	test	al, al
-
 
356
	jnz	@b
-
 
357
	mov	eax, curdir
-
 
358
	call	load_image
-
 
359
	pop	ebx eax
-
 
360
	jc	.scanloop
244
draw_window:
361
	mov	[cur_file_idx], eax
-
 
362
	invoke	img.destroy
-
 
363
	mov	esi, curdir
-
 
364
	push	esi
-
 
365
	mov	edi, @PARAMS
-
 
366
	mov	ecx, 512/4
-
 
367
	rep	movsd
-
 
368
	mov	byte [edi-1], 0
-
 
369
	pop	esi
-
 
370
@@:
-
 
371
	lodsb
-
 
372
	test	al, al
-
 
373
	jnz	@b
-
 
374
@@:
-
 
375
	dec	esi
-
 
376
	cmp	byte [esi], '/'
-
 
377
	jnz	@b
-
 
378
	mov	byte [esi], 0
-
 
379
.ret:
-
 
380
	ret
-
 
381
.notfound:
-
 
382
	pop	[image]
-
 
383
	ret
-
 
384
 
-
 
385
load_directory:
-
 
386
	cmp	[directory_ptr], 0
-
 
387
	jnz	.ret
-
 
388
	mov	esi, @PARAMS
-
 
389
	mov	ecx, esi
-
 
390
@@:
-
 
391
	lodsb
-
 
392
	test	al, al
-
 
393
	jnz	@b
-
 
394
@@:
-
 
395
	dec	esi
-
 
396
	cmp	byte [esi], '/'
-
 
397
	jnz	@b
-
 
398
	mov	[last_name_component], esi
-
 
399
	sub	esi, ecx
-
 
400
	xchg	ecx, esi
-
 
401
	mov	edi, curdir
-
 
402
	rep	movsb
-
 
403
	mov	byte [edi], 0
-
 
404
	mcall	68, 12, 0x1000
-
 
405
	test	eax, eax
-
 
406
	jz	.ret
-
 
407
	mov	ebx, readdir_fileinfo
-
 
408
	mov	dword [ebx+12], (0x1000 - 32) / 304
-
 
409
	mov	dword [ebx+16], eax
-
 
410
	mcall	70
-
 
411
	cmp	eax, 6
-
 
412
	jz	.dirok
-
 
413
	test	eax, eax
-
 
414
	jnz	free_directory
-
 
415
	mov	edx, [directory_ptr]
-
 
416
	mov	ecx, [edx+8]
-
 
417
	mov	[readblocks], ecx
-
 
418
	imul	ecx, 304
-
 
419
	add	ecx, 32
-
 
420
	mcall	68, 20
-
 
421
	test	eax, eax
-
 
422
	jz	free_directory
-
 
423
	mov	[directory_ptr], eax
-
 
424
	mcall	70, readdir_fileinfo
-
 
425
.dirok:
-
 
426
	cmp	ebx, 0
-
 
427
	jle	free_directory
-
 
428
	mov	eax, [directory_ptr]
-
 
429
	add	eax, 32
-
 
430
	mov	edi, eax
-
 
431
	push	0
-
 
432
.dirskip:
-
 
433
	push	eax
-
 
434
	test	byte [eax], 18h
-
 
435
	jnz	.nocopy
-
 
436
	lea	esi, [eax+40]
-
 
437
	mov	ecx, esi
-
 
438
@@:
-
 
439
	lodsb
-
 
440
	test	al, al
-
 
441
	jnz	@b
-
 
442
@@:
-
 
443
	dec	esi
-
 
444
	cmp	esi, ecx
-
 
445
	jb	.noext
-
 
446
	cmp	byte [esi], '.'
-
 
447
	jnz	@b
-
 
448
	inc	esi
-
 
449
	mov	ecx, [esi]
-
 
450
	or	ecx, 0x202020
-
 
451
	cmp	ecx, 'jpg'
-
 
452
	jz	.copy
-
 
453
	cmp	ecx, 'bmp'
-
 
454
	jz	.copy
-
 
455
	cmp	ecx, 'gif'
-
 
456
	jz	.copy
-
 
457
	cmp	ecx, 'png'
-
 
458
	jz	.copy
-
 
459
	cmp	ecx, 'jpe'
-
 
460
	jz	.copy
-
 
461
	cmp	ecx, 'jpeg'
-
 
462
	jz	@f
-
 
463
	cmp	ecx, 'jpeG'
-
 
464
	jnz	.nocopy
-
 
465
@@:
-
 
466
	cmp	byte [esi+4], 0
-
 
467
	jnz	.nocopy
-
 
468
.copy:
-
 
469
	mov	esi, [esp]
-
 
470
	mov	ecx, 304 / 4
-
 
471
	rep	movsd
-
 
472
	inc	dword [esp+4]
-
 
473
.nocopy:
-
 
474
.noext:
-
 
475
	pop	eax
-
 
476
	add	eax, 304
-
 
477
	dec	ebx
-
 
478
	jnz	.dirskip
-
 
479
	mov	eax, [directory_ptr]
245
	invoke	gfx.open, TRUE
480
	pop	ebx
-
 
481
	mov	[eax+4], ebx
-
 
482
	test	ebx, ebx
-
 
483
	jz	free_directory
-
 
484
	push	0	; sort mode
-
 
485
	push	ebx
-
 
486
	add	eax, 32
-
 
487
	push	eax
-
 
488
	call	[SortDir]
-
 
489
	xor	eax, eax
-
 
490
	mov	edi, [directory_ptr]
-
 
491
	add	edi, 32 + 40
-
 
492
.scan:
-
 
493
	mov	esi, [last_name_component]
-
 
494
	inc	esi
-
 
495
	push	edi
-
 
496
	invoke	strcmpi
-
 
497
	pop	edi
-
 
498
	jz	.found
-
 
499
	inc	eax
-
 
500
	add	edi, 304
-
 
501
	dec	ebx
-
 
502
	jnz	.scan
-
 
503
	or	eax, -1
-
 
504
.found:
-
 
505
	mov	[cur_file_idx], eax
-
 
506
.ret:
-
 
507
	ret
-
 
508
 
-
 
509
free_directory:
-
 
510
	mcall	68, 13, [directory_ptr]
-
 
511
	and	[directory_ptr], 0
-
 
512
	ret
246
	mov	[ctx], eax
513
 
247
 
514
draw_window:
248
	mcall	48, 4
515
	mcall	48, 4
249
	mov	ebp, eax	; save skin height
516
	mov	ebp, eax	; save skin height
250
	add	eax, [wnd_height]
517
	add	eax, [wnd_height]
251
	__mov	ebx, 100, 0
518
	__mov	ebx, 100, 0
252
	add	ebx, [wnd_width]
519
	add	ebx, [wnd_width]
253
	lea	ecx, [100*65536 + eax]
520
	lea	ecx, [100*65536 + eax]
254
	mcall	0, , , 0x73FFFFFF, , s_header
521
	mcall	0, , , 0x73FFFFFF, , s_header
255
 
522
 
256
	mcall	9, procinfo, -1
523
	mcall	9, procinfo, -1
257
 
524
 
258
	mov	ebx, [procinfo + 42]
525
	mov	ebx, [procinfo + 62]
259
	sub	ebx, 9
526
	inc	ebx
260
	mcall	13, , <0, 35>, 0xFFFFFF
527
	mcall	13, , <0, 35>, 0xFFFFFF
261
	mov	ecx, [procinfo + 46]
-
 
262
	sub	ecx, ebp
528
	mov	ecx, [procinfo + 66]
263
	sub	ecx, 9
529
	sub	ecx, 4
264
	shl	ecx, 16
530
	shl	ecx, 16
265
	mov	cl, 5
531
	mov	cl, 5
266
	mcall
532
	mcall
267
	mov	cl, 35
533
	mov	cl, 35
268
	ror	ecx, 16
534
	ror	ecx, 16
269
	sub	cx, 35
535
	sub	cx, 35
270
	mov	ebx, 5
536
	mov	ebx, 5
271
	mcall
537
	mcall
272
; 5 pixels for indentation, [image.Width] pixels for image
538
; 5 pixels for indentation, [image.Width] pixels for image
273
; client_width - 5 - [image.Width] pixels must be white
539
; client_width - 5 - [image.Width] pixels must be white
274
	mov	ebx, [image]
540
	mov	ebx, [image]
275
	mov	esi, [procinfo + 62]
541
	mov	esi, [procinfo + 62]
276
	inc	esi
542
	inc	esi
277
	push	esi
543
	push	esi
278
	mov	ebx, [ebx + Image.Width]
544
	mov	ebx, [ebx + Image.Width]
279
	sub	esi, 5
545
	sub	esi, 5
280
	sub	esi, ebx
546
	sub	esi, ebx
281
	pop	ebx
547
	pop	ebx
282
	sub	ebx, esi
548
	sub	ebx, esi
283
	shl	ebx, 16
549
	shl	ebx, 16
284
	add	ebx, esi
550
	add	ebx, esi
285
	mcall
551
	mcall
286
 
-
 
287
	invoke	gfx.pen.color, [ctx], 0x007F7F7F
552
 
288
	mov	eax, [procinfo + 42]
553
	mov	ebx, [procinfo + 62]
-
 
554
	push	ebx
-
 
555
	mcall	38, , <30, 30>, 0x007F7F7F
289
	sub	eax, 10
556
	mcall	, <5 + 25 * 1, 5 + 25 * 1>, <0, 30>
-
 
557
	mcall	, <10 + 25 * 3, 10 + 25 * 3>
290
	invoke	gfx.line, [ctx], 0, 30, eax, 30
558
	mcall	, <15 + 25 * 4, 15 + 25 * 4>
-
 
559
	pop	ebx
-
 
560
	sub	ebx, 25 * 5 + 10
291
 
561
	push	ebx
-
 
562
	imul	ebx, 10001h
292
	xor	ebp, ebp
563
	mcall
293
 
564
 
294
	mcall	8, <5 + 25 * 0, 20>, <5, 20>, 'opn'+40000000h
-
 
295
	mcall	65, openbtn, <20, 20>, <5 + 25 * 0, 5>, 4, palette
565
	mcall	8, <5 + 25 * 0, 20>, <5, 20>, 'opn'+40000000h
296
 
-
 
297
	invoke	gfx.line, [ctx], 5 + 25 * 1, 0, 5 + 25 * 1, 30
566
	mcall	, <10 + 25 * 1, 20>, , 'bck'+40000000h
-
 
567
	mcall	, <10 + 25 * 2, 20>, , 'fwd'+40000000h
-
 
568
	mcall	, <15 + 25 * 3, 20>, , 'bgr'+40000000h
-
 
569
	pop	ebx
-
 
570
	add	ebx, 5
298
 
571
	shl	ebx, 16
-
 
572
	mov	bl, 20
299
	mcall	8, <10 + 25 * 1, 20>, <5, 20>, 'flh'+40000000h
573
	mcall	, , , 'flh'+40000000h
-
 
574
	add	ebx, 25 * 65536
-
 
575
	mcall	, , , 'flv'+40000000h
-
 
576
	add	ebx, 30 * 65536
-
 
577
	mcall	, , , 'rtr'+40000000h
-
 
578
	add	ebx, 25 * 65536
300
	mcall	65, fliphorzbtn, <20, 20>, <10 + 25 * 1, 5>, 4, palette
579
	mcall	, , , 'rtl'+40000000h
301
	mcall	8, <10 + 25 * 2, 20>, <5, 20>, 'flv'+40000000h
580
	add	ebx, 25 * 65536
302
	mcall	65, flipvertbtn, <20, 20>, <10 + 25 * 2, 5>, 4, palette
581
	mcall	, , , 'flb'+40000000h
303
 
582
 
304
	invoke	gfx.line, [ctx], 10 + 25 * 3, 0, 10 + 25 * 3, 30
583
	mov	ebp, (numimages-1)*20
305
 
584
 
306
	mcall	8, <15 + 25 * 3, 20>, <5, 20>, 'rtr'+40000000h
585
	mcall	65, buttons+openbtn*20, <20, 20>, <5 + 25 * 0, 5>, 8, palette
307
	mcall	65, rotcwbtn, <20, 20>, <15 + 25 * 3, 5>, 4, palette
586
	mcall	, buttons+backbtn*20, , <10 + 25 * 1, 5>
-
 
587
	mcall	, buttons+forwardbtn*20, , <10 + 25 * 2, 5>
-
 
588
	mcall	, buttons+bgrbtn*20, , <15 + 25 * 3, 5>
-
 
589
	mov	edx, [procinfo + 62]
-
 
590
	sub	edx, 25 * 5 + 4
308
	mcall	8, <15 + 25 * 4, 20>, <5, 20>, 'rtl'+40000000h
591
	shl	edx, 16
-
 
592
	mov	dl, 5
309
	mcall	65, rotccwbtn, <20, 20>, <15 + 25 * 4, 5>, 4, palette
593
	mcall	, buttons+fliphorzbtn*20
-
 
594
	add	edx, 25 * 65536
-
 
595
	mcall	, buttons+flipvertbtn*20
-
 
596
	add	edx, 30 * 65536
-
 
597
	mcall	, buttons+rotcwbtn*20
-
 
598
	add	edx, 25 * 65536
-
 
599
	mcall	, buttons+rotccwbtn*20
310
	mcall	8, <15 + 25 * 5, 20>, <5, 20>, 'flb'+40000000h
600
	add	edx, 25 * 65536
311
	mcall	65, rot180btn, <20, 20>, <15 + 25 * 5, 5>, 4, palette
601
	mcall	, buttons+rot180btn*20
312
 
602
 
313
	mov	ebx, [image]
603
	mov	ebx, [image]
314
	mov	ecx, [ebx + Image.Width]
604
	mov	ecx, [ebx + Image.Width]
315
	shl	ecx, 16
605
	shl	ecx, 16
316
	add	ecx, [ebx + Image.Height]
606
	add	ecx, [ebx + Image.Height]
317
	__mov	edx, 5, 35
607
	__mov	edx, 5, 35
318
	mov	esi, 8
608
	mov	esi, 8
319
	cmp	[ebx + Image.Type], Image.bpp8
609
	cmp	[ebx + Image.Type], Image.bpp8
320
	jz	@f
610
	jz	@f
321
	mov	esi, 24
611
	mov	esi, 24
322
	cmp	[ebx + Image.Type], Image.bpp24
612
	cmp	[ebx + Image.Type], Image.bpp24
323
	jz	@f
613
	jz	@f
324
	mov	esi, 32
614
	mov	esi, 32
325
@@:
615
@@:
326
	mov	edi, [ebx + Image.Palette]
616
	mov	edi, [ebx + Image.Palette]
327
	mov	ebx, [ebx + Image.Data]
617
	mov	ebx, [ebx + Image.Data]
328
	xor	ebp, ebp
618
	xor	ebp, ebp
329
	mcall	65
619
	mcall	65
330
 
-
 
331
	invoke	gfx.close, [ctx]
620
 
332
	ret
621
	ret
333
 
622
 
334
; void* __stdcall mem.Alloc(unsigned size);
623
; void* __stdcall mem.Alloc(unsigned size);
335
mem.Alloc:
624
mem.Alloc:
336
	push	ebx ecx
625
	push	ebx ecx
337
	mov	ecx, [esp+12]
626
	mov	ecx, [esp+12]
338
	mcall	68, 12
627
	mcall	68, 12
339
	pop	ecx ebx
628
	pop	ecx ebx
340
	ret	4
629
	ret	4
341
 
630
 
342
; void* __stdcall mem.ReAlloc(void* mptr, unsigned size);
631
; void* __stdcall mem.ReAlloc(void* mptr, unsigned size);
343
mem.ReAlloc:
632
mem.ReAlloc:
344
	push	ebx ecx edx
633
	push	ebx ecx edx
345
	mov	edx, [esp+16]
634
	mov	edx, [esp+16]
346
	mov	ecx, [esp+20]
635
	mov	ecx, [esp+20]
347
	mcall	68, 20
636
	mcall	68, 20
348
	pop	edx ecx ebx
637
	pop	edx ecx ebx
349
	ret	8
638
	ret	8
350
 
639
 
351
; void __stdcall mem.Free(void* mptr);
640
; void __stdcall mem.Free(void* mptr);
352
mem.Free:
641
mem.Free:
353
	push	ebx ecx
642
	push	ebx ecx
354
	mov	ecx, [esp+12]
643
	mov	ecx, [esp+12]
355
	mcall	68, 13
644
	mcall	68, 13
356
	pop	ecx ebx
645
	pop	ecx ebx
357
	ret	4
646
	ret	4
358
 
647
 
359
;-----------------------------------------------------------------------------
648
;-----------------------------------------------------------------------------
360
 
649
 
361
s_header db 'Kolibri Image Viewer', 0
650
s_header db 'Kolibri Image Viewer', 0
362
 
651
 
363
;-----------------------------------------------------------------------------
652
;-----------------------------------------------------------------------------
364
 
653
 
365
opendialog:
654
opendialog:
366
;
655
;
367
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
656
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
368
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
657
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
369
;
658
;
370
 
659
 
371
;;    mov esi,path
660
;;    mov esi,path
372
    mov edi,path
661
    mov edi,path
373
    xor eax,eax
662
    xor eax,eax
374
    mov ecx,(1024+16)/4
663
    mov ecx,(1024+16)/4
375
    rep stosd
664
    rep stosd
376
 
665
 
377
;mov [get_loops],0
666
;mov [get_loops],0
378
mov [dlg_pid_get],0
667
mov [dlg_pid_get],0
379
 
668
 
380
; Get my PID in dec format 4 bytes
669
; Get my PID in dec format 4 bytes
381
    mov eax,9
670
    mov eax,9
382
    mov ebx,procinfo
671
    mov ebx,procinfo
383
    or  ecx,-1
672
    or  ecx,-1
384
    mcall
673
    mcall
385
 
674
 
386
; convert eax bin to param dec
675
; convert eax bin to param dec
387
    mov eax,dword [procinfo+30]  ;offset of myPID
676
    mov eax,dword [procinfo+30]  ;offset of myPID
388
    mov edi,param+4-1		 ;offset to 4 bytes
677
    mov edi,param+4-1		 ;offset to 4 bytes
389
    mov ecx,4
678
    mov ecx,4
390
    mov ebx,10
679
    mov ebx,10
391
new_d:
680
new_d:
392
    xor edx,edx
681
    xor edx,edx
393
    div ebx
682
    div ebx
394
    add dl,'0'
683
    add dl,'0'
395
    mov [edi],dl
684
    mov [edi],dl
396
    dec edi
685
    dec edi
397
    loop new_d
686
    loop new_d
398
 
687
 
399
; wirite 1 byte space to param
688
; wirite 1 byte space to param
400
    mov [param+4],byte 32    ;Space for next parametr
689
    mov [param+4],byte 32    ;Space for next parametr
401
; and 1 byte type of dialog to param
690
; and 1 byte type of dialog to param
402
    mov [param+5],byte 'O'   ;Get Open dialog (Use 'S' for Save dialog)
691
    mov [param+5],byte 'O'   ;Get Open dialog (Use 'S' for Save dialog)
403
 
692
 
404
;
693
;
405
; STEP2 prepare IPC area for get messages
694
; STEP2 prepare IPC area for get messages
406
;
695
;
407
 
696
 
408
; prepare IPC area
697
; prepare IPC area
409
    mov [path],dword 0
698
    mov [path],dword 0
410
    mov [path+4],dword 8
699
    mov [path+4],dword 8
411
 
700
 
412
; define IPC memory
701
; define IPC memory
413
    mov eax,60
702
    mov eax,60
414
    mov ebx,1	     ; define IPC
703
    mov ebx,1	     ; define IPC
415
    mov ecx,path     ; offset of area
704
    mov ecx,path     ; offset of area
416
    mov edx,1024+16  ; size
705
    mov edx,1024+16  ; size
417
    mcall
706
    mcall
418
 
707
 
419
; change wanted events list 7-bit IPC event
708
; change wanted events list 7-bit IPC event
420
    mov eax,40
709
    mov eax,40
421
    mov ebx,01000111b
710
    mov ebx,01000111b
422
	cmp	[image], 0
711
	cmp	[image], 0
423
	jnz	@f
712
	jnz	@f
424
	mov	bl, 01000110b
713
	mov	bl, 01000110b
425
@@:
714
@@:
426
    mcall
715
    mcall
427
 
716
 
428
;
717
;
429
; STEP 3 run SYSTEM XTREE with parameters
718
; STEP 3 run SYSTEM XTREE with parameters
430
;
719
;
431
 
720
 
432
    mov eax,70
721
    mov eax,70
433
    mov ebx,run_fileinfo
722
    mov ebx,run_fileinfo
434
    mcall
723
    mcall
435
 
724
 
436
    mov [get_loops],0
725
    mov [get_loops],0
437
getmesloop:
726
getmesloop:
438
    mov eax,23
727
    mov eax,23
439
    mov ebx,50	   ;0.5 sec
728
    mov ebx,50	   ;0.5 sec
440
    mcall
729
    mcall
441
        dec     eax
730
        dec     eax
442
        jz      mred
731
        jz      mred
443
        dec     eax
732
        dec     eax
444
        jz      mkey
733
        jz      mkey
445
        dec     eax
734
        dec     eax
446
        jz      mbutton
735
        jz      mbutton
447
        cmp     al, 7-3
736
        cmp     al, 7-3
448
        jz      mgetmes
737
        jz      mgetmes
449
 
738
 
450
; Get number of procces
739
; Get number of procces
451
    mov ebx,procinfo
740
    mov ebx,procinfo
452
    mov ecx,-1
741
    mov ecx,-1
453
    mov eax,9
742
    mov eax,9
454
    mcall
743
    mcall
455
    mov ebp,eax
744
    mov ebp,eax
456
 
745
 
457
loox:
746
loox:
458
    mov eax,9
747
    mov eax,9
459
    mov ebx,procinfo
748
    mov ebx,procinfo
460
    mov ecx,ebp
749
    mov ecx,ebp
461
    mcall
750
    mcall
462
    mov eax,[DLGPID]
751
    mov eax,[DLGPID]
463
    cmp [procinfo+30],eax    ;IF Dialog find
752
    cmp [procinfo+30],eax    ;IF Dialog find
464
    je	dlg_is_work	     ;jmp to dlg_is_work
753
    je	dlg_is_work	     ;jmp to dlg_is_work
465
    dec ebp
754
    dec ebp
466
    jnz loox
755
    jnz loox
467
 
756
 
468
    jmp erroff
757
    jmp erroff
469
 
758
 
470
dlg_is_work:
759
dlg_is_work:
471
    cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
760
    cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
472
    je	erroff		       ;TESTODP2 terminated too
761
    je	erroff		       ;TESTODP2 terminated too
473
 
762
 
474
    cmp [dlg_pid_get],dword 1
763
    cmp [dlg_pid_get],dword 1
475
    je	getmesloop
764
    je	getmesloop
476
    inc [get_loops]
765
    inc [get_loops]
477
    cmp [get_loops],4  ;2 sec if DLG_PID not get, TESTOP2  terminated
766
    cmp [get_loops],4  ;2 sec if DLG_PID not get, TESTOP2  terminated
478
    jae erroff
767
    jae erroff
479
    jmp getmesloop
768
    jmp getmesloop
480
 
769
 
481
mred:
770
mred:
482
	cmp	[image], 0
771
	cmp	[image], 0
483
	jz	getmesloop
772
	jz	getmesloop
484
    call draw_window
773
    call draw_window
485
    jmp  getmesloop
774
    jmp  getmesloop
486
mkey:
775
mkey:
487
    mov  eax,2
776
    mov  eax,2
488
    mcall			; read (eax=2)
777
    mcall			; read (eax=2)
489
    jmp  getmesloop
778
    jmp  getmesloop
490
mbutton:
779
mbutton:
491
    mov  eax,17 		; get id
780
    mov  eax,17 		; get id
492
    mcall
781
    mcall
493
    cmp  ah,1			; button id=1 ?
782
    cmp  ah,1			; button id=1 ?
494
    jne  getmesloop
783
    jne  getmesloop
495
    mov  eax,-1 		; close this program
784
    mov  eax,-1 		; close this program
496
    mcall
785
    mcall
497
mgetmes:
786
mgetmes:
498
 
787
 
499
; If dlg_pid_get then second message get jmp to still
788
; If dlg_pid_get then second message get jmp to still
500
    cmp  [dlg_pid_get],dword 1
789
    cmp  [dlg_pid_get],dword 1
501
    je	 ready
790
    je	 ready
502
 
791
 
503
; First message is number of PID SYSXTREE dialog
792
; First message is number of PID SYSXTREE dialog
504
 
793
 
505
; convert PID dec to PID bin
794
; convert PID dec to PID bin
506
    movzx eax,byte [path+16]
795
    movzx eax,byte [path+16]
507
    sub eax,48
796
    sub eax,48
508
    imul eax,10
797
    imul eax,10
509
    movzx ebx,byte [path+16+1]
798
    movzx ebx,byte [path+16+1]
510
    add eax,ebx
799
    add eax,ebx
511
    sub eax,48
800
    sub eax,48
512
    imul eax,10
801
    imul eax,10
513
    movzx ebx,byte [path+16+2]
802
    movzx ebx,byte [path+16+2]
514
    add eax,ebx
803
    add eax,ebx
515
    sub eax,48
804
    sub eax,48
516
    imul eax,10
805
    imul eax,10
517
    movzx ebx,byte [path+16+3]
806
    movzx ebx,byte [path+16+3]
518
    add eax,ebx
807
    add eax,ebx
519
    sub eax,48
808
    sub eax,48
520
    mov [DLGPID],eax
809
    mov [DLGPID],eax
521
 
810
 
522
; Claear and prepare IPC area for next message
811
; Claear and prepare IPC area for next message
523
    mov [path],dword 0
812
    mov [path],dword 0
524
    mov [path+4],dword 8
813
    mov [path+4],dword 8
525
    mov [path+8],dword 0
814
    mov [path+8],dword 0
526
    mov [path+12],dword 0
815
    mov [path+12],dword 0
527
    mov [path+16],dword 0
816
    mov [path+16],dword 0
528
 
817
 
529
; Set dlg_pid_get for get next message
818
; Set dlg_pid_get for get next message
530
    mov [dlg_pid_get],dword 1
819
    mov [dlg_pid_get],dword 1
531
	cmp	[image], 0
820
	cmp	[image], 0
532
	jz	getmesloop
821
	jz	getmesloop
533
    call draw_window
822
    call draw_window
534
    jmp  getmesloop
823
    jmp  getmesloop
535
 
824
 
536
ready:
825
ready:
537
;
826
;
538
; The second message get
827
; The second message get
539
; Second message is 100 bytes path to SAVE/OPEN file
828
; Second message is 100 bytes path to SAVE/OPEN file
540
; shl path string on 16 bytes
829
; shl path string on 16 bytes
541
;
830
;
542
    mov esi,path+16
831
    mov esi,path+16
543
    mov edi,path
832
    mov edi,path
544
    mov ecx,1024/4
833
    mov ecx,1024/4
545
    rep movsd
834
    rep movsd
546
    mov [edi],byte 0
835
    mov [edi],byte 0
547
 
836
 
548
openoff:
837
openoff:
549
	mcall	40, 7
838
	mcall	40, 7
550
	clc
839
	clc
551
	ret
840
	ret
552
 
841
 
553
erroff:
842
erroff:
554
	mcall	40, 7
843
	mcall	40, 7
555
	stc
844
	stc
556
	ret
845
	ret
557
 
846
 
558
;-----------------------------------------------------------------------------
847
;-----------------------------------------------------------------------------
559
 
848
 
560
align 4
849
align 4
561
@IMPORT:
850
@IMPORT:
562
 
851
 
563
library 			\
852
library 			\
564
	libio  , 'libio.obj'  , \
853
	libio  , 'libio.obj'  , \
565
	libgfx , 'libgfx.obj' , \
854
	libgfx , 'libgfx.obj' , \
566
	libimg , 'libimg.obj'
855
	libimg , 'libimg.obj' , \
-
 
856
	sort   , 'sort.obj'
567
 
857
 
568
import	libio			  , \
858
import	libio			  , \
569
	libio.init , 'lib_init'   , \
859
	libio.init , 'lib_init'   , \
570
	file.size  , 'file.size'  , \
860
	file.size  , 'file.size'  , \
571
	file.open  , 'file.open'  , \
861
	file.open  , 'file.open'  , \
572
	file.read  , 'file.read'  , \
862
	file.read  , 'file.read'  , \
573
	file.close , 'file.close'
863
	file.close , 'file.close'
574
 
864
 
575
import	libgfx				, \
865
import	libgfx				, \
576
	libgfx.init   , 'lib_init'	, \
866
	libgfx.init   , 'lib_init'	, \
577
	gfx.open      , 'gfx.open'	, \
867
	gfx.open      , 'gfx.open'	, \
578
	gfx.close     , 'gfx.close'	, \
868
	gfx.close     , 'gfx.close'	, \
579
	gfx.pen.color , 'gfx.pen.color' , \
869
	gfx.pen.color , 'gfx.pen.color' , \
580
	gfx.line      , 'gfx.line'
870
	gfx.line      , 'gfx.line'
581
 
871
 
582
import	libimg			   , \
872
import	libimg			   , \
583
	libimg.init , 'lib_init'   , \
873
	libimg.init , 'lib_init'   , \
584
	img.is_img  , 'img.is_img' , \
874
	img.is_img  , 'img.is_img' , \
585
	img.to_rgb2 , 'img.to_rgb2', \
875
	img.to_rgb2 , 'img.to_rgb2', \
586
	img.decode  , 'img.decode' , \
876
	img.decode  , 'img.decode' , \
587
	img.flip    , 'img.flip'   , \
877
	img.flip    , 'img.flip'   , \
588
	img.rotate  , 'img.rotate' , \
878
	img.rotate  , 'img.rotate' , \
589
	img.destroy , 'img.destroy'
879
	img.destroy , 'img.destroy'
-
 
880
 
-
 
881
import  sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
590
 
882
 
-
 
883
;-----------------------------------------------------------------------------
-
 
884
 
-
 
885
virtual at 0
-
 
886
file 'kivicons.bmp':0xA,4
-
 
887
load offbits dword from 0
-
 
888
end virtual
-
 
889
numimages = 9
-
 
890
openbtn = 0
-
 
891
backbtn = 1
-
 
892
forwardbtn = 2
-
 
893
bgrbtn = 3
-
 
894
fliphorzbtn = 4
-
 
895
flipvertbtn = 5
-
 
896
rotcwbtn = 6
-
 
897
rotccwbtn = 7
591
;-----------------------------------------------------------------------------
898
rot180btn = 8
592
 
-
 
593
palette:
-
 
594
	dd	0x000000, 0x800000, 0x008000, 0x808000
899
 
595
	dd	0x000080, 0x800080, 0x008080, 0x808080
-
 
596
	dd	0xC0C0C0, 0xFF0000, 0x00FF00, 0xFFFF00
-
 
597
	dd	0x0000FF, 0xFF00FF, 0x00FFFF, 0xFFFFFF
-
 
598
 
-
 
599
macro loadbtn filename
900
palette:
600
{
901
	file 'kivicons.bmp':0x36,offbits-0x36
601
repeat 20
-
 
602
file filename:76h+(%-1)*12,10
902
buttons:
603
end repeat
903
	file 'kivicons.bmp':offbits
604
repeat 10
904
repeat 10
605
y = % - 1
905
y = % - 1
606
z = 20 - %
906
z = 20 - %
607
repeat 10
907
repeat numimages*5
608
load a byte from $ - 20*10 + y*10 + (%-1)
908
load a dword from $ - numimages*20*20 + numimages*20*y + (%-1)*4
609
load b byte from $ - 20*10 + z*10 + (%-1)
909
load b dword from $ - numimages*20*20 + numimages*20*z + (%-1)*4
610
store byte a at $ - 20*10 + z*10 + (%-1)
910
store dword a at $ - numimages*20*20 + numimages*20*z + (%-1)*4
611
store byte b at $ - 20*10 + y*10 + (%-1)
911
store dword b at $ - numimages*20*20 + numimages*20*y + (%-1)*4
612
end repeat
912
end repeat
613
end repeat
913
end repeat
614
}
-
 
615
 
-
 
616
openbtn:
-
 
617
	loadbtn 'open.bmp'
-
 
618
fliphorzbtn:
-
 
619
	loadbtn 'fliphorz.bmp'
-
 
620
flipvertbtn:
-
 
621
	loadbtn 'flipvert.bmp'
-
 
622
rotcwbtn:
-
 
623
	loadbtn 'rotcw.bmp'
-
 
624
rotccwbtn:
-
 
625
	loadbtn 'rotccw.bmp'
-
 
626
rot180btn:
-
 
627
	loadbtn 'rot180.bmp'
-
 
628
 
914
 
629
; DATA AREA
915
; DATA AREA
630
get_loops   dd 0
916
get_loops   dd 0
631
dlg_pid_get dd 0
917
dlg_pid_get dd 0
632
DLGPID	    dd 0
918
DLGPID	    dd 0
633
 
919
 
634
param:
920
param:
635
   dd 0    ; My dec PID
921
   dd 0    ; My dec PID
636
   dd 0,0  ; Type of dialog
922
   dd 0,0  ; Type of dialog
637
 
923
 
638
run_fileinfo:
924
run_fileinfo:
639
 dd 7
925
 dd 7
640
 dd 0
926
 dd 0
641
 dd param
927
 dd param
642
 dd 0
928
 dd 0
643
 dd 0
929
 dd 0
644
;run_filepath
930
;run_filepath
645
 db '/sys/SYSXTREE',0
931
 db '/sys/SYSXTREE',0
-
 
932
 
-
 
933
readdir_fileinfo:
-
 
934
	dd	1
-
 
935
	dd	0
-
 
936
	dd	0
-
 
937
readblocks dd	0
-
 
938
directory_ptr	dd	0
646
 
939
 
647
;-----------------------------------------------------------------------------
940
;-----------------------------------------------------------------------------
648
 
941
 
649
I_END:
942
I_END:
-
 
943
 
-
 
944
curdir		rb	1024
-
 
945
 
650
 
946
align 4
651
img_data     dd ?
947
img_data     dd ?
652
img_data_len dd ?
948
img_data_len dd ?
653
fh	     dd ?
949
fh	     dd ?
654
image	     dd ?
950
image	     dd ?
655
wnd_width	dd	?
951
wnd_width	dd	?
656
wnd_height	dd	?
952
wnd_height	dd	?
-
 
953
last_name_component	dd	?
-
 
954
cur_file_idx	dd	?
657
 
955
 
658
ctx dd ?
956
ctx dd ?
659
 
957
 
660
procinfo:	rb	1024
958
procinfo:	rb	1024
661
path:		rb	1024+16
959
path:		rb	1024+16
662
 
960
 
663
@PARAMS rb 512
961
@PARAMS rb 512