Subversion Repositories Kolibri OS

Rev

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