home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrpmac21.zip / VRPrFtr.VRM < prev    next >
Text File  |  1995-10-15  |  5KB  |  195 lines

  1. /* Custom mainline for macro */
  2.  
  3.     signal on SYNTAX name _VRESyntax
  4.     signal _VREMain
  5.  
  6. _VRESyntax:
  7.     parse source . . _VRESourceSpec
  8.     call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL":" ErrorText(rc), "Error!"
  9.     call VRFini
  10.     exit 32000
  11.  
  12. _VREMain:
  13. /*:VRX         Main
  14. */
  15. /*  Main
  16. */
  17. Main:
  18. /*  Process the arguments.
  19.     Get the parent window.
  20. */
  21.     parse source . calledAs .
  22.     parent = ""
  23.     argCount = arg()
  24.     argOff = 0
  25.     if( calledAs \= "COMMAND" )then do
  26.         if argCount >= 1 then do
  27.             parent = arg(1)
  28.             argCount = argCount - 1
  29.             argOff = 1
  30.         end
  31.     end; else do
  32.         call VROptions 'ImplicitNames'
  33.     end
  34.     InitArgs.0 = argCount
  35.     if( argCount > 0 )then do i = 1 to argCount
  36.         InitArgs.i = arg( i + argOff )
  37.     end
  38.     drop calledAs argCount argOff
  39.  
  40. /*  Load the windows
  41. */
  42.     call VRInit
  43.     parse source . . spec
  44.     _VREPrimaryWindowPath = ,
  45.         VRParseFileName( spec, "dpn" ) || ".VRW"
  46.     _VREPrimaryWindow = ,
  47.         VRLoad( parent, _VREPrimaryWindowPath )
  48.     drop parent spec
  49.     if( _VREPrimaryWindow == "" )then do
  50.         call VRMessage "", "Cannot load window:" VRError(), ,
  51.             "Error!"
  52.         _VREReturnValue = 32000
  53.         signal _VRELeaveMain
  54.     end
  55.  
  56. /*  Process events
  57. */
  58.     call Init
  59.     signal on halt
  60.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  61.         _VREEvent = VREvent()
  62.         interpret _VREEvent
  63.     end
  64. _VREHalt:
  65.     _VREReturnValue = Fini()
  66.     call VRDestroy _VREPrimaryWindow
  67. _VRELeaveMain:
  68.     call VRFini
  69. exit _VREReturnValue
  70.  
  71. VRLoadSecondary:
  72.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  73.     if __vrlsWait then do
  74.         call VRFlush
  75.     end
  76.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  77.     if __vrlsHWnd = '' then signal __vrlsDone
  78.     if __vrlsWait \= 1 then signal __vrlsDone
  79.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  80.     __vrlsTmp = __vrlsWindows.0
  81.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  82.         __vrlsTmp = 1
  83.     end
  84.     else do
  85.         __vrlsTmp = __vrlsTmp + 1
  86.     end
  87.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  88.     __vrlsWindows.0 = __vrlsTmp
  89.     do while( VRIsValidObject( VRWindow() ) = 1 )
  90.         __vrlsEvent = VREvent()
  91.         interpret __vrlsEvent
  92.     end
  93.     __vrlsTmp = __vrlsWindows.0
  94.     __vrlsWindows.0 = __vrlsTmp - 1
  95.     call VRWindow __vrlsWindows.__vrlsTmp 
  96.     __vrlsHWnd = ''
  97. __vrlsDone:
  98. return __vrlsHWnd
  99.  
  100. /*:VRX         dlg_Close
  101. */
  102. dlg_Close:
  103.     call Quit
  104. return
  105.  
  106. /*:VRX         dlg_Help
  107. */
  108. dlg_Help: 
  109.     address cmd 'view vrprint Formatting Characters'
  110. return
  111.  
  112. /*:VRX         Fini
  113. */
  114. Fini:
  115.     window = VRWindow()
  116.     call VRSet window, "Visible", 0
  117.     drop window
  118. return ret
  119.  
  120. /*:VRX         Halt
  121. */
  122. Halt:
  123.     signal _VREHalt
  124. return
  125.  
  126. /*:VRX         Init
  127. */
  128. Init:
  129.  
  130.     ret = '';
  131.  
  132.     if InitArgs.0 < 2 then
  133.         call Quit;
  134.  
  135.     object = InitArgs.1;
  136.     parse var InitArgs.2 method'_'var1
  137.  
  138.     window = VRWindow()
  139.     call VRSet "DT_1", "Caption", var1
  140.     ok = VRSet( window, "Caption", method )
  141.     call VRMethod window, "CenterWindow"
  142.     call VRSet window, "Visible", 1
  143.     call VRMethod window, "Activate"
  144.     drop window
  145. return
  146.  
  147. /*:VRX         PB_accept_Click
  148. */
  149. PB_accept_Click: 
  150.     text = VRGet( "EF_Value", "Value" )
  151.     set = VRGet( "CB_1", "Set" )
  152.     if set then
  153.         text = '"' || text || '"'
  154.  
  155.     font = VRGet( "EF_font", "Value" )
  156.     set = VRGet( "CB_2", "Set" )
  157.     if set then
  158.         font = '"' || font || '"'
  159.  
  160.     pts = VRGet( "SPIN_Pts", "Value" )
  161.     
  162.     fill = VRGet( "SPIN_fill", "Value" )
  163.     line = VRGet( "SPIN_line", "Value" )
  164.     
  165.     tc = VRGet( "DDCB_tc", "Value");
  166.     if VRMethod( "DDCB_tc", "FindString", tc) > 0 then
  167.         tc = '"' || tc || '"'
  168.     lc = VRGet( "DDCB_lc", "Value");
  169.     if VRMethod( "DDCB_lc", "FindString", lc) > 0 then
  170.         lc = '"' || lc || '"'
  171.     fc = VRGet( "DDCB_fc", "Value");
  172.     if VRMethod( "DDCB_fc", "FindString", fc) > 0 then
  173.         fc = '"' || fc || '"'
  174.  
  175.     ret = 'ok = VRMethod( "' || object ||'", "' || method || '",' font',' pts',' ,
  176.            fill',' line',' text',' lc',' fc',' tc ");"
  177.     call Quit
  178. return
  179.  
  180. /*:VRX         PB_Cancel_Click
  181. */
  182. PB_Cancel_Click: 
  183.     ret = '';
  184.     call Quit;
  185. return
  186.  
  187. /*:VRX         Quit
  188. */
  189. Quit:
  190.     window = VRWindow()
  191.     call VRSet window, "Shutdown", 1
  192.     drop window
  193. return
  194.  
  195.