home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / p2demo21.exe / PEL / COLORS.PEL < prev    next >
Text File  |  1995-03-01  |  7KB  |  178 lines

  1. # $Header:   P:\source\wmacros\colors.pev   1.22   01 Mar 1995 15:39:18   PFHJXM0  $
  2.  
  3. ##############################################################################
  4. #
  5. #       Compuware Corporation
  6. #         31440 Northwestern Highway
  7. #           Farmington Hills, Michigan 48334-2564
  8. #
  9. #   This source code listing contains information that is
  10. #   proprietary to Compuware Corporation and may not be copied
  11. #   duplicated, translated, transmitted, stored, retrieved
  12. #   or in any manner or by any method conveyed or disclosed
  13. #   to a third party or parties without express written
  14. #   permission from Compuware Corporation.
  15. #
  16. #  
  17. ##############################################################################
  18.  
  19. #### $Workfile:   colors.pel  $: 
  20. #
  21. # colors for windows:
  22. #
  23. # These colors are made by ORing combinations of red, green and blue to 
  24. # form a long.  Blue makes up the bottom 8 bits, Green the next 8, Red
  25. # the following 8 and finally the top 8 are ZERO.
  26.  
  27. global COLOR_BLACK           = 0x000000    # foreground or background
  28. global COLOR_BLUE            = 0x0000ff
  29. global COLOR_GREEN           = 0x00ff00
  30. global COLOR_RED             = 0xff0000
  31.  
  32. global COLOR_NEON_BABY_BLUE  = 0x00FFFF
  33. global COLOR_MAGENTA         = 0xFF00FF
  34. global COLOR_WHITE           = 0xFFFFFF
  35.  
  36. global COLOR_MAROON          = 0x6B238D
  37. global COLOR_DARK_BLUE       = 0x2A2AA5
  38. global COLOR_BROWN           = 0xA52A2A
  39. global COLOR_ORCHID          = 0xD760D7
  40. global COLOR_PINK            = 0xBC8E8E
  41. global COLOR_MEDVIOLET       = 0xB548B5
  42. global COLOR_ORANGERED       = 0xFF006E
  43. global COLOR_DARKTURQUOIS    = 0x6093D7
  44. global COLOR_GREENYELLOW     = 0x60D793
  45.  
  46. global COLOR_LTBLUE          = 0x0088FF
  47. global COLOR_YELLOW          = 0xFFFF00
  48. global COLOR_LTPURPLE        = 0xD5B6FF
  49. global COLOR_MDPURPLE        = 0xFF80FF
  50. global COLOR_DARK_GRAY       = 0x404040
  51. global COLOR_LIGHT_GRAY      = 0xCCCCCC
  52. global COLOR_MED_GRAY        = 0x888888
  53. global COLOR_GOLD            = 0xBFA400
  54. global COLOR_ORANGE          = 0xFF7800
  55. global COLOR_DARK_GREEN      = 0x008C30
  56.  
  57.  
  58. function ATTR_RED( color )
  59. {
  60.    return and(color, COLOR_RED)
  61. }
  62.  
  63. function ATTR_GREEN( color )
  64. {
  65.    return and(color, COLOR_GREEN)
  66. }
  67.  
  68. function ATTR_BLUE( color )
  69. {
  70.    return and(color, COLOR_BLUE)
  71. }
  72.  
  73. function reverseVideo()
  74. {
  75.    local temp;
  76.    
  77.    temp = color_window_fg
  78.    color_window_fg = color_window_bg
  79.    color_window_bg = temp
  80. }
  81.  
  82. # DWM 4/7/94
  83. # This function returns the config information to be saved for default colors
  84. # in an array
  85. global function color_config()
  86. {
  87.    local data[]
  88.    local i = 1
  89.  
  90.    data[ i++ ] = sprintf( "#  Each pair is default FG followed by default BG.  The order is as follows:\n" )
  91.    data[ i++ ] = sprintf( "#  window, linenumbers, linecommands, message, notify, warning, error.\n" )
  92.    data[ i++ ] = sprintf( "0x%x\n", default_color_window_fg       )
  93.    data[ i++ ] = sprintf( "0x%x\n", default_color_window_bg       )
  94.    data[ i++ ] = sprintf( "0x%x\n", default_color_linenumbers_fg  )
  95.    data[ i++ ] = sprintf( "0x%x\n", default_color_linenumbers_bg  )
  96.    data[ i++ ] = sprintf( "0x%x\n", default_color_linecommands_fg )
  97.    data[ i++ ] = sprintf( "0x%x\n", default_color_linecommands_bg )
  98.  
  99.    data[ i++ ] = sprintf( "0x%x\n", default_color_message_fg      )
  100.    data[ i++ ] = sprintf( "0x%x\n", default_color_message_bg      )
  101.    data[ i++ ] = sprintf( "0x%x\n", default_color_notify_fg       )
  102.    data[ i++ ] = sprintf( "0x%x\n", default_color_notify_bg       )
  103.    data[ i++ ] = sprintf( "0x%x\n", default_color_warning_fg      )
  104.    data[ i++ ] = sprintf( "0x%x\n", default_color_warning_bg      )
  105.    data[ i++ ] = sprintf( "0x%x\n", default_color_error_fg        )
  106.    data[ i++ ] = sprintf( "0x%x\n", default_color_error_bg        )
  107. #   data[ i++ ] = sprintf( "0x%x\n", default_color_bookmark_fg     )
  108. #   data[ i++ ] = sprintf( "0x%x\n", default_color_bookmark_bg     )
  109.  
  110.    data[ i++ ] = sprintf( "\n" )
  111.  
  112.    return data
  113. }
  114.  
  115. # DWM
  116. # This callback handles the two color dialog messages handled from pel:
  117. # DM_OK, and DM_CLICK for the IDB_SAVE_CHANGES button
  118. global function color_callback()
  119. {
  120.    local curr_win       = 0
  121.    local temp = ""
  122.    local rc = DRC_CONTINUE
  123.  
  124.    if ( callback_msg == DM_OK )
  125.    {
  126.       if ( callback_data.apply_to_all )
  127.       {
  128.          # loop through the windows and reassign the colors
  129.          curr_win = current_window
  130.          while ( curr_win != next_window() )
  131.             {
  132.             color_window_bg         =  callback_data[ "color_window_bg"       ]
  133.             color_window_fg         =  callback_data[ "color_window_fg"       ]
  134.             color_linenumbers_bg    =  callback_data[ "color_linenumbers_bg"  ]
  135.             color_linenumbers_fg    =  callback_data[ "color_linenumbers_fg"  ]
  136.             color_linecommands_bg   =  callback_data[ "color_linecommands_bg" ]
  137.             color_linecommands_fg   =  callback_data[ "color_linecommands_fg" ]
  138.               
  139.             update_current_view()
  140.             }
  141.       }
  142.  
  143.       if ( callback_data.make_default )
  144.       {
  145.          # make these values the defaults
  146.          default_color_window_bg       =  callback_data[ "color_window_bg"       ]
  147.          default_color_window_fg       =  callback_data[ "color_window_fg"       ]
  148.          default_color_linenumbers_bg  =  callback_data[ "color_linenumbers_bg"  ]
  149.          default_color_linenumbers_fg  =  callback_data[ "color_linenumbers_fg"  ]
  150.          default_color_linecommands_bg =  callback_data[ "color_linecommands_bg" ]
  151.          default_color_linecommands_fg =  callback_data[ "color_linecommands_fg" ]
  152.          default_color_message_fg      =  callback_data[ "color_message_fg" ]
  153.          default_color_message_bg      =  callback_data[ "color_message_bg" ]
  154.          default_color_notify_fg       =  callback_data[ "color_notify_fg" ]
  155.          default_color_notify_bg       =  callback_data[ "color_notify_bg" ]
  156.          default_color_help_fg         =  callback_data[ "color_help_fg" ]
  157.          default_color_help_bg         =  callback_data[ "color_help_bg" ]
  158.          default_color_warning_fg      =  callback_data[ "color_warning_fg" ]
  159.          default_color_warning_bg      =  callback_data[ "color_warning_bg" ]
  160.          default_color_error_fg        =  callback_data[ "color_error_fg" ]
  161.          default_color_error_bg        =  callback_data[ "color_error_bg" ]
  162. #         default_color_bookmark_fg     =  callback_data[ "color_bookmark_fg" ]
  163. #         default_color_bookmark_bg     =  callback_data[ "color_bookmark_bg" ]
  164.  
  165.          # update the config file
  166.          update_config_section( "$COLOR_SETTINGS$", color_config() )
  167.       }
  168.    }
  169.  
  170.    return rc
  171. }
  172.  
  173. global function color_dialog_key()
  174. {
  175.    color_dialog( "color_callback", "colors" )
  176. }
  177.  
  178.