home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / p2demo21.exe / PEL / LOCAL.PEL < prev    next >
Text File  |  1995-02-14  |  14KB  |  295 lines

  1. # $Header:   P:\source\wmacros\local.pev   1.37   14 Feb 1995 08:59:06   WALKER  $
  2. # $Tabs:4 7$
  3.  
  4. ##############################################################################
  5. #
  6. #       Compuware Corporation
  7. #         31440 Northwestern Highway
  8. #           Farmington Hills, Michigan 48334-2564
  9. #
  10. #   This source code listing contains information that is
  11. #   proprietary to Compuware Corporation and may not be copied
  12. #   duplicated, translated, transmitted, stored, retrieved
  13. #   or in any manner or by any method conveyed or disclosed
  14. #   to a third party or parties without express written
  15. #   permission from Compuware Corporation.
  16. #
  17. #  
  18. ##############################################################################
  19.  
  20. #### $Workfile:   local.pel  $: User's customized startup
  21.  
  22. ###
  23. # Each user may have a local copy of this file in order to augment the 
  24. # standard macro library.  The function "local_setup" is called from within 
  25. # the startup function.
  26. #
  27. # As shipped, this function does virtually nothing.  However, sample code 
  28. # and advisory comments have been included to simplify the inclusion of 
  29. # popular customizations into a customer's local_setup function.  Some of 
  30. # the customizations interact, so this outline illuminates a path of least 
  31. # astonishment.
  32. #
  33. # If any changes are made to this or any other .pel source file, the
  34. # user must recompile the "cpe.ae" file using the PEL compiler.
  35. # (For details on how this is done, see chapter 10 in the User's Manual
  36. # entitled "Getting Started With PEL."
  37.  
  38. global function local_setup()
  39. {
  40.    ###
  41.    # (At this point in system initialization, no windows have yet been 
  42.    # created and a default system buffer named "Scratch" has been 
  43.    # initialized.)
  44.  
  45.    # initialize the dde mechanism of the editor.  This will allow the 
  46.    # editor to make use of the stub program
  47.    initialize_dde()
  48.  
  49.    # initialize the IBM WorkFrame dde mechanism of the editor.  This will
  50.    # allow the editor to make use of the IBM WorkFrame.
  51.    #initialize_wf_dde()
  52.  
  53.    ###
  54.    # The emulation modes modify many system variables.  For your 
  55.    # customizations to persist, you probably should pick an emulation 
  56.    # mode before any other customization.  Pick only one from the 
  57.    # list below.
  58.  
  59.    # cua()
  60.    # native()   # Sage Professional Editor's Native mode
  61.    # vi()
  62.    # brief()
  63.    # emacs()
  64.    # ispf()     # If turned on, MUST also be present in config file!
  65.  
  66.     ###
  67.     # There are several global parameters you may wish to modify:
  68.  
  69.    # pause_on_error = 1    # enable pausing after every error
  70.      save_state = 1        # enable automatic state file saves/restores
  71.      save_flags = set_flag_bits( save_flags, SAVE_SETTINGS, SAVE_SETTINGS) # enable automatic settings saves/restores
  72.      save_flags = set_flag_bits( save_flags, SAVE_COMMANDS, SAVE_COMMANDS) # enable automatic command history saves/restores
  73.      save_flags = set_flag_bits( save_flags, SAVE_SEARCH  , SAVE_SEARCH)   # enable automatic search history saves/restores
  74.      save_flags = set_flag_bits( save_flags, SAVE_REPLACE , SAVE_REPLACE)  # enable automatic replace history saves/restores
  75.      save_flags = set_flag_bits( save_flags, SAVE_EDITFILE, SAVE_EDITFILE) # enable automatic editfile history saves/restores
  76.      save_flags = set_flag_bits( save_flags, SAVE_COMPILE , SAVE_COMPILE)  # enable automatic compile history saves/restores
  77.  
  78.     ###
  79.     # Several features are enabled by some emulation modes but not by 
  80.     # others (or in some cases they're not enabled at all).  In any case 
  81.     # you may wish to override the defaults, and they generally should 
  82.     # be set AFTER you select an emulation mode.  The toggle_... 
  83.     # functions take an optional argument: 0=> disable, 1=> enable,  
  84.     # nothing=> toggle the current state.
  85.  
  86.    # toggle_dir_sync( 1 )          # have the editor change its working dir on new current buffer
  87.    # toggle_pvcs( 3 )              # automatic pvcs gets/puts, 
  88.                                    #  see "pvcs.pel" for definition of "3"
  89.    # toggle_file_backup( 1 )       # enable file backups
  90.    # autosave( 15 )                # autosave every 15 seconds
  91.    # toggle_pause( 1 )             # enable pause on errors/warnings
  92.    # toggle_search_flags(SEARCH_CASE, 0 )       # disable case sensitive searches (default is different for each keymap)
  93.    # toggle_search_flags(SEARCH_REGEX, 1 )      # enable regular expression searches (default is different for each keymap)
  94.    # toggle_search_flags(SEARCH_FORWARD, 1 )    # enable forward searches (default is different for each keymap)
  95.    # toggle_search_flags(SEARCH_BLOCK, 1 )      # enable block restricted searches (default is different for each keymap)
  96.  
  97.     ###
  98.     # The toggle_... functions listed above affect the entire system.
  99.     # Several other toggle_... functions exist which only affect the
  100.     # current buffer or current window.  These can be used from the 
  101.     # command line or within other functions.
  102.     #
  103.  
  104.    # toggle_buffer_flags(BUFFER_OVERTYPE_MODE, 0 )     # disable overtype mode
  105.    # toggle_linenumbers( 1 )  # enable display of line numbers
  106.    # toggle_buffer_flags(BUFFER_REAL_SPACE_ONLY, 1 )   # disable entry into virtual space
  107.    # toggle_buffer_flags(BUFFER_TABS_TO_SPACES, 1)     # enable conversion of tabs to spaces during edits
  108.    # toggle_wp( 1 )           # enable continuous word wrap
  109.    
  110.     ###
  111.     # To modify the mode and operation of all regular buffers created 
  112.     # from this point on, modify the default_buffer_flags variable.
  113.     # Each flag has a unique affect on buffer edit operations.  See 
  114.     # "Library Reference" for more details.
  115.     #
  116.  
  117.    # set_default_buffer_flag( BUFFER_READ_ONLY, 1 )      # make all buffers read-only
  118.    # set_default_buffer_flag( BUFFER_OVERTYPE_MODE, 1 )  # make overtype mode the default
  119.    # set_default_buffer_flag( BUFFER_EXPAND_TABS, 1 )    # expand tabs on write
  120.    # set_default_buffer_flag( BUFFER_WP_ENABLED, 1 )     # enable continuous word wrap
  121.    # set_default_buffer_flag( BUFFER_REAL_SPACE_ONLY, 1 )# disable movement into virtual space
  122.    # set_default_buffer_flag( BUFFER_SNAP_TO_EOL, 1 )    # disable insertion past EOL
  123.    # set_default_buffer_flag( BUFFER_NO_UNDO, 1 )        # disable recording of undo information
  124.    # set_default_buffer_flag( BUFFER_TABS_TO_SPACES, 1 ) # enable convertion of tabs to spaces
  125.    # set_default_buffer_flag( BUFFER_WHOLE_LINES, 1 )    # enable display of whole lines
  126.  
  127.     ###
  128.     # Loads all .ndx files specified in the HELPNDX environment variable.
  129.     # This will allow language specific help when the F1 key is processed.
  130.     # 
  131.     # load_ndx_help()
  132.  
  133.     ###
  134.     # Some various examples of event handlers that may be attached
  135.     # to the left mouse double click.  Please refer to the PEL 
  136.     # functions by Category for a list of all the events that may
  137.     # be attached.
  138.  
  139.       # open the file that was double-clicked
  140.    #attach_event_handler( EVENT.MOUSE_LEFT_CLICK2, "open_file_under_cursor" ) 
  141.  
  142.       # do a tags auto on word that was double-clicked
  143.    #attach_event_handler( EVENT.MOUSE_LEFT_CLICK2, "tags_auto" )
  144.  
  145.       # search for word double-clicked on
  146.    #attach_event_handler( EVENT.MOUSE_LEFT_CLICK2, "gui_context_find" )
  147.  
  148.       # hilight the word that was double-clicked
  149.     attach_event_handler( EVENT.MOUSE_LEFT_CLICK2, "hilight_word_mouse" )
  150.  
  151.       # display help on word that was double-clicked
  152.    #attach_event_handler( EVENT.MOUSE_LEFT_CLICK2, "display_help_item" )
  153.  
  154.    
  155.    ###
  156.    # All other custom initialization goes here.
  157.    #
  158.    #   When setting variables here, it is advisable to set the 
  159.    #   default_... version of them variables so they take effect when 
  160.    #   windows are eventually created.
  161.    #
  162.    default_buffer_tabs = "4 7"
  163.    buffer_tabs         = "4 7"
  164.  
  165.    ###
  166.    # After local_setup() exits, startup processing proceeds as follows:
  167.    #
  168.    # 1) The configuration/state file, CPE.CFG, is processed.
  169.    # 2) Buffers are created for all files specified on the command line,
  170.    #    and command line switches are processed.
  171.    #
  172.    # Upon completion of startup processing, the editor begins accepting
  173.    # commands from the user.
  174.  
  175. }
  176.  
  177. global function local_settings()
  178. {
  179.    ###
  180.    # (At this point in system initialization, the config file has just been
  181.    #  read and any settings in here will override them)
  182.    # 
  183. }
  184.  
  185. ### additional custom startup function definitions go here,
  186. #       after local_startup():
  187.  
  188. ### place additional menus in user_menu
  189. #   "main_menu" is a global variable that contains the main menu handle
  190. global function user_menu()
  191. {
  192. }
  193.  
  194. ### place help for user menus in user_help_lines
  195. #
  196. global function user_help_lines( main_menu )
  197. {
  198. }
  199.  
  200. global function local_keys()
  201. {
  202.     ###
  203.     # Place any assign-key settings that you wish to persist in any emulation
  204.     # mode here.  This routine is called from all emulation modes to modify
  205.     # their keymap.  To assign a key in only certain emulation modes, check
  206.     # the emulation_mode variable.
  207.  
  208.     # EXAMPLE
  209.     # ------------------------------------------------------------------------
  210.     # In Cua, Brief, and Native keymap modes, <Alt-1> through <Alt-0> set
  211.     # bookmarks that can later be moved to by pressing <Alt-J>, then selecting
  212.     # the bookmark number to go to.  This sample key assignment causes <Ctrl-1> 
  213.     # through <Ctrl-0> to move to their respective bookmarks.
  214.     # ------------------------------------------------------------------------
  215.    #assign_key( "<Ctrl-1>",   function_id("goto_bookmark 1")   )
  216.    #assign_key( "<Ctrl-2>",   function_id("goto_bookmark 2")   )
  217.    #assign_key( "<Ctrl-3>",   function_id("goto_bookmark 3")   )
  218.    #assign_key( "<Ctrl-4>",   function_id("goto_bookmark 4")   )
  219.    #assign_key( "<Ctrl-5>",   function_id("goto_bookmark 5")   )
  220.    #assign_key( "<Ctrl-6>",   function_id("goto_bookmark 6")   )
  221.    #assign_key( "<Ctrl-7>",   function_id("goto_bookmark 7")   )
  222.    #assign_key( "<Ctrl-8>",   function_id("goto_bookmark 8")   )
  223.    #assign_key( "<Ctrl-9>",   function_id("goto_bookmark 9")   )
  224.    #assign_key( "<Ctrl-0>",   function_id("goto_bookmark 10")  )
  225.  
  226.     # uncomment the following if you want to
  227.     # fix the menu incase there are key assignments in config file that matter
  228.     # by calling the corresponding menu function for the current emulation
  229.    #if ( emulation_mode )
  230.    #   execute_function( emulation_mode"_menu")
  231.     
  232.     # useful functions 
  233.    #assign_key( "<F11>",          "tags_auto" )
  234.    #assign_key( "<Shift-F11>",    "tags" )
  235.  
  236.    #assign_key( "<F12>",          "fgrep" )
  237.  
  238.    #assign_key( "<Ctrl-P>",       "prev_window" )
  239.  
  240.    #assign_key( "<Alt-F12>",      "set_buffer_mask_key" )
  241.    #assign_key( "<Ctrl-F12>",     "reset_buffer_mask" )
  242.  
  243.     # CUA clipboard keys in any emulation mode
  244.    #assign_key( "<Shift-Delete>", "gui_delete_to_scrap" )
  245.    #assign_key( "<Shift-Insert>", "insert_scrap"  )
  246.    #assign_key( "<Ctrl-Insert>",  "copy_to_scrap_key" )
  247.  
  248.     # assigns all the CUAelection keys in any emulation mode
  249.    #assign_key( "<Shift-Left>",             "cua_extend " )              #CUA
  250.    #assign_key( "<Shift-Right>",            "cua_extend " )              #CUA
  251.    #assign_key( "<Shift-Down>",             "cua_extend " )              #CUA
  252.    #assign_key( "<Shift-Up>",               "cua_extend " )              #CUA
  253.  
  254.    #assign_key( "<Shift-Home>",             "cua_extend " )              #CUA
  255.    #assign_key( "<Shift-End>",              "cua_extend " )              #CUA
  256.    #assign_key( "<Shift-PageDown>",         "cua_extend " )              #CUA
  257.    #assign_key( "<Shift-PageUp>",           "cua_extend " )              #CUA
  258.  
  259.    #assign_key( "<Shift-Num-Left>",         "cua_extend " )              #CUA
  260.    #assign_key( "<Shift-Num-Right>",        "cua_extend " )              #CUA
  261.    #assign_key( "<Shift-Num-Down>",         "cua_extend " )              #CUA
  262.    #assign_key( "<Shift-Num-Up>",           "cua_extend " )              #CUA
  263.  
  264.    #assign_key( "<Shift-Num-Home>",         "cua_extend " )              #CUA
  265.    #assign_key( "<Shift-Num-End>",          "cua_extend " )              #CUA
  266.    #assign_key( "<Shift-Num-PageDown>",     "cua_extend " )              #CUA
  267.    #assign_key( "<Shift-Num-PageUp>",       "cua_extend " )              #CUA
  268.    
  269.    #assign_key( "<Ctrl-Shift-Left>",        "cua_extend " )              #CUA
  270.    #assign_key( "<Ctrl-Shift-Right>",       "cua_extend " )              #CUA
  271.    #assign_key( "<Ctrl-Shift-Down>",        "cua_extend " )
  272.    #assign_key( "<Ctrl-Shift-Up>",          "cua_extend " )
  273.    #assign_key( "<Ctrl-Shift-Home>",        "cua_extend " )              #CUA
  274.    #assign_key( "<Ctrl-Shift-End>",         "cua_extend " )              #CUA
  275.    #assign_key( "<Ctrl-Shift-PageDown>",    "cua_extend " )              #CUA
  276.    #assign_key( "<Ctrl-Shift-PageUp>",      "cua_extend " )              #CUA
  277.    
  278.    #assign_key( "<Ctrl-Shift-Num-Left>",    "cua_extend " )              #CUA
  279.    #assign_key( "<Ctrl-Shift-Num-Right>",   "cua_extend " )              #CUA
  280.    #assign_key( "<Ctrl-Shift-Num-Down>",    "cua_extend " )
  281.    #assign_key( "<Ctrl-Shift-Num-Up>",      "cua_extend " )
  282.    #assign_key( "<Ctrl-Shift-Num-Home>",    "cua_extend " )              #CUA
  283.    #assign_key( "<Ctrl-Shift-Num-End>",     "cua_extend " )              #CUA
  284.    #assign_key( "<Ctrl-Shift-Num-PageDown>","cua_extend " )              #CUA
  285.    #assign_key( "<Ctrl-Shift-Num-PageUp>",  "cua_extend " )              #CUA
  286.    
  287.     # reassigns Alt-X to minimize the editor and prompt to save changed files
  288.    #assign_key( "<Alt-X>", "minimize_and_save" )
  289.  
  290.    #assign_key( "<Ctrl-Shift-{>", "goto_matching" )
  291.  
  292.     # reassign Alt key so it doesn't select a menu item.
  293.    #assign_key( "<Alt>", "nop" )
  294. }
  295.