Subversion Repositories Kolibri OS

Rev

Rev 6250 | Rev 6253 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6250 leency 1
#ifndef AUTOBUILD
2
#include "lang.h--"
3
#endif
4
 
5
#define MEMSIZE 4096*20
6
#include "..\lib\strings.h"
7
#include "..\lib\mem.h"
8
#include "..\lib\io.h"
9
#include "..\lib\gui.h"
10
#include "..\lib\obj\proc_lib.h"
11
#include "..\lib\patterns\simple_open_dialog.h"
12
#include "..\lib\added_sysdir.c"
13
 
14
char default_dir[] = "/rd/1";
15
od_filter filter2 = {"",0};
16
 
17
proc_info Form;
18
 
19
dword scr = FROM "scr.raw_8bit";
20
dword scr_pal[] = {0xFFFFFF,0xBBDDFF,0x4166B5,0xE0E4E6,0xAFBEDD,0xC4D4E8,0x52ACDD,0x000000,
21
0xE9DAB2,0xC99811,0xFDF9D4,0xF8B93C,0xFDEEBE,0xFBEBA6,0xDFAF4F,0xF3D57C};
22
 
6251 leency 23
#define APP_PLUS_INI_PATH "/kolibrios/settings/app_plus.ini"
6250 leency 24
 
6251 leency 25
#define APP_PLUS_INI_NOT_EXISTS "'APP+\n/kolibrios/settings/app_plus.ini is not exists.\nProgram terminated.' -tE"
6250 leency 26
 
6251 leency 27
#define WINDOW_TITLE_TEXT "Error"
28
#define CONTENT_HEADER_TEXT "/KOLIBRIOS/ NOT MOUNTED"
29
#define DESCRIPTION_TEXT "Try to find it manually. It should look
30
like image on the right.
31
Note: this action can be done only once
32
per 1 session of the OS running. If you
33
will choose the wrong folder then you
34
need to reboot system to try again."
35
#define MANUALLY_BUTTON_TEXT "Choose /kolibrios/ folder..."
36
 
37
 
6250 leency 38
void CheckKosMounted()
39
{
6251 leency 40
	if (dir_exists("/kolibrios/"))
6250 leency 41
	{
6251 leency 42
		if (file_exists(APP_PLUS_INI_PATH))
43
			io.run("syspanel", APP_PLUS_INI_PATH);
44
		else
45
			notify(APP_PLUS_INI_NOT_EXISTS);
6250 leency 46
		ExitProcess();
47
	}
48
}
49
 
50
void RunAutosearch()
51
{
52
	dword searchap_run_id;
53
	searchap_run_id = io.run("/sys/searchap",0);
54
	while (GetProcessSlot(searchap_run_id)) pause(10);
55
}
56
 
57
void main()
58
{
59
	word id;
60
 
61
	CheckKosMounted();
62
	RunAutosearch();
63
	CheckKosMounted();
64
 
65
	o_dialog.type = 2;
66
	load_dll(Proc_lib, #OpenDialog_init,0);
67
	OpenDialog_init stdcall (#o_dialog);
68
 
69
	loop() switch(WaitEvent())
70
	{
71
		case evButton:
72
			id=GetButtonID();
73
			if (id==1) ExitProcess();
74
			if (id==10)
75
			{
76
				OpenDialog_start stdcall (#o_dialog);
77
				if (o_dialog.status) SetAdditionalSystemDirectory("kolibrios", #openfile_path);
78
				pause(3);
79
				CheckKosMounted();
80
			}
81
			break;
82
 
83
		case evReDraw:
84
			draw_window();
85
	}
86
}
87
 
88
void draw_window()
89
{
90
	incn y;
91
	dword x=30;
92
	y.n=0;
93
	system.color.get();
94
	DefineAndDrawWindow(screen.width-570/2, 100, 570, 280+skin_height, 0x34, system.color.work, WINDOW_TITLE_TEXT);
95
	GetProcessInfo(#Form, SelfInfo);
96
	WriteTextB(x+2,y.inc(20)+2,0x81,MixColors(system.color.work, 0xB92234,220),CONTENT_HEADER_TEXT);
97
	WriteTextB(x,y.n,0x81,0xB92234,CONTENT_HEADER_TEXT);
98
 
99
	WriteTextLines(x,y.inc(50),0x90,system.color.work_text,DESCRIPTION_TEXT,20);
100
 
101
	PutPaletteImage(#scr,144,171,Form.cwidth-180,y.n,8,#scr_pal);
102
	DrawRectangle(Form.cwidth-180-1,y.n-1, 144+1,171+1, system.color.work_graph);
103
 
104
	DrawCaptButton(x,Form.cheight-66,300,30,10,system.color.work_button,system.color.work_button_text,MANUALLY_BUTTON_TEXT);
105
}
106
 
107
 
108
stop: