/[james]/archive/bootedit/BootEdit/Basic/Boot
ViewVC logotype

Annotation of /archive/bootedit/BootEdit/Basic/Boot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 25 - (hide annotations) (download)
Thu Mar 13 12:54:50 2003 UTC (21 years, 8 months ago) by james
File size: 8356 byte(s)
Initial import.

1 james 25 REM > BootEditCode:Boot
2    
3     DEF PROCBoot_Scan
4     LOCAL Wide%
5    
6     SYS"WimpExt_MiscOp", 1 TO ,,, Wide%
7     Wide% = 810 - Wide%
8    
9     CASE TRUE OF
10    
11     WHEN FNWind_GetIcon("Boot", "PreDesktop")
12     Boot_Editing% = 1
13     PROCBoot_LoadFile("PreDesktop", "small_feb")
14    
15     WHEN FNWind_GetIcon("Boot", "PreDesk")
16     Boot_Editing% = 2
17     PROCBoot_ScanDirectory("PreDesk")
18    
19     WHEN FNWind_GetIcon("Boot", "Desktop")
20     Boot_Editing% = 3
21     PROCBoot_LoadFile("Desktop", "small_fea")
22    
23     WHEN FNWind_GetIcon("Boot", "Tasks")
24     Boot_Editing% = 4
25     PROCBoot_ScanDirectory("Tasks")
26    
27     ENDCASE
28    
29     PROCWind_IconGrey("Boot", "Remove", 1)
30     PROCWind_IconGrey("Boot", "Edit", 1)
31     PROCWind_IconGrey("Boot", "Open", -(Boot_Editing% = 1 OR Boot_Editing% = 3))
32    
33     IF High% < 364 THEN High% = 364
34    
35     B%!400 = 0
36     B%!404 = -High%
37     B%!408 = Wide%
38     B%!412 = 0
39     SYS"Wimp_SetExtent", FNObject_Hand(0, "BootPane", 0), B% + 400
40    
41     IF FNWind_Open("BootPane") THEN
42     PROCWind_PopOpen("BootPane")
43     B%!00 = FNObject_Hand(0, "BootPane", 0)
44     SYS"Wimp_GetWindowState",, B%
45     IF FNOpen_BootPane
46     PROCWind_ForceRedraw("BootPane")
47     ENDIF
48    
49     BootPane_Wide% = Wide%
50    
51     ENDPROC
52    
53     REM �������������������������������������������������������������������������
54    
55     DEF PROCBoot_LoadFile(File$, Icon$)
56     LOCAL List%, File%
57    
58     IF NOT(FNWimp_FileExists(Boot_Path$ + ".Choices.Boot." + File$)) THEN ERROR Erro_Warn%, "%No" + File$
59    
60     LOCAL ERROR
61     ON ERROR LOCAL RESTORE ERROR: PROCBoot_Error(File%)
62    
63     PROCHeap_Lose(0, "BootList")
64     List% = FNHeap_Safe(4, 0, "BootList")
65     !List% = 0
66    
67     File% = OPENIN(Boot_Path$ + ".Choices.Boot." + File$)
68     WHILE NOT EOF#File%
69     Line$ = GET$#File%
70    
71     IF LEFT$(Line$, 6) = "|Start" THEN
72     !List% += 1
73     IF NOT FNHeap_ReAlloc(List%, 4 + !List% * 80) THEN ERROR Erro_Memo%, ""
74     List% = FNHeap_Find(0, "BootList")
75     !(List% + 4 + 80 * (!List% - 1) + 00) = 0
76     $(List% + 4 + 80 * (!List% - 1) + 04) = "S" + Icon$
77     $(List% + 4 + 80 * (!List% - 1) + 20) = MID$(Line$, 8, 59)
78     ENDIF
79    
80     ENDWHILE
81     CLOSE#File%
82    
83     High% = !List% * List_High%
84    
85     ENDPROC
86    
87     REM �������������������������������������������������������������������������
88    
89     DEF PROCBoot_Error(File%)
90     PROCHeap_Lose(0, "BootList")
91     Erro_ERL% = ERL
92     Erro_REPORT$ = REPORT$
93     Erro_ERR% = ERR
94     IF File% <> 0 THEN CLOSE#File%
95     ERROR ERR, REPORT$
96     ENDPROC
97    
98     REM �������������������������������������������������������������������������
99    
100     DEF PROCBoot_ScanDirectory(Directory$)
101     LOCAL Offset%, List%, Read%
102    
103     IF NOT(FNWimp_FileExists(Boot_Path$ + ".Choices.Boot." + Directory$)) THEN ERROR Erro_Warn%, "%No" + Directory$
104    
105     PROCHeap_Lose(0, "BootList")
106     List% = FNHeap_Safe(4, 0, "BootList")
107     !List% = 0
108    
109     REPEAT
110     SYS"OS_GBPB", 12, Boot_Path$ + ".Choices.Boot." + Directory$, B% + 400, 1, Offset%, 112 TO ,,, Read%, Offset%
111    
112     IF Read% = 1 THEN
113     !List% += 1
114     IF NOT FNHeap_ReAlloc(List%, 4 + !List% * 80) THEN ERROR Erro_Memo%, ""
115     List% = FNHeap_Find(0, "BootList")
116    
117     CASE B%!420 OF
118    
119     WHEN &1000
120     Icon$ = "small_dir"
121    
122     WHEN &2000
123     Icon$ = "sm" + LEFT$(FNWimp_GetString(B% + 424), 10)
124     SYS"XWimp_SpriteOp", 40,, Icon$ TO ;PFlg%
125     IF (PFlg% AND 1) THEN Icon$ = "small_app"
126    
127     OTHERWISE
128     Icon$ = "small_" + RIGHT$("00" + STR$~(B%!420), 3)
129     SYS"XWimp_SpriteOp", 40,, Icon$ TO ;PFlg%
130     IF (PFlg% AND 1) THEN Icon$ = "small_xxx"
131    
132     ENDCASE
133    
134     !(List% + 4 + 80 * (!List% - 1) + 00) = 0
135     $(List% + 4 + 80 * (!List% - 1) + 04) = "S" + Icon$
136     $(List% + 4 + 80 * (!List% - 1) + 20) = FNWimp_GetString(B% + 424)
137     ENDIF
138    
139     UNTIL Offset% = -1
140    
141     High% = !List% * List_High%
142    
143     ENDPROC
144    
145     REM �������������������������������������������������������������������������
146    
147     DEF PROCBoot_Edited(File$)
148     LOCAL File%, In%, Out%, Line$, In$, Done%
149    
150     File% = OPENIN("Pipe:$." + File$)
151     IF EOF#File% THEN ENDPROC
152     Line$ = GET$#File%
153    
154     In% = OPENIN(Boot_Path$ + ".Choices.Boot." + File$)
155     Out% = OPENOUT("<Wimp$ScrapDir>.BootEdit")
156    
157     WHILE NOT EOF#In%
158     In$ = GET$#In%
159    
160     IF (In$ = Line$) AND NOT(Done%) THEN
161     REPEAT
162     IF In$ <> "" THEN BPUT#Out%, In$
163     In$ = GET$#File%
164     UNTIL In$ = "|End"
165     REPEAT
166     Line$ = GET$#In%
167     UNTIL Line$ = "|End"
168     Done% = TRUE
169     ENDIF
170    
171     IF In$ <> "" THEN BPUT#Out%, In$
172     ENDWHILE
173    
174     IF NOT Done% THEN
175     BPUT#Out%, Line$
176     REPEAT
177     In$ = GET$#File%
178     IF In$ <> "" THEN BPUT#Out%, In$
179     UNTIL In$ = "|End"
180     ENDIF
181    
182     CLOSE#File%
183     CLOSE#In%
184     CLOSE#Out%
185    
186     OSCLI"Copy <Wimp$ScrapDir>.BootEdit " + Boot_Path$ + ".Choices.Boot." + File$ + " ~CDFL~V"
187     IF File$ = "PreDesktop" THEN
188     OSCLI"SetType " + Boot_Path$ + ".Choices.Boot." + File$ + " FEB"
189     ELSE
190     OSCLI"SetType " + Boot_Path$ + ".Choices.Boot." + File$ + " FEA"
191     ENDIF
192    
193     PROCBoot_Scan
194    
195     ENDPROC
196    
197     REM �������������������������������������������������������������������������
198    
199     DEF PROCBoot_Remove(File$)
200     LOCAL List%, Item%, In%, Out%, Line$
201    
202     List% = FNHeap_Find(0, "BootList")
203    
204     In% = OPENIN(Boot_Path$ + ".Choices.Boot." + File$)
205     Out% = OPENOUT("<Wimp$ScrapDir>.BootEdit")
206    
207     WHILE NOT EOF#In%
208     Line$ = GET$#In%
209    
210     IF LEFT$(Line$, 6) = "|Start" THEN
211    
212     Item% = 1
213     WHILE ($(List% + 4 + 80 * (Item% - 1) + 20) <> MID$(Line$, 8)) AND (Item% <= !List%)
214     Item% += 1
215     ENDWHILE
216    
217     IF (($(List% + 4 + 80 * (Item% - 1) + 20) = MID$(Line$, 8))) AND (!(List% + 4 + 80 * (Item% - 1) + 00) AND 1) THEN
218     REPEAT
219     Line$ = GET$#In%
220     UNTIL Line$ = "|End"
221     Line$ = GET$#In%
222     ENDIF
223    
224     ENDIF
225    
226     IF Line$ <> "" THEN BPUT#Out%, Line$
227     ENDWHILE
228    
229     CLOSE#In%
230     CLOSE#Out%
231    
232     OSCLI"Copy <Wimp$ScrapDir>.BootEdit " + Boot_Path$ + ".Choices.Boot." + File$ + " ~CDFL~V"
233     IF File$ = "PreDesktop" THEN
234     OSCLI"SetType " + Boot_Path$ + ".Choices.Boot." + File$ + " FEB"
235     ELSE
236     OSCLI"SetType " + Boot_Path$ + ".Choices.Boot." + File$ + " FEA"
237     ENDIF
238    
239     PROCBoot_Scan
240    
241     ENDPROC
242    
243     REM �������������������������������������������������������������������������
244    
245     DEF PROCBoot_Delete(Directory$)
246     LOCAL List%, Item%
247    
248     List% = FNHeap_Find(0, "BootList")
249    
250     FOR Item% = 1 TO !List%
251     IF (!(List% + 4 + 80 * (Item% - 1) + 00) AND 1) THEN
252     OSCLI("Wipe " + Boot_Path$ + ".Choices.Boot." + Directory$ + "." + $(List% + 4 + 80 * (Item% - 1) + 20) + " ~CFR~V")
253     ENDIF
254     NEXT
255    
256     PROCBoot_Scan
257    
258     ENDPROC
259    
260     REM �������������������������������������������������������������������������
261    
262     DEF PROCBoot_Edit(File$, Item%)
263     LOCAL List%, In%, Out%
264    
265     List% = FNHeap_Find(0, "BootList")
266    
267     In% = OPENIN(Boot_Path$ + ".Choices.Boot." + File$)
268     Out% = OPENOUT("Pipe:$." + File$)
269    
270     IF Item% = 0 THEN
271    
272     Item% = 1
273     WHILE (!(List% + 4 + 80 * (Item% - 1) + 00) AND 1) = 0
274     Item% += 1
275     ENDWHILE
276    
277     ENDIF
278    
279     WHILE NOT EOF#In%
280     Line$ = GET$#In%
281    
282     IF LEFT$(Line$, 6) = "|Start" THEN
283     IF MID$(Line$, 8) = $(List% + 4 + 80 * (Item% - 1) + 20) THEN
284     BPUT#Out%, Line$
285     REPEAT
286     Line$ = GET$#In%
287     BPUT#Out%, Line$
288     UNTIL Line$ = "|End"
289     ENDIF
290     ENDIF
291    
292     ENDWHILE
293    
294     CLOSE#In%
295     CLOSE#Out%
296    
297     OSCLI("SetType Pipe:$." + File$ + " FFF")
298     OSCLI("Filer_Run Pipe:$." + File$)
299    
300     ENDPROC
301    
302     REM �������������������������������������������������������������������������
303    
304     DEF PROCBoot_Load(File$)
305     LOCAL File%, In%, Line$
306    
307     IF File$ = "PreDesktop" AND B%!40 <> &FEB THEN ERROR Erro_Warn%, "%NotFEB"
308     IF File$ = "Desktop" AND B%!40 <> &FEA THEN ERROR Erro_Warn%, "%NotFEA"
309    
310     File% = OPENIN(FNWimp_GetString(B% + 44))
311     IF EOF#File% THEN CLOSE#File%: ERROR Erro_Warn%, "%NoHeader"
312     Line$ = GET$#File%
313     IF LEFT$(Line$, 6) <> "|Start" THEN CLOSE#File%: ERROR Erro_Warn%, "%NoHeader"
314     WHILE NOT EOF#File%
315     Line$ = GET$#File%
316     ENDWHILE
317     IF Line$ <> "|End" THEN CLOSE#File%: ERROR Erro_Warn%, "%NoEnd"
318    
319     PTR#File% = 0
320    
321     In% = OPENUP(Boot_Path$ + ".Choices.Boot." + File$)
322     PTR#In% = EXT#In%
323    
324     WHILE NOT EOF#File%
325     BPUT#In%, GET$#File%
326     ENDWHILE
327    
328     CLOSE#In%
329     CLOSE#File%
330    
331     FOR A% = 0 TO !B% STEP 4: !(B% + 200 + A%) = B%!A%: NEXT
332     PROCBoot_Scan
333     FOR A% = 0 TO B%!200 STEP 4: B%!A% = !(B% + 200 + A%): NEXT
334    
335     ENDPROC
336    
337     REM �������������������������������������������������������������������������
338    
339     DEF PROCBoot_Copy(Directory$)
340     LOCAL File$
341    
342     File$ = FNWimp_GetString(B% + 44)
343     Leaf$ = FNWimp_GetLeaf(File$)
344     IF FNWimp_FileExists(Boot_Path$ + ".Choices.Boot." + Directory$ + "." + Leaf$) THEN ERROR Erro_Warn%, "%AlreadyExists"
345    
346     SYS"Wimp_StartTask", "Copy " + File$ + " " + Boot_Path$ + ".Choices.Boot." + Directory$ + "." + Leaf$ + " ~C~D~FLR~V"
347    
348     FOR A% = 0 TO !B% STEP 4: !(B% + 200 + A%) = B%!A%: NEXT
349     PROCBoot_Scan
350     FOR A% = 0 TO B%!200 STEP 4: B%!A% = !(B% + 200 + A%): NEXT
351    
352     ENDPROC

  ViewVC Help
Powered by ViewVC 1.1.26