From 047377a66eae190d1dd56d74ee21f8a13cffc626 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 31 Oct 2016 23:41:05 +0000 Subject: [PATCH] asm end: new design git-svn-id: svn://kolibrios.org@6642 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/gui_patterns.inc | 31 ++++++++++- programs/system/end/light/data.inc | 78 ++++++++++++---------------- programs/system/end/light/end.asm | 83 +++++++++++++++++++++--------- 3 files changed, 122 insertions(+), 70 deletions(-) diff --git a/programs/gui_patterns.inc b/programs/gui_patterns.inc index ad808674dc..bc53519066 100644 --- a/programs/gui_patterns.inc +++ b/programs/gui_patterns.inc @@ -17,4 +17,33 @@ macro DrawRectangle3D x, y, w, h, color1, color2 DrawBar x,y,1,h DrawBar x,y+h,w,1,color2 DrawBar x+w,y,1,h+1 -} \ No newline at end of file +} + +macro DrawWideRectangle x, y, w, h, boder, color +{ + DrawBar x, y, w, boder, color + DrawBar x, y+h-boder, w, boder + DrawBar x, y+boder, boder, h-boder-boder + DrawBar x+w-boder, y+boder, boder, h-boder-boder +} + +macro WriteText x, y, fontType, color, text +{ + mcall 4, (x) shl 16 + (y), (fontType) shl 24 + (color), text +} + +macro WriteTextBold x, y, fontType, color, text +{ + mcall 4, (x) shl 16 + (y), (fontType) shl 24 + (color), text + add ebx,1 shl 16 + mcall +} + +BT_DEL equ 0x80000000 +BT_HIDE equ 0x40000000 +BT_NOFRAME equ 0x20000000 + +macro DefineButton x, y, w, h, id, background_color +{ + mcall 8, (x) shl 16 + (w), (y) shl 16 + (h), id, background_color +} diff --git a/programs/system/end/light/data.inc b/programs/system/end/light/data.inc index c6151fb0d1..4f6b8c69be 100644 --- a/programs/system/end/light/data.inc +++ b/programs/system/end/light/data.inc @@ -1,42 +1,41 @@ +empty_label: db ' ',0 +TEXT_HOME: db 'Home',0 +TEXT_ENTER: db 'Enter',0 +TEXT_END: db 'End',0 +TEXT_CANCEL: db 'x',0 + +strlen_var dd 0 + if lang eq ru - label2: - db 'Выключить Ядро',0 - label3: - db 'Перезапуск Отмена',0 - label4: - db 'Сохранить настройки (Ctrl-S)',0 - + TEXT_TITLE: db 'Завершение работы',0 + TEXT_RDSAVE1: db 'Сохраненить изменения, сделанные',0 + TEXT_RDSAVE2: db 'в процессе работы в системе (Ctrl+S)',0 + TEXT_KERNEL: db 'Ядро',0 + TEXT_REBOOT: db 'Перезагрузка',0 + TEXT_OFF: db 'Выключение',0 else if lang eq ge - label2: - db ' Beenden Kernel',0 - label3: - db ' Neustart Abbrechen',0 - label4: - db 'Save your settings (Ctrl-S)',0 - + TEXT_TITLE: db 'Shutdown computer',0 + TEXT_RDSAVE1: db 'Save all changes that were done',0 + TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0 + TEXT_KERNEL: db 'Kernel',0 + TEXT_REBOOT: db 'Neustart',0 + TEXT_OFF: db 'Beenden',0 else if lang eq it - label2: - db ' Spegni Kernel',0 - label3: - db ' Riavvio Annulla',0 - label4: - db 'Salva impostazioni (Ctrl-S)',0 - + TEXT_TITLE: db 'Shutdown computer',0 + TEXT_RDSAVE1: db 'Save all changes that were done',0 + TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0 + TEXT_KERNEL: db 'Kernel',0 + TEXT_REBOOT: db 'Riavvio',0 + TEXT_OFF: db 'Spegni',0 else - label2: - db 'Power off Kernel',0 - label3: - db ' Restart Cancel',0 - label4: - db 'Save your settings (Ctrl-S)',0 - + TEXT_TITLE: db 'Shutdown computer',0 + TEXT_RDSAVE1: db 'Save all changes that were done',0 + TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0 + TEXT_KERNEL: db 'Kernel',0 + TEXT_REBOOT: db 'Reboot',0 + TEXT_OFF: db 'Power off',0 end if - label5: - db ' (End) (Home)',0 - label6: - db '(Enter) (Esc)',0 - rdsave: dd 7,0,hide,0,0 db '/sys/rdsave',0 @@ -90,24 +89,13 @@ aini_get_int db 'ini_get_int',0 aini_set_int db 'ini_set_int',0 ;--------------------------------------------------------------------- -check1 check_box2 20 shl 16 +12,108 shl 16 +12,6,0xffffff,0,0,label4,ch_flag_middle +check1 check_box2 32 shl 16 +15, 70 shl 16 +15,6,0xffffff,0x757575,0x00CC00, empty_label, ch_flag_middle hide db 'h',0 asettings db 'settings',0 aautosave db 'autosave',0 ini_file db '/sys/settings/rdsave.ini',0 -color1 dd 0x6068a0 -color2 dd 0xFFFFFF -color3 dd 0xe4dfe1 - -color4 dd 0x990022 -color5 dd 0xaa7700 -color6 dd 0x777777 -color7 dd 0x007700 - -color8 dd 0x81FFFFFF -color9 dd 0x80FFFFFF If fade=1 diff --git a/programs/system/end/light/end.asm b/programs/system/end/light/end.asm index 5d877fc694..ff5342a50d 100644 --- a/programs/system/end/light/end.asm +++ b/programs/system/end/light/end.asm @@ -1,6 +1,6 @@ ; END -; KolibriOS Team 2005-2015 +; KolibriOS Team 2005-2016 fade equ 0 @@ -23,6 +23,16 @@ include '../../../dll.inc' include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../../gui_patterns.inc' +include "../../../string.inc" + +WIN_W equ 440 +WIN_H equ 200 +BOT_PANEL_H equ 70 + +CANCEL_BUTTON_ID equ 1+BT_HIDE +HOME_BUTTON_ID equ 3 +REBOOT_BUTTON_ID equ 2 +POWEROFF_BUTTON_ID equ 4 @use_library @@ -171,42 +181,67 @@ checkbox: draw_window: mcall 12,1 - + mov al,14 mcall ;eax=14 - get screen max x & max y movzx ecx,ax shr eax,17 shl eax,16 - lea ebx,[eax-165 shl 16+332] + lea ebx,[eax-(WIN_W/2) shl 16+WIN_W-1] shr ecx,1 shl ecx,16 - lea ecx,[ecx-70 shl 16+132] + lea ecx,[ecx-(WIN_H/2) shl 16+WIN_H-1] xor eax,eax - mov edx, 0x01000000 - mcall ;define and draw window - - DrawRectangle 0,0,332,132,[color1] - mov al,13 - mcall ,<1,331>,<1,1>,[color2] - mcall ,<1,1>,<1,131> - mcall ,<2,330>,<2,130>, [color3] - - mov al,8 - mcall ,<16,144> ,<16,36>,4,[color4] ;eax=8 - draw buttons - mcall ,<170,144>, ,2,[color5] - mcall , ,<62,36>,1,[color6] - mcall ,<16,144> , ,3,[color7] - - mov al,4 - mcall ,<28,19> ,[color8],label2 ;eax=4 - write text - mcall ,<28,65> , ,label3 - mcall ,<64,40> ,[color9],label5 - mcall ,<64,86> , ,label6 + mov edx, 0x41000000 + mcall ;define and draw window + + DrawWideRectangle 0, 0, WIN_W, WIN_H, 2, 0xA3A7AA + DrawBar 2, 2, WIN_W-4, WIN_H-BOT_PANEL_H-2, 0x202020 + DrawBar 2, WIN_H-BOT_PANEL_H-2, WIN_W-4, BOT_PANEL_H, 0x4B4B4B + WriteText 30, 27, 10010001b, 0xFFFfff, TEXT_TITLE + WriteText 55, 70, 10010000b, 0xFFFfff, TEXT_RDSAVE1 + WriteText 55, 86, 10010000b, 0xFFFfff, TEXT_RDSAVE2 + + DefineButton WIN_W-33, 2, 32, 20, CANCEL_BUTTON_ID, 0 + WriteText WIN_W-23, 5, 10000001b, 0xFFFfff, TEXT_CANCEL push dword check1 call [check_box_draw2] +macro EndButton x, bgcol, id, but_text, hotkey_text +{ + buty equ WIN_H-60 + butw equ 116 + buth equ 43 + DrawWideRectangle x-3, buty-3, butw+6, buth+6, 3, 0x202020 + DefineButton x, buty, butw-1, buth-1, id, bgcol + ; WriteTextBold -strlen(but_text)*8 + butw / 2 + x, buty+8, 10010000b, 0xFFFfff, but_text + ; WriteText -strlen(but_text)*6 + butw / 2 + x, buty+26, 10000000b, 0xFFFfff, hotkey_text + stdcall string.length, but_text + mov ebx,eax + imul ebx,4 + neg ebx + add ebx,butw / 2 + x + shl ebx,16 + add ebx,buty+8 + mcall 4, , 10010000b shl 24 + 0xFFFfff, but_text + add ebx,1 shl 16 + mcall + stdcall string.length, hotkey_text + mov ebx,eax + imul ebx,3 + neg ebx + add ebx,butw / 2 + x + shl ebx,16 + add ebx,buty+26 + mcall 4, , 10000000b shl 24 + 0xFFFfff, hotkey_text +} + + EndButton 20, 0x4E91C5, HOME_BUTTON_ID, TEXT_KERNEL, TEXT_HOME + EndButton 160, 0x55C891, REBOOT_BUTTON_ID, TEXT_REBOOT, TEXT_ENTER + EndButton 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF, TEXT_END + mov al,12 mcall ,2 ret