Rev 4113 | Go to most recent revision | Details | Compare with Previous | 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 | |||
4114 | leency | 11 | #include "add_appl_dir.c"; |
4113 | leency | 12 | |
13 | #define LOGOW 16 |
||
14 | #define LOGOH 16 |
||
15 | #define BLACK_H 40 |
||
16 | #define TEXTX 20 |
||
17 | #define WIN_W 300 |
||
18 | #define WIN_H 200 |
||
19 | |||
20 | unsigned char logo[LOGOW*LOGOH*3]= FROM "img\logo.raw"; |
||
21 | |||
22 | proc_info Form; |
||
23 | system_colors sc; |
||
24 | char dialog; |
||
25 | enum { |
||
26 | INSTALL, |
||
27 | END |
||
28 | }; |
||
29 | |||
30 | #ifdef LANG_RUS |
||
31 | ?define T_WTITILE "Установка Kolibri N9" |
||
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); |
||
49 | DrawBar(0, BLACK_H, Form.cwidth, Form.cheight-BLACK_H, 0xFFFfff); |
||
50 | DrawCaptButton(Form.cwidth-107, Form.cheight-40, 90, 24, 10, sc.work_button, sc.work_button_text,wbutton); |
||
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 | { |
||
64 | byte id, key, started=false; |
||
65 | int free_ram; |
||
66 | unsigned char free_ram_text[256]; |
||
67 | |||
68 | dialog = dialog_t; |
||
69 | goto _DRAW_WIN; |
||
70 | |||
71 | loop() switch(WaitEvent()) |
||
72 | { |
||
73 | case evButton: |
||
74 | id=GetButtonID(); |
||
75 | if (id == 01) ExitProcess(); |
||
76 | if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/index.php"); |
||
77 | if (id == 10) |
||
78 | { |
||
79 | if (dialog==INSTALL) InstallationLoop(END); |
||
80 | else if (dialog==END) ExitProcess(); |
||
81 | } |
||
82 | break; |
||
83 | |||
84 | case evReDraw: |
||
85 | _DRAW_WIN: |
||
86 | if (dialog==INSTALL) |
||
87 | { |
||
88 | if !(DefineWindow("Installation Started", "Stop")) break; |
||
89 | //iclock[0]> |
||
4114 | leency | 90 | _PutImage(Form.cwidth-LOGOW/2, Form.height-LOGOH/2, LOGOW,LOGOH, LOGOW*LOGOH*3*iclock[0]+ #logo); |
4113 | leency | 91 | |
92 | if (!started) |
||
93 | { |
||
94 | started = true; |
||
95 | if (GetFreeRAM()/1024<15) notify("Too less free ram. May cause problems"); |
||
96 | Install(); |
||
97 | } |
||
98 | } |
||
99 | if (dialog==END) |
||
100 | { |
||
101 | if !(DefineWindow("Installation complete", "Exit")) break; |
||
102 | WriteText(TEXTX, BLACK_H*2, 0x80, 0, T_END); |
||
4114 | leency | 103 | DrawLink(TEXTX, BLACK_H*2+15, 0x80, 11, "http://kolibri-n.org"); |
4113 | leency | 104 | } |
105 | } |
||
106 | } |
||
107 | |||
108 | |||
109 | void Install() |
||
110 | { |
||
111 | int i; |
||
112 | proc_info Process; |
||
113 | |||
114 | for (i=0; i<256; i++;) |
||
115 | { |
||
116 | GetProcessInfo(#Process, i); |
||
117 | if (i==Form.ID) || (strcmp(#Process.name, "OS")==0) continue; |
||
118 | KillProcess(i); |
||
119 | } |
||
120 | SetAddApplDir("kolibrios", abspath("kolibrios")+1); |
||
121 | RunProgram("/sys/REFRSCRN", NULL); |
||
122 | copyf(abspath("sys"), "/rd/1"); |
||
123 | RunProgram("/sys/launcher", NULL); |
||
124 | SetSystemSkin("/kolibrios/skins/latte.skn"); |
||
125 | InstallationLoop(END); |
||
126 | //===to tmp=== |
||
127 | // RunProgram("/sys/tmpdisk", "a9s100"); |
||
128 | // copyf(abspath("tmp"), "/tmp9/1"); |
||
129 | } |
||
130 | |||
131 | void copyf_Draw_Progress(dword filename) { return; } |
||
132 | |||
133 | |||
134 | stop:256;>15)> |