Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
6250 leency 1
#define MEMSIZE 4096*20
2
#include "..\lib\strings.h"
3
#include "..\lib\mem.h"
4
#include "..\lib\io.h"
5
#include "..\lib\gui.h"
6
#include "..\lib\obj\proc_lib.h"
7
#include "..\lib\patterns\simple_open_dialog.h"
6258 leency 8
#include "..\lib\patterns\restart_process.h"
8509 leency 9
#include "added_sysdir.c"
6250 leency 10
 
7519 leency 11
//===================================================//
12
//                                                   //
13
//                       DATA                        //
14
//                                                   //
15
//===================================================//
16
 
17
proc_info Form;
18
#define CONX 30 //content X pos
19
 
6250 leency 20
char default_dir[] = "/rd/1";
21
od_filter filter2 = {"",0};
22
 
23
dword scr = FROM "scr.raw_8bit";
24
dword scr_pal[] = {0xFFFFFF,0xBBDDFF,0x4166B5,0xE0E4E6,0xAFBEDD,0xC4D4E8,0x52ACDD,0x000000,
25
0xE9DAB2,0xC99811,0xFDF9D4,0xF8B93C,0xFDEEBE,0xFBEBA6,0xDFAF4F,0xF3D57C};
26
 
7037 leency 27
#define BTN_MANUAL_SEARCH 10
7519 leency 28
#define BTN_OPEN_ANYWAY 11
7037 leency 29
 
7519 leency 30
#define APP_PLUS_INI_PATH "/sys/settings/app_plus.ini"
6250 leency 31
 
7519 leency 32
//===================================================//
33
//                                                   //
34
//                   TRANSLATIONS                    //
35
//                                                   //
36
//===================================================//
6250 leency 37
 
7519 leency 38
#ifdef LANG_RUS
39
?define WINDOW_TITLE_TEXT "Внимание! Это важно."
40
?define CONTENT_HEADER_TEXT "ПАПКА /KOLIBRIOS/ НЕ НАЙДЕНА"
41
?define DESCRIPTION_TEXT "Попробуйте найти ее самостоятельно.
7613 leency 42
Содержимое искомой папки показано на
7519 leency 43
картинке справа. В случае неверно
44
выбранной папки требуется выполнить
45
перезагрузку ПК и попробовать снова."
46
?define MANUALLY_BUTTON_TEXT "Найти /kolibrios/..."
47
?define OPEN_ANYWAY_BUTTON_TEXT "Запустить APP+ (некоторые программы будут недоступны)"
48
#else
49
?define WINDOW_TITLE_TEXT "Warning! It's important."
50
?define CONTENT_HEADER_TEXT "/KOLIBRIOS/ IS NOT MOUNTED"
51
?define DESCRIPTION_TEXT "Try to find it manually. It should look
6251 leency 52
like image on the right.
53
Note: this action can be done only once
54
per 1 session of the OS running. If you
55
will choose the wrong folder then you
56
need to reboot system to try again."
7519 leency 57
?define MANUALLY_BUTTON_TEXT "Choose /kolibrios/ folder..."
58
?define OPEN_ANYWAY_BUTTON_TEXT "Open APP+ anyway (some apps will be unavailable)"
59
#endif
6251 leency 60
 
7519 leency 61
//===================================================//
62
//                                                   //
63
//                       CODE                        //
64
//                                                   //
65
//===================================================//
6251 leency 66
 
6250 leency 67
void main()
68
{
8407 leency 69
	if (param) {
70
		SetAdditionalSystemDirectory("kolibrios", #param+1);
71
		ExitProcess();
72
	}
73
 
7037 leency 74
	WaitAutosearch();
6250 leency 75
	CheckKosMounted();
76
 
77
	o_dialog.type = 2;
7984 leency 78
	#define NO_DLL_INIT
6250 leency 79
	load_dll(Proc_lib, #OpenDialog_init,0);
80
	OpenDialog_init stdcall (#o_dialog);
7037 leency 81
	active_button_id = BTN_MANUAL_SEARCH;
6250 leency 82
 
7984 leency 83
	loop() switch(@WaitEvent())
6250 leency 84
	{
85
		case evButton:
7519 leency 86
			EventButton(GetButtonID());
6250 leency 87
			break;
7037 leency 88
		case evKey:
8400 leency 89
			@GetKeyScancode();
7984 leency 90
			if (AL == SCAN_CODE_ENTER) {
7519 leency 91
				EventButton(active_button_id);
7984 leency 92
			} else if (AL == SCAN_CODE_TAB) {
7519 leency 93
				active_button_id = active_button_id-10^1 + 10;
94
				DrawButtons();
95
			}
7037 leency 96
			break;
6250 leency 97
 
98
		case evReDraw:
99
			draw_window();
100
	}
101
}
102
 
103
void draw_window()
104
{
105
	incn y;
7806 leency 106
	sc.get();
107
	DefineAndDrawWindow(screen.width-570/2, 100, 570, 300+skin_height, 0x34, sc.work, WINDOW_TITLE_TEXT,0);
6250 leency 108
	GetProcessInfo(#Form, SelfInfo);
7984 leency 109
	WriteTextB(CONX+2,y.set(20)+2,0x81,MixColors(sc.work, 0xB92234,220),CONTENT_HEADER_TEXT);
7519 leency 110
	WriteTextB(CONX,y.n,0x81,0xB92234,CONTENT_HEADER_TEXT);
6250 leency 111
 
112
	PutPaletteImage(#scr,144,171,Form.cwidth-180,y.n,8,#scr_pal);
7806 leency 113
	DrawRectangle(Form.cwidth-180-1,y.n-1, 144+1,171+1, sc.work_graph);
7519 leency 114
 
7806 leency 115
	WriteTextLines(CONX,y.inc(50),0x90,sc.work_text,DESCRIPTION_TEXT,20);
7519 leency 116
 
117
	DrawButtons();
6250 leency 118
}
119
 
7519 leency 120
void DrawButtons()
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
//===================================================//
141
//                                                   //
142
//                      EVENTS                       //
143
//                                                   //
144
//===================================================//
145
 
7037 leency 146
void EventManualSearch()
147
{
148
	OpenDialog_start stdcall (#o_dialog);
149
	if (o_dialog.status) SetAdditionalSystemDirectory("kolibrios", #openfile_path+1);
150
	pause(3);
151
	CheckKosMounted();
152
}
6250 leency 153
 
7519 leency 154
void EventOpenApp()
155
{
7614 leency 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
	}
7519 leency 159
}
7037 leency 160
 
7519 leency 161
void EventButton(dword id)
162
{
163
	if (id==CLOSE_BTN) ExitProcess();
164
	else if (id==BTN_MANUAL_SEARCH) EventManualSearch();
165
	else if (id==BTN_OPEN_ANYWAY) { EventOpenApp();	 ExitProcess(); }
166
}
167
 
168
 
6250 leency 169
stop: