Subversion Repositories Kolibri OS

Rev

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

Rev 6651 Rev 6653
Line 1... Line 1...
1
#define MEMSIZE 4096*10
1
#define MEMSIZE 4096*20
-
 
2
 
-
 
3
//===================================================//
-
 
4
//                                                   //
-
 
5
//                       LIB                         //
-
 
6
//                                                   //
-
 
7
//===================================================//
-
 
8
 
2
#include "../lib/gui.h"
9
#include "../lib/gui.h"
-
 
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
 
3
proc_info Form;
22
proc_info Form;
Line 4... Line 23...
4
 
23
 
5
#define WINDOW_TITLE "Driver Installer"
24
#define WINDOW_TITLE "Driver Installer"
6
#define T_CAUTION_TITLE "CAUTION"
25
#define T_CAUTION_TITLE "CAUTION"
Line 16... Line 35...
16
//WINDOW STEPS
35
//WINDOW STEPS
17
#define WINDOW_STEP_INTRO 1;
36
#define WINDOW_STEP_INTRO 1;
18
#define WINDOW_STEP_DRIVER_LIST 2;
37
#define WINDOW_STEP_DRIVER_LIST 2;
19
char window_step = WINDOW_STEP_INTRO;
38
char window_step = WINDOW_STEP_INTRO;
Line -... Line 39...
-
 
39
 
-
 
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
}
20
 
62
 
21
void main()
63
void main()
22
{
64
{
-
 
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();
23
	word id;
70
	SetEventMask(0x27);
24
	loop() switch(WaitEvent())
71
	loop() switch(WaitEvent())
-
 
72
	{
-
 
73
		case evMouse:
-
 
74
			if (!CheckActiveProcess(Form.ID)) return;
-
 
75
			SelectList_ProcessMouse();
-
 
76
			break;
25
	{
77
 
26
		case evButton:
78
		case evButton:
27
			id=GetButtonID();               
79
			id=GetButtonID();               
28
			if (id==1) ExitProcess();
80
			if (id==1) ExitProcess();
29
			if (id==BUTTON_ID_ASSEPT_RISK) {
81
			if (id==BUTTON_ID_ASSEPT_RISK) Event_AsseptRisk();
30
				window_step = WINDOW_STEP_DRIVER_LIST;
82
			if (id==BUTTON_ID_README) Event_ShowReadme();
31
				goto _EV_WINDOW_REDRAW;
-
 
32
			}
83
			if (id==BUTTON_ID_INSTALL) Event_RunInstall();
Line 33... Line 84...
33
			break;
84
			break;
34
	  
85
	  
-
 
86
		case evKey:
35
		case evKey:
87
			GetKeys();
Line 36... Line 88...
36
			GetKeys();
88
			if (select_list.ProcessKey(key_scancode)) SelectList_LineChanged();
37
			break;
-
 
38
		 
89
			break;
39
		case evReDraw:
-
 
40
		_EV_WINDOW_REDRAW:
-
 
41
			system.color.get();
-
 
42
			DefineAndDrawWindow(215, 100, 550, 350, 0x33, system.color.work, WINDOW_TITLE);
-
 
43
			GetProcessInfo(#Form, SelfInfo);
-
 
44
			if (window_step == WINDOW_STEP_INTRO) draw_intro_window();
90
		 
45
			if (window_step == WINDOW_STEP_DRIVER_LIST) draw_driver_list_window();
91
		case evReDraw:
Line 46... Line 92...
46
			break;
92
			Event_DrawWindow();
Line 62... Line 108...
62
 
108
 
63
void draw_driver_list_window()
109
void draw_driver_list_window()
64
{
110
{
65
	int PADDING = 12;
111
	int PADDING = 12;
66
	int right_frame_x = Form.cwidth/2 + PADDING + calc(PADDING/2);
-
 
67
	incn y;
-
 
68
	y.n = PADDING + 3;
112
	int right_frame_x = Form.cwidth/2 + PADDING + calc(PADDING/2);
-
 
113
	//LEFT FRAME
-
 
114
	select_list.count = 4;
-
 
115
	SelectList_Init(PADDING, 
-
 
116
		PADDING, 
69
	//LEFT FRAME
117
		Form.cwidth/2 - PADDING - scroll1.size_x, 
-
 
118
		Form.cheight - PADDING - PADDING, 
-
 
119
		false);
70
	DrawBar(PADDING, PADDING, Form.cwidth/2 - PADDING, Form.cheight - PADDING - PADDING, 0xEEEeee);
120
	SelectList_Draw();
71
	//RIGHT FRAME
121
	//RIGHT FRAME
72
	WriteTextB(right_frame_x, y.n, 0x81, system.color.work_text, "ATI KMS");
122
	WriteTextB(right_frame_x, PADDING+3, 0x81, system.color.work_text, "ATI KMS");
73
	WriteText(right_frame_x, y.inc(20), 0x80, MixColors(system.color.work, 0xCCCccc,80), "ver 4.4");
123
	WriteText(right_frame_x, PADDING+23, 0x80, MixColors(system.color.work, system.color.work_text,120), "ver 4.4");
74
	DrawTextViewArea(right_frame_x-2, y.inc(30), Form.cwidth - right_frame_x - PADDING, Form.cheight-100, 
124
	DrawTextViewArea(right_frame_x-2, PADDING+53, Form.cwidth - right_frame_x - PADDING, Form.cheight-100, 
75
		T_CAUTION_PARAGRAPH, -1, system.color.work_text);
125
		T_CAUTION_PARAGRAPH, -1, system.color.work_text);
76
	right_frame_x += DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_README, T_README);
126
	right_frame_x += DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_README, T_README);
77
	DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_INSTALL, T_INSTALL);
127
	DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_INSTALL, T_INSTALL);
-
 
128
}
-
 
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;
78
}
183
}