2011-01-18 15:29:19 +01:00
|
|
|
|
; END
|
2021-01-10 20:33:26 +01:00
|
|
|
|
; KolibriOS Team 2005-2021
|
2015-08-03 14:38:30 +02:00
|
|
|
|
|
2021-12-22 12:32:12 +01:00
|
|
|
|
use32 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ०<><E0A5A6> <20><>ᥬ<EFBFBD><E1A5AC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
org 0x0 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>
|
2013-11-21 10:36:24 +01:00
|
|
|
|
|
2021-12-22 12:32:12 +01:00
|
|
|
|
db 'MENUET01' ; 8-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䨪<EFBFBD><E4A8AA><EFBFBD><EFBFBD> MenuetOS
|
|
|
|
|
dd 0x01 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28>ᥣ<EFBFBD><E1A5A3> 1)
|
|
|
|
|
dd START ; <20><><EFBFBD><EFBFBD><EFBFBD> <20><>ࢮ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
dd IM_END ; ࠧ<><E0A0A7><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
|
|
|
|
|
dd I_END ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⢮ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
dd stacktop ; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>設<EFBFBD> <20>⥪<EFBFBD>
|
|
|
|
|
dd 0x0 ; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><>ࠬ<EFBFBD><E0A0AC>
|
|
|
|
|
dd 0x0
|
2013-11-11 23:49:12 +01:00
|
|
|
|
|
|
|
|
|
include 'lang.inc'
|
|
|
|
|
include '../../../macros.inc'
|
|
|
|
|
include '../../../proc32.inc'
|
|
|
|
|
include '../../../dll.inc'
|
2021-01-10 20:33:26 +01:00
|
|
|
|
include '../../../KOSfuncs.inc'
|
|
|
|
|
include '../../../load_lib.mac'
|
2016-02-13 16:26:28 +01:00
|
|
|
|
include '../../../gui_patterns.inc'
|
2021-12-22 12:32:12 +01:00
|
|
|
|
include '../../../string.inc'
|
2013-11-11 23:49:12 +01:00
|
|
|
|
|
2016-02-11 00:25:56 +01:00
|
|
|
|
@use_library
|
|
|
|
|
|
2013-11-11 23:49:12 +01:00
|
|
|
|
START:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
mcall SF_SYS_MISC, SSF_HEAP_INIT
|
|
|
|
|
mcall SF_SYS_MISC, SSF_MEM_OPEN, checkbox_sharedname
|
|
|
|
|
mov [checkbox_img], eax
|
2013-11-11 23:49:12 +01:00
|
|
|
|
|
2021-12-22 12:32:12 +01:00
|
|
|
|
load_libraries l_libs_start,end_l_libs
|
|
|
|
|
inc eax
|
|
|
|
|
test eax,eax
|
|
|
|
|
jz close
|
2016-02-11 00:25:56 +01:00
|
|
|
|
|
2021-12-22 12:32:12 +01:00
|
|
|
|
stdcall dll.Init,[init_lib]
|
2013-11-11 23:49:12 +01:00
|
|
|
|
|
2021-12-22 12:32:12 +01:00
|
|
|
|
invoke ini_get_int,ini_file,asettings,aautosave,0
|
|
|
|
|
mov [autosave],eax
|
2013-11-11 23:49:12 +01:00
|
|
|
|
redraw:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
call draw_window
|
2013-10-17 16:31:03 +02:00
|
|
|
|
still:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
mcall SF_WAIT_EVENT ;wait here for event
|
|
|
|
|
dec eax
|
|
|
|
|
jz redraw
|
|
|
|
|
dec eax
|
|
|
|
|
jz key
|
|
|
|
|
dec eax
|
|
|
|
|
jz button
|
|
|
|
|
jmp still
|
2013-11-21 10:36:24 +01:00
|
|
|
|
|
2013-11-11 23:49:12 +01:00
|
|
|
|
key:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
mcall SF_GET_KEY ;get key code
|
|
|
|
|
mov al,ah
|
2011-01-18 15:29:19 +01:00
|
|
|
|
cmp al,13
|
2013-11-12 01:45:05 +01:00
|
|
|
|
je restart
|
2011-01-18 15:29:19 +01:00
|
|
|
|
cmp al,19
|
2013-11-12 01:45:05 +01:00
|
|
|
|
je checkbox
|
2011-01-18 15:29:19 +01:00
|
|
|
|
cmp al,180
|
2013-11-12 01:45:05 +01:00
|
|
|
|
je restart_kernel
|
2011-01-18 15:29:19 +01:00
|
|
|
|
cmp al,181
|
2013-11-12 01:45:05 +01:00
|
|
|
|
je power_off
|
|
|
|
|
cmp al,27
|
2021-12-22 12:32:12 +01:00
|
|
|
|
jne still
|
2013-11-12 01:45:05 +01:00
|
|
|
|
|
|
|
|
|
close:
|
2021-01-10 20:33:26 +01:00
|
|
|
|
mcall SF_TERMINATE_PROCESS
|
2011-01-18 15:29:19 +01:00
|
|
|
|
|
2013-10-17 16:31:03 +02:00
|
|
|
|
button:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
mcall SF_GET_BUTTON ;get pressed button id
|
|
|
|
|
xchg al,ah
|
|
|
|
|
dec eax
|
|
|
|
|
jz close
|
|
|
|
|
dec eax
|
|
|
|
|
jz restart_kernel
|
|
|
|
|
dec eax
|
|
|
|
|
jz restart
|
|
|
|
|
dec eax
|
|
|
|
|
jnz checkbox
|
2013-10-17 16:31:03 +02:00
|
|
|
|
|
2012-05-25 11:21:47 +02:00
|
|
|
|
power_off:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
push 2
|
|
|
|
|
jmp mcall_and_close
|
2013-11-11 23:49:12 +01:00
|
|
|
|
|
2012-05-25 11:21:47 +02:00
|
|
|
|
restart:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
push 3
|
|
|
|
|
jmp mcall_and_close
|
2013-11-11 23:49:12 +01:00
|
|
|
|
|
2013-10-17 16:31:03 +02:00
|
|
|
|
restart_kernel:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
push 4
|
2013-11-11 23:49:12 +01:00
|
|
|
|
|
2011-01-18 15:29:19 +01:00
|
|
|
|
mcall_and_close:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
invoke ini_set_int,ini_file,asettings,aautosave,[autosave]
|
|
|
|
|
cmp [autosave],1
|
2013-11-11 23:49:12 +01:00
|
|
|
|
jne no_save
|
2013-11-23 11:09:40 +01:00
|
|
|
|
|
2021-12-22 12:32:12 +01:00
|
|
|
|
mcall SF_DRAW_TEXT,<55,108>,0x90FF990A,TEXT_SAVING
|
2013-11-23 11:09:40 +01:00
|
|
|
|
|
2021-01-10 20:33:26 +01:00
|
|
|
|
mcall SF_FILE,rdsave
|
2013-11-11 23:49:12 +01:00
|
|
|
|
test eax,eax
|
2021-12-22 12:32:12 +01:00
|
|
|
|
js no_save
|
2013-11-11 23:49:12 +01:00
|
|
|
|
mov ecx,eax
|
2021-01-10 20:33:26 +01:00
|
|
|
|
mcall SF_SYSTEM,SSF_GET_THREAD_SLOT
|
2013-11-11 23:49:12 +01:00
|
|
|
|
mov ecx,eax
|
|
|
|
|
@@:
|
|
|
|
|
push ecx
|
2021-01-10 20:33:26 +01:00
|
|
|
|
mcall SF_WAIT_EVENT_TIMEOUT,100
|
2013-11-11 23:49:12 +01:00
|
|
|
|
dec eax
|
|
|
|
|
jnz no_red
|
2021-12-22 12:32:12 +01:00
|
|
|
|
call draw_window
|
2013-11-21 10:36:24 +01:00
|
|
|
|
no_red:
|
2013-11-11 23:49:12 +01:00
|
|
|
|
pop ecx
|
2021-01-10 20:33:26 +01:00
|
|
|
|
mcall SF_THREAD_INFO,proc_info
|
2013-11-11 23:49:12 +01:00
|
|
|
|
cmp [proc_info+50],9
|
2021-12-22 12:32:12 +01:00
|
|
|
|
je no_save
|
2013-11-11 23:49:12 +01:00
|
|
|
|
jmp @b
|
|
|
|
|
no_save:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
pop ecx
|
2021-01-10 20:33:26 +01:00
|
|
|
|
mcall SF_SYSTEM,SSF_SHUTDOWN
|
|
|
|
|
mcall SF_TERMINATE_PROCESS
|
2013-11-21 10:48:36 +01:00
|
|
|
|
ret
|
2013-11-11 23:49:12 +01:00
|
|
|
|
|
|
|
|
|
checkbox:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
cmp [autosave],1
|
|
|
|
|
je .1
|
2013-11-11 23:49:12 +01:00
|
|
|
|
mov [autosave],1
|
|
|
|
|
jmp .draw
|
|
|
|
|
.1:
|
|
|
|
|
mov [autosave],0
|
|
|
|
|
.draw:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
call draw_checkbox_flag
|
|
|
|
|
jmp still
|
2013-11-21 10:36:24 +01:00
|
|
|
|
|
2013-11-11 23:49:12 +01:00
|
|
|
|
draw_window:
|
2021-01-10 20:33:26 +01:00
|
|
|
|
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
2021-12-22 12:32:12 +01:00
|
|
|
|
|
|
|
|
|
mcall SF_GET_SCREEN_SIZE
|
2013-11-11 23:49:12 +01:00
|
|
|
|
movzx ecx,ax
|
2013-11-12 01:45:05 +01:00
|
|
|
|
shr eax,17
|
|
|
|
|
shl eax,16
|
2016-11-01 00:41:05 +01:00
|
|
|
|
lea ebx,[eax-(WIN_W/2) shl 16+WIN_W-1]
|
2013-11-12 01:45:05 +01:00
|
|
|
|
shr ecx,1
|
|
|
|
|
shl ecx,16
|
2016-11-01 00:41:05 +01:00
|
|
|
|
lea ecx,[ecx-(WIN_H/2) shl 16+WIN_H-1]
|
2013-11-12 01:45:05 +01:00
|
|
|
|
|
|
|
|
|
xor eax,eax
|
2021-12-22 12:32:12 +01:00
|
|
|
|
mov edx, 0x41000000
|
|
|
|
|
mcall ;define and draw window
|
|
|
|
|
|
|
|
|
|
DrawWideRectangle 0, 0, WIN_W, WIN_H, 2, 0xA3A7AA
|
|
|
|
|
mcall SF_DRAW_RECT, <2,WIN_W-4>, <2,WIN_H-BOT_PANEL_H-2>, 0x202020
|
|
|
|
|
mcall SF_DRAW_RECT, <2,WIN_W-4>, <WIN_H-BOT_PANEL_H-2,BOT_PANEL_H>, 0x4B4B4B
|
|
|
|
|
|
2021-12-22 21:19:48 +01:00
|
|
|
|
mcall SF_DRAW_TEXT, <30,21>, 0x91FFFfff, TEXT_WTITLE
|
2021-12-22 12:32:12 +01:00
|
|
|
|
mcall SF_DRAW_TEXT, <55,70>, 0x90FFFfff, TEXT_RDSAVE1
|
|
|
|
|
mcall SF_DRAW_TEXT, <55,86>, 0x90FFFfff, TEXT_RDSAVE2
|
|
|
|
|
mcall SF_DRAW_TEXT, <WIN_W-23,5>, 0x81FFFfff, TEXT_CANCEL
|
|
|
|
|
|
|
|
|
|
mcall SF_DEFINE_BUTTON, <WIN_W-35,32>, <2,22>, CANCEL_BUTTON_ID
|
|
|
|
|
mcall SF_DEFINE_BUTTON, <32,14>, <70,14>, CHECKBOX_BUTTON_ID
|
|
|
|
|
mcall SF_DEFINE_BUTTON, <47,WIN_W-47>, <68,34>, CHECKBOX_BUTTON_ID+BT_NOFRAME
|
|
|
|
|
DrawRectangle3D 32, 70, 14, 14, 0x606060, 0xAFAFAF
|
|
|
|
|
call draw_checkbox_flag
|
|
|
|
|
|
|
|
|
|
stdcall EndButton, 20, 0x4E91C5, HOME_BUTTON_ID, TEXT_KERNEL, TEXT_HOME
|
2021-12-22 21:19:48 +01:00
|
|
|
|
stdcall EndButton, 160, 0x41C166, REBOOT_BUTTON_ID, TEXT_REBOOT, TEXT_ENTER
|
2021-12-22 12:32:12 +01:00
|
|
|
|
stdcall EndButton, 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF, TEXT_END
|
|
|
|
|
|
|
|
|
|
mcall SF_REDRAW,SSF_END_DRAW
|
|
|
|
|
ret
|
2016-11-01 00:41:05 +01:00
|
|
|
|
|
2021-12-22 12:32:12 +01:00
|
|
|
|
proc EndButton x, bgcol, id, but_text, hotkey_text
|
|
|
|
|
BUTY = WIN_H-60
|
|
|
|
|
BUTW = 116
|
|
|
|
|
mov ebx,[x]
|
|
|
|
|
sub ebx,3
|
2021-12-22 21:19:48 +01:00
|
|
|
|
mcall SF_DRAW_RECT, <ebx,BUTW+7>, <BUTY-3,43+6>, 0x202020
|
2021-12-22 12:32:12 +01:00
|
|
|
|
mcall SF_DEFINE_BUTTON, <[x],BUTW>, <BUTY,43-1>, [id], [bgcol]
|
|
|
|
|
; -strlen(but_text)*8 + BUTW / 2 + x, BUTY+8
|
|
|
|
|
stdcall string.length, [but_text]
|
|
|
|
|
neg eax
|
|
|
|
|
lea ebx,[eax*4+BUTW/2]
|
|
|
|
|
add ebx,[x]
|
|
|
|
|
mcall SF_DRAW_TEXT, <ebx,BUTY+8>, 0x90FFFfff, [but_text]
|
|
|
|
|
add ebx,1 shl 16
|
|
|
|
|
mcall
|
|
|
|
|
stdcall string.length, [hotkey_text]
|
|
|
|
|
neg eax
|
|
|
|
|
lea ebx,[eax*3+BUTW/2]
|
|
|
|
|
add ebx,[x]
|
|
|
|
|
shl ebx,16
|
|
|
|
|
add ebx,BUTY+26
|
|
|
|
|
mcall SF_DRAW_TEXT, , 0x80FFFfff, [hotkey_text]
|
|
|
|
|
ret
|
|
|
|
|
endp
|
|
|
|
|
|
|
|
|
|
draw_checkbox_flag:
|
|
|
|
|
cmp [autosave],0
|
|
|
|
|
je .flag_unset
|
|
|
|
|
cmp [checkbox_img],0
|
|
|
|
|
je .flag_set_but_no_checkbox_img
|
|
|
|
|
.flag_set:
|
|
|
|
|
mcall SF_PUT_IMAGE, [checkbox_img], <13,13>, <33,71>
|
|
|
|
|
ret
|
|
|
|
|
.flag_set_but_no_checkbox_img:
|
|
|
|
|
mcall SF_DRAW_RECT, <33,13>, <71,13>, 0xffffff
|
|
|
|
|
mcall SF_DRAW_RECT, <34,11>, <72,11>, 0x58C33C
|
|
|
|
|
ret
|
|
|
|
|
.flag_unset:
|
|
|
|
|
DrawRectangle3D 33, 71, 12, 12, 0xDDDddd, 0xffffff
|
|
|
|
|
mcall SF_DRAW_RECT, <34,12>, <72,12>, 0xFFFfff
|
2013-11-11 23:49:12 +01:00
|
|
|
|
ret
|
2013-11-12 01:45:05 +01:00
|
|
|
|
;---------------------------------------------------------------------
|
2013-10-17 16:31:03 +02:00
|
|
|
|
include 'data.inc'
|
2013-11-11 23:49:12 +01:00
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
IM_END:
|
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
proc_info rb 1024
|
|
|
|
|
autosave rd 1
|
|
|
|
|
;---------------------------------------------------------------------
|
2021-01-10 20:33:26 +01:00
|
|
|
|
library_path rb 4096
|
2013-11-11 23:49:12 +01:00
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
align 32
|
2021-12-22 12:32:12 +01:00
|
|
|
|
rb 4096
|
2013-11-11 23:49:12 +01:00
|
|
|
|
stacktop:
|
2021-12-22 12:32:12 +01:00
|
|
|
|
I_END: ; <20><>⪠ <20><><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
|