Rev 1108 | Rev 1417 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1219 | mario79 | 1 | ;***************************************************************************** |
1101 | Lrz | 2 | ; Example for Box_lib: scrollbar, menubar, dinamic_button |
1219 | mario79 | 3 | ; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario |
1101 | Lrz | 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: |
||
1219 | mario79 | 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 |
||
14 | ; names of its contributors may be used to endorse or promote products |
||
15 | ; derived from this software without specific prior written permission. |
||
1101 | Lrz | 16 | ; |
1219 | mario79 | 17 | ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY |
1101 | Lrz | 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 |
||
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. |
||
1219 | mario79 | 27 | ;****************************************************************************** |
1101 | Lrz | 28 | ; import_boxlib procedure written by |
29 | ;--------------------------------------------------------------------- |
||
30 | |||
31 | use32 |
||
32 | org 0x0 |
||
33 | |||
34 | db 'MENUET01' |
||
35 | dd 0x01 |
||
36 | dd START |
||
37 | dd IM_END |
||
38 | dd I_END |
||
39 | dd stacktop |
||
40 | dd 0x0 |
||
41 | dd path |
||
42 | |||
43 | include '../../../../../macros.inc' |
||
1108 | Lrz | 44 | include '../../load_lib.mac' |
1219 | mario79 | 45 | ;include 'macros.inc' |
46 | ;include 'load_lib.mac' |
||
47 | @use_library |
||
48 | include 'opendial.mac' |
||
49 | use_OpenDialog |
||
1101 | Lrz | 50 | ;--------------------------------------------------------------------- |
51 | ;--- Start of program ---------------------------------------------- |
||
52 | ;--------------------------------------------------------------------- |
||
53 | START: |
||
54 | mcall 68, 11 |
||
55 | mcall 66, 1, 1 |
||
56 | mcall 40, 0x27 |
||
57 | ;--------------------------------------------------------------------- |
||
1219 | mario79 | 58 | |
1101 | Lrz | 59 | load_libraries l_libs_start,end_l_libs |
60 | |||
1219 | mario79 | 61 | test eax,eax |
62 | jnz button.exit |
||
1101 | Lrz | 63 | |
1219 | mario79 | 64 | ; unpack deflate |
65 | mov eax,[unpack_DeflateUnpack2] |
||
66 | mov [deflate_unpack],eax |
||
1101 | Lrz | 67 | |
1219 | mario79 | 68 | ;OpenDialog initialisation |
69 | init_OpenDialog OpenDialog_data |
||
1101 | Lrz | 70 | |
71 | |||
72 | ; mov ebx,icons_file_name |
||
73 | ; mov esi,path |
||
74 | ; mov edi,file_name |
||
1219 | mario79 | 75 | |
76 | copy_path icons_file_name,path,library_path,0 |
||
1101 | Lrz | 77 | |
78 | mcall 70, fileinfo |
||
79 | |||
80 | mov [fileinfo+0],dword 0 |
||
81 | |||
82 | mov ecx,[file_info+32] |
||
83 | mov [fileinfo+12],ecx |
||
84 | mov [img_size],ecx |
||
85 | |||
86 | |||
87 | mcall 68, 12 |
||
88 | |||
89 | |||
90 | mov [fileinfo+16],eax |
||
91 | mov [image_file],eax |
||
92 | |||
93 | |||
94 | mcall 70, fileinfo |
||
95 | |||
96 | xor eax,eax |
||
97 | mov [return_code],eax |
||
98 | mov eax,image_file |
||
1219 | mario79 | 99 | call [cnv_png_import.Start] |
1101 | Lrz | 100 | |
101 | mov ecx,[image_file] |
||
102 | mcall 68, 13, |
||
103 | |||
104 | cmp [return_code],dword 0 |
||
105 | jne button.exit |
||
106 | |||
107 | mov ebx,[raw_pointer] |
||
108 | mov eax,[ebx+4] |
||
109 | ; set of button size |
||
110 | mov [dinamic_button_data_1.size_x],ax |
||
111 | mov [dinamic_button_data_1.size_y],ax |
||
112 | mov [dinamic_button_data_2.size_x],ax |
||
113 | mov [dinamic_button_data_2.size_y],ax |
||
114 | mov eax,[ebx+12] |
||
115 | ; set of RAW resolution to pixel |
||
116 | mov [dinamic_button_data_1.resolution_raw],eax |
||
117 | mov [dinamic_button_data_2.resolution_raw],eax |
||
118 | mov eax,[ebx+20] |
||
119 | add eax,ebx |
||
120 | ; set RAW palette, use else resolution 8bit or less |
||
121 | mov [dinamic_button_data_1.palette_raw],eax |
||
122 | mov [dinamic_button_data_2.palette_raw],eax |
||
123 | mov eax,[ebx+28] |
||
124 | add eax,ebx |
||
125 | ; set RAW area for passive button |
||
126 | mov [dinamic_button_data_1.passive_raw],eax |
||
127 | mov [dinamic_button_data_2.passive_raw],eax |
||
128 | mov ecx,[ebx+4] |
||
129 | imul ecx,[ebx+4] |
||
130 | imul ecx,[ebx+12] |
||
131 | shr ecx,3 |
||
132 | add eax,ecx |
||
133 | ; set RAW area for active button |
||
134 | mov [dinamic_button_data_1.active_raw],eax |
||
135 | mov [dinamic_button_data_2.active_raw],eax |
||
136 | add eax,ecx |
||
137 | ; RAW area for click button |
||
138 | mov [dinamic_button_data_1.click_raw],eax |
||
139 | mov [dinamic_button_data_2.click_raw],eax |
||
140 | ;--------------------------------------------------------------------- |
||
141 | red: |
||
142 | call draw_window |
||
143 | still: |
||
144 | mcall 10 |
||
145 | |||
146 | cmp eax,1 |
||
147 | je red |
||
148 | cmp eax,2 |
||
149 | je key |
||
150 | cmp eax,3 |
||
151 | je button |
||
152 | cmp eax,6 |
||
153 | je mouse |
||
154 | jmp still |
||
155 | |||
156 | |||
157 | ;--------------------------------------------------------------------- |
||
158 | key: |
||
159 | mcall 2 |
||
160 | jmp still |
||
161 | ;--------------------------------------------------------------------- |
||
162 | button: |
||
163 | mcall 17 |
||
164 | cmp ah, 1 |
||
165 | jne still |
||
166 | .exit: |
||
167 | mcall -1 |
||
168 | ;--------------------------------------------------------------------- |
||
169 | mouse: |
||
170 | ;----------------------------------------------- |
||
171 | cmp [scroll_bar_data_horizontal.delta2],0 |
||
172 | jne .horizontal |
||
173 | .vertical: |
||
174 | mov eax,[scroll_bar_data_vertical.max_area] |
||
175 | cmp eax,[scroll_bar_data_vertical.cur_area] |
||
176 | jbe .horizontal |
||
177 | ; mouse event for Vertical ScrollBar |
||
178 | push dword scroll_bar_data_vertical |
||
179 | call [scrollbar_ver_mouse] |
||
180 | mov eax,scroll_bar_data_vertical.redraw |
||
181 | xor ebx,ebx |
||
182 | cmp [eax],ebx |
||
183 | je @f |
||
184 | mov [eax],ebx |
||
185 | jmp .draw_cube |
||
186 | @@: |
||
187 | cmp [scroll_bar_data_vertical.delta2],0 |
||
188 | jne still |
||
189 | .horizontal: |
||
190 | mov eax,[scroll_bar_data_horizontal.max_area] |
||
191 | cmp eax,[scroll_bar_data_horizontal.cur_area] |
||
192 | jbe .other |
||
193 | ; mouse event for Horizontal ScrollBar |
||
194 | push dword scroll_bar_data_horizontal |
||
195 | call [scrollbar_hor_mouse] |
||
196 | mov eax,scroll_bar_data_horizontal.redraw |
||
197 | xor ebx,ebx |
||
198 | cmp [eax],ebx |
||
199 | je .other |
||
200 | mov [eax],ebx |
||
201 | .draw_cube: |
||
202 | call draw_cube |
||
203 | jmp still |
||
204 | .other: |
||
205 | cmp [scroll_bar_data_vertical.delta2],0 |
||
206 | jne still |
||
207 | cmp [scroll_bar_data_horizontal.delta2],0 |
||
208 | jne still |
||
209 | ;----------------------------------------------- |
||
210 | .menu_bar_1: |
||
211 | call .set_mouse_flag |
||
212 | @@: |
||
213 | ; mouse event for Menu 1 |
||
214 | push dword menu_data_1 |
||
215 | call [menu_bar_mouse] |
||
216 | cmp [menu_data_1.click],dword 1 |
||
217 | jne .menu_bar_2 |
||
218 | cmp [menu_data_1.cursor_out],dword 0 |
||
219 | jne analyse_out_menu_1 |
||
220 | jmp .menu_bar_1 |
||
221 | ;-------------------------------------------- |
||
222 | .menu_bar_2: |
||
223 | ; mouse event for Menu 2 |
||
224 | push dword menu_data_2 |
||
225 | call [menu_bar_mouse] |
||
226 | cmp [menu_data_2.click],dword 1 |
||
227 | jne .mouse_dinamic_button |
||
228 | cmp [menu_data_2.cursor_out],dword 0 |
||
229 | jne analyse_out_menu_2 |
||
230 | jmp .menu_bar_1 |
||
231 | ;-------------------------------------------- |
||
232 | .mouse_dinamic_button: |
||
233 | ; mouse event for Dinamic Button 1 |
||
234 | push dword dinamic_button_data_1 |
||
235 | call [dinamic_button_mouse] |
||
236 | mov eax,dinamic_button_data_1.click |
||