Rev 6642 | Rev 7547 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6642 | Rev 6662 | ||
---|---|---|---|
1 | ; END |
1 | ; END |
2 | ; KolibriOS Team 2005-2016 |
2 | ; KolibriOS Team 2005-2016 |
3 | 3 | ||
4 | fade equ 0 |
4 | fade equ 0 |
5 | 5 | ||
6 | use32 ; ¢ª«îç¨âì 32-¡¨âë© à¥¦¨¬ áᥬ¡«¥à |
6 | use32 ; ¢ª«îç¨âì 32-¡¨âë© à¥¦¨¬ áᥬ¡«¥à |
7 | org 0x0 ; ¤à¥á æ¨ï á ã«ï |
7 | org 0x0 ; ¤à¥á æ¨ï á ã«ï |
8 | 8 | ||
9 | db 'MENUET01' ; 8-¡ ©âë© ¨¤¥â¨ä¨ª â®à MenuetOS |
9 | db 'MENUET01' ; 8-¡ ©âë© ¨¤¥â¨ä¨ª â®à MenuetOS |
10 | dd 0x01 ; ¢¥àá¨ï § £®«®¢ª (¢á¥£¤ 1) |
10 | dd 0x01 ; ¢¥àá¨ï § £®«®¢ª (¢á¥£¤ 1) |
11 | dd START ; ¤à¥á ¯¥à¢®© ª®¬ ¤ë |
11 | dd START ; ¤à¥á ¯¥à¢®© ª®¬ ¤ë |
12 | dd IM_END ; à §¬¥à ¯à®£à ¬¬ë |
12 | dd IM_END ; à §¬¥à ¯à®£à ¬¬ë |
13 | dd I_END ; ª®«¨ç¥á⢮ ¯ ¬ï⨠|
13 | dd I_END ; ª®«¨ç¥á⢮ ¯ ¬ï⨠|
14 | dd stacktop ; ¤à¥á ¢¥àè¨ë á⥪ |
14 | dd stacktop ; ¤à¥á ¢¥àè¨ë á⥪ |
15 | dd 0x0 ; ¤à¥á ¡ãä¥à ¤«ï ¯ à ¬¥â஢ |
15 | dd 0x0 ; ¤à¥á ¡ãä¥à ¤«ï ¯ à ¬¥â஢ |
16 | dd cur_dir_path |
16 | dd cur_dir_path |
17 | 17 | ||
18 | include 'lang.inc' |
18 | include 'lang.inc' |
19 | include '../../../macros.inc' |
19 | include '../../../macros.inc' |
20 | include '../../../proc32.inc' |
20 | include '../../../proc32.inc' |
21 | include '../../../dll.inc' |
21 | include '../../../dll.inc' |
22 | include '../../../develop/libraries/box_lib/load_lib.mac' |
22 | include '../../../develop/libraries/box_lib/load_lib.mac' |
23 | include '../../../develop/libraries/box_lib/trunk/box_lib.mac' |
23 | include '../../../develop/libraries/box_lib/trunk/box_lib.mac' |
24 | include '../../../gui_patterns.inc' |
24 | include '../../../gui_patterns.inc' |
25 | include "../../../string.inc" |
25 | include "../../../string.inc" |
26 | 26 | ||
27 | WIN_W equ 440 |
27 | WIN_W equ 440 |
28 | WIN_H equ 200 |
28 | WIN_H equ 200 |
29 | BOT_PANEL_H equ 70 |
29 | BOT_PANEL_H equ 70 |
30 | 30 | ||
31 | CANCEL_BUTTON_ID equ 1+BT_HIDE |
31 | CANCEL_BUTTON_ID equ 1+BT_HIDE |
32 | HOME_BUTTON_ID equ 3 |
32 | HOME_BUTTON_ID equ 2 |
33 | REBOOT_BUTTON_ID equ 2 |
33 | REBOOT_BUTTON_ID equ 3 |
34 | POWEROFF_BUTTON_ID equ 4 |
34 | POWEROFF_BUTTON_ID equ 4 |
35 | 35 | ||
36 | @use_library |
36 | @use_library |
37 | 37 | ||
38 | 38 | ||
39 | align 4 |
39 | align 4 |
40 | START: |
40 | START: |
41 | 41 | ||
42 | 42 | ||
43 | load_libraries l_libs_start,end_l_libs |
43 | load_libraries l_libs_start,end_l_libs |
44 | inc eax |
44 | inc eax |
45 | test eax,eax |
45 | test eax,eax |
46 | jz close |
46 | jz close |
47 | 47 | ||
48 | push dword check1 |
48 | push dword check1 |
49 | call [init_checkbox2] |
49 | call [init_checkbox2] |
50 | 50 | ||
51 | stdcall dll.Init,[init_lib] |
51 | stdcall dll.Init,[init_lib] |
52 | 52 | ||
53 | invoke ini_get_int,ini_file,asettings,aautosave,0 |
53 | invoke ini_get_int,ini_file,asettings,aautosave,0 |
54 | mov [autosave],eax |
54 | mov [autosave],eax |
55 | dec eax |
55 | dec eax |
56 | jnz @f |
56 | jnz @f |
57 | bts dword [check1.flags],1 |
57 | bts dword [check1.flags],1 |
58 | @@: |
58 | @@: |
59 | mcall 40,0x80000027 |
59 | mcall 40,0x80000027 |
60 | redraw: |
60 | redraw: |
61 | call draw_window |
61 | call draw_window |
62 | still: |
62 | still: |
63 | mov al,10 |
63 | mov al,10 |
64 | mcall ;wait here for event |
64 | mcall ;wait here for event |
65 | dec eax |
65 | dec eax |
66 | jz redraw |
66 | jz redraw |
67 | dec eax |
67 | dec eax |
68 | jz key |
68 | jz key |
69 | dec eax |
69 | dec eax |
70 | jz button |
70 | jz button |
71 | 71 | ||
72 | push dword check1 |
72 | push dword check1 |
73 | call [check_box_mouse2] |
73 | call [check_box_mouse2] |
74 | bt dword [check1.flags],1 |
74 | bt dword [check1.flags],1 |
75 | jnc @f |
75 | jnc @f |
76 | mov [autosave],1 |
76 | mov [autosave],1 |
77 | jmp still |
77 | jmp still |
78 | @@: |
78 | @@: |
79 | mov [autosave],0 |
79 | mov [autosave],0 |
80 | jmp still |
80 | jmp still |
81 | 81 | ||
82 | key: |
82 | key: |
83 | mov al,2 |
83 | mov al,2 |
84 | mcall ;eax=2 - get key code |
84 | mcall ;eax=2 - get key code |
85 | mov al,ah |
85 | mov al,ah |
86 | cmp al,13 |
86 | cmp al,13 |
87 | je restart |
87 | je restart |
88 | cmp al,19 |
88 | cmp al,19 |
89 | je checkbox |
89 | je checkbox |
90 | cmp al,180 |
90 | cmp al,180 |
91 | je restart_kernel |
91 | je restart_kernel |
92 | cmp al,181 |
92 | cmp al,181 |
93 | je power_off |
93 | je power_off |
94 | cmp al,27 |
94 | cmp al,27 |
95 | jne still |
95 | jne still |
96 | 96 | ||
97 | close: |
97 | close: |
98 | mcall -1 |
98 | mcall -1 |
99 | 99 | ||
100 | button: |
100 | button: |
101 | mcall 17 ;eax=17 - get pressed button id |
101 | mcall 17 ;eax=17 - get pressed button id |
102 | xchg al,ah |
102 | xchg al,ah |
103 | dec eax |
103 | dec eax |
104 | jz close |
104 | jz close |
105 | dec eax |
105 | dec eax |
106 | jz restart_kernel |
106 | jz restart_kernel |
107 | dec eax |
107 | dec eax |
108 | jz restart |
108 | jz restart |
109 | dec eax |
109 | dec eax |
110 | jnz checkbox |
110 | jnz checkbox |
111 | 111 | ||
112 | power_off: |
112 | power_off: |
113 | push 2 |
113 | push 2 |
114 | jmp mcall_and_close |
114 | jmp mcall_and_close |
115 | 115 | ||
116 | restart: |
116 | restart: |
117 | push 3 |
117 | push 3 |
118 | jmp mcall_and_close |
118 | jmp mcall_and_close |
119 | 119 | ||
120 | restart_kernel: |
120 | restart_kernel: |
121 | push 4 |
121 | push 4 |
122 | 122 | ||
123 | mcall_and_close: |
123 | mcall_and_close: |
124 | if fade=1 |
124 | if fade=1 |
125 | ; === FADE IN === |
125 | ; === FADE IN === |
126 | mov eax, color1 |
126 | mov eax, color1 |
127 | @@: |
127 | @@: |
128 | mov ebx, [eax + 32] |
128 | mov ebx, [eax + 32] |
129 | mov [eax], ebx |
129 | mov [eax], ebx |
130 | add eax, 4 |
130 | add eax, 4 |
131 | cmp eax, color21 |
131 | cmp eax, color21 |
132 | jne @b |
132 | jne @b |
133 | 133 | ||
134 | call draw_window |
134 | call draw_window |
135 | end if |
135 | end if |
136 | 136 | ||
137 | invoke ini_set_int,ini_file,asettings,aautosave,[autosave] |
137 | invoke ini_set_int,ini_file,asettings,aautosave,[autosave] |
138 | cmp [autosave],1 |
138 | cmp [autosave],1 |
139 | jne no_save |
139 | jne no_save |
140 | 140 | ||
141 | if fade=0 |
141 | if fade=0 |
142 | mov al,4 |
142 | mov al,4 |
143 | mcall ,<50,120> ,0x800000cc,label7 ;eax=4 - write text |
143 | mcall ,<50,120> ,0x800000cc,label7 ;eax=4 - write text |
144 | end if |
144 | end if |
145 | 145 | ||
146 | mcall 70,rdsave |
146 | mcall 70,rdsave |
147 | test eax,eax |
147 | test eax,eax |
148 | js no_save |
148 | js no_save |
149 | mov ecx,eax |
149 | mov ecx,eax |
150 | mcall 18,21 |
150 | mcall 18,21 |
151 | mov ecx,eax |
151 | mov ecx,eax |
152 | @@: |
152 | @@: |
153 | push ecx |
153 | push ecx |
154 | mcall 23,100 |
154 | mcall 23,100 |
155 | dec eax |
155 | dec eax |
156 | jnz no_red |
156 | jnz no_red |
157 | call draw_window |
157 | call draw_window |
158 | no_red: |
158 | no_red: |
159 | pop ecx |
159 | pop ecx |
160 | mcall 9,proc_info |
160 | mcall 9,proc_info |
161 | cmp [proc_info+50],9 |
161 | cmp [proc_info+50],9 |
162 | je no_save |
162 | je no_save |
163 | jmp @b |
163 | jmp @b |
164 | no_save: |
164 | no_save: |
165 | pop ecx |
165 | pop ecx |
166 | mcall 18,9 |
166 | mcall 18,9 |
167 | ret |
167 | ret |
168 | 168 | ||
169 | checkbox: |
169 | checkbox: |
170 | btc dword [check1.flags],1 |
170 | btc dword [check1.flags],1 |
171 | jc .1 |
171 | jc .1 |
172 | mov [autosave],1 |
172 | mov [autosave],1 |
173 | jmp .draw |
173 | jmp .draw |
174 | .1: |
174 | .1: |
175 | mov [autosave],0 |
175 | mov [autosave],0 |
176 | .draw: |
176 | .draw: |
177 | push dword check1 |
177 | push dword check1 |
178 | call [check_box_draw2] |
178 | call [check_box_draw2] |
179 | jmp still |
179 | jmp still |
180 | 180 | ||
181 | draw_window: |
181 | draw_window: |
182 | mcall 12,1 |
182 | mcall 12,1 |
183 | 183 | ||
184 | mov al,14 |
184 | mov al,14 |
185 | mcall ;eax=14 - get screen max x & max y |
185 | mcall ;eax=14 - get screen max x & max y |
186 | movzx ecx,ax |
186 | movzx ecx,ax |
187 | shr eax,17 |
187 | shr eax,17 |
188 | shl eax,16 |
188 | shl eax,16 |
189 | lea ebx,[eax-(WIN_W/2) shl 16+WIN_W-1] |
189 | lea ebx,[eax-(WIN_W/2) shl 16+WIN_W-1] |
190 | shr ecx,1 |
190 | shr ecx,1 |
191 | shl ecx,16 |
191 | shl ecx,16 |
192 | lea ecx,[ecx-(WIN_H/2) shl 16+WIN_H-1] |
192 | lea ecx,[ecx-(WIN_H/2) shl 16+WIN_H-1] |
193 | 193 | ||
194 | xor eax,eax |
194 | xor eax,eax |
195 | mov edx, 0x41000000 |
195 | mov edx, 0x41000000 |
196 | mcall ;define and draw window |
196 | mcall ;define and draw window |
197 | 197 | ||
198 | DrawWideRectangle 0, 0, WIN_W, WIN_H, 2, 0xA3A7AA |
198 | DrawWideRectangle 0, 0, WIN_W, WIN_H, 2, 0xA3A7AA |
199 | DrawBar 2, 2, WIN_W-4, WIN_H-BOT_PANEL_H-2, 0x202020 |
199 | DrawBar 2, 2, WIN_W-4, WIN_H-BOT_PANEL_H-2, 0x202020 |
200 | DrawBar 2, WIN_H-BOT_PANEL_H-2, WIN_W-4, BOT_PANEL_H, 0x4B4B4B |
200 | DrawBar 2, WIN_H-BOT_PANEL_H-2, WIN_W-4, BOT_PANEL_H, 0x4B4B4B |
201 | WriteText 30, 27, 10010001b, 0xFFFfff, TEXT_TITLE |
201 | WriteText 30, 27, 10010001b, 0xFFFfff, TEXT_TITLE |
202 | WriteText 55, 70, 10010000b, 0xFFFfff, TEXT_RDSAVE1 |
202 | WriteText 55, 70, 10010000b, 0xFFFfff, TEXT_RDSAVE1 |
203 | WriteText 55, 86, 10010000b, 0xFFFfff, TEXT_RDSAVE2 |
203 | WriteText 55, 86, 10010000b, 0xFFFfff, TEXT_RDSAVE2 |
204 | 204 | ||
205 | DefineButton WIN_W-33, 2, 32, 20, CANCEL_BUTTON_ID, 0 |
205 | DefineButton WIN_W-33, 2, 32, 20, CANCEL_BUTTON_ID, 0 |
206 | WriteText WIN_W-23, 5, 10000001b, 0xFFFfff, TEXT_CANCEL |
206 | WriteText WIN_W-23, 5, 10000001b, 0xFFFfff, TEXT_CANCEL |
207 | 207 | ||
208 | push dword check1 |
208 | push dword check1 |
209 | call [check_box_draw2] |
209 | call [check_box_draw2] |
210 | 210 | ||
211 | macro EndButton x, bgcol, id, but_text, hotkey_text |
211 | macro EndButton x, bgcol, id, but_text, hotkey_text |
212 | { |
212 | { |
213 | buty equ WIN_H-60 |
213 | buty equ WIN_H-60 |
214 | butw equ 116 |
214 | butw equ 116 |
215 | buth equ 43 |
215 | buth equ 43 |
216 | DrawWideRectangle x-3, buty-3, butw+6, buth+6, 3, 0x202020 |
216 | DrawWideRectangle x-3, buty-3, butw+6, buth+6, 3, 0x202020 |
217 | DefineButton x, buty, butw-1, buth-1, id, bgcol |
217 | DefineButton x, buty, butw-1, buth-1, id, bgcol |
218 | ; WriteTextBold -strlen(but_text)*8 + butw / 2 + x, buty+8, 10010000b, 0xFFFfff, but_text |
218 | ; WriteTextBold -strlen(but_text)*8 + butw / 2 + x, buty+8, 10010000b, 0xFFFfff, but_text |
219 | ; WriteText -strlen(but_text)*6 + butw / 2 + x, buty+26, 10000000b, 0xFFFfff, hotkey_text |
219 | ; WriteText -strlen(but_text)*6 + butw / 2 + x, buty+26, 10000000b, 0xFFFfff, hotkey_text |
220 | stdcall string.length, but_text |
220 | stdcall string.length, but_text |
221 | mov ebx,eax |
221 | mov ebx,eax |
222 | imul ebx,4 |
222 | imul ebx,4 |
223 | neg ebx |
223 | neg ebx |
224 | add ebx,butw / 2 + x |
224 | add ebx,butw / 2 + x |
225 | shl ebx,16 |
225 | shl ebx,16 |
226 | add ebx,buty+8 |
226 | add ebx,buty+8 |
227 | mcall 4, , 10010000b shl 24 + 0xFFFfff, but_text |
227 | mcall 4, , 10010000b shl 24 + 0xFFFfff, but_text |
228 | add ebx,1 shl 16 |
228 | add ebx,1 shl 16 |
229 | mcall |
229 | mcall |
230 | stdcall string.length, hotkey_text |
230 | stdcall string.length, hotkey_text |
231 | mov ebx,eax |
231 | mov ebx,eax |
232 | imul ebx,3 |
232 | imul ebx,3 |
233 | neg ebx |
233 | neg ebx |
234 | add ebx,butw / 2 + x |
234 | add ebx,butw / 2 + x |
235 | shl ebx,16 |
235 | shl ebx,16 |
236 | add ebx,buty+26 |
236 | add ebx,buty+26 |
237 | mcall 4, , 10000000b shl 24 + 0xFFFfff, hotkey_text |
237 | mcall 4, , 10000000b shl 24 + 0xFFFfff, hotkey_text |
238 | } |
238 | } |
239 | 239 | ||
240 | EndButton 20, 0x4E91C5, HOME_BUTTON_ID, TEXT_KERNEL, TEXT_HOME |
240 | EndButton 20, 0x4E91C5, HOME_BUTTON_ID, TEXT_KERNEL, TEXT_HOME |
241 | EndButton 160, 0x55C891, REBOOT_BUTTON_ID, TEXT_REBOOT, TEXT_ENTER |
241 | EndButton 160, 0x55C891, REBOOT_BUTTON_ID, TEXT_REBOOT, TEXT_ENTER |
242 | EndButton 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF, TEXT_END |
242 | EndButton 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF, TEXT_END |
243 | 243 | ||
244 | mov al,12 |
244 | mov al,12 |
245 | mcall ,2 |
245 | mcall ,2 |
246 | ret |
246 | ret |
247 | ;--------------------------------------------------------------------- |
247 | ;--------------------------------------------------------------------- |
248 | ;data |
248 | ;data |
249 | include 'data.inc' |
249 | include 'data.inc' |
250 | ;--------------------------------------------------------------------- |
250 | ;--------------------------------------------------------------------- |
251 | IM_END: |
251 | IM_END: |
252 | ;--------------------------------------------------------------------- |
252 | ;--------------------------------------------------------------------- |
253 | align 4 |
253 | align 4 |
254 | 254 | ||
255 | proc_info rb 1024 |
255 | proc_info rb 1024 |
256 | 256 | ||
257 | autosave rd 1 |
257 | autosave rd 1 |
258 | ;--------------------------------------------------------------------- |
258 | ;--------------------------------------------------------------------- |
259 | cur_dir_path: |
259 | cur_dir_path: |
260 | rb 4096 |
260 | rb 4096 |
261 | ;--------------------------------------------------------------------- |
261 | ;--------------------------------------------------------------------- |
262 | library_path: |
262 | library_path: |
263 | rb 4096 |
263 | rb 4096 |
264 | ;--------------------------------------------------------------------- |
264 | ;--------------------------------------------------------------------- |
265 | align 32 |
265 | align 32 |
266 | rb 4096 |
266 | rb 4096 |
267 | stacktop: |
267 | stacktop: |
268 | I_END: ; ¬¥âª ª®æ ¯à®£à ¬¬ë50,120> |
268 | I_END: ; ¬¥âª ª®æ ¯à®£à ¬¬ë50,120> |