Rev 5465 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5465 | leency | 1 | char open_assoc_ini_path[] = "/sys/settings/assoc.ini"; |
2 | word program_path_len; |
||
3 | |||
4 | |||
5 | void CheckDefaultForTheFirstStart() |
||
6 | { |
||
7 | ini_get_int stdcall (#open_assoc_ini_path, "Pixie", "icon", -1); |
||
8 | if (EAX!=-1) return; |
||
9 | |||
10 | CreateThread(#ShowPopUp,#menu_stak+4092); |
||
11 | } |
||
12 | |||
13 | |||
14 | void ShowPopUp() |
||
15 | { |
||
16 | byte button_id, key; |
||
17 | proc_info pop_up; |
||
18 | |||
19 | ini_set_int stdcall (#open_assoc_ini_path, "Pixie", "icon", 65); |
||
20 | program_path_len = strlen(#program_path); |
||
21 | ini_set_str stdcall (#open_assoc_ini_path, "Pixie", "exec", #program_path, program_path_len); |
||
22 | |||
23 | loop() switch(WaitEvent()) |
||
24 | { |
||
25 | case evButton: |
||
26 | button_id = GetButtonID(); |
||
27 | if (button_id==10) SetDefaultPlayer(); |
||
28 | if (button_id==11) ExitProcess(); |
||
29 | break; |
||
30 | case evKey: |
||
31 | key = GetKey(); |
||
32 | if (key==ASCII_KEY_ENTER) SetDefaultPlayer(); |
||
33 | if (key==ASCII_KEY_ESC) ExitProcess(); |
||
34 | break; |
||
35 | case evReDraw: |
||
36 | DefineAndDrawWindow(150, 200, 220, 90, 0x01,0,0,0); |
||
37 | GetProcessInfo(#pop_up, SelfInfo); |
||
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); |
||
5775 | leency | 40 | WriteText(10, 20, 0x80, theme.color_list_text, "Hey! Pixie is not a default"); |
41 | WriteText(10, 32, 0x80, theme.color_list_text, "MP3 player. Make it default?"); |
||
5465 | leency | 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"); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | void SetDefaultPlayer() |
||
48 | { |
||
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); |
||
51 | ExitProcess(); |
||
52 | } |