Rev 3655 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3655 | Rev 3866 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "..\lib\figures.h" |
1 | #include "..\lib\figures.h" |
2 | #include "..\lib\mem.h" |
2 | #include "..\lib\mem.h" |
3 | #include "..\lib\dll.h" |
3 | #include "..\lib\dll.h" |
- | 4 | #include "..\lib\lib.obj\box_lib.h" |
|
Line 4... | Line 5... | ||
4 | 5 | ||
5 | #ifdef LANG_RUS |
6 | #ifdef LANG_RUS |
6 | unsigned char *but_text[]={ |
7 | unsigned char *but_text[]={ |
7 | "®¡ ¢¨âì ¤¨áª [F2]", |
8 | "®¡ ¢¨âì ¤¨áª [F2]", |
Line 10... | Line 11... | ||
10 | 0}; |
11 | 0}; |
Line 11... | Line 12... | ||
11 | 12 | ||
12 | ?define INTRO_TEXT_1 "¤¥áì ¡ã¤¥â ®â®¡à ¦ âìáï ᯨ᮪" |
13 | ?define INTRO_TEXT_1 "¤¥áì ¡ã¤¥â ®â®¡à ¦ âìáï ᯨ᮪" |
13 | ?define INTRO_TEXT_2 "¢¨àâã «ìëå ¤¨áª®¢ ¢ á¨á⥬¥." |
14 | ?define INTRO_TEXT_2 "¢¨àâã «ìëå ¤¨áª®¢ ¢ á¨á⥬¥." |
- | 15 | ?define INTRO_TEXT_3 "®¯à®¡ã©â¥ ¤®¡ ¢¨âì ®¤¨..." |
|
Line 14... | Line 16... | ||
14 | ?define INTRO_TEXT_3 "®¯à®¡ã©â¥ ¤®¡ ¢¨âì ®¤¨..." |
16 | ?define INTRO_TEXT_4 " §¬¥à:" |
15 | 17 | ||
Line 16... | Line 18... | ||
16 | ?define NOTIFY_TEXT_NO_DISK "«ï ç « ¤®¡ ¢ì⥠å®âï ¡ë ®¤¨ ¤¨áª" |
18 | ?define NOTIFY_TEXT_NO_DISK "«ï ç « ¤®¡ ¢ì⥠å®âï ¡ë ®¤¨ ¤¨áª" |
Line 24... | Line 26... | ||
24 | 0}; |
26 | 0}; |
Line 25... | Line 27... | ||
25 | 27 | ||
26 | ?define INTRO_TEXT_1 " There will be list of mounted" |
28 | ?define INTRO_TEXT_1 " There will be list of mounted" |
27 | ?define INTRO_TEXT_2 " virtual disks." |
29 | ?define INTRO_TEXT_2 " virtual disks." |
- | 30 | ?define INTRO_TEXT_3 " Try to add one..." |
|
Line 28... | Line 31... | ||
28 | ?define INTRO_TEXT_3 " Try to add one..." |
31 | ?define INTRO_TEXT_4 " Size:" |
29 | 32 | ||
30 | ?define NOTIFY_TEXT_NO_DISK "You need to have at least one disk" |
33 | ?define NOTIFY_TEXT_NO_DISK "You need to have at least one disk" |
Line 39... | Line 42... | ||
39 | int selected; |
42 | int selected; |
Line 40... | Line 43... | ||
40 | 43 | ||
41 | system_colors sc; |
44 | system_colors sc; |
Line 42... | Line -... | ||
42 | proc_info Form; |
- | |
43 | 45 | proc_info Form; |
|
Line 44... | Line 46... | ||
44 | int mouse_dd; |
46 | |
45 | unsigned char dsize[30]; |
47 | unsigned char dsize[30]; |
46 | 48 | ||
Line 47... | Line 49... | ||
47 | unsigned char icons[14*56] = FROM "icons.raw"; |
49 | unsigned char icons[14*56] = FROM "icons.raw"; |
- | 50 | #define TOPPANELH 50 |
|
- | 51 | #define BOTPANELH 20 |
|
Line 48... | Line 52... | ||
48 | #define TOPPANELH 30 |
52 | |
49 | #define BOTPANELH 20 |
53 | int mouse_dd; |
50 | 54 | char disk_size[30]="\0"; |
|
51 | 55 | edit_box edit_disk_size= {60,48,5,0xffffff,0x94AECE,0x000000,0xffffff,0,sizeof(disk_size)+2,#disk_size,#mouse_dd, 1000000000000000b}; |
|
Line 52... | Line 56... | ||
52 | 56 | ||
- | 57 | void Main_Window() |
|
- | 58 | { |
|
- | 59 | unsigned int id, key, err; |
|
- | 60 | int i, x, fr; |
|
- | 61 | ||
- | 62 | mem_Init(); |
|
53 | void Main_Window() |
63 | if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading GUI library /sys/lib/boxlib.obj"); |
54 | { |
64 | fr = GetFreeRAM() / 5; |
55 | unsigned int id, key, err; |
65 | fr = itoa(fr / 2048); |
56 | int i, x; |
66 | strcat(#disk_size, fr); |
- | 67 | edit_disk_size.size = strlen(#disk_size); |
|
- | 68 | SetEventMask(0x27); |
|
- | 69 | loop() |
|
- | 70 | { |
|
- | 71 | switch(WaitEvent()) |
|
57 | 72 | { |
|
58 | mem_Init(); |
73 | case evMouse: |
59 | loop() |
74 | IF (GetProcessSlot(Form.ID)-GetActiveProcess()!=0) break; |
60 | { |
75 | edit_box_mouse stdcall (#edit_disk_size); |
61 | switch(WaitEvent()) |
76 | break; |
Line 114... | Line 129... | ||
114 | { |
129 | { |
115 | if (selected+4>disk_num) break; |
130 | if (selected+4>disk_num) break; |
116 | selected+=3; |
131 | selected+=3; |
117 | DrawTmpDisks(); |
132 | DrawTmpDisks(); |
118 | } |
133 | } |
- | 134 | EAX=key<<8; |
|
- | 135 | edit_box_key stdcall(#edit_disk_size); |
|
119 | break; |
136 | break; |
120 | case evReDraw: |
137 | case evReDraw: |
121 | sc.get(); |
138 | sc.get(); |
122 | DefineAndDrawWindow(170,150,314,250,0x74,sc.work,"Virtual Disk Manager 0.45",0); |
139 | DefineAndDrawWindow(170,150,314,270,0x74,sc.work,"Virtual Disk Manager 0.46",0); |
123 | GetProcessInfo(#Form, SelfInfo); |
140 | GetProcessInfo(#Form, SelfInfo); |
124 | if (Form.status_window>2) return; |
141 | if (Form.status_window>2) return; |
Line 125... | Line 142... | ||
125 | 142 | ||
126 | DrawBar(0,0, Form.cwidth,TOPPANELH, sc.work); |
143 | DrawBar(0,0, Form.cwidth,TOPPANELH, sc.work); |
- | 144 | DrawBar(0,TOPPANELH, Form.cwidth,1, sc.work_graph); |
|
- | 145 | WriteText(5, 9, 0x80, sc.work_text, INTRO_TEXT_4); |
|
- | 146 | edit_box_draw stdcall (#edit_disk_size); |
|
127 | DrawBar(0,TOPPANELH, Form.cwidth,1, sc.work_graph); |
147 | WriteText(115, 9, 0x80, sc.work_text, "MB."); |
128 | x=6; |
148 | x=6; |
129 | for (i=0; i<2; i++) |
149 | for (i=0; i<2; i++) |
130 | { |
150 | { |
131 | DefineButton(x,5, strlen(but_text[i])*6+28,19, 10+i, sc.work_button); |
151 | DefineButton(x,25, strlen(but_text[i])*6+28,19, 10+i, sc.work_button); |
132 | _PutImage(x+3,8, 14,14, i*14*14*3+#icons); |
152 | _PutImage(x+3,28, 14,14, i*14*14*3+#icons); |
133 | WriteText(x+22,11, 0x80, sc.work_button_text, but_text[i]); |
153 | WriteText(x+22,31, 0x80, sc.work_button_text, but_text[i]); |
134 | x+=strlen(but_text[i])*6+37; |
154 | x+=strlen(but_text[i])*6+37; |
135 | } |
155 | } |
136 | GetDisks(); |
156 | GetDisks(); |
137 | DrawTmpDisks(); |
157 | DrawTmpDisks(); |
Line 174... | Line 194... | ||
174 | if (disk_num>12) disk_num=12; |
194 | if (disk_num>12) disk_num=12; |
175 | } |
195 | } |
Line 176... | Line 196... | ||
176 | 196 | ||
177 | 197 | ||
Line 178... | Line 198... | ||
178 | unsigned int disk_pos_x[]={13,13,13,83,83,83,153,153,153,223,223,223}; |
198 | unsigned int disk_pos_x[]={13,13,13,83,83,83,153,153,153,223,223,223}; |
179 | unsigned int disk_pos_y[]={40,65,90,40,65,90,40,65,90,40,65,90}; |
199 | unsigned int disk_pos_y[]={60,85,110,60,85,110,60,85,110,60,85,110}; |
180 | 200 | ||
181 | void DrawTmpDisks() |
201 | void DrawTmpDisks() |
182 | { |
202 | { |
183 | int i,FreeRAM=GetFreeRAM()/1024; |
203 | int i,FreeRAM=GetFreeRAM()/1024; |
184 | DrawBar(0,31, Form.cwidth,Form.cheight-TOPPANELH-BOTPANELH-2, 0xFFFFFF); |
204 | DrawBar(0,51, Form.cwidth,Form.cheight-TOPPANELH-BOTPANELH-2, 0xFFFFFF); |
185 | DrawBar(0,Form.cheight-BOTPANELH-1, Form.cwidth,1, sc.work_graph); |
205 | DrawBar(0,Form.cheight-BOTPANELH-1, Form.cwidth,1, sc.work_graph); |
186 | DrawBar(0,Form.cheight-BOTPANELH, Form.cwidth,BOTPANELH, sc.work); |
206 | DrawBar(0,Form.cheight-BOTPANELH, Form.cwidth,BOTPANELH, sc.work); |
187 | WriteText(10, Form.cheight-13, 0x80, sc.work_text, "Free RAM size:"); |
207 | WriteText(10, Form.cheight-13, 0x80, sc.work_text, "Free RAM size:"); |
188 | WriteText(100, Form.cheight-13, 0x80, sc.work_text, itoa(FreeRAM)); |
208 | WriteText(100, Form.cheight-13, 0x80, sc.work_text, itoa(FreeRAM)); |
189 | WriteText(strlen(itoa(FreeRAM))*6 + 100, Form.cheight-13, 0x80, sc.work_text, " MB"); |
209 | WriteText(strlen(itoa(FreeRAM))*6 + 100, Form.cheight-13, 0x80, sc.work_text, " MB"); |
190 | if (disk_num==0) |
210 | if (disk_num==0) |
191 | { |
211 | { |
192 | WriteText(17,45, 0x90, 0x777777, INTRO_TEXT_1); |
212 | WriteText(17,65, 0x90, 0x777777, INTRO_TEXT_1); |
193 | WriteText(17,45+15, 0x90, 0x777777, INTRO_TEXT_2); |
213 | WriteText(17,65+15, 0x90, 0x777777, INTRO_TEXT_2); |
194 | WriteText(17,45+42, 0x90, 0x777777, INTRO_TEXT_3); |
214 | WriteText(17,65+42, 0x90, 0x777777, INTRO_TEXT_3); |
195 | return; |
215 | return; |
196 | }; |
216 | }; |
Line 211... | Line 231... | ||
211 | if (disk_num>=10) |
231 | if (disk_num>=10) |
212 | { |
232 | { |
213 | notify(NOTIFY_TEXT_DISK_LIMIT); |
233 | notify(NOTIFY_TEXT_DISK_LIMIT); |
214 | return; |
234 | return; |
215 | } |
235 | } |
- | 236 | ||
216 | param[0]='a'; |
237 | param[0]='a'; |
217 | for (i=0; i<9; i++) |
238 | for (i=0; i<9; i++) |
218 | { |
239 | { |
219 | for (j=0; j<=disk_num; j++) |
240 | for (j=0; j<=disk_num; j++) |
220 | { |
241 | { |
221 | if (i+48==disk_list[j].Item[3]) continue 1; |
242 | if (i+48==disk_list[j].Item[3]) continue 1; |
222 | } |
243 | } |
223 | break; |
244 | break; |
224 | } |
245 | } |
- | 246 | ||
225 | param[1]=i+48; |
247 | param[1]=i+48; |
- | 248 | param[2]='s'; |
|
- | 249 | param[3]='\0'; |
|
- | 250 | strcat(#param, #disk_size); |
|
226 | err = Console_Work(); |
251 | err = Console_Work(); |
227 | if ((err!=0) && (err<7)) notify(rezult_text[err]); |
252 | if ((err!=0) && (err<7)) notify(rezult_text[err]); |
228 | pause(5); |
253 | pause(5); |
229 | GetDisks(); |
254 | GetDisks(); |
230 | DrawTmpDisks(); |
255 | DrawTmpDisks(); |