Subversion Repositories Kolibri OS

Rev

Rev 6746 | Rev 7519 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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