Comment ============================================================= Environment Editor * Copyright 1990 by Marc Perkel This is a MarxMenu demo program that lets you edit your master environment area. To use type: MARXMENU ENV ============================================================= EndComment Var Env, Env2, Paths, Paths2, NewPath, SetString, SetA, SetB, Middle PathLevel Const MyEditor = 'ME.EXE' ClearScreenOnExit Off ReadEnvironment(Env) UseArrows BoxBorderColor Green Blue BoxInsideColor Yellow Blue if ColorScreen BoxHeaderColor Yellow Mag InverseColor Yellow Red else BoxHeaderColor Black Grey InverseColor Black Grey endif BoxHeader ' Environment ' DrawBox 27 6 32 9 TextColor LCyan Blue ClearLine 205 TextColor Yellow Blue Writeln Writeln ' A - Change One Line' Writeln ' B - Delete Lines' Writeln ' C - Edit Environment' Writeln ' D - Sort Environment' Writeln ' E - Edit Paths' Write ' F - Information' OnKey 'A' ^SetALine OnKey 'B' ^DelLines OnKey 'C' ^EdEnv OnKey 'D' |DrawBox 33 13 11 3 |Write ' Sorting' |SortArray(Env) |WasteEnv(Env) |WriteEnv(Env) |Wait 20 |EraseTopWindow OnKey 'E' ^EdPath OnKey 'F' |BoxHeader ' Information ' |DrawBox 30 9 32 6 |TextColor LCyan Blue |ClearLine 205 |TextColor Yellow Blue |Writeln |Writeln ' Environment Size: ' EnvSize |Writeln ' Environment Free: ' EnvFree |Write ' Environment Used: ' (EnvSize - EnvFree) |WaitOrKBDReady 4000 |EraseTopWindow :SetALine if NumberOfElements(Env) > 1 BoxHeader ' Pick String to Edit ' DrawPickBox(Env) SetString = PickOne Env EraseTopWindow EraseTopWindow endif if NumberOfElements(Env) = 1 then SetString = Env[1] if LastKey = Esc then ExitMenu SetA = Left(SetString,pos('=',SetString) - 1) delete(SetString,1,pos('=',SetString)) DrawBox 1 20 80 3 Write ' ' SetA '=' InputString = SetString SetB = Readln EraseTopWindow if LastKey = Esc then ExitMenu SetEnv(SetA + '=' + SetB) ExitMenu :DelLines BoxHeader ' Mark Lines to Delete ' DrawPickBox(Env) PickMany(Env,Env2) EraseTopWindow EraseTopWindow WasteEnv(Env2) ExitMenu :EdEnv WriteTextFile ('ENV.TMP',Env) Explode Off Execute (MyEditor + ' ENV.TMP') ReadTextFile ('ENV.TMP',Env2) DelFile ('ENV.TMP') DelFile ('ENV.BAK') WasteEnv(Env) WriteEnv(Env2) ExitMenu :EdPath SplitPath(Paths) BoxHeader ' Edit Path ' DrawBox 30 9 32 5 TextColor LCyan Blue ClearLine 205 TextColor Yellow Blue Writeln Writeln ' A - Add a Path' Write ' B - Delete Paths' OnKey 'A' |DrawBox 1 20 80 3 |repeat | Write ' New Path: ' | NewPath = UpperCase(Readln) |until ExistDir(NewPath) or (LastKey = Esc) or (SetB = '') |EraseTopWindow |if ExistDir(NewPath) and (LastKey <> Esc) | Paths[NumberOfElements(Paths) + 1] = NewPath |endif |BuildPath(Paths) OnKey 'B' ^DelPaths :DelPaths BoxHeader ' Mark Paths to Delete ' PathLevel = True DrawPickBox(Paths) PathLevel = False PickMany(Paths,Paths2) EraseTopWindow EraseTopWindow EraseTopWindow EraseTopWindow SubtractPaths(Paths,Paths2) BuildPath(Paths) ExitMenu Procedure WasteEnv (EnvArray) Loop EnvArray LoopVal = Left(LoopVal,pos('=',LoopVal)) SetEnv(LoopVal) EndLoop EndProc Procedure WriteEnv (EnvArray) Loop EnvArray SetEnv(LoopVal) EndLoop EndProc Procedure DrawPickBox (ChooseList) var BoxDim Longest Longest = length(BoxHeader) - 2 Loop ChooseList Longest = Max(Longest,length(LoopVal)) EndLoop BoxDim[3] = Min(Longest + 6,ScreenWidth - 6) BoxDim[4] = Min(NumberOfElements(ChooseList) + 3,ScreenHeight) if PathLevel BoxDim[1] = Max(Min(33,ScreenWidth - BoxDim[3]),1) BoxDim[2] = Max(Min(12,ScreenHeight - BoxDim[4]),1) else BoxDim[1] = Max(Min(30,ScreenWidth - BoxDim[3]),1) BoxDim[2] = Max(Min(9,ScreenHeight - BoxDim[4]),1) endif DrawBox BoxDim[1] BoxDim[2] BoxDim[3] BoxDim[4] TextColor LCyan Blue ClearLine 205 TextColor Yellow Blue NoBoxBorder Explode Off DrawBox BoxDim[1] + 1 BoxDim[2] + 2 BoxDim[3] - 2 BoxDim[4] - 3 BlockBox Explode EndProc Procedure SubtractPaths (Org,Sub) var I Match Dispose(Paths) I = 1 while I <= NumberOfElements(Org) Match = False Loop Sub if Org[I] = LoopVal Match = True endif EndLoop if not Match then Paths[NumberOfElements(Paths) + 1] = Org[I] I = I + 1 endwhile EndProc