Rev 5465 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5465 | Rev 5775 | ||
---|---|---|---|
1 | char open_assoc_ini_path[] = "/sys/settings/assoc.ini"; |
1 | char open_assoc_ini_path[] = "/sys/settings/assoc.ini"; |
2 | word program_path_len; |
2 | word program_path_len; |
3 | 3 | ||
4 | 4 | ||
5 | void CheckDefaultForTheFirstStart() |
5 | void CheckDefaultForTheFirstStart() |
6 | { |
6 | { |
7 | ini_get_int stdcall (#open_assoc_ini_path, "Pixie", "icon", -1); |
7 | ini_get_int stdcall (#open_assoc_ini_path, "Pixie", "icon", -1); |
8 | if (EAX!=-1) return; |
8 | if (EAX!=-1) return; |
9 | 9 | ||
10 | CreateThread(#ShowPopUp,#menu_stak+4092); |
10 | CreateThread(#ShowPopUp,#menu_stak+4092); |
11 | } |
11 | } |
12 | 12 | ||
13 | 13 | ||
14 | void ShowPopUp() |
14 | void ShowPopUp() |
15 | { |
15 | { |
16 | byte button_id, key; |
16 | byte button_id, key; |
17 | proc_info pop_up; |
17 | proc_info pop_up; |
18 | 18 | ||
19 | ini_set_int stdcall (#open_assoc_ini_path, "Pixie", "icon", 65); |
19 | ini_set_int stdcall (#open_assoc_ini_path, "Pixie", "icon", 65); |
20 | program_path_len = strlen(#program_path); |
20 | program_path_len = strlen(#program_path); |
21 | ini_set_str stdcall (#open_assoc_ini_path, "Pixie", "exec", #program_path, program_path_len); |
21 | ini_set_str stdcall (#open_assoc_ini_path, "Pixie", "exec", #program_path, program_path_len); |
22 | 22 | ||
23 | loop() switch(WaitEvent()) |
23 | loop() switch(WaitEvent()) |
24 | { |
24 | { |
25 | case evButton: |
25 | case evButton: |
26 | button_id = GetButtonID(); |
26 | button_id = GetButtonID(); |
27 | if (button_id==10) SetDefaultPlayer(); |
27 | if (button_id==10) SetDefaultPlayer(); |
28 | if (button_id==11) ExitProcess(); |
28 | if (button_id==11) ExitProcess(); |
29 | break; |
29 | break; |
30 | case evKey: |
30 | case evKey: |
31 | key = GetKey(); |
31 | key = GetKey(); |
32 | if (key==ASCII_KEY_ENTER) SetDefaultPlayer(); |
32 | if (key==ASCII_KEY_ENTER) SetDefaultPlayer(); |
33 | if (key==ASCII_KEY_ESC) ExitProcess(); |
33 | if (key==ASCII_KEY_ESC) ExitProcess(); |
34 | break; |
34 | break; |
35 | case evReDraw: |
35 | case evReDraw: |
36 | DefineAndDrawWindow(150, 200, 220, 90, 0x01,0,0,0); |
36 | DefineAndDrawWindow(150, 200, 220, 90, 0x01,0,0,0); |
37 | GetProcessInfo(#pop_up, SelfInfo); |
37 | GetProcessInfo(#pop_up, SelfInfo); |
38 | DrawBar(0, 0, pop_up.width, pop_up.height, theme.color_list_bg); |
38 | DrawBar(0, 0, pop_up.width, pop_up.height, theme.color_list_bg); |
39 | DrawRectangle(0, 0, pop_up.width, pop_up.height, theme.color_list_border); |
39 | DrawRectangle(0, 0, pop_up.width, pop_up.height, theme.color_list_border); |
40 | WriteText(10, 20, 0x80, theme.color_list_text, "Pixie is not a default MP3 player."); |
40 | WriteText(10, 20, 0x80, theme.color_list_text, "Hey! Pixie is not a default"); |
41 | WriteText(10, 32, 0x80, theme.color_list_text, "Make it default?"); |
41 | WriteText(10, 32, 0x80, theme.color_list_text, "MP3 player. Make it default?"); |
42 | DrawCaptButton(10, pop_up.height - 30, 80, 20, 10, theme.color_list_active_bg, theme.color_list_active_text, "Yes"); |
42 | DrawCaptButton(10, pop_up.height - 30, 80, 20, 10, theme.color_list_active_bg, theme.color_list_active_text, "Yes"); |
43 | DrawCaptButton(pop_up.width-10-80, pop_up.height - 30, 80, 20, 11, theme.color_list_active_bg, theme.color_list_active_text, "No"); |
43 | DrawCaptButton(pop_up.width-10-80, pop_up.height - 30, 80, 20, 11, theme.color_list_active_bg, theme.color_list_active_text, "No"); |
44 | } |
44 | } |
45 | } |
45 | } |
46 | 46 | ||
47 | void SetDefaultPlayer() |
47 | void SetDefaultPlayer() |
48 | { |
48 | { |
49 | ini_set_str stdcall (#open_assoc_ini_path, "Assoc", "mp3", "$Pixie", 6); |
49 | ini_set_str stdcall (#open_assoc_ini_path, "Assoc", "mp3", "$Pixie", 6); |
50 | ini_set_str stdcall ("/sys/File namagers/KFAR.ini", "Associations", "mp3", #program_path, program_path_len); |
50 | ini_set_str stdcall ("/sys/File namagers/KFAR.ini", "Associations", "mp3", #program_path, program_path_len); |
51 | ExitProcess(); |
51 | ExitProcess(); |
52 | } |
52 | } |