2013-10-11 00:42:17 +02:00
|
|
|
|
//notify 0.7
|
2013-03-12 22:43:15 +01:00
|
|
|
|
//SoUrcerer 2010, Leency 2012-2013, GNU GPLv2
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2013-10-11 00:42:17 +02:00
|
|
|
|
#define MEMSIZE 0x2F00
|
2012-11-26 16:26:15 +01:00
|
|
|
|
#include "..\lib\kolibri.h"
|
|
|
|
|
#include "..\lib\strings.h"
|
2013-03-11 19:16:24 +01:00
|
|
|
|
#include "..\lib\mem.h"
|
|
|
|
|
#include "..\lib\figures.h"
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2013-10-11 00:42:17 +02:00
|
|
|
|
?define PADDING 12;
|
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
|
int SCREEN_SIZE_X,
|
|
|
|
|
SCREEN_SIZE_Y;
|
|
|
|
|
|
2013-10-11 00:42:17 +02:00
|
|
|
|
int WIN_X,
|
|
|
|
|
WIN_Y,
|
|
|
|
|
WIN_SIZE_X=256,
|
2012-11-26 16:26:15 +01:00
|
|
|
|
WIN_SIZE_Y=28;
|
|
|
|
|
|
2013-10-11 00:42:17 +02:00
|
|
|
|
int delay = 400;
|
|
|
|
|
|
2013-10-11 00:45:19 +02:00
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
#include "lang.h--"
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-10-11 00:42:17 +02: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) {
|
|
|
|
|
WriteText(x,y, 0x80, 0, #param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall int GetClientTop()
|
|
|
|
|
{
|
|
|
|
|
$mov eax, 48
|
|
|
|
|
$mov ebx, 5
|
|
|
|
|
$int 0x40
|
|
|
|
|
$mov eax, ebx
|
|
|
|
|
$shr eax, 16
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dword shadow_buf, lighter_pixel1, lighter_pixel2;
|
|
|
|
|
void GetBackground()
|
|
|
|
|
{
|
|
|
|
|
CopyScreen(shadow_buf, 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);
|
|
|
|
|
ShadowImage(shadow_buf, WIN_SIZE_X, WIN_SIZE_Y, 6);
|
|
|
|
|
ShadowImage(lighter_pixel1, 1, 1, 2);
|
|
|
|
|
ShadowImage(lighter_pixel2, 1, 1, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
|
void main()
|
|
|
|
|
{
|
|
|
|
|
int TEXT_X=4,
|
|
|
|
|
TEXT_Y=12;
|
2013-10-11 00:42:17 +02:00
|
|
|
|
char drawn;
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2013-10-11 00:42:17 +02:00
|
|
|
|
if (!param) strcpy(#param, DEFAULT_TEXT);
|
2013-03-13 21:07:53 +01:00
|
|
|
|
if (strlen(#param)*6>WIN_SIZE_X)
|
|
|
|
|
{
|
2013-10-11 00:42:17 +02:00
|
|
|
|
WIN_SIZE_X=strlen(#param)*6+PADDING;
|
2013-03-13 21:07:53 +01:00
|
|
|
|
delay = strlen(#param)*10;
|
|
|
|
|
}
|
2013-10-11 00:42:17 +02:00
|
|
|
|
|
|
|
|
|
SCREEN_SIZE_X=GetScreenWidth()+1;
|
|
|
|
|
WIN_X = SCREEN_SIZE_X-WIN_SIZE_X-1;
|
|
|
|
|
WIN_Y = GetClientTop();
|
|
|
|
|
TEXT_X = -6*strlen(#param)+WIN_SIZE_X/2;
|
|
|
|
|
TEXT_Y = WIN_SIZE_Y/2-3;
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2013-10-11 00:42:17 +02:00
|
|
|
|
//emulate multithread :)
|
2013-03-11 19:16:24 +01:00
|
|
|
|
while (GetPixelColor(SCREEN_SIZE_X-1, SCREEN_SIZE_X, WIN_Y)==0x333333) WIN_Y+=WIN_SIZE_Y+17;
|
|
|
|
|
|
2013-10-11 00:42:17 +02:00
|
|
|
|
mem_Init();
|
|
|
|
|
shadow_buf = malloc(WIN_SIZE_X*WIN_SIZE_Y*3);
|
|
|
|
|
lighter_pixel1 = malloc(3);
|
|
|
|
|
lighter_pixel2 = malloc(3);
|
|
|
|
|
GetBackground();
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
|
|
|
|
loop()
|
2013-03-12 22:36:50 +01:00
|
|
|
|
{
|
2013-03-13 21:07:53 +01:00
|
|
|
|
WaitEventTimeout(delay);
|
2012-11-26 16:26:15 +01:00
|
|
|
|
switch(EAX & 0xFF)
|
|
|
|
|
{
|
|
|
|
|
case evButton:
|
2013-10-11 00:42:17 +02:00
|
|
|
|
ExitProcess();
|
2012-11-26 16:26:15 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw:
|
2013-10-11 00:42:17 +02:00
|
|
|
|
DefineAndDrawWindow(WIN_X+1,WIN_Y,WIN_SIZE_X, WIN_SIZE_Y-1, 0x01, 0, 0, 0x01fffFFF);
|
|
|
|
|
if (drawn==1)
|
2013-03-12 22:43:15 +01:00
|
|
|
|
{
|
2013-10-11 00:42:17 +02:00
|
|
|
|
drawn=2;
|
|
|
|
|
MoveSize(0,0,-1,-1);
|
|
|
|
|
pause(3);
|
|
|
|
|
GetBackground();
|
|
|
|
|
MoveSize(WIN_X,WIN_Y,-1,-1);
|
|
|
|
|
drawn=1;
|
|
|
|
|
}
|
|
|
|
|
DefineButton(0,0, WIN_SIZE_X, WIN_SIZE_Y, 1+BT_HIDE+BT_NOFRAME, 0);
|
|
|
|
|
|
|
|
|
|
_PutImage(0,0,WIN_SIZE_X,WIN_SIZE_Y,shadow_buf);
|
|
|
|
|
PutPixel(0,0,ESDWORD[lighter_pixel1]);
|
|
|
|
|
PutPixel(0,WIN_SIZE_Y-1,ESDWORD[lighter_pixel2]);
|
2013-03-11 19:16:24 +01:00
|
|
|
|
DrawBar(WIN_SIZE_X,0, 1, WIN_SIZE_Y, 0x333333);
|
2013-10-11 00:42:17 +02:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
WriteText(TEXT_X, TEXT_Y, 0x80, 0xFFFfff, #param);
|
|
|
|
|
if (drawn==0) drawn=1;
|
2012-11-26 16:26:15 +01:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ExitProcess();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stop:
|