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