Subversion Repositories Kolibri OS

Rev

Rev 8271 | Rev 8993 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3380 mario79 1
;*****************************************************************************
2
; Color Dialog - for Kolibri OS
3
; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario
4
; All rights reserved.
5
;
6
; Redistribution and use in source and binary forms, with or without
7
; modification, are permitted provided that the following conditions are met:
8
;        * Redistributions of source code must retain the above copyright
9
;          notice, this list of conditions and the following disclaimer.
10
;        * Redistributions in binary form must reproduce the above copyright
11
;          notice, this list of conditions and the following disclaimer in the
12
;          documentation and/or other materials provided with the distribution.
13
;        * Neither the name of the  nor the
14
;          names of its contributors may be used to endorse or promote products
15
;          derived from this software without specific prior written permission.
16
;
17
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
18
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
21
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
;*****************************************************************************
3417 mario79 28
;---------------------------------------------------------------------
29
;Some documentation for memory
30
;
31
;area name db 'FFFFFFFF_color_dialog',0 ; FFFFFFFF = PID
32
;
33
; communication area data
34
; flag  ; +0
35
; dw 0   ; 0 - empty, 1 - OK, color selected
36
;          2 - use another method/not found program, 3 - cancel
37
;
38
; type of dialog:  0-Palette&Tone
39
; dw 0 ; +2
40
;
41
; window X size ; +4
42
; dw 0
43
;
3587 fedesco 44
; window X position ; +6
3417 mario79 45
; dw 0
46
;
47
; window y size ; +8
48
; dw 0
49
;
50
; window Y position ; +10
51
; dw 0
52
;
53
; ColorDialog WINDOW SLOT ; +12
54
; dd 0
55
;
56
; Color type ; +16
57
; dd 0
58
;
59
; Color value ; +20
60
; dd 0
3473 mario79 61
 
62
; First start flag ; +24
63
; dd 0 ; 0 - first start, 1 - subsequent starts
64
;
65
; Old colors ; +28
66
; rd 10
67
;
68
; Free area ; +68
3417 mario79 69
;---------------------------------------------------------------------
3380 mario79 70
  use32
8288 IgorA 71
  org	 0
3380 mario79 72
  db	 'MENUET01'
8288 IgorA 73
  dd	 1, START, IM_END, I_END, stacktop, param, path
3380 mario79 74
;---------------------------------------------------------------------
75
include '../../macros.inc'
8288 IgorA 76
include '../../proc32.inc'
8271 IgorA 77
include '../../KOSfuncs.inc'
78
include '../../load_lib.mac'
3469 mario79 79
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
3380 mario79 80
;include 'lang.inc'
3469 mario79 81
;include '../../debug.inc'
82
@use_library
3380 mario79 83
;---------------------------------------------------------------------
84
p_start_x = 10
85
p_start_y = 10
86
 
87
p_size_x = 20
88
p_size_y = 256
89
;--------------------------------------
90
t_start_x = 40
91
t_start_y = 10
92
;--------------------------------------
93
w_start_x = 200
94
w_start_y = 200
95
 
96
w_size_x = 400
97
w_size_y = 350
98
;--------------------------------------
99
c_start_x = t_start_x + p_size_y + 10
100
c_start_y = 10
101
 
8288 IgorA 102
c_size_x = 27
3380 mario79 103
c_size_y = 20
8288 IgorA 104
ed_size_x = 53
3380 mario79 105
;---------------------------------------------------------------------
3463 mario79 106
x_minimal_size equ 350
107
y_minimal_size equ 250
108
;---------------------------------------------------------------------
3380 mario79 109
START:
8288 IgorA 110
	mcall	SF_SYS_MISC,SSF_HEAP_INIT
111
	;mcall	SF_KEYBOARD,SSF_SET_INPUT_MODE,1
112
	mcall	SF_SET_EVENTS_MASK,0x27
3473 mario79 113
;--------------------------------------
3469 mario79 114
load_libraries	l_libs_start,end_l_libs
115
	test	eax,eax
116
	jnz	button.exit_2
3473 mario79 117
;--------------------------------------
8288 IgorA 118
	call	get_communication_area
119
	call	get_active_pocess
120
	call	clear_colors_history
3380 mario79 121
	xor	eax,eax
122
	mov	al,p_size_x
123
	mov	[palette_SIZE_X],eax
124
	mov	ax,p_size_y
125
	mov	[palette_SIZE_Y],eax
126
	mov	[tone_SIZE_X],eax
127
	mov	[tone_SIZE_Y],eax
128
	mov	eax,0xff0000
129
	mov	[tone_color],eax
130
	mov	[selected_color],eax
3469 mario79 131
	call	prepare_scrollbars_position_from_color
3380 mario79 132
;--------------------------------------
133
	mov	ecx,[palette_SIZE_Y]
134
	imul	ecx,[palette_SIZE_X]
135
	lea	ecx,[ecx*3]
136
	inc	ecx	;reserve for stosd
8288 IgorA 137
	mcall	SF_SYS_MISC,SSF_MEM_ALLOC
3380 mario79 138
	mov	[palette_area],eax
139
;--------------------------------------
140
	call	create_palette
3587 fedesco 141
;--------------------------------------
3380 mario79 142
	mov	ecx,[tone_SIZE_Y]
143
	imul	ecx,[tone_SIZE_X]
144
	lea	ecx,[ecx*3]
145
	inc	ecx	;reserve for stosd
8288 IgorA 146
	mcall	SF_SYS_MISC,SSF_MEM_ALLOC
3380 mario79 147
	mov	[tone_area],eax
148
;--------------------------------------
149
	call    create_tone
150
;---------------------------------------------------------------------
151
align 4
152
red:
153
	call	draw_window
154
;---------------------------------------------------------------------
155
align 4
156
still:
8288 IgorA 157
	mcall	SF_WAIT_EVENT
3380 mario79 158
 
159
	cmp	eax,1
160
	je	red
161
 
162
	cmp	eax,2
163
	je	key
164
 
165
	cmp	eax,3
3469 mario79 166
	je	button
3587 fedesco 167
 
3469 mario79 168
	cmp	eax,6
169
	je	mouse
3587 fedesco 170
 
3469 mario79 171
	jmp	still
3380 mario79 172
;---------------------------------------------------------------------
173
align 4
174
button:
8288 IgorA 175
	mcall	SF_GET_BUTTON
3380 mario79 176
 
177
	cmp	ah, 2
178
	je	palette_button
3587 fedesco 179
 
3380 mario79 180
	cmp	ah, 3
181
	je	tone_button
3417 mario79 182
 
183
	cmp	ah, 4
184
	je	color_button
3587 fedesco 185
 
3473 mario79 186
	cmp	ah, 30
187
	jb	@f
3587 fedesco 188
 
3473 mario79 189
	cmp	ah, 39
190
	ja	@f
3587 fedesco 191
 
3473 mario79 192
	sub	ah,30
193
	movzx	eax,ah
194
	shl	eax,2
195
	add	eax,[communication_area]
196
	add	eax,28
197
	mov	eax,[eax]
198
	mov	[selected_color],eax
199
	call	prepare_scrollbars_position_from_color
200
	call	draw_selected_color
201
	call	draw_scrollbars
202
	jmp	still
203
;--------------------------------------
204
align 4
205
@@:
3380 mario79 206
	cmp	ah, 1
207
	jne	still
3473 mario79 208
;--------------------------------------
209
align 4
3380 mario79 210
.exit:
3417 mario79 211
	mov	eax,[communication_area]
212
	mov	[eax],word 3
3473 mario79 213
	jmp	@f
3417 mario79 214
; dps "CD flag value: cancel "
3473 mario79 215
;--------------------------------------
216
align 4
3417 mario79 217
.exit_1:
3473