Subversion Repositories Kolibri OS

Rev

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

Rev 6653 Rev 6654
Line 9... Line 9...
9
#include "../lib/gui.h"
9
#include "../lib/gui.h"
10
#include "../lib/list_box.h"
10
#include "../lib/list_box.h"
11
#include "../lib/obj/box_lib.h"
11
#include "../lib/obj/box_lib.h"
12
#include "../lib/obj/libio_lib.h"
12
#include "../lib/obj/libio_lib.h"
13
#include "../lib/obj/libini.h"
13
#include "../lib/obj/libini.h"
-
 
14
#include "../lib/collection.h"
-
 
15
#include "../lib/io.h"
14
#include "../lib/patterns/select_list.h"
16
#include "../lib/patterns/select_list.h"
Line 15... Line 17...
15
 
17
 
16
//===================================================//
18
//===================================================//
17
//                                                   //
19
//                                                   //
Line 35... Line 37...
35
//WINDOW STEPS
37
//WINDOW STEPS
36
#define WINDOW_STEP_INTRO 1;
38
#define WINDOW_STEP_INTRO 1;
37
#define WINDOW_STEP_DRIVER_LIST 2;
39
#define WINDOW_STEP_DRIVER_LIST 2;
38
char window_step = WINDOW_STEP_INTRO;
40
char window_step = WINDOW_STEP_INTRO;
Line -... Line 41...
-
 
41
 
-
 
42
collection ini_sections;
-
 
43
 
-
 
44
char drvinf_path[4096] = "/sys/drvinf.ini";
-
 
45
char cur_version[64];
-
 
46
char cur_description[1024];
-
 
47
char cur_readme_path[4096];
-
 
48
char cur_install_path[4096];
39
 
49
 
40
//===================================================//
50
//===================================================//
41
//                                                   //
51
//                                                   //
42
//                       CODE                        //
52
//                       CODE                        //
43
//                                                   //
53
//                                                   //
Line 44... Line 54...
44
//===================================================//
54
//===================================================//
45
 
55
 
-
 
56
void GetIniData()
46
void GetIniData()
57
{
47
{
58
	select_list.count = 0;
Line 48... Line 59...
48
	ini_enum_sections stdcall ("/sys/drvinf.ini", #process_sections);
59
	ini_enum_sections stdcall (#drvinf_path, #process_sections);
49
}
60
}
50
 
-
 
51
byte process_sections(dword sec_name, f_name)
61
 
52
{
-
 
53
	ini_enum_keys stdcall (f_name, sec_name, #process_keys);
-
 
54
	return true;
-
 
55
}
-
 
56
 
62
byte process_sections(dword sec_name, f_name)
57
byte process_keys(dword key_value, key_name, sec_name, f_name)
63
{
58
{
64
	select_list.count++;
Line 59... Line 65...
59
	debugln(key_value);
65
	ini_sections.add(sec_name);
60
	return true;
66
	return true;
61
}
67
}
62
 
68
 
63
void main()
69
void main()
64
{
70
{
65
	int id;
71
	int id;
66
	load_dll(libio,  #libio_init,1);
72
	load_dll(libio,  #libio_init,1);
67
	load_dll(libini, #lib_init,1);
73
	load_dll(libini, #lib_init,1);
68
	load_dll(boxlib, #box_lib_init,0);
74
	load_dll(boxlib, #box_lib_init,0);
69
	//GetIniData();
75
	GetIniData();
70
	SetEventMask(0x27);
76
	SetEventMask(0x27);
71
	loop() switch(WaitEvent())
77
	loop() switch(WaitEvent())
72
	{
78
	{
Line 73... Line 79...
73
		case evMouse:
79
		case evMouse:
74
			if (!CheckActiveProcess(Form.ID)) return;
80
			if (!CheckActiveProcess(Form.ID)) break;
Line 107... Line 113...
107
 
113
 
108
 
114
 
109
void draw_driver_list_window()
115
void draw_driver_list_window()
110
{
116
{
-
 
117
	int PADDING = 12;
111
	int PADDING = 12;
118
	int right_frame_x = Form.cwidth*46/100;
112
	int right_frame_x = Form.cwidth/2 + PADDING + calc(PADDING/2);
-
 
113
	//LEFT FRAME
119
	int readme_w = 0;
114
	select_list.count = 4;
120
	//LEFT FRAME
115
	SelectList_Init(PADDING, 
121
	SelectList_Init(PADDING, 
116
		PADDING, 
122
		PADDING, 
117
		Form.cwidth/2 - PADDING - scroll1.size_x, 
123
		right_frame_x - PADDING - PADDING - 8 - scroll1.size_x, 
118
		Form.cheight - PADDING - PADDING, 
124
		Form.cheight - PADDING - PADDING, 
119
		false);
125
		false);
120
	SelectList_Draw();
126
	SelectList_Draw();
121
	//RIGHT FRAME
127
	//RIGHT FRAME
122
	WriteTextB(right_frame_x, PADDING+3, 0x81, system.color.work_text, "ATI KMS");
128
	GetCurrentSectionData();
123
	WriteText(right_frame_x, PADDING+23, 0x80, MixColors(system.color.work, system.color.work_text,120), "ver 4.4");
129
	DrawBar(right_frame_x, PADDING+3, Form.cwidth - right_frame_x - PADDING, 80, system.color.work);
124
	DrawTextViewArea(right_frame_x-2, PADDING+53, Form.cwidth - right_frame_x - PADDING, Form.cheight-100, 
130
	WriteTextB(right_frame_x, PADDING+3, 0x81, system.color.work_text, ini_sections.get(select_list.cur_y));
125
		T_CAUTION_PARAGRAPH, -1, system.color.work_text);
131
	WriteText(right_frame_x, PADDING+23, 0x80, system.color.work_text, #cur_version);
-
 
132
	if(cur_readme_path[0]) readme_w = DrawStandartCaptButton(right_frame_x, PADDING+45, BUTTON_ID_README, T_README);
-
 
133
	DrawStandartCaptButton(right_frame_x + readme_w, PADDING+45, BUTTON_ID_INSTALL, T_INSTALL);
126
	right_frame_x += DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_README, T_README);
134
	DrawTextViewArea(right_frame_x-2, PADDING+83, Form.cwidth - right_frame_x - PADDING, Form.cheight-PADDING-PADDING, 
Line 127... Line 135...
127
	DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_INSTALL, T_INSTALL);
135
		#cur_description, system.color.work, system.color.work_text);
128
}
136
}
129
 
137
 
Line 134... Line 142...
134
	yyy = i*select_list.item_h+select_list.y;
142
	yyy = i*select_list.item_h+select_list.y;
Line 135... Line 143...
135
	
143
	
136
	if (select_list.cur_y-select_list.first==i)
144
	if (select_list.cur_y-select_list.first==i)
137
	{
145
	{
138
		DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, system.color.work_button);
146
		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");
147
		WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,system.color.work_button_text, ini_sections.get(i));
140
	}
148
	}
141
	else
149
	else
142
	{
150
	{
143
		DrawBar(select_list.x,yyy,select_list.w, select_list.item_h, 0xFFFfff);
151
		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");
152
		WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,0, ini_sections.get(i));
145
	}
153
	}
Line 146... Line 154...
146
}
154
}
147
 
155
 
148
void SelectList_LineChanged()
156
void SelectList_LineChanged()
-
 
157
{
-
 
158
	draw_driver_list_window();
-
 
159
}
-
 
160
 
-
 
161
void GetCurrentSectionData()
-
 
162
{
-
 
163
	dword cur_section_name = ini_sections.get(select_list.cur_y);
-
 
164
	ini_get_str stdcall (#drvinf_path, cur_section_name, "ver", #cur_version, sizeof(cur_version), 0);
-
 
165
	ini_get_str stdcall (#drvinf_path, cur_section_name, "description", #cur_description, sizeof(cur_description), 0);
149
{
166
	ini_get_str stdcall (#drvinf_path, cur_section_name, "readme", #cur_readme_path, sizeof(cur_readme_path), 0);
Line 150... Line 167...
150
	SelectList_Draw();
167
	ini_get_str stdcall (#drvinf_path, cur_section_name, "install", #cur_install_path, sizeof(cur_install_path), 0);
151
}
168
}
152
 
169
 
Line 159... Line 176...
159
void Event_DrawWindow() 
176
void Event_DrawWindow() 
160
{
177
{
161
	system.color.get();
178
	system.color.get();
162
	DefineAndDrawWindow(215, 100, 600, 400, 0x33, system.color.work, WINDOW_TITLE);
179
	DefineAndDrawWindow(215, 100, 600, 400, 0x33, system.color.work, WINDOW_TITLE);
163
	GetProcessInfo(#Form, SelfInfo);
180
	GetProcessInfo(#Form, SelfInfo);
-
 
181
	if (Form.status_window>2) return;
-
 
182
	if (Form.width  < 450) { MoveSize(OLD,OLD,450,OLD); return; }
-
 
183
	if (Form.height < 250) { MoveSize(OLD,OLD,OLD,250); return; }
164
	if (window_step == WINDOW_STEP_INTRO) draw_intro_window();
184
	if (window_step == WINDOW_STEP_INTRO) draw_intro_window();
165
	if (window_step == WINDOW_STEP_DRIVER_LIST) draw_driver_list_window();
185
	if (window_step == WINDOW_STEP_DRIVER_LIST) draw_driver_list_window();
166
	return;
186
	return;
167
}
187
}
Line 172... Line 192...
172
	Event_DrawWindow();
192
	Event_DrawWindow();
173
}
193
}
Line 174... Line 194...
174
 
194
 
175
void Event_ShowReadme()
195
void Event_ShowReadme()
176
{
196
{
177
	return;
197
	io.run("/sys/textreader", #cur_readme_path);
Line 178... Line 198...
178
}
198
}
179
 
199
 
180
void Event_RunInstall()
200
void Event_RunInstall()
181
{
201
{
182
	return;
202
	io.run(#cur_install_path, NULL);