home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / gpacks / vib / vibedit.icn < prev    next >
Text File  |  2000-07-29  |  32KB  |  923 lines

  1. ############################################################################
  2. #
  3. #  vibedit.icn -- shared graphical editing routines
  4. #
  5. ## #########################################################################
  6. #
  7. #   This file is in the public domain.
  8. #
  9. ############################################################################
  10.  
  11. $include "vibdefn.icn"
  12. $include "vdefns.icn"
  13.  
  14. record palette_obj(name, x, y, bwimage, colrimage)
  15.  
  16. ############################################################################
  17. # next_id() generates an ID number for a new object
  18. ############################################################################
  19. procedure next_id(s)
  20.    local obj, n
  21.  
  22.    n := 0
  23.    every obj := !O_LIST do
  24.       obj.id ?
  25.          if =s then
  26.             n <:= integer(tab(0))    # find highest used so far
  27.    return n + 1
  28. end
  29.  
  30. ############################################################################
  31. # strip() deletes trailing blanks from the incoming string.
  32. ############################################################################
  33. procedure strip(s)
  34.    local index
  35.  
  36.    index := 0
  37.    every index := *s to 1 by -1 do
  38.       if s[index] ~== " " then break
  39.    return s[1:index+1]
  40. end
  41.  
  42. ############################################################################
  43. # set_align() sets the align flag and changes the cursor to indicate that
  44. #             the system is in align mode.
  45. ############################################################################
  46. procedure set_align(kind)
  47.    ALIGN := kind
  48.    if kind == "alignv" then
  49.        WAttrib("pointer=" || ("top side" | "sb v double arrow" | "crosshair"))
  50.    else
  51.        WAttrib("pointer=" || ("left side" | "sb h double arrow" | "crosshair"))
  52. end
  53.  
  54. ############################################################################
  55. # unset_align() unsets the align flag and restores the cursor to its
  56. #               original state.
  57. ############################################################################
  58. procedure unset_align()
  59.    ALIGN := &null
  60.    WAttrib("pointer=" || ("left ptr" | "arrow"))
  61. end
  62.  
  63. ############################################################################
  64. # minimum() returns the smaller of two numeric values.
  65. ############################################################################
  66. procedure minimum(x, y)
  67.    return x > y | x
  68. end
  69.  
  70. ############################################################################
  71. # maximum() returns the larger of two numeric values.
  72. ############################################################################
  73. procedure maximum(x, y)
  74.    return x < y | x
  75. end
  76.  
  77. ############################################################################
  78. # draw_outline() draws an outline for the given object.  Used for resizing.
  79. ############################################################################
  80. procedure draw_outline(object)
  81.    case type(object) of {
  82.       "line_obj" : outline_line(object)
  83.       default    : DrawRectangle(XORWIN,
  84.                       object.x-1, object.y-1, object.w+1, object.h+1)
  85.    }
  86. end
  87.  
  88. ############################################################################
  89. # update_bb() calls update routines for the various object types so
  90. #             that attributes correctly get updated when an object is
  91. #             resized or a label changes, etc.
  92. ############################################################################
  93. procedure update_bb(object)
  94.    case type(object) of {
  95.       "button_obj"      : update_button_bb(object)
  96.       "radio_button_obj": update_radio_bb(object)
  97.       "line_obj"        : update_line_bb(object)
  98.       "slider_obj"      : update_slider_bb(object)
  99.       "text_input_obj"  : update_text_input_bb(object)
  100.       "label_obj"       : update_label_bb(object)
  101.       "menu_obj"        : update_menu_bb(object)
  102.       "list_obj"        : update_list_bb(object)
  103.       # nothing to do for rectangles
  104.    }
  105. end
  106.  
  107. ############################################################################
  108. # move_object() is called to reposition, resize, and redraw an object.
  109. ############################################################################
  110. procedure move_object(object, x, y, w, h)
  111.  
  112.    erase_object(object)
  113.    draw_overlap(object)
  114.  
  115.    if type(object) == "line_obj" then {
  116.       object.x2 := object.x2 - object.x + x
  117.       object.y2 := object.y2 - object.y + y
  118.       object.x1 := object.x1 - object.x + x
  119.       object.y1 := object.y1 - object.y + y
  120.       update_bb(object)
  121.    }
  122.    else {
  123.       x <:= 0
  124.       y <:= CANVASY        # ensure object does not overlap palette
  125.       object.x := x
  126.       object.y := y
  127.       object.w := \w
  128.       object.h := \h
  129.       update_bb(object)
  130.       VResize(object.v, object.x, object.y, object.w, object.h)
  131.    }
  132.  
  133.    draw_object(object)
  134.    DIRTY := 1
  135. end
  136.  
  137. ############################################################################
  138. # resize_object() is called to resize the outline of an object.  First,
  139. #                 draw_outline() is called to erase the outline, then the
  140. #                 attributes are updated, then draw_outline is called to
  141. #                 draw the new outline.
  142. ############################################################################
  143. procedure resize_object(object, x, y, direction)
  144.    local neww, newh, newy, xcorner, ycorner
  145.  
  146.    # move particular enpoint of line and adjust bounding box of line
  147.    if type(object) == "line_obj" then {
  148.       draw_outline(object)
  149.       if direction == "lpt" then {
  150.          object.x1 := x
  151.          object.y1 := maximum(CANVASY, y)
  152.       }
  153.       else if direction == "rpt" then {
  154.          object.x2 := x
  155.          object.y2 := maximum(CANVASY, y)
  156.       }
  157.       update_bb(object)
  158.       draw_outline(object)
  159.       return
  160.    }
  161.  
  162.    # all other objects can be resized freely,
  163.    # subject to minimum width/height imposed in update_bb()
  164.  
  165.    draw_outline(object)
  166.    y <:= CANVASY
  167.    ycorner := direction[1]    # "u" or "l"
  168.    xcorner := direction[2]    # "l" or "r"
  169.  
  170.    if xcorner == "r" then {
  171.       neww := x - object.x
  172.       neww <:= MIN_W
  173.       }
  174.    else {
  175.       neww := object.w + object.x - x
  176.       neww <:= MIN_W
  177.       object.x +:= object.w - neww
  178.       }
  179.  
  180.    if ycorner == "l" then {
  181.       newh := y - object.y
  182.       newh <:= MIN_H
  183.       }
  184.    else {
  185.       newh := object.h + object.y - y
  186.       newh <:= MIN_H
  187.       object.y +:= object.h - newh
  188.       }
  189.  
  190.    object.h := newh
  191.    object.w := neww
  192.    update_bb(object)
  193.    if object.w ~= neww & xcorner == "l" then
  194.       object.x +:= neww - object.w
  195.    if object.h ~= newh & ycorner == "u" then
  196.       object.y +:= newh - object.h
  197.  
  198.    VResize(object.v, object.x, object.y, object.w, object.h)
  199.    draw_outline(object)
  200. end
  201.  
  202. ############################################################################
  203. # display_talk() is called to display the attribute sheets of the various
  204. #                object types.
  205. ############################################################################
  206. procedure display_talk(object)
  207.    case type(object) of {
  208.       "button_obj"      : display_button_atts(object)
  209.       "slider_obj"      : display_slider_atts(object)
  210.       "text_input_obj"  : display_text_input_atts(object)
  211.       "rect_obj"        : display_rect_atts(object)
  212.       "menu_obj"        : display_menu_atts(object)
  213.       "line_obj"        : display_line_atts(object)
  214.       "label_obj"       : display_label_atts(object)
  215.       "radio_button_obj": display_radio_button_atts(object)
  216.       "list_obj"        : display_list_atts(object)
  217.    }
  218. end
  219.  
  220. ############################################################################
  221. # draw_object() is called to draw the various object types.
  222. ############################################################################
  223. procedure draw_object(object)
  224.    update_bb(object)
  225.    case type(object) of {
  226.       "sizer_obj"     : draw_sizer(object)
  227.       "button_obj"       : draw_button(object)
  228.       "text_input_obj"   : draw_text_input(object)
  229.       "radio_button_obj" : draw_radio_button(object)
  230.       "rect_obj"         : draw_rect(object)
  231.       "slider_obj"       : draw_slider(object)
  232.       "line_obj"         : draw_line(object)
  233.       "label_obj"        : draw_label(object)
  234.       "menu_obj"         : draw_menu(object)
  235.       "list_obj"         : draw_list(object)
  236.    }
  237. end
  238.  
  239. ############################################################################
  240. # erase_object() removes an object from the screen.
  241. ############################################################################
  242. procedure erase_object(object)
  243.    if type(object) == "line_obj" then
  244.       DrawGroove(APPWIN, object.x1, object.y1, object.x2, object.y2, 0)
  245.    else if type(object) == "button_obj" & \object.dflt then
  246.       EraseArea(APPWIN, object.x - 4, object.y - 4, object.w + 8, object.h + 8)
  247.    else
  248.       EraseArea(APPWIN, object.x, object.y, object.w, object.h)
  249. end
  250.  
  251. ############################################################################
  252. # draw_focus() is called to draw focus lines around an object.
  253. ############################################################################
  254. procedure draw_focus(o)
  255.    if type(o) == "line_obj" then {
  256.       FillRectangle(XORWIN, o.x1 - 3, o.y1 - 3, 6, 6)
  257.       FillRectangle(XORWIN, o.x2 - 3, o.y2 - 3, 6, 6)
  258.    } else {
  259.       DrawLine(XORWIN, o.x-2, o.y+2, o.x-2, o.y-2, o.x+2, o.y-2)
  260.       DrawLine(XORWIN, o.x-2, o.y+o.h-3, o.x-2, o.y+o.h+1, o.x+2, o.y+o.h+1)
  261.       DrawLine(XORWIN, o.x+o.w-3, o.y-2, o.x+o.w+1, o.y-2, o.x+o.w+1, o.y+2)
  262.       DrawLine(XORWIN,
  263.          o.x+o.w-3, o.y+o.h+1, o.x+o.w+1, o.y+o.h+1, o.x+o.w+1, o.y+o.h-3)
  264.    }
  265. end
  266.  
  267. ############################################################################
  268. # focus_object() sets the given object to be the object with the focus.
  269. #                Focus lines are drawn around the object and the FOCUS
  270. #                global is set to be the object.
  271. ############################################################################
  272. procedure focus_object(object)
  273.    unfocus_object(\FOCUS)
  274.    draw_focus(object)
  275.    object.focus := 1
  276.    FOCUS := object
  277.    return object
  278. end
  279.  
  280. ############################################################################
  281. # unfocus_object() unsets the focus.  The focus lines are erased about
  282. #                  the object and the FOCUS global is set to null.
  283. ############################################################################
  284. procedure unfocus_object(object)
  285.    draw_focus(object)
  286.    object.focus := 0
  287.    FOCUS := &null
  288.    return object
  289. end
  290.  
  291. ############################################################################
  292. # on_focus() returns either
  293. #   "lpt" : if object is a line and the mouse is on the left endpoint
  294. #   "rpt" : if object is a line and the mouse is on the right endpoint
  295. #   "ur"  : if mouse is on upper-right focus point of object
  296. #   "ul"  : if mouse is on upper-left focus point of object
  297. #   "lr"  : if mouse is on lower-right focus point of object
  298. #   "ll"  : if mouse is on lower-left focus point of object
  299. # otherwise it fails
  300. ############################################################################
  301. procedure on_focus(object, x, y)
  302.    local range
  303.  
  304.    range := 5
  305.    if type(object) == "line_obj" then {
  306.       if (object.x1 - range < x < object.x1 + range) &
  307.          (object.y1 - range < y < object.y1 + range) then
  308.          return "lpt"
  309.       else if (object.x2 - range < x < object.x2 + range) &
  310.               (object.y2 - range < y < object.y2 + range) then
  311.          return "rpt"
  312.       else fail
  313.    }
  314.    if (object.x+object.w-range) < x < (object.x+object.w+range) &
  315.       (object.y - range) < y < (object.y + range) then
  316.         return "ur"
  317.    if (object.x - range) < x < (object.x + range) &
  318.       (object.y - range) < y < (object.y + range) then
  319.       return "ul"
  320.    if (object.x - range) < x < (object.x + range) &
  321.       (object.y+object.h-range) < y < (object.y+object.h+range) then
  322.         return "ll"
  323.    if (object.x+object.w-range) < x < (object.x+object.w+range) &
  324.       (object.y+object.h-range) < y < (object.y+object.h+range) then
  325.         return "lr"
  326.    fail
  327. end
  328.  
  329. ############################################################################
  330. # on_target() returns the object if the mouse is over the object.
  331. #             Else fails.
  332. ############################################################################
  333. procedure on_target(o, x, y)
  334.    local m, a, b, c, d
  335.  
  336.    if y < CANVASY then fail
  337.    if not ((o.x <= x <= o.x + o.w) &
  338.       (o.y <= y <= o.y + o.h)) then
  339.          fail
  340.    if type(o) == "line_obj" & o.w > 6 & o.h > 6 then {    # if skewed line
  341.       # make sure (x,y) is reasonably close to the line
  342.       m := (o.y2 - o.y1) / real(o.x2 - o.x1)        # slope
  343.       a := o.y1 - m * o.x1                # y-intercept
  344.       b := o.x1 - o.y1 / m                # x-intercept
  345.       c := -a * o.x1 - b * o.y1                # ax + by + c = 0
  346.       d := (a * x + b * y + c) / sqrt(a ^ 2 + b ^ 2)    # distance
  347.       if abs(d) > 5 then
  348.          fail
  349.       }
  350.    return o
  351. end
  352.  
  353. ############################################################################
  354. # object_of_event() checks the canvas object list against the mouse event
  355. #                   coordinates to determine if the event correlates to
  356. #                   a canvas object.  If multiple objects match, the
  357. #                   smallest is returned.  (The area of a "line" is fudged.)
  358. #                   Null is returned if the event does not correlate.
  359. ############################################################################
  360. procedure object_of_event(x, y)
  361.    local o, a, obj, area
  362.  
  363.    every o := !O_LIST do
  364.       if on_target(o, x, y) then {
  365.          if type(o) == "line_obj" then
  366.             a := 5 * maximum(o.w, o.h)
  367.          else
  368.             a := o.w * o.h
  369.          if /obj | a < area then {
  370.             obj := o
  371.             area := a
  372.             }
  373.          }
  374.    return obj
  375. end
  376.  
  377. ############################################################################
  378. # clear_screen() empties the entire screen, redrawing just the palette
  379. #                and sizer object.  The canvas list is emptied.
  380. ############################################################################
  381. procedure clear_screen()
  382.    O_LIST := list()
  383.    FOCUS := &null
  384.    DIRTY := &null
  385.    redraw_screen()
  386. end
  387.  
  388. ############################################################################
  389. # redraw_screen() clears the screen and redraws both the palette and canvas.
  390. ############################################################################
  391. procedure redraw_screen()
  392.    EraseArea()
  393.    draw_header()
  394.    draw_canvas()
  395. end
  396.  
  397. ############################################################################
  398. # shift_focus() moves the object with the FOCUS by in the amount given.
  399. ############################################################################
  400. procedure shift_focus(dx, dy)
  401.    local object
  402.  
  403.    if object := \FOCUS then {
  404.       unfocus_object(object)
  405.       move_object(object, object.x + dx, object.y + dy)
  406.       focus_object(object)
  407.    }
  408. end
  409.  
  410. ############################################################################
  411. # copy_focus() makes a copy of the object with the focus.
  412. ############################################################################
  413. procedure copy_focus()
  414.    local r, drawin, temp, obj
  415.  
  416.    if obj := \FOCUS then {
  417.       unfocus_object(obj)
  418.       case type(obj) of {
  419.          "rect_obj": {
  420.             r := create_rect(obj.x + 10, obj.y + 10, obj.w, obj.h, obj.style)
  421.          }
  422.          "menu_obj": {
  423.             temp := copy(obj)
  424.             r := create_menu(obj.x + 10, obj.y + 10, obj.label, obj.style)
  425.             copy_menu(r, temp)
  426.          }
  427.          "button_obj": {
  428.             r := create_button(obj.x + 10, obj.y + 10, obj.w, obj.h,
  429.                               obj.label, obj.style, obj.toggle)
  430.          }
  431.          "text_input_obj": {
  432.             r := create_text_input(obj.x + 10, obj.y + 10,
  433.                                     obj.label, obj.value, obj.length)
  434.          }
  435.          "label_obj": {
  436.             r := create_label(obj.x + 10, obj.y + 10, obj.label)
  437.          }
  438.          "radio_button_obj": {
  439.             r := create_radio_button(obj.x + 10, obj.y + 10, copy(obj.alts))
  440.          }
  441.          "slider_obj": {
  442.             r := create_slider(obj.x + 10, obj.y + 10, obj.w, obj.h,
  443.                               obj.typ, obj.min, obj.max, obj.value, obj.filter)
  444.          }
  445.          "line_obj": {
  446.             r := create_line(obj.x1 + 10, obj.y1 + 10, obj.x2 + 10, obj.y2 + 10)
  447.          }
  448.      "list_obj": {
  449.         r := create_list(obj.x + 10, obj.y + 10, obj.w, obj.h,
  450.                 obj.style, obj.scroll)
  451.      }
  452.          default: return
  453.       }
  454.       push(O_LIST, r)
  455.       draw_object(r)
  456.       focus_object(r)
  457.       DIRTY := 1
  458.    }
  459. end
  460.  
  461. ############################################################################
  462. # delete_focus() removes the object with the FOCUS from the canvas list.
  463. ############################################################################
  464. procedure delete_focus()
  465.    local i
  466.  
  467.    if \FOCUS then {
  468.       draw_focus(FOCUS)
  469.       erase_object(FOCUS)
  470.       DELETED := FOCUS
  471.       every i := 1 to *O_LIST do
  472.          if (O_LIST[i] === FOCUS) then
  473.             O_LIST := O_LIST[1:i] ||| O_LIST[i+1:*O_LIST+1]
  474.       FOCUS := &null
  475.       DELETED.focus := 0
  476.       DIRTY := 1
  477.       draw_overlap(DELETED)
  478.    }
  479. end
  480.  
  481. ############################################################################
  482. # undelete() restores the most recently deleted object.
  483. ############################################################################
  484. procedure undelete()
  485.    if \DELETED then {
  486.       unfocus_object(\FOCUS)
  487.       push(O_LIST, DELETED)
  488.       draw_object(DELETED)
  489.       focus_object(DELETED)
  490.       DELETED := &null
  491.       DIRTY := 1
  492.    }
  493. end
  494.  
  495. ############################################################################
  496. # add_palette_entry() adds one entry to the palette
  497. ############################################################################
  498. procedure add_palette_entry(name, bwimage, colrimage)
  499.    static x
  500.    initial x := 0
  501.  
  502.    push(P_LIST, palette_obj(name, x, MENUBAR.ah + 3, bwimage, colrimage))
  503.    x +:= PAL_W
  504. end
  505.  
  506. ############################################################################
  507. # draw_decor() redraws the decorative lines that extend across the window.
  508. ############################################################################
  509. procedure draw_decor()
  510.    DrawLine(0, MENUBAR.ah, 2000, MENUBAR.ah)
  511.    DrawLine(0, CANVASY-1, 2000, CANVASY-1)
  512. end
  513.  
  514. ############################################################################
  515. # draw_header() redraws the window header.
  516. ############################################################################
  517. procedure draw_header()
  518.    local e, xpad, ypad, w, d, h, im
  519.  
  520.    MENUBAR.V.draw(MENUBAR)
  521.    DrawString(SELECT.ax + 4, SELECT.ay + 15, "Select")
  522.    BevelRectangle(SELECT.ax, SELECT.ay, SELECT.aw, SELECT.ah)
  523.    draw_decor()
  524.    every e := !P_LIST do {
  525.       if WAttrib("depth") > 1 then (im := e.colrimage) ? {
  526.          w := tab(upto(','))        # width of image
  527.          move(1)
  528.          tab(upto(',') + 1)        # skip over palette spec
  529.          h := *tab(0) / w        # height of image
  530.          }
  531.       else (im := e.bwimage) ? {
  532.          w := tab(upto(','))        # width of image
  533.          d := ((w + 3) / 4)        # digits per row
  534.          move(2)
  535.          h := *tab(0) / d        # height of image
  536.          }
  537.       xpad := (PAL_W - w) / 2
  538.       ypad := (PAL_H - h) / 2
  539.       DrawImage(e.x + xpad, e.y + ypad, im)
  540.       }
  541. end
  542.  
  543. ############################################################################
  544. # draw_canvas() draws all the objects that exist within the canvas.
  545. ############################################################################
  546. procedure draw_canvas()
  547.    every draw_object(O_LIST[*O_LIST to 1 by -1])
  548.    draw_sizer(SIZER)
  549.    draw_focus(\FOCUS)
  550. end
  551.  
  552. ############################################################################
  553. # draw_overlap() draws any objects that overlap the argument object.
  554. ############################################################################
  555. procedure draw_overlap(object)
  556.    local f, o, d
  557.  
  558.    if type(object) == "button_obj" & \object.dflt then
  559.       d := 8        # fudge factor for default box on both objects
  560.    else
  561.       d := 4        # only the other object can have default box
  562.  
  563.    unfocus_object(f := \FOCUS)
  564.    every o := O_LIST[*O_LIST to 1 by -1] do {
  565.       if o.x >= object.x + object.w + d    then next
  566.       if object.x >= o.x + o.w + d    then next
  567.       if o.y >= object.y + object.h + d    then next
  568.       if object.y >= o.y + o.h + d    then next
  569.       if o === object            then next
  570.       draw_object(o)
  571.       }
  572.    if object.x + object.w + d >= SIZER.x |
  573.       object.y + object.h + d >= SIZER.y then
  574.      draw_sizer(SIZER)
  575.    focus_object(\f)
  576. end
  577.  
  578. ############################################################################
  579. # palette_object_of_event() cycles through the list of palette objects
  580. #                           to determine if any of them were the target
  581. #                           of a mouse event.
  582. ############################################################################
  583. procedure palette_object_of_event(x, y)
  584.    local o
  585.  
  586.    every o := !P_LIST do
  587.       if o.x <= x <= o.x + PAL_W & o.y <= y <= o.y + PAL_H then
  588.          return o
  589.    return &null
  590. end
  591.  
  592. ############################################################################
  593. # create_object_instance() creates an instance of the given object.
  594. ############################################################################
  595. procedure create_object_instance(obj)
  596.    local r, temp, x, y, w, h
  597.  
  598.    x := &x
  599.    y := CANVASY
  600.    w := 32
  601.    h := 20
  602.    case obj.name of {
  603.       "line":
  604.          r := create_line(x, y + 3, x + PAL_W, y + 3)
  605.       "rect":
  606.          r := create_rect(x, y, w, h, "grooved")
  607.       "menu": {
  608.          r := create_menu(x, y, "Menu", "pull")
  609.          add_item(r, "three", 0)
  610.          add_item(r, "two", 0)
  611.          add_item(r, "one", 0)
  612.          }
  613.       "button":
  614.          r := create_button(x, y, w, h, "push")
  615.       "radio_button":
  616.          r := create_radio_button(x, y, ["one","two","three"])
  617.       "text":
  618.          r := create_text_input(x, y, "Text:", "", 3)
  619.       "label":
  620.          r := create_label(x, y, "Label")
  621.       "slider":
  622.          r := create_slider(x, y, VSlider_DefWidth, VSlider_DefLength,
  623.             "Slider", 0.0, 1.0, 0.5, 1)
  624.       "scroll":
  625.          r := create_slider(x, y, VSlider_DefWidth, VSlider_DefLength,
  626.             "Scrollbar", 0.0, 1.0, 0.5, 1)
  627.       "list":
  628.      r := create_list(x, y)
  629.       default: return &null
  630.    }
  631.    push(O_LIST, r)
  632.    DIRTY := 1
  633.    return r
  634. end
  635.  
  636. ############################################################################
  637. # create_palette() creates the palette objects.
  638. ############################################################################
  639. procedure create_palette()
  640.  
  641.    add_palette_entry("button",
  642.       "25,#1ffffff10000011000001115555110aaaa11155551100000110000011ffffff",
  643.       "25,c1,_
  644.       6666666666666666666666666_
  645.       6~~~~~~~~~~~~~~~~~~~~~~~1_
  646.       6~~~~~~~~~~~~~~~~~~~~~~~1_
  647.       6~~~~222222222222222~~~~1_
  648.       6~~~~222222222222222~~~~1_
  649.       6~~~~222222222222222~~~~1_
  650.       6~~~~~~~~~~~~~~~~~~~~~~~1_
  651.       6~~~~~~~~~~~~~~~~~~~~~~~1_
  652.       6111111111111111111111111_
  653.       ")
  654.    add_palette_entry("radio_button",
  655.       "32,#FFFFFFFF8000000180000021800000518555508982AAA1058555508980000051_
  656.       80000021800000018000000180000021800000518555508982AAA10585555089_
  657.       800000518000002180000001800000018000002180000071855550F982AAA1FD_
  658.       855550F9800000718000002180000001FFFFFFFF",
  659.       "33,c1,_
  660.       666666666666666666666666666666661_
  661.       6~~~~~6~~~~~~~~~~~~~~~~~~~~~~~~~1_
  662.       6~~~~666~~~~~~~~~~~~~~~~~~~~~~~~1_
  663.       6~~~66~66~~~~~~~~~~~~~~~~~~~~~~~1_
  664.       6~~66~~~66~~~222222222222222~~~~1_
  665.       6~66~~~~~66~~222222222222222~~~~1_
  666.       6~~11~~~11~~~222222222222222~~~~1_
  667.       6~~~11~11~~~~~~~~~~~~~~~~~~~~~~~1_
  668.       6~~~~111~~~~~~~~~~~~~~~~~~~~~~~~1_
  669.       6~~~~~1~~~~~~~~~~~~~~~~~~~~~~~~~1_
  670.       6~~~~~6~~~~~~~~~~~~~~~~~~~~~~~~~1_
  671.       6~~~~666~~~~~~~~~~~~~~~~~~~~~~~~1_
  672.       6~~~66~66~~~~~~~~~~~~~~~~~~~~~~~1_
  673.       6~~66~~~66~~~222222222222222~~~~1_
  674.       6~66~~~~~66~~222222222222222~~~~1_
  675.       6~~11~~~11~~~222222222222222~~~~1_
  676.       6~~~11~11~~~~~~~~~~~~~~~~~~~~~~~1_
  677.       6~~~~111~~~~~~~~~~~~~~~~~~~~~~~~1_
  678.       6~~~~~1~~~~~~~~~~~~~~~~~~~~~~~~~1_
  679.       6~~~~~6~~~~~~~~~~~~~~~~~~~~~~~~~1_
  680.       6~~~~666~~~~~~~~~~~~~~~~~~~~~~~~1_
  681.       6~~~66066~~~~~~~~~~~~~~~~~~~~~~~1_
  682.       6~~6600066~~~222222222222222~~~~1_
  683.       6~660000066~~222222222222222~~~~1_
  684.       6~~1100011~~~222222222222222~~~~1_
  685.       6~~~11011~~~~~~~~~~~~~~~~~~~~~~~1_
  686.       6~~~~111~~~~~~~~~~~~~~~~~~~~~~~~1_
  687.       6~~~~~1~~~~~~~~~~~~~~~~~~~~~~~~~1_
  688.       611111111111111111111111111111111_
  689.       ")
  690.    add_palette_entry("menu",
  691.       "20,#1ffff1ffff1d5571eaaf1d5571fffffffff800018000180001955518aaa98000_
  692.       18000180001955518aaa9800018000180001955518aaa9800018000180001955_
  693.       518aaa98000180001fffff",
  694.       "20,c1,_
  695.       1111111111111116~~~~_
  696.       1000000000000006~~~~_
  697.       1005555555550006~~~~_
  698.       1005555555550006~~~~_
  699.       1000000000000006~~~~_
  700.       1000000000000006~~~~_
  701.       66666666666666666666_
  702.       6~~~~~~~~~~~~~~~~~~1_
  703.       6~~~~~~~~~~~~~~~~~~1_
  704.       6~~~~~~~~~~~~~~~~~~1_
  705.       6~~22222222222222~~1_
  706.       6~~22222222222222~~1_
  707.       6~~~~~~~~~~~~~~~~~~1_
  708.       6~~~~~~~~~~~~~~~~~~1_
  709.       6~~~~~~~~~~~~~~~~~~1_
  710.       6~~22222222222222~~1_
  711.       6~~22222222222222~~1_
  712.       6~~~~~~~~~~~~~~~~~~1_
  713.       6~~~~~~~~~~~~~~~~~~1_
  714.       6~~~~~~~~~~~~~~~~~~1_
  715.       6~~22222222222222~~1_
  716.       6~~22222222222222~~1_
  717.       6~~~~~~~~~~~~~~~~~~1_
  718.       6~~~~~~~~~~~~~~~~~~1_
  719.       6~~~~~~~~~~~~~~~~~~1_
  720.       6~~22222222222222~~1_
  721.       6~~22222222222222~~1_
  722.       6~~~~~~~~~~~~~~~~~~1_
  723.       6~~~~~~~~~~~~~~~~~~1_
  724.       6~~~~~~~~~~~~~~~~~~1_
  725.       61111111111111111111_
  726.       ")
  727.    add_palette_entry("list",
  728.       "32,#FFFFFFFF92000001AA000001AA555551C62AAAA9FE0000018200000182555551_
  729.       FE2AAAA9C6000001C7FFFFFFC7AAAAAFC7D55557C7FFFFFFC6000001C6555551_
  730.       C62AAAA9FE0000018200000182555551822AAAA9820000018200000182555551_
  731.       822AAAA982000001FE000001C6555551AA2AAAA9AA00000192000001FFFFFFFF",
  732.       "32,c1,_
  733.       111111111111111111111111~1111111_
  734.       1~~~~~~~~~~~~~~~~~~~~~~6~1~~6~~6_
  735.       1~~~~~~~~~~~~~~~~~~~~~~6~1~6~1~6_
  736.       1~~222222222222222222~~6~1~6~1~6_
  737.       1~~222222222222222222~~6~16~~~16_
  738.       1~~~~~~~~~~~~~~~~~~~~~~6~1611116_
  739.       1~~~~~~~~~~~~~~~~~~~~~~6~1~~~~~6_
  740.       1~~222222222222222222~~6~1666666_
  741.       1~~222222222222222222~~6~16~~~16_
  742.       1~~~~~~~~~~~~~~~~~~~~~~6~16~~~16_
  743.       100000000000000000000006~16~~~16_
  744.       100222222222222222222006~16~~~16_
  745.       100222222222222222222006~16~~~16_
  746.       100000000000000000000006~16~~~16_
  747.       1~~~~~~~~~~~~~~~~~~~~~~6~16~~~16_
  748.       1~~222222222222222222~~6~16~~~16_
  749.       1~~222222222222222222~~6~1611116_
  750.       1~~~~~~~~~~~~~~~~~~~~~~6~1~~~~~6_
  751.       1~~~~~~~~~~~~~~~~~~~~~~6~1~~~~~6_
  752.       1~~222222222222222222~~6~1~~~~~6_
  753.       1~~222222222222222222~~6~1~~~~~6_
  754.       1~~~~~~~~~~~~~~~~~~~~~~6~1~~~~~6_
  755.       1~~~~~~~~~~~~~~~~~~~~~~6~1~~~~~6_
  756.       1~~222222222222222222~~6~1~~~~~6_
  757.       1~~222222222222222222~~6~1~~~~~6_
  758.       1~~~~~~~~~~~~~~~~~~~~~~6~1666666_
  759.       1~~~~~~~~~~~~~~~~~~~~~~6~16~~~16_
  760.       1~~222222222222222222~~6~16~~~16_
  761.       1~~222222222222222222~~6~1~6~1~6_
  762.       1~~~~~~~~~~~~~~~~~~~~~~6~1~6~1~6_
  763.       1~~~~~~~~~~~~~~~~~~~~~~6~1~~6~~6_
  764.       16666666666666666666666641666666_
  765.       ")
  766.    add_palette_entry("text",
  767.       "32,#ffffc00080004000800040008000400080004555800042aa9ffe455580004000_
  768.       80004000ffffc000",
  769.       "32,c1,_
  770.       ~~~~~~~~~~~~~~111111111111111111_
  771.       ~~~~~~~~~~~~~~1~~~~~~~~~~~~~~~~6_
  772.       ~~~~~~~~~~~~~~1~~~~~~~~~~~~~~~~6_
  773.       ~~~~~~~~~~~~~~1~~~~~~~~~~~~~~~~6_
  774.       22222222222~~~1~~~~~~~~~~~~~~~~6_
  775.       22222222222~~~1~~~~~~~~~~~~~~~~6_
  776.       22222222222~~~1~~~~~~~~~~~~~~~~6_
  777.       ~~~~~~~~~~~~~~1~~~~~~~~~~~~~~~~6_
  778.       ~~~~~~~~~~~~~~1~~~~~~~~~~~~~~~~6_
  779.       ~~~~~~~~~~~~~~166666666666666666_
  780.       ")
  781.    add_palette_entry("slider",
  782.       "9,#1FF1011011011011011011011011011011FF1831831831831831FF_
  783.       1831831831831831FF1011011011011011011011FF",
  784.       "9,c1,_
  785.       111111111_
  786.       1~~~~~~~6_
  787.       1~~~~~~~6_
  788.       1~~~~~~~6_
  789.       1~~~~~~~6_
  790.       1~~~~~~~6_
  791.       1~~~~~~~6_
  792.       1~~~~~~~6_
  793.       1~~~~~~~6_
  794.       1~~~~~~~6_
  795.       1~~~~~~~6_
  796.       1~~~~~~~6_
  797.       166666666_
  798.       16~~~~~16_
  799.       16~~~~~16_
  800.       16~~~~~16_
  801.       16~~~~~16_
  802.       16~~~~~16_
  803.       161111116_
  804.       166666616_
  805.       16~~~~~16_
  806.       16~~~~~16_
  807.       16~~~~~16_
  808.       16~~~~~16_
  809.       16~~~~~16_
  810.       161111116_
  811.       1~~~~~~~6_
  812.       1~~~~~~~6_
  813.       1~~~~~~~6_
  814.       1~~~~~~~6_
  815.       1~~~~~~~6_
  816.       166666666_
  817.       ")
  818.    add_palette_entry("scroll",
  819.       "9,#1FF1111291291451451FF1011011011011FF1831831831831831FF_
  820.       1011011011011011011011FF1451451291291111FF",
  821.       "9,c1,_
  822.       111111111_
  823.       1~~~6~~~6_
  824.       1~~6~1~~6_
  825.       1~~6~1~~6_
  826.       1~6~~~1~6_
  827.       1~6~~~1~6_
  828.       16~~~~~16_
  829.       161111116_
  830.       1~~~~~~~6_
  831.       1~~~~~~~6_
  832.       1~~~~~~~6_
  833.       1~~~~~~~6_
  834.       166666666_
  835.       16~~~~~16_
  836.       16~~~~~16_
  837.       16~~~~~16_
  838.       16~~~~~16_
  839.       16~~~~~16_
  840.       161111116_
  841.       1~~~~~~~6_
  842.       1~~~~~~~6_
  843.       1~~~~~~~6_
  844.       1~~~~~~~6_
  845.       1~~~~~~~6_
  846.       166666666_
  847.       16~~~~~16_
  848.       1~6~~~1~6_
  849.       1~6~~~1~6_
  850.       1~~6~1~~6_
  851.       1~~6~1~~6_
  852.       1~~~6~~~6_
  853.       166666666_
  854.       ")
  855.    add_palette_entry("rect",
  856.       "32,#ffffffff80000001800000018000000180000001800000018000000180000001_
  857.       8000000180000001800000018000000180000001800000018000000180000001_
  858.       800000018000000180000001ffffffff",
  859.       "32,c1,_
  860.       33333333333333333333333333333333_
  861.       36666666666666666666666666666666_
  862.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  863.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  864.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  865.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  866.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  867.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  868.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  869.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  870.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  871.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  872.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  873.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  874.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  875.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  876.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  877.       36~~~~~~~~~~~~~~~~~~~~~~~~~~~~36_
  878.       36333333333333333333333333333336_
  879.       36666666666666666666666666666666_
  880.       ")
  881.    add_palette_entry("label",
  882.       "13,#0040004000e000e000e001b00190019003180308030807fc060406040c061e0f",
  883.       "13,c1,_
  884.       ~~~~~~0~~~~~~_
  885.       ~~~~~~0~~~~~~_
  886.       ~~~~~000~~~~~_
  887.       ~~~~~000~~~~~_
  888.       ~~~~~000~~~~~_
  889.       ~~~~00~00~~~~_
  890.       ~~~~0~~00~~~~_
  891.       ~~~~0~~00~~~~_
  892.       ~~~00~~~00~~~_
  893.       ~~~0~~~~00~~~_
  894.       ~~~0~~~~~0~~~_
  895.       ~~000000000~~_
  896.       ~~0~~~~~~00~~_
  897.       ~~0~~~~~~00~~_
  898.       ~00~~~~~~~00~_
  899.       0000~~~~~0000_
  900.       ")
  901.    add_palette_entry("line",
  902.       "32,#0000000f0000000f0000001f0000006f00000180000006000000180000006000_
  903.       0001800000060000001800000060000001800000f6000000f8000000f0000000f0000000",
  904.       "30,c1,_
  905.       ~~~~~~~~~~~~~~~~~~~~~~~~~~0000_
  906.       ~~~~~~~~~~~~~~~~~~~~~~~~~~3300_
  907.       ~~~~~~~~~~~~~~~~~~~~~~~~336600_
  908.       ~~~~~~~~~~~~~~~~~~~~~~33660000_
  909.       ~~~~~~~~~~~~~~~~~~~~3366~~~~~~_
  910.       ~~~~~~~~~~~~~~~~~~3366~~~~~~~~_
  911.       ~~~~~~~~~~~~~~~~3366~~~~~~~~~~_
  912.       ~~~~~~~~~~~~~~3366~~~~~~~~~~~~_
  913.       ~~~~~~~~~~~~3366~~~~~~~~~~~~~~_
  914.       ~~~~~~~~~~3366~~~~~~~~~~~~~~~~_
  915.       ~~~~~~~~3366~~~~~~~~~~~~~~~~~~_
  916.       ~~~~~~3366~~~~~~~~~~~~~~~~~~~~_
  917.       00003366~~~~~~~~~~~~~~~~~~~~~~_
  918.       003366~~~~~~~~~~~~~~~~~~~~~~~~_
  919.       0066~~~~~~~~~~~~~~~~~~~~~~~~~~_
  920.       0000~~~~~~~~~~~~~~~~~~~~~~~~~~_
  921.       ")
  922. end
  923.