Subversion Repositories Kolibri OS

Rev

Rev 6662 | Rev 8532 | 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
7547 leency 167
    mcall -1
168
ret
4268 heavyiron 169
1742 mario79 170
 
4213 heavyiron 171
    btc   dword [check1.flags],1
172
    jc	  .1
5665 Pathoswith 173
    mov   [autosave],1
4213 heavyiron 174
    jmp   .draw
175
.1:
176
    mov   [autosave],0
177
.draw:
178
    push  dword check1
179
    call  [check_box_draw2]
180
    jmp    still
181
4266 heavyiron 182
 
4213 heavyiron 183
    mcall 12,1
6190 leency 184
6642 leency 185
 
4215 heavyiron 186
    mcall				     ;eax=14 - get screen max x & max y
5665 Pathoswith 187
    movzx ecx,ax
4213 heavyiron 188
    shr   eax,17
4215 heavyiron 189
    shl   eax,16
190
    lea   ebx,[eax-(WIN_W/2) shl 16+WIN_W-1]
6642 leency 191
    shr   ecx,1
4215 heavyiron 192
    shl   ecx,16
193
    lea   ecx,[ecx-(WIN_H/2) shl 16+WIN_H-1]
6642 leency 194
4213 heavyiron 195
 
4215 heavyiron 196
	mov edx, 0x41000000
6642 leency 197
	mcall ;define and draw window
198
199
 
200
	DrawBar 2, 2, WIN_W-4, WIN_H-BOT_PANEL_H-2, 0x202020
201
	DrawBar 2, WIN_H-BOT_PANEL_H-2, WIN_W-4, BOT_PANEL_H, 0x4B4B4B
202
	WriteText 30, 27, 10010001b, 0xFFFfff, TEXT_TITLE
203
	WriteText 55, 70, 10010000b, 0xFFFfff, TEXT_RDSAVE1
204
	WriteText 55, 86, 10010000b, 0xFFFfff, TEXT_RDSAVE2
205
206
 
207
	WriteText  WIN_W-23, 5, 10000001b, 0xFFFfff, TEXT_CANCEL
208
4213 heavyiron 209
 
6642 leency 210
    call  [check_box_draw2]
211
4213 heavyiron 212
 
6642 leency 213
{
214
	buty equ WIN_H-60
215
	butw equ 116
216
	buth equ 43
217
	DrawWideRectangle x-3, buty-3, butw+6, buth+6, 3, 0x202020
218
	DefineButton x, buty, butw-1, buth-1, id, bgcol
219
	; WriteTextBold -strlen(but_text)*8 + butw / 2 + x, buty+8,  10010000b, 0xFFFfff, but_text
220
	; WriteText     -strlen(but_text)*6 + butw / 2 + x, buty+26, 10000000b, 0xFFFfff, hotkey_text
221
	stdcall string.length, but_text
222
	mov  ebx,eax
223
	imul ebx,4
224
	neg  ebx
225
	add  ebx,butw / 2 + x
226
	shl  ebx,16
227
	add  ebx,buty+8
228
	mcall 4, , 10010000b shl 24 + 0xFFFfff, but_text
229
	add ebx,1 shl 16
230
	mcall
231
	stdcall string.length, hotkey_text
232
	mov  ebx,eax
233
	imul ebx,3
234
	neg  ebx
235
	add  ebx,butw / 2 + x
236
	shl  ebx,16
237
	add  ebx,buty+26
238
	mcall 4, , 10000000b shl 24 + 0xFFFfff, hotkey_text
239
}
240
4213 heavyiron 241
 
6642 leency 242
	EndButton 160, 0x55C891, REBOOT_BUTTON_ID,   TEXT_REBOOT, TEXT_ENTER
243
	EndButton 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF,    TEXT_END
244
4215 heavyiron 245
 
4213 heavyiron 246
    mcall   ,2
247
    ret
248
;---------------------------------------------------------------------
4215 heavyiron 249
;data
250
include 'data.inc'
4044 heavyiron 251
;---------------------------------------------------------------------
4213 heavyiron 252
IM_END:
253
;---------------------------------------------------------------------
254
align 4
255
1742 mario79 256
 
4213 heavyiron 257
258
 
259
;---------------------------------------------------------------------
260
cur_dir_path:
261
	rb 4096
5665 Pathoswith 262
;---------------------------------------------------------------------
4213 heavyiron 263
library_path:
264
	rb 4096
5665 Pathoswith 265
;---------------------------------------------------------------------
4213 heavyiron 266
align 32
267
	rb 4096
5665 Pathoswith 268
stacktop:
4213 heavyiron 269
I_END:	; метка конца программы
5665 Pathoswith 270