Subversion Repositories Kolibri OS

Rev

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