home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 82 / af082sub.adf / FINALWRITER / FINAL.lzx / FinalWriter / FinalWrapper / FinalWrapper.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1978-01-01  |  60.3 KB  |  2,732 lines

  1. /* $VER: FinalWrapper 3.1 (21.05.95) by NDY's */
  2. version="3.1"
  3. date="21.05.95"
  4. OPTIONS RESULTS
  5. SIGNAL ON ERROR
  6. SIGNAL ON SYNTAX
  7. SIGNAL ON BREAK_C
  8. ARG cliarg
  9. initerr=init()
  10. rxport=ADDRESS()
  11. IF ~(Left(rxport,Length(finalw))=finalw) THEN
  12. DO
  13. DO i=1 TO 20 UNTIL portok
  14. rxport=finalw||i
  15. portok=Show("p",rxport)
  16. END
  17. IF portok THEN ADDRESS VALUE rxport
  18. END
  19. portok=Show("p",rxport)
  20. CALL locale
  21. CALL checkenv
  22. CALL loaddef(1)
  23. pubonly=~check.mscr
  24. IF portok & ~pubonly & fwkey~="" THEN
  25. DO
  26. SIGNAL OFF ERROR
  27. ADDRESS COMMAND ''fwkey''
  28. SIGNAL ON ERROR
  29. IF RC=0 THEN
  30. pubonly=1
  31. ELSE
  32. customscr=D2C(RC,4)
  33. END
  34. ELSE
  35. pubonly=1
  36. IF portok THEN
  37. DO
  38. GetDocItemPrefs "DECIMAL"
  39. deci=Upper(RESULT)
  40. DocItemPrefs "DECIMAL PERIOD" 
  41. CALL options
  42. CALL chosenobjs
  43. CALL oval
  44. CALL scan
  45. CALL resetprefs
  46. END
  47. meas=measure.1
  48. IF portok THEN
  49. DO
  50. GetDisplayPrefs "MEASURE"
  51. RESULT=Upper(RESULT)
  52. SELECT
  53. WHEN RESULT="INCHES" THEN meas=measure.2
  54. WHEN RESULT="METRIC" THEN meas=measure.3
  55. WHEN RESULT="PICA" THEN meas=measure.4
  56. OTHERWISE NOP
  57. END
  58. END
  59. DO id=agads+1 TO agads+sgads
  60. ltxt.id=replacepat(ltxt.id,"@m",meas)
  61. END
  62. IF guiinit()=5 THEN CALL message(50,nogui)
  63. IF test THEN
  64. DO
  65. DO i=1 TO 5
  66. nr=Word("5 10 20 100 200",i)
  67. CALL message(0,replacepat(replacepat(replacepat(replacepat(errtext,"@n",nr),"@l",666),"@t",fwerrtext.nr),"@s","Goto hell"))
  68. END
  69. CALL message(0,replacepat(nolib,"@y","leng.library"))
  70. CALL message(0,nofw)
  71. CALL message(0,noselect)
  72. CALL message(0,wrongos)
  73. CALL message(0,nogui)
  74. CALL message(0,nohelp)
  75. CALL message(0,noreqtools)
  76. CALL message(0,replacepat(notnum,"@g","Age:"))
  77. CALL message(0,replacepat(rxcmderr,"@c","BE QUIET"))
  78. CALL message(0,about)
  79. END
  80. init=0
  81. DO FOREVER
  82. CALL OnMenu(win,1024)
  83. IF ~zoomed THEN CALL ZipWindow(win)
  84. CALL ScreenToFront(scr)
  85. CALL ActivateWindow(win)
  86. CALL SetWindowTitles(win,wintitle,scrtitle)
  87. IF Left(text,Min(len.tgad,Length(text)))~=val.tgad THEN text=val.tgad
  88. DO UNTIL portok
  89. closed=0
  90. DO UNTIL closed~=0
  91. DO UNTIL closed~=0
  92. CALL WaitPkt(portname)
  93. CALL messy
  94. END
  95. DO id=1 TO agads+sgads
  96. IF labs.id>0 THEN CALL checkstrgad
  97. END
  98. IF closed=winclose | closed=okclose & prefsstore THEN CALL savedef(1)
  99. IF closed=cancelclose | closed=winclose THEN
  100. DO
  101. CALL bye(0)
  102. closed=0
  103. END
  104. IF closed=rxclose THEN
  105. DO
  106. ADDRESS COMMAND "Run >NIL: Rx "||defdir
  107. closed=0
  108. END
  109. IF closed=nextclose THEN
  110. DO
  111. ADDRESS VALUE rxport
  112. portok=1
  113. CALL newdoc
  114. closed=0
  115. END
  116. END
  117. closed=0
  118. portok=Show("P",rxport)
  119. IF ~portok THEN
  120. DO
  121. DO i=1 TO 20 UNTIL portok
  122. rxport=finalw||i
  123. portok=Show("p",rxport)
  124. END
  125. CALL newdoc
  126. END
  127. IF ~portok THEN
  128. CALL message(0,nofw)
  129. ELSE
  130. ADDRESS VALUE rxport
  131. END
  132. zoomed=BitTst(D2C(GETVALUE(win,24,4,"N")),28)
  133. IF ~zoomed THEN CALL ZipWindow(win) 
  134. CALL SetWindowTitles(win,aborttitle,busytitle)
  135. ScreenToFront
  136. CALL OffMenu(win,1024)
  137. GetDocItemPrefs "DECIMAL"
  138. deci=Upper(RESULT)
  139. DocItemPrefs "DECIMAL PERIOD" 
  140. CALL options
  141. IF chosenobjs()=0 THEN
  142. DO
  143. CALL oval
  144. CALL scan
  145. IF closed=0 THEN CALL text
  146. IF closed=0 THEN CALL wrap
  147. IF closed=0 THEN CALL group
  148. CALL updategadgets
  149. IF stilltoreply THEN
  150. DO
  151. CALL Reply(replymsg,0)
  152. stilltoreply=0
  153. END
  154. END
  155. CALL resetprefs
  156. END
  157. CALL bye(5)
  158. init: 
  159. init=1
  160. errtext="@t (#@n)|in line @l"
  161. stdbut="OK"
  162. wintitle=""
  163. lockcnt=0
  164. errtrap=0
  165. getscrn=0
  166. catalog=0
  167. objs=0
  168. sobjs=0
  169. deci=""
  170. et=""
  171. cleangui=0
  172. stilltoreply=0
  173. replymsg="00000000"x
  174. apig=1
  175. lib.apig=0
  176. reqtools=4
  177. lib.reqtools=0
  178. win="00000000"x
  179. defprfs=""
  180. defspecs=""
  181. defcolour=""
  182. deffont=""
  183. portname="FinalWrapperPort"
  184. IF Show("P",portname) THEN
  185. DO
  186. ADDRESS VALUE portname
  187. IF cliarg~="" THEN
  188. INTERPRET cliarg
  189. ELSE
  190. PopFront
  191. CALL bye(0)
  192. END
  193. fwkey="ENVARC:FinalWrapper/FWKeyfile"
  194. libs=5
  195. DO i=1 TO libs
  196. lib.i=0
  197. END
  198. library.apig="apig.library"
  199. library.2="rexxmathlib.library"
  200. library.3="rexxsupport.library"
  201. library.reqtools="rexxreqtools.library"
  202. guidelib=5
  203. library.guidelib="amigaguide.library"
  204. DO libn=1 TO libs
  205. lib.libn=Show("l",library.libn)
  206. IF ~lib.libn THEN lib.libn=AddLib(library.libn,0,-30,0)
  207. IF ~lib.libn & libn~=guidelib & libn~=reqtools THEN RETURN 14
  208. END
  209. help=lib.guidelib
  210. defdir=""
  211. temp=""
  212. preff.1=""
  213. preff.2=""
  214. IF xexists("ENV:Workbench") THEN
  215. IF Open(prefs,"ENV:Workbench","R") THEN
  216. DO
  217. wb3=(ReadLn(prefs)>=39)
  218. CALL Close(prefs)
  219. END
  220. ELSE
  221. wb3=0
  222. IF xexists("ENV:FinalWrapper") THEN
  223. DO
  224. preff.1="ENV:FinalWrapper/FinalWrapper.def"
  225. temp="ENV:FinalWrapper/FinalWrapper.temp"
  226. IF Open(prefs,"ENV:FinalWrapper/FWPath","R") THEN
  227. DO
  228. defdir=ReadLn(prefs)
  229. CALL Close(prefs)
  230. END
  231. END
  232. IF xexists("ENVARC:FinalWrapper") THEN preff.2="ENVARC:FinalWrapper/FinalWrapper.def"
  233. finalw="FINALW."
  234. libn=libs
  235. port=0
  236. oldlen=0
  237. oldtxt=0
  238. oldoval=0
  239. oldobjs=0
  240. oldpara=-1
  241. oldppos=-1
  242. oldplen=-1
  243. txt=0
  244. oval=0
  245. rx=0
  246. ry=0
  247. ovalx=""
  248. ovaly=""
  249. ovalw=""
  250. ovalh=""
  251. ovalp=""
  252. text=""
  253. mchks=0
  254. macts=0
  255. agads=0
  256. sgads=0
  257. tgads=0
  258. wgads=0
  259. slines=0
  260. ovalscanned=0
  261. gadgettext=0
  262. virtualtext=1
  263. alen=0
  264. txtrot=0
  265. windowpos=0
  266. prefsstore=1
  267. trapped=0
  268. specs.0=""
  269. font.0=""
  270. colour.0=""
  271. dirtysize=1
  272. sheetused=0
  273. dirtytext=1
  274. obl="00011111122222233333444445555666677778888999AA"
  275. obrot="0006121722273135394245"
  276. RETURN 0
  277. locale: 
  278. return=13 ; esc=27 ; bs=8 ; del=127
  279. test=0 
  280. IF xexists("ENV:") THEN
  281. ok=Open(prefs,"ENV:Language","R")
  282. ELSE
  283. ok=0
  284. IF ok THEN
  285. DO
  286. language=ReadLn(prefs)
  287. CALL Close(prefs)
  288. END
  289. ELSE
  290. language="english"
  291. IF language="deutsch" THEN 
  292. DO
  293. measure.1="?"
  294. measure.2="Zoll"
  295. measure.3="cm"
  296. measure.4="Pica"
  297. docname="FinalWrapperSmallD.Guide"
  298. origwintitle="@i - @f"
  299. origscrtitle="@i - @f"
  300. unnamed="Unbenannt"
  301. defwinx=0
  302. defwiny=0
  303. aborttitle="<- Abbrechen"
  304. busytitle="@i - Am Arbeiten, bitte warten..."
  305. gnode.0="REQUESTER"
  306. mnode.0="MENU"
  307. stdbut="OK"
  308. errtext="FinalWrapper-Fehler:|@t|in Zeile @l:|<@s>|(Fehlernummer @n)"
  309. nolib="FinalWrapper-Fehler:|Konnte '@y' nicht öffnen!"
  310. nofw="Erst mal Final Writer starten!"
  311. noselect="FinalWrapper-Fehler:|Zuerst einen Textblock oder einen|Textausschnitt und ein Objekt|wählen oder die Werte in die|entsprechenden Felder eingeben!"
  312. wrongos="FinalWrapper-Fehler:|Es wird mindestens OS2.0 benötigt!"
  313. nogui="FinalWrapper-Fehler:|Konnte Requester nicht öffnen!"
  314. notnum="@g|Numerischer Wert erforderlich!"
  315. noreqtools="Konnte rexxreqtools.library nicht öffnen!"
  316. nohelp="Online Help nicht verfügbar!"
  317. rxcmderr="Unbekannter Arexx-Befehl|oder Syntaxfehler:|@c"
  318. rxfilerq="Arexx-Makro starten:"
  319. rxfileok="OK"
  320. about="FinalWrapper @v (@d)||Vorschläge & Fehler sind zu richten an:|    Andreas Weiss|    Dorfstrasse 24|    CH-8212 Nohl|    (Schweiz)||Dieses Programm ist SHAREWARE!|Die Gebühr beträgt sfr/DM 20 oder $15"
  321. arc=newgadget(2,"n",1,360,0,"ARC",0,9999)
  322. ltxt.arc.1="Nutze Sektor °: Uhrzeiger"
  323. ltxt.arc.2="Nutze Sektor °: Gegenuhrz."
  324. beg=newgadget(3,"p",0,0,0,"BEGIN",0,359)
  325. ltxt.beg.1="Position °: Absolut"
  326. ltxt.beg.2="Position °: Uhrzeigersinn"
  327. ltxt.beg.3="Position °: Gegenuhrzeiger"
  328. rot=newgadget(7,"r",0,0,0,"ROTATE",0,359)
  329. ltxt.rot.1="Rotation °: Absolut"
  330. ltxt.rot.2="Rotation °: Wie Textblock"
  331. ltxt.rot.3="Rotation °: Uhrzeigersinn"
  332. ltxt.rot.4="Rotation °: Gegenuhrzeiger"
  333. ltxt.rot.5="Rotation °: Delta Uhrz."
  334. ltxt.rot.6="Rotation °: Delta Gegenuhr"
  335. ltxt.rot.7="Rotation  : Titelmodus"
  336. dlt=newgadget(-4,"l",0,0,0,"DELETE")
  337. ltxt.dlt.1="Löschen: Nichts"
  338. ltxt.dlt.2="Löschen: Nur Oval"
  339. ltxt.dlt.3="Löschen: Oval und Textblock"
  340. ltxt.dlt.4="Löschen: Oval kopieren"
  341. grp=newgadget(-3,"g",0,0,0,"GROUP")
  342. ltxt.grp.1="Gruppieren: Nein"
  343. ltxt.grp.2="Gruppieren: Ausgewähltes Oval"
  344. ltxt.grp.3="Gruppieren: Unsichtbares Oval"
  345. wrd=newgadget(-4,"w",0,0,0,"WORDMODE")
  346. ltxt.wrd.1="Worte zusammen: Nein"
  347. ltxt.wrd.2="Worte zusammen: Zentriert"
  348. ltxt.wrd.3="Worte zusammen: Linksbündig"
  349. ltxt.wrd.4="Worte zusammen: Rechtsbündig"
  350. spl=newgadget(2,"s",0,25,0,"SPIRAL",1,100)
  351. ltxt.spl.1="Spirale %: Aussen -> innen"
  352. ltxt.spl.2="Spirale %: Innen -> aussen"
  353. siz=newgadget(2,"z",0,100,0,"SIZE",1,100)
  354. ltxt.siz.1="Zeichengröße %: Sinkend"
  355. ltxt.siz.2="Zeichengröße %: Steigend"
  356. zoo=newgadget(3,"v",0,50,0,"ZOOM",1,1000)
  357. ltxt.zoo.1="Vergrössern %: Alles"
  358. ltxt.zoo.2="Vergrössern %: Höhe"
  359. ltxt.zoo.3="Vergrössern %: Breite"
  360. ink=newgadget(-5,"f",0,0,0,"COLOUR")
  361. ltxt.ink.1="Farbe: Wie Text"
  362. ltxt.ink.2="Farbe: Wie Ovalfüllung"
  363. ltxt.ink.3="Farbe: Wie Ovalrahmen"
  364. ltxt.ink.4="Farbe: Schatten Füllfarbe"
  365. ltxt.ink.5="Farbe: Schatten Rahmenfarbe"
  366. adj=newgadget(-5,"k",0,0,0,"ADJUST")
  367. ltxt.adj.1="Korrigiere: Nichts"
  368. ltxt.adj.2="Korrigiere: Zeichengrösse"
  369. ltxt.adj.3="Korrigiere: Zeichenbreite"
  370. ltxt.adj.4="Korrigiere: Scheinbare Breite"
  371. ltxt.adj.5="Korrigiere: Sektorgrösse"
  372. adjarc=5
  373. pat=newgadget(0,"ü",0,0,0,"PATTERN")
  374. ltxt.pat="Übernehme Attribute von Auswahl"
  375. xgad=newstr(7,"x",1,"",1,"XPOS")
  376. ltxt.xgad="(@m) X:"
  377. ygad=newstr(7,"y",1,"",1,"YPOS")
  378. ltxt.ygad="Y:"
  379. wgad=newstr(7,"b",1,"",1,"WIDTH")
  380. ltxt.wgad="Breite:"
  381. hgad=newstr(7,"h",1,"",1,"HEIGHT")
  382. ltxt.hgad="Höhe:"
  383. pgad=newstr(4,"#",1,1,0,"PAGE")
  384. ltxt.pgad="# der Seite:"
  385. tgad=newstr(200,"t",2,"",2,"TEXT")
  386. ltxt.tgad="Text:"
  387. okgad=newbutton("  OK  ","o",RETURN,"OK")
  388. cancelgad=newbutton("Abbruch","a",esc,"CANCEL")
  389. closegad=newkey(del,"CLOSE")
  390. zipgad=newkey(" ","ZIP")
  391. depthgad=newkey(bs,"BACK")
  392. mtitle="Einstellungen"
  393. mgad=newchkitem("Gadgets aktivieren","G",1,"ACTIVATE")
  394. mspl=newchkitem("Korrigiere Sektor für Spiralen","K",1,"IMPROVE")
  395. mwin=newchkitem("Requester unter Mauszeiger","R",1,"WINDOW")
  396. mscr=newchkitem("Benutze Final Writers Screen","B",1,"SCREEN")
  397. mrel=newchkitem("Final Writer Version 3","F",1,"RELEASE")
  398. CALL newitem("","",mnode.0)
  399. mload=newitem("Laden","L","LOAD")
  400. msave=newitem("Sichern","S","SAVE")
  401. mres=newitem("Zurücksetzen","Z","RESET")
  402. mdef=newitem("Voreinstellungen","V","DEFAULTS")
  403. CALL newitem("","",mnode.0)
  404. mtext=newitem("Textblock-Einstellungen","T","TEXTPREFS")
  405. moval=newitem("Oval-Einstellungen","O","OVALPREFS")
  406. CALL newitem("","",mnode.0)
  407. mnext=newitem("Nächstes Dokument","N","NEXT")
  408. mrexx=newitem("Arexx-Makro starten...","A","MACRO")
  409. mhelp=newitem("Hilfe...","H","HELP")
  410. mabt=newitem("Über...","?","ABOUT")
  411. fwerrtext.5="Befehl schlug fehl"
  412. fwerrtext.10="Befehl gescheitert"
  413. fwerrtext.20="Ungültige Argumente"
  414. fwerrtext.100="Befehl unbekannt"
  415. fwerrtext.200="Kann fwarexx.library nicht öffnen"
  416. END
  417. ELSE
  418. IF language="italiano" THEN 
  419. DO
  420. measure.1="?"
  421. measure.2="Poll."
  422. measure.3="cm"
  423. measure.4="Pica"
  424. docname="FinalWrapperSmallI.Guide"
  425. origwintitle="@i - @f"
  426. origscrtitle="@i - @f"
  427. unnamed="SenzaNome"
  428. defwinx=0
  429. defwiny=0
  430. aborttitle="<- Interrompi"
  431. busytitle="@i - Attendi, sto calcolando..."
  432. gnode.0="REQUESTER"
  433. mnode.0="MENU"
  434. stdbut="OK"
  435. errtext="FinalWrapper fallito:|@t|alla linea @l:|<@s>|(errornumber @n)"
  436. noselect="FinalWrapper fallito:|Prima seleziona un oggetto|e un textblock (o del testo)|oppure inserisci i valori|nelle caselle"
  437. nolib="FinalWrapper failed:|Non si può aprire '@y'"
  438. nofw="Eseguire prima Final Writer!"
  439. wrongos="FinalWrapper fallito:|E' richiesto almeno OS2.0!"
  440. nogui="FinalWrapper fallito:|Non si può aprire il requester!"
  441. notnum="@g|Occorre un valore numerico!"
  442. noreqtools="Rexxreqtools.library non trovata!"
  443. nohelp="Help in linea non disponibile!"
  444. rxcmderr="Comando Arexx sconosciuto|o errore di sintassi:|@c"
  445. rxfilerq="Esecuzione macro Arexx:"
  446. rxfileok="OK"
  447. about="FinalWrapper @v (@d)||Per consigli e bugs scrivere a:|    Andreas Weiss|   Dorfstrasse 24|    CH-8212 Nohl|    (Switzerland)|Il programma è SHAREWARE!|($15 o sfr/DM 20)"
  448. arc=newgadget(2,"u",1,360,0,"ARC",0,9999)
  449. ltxt.arc.1="Usa arco °: In s.orario"
  450. ltxt.arc.2="Usa arco °: In s.antiorar."
  451. beg=newgadget(3,"i",0,0,0,"BEGIN",0,359)
  452. ltxt.beg.1="Inizio °: In assoluti"
  453. ltxt.beg.2="Inizio °: In s.orario"
  454. ltxt.beg.3="Inizio °: In s.antiorario"
  455. rot=newgadget(7,"r",0,0,0,"ROTATE",0,359)
  456. ltxt.rot.1="Ruota °: Angolo fisso"
  457. ltxt.rot.2="Ruota °: Come textblock"
  458. ltxt.rot.3="Ruota °: In s.orario"
  459. ltxt.rot.4="Ruota °: In s.antiorario"
  460. ltxt.rot.5="Ruota °: Incremento orar."
  461. ltxt.rot.6="Ruota °: Incremento anti."
  462. ltxt.rot.7="Ruota °: Modo del titolo"
  463. dlt=newgadget(-4,"e",0,0,0,"DELETE")
  464. ltxt.dlt.1="Elimina: Niente"
  465. ltxt.dlt.2="Elimina: Solo ovale"
  466. ltxt.dlt.3="Elimina: Ovale e textblock"
  467. ltxt.dlt.4="Elimina: Copia ovale"
  468. grp=newgadget(-3,"g",0,0,0,"GROUP")
  469. ltxt.grp.1="Gruppo: No"
  470. ltxt.grp.2="Gruppo: Ovale selezionato"
  471. ltxt.grp.3="Gruppo: Ovale nascosto"
  472. wrd=newgadget(-4,"w",0,0,0,"WORDMODE")
  473. ltxt.wrd.1="Non piegare le parole: No"
  474. ltxt.wrd.2="Non piegare le parole: Centro"
  475. ltxt.wrd.3="Non piegare le parole: Sinistra"
  476. ltxt.wrd.4="Non piegare le parole: Destra"
  477. spl=newgadget(2,"s",0,25,0,"SPIRAL",1,100)
  478. ltxt.spl.1="Spirale %: Verso l'interno"
  479. ltxt.spl.2="Spirale %: Verso l'esterno"
  480. siz=newgadget(2,"d",0,100,0,"SIZE",1,100)
  481. ltxt.siz.1="Dim. font %: Decrescente"
  482. ltxt.siz.2="Dim. font %: Crescente"
  483. zoo=newgadget(3,"z",0,50,0,"ZOOM",1,1000)
  484. ltxt.zoo.1="Zoom %: Tutto"
  485. ltxt.zoo.2="Zoom %: Altezza"
  486. ltxt.zoo.3="Zoom %: Larghezza"
  487. ink=newgadget(-5,"c",0,0,0,"COLOUR")
  488. ltxt.ink.1="Colore: Del testo"
  489. ltxt.ink.2="Colore: Riempimento ovale"
  490. ltxt.ink.3="Colore: Bordo dell'ovale"
  491. ltxt.ink.4="Colore: Ombra = riempim. ovale"
  492. ltxt.ink.5="Colore: Ombra = bordo ovale"
  493. adj=newgadget(-5,"m",0,0,0,"ADJUST")
  494. ltxt.adj.1="Modella: Niente"
  495. ltxt.adj.2="Modella: Dim. caratteri"
  496. ltxt.adj.3="Modella: Largh. caratteri"
  497. ltxt.adj.4="Modella: Largh. apparente"
  498. ltxt.adj.5="Modella: Arco"
  499. adjarc=5
  500. pat=newgadget(0,"p",0,0,0,"PATTERN")
  501. ltxt.pat="Prendi stile del testo selezionato"
  502. xgad=newstr(7,"x",1,"",1,"XPOS")
  503. ltxt.xgad="(@m) X:"
  504. ygad=newstr(7,"y",1,"",1,"YPOS")
  505. ltxt.ygad="Y:"
  506. wgad=newstr(7,"l",1,"",1,"WIDTH")
  507. ltxt.wgad="Largh:"
  508. hgad=newstr(7,"a",1,"",1,"HEIGHT")
  509. ltxt.hgad="Alt:"
  510. pgad=newstr(4,"#",1,1,0,"PAGE")
  511. ltxt.pgad="# di pag.:"
  512. tgad=newstr(200,"t",2,"",2,"TEXT")
  513. ltxt.tgad="Testo:"
  514. okgad=newbutton("  OK  ","o",RETURN,"OK")
  515. cancelgad=newbutton("Annulla","q",esc,"CANCEL")
  516. closegad=newkey(del,"CLOSE")
  517. zipgad=newkey(" ","ZIP")
  518. depthgad=newkey(bs,"BACK")
  519. mtitle="Impostazioni"
  520. mgad=newchkitem("Auto-attiva caselle valori","A",1,"ACTIVATE")
  521. mspl=newchkitem("Modella Arco per spirali","M",1,"IMPROVE")
  522. mwin=newchkitem("Pannello sotto al pointer","P",1,"WINDOW")
  523. mscr=newchkitem("Usa schermo di Final Writer","U",1,"SCREEN")
  524. mrel=newchkitem("Final Writer Release 3","F",1,"RELEASE")
  525. CALL newitem("","",mnode.0)
  526. mload=newitem("Carica","C","LOAD")
  527. msave=newitem("Salva","S","SAVE")
  528. mres=newitem("Ripristina ultime impostazioni","R","RESET")
  529. mdef=newitem("Impostazioni predefinite","I","DEFAULTS")
  530. CALL newitem("","",mnode.0)
  531. mtext=newitem("Text blocks settings","T","TEXTPREFS")
  532. moval=newitem("Oval settings","O","OVALPREFS")
  533. CALL newitem("","",mnode.0)
  534. mnext=newitem("Documento successivo","D","NEXT")
  535. mrexx=newitem("Esegui macro Arexx...","E","MACRO")
  536. mhelp=newitem("Help...","H","HELP")
  537. mabt=newitem("Notizie...","?","ABOUT")
  538. fwerrtext.5="Instruction didn't succeed"
  539. fwerrtext.10="Istruzione fallita"
  540. fwerrtext.20="Argomenti non validi"
  541. fwerrtext.100="Istruzione sconosciuta"
  542. fwerrtext.200="Couldn't open fwarexx.library"
  543. END
  544. ELSE 
  545. DO
  546. measure.1="?"
  547. measure.2="Inch"
  548. measure.3="cm"
  549. measure.4="Pica"
  550. docname="FinalWrapperSmall.Guide"
  551. origwintitle="@i - @f"
  552. origscrtitle="@i - @f"
  553. unnamed="Unnamed"
  554. defwinx=0
  555. defwiny=0
  556. aborttitle="<- Abort"
  557. busytitle="@i - Busy working, please wait..."
  558. gnode.0="REQUESTER"
  559. mnode.0="MENU"
  560. stdbut="OK"
  561. errtext="FinalWrapper failed:|@t|in line @l:|<@s>|(errornumber @n)"
  562. noselect="FinalWrapper failed:|First select an object and|a text block or some text|or enter the values in the|appropriate gadgets!"
  563. nolib="FinalWrapper failed:|Couldn't open '@y'"
  564. nofw="Run Final Writer first!"
  565. wrongos="FinalWrapper failed:|At least OS2.0 is required!"
  566. nogui="FinalWrapper failed:|Couldn't open requester!"
  567. notnum="@g|Value must be numeric!"
  568. noreqtools="Couldn't open rexxreqtools.library!"
  569. nohelp="On-line help not available!"
  570. rxcmderr="Unknown Arexx command|or syntax error:|@c"
  571. rxfilerq="Execute Arexx macro:"
  572. rxfileok="OK"
  573. about="FinalWrapper @v (@d)||For suggestions & bugs write to:|    Andreas Weiss|    Dorfstrasse 24|    CH-8212 Nohl|    (Switzerland)||This program is SHAREWARE!|The share is sfr/DM 20 or $15"
  574. arc=newgadget(2,"u",1,360,0,"ARC",0,9999)
  575. ltxt.arc.1="Use arc °: Clockwise"
  576. ltxt.arc.2="Use arc °: Anticlockwise"
  577. beg=newgadget(3,"b",0,0,0,"BEGIN",0,359)
  578. ltxt.beg.1="Begin °: Absolute"
  579. ltxt.beg.2="Begin °: Clockwise"
  580. ltxt.beg.3="Begin °: Anticlockwise"
  581. rot=newgadget(7,"r",0,0,0,"ROTATE",0,359)
  582. ltxt.rot.1="Rotate °: Absolute"
  583. ltxt.rot.2="Rotate °: Like text block"
  584. ltxt.rot.3="Rotate °: Clockwise"
  585. ltxt.rot.4="Rotate °: Anticlockwise"
  586. ltxt.rot.5="Rotate °: Delta clockwise"
  587. ltxt.rot.6="Rotate °: Delta anticlock"
  588. ltxt.rot.7="Rotate  : Title mode"
  589. dlt=newgadget(-4,"d",0,0,0,"DELETE")
  590. ltxt.dlt.1="Delete: Nothing"
  591. ltxt.dlt.2="Delete: Oval only"
  592. ltxt.dlt.3="Delete: Oval and text block"
  593. ltxt.dlt.4="Delete: Copy oval"
  594. grp=newgadget(-3,"g",0,0,0,"GROUP")
  595. ltxt.grp.1="Group: No"
  596. ltxt.grp.2="Group: Selected oval"
  597. ltxt.grp.3="Group: Invisible oval"
  598. wrd=newgadget(-4,"j",0,0,0,"WORDMODE")
  599. ltxt.wrd.1="Join words: No"
  600. ltxt.wrd.2="Join words: Centered"
  601. ltxt.wrd.3="Join words: Align left"
  602. ltxt.wrd.4="Join words: Align right"
  603. spl=newgadget(2,"s",0,25,0,"SPIRAL",1,100)
  604. ltxt.spl.1="Spiral %: Outside > inside"
  605. ltxt.spl.2="Spiral %: Inside > outside"
  606. siz=newgadget(2,"f",0,100,0,"SIZE",1,100)
  607. ltxt.siz.1="Font size %: Decreasing"
  608. ltxt.siz.2="Font size %: Increasing"
  609. zoo=newgadget(3,"z",0,50,0,"ZOOM",1,1000)
  610. ltxt.zoo.1="Zoom %: All"
  611. ltxt.zoo.2="Zoom %: Height"
  612. ltxt.zoo.3="Zoom %: Width"
  613. ink=newgadget(-5,"i",0,0,0,"COLOUR")
  614. ltxt.ink.1="Ink: From text"
  615. ltxt.ink.2="Ink: From oval fill"
  616. ltxt.ink.3="Ink: From oval border"
  617. ltxt.ink.4="Ink: Shadow = oval fill"
  618. ltxt.ink.5="Ink: Shadow = oval border"
  619. adj=newgadget(-5,"a",0,0,0,"ADJUST")
  620. ltxt.adj.1="Adjust: Nothing"
  621. ltxt.adj.2="Adjust: Character size"
  622. ltxt.adj.3="Adjust: Character width"
  623. ltxt.adj.4="Adjust: Apparent width"
  624. ltxt.adj.5="Adjust: Arc"
  625. adjarc=5
  626. pat=newgadget(0,"p",0,0,0,"PATTERN")
  627. ltxt.pat="Pattern from selected text"
  628. xgad=newstr(7,"x",1,"",1,"XPOS")
  629. ltxt.xgad="(@m) X:"
  630. ygad=newstr(7,"y",1,"",1,"YPOS")
  631. ltxt.ygad="Y:"
  632. wgad=newstr(7,"w",1,"",1,"WIDTH")
  633. ltxt.wgad="Width:"
  634. hgad=newstr(7,"h",1,"",1,"HEIGHT")
  635. ltxt.hgad="Height:"
  636. pgad=newstr(4,"#",1,1,0,"PAGE")
  637. ltxt.pgad="# of page:"
  638. tgad=newstr(200,"t",2,"",2,"TEXT")
  639. ltxt.tgad="Text:"
  640. okgad=newbutton("  OK  ","o",RETURN,"OK")
  641. cancelgad=newbutton("Cancel","c",esc,"CANCEL")
  642. closegad=newkey(del,"CLOSE")
  643. zipgad=newkey(" ","ZIP")
  644. depthgad=newkey(bs,"BACK")
  645. mtitle="Settings"
  646. mgad=newchkitem("Gadgets are auto-activated","G",1,"ACTIVATE")
  647. mspl=newchkitem("Adjust arc for spirals","A",1,"IMPROVE")
  648. mwin=newchkitem("Window beneath pointer","W",1,"WINDOW")
  649. mscr=newchkitem("Use Final Writer's screen","U",1,"SCREEN")
  650. mrel=newchkitem("Final Writer Release 3","F",1,"RELEASE")
  651. CALL newitem("","",mnode.0)
  652. mload=newitem("Load","L","LOAD")
  653. msave=newitem("Save","S","SAVE")
  654. mres=newitem("Reset","R","RESET")
  655. mdef=newitem("Defaults","D","DEFAULTS")
  656. CALL newitem("","",mnode.0)
  657. mtext=newitem("Text block preferences","T","TEXTPREFS")
  658. moval=newitem("Oval preferences","O","OVALPREFS")
  659. CALL newitem("","",mnode.0)
  660. mnext=newitem("Next Document","N","NEXT")
  661. mrexx=newitem("Execute Arexx macro...","E","MACRO")
  662. mhelp=newitem("Help...","H","HELP")
  663. mabt=newitem("About...","?","ABOUT")
  664. fwerrtext.5="Instruction didn't succeed"
  665. fwerrtext.10="Instruction failed"
  666. fwerrtext.20="Invalid arguments"
  667. fwerrtext.100="Unknown instruction"
  668. fwerrtext.200="Couldn't open fwarexx.library"
  669. END
  670. RETURN
  671. checkenv: 
  672. about=replacepat(replacepat(about,"@v",version),"@d",date)
  673. info=replacepat(replacepat("FinalWrapper @v by NDY's","@v",version),"@d",date)
  674. origwintitle=replacepat(origwintitle,"@i",info)
  675. origscrtitle=replacepat(origscrtitle,"@i",info)
  676. wtitle=origwintitle
  677. stitle=origscrtitle
  678. busytitle=replacepat(busytitle,"@i",info)
  679. doc=""
  680. CALL newdoc
  681. menus=mchks+macts
  682. gads=agads+tgads+sgads
  683. kgads=gads+wgads
  684. menuoff=kgads
  685. i=32+menuoff
  686. mnode.i=mnode.0
  687. prefsize=agads*4+mchks+4
  688. prefsid="FW30"||D2C(prefsize,2)
  689. tempsize=0
  690. IF temp~="" THEN
  691. DO id=agads+1 TO agads+sgads
  692. tempsize=tempsize+len.id
  693. END
  694. cancelclose=cancelgad-agads
  695. okclose=okgad-agads
  696. winclose=tgads+1
  697. rxclose=winclose+1
  698. nextclose=rxclose+1
  699. DO id=1 TO kgads
  700. IF ~Datatype(lkey.id,"W") THEN lkey.id=C2D(Upper(lkey.id))
  701. END
  702. IF initerr=14 THEN
  703. DO
  704. ln=replacepat(nolib,"@y",library.libn)
  705. CALL message(14,ln)
  706. CALL bye(14)
  707. END
  708. execbase=GETVALUE("4"x,0,4,"P")
  709. osversion=GETVALUE(execbase,20,2,"N")
  710. IF osversion<37 THEN CALL message(10,wrongos)
  711. IF ~xexists(fwkey) THEN fwkey=""
  712. IF help THEN
  713. DO
  714. docfile="HELP:"||language||"/"||docname
  715. IF ~xexists(docfile) THEN
  716. DO
  717. docfile="ENVARC:FinalWrapper/"||docname
  718. IF ~xexists(docfile) THEN help=0
  719. END
  720. END
  721. RETURN
  722. guiinit: 
  723. IF cleangui THEN RETURN 0
  724. pubscr=Null() ; scr=Null() ; win=Null() ; gad=Null() ; scrvinfo=Null() ; menu=Null() ; port=0 ; menustrip=0
  725. cleangui=1
  726. CALL SET_APIG_GLOBALS()
  727. GT_TAGBASE=X2D("80080000")
  728. GTMN_NEWLOOKMENUS=X2C("80080043")
  729. GTCB_SCALED=X2C("80080044")
  730. WA_NEWLOOKMENUS=X2C("80000093")
  731. nullbyte=D2C(0)
  732. port=OpenPort(portname)
  733. IF ~port THEN RETURN 5
  734. pubscr=LockPubScreen("")
  735. IF pubscr=Null() THEN RETURN 5
  736. IF pubonly THEN
  737. scr=pubscr
  738. ELSE
  739. scr=customscr
  740. scrvinfo=GetVisualInfo(scr)
  741. IF scrvinfo=Null() THEN RETURN 5
  742. scrfont=GETVALUE(scr,40,4,"P")
  743. fonth=GETVALUE(scrfont,4,2,"N")
  744. scrrp=D2C(C2D(scr)+84)
  745. glistptr=MAKEPOINTER(0,0,4,MEMF_CLEAR)
  746. IF glistptr=Null() THEN RETURN 5
  747. borderl=GETVALUE(scr,36,1,"N")
  748. borderr=GETVALUE(scr,37,1,"N")
  749. bordert=GETVALUE(scr,35,1,"N")+fonth+1
  750. pubname=""
  751. pubnptr=MAKEPOINTER(0,0,MAXPUBSCREENNAME,MEMF_CLEAR)
  752. IF pubnptr~=Null() THEN
  753. DO
  754. checkscr=GetDefaultPubScreen(pubnptr)
  755. IF checkscr=pubscr THEN pubname=Import(pubnptr)
  756. CALL FREETHIS(pubnptr)
  757. END
  758. IF pubname="" THEN
  759. DO
  760. pubname="Workbench"
  761. usewb=1
  762. END
  763. ELSE
  764. usewb=0
  765. rows=2
  766. gadh=fonth+4
  767. gaddy=gadh+2
  768. DO i=1 TO 3+slines
  769. maxwidth.i=0
  770. END
  771. charw=TextLength(scrrp,"W"||nullbyte,-1) 
  772. intw=charw*4+12   
  773. strminw=charw*2+6
  774. addwidth=30+intw
  775. gperrow=agads%rows+agads//rows
  776. DO id=1 TO agads
  777. k=1+(id>gperrow)
  778. IF labs.id=0 THEN
  779. DO
  780. gwid.id=TextLength(scrrp,ltxt.id||nullbyte,-1)+34
  781. maxwidth.k=Max(maxwidth.k,gwid.id)
  782. END
  783. ELSE
  784. DO
  785. glabels.id=MAKEPOINTER(0,0,4*Abs(labs.id)+4,MEMF_CLEAR)
  786. IF glabels.id=Null() THEN RETURN 5
  787. DO i=1 TO Abs(labs.id) 
  788. lbuf.id.i=MAKEPOINTER(glabels.id,0,Length(ltxt.id.i)+1,MEMF_CLEAR)
  789. IF lbuf.id.i=Null() THEN RETURN 5
  790. CALL Export(lbuf.id.i,ltxt.id.i)
  791. CALL SETVALUE(glabels.id,(i-1)*4,4,"P",lbuf.id.i)
  792. xwid=TextLength(scrrp,ltxt.id.i||nullbyte,-1)+30
  793. IF labs.id>0 THEN xwid=xwid+addwidth
  794. maxwidth.k=Max(maxwidth.k,xwid)
  795. END
  796. END
  797. END
  798. DO i=1 TO slines
  799. nsgads.i=0
  800. END
  801. DO id=agads+1 TO agads+sgads
  802. gwid.id=TextLength(scrrp,ltxt.id||nullbyte,-1)
  803. lin=line.id
  804. maxnr=3+lin
  805. maxwidth.maxnr=maxwidth.maxnr+gwid.id+strminw+12
  806. nsgads.lin=nsgads.lin+1
  807. END
  808. DO id=agads+sgads+1 TO gads
  809. gwid.id=TextLength(scrrp,ltxt.id||nullbyte,-1)+6
  810. maxwidth.3=maxwidth.3+gwid.id+2
  811. END
  812. maxwidth=Max((Max(maxwidth.1,maxwidth.2)+4)*rows-4,maxwidth.3)
  813. DO i=4 TO slines+3
  814. maxwidth=Max(maxwidth,maxwidth.i)
  815. END
  816. winwid=maxwidth+4
  817. winhi=(gperrow+1+slines)*gaddy+6
  818. gadx=borderl+2
  819. gady=bordert+1
  820. gadw=maxwidth%rows-rows*2+2
  821. gadmaxx=winwid+borderl-2
  822. gadmaxy=winhi+bordert-1
  823. id=0
  824. gx=gadx
  825. cyx=gx
  826. chkx=gx+gadw-26
  827. intx=gx+gadw-28-intw
  828. textplace=PLACETEXT_LEFT
  829. DO i=0 TO 1
  830. DO j=0 TO gperrow-1 WHILE id<agads
  831. id=i*gperrow+j+1
  832. gadid=id*3
  833. IF labs.id>0 THEN
  834. DO
  835. newgadx.id=MAKENEWGADGET(scrvinfo,scrfont,gx,gady+j*gaddy,gadw-addwidth,gadh,"",0,gadid,Null())
  836. newgadxb.id=MAKENEWGADGET(scrvinfo,scrfont,chkx,gady+j*gaddy,26,gadh,"",0,gadid+1,Null())
  837. newgadxi.id=MAKENEWGADGET(scrvinfo,scrfont,intx,gady+j*gaddy,intw,gadh,"",0,gadid+2,Null())
  838. IF newgadxb.id=Null() | newgadxi.id=Null() | newgadx.id=Null() THEN RETURN 5
  839. END
  840. ELSE
  841. DO
  842. IF labs.id<0 THEN
  843. newgadx.id=MAKENEWGADGET(scrvinfo,scrfont,cyx,gady+j*gaddy,gadw,gadh,"",0,id*3,Null())
  844. ELSE
  845. newgadx.id=MAKENEWGADGET(scrvinfo,scrfont,chkx,gady+j*gaddy,26,gadh,ltxt.id,textplace,id*3+1,Null())
  846. IF newgadx.id=Null() THEN RETURN 5
  847. END
  848. END
  849. chkx=gadmaxx-gadw
  850. intx=chkx+28
  851. gx=chkx+addwidth
  852. cyx=chkx
  853. textplace=PLACETEXT_RIGHT
  854. END
  855. gy=gady+gaddy*gperrow
  856. DO i=1 TO slines
  857. gx=gadx
  858. maxnr=i+3
  859. strw=(maxwidth-maxwidth.maxnr)%(nsgads.i)+strminw
  860. DO id=agads+1 TO agads+sgads
  861. IF line.id=i THEN
  862. DO
  863. nsgads.i=nsgads.i-1
  864. IF nsgads.i=0 THEN strw=gadmaxx-(gx+gwid.id+8)
  865. newgadx.id=MAKENEWGADGET(scrvinfo,scrfont,gx+gwid.id+8,gy,strw,gadh,ltxt.id,PLACETEXT_LEFT,id*3+2,Null())
  866. gx=gx+gwid.id+strw+12
  867. IF newgadx.id=Null() THEN RETURN 5
  868. END
  869. END
  870. gy=gy+gaddy
  871. END
  872. gx=gadx+(maxwidth-maxwidth.3)%2
  873. DO id=agads+sgads+1 TO gads
  874. newgadx.id=MAKENEWGADGET(scrvinfo,scrfont,gx,gadmaxy-gadh,gwid.id,gadh,ltxt.id,PLACETEXT_IN,id*3,Null())
  875. gx=gx+gwid.id+4
  876. IF newgadx.id=Null() THEN RETURN 5
  877. END
  878. newgadbv=MAKENEWGADGET(scrvinfo,scrfont,gadx,gadmaxy-gadh-5,maxwidth,2,0,0,Null())
  879. gad=CreateContext(glistptr)
  880. prev=gad
  881. DO id=1 TO gads
  882. IF id>agads THEN
  883. IF id>agads+sgads THEN
  884. DO
  885. checkgad.id=CreateGadget(BUTTON_KIND,prev,newgadx.id,TAG_DONE,0)
  886. prev=checkgad.id
  887. END
  888. ELSE
  889. DO
  890. IF gtype.id=0 THEN
  891. intgad.id=CreateGadget(INTEGER_KIND,prev,newgadx.id,GTIN_NUMBER,val.id,GTIN_MAXCHARS,len.id,STRINGA_EXITHELP,1,TAG_DONE,0)
  892. ELSE
  893. intgad.id=CreateGadget(STRING_KIND,prev,newgadx.id,GTST_STRING,val.id,GTST_MAXCHARS,len.id,STRINGA_EXITHELP,1,TAG_DONE,0)
  894. prev=intgad.id
  895. END
  896. ELSE
  897. IF labs.id=0 THEN
  898. DO
  899. checkgad.id=CreateGadget(CHECKBOX_KIND,prev,newgadx.id,GTCB_CHECKED,check.id,GTCB_SCALED,-1,TAG_DONE,0)
  900. prev=checkgad.id
  901. END
  902. ELSE
  903. IF labs.id>0 THEN
  904. DO
  905. checkgad.id=CreateGadget(CHECKBOX_KIND,prev,newgadxb.id,GTCB_CHECKED,check.id,GTCB_SCALED,-1,TAG_DONE,0)
  906. intgad.id=CreateGadget(INTEGER_KIND,checkgad.id,newgadxi.id,GTIN_NUMBER,val.id,GTIN_MAXCHARS,4,STRINGA_EXITHELP,1,TAG_DONE,0)
  907. cyclegad.id=CreateGadget(CYCLE_KIND,intgad.id,newgadx.id,GTCY_LABELS,glabels.id,GTCY_ACTIVE,cycle.id,TAG_DONE,0)
  908. prev=cyclegad.id
  909. END
  910. ELSE
  911. DO
  912. cyclegad.id=CreateGadget(CYCLE_KIND,prev,newgadx.id,GTCY_LABELS,glabels.id,GTCY_ACTIVE,cycle.id,TAG_DONE,0)
  913. prev=cyclegad.id
  914. END
  915. END
  916. prev=CreateGadget(TEXT_KIND,prev,newgadbv,GTTX_BORDER,-1,TAG_DONE,0)
  917. IF prev=Null() THEN RETURN 5 
  918. mptr=MAKENEWMENU(menus)
  919. IF mptr=Null() THEN RETURN 5
  920. CALL ADDTO_NEWMENU(mptr,NM_TITLE,mtitle,"",0,0,Null())
  921. DO i=1 TO menus
  922. n=menuoff+i
  923. IF ltxt.n="" THEN
  924. mtxt=NM_BARLABEL
  925. ELSE
  926. mtxt=ltxt.n
  927. IF i>mchks THEN
  928. flags=MENUTOGGLE
  929. ELSE
  930. flags=CHECKED*check.n+CHECKIT+MENUTOGGLE
  931. IF Length(mkey.n)~=1 THEN mkey.n=""
  932. CALL ADDTO_NEWMENU(mptr,NM_ITEM,mtxt,mkey.n,flags,0,Null())
  933. END
  934. DROP ltxt
  935. CALL ADDTO_NEWMENU(mptr,NM_END,"","",0,0,Null())
  936. menu=CreateMenus(mptr,TAG_DONE,0)
  937. IF menu=Null() THEN RETURN 5
  938. IF LayoutMenus(menu,scrvinfo,GTMN_NEWLOOKMENUS,-1,TAG_DONE,0)=0 THEN RETURN 5
  939. winidcmp=IDCMP_CHANGEWINDOW+IDCMP_CLOSEWINDOW+IDCMP_GADGETUP+IDCMP_ACTIVEWINDOW+IDCMP_MOUSEBUTTONS+IDCMP_MENUPICK+IDCMP_VANILLAKEY+IDCMP_RAWKEY+IDCMP_MENUHELP
  940. winflags=WFLG_CLOSEGADGET+WFLG_DEPTHGADGET+WFLG_DRAGBAR+WFLG_ACTIVATE
  941. IF check.mwin THEN
  942. DO
  943. ymouse=GETVALUE(scr,16,2,"N")
  944. xmouse=GETVALUE(scr,18,2,"N")
  945. END
  946. ELSE
  947. DO
  948. ymouse=winx+winhi/2
  949. xmouse=winy+winwid/2
  950. END
  951. wtagl=MAKEPOINTER(0,0,104+8,MEMF_CLEAR)
  952. IF wtagl=Null() THEN RETURN 5
  953. wname=MAKEPOINTER(wtagl,0,Length(wintitle)+1,MEMF_CLEAR)
  954. IF wname=Null() THEN RETURN 5
  955. CALL Export(wname,wintitle)
  956. sname=MAKEPOINTER(wtagl,0,Length(scrtitle)+1,MEMF_CLEAR)
  957. IF sname=Null() THEN RETURN 5
  958. CALL Export(sname,scrtitle)
  959. wzipdims=MAKEPOINTER(wtagl,0,8,MEMF_CLEAR)
  960. IF wzipdims=Null() THEN RETURN 5
  961. zipwid=winwid+borderl+borderr
  962. ziphi=bordert
  963. CALL SETVALUE(wzipdims,4,2,"N",zipwid)
  964. CALL SETVALUE(wzipdims,6,2,"N",ziphi)
  965. CALL SETTAGSLOT(wtagl,0,WA_LEFT,"N",Max(xmouse-winwid/2,0))
  966. CALL SETTAGSLOT(wtagl,1,WA_TOP,"N",Max(ymouse-winhi/2,0))
  967. CALL SETTAGSLOT(wtagl,2,WA_INNERWIDTH,"N",winwid)
  968. CALL SETTAGSLOT(wtagl,3,WA_INNERHEIGHT,"N",winhi)
  969. CALL SETTAGSLOT(wtagl,4,WA_IDCMP,"N",winidcmp)
  970. CALL SETTAGSLOT(wtagl,5,WA_FLAGS,"N",winflags)
  971. CALL SETTAGSLOT(wtagl,6,WA_TITLE,"P",wname)
  972. CALL SETTAGSLOT(wtagl,7,WA_SCREENTITLE,"P",sname)
  973. CALL SETTAGSLOT(wtagl,8,WA_GADGETS,"P",gad)
  974. IF pubonly THEN
  975. CALL SETTAGSLOT(wtagl,9,WA_PUBSCREEN,"P",scr)
  976. ELSE
  977. CALL SETTAGSLOT(wtagl,9,WA_CUSTOMSCREEN,"P",scr)
  978. CALL SETTAGSLOT(wtagl,10,WA_ZOOM,"P",wzipdims)
  979. CALL SETTAGSLOT(wtagl,11,WA_NEWLOOKMENUS,"N",-1)
  980. CALL SETTAGSLOT(wtagl,12,WA_MENUHELP,"N",-1)
  981. CALL SETTAGSLOT(wtagl,13,TAG_DONE,"N",0)
  982. win=OpenWindowTagList(portname,Null(),wtagl,0)
  983. IF win=Null() THEN RETURN 5
  984. rp=GETWINDOWRASTPORT(win)
  985. dwid=GETVALUE(win,8,2,"N")-zipwid
  986. dhi=GETVALUE(win,10,2,"N")-ziphi
  987. CALL GT_RefreshWindow(win,Null())
  988. CALL SetMenuStrip(win,menu)
  989. menustrip=1
  990. zoomed=1
  991. RETURN 0
  992. messy: 
  993. IF port=0 THEN RETURN
  994. DO FOREVER
  995. msg=GetPkt(portname)
  996. IF msg=Null() THEN LEAVE
  997. msgclass=GetArg(msg,0)
  998. zipped=GETVALUE(win,10,2,"N")=ziphi
  999. IF ~Datatype(msgclass,"W") THEN
  1000. CALL rx
  1001. ELSE
  1002. DO
  1003. code=GetArg(msg,1)
  1004. qual=GetArg(msg,2)
  1005. gadid=GetArg(msg,9)
  1006. CALL Reply(msg,0)
  1007. END
  1008. actgads=check.mgad & ~zipped
  1009. nospiral=~check.spl
  1010. IF msgclass=IDCMP_VANILLAKEY THEN
  1011. DO
  1012. code=C2D(Upper(D2C(code)))
  1013. DO id=1 TO kgads
  1014. IF code=lkey.id | code=lkey2.id THEN
  1015. DO
  1016. IF id=zipgad THEN
  1017. DO
  1018. CALL ZipWindow(win)
  1019. LEAVE
  1020. END
  1021. ELSE
  1022. IF id=depthgad THEN
  1023. DO
  1024. windowpos=~windowpos
  1025. IF windowpos THEN
  1026. CALL WindowToBack(win)
  1027. ELSE
  1028. CALL WindowToFront(win)
  1029. LEAVE
  1030. END
  1031. ELSE
  1032. IF id>agads+sgads THEN
  1033. DO
  1034. closed=id-agads
  1035. LEAVE
  1036. END
  1037. IF ~zipped THEN
  1038. DO
  1039. msgclass=IDCMP_GADGETUP
  1040. type=(qual//4)//3
  1041. IF labs.id=0 THEN type=1
  1042. IF labs.id<0 THEN type=0
  1043. IF id>agads THEN type=2
  1044. gadid=id*3+type
  1045. IF type=2 | (actgads & ~(check.id & type=1)) THEN CALL ActivateGadget(intgad.id,win,Null())
  1046. IF type=1 THEN code=~check.id
  1047. IF labs.id>=0 & type=1 THEN CALL GT_SetGadgetAttrs(checkgad.id,win,Null(),GTCB_CHECKED,code)
  1048. IF type=0 THEN code=(cycle.id+1)//Abs(labs.id)
  1049. IF labs.id~=0 & type=0 THEN CALL GT_SetGadgetAttrs(cyclegad.id,win,Null(),GTCY_ACTIVE,code)
  1050. LEAVE
  1051. END
  1052. END
  1053. END
  1054. END
  1055. SELECT
  1056. WHEN msgclass=IDCMP_CLOSEWINDOW THEN closed=winclose
  1057. WHEN msgclass=IDCMP_MENUPICK THEN
  1058. DO
  1059. mnr=(code%32)//32+1
  1060. n=menuoff+mnr
  1061. IF mnr<=mchks THEN check.n=~check.n
  1062. SELECT
  1063. WHEN n=mload THEN
  1064. CALL loaddef(2)
  1065. WHEN n=msave THEN
  1066. CALL savedef(2)
  1067. WHEN n=mres THEN
  1068. CALL loaddef(1)
  1069. WHEN n=mdef THEN
  1070. CALL loaddef(0)
  1071. WHEN n=mabt THEN
  1072. CALL message(0,about)
  1073. WHEN n=mtext THEN
  1074. IF portok THEN
  1075. DO
  1076. resume="BACKMESSY"
  1077. errtrap=10
  1078. TextBlockPrefs "PROMPT"
  1079. END
  1080. WHEN n=moval THEN
  1081. IF portok THEN
  1082. DO
  1083. resume="BACKMESSY"
  1084. errtrap=10
  1085. OvalPrefs "PROMPT"
  1086. END
  1087. WHEN n=mnext THEN
  1088. DO
  1089. x=SubStr(rxport,Length(finalw)+1)
  1090. i=x
  1091. DO UNTIL Show("P",rxport) | i=x
  1092. i=i//20+1
  1093. rxport=finalw||i
  1094. END
  1095. IF x~=i THEN closed=nextclose
  1096. END
  1097. WHEN n=mrexx THEN
  1098. IF lib.reqtools THEN
  1099. DO
  1100. i=Max(Pos(defdir,':'),LastPos('/',defdir))
  1101. resume="BACKMESSY"
  1102. errtrap=14
  1103. newdir=RTFileRequest(SubStr(defdir,1,i),DelStr(defdir,1,i),rxfilerq,rxfileok,"RT_SCREENTOFRONT=TRUE")
  1104. IF newdir~="" THEN
  1105. DO
  1106. defdir=newdir
  1107. IF xexists("ENV:FinalWrapper") THEN 
  1108. IF Open(prefs,"ENV:FinalWrapper/FWPath","W") THEN
  1109. DO
  1110. CALL WriteLn(prefs,defdir)
  1111. CALL Close(prefs)
  1112. END
  1113. closed=rxclose
  1114. END
  1115. END
  1116. WHEN n=mhelp THEN
  1117. IF help THEN
  1118. DO
  1119. IF usewb THEN
  1120. CALL WBenchToFront()
  1121. ELSE
  1122. CALL ScreenToFront(pubscr)
  1123. IF wb3 THEN
  1124. CALL Shownode(pubname,docfile,"MAIN",1,0)
  1125. ELSE
  1126. CALL Shownode(pubname,docfile,"MAIN",1)
  1127. CALL ScreenToFront(scr)
  1128. END
  1129. ELSE
  1130. CALL message(0,nohelp)
  1131. OTHERWISE NOP
  1132. END
  1133. END
  1134. WHEN actgads & (msgclass=IDCMP_ACTIVEWINDOW | msgclass=IDCMP_MOUSEBUTTONS) THEN CALL ActivateGadget(intgad.1,win,Null())
  1135. WHEN msgclass=IDCMP_MENUHELP | (code=95 & (msgclass=IDCMP_RAWKEY | msgclass=IDCMP_GADGETUP)) THEN
  1136. IF help THEN
  1137. DO
  1138. IF usewb THEN
  1139. CALL WBenchToFront()
  1140. ELSE
  1141. CALL ScreenToFront(pubscr)
  1142. mnr=(code%32)//32+1+menuoff
  1143. IF msgclass=IDCMP_MENUHELP THEN
  1144. node=mnode.mnr
  1145. ELSE
  1146. IF zipped THEN
  1147. node=gnode.0
  1148. ELSE 
  1149. DO
  1150. ymouse=getshort(C2D(win),12)
  1151. xmouse=getshort(C2D(win),14)
  1152. gad=GETVALUE(win,62,4,"P")
  1153. id=0
  1154. IF xmouse>=0 & ymouse>=0 & xmouse<dwid+zipwid & ymouse<dhi+ziphi & gad~=Null() THEN
  1155. DO UNTIL gad=Null()
  1156. x=getshort(C2D(gad),4)
  1157. y=getshort(C2D(gad),6)
  1158. w=getshort(C2D(gad),8)
  1159. h=getshort(C2D(gad),10)
  1160. i=GETVALUE(gad,38,2,"N")
  1161. IF xmouse>=x & xmouse<=x+w & ymouse>=y & ymouse<=y+h & i>0 THEN
  1162. DO
  1163. id=i%3
  1164. LEAVE
  1165. END
  1166. ELSE
  1167. gad=GETVALUE(gad,0,4,"P")
  1168. END
  1169. node=gnode.id
  1170. END
  1171. IF wb3 THEN
  1172. CALL Shownode(pubname,docfile,node,1,0)
  1173. ELSE
  1174. CALL Shownode(pubname,docfile,node,1)
  1175. CALL ScreenToFront(scr)
  1176. END
  1177. ELSE
  1178. CALL message(0,nohelp)
  1179. WHEN msgclass=IDCMP_GADGETUP THEN
  1180. DO
  1181. type=gadid//3
  1182. id=gadid%3
  1183. SELECT
  1184. WHEN id>agads+sgads THEN closed=id-agads 
  1185. WHEN type=2 THEN CALL checkstrgad 
  1186. WHEN type=1 THEN  
  1187. DO
  1188. check.id=code
  1189. IF labs.id>0 & check.id~=0 & actgads THEN CALL ActivateGadget(intgad.id,win,Null())
  1190. END
  1191. OTHERWISE 
  1192. DO
  1193. cycle.id=code
  1194. check.id=1
  1195. IF labs.id>0 THEN CALL GT_SetGadgetAttrs(checkgad.id,win,Null(),GTCB_CHECKED,check.id)
  1196. IF labs.id>0 & actgads THEN CALL ActivateGadget(intgad.id,win,Null())
  1197. END
  1198. END
  1199. END
  1200. OTHERWISE NOP
  1201. END
  1202. IF check.mspl THEN
  1203. IF check.spl & nospiral THEN 
  1204. DO
  1205. cycle.adj=adjarc-1
  1206. CALL GT_SetGadgetAttrs(cyclegad.adj,win,Null(),GTCY_ACTIVE,cycle.adj)
  1207. END
  1208. END
  1209. BACKMESSY:
  1210. IF trapped THEN
  1211. DO
  1212. trapped=0
  1213. IF err=14 THEN
  1214. DO
  1215. lib.reqtools=0
  1216. CALL message(0,noreqtools)
  1217. END
  1218. END
  1219. RETURN
  1220. checkstrgad: 
  1221. old=val.id
  1222. specialinfo=GETVALUE(intgad.id,34,4,"P")
  1223. IF id>agads THEN
  1224. DO
  1225. IF gtype.id=0 THEN
  1226. val.id=GETVALUE(specialinfo,28,4,"N")
  1227. ELSE
  1228. DO
  1229. gval=GETVALUE(specialinfo,0,4,"S")
  1230. IF gtype.id=1 & gval~=old THEN
  1231. DO
  1232. IF gval~="" THEN
  1233. IF ~Datatype(replacepat(gval,",","."),"N") THEN
  1234. DO
  1235. IF closed=okclose THEN closed=0
  1236. IF closed=0 THEN CALL message(0,replacepat(notnum,"@g",ltxt.id))
  1237. END
  1238. ELSE
  1239. IF deci="COMMA" THEN
  1240. val.id=replacepat(Max(replacepat(gval,",","."),0),".",",")
  1241. ELSE
  1242. val.id=Max(replacepat(gval,",","."),0)
  1243. ELSE
  1244. val.id=""
  1245. IF val.id~=gval THEN CALL GT_SetGadgetAttrs(intgad.id,win,Null(),GTST_STRING,val.id)
  1246. END
  1247. ELSE
  1248. IF gtype.id=2 THEN val.id=gval
  1249. END
  1250. END
  1251. ELSE
  1252. DO
  1253. gval=GETVALUE(specialinfo,28,4,"N")
  1254. val.id=Max(Min(ubound.id,gval),lbound.id)
  1255. IF val.id~=gval THEN CALL GT_SetGadgetAttrs(intgad.id,win,Null(),GTIN_NUMBER,val.id)
  1256. check.id=check.id | (old~=val.id & actgads)
  1257. IF old~=val.id | actgads THEN CALL GT_SetGadgetAttrs(checkgad.id,win,Null(),GTCB_CHECKED,check.id)
  1258. END
  1259. RETURN
  1260. rx: 
  1261. PARSE VAR msgclass comm ar.1 ar.2 ar.3
  1262. arg1=Upper(ar.1)
  1263. arg2=SubStr(msgclass,Pos(ar.1,msgclass,Length(comm)+1)+Length(ar.1)+1)
  1264. IF Datatype(arg1,"U") THEN INTERPRET "id="||arg1
  1265. comm=Upper(comm)
  1266. full=msgclass
  1267. msgclass=0
  1268. ret=0
  1269. res=0
  1270. SELECT
  1271. WHEN comm="SETVAL" THEN
  1272. IF checksyntax("W") & ar.2~="" THEN
  1273. SELECT
  1274. WHEN id>0 & id<=agads THEN
  1275. IF labs.id>0 & Datatype(ar.2,"W") THEN
  1276. DO
  1277. gadid=id*3+2
  1278. msgclass=IDCMP_GADGETUP
  1279. code=0
  1280. CALL GT_SetGadgetAttrs(intgad.id,win,Null(),GTIN_NUMBER,ar.2)
  1281. res=val.id
  1282. END
  1283. WHEN id>agads & id<=agads+sgads THEN
  1284. IF Datatype(replacepat(ar.2,",","."),Word("W N A",gtype.id+1)) | gtype.id=2 THEN
  1285. DO
  1286. gadid=id*3+2
  1287. msgclass=IDCMP_GADGETUP
  1288. code=0
  1289. IF gtype.id=2 THEN
  1290. CALL GT_SetGadgetAttrs(intgad.id,win,Null(),GTST_STRING,arg2)
  1291. ELSE
  1292. IF gtype.id=1 THEN
  1293. CALL GT_SetGadgetAttrs(intgad.id,win,Null(),GTST_STRING,ar.2)
  1294. ELSE
  1295. CALL GT_SetGadgetAttrs(intgad.id,win,Null(),GTIN_NUMBER,ar.2)
  1296. res=val.id
  1297. END
  1298. OTHERWISE NOP
  1299. END
  1300. WHEN comm="SETMODE" THEN
  1301. IF checksyntax("W","w") &  id>0 & id<=agads & labs.id~=0 THEN
  1302. DO
  1303. gadid=id*3
  1304. msgclass=IDCMP_GADGETUP
  1305. code=ar.2
  1306. CALL GT_SetGadgetAttrs(cyclegad.id,win,Null(),GTCY_ACTIVE,code)
  1307. res=cycle.id
  1308. END
  1309. WHEN comm="SETSTATE" THEN
  1310. IF checksyntax("W","w") THEN
  1311. IF id>0 & id<=agads THEN
  1312. IF labs.id>=0 THEN
  1313. DO
  1314. gadid=id*3+1
  1315. msgclass=IDCMP_GADGETUP
  1316. code=(ar.2~=0)
  1317. CALL GT_SetGadgetAttrs(checkgad.id,win,Null(),GTCB_CHECKED,code)
  1318. res=check.id
  1319. END
  1320. ELSE 
  1321. DO
  1322. gadid=id*3
  1323. msgclass=IDCMP_GADGETUP
  1324. code=(ar.2~=0)
  1325. CALL GT_SetGadgetAttrs(cyclegad.id,win,Null(),GTCY_ACTIVE,code)
  1326. res=(cycle.id~=0)
  1327. END
  1328. ELSE
  1329. IF id>menuoff & id<=menuoff+mchks THEN
  1330. DO
  1331. check.id=(ar.2~=0)
  1332. CALL ClearMenuStrip(win)
  1333. item=GETVALUE(menu,18,4,"P")
  1334. DO n=menuoff+1 TO id-1
  1335. item=GETVALUE(item,0,4,"P")
  1336. END
  1337. flags=C2D(B2C(BitAnd(C2B(D2C(GETVALUE(item,12,2,"N"),2)),"1111111011111111")))+CHECKED*check.id
  1338. CALL SETVALUE(item,12,2,"N",flags,0)
  1339. CALL ResetMenuStrip(win,menu)
  1340. msgclass=-1
  1341. END
  1342. WHEN comm="GETVAL" THEN
  1343. IF checksyntax("W") & id>0 & ((id<=agads & labs.id>0) | id<=agads+sgads) THEN
  1344. DO
  1345. specialinfo=GETVALUE(intgad.id,34,4,"P")
  1346. IF id>agads & gtype.id~=0 THEN
  1347. DO
  1348. val=GETVALUE(specialinfo,0,4,"S")
  1349. IF gtype.id=1 THEN val=replacepat(val,",",".")
  1350. END
  1351. ELSE
  1352. val=GETVALUE(specialinfo,28,4,"N")
  1353. res=val
  1354. msgclass=-1
  1355. END
  1356. WHEN comm="GETMODE" THEN
  1357. IF checksyntax("W") & id>0 & id<=agads THEN
  1358. DO
  1359. res=cycle.id
  1360. msgclass=-1
  1361. END
  1362. WHEN comm="GETSTATE" THEN
  1363. IF checksyntax("W") & ((id>0 & id<=agads) | (id>menuoff & id<=menuoff+mchks)) THEN
  1364. DO
  1365. IF id>0 & id<=agads & labs.id<0 THEN 
  1366. res=(cycle.id~=0)
  1367. ELSE
  1368. res=check.id
  1369. msgclass=-1
  1370. END
  1371. WHEN comm="USE" THEN
  1372. IF checksyntax("W") THEN
  1373. IF id>=agads+sgads & id<=kgads THEN
  1374. DO
  1375. msgclass=-1
  1376. IF id=zipgad THEN
  1377. CALL ZipWindow(win)
  1378. ELSE
  1379. IF id=depthgad THEN
  1380. DO
  1381. windowpos=~windowpos
  1382. IF windowpos THEN
  1383. CALL WindowToBack(win)
  1384. ELSE
  1385. CALL WindowToFront(win)
  1386. END
  1387. ELSE
  1388. DO
  1389. msgclass=IDCMP_GADGETUP
  1390. code=0
  1391. gadid=id*3
  1392. END
  1393. END
  1394. ELSE
  1395. IF id>menuoff+mchks & id<=menuoff+mchks+macts THEN
  1396. DO
  1397. msgclass=IDCMP_MENUPICK
  1398. code=(id-1-menuoff)*32
  1399. END
  1400. WHEN comm="SETSTYLE" THEN
  1401. IF ar.1>=0 & ar.1<=Length(text) THEN
  1402. DO
  1403. msgclass=-1
  1404. IF ar.1=0 THEN 
  1405. DO
  1406. j=1
  1407. k=Length(text)
  1408. END
  1409. ELSE
  1410. DO
  1411. j=ar.1
  1412. k=j
  1413. END
  1414. y=arg2
  1415. DO i=j TO k
  1416. tprfs=specs.i
  1417. tfontp=font.i
  1418. tcolourp=colour.i
  1419. arg2=y
  1420. DO WHILE arg2~=""
  1421. x=Upper(Word(arg2,1))
  1422. v=Word(arg2,2)
  1423. SELECT
  1424. WHEN Pos(x||"|","SIZE|WIDTH|OBLIQUE|")>0 THEN
  1425. DO
  1426. p=Pos(x,tprfs)
  1427. tprfs=Left(tprfs,p-1)||x v DelWord(SubStr(tprfs,p),1,2) 
  1428. END
  1429. WHEN x="COLOR" THEN
  1430. tcolourp=x v
  1431. WHEN x="FONT" THEN
  1432. tfontp=x v
  1433. WHEN Pos(x||"|","LEADING|POSITION|CASE|STYLE|")>0 THEN NOP 
  1434. OTHERWISE msgclass=0
  1435. END
  1436. arg2=DelWord(arg2,1,2)
  1437. END
  1438. specs.i=tprfs
  1439. font.i=tfontp
  1440. colour.i=tcolourp
  1441. END
  1442. END
  1443. WHEN comm="GETSTYLE" THEN
  1444. IF ar.1>=0 & ar.1<=Length(text) THEN
  1445. DO
  1446. msgclass=-1
  1447. i=ar.1
  1448. IF i=0 THEN
  1449. DO
  1450. specs.i=defspecs
  1451. font.i=deffont
  1452. colour.i=defcolour
  1453. END
  1454. SELECT
  1455. WHEN arg2="" THEN
  1456. res=specs.i colour.i font.i
  1457. WHEN arg2="FONT" THEN
  1458. res=SubStr(font.i,6)
  1459. WHEN arg2="COLOR"THEN
  1460. res=SubStr(colour.i,7)
  1461. WHEN Pos(arg2||"|","SIZE|WIDTH|OBLIQUE|")>0 THEN
  1462. res=Word(SubStr(specs.i,Pos(arg2,specs.i)+Length(arg2)+1),1)
  1463. WHEN Pos(arg2||"|","LEADING|POSITION|CASE|STYLE|")>0 THEN 
  1464. res=Word(SubStr(defspecs,Pos(arg2,defspecs)+Length(arg2)+1),1)
  1465. OTHERWISE msgclass=0
  1466. END
  1467. IF i=0 THEN
  1468. DO
  1469. specs.i=""
  1470. font.i=""
  1471. colour.i=""
  1472. END
  1473. END
  1474. WHEN comm="SET" THEN
  1475. DO
  1476. msgclass=-1
  1477. SELECT
  1478. WHEN Abbrev("PORT",arg1,1) THEN
  1479. DO
  1480. IF Show("P",ar.2) & Left(ar.2,Length(finalw))=finalw THEN rxport=ar.2
  1481. res=rxport
  1482. END
  1483. WHEN Abbrev("SCREEN",arg1,1) THEN
  1484. DO
  1485. IF arg2="" THEN
  1486. stitle=origscrtitle
  1487. ELSE
  1488. stitle=arg2
  1489. scrtitle=replacepat(replacepat(stitle,"@f",doc),"@i",info)
  1490. CALL SetWindowTitles(win,wintitle,scrtitle)
  1491. END
  1492. WHEN Abbrev("WINDOW",arg1,1) THEN
  1493. DO
  1494. IF arg2="" THEN
  1495. wtitle=origwintitle
  1496. ELSE
  1497. wtitle=arg2
  1498. wintitle=replacepat(replacepat(wtitle,"@f",doc),"@i",info)
  1499. CALL SetWindowTitles(win,wintitle,scrtitle)
  1500. END
  1501. WHEN Abbrev("ZIP",arg1,1) THEN
  1502. DO
  1503. res=zipped
  1504. zipped=(ar.2~=0)
  1505. IF zipped~=res THEN CALL ZipWindow(win)
  1506. END
  1507. OTHERWISE msgclass=0
  1508. END
  1509. END
  1510. WHEN comm="GET" THEN
  1511. DO
  1512. msgclass=-1
  1513. SELECT
  1514. WHEN Abbrev("PORT",arg1,1) THEN
  1515. IF portok THEN
  1516. res=rxport
  1517. ELSE
  1518. res=""
  1519. WHEN Abbrev("REQTOOLS",arg1,1) THEN res=lib.reqtools
  1520. WHEN Abbrev("SCREEN",arg1,1) THEN res=scrtitle
  1521. WHEN Abbrev("VERSION",arg1,1) THEN res=version
  1522. WHEN Abbrev("WINDOW",arg1,1) THEN res=wintitle
  1523. WHEN Abbrev("ZIP",arg1,1) THEN res=zipped
  1524. OTHERWISE msgclass=0
  1525. END
  1526. END
  1527. WHEN comm="PREFS" THEN
  1528. DO
  1529. msgclass=-1
  1530. IF Abbrev("STORE",arg1,1) THEN
  1531. DO
  1532. CALL savedef(1)
  1533. prefsstore=0
  1534. END
  1535. ELSE
  1536. IF Abbrev("RESET",arg1,1) THEN
  1537. DO
  1538. CALL loaddef(1)
  1539. prefsstore=1
  1540. END
  1541. ELSE
  1542. CALL loaddef(0)
  1543. END
  1544. WHEN comm="POPFRONT" THEN
  1545. DO
  1546. IF zipped THEN CALL ZipWindow(win)
  1547. CALL WindowToFront(win)
  1548. CALL ScreenToFront(scr)
  1549. CALL ActivateWindow(win)
  1550. msgclass=-1
  1551. END
  1552. WHEN comm="DIE" THEN
  1553. DO
  1554. msgclass=-1
  1555. res=lockcnt
  1556. IF lockcnt=0 THEN
  1557. DO
  1558. CALL Reply(msg,0)
  1559. IF ar.1~="" & Datatype(ar.1,"W") THEN
  1560. IF ar.2~="" THEN
  1561. DO
  1562. CALL message(ar.1,replacepat(ar.2,"_"," "),replacepat(ar.3,"_"," "))
  1563. IF ar.1=0 THEN CALL bye(0)
  1564. END
  1565. ELSE
  1566. CALL bye(ar.1)
  1567. ELSE
  1568. CALL bye(0)
  1569. END
  1570. END
  1571. WHEN comm="MESSAGE" THEN
  1572. DO
  1573. msgclass=-1
  1574. res=message(0,replacepat(ar.1,"_"," "),replacepat(ar.2,"_"," "),replacepat(ar.3,"_"," "))
  1575. END
  1576. WHEN comm="LOCK" THEN
  1577. DO
  1578. msgclass=-1
  1579. IF Abbrev("ON",arg1,2) THEN
  1580. lockcnt=lockcnt+1
  1581. ELSE
  1582. IF Abbrev("OFF",arg1,2) THEN
  1583. lockcnt=Max(0,lockcnt-1)
  1584. ELSE
  1585. IF Abbrev("RESET",arg1,1) THEN
  1586. lockcnt=0
  1587. res=lockcnt
  1588. END
  1589. WHEN comm="ABORT" THEN
  1590. msgclass=-1
  1591. WHEN comm="GO" THEN
  1592. DO
  1593. msgclass=IDCMP_GADGETUP
  1594. code=0
  1595. gadid=okgad*3
  1596. replymsg=msg
  1597. stilltoreply=1
  1598. RETURN
  1599. END
  1600. OTHERWISE NOP
  1601. END
  1602. IF msgclass=0 THEN 
  1603. CALL Reply(msg,5)
  1604. ELSE
  1605. CALL Reply(msg,ret,res)
  1606. IF msgclass=0 THEN CALL message(0,replacepat(rxcmderr,"@c",full))
  1607. RETURN
  1608. quickmessy: 
  1609. IF port=0 THEN RETURN 0
  1610. DO FOREVER
  1611. msg=GetPkt(portname)
  1612. IF msg=Null() THEN LEAVE
  1613. msgclass=GetArg(msg,0)
  1614. IF msgclass=IDCMP_CLOSEWINDOW THEN
  1615. closed=winclose
  1616. ELSE
  1617. IF msgclass=IDCMP_CHANGEWINDOW THEN
  1618. IF ~BitTst(D2C(GETVALUE(win,24,4,"N")),28) THEN CALL ZipWindow(win) 
  1619. IF Datatype(msgclass,"W") THEN
  1620. CALL Reply(msg,0)
  1621. ELSE
  1622. IF Upper(msgclass)="ABORT" THEN
  1623. DO
  1624. closed=winclose
  1625. CALL Reply(msg,0)
  1626. END
  1627. ELSE
  1628. CALL Reply(msg,1)
  1629. END
  1630. RETURN closed~=0
  1631. guiclean: 
  1632. IF cleangui THEN
  1633. DO
  1634. IF pubscr~=Null() THEN CALL UnLockPubScreen(Null(),pubscr)
  1635. IF win~=Null() THEN
  1636. DO
  1637. IF menustrip THEN CALL ClearMenuStrip(win)
  1638. CALL CloseWindow(win)
  1639. END
  1640. IF menu~=Null() THEN CALL FreeMenus(menu)
  1641. IF gad~=Null() THEN CALL FreeGadgets(gad)
  1642. IF scrvinfo~=Null() THEN CALL FreeVisualInfo(scrvinfo)
  1643. IF port THEN CALL ClosePort(portname)
  1644. port=0
  1645. DO id=1 TO gads
  1646. CALL FREETHIS(newgadx.id)
  1647. CALL FREETHIS(newgadxi.id)
  1648. CALL FREETHIS(newgadxb.id)
  1649. CALL FREETHIS(glabels.id)
  1650. END
  1651. CALL FREETHIS(newgadbv)
  1652. CALL FREETHIS(mptr)
  1653. CALL FREETHIS(wtagl)
  1654. CALL FREETHIS(glistptr)
  1655. CALL FREETHIS(pubnptr)
  1656. cleangui=0
  1657. END
  1658. RETURN
  1659. options: 
  1660. GetTextBlockPrefs "TEXTFLOW FLOWDIST TEXT"
  1661. PARSE VAR RESULT defflow deffld deftext
  1662. defprfs=""
  1663. IF defflow~="" THEN defprfs=defprfs "TEXTFLOW" defflow
  1664. IF deffld~="" THEN defprfs=defprfs "FLOWDIST" deffld
  1665. IF deftext~="" THEN defprfs=defprfs "TEXT" deftext
  1666. GetTextBlockTypePrefs "SIZE LEADING WIDTH OBLIQUE POSITION CASE STYLE COLOR FONT"
  1667. PARSE VAR RESULT tsize tlead twid tobl tpos tcase tstyl tcol tfont
  1668. defspecs="SIZE" tsize "LEADING" tlead "WIDTH" twid "OBLIQUE" tobl "POSITION" tpos "CASE" tcase "STYLE" tstyl
  1669. defcolour="COLOR" tcol
  1670. IF Left(tfont,1)~=" " THEN tfont=" "||tfont 
  1671. deffont="FONT"||tfont
  1672. ssize=360
  1673. start="+0"
  1674. Status "PAGES"
  1675. docpages=RESULT
  1676. IF val.xgad~="" THEN ovalx=replacepat(val.xgad,",",".")
  1677. IF val.ygad~="" THEN ovaly=replacepat(val.ygad,",",".")
  1678. IF val.wgad~="" THEN ovalw=replacepat(val.wgad,",",".")
  1679. IF val.hgad~="" THEN ovalh=replacepat(val.hgad,",",".")
  1680. IF val.pgad~=0 THEN ovalp=Min(Max(val.pgad,1),docpages)
  1681. IF Left(text,Min(len.tgad,Length(text)))~=val.tgad THEN
  1682. DO
  1683. text=val.tgad
  1684. gadgettext=1
  1685. virtualtext=1
  1686. END
  1687. rescan=Length(text)=0
  1688. IF check.arc THEN ssize=SubStr("+-",cycle.arc+1,1)||val.arc
  1689. IF check.beg THEN start=SubStr(" -+",cycle.beg+1,1)||val.beg
  1690. titlemd=check.rot & (cycle.rot=6)
  1691. norrot=~check.rot | titlemd
  1692. IF norrot THEN
  1693. rrot=""
  1694. ELSE
  1695. IF cycle.rot=1 THEN
  1696. rrot="="
  1697. ELSE
  1698. IF cycle.rot=0 THEN
  1699. rrot=val.rot
  1700. ELSE
  1701. DO
  1702. rrot=SubStr("+-",cycle.rot//2+1,1)||val.rot
  1703. IF cycle.rot>3 THEN rrot=" "||rrot
  1704. END
  1705. delete=SubStr("- +=",cycle.dlt+1,1)
  1706. ogrp=SubStr(" +-",cycle.grp+1,1)
  1707. dordim=check.spl
  1708. rdim=""
  1709. IF check.spl THEN rdim=SubStr("+-",cycle.spl+1,1)||val.spl
  1710. dohdim=check.siz | check.spl
  1711. hdim=""
  1712. IF check.siz THEN
  1713. hdim=SubStr("+-",cycle.siz+1,1)||val.siz
  1714. ELSE
  1715. IF check.spl THEN hdim=rdim
  1716. doresize=check.zoo
  1717. IF check.zoo THEN
  1718. DO
  1719. resize=val.zoo
  1720. resizek=SubStr("+|-",cycle.zoo+1,1)
  1721. END
  1722. adjust=cycle.adj
  1723. doadj=(adjust>0)
  1724. fillcol=cycle.ink//2
  1725. shadow=cycle.ink=3 | cycle.ink=4
  1726. resetcol=(cycle.ink=0) | shadow
  1727. attr=check.pat
  1728. wordmd=cycle.wrd>0
  1729. wordoff=SubStr(" 0 0+1-1",2*cycle.wrd+1,2)
  1730. charmd=~wordmd
  1731. IF ssize=0 THEN ssize=0.01 
  1732. absstart=0
  1733. IF Verify(Left(start,1),"+-","m")=0 THEN
  1734. DO
  1735. absstart=1
  1736. start=Max(Min(start,360),0)
  1737. END
  1738. ELSE
  1739. start=Max(Min(start,360),-360)
  1740. IF dordim THEN
  1741. rdim=Max(Min(rdim,100),-100)
  1742. ELSE
  1743. ssize=Max(Min(ssize,360),-360)
  1744. IF rdim=0 THEN rdim=0.01
  1745. IF dohdim THEN
  1746. hdim=Max(Min(hdim,100),-100)
  1747. ELSE
  1748. hdim=rdim
  1749. IF hdim=0 THEN hdim=0.01
  1750. IF doresize THEN
  1751. DO
  1752. resizex=Max(Min(resize,1000),5)/100
  1753. resizey=resizex
  1754. resize=resizex
  1755. IF resizek="|" THEN
  1756. resizex=1
  1757. ELSE
  1758. IF resizek="-" THEN resizey=1
  1759. END
  1760. drot=0
  1761. deltarot=0
  1762. dodrot=0
  1763. IF Verify(Left(rrot,1),"+-","m")>0 THEN
  1764. DO
  1765. drot=Max(Min(rrot,360),-360)
  1766. rrot=""
  1767. norrot=1
  1768. END
  1769. ELSE
  1770. IF Left(rrot,1)=" " & rrot~="" THEN
  1771. DO
  1772. deltarot=Max(Min(rrot,360),-360)
  1773. dodrot=1
  1774. rrot=0
  1775. END
  1776. ELSE
  1777. IF rrot~="" & rrot~="=" THEN rrot=Max(Min(rrot,360),-360)
  1778. IF rrot="=" THEN rrot=txtrot||" "
  1779. RETURN
  1780. chosenobjs: 
  1781. ovalrescan=0
  1782. txtrescan=0
  1783. txt=0
  1784. oval=0
  1785. len=0
  1786. FirstObject "SELECTED"
  1787. o=RESULT
  1788. IF o~=0 THEN
  1789. DO
  1790. cnt=0
  1791. DO UNTIL o=0
  1792. gobj.cnt=o
  1793. NextObject o "SELECTED"
  1794. o=RESULT
  1795. cnt=cnt+1
  1796. END
  1797. DO i=0 TO cnt-1 WHILE oval=0 | txt=0
  1798. GetObjectType gobj.i
  1799. IF RESULT=7 THEN txt=gobj.i
  1800. IF RESULT=6 THEN oval=gobj.i
  1801. END
  1802. END
  1803. IF oval=0 THEN
  1804. oval=oldoval
  1805. ELSE
  1806. ovalrescan=1
  1807. IF gadgettext THEN len=Length(text)
  1808. IF gadgettext & ~(init | rescan) THEN txt=0
  1809. CALL getattr
  1810. Status "PARAPOS"
  1811. pos=RESULT
  1812. PARSE VAR pos para ppos x
  1813. Status "PARACHARS"
  1814. plen=RESULT
  1815. IF txt=0 & ~newattr THEN
  1816. IF Words(pos)=4  & (~gadgettext | rescan | init) THEN
  1817. DO
  1818. Extract
  1819. text=RESULT
  1820. len=Length(text)
  1821. IF C2X(Right(text,1))="0A" THEN len=len-1 
  1822. text=""
  1823. MoveToPara para ppos
  1824. virtualtext=0
  1825. ppos=0
  1826. END
  1827. ELSE
  1828. IF plen~=0 & (rescan | ((plen~=oldplen | para~=oldpara | ppos~=oldppos) & ~gadgettext)) THEN
  1829. DO
  1830. len=plen
  1831. text=""
  1832. virtualtext=0
  1833. IF ppos~=0 THEN MoveToPara para 0
  1834. ppos=0
  1835. END
  1836. IF txt>0 THEN
  1837. DO
  1838. GetTextBlockText txt
  1839. text=RESULT
  1840. len=Length(text)
  1841. END
  1842. IF len=0 & text~="" THEN
  1843. DO
  1844. objs=oldobjs
  1845. len=oldlen
  1846. END
  1847. ELSE
  1848. txtrescan=1
  1849. IF (len=0 | oval=0) & ~init THEN
  1850. DO
  1851. IF len=0 & text~="" THEN
  1852. DO
  1853. len=Length(text)
  1854. txtrescan=1
  1855. END
  1856. IF oval=0 & ovalx~="" & ovaly~="" & ovalw~="" & ovalh~="" & ovalp~="" THEN oval=-1
  1857. IF len=0 | oval=0 THEN
  1858. DO
  1859. CALL message(0,noselect)
  1860. RETURN 5
  1861. END
  1862. END
  1863. gadgettext=0
  1864. oldoval=oval
  1865. oldtxt=txt
  1866. oldlen=len
  1867. oldobjs=objs
  1868. oldpara=para
  1869. oldppos=ppos
  1870. oldplen=plen
  1871. redrawchars=1
  1872. RETURN 0
  1873. getattr: 
  1874. newattr=0
  1875. IF ~attr | init THEN RETURN 5
  1876. Status "PARAPOS"
  1877. pos=RESULT
  1878. IF Words(pos)~=4 THEN RETURN 5
  1879. PARSE VAR pos para ppos x
  1880. Extract
  1881. atext=RESULT
  1882. MoveToPara para ppos
  1883. alen=Length(atext)
  1884. IF C2X(Right(atext,1))="0A" THEN alen=alen-1 
  1885. IF alen=0 THEN RETURN 5
  1886. DO i=1 TO alen
  1887. Cursor "RIGHT"
  1888. aspecs.i=gettexttypespecs()
  1889. Status "FONTNAME"
  1890. afont.i="FONT" RESULT
  1891. Status "FONTCOLOR"
  1892. acolour.i="COLOR" RESULT
  1893. IF quickmessy() THEN
  1894. DO
  1895. CALL remobjs
  1896. oldlen=0
  1897. alen=0
  1898. oldobjs=0
  1899. RETURN 5
  1900. END
  1901. END
  1902. MoveToPara para 0
  1903. oldppos=0
  1904. oldpara=para
  1905. Status "PARACHARS"
  1906. oldplen=RESULT
  1907. newattr=1
  1908. RETURN 0
  1909. oval: 
  1910. IF ovalrescan THEN
  1911. DO
  1912. GetObjectRotation oval
  1913. orot=RESULT
  1914. IF orot~=0 THEN SetObjectRotation oval 0
  1915. GetObjectCoords oval
  1916. PARSE VAR RESULT ovalp ovalx ovaly ovalw ovalh
  1917. IF ovalw<0 THEN
  1918. DO
  1919. ovalx=ovalx+ovalw
  1920. ovalw=-ovalw
  1921. END
  1922. IF ovalh<0 THEN
  1923. DO
  1924. ovaly=ovaly+ovalh
  1925. ovalh=-ovalh
  1926. END
  1927. val.xgad=Left(ovalx,Min(len.xgad,Length(ovalx)))
  1928. val.ygad=Left(ovaly,Min(len.ygad,Length(ovaly)))
  1929. val.wgad=Left(ovalw,Min(len.wgad,Length(ovalw)))
  1930. val.hgad=replacepat(Left(ovalh,Min(len.hgad,Length(ovalh)))," ","") 
  1931. val.pgad=Left(ovalp,Min(len.pgad,Length(ovalp)))
  1932. IF deci="COMMA" THEN
  1933. DO
  1934. val.xgad=replacepat(val.xgad,".",",")
  1935. val.ygad=replacepat(val.ygad,".",",")
  1936. val.wgad=replacepat(val.wgad,".",",")
  1937. val.hgad=replacepat(val.hgad,".",",")
  1938. END
  1939. IF cleangui THEN
  1940. DO
  1941. CALL GT_SetGadgetAttrs(intgad.xgad,win,Null(),GTST_STRING,val.xgad)
  1942. CALL GT_SetGadgetAttrs(intgad.ygad,win,Null(),GTST_STRING,val.ygad)
  1943. CALL GT_SetGadgetAttrs(intgad.wgad,win,Null(),GTST_STRING,val.wgad)
  1944. CALL GT_SetGadgetAttrs(intgad.hgad,win,Null(),GTST_STRING,val.hgad)
  1945. CALL GT_SetGadgetAttrs(intgad.pgad,win,Null(),GTIN_NUMBER,val.pgad)
  1946. END
  1947. GetObjectParams oval "TEXTFLOW FLOWDIST LINECOLOR FILLCOLOR"
  1948. PARSE VAR RESULT flow fld ovlcol ovfcol
  1949. IF Left(flow,5)="Right" THEN
  1950. flow="Right"
  1951. ELSE
  1952. IF Left(flow,4)="Left" THEN flow="Left"
  1953. IF delete="=" THEN
  1954. DO
  1955. SelectObject oval
  1956. Copy
  1957. END
  1958. IF delete~="-" & ogrp=" " THEN
  1959. DeleteObject oval
  1960. ELSE
  1961. IF doresize THEN SetObjectCoords oval x+rx*(1-resizex) y+ry*(1-resizey) rx*resizex*2 ry*resizey*2
  1962. ovalscanned=1
  1963. END
  1964. IF oval~=0 THEN
  1965. DO
  1966. GetPageSetup "WIDTH" "HEIGHT"
  1967. PARSE VAR RESULT pagew pageh
  1968. rx=ovalw/2
  1969. ry=ovalh/2
  1970. xm=Min(ovalx,pagew)+rx
  1971. ym=Min(ovaly,pageh)+ry
  1972. page=ovalp
  1973. END
  1974. IF ~ovalscanned THEN 
  1975. DO
  1976. GetOvalPrefs "TEXTFLOW FLOWDIST LINECOLOR FILLCOLOR"
  1977. PARSE VAR RESULT flow fld ovlcol ovfcol
  1978. IF Left(flow,5)="Right" THEN
  1979. flow="Right"
  1980. ELSE
  1981. IF Left(flow,4)="Left" THEN flow="Left"
  1982. orot=0
  1983. END
  1984. IF fillcol THEN
  1985. ovcol=ovfcol
  1986. ELSE
  1987. ovcol=ovlcol
  1988. TextBlockPrefs "TEXTFLOW" flow "FLOWDIST" fld
  1989. IF ~resetcol THEN TextBlockTypePrefs "COLOR" ovcol
  1990. RETURN
  1991. text: 
  1992. usesheet=alen>0 & attr
  1993. IF ~(txtrescan | dirtysize | (sheetused ^ usesheet) | newattr) THEN RETURN
  1994. DO i=1 TO len
  1995. x=SubStr(text,i,1)
  1996. IF usesheet THEN 
  1997. DO
  1998. attrn=(i-1)//alen+1
  1999. TextBlockTypePrefs afont.attrn
  2000. IF resetcol THEN
  2001. TextBlockTypePrefs aspecs.attrn acolour.attrn
  2002. ELSE
  2003. TextBlockTypePrefs aspecs.attrn
  2004. END
  2005. ELSE
  2006. DO
  2007. j=i-1
  2008. IF font.i~=font.j THEN TextBlockTypePrefs font.i
  2009. IF resetcol & (colour.i~=colour.j) THEN
  2010. TextBlockTypePrefs specs.i colour.i
  2011. ELSE
  2012. IF specs.i~=specs.j THEN TextBlockTypePrefs specs.i
  2013. END
  2014. IF Verify(x,'";= ',"M")  THEN x='"'||x||'"'
  2015. DrawTextBlock page xm ym x
  2016. obj.i=RESULT
  2017. objs=objs+1
  2018. IF check.mrel THEN Redraw
  2019. GetObjectCoords
  2020. PARSE VAR RESULT x x x objw.objs objh.objs
  2021. IF quickmessy() THEN
  2022. DO
  2023. CALL remobjs
  2024. dirtysize=1
  2025. oldlen=0
  2026. oldobjs=0
  2027. RETURN
  2028. END
  2029. END
  2030. sheetused=usesheet 
  2031. dirtysize=0
  2032. redrawchars=0
  2033. RETURN
  2034. scan: 
  2035. IF ~(txtrescan | dirtytext) | len=0 THEN RETURN
  2036. IF txt>0 THEN
  2037. DO
  2038. redrawchars=0
  2039. GetObjectTypeSpecs txt "SIZE LEADING WIDTH OBLIQUE POSITION CASE STYLE COLOR FONT"
  2040. PARSE VAR RESULT tsize tlead twid tobl tpos tcase tstyl tcol tfont
  2041. prfs="SIZE" tsize "LEADING" tlead "WIDTH" twid "OBLIQUE" tobl "POSITION" tpos "CASE" tcase "STYLE" tstyl
  2042. colourp="COLOR" tcol
  2043. IF Left(tfont,1)~=" " THEN tfont=" "||tfont 
  2044. fontp="FONT"||tfont
  2045. GetObjectRotation txt
  2046. txtrot=RESULT
  2047. IF delete="+" THEN DeleteObject txt
  2048. IF Right(rrot,1)=" " THEN rrot=txtrot
  2049. virtualtext=0
  2050. DO i=1 TO len
  2051. specs.i=prfs
  2052. font.i=fontp
  2053. colour.i=colourp
  2054. END
  2055. END
  2056. ELSE
  2057. IF virtualtext THEN
  2058. DO i=1 TO len
  2059. specs.i=defspecs
  2060. font.i=deffont
  2061. colour.i=defcolour
  2062. END
  2063. ELSE
  2064. IF text="" | dirtytext THEN
  2065. DO
  2066. text=""
  2067. DO i=1 TO len
  2068. Extract
  2069. x=rembad(RESULT)
  2070. text=text||x
  2071. Cursor "RIGHT"
  2072. specs.i=gettexttypespecs()
  2073. Status "FONTNAME"
  2074. font.i="FONT" RESULT
  2075. Status "FONTCOLOR"
  2076. colour.i="COLOR" RESULT
  2077. IF quickmessy() THEN
  2078. DO
  2079. CALL remobjs
  2080. oldlen=0
  2081. dirtytext=1
  2082. oldobjs=0
  2083. RETURN
  2084. END
  2085. END
  2086. MoveToPara para 0
  2087. val.tgad=Left(text,Min(len.tgad,Length(text)))
  2088. IF cleangui THEN CALL GT_SetGadgetAttrs(intgad.tgad,win,Null(),GTST_STRING,val.tgad)
  2089. END
  2090. dirtytext=0
  2091. IF text~="" THEN
  2092. DO
  2093. IF C2X(Right(text,1))="0A" THEN
  2094. DO
  2095. len=len-1
  2096. text=Left(text,len)
  2097. END
  2098. text=rembad(text)
  2099. old=val.tgad
  2100. val.tgad=Left(text,Min(len.tgad,Length(text)))
  2101. IF cleangui & val.tgad~=old THEN CALL GT_SetGadgetAttrs(intgad.tgad,win,Null(),GTST_STRING,val.tgad)
  2102. END
  2103. RETURN
  2104. initwrap: 
  2105. txtw=0
  2106. wnr=1
  2107. wordbeg=1
  2108. wordw=0
  2109. IF wordmd THEN
  2110. DO
  2111. wn=1
  2112. whi.wn=0
  2113. DO n=1 TO len
  2114. whi.wn=Max(objh.n,whi.wn)
  2115. IF SubStr(text,n,1)=" " | n=len THEN
  2116. DO
  2117. txtw=txtw+whi.wn
  2118. wn=wn+1
  2119. whi.wn=0
  2120. END
  2121. END
  2122. END
  2123. ELSE
  2124. DO n=1 TO len
  2125. txtw=txtw+objw.n
  2126. END
  2127. PI=3.141593
  2128. deg2rad=PI/180
  2129. smin=0.1 
  2130. rx=Max(rx,smin)
  2131. ry=Max(ry,smin)
  2132. sizerad=ssize*deg2rad
  2133. angstep=sizerad/txtw
  2134. IF doresize THEN angstep=angstep/resize
  2135. IF absstart THEN
  2136. angstart=start*deg2rad
  2137. ELSE
  2138. angstart=(ssize-360+start*2)/2*deg2rad
  2139. adone=angstart
  2140. flip=Sign(ssize)
  2141. ssize=ssize<0
  2142. fr=0
  2143. IF dordim THEN
  2144. DO
  2145. fr=(1-Abs(rdim)/100)/sizerad*Sign(rdim)
  2146. IF rdim<0 THEN
  2147. fr0=Abs(rdim)/100
  2148. ELSE
  2149. fr0=1
  2150. END
  2151. ELSE
  2152. qr=1
  2153. IF dohdim THEN
  2154. DO
  2155. fh=(1-Abs(hdim)/100)/sizerad*Sign(hdim)
  2156. IF hdim<0 THEN
  2157. fh0=Abs(hdim)/100
  2158. ELSE
  2159. fh0=1
  2160. END
  2161. ELSE
  2162. qh=1
  2163. wdone=0
  2164. o=0
  2165. rxx=rx
  2166. ryy=ry
  2167. IF doresize THEN
  2168. DO
  2169. rxx=rxx*resizex
  2170. ryy=ryy*resizey
  2171. END
  2172. sobjs=0
  2173. IF titlemd THEN
  2174. DO
  2175. CALL remobjs
  2176. redrawchars=1
  2177. END
  2178. resetprefs=redrawchars | shadow
  2179. recalcchar=resetprefs | wordmd
  2180. usesheet=(alen>0) & attr
  2181. RETURN
  2182. wrap: 
  2183. CALL initwrap
  2184. DO n=1 TO len
  2185. IF recalcchar THEN
  2186. DO
  2187. char=SubStr(text,n,1)
  2188. IF Verify(char,'";= ',"M")  THEN char='"'||char||'"'
  2189. END
  2190. cw=objw.n
  2191. ch=objh.n
  2192. o=obj.n
  2193. IF charmd THEN
  2194. DO
  2195. CALL position
  2196. x=rxx*Sin(f)*qr-cw/2
  2197. y=ryy*Cos(f)*qr
  2198. IF ~check.mrel THEN y=y-ch/2
  2199. END
  2200. IF resetprefs THEN
  2201. DO
  2202. IF usesheet THEN
  2203. DO
  2204. attrn=(n-1)//alen+1
  2205. TextBlockTypePrefs afont.attrn
  2206. IF resetcol THEN
  2207. TextBlockTypePrefs aspecs.attrn acolour.attrn
  2208. ELSE
  2209. TextBlockTypePrefs aspecs.attrn
  2210. END
  2211. ELSE
  2212. DO
  2213. m=n-1
  2214. IF font.n~=font.m THEN TextBlockTypePrefs font.n
  2215. IF resetcol & (colour.n~=colour.m | shadow) THEN
  2216. TextBlockTypePrefs specs.n colour.n
  2217. ELSE
  2218. IF specs.n~=specs.m THEN TextBlockTypePrefs specs.n
  2219. END
  2220. END
  2221. IF titlemd THEN
  2222. DO
  2223. PARSE VAR specs.n "WIDTH" l
  2224. l=Word(l,1)*cw/objw.n
  2225. i=crot+45
  2226. k=(i-i//90)//360
  2227. j=45-i//360+k
  2228. i=X2D(SubStr(obl,Abs(j)+1,1))
  2229. crot=(360+k-Sign(j)*SubStr(obrot,i+i+1,2))//360
  2230. TextBlockTypePrefs "OBLIQUE" Trunc(10*i*Sign(j)/Sqrt(l)+0.5)
  2231. END
  2232. IF wordmd THEN
  2233. DO
  2234. x=wordw
  2235. y=(whi.wnr-objh.n)/2
  2236. wordw=wordw+objw.n
  2237. crot=0
  2238. END
  2239. IF redrawchars THEN
  2240. DO
  2241. DrawTextBlock page x+xm y+ym char
  2242. obj.n=RESULT
  2243. objs=objs+1
  2244. IF check.mrel THEN Redraw
  2245. o=obj.n
  2246. IF cw~=objw.n | ch~=objh.n THEN SetObjectCoords o page x+xm y+ym cw ch
  2247. END
  2248. ELSE
  2249. SetObjectCoords o page x+xm y+ym cw ch
  2250. SetObjectRotation o crot
  2251. IF shadow THEN
  2252. DO
  2253. TextBlockTypePrefs "COLOR" ovcol
  2254. DrawTextBlock page x+xm+rx/10 y+ym+ry/10 char
  2255. sobj.n=RESULT
  2256. sobjs=sobjs+1
  2257. IF check.mrel THEN Redraw
  2258. IF cw~=objw.n | ch~=objh.n THEN SetObjectCoords sobj.n page x+xm+rx/10 y+ym+ry/10 cw ch
  2259. SetObjectRotation sobj.n crot
  2260. END
  2261. IF wordmd THEN
  2262. IF char='" "' | n=len THEN CALL endofword
  2263. IF quickmessy() THEN
  2264. DO
  2265. CALL remobjs
  2266. RETURN
  2267. END
  2268. END
  2269. RETURN
  2270. position: 
  2271. IF doresize THEN
  2272. DO
  2273. cw=cw*resize
  2274. ch=ch*resize
  2275. END
  2276. f=angstart-angstep*(wdone+cw/2)
  2277. wdone=wdone+cw
  2278. IF dordim THEN qr=fr0+fr*(f-angstart)
  2279. IF dohdim THEN
  2280. DO
  2281. qh=fh0+fh*(f-angstart)
  2282. ch=Max(ch*qh,smin)
  2283. cw=Max(cw*qh,smin)
  2284. END
  2285. IF doadj THEN
  2286. IF adjust=4 THEN
  2287. DO
  2288. asize=1.1*cw/radius(adone,rxx,ryy,qr)
  2289. f=adone-asize/2*flip
  2290. adone=adone-asize*flip
  2291. END
  2292. ELSE
  2293. DO
  2294. carc=radius(f,rxx,ryy,qr)*angstep/qr
  2295. IF adjust=1 THEN ch=ch*carc
  2296. IF adjust=3 THEN ch=ch/Sqrt(carc)
  2297. cw=cw*carc
  2298. END
  2299. IF norrot THEN
  2300. crot=720-Trunc(Atan(ryy/rxx*Tan(f))/PI*180)+180*((Cos(f)>0)+ssize)+drot
  2301. ELSE
  2302. DO
  2303. IF dodrot & n=1 THEN rrot=720-Trunc(Atan(ryy/rxx*Tan(f))/PI*180)+180*((Cos(f)>0)+ssize)
  2304. crot=rrot+deltarot*(n-1)//360+360
  2305. END
  2306. crot=crot//360
  2307. RETURN
  2308. endofword: 
  2309. cw=whi.wnr
  2310. ch=1
  2311. CALL position
  2312. x=rxx*Sin(f)*qr-wordw/2
  2313. y=ryy*Cos(f)*qr-whi.wnr
  2314. x=x+wordoff*wordw/2*Sin(crot*deg2rad)
  2315. y=y-wordoff*wordw/2*Cos(crot*deg2rad)
  2316. crot=(crot+270)//360
  2317. IF shadow THEN
  2318. DO
  2319. SelectObject
  2320. DO i=wordbeg TO n
  2321. SelectObject sobj.i "MULTIPLE"
  2322. END
  2323. Group
  2324. CurrentObject
  2325. wsobj.wnr=RESULT
  2326. GetObjectCoords
  2327. SetObjectCoords wsobj.wnr page x+xm+rx/10 y+ym+ry/10 Word(RESULT,4)*ch Word(RESULT,5)*cw/whi.wnr
  2328. SetObjectRotation wsobj.wnr crot
  2329. END
  2330. SelectObject
  2331. DO i=wordbeg TO n
  2332. SelectObject obj.i "MULTIPLE"
  2333. END
  2334. Group
  2335. CurrentObject
  2336. wobj.wnr=RESULT
  2337. GetObjectCoords
  2338. SetObjectCoords wobj.wnr page x+xm y+ym Word(RESULT,4)*ch Word(RESULT,5)*cw/whi.wnr
  2339. SetObjectRotation wobj.wnr crot
  2340. wordbeg=n+1
  2341. wnr=wnr+1
  2342. wordw=0
  2343. RETURN
  2344. group: 
  2345. IF ~ovalrescan & ogrp~=" " THEN
  2346. DO
  2347. DrawOval ovalp ovalx ovaly ovalw ovalh
  2348. oval=RESULT
  2349. ovalrescan=1
  2350. Redraw
  2351. END
  2352. IF ovalrescan THEN
  2353. DO
  2354. IF ogrp="-" THEN
  2355. DO
  2356. SelectObject oval
  2357. SetObjectParams oval "LINEWT NONE FILL TRANSPARENT"
  2358. END
  2359. IF orot~=0 & delete="-" & ogrp=" " THEN SetObjectRotation oval orot
  2360. END
  2361. SelectObject
  2362. IF wordmd THEN
  2363. DO n=1 TO wnr-1
  2364. SelectObject wobj.n "MULTIPLE"
  2365. END
  2366. ELSE
  2367. DO n=1 TO objs
  2368. SelectObject obj.n "MULTIPLE"
  2369. END
  2370. Group
  2371. i=RESULT
  2372. IF ogrp~=" " THEN
  2373. DO
  2374. SelectObject oval "MULTIPLE"
  2375. Group
  2376. END
  2377. objs=0
  2378. IF orot~=0 THEN SetObjectRotation 0 orot
  2379. IF shadow THEN
  2380. DO
  2381. SelectObject
  2382. IF wordmd THEN
  2383. DO n=1 TO wnr-1
  2384. SelectObject wsobj.n "MULTIPLE"
  2385. END
  2386. ELSE
  2387. DO n=1 TO sobjs
  2388. SelectObject sobj.n "MULTIPLE"
  2389. END
  2390. Group
  2391. sobjs=0
  2392. IF orot~=0 THEN SetObjectRotation 0 orot
  2393. ObjectToBack 0
  2394. END
  2395. Redraw
  2396. RETURN
  2397. bye: 
  2398. PARSE ARG errnr
  2399. errtrap=-2
  2400. IF errnr=0 & lockcnt>0 THEN RETURN
  2401. IF stilltoreply THEN CALL Reply(replymsg,10)
  2402. IF catalog~=0 THEN CALL CloseCatalog(catalog)
  2403. CALL resetprefs
  2404. CALL guiclean
  2405. CALL remobjs
  2406. EXIT errnr
  2407. RETURN
  2408. remobjs: 
  2409. IF objs>0 THEN
  2410. DO
  2411. IF wordmd THEN
  2412. DO n=1 TO wnr-1
  2413. SelectObject wobj.n
  2414. UnGroup
  2415. END
  2416. SelectObject
  2417. DO n=1 TO objs
  2418. SelectObject obj.n "MULTIPLE"
  2419. END
  2420. Group
  2421. DeleteObject
  2422. objs=0
  2423. END
  2424. IF sobjs>0 THEN
  2425. DO
  2426. SelectObject
  2427. IF wordmd THEN
  2428. DO n=1 TO wnr-1
  2429. SelectObject wsobj.n
  2430. UnGroup
  2431. END
  2432. DO n=1 TO sobjs
  2433. SelectObject sobj.n "MULTIPLE"
  2434. END
  2435. Group
  2436. DeleteObject
  2437. sobjs=0
  2438. END
  2439. RETURN
  2440. resetprefs: 
  2441. IF deci~="" THEN DocItemPrefs "DECIMAL PERIOD"
  2442. IF defprfs~="" THEN TextBlockPrefs defprfs
  2443. IF defspecs~="" | defcolour~="" THEN TextBlockTypePrefs defspecs defcolour
  2444. IF deffont~="" THEN TextBlockTypePrefs deffont
  2445. IF deci~="" THEN DocItemPrefs "DECIMAL" deci
  2446. RETURN
  2447. loaddef: 
  2448. ARG where
  2449. CALL loadtemp
  2450. IF where>0 THEN
  2451. DO
  2452. ok=0
  2453. DO i=where TO 3-where BY 3-where*2 UNTIL ok
  2454. IF preff.i~="" THEN
  2455. DO
  2456. ok=Open(prefs,preff.i,"R")
  2457. IF ok THEN
  2458. DO
  2459. default=ReadCh(prefs,prefsize+6)
  2460. CALL Close(prefs)
  2461. END
  2462. END
  2463. END
  2464. END
  2465. ELSE
  2466. default=""
  2467. IF Length(default)~=prefsize+6 | Left(default,6)~=prefsid | C2D(SubStr(default,5,2))~=prefsize THEN default=""
  2468. IF default="" THEN 
  2469. DO
  2470. winx=defwinx
  2471. winy=defwiny
  2472. DO id=1 TO agads
  2473. check.id=defchk.id
  2474. cycle.id=defcyc.id
  2475. val.id=defval.id
  2476. END
  2477. DO id=menuoff+1 TO menuoff+mchks
  2478. check.id=defchk.id
  2479. END
  2480. DO id=agads+1 TO agads+sgads
  2481. IF gtype.id=0 THEN
  2482. val.id=1
  2483. ELSE
  2484. val.id=""
  2485. END
  2486. END
  2487. ELSE 
  2488. DO
  2489. winx=C2D(SubStr(default,7,2))
  2490. winy=C2D(SubStr(default,9,2))
  2491. DO id=1 TO agads
  2492. i=id*4
  2493. check.id=C2D(SubStr(default,i+7,1))~=0
  2494. cycle.id=Min(Max(C2D(SubStr(default,i+8,1)),0),Abs(labs.id))
  2495. val.id=Min(Max(C2D(SubStr(default,i+9,2)),0),9999)
  2496. END
  2497. DO id=menuoff+1 TO menuoff+mchks
  2498. check.id=C2D(SubStr(default,id+agads*4-menuoff+10,1))~=0
  2499. END
  2500. END
  2501. CALL updategadgets
  2502. RETURN
  2503. savedef: 
  2504. ARG where
  2505. CALL savetemp
  2506. winx=GETVALUE(win,4,2,"N")
  2507. winy=GETVALUE(win,6,2,"N")
  2508. default=prefsid||D2C(winx,2)||D2C(winy,2)
  2509. DO id=1 TO agads
  2510. default=default||D2C(check.id,1)||D2C(cycle.id,1)||D2C(val.id,2)
  2511. END
  2512. DO id=menuoff+1 TO menuoff+mchks
  2513. default=default||D2C(check.id,1)
  2514. END
  2515. DO i=1 TO where
  2516. IF preff.i~="" THEN
  2517. DO
  2518. ok=Open(prefs,preff.i,"W")
  2519. IF ok THEN
  2520. DO
  2521. CALL WriteCh(prefs,default)
  2522. CALL Close(prefs)
  2523. END
  2524. END
  2525. END
  2526. RETURN
  2527. loadtemp: 
  2528. IF tempsize=0 THEN RETURN
  2529. ok=Open(prefs,temp,"R")
  2530. IF ok THEN
  2531. DO
  2532. default=ReadCh(prefs,tempsize)
  2533. i=1
  2534. IF Length(default)=tempsize THEN
  2535. DO id=agads+1 TO agads+sgads
  2536. val.id=replacepat(SubStr(default,i,len.id),D2C(0),"")
  2537. i=i+len.id
  2538. END
  2539. CALL Close(prefs)
  2540. END
  2541. RETURN
  2542. savetemp: 
  2543. IF tempsize=0 THEN RETURN
  2544. ok=Open(prefs,temp,"W")
  2545. IF ok THEN
  2546. DO
  2547. default=""
  2548. DO id=agads+1 TO agads+sgads
  2549. default=default||Left(val.id,len.id,D2C(0))
  2550. END
  2551. CALL WriteCh(prefs,default)
  2552. CALL Close(prefs)
  2553. END
  2554. RETURN
  2555. updategadgets: 
  2556. IF ~cleangui THEN RETURN
  2557. DO id=1 TO agads
  2558. IF labs.id>=0 THEN CALL GT_SetGadgetAttrs(checkgad.id,win,Null(),GTCB_CHECKED,check.id)
  2559. IF labs.id~=0 THEN CALL GT_SetGadgetAttrs(cyclegad.id,win,Null(),GTCY_ACTIVE,cycle.id)
  2560. IF labs.id>0 THEN CALL GT_SetGadgetAttrs(intgad.id,win,Null(),GTIN_NUMBER,val.id)
  2561. END
  2562. DO id=agads+1 TO agads+sgads
  2563. IF gtype.id>0 THEN
  2564. CALL GT_SetGadgetAttrs(intgad.id,win,Null(),GTST_STRING,val.id)
  2565. ELSE
  2566. CALL GT_SetGadgetAttrs(intgad.id,win,Null(),GTIN_NUMBER,val.id)
  2567. END
  2568. CALL ClearMenuStrip(win)
  2569. item=GETVALUE(menu,18,4,"P")
  2570. DO n=menuoff+1 TO menuoff+mchks
  2571. flags=C2D(B2C(BitAnd(C2B(D2C(GETVALUE(item,12,2,"N"),2)),"1111111011111111")))+CHECKED*check.n
  2572. CALL SETVALUE(item,12,2,"N",flags,0)
  2573. item=GETVALUE(item,0,4,"P")
  2574. END
  2575. CALL ResetMenuStrip(win,menu)
  2576. RETURN
  2577. newdoc: 
  2578. IF portok THEN
  2579. DO
  2580. Status "FILENAME"
  2581. doc=RESULT
  2582. WinToFront
  2583. END
  2584. ELSE
  2585. doc="???"
  2586. IF doc="" THEN doc=unnamed
  2587. wintitle=replacepat(wtitle,"@f",doc)
  2588. scrtitle=replacepat(stitle,"@f",doc)
  2589. IF cleangui THEN
  2590. DO
  2591. CALL SetWindowTitles(win,wintitle,scrtitle)
  2592. IF ~windowpos THEN CALL WindowToFront(win)
  2593. CALL ActivateWindow(win)
  2594. END
  2595. RETURN
  2596. SYNTAX: 
  2597. et=ErrorText(RC)
  2598. ERROR:
  2599. err=RC
  2600. line=SIGL
  2601. IF errtrap=-1 THEN CALL bye(err)
  2602. IF errtrap=-2 THEN EXIT err
  2603. IF err=errtrap THEN
  2604. DO
  2605. errtrap=0
  2606. i=resume
  2607. DROP resume
  2608. trapped=1
  2609. SIGNAL VALUE i
  2610. END
  2611. RESUME:
  2612. errtrap=-1
  2613. IF et="" THEN et=fwerrtext.err
  2614. CALL message(err,replacepat(replacepat(replacepat(replacepat(errtext,"@n",err),"@l",line),"@t",et),"@s",SourceLine(line)))
  2615. CALL bye(err)
  2616. RETURN
  2617. BREAK_C: 
  2618. CALL bye(2)
  2619. RETURN
  2620. rembad: PROCEDURE 
  2621. PARSE ARG t
  2622. bad=XRange("00"x,"1F"x)||XRange("7F"x,"A0"x)
  2623. i=Verify(t,bad,"m")
  2624. l=Length(t)
  2625. DO WHILE i>0
  2626. t=Left(t,i-1) Right(t,l-i)
  2627. i=Verify(t,bad,"m")
  2628. END
  2629. RETURN t
  2630. replacepat: PROCEDURE 
  2631. PARSE ARG str,pat,replc
  2632. p=Pos(pat,str)
  2633. DO WHILE p>0
  2634. str=Left(str,p-1)||replc||SubStr(str,p+Length(pat))
  2635. p=Pos(pat,str)
  2636. END
  2637. RETURN str
  2638. gettexttypespecs: PROCEDURE 
  2639. Status "FONTSIZE"
  2640. p="SIZE" RESULT
  2641. Status "FONTWIDTH"
  2642. p=p "WIDTH" RESULT
  2643. Status "FONTOBLIQUE"
  2644. p=p "OBLIQUE" RESULT
  2645. RETURN p
  2646. radius: PROCEDURE 
  2647. ARG a,rx,ry,v
  2648. rx=rx*Cos(a)
  2649. ry=ry*Sin(a)
  2650. r=v*Sqrt(rx*rx+ry*ry)
  2651. RETURN r
  2652. getshort: PROCEDURE 
  2653. ARG ptr,offset
  2654. a=GETVALUE(D2C(ptr),offset,2,"N")
  2655. IF a>32767 THEN a=a-65536
  2656. RETURN a
  2657. xexists: PROCEDURE 
  2658. PARSE ARG file
  2659. IF Pos(":",file)>0 THEN
  2660. IF Pos(Upper(Left(file,Pos(":",file))),Upper(ShowList("A",,":")||ShowList("V",,":"))||":")>0 THEN
  2661. ok=Exists(file)
  2662. ELSE
  2663. ok=0
  2664. ELSE
  2665. ok=Exists(file)
  2666. RETURN ok
  2667. newchkitem: 
  2668. mchks=mchks+1
  2669. chk=mchks+agads+tgads+wgads+sgads
  2670. PARSE ARG ltxt.chk,mkey.chk,defchk.chk,mnode.chk
  2671. RETURN chk
  2672. newitem: 
  2673. macts=macts+1
  2674. nr=macts+mchks+agads+tgads+wgads+sgads
  2675. PARSE ARG ltxt.nr,mkey.nr,mnode.nr
  2676. RETURN nr
  2677. newgadget: 
  2678. agads=agads+1
  2679. PARSE ARG labs.agads,lkey.agads,defchk.agads,defval.agads,defcyc.agads,gnode.agads,lbound.agads,ubound.agads
  2680. RETURN agads
  2681. newstr: 
  2682. sgads=sgads+1
  2683. gad=sgads+agads
  2684. PARSE ARG len.gad,lkey.gad,line.gad,val.gad,gtype.gad,gnode.gad
  2685. check.gad=0
  2686. cycle.gad=0
  2687. labs.gad=1
  2688. slines=Max(slines,line.gad)
  2689. RETURN gad
  2690. newbutton: 
  2691. tgads=tgads+1
  2692. gad=tgads+agads+sgads
  2693. PARSE ARG ltxt.gad,lkey.gad,lkey2.gad,gnode.gad
  2694. RETURN gad
  2695. newkey: 
  2696. wgads=wgads+1
  2697. gad=agads+tgads+wgads+sgads
  2698. PARSE ARG lkey.gad,gnode.gad
  2699. RETURN gad
  2700. checksyntax: 
  2701. PARSE ARG par.1,par.2,par.3
  2702. ok=1
  2703. DO i=1 TO 3 WHILE par.i~=""
  2704. IF par.i=Upper(par.i) THEN INTERPRET "ar.i="||ar.i 
  2705. ok=ok & Datatype(ar.i,par.i)
  2706. END
  2707. RETURN ok
  2708. message: 
  2709. PARSE ARG xiterr,msgtxt,buttxt,titletxt
  2710. IF msgtxt="" THEN RETURN 0
  2711. IF buttxt="" THEN buttxt=stdbut
  2712. IF titletxt="" THEN titletxt=wintitle
  2713. IF lib.reqtools THEN
  2714. DO
  2715. resume="BACKMSG"
  2716. errtrap=14
  2717. button=RTEZRequest(replacepat(msgtxt,"|","0A"x),buttxt,titletxt)
  2718. END
  2719. BACKMSG:
  2720. IF trapped THEN 
  2721. DO
  2722. trapped=0
  2723. lib.reqtools=0
  2724. END
  2725. IF ~lib.reqtools THEN
  2726. IF lib.apig & cleangui & win~="00000000"x THEN
  2727. button=EasyRequest(win,titletxt,replacepat(msgtxt,"|","0A"x),buttxt,Null(),0,0)
  2728. ELSE
  2729. SAY replacepat(msgtxt,"|","0A"x)
  2730. IF xiterr>0 THEN CALL bye(xiterr)
  2731. RETURN button
  2732.