Subversion Repositories Kolibri OS

Rev

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

Rev 5409 Rev 5424
Line 1... Line 1...
1
/*
1
/*
2
SOFTWARE CENTER v2.21
2
SOFTWARE CENTER v2.3
3
*/
3
*/
Line 4... Line 4...
4
 
4
 
5
#define MEMSIZE 0x3E80
5
#define MEMSIZE 0x3E80
6
#include "..\lib\kolibri.h" 
6
#include "..\lib\kolibri.h" 
Line 18... Line 18...
18
 
18
 
19
system_colors sc;
19
system_colors sc;
20
proc_info Form;
20
proc_info Form;
Line -... Line 21...
-
 
21
mouse m;
-
 
22
 
21
mouse m;
23
byte kolibrios_mounted;
22
 
24
 
Line 23... Line 25...
23
int item_id_need_to_run=-1,
25
int item_id_need_to_run=-1,
24
    current_item_id;
26
    current_item_id;
Line 30... Line 32...
30
    cell_w,
32
    cell_w,
31
    cell_h, 
33
    cell_h, 
32
    list_pos, 
34
    list_pos, 
33
    list_top,
35
    list_top,
34
    row,
36
    row,
-
 
37
    old_row, //to detect empty sections
35
    col,
38
    col,
36
    default_icon;
39
    default_icon;
Line 37... Line 40...
37
 
40
 
38
char window_title[128],
41
char window_title[128],
Line 89... Line 92...
89
            if (id==1) ExitProcess();
92
            if (id==1) ExitProcess();
90
            if (id>=100)
93
            if (id>=100)
91
            {
94
            {
92
            	item_id_need_to_run = id - 100;
95
            	item_id_need_to_run = id - 100;
93
            	current_item_id = 0;
96
            	current_item_id = 0;
94
            	ini_enum_sections stdcall (#settings_ini_path, #draw_section);
97
            	ini_enum_sections stdcall (#settings_ini_path, #process_sections);
95
            	item_id_need_to_run = -1;
98
            	item_id_need_to_run = -1;
96
            }
99
            }
97
			break;
100
			break;
Line 98... Line 101...
98
 
101
 
99
         case evReDraw:
102
         case evReDraw:
100
			sc.get();
103
			sc.get();
101
			DefineAndDrawWindow(GetScreenWidth()-window_width/2,GetScreenHeight()-window_height/2,window_width,window_height,0x74,sc.work,"");
104
			DefineAndDrawWindow(GetScreenWidth()-window_width/2,GetScreenHeight()-window_height/2,window_width,window_height,0x74,sc.work,"");
102
			GetProcessInfo(#Form, SelfInfo);
105
			GetProcessInfo(#Form, SelfInfo);
-
 
106
			if (Form.status_window>2) { DrawTitle(#window_title); break; } else DrawTitle("");
103
			if (Form.status_window>2) { DrawTitle(#window_title); break; } else DrawTitle("");
107
			kolibrios_mounted = isdir("/kolibrios");
104
			col_max = Form.cwidth - 10 / cell_w;
108
			col_max = Form.cwidth - 10 / cell_w;
105
			current_item_id = 0;
109
			current_item_id = 0;
106
			draw_top_bar();
110
			draw_top_bar();
107
			ini_enum_sections stdcall (#settings_ini_path, #draw_section);
111
			ini_enum_sections stdcall (#settings_ini_path, #process_sections);
108
			DrawBar(0, row + 1 * cell_h + list_pos, Form.cwidth, -row - 1 * cell_h - list_pos + Form.cheight, LIST_BACKGROUND_COLOR);
112
			DrawBar(0, row + 1 * cell_h + list_pos, Form.cwidth, -row - 1 * cell_h - list_pos + Form.cheight, LIST_BACKGROUND_COLOR);
109
			break;
113
			break;
110
      }
114
      }
111
	}
115
	}
Line 133... Line 137...
133
 
137
 
134
	if (col==col_max) {
138
	if (col==col_max) {
135
		row++;
139
		row++;
136
		col=0;
140
		col=0;
-
 
141
	}
-
 
142
 
-
 
143
	//do not show items located in /kolibrios/ if this directory not mounted
-
 
144
	if (strncmp(key_value, "/kolibrios/", 11)==0) && (!kolibrios_mounted) return 1;
137
	}
145
 
138
	if (col==0) DrawBar(0, row * cell_h + list_pos, Form.cwidth, cell_h, LIST_BACKGROUND_COLOR);
146
	if (col==0) DrawBar(0, row * cell_h + list_pos, Form.cwidth, cell_h, LIST_BACKGROUND_COLOR);
139
	DefineButton(col*cell_w+6,row*cell_h + list_pos,cell_w,cell_h-5,current_item_id + 100 + BT_HIDE,0);
147
	DefineButton(col*cell_w+6,row*cell_h + list_pos,cell_w,cell_h-5,current_item_id + 100 + BT_HIDE,0);
Line 140... Line 148...
140
	tmp = cell_w/2;
148
	tmp = cell_w/2;
Line 148... Line 156...
148
	col++;
156
	col++;
149
	return 1;
157
	return 1;
150
}
158
}
Line 151... Line 159...
151
 
159
 
152
 
160
 
153
byte draw_section(dword sec_name, f_name)
161
byte process_sections(dword sec_name, f_name)
Line 154... Line 162...
154
{
162
{
155
	if (strcmp(sec_name, "Config")==0) return 1;
163
	if (strcmp(sec_name, "Config")==0) return 1;
156
 
164
 
157
	if (item_id_need_to_run!=-1)
165
	if (item_id_need_to_run!=-1)
158
	{
166
	{
159
		ini_enum_keys stdcall (f_name, sec_name, #search_for_id_need_to_run);
167
		ini_enum_keys stdcall (f_name, sec_name, #search_for_id_need_to_run);
-
 
168
	}
-
 
169
	else
-
 
170
	{
-
 
171
		if ((col==0) && (row==old_row)) 
-
 
172
		{
-
 
173
			list_pos -= 20;
160
	}
174
		}
-
 
175
		else
161
	else
176
		{
-
 
177
			row++;
162
	{
178
		}
163
		row++;
179
		col = 0;
164
		col = 0;
180
		old_row = row;
165
		DrawBar(0, row * cell_h + list_pos, Form.cwidth , 20, LIST_BACKGROUND_COLOR);
181
		DrawBar(0, row * cell_h + list_pos, Form.cwidth , 20, LIST_BACKGROUND_COLOR);
166
		WriteTextB(10, row * cell_h + 9 + list_pos, 0x90, 0x000000, sec_name);
182
		WriteTextB(10, row * cell_h + 9 + list_pos, 0x90, 0x000000, sec_name);