| 1 |
include "const.oph" |
| 2 |
include "sysram1.oxh" |
| 3 |
|
| 4 |
APP Regina, &101F401E |
| 5 |
caption "Regina", 3 |
| 6 |
mime KDataTypePriorityHigh%, "text/rexx" |
| 7 |
icon "rexx48.mbm" |
| 8 |
icon "mask48.mbm" |
| 9 |
icon "rexx32.mbm" |
| 10 |
icon "mask32.mbm" |
| 11 |
icon "rexx24.mbm" |
| 12 |
icon "mask24.mbm" |
| 13 |
icon "rexx16.mbm" |
| 14 |
icon "mask16.mbm" |
| 15 |
ENDA |
| 16 |
|
| 17 |
include "system.oxh" |
| 18 |
include "toolbar.oph" |
| 19 |
|
| 20 |
PROC main: |
| 21 |
global winid% |
| 22 |
global file$(255) |
| 23 |
global args$(50) |
| 24 |
global rexxstartini$(50) |
| 25 |
global rexxstartdir$(50) |
| 26 |
global rexxexe$(50) |
| 27 |
global trace_chk% |
| 28 |
|
| 29 |
file$="c:\documents\*.rexx" |
| 30 |
trace_chk%=0 |
| 31 |
rexxstartdir$="C:\System\Apps\Regina" |
| 32 |
rexxstartini$=rexxstartdir$ +"\Regina.ini" |
| 33 |
rexxexe$="?:\System\Apps\Regina\rexx.exe" |
| 34 |
searchrexx%: |
| 35 |
loadm "z:\system\opl\Toolbar" |
| 36 |
tbarlink:("continue") |
| 37 |
endp |
| 38 |
|
| 39 |
proc continue: |
| 40 |
local a&, choice% |
| 41 |
local ev&(32), key% |
| 42 |
local cmdl$(255) |
| 43 |
|
| 44 |
if (cmd$(3) = "O") |
| 45 |
file$ = cmd$(2) |
| 46 |
cmdr%: |
| 47 |
cmde%: |
| 48 |
endif |
| 49 |
wininit: |
| 50 |
while (1) |
| 51 |
getevent32 ev&() |
| 52 |
if (ev&( KEvAType%) = KKeyMenu32%) |
| 53 |
menu: |
| 54 |
elseif (ev&(1) = KKeySidebarMenu32%) |
| 55 |
menu: |
| 56 |
elseif ((ev&(1) and &400) = 0) |
| 57 |
key% = ev&(1) + (%A - 1) |
| 58 |
onerr nix:: |
| 59 |
@%("cmd"+chr$(key%)): |
| 60 |
onerr off |
| 61 |
elseif (ev&(KEvAType%) = KEvPtr&) |
| 62 |
TBarOffer%:(ev&(KEvAPtrOplWindowId%),ev&(KEvAPtrType%),ev&(KEvAPtrPositionX%),ev&(KEvAPtrPositionY%)) |
| 63 |
elseif (ev&(KEvAType%) = KEvCommand&) |
| 64 |
cmdl$ = getcmd$ |
| 65 |
key% = asc( cmdl$) |
| 66 |
if (key% = %X) |
| 67 |
cmde%: |
| 68 |
elseif (key% = %O) |
| 69 |
file$=right$(cmdl$,len(cmdl$)-1) |
| 70 |
cmdr%: |
| 71 |
endif |
| 72 |
endif |
| 73 |
nix:: |
| 74 |
endwh |
| 75 |
ENDP |
| 76 |
|
| 77 |
proc cmdtbdownc%: |
| 78 |
cmdc%: |
| 79 |
endp |
| 80 |
|
| 81 |
proc cmdc%: |
| 82 |
LOCAL rc% |
| 83 |
|
| 84 |
file$=OPENFILEDIALOG$:(file$,0,0,0) |
| 85 |
if ( file$ = "" ) |
| 86 |
file$="c:\documents\*.rexx" |
| 87 |
else |
| 88 |
dinit "Command Line" |
| 89 |
dcheckbox trace_chk%,"Trace" |
| 90 |
dedit file$, "Program", 25 |
| 91 |
dedit args$, "Arguments", 25 |
| 92 |
dbuttons "Ok", KDButtonEnter%, "Cancel", -KDButtonEsc% |
| 93 |
rc%=dialog |
| 94 |
if ( rc% = 0 ) |
| 95 |
file$="c:\documents\*.rexx" |
| 96 |
endif |
| 97 |
endif |
| 98 |
endp |
| 99 |
|
| 100 |
proc WinInit: |
| 101 |
local id%, icon% |
| 102 |
|
| 103 |
gupdate off |
| 104 |
gfont KFontCourierNormal11& |
| 105 |
tbarinit:("Regina", gwidth, gheight) |
| 106 |
|
| 107 |
Icon%=gCreateBit(0,0) rem create it once and for all |
| 108 |
gCls |
| 109 |
tbarbutt:("r", 1, "Run", 0, icon%, icon%, KTbFlgCmdOnPtrDown%) |
| 110 |
tbarbutt:("c", 2, "Command" +chr$(10) + "line", 0, icon%, icon%, KTbFlgCmdOnPtrDown%) |
| 111 |
tbarbutt:("e", 3, "Exit", 0, icon%, icon%, KTbFlgCmdOnPtrDown%) |
| 112 |
rem tbarbutt:("a", 4, "About", 0, icon%, icon%, KTbFlgCmdOnPtrDown%) |
| 113 |
tbarshow: |
| 114 |
return id% |
| 115 |
endp |
| 116 |
|
| 117 |
|
| 118 |
proc menu: |
| 119 |
local val% |
| 120 |
local comd$(4) |
| 121 |
|
| 122 |
minit |
| 123 |
mcard "File", "Run", %r, "Command Line", %c, "Exit", %e |
| 124 |
mcard "Help", "About", %a, "Contents", %h |
| 125 |
|
| 126 |
val% = menu |
| 127 |
if (val% > 0) |
| 128 |
@%("cmd"+chr$(val%)): |
| 129 |
endif |
| 130 |
endp |
| 131 |
|
| 132 |
proc cmdtbdowne%: |
| 133 |
cmde%: |
| 134 |
endp |
| 135 |
|
| 136 |
proc cmdtbdowna%: |
| 137 |
cmda%: |
| 138 |
endp |
| 139 |
|
| 140 |
proc cmde%: |
| 141 |
stop |
| 142 |
endp |
| 143 |
|
| 144 |
proc cmda%: |
| 145 |
dinit "RexxStart v3.4" |
| 146 |
dtext "by Mark Hessling","" |
| 147 |
dtext " http://www.rexx.org/","" |
| 148 |
dtext "based on PerlStart by Olaf Flebbe","" |
| 149 |
dtext " http://www.science-computing.de/o.flebbe","" |
| 150 |
dbuttons "Continue", KDButtonEnter% |
| 151 |
dialog |
| 152 |
endp |
| 153 |
|
| 154 |
proc checkrexx%:( location$) |
| 155 |
rexxexe$ = location$ + right$(rexxexe$, len(rexxexe$)-1) |
| 156 |
return exist( rexxexe$) |
| 157 |
endp |
| 158 |
|
| 159 |
proc searchrexx%: |
| 160 |
if (checkrexx%:("C")) |
| 161 |
return |
| 162 |
elseif (checkrexx%:("D")) |
| 163 |
return |
| 164 |
else |
| 165 |
alert("Rexx executable not found on C: or D:") |
| 166 |
stop |
| 167 |
endif |
| 168 |
endp |
| 169 |
|
| 170 |
proc cmdtbdownd%: |
| 171 |
cmdd%: |
| 172 |
endp |
| 173 |
|
| 174 |
proc cmdtbdownr%: |
| 175 |
cmdr%: |
| 176 |
endp |
| 177 |
|
| 178 |
proc cmdr%: |
| 179 |
local tid&, statusword& |
| 180 |
local runargs$(50) |
| 181 |
local trace_flag$(3) |
| 182 |
|
| 183 |
if file$ = "c:\documents\*.rexx" |
| 184 |
cmdc%: |
| 185 |
endif |
| 186 |
if file$ = "c:\documents\*.rexx" |
| 187 |
return |
| 188 |
endif |
| 189 |
|
| 190 |
onerr nix:: |
| 191 |
if ( trace_chk% = 0 ) |
| 192 |
trace_flag$ = "" |
| 193 |
else |
| 194 |
trace_flag$ = "-t " |
| 195 |
endif |
| 196 |
if args$ <> "" |
| 197 |
runargs$ = " " + args$ |
| 198 |
else |
| 199 |
runargs$ = args$ |
| 200 |
endif |
| 201 |
busy "[" + trace_flag$ + file$ + args$ + "]" |
| 202 |
tid& = RunExeWithCmd&:( rexxexe$, trace_flag$ + file$ + args$) |
| 203 |
busy off |
| 204 |
onerr off |
| 205 |
LOGONTOTHREAD:(tid&,statusWord&) |
| 206 |
IOWAITSTAT32 statusWord& |
| 207 |
setforeground: |
| 208 |
return |
| 209 |
nix:: |
| 210 |
busy off |
| 211 |
alert(rexxexe$ + " unable to be run") |
| 212 |
endp |
| 213 |
|
| 214 |
proc cmdh%: |
| 215 |
RUNAPP&:("Data","c:\system\apps\regina\regina.hlp","",0) |
| 216 |
endp |