home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / xf2.3-p / xf2 / xf2.3 / src / xfcursorBox.tcl < prev    next >
Encoding:
Text File  |  1993-11-20  |  20.3 KB  |  583 lines

  1. # XFNoParsing
  2. # Program: template
  3. # Description: cursor selection
  4. #
  5. # $Header: xfcursorBox.tcl[2.3] Wed Mar 10 12:05:33 1993 garfield@garfield frozen $
  6.  
  7. global xfCursorBox
  8. set xfCursorBox(activeBackground) ""
  9. set xfCursorBox(activeForeground) ""
  10. set xfCursorBox(background) ""
  11. set xfCursorBox(font) ""
  12. set xfCursorBox(foreground) ""
  13. set xfCursorBox(scrollActiveForeground) ""
  14. set xfCursorBox(scrollBackground) ""
  15. set xfCursorBox(scrollForeground) ""
  16. set xfCursorBox(cursorName) ""
  17.  
  18. proc XFCursorBox {{xfCursorBoxFileCursor "/usr/local/lib/xf/lib/Cursors"} {xfCursorBoxFileColor "/usr/local/lib/xf/lib/Colors"} {xfCursorBoxMessage "Cursor"} {xfCursorBoxEntryW ""} {xfCursorBoxTargetW ""}} {# xf ignore me 5
  19. ##########
  20. # Procedure: XFCursorBox
  21. # Description: select a cursor
  22. # Arguments: {xfCursorBoxFileCursor} - the color file with all cursornames
  23. #            {xfCursorBoxFileColor} - the color file with all colornames
  24. #            {xfCursorBoxMessage} - a message to display
  25. #            {xfCursorBoxEntryW} - the widget name for the resulting color name
  26. #            {xfCursorBoxTargetW} - the widget we configure
  27. # Returns: cursorname, or nothing
  28. # Sideeffects: none
  29. ##########
  30. #
  31. # global xfCursorBox(activeBackground) - active background color
  32. # global xfCursorBox(activeForeground) - active foreground color
  33. # global xfCursorBox(background) - background color
  34. # global xfCursorBox(font) - text font
  35. # global xfCursorBox(foreground) - foreground color
  36. # global xfCursorBox(scrollActiveForeground) - scrollbar active background color
  37. # global xfCursorBox(scrollBackground) - scrollbar background color
  38. # global xfCursorBox(scrollForeground) - scrollbar foreground color
  39. # global xfCursorBox(scrollSide) - side where scrollbar is located
  40.  
  41.   global xfCursorBox
  42.  
  43.   set xfCursorBox(cursorName) ""
  44.  
  45.   set tmpButtonOpt ""
  46.   set tmpFrameOpt ""
  47.   set tmpMessageOpt ""
  48.   set tmpScrollOpt ""
  49.   if {"$xfCursorBox(activeBackground)" != ""} {
  50.     append tmpButtonOpt "-activebackground \"$xfCursorBox(activeBackground)\" "
  51.   }
  52.   if {"$xfCursorBox(activeForeground)" != ""} {
  53.     append tmpButtonOpt "-activeforeground \"$xfCursorBox(activeForeground)\" "
  54.   }
  55.   if {"$xfCursorBox(background)" != ""} {
  56.     append tmpButtonOpt "-background \"$xfCursorBox(background)\" "
  57.     append tmpFrameOpt "-background \"$xfCursorBox(background)\" "
  58.     append tmpMessageOpt "-background \"$xfCursorBox(background)\" "
  59.   }
  60.   if {"$xfCursorBox(font)" != ""} {
  61.     append tmpButtonOpt "-font \"$xfCursorBox(font)\" "
  62.     append tmpMessageOpt "-font \"$xfCursorBox(font)\" "
  63.   }
  64.   if {"$xfCursorBox(foreground)" != ""} {
  65.     append tmpButtonOpt "-foreground \"$xfCursorBox(foreground)\" "
  66.     append tmpMessageOpt "-foreground \"$xfCursorBox(foreground)\" "
  67.   }
  68.   if {"$xfCursorBox(scrollActiveForeground)" != ""} {
  69.     append tmpScrollOpt "-activeforeground \"$xfCursorBox(scrollActiveForeground)\" "
  70.   }
  71.   if {"$xfCursorBox(scrollBackground)" != ""} {
  72.     append tmpScrollOpt "-background \"$xfCursorBox(scrollBackground)\" "
  73.   }
  74.   if {"$xfCursorBox(scrollForeground)" != ""} {
  75.     append tmpScrollOpt "-foreground \"$xfCursorBox(scrollForeground)\" "
  76.   }
  77.  
  78.   # get cursor file name
  79.   if {!([file exists $xfCursorBoxFileCursor] &&
  80.         [file readable $xfCursorBoxFileCursor])} {
  81.     set xfCursorBoxFileCursor ""
  82.   }
  83.   if {"$xfCursorBoxFileCursor" == ""} {
  84.     global env
  85.     if {[info exists env(XF_CURSOR_FILE)]} {
  86.       if {[file exists $env(XF_CURSOR_FILE)] &&
  87.           [file readable $env(XF_CURSOR_FILE)]} {
  88.         set xfCursorBoxFileCursor $env(XF_CURSOR_FILE)
  89.       }
  90.     }
  91.   }
  92.  
  93.   # get color file name
  94.   if {!([file exists $xfCursorBoxFileColor] &&
  95.         [file readable $xfCursorBoxFileColor])} {
  96.     set xfCursorBoxFileColor ""
  97.   }
  98.   if {"$xfCursorBoxFileColor" == ""} {
  99.     global env
  100.     if {[info exists env(XF_COLOR_FILE)]} {
  101.       if {[file exists $env(XF_COLOR_FILE)] &&
  102.           [file readable $env(XF_COLOR_FILE)]} {
  103.         set xfCursorBoxFileColor $env(XF_COLOR_FILE)
  104.       }
  105.     }
  106.   }
  107.   if {"$xfCursorBoxMessage" == ""} {
  108.     set xfCursorBoxMessage "Cursor"
  109.   }
  110.  
  111.   # save the the current widget cursor
  112.   if {"$xfCursorBoxTargetW" != ""} {
  113.     if {[catch "$xfCursorBoxTargetW config -[string tolower $xfCursorBoxMessage]" result]} {
  114.       set xfCursorBoxSavedCursor ""
  115.     } {
  116.       set xfCursorBoxSavedCursor [lindex $result 4]
  117.     }
  118.   } {
  119.     set xfCursorBoxSavedCursor ""
  120.   }
  121.  
  122.   # look if there is already a font window
  123.   if {"[info commands .xfCursorBox]" == ""} {
  124.     # build widget structure
  125.  
  126.     XFTmpltToplevel .xfCursorBox 400x300 {XF cursor select}
  127.  
  128.     set xfCursorBox(oldWidget) $xfCursorBoxEntryW
  129.  
  130.     frame .xfCursorBox.frame1 \
  131.       -borderwidth 0 \
  132.       -relief raised
  133.     catch ".xfCursorBox.frame1 config $tmpFrameOpt"
  134.  
  135.     button .xfCursorBox.frame1.ok \
  136.       -text "OK"
  137.     catch ".xfCursorBox.frame1.ok config $tmpButtonOpt"
  138.  
  139.     button .xfCursorBox.frame1.cancel \
  140.       -text "Cancel"
  141.     catch ".xfCursorBox.frame1.cancel config $tmpButtonOpt"
  142.  
  143.     label .xfCursorBox.demo \
  144.       -relief raised \
  145.       -text "This text shows the results :-) (enter this widget)"
  146.     catch ".xfCursorBox.demo config $tmpMessageOpt"
  147.  
  148.     frame .xfCursorBox.current \
  149.       -borderwidth 0 \
  150.       -relief raised
  151.     catch ".xfCursorBox.current config $tmpFrameOpt"
  152.  
  153.     label .xfCursorBox.current.labelcurrent \
  154.       -relief raised
  155.     catch ".xfCursorBox.current.labelcurrent config $tmpMessageOpt"
  156.  
  157.     entry .xfCursorBox.current.current \
  158.       -relief raised
  159.     catch ".xfCursorBox.current.current config $tmpMessageOpt"
  160.  
  161.     frame .xfCursorBox.fg \
  162.       -borderwidth 0 \
  163.       -relief raised
  164.     catch ".xfCursorBox config.fg $tmpFrameOpt"
  165.  
  166.     label .xfCursorBox.fg.labelfg \
  167.       -relief raised \
  168.       -text "Foreground:"
  169.     catch ".xfCursorBox.fg.labelfg config $tmpMessageOpt"
  170.  
  171.     entry .xfCursorBox.fg.fg \
  172.       -relief raised
  173.     catch ".xfCursorBox.fg.fg config $tmpMessageOpt"
  174.  
  175.     frame .xfCursorBox.bg \
  176.       -borderwidth 0 \
  177.       -relief raised
  178.     catch ".xfCursorBox.bg config $tmpFrameOpt"
  179.  
  180.     label .xfCursorBox.bg.labelbg \
  181.       -relief raised \
  182.       -text "Background:"
  183.     catch ".xfCursorBox.bg.labelbg config $tmpMessageOpt"
  184.  
  185.     entry .xfCursorBox.bg.bg \
  186.       -relief raised
  187.     catch ".xfCursorBox.bg.bg config $tmpMessageOpt"
  188.  
  189.     frame .xfCursorBox.cursors \
  190.       -borderwidth 0 \
  191.       -relief raised
  192.     catch ".xfCursorBox.cursor config $tmpFrameOpt"
  193.  
  194.     scrollbar .xfCursorBox.cursors.vscroll \
  195.       -relief raised \
  196.       -command ".xfCursorBox.cursors.cursors yview"
  197.     catch ".xfCursorBox.cursors.vscroll config $tmpScrollOpt"
  198.  
  199.     scrollbar .xfCursorBox.cursors.hscroll \
  200.       -orient horiz \
  201.       -relief raised \
  202.       -command ".xfCursorBox.cursors.cursors xview"
  203.     catch ".xfCursorBox.cursors.hscroll config $tmpScrollOpt"
  204.  
  205.     listbox .xfCursorBox.cursors.cursors \
  206.       -exportselection false \
  207.       -relief raised \
  208.       -xscrollcommand ".xfCursorBox.cursors.hscroll set" \
  209.       -yscrollcommand ".xfCursorBox.cursors.vscroll set"
  210.     catch ".xfCursorBox.cursors.cursors config $tmpMessageOpt"
  211.  
  212.     # read cursor file
  213.     if {"$xfCursorBoxFileCursor" != ""} {
  214.       if {[catch "open $xfCursorBoxFileCursor r" cursorInFile]} {
  215.         set xfCursorBoxFileCursor ""
  216.         if {"[info commands XFAlertBox]" != ""} {
  217.           XFAlertBox "$cursorInFile"
  218.         } {
  219.           puts stderr "$cursorInFile"
  220.         }
  221.       } {
  222.         set cursorReadList [read $cursorInFile]
  223.         close $cursorInFile
  224.         foreach cursorLine [split $cursorReadList "\n"] {
  225.           if {"[string trim $cursorLine]" != ""} {
  226.             .xfCursorBox.cursors.cursors insert end $cursorLine
  227.           }
  228.         }
  229.       }
  230.     }
  231.   
  232.     # bindings
  233.     global xfBind
  234.     set tmpBinding "<Double-Button-3>"
  235.     if {[info exists xfBind(configure)]} {
  236.       set tmpBinding $xfBind(configure)
  237.     }
  238.     bind .xfCursorBox.fg.fg $tmpBinding "
  239.       if {\"\[info commands XFColorBox\]\" != \"\"} {
  240.         .xfCursorBox.fg.fg delete 0 end
  241.         .xfCursorBox.fg.fg insert 0 \[XFColorBox $xfCursorBoxFileColor\]
  242.         update idletask
  243.         grab .xfCursorBox
  244.         tkwait window .xfCursorBox
  245.       }"
  246.     catch "bind .xfCursorBox.fg.fg <Up> {}"
  247.     bind .xfCursorBox.fg.fg <Down> {
  248.       global tkVersion
  249.       if {$tkVersion >= 3.0} {
  250.         .xfCursorBox.bg.bg icursor 0
  251.       } {
  252.         .xfCursorBox.bg.bg cursor 0
  253.       }
  254.       focus .xfCursorBox.bg.bg}
  255.  
  256.     bind .xfCursorBox.bg.bg $tmpBinding "
  257.       if {\"\[info commands XFColorBox\]\" != \"\"} {
  258.         .xfCursorBox.bg.bg delete 0 end
  259.         .xfCursorBox.bg.bg insert 0 \[XFColorBox $xfCursorBoxFileColor\]
  260.        update idletask
  261.        grab .xfCursorBox
  262.        tkwait window .xfCursorBox
  263.       }"
  264.     bind .xfCursorBox.bg.bg <Up> {
  265.       global tkVersion
  266.       if {$tkVersion >= 3.0} {
  267.         .xfCursorBox.fg.fg icursor 0
  268.       } {
  269.         .xfCursorBox.fg.fg cursor 0
  270.       }
  271.       focus .xfCursorBox.fg.fg}
  272.     bind .xfCursorBox.bg.bg <Down> {
  273.       global tkVersion
  274.       if {$tkVersion >= 3.0} {
  275.         .xfCursorBox.current.current icursor 0
  276.       } {
  277.         .xfCursorBox.current.current cursor 0
  278.       }
  279.       focus .xfCursorBox.current.current}
  280.  
  281.     bind .xfCursorBox.current.current <Up> {
  282.       global tkVersion
  283.       if {$tkVersion >= 3.0} {
  284.         .xfCursorBox.bg.bg icursor 0
  285.       } {
  286.         .xfCursorBox.bg.bg cursor 0
  287.       }
  288.       focus .xfCursorBox.bg.bg}
  289.     catch "bind .xfCursorBox.current.current <Down> {}"
  290.   } {
  291.     if {"[.xfCursorBox.fg.fg get]" != "" &&
  292.         "[.xfCursorBox.bg.bg get]" != ""} {
  293.      set tmpXFCursorBox \
  294.          "[.xfCursorBox.current.current get] {[.xfCursorBox.fg.fg get]} {[.xfCursorBox.bg.bg get]}"
  295.     } {
  296.       if {"[.xfCursorBox.fg.fg get]" != ""} {
  297.         set tmpXFCursorBox \
  298.           "[.xfCursorBox.current.current get] {[.xfCursorBox.fg.fg get]}"
  299.       } {
  300.         if {"[.xfCursorBox.bg.bg get]" != ""} {
  301.           set tmpXFCursorBox \
  302.             "[.xfCursorBox.current.current get] {[.xfCursorBox.bg.bg get]}"
  303.         } {
  304.           set tmpXFCursorBox \
  305.             "[.xfCursorBox.current.current get]"
  306.         }
  307.       }
  308.     }
  309.     if {"[winfo class $xfCursorBox(oldWidget)]" == "Text"} {
  310.       catch "$xfCursorBox(oldWidget) delete 1.0 end"
  311.       catch "$xfCursorBox(oldWidget) insert 1.0 [.xfCursorBox.current.current get]"
  312.     } {
  313.       if {"[winfo class $xfCursorBox(oldWidget)]" == "Entry"} {
  314.         catch "$xfCursorBox(oldWidget) delete 0 end"
  315.         catch "$xfCursorBox(oldWidget) insert 0 [.xfCursorBox.current.current get]"
  316.       }
  317.     }
  318.  
  319.     set xfCursorBox(oldWidget) $xfCursorBoxEntryW
  320.   }
  321.  
  322.   .xfCursorBox.frame1.ok config \
  323.     -command "
  324.       global xfCursorBox
  325.       if {\"\[.xfCursorBox.fg.fg get\]\" != \"\" &&
  326.           \"\[.xfCursorBox.bg.bg get\]\" != \"\"} {
  327.        set xfCursorBox(cursorName) \
  328.            \"\[.xfCursorBox.current.current get\] {\[.xfCursorBox.fg.fg get\]} {\[.xfCursorBox.bg.bg get\]}\"
  329.       } {
  330.         if {\"\[.xfCursorBox.fg.fg get\]\" != \"\"} {
  331.           set xfCursorBox(cursorName) \
  332.             \"\[.xfCursorBox.current.current get\] {\[.xfCursorBox.fg.fg get\]}\"
  333.         } {
  334.           if {\"\[.xfCursorBox.bg.bg get\]\" != \"\"} {
  335.             set xfCursorBox(cursorName) \
  336.               \"\[.xfCursorBox.current.current get\] {\[.xfCursorBox.bg.bg get\]}\"
  337.           } {
  338.             set xfCursorBox(cursorName) \
  339.               \"\[.xfCursorBox.current.current get\]\"
  340.           }
  341.         }
  342.       }
  343.       if {\"$xfCursorBoxEntryW\" != \"\"} {
  344.         if {\"\[winfo class $xfCursorBoxEntryW\]\" == \"Text\"} {
  345.           catch \"$xfCursorBoxEntryW delete 1.0 end\"
  346.           catch \"$xfCursorBoxEntryW insert 1.0 \\\"\$xfCursorBox(cursorName)\\\"\"
  347.         } {
  348.           if {\"\[winfo class $xfCursorBoxEntryW\]\" == \"Entry\"} {
  349.             catch \"$xfCursorBoxEntryW delete 0 end\"
  350.             catch \"$xfCursorBoxEntryW insert 0 \\\"\$xfCursorBox(cursorName)\\\"\"
  351.           }
  352.         }
  353.       }
  354.       if {\"\[info commands XFDestroy\]\" != \"\"} {
  355.         catch {XFDestroy .xfCursorBox}
  356.       } {
  357.         catch {destroy .xfCursorBox}
  358.       }"
  359.  
  360.   .xfCursorBox.frame1.cancel config \
  361.     -command "
  362.       global xfCursorBox
  363.       set xfCursorBox(cursorName) {}
  364.       if {\"$xfCursorBoxTargetW\" != \"\"} {
  365.         catch \"$xfCursorBoxTargetW config -\[string tolower $xfCursorBoxMessage\] $xfCursorBoxSavedCursor\"
  366.       }
  367.       if {\"\[info commands XFDestroy\]\" != \"\"} {
  368.         catch {XFDestroy .xfCursorBox}
  369.       } {
  370.         catch {destroy .xfCursorBox}
  371.       }"
  372.  
  373.   .xfCursorBox.current.labelcurrent config \
  374.     -text "$xfCursorBoxMessage:"
  375.  
  376.   # bindings
  377.   bind .xfCursorBox.fg.fg <Return> "
  378.     XFCursorBoxSetCursor \"$xfCursorBoxMessage\" \"$xfCursorBoxTargetW\"
  379.     global tkVersion
  380.     if {\$tkVersion >= 3.0} {
  381.       .xfCursorBox.bg.bg icursor 0
  382.     } {
  383.       .xfCursorBox.bg.bg cursor 0
  384.     }
  385.     focus .xfCursorBox.bg.bg"
  386.  
  387.   bind .xfCursorBox.bg.bg <Return> "
  388.     XFCursorBoxSetCursor \"$xfCursorBoxMessage\" \"$xfCursorBoxTargetW\"
  389.     global tkVersion
  390.     if {\$tkVersion >= 3.0} {
  391.       .xfCursorBox.current.current icursor 0
  392.     } {
  393.       .xfCursorBox.current.current cursor 0
  394.     }
  395.     focus .xfCursorBox.current.current"
  396.  
  397.   bind .xfCursorBox.current.current <Return> "
  398.     XFCursorBoxSetCursor \"$xfCursorBoxMessage\" \"$xfCursorBoxTargetW\""
  399.  
  400.   bind .xfCursorBox.cursors.cursors <Double-1> "
  401.     XFCursorBoxSelectCursor %W \"$xfCursorBoxMessage\" \"$xfCursorBoxTargetW\" %y
  402.     global xfCursorBox
  403.     if {\"\[.xfCursorBox.fg.fg get\]\" != \"\" &&
  404.         \"\[.xfCursorBox.bg.bg get\]\" != \"\"} {
  405.      set xfCursorBox(cursorName) \
  406.          \"\[.xfCursorBox.current.current get\] {\[.xfCursorBox.fg.fg get\]} {\[.xfCursorBox.bg.bg get\]}\"
  407.     } {
  408.       if {\"\[.xfCursorBox.fg.fg get\]\" != \"\"} {
  409.          set xfCursorBox(cursorName) \
  410.            \"\[.xfCursorBox.current.current get\] {\[.xfCursorBox.fg.fg get\]}\"
  411.       } {
  412.         if {\"\[.xfCursorBox.bg.bg get\]\" != \"\"} {
  413.           set xfCursorBox(cursorName) \
  414.             \"\[.xfCursorBox.current.current get\] {\[.xfCursorBox.bg.bg get\]}\"
  415.         } {
  416.           set xfCursorBox(cursorName) \
  417.             \"\[.xfCursorBox.current.current get\]\"
  418.         }
  419.       }
  420.     }
  421.     if {\"$xfCursorBoxEntryW\" != \"\"} {
  422.       if {\"\[winfo class $xfCursorBoxEntryW\]\" == \"Text\"} {
  423.         catch \"$xfCursorBoxEntryW delete 1.0 end\"
  424.         catch \"$xfCursorBoxEntryW insert 1.0 \\\"\$xfCursorBox(cursorName)\\\"\"
  425.       } {
  426.         if {\"\[winfo class $xfCursorBoxEntryW\]\" == \"Entry\"} {
  427.           catch \"$xfCursorBoxEntryW delete 0 end\"
  428.           catch \"$xfCursorBoxEntryW insert 0 \\\"\$xfCursorBox(cursorName)\\\"\"
  429.         }
  430.       }
  431.     }
  432.     if {\"\[info commands XFDestroy\]\" != \"\"} {
  433.       catch {XFDestroy .xfCursorBox}
  434.     } {
  435.       catch {destroy .xfCursorBox}
  436.     }"
  437.  
  438.   bind .xfCursorBox.cursors.cursors <ButtonPress-1> "
  439.     XFCursorBoxSelectCursor %W \"$xfCursorBoxMessage\" \"$xfCursorBoxTargetW\" %y"
  440.   bind .xfCursorBox.cursors.cursors <Button1-Motion> "
  441.     XFCursorBoxSelectCursor %W \"$xfCursorBoxMessage\" \"$xfCursorBoxTargetW\" %y"
  442.   bind .xfCursorBox.cursors.cursors <Shift-ButtonPress-1> "
  443.     XFCursorBoxSelectCursor %W \"$xfCursorBoxMessage\" \"$xfCursorBoxTargetW\" %y"
  444.   bind .xfCursorBox.cursors.cursors <Shift-Button1-Motion> "
  445.     XFCursorBoxSelectCursor %W \"$xfCursorBoxMessage\" \"$xfCursorBoxTargetW\" %y"
  446.  
  447.   # set up current value
  448.   .xfCursorBox.current.current delete 0 end
  449.   if {"$xfCursorBoxEntryW" != ""} {
  450.     if {"[winfo class $xfCursorBoxEntryW]" == "Text"} {
  451.       .xfCursorBox.fg.fg insert 0 [lindex [$xfCursorBoxEntryW get 1.0 end] 1]
  452.       .xfCursorBox.bg.bg insert 0 [lindex [$xfCursorBoxEntryW get 1.0 end] 2]
  453.       .xfCursorBox.current.current insert 0 [lindex [$xfCursorBoxEntryW get 1.0 end] 0]
  454.     } {
  455.       if {"[winfo class $xfCursorBoxEntryW]" == "Entry"} {
  456.         .xfCursorBox.fg.fg insert 0 [lindex [$xfCursorBoxEntryW get] 1]
  457.         .xfCursorBox.bg.bg insert 0 [lindex [$xfCursorBoxEntryW get] 2]
  458.         .xfCursorBox.current.current insert 0 [lindex [$xfCursorBoxEntryW get] 0]
  459.       }
  460.     }
  461.   }
  462.  
  463.   # packing
  464.   pack append .xfCursorBox.frame1 \
  465.               .xfCursorBox.frame1.ok {left fill expand} \
  466.               .xfCursorBox.frame1.cancel {left fill expand}
  467.   pack append .xfCursorBox.current \
  468.               .xfCursorBox.current.labelcurrent {left} \
  469.               .xfCursorBox.current.current {left fill expand}
  470.   pack append .xfCursorBox.fg \
  471.               .xfCursorBox.fg.labelfg {left} \
  472.               .xfCursorBox.fg.fg {left fill expand}
  473.   pack append .xfCursorBox.bg \
  474.               .xfCursorBox.bg.labelbg {left} \
  475.               .xfCursorBox.bg.bg {left fill expand}
  476.   pack append .xfCursorBox.cursors \
  477.               .xfCursorBox.cursors.vscroll "$xfCursorBox(scrollSide) filly" \
  478.               .xfCursorBox.cursors.hscroll {bottom fillx} \
  479.               .xfCursorBox.cursors.cursors {left fill expand}
  480.  
  481.   if {"$xfCursorBoxFileCursor" != ""} {
  482.     pack append .xfCursorBox \
  483.                 .xfCursorBox.frame1 {bottom fillx} \
  484.                 .xfCursorBox.current {bottom fillx} \
  485.                 .xfCursorBox.bg {bottom fillx} \
  486.                 .xfCursorBox.fg {bottom fillx} \
  487.                 .xfCursorBox.demo {bottom fillx} \
  488.                 .xfCursorBox.cursors {left expand fill}
  489.   } {
  490.     wm geometry .xfCursorBox 400x110
  491.     pack append .xfCursorBox \
  492.                 .xfCursorBox.frame1 {bottom fillx} \
  493.                 .xfCursorBox.current {bottom fillx} \
  494.                 .xfCursorBox.bg {bottom fillx} \
  495.                 .xfCursorBox.fg {bottom fillx} \
  496.                 .xfCursorBox.demo {bottom fill expand}
  497.   }
  498.   catch "wm deiconify .xfCursorBox"
  499.  
  500.   if {"$xfCursorBoxEntryW" == ""} {
  501.     # wait for the box to be destroyed
  502.     update idletask
  503.     grab .xfCursorBox
  504.     tkwait window .xfCursorBox
  505.  
  506.     return $xfCursorBox(cursorName)
  507.   }
  508. }
  509.  
  510. ##########
  511. # Procedure: XFCursorBoxSelectCursor
  512. # Description: select cursor for cursor composing
  513. # Arguments: xfCursorBoxW - the widget
  514. #            xfCursorBoxMessage - the message for the cursor
  515. #            xfCursorBoxTargetW - the widget we configure
  516. #            xfCursorBoxY - the y position in the listbox
  517. # Returns: none
  518. # Sideeffects: none
  519. ##########
  520. proc XFCursorBoxSelectCursor {xfCursorBoxW xfCursorBoxMessage xfCursorBoxTargetW xfCursorBoxY} {# xf ignore me 6
  521.  
  522.   set xfCursorBoxNearest [$xfCursorBoxW nearest $xfCursorBoxY]
  523.   if {$xfCursorBoxNearest >= 0} {
  524.     $xfCursorBoxW select from $xfCursorBoxNearest
  525.     $xfCursorBoxW select to $xfCursorBoxNearest
  526.     .xfCursorBox.current.current delete 0 end
  527.     .xfCursorBox.current.current insert 0 [$xfCursorBoxW get $xfCursorBoxNearest]
  528.     XFCursorBoxSetCursor "$xfCursorBoxMessage" "$xfCursorBoxTargetW"
  529.   }
  530. }
  531.  
  532. ##########
  533. # Procedure: XFCursorBoxSetCursor
  534. # Description: set cursor for the widget
  535. # Arguments: xfCursorBoxMessage - the message for the cursor
  536. #            xfCursorBoxTargetW - the widget we configure
  537. # Arguments: none
  538. # Returns: none
  539. # Sideeffects: none
  540. ##########
  541. proc XFCursorBoxSetCursor {xfCursorBoxMessage xfCursorBoxTargetW} {# xf ignore me 6
  542.  
  543.   if {"[.xfCursorBox.current.current get]" != ""} {
  544.     if {"[.xfCursorBox.fg.fg get]" != "" &&
  545.         "[.xfCursorBox.bg.bg get]" != ""} {
  546.       catch ".xfCursorBox.demo config -cursor \
  547.         \"{[.xfCursorBox.current.current get]} {[.xfCursorBox.fg.fg get]} {[.xfCursorBox.bg.bg get]}\""
  548.       if {"$xfCursorBoxTargetW" != ""} {
  549.         catch "$xfCursorBoxTargetW config -[string tolower $xfCursorBoxMessage] \
  550.           \"{[.xfCursorBox.current.current get]} {[.xfCursorBox.fg.fg get]} {[.xfCursorBox.bg.bg get]}\""
  551.       }
  552.     } {
  553.       if {"[.xfCursorBox.fg.fg get]" != ""} {
  554.         catch ".xfCursorBox.demo config -cursor \
  555.           \"{[.xfCursorBox.current.current get]} {[.xfCursorBox.fg.fg get]}\""
  556.         if {"$xfCursorBoxTargetW" != ""} {
  557.           catch "$xfCursorBoxTargetW config -[string tolower $xfCursorBoxMessage] \
  558.             \"{[.xfCursorBox.current.current get]} {[.xfCursorBox.fg.fg get]}\""
  559.         }
  560.       } {
  561.         if {"[.xfCursorBox.bg.bg get]" != ""} {
  562.           catch ".xfCursorBox.demo config -cursor \
  563.             \"{[.xfCursorBox.current.current get]} {[.xfCursorBox.bg.bg get]}\""
  564.           if {"$xfCursorBoxTargetW" != ""} {
  565.             catch "$xfCursorBoxTargetW config -[string tolower $xfCursorBoxMessage] \
  566.               \"{[.xfCursorBox.current.current get]} {[.xfCursorBox.bg.bg get]}\""
  567.           }
  568.         } {
  569.           catch ".xfCursorBox.demo config -cursor \
  570.             \"{[.xfCursorBox.current.current get]}\""
  571.           if {"$xfCursorBoxTargetW" != ""} {
  572.             catch "$xfCursorBoxTargetW config -[string tolower $xfCursorBoxMessage] \
  573.               \"{[.xfCursorBox.current.current get]}\""
  574.           }
  575.         }
  576.       }
  577.     }
  578.   }
  579. }
  580.  
  581. # eof
  582.  
  583.