2013-10-12 01:58:43 +04:00
|
|
|
|
//notify 0.8
|
2013-03-13 01:43:15 +04:00
|
|
|
|
//SoUrcerer 2010, Leency 2012-2013, GNU GPLv2
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
2013-10-11 02:42:17 +04:00
|
|
|
|
#define MEMSIZE 0x2F00
|
2012-11-26 19:26:15 +04:00
|
|
|
|
#include "..\lib\kolibri.h"
|
|
|
|
|
#include "..\lib\strings.h"
|
2013-03-11 22:16:24 +04:00
|
|
|
|
#include "..\lib\mem.h"
|
2015-03-05 23:55:28 +03:00
|
|
|
|
#include "..\lib\gui.h"
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
2013-10-12 01:58:43 +04:00
|
|
|
|
dword shadow_buf_24, shadow_buf_32, lighter_pixel1, lighter_pixel2;
|
|
|
|
|
|
|
|
|
|
?define PADDING 15;
|
2013-10-11 02:42:17 +04:00
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
int SCREEN_SIZE_X,
|
|
|
|
|
SCREEN_SIZE_Y;
|
|
|
|
|
|
2013-10-11 02:42:17 +04:00
|
|
|
|
int WIN_X,
|
|
|
|
|
WIN_Y,
|
|
|
|
|
WIN_SIZE_X=256,
|
2012-11-26 19:26:15 +04:00
|
|
|
|
WIN_SIZE_Y=28;
|
|
|
|
|
|
2013-10-12 01:58:43 +04:00
|
|
|
|
int TEXT_X=PADDING,
|
|
|
|
|
TEXT_Y;
|
|
|
|
|
|
2013-10-11 02:42:17 +04:00
|
|
|
|
int delay = 400;
|
|
|
|
|
|
2013-10-11 02:45:19 +04:00
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
#include "lang.h--"
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-10-11 02:42:17 +04:00
|
|
|
|
#ifdef LANG_RUS
|
|
|
|
|
?define DEFAULT_TEXT "<EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> <20><><EFBFBD><EFBFBD><EFBFBD>뢠<EFBFBD><EBA2A0> 㢥<><E3A2A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.";
|
|
|
|
|
#else
|
|
|
|
|
?define DEFAULT_TEXT "This program shows notices. Open it with params.";
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void PutText(dword x, y) {
|
2013-10-12 01:58:43 +04:00
|
|
|
|
WriteBufText(x,y, 0x88, 0, #param, shadow_buf_32);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Text()
|
|
|
|
|
{
|
|
|
|
|
PutText(TEXT_X-1,TEXT_Y+1);
|
|
|
|
|
PutText(TEXT_X-1,TEXT_Y-1);
|
|
|
|
|
PutText(TEXT_X-1,TEXT_Y );
|
|
|
|
|
PutText(TEXT_X+1,TEXT_Y-1);
|
|
|
|
|
PutText(TEXT_X+1,TEXT_Y );
|
|
|
|
|
PutText(TEXT_X+1,TEXT_Y+1);
|
|
|
|
|
PutText(TEXT_X, TEXT_Y+1);
|
|
|
|
|
PutText(TEXT_X, TEXT_Y-1);
|
|
|
|
|
WriteBufText(TEXT_X, TEXT_Y, 0x88, 0xFFFfff, #param, shadow_buf_32);
|
2013-10-11 02:42:17 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-18 15:39:28 +04:00
|
|
|
|
void from24to32(ESI, EDI, EAX, EBX) //src,dst,w,h
|
2013-10-12 01:58:43 +04:00
|
|
|
|
{
|
|
|
|
|
conv24to32:
|
2014-01-18 15:39:28 +04:00
|
|
|
|
$mul ebx
|
2013-10-12 01:58:43 +04:00
|
|
|
|
$mov ecx, eax
|
|
|
|
|
$xor al, al
|
|
|
|
|
_next:
|
|
|
|
|
$movsw
|
|
|
|
|
$movsb
|
|
|
|
|
$stosb
|
|
|
|
|
$loop _next
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-21 02:54:16 +04:00
|
|
|
|
void DrawBackground()
|
|
|
|
|
{
|
|
|
|
|
PutPaletteImage(shadow_buf_32+8,WIN_SIZE_X,WIN_SIZE_Y,0,0,32,0);
|
|
|
|
|
PutPixel(0,0,ESDWORD[lighter_pixel1]);
|
|
|
|
|
PutPixel(0,WIN_SIZE_Y-1,ESDWORD[lighter_pixel2]);
|
|
|
|
|
}
|
2013-10-12 01:58:43 +04:00
|
|
|
|
|
2013-10-11 02:42:17 +04:00
|
|
|
|
void GetBackground()
|
|
|
|
|
{
|
2013-10-12 01:58:43 +04:00
|
|
|
|
int i;
|
2013-10-21 02:54:16 +04:00
|
|
|
|
static int was_once;
|
2013-10-12 01:58:43 +04:00
|
|
|
|
|
2013-10-21 02:54:16 +04:00
|
|
|
|
if (was_once)
|
|
|
|
|
{
|
|
|
|
|
DrawBackground();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-10-12 01:58:43 +04:00
|
|
|
|
for (i=1; i<=6; i++)
|
|
|
|
|
{
|
2013-10-21 02:54:16 +04:00
|
|
|
|
was_once = 1;
|
2013-10-12 01:58:43 +04:00
|
|
|
|
ShadowImage(shadow_buf_24, WIN_SIZE_X, WIN_SIZE_Y, 1);
|
|
|
|
|
if (i%2 == 0) ShadowImage(lighter_pixel1, 1, 1, 1);
|
|
|
|
|
if (i%2 == 0) ShadowImage(lighter_pixel2, 1, 1, 1);
|
|
|
|
|
from24to32(shadow_buf_24, shadow_buf_32+8, WIN_SIZE_X, WIN_SIZE_Y);
|
|
|
|
|
Text();
|
2013-10-21 02:54:16 +04:00
|
|
|
|
DrawBackground();
|
2013-10-12 01:58:43 +04:00
|
|
|
|
pause(5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Exit()
|
|
|
|
|
{
|
|
|
|
|
ExitProcess();
|
2013-10-11 02:42:17 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
void main()
|
2013-10-12 01:58:43 +04:00
|
|
|
|
{
|
2013-10-11 02:42:17 +04:00
|
|
|
|
if (!param) strcpy(#param, DEFAULT_TEXT);
|
2013-03-14 00:07:53 +04:00
|
|
|
|
if (strlen(#param)*6>WIN_SIZE_X)
|
|
|
|
|
{
|
2013-10-11 02:42:17 +04:00
|
|
|
|
WIN_SIZE_X=strlen(#param)*6+PADDING;
|
2013-03-14 00:07:53 +04:00
|
|
|
|
delay = strlen(#param)*10;
|
|
|
|
|
}
|
2013-10-11 02:42:17 +04:00
|
|
|
|
|
|
|
|
|
SCREEN_SIZE_X=GetScreenWidth()+1;
|
|
|
|
|
WIN_X = SCREEN_SIZE_X-WIN_SIZE_X-1;
|
|
|
|
|
WIN_Y = GetClientTop();
|
2013-10-12 01:58:43 +04:00
|
|
|
|
TEXT_X = -6*strlen(#param)+WIN_SIZE_X/2+1;
|
|
|
|
|
TEXT_Y = WIN_SIZE_Y/2-4;
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
2013-10-11 02:42:17 +04:00
|
|
|
|
//emulate multithread :)
|
2016-12-08 20:20:55 +03:00
|
|
|
|
while (GetPixelColorFromScreen(SCREEN_SIZE_X-1, WIN_Y)==0x333333) WIN_Y+=WIN_SIZE_Y+17;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
2013-10-12 01:58:43 +04:00
|
|
|
|
shadow_buf_24 = malloc(WIN_SIZE_X*WIN_SIZE_Y*3);
|
|
|
|
|
shadow_buf_32 = malloc(WIN_SIZE_X*WIN_SIZE_Y*4+8);
|
2013-10-11 02:42:17 +04:00
|
|
|
|
lighter_pixel1 = malloc(3);
|
|
|
|
|
lighter_pixel2 = malloc(3);
|
2013-10-12 01:58:43 +04:00
|
|
|
|
CopyScreen(shadow_buf_24, WIN_X, WIN_Y, WIN_SIZE_X, WIN_SIZE_Y);
|
|
|
|
|
CopyScreen(lighter_pixel1, WIN_X, WIN_Y, 1, 1);
|
|
|
|
|
CopyScreen(lighter_pixel2, WIN_X, WIN_Y+WIN_SIZE_Y, 1, 1);
|
|
|
|
|
ESDWORD[shadow_buf_32] = WIN_SIZE_X;
|
|
|
|
|
ESDWORD[shadow_buf_32+4] = WIN_SIZE_Y;
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
loop()
|
2013-03-13 01:36:50 +04:00
|
|
|
|
{
|
2013-03-14 00:07:53 +04:00
|
|
|
|
WaitEventTimeout(delay);
|
2012-11-26 19:26:15 +04:00
|
|
|
|
switch(EAX & 0xFF)
|
|
|
|
|
{
|
|
|
|
|
case evButton:
|
2013-10-12 01:58:43 +04:00
|
|
|
|
Exit();
|
2012-11-26 19:26:15 +04:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw:
|
2013-10-11 02:42:17 +04:00
|
|
|
|
DefineAndDrawWindow(WIN_X+1,WIN_Y,WIN_SIZE_X, WIN_SIZE_Y-1, 0x01, 0, 0, 0x01fffFFF);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
DrawBar(WIN_SIZE_X,0, 1, WIN_SIZE_Y, 0x333333);
|
2013-10-12 01:58:43 +04:00
|
|
|
|
DefineButton(0,0, WIN_SIZE_X, WIN_SIZE_Y, 1+BT_HIDE+BT_NOFRAME, 0);
|
|
|
|
|
GetBackground();
|
2012-11-26 19:26:15 +04:00
|
|
|
|
break;
|
2013-10-12 01:58:43 +04:00
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
default:
|
2013-10-12 01:58:43 +04:00
|
|
|
|
Exit();
|
2012-11-26 19:26:15 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stop:
|