CMM End v2.0

git-svn-id: svn://kolibrios.org@5738 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-08-17 21:24:56 +00:00
parent 4823ea9991
commit 2ea3102d62
8 changed files with 84 additions and 159 deletions

View File

@ -1,5 +0,0 @@
C-- end.c
@del end
@rename end.com end
@del warning.txt
@pause

View File

@ -1,166 +1,78 @@
#define MEMSIZE 0x3E80 #ifndef AUTOBUILD
#include "..\lib\kolibri.h" #include "lang.h--"
#include "..\lib\gui.h"
#include "..\lib\strings.h"
#include "..\lib\random.h"
#include "..\lib\mem.h"
#include "..\lib\file_system.h"
#ifndef ru
char *BUTTONS_CAPTIONS[]={
"Ïåðåçàãðóçêà [Enter]"w, 13,
"Âûêëþ÷åíèå [End]"w, 181,
//"ßäðî [Home]"w, 180,
"Îòìåíà [Esc]"w, 27,
0};
#else
char *BUTTONS_CAPTIONS[]={
" Reboot [Enter]",13,
" Power off [End]",181,
//" Kernel [Home]",180,
" Close [Esc]",27,
0};
#endif #endif
unsigned char moon[6*6] = FROM "moon.raw"; #define MEMSIZE 4096*4
#include "../lib/gui.h"
#include "../lib/file_system.h"
int WIN_SIZE_X, WIN_SIZE_Y; #ifdef LANG_RUS
int PANEL_X, PANEL_Y; #define TEXT_TITLE "Завершение работы"
#define TEXT_RDSAVE1 "Нажмите Ctrl+S для сохранения изменений"
#define NIGHT_PALEL_HEIGHT 50 #define TEXT_RDSAVE2 "сделанных в процессе работы в системе."
#define STARS_COUNT 25 #define TEXT_REBOOT "Перезагрузка"
#define TEXT_OFF "Выключение"
#define PANEL_SIZE_X 260 #define TEXT_CANCEL "Отмена"
#define PANEL_SIZE_Y 148 #else
#define TEXT_TITLE "Shutdown computer"
:void ShadowScreen(dword img, w, h) #define TEXT_RDSAVE1 "Press Ctrl+S to save all changes"
{ #define TEXT_RDSAVE2 "that were done during system work."
dword to = w*h*3 + img; #define TEXT_REBOOT "Reboot"
for ( ; img < to; img+=4) #define TEXT_OFF "Power off"
{ #define TEXT_CANCEL "Close"
ESDWORD[img] >>= 1; #endif
$and ESDWORD[img], 7F7F7F7Fh
}
//for ( ; img < to; img+=4) { ESDWORD[img] >>= 2; $and ESDWORD[img], 3F3F3F3Fh }
}
#define WIN_W 440
#define WIN_H 200
#define BOT_PANEL_H 70
void main() void main()
{ {
int key; int key;
dword s1,s2, s3, s4, sides_w,i; int WIN_X = GetScreenWidth() - WIN_W / 2;
int WIN_Y = GetScreenHeight() - WIN_H / 2;
WIN_SIZE_X=GetScreenWidth()+1;
WIN_SIZE_Y=GetScreenHeight()+1;
PANEL_X=WIN_SIZE_X-PANEL_SIZE_X/2;
PANEL_Y=WIN_SIZE_Y-PANEL_SIZE_Y/2;
sides_w = WIN_SIZE_X-PANEL_SIZE_X/2;
s1 = mem_Alloc(WIN_SIZE_X*PANEL_Y*3);
s2 = mem_Alloc(sides_w*PANEL_Y*3);
s3 = mem_Alloc(sides_w*PANEL_Y*3);
s4 = mem_Alloc(WIN_SIZE_X*PANEL_Y*3);
CopyScreen(s1, 0, 0, WIN_SIZE_X, PANEL_Y);
ShadowScreen(s1, WIN_SIZE_X, PANEL_Y);
CopyScreen(s2, 0, PANEL_Y, sides_w, PANEL_SIZE_Y+1);
ShadowScreen(s2, sides_w, PANEL_SIZE_Y+1);
CopyScreen(s3, sides_w+PANEL_SIZE_X+1, PANEL_Y, sides_w-1, PANEL_SIZE_Y+1);
ShadowScreen(s3, sides_w, PANEL_SIZE_Y+1);
CopyScreen(s4, 0, PANEL_Y+PANEL_SIZE_Y+1, WIN_SIZE_X, PANEL_Y-1);
ShadowScreen(s4, WIN_SIZE_X, PANEL_Y-1);
goto _DRAW;
loop() loop()
{ {
WaitEventTimeout(7); switch(WaitEvent())
switch(EAX & 0xFF) {
{ case evButton:
case evButton:
key=GetButtonID(); key=GetButtonID();
if (key==1) ExitProcess(); if (key==1) ExitProcess();
GOTO _BUTTON_MARK; GOTO _BUTTON_MARK;
case evKey: case evKey:
key = GetKey(); key = GetKey();
_BUTTON_MARK: _BUTTON_MARK:
if (key== 13) ExitSystem(REBOOT); //ENTER if (key==ASCII_KEY_ENTER) ExitSystem(REBOOT);
if (key==180) ExitSystem(KERNEL); //HOME if (key==ASCII_KEY_END) ExitSystem(TURN_OFF);
if (key==181) ExitSystem(TURN_OFF); //END if (key==ASCII_KEY_ESC) ExitProcess();
if (key== 27) ExitProcess(); //ESC if (key==19) RunProgram("rdsave",0);
if (key== 19) //CTRL+S
{
RunProgram("rdsave",0);
ExitProcess();
}
break; break;
case evReDraw: case evReDraw:
system.color.get(); DefineAndDrawWindow(WIN_X, WIN_Y, WIN_W-1, WIN_H-1, 0x41, 0, 0, 0);
DefineAndDrawWindow(0,0,WIN_SIZE_X, WIN_SIZE_Y, 0x01, 0, 0, 0x01fffFFF); DrawWideRectangle(0, 0, WIN_W, WIN_H, 2, 0xA3A7AA);
//_PutImage(0,0,WIN_SIZE_X,WIN_SIZE_Y,shadow_buf); DrawBar(2, 2, WIN_W-4, WIN_H-BOT_PANEL_H-2, 0x202020);
_PutImage(0,0,WIN_SIZE_X, PANEL_Y,s1); DrawBar(2, WIN_H-BOT_PANEL_H-2, WIN_W-4, BOT_PANEL_H, 0x4B4B4B);
_PutImage(0,PANEL_Y,sides_w, PANEL_SIZE_Y+1,s2); WriteText(30, 27, 10110001b, 0xFFFfff, TEXT_TITLE);
_PutImage(sides_w+PANEL_SIZE_X+1,PANEL_Y,sides_w-1, PANEL_SIZE_Y+1,s3); WriteText(30, 70, 10110000b, 0xFFFfff, TEXT_RDSAVE1);
_PutImage(0,PANEL_Y+PANEL_SIZE_Y+1,WIN_SIZE_X, PANEL_Y-1,s4); WriteText(30, 85, 10110000b, 0xFFFfff, TEXT_RDSAVE2);
draw_main_area(PANEL_X, PANEL_Y, PANEL_SIZE_X, PANEL_SIZE_Y); EndButton( 20, 0x4E91C5, ASCII_KEY_ESC, TEXT_CANCEL, "Esc");
EndButton(160, 0x55C891, ASCII_KEY_ENTER, TEXT_REBOOT, "Enter");
EndButton(300, 0xC75C54, ASCII_KEY_END, TEXT_OFF, "End");
break; break;
default: _DRAW: }
draw_stars();
}
} }
} }
void EndButton(dword x, bgcol, id, but_text, hotkey_text)
void draw_main_area()
{ {
int i=0; word buty=WIN_H-60;
word butw=116;
DrawRectangle(PANEL_X, PANEL_Y, PANEL_SIZE_X, PANEL_SIZE_Y, 0); word buth=43;
DrawBar(PANEL_X+1, PANEL_Y+NIGHT_PALEL_HEIGHT+1, PANEL_SIZE_X-1, PANEL_SIZE_Y-NIGHT_PALEL_HEIGHT-1, system.color.work); DrawWideRectangle(x-3, buty-3, butw+6, buth+6, 3, 0x202020);
DefineButton(x, buty, butw-1, buth-1, id, bgcol);
for (i=0; i<3; i++) WriteTextB(-utf8_strlen(but_text)*8 + butw / 2 + x, buty+8, 10110000b, 0xFFFfff, but_text);
{ WriteTextCenter(x, buty+26, butw, 0xFFFfff, hotkey_text);
DefineButton(PANEL_X+33, i*23 + PANEL_Y+NIGHT_PALEL_HEIGHT+16, 190,19, BUTTONS_CAPTIONS[i*2+1],system.color.work_button); }
WriteText(PANEL_X+59, i*23 + PANEL_Y+NIGHT_PALEL_HEIGHT+22, 0x80,system.color.work_button_text, BUTTONS_CAPTIONS[i*2]);
}
draw_stars();
}
dword stars_col[4]={0xD2CF19, 0x716900, 0x002041, 0xEAE0DE}; //0x005BFF - ãîëóáîé, ðåäêî
void draw_stars()
{
int i, x_pic, y_pic, col;
DrawBar(PANEL_X+1, PANEL_Y+1, PANEL_SIZE_X-1, NIGHT_PALEL_HEIGHT, 0x002041);
for (i=0; i<STARS_COUNT; i++)
{
x_pic = random(PANEL_SIZE_X-2);
y_pic = random(NIGHT_PALEL_HEIGHT-2);
col = random(4);
PutPixel(PANEL_X+2 +x_pic, PANEL_Y+2 +y_pic, stars_col[col]);
if (stars_col[col]==0xD2CF19)
{
PutPixel(PANEL_X+2 +x_pic+1, PANEL_Y+2 +y_pic, stars_col[col+1]);
PutPixel(PANEL_X+2 +x_pic-1, PANEL_Y+2 +y_pic, stars_col[col+1]);
PutPixel(PANEL_X+2 +x_pic, PANEL_Y+2 +y_pic-1, stars_col[col+1]);
PutPixel(PANEL_X+2 +x_pic, PANEL_Y+2 +y_pic+1, stars_col[col+1]);
}
}
_PutImage(PANEL_X+PANEL_SIZE_X-60+random(3),PANEL_Y+10+random(3), 6,6, #moon);
}
stop:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

View File

@ -279,7 +279,7 @@ void main()
if (active_panel!=1) if (active_panel!=1)
{ {
active_panel = 1; active_panel = 1;
goto __SET_VALS_AND_DRAW; ChangeActivePanel();
} }
} }
else else
@ -287,12 +287,7 @@ void main()
if (active_panel!=2) if (active_panel!=2)
{ {
active_panel = 2; active_panel = 2;
__SET_VALS_AND_DRAW: ChangeActivePanel();
llist_copy(#files_active, #files_inactive);
llist_copy(#files_inactive, #files);
strcpy(#active_path, #inactive_path);
strcpy(#inactive_path, #path);
DrawFilePanels();
} }
} }
} }
@ -448,6 +443,11 @@ void main()
case SCAN_CODE_ENTER: case SCAN_CODE_ENTER:
Open(0); Open(0);
break; break;
case SCAN_CODE_TAB:
if (!two_panels) break;
if (active_panel==1) active_panel=2; else active_panel=1;
ChangeActivePanel();
break;
case 093: //menu case 093: //menu
menu_call_mouse=0; menu_call_mouse=0;
menu_stak = malloc(4096); menu_stak = malloc(4096);
@ -1128,6 +1128,15 @@ void FnProcess(byte N)
} }
} }
void ChangeActivePanel()
{
llist_copy(#files_active, #files_inactive);
llist_copy(#files_inactive, #files);
strcpy(#active_path, #inactive_path);
strcpy(#inactive_path, #path);
DrawFilePanels();
}
//need to remove these functiones, they are a very old shit :) //need to remove these functiones, they are a very old shit :)
dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;} dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}

View File

@ -4,7 +4,7 @@
@del Eolite @del Eolite
cls cls
c-- Eolite.c c-- Eolite.c
@kpack Eolite.com rem @kpack Eolite.com
@rename Eolite.com Eolite @rename Eolite.com Eolite
@del warning.txt @del warning.txt
@del lang.h-- @del lang.h--

View File

@ -4,7 +4,7 @@
@del Eolite @del Eolite
cls cls
c-- Eolite.c c-- Eolite.c
@kpack Eolite.com rem @kpack Eolite.com
@rename Eolite.com Eolite @rename Eolite.com Eolite
@del warning.txt @del warning.txt
@del lang.h-- @del lang.h--

View File

@ -19,6 +19,15 @@
DrawBar(x+w,y,1,h+1,color1); DrawBar(x+w,y,1,h+1,color1);
} }
:void DrawWideRectangle(dword x,y,w,h,boder,color1)
{
if (w<=0) || (h<=0) return;
DrawBar(x, y, w, boder, color1);
DrawBar(x, y+h-boder, w, boder, color1);
DrawBar(x, y+boder, boder, h-boder-boder, color1);
DrawBar(x+w-boder, y+boder, boder, h-boder-boder, color1);
}
:void DrawRectangle3D(dword x,y,w,h,color1,color2) :void DrawRectangle3D(dword x,y,w,h,color1,color2)
{ {
if (w<=0) || (h<=0) return; if (w<=0) || (h<=0) return;