Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
6653 leency 1
#define MEMSIZE 4096*20
2
 
3
//===================================================//
4
//                                                   //
5
//                       LIB                         //
6
//                                                   //
7
//===================================================//
8
 
6631 leency 9
#include "../lib/gui.h"
6653 leency 10
#include "../lib/list_box.h"
11
#include "../lib/obj/box_lib.h"
12
#include "../lib/obj/libio_lib.h"
13
#include "../lib/obj/libini.h"
14
#include "../lib/patterns/select_list.h"
15
 
16
//===================================================//
17
//                                                   //
18
//                       DATA                        //
19
//                                                   //
20
//===================================================//
21
 
6631 leency 22
proc_info Form;
23
 
24
#define WINDOW_TITLE "Driver Installer"
25
#define T_CAUTION_TITLE "CAUTION"
26
#define T_CAUTION_PARAGRAPH "Installing additional drivers can be harmful to the stability of the operation system and potentionally can harm hardware."
27
#define T_ASSEPT_RISK "I assept the risk"
6651 leency 28
#define T_README "Readme"
29
#define T_INSTALL "Install"
6631 leency 30
 
31
#define BUTTON_ID_ASSEPT_RISK 10
6651 leency 32
#define BUTTON_ID_README 11
33
#define BUTTON_ID_INSTALL 12
6631 leency 34
 
6651 leency 35
//WINDOW STEPS
36
#define WINDOW_STEP_INTRO 1;
37
#define WINDOW_STEP_DRIVER_LIST 2;
38
char window_step = WINDOW_STEP_INTRO;
6631 leency 39
 
6653 leency 40
//===================================================//
41
//                                                   //
42
//                       CODE                        //
43
//                                                   //
44
//===================================================//
45
 
46
void GetIniData()
47
{
48
	ini_enum_sections stdcall ("/sys/drvinf.ini", #process_sections);
49
}
50
 
51
byte process_sections(dword sec_name, f_name)
52
{
53
	ini_enum_keys stdcall (f_name, sec_name, #process_keys);
54
	return true;
55
}
56
 
57
byte process_keys(dword key_value, key_name, sec_name, f_name)
58
{
59
	debugln(key_value);
60
	return true;
61
}
62
 
6631 leency 63
void main()
64
{
6653 leency 65
	int id;
66
	load_dll(libio,  #libio_init,1);
67
	load_dll(libini, #lib_init,1);
68
	load_dll(boxlib, #box_lib_init,0);
69
	//GetIniData();
70
	SetEventMask(0x27);
6631 leency 71
	loop() switch(WaitEvent())
72
	{
6653 leency 73
		case evMouse:
74
			if (!CheckActiveProcess(Form.ID)) return;
75
			SelectList_ProcessMouse();
76
			break;
77
 
6631 leency 78
		case evButton:
79
			id=GetButtonID();
80
			if (id==1) ExitProcess();
6653 leency 81
			if (id==BUTTON_ID_ASSEPT_RISK) Event_AsseptRisk();
82
			if (id==BUTTON_ID_README) Event_ShowReadme();
83
			if (id==BUTTON_ID_INSTALL) Event_RunInstall();
6631 leency 84
			break;
85
 
86
		case evKey:
87
			GetKeys();
6653 leency 88
			if (select_list.ProcessKey(key_scancode)) SelectList_LineChanged();
6631 leency 89
			break;
90
 
91
		case evReDraw:
6653 leency 92
			Event_DrawWindow();
6631 leency 93
	}
94
}
95
 
96
 
6651 leency 97
void draw_intro_window()
6631 leency 98
{
99
	incn y;
6651 leency 100
	y.n = Form.cheight/2 - 80;
6631 leency 101
	WriteTextB(30+2,y.n+2,0x81,MixColors(system.color.work, 0xB92234,220),T_CAUTION_TITLE);
102
	WriteTextB(30,y.n,0x81,0xB92234,T_CAUTION_TITLE);
6651 leency 103
	y.n = DrawTextViewArea(30, y.inc(30), Form.cwidth-60, Form.cheight-140,
6631 leency 104
		T_CAUTION_PARAGRAPH, -1, system.color.work_text);
105
	DrawStandartCaptButton(30, y.inc(10), BUTTON_ID_ASSEPT_RISK, T_ASSEPT_RISK);
106
}
107
 
108
 
6651 leency 109
void draw_driver_list_window()
110
{
111
	int PADDING = 12;
112
	int right_frame_x = Form.cwidth/2 + PADDING + calc(PADDING/2);
113
	//LEFT FRAME
6653 leency 114
	select_list.count = 4;
115
	SelectList_Init(PADDING,
116
		PADDING,
117
		Form.cwidth/2 - PADDING - scroll1.size_x,
118
		Form.cheight - PADDING - PADDING,
119
		false);
120
	SelectList_Draw();
6651 leency 121
	//RIGHT FRAME
6653 leency 122
	WriteTextB(right_frame_x, PADDING+3, 0x81, system.color.work_text, "ATI KMS");
123
	WriteText(right_frame_x, PADDING+23, 0x80, MixColors(system.color.work, system.color.work_text,120), "ver 4.4");
124
	DrawTextViewArea(right_frame_x-2, PADDING+53, Form.cwidth - right_frame_x - PADDING, Form.cheight-100,
6651 leency 125
		T_CAUTION_PARAGRAPH, -1, system.color.work_text);
126
	right_frame_x += DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_README, T_README);
127
	DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_INSTALL, T_INSTALL);
128
}
6653 leency 129
 
130
void SelectList_DrawLine(dword i)
131
{
132
	int yyy, list_last;
133
 
134
	yyy = i*select_list.item_h+select_list.y;
135
 
136
	if (select_list.cur_y-select_list.first==i)
137
	{
138
		DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, system.color.work_button);
139
		WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,system.color.work_button_text, "Hello");
140
	}
141
	else
142
	{
143
		DrawBar(select_list.x,yyy,select_list.w, select_list.item_h, 0xFFFfff);
144
		WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,0, "Hello");
145
	}
146
}
147
 
148
void SelectList_LineChanged()
149
{
150
	SelectList_Draw();
151
}
152
 
153
//===================================================//
154
//                                                   //
155
//                     EVENTS                        //
156
//                                                   //
157
//===================================================//
158
 
159
void Event_DrawWindow()
160
{
161
	system.color.get();
162
	DefineAndDrawWindow(215, 100, 600, 400, 0x33, system.color.work, WINDOW_TITLE);
163
	GetProcessInfo(#Form, SelfInfo);
164
	if (window_step == WINDOW_STEP_INTRO) draw_intro_window();
165
	if (window_step == WINDOW_STEP_DRIVER_LIST) draw_driver_list_window();
166
	return;
167
}
168
 
169
void Event_AsseptRisk()
170
{
171
	window_step = WINDOW_STEP_DRIVER_LIST;
172
	Event_DrawWindow();
173
}
174
 
175
void Event_ShowReadme()
176
{
177
	return;
178
}
179
 
180
void Event_RunInstall()
181
{
182
	return;
183
}