Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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