/*
 * install.vrm -- VXREZ installation routine.  Call this from the
 *                VX-REXX profile.vrm file.
 */

    parse arg main_window

    main_window = VRGet( main_window, "Self" )

    call VREMacroAdd "~Resource editor...", VREPath() || "MACROS\VXREZ\editres.vrm", "Window", "Open", "NotDefault"

    call ReplaceEvent "__VREProjRunMenuItem", "run.vrm", main_window
    call ReplaceEvent "__VREProjMakeEXEMenuItem", "makeexe.vrm", main_window

    call VRCreate "__VREProjectMenu", "MenuItem", "Caption", "-"

    eventstr = 'call VRMacro "' || VREPath() || 'MACROS\VXREZ\editres.vrm"'
    call VRCreate "__VREProjectMenu", "MenuItem",,
                  "Caption", "Resource editor...",,
                  "Accelerator", "{F2}",,
                  "Click", eventstr

/*
    eventstr = 'call VRMacro "' || VREPath() || 'MACROS\VXREZ\runexe.vrm"'
    call VRCreate "__VREProjectMenu", "MenuItem",,
                  "Accelerator", "{F3}",,
                  "Caption", "Run EXE file",,
                  "Click", eventstr
                  */

    call VRMethod main_window, "InstallAccelerators"

    return

/*
 * ReplaceEvent -- Find the event code for a given object, store it
 *                 away and replace it with our own.
 */

ReplaceEvent: procedure
    parse arg name, file, main_window

    eventstr = VRGet( name, 'Click' )
    call VRMethod 'Application', 'PutVar', 'eventstr', name

    eventstr = 'call VRMacro "' || VREPath() || 'MACROS\VXREZ\' || file
    eventstr = eventstr || '", ' || main_window
    call VRSet name, 'Click', eventstr

    return
