Rev 5403 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5403 | Rev 5404 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | SOFTWARE CENTER v2.0 |
2 | SOFTWARE CENTER v2.1 |
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 16... | Line 16... | ||
16 | 16 | ||
17 | system_colors sc; |
17 | system_colors sc; |
18 | proc_info Form; |
18 | proc_info Form; |
Line 19... | Line 19... | ||
19 | mouse m; |
19 | mouse m; |
Line 20... | Line 20... | ||
20 | 20 | ||
21 | int item_id_need_to_run, current_item_id; |
21 | int item_id_need_to_run=-1, current_item_id; |
Line 22... | Line 22... | ||
22 | 22 | ||
23 | int col_max, col_w=66, col_h=64, list_pos, list_top; |
23 | int col_max, cell_w, cell_h, list_pos, list_top; |
24 | int row, col; |
24 | int row, col; |
Line 57... | Line 57... | ||
57 | ini_get_str stdcall (#settings_ini_path, "Config", "window_title", #window_title, sizeof(window_title), "Software widget"); |
57 | ini_get_str stdcall (#settings_ini_path, "Config", "window_title", #window_title, sizeof(window_title), "Software widget"); |
58 | ini_get_int stdcall (#settings_ini_path, "Config", "window_width", 690); |
58 | ini_get_int stdcall (#settings_ini_path, "Config", "window_width", 690); |
59 | window_width = EAX; |
59 | window_width = EAX; |
60 | ini_get_int stdcall (#settings_ini_path, "Config", "window_height", 540); |
60 | ini_get_int stdcall (#settings_ini_path, "Config", "window_height", 540); |
61 | window_height = EAX; |
61 | window_height = EAX; |
- | 62 | ini_get_int stdcall (#settings_ini_path, "Config", "cell_w", 66); |
|
- | 63 | cell_w = EAX; |
|
- | 64 | ini_get_int stdcall (#settings_ini_path, "Config", "cell_h", 64); |
|
- | 65 | cell_h = EAX; |
|
62 | } |
66 | } |
Line 63... | Line 67... | ||
63 | 67 | ||
64 | 68 | ||
Line 85... | Line 89... | ||
85 | if (id>=100) |
89 | if (id>=100) |
86 | { |
90 | { |
87 | item_id_need_to_run = id - 100; |
91 | item_id_need_to_run = id - 100; |
88 | current_item_id = 0; |
92 | current_item_id = 0; |
89 | ini_enum_sections stdcall (#settings_ini_path, #draw_section); |
93 | ini_enum_sections stdcall (#settings_ini_path, #draw_section); |
90 | item_id_need_to_run = 0; |
94 | item_id_need_to_run = -1; |
91 | } |
95 | } |
92 | break; |
96 | break; |
Line 93... | Line 97... | ||
93 | 97 | ||
94 | case evReDraw: |
98 | case evReDraw: |
95 | sc.get(); |
99 | sc.get(); |
96 | DefineAndDrawWindow(GetScreenWidth()-window_width/2,GetScreenHeight()-window_height/2,window_width,window_height,0x74,sc.work," "); |
100 | DefineAndDrawWindow(GetScreenWidth()-window_width/2,GetScreenHeight()-window_height/2,window_width,window_height,0x74,sc.work," "); |
97 | GetProcessInfo(#Form, SelfInfo); |
101 | GetProcessInfo(#Form, SelfInfo); |
98 | if (Form.status_window>2) break; |
102 | if (Form.status_window>2) break; |
99 | col_max = Form.cwidth - 10 / col_w; |
103 | col_max = Form.cwidth - 10 / cell_w; |
100 | current_item_id = 0; |
104 | current_item_id = 0; |
101 | draw_top_bar(); |
105 | draw_top_bar(); |
102 | ini_enum_sections stdcall (#settings_ini_path, #draw_section); |
106 | ini_enum_sections stdcall (#settings_ini_path, #draw_section); |
103 | DrawBar(0, row + 1 * col_h + list_pos, Form.cwidth, -row - 1 * col_h - list_pos + Form.cheight, LIST_BACKGROUND_COLOR); |
107 | DrawBar(0, row + 1 * cell_h + list_pos, Form.cwidth, -row - 1 * cell_h - list_pos + Form.cheight, LIST_BACKGROUND_COLOR); |
104 | break; |
108 | break; |
105 | } |
109 | } |
106 | } |
110 | } |
Line 107... | Line 111... | ||
107 | } |
111 | } |
108 | 112 | ||
- | 113 | byte search_for_id_need_to_run(dword key_value, key_name, sec_name, f_name) |
|
109 | byte search_for_id_need_to_run(dword key_value, key_name, sec_name, f_name) |
114 | { |
110 | { |
115 | int icon_char_pos; |
- | 116 | if (item_id_need_to_run == current_item_id) |
|
111 | if (item_id_need_to_run == current_item_id) |
117 | { |
112 | { |
118 | icon_char_pos = strchr(key_value, ','); |
113 | ESBYTE[key_value + strchr(key_value, ',') - 1] = 0; //delete icon from string |
119 | if (icon_char_pos) ESBYTE[key_value + icon_char_pos - 1] = 0; //delete icon from string |
114 | RunProgram(key_value, ""); |
120 | RunProgram(key_value, ""); |
115 | } |
121 | } |
116 | current_item_id++; |
122 | current_item_id++; |
Line 125... | Line 131... | ||
125 | 131 | ||
126 | if (col==col_max) { |
132 | if (col==col_max) { |
127 | row++; |
133 | row++; |
128 | col=0; |
134 | col=0; |
129 | } |
135 | } |
130 | if (col==0) DrawBar(0, row * col_h + list_pos, Form.cwidth, col_h, LIST_BACKGROUND_COLOR); |
136 | if (col==0) DrawBar(0, row * cell_h + list_pos, Form.cwidth, cell_h, LIST_BACKGROUND_COLOR); |
131 | DefineButton(col*col_w+6,row*col_h + list_pos,col_w,col_h-5,current_item_id + 100 + BT_HIDE,0); |
137 | DefineButton(col*cell_w+6,row*cell_h + list_pos,cell_w,cell_h-5,current_item_id + 100 + BT_HIDE,0); |
132 | tmp = col_w/2; |
138 | tmp = cell_w/2; |
133 | icon_id = atoi(key_value + strchr(key_value, ',')); |
139 | icon_id = atoi(key_value + strchr(key_value, ',')); |
134 | img_draw stdcall(skin.image, col*col_w+tmp-10, row*col_h+5 + list_pos, 32, 32, 0, icon_id*32); |
140 | img_draw stdcall(skin.image, col*cell_w+tmp-10, row*cell_h+5 + list_pos, 32, 32, 0, icon_id*32); |
135 | WriteTextCenter(col*col_w+7,row*col_h+47 + list_pos,col_w,0xD4D4d4,key_name); |
141 | WriteTextCenter(col*cell_w+7,row*cell_h+47 + list_pos,cell_w,0xD4D4d4,key_name); |
136 | WriteTextCenter(col*col_w+6,row*col_h+46 + list_pos,col_w,0x000000,key_name); |
142 | WriteTextCenter(col*cell_w+6,row*cell_h+46 + list_pos,cell_w,0x000000,key_name); |
137 | current_item_id++; |
143 | current_item_id++; |
138 | col++; |
144 | col++; |
139 | return 1; |
145 | return 1; |
Line 140... | Line 146... | ||
140 | } |
146 | } |
141 | 147 | ||
142 | 148 | ||
Line 143... | Line 149... | ||
143 | byte draw_section(dword sec_name, f_name) |
149 | byte draw_section(dword sec_name, f_name) |
144 | { |
150 | { |
145 | if (strcmp(sec_name, "Config")==0) return 1; |
151 | if (strcmp(sec_name, "Config")==0) return 1; |
146 | 152 | ||
147 | if (item_id_need_to_run) |
153 | if (item_id_need_to_run!=-1) |
148 | { |
154 | { |
149 | ini_enum_keys stdcall (f_name, sec_name, #search_for_id_need_to_run); |
155 | ini_enum_keys stdcall (f_name, sec_name, #search_for_id_need_to_run); |
150 | } |
156 | } |
151 | else |
157 | else |
152 | { |
158 | { |
153 | row++; |
159 | row++; |
154 | col = 0; |
160 | col = 0; |
155 | DrawBar(0, row * col_h + list_pos, Form.cwidth , 20, LIST_BACKGROUND_COLOR); |
161 | DrawBar(0, row * cell_h + list_pos, Form.cwidth , 20, LIST_BACKGROUND_COLOR); |
156 | WriteTextB(10, row * col_h + 9 + list_pos, 0x90, 0x000000, sec_name); |
162 | WriteTextB(10, row * cell_h + 9 + list_pos, 0x90, 0x000000, sec_name); |
157 | list_pos += 20; |
163 | list_pos += 20; |