Subversion Repositories Kolibri OS

Rev

Rev 7197 | Rev 7613 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7197 Rev 7519
Line 1... Line -...
1
#ifndef AUTOBUILD
-
 
2
#include "lang.h--"
-
 
3
#endif
-
 
4
 
-
 
5
#define MEMSIZE 4096*20
1
#define MEMSIZE 4096*20
6
#include "..\lib\strings.h" 
2
#include "..\lib\strings.h" 
7
#include "..\lib\mem.h" 
3
#include "..\lib\mem.h" 
8
#include "..\lib\io.h"
4
#include "..\lib\io.h"
9
#include "..\lib\gui.h"
5
#include "..\lib\gui.h"
10
#include "..\lib\obj\proc_lib.h"
6
#include "..\lib\obj\proc_lib.h"
11
#include "..\lib\patterns\simple_open_dialog.h"
7
#include "..\lib\patterns\simple_open_dialog.h"
12
#include "..\lib\patterns\restart_process.h"
8
#include "..\lib\patterns\restart_process.h"
13
#include "..\lib\added_sysdir.c"
9
#include "..\lib\added_sysdir.c"
Line -... Line 10...
-
 
10
 
-
 
11
#ifndef AUTOBUILD
-
 
12
#include "lang.h--"
Line -... Line 13...
-
 
13
#endif
-
 
14
 
14
 
15
//===================================================//
15
 
16
//                                                   //
-
 
17
//                       DATA                        //
Line 16... Line 18...
16
char default_dir[] = "/rd/1";
18
//                                                   //
-
 
19
//===================================================//
-
 
20
 
-
 
21
proc_info Form;
-
 
22
#define CONX 30 //content X pos
Line 17... Line 23...
17
od_filter filter2 = {"",0};
23
 
18
 
24
char default_dir[] = "/rd/1";
19
proc_info Form;
25
od_filter filter2 = {"",0};
Line 20... Line 26...
20
 
26
 
-
 
27
dword scr = FROM "scr.raw_8bit";
Line 21... Line 28...
21
dword scr = FROM "scr.raw_8bit";
28
dword scr_pal[] = {0xFFFFFF,0xBBDDFF,0x4166B5,0xE0E4E6,0xAFBEDD,0xC4D4E8,0x52ACDD,0x000000,
Line -... Line 29...
-
 
29
0xE9DAB2,0xC99811,0xFDF9D4,0xF8B93C,0xFDEEBE,0xFBEBA6,0xDFAF4F,0xF3D57C};
-
 
30
 
22
dword scr_pal[] = {0xFFFFFF,0xBBDDFF,0x4166B5,0xE0E4E6,0xAFBEDD,0xC4D4E8,0x52ACDD,0x000000,
31
#define BTN_MANUAL_SEARCH 10
-
 
32
#define BTN_OPEN_ANYWAY 11
-
 
33
 
23
0xE9DAB2,0xC99811,0xFDF9D4,0xF8B93C,0xFDEEBE,0xFBEBA6,0xDFAF4F,0xF3D57C};
34
#define APP_PLUS_INI_PATH "/sys/settings/app_plus.ini"
-
 
35
 
-
 
36
//===================================================//
-
 
37
//                                                   //
-
 
38
//                   TRANSLATIONS                    //
-
 
39
//                                                   //
-
 
40
//===================================================//
-
 
41
 
-
 
42
#ifdef LANG_RUS
-
 
43
?define WINDOW_TITLE_TEXT "‚­¨¬ ­¨¥! â® ¢ ¦­®."
-
 
44
?define CONTENT_HEADER_TEXT "€Š€ /KOLIBRIOS/ … €‰„…€"
-
 
45
?define DESCRIPTION_TEXT "®¯à®¡ã©â¥ ­ ©â¨ ¥¥ á ¬®áâ®ï⥫쭮.
24
 
46
‘®¤¥à¦¨¬®¥ ¨ª®¬®© ¯ ¯ª¨ ¯®ª § ­® ­  
25
#define BTN_MANUAL_SEARCH 10
47
ª à⨭ª¥ á¯à ¢ . ‚ á«ãç ¥ ­¥¢¥à­® 
26
 
48
¢ë¡à ­­®© ¯ ¯ª¨ âॡã¥âáï ¢ë¯®«­¨âì 
27
#define APP_PLUS_INI_PATH "/kolibrios/settings/app_plus.ini"
49
¯¥à¥§ £à㧪㠏Š ¨ ¯®¯à®¡®¢ âì á­®¢ ."
28
 
50
?define MANUALLY_BUTTON_TEXT " ©â¨ /kolibrios/..."
29
#define APP_PLUS_INI_NOT_EXISTS "'APP+\n/kolibrios/settings/app_plus.ini does not exists.\nProgram terminated.' -tE"
51
?define OPEN_ANYWAY_BUTTON_TEXT "‡ ¯ãáâ¨âì APP+ (­¥ª®â®àë¥ ¯à®£à ¬¬ë ¡ã¤ãâ ­¥¤®áâ㯭ë)"
30
 
52
#else
31
#define WINDOW_TITLE_TEXT "Error"
53
?define WINDOW_TITLE_TEXT "Warning! It's important."
32
#define CONTENT_HEADER_TEXT "/KOLIBRIOS/ IS NOT MOUNTED"
54
?define CONTENT_HEADER_TEXT "/KOLIBRIOS/ IS NOT MOUNTED"
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
 
55
?define DESCRIPTION_TEXT "Try to find it manually. It should look
41
 
56
like image on the right.
42
void CheckKosMounted()
-
 
43
{
-
 
44
	if (dir_exists("/kolibrios")) 
-
 
45
	{
-
 
Line -... Line 57...
-
 
57
Note: this action can be done only once 
46
		if (file_exists(APP_PLUS_INI_PATH))	
58
per 1 session of the OS running. If you 
47
			RunProgram("syspanel", APP_PLUS_INI_PATH);
-
 
48
		else
59
will choose the wrong folder then you 
49
			notify(APP_PLUS_INI_NOT_EXISTS);
-
 
-
 
60
need to reboot system to try again."
-
 
61
?define MANUALLY_BUTTON_TEXT "Choose /kolibrios/ folder..."
Line 50... Line 62...
50
		ExitProcess();
62
?define OPEN_ANYWAY_BUTTON_TEXT "Open APP+ anyway (some apps will be unavailable)"
51
	}
63
#endif
52
}
-
 
53
 
-
 
54
void WaitAutosearch()
-
 
55
{
64
 
56
	while (CheckProcessExists("SEARCHAP")) pause(2);
65
//===================================================//
Line 57... Line 66...
57
}
66
//                                                   //
58
 
67
//                       CODE                        //
Line 70... Line 79...
70
	active_button_id = BTN_MANUAL_SEARCH;
79
	active_button_id = BTN_MANUAL_SEARCH;
Line 71... Line 80...
71
 
80
 
72
	loop() switch(WaitEvent())
81
	loop() switch(WaitEvent())
73
	{	
82
	{	
74
		case evButton:
83
		case evButton:
75
			id=GetButtonID();               
-
 
76
			if (id==1) ExitProcess();
-
 
77
			if (id==BTN_MANUAL_SEARCH) EventManualSearch();
84
			EventButton(GetButtonID());
78
			break;
85
			break;
79
		case evKey:
86
		case evKey:
80
			GetKeys();
87
			GetKeys();
-
 
88
			if (key_scancode == SCAN_CODE_ENTER) {
-
 
89
				EventButton(active_button_id);
-
 
90
			}
-
 
91
			else if (key_scancode == SCAN_CODE_TAB) {
-
 
92
				active_button_id = active_button_id-10^1 + 10;
-
 
93
				DrawButtons();
81
			if (key_scancode == SCAN_CODE_ENTER) EventManualSearch();
94
			}
Line 82... Line 95...
82
			break;
95
			break;
83
		 
96
		 
84
		case evReDraw:
97
		case evReDraw:
85
			draw_window();
98
			draw_window();
Line 86... Line 99...
86
	}
99
	}
87
}
100
}
88
 
101
 
89
void draw_window()
-
 
90
{
102
void draw_window()
91
	incn y;
103
{
92
	dword x=30;
104
	incn y;
93
	y.n=0;
105
	y.n=0;
94
	system.color.get();
106
	system.color.get();
95
	DefineAndDrawWindow(screen.width-570/2, 100, 570, 280+skin_height, 0x34, system.color.work, WINDOW_TITLE_TEXT,0);
107
	DefineAndDrawWindow(screen.width-570/2, 100, 570, 300+skin_height, 0x34, system.color.work, WINDOW_TITLE_TEXT,0);
96
	GetProcessInfo(#Form, SelfInfo);
-
 
97
	WriteTextB(x+2,y.inc(20)+2,0x81,MixColors(system.color.work, 0xB92234,220),CONTENT_HEADER_TEXT);
-
 
Line 98... Line 108...
98
	WriteTextB(x,y.n,0x81,0xB92234,CONTENT_HEADER_TEXT);
108
	GetProcessInfo(#Form, SelfInfo);
99
	
109
	WriteTextB(CONX+2,y.inc(20)+2,0x81,MixColors(system.color.work, 0xB92234,220),CONTENT_HEADER_TEXT);
-
 
110
	WriteTextB(CONX,y.n,0x81,0xB92234,CONTENT_HEADER_TEXT);
-
 
111
	
-
 
112
	PutPaletteImage(#scr,144,171,Form.cwidth-180,y.n,8,#scr_pal);
-
 
113
	DrawRectangle(Form.cwidth-180-1,y.n-1, 144+1,171+1, system.color.work_graph);
-
 
114
 
-
 
115
	WriteTextLines(CONX,y.inc(50),0x90,system.color.work_text,DESCRIPTION_TEXT,20);
-
 
116
 
-
 
117
	DrawButtons();	
100
	WriteTextLines(x,y.inc(50),0x90,system.color.work_text,DESCRIPTION_TEXT,20);
118
}
-
 
119
 
101
	
120
void DrawButtons()
Line -... Line 121...
-
 
121
{
-
 
122
	DrawStandartCaptButton(CONX, Form.cheight-80, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT);
-
 
123
	DrawStandartCaptButton(CONX, Form.cheight-42, BTN_OPEN_ANYWAY, OPEN_ANYWAY_BUTTON_TEXT);
-
 
124
}
-
 
125
 
-
 
126
void CheckKosMounted()
-
 
127
{
-
 
128
	if (dir_exists("/kolibrios")) 
-
 
129
	{
-
 
130
		if (file_exists(APP_PLUS_INI_PATH))	EventOpenApp();
-
 
131
		ExitProcess();
-
 
132
	}
-
 
133
}
-
 
134
 
-
 
135
void WaitAutosearch()
-
 
136
{
-
 
137
	while (CheckProcessExists("SEARCHAP")) pause(2);
-
 
138
}
-
 
139
 
-
 
140
//===================================================//
102
	PutPaletteImage(#scr,144,171,Form.cwidth-180,y.n,8,#scr_pal);
141
//                                                   //
103
	DrawRectangle(Form.cwidth-180-1,y.n-1, 144+1,171+1, system.color.work_graph);
142
//                      EVENTS                       //
104
	DrawStandartCaptButton(x, Form.cheight-66, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT);
143
//                                                   //
105
}
144
//===================================================//
106
 
145
 
107
void EventManualSearch()
146
void EventManualSearch()
108
{
147
{
Line -... Line 148...
-
 
148
	OpenDialog_start stdcall (#o_dialog);
-
 
149
	if (o_dialog.status) SetAdditionalSystemDirectory("kolibrios", #openfile_path+1);
-
 
150
	pause(3);
-
 
151
	CheckKosMounted();	
-
 
152
}
-
 
153
 
-
 
154
void EventOpenApp()
-
 
155
{
-
 
156
	RunProgram("syspanel", APP_PLUS_INI_PATH);
-
 
157
}
-
 
158
 
-
 
159
void EventButton(dword id)
Line 109... Line 160...
109
	OpenDialog_start stdcall (#o_dialog);
160
{