home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / graphics / drawedit_1 / !DrawEdit / Source61 (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1997-03-05  |  22KB  |  756 lines

  1.  *****************************************************************
  2.  *                     Initiallisation code                      *
  3.  *****************************************************************
  4. !version$="1.61 (05-Mar-1997)"
  5.  "Wimp_Initialise",200,&4B534154,"DrawEdit" 
  6.  riscos%,myid%
  7. _Heap_Initialise
  8.     6stack% = 
  9. _Heap_Claim(4) :
  10.  this is the main stack
  11. unloaded%=
  12.          
  13.  Block% 256
  14. Iiconbar_icon%=
  15. _Icon_Create(-1,0,0,88,68,%10000000000010,"!DrawEdit")
  16. _ErrorHandler
  17.  "MenuUtil_Initialise",010,0
  18. _TemplatesLoad 
  19. _Menu_CreateMain
  20. _ScreenReadSize
  21.     n%=-4
  22. _Icon_Write(info%,7,version$)
  23.  *****************************************************************
  24.  *                         Wimp Poll                             *
  25.  *****************************************************************
  26.  "Wimp_Poll",,Block% 
  27.  reason%
  28.  reason% 
  29.  )   
  30.  2 : 
  31.  "Wimp_OpenWindow",,Block%
  32. !*   
  33.  3 : 
  34.  "Wimp_CloseWindow",,Block%
  35. "7   
  36.  6 : 
  37. _MouseClick(Block%!12,Block%!16,Block%!8)
  38. #>   
  39.  7 : 
  40. _DragBoxEnd(
  41. _Icon_Read(save%,0)) :
  42.  End of drag
  43. $6   
  44.  8 : 
  45. _KeyPressed(Block%!0,Block%!4,Block%!24)
  46.  9 : 
  47. _Menu_Decode
  48. &$   
  49.  17,18,19: 
  50. _Message_Receive
  51.  *****************************************************************
  52.  *                     Menu definitions                          *
  53.  *****************************************************************
  54. _Menu_CreateMain
  55.  "MenuUtil_New",,"DrawEdit" 
  56.  menu_iconbar%
  57. 1!   
  58.  "MenuUtil_Add",,"Info" 
  59. 2&      
  60.  "MenuUtil_SubMenu",,info%
  61.       
  62.  "MenuUtil_Dots",,
  63. 4'   
  64.  "MenuUtil_Add",,"Quit","Quit"
  65.  "MenuUtil_New",,"DrawEdit" 
  66.  menu_window%
  67. 7    
  68.  "MenuUtil_Add",,"Info"
  69. 8&      
  70.  "MenuUtil_SubMenu",,info%
  71. 95   
  72.  "MenuUtil_Add",,"Save
  73. ","Save" 
  74.  menu_save%
  75. :&      
  76.  "MenuUtil_SubMenu",,save%
  77. ;'      
  78.  "MenuUtil_Fade",,unloaded%
  79. _Menu_Decode
  80.  handler$,handler%,adjust%
  81.  "MenuUtil_Decode",,Block% 
  82.  handler%,adjust%
  83. handler$=$handler%
  84.  handler$ 
  85. C"   
  86.  "Quit"      : 
  87. _CloseDown
  88. D1   
  89.  "Save"      : 
  90. _Window_Open(save%,-1,-1)
  91.  adjust% 
  92.  "MenuUtil_Show"
  93.  *****************************************************************
  94.  *                    Template definitions                       *
  95.  *****************************************************************
  96. _TemplatesLoad
  97.  Version 1.48
  98.  template_Block% 6000
  99.  make sure maxws% is large enough for all icons
  100. Q/maxws%=6204:
  101.  ws% maxws%:curws%=ws%        
  102. "Wimp_OpenTemplate",,"<DrawEdit$Dir>.Templates"
  103. "Wimp_LoadTemplate",,template_Block%,ws%,ws%+maxws%,-1,"info",0 
  104.  ,,curws%
  105. "Wimp_CreateWindow",,template_Block% 
  106.  info%
  107. "Wimp_LoadTemplate",,template_Block%,curws%,ws%+maxws%,-1,"save",0 
  108.  ,,curws%
  109. "Wimp_CreateWindow",,template_Block% 
  110.  save%
  111. "Wimp_LoadTemplate",,template_Block%,curws%,ws%+maxws%,-1,"options",0 
  112.  ,,curws%
  113. "Wimp_CreateWindow",,template_Block% 
  114.  main%
  115. "Wimp_CloseTemplate"
  116.  *****************************************************************
  117.  *                         Mouse actions                         *
  118.  *****************************************************************
  119. _MouseClick(window%,icon%,button%)
  120.  window_height%
  121.  window%=-2 
  122.  icon%=iconbar_icon% 
  123.  button% 
  124. d6      
  125.  "MenuUtil_Show",menu_iconbar%,Block%
  126. e)      
  127. _Window_Open(main%,-1,-1)
  128.  window% 
  129.       
  130.  save%
  131.       
  132.  icon% 
  133. mB         
  134.  1  : 
  135. _DragSave(save%)      :
  136.  Start drag operation
  137.       
  138.  main%
  139.       
  140.  button% 
  141. r:         
  142.  2  : 
  143.  "MenuUtil_Show",menu_window%,Block%
  144.       
  145.  *****************************************************************
  146.  *         Actions when message is received from the WIMP        *
  147.  *****************************************************************
  148. _Message_Receive
  149.  Version 1.58
  150.  Block%!16 
  151.  0      : 
  152. _CloseDown
  153.  1      : 
  154. _Message_Data_Save
  155.  2      : 
  156. _Message_AcknowlegeSave
  157.  3      : 
  158. _Message_LoadOpen(Block%)
  159.  10     : 
  160. _Message_DesktopSave(Block%!20)
  161.  &502   : 
  162. _HelpDefinitions
  163.  &400C2 : 
  164. _Message_NewTask
  165.  &400CC : 
  166. _Window_Iconise
  167. _Message_Data_Save
  168. )Block%!0=(48+
  169. ("<Wimp$Scrap> "))
  170. Block%!12=Block%!8
  171. "Block%!16=2     :
  172.  DataSaveAck
  173. $(Block%+44)="<Wimp$Scrap>"
  174.  "Wimp_SendMessage",17,Block%,Block%!4
  175. _Message_NewTask
  176. newtaskid%=Block%!4
  177. /newtask$=
  178. _Convert_BlockToString(Block%+28)
  179.  newtask$="DrawEdit" 
  180.  newtaskid%<>myid% 
  181. _CloseDown
  182. _Message_LoadOpen(Block%)
  183.  Block%!40 
  184.  &AFF
  185. _Drawfile_Load(
  186. _Convert_BlockToString(Block%+44)) :
  187.  loads the file
  188. _Window_Open(main%,-1,-1)
  189.  2002,""  
  190. _CloseDown
  191.  Version 1.64
  192. "Wimp_CloseDown"
  193. _Message_DesktopSave(file%)
  194.  Block%!12=Block%!8:
  195. "Wimp_SendMessage",19,Block%,Block%!4:
  196.  The above line acknowledges the message if an error occurs, thereby
  197.  aborting the desktop save.
  198. #file%,"Run <DrawEdit$Dir>.!RunImage"
  199. _Message_AcknowlegeSave
  200.  Version 1.61
  201.  pathname$
  202. 0pathname$=
  203. _Convert_BlockToString(Block%+44)
  204. _Icon_Write(save%,0,pathname$)
  205. _Drawfile_Save(pathname$)
  206. Block%!0=40+
  207.  pathname$+4
  208. Block%!0+=4-(Block%!0 
  209. $Block%!16=3 : 
  210.  Message_DataLoad
  211. Block%!36=0
  212. Block%!40=&FF8
  213. $(Block%+44)=pathname$+
  214.  "Wimp_SendMessage",18,Block%,senderwindow%,sendericon%
  215.  *****************************************************************
  216.  *                        Error Handling                         *
  217.  *****************************************************************
  218. _ErrorHandler
  219.  sel%
  220.  "Wimp_DragBox",,-1
  221. error$=
  222.  2001  : error$="Could not extend block."+" at Line "+
  223.  2002  : error$="This File type ("+
  224. ~Block%!40+") cannot be handled by DrawEdit."
  225.  2003  : error$=file$+" is too long to be handled by DrawEdit or Draw. Split it up, and reload it.":
  226. #file%
  227.  2004  : error$="The concatenated data is too long to be handled by DrawEdit or Draw. Split it up, and reload it.":
  228. #file%
  229.   : error$="Error "+
  230. )+" at Line "+
  231. )+": "+
  232.  !Block%=
  233. :$(Block%+4)=error$
  234.  "Wimp_ReportError",Block%,%10011,"DrawEdit" 
  235.  ,sel%
  236.  sel%=2 
  237. _CloseDown
  238.  *****************************************************************
  239.  *                         Drag routines                         *
  240.  *****************************************************************
  241. _DragSave(window%)
  242.  Version 1.60
  243.  LOCAL offset_x%,offset_y%
  244. !Block%=window%
  245.  "Wimp_GetWindowState",,Block%
  246.  offset_x%=Block%!4-Block%!20
  247. !offset_y%=Block%!16-Block%!24
  248. QBlock%!0=window%                                    :
  249.  Window owning the icon
  250. MBlock%!4=1                                          :
  251.  Icon to be dragged
  252.  "Wimp_GetIconState",,Block%
  253. Block%!0=Block%!8+offset_x%
  254.  Block%!4=Block%!12+offset_y%
  255.  Block%!8=Block%!16+offset_x%
  256. !Block%!12=Block%!20+offset_y%
  257.  SYS "Wimp_DragBox",,Block%
  258.  "DragASprite_Start",%11001111,1,"file_aff",Block%
  259. _DragBoxEnd(leafname$)
  260.  "DragASprite_Stop"
  261.  pointer%
  262. pointer%=
  263.  leafname$
  264.  pointer%>0 
  265. leafname$,pointer%,1)<>"."
  266. pointer%-=1
  267. $leafname$=
  268. leafname$,pointer%+1)
  269.  "Wimp_GetPointerInfo",,Block%
  270. senderwindow%=Block%!12
  271. sendericon%=Block%!16
  272. Block%!20=senderwindow%
  273. Block%!24=sendericon%
  274. Block%!28=Block%!0
  275. Block%!32=Block%!4
  276. Block%!0=44+
  277.  leafname$
  278. Block%!0+=4-(Block%!0 
  279. Block%!4=0
  280. Block%!8=0
  281. Block%!12=0
  282. $Block%!16=1 : 
  283.  Message_DataSave
  284. +Block%!36=0 : 
  285.  Length of proposed save
  286. Block%!40=&AFF
  287. $(Block%+44)=leafname$+
  288.  "Wimp_SendMessage",17,Block%,senderwindow%,sendericon%
  289.  *****************************************************************
  290.  *                         Icon handling                         *
  291.  *****************************************************************
  292. _Icon_Read(window%,icon%)
  293.  result$
  294. Block%!0=window%
  295. Block%!4=icon%
  296.  "Wimp_GetIconState",,Block%
  297.  (Block%!24 
  298.  (1<<8))<>0 
  299.  result$=$(Block%!28) 
  300.  result$=$(Block%+28)
  301. =result$
  302. _Icon_Write(window%,icon%,text$)
  303. BBlock%!0=window%:Block%!4=icon%:
  304.  "Wimp_GetIconState",,Block%
  305. (text$)>(Block%!36)-1 
  306.  ((Block%!24) 
  307.  (1<<9))=(1<<9) 
  308.  Right-justified
  309. '    text$="
  310. text$,(Block%!36)-2)
  311. #    
  312.  Left-justified or centred
  313. /    text$=
  314. text$,(Block%!36)-1):
  315. text$)="
  316.  ^ Ensures the text can't overflow the maximum space in the icon.
  317.  $(Block%!28)<>text$ 
  318. /  $(Block%!28)=text$:Block%!8=0:Block%!12=0
  319.  "Wimp_SetIconState",,Block%
  320.  "Wimp_GetCaretPosition",,Block%
  321.  Block%!0=window% 
  322.  Block%!4=icon% 
  323.  If this icon owns the caret, then put it at the end.
  324.  "Wimp_SetCaretPosition",window%,icon%,0,0,-1,
  325. (text$)
  326. _Icon_State_Selected(window%,icon%)
  327.  sel%
  328. sel%=
  329. +BBlock%!0=window%:Block%!4=icon%:
  330.  "Wimp_GetIconState",,Block%
  331.  ((Block%!24) 
  332.  (1<<21))=(1<<21) 
  333.  sel%=
  334. -    =sel%
  335. _Icon_Alter_Flags(window%,icon%,bit%,sel%)
  336. Block%!0=window%
  337. Block%!4=icon%
  338.  sel% 
  339.   Block%!8=1<<(bit%-1)
  340.   Block%!8=0
  341. Block%!12=1<<(bit%-1)
  342.  "Wimp_SetIconState",,Block%
  343. _Icon_Create(window%,xmin%,ymin%,xmax%,ymax%,flags%,sprite$)
  344.  icon%
  345. Block%!0=window%
  346. Block%!4=xmin%
  347. Block%!8=ymin%
  348. Block%!12=xmax%
  349. Block%!16=ymax%
  350. Block%!20=flags%
  351. $(Block%+24)=sprite$
  352.  "Wimp_CreateIcon",,Block% 
  353.  icon%
  354. =icon%
  355.  *****************************************************************
  356.  *                         Miscellaneous                         *
  357.  *****************************************************************
  358. _ScreenReadSize
  359.  xw%,xh%,xf%,yf%
  360.  "OS_ReadModeVariable",
  361.  ,,xw%
  362.  "OS_ReadModeVariable",
  363.  ,,xh%
  364.  "OS_ReadModeVariable",
  365.  ,,xf%
  366.  "OS_ReadModeVariable",
  367.  ,,yf%
  368. scw%=xw%<<xf%
  369. sch%=xh%<<yf%
  370. _Convert_BlockToString(pointer%)   :
  371.  Reads a zero terminated string
  372.  result$
  373.    result$+=
  374. ?pointer%
  375.    pointer%+=1
  376.  ?pointer%=0 
  377.  ?pointer%=13
  378. =result$
  379. _KeyPressed(window%,icon%,char%)
  380.  "Wimp_GetPointerInfo",,Block%
  381.  CASE Block%!12 OF
  382.  ENDCASE   
  383.  "Wimp_ProcessKey",char%
  384.  *****************************************************************
  385.  *                       Window routines                         *
  386.  *****************************************************************
  387. _Window_Open(window%,x%,y%)  :
  388.  If x% or y% =-1 (TRUE) then the window is centered
  389.  window_xsize%,window_ysize%
  390. Block%!0=window%
  391.  "Wimp_GetWindowState",,Block%
  392. o$window_xsize%=Block%!12-Block%!4
  393. p$window_ysize%=Block%!16-Block%!8
  394. s'    Block%!4=(scw%-window_xsize%)/2
  395. t'    Block%!8=(sch%-window_ysize%)/2
  396.   Block%!4=x%
  397.   Block%!8=y%
  398. z$Block%!12=Block%!4+window_xsize%
  399. {$Block%!16=Block%!8+window_ysize%
  400. Block%!28=-1
  401.  "Wimp_OpenWindow",,Block%
  402. _WindowState_Open(window%)
  403.  result%
  404.  Returns TRUE if window is open; false otherwise
  405. 5Block%!0=window%:
  406.  "Wimp_GetWindowState",,Block%
  407.  ((Block%!32) 
  408.  (1<<16))=(1<<16) 
  409.  result%=
  410.  result%=
  411. =result%
  412. _Window_Close(window%)
  413. Block%!0=window%
  414.  "Wimp_GetWindowState",,Block%
  415.  "Wimp_CloseWindow",,Block%
  416. _Window_Iconise
  417. HBlock%!0=56:Block%!12=Block%!8:Block%!16=&400CC:
  418.  Message_WindowInfo
  419.  Block%!20=0 
  420.  Window handle
  421. Block%!24=0
  422. :$(Block%+28)="DrawEdit"+
  423. 0    :
  424.  uses sprite ic_<name>
  425. 8$(Block%+36)="DrawEdit"          :
  426.  uses text <name>
  427.  "Wimp_SendMessage",17,Block%,Block%!4
  428.  *****************************************************************
  429.  *                      Interactive Help                         *
  430.  *****************************************************************
  431. _HelpDefinitions
  432. 9Block%!12=Block%!8:Block%!16=&503:helpinfo%=Block%+20
  433.  Block%!32 gives window, Block%!36 gives icon
  434.  Block%!32 
  435. _HelpSend("This is the DrawEdit icon.")
  436. @        
  437. _HelpSend("Click MENU for information or to quit.")
  438. C        
  439. _HelpSend("Click SELECT to open the DrawEdit window.")
  440.  main%:
  441.  Block%!36 
  442. 2      
  443.  8  : 
  444. _HelpSend("Toggle Grid On/Off.")
  445. 7      
  446.  9  : 
  447. _HelpSend("Toggle Grid Lock On/Off.")
  448. >      
  449.  10 : 
  450. _HelpSend("Toggle Grid Auto Adjust On/Off.")
  451. <      
  452.  19 : 
  453. _HelpSend("Toggle Isometric Grid On/Off.")
  454. 1      
  455.  22 : 
  456. _HelpSend("Toggle Grid Units.")
  457. 8      
  458.  21  : 
  459. _HelpSend("Enter Grid Subdivisions.")
  460. A      
  461.  11,12,13,14,15,16  : 
  462. _HelpSend("Select Paper Size.")
  463. <      
  464.  17,18  : 
  465. _HelpSend("Select Paper Orientation.")
  466. 8      
  467.  23,25  : 
  468. _HelpSend("Enter the Zoom Scale.")
  469. 8      
  470.  26  : 
  471. _HelpSend("Toggle Zoom Lock On/Off.")
  472. 6      
  473.  27  : 
  474. _HelpSend("Toggle Toolbox On/Off.")
  475.  save%
  476.  Block%!36 
  477. O      
  478. _HelpSend("Drag this icon to a filer window to save the file.")
  479. W              
  480. _HelpSend("CSV, Data, Drawfile, DXF and Screenshots are supported.")
  481. 5      
  482. _HelpSend("Enter the filename here.")
  483.  info%:
  484. _HelpSend("This window displays information about DrawEdit.")
  485. ?helpinfo%=0
  486. 'Block%!0=(helpinfo%+4-Block%) 
  487.  "Wimp_SendMessage",17,Block%,Block%!4
  488. _HelpSend(text$)
  489. $helpinfo%=text$+"|M"
  490. helpinfo%+=
  491. (text$)+2
  492.  *****************************************************************
  493.  *                        Drawfile handling                      *
  494.  *****************************************************************
  495. _Drawfile_Load(filename$)
  496.  a%,file%
  497. unloaded%=
  498.  "MenuUtil_Fade",menu_save%,unloaded%
  499. stack%=
  500. _Heap_Free(stack%)
  501. stack% = 
  502. _Heap_Claim(4)
  503.  "Hourglass_On"
  504. file%=
  505.  filename$
  506. file$=filename$
  507. )temp% = 
  508. _Heap_Extend(stack%,
  509. #file%)
  510.  temp% <> 0 
  511.  stack% = temp% 
  512.  2001,""
  513.  "OS_GBPB",3,file%,stack%,
  514. #file%
  515. #file%-4
  516. #file%
  517. _Read_Paper
  518. _Read_Aspect
  519. _Read_Divisions
  520. _Read_AutoAdjust        
  521. _Read_Grid            
  522. _Read_GridLock           
  523. _Read_Units              
  524. _Read_ZoomScale             
  525. _Read_ZoomLock
  526. _Read_Toolbox
  527.  "Hourglass_Off"        
  528. _Drawfile_Save(pathname$)
  529.  "Hourglass_On"
  530. file%=
  531.  pathname$
  532. _Drawfile_CheckOptionValidity
  533. _Drawfile_Alter
  534. "SetType "+pathname$+" AFF"
  535. #file%
  536.  "Hourglass_Off"
  537.  "Wimp_CreateMenu",,-1
  538. _WindowState_Open(save%))=
  539. _Window_Close(save%)
  540. _Drawfile_CheckOptionValidity
  541.  Version 1.49
  542. #divs%=
  543. _Icon_Read(main%,21)) 
  544. #zooma%=
  545. _Icon_Read(main%,23))
  546. #zoomb%=
  547. _Icon_Read(main%,25))
  548.  divs%=0  
  549.  divs%=10:
  550. _Icon_Write(main%,21,
  551. (divs%))
  552.  zooma%=0 
  553.  zooma%=4:
  554. _Icon_Write(main%,23,
  555. (zooma%))
  556.  zoomb%=0 
  557.  zoomb%=1:
  558. _Icon_Write(main%,25,
  559. (zoomb%))
  560. _Drawfile_Alter
  561.  Version 1.50
  562.  grid%,lock%,autoadj%,paper%,portrait%,isom%,inches%,zlock%,toolbox%
  563.  papernumber%
  564. inches%=0:paper%=&100
  565. _Icon_State_Selected(main%,8)  
  566.  grid%=1  
  567. _Icon_State_Selected(main%,9)  
  568.  lock%=1  
  569. _Icon_State_Selected(main%,10) 
  570.  autoadj%=1  
  571.  papernumber%=1 
  572. _Icon_State_Selected(main%,10+papernumber%) 
  573.  paper%=&100*papernumber%
  574. _Icon_State_Selected(main%,18) 
  575.  portrait%=&10
  576. _Icon_State_Selected(main%,19) 
  577.  isom%=1    
  578. _Icon_State_Selected(main%,22) 
  579.  inches%=1  
  580. _Icon_State_Selected(main%,26) 
  581.  zlock%=1 
  582. _Icon_State_Selected(main%,27) 
  583.  toolbox%=1
  584. #stack%!64=(paper%)             
  585. $stack%!68=(portrait%)           
  586. #stack%!80=(divs%)              
  587. *stack%!84=(isom%)                     
  588. #stack%!88=(autoadj%)           
  589. &stack%!92=(grid%)                 
  590. #stack%!96=(lock%)              
  591. (stack%!100=(inches%)                
  592. stack%!104=(zooma%)
  593. stack%!108=(zoomb%)
  594. $stack%!112=(zlock%)             
  595. stack%!116=(toolbox%)
  596.  "OS_GBPB",1,file%,stack%,n%+4
  597.  *****************************************************************
  598.  *                      Wimp Heap Routines                       *
  599.  *****************************************************************
  600. _Heap_Initialise
  601.  heap_temp%
  602.  "OS_ReadMemMapInfo" 
  603.  _wh_pagesize%
  604. (#  _wh_heapsize% = _wh_pagesize%
  605.  "Wimp_SlotSize",-1,-1 
  606.  heap_temp%
  607. *'  _wh_heaploc% = heap_temp% + &8000
  608.  "Wimp_SlotSize",_wh_heaploc% + _wh_heapsize% - &8000,-1
  609.  "OS_Heap",0,_wh_heaploc%,,_wh_heapsize%
  610. _Heap_Claim(heapsize%)
  611.  heap_temp%,result%
  612.  "XOS_Heap",2,_wh_heaploc%,,heapsize% 
  613.  ,,heap_temp%
  614.  heap_temp% <> 0 
  615.      result%=heap_temp%
  616. 51     
  617. _Heap_InternalExtend(heapsize%) = 
  618.         result%=0
  619.      
  620. 8?        
  621.  "XOS_Heap",2,_wh_heaploc%,,heapsize% 
  622.  ,,result%
  623. 9!        
  624. _Heap_InternalShrink
  625.      
  626. =result%
  627. _Heap_Extend(block%, change%)
  628.  heap_temp%,heap_temp2%,heap_temp3%,result%
  629.   result%=0
  630.  "XOS_Heap",4,_wh_heaploc%,block%,change% 
  631.  ,,heap_temp% ;heap_temp2%
  632. (heap_temp2% 
  633.  1) = 0 
  634.      result%=heap_temp%
  635. E<     
  636.  "OS_Heap",6,_wh_heaploc%,block% 
  637.  ,,,heap_temp3%
  638. F;     
  639. _Heap_InternalExtend(heap_temp3%+change%) = 
  640.         result%=0
  641.      
  642. IS        
  643.  "XOS_Heap",4,_wh_heaploc%,block%,change% 
  644.  ,,heap_temp% ;heap_temp2%
  645. J7        
  646. (heap_temp2% 
  647.  1) = 0 
  648.  result%=heap_temp%
  649.      
  650. =result%
  651. _Heap_Free(block%)
  652.  "OS_Heap",3,_wh_heaploc%,block%
  653. _Heap_InternalShrink
  654. _Heap_LargestFree
  655.  result%
  656.  "OS_Heap",1,_wh_heaploc% 
  657.  ,,result%
  658. =result%
  659.  *****************************************************************
  660.  *                 Wimp Heap Routines (Internal)                 *
  661.  *****************************************************************
  662. _Heap_InternalExtend(size%)
  663.  heap_temp%,heap_temp2%,result%
  664. _@  heap_temp% = 
  665. _Heap_InternalRoundup(_wh_heapsize% + size%)
  666.  "XWimp_SlotSize",_wh_heaploc% + heap_temp% - &8000,-1 
  667.  ;heap_temp2%
  668. (heap_temp2% 
  669.  1) = 1 
  670.      result%=
  671. d@     
  672.  "OS_Heap",5,_wh_heaploc%,,heap_temp% - _wh_heapsize%
  673. e#     _wh_heapsize% = heap_temp%
  674.      result%=
  675. =result%
  676. _Heap_InternalShrink
  677.  heap_temp%,heap_temp2%
  678. l   heap_temp% = _wh_heapsize%
  679.  "XOS_Heap",5,_wh_heaploc%,,-heap_temp% 
  680.  ,,,heap_temp2%
  681.  heap_temp2% = -heap_temp% 
  682.  heap_temp2% = heap_temp%
  683. oI  _wh_heapsize% = 
  684. _Heap_InternalRoundup(_wh_heapsize% - heap_temp2%)
  685.  "XOS_Heap",5,_wh_heaploc%,,_wh_heapsize% - (heap_temp% - heap_temp2%)
  686.  "Wimp_SlotSize",_wh_heaploc% + _wh_heapsize% - &8000,-1
  687. _Heap_InternalRoundup(result%)
  688.  heap_temp%
  689. (result% 
  690.  _wh_pagesize%) <> 0 
  691. w>    heap_temp% = _wh_pagesize% - (result% 
  692.  _wh_pagesize%)
  693.     result% += heap_temp%
  694. =result%
  695.  *****************************************************************
  696.  *                    Read Drawfile Options                      *
  697.  *****************************************************************
  698. _Read_Paper
  699. paper%=stack%!64/&100
  700.  a%=1 
  701.  a%=paper% 
  702. _Icon_Alter_Flags(main%, 10+a%,22,
  703. _Icon_Alter_Flags(main%, 10+a%,22,
  704. _Read_Aspect
  705. portrait%=stack%!68
  706.  portrait%=&10 
  707. _Icon_Alter_Flags(main%, 18,22,
  708. _Icon_Alter_Flags(main%, 17,22,
  709. _Icon_Alter_Flags(main%, 17,22,
  710. _Icon_Alter_Flags(main%, 18,22,
  711. _Read_Divisions
  712. divs%=stack%!80
  713. _Icon_Write(main%,21,
  714. (divs%))
  715. isom%=stack%!84
  716.  isom%=1 
  717. _Icon_Alter_Flags(main%, 19,22,
  718. _Icon_Alter_Flags(main%, 19,22,
  719. _Read_AutoAdjust
  720. autoadj%=stack%!88
  721.  autoadj%=1 
  722. _Icon_Alter_Flags(main%, 10,22,
  723. _Icon_Alter_Flags(main%, 10,22,
  724. _Read_Grid
  725. grid%=stack%!92
  726.  grid%=1 
  727. _Icon_Alter_Flags(main%,8,22,
  728. _Icon_Alter_Flags(main%,8,22,
  729. _Read_GridLock
  730. lock%=stack%!96
  731.  lock%=1 
  732. _Icon_Alter_Flags(main%,9,22,
  733. _Icon_Alter_Flags(main%,9,22,
  734. _Read_Units
  735. inches%=stack%!100
  736.  inches%=1 
  737. _Icon_Alter_Flags(main%,22,22,
  738. _Icon_Alter_Flags(main%,22,22,
  739. _Read_ZoomScale             
  740. zooma%=stack%!104
  741. zoomb%=stack%!108
  742. _Icon_Write(main%,23,
  743. (zooma%))
  744. _Icon_Write(main%,25,
  745. (zoomb%))
  746. _Read_ZoomLock
  747. zlock%=stack%!112
  748.  zlock%=1 
  749. _Icon_Alter_Flags(main%,26,22,
  750. _Icon_Alter_Flags(main%,26,22,
  751. _Read_Toolbox
  752. toolbox%=stack%!116
  753.  toolbox%=1 
  754. _Icon_Alter_Flags(main%,27,22,
  755. _Icon_Alter_Flags(main%,27,22,
  756.