Rev 1108 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1101 | Lrz | 1 | ; |
2 | ; Example for Box_lib: scrollbar, menubar, dinamic_button |
||
3 | ; Copyright (c) 2009, Mario79 |
||
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 |
||
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 Mario79 ''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 |
||
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 | ;***************************************************************************** |
||
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' |
||
44 | include 'load_lib.mac' |
||
45 | ;--------------------------------------------------------------------- |
||
46 | ;--- Start of program ---------------------------------------------- |
||
47 | ;--------------------------------------------------------------------- |
||
48 | START: |
||
49 | mcall 68, 11 |
||
50 | mcall 66, 1, 1 |
||
51 | mcall 40, 0x27 |
||
52 | ;--------------------------------------------------------------------- |
||
53 | ; Procinfo area for function 9 in MenuBar |
||
54 | mcall 68,12,1024 |
||
55 | mov [menu_data_1.procinfo],eax |
||
56 | mov [menu_data_2.procinfo],eax |
||
57 | ;--------------------------------------------------------------------- |
||
58 | ; loading Box_Lib library |
||
59 | load_libraries l_libs_start,end_l_libs |
||
60 | ;sys_load_library boxlib_name, path, file_name, system_dir, \ |
||
61 | ;er_message_found_lib, ihead_f_l, myimport, er_message_import, ihead_f_i |
||
62 | ; test eax,eax |
||
63 | ; jnz button.exit |
||
64 | |||
65 | ;----------------------------------old |
||
66 | ; mov ebx,boxlib_name |
||
67 | ; mov esi,path |
||
68 | ; mov edi,file_name |
||
69 | ; call copy_path |
||
70 | ; |
||
71 | ; mcall 68,19,file_name ; load of alternative |
||
72 | ; test eax,eax |
||
73 | ; jnz @f |
||
74 | ; |
||
75 | ; mcall 68,19,system_dir ; load of sys directory |
||
76 | ; test eax,eax |
||
77 | ; jz button.exit |
||
78 | ;@@: |
||
79 | ; call import_boxlib |
||
80 | ;--------------------------------------------------------------------- |
||
81 | ; Load and convert BMP file for DinamicButton |
||
82 | ; This procedures use cnv_bmp.obj and this module used only for |
||
83 | ; demonstration of use DinamicButton |
||
84 | |||
85 | ; mov ebx,plugin_BMP_name |
||
86 | ; mov esi,path |
||
87 | ; mov edi,file_name |
||
88 | copy_path plugin_BMP_name,path,file_name |
||
89 | ; |
||
90 | mcall 68,19,file_name |
||
91 | test eax,eax |
||
92 | jz button.exit |
||
93 | |||
94 | mov eax,[eax+4] |
||
95 | mov [plugin],eax |
||
96 | |||
97 | |||
98 | ;проверка на сколько удачно загузилась наша либа |
||
99 | mov ebp,library01 |
||
100 | cmp dword [ebp+ll_struc_size-4],0 |
||
101 | jnz button.exit |
||
102 | ; |
||
103 | ; mov ebp,library02 |
||
104 | ; cmp dword [ebp+ll_struc_size-4],0x2 |
||
105 | ; jnz button.exit |
||
106 | ; mov eax,dword [ebp+36] |
||
107 | ; mov eax,[eax+4] |
||
108 | ; mov [plugin],eax |
||
109 | |||
110 | |||
111 | |||
112 | ; mov ebx,icons_file_name |
||
113 | ; mov esi,path |
||
114 | ; mov edi,file_name |
||
115 | copy_path icons_file_name,path,file_name |
||
116 | |||
117 | mcall 70, fileinfo |
||
118 | |||
119 | mov [fileinfo+0],dword 0 |
||
120 | |||
121 | mov ecx,[file_info+32] |
||
122 | mov [fileinfo+12],ecx |
||
123 | mov [img_size],ecx |
||
124 | |||
125 | |||
126 | mcall 68, 12 |
||
127 | |||
128 | |||
129 | mov [fileinfo+16],eax |
||
130 | mov [image_file],eax |
||
131 | |||
132 | |||
133 | mcall 70, fileinfo |
||
134 | |||
135 | xor eax,eax |
||
136 | mov [return_code],eax |
||
137 | mov eax,image_file |
||
138 | call [plugin] |
||
139 | |||
140 | mov ecx,[image_file] |
||
141 | mcall 68, 13, |
||
142 | |||
143 | cmp [return_code],dword 0 |
||
144 | jne button.exit |
||
145 | |||
146 | mov ebx,[raw_pointer] |
||
147 | mov eax,[ebx+4] |
||
148 | ; set of button size |
||
149 | mov [dinamic_button_data_1.size_x],ax |
||
150 | mov [dinamic_button_data_1.size_y],ax |
||
151 | mov [dinamic_button_data_2.size_x],ax |
||
152 | mov [dinamic_button_data_2.size_y],ax |
||
153 | mov eax,[ebx+12] |
||
154 | ; set of RAW resolution to pixel |
||
155 | mov [dinamic_button_data_1.resolution_raw],eax |
||
156 | mov [dinamic_button_data_2.resolution_raw],eax |
||
157 | mov eax,[ebx+20] |
||
158 | add eax,ebx |
||
159 | ; set RAW palette, use else resolution 8bit or less |
||
160 | mov [dinamic_button_data_1.palette_raw],eax |
||
161 | mov [dinamic_button_data_2.palette_raw],eax |
||
162 | mov eax,[ebx+28] |
||
163 | add eax,ebx |
||
164 | ; set RAW area for passive button |
||
165 | mov [dinamic_button_data_1.passive_raw],eax |
||
166 | mov [dinamic_button_data_2.passive_raw],eax |
||
167 | mov ecx,[ebx+4] |
||
168 | imul ecx,[ebx+4] |
||
169 | imul ecx,[ebx+12] |
||
170 | shr ecx,3 |
||
171 | add eax,ecx |
||
172 | ; set RAW area for active button |
||
173 | mov [dinamic_button_data_1.active_raw],eax |
||
174 | mov [dinamic_button_data_2.active_raw],eax |
||
175 | add eax,ecx |
||
176 | ; RAW area for click button |
||
177 | mov [dinamic_button_data_1.click_raw],eax |
||
178 | mov [dinamic_button_data_2.click_raw],eax |
||
179 | ;--------------------------------------------------------------------- |
||
180 | red: |
||
181 | call draw_window |
||
182 | still: |
||
183 | mcall 10 |
||
184 | |||
185 | cmp eax,1 |
||
186 | je red |
||
187 | cmp eax,2 |
||
188 | je key |
||
189 | cmp eax,3 |
||
190 | je button |
||
191 | cmp eax,6 |
||
192 | je mouse |
||
193 | jmp still |
||
194 | |||
195 | |||
196 | ;--------------------------------------------------------------------- |
||
197 | key: |
||
198 | mcall 2 |
||
199 | jmp still |
||
200 | ;--------------------------------------------------------------------- |
||
201 | button: |
||
202 | mcall 17 |
||
203 | cmp ah, 1 |
||
204 | jne still |
||
205 | .exit: |
||
206 | mcall -1 |
||
207 | ;--------------------------------------------------------------------- |
||
208 | mouse: |
||
209 | ;----------------------------------------------- |
||
210 | cmp [scroll_bar_data_horizontal.delta2],0 |
||
211 | jne .horizontal |
||
212 | .vertical: |
||
213 | mov eax,[scroll_bar_data_vertical.max_area] |
||
214 | cmp eax,[scroll_bar_data_vertical.cur_area] |
||
215 | jbe .horizontal |
||
216 | ; mouse event for Vertical ScrollBar |
||
217 | push dword scroll_bar_data_vertical |
||
218 | call [scrollbar_ver_mouse] |
||
219 | mov eax,scroll_bar_data_vertical.redraw |
||
220 | xor ebx,ebx |
||
221 | cmp [eax],ebx |
||
222 | je @f |
||
223 | mov [eax],ebx |
||
224 | jmp .draw_cube |
||
225 | @@: |
||
226 | cmp [scroll_bar_data_vertical.delta2],0 |
||
227 | jne still |
||
228 | .horizontal: |
||
229 | mov eax,[scroll_bar_data_horizontal.max_area] |
||
230 | cmp eax,[scroll_bar_data_horizontal.cur_area] |
||
231 | jbe .other |
||
232 | ; mouse event for Horizontal ScrollBar |
||
233 | push dword scroll_bar_data_horizontal |
||
234 | call [scrollbar_hor_mouse] |
||
235 | mov eax,scroll_bar_data_horizontal.redraw |
||
236 | xor ebx,ebx |
||
237 | cmp [eax],ebx |
||
238 | je .other |
||
239 | mov [eax],ebx |
||
240 | .draw_cube: |
||
241 | call draw_cube |
||
242 | jmp still |
||
243 | .other: |
||
244 | cmp [scroll_bar_data_vertical.delta2],0 |
||
245 | jne still |
||
246 | cmp [scroll_bar_data_horizontal.delta2],0 |
||
247 | jne still |
||
248 | ;----------------------------------------------- |
||
249 | .menu_bar_1: |
||
250 | call .set_mouse_flag |
||
251 | @@: |
||
252 | ; mouse event for Menu 1 |
||
253 | push dword menu_data_1 |
||
254 | call [menu_bar_mouse] |
||
255 | cmp [menu_data_1.click],dword 1 |
||
256 | jne .menu_bar_2 |
||
257 | cmp [menu_data_1.cursor_out],dword 0 |
||
258 | jne analyse_out_menu_1 |
||
259 | jmp .menu_bar_1 |
||
260 | ;-------------------------------------------- |
||
261 | .menu_bar_2: |
||