Subversion Repositories Kolibri OS

Rev

Rev 4114 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4114 Rev 4137
Line 10... Line 10...
10
 
10
 
Line 11... Line 11...
11
#include "add_appl_dir.c";
11
#include "add_appl_dir.c";
12
 
12
 
13
#define LOGOW 16
-
 
14
#define LOGOH 16
-
 
15
#define BLACK_H 40
13
#define LOGOW 16
16
#define TEXTX 20
14
#define LOGOH 16
Line 17... Line 15...
17
#define WIN_W 300
15
#define WIN_W 240
-
 
16
#define WIN_H 140
Line 18... Line 17...
18
#define WIN_H 200
17
 
19
 
18
unsigned char logo[LOGOW*LOGOH*3]= FROM "img\logo.raw";
20
unsigned char logo[LOGOW*LOGOH*3]= FROM "img\logo.raw";
-
 
21
 
-
 
22
proc_info Form;
-
 
23
system_colors sc;
-
 
24
char dialog;
-
 
Line 25... Line 19...
25
enum {
19
char iclock[3]={1,2};
26
	INSTALL,
20
 
27
	END
21
proc_info Form;
28
};
22
system_colors sc;
29
 
23
 
30
#ifdef LANG_RUS
24
#ifdef LANG_RUS
31
	?define T_WTITILE "Установка Kolibri N9"
25
	?define T_WTITILE "Установка Kolibri N9"
Line 32... Line -...
32
	?define T_END "Установка KolibriN успешно завершена."
-
 
33
#else
-
 
34
	?define T_WTITILE "Kolibri N9 Setup"
-
 
35
	?define T_END "KolibriN install complete."
-
 
36
#endif
-
 
37
 
-
 
38
 
-
 
39
int DefineWindow(dword wtitle, wbutton)
-
 
40
{
-
 
41
	sc.get();
-
 
42
	DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2-30, WIN_W+9, WIN_H+GetSkinHeight()+4,0x74,0,T_WTITILE);
-
 
43
	GetProcessInfo(#Form, SelfInfo);
-
 
44
	if (Form.status_window>2) return 0; //rolled_up
-
 
45
 
-
 
46
	DrawBar(0, 0, Form.cwidth, BLACK_H, 0);
-
 
47
	_PutImage(BLACK_H-LOGOW/2, BLACK_H-LOGOH/2, LOGOW,LOGOH, #logo);
-
 
48
	WriteTextB(BLACK_H-LOGOW + LOGOW, BLACK_H-6/2, 0x90, 0xFFFfff, wtitle);
26
	?define T_END "Установка KolibriN успешно завершена."
49
	DrawBar(0, BLACK_H, Form.cwidth, Form.cheight-BLACK_H, 0xFFFfff);
27
#else
-
 
28
	?define T_WTITILE "Kolibri N9 Setup"
50
	DrawCaptButton(Form.cwidth-107, Form.cheight-40, 90, 24, 10, sc.work_button, sc.work_button_text,wbutton);
29
	?define T_END "KolibriN install complete."
51
	return 1;
-
 
52
}
-
 
53
 
-
 
54
void main()
-
 
55
{
-
 
56
	mem_Init();
-
 
57
	InstallationLoop(INSTALL);
-
 
58
}
-
 
59
 
-
 
60
char iclock[3]={1,2};
-
 
61
 
-
 
62
void InstallationLoop(int dialog_t)
-
 
63
{
-
 
Line 64... Line 30...
64
	byte id, key, started=false;
30
#endif
65
	int free_ram;
31
 
66
	unsigned char free_ram_text[256];
32
void main()
67
 
-
 
68
	dialog = dialog_t;
33
{
69
	goto _DRAW_WIN;
-
 
70
   
-
 
71
	loop() switch(WaitEvent())
-
 
72
	{						   
-
 
73
			case evButton:
-
 
74
					id=GetButtonID();
-
 
75
					if (id == 01) ExitProcess();
34
	byte id, started=false;
Line 76... Line 35...
76
					if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/index.php");
35
	mem_Init();
77
					if (id == 10)
36
   
-
 
37
	loop() switch(WaitEvent())
78
					{
38
	{						   
79
						if (dialog==INSTALL) InstallationLoop(END);
-
 
80
						else if (dialog==END) ExitProcess();
39
			case evButton:
81
					}
40
					if (GetButtonID() == 01) ExitProcess();
-
 
41
					break;
82
					break;
42
					
-
 
43
			case evReDraw: 
Line 83... Line 44...
83
					
44
					sc.get();
84
			case evReDraw: 
45
					DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2-30, WIN_W+9, WIN_H+GetSkinHeight()+4,
85
					_DRAW_WIN:
46
					0x34,0xFFFfff,T_WTITILE);
86
					if (dialog==INSTALL)
47
					GetProcessInfo(#Form, SelfInfo);
87
					{
48
					if (Form.status_window>2) break;
88
						if !(DefineWindow("Installation Started", "Stop")) break;
49
 
89
						//iclock[0]>
50
					_PutImage(Form.cwidth-LOGOW/2, Form.height-LOGOH/2, LOGOW,LOGOH, LOGOW*LOGOH*3*iclock[0]+ #logo); //iclock[0]>
90
						_PutImage(Form.cwidth-LOGOW/2, Form.height-LOGOH/2, LOGOW,LOGOH, LOGOW*LOGOH*3*iclock[0]+ #logo);
-
 
91
 
-
 
92
						if (!started)
-
 
93
						{
-
 
94
							started = true;
-
 
95
							if (GetFreeRAM()/1024<15) notify("Too less free ram. May cause problems");
-
 
96
							Install();
-
 
97
						}
51
					WriteTextB(-strlen(T_WTITILE)*6+Form.cwidth/2, Form.cheight - 35, 0x90, 0, T_WTITILE);
Line 98... Line 52...
98
					}
52
 
99
					if (dialog==END)
53
					if (!started)
100
					{
54
					{
-
 
55
						started = true;
101
						if !(DefineWindow("Installation complete", "Exit")) break;
56
						if (GetFreeRAM()/1024<15) notify("Too less free ram. May cause problems");
Line -... Line 57...
-
 
57
						Install();
102
						WriteText(TEXTX, BLACK_H*2, 0x80, 0, T_END);
58
					}
103
						DrawLink(TEXTX, BLACK_H*2+15, 0x80, 11, "http://kolibri-n.org");
59
	}
104
					}
60
}
105
	}
61
 
106
}
-
 
107
 
62
 
108
 
63
void Install()
109
void Install()
64
{
110
{
65
	int i;
111
	int i;
66
	dword temp;
112
	proc_info Process;
67
	proc_info Process;
113
 
68
 
114
	for (i=0; i<256; i++;)
69
 
115
	{
-
 
116
		GetProcessInfo(#Process, i);
-
 
117
		if (i==Form.ID) || (strcmp(#Process.name, "OS")==0) continue;
70
	for (i=0; i<1000; i++;)
Line 118... Line 71...
118
		KillProcess(i);
71
	{