Subversion Repositories Kolibri OS

Rev

Rev 2188 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1951 mario79 1
;---------------------------------------------------------------------
2
k_background:
3
	test	dword [status],8
4
	jnz	still
5
	or	dword [status],8
6
 
2000 mario79 7
	call	get_memory_for_thread_stack
1951 mario79 8
	mov	[thread_stack_4],eax
9
	mcall	51,1,thread4	;, thread_stack_4
10
	jmp	still
11
;---------------------------------------------------------------------
12
thread4:	; start of bgrd thread
13
	mcall	9, procinfo_threads, -1
14
	mov	eax,[ebx+30]
15
	mov	[PID4],eax
16
	mcall	40, 0x27
17
.red:
18
	call	.draw_window
19
.still:
20
	mov	eax,10	; wait here for event
21
	mcall
22
 
23
	cmp	eax,1	; redraw request ?
24
	je	.red
2000 mario79 25
 
1951 mario79 26
	cmp	eax,2	; key in buffer ?
27
	je	.key
2000 mario79 28
 
1951 mario79 29
	cmp	eax,3	; button in buffer ?
30
	je	.button
2000 mario79 31
 
1951 mario79 32
	cmp	eax,6	; mouse in buffer ?
33
	je	.mouse
2000 mario79 34
 
1951 mario79 35
	jmp	.still
2000 mario79 36
;---------------------------------------------------------------------
1951 mario79 37
.mouse:
2188 mario79 38
	mov	eax,option_group1
39
	mov	ecx,[eax]
1951 mario79 40
	push	dword option_boxes_bcgr
41
	call	[option_box_mouse]
2188 mario79 42
	cmp	ecx,[eax]
43
	je	.option_boxes_SCC
1951 mario79 44
 
2188 mario79 45
	mov	ebx,bgrmode
46
	cmp	[eax],dword op1
1951 mario79 47
	jne	@f
2188 mario79 48
	mov	[ebx],dword 1
49
	jmp	.option_group1_color_set
2000 mario79 50
;---------------------------------------------------------------------
1951 mario79 51
@@:
2188 mario79 52
	cmp	[eax],dword op2
2163 mario79 53
	jne	@f
2188 mario79 54
	mov	[ebx],dword 2
55
	jmp	.option_group1_color_set
2000 mario79 56
;---------------------------------------------------------------------
2163 mario79 57
@@:
2188 mario79 58
	cmp	[eax],dword op3
2163 mario79 59
	jne	@f
2188 mario79 60
	mov	[ebx],dword 3
61
	jmp	.option_group1_color_set
2163 mario79 62
;---------------------------------------------------------------------
63
@@:
2188 mario79 64
	cmp	[eax],dword op4
65
	jne	.option_boxes_SCC
66
	mov	[ebx],dword 4
67
.option_group1_color_set:
68
	mov	[bcgr_group_pointer],0
69
	call	.option_boxes_redraw
2163 mario79 70
	jmp	.still
71
;---------------------------------------------------------------------
2188 mario79 72
.option_boxes_SCC:
73
	mov	eax,[option_group3]
74
	push	dword option_boxes_SCC
75
	call	[option_box_mouse]
76
	cmp	eax,[option_group3]
77
	je	.still
78
 
79
	call	.convert_1
80
	mov	[bcgr_group_pointer],1
81
	call	.option_boxes_redraw
82
	jmp	.still
83
;---------------------------------------------------------------------
84
.tab:
85
	mov	al,[bcgr_group_pointer]
86
	inc	al
87
	and	al,1
88
	mov	[bcgr_group_pointer],al
89
	call	.option_boxes_redraw
90
	jmp	.still
91
;---------------------------------------------------------------------
1951 mario79 92
.key:
93
	mcall
94
	cmp	ah,27
95
	je	.close
2000 mario79 96
 
1951 mario79 97
	cmp	ah,13
98
	je	.kok
2000 mario79 99
 
2188 mario79 100
	cmp	ah,9
101
	je	.tab
102
 
103
	cmp	[bcgr_group_pointer],1
104
	je	.key_option_group3
105
;---------------------------------------------------------------------
106
.key_option_group1:
107
	mov	ebx,bgrmode
108
 
1951 mario79 109
	cmp	ah,178 ;up
110
	jne	.nofup
2000 mario79 111
 
2188 mario79 112
	cmp	[ebx],dword 1
1951 mario79 113
	je	.fdn
114
.fup:
2188 mario79 115
	dec	dword [ebx]
1951 mario79 116
	jmp	.flagcont
2188 mario79 117
;--------------------------------------
1951 mario79 118
.nofup:
119
	cmp	ah,177 ;down
120
	jne	.still
2000 mario79 121
 
2188 mario79 122
	cmp	[ebx],dword 4
1951 mario79 123
	je	.fup
124
.fdn:
2188 mario79 125
	inc	dword [ebx]
1951 mario79 126
.flagcont:
2188 mario79 127
	mov	eax,option_group1
128
	cmp	[ebx],dword 1
1951 mario79 129
	jne	@f
2000 mario79 130
 
2188 mario79 131
	mov	[eax],dword op1
132
	call	.draw_opt_boxes_bcgr
1951 mario79 133
	jmp	.still
2188 mario79 134
;---------------------------------------
1951 mario79 135
@@:
2188 mario79 136
	cmp	[ebx],dword 2
2000 mario79 137
	jne	@f
138
 
2188 mario79 139
	mov	[eax],dword op2
140
	call	.draw_opt_boxes_bcgr
1951 mario79 141
	jmp	.still
2188 mario79 142
;----------------------------------------
2000 mario79 143
@@:
2188 mario79 144
	cmp	[ebx],dword 3
2000 mario79 145
	jne	@f
146
 
2188 mario79 147
	mov	[eax],dword op3
148
	call	.draw_opt_boxes_bcgr
2000 mario79 149
	jmp	.still
2188 mario79 150
;-----------------------------------------
151
@@:
152
	mov	[eax],dword op4
153
	call	.draw_opt_boxes_bcgr
154
	jmp	.still
2000 mario79 155
;---------------------------------------------------------------------
2188 mario79 156
.key_option_group3:
157
	push	eax
158
	call	.convert_1
159
	pop	eax
160
 
161
	cmp	ah,178	;up
162
	jne	@f
163
 
164
	dec	word [ebx+2]
165
	jmp	.flagcont_1
166
;------------------------------------------
2000 mario79 167
@@:
2188 mario79 168
	cmp	ah,177	;down
169
	jne	@f
170
 
171
	inc	word [ebx+2]
172
	jmp	.flagcont_1
173
;------------------------------------------
174
@@:
175
	cmp	ah,176	;left
176
	jne	@f
177
 
178
	dec	word [ebx]
179
	jmp	.flagcont_1
180
;------------------------------------------
181
@@:
182
	cmp	ah,179	;right
183
	jne	.still
184
 
185
	inc	word [ebx]
186
;------------------------------------------
187
.flagcont_1:
188
	call	.convert_2
189
	call	.convert_1	;for additional check
190
	call	.draw_opt_boxes_SCC
2000 mario79 191
	jmp	.still
192
;---------------------------------------------------------------------
2188 mario79 193
.convert_1:
194
	mov	eax,option_group3
195
	mov	ebx,Stretch_Crop_Corner
196
	cmp	[eax],dword op_UL
197
	jne	@f
198
	mov	[ebx],dword 0 shl 16+0
199
	jmp	.option_group3_color_set
200
;----------------------------------------
201
@@:
202
	cmp	[eax],dword op_UC
203
	jne	@f
204
	mov	[ebx],dword 0 shl 16+1
205
	jmp	.option_group3_color_set
206
;-----------------------------------------
207
@@:
208
	cmp	[eax],dword op_UR
209
	jne	@f
210
	mov	[ebx],dword 0 shl 16+2
211
	jmp	.option_group3_color_set
212
;-----------------------------------------
213
@@:
214
	cmp	[eax],dword op_CL
215
	jne	@f
216
	mov	[ebx],dword 1 shl 16+0
217
	jmp	.option_group3_color_set
218
;------------------------------------------
219
@@:
220
	cmp	[eax],dword op_CC
221
	jne	@f
222
	mov	[ebx],dword 1 shl 16+1
223
	jmp	.option_group3_color_set
224
;-------------------------------------------
225
@@:
226
	cmp	[eax],dword op_CR
227
	jne	@f
228
	mov	[ebx],dword 1 shl 16+2
229
	jmp	.option_group3_color_set
230
;--------------------------------------------
231
@@:
232
	cmp	[eax],dword op_DL
233
	jne	@f
234
	mov	[ebx],dword 2 shl 16+0
235
	jmp	.option_group3_color_set
236
;--------------------------------------------
237
@@:
238
	cmp	[eax],dword op_DC
239
	jne	@f
240
	mov	[ebx],dword 2 shl 16+1
241
	jmp	.option_group3_color_set
242
;--------------------------------------------
243
@@:
244
	cmp	[eax],dword op_DR
245
	jne	.option_group3_color_set
246
	mov	[ebx],dword 2 shl 16+2
247
.option_group3_color_set:
248
	ret
249
;---------------------------------------------------------------------
250
.convert_2:
251
	mov	eax,Stretch_Crop_Corner
252
	mov	ebx,option_group3
253
	cmp	[eax],dword 0 shl 16+0
254
	jne	@f
255
	mov	[ebx],dword op_UL
256
	jmp	.Stretch_Crop_Corner_set
257
;----------------------------------------
258
@@:
259
	cmp	[eax],dword 0 shl 16+1
260
	jne	@f
261
	mov	[ebx],dword op_UC
262
	jmp	.Stretch_Crop_Corner_set
263
;-----------------------------------------
264
@@:
265
	cmp	[eax],dword 0 shl 16+2
266
	jne	@f
267
	mov	[ebx],dword op_UR
268
	jmp	.Stretch_Crop_Corner_set
269
;-----------------------------------------
270
@@:
271
	cmp	[eax],dword 1 shl 16+0
272
	jne	@f
273
	mov	[ebx],dword op_CL
274
	jmp	.Stretch_Crop_Corner_set
275
;------------------------------------------
276
@@:
277
	cmp	[eax],dword 1 shl 16+1
278
	jne	@f
279
	mov	[ebx],dword op_CC
280
	jmp	.Stretch_Crop_Corner_set
281
;-------------------------------------------
282
@@:
283
	cmp	[eax],dword 1 shl 16+2
284
	jne	@f
285
	mov	[ebx],dword op_CR
286
	jmp	.Stretch_Crop_Corner_set
287
;--------------------------------------------
288
@@:
289
	cmp	[eax],dword 2 shl 16+0
290
	jne	@f
291
	mov	[ebx],dword op_DL
292
	jmp	.Stretch_Crop_Corner_set
293
;--------------------------------------------
294
@@:
295
	cmp	[eax],dword 2 shl 16+1
296
	jne	@f
297
	mov	[ebx],dword op_DC
298
	jmp	.Stretch_Crop_Corner_set
299
;--------------------------------------------
300
@@:
301
	cmp	[eax],dword 2 shl 16+2
302
	jne	.Stretch_Crop_Corner_set
303
	mov	[ebx],dword op_DR
304
.Stretch_Crop_Corner_set:
305
	ret
306
;---------------------------------------------------------------------
1951 mario79 307
.button:		; button
2188 mario79 308
	mcall	17	; get id
3423 mario79 309
	cmp	ah,4
310
	je	.kok
311
 
312
	cmp	ah,5
313
	je	.start_ColorDialog
314
;	cmp	ah,1	; button id=1 ?
315
;	jne	.noclose
1951 mario79 316
.close:
317
	xor	dword [status],8
318
	xor	eax,eax
319
	mov	[PID4],eax
320
 
321
	mcall	68,13,[thread_stack_4]
322
	mov	eax,-1	; close this program
323
	mcall
324
.noclose:
325
.kok:
326
	call	background
327
	jmp	.close
3423 mario79 328
;---------------------------------------------------------------------
329
.start_ColorDialog:
330
	push    dword ColorDialog_data
331
	call    [ColorDialog_Start]
332
	call	clear_control_key_flag
333
; 2 - use another method/not found program
334
	cmp	[ColorDialog_data.status],2
335
	je	.still
336
; 1 - OK, color selected
337
	cmp	[ColorDialog_data.status],1
338
	jne	.still
339
 
340
	mov	eax,[ColorDialog_data.color]
341
	mov	[background_color],eax
342
	jmp	.still
2000 mario79 343
;---------------------------------------------------------------------
1951 mario79 344
;	*********************************************
345
;	*******	WINDOW DEFINITIONS AND DRAW ********
346
;	*********************************************
347
.draw_window:
348
	mcall	12,1
2000 mario79 349
	xor	eax,eax
350
	xor	esi,esi
3423 mario79 351
	mcall	,<100,300>,<100,170>,0x13909090,,labelt4
352
	mcall	8,<60,40>,<120,20>,4,0xdddddd
353
	mcall	,<220,40>,<120,20>,5,[background_color]	; 0xdddddd
354
	mcall	4,<36,28>,0xffffff,bgrdtext,bgrdtext.size
355
	push	ebx
356
	add	ebx,170*65536
357
	mcall	,,,scc_text,scc_text.size
358
	pop	ebx
359
	add	ebx,40*65536+98
2000 mario79 360
	xor	ecx,ecx
361
	mcall	,,,ok_btn,ok_btn.size
3423 mario79 362
	add	ebx,40*65536
363
	mcall	,,0xffffff,color_btn,color_btn.size
2188 mario79 364
	call	.option_boxes_redraw
2000 mario79 365
;	mcall	47,0x80000,[PID4],<200, 5>,0xffffff
1951 mario79 366
	mcall	12,2
367
	ret
368
;---------------------------------------------------------------------
2188 mario79 369
.option_boxes_redraw:
370
	call	.draw_opt_boxes_bcgr
371
	call	.draw_opt_boxes_SCC
372
	ret
373
;---------------------------------------------------------------------
374
.draw_opt_boxes_bcgr:
375
	mov	edx,0x13909090
376
	cmp	[bcgr_group_pointer],0
377
	jne	@f
378
 
379
	mov	edx,0xffff80
380
@@:
3423 mario79 381
	mcall	13,<59,14>,<44,59>,
1951 mario79 382
	push	dword option_boxes_bcgr
383
	call	[option_box_draw]
2188 mario79 384
	ret
385
;---------------------------------------------------------------------
386
.draw_opt_boxes_SCC:
387
	mov	edx,0x13909090
388
	cmp	[bcgr_group_pointer],1
389
	jne	@f
390
 
391
	mov	edx,0xffff80
392
@@:
393
	mcall	13,<198,70>,<38,70>,
394
	push	dword option_boxes_SCC
395
	call	[option_box_draw]
1951 mario79 396
	ret