Rev 9602 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9602 | Rev 9689 | ||
---|---|---|---|
- | 1 | bool KolibriosMounted() |
|
- | 2 | { |
|
- | 3 | static bool kolibrios_mounted; |
|
- | 4 | if (kolibrios_mounted) return true; |
|
- | 5 | kolibrios_mounted = real_dir_exists("/kolibrios"); |
|
- | 6 | return kolibrios_mounted; |
|
- | 7 | } |
|
1 | struct _SystemDiscs |
8 | |
2 | { |
9 | struct _SystemDiscs |
3 | collection list; |
10 | { |
4 | int dev_num; |
11 | collection list; |
5 | void Get(); |
12 | int dev_num; |
6 | void Draw(); |
13 | void Get(); |
7 | void DrawSelect(); |
14 | void Draw(); |
8 | void DrawOptions(); |
15 | void DrawSelect(); |
9 | } SystemDiscs=0; |
16 | void DrawOptions(); |
10 | 17 | } SystemDiscs=0; |
|
11 | void _SystemDiscs::Get() |
18 | |
12 | { |
19 | void _SystemDiscs::Get() |
13 | char dev_name[10], sys_discs[10]; |
20 | { |
14 | int i1, j1, dev_disc_num, real_dev_num; |
21 | char dev_name[10], sys_discs[10]; |
15 | dword devbuf, diskbuf; |
22 | int i1, j1, dev_disc_num, real_dev_num; |
16 | 23 | dword devbuf, diskbuf; |
|
17 | list.drop(); |
24 | |
18 | devbuf = malloc(10000); |
25 | list.drop(); |
19 | ReadDir(19, devbuf, "/"); |
26 | devbuf = malloc(10000); |
20 | dev_num = real_dev_num = EBX; |
27 | ReadDir(19, devbuf, "/"); |
21 | 28 | dev_num = real_dev_num = EBX; |
|
22 | list.add("/sys"); |
29 | |
23 | dev_num++; |
30 | list.add("/sys"); |
24 | 31 | dev_num++; |
|
25 | if (dir_exists("/kolibrios")) { |
32 | |
26 | //need to check that /sys != /kolibrios |
33 | if (KolibriosMounted()) { |
27 | list.add("/kolibrios"); |
34 | //need to check that /sys != /kolibrios |
28 | dev_num++; |
35 | list.add("/kolibrios"); |
29 | } |
36 | dev_num++; |
30 | 37 | } |
|
31 | for (i1=0; i1 |
38 | |
32 | { |
39 | for (i1=0; i1 |
33 | sprintf(#dev_name,"/%s",i1*304+ devbuf+72); |
40 | { |
34 | GetDir(#diskbuf, #dev_disc_num, #dev_name, DIRS_NOROOT); |
41 | sprintf(#dev_name,"/%s",i1*304+ devbuf+72); |
35 | if (!EAX) for (j1=0; j1 |
42 | GetDir(#diskbuf, #dev_disc_num, #dev_name, DIRS_NOROOT); |
36 | { |
43 | if (!EAX) for (j1=0; j1 |
37 | sprintf(#sys_discs,"%s/%s",#dev_name,j1*304+ diskbuf+72); |
44 | { |
38 | if (sys_discs[1]=='r') { |
45 | sprintf(#sys_discs,"%s/%s",#dev_name,j1*304+ diskbuf+72); |
39 | dev_num--; |
46 | if (sys_discs[1]=='r') { |
40 | continue; |
47 | dev_num--; |
41 | } |
48 | continue; |
42 | if (sys_discs[1]=='c') || (sys_discs[1]=='f') || (dir_exists(#sys_discs)) { |
49 | } |
43 | list.add(#sys_discs); |
50 | if (sys_discs[1]=='c') || (sys_discs[1]=='f') || (dir_exists(#sys_discs)) { |
44 | } |
51 | list.add(#sys_discs); |
45 | } |
52 | } |
46 | } |
53 | } |
47 | free(devbuf); |
54 | } |
48 | free(diskbuf); |
55 | free(devbuf); |
49 | } |
56 | free(diskbuf); |
50 | 57 | } |
|
51 | void GetDiskIconAndName(dword dev_name, icon, disc_name) |
58 | |
52 | { |
59 | void GetDiskIconAndName(dword dev_name, icon, disc_name) |
53 | int i; |
60 | { |
54 | dword volume_label; |
61 | int i; |
55 | for (i=0; devinfo[i]!=0; i+=3) { |
62 | dword volume_label; |
56 | if (!strncmp(dev_name+1, devinfo[i], 2)) { |
63 | for (i=0; devinfo[i]!=0; i+=3) { |
57 | ESBYTE[icon] = devinfo[i+1]; |
64 | if (!strncmp(dev_name+1, devinfo[i], 2)) { |
58 | if (ESBYTE[icon]==4) |
65 | ESBYTE[icon] = devinfo[i+1]; |
59 | { |
66 | if (ESBYTE[icon]==4) |
60 | //show label only for hard disk drives |
67 | { |
61 | volume_label = GetVolumeLabel(dev_name); |
68 | //show label only for hard disk drives |
62 | if (ESBYTE[volume_label]) { |
69 | volume_label = GetVolumeLabel(dev_name); |
63 | strncpy(disc_name, volume_label, 15); |
70 | if (ESBYTE[volume_label]) { |
64 | chrcat(disc_name, ' '); |
71 | strncpy(disc_name, volume_label, 15); |
65 | return; |
72 | chrcat(disc_name, ' '); |
66 | } |
73 | return; |
67 | } |
74 | } |
68 | strcpy(disc_name, devinfo[i+2]); |
75 | } |
69 | return; |
76 | strcpy(disc_name, devinfo[i+2]); |
70 | } |
77 | return; |
71 | } |
78 | } |
72 | ESBYTE[icon]=4; |
79 | } |
73 | strcpy(disc_name, T_UNC); |
80 | ESBYTE[icon]=4; |
74 | } |
81 | strcpy(disc_name, T_UNC); |
75 | 82 | } |
|
76 | void _SystemDiscs::Draw() |
83 | |
77 | { |
84 | void _SystemDiscs::Draw() |
78 | char dev_name[15], disc_name[100], i, dev_icon; |
85 | { |
79 | bool is_active=0; |
86 | char dev_name[15], disc_name[100], i, dev_icon; |
80 | int draw_y, draw_x; |
87 | bool is_active=0; |
81 | 88 | int draw_y, draw_x; |
|
82 | if (efm) { |
89 | |
83 | DrawSelect(2, KFM_DEV_DROPDOWN_1, location[0]); |
90 | if (efm) { |
84 | DrawSelect(Form.cwidth/2, KFM_DEV_DROPDOWN_2, location[sizeof(dword)]); |
91 | DrawSelect(2, KFM_DEV_DROPDOWN_1, location[0]); |
85 | files.y = 40 + 17; |
92 | DrawSelect(Form.cwidth/2, KFM_DEV_DROPDOWN_2, location[sizeof(dword)]); |
86 | } else { |
93 | files.y = 40 + 17; |
87 | Tip(56, T_DEVICES, 55, "="); |
94 | } else { |
88 | for (i=0; i<30; i++) DeleteButton(100+i); |
95 | Tip(56, T_DEVICES, 55, "="); |
89 | 96 | for (i=0; i<30; i++) DeleteButton(100+i); |
|
90 | draw_y = 74; |
97 | |
91 | draw_x = 17; |
98 | draw_y = 74; |
92 | for (i=0;i |
99 | draw_x = 17; |
93 | strcpy(#dev_name, list.get(i)); |
100 | for (i=0;i |
94 | GetDiskIconAndName(#dev_name, #dev_icon, #disc_name); |
101 | strcpy(#dev_name, list.get(i)); |
95 | if (strstr(path, #dev_name)==path) is_active=true; else is_active=false; |
102 | GetDiskIconAndName(#dev_name, #dev_icon, #disc_name); |
96 | 103 | if (strstr(path, #dev_name)==path) is_active=true; else is_active=false; |
|
97 | DrawBar(draw_x,draw_y,6,DEV_H+1,0xFFFFFF); |
104 | |
98 | DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF); |
105 | DrawBar(draw_x,draw_y,6,DEV_H+1,0xFFFFFF); |
99 | DefineHiddenButton(draw_x,draw_y,159,16,100+i); |
106 | DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF); |
100 | if (show_dev_name.checked) |
107 | DefineHiddenButton(draw_x,draw_y,159,16,100+i); |
101 | { |
108 | if (show_dev_name.checked) |
102 | strcat(#disc_name, #dev_name); |
109 | { |
103 | if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name); |
110 | strcat(#disc_name, #dev_name); |
104 | WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name); |
111 | if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name); |
105 | //if (is_active) kfont.bold = true; |
112 | WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name); |
106 | //kfont.WriteIntoWindow(draw_x + 29, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #disc_name); |
113 | //if (is_active) kfont.bold = true; |
107 | //kfont.bold = false; |
114 | //kfont.WriteIntoWindow(draw_x + 29, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #disc_name); |
108 | } else { |
115 | //kfont.bold = false; |
109 | if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name); |
116 | } else { |
110 | WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name); |
117 | if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name); |
111 | } |
118 | WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name); |
112 | PutImage(draw_x+6,draw_y, 18,17, is_active*7+dev_icon*17*18*3+#devices); |
119 | } |
113 | draw_y += DEV_H; |
120 | PutImage(draw_x+6,draw_y, 18,17, is_active*7+dev_icon*17*18*3+#devices); |
114 | } |
121 | draw_y += DEV_H; |
115 | DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff); |
122 | } |
116 | ActionsDraw(list.count*DEV_H+108); |
123 | DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff); |
117 | DrawLeftPanelBg(list.count*DEV_H); |
124 | ActionsDraw(list.count*DEV_H+108); |
118 | } |
125 | DrawLeftPanelBg(list.count*DEV_H); |
119 | } |
126 | } |
120 | 127 | } |
|
121 | void _SystemDiscs::DrawSelect(int draw_x, btid, dword _path) |
128 | |
122 | { |
129 | void _SystemDiscs::DrawSelect(int draw_x, btid, dword _path) |
123 | char dev_name[15], disc_name[100], i, dev_icon; |
130 | { |
124 | 131 | char dev_name[15], disc_name[100], i, dev_icon; |
|
125 | if (ESBYTE[_path+1]=='\0') { |
132 | |
126 | strcpy(#dev_name, "/root"); |
133 | if (ESBYTE[_path+1]=='\0') { |
127 | dev_icon = 0; |
134 | strcpy(#dev_name, "/root"); |
128 | } else if (chrnum(_path, '/')==1) { |
135 | dev_icon = 0; |
129 | strcpy(#dev_name, _path); |
136 | } else if (chrnum(_path, '/')==1) { |
130 | GetDiskIconAndName(#dev_name, #dev_icon, #disc_name); |
137 | strcpy(#dev_name, _path); |
131 | } else for (i=0;i |
138 | GetDiskIconAndName(#dev_name, #dev_icon, #disc_name); |
132 | strcpy(#dev_name, list.get(i)); |
139 | } else for (i=0;i |
133 | GetDiskIconAndName(#dev_name, #dev_icon, #disc_name); |
140 | strcpy(#dev_name, list.get(i)); |
134 | if (strstr(_path, #dev_name)-_path==0) break; |
141 | GetDiskIconAndName(#dev_name, #dev_icon, #disc_name); |
135 | } |
142 | if (strstr(_path, #dev_name)-_path==0) break; |
136 | DrawRectangle(draw_x-1, SELECTY-1, DDW+2-KFM2_DEVH, KFM2_DEVH+1, sc.line); |
143 | } |
137 | DrawBar(draw_x, SELECTY, DDW+1-KFM2_DEVH, KFM2_DEVH, 0xFFFFFF); |
144 | DrawRectangle(draw_x-1, SELECTY-1, DDW+2-KFM2_DEVH, KFM2_DEVH+1, sc.line); |
138 | PutImage(draw_x + 5, SELECTY+2, 18,17, dev_icon*17*18*3+#devices); |
145 | DrawBar(draw_x, SELECTY, DDW+1-KFM2_DEVH, KFM2_DEVH, 0xFFFFFF); |
139 | kfont.WriteIntoWindow(draw_x + 24, math.max(KFM2_DEVH-kfont.height/2+SELECTY,0), 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1); |
146 | PutImage(draw_x + 5, SELECTY+2, 18,17, dev_icon*17*18*3+#devices); |
140 | DefineHiddenButton(draw_x, SELECTY, DDW-1, KFM2_DEVH-1, btid); |
147 | kfont.WriteIntoWindow(draw_x + 24, math.max(KFM2_DEVH-kfont.height/2+SELECTY,0), 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1); |
141 | DrawFlatButtonSmall(draw_x+DDW-KFM2_DEVH+1, SELECTY-1, KFM2_DEVH-1, KFM2_DEVH+1, NULL, "\x19"); |
148 | DefineHiddenButton(draw_x, SELECTY, DDW-1, KFM2_DEVH-1, btid); |
142 | } |
149 | DrawFlatButtonSmall(draw_x+DDW-KFM2_DEVH+1, SELECTY-1, KFM2_DEVH-1, KFM2_DEVH+1, NULL, "\x19"); |
143 | 150 | } |
|
144 | void _SystemDiscs::DrawOptions(int draw_x) |
151 | |
145 | { |
152 | void _SystemDiscs::DrawOptions(int draw_x) |
146 | int optionsy = SELECTY+KFM2_DEVH+1; |
153 | { |
147 | char dev_name[15], disc_name[100], volume_label[64], label_file_name[100]; |
154 | int optionsy = SELECTY+KFM2_DEVH+1; |
148 | char i, dev_icon, is_active=0; |
155 | char dev_name[15], disc_name[100], volume_label[64], label_file_name[100]; |
149 | 156 | char i, dev_icon, is_active=0; |
|
150 | SystemDiscs.Get(); |
157 | |
151 | 158 | SystemDiscs.Get(); |
|
152 | DrawPopup(draw_x, optionsy, DDW, list.count*KFM2_DEVH, 1, -1, sc.line); |
159 | |
153 | 160 | DrawPopup(draw_x, optionsy, DDW, list.count*KFM2_DEVH, 1, -1, sc.line); |
|
154 | for (i=0;i |
161 | |
155 | strcpy(#dev_name, list.get(i)); |
162 | for (i=0;i |
156 | GetDiskIconAndName(#dev_name, #dev_icon, #disc_name); |
163 | strcpy(#dev_name, list.get(i)); |
157 | if (strstr(path, #dev_name)!=0) is_active=true; else is_active=false; |
164 | GetDiskIconAndName(#dev_name, #dev_icon, #disc_name); |
158 | 165 | if (strstr(path, #dev_name)!=0) is_active=true; else is_active=false; |
|
159 | DrawBar(draw_x, optionsy, DDW, KFM2_DEVH, 0xFFFFFF); |
166 | |
160 | DefineButton(draw_x, optionsy, DDW, KFM2_DEVH-1, 100+i+BT_HIDE,0xFFFFFF); |
167 | DrawBar(draw_x, optionsy, DDW, KFM2_DEVH, 0xFFFFFF); |
161 | PutImage(draw_x + 5, optionsy+2, 18,17, is_active*7+dev_icon*17*18*3+#devices); |
168 | DefineButton(draw_x, optionsy, DDW, KFM2_DEVH-1, 100+i+BT_HIDE,0xFFFFFF); |
162 | if (is_active) kfont.bold = true; |
169 | PutImage(draw_x + 5, optionsy+2, 18,17, is_active*7+dev_icon*17*18*3+#devices); |
163 | //strncpy(#volume_label, GetVolumeLabel(#dev_name), sizeof(volume_label)); |
170 | if (is_active) kfont.bold = true; |
164 | strcpy(#label_file_name, #dev_name); |
171 | //strncpy(#volume_label, GetVolumeLabel(#dev_name), sizeof(volume_label)); |
165 | //if (dev_name[1]!='k') && (dev_name[2]!='y') { |
172 | strcpy(#label_file_name, #dev_name); |
166 | // if (volume_label) sprintf(#label_file_name, "%s [%s]", #dev_name, #volume_label); |
173 | //if (dev_name[1]!='k') && (dev_name[2]!='y') { |
167 | //} |
174 | // if (volume_label) sprintf(#label_file_name, "%s [%s]", #dev_name, #volume_label); |
168 | kfont.WriteIntoWindow(draw_x + 24, optionsy+2, 0xFFFfff, 0x000000, kfont.size.pt, #label_file_name+1); |
175 | //} |
169 | kfont.bold = false; |
176 | kfont.WriteIntoWindow(draw_x + 24, optionsy+2, 0xFFFfff, 0x000000, kfont.size.pt, #label_file_name+1); |
170 | optionsy += KFM2_DEVH; |
177 | kfont.bold = false; |
171 | } |
178 | optionsy += KFM2_DEVH; |
172 | }30;> |
179 | } |
- | 180 | }30;> |