2013-10-11 23:58:43 +02:00
|
|
|
|
//notify 0.8
|
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 23:58:43 +02:00
|
|
|
|
dword shadow_buf_24, shadow_buf_32, lighter_pixel1, lighter_pixel2;
|
|
|
|
|
|
|
|
|
|
?define PADDING 15;
|
2013-10-11 00:42:17 +02:00
|
|
|
|
|
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 23:58:43 +02:00
|
|
|
|
int TEXT_X=PADDING,
|
|
|
|
|
TEXT_Y;
|
|
|
|
|
|
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) {
|
2013-10-11 23:58:43 +02: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 00:42:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline fastcall int GetClientTop()
|
|
|
|
|
{
|
|
|
|
|
$mov eax, 48
|
|
|
|
|
$mov ebx, 5
|
|
|
|
|
$int 0x40
|
|
|
|
|
$mov eax, ebx
|
|
|
|
|
$shr eax, 16
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-11 23:58:43 +02:00
|
|
|
|
void from24to32(dword src, dst, Width, Height)
|
|
|
|
|
{
|
|
|
|
|
conv24to32:
|
|
|
|
|
$mov esi, src
|
|
|
|
|
$mov edi, dst
|
|
|
|
|
|
|
|
|
|
$mov eax, Width
|
|
|
|
|
//$mul ESDWORD[Height]
|
|
|
|
|
$mul Height
|
|
|
|
|
$mov ecx, eax
|
|
|
|
|
$xor al, al
|
|
|
|
|
_next:
|
|
|
|
|
$movsw
|
|
|
|
|
$movsb
|
|
|
|
|
$stosb
|
|
|
|
|
$loop _next
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 00:42:17 +02:00
|
|
|
|
void GetBackground()
|
|
|
|
|
{
|
2013-10-11 23:58:43 +02:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i=1; i<=6; i++)
|
|
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
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]);
|
|
|
|
|
pause(5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Exit()
|
|
|
|
|
{
|
|
|
|
|
ExitProcess();
|
2013-10-11 00:42:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
|
void main()
|
2013-10-11 23:58:43 +02: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();
|
2013-10-11 23:58:43 +02:00
|
|
|
|
TEXT_X = -6*strlen(#param)+WIN_SIZE_X/2+1;
|
|
|
|
|
TEXT_Y = WIN_SIZE_Y/2-4;
|
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();
|
2013-10-11 23:58:43 +02: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 00:42:17 +02:00
|
|
|
|
lighter_pixel1 = malloc(3);
|
|
|
|
|
lighter_pixel2 = malloc(3);
|
2013-10-11 23:58:43 +02: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 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 23:58:43 +02:00
|
|
|
|
Exit();
|
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);
|
2013-03-11 19:16:24 +01:00
|
|
|
|
DrawBar(WIN_SIZE_X,0, 1, WIN_SIZE_Y, 0x333333);
|
2013-10-11 23:58:43 +02:00
|
|
|
|
DefineButton(0,0, WIN_SIZE_X, WIN_SIZE_Y, 1+BT_HIDE+BT_NOFRAME, 0);
|
|
|
|
|
GetBackground();
|
2012-11-26 16:26:15 +01:00
|
|
|
|
break;
|
2013-10-11 23:58:43 +02:00
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
|
default:
|
2013-10-11 23:58:43 +02:00
|
|
|
|
Exit();
|
2012-11-26 16:26:15 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stop:
|