Rev 4049 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4049 | Rev 4057 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | //Leency 2013 |
1 | //Leency 2013 |
Line 2... | Line 2... | ||
2 | 2 | ||
3 | llist app_list; |
3 | llist app_list; |
4 | struct app_list_string { char item[1024]; char icon; }; |
4 | struct app_list_string { char item[1024]; char ext[5]; }; |
Line 5... | Line 5... | ||
5 | app_list_string app_paths[100]; |
5 | app_list_string app_paths[100]; |
6 | 6 | ||
7 | int GetListOfPrograms() |
7 | int GetListOfPrograms() |
8 | { |
8 | { |
9 | byte section[32], parametr[32], option[256], InfType=0; |
9 | byte section[32], parametr[32], option[256], InfType=0; |
10 | char bukva[2]; |
10 | char bukva[2]; |
Line 11... | Line -... | ||
11 | int tj, ti; |
- | |
12 | static dword buff, fsize; |
- | |
13 | 11 | int tj, ti; |
|
14 | debug("GetListOfPrograms()"); |
12 | static dword buff, fsize; |
15 | 13 | ||
16 | free(buff); |
14 | free(buff); |
17 | if (!GetFile(#buff, #fsize, abspath("Eolite.ini"))) |
15 | if (!GetFile(#buff, #fsize, abspath("Eolite.ini"))) |
Line 29... | Line 27... | ||
29 | case '[': InfType=SECTION; section=NULL; break; |
27 | case '[': InfType=SECTION; section=NULL; break; |
30 | case ']': InfType=PARAM; break; |
28 | case ']': InfType=PARAM; break; |
31 | case '=': InfType=OPTION; break; |
29 | case '=': InfType=OPTION; break; |
32 | case 0x0a: |
30 | case 0x0a: |
33 | case 0x0d: |
31 | case 0x0d: |
34 | InfType=PARAM; |
- | |
35 | if (!strcmp(#section,"Associations")) && (option) |
32 | if (!strcmp(#section,"Associations")) && (option) && (InfType!=COMMENT) |
36 | { |
33 | { |
37 | for (ti=0; ti |
34 | for (ti=0; ti |
38 | { |
35 | { |
39 | if (strcmp(#app_paths[ti].item, #option)==0) GOTO _OUT; |
36 | if (strcmp(#app_paths[ti].item, #option)==0) goto _OUT; |
40 | } |
37 | } |
41 | // for (i=0; ext[i]!=0; i+=2;) if (!strcmp(extension, ext[i])) { icon_n = ext[i+1]; break; } |
38 | if (kolibrios_drive==false) && (strstr(#option,"kolibrios/")!=0) goto _OUT; |
42 | strcpy(#app_paths[app_list.count].item, #option); |
39 | strcpy(#app_paths[app_list.count].item, #option); |
- | 40 | if (strlen(#parametr)<=5) && (parametr[0]) strcpy(#app_paths[app_list.count].ext, #parametr); |
|
- | 41 | else strcpy(#app_paths[app_list.count].ext, "kex"); |
|
43 | app_list.count++; |
42 | app_list.count++; |
44 | } |
43 | } |
45 | _OUT: |
44 | _OUT: |
- | 45 | InfType=PARAM; |
|
46 | parametr=option=NULL; |
46 | parametr=option=NULL; |
47 | break; |
47 | break; |
48 | default: |
48 | default: |
49 | IF (InfType==SECTION) chrcat(#section, bukva); |
49 | IF (InfType==SECTION) chrcat(#section, bukva); |
50 | IF (InfType==PARAM) chrcat(#parametr, bukva); |
50 | IF (InfType==PARAM) chrcat(#parametr, bukva); |
Line 59... | Line 59... | ||
59 | { |
59 | { |
60 | #define WIN_W 290 |
60 | #define WIN_W 290 |
61 | #define OPEN_LIST_VISIBLE_N 12 |
61 | #define OPEN_LIST_VISIBLE_N 12 |
62 | #define OPEN_LIST_LINE_H 20 |
62 | #define OPEN_LIST_LINE_H 20 |
63 | #define PANEL_H 40 |
63 | #define PANEL_H 40 |
64 | #define PADDING 8; |
64 | #define PADDING 8 |
65 | int WIN_H; |
65 | int WIN_H; |
66 | mouse mm; |
66 | mouse mm; |
67 | word key, slot; |
67 | word key, slot; |
68 | proc_info MenuForm; |
68 | proc_info MenuForm; |
Line 91... | Line 91... | ||
91 | if (app_list.current_temp != app_list.current) |
91 | if (app_list.current_temp != app_list.current) |
92 | { |
92 | { |
93 | app_list.current = app_list.current_temp; |
93 | app_list.current = app_list.current_temp; |
94 | DrawAppList(); |
94 | DrawAppList(); |
95 | } |
95 | } |
- | 96 | if (mm.lkm) |
|
- | 97 | { |
|
- | 98 | RunProgram(#app_paths[app_list.current].item, #file_path); |
|
- | 99 | ExitProcess(); |
|
- | 100 | } |
|
96 | } |
101 | } |
Line 97... | Line 102... | ||
97 | 102 | ||
Line 98... | Line 103... | ||
98 | break; |
103 | break; |
99 | 104 | ||
100 | case evKey: |
105 | case evKey: |
- | 106 | key = GetKey(); |
|
- | 107 | if (key==27) ExitProcess(); |
|
101 | key = GetKey(); |
108 | if (key==13) { RunProgram(#app_paths[app_list.current].item, #file_path); ExitProcess(); } |
- | 109 | if (key==177) //down |
|
102 | if (key==27) ExitProcess(); |
110 | { |
103 | break; |
111 | if (app_list.KeyDown()) DrawAppList(); |
- | 112 | } |
|
104 | 113 | if (key==178) //up |
|
105 | case evButton: |
114 | { |
106 | RunProgram(#app_paths[GetButtonID()-10].item, #file_path); |
115 | if (app_list.KeyUp()) DrawAppList(); |
Line 107... | Line 116... | ||
107 | ExitProcess(); |
116 | } |
108 | break; |
117 | break; |
109 | 118 | ||
110 | case evReDraw: _APP_LIST_DRAW: |
119 | case evReDraw: _APP_LIST_DRAW: |
111 | WIN_H = app_list.h+PANEL_H+PADDING+2; |
120 | WIN_H = app_list.h+PANEL_H+PADDING+2; |
112 | DefineAndDrawWindow(files.w-WIN_W/2+files.x+Form.left+6, |
121 | DefineAndDrawWindow(files.w-WIN_W/2+files.x+Form.left+6, |
113 | files.h-WIN_H/2+files.y+Form.top+GetSkinHeight(),WIN_W+1,WIN_H,0x01, 0, 0, 0x01fffFFF); |
122 | files.h-WIN_H/2+files.y+Form.top+GetSkinHeight(),WIN_W+1,WIN_H,0x01, 0, 0, 0x01fffFFF); |
Line 114... | Line 123... | ||
114 | GetProcessInfo(#MenuForm, SelfInfo); |
123 | GetProcessInfo(#MenuForm, SelfInfo); |
115 | DrawPopup(0,0,MenuForm.width-2,MenuForm.height-2,0, col_work, col_border); |
124 | DrawPopup(0,0,MenuForm.width-2,MenuForm.height-2,0, col_work, col_border); |
116 | DrawRectangle(app_list.x-1, app_list.y-2, app_list.w+1, app_list.h+2, col_border); |
125 | DrawRectangle(app_list.x-1, app_list.y-2, app_list.w+1, app_list.h+2, col_border); |
Line 117... | Line 126... | ||
117 | 126 | ||
118 | Put_icon(#file_name+_strrchr(#file_name,'.'), 10, 13, col_work); |
127 | Put_icon(#file_name+_strrchr(#file_name,'.'), 10, 13, col_work, 0); |
119 | WriteText(35,10, 0x80, 0, T_SELECT_APP_TO_OPEN_WITH); |
128 | WriteText(35,10, 0x80, 0, T_SELECT_APP_TO_OPEN_WITH); |
Line 120... | Line 129... | ||
120 | WriteText(35,23, 0x80, 0, #file_name); |
129 | WriteText(35,23, 0x80, 0, #file_name); |
121 | 130 | ||
- | 131 | DrawAppList(); |
|
- | 132 | } |
|
122 | DrawAppList(); |
133 | } |
123 | } |
134 | |
124 | } |
135 | void DrawAppList() |
125 | - | ||
126 | void DrawAppList() |
136 | { |
127 | { |
137 | #define SCROLL_WIDTH 5 |
128 | dword index, col_bg; |
138 | llist tiny_scroll; |
129 | for (index = 0; (index |
139 | dword index, col_bg; |
130 | { |
140 | for (index = 0; (index |
- | 141 | { |
|
- | 142 | if (index+app_list.first==app_list.current) col_bg = col_selec; else col_bg = 0xFFFfff; |
|
- | 143 | DrawBar(app_list.x, index*app_list.line_h+app_list.y, app_list.w, app_list.line_h, col_bg); |
|
- | 144 | Put_icon(#app_paths[index+app_list.first].ext, app_list.x+4, index*app_list.line_h+app_list.y+2, col_bg, 6); |
|
- | 145 | WriteText(app_list.x+25, index*app_list.line_h+app_list.y+7, 0x80, 0, #app_paths[index+app_list.first].item); |
|
131 | DefineButton(app_list.x, index*app_list.line_h+app_list.y, app_list.w, app_list.line_h-1, index+app_list.first+10+BT_HIDE+BT_NOFRAME, 0); |
146 | } |
132 | if (index+app_list.first==app_list.current) col_bg = col_selec; else col_bg = 0xFFFfff; |
147 | tiny_scroll.h = app_list.w*app_list.visible/app_list.count; |