Subversion Repositories Kolibri OS

Rev

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

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