Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
5665 Pathoswith 1
 
1742 mario79 2
; KolibriOS Team 2005-2016
6642 leency 3
5665 Pathoswith 4
 
4266 heavyiron 5
1742 mario79 6
 
5665 Pathoswith 7
org 0x0      ; адресация с нуля
4266 heavyiron 8
1742 mario79 9
 
5665 Pathoswith 10
dd 0x01 	 ; версия заголовка (всегда 1)
11
dd START	 ; адрес первой команды
12
dd IM_END	 ; размер программы
13
dd I_END	 ; количество памяти
14
dd stacktop	 ; адрес вершины стека
15
dd 0x0		 ; адрес буфера для параметров
16
dd cur_dir_path
4213 heavyiron 17
1742 mario79 18
 
4213 heavyiron 19
include '../../../macros.inc'
20
include '../../../proc32.inc'
21
include '../../../dll.inc'
22
include '../../../develop/libraries/box_lib/load_lib.mac'
23
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
24
include '../../../gui_patterns.inc'
6215 leency 25
include "../../../string.inc"
6642 leency 26
1742 mario79 27
 
6642 leency 28
WIN_H equ 200
29
BOT_PANEL_H equ 70
30
31
 
32
HOME_BUTTON_ID equ 2
6662 leency 33
REBOOT_BUTTON_ID equ 3
34
POWEROFF_BUTTON_ID equ 4
6642 leency 35
36
 
6190 leency 37
1742 mario79 38
 
6190 leency 39
 
4213 heavyiron 40
START:
41
1742 mario79 42
 
6190 leency 43
 
4213 heavyiron 44
	inc	eax
5665 Pathoswith 45
	test	eax,eax
46
	jz	close
47
1742 mario79 48
 
5665 Pathoswith 49
call	[init_checkbox2]
50
1742 mario79 51
 
4213 heavyiron 52
53
 
5665 Pathoswith 54
	mov   [autosave],eax
55
	dec   eax
56
	jnz   @f
57
	bts   dword [check1.flags],1
58
@@:
4213 heavyiron 59
	mcall	40,0x80000027
5665 Pathoswith 60
redraw:
4213 heavyiron 61
    call draw_window
62
still:
1742 mario79 63
    mov  al,10
4051 heavyiron 64
    mcall				     ;wait here for event
5665 Pathoswith 65
    dec  eax
1742 mario79 66
    jz	 redraw
5665 Pathoswith 67
    dec  eax
1742 mario79 68
    jz	 key
5665 Pathoswith 69
    dec  eax
4213 heavyiron 70
    jz	 button
5665 Pathoswith 71
4044 heavyiron 72
 
4213 heavyiron 73
    call [check_box_mouse2]
74
    bt	 dword [check1.flags],1
5665 Pathoswith 75
    jnc  @f
4213 heavyiron 76
    mov  [autosave],1
77
    jmp  still
78
@@:
79
    mov  [autosave],0
80
    jmp  still
81
4266 heavyiron 82
 
4213 heavyiron 83
    mov  al,2
4051 heavyiron 84
    mcall				     ;eax=2 - get key code
5665 Pathoswith 85
    mov  al,ah
1742 mario79 86
     cmp  al,13
87
     je   restart
4215 heavyiron 88
     cmp  al,19
1742 mario79 89
     je   checkbox
4215 heavyiron 90
     cmp  al,180
1742 mario79 91
     je   restart_kernel
4215 heavyiron 92
     cmp  al,181
1742 mario79 93
     je   power_off
4215 heavyiron 94
     cmp  al,27
95
     jne   still
96
1742 mario79 97
 
4215 heavyiron 98
    mcall -1
99
100
 
4044 heavyiron 101
    mcall 17				     ;eax=17 - get pressed button id
5665 Pathoswith 102
    xchg al,ah
1742 mario79 103
    dec  eax
104
    jz	 close
5665 Pathoswith 105
    dec  eax
1742 mario79 106
    jz	 restart_kernel
5665 Pathoswith 107
    dec  eax
1742 mario79 108
    jz	 restart
5665 Pathoswith 109
    dec  eax
1742 mario79 110
    jnz  checkbox
4213 heavyiron 111
4044 heavyiron 112
 
2676 leency 113
    push 2
114
    jmp  mcall_and_close
115
4213 heavyiron 116
 
2676 leency 117
    push 3
1742 mario79 118
    jmp  mcall_and_close
119
4213 heavyiron 120
 
4044 heavyiron 121
    push 4
1742 mario79 122
4213 heavyiron 123
 
1742 mario79 124
if fade=1
4266 heavyiron 125
 ; === FADE IN ===
126
    mov eax, color1
127
  @@:
128
    mov ebx, [eax + 32]
129
    mov [eax], ebx
130
    add eax, 4
131
    cmp eax, color21
132
    jne @b
133
134
 
135
end if
136
137
 
4213 heavyiron 138
    cmp  [autosave],1
139
    jne   no_save
140
4284 heavyiron 141
 
142
    mov   al,4
143
    mcall   ,<50,120> ,0x800000cc,label7	;eax=4 - write text
5665 Pathoswith 144
end if
4284 heavyiron 145
146
 
4213 heavyiron 147
    test  eax,eax
148
    js	  no_save
5665 Pathoswith 149
    mov   ecx,eax
4213 heavyiron 150
    mcall 18,21
151
    mov   ecx,eax
152
@@:
153
    push ecx
154
    mcall 23,100
4215 heavyiron 155
    dec   eax
4213 heavyiron 156
    jnz   no_red
157
    call draw_window
158
no_red:
4266 heavyiron 159
    pop   ecx
4213 heavyiron 160
    mcall 9,proc_info
161
    cmp   [proc_info+50],9
162
    je	  no_save
5665 Pathoswith 163
    jmp   @b
4213 heavyiron 164
no_save:
165
    pop  ecx
1742 mario79 166
  mcall 18,9
4266 heavyiron 167
ret
4268 heavyiron 168
1742 mario79 169
 
4213 heavyiron 170
    btc   dword [check1.flags],1
171
    jc	  .1
5665 Pathoswith 172
    mov   [autosave],1
4213 heavyiron 173
    jmp   .draw
174
.1:
175
    mov   [autosave],0
176
.draw:
177
    push  dword check1
178
    call  [check_box_draw2]
179
    jmp    still
180
4266 heavyiron 181
 
4213 heavyiron 182
    mcall 12,1
6190 leency 183
6642 leency 184
 
4215 heavyiron 185
    mcall				     ;eax=14 - get screen max x & max y
5665 Pathoswith 186
    movzx ecx,ax
4213 heavyiron 187
    shr   eax,17
4215 heavyiron 188
    shl   eax,16
189
    lea   ebx,[eax-(WIN_W/2) shl 16+WIN_W-1]
6642 leency 190
    shr   ecx,1
4215 heavyiron 191
    shl   ecx,16
192
    lea   ecx,[ecx-(WIN_H/2) shl 16+WIN_H-1]
6642 leency 193
4213 heavyiron 194
 
4215 heavyiron 195
	mov edx, 0x41000000
6642 leency 196
	mcall ;define and draw window
197
198
 
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
201
	WriteText 30, 27, 10010001b, 0xFFFfff, TEXT_TITLE
202
	WriteText 55, 70, 10010000b, 0xFFFfff, TEXT_RDSAVE1
203
	WriteText 55, 86, 10010000b, 0xFFFfff, TEXT_RDSAVE2
204
205
 
206
	WriteText  WIN_W-23, 5, 10000001b, 0xFFFfff, TEXT_CANCEL
207
4213 heavyiron 208
 
6642 leency 209
    call  [check_box_draw2]
210
4213 heavyiron 211
 
6642 leency 212
{
213
	buty equ WIN_H-60
214
	butw equ 116
215
	buth equ 43
216
	DrawWideRectangle x-3, buty-3, butw+6, buth+6, 3, 0x202020
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
219
	; WriteText     -strlen(but_text)*6 + butw / 2 + x, buty+26, 10000000b, 0xFFFfff, hotkey_text
220
	stdcall string.length, but_text
221
	mov  ebx,eax
222
	imul ebx,4
223
	neg  ebx
224
	add  ebx,butw / 2 + x
225
	shl  ebx,16
226
	add  ebx,buty+8
227
	mcall 4, , 10010000b shl 24 + 0xFFFfff, but_text
228
	add ebx,1 shl 16
229
	mcall
230
	stdcall string.length, hotkey_text
231
	mov  ebx,eax
232
	imul ebx,3
233
	neg  ebx
234
	add  ebx,butw / 2 + x
235
	shl  ebx,16
236
	add  ebx,buty+26
237
	mcall 4, , 10000000b shl 24 + 0xFFFfff, hotkey_text
238
}
239
4213 heavyiron 240
 
6642 leency 241
	EndButton 160, 0x55C891, REBOOT_BUTTON_ID,   TEXT_REBOOT, TEXT_ENTER
242
	EndButton 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF,    TEXT_END
243
4215 heavyiron 244
 
4213 heavyiron 245
    mcall   ,2
246
    ret
247
;---------------------------------------------------------------------
4215 heavyiron 248
;data
249
include 'data.inc'
4044 heavyiron 250
;---------------------------------------------------------------------
4213 heavyiron 251
IM_END:
252
;---------------------------------------------------------------------
253
align 4
254
1742 mario79 255
 
4213 heavyiron 256
257
 
258
;---------------------------------------------------------------------
259
cur_dir_path:
260
	rb 4096
5665 Pathoswith 261
;---------------------------------------------------------------------
4213 heavyiron 262
library_path:
263
	rb 4096
5665 Pathoswith 264
;---------------------------------------------------------------------
4213 heavyiron 265
align 32
266
	rb 4096
5665 Pathoswith 267
stacktop:
4213 heavyiron 268
I_END:	; метка конца программы
5665 Pathoswith 269