#!/usr/local/bin/wish

# Program: toucan
# Tcl version: 8.3 (Tcl/Tk/XF)
# Tk version: 8.3
# XF version: 4.3

# module inclusion
global env
global xfLoadPath
global xfLoadInfo
set xfMisc(separator) @
set xfLoadInfo 0
if {[info exists env(XF_LOAD_PATH)]} {
  if {[string first $env(XF_LOAD_PATH) .] == -1} {
    set xfLoadPath $env(XF_LOAD_PATH)@.
  } {
    set xfLoadPath .
  }
} {
  set xfLoadPath .
}



# procedure to show window ShowWindow.top0
proc ShowWindow.top0 { args} {
# xf ignore me 7

  # build widget .top0
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top0"
  } {
    catch "destroy .top0"
  }
  toplevel .top0   -relief {raised}

  # Window manager configurations
  wm positionfrom .top0 ""
  wm sizefrom .top0 ""
  wm maxsize .top0 1000 768
  wm minsize .top0 10 10
  wm protocol .top0 WM_DELETE_WINDOW {DestroyWindow.top0}
  wm title .top0 {top0}


  # build widget .top0.frame0
  frame .top0.frame0  -borderwidth {2}  -height {177}  -width {307}

  # build widget .top0.frame0.listbox0
  listbox .top0.frame0.listbox0  -font {toucan_font}  -relief {raised}  -selectmode {extended}  -width {40}  -xscrollcommand {.top0.frame0.scrollbar1 set}  -yscrollcommand {.top0.frame0.scrollbar0 set}  -listvariable {toucanTop0(list)}

  # build widget .top0.frame0.scrollbar0
  scrollbar .top0.frame0.scrollbar0  -command {.top0.frame0.listbox0 yview}

  # build widget .top0.frame0.scrollbar1
  scrollbar .top0.frame0.scrollbar1  -command {.top0.frame0.listbox0 xview}  -orient {horizontal}

  # build widget .top0.frame1
  frame .top0.frame1  -borderwidth {2}  -height {26}  -width {307}

  # build widget .top0.frame1.button0
  button .top0.frame1.button0  -font {toucan_font}  -text {OK}

  # build widget .top0.frame1.button1
  button .top0.frame1.button1  -font {toucan_font}  -text {Add}

  # build widget .top0.frame1.button2
  button .top0.frame1.button2  -command {foreach ndx [lsort -integer -decreasing [.top0.frame0.listbox0 curselection]] {
  .top0.frame0.listbox0 delete $ndx
}
unset ndx}  -font {toucan_font}  -text {Remove}

  # build widget .top0.frame1.button3
  button .top0.frame1.button3  -command {DestroyWindow.top0}  -font {toucan_font}  -text {Cancel}

  # build widget .top0.frame2
  frame .top0.frame2  -borderwidth {2}  -height {26}  -width {307}

  # build widget .top0.frame2.button0
  button .top0.frame2.button0  -command {toucanDisplayBitmapFile [.top0.frame0.listbox0 curselection]}  -font {toucan_font}  -text {View}

  # build widget .top0.frame2.frame0
  frame .top0.frame2.frame0  -borderwidth {2}  -height {30}  -relief {ridge}  -width {84}

  # build widget .top0.frame2.frame0.label0
  label .top0.frame2.frame0.label0  -font {toucan_font}  -text {Type}

  # build widget .top0.frame2.frame0.menubutton0
  menubutton .top0.frame2.frame0.menubutton0  -font {toucan_font}  -menu {.top0.frame2.frame0.menubutton0.m}  -padx {4}  -pady {3}  -text {BITMAP}  -textvariable {toucanTop0(type)}

  # build widget .top0.frame2.frame0.menubutton0.m
  menu .top0.frame2.frame0.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top0.frame2.frame0.menubutton0.m add command  -command {toucanSetBitmapOption type BITMAP}  -label {BITMAP}
  .top0.frame2.frame0.menubutton0.m add command  -command {toucanSetBitmapOption type BITMAPGRAY}  -label {BITMAPGRAY}
  .top0.frame2.frame0.menubutton0.m add command  -command {toucanSetBitmapOption type BITMAPGRAY16}  -label {BITMAPGRAY16}
  .top0.frame2.frame0.menubutton0.m add command  -command {toucanSetBitmapOption type BITMAPCOLOR16}  -label {BITMAPCOLOR16}
  .top0.frame2.frame0.menubutton0.m add command  -command {toucanSetBitmapOption type BITMAPCOLOR}  -label {BITMAPCOLOR}
  .top0.frame2.frame0.menubutton0.m add command  -command {toucanSetBitmapOption type BITMAPCOLOR16K}  -label {BITMAPCOLOR16K}

  # build widget .top0.frame2.frame1
  frame .top0.frame2.frame1  -borderwidth {2}  -height {30}  -relief {ridge}  -width {66}

  # build widget .top0.frame2.frame1.label0
  label .top0.frame2.frame1.label0  -font {toucan_font}  -text {Compression}

  # build widget .top0.frame2.frame1.menubutton0
  menubutton .top0.frame2.frame1.menubutton0  -font {toucan_font}  -menu {.top0.frame2.frame1.menubutton0.m}  -padx {4}  -pady {3}  -text {NOCOMPRESS}  -textvariable {toucanTop0(comp)}

  # build widget .top0.frame2.frame1.menubutton0.m
  menu .top0.frame2.frame1.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top0.frame2.frame1.menubutton0.m add command  -command {toucanSetBitmapOption comp NOCOMPRESS}  -label {NOCOMPRESS}
  .top0.frame2.frame1.menubutton0.m add command  -command {toucanSetBitmapOption comp COMPRESS}  -label {COMPRESS}
  .top0.frame2.frame1.menubutton0.m add command  -command {toucanSetBitmapOption comp FORCECOMPRESS}  -label {FORCECOMPRESS}

  # build widget .top0.frame2.button1
  button .top0.frame2.button1  -command {toucanSetBitmapOption file}  -font {toucan_font}  -text {File}

  # pack master .top0.frame0
  pack configure .top0.frame0.scrollbar0  -fill y  -side left
  pack configure .top0.frame0.listbox0  -expand 1  -fill both
  pack configure .top0.frame0.scrollbar1  -fill x

  # pack master .top0.frame1
  pack configure .top0.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top0.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top0.frame1.button2  -expand 1  -fill x  -side left
  pack configure .top0.frame1.button3  -expand 1  -fill x  -side left

  # pack master .top0.frame2
  pack configure .top0.frame2.button0  -expand 1  -fill x  -side left
  pack configure .top0.frame2.button1  -expand 1  -fill x  -side left
  pack configure .top0.frame2.frame0  -expand 1  -fill x  -side left
  pack configure .top0.frame2.frame1  -expand 1  -fill x  -side left

  # pack master .top0.frame2.frame0
  pack configure .top0.frame2.frame0.label0  -side left
  pack configure .top0.frame2.frame0.menubutton0  -expand 1  -fill x  -side left

  # pack master .top0.frame2.frame1
  pack configure .top0.frame2.frame1.label0  -side left
  pack configure .top0.frame2.frame1.menubutton0  -expand 1  -fill x  -side left

  # pack master .top0
  pack configure .top0.frame0  -expand 1  -fill both
  pack configure .top0.frame2  -fill x
  pack configure .top0.frame1  -fill x

EndSrc.top0

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top0"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top0 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top0]" != ""} {
      global xfShowWindow.top0
      set xfShowWindow.top0 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top0; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top0"
    update
  }
}

proc EndSrc.top0 {} {
  global toucanTop0
  upvar args cargs

  if {[winfo exists .xfEdit]} { return }
  grab .top0
  foreach ndx [array names toucanTop0 {[0-9][0-9][0-9][0-9]}] {
    unset toucanTop0($ndx)
  }

  switch -- [lindex $cargs 0] {
    -M {
      wm title .top0 {Messages}
      destroy .top0.frame1.button0 .top0.frame1.button1 .top0.frame1.button2
      destroy .top0.frame2
      .top0.frame1.button3 config -text Dismiss
    }
    -D {
      wm title .top0 {Macro definitions}
      destroy .top0.frame2
      global toucanPilrc
      set toucanTop0(list) $toucanPilrc(-D)
      .top0.frame1.button0 config -command {
        set toucanPilrc(-D) $toucanTop0(list)
        DestroyWindow.top0
      }
      .top0.frame1.button1 config -command {
        ShowWindow.top1 -D
      }
    }
    -I {
      wm title .top0 {Include paths}
      destroy .top0.frame2
      global toucanPilrc
      set toucanTop0(list) $toucanPilrc(-I)
      .top0.frame1.button0 config -command {
        set toucanPilrc(-I) $toucanTop0(list)
        DestroyWindow.top0
      }
      .top0.frame1.button1 config -command {
        if {[set path [tk_chooseDirectory -mustexist 1 -parent .top0 -title {Include path}]] != {}} {
          .top0.frame0.listbox0 insert end $path
        }
        unset path
      }
    }
    -B {
      wm title .top0 {Bitmap properties}
      .top0.frame0.listbox0 config -selectmode browse -exportselection 0
      bind .top0.frame0.listbox0 <B1-ButtonRelease> {
        toucanSelectBitmapData [%W curselection]
      }
      .top0.frame1.button0 config -command {
        toucanApplyBitmapData
        DestroyWindow.top0
      }
      .top0.frame1.button1 config -command {
        toucanCreateBitmapElement
      }
      .top0.frame1.button2 config -command {
        toucanDeleteBitmapData [.top0.frame0.listbox0 curselection]
      }
      global toucanBitmapType
      set toucanTop0(list) {}
      array set toucanTop0 [array get toucanBitmapType]
      foreach bid [lsort -integer [array names toucanBitmapType {[0-9][0-9][0-9][0-9]}]] {
        lappend toucanTop0(list) [concat $bid : [lindex $toucanBitmapType($bid) 2]]
      }
    }
  }
}


# procedure to show window ShowWindow.top1
proc ShowWindow.top1 { args} {
# xf ignore me 7

  # build widget .top1
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top1"
  } {
    catch "destroy .top1"
  }
  toplevel .top1   -relief {sunken}

  # Window manager configurations
  wm positionfrom .top1 ""
  wm sizefrom .top1 ""
  wm maxsize .top1 1000 768
  wm minsize .top1 10 10
  wm protocol .top1 WM_DELETE_WINDOW {DestroyWindow.top1}
  wm title .top1 {Macro definition}


  # build widget .top1.frame0
  frame .top1.frame0  -borderwidth {2}  -height {24}  -width {336}

  # build widget .top1.frame0.label0
  label .top1.frame0.label0  -font {toucan_font}  -text {Symbol:}

  # build widget .top1.frame0.label1
  label .top1.frame0.label1  -font {toucan_font}  -text {Value:}

  # build widget .top1.frame0.entry0
  entry .top1.frame0.entry0  -font {toucan_font}

  # build widget .top1.frame0.entry1
  entry .top1.frame0.entry1  -font {toucan_font}

  # build widget .top1.frame1
  frame .top1.frame1  -borderwidth {2}  -height {30}  -width {336}

  # build widget .top1.frame1.button0
  button .top1.frame1.button0  -font {toucan_font}  -text {OK}

  # build widget .top1.frame1.button1
  button .top1.frame1.button1  -command {DestroyWindow.top1}  -font {toucan_font}  -text {Cancel}

  # pack master .top1.frame0
  pack configure .top1.frame0.label0  -side left
  pack configure .top1.frame0.entry0  -expand 1  -fill x  -side left
  pack configure .top1.frame0.label1  -side left
  pack configure .top1.frame0.entry1  -expand 1  -fill x  -side left

  # pack master .top1.frame1
  pack configure .top1.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top1.frame1.button1  -expand 1  -fill x  -side left

  # pack master .top1
  pack configure .top1.frame0  -expand 1  -fill x
  pack configure .top1.frame1  -expand 1  -fill x

  .top1.frame0.entry0 insert end {}
  .top1.frame0.entry1 insert end {}



EndSrc.top1

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top1"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top1 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top1]" != ""} {
      global xfShowWindow.top1
      set xfShowWindow.top1 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top1; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top1"
    update
  }
}

proc EndSrc.top1 {} {
  global toucanProject toucanPilrc toucanPar
  upvar args cargs

  if {[winfo exists .xfEdit]} { return }
  grab .top1
  switch -- [lindex $cargs 0] {
    -D {
      wm title .top1 {Macro definition}
      .top1.frame1.button0 config -command {
        if {[.top1.frame0.entry1 get] != {}} {
          .top0.frame0.listbox0 insert end "[.top1.frame0.entry0 get]=[.top1.frame0.entry1 get]"
        } else {
          .top0.frame0.listbox0 insert end [.top1.frame0.entry0 get]
        }
        DestroyWindow.top1
      }
    }
    -H {
      wm title .top1 {Output include (.h) file}
      destroy .top1.frame0.label0 .top1.frame0.label1 .top1.frame0.entry1
      .top1.frame0.entry0 insert 0 $toucanPilrc(-H)
      .top1.frame1.button0 config -command {
        set toucanPilrc(-H) [.top1.frame0.entry0 get]
        DestroyWindow.top1
      }
    }
    -R {
      wm title .top1 {Output resource (.res) file}
      destroy .top1.frame0.label0 .top1.frame0.label1 .top1.frame0.entry1
      .top1.frame0.entry0 insert 0 $toucanPilrc(-R)
      .top1.frame1.button0 config -command {
        set toucanPilrc(-R) [.top1.frame0.entry0 get]
        DestroyWindow.top1
      }
    }
    appName {
      wm title .top1 {Application name}
      destroy .top1.frame0.label0 .top1.frame0.label1 .top1.frame0.entry1
      .top1.frame0.entry0 insert 0 $toucanPar(appName)
      .top1.frame1.button0 config -command {
        set toucanPar(appName) [.top1.frame0.entry0 get]
        DestroyWindow.top1
      }
    }
    creatorID {
      wm title .top1 {Creator ID}
      destroy .top1.frame0.label0 .top1.frame0.label1 .top1.frame0.entry1
      .top1.frame0.entry0 insert 0 $toucanPar(creatorID)
      .top1.frame1.button0 config -command {
        set toucanPar(creatorID) [.top1.frame0.entry0 get]
        DestroyWindow.top1
      }
    }
    version {
      wm title .top1 {Version}
      destroy .top1.frame0.label0 .top1.frame0.label1 .top1.frame0.entry1
      .top1.frame0.entry0 insert 0 $toucanProject(version)
      .top1.frame1.button0 config -command {
        set toucanProject(version) [.top1.frame0.entry0 get]
        DestroyWindow.top1
      }
    }
 }
}


# procedure to show window ShowWindow.top10
proc ShowWindow.top10 { args} {
# xf ignore me 7

  # build widget .top10
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top10"
  } {
    catch "destroy .top10"
  }
  toplevel .top10   -relief {sunken}

  # Window manager configurations
  wm positionfrom .top10 ""
  wm sizefrom .top10 user
  wm geometry .top10 615x118
  wm maxsize .top10 1000 768
  wm minsize .top10 590 109
  wm protocol .top10 WM_DELETE_WINDOW {DestroyWindow.top10}
  wm title .top10 {List properties}


  # build widget .top10.frame0
  frame .top10.frame0  -height {218}  -width {717}

  # build widget .top10.frame0.frame0
  frame .top10.frame0.frame0  -height {24}  -width {717}

  # build widget .top10.frame0.frame0.frame0
  frame .top10.frame0.frame0.frame0  -borderwidth {2}  -height {20}  -relief {ridge}  -width {172}

  # build widget .top10.frame0.frame0.frame0.radiobutton0
  radiobutton .top10.frame0.frame0.frame0.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Usable}  -value {USABLE}  -variable {toucanFormObject(usability)}

  # build widget .top10.frame0.frame0.frame0.radiobutton1
  radiobutton .top10.frame0.frame0.frame0.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Nonusable}  -value {NONUSABLE}  -variable {toucanFormObject(usability)}

  # build widget .top10.frame0.frame0.checkbutton3
  checkbutton .top10.frame0.frame0.checkbutton3  -font {toucan_font}  -offvalue {Null}  -onvalue {DISABLED}  -relief {raised}  -text {Disabled}  -variable {toucanFormObject(disabled)}

  # build widget .top10.frame0.frame0.frame3
  frame .top10.frame0.frame0.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top10.frame0.frame0.frame3.label6
  label .top10.frame0.frame0.frame3.label6  -font {toucan_font}  -text {Object ID}

  # build widget .top10.frame0.frame0.frame3.label7
  label .top10.frame0.frame0.frame3.label7  -font {toucan_font}  -textvariable {toucanFormObject(ID)}  -width {5}

  # build widget .top10.frame0.frame0.frame33
  frame .top10.frame0.frame0.frame33  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top10.frame0.frame0.frame33.label17
  label .top10.frame0.frame0.frame33.label17  -font {toucan_font}  -text {Font ID}

  # build widget .top10.frame0.frame0.frame33.menubutton0
  menubutton .top10.frame0.frame0.frame33.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top10.frame0.frame0.frame33.menubutton0.m}  -padx {4}  -pady {3}  -text {0}  -textvariable {toucanFormObject(font)}

  # build widget .top10.frame0.frame0.frame33.menubutton0.m
  menu .top10.frame0.frame0.frame33.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top10.frame0.frame0.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 0}  -label {0}
  .top10.frame0.frame0.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 1}  -label {1}
  .top10.frame0.frame0.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 2}  -label {2}
  .top10.frame0.frame0.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 3}  -label {3}
  .top10.frame0.frame0.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 4}  -label {4}
  .top10.frame0.frame0.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 5}  -label {5}
  .top10.frame0.frame0.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 6}  -label {6}
  .top10.frame0.frame0.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 7}  -label {7}

  # build widget .top10.frame0.frame3
  frame .top10.frame0.frame3  -height {86}  -width {454}

  # build widget .top10.frame0.frame3.scale5
  scale .top10.frame0.frame3.scale5  -font {toucan_font}  -label {Width}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(width)}

  # build widget .top10.frame0.frame3.scale6
  scale .top10.frame0.frame3.scale6  -font {toucan_font}  -label {Height}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(height)}

  # build widget .top10.frame0.frame3.scale3
  scale .top10.frame0.frame3.scale3  -font {toucan_font}  -label {Visible items}  -orient {horizontal}  -relief {raised}  -variable {toucanFormObject(visibleItems)}

  # build widget .top10.frame0.frame4
  frame .top10.frame0.frame4  -height {342}  -width {492}

  # build widget .top10.frame0.frame4.text6
  text .top10.frame0.frame4.text6  -font {toucan_font}  -height {4}  -width {20}  -wrap {none}  -xscrollcommand {.top10.frame0.frame4.scrollbar8 set}  -yscrollcommand {.top10.frame0.frame4.scrollbar7 set}

  # build widget .top10.frame0.frame4.scrollbar7
  scrollbar .top10.frame0.frame4.scrollbar7  -command {.top10.frame0.frame4.text6 yview}

  # build widget .top10.frame0.frame4.scrollbar8
  scrollbar .top10.frame0.frame4.scrollbar8  -command {.top10.frame0.frame4.text6 xview}  -orient {horizontal}

  # build widget .top10.frame1
  frame .top10.frame1  -height {26}  -width {717}

  # build widget .top10.frame1.button0
  button .top10.frame1.button0  -command {set toucanFormObject(items) [split [string trimright [.top10.frame0.frame4.text6 get 1.0 end] "\n"] "\n"]
toucanAcceptProperties .top10
DestroyWindow.top10}  -font {toucan_font}  -text {OK}

  # build widget .top10.frame1.button1
  button .top10.frame1.button1  -command {set toucanFormObject(items) [split [string trimright [.top10.frame0.frame4.text6 get 1.0 end] "\n"] "\n"]
toucanAcceptProperties .top10}  -font {toucan_font}  -text {Apply}

  # build widget .top10.frame1.button2
  button .top10.frame1.button2  -command {DestroyWindow.top10}  -font {toucan_font}  -text {Cancel}

  # pack master .top10.frame0
  pack configure .top10.frame0.frame4  -side right
  pack configure .top10.frame0.frame0  -fill x
  pack configure .top10.frame0.frame3  -expand 1  -fill x  -side left

  # pack master .top10.frame0.frame0
  pack configure .top10.frame0.frame0.frame3  -fill y  -side left
  pack configure .top10.frame0.frame0.frame33  -fill x  -side left
  pack configure .top10.frame0.frame0.frame0  -expand 1  -fill x  -side left
  pack configure .top10.frame0.frame0.checkbutton3  -expand 1  -fill both  -side left

  # pack master .top10.frame0.frame0.frame0
  pack configure .top10.frame0.frame0.frame0.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top10.frame0.frame0.frame0.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top10.frame0.frame0.frame3
  pack configure .top10.frame0.frame0.frame3.label6  -side left
  pack configure .top10.frame0.frame0.frame3.label7  -expand 1  -fill x  -side left

  # pack master .top10.frame0.frame0.frame33
  pack configure .top10.frame0.frame0.frame33.label17  -fill x  -side left
  pack configure .top10.frame0.frame0.frame33.menubutton0  -side left

  # pack master .top10.frame0.frame3
  pack configure .top10.frame0.frame3.scale3  -expand 1  -fill x  -side left
  pack configure .top10.frame0.frame3.scale5  -expand 1  -fill x  -side left
  pack configure .top10.frame0.frame3.scale6  -expand 1  -fill x  -side left

  # pack master .top10.frame0.frame4
  pack configure .top10.frame0.frame4.scrollbar7  -fill y  -side left
  pack configure .top10.frame0.frame4.scrollbar8  -fill x  -side bottom
  pack configure .top10.frame0.frame4.text6  -side left

  # pack master .top10.frame1
  pack configure .top10.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top10.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top10.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top10
  pack configure .top10.frame0  -expand 1  -fill both
  pack configure .top10.frame1  -fill x

  .top10.frame0.frame4.text6 insert end {}



EndSrc.top10

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top10"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top10 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top10]" != ""} {
      global xfShowWindow.top10
      set xfShowWindow.top10 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top10; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top10"
    update
  }
}

proc EndSrc.top10 {} {
  upvar args cargs
  global toucanFormObject toucanFormObjectList

  if {[winfo exists .xfEdit]} { return }
  grab .top10
  set objectID [lindex $cargs 0]
  if {$objectID == {default}} {
    append title {Default }
    .top10.frame0.frame0.frame3.label6 configure -state disabled
    .top10.frame0.frame0.frame3.label7 configure -state disabled
  }
  append title {List properties}
  wm title .top10 $title
  if {$objectID != {default}} {
    array set toucanFormObject [toucanRetrieveObjectProperties $objectID]
  } else {
    array set toucanFormObject [array get toucanFormObjectList]
  }

  .top10.frame0.frame4.text6 insert 1.0 [join $toucanFormObject(items) "\n"]
}


# procedure to show window ShowWindow.top11
proc ShowWindow.top11 { args} {
# xf ignore me 7

  # build widget .top11
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top11"
  } {
    catch "destroy .top11"
  }
  toplevel .top11   -relief {sunken}

  # Window manager configurations
  wm positionfrom .top11 ""
  wm sizefrom .top11 ""
  wm maxsize .top11 1000 768
  wm minsize .top11 10 10
  wm protocol .top11 WM_DELETE_WINDOW {DestroyWindow.top11}
  wm title .top11 {Formbitmap/Label properties}


  # build widget .top11.frame0
  frame .top11.frame0  -height {218}  -width {717}

  # build widget .top11.frame0.frame0
  frame .top11.frame0.frame0  -height {24}  -width {717}

  # build widget .top11.frame0.frame0.frame0
  frame .top11.frame0.frame0.frame0  -borderwidth {2}  -height {20}  -relief {ridge}  -width {172}

  # build widget .top11.frame0.frame0.frame0.radiobutton0
  radiobutton .top11.frame0.frame0.frame0.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Usable}  -value {USABLE}  -variable {toucanFormObject(usability)}

  # build widget .top11.frame0.frame0.frame0.radiobutton1
  radiobutton .top11.frame0.frame0.frame0.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Nonusable}  -value {NONUSABLE}  -variable {toucanFormObject(usability)}

  # build widget .top11.frame0.frame0.frame1
  frame .top11.frame0.frame0.frame1  -borderwidth {2}  -height {40}  -relief {ridge}  -width {86}

  # build widget .top11.frame0.frame0.frame1.label30
  label .top11.frame0.frame0.frame1.label30  -font {toucan_font}  -text {Bitmap ID}

  # build widget .top11.frame0.frame0.frame1.menubutton0
  menubutton .top11.frame0.frame0.frame1.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top11.frame0.frame0.frame1.menubutton0.m}  -padx {4}  -pady {3}  -text {None}  -textvariable {toucanFormObject(bitmap)}

  # build widget .top11.frame0.frame0.frame1.menubutton0.m
  menu .top11.frame0.frame0.frame1.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top11.frame0.frame0.frame1.menubutton0.m add command  -command {set toucanFormObject(bitmap) None}  -label {None}

  # build widget .top11.frame0.frame0.frame1.entry0
  entry .top11.frame0.frame0.frame1.entry0  -font {toucan_font}  -textvariable {toucanFormObject(label)}  -width {10}

  # build widget .top11.frame0.frame0.frame3
  frame .top11.frame0.frame0.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top11.frame0.frame0.frame3.label6
  label .top11.frame0.frame0.frame3.label6  -font {toucan_font}  -text {Object ID}

  # build widget .top11.frame0.frame0.frame3.label7
  label .top11.frame0.frame0.frame3.label7  -font {toucan_font}  -textvariable {toucanFormObject(ID)}  -width {5}

  # build widget .top11.frame0.frame0.frame2
  frame .top11.frame0.frame0.frame2  -borderwidth {2}  -height {40}  -relief {ridge}  -width {86}

  # build widget .top11.frame0.frame0.frame2.label30
  label .top11.frame0.frame0.frame2.label30  -font {toucan_font}  -text {Font ID}

  # build widget .top11.frame0.frame0.frame2.menubutton0
  menubutton .top11.frame0.frame0.frame2.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top11.frame0.frame0.frame2.menubutton0.m}  -padx {4}  -pady {3}  -text {0}  -textvariable {toucanFormObject(font)}

  # build widget .top11.frame0.frame0.frame2.menubutton0.m
  menu .top11.frame0.frame0.frame2.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top11.frame0.frame0.frame2.menubutton0.m add command  -command {set toucanFormObject(font) 0}  -label {0}
  .top11.frame0.frame0.frame2.menubutton0.m add command  -command {set toucanFormObject(font) 1}  -label {1}
  .top11.frame0.frame0.frame2.menubutton0.m add command  -command {set toucanFormObject(font) 2}  -label {2}
  .top11.frame0.frame0.frame2.menubutton0.m add command  -command {set toucanFormObject(font) 3}  -label {3}
  .top11.frame0.frame0.frame2.menubutton0.m add command  -command {set toucanFormObject(font) 4}  -label {4}
  .top11.frame0.frame0.frame2.menubutton0.m add command  -command {set toucanFormObject(font) 5}  -label {5}
  .top11.frame0.frame0.frame2.menubutton0.m add command  -command {set toucanFormObject(font) 6}  -label {6}
  .top11.frame0.frame0.frame2.menubutton0.m add command  -command {set toucanFormObject(font) 7}  -label {7}

  # build widget .top11.frame1
  frame .top11.frame1  -height {26}  -width {717}

  # build widget .top11.frame1.button0
  button .top11.frame1.button0  -command {toucanAcceptProperties .top11
DestroyWindow.top11}  -font {toucan_font}  -text {OK}

  # build widget .top11.frame1.button1
  button .top11.frame1.button1  -command {toucanAcceptProperties .top11}  -font {toucan_font}  -text {Apply}

  # build widget .top11.frame1.button2
  button .top11.frame1.button2  -command {DestroyWindow.top11}  -font {toucan_font}  -text {Cancel}

  # pack master .top11.frame0
  pack configure .top11.frame0.frame0  -fill x

  # pack master .top11.frame0.frame0
  pack configure .top11.frame0.frame0.frame3  -fill y  -side left
  pack configure .top11.frame0.frame0.frame1  -expand 1  -fill both  -side left
  pack configure .top11.frame0.frame0.frame2  -fill y  -side left
  pack configure .top11.frame0.frame0.frame0  -fill y  -side left

  # pack master .top11.frame0.frame0.frame0
  pack configure .top11.frame0.frame0.frame0.radiobutton0  -side left
  pack configure .top11.frame0.frame0.frame0.radiobutton1  -side left

  # pack master .top11.frame0.frame0.frame1
  pack configure .top11.frame0.frame0.frame1.label30  -side left
  pack configure .top11.frame0.frame0.frame1.menubutton0  -side left
  pack configure .top11.frame0.frame0.frame1.entry0  -expand 1  -fill x

  # pack master .top11.frame0.frame0.frame3
  pack configure .top11.frame0.frame0.frame3.label6  -side left
  pack configure .top11.frame0.frame0.frame3.label7  -expand 1  -fill x  -side left

  # pack master .top11.frame0.frame0.frame2
  pack configure .top11.frame0.frame0.frame2.label30  -side left
  pack configure .top11.frame0.frame0.frame2.menubutton0

  # pack master .top11.frame1
  pack configure .top11.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top11.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top11.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top11
  pack configure .top11.frame0  -expand 1  -fill both
  pack configure .top11.frame1  -fill x

EndSrc.top11

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top11"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top11 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top11]" != ""} {
      global xfShowWindow.top11
      set xfShowWindow.top11 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top11; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top11"
    update
  }
}

proc EndSrc.top11 {} {
  upvar args cargs
  global toucanFormObject toucanBitmapType

  if {[winfo exists .xfEdit]} { return }
  grab .top11
  set objectType [lindex $cargs 0]
  set objectID [lindex $cargs 1]
  if {$objectID == {default}} {
    append title {Default }
    .top11.frame0.frame0.frame3.label6 configure -state disabled
    .top11.frame0.frame0.frame3.label7 configure -state disabled
  }
  switch $objectType {
    Formbitmap {
      append title {Formbitmap properties}
      .top11.frame0.frame0.frame1.label30 configure -text {Bitmap ID}
      destroy .top11.frame0.frame0.frame1.entry0
      destroy .top11.frame0.frame0.frame2
      # set up the menu
      if {$objectID != {default}} {
        foreach bid [lsort -integer [array names toucanBitmapType {[0-9][0-9][0-9][0-9]}]] {
          .top11.frame0.frame0.frame1.menubutton0.m add command -label $bid -command [list set toucanFormObject(bitmap) $bid]
        }
      }
    }
    Label {
      append title {Label properties}
      .top11.frame0.frame0.frame1.label30 configure -text {Label}
      destroy .top11.frame0.frame0.frame1.menubutton0
      .top11.frame0.frame0.frame2.label30 configure -text {Font ID}
      .top11.frame0.frame0.frame2.menubutton0 configure -textvariable toucanFormObject(font)
      set menuEnd [.top11.frame0.frame0.frame2.menubutton0.m index end]
      for {set idx 0} {$idx <= $menuEnd} {incr idx} {
        .top11.frame0.frame0.frame2.menubutton0.m entryconfig $idx -command [list set toucanFormObject(font) $idx]
      }
    }
  }
  wm title .top11 $title
  global toucanFormObject$objectType
  if {$objectID != {default}} {
    array set toucanFormObject [toucanRetrieveObjectProperties $objectID]
  } else {
    array set toucanFormObject [array get toucanFormObject$objectType]
  }
}


# procedure to show window ShowWindow.top12
proc ShowWindow.top12 { args} {
# xf ignore me 7

  # build widget .top12
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top12"
  } {
    catch "destroy .top12"
  }
  toplevel .top12 

  # Window manager configurations
  wm positionfrom .top12 ""
  wm sizefrom .top12 ""
  wm maxsize .top12 1000 768
  wm minsize .top12 10 10
  wm protocol .top12 WM_DELETE_WINDOW {DestroyWindow.top12}
  wm title .top12 {Form properties}


  # build widget .top12.frame0
  frame .top12.frame0  -height {218}  -width {717}

  # build widget .top12.frame0.frame0
  frame .top12.frame0.frame0  -height {24}  -width {717}

  # build widget .top12.frame0.frame0.frame0
  frame .top12.frame0.frame0.frame0  -borderwidth {2}  -height {20}  -relief {ridge}  -width {172}

  # build widget .top12.frame0.frame0.frame0.radiobutton0
  radiobutton .top12.frame0.frame0.frame0.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Save behind}  -value {SAVEBEHIND}  -variable {toucanFormObject(saving)}

  # build widget .top12.frame0.frame0.frame0.radiobutton1
  radiobutton .top12.frame0.frame0.frame0.radiobutton1  -font {toucan_font}  -relief {raised}  -text {No save behind}  -value {NOSAVEBEHIND}  -variable {toucanFormObject(saving)}

  # build widget .top12.frame0.frame0.frame3
  frame .top12.frame0.frame0.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top12.frame0.frame0.frame3.label6
  label .top12.frame0.frame0.frame3.label6  -font {toucan_font}  -text {Form ID}

  # build widget .top12.frame0.frame0.frame3.label7
  label .top12.frame0.frame0.frame3.label7  -font {toucan_font}  -textvariable {toucanFormObject(ID)}  -width {5}

  # build widget .top12.frame0.frame0.checkbutton3
  checkbutton .top12.frame0.frame0.checkbutton3  -command {if {$toucanFormObject(modal) == {Null}} {
  .top12.frame0.frame19.frame33.label17 config -state disabled
  .top12.frame0.frame19.frame33.menubutton0.m invoke None
  .top12.frame0.frame19.frame33.menubutton0 config -state disabled
} else {
  .top12.frame0.frame19.frame33.label17 config -state normal
  .top12.frame0.frame19.frame33.menubutton0 config -state normal
}}  -font {toucan_font}  -offvalue {Null}  -onvalue {MODAL}  -relief {raised}  -text {Modal}  -variable {toucanFormObject(modal)}

  # build widget .top12.frame0.frame1
  frame .top12.frame0.frame1  -height {24}  -width {717}

  # build widget .top12.frame0.frame1.frame4
  frame .top12.frame0.frame1.frame4  -borderwidth {2}  -height {24}  -relief {ridge}  -width {625}

  # build widget .top12.frame0.frame1.frame4.radiobutton5
  radiobutton .top12.frame0.frame1.frame4.radiobutton5  -font {toucan_font}  -relief {raised}  -text {No frame}  -value {NOFRAME}  -variable {toucanFormObject(framing)}

  # build widget .top12.frame0.frame1.frame4.radiobutton6
  radiobutton .top12.frame0.frame1.frame4.radiobutton6  -font {toucan_font}  -relief {raised}  -text {Frame}  -value {FRAME}  -variable {toucanFormObject(framing)}

  # build widget .top12.frame0.frame1.checkbutton3
  checkbutton .top12.frame0.frame1.checkbutton3  -font {toucan_font}  -offvalue {Null}  -onvalue {USABLE}  -relief {raised}  -text {Usable}  -variable {toucanFormObject(usability)}

  # build widget .top12.frame0.frame2
  frame .top12.frame0.frame2  -height {24}  -width {503}

  # build widget .top12.frame0.frame2.frame33
  frame .top12.frame0.frame2.frame33  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top12.frame0.frame2.frame33.label17
  label .top12.frame0.frame2.frame33.label17  -font {toucan_font}  -text {Title}

  # build widget .top12.frame0.frame2.frame33.entry18
  entry .top12.frame0.frame2.frame33.entry18  -font {toucan_font}  -textvariable {toucanFormObject(title)}  -width {5}

  # build widget .top12.frame0.frame2.frame17
  frame .top12.frame0.frame2.frame17  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top12.frame0.frame2.frame17.label17
  label .top12.frame0.frame2.frame17.label17  -font {toucan_font}  -text {Menu ID}

  # build widget .top12.frame0.frame2.frame17.menubutton0
  menubutton .top12.frame0.frame2.frame17.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top12.frame0.frame2.frame17.menubutton0.m}  -padx {4}  -pady {3}  -text {None}  -textvariable {toucanFormObject(menuID)}

  # build widget .top12.frame0.frame2.frame17.menubutton0.m
  menu .top12.frame0.frame2.frame17.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top12.frame0.frame2.frame17.menubutton0.m add command  -command {set toucanFormObject(menuID) None}  -label {None}

  # build widget .top12.frame0.frame3
  frame .top12.frame0.frame3  -height {86}  -width {454}

  # build widget .top12.frame0.frame3.scale5
  scale .top12.frame0.frame3.scale5  -font {toucan_font}  -from {1.0}  -label {Width}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(width)}

  # build widget .top12.frame0.frame3.scale6
  scale .top12.frame0.frame3.scale6  -font {toucan_font}  -from {1.0}  -label {Height}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(height)}

  # build widget .top12.frame0.frame19
  frame .top12.frame0.frame19  -height {24}  -width {503}

  # build widget .top12.frame0.frame19.frame33
  frame .top12.frame0.frame19.frame33  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top12.frame0.frame19.frame33.label17
  label .top12.frame0.frame19.frame33.label17  -font {toucan_font}  -state {disabled}  -text {Help ID}

  # build widget .top12.frame0.frame19.frame33.menubutton0
  menubutton .top12.frame0.frame19.frame33.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top12.frame0.frame19.frame33.menubutton0.m}  -padx {4}  -pady {3}  -state {disabled}  -text {None}  -textvariable {toucanFormObject(helpID)}

  # build widget .top12.frame0.frame19.frame33.menubutton0.m
  menu .top12.frame0.frame19.frame33.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top12.frame0.frame19.frame33.menubutton0.m add command  -command {set toucanFormObject(helpID) None}  -label {None}

  # build widget .top12.frame0.frame19.frame15
  frame .top12.frame0.frame19.frame15  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top12.frame0.frame19.frame15.label17
  label .top12.frame0.frame19.frame15.label17  -font {toucan_font}  -text {Default Button ID}

  # build widget .top12.frame0.frame19.frame15.menubutton0
  menubutton .top12.frame0.frame19.frame15.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top12.frame0.frame19.frame15.menubutton0.m}  -padx {4}  -pady {3}  -text {None}  -textvariable {toucanFormObject(defaultBtnID)}

  # build widget .top12.frame0.frame19.frame15.menubutton0.m
  menu .top12.frame0.frame19.frame15.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top12.frame0.frame19.frame15.menubutton0.m add command  -command {set toucanFormObject(defaultBtnID) None}  -label {None}

  # build widget .top12.frame1
  frame .top12.frame1  -height {26}  -width {717}

  # build widget .top12.frame1.button0
  button .top12.frame1.button0  -command {.top12.frame1.button1 invoke
DestroyWindow.top12}  -font {toucan_font}  -text {OK}

  # build widget .top12.frame1.button1
  button .top12.frame1.button1  -command {set title [wm title .top12]
if {[lindex $title 0] == {Default}} {
  foreach {ndx val} [array get toucanFormObjectForm] {
    set toucanFormObjectForm($ndx) $toucanFormObject($ndx)
  }
  unset title ndx val
} else {
  set formID form$toucanFormObject(ID)
  .canvas0.${formID}.title configure -text $toucanFormObject(title)
  .canvas0.${formID} configure -height [expr $toucanFormObject(height) * 2]
  .canvas0.${formID} configure -width [expr $toucanFormObject(width) * 2]
  .canvas0 itemconfigure $formID -height [expr $toucanFormObject(height) * 2] -width [expr $toucanFormObject(width) * 2]
  if {$toucanFormObject(framing) == {FRAME}} {
    lappend options -relief solid -borderwidth 2
  } else {
    lappend options -relief flat -borderwidth 0
  }
  if {$toucanFormObject(usability) == {USABLE}} {
    lappend options -state normal
  } else {
    lappend options -state disabled
  }
  eval .canvas0.$formID configure $options
  set formOptions [.canvas0 gettags $formID]
  set formOptions [lindex $formOptions [lsearch -regexp $formOptions {^formOptions}]]
  .canvas0 dtag $formID $formOptions
  foreach ndx {modal saving helpID defaultBtnID menuID} {
    lappend formTags $ndx $toucanFormObject($ndx)
  }
  set formTags [concat formOptions $formTags]
  .canvas0 addtag $formTags withtag $formID
  .canvas0.$formID itemconfig title -width 0
  .canvas0.$formID coords help -4 6
  if {$toucanFormObject(modal) == {MODAL}} {
    .canvas0.$formID itemconfig title -width [expr 2 * $toucanFormObject(width)]
    if {$toucanFormObject(helpID) != {None}} {
      .canvas0.$formID move help [expr 2 * $toucanFormObject(width)] 0
    }
  }
  unset formID options formOptions formTags ndx title
}}  -font {toucan_font}  -text {Apply}

  # build widget .top12.frame1.button2
  button .top12.frame1.button2  -command {DestroyWindow.top12}  -font {toucan_font}  -text {Cancel}

  # pack master .top12.frame0
  pack configure .top12.frame0.frame0  -fill x
  pack configure .top12.frame0.frame1  -fill x
  pack configure .top12.frame0.frame2  -fill x
  pack configure .top12.frame0.frame19  -fill x
  pack configure .top12.frame0.frame3  -fill x

  # pack master .top12.frame0.frame0
  pack configure .top12.frame0.frame0.frame3  -side left
  pack configure .top12.frame0.frame0.frame0  -expand 1  -fill x  -side left
  pack configure .top12.frame0.frame0.checkbutton3  -expand 1  -fill both  -side left

  # pack master .top12.frame0.frame0.frame0
  pack configure .top12.frame0.frame0.frame0.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top12.frame0.frame0.frame0.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top12.frame0.frame0.frame3
  pack configure .top12.frame0.frame0.frame3.label6  -side left
  pack configure .top12.frame0.frame0.frame3.label7  -expand 1  -fill x  -side left

  # pack master .top12.frame0.frame1
  pack configure .top12.frame0.frame1.frame4  -expand 1  -fill x  -side left
  pack configure .top12.frame0.frame1.checkbutton3  -expand 1  -fill both  -side left

  # pack master .top12.frame0.frame1.frame4
  pack configure .top12.frame0.frame1.frame4.radiobutton5  -expand 1  -fill x  -side left
  pack configure .top12.frame0.frame1.frame4.radiobutton6  -expand 1  -fill x  -side left

  # pack master .top12.frame0.frame2
  pack configure .top12.frame0.frame2.frame33  -expand 1  -fill x  -side left
  pack configure .top12.frame0.frame2.frame17  -fill x  -side left

  # pack master .top12.frame0.frame2.frame33
  pack configure .top12.frame0.frame2.frame33.label17  -fill x  -side left
  pack configure .top12.frame0.frame2.frame33.entry18  -expand 1  -fill x

  # pack master .top12.frame0.frame2.frame17
  pack configure .top12.frame0.frame2.frame17.label17  -fill x  -side left
  pack configure .top12.frame0.frame2.frame17.menubutton0  -side left

  # pack master .top12.frame0.frame3
  pack configure .top12.frame0.frame3.scale5  -expand 1  -fill x  -side left
  pack configure .top12.frame0.frame3.scale6  -expand 1  -fill x  -side left

  # pack master .top12.frame0.frame19
  pack configure .top12.frame0.frame19.frame33  -expand 1  -fill x  -side left
  pack configure .top12.frame0.frame19.frame15  -expand 1  -fill x  -side left

  # pack master .top12.frame0.frame19.frame33
  pack configure .top12.frame0.frame19.frame33.label17  -fill x  -side left
  pack configure .top12.frame0.frame19.frame33.menubutton0  -side left

  # pack master .top12.frame0.frame19.frame15
  pack configure .top12.frame0.frame19.frame15.label17  -fill x  -side left
  pack configure .top12.frame0.frame19.frame15.menubutton0  -side left

  # pack master .top12.frame1
  pack configure .top12.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top12.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top12.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top12
  pack configure .top12.frame0  -expand 1  -fill both
  pack configure .top12.frame1  -fill x

EndSrc.top12

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top12"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top12 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top12]" != ""} {
      global xfShowWindow.top12
      set xfShowWindow.top12 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top12; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top12"
    update
  }
}

proc EndSrc.top12 {} {
  upvar args cargs
  global toucanFormObject toucanFormObjectForm

  if {[winfo exists .xfEdit]} { return }
  grab .top12
  set formID [lindex $cargs 0]
  if {$formID == {default}} {
    append title {Default }
    .top12.frame0.frame0.frame3.label6 configure -state disabled
    .top12.frame0.frame0.frame3.label7 configure -state disabled
  }
  append title {Form properties}
  wm title .top12 $title
  if {$formID != {default}} {
    array set toucanFormObject [toucanRetrieveFormProperties $formID]
    foreach w [lsort [info commands {.canvas0.menu[0-9][0-9][0-9][0-9]}]] {
      regexp {^[.]canvas0[.]menu([0-9]+)$} $w junk id
      .top12.frame0.frame2.frame17.menubutton0.m add command -label $id -command [list set toucanFormObject(menuID) $id]
    }
    foreach w [winfo children .canvas0.${formID}] {
      if {[regexp {(button|checkbox|pushbutton|repeatbutton)([0-9]+)$} $w junk type id]} {
        .top12.frame0.frame19.frame15.menubutton0.m add command -label $id -command [list set toucanFormObject(defaultBtnID) $id]
      }
    }
    if {$toucanFormObject(modal) != {Null}} {
      .top12.frame0.frame19.frame33.label17 config -state normal
      .top12.frame0.frame19.frame33.menubutton0 config -state normal
    }
    foreach w [lsort [info commands {.canvas0.string17[0-9][0-9]}]] {
      if {[regexp {string([0-9]+)$} $w junk id]} {
        .top12.frame0.frame19.frame33.menubutton0.m add command -label $id -command [list set toucanFormObject(helpID) $id]
      }
    }
  } else {
    array set toucanFormObject [array get toucanFormObjectForm]
  }
}


# procedure to show window ShowWindow.top13
proc ShowWindow.top13 { args} {
# xf ignore me 7

  # build widget .top13
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top13"
  } {
    catch "destroy .top13"
  }
  toplevel .top13 

  # Window manager configurations
  wm positionfrom .top13 ""
  wm sizefrom .top13 ""
  wm maxsize .top13 1000 768
  wm minsize .top13 10 10
  wm protocol .top13 WM_DELETE_WINDOW {DestroyWindow.top13}
  wm title .top13 {Menu properties}


  # build widget .top13.frame0
  frame .top13.frame0  -height {218}  -width {717}

  # build widget .top13.frame0.frame0
  frame .top13.frame0.frame0

  # build widget .top13.frame0.frame0.frame3
  frame .top13.frame0.frame0.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top13.frame0.frame0.frame3.label6
  label .top13.frame0.frame0.frame3.label6  -font {toucan_font}  -text {Menu ID}

  # build widget .top13.frame0.frame0.frame3.label7
  label .top13.frame0.frame0.frame3.label7  -font {toucan_font}  -text {0000}  -width {5}

  # build widget .top13.frame0.frame0.button17
  button .top13.frame0.frame0.button17  -command {toucanAddPulldown}  -font {toucan_font}  -text {Add Puldown}

  # build widget .top13.frame0.frame0.button18
  button .top13.frame0.frame0.button18  -command {toucanDeletePulldown}  -font {toucan_font}  -text {Delete Pulldown}

  # build widget .top13.frame0.frame0.button20
  button .top13.frame0.frame0.button20  -command {toucanInsertMenuItem}  -font {toucan_font}  -text {Insert Menu Button}

  # build widget .top13.frame0.frame0.button21
  button .top13.frame0.frame0.button21  -command {toucanInsertMenuItem 1}  -font {toucan_font}  -text {Insert Menu Separator}

  # build widget .top13.frame0.frame0.button22
  button .top13.frame0.frame0.button22  -command {toucanDeleteMenuItem}  -font {toucan_font}  -text {Delete Menu Item}

  # build widget .top13.frame0.frame0.button0
  button .top13.frame0.frame0.button0  -command {toucanRenamePulldown}  -font {toucan_font}  -text {Rename Pulldown}

  # build widget .top13.frame0.frame0.button1
  button .top13.frame0.frame0.button1  -command {toucanRenameMenuButton}  -font {toucan_font}  -text {Rename Menu Button}

  # build widget .top13.frame0.frame0.frame0
  frame .top13.frame0.frame0.frame0  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top13.frame0.frame0.frame0.label6
  label .top13.frame0.frame0.frame0.label6  -font {toucan_font}  -text {Pulldown}

  # build widget .top13.frame0.frame0.frame0.entry7
  entry .top13.frame0.frame0.frame0.entry7  -font {toucan_font}  -width {10}

  # build widget .top13.frame0.frame0.frame2
  frame .top13.frame0.frame0.frame2  -borderwidth {2}  -height {24}  -relief {ridge}  -width {125}

  # build widget .top13.frame0.frame0.frame2.label6
  label .top13.frame0.frame0.frame2.label6  -font {toucan_font}  -text {Menu item}

  # build widget .top13.frame0.frame0.frame2.entry7
  entry .top13.frame0.frame0.frame2.entry7  -font {toucan_font}  -width {10}

  # build widget .top13.frame0.frame0.frame5
  frame .top13.frame0.frame0.frame5  -borderwidth {2}  -height {24}  -relief {ridge}  -width {125}

  # build widget .top13.frame0.frame0.frame5.label6
  label .top13.frame0.frame0.frame5.label6  -font {toucan_font}  -text {Accelerator}

  # build widget .top13.frame0.frame0.frame5.entry7
  entry .top13.frame0.frame0.frame5.entry7  -font {toucan_font}  -width {5}

  # build widget .top13.frame0.frame0.frame1
  frame .top13.frame0.frame0.frame1  -borderwidth {2}  -height {22}  -relief {ridge}  -width {130}

  # build widget .top13.frame0.frame0.frame1.label6
  label .top13.frame0.frame0.frame1.label6  -font {toucan_font}  -text {Menu Item ID}

  # build widget .top13.frame0.frame0.frame1.label3
  label .top13.frame0.frame0.frame1.label3  -font {toucan_font}  -relief {ridge}

  # build widget .top13.frame0.frame1
  frame .top13.frame0.frame1  -borderwidth {2}  -height {190}  -relief {ridge}  -width {126}

  # build widget .top13.frame0.scale24
  scale .top13.frame0.scale24  -command {toucanShiftPulldown}  -font {toucan_font}  -orient {horizontal}  -relief {raised}  -sliderlength {11}  -to {2.0}  -width {8}

  # build widget .top13.frame0.scale28
  scale .top13.frame0.scale28  -command {toucanShiftMenuItem}  -font {toucan_font}  -relief {raised}  -sliderlength {12}  -to {0.0}  -width {8}

  # build widget .top13.frame1
  frame .top13.frame1  -height {26}  -width {717}

  # build widget .top13.frame1.button0
  button .top13.frame1.button0  -command {eval toucanCreateMenuContent [toucanRetrieveMenuDialog]
DestroyWindow.top13}  -font {toucan_font}  -text {OK}

  # build widget .top13.frame1.button1
  button .top13.frame1.button1  -command {eval toucanCreateMenuContent [toucanRetrieveMenuDialog]}  -font {toucan_font}  -text {Apply}

  # build widget .top13.frame1.button2
  button .top13.frame1.button2  -command {DestroyWindow.top13}  -font {toucan_font}  -text {Cancel}

  # pack master .top13.frame0
  pack configure .top13.frame0.frame0  -anchor n  -side left
  pack configure .top13.frame0.scale24  -fill x
  pack configure .top13.frame0.frame1  -expand 1  -fill both  -side left
  pack configure .top13.frame0.scale28  -expand 1  -fill y

  # pack master .top13.frame0.frame0
  pack configure .top13.frame0.frame0.frame3  -fill x
  pack configure .top13.frame0.frame0.button17  -fill x
  pack configure .top13.frame0.frame0.button0  -fill x
  pack configure .top13.frame0.frame0.button18  -fill x
  pack configure .top13.frame0.frame0.frame0  -fill x
  pack configure .top13.frame0.frame0.button20  -fill x
  pack configure .top13.frame0.frame0.button1  -fill x
  pack configure .top13.frame0.frame0.button21  -fill x
  pack configure .top13.frame0.frame0.button22  -fill x
  pack configure .top13.frame0.frame0.frame1  -fill x
  pack configure .top13.frame0.frame0.frame2  -fill x
  pack configure .top13.frame0.frame0.frame5  -fill x

  # pack master .top13.frame0.frame0.frame3
  pack configure .top13.frame0.frame0.frame3.label6  -side left
  pack configure .top13.frame0.frame0.frame3.label7  -expand 1  -fill x  -side left

  # pack master .top13.frame0.frame0.frame0
  pack configure .top13.frame0.frame0.frame0.label6  -side left
  pack configure .top13.frame0.frame0.frame0.entry7  -expand 1  -fill x  -side left

  # pack master .top13.frame0.frame0.frame2
  pack configure .top13.frame0.frame0.frame2.label6  -side left
  pack configure .top13.frame0.frame0.frame2.entry7  -expand 1  -fill x  -side left

  # pack master .top13.frame0.frame0.frame5
  pack configure .top13.frame0.frame0.frame5.label6  -side left
  pack configure .top13.frame0.frame0.frame5.entry7  -expand 1  -fill x  -side left

  # pack master .top13.frame0.frame0.frame1
  pack configure .top13.frame0.frame0.frame1.label6  -side left
  pack configure .top13.frame0.frame0.frame1.label3  -fill x

  # pack master .top13.frame1
  pack configure .top13.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top13.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top13.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top13
  pack configure .top13.frame0  -expand 1  -fill both
  pack configure .top13.frame1  -fill x

  .top13.frame0.frame0.frame0.entry7 insert end {}
  .top13.frame0.frame0.frame2.entry7 insert end {}
  .top13.frame0.frame0.frame5.entry7 insert end {}



EndSrc.top13

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top13"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top13 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top13]" != ""} {
      global xfShowWindow.top13
      set xfShowWindow.top13 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top13; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top13"
    update
  }
}

proc EndSrc.top13 {} {
  upvar args cargs

  if {[winfo exists .xfEdit]} { return }
  grab .top13
  if {[regexp {menu([0-9]+)$} [lindex $cargs 0] junk id]} {
    eval toucanCreateMenuDialog [toucanRetrieveMenuProperties $id]
  }
}


# procedure to show window ShowWindow.top14
proc ShowWindow.top14 { args} {
# xf ignore me 7

  # build widget .top14
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top14"
  } {
    catch "destroy .top14"
  }
  toplevel .top14 

  # Window manager configurations
  wm positionfrom .top14 ""
  wm sizefrom .top14 ""
  wm maxsize .top14 1000 768
  wm minsize .top14 10 10
  wm protocol .top14 WM_DELETE_WINDOW {DestroyWindow.top14}
  wm title .top14 {Search/Replace}


  # build widget .top14.frame0
  frame .top14.frame0  -height {30}  -width {30}

  # build widget .top14.frame0.frame0
  frame .top14.frame0.frame0  -height {24}  -width {160}

  # build widget .top14.frame0.frame0.label0
  label .top14.frame0.frame0.label0  -borderwidth {0}  -font {toucan_bold_font}  -text {Search for:}

  # build widget .top14.frame0.frame0.entry0
  entry .top14.frame0.frame0.entry0  -font {toucan_font}  -textvariable {toucanSearchVariable(search)}

  # build widget .top14.frame0.frame1
  frame .top14.frame0.frame1  -height {24}  -width {160}

  # build widget .top14.frame0.frame1.label0
  label .top14.frame0.frame1.label0  -borderwidth {0}  -font {toucan_bold_font}  -text {Replace with:}

  # build widget .top14.frame0.frame1.entry0
  entry .top14.frame0.frame1.entry0  -font {toucan_font}  -textvariable {toucanSearchVariable(replace)}

  # build widget .top14.frame0.checkbutton0
  checkbutton .top14.frame0.checkbutton0  -font {toucan_bold_font}  -text {Case Sensitive}  -variable {toucanSearchVariable(case)}

  # build widget .top14.frame0.checkbutton1
  checkbutton .top14.frame0.checkbutton1  -font {toucan_bold_font}  -text {Regexp Matching}  -variable {toucanSearchVariable(regexp)}

  # build widget .top14.frame0.checkbutton2
  checkbutton .top14.frame0.checkbutton2  -font {toucan_bold_font}  -text {Search Backwards}  -variable {toucanSearchVariable(backward)}

  # build widget .top14.frame1
  frame .top14.frame1  -height {108}  -width {91}

  # build widget .top14.frame1.button0
  button .top14.frame1.button0  -command {toucanGeneralSearchReplace [.canvas0 itemcget [.canvas0 find withtag edit] -window].f2.text find $toucanSearchVariable(case) $toucanSearchVariable(regexp) $toucanSearchVariable(backward) $toucanSearchVariable(search)}  -font {toucan_font}  -pady {0}  -text {Find Next}

  # build widget .top14.frame1.button1
  button .top14.frame1.button1  -command {toucanGeneralSearchReplace [.canvas0 itemcget [.canvas0 find withtag edit] -window].f2.text replace $toucanSearchVariable(case) $toucanSearchVariable(regexp) $toucanSearchVariable(backward) $toucanSearchVariable(search) $toucanSearchVariable(replace)}  -font {toucan_font}  -pady {0}  -text {Replace Next}

  # build widget .top14.frame1.button2
  button .top14.frame1.button2  -command {toucanGeneralSearchReplace [.canvas0 itemcget [.canvas0 find withtag edit] -window].f2.text replaceall $toucanSearchVariable(case) $toucanSearchVariable(regexp) $toucanSearchVariable(backward) $toucanSearchVariable(search) $toucanSearchVariable(replace)}  -font {toucan_font}  -pady {0}  -text {Replace All}

  # build widget .top14.frame1.button3
  button .top14.frame1.button3  -command {DestroyWindow.top14}  -font {toucan_font}  -pady {0}  -text {Dismiss}

  # pack master .top14.frame0
  pack configure .top14.frame0.frame0  -fill x
  pack configure .top14.frame0.frame1  -fill x
  pack configure .top14.frame0.checkbutton0  -anchor w
  pack configure .top14.frame0.checkbutton1  -anchor w
  pack configure .top14.frame0.checkbutton2  -anchor w

  # pack master .top14.frame0.frame0
  pack configure .top14.frame0.frame0.label0  -side left
  pack configure .top14.frame0.frame0.entry0  -side right

  # pack master .top14.frame0.frame1
  pack configure .top14.frame0.frame1.label0  -side left
  pack configure .top14.frame0.frame1.entry0  -side right

  # pack master .top14.frame1
  pack configure .top14.frame1.button0  -fill x
  pack configure .top14.frame1.button1  -fill x
  pack configure .top14.frame1.button2  -fill x
  pack configure .top14.frame1.button3  -fill x  -side bottom

  # pack master .top14
  pack configure .top14.frame0  -expand 1  -fill x  -side left
  pack configure .top14.frame1  -anchor n  -fill y  -side left

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top14"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top14 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top14]" != ""} {
      global xfShowWindow.top14
      set xfShowWindow.top14 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top14; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top14"
    update
  }
}


# procedure to show window ShowWindow.top15
proc ShowWindow.top15 { args} {
# xf ignore me 7

  # build widget .top15
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top15"
  } {
    catch "destroy .top15"
  }
  toplevel .top15 

  # Window manager configurations
  wm positionfrom .top15 ""
  wm sizefrom .top15 ""
  wm maxsize .top15 1000 768
  wm minsize .top15 10 10
  wm protocol .top15 WM_DELETE_WINDOW {DestroyWindow.top15}
  wm title .top15 {Editor Preferences}


  # build widget .top15.frame0
  frame .top15.frame0  -height {203}  -width {240}

  # build widget .top15.frame0.frame0
  frame .top15.frame0.frame0  -height {203}  -width {120}

  # build widget .top15.frame0.frame0.frame0
  frame .top15.frame0.frame0.frame0  -borderwidth {2}  -height {26}  -relief {ridge}  -width {179}

  # build widget .top15.frame0.frame0.frame0.label0
  label .top15.frame0.frame0.frame0.label0  -font {toucan_font}  -text {Font family:}

  # build widget .top15.frame0.frame0.frame0.menubutton0
  menubutton .top15.frame0.frame0.frame0.menubutton0  -font {toucan_font}  -menu {.top15.frame0.frame0.frame0.menubutton0.m}  -padx {4}  -pady {3}  -text {helvetica}  -textvariable {toucanNewEditorPreferences(family)}

  # build widget .top15.frame0.frame0.frame0.menubutton0.m
  menu .top15.frame0.frame0.frame0.menubutton0.m  -font {toucan_font}  -tearoff {0}

  # build widget .top15.frame0.frame0.frame0.label1
  label .top15.frame0.frame0.frame0.label1  -font {toucan_font}  -text {Size:}

  # build widget .top15.frame0.frame0.frame0.menubutton1
  menubutton .top15.frame0.frame0.frame0.menubutton1  -font {toucan_font}  -menu {.top15.frame0.frame0.frame0.menubutton1.m}  -padx {4}  -pady {3}  -text {12}  -textvariable {toucanNewEditorPreferences(size)}

  # build widget .top15.frame0.frame0.frame0.menubutton1.m
  menu .top15.frame0.frame0.frame0.menubutton1.m  -font {toucan_font}  -tearoff {0}
  .top15.frame0.frame0.frame0.menubutton1.m add command  -command {set toucanNewEditorPreferences(size) 8
toucanBuildFont toucanNewEditorPreferences
.top15.frame0.frame1.text config -font $toucanNewEditorPreferences(font)}  -label {8}
  .top15.frame0.frame0.frame0.menubutton1.m add command  -command {set toucanNewEditorPreferences(size) 10
toucanBuildFont toucanNewEditorPreferences
.top15.frame0.frame1.text config -font $toucanNewEditorPreferences(font)}  -label {10}
  .top15.frame0.frame0.frame0.menubutton1.m add command  -command {set toucanNewEditorPreferences(size) 12
toucanBuildFont toucanNewEditorPreferences
.top15.frame0.frame1.text config -font $toucanNewEditorPreferences(font)}  -label {12}
  .top15.frame0.frame0.frame0.menubutton1.m add command  -command {set toucanNewEditorPreferences(size) 14
toucanBuildFont toucanNewEditorPreferences
.top15.frame0.frame1.text config -font $toucanNewEditorPreferences(font)}  -label {14}
  .top15.frame0.frame0.frame0.menubutton1.m add command  -command {set toucanNewEditorPreferences(size) 16
toucanBuildFont toucanNewEditorPreferences
.top15.frame0.frame1.text config -font $toucanNewEditorPreferences(font)}  -label {16}
  .top15.frame0.frame0.frame0.menubutton1.m add command  -command {set toucanNewEditorPreferences(size) 18
toucanBuildFont toucanNewEditorPreferences
.top15.frame0.frame1.text config -font $toucanNewEditorPreferences(font)}  -label {18}

  # build widget .top15.frame0.frame0.frame0.checkbutton0
  checkbutton .top15.frame0.frame0.frame0.checkbutton0  -command {toucanBuildFont toucanNewEditorPreferences
.top15.frame0.frame1.text config -font $toucanNewEditorPreferences(font)}  -font {toucan_font}  -text {Bold}  -variable {toucanNewEditorPreferences(bold)}

  # build widget .top15.frame0.frame0.frame1
  frame .top15.frame0.frame0.frame1  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top15.frame0.frame0.frame1.label0
  label .top15.frame0.frame0.frame1.label0  -anchor {w}  -font {toucan_font}  -text {Foreground text color:}

  # build widget .top15.frame0.frame0.frame1.label1
  label .top15.frame0.frame0.frame1.label1  -font {toucan_font}  -text {#000000}  -textvariable {toucanNewEditorPreferences(fg)}

  # build widget .top15.frame0.frame0.frame1.button0
  button .top15.frame0.frame0.frame1.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(fg) -parent .top15 -title {Select foreground color}]] != {}} {
  set toucanNewEditorPreferences(fg) $cval
  .top15.frame0.frame1.text config -fg $toucanNewEditorPreferences(fg)
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame2
  frame .top15.frame0.frame0.frame2  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top15.frame0.frame0.frame2.label0
  label .top15.frame0.frame0.frame2.label0  -anchor {w}  -font {toucan_font}  -text {Background text color:}

  # build widget .top15.frame0.frame0.frame2.label1
  label .top15.frame0.frame0.frame2.label1  -font {toucan_font}  -text {#ffffff}  -textvariable {toucanNewEditorPreferences(bg)}

  # build widget .top15.frame0.frame0.frame2.button0
  button .top15.frame0.frame0.frame2.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(bg) -parent .top15 -title {Select background color}]] != {}} {
  set toucanNewEditorPreferences(bg) $cval
  .top15.frame0.frame1.text config -bg $toucanNewEditorPreferences(bg)
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame3
  frame .top15.frame0.frame0.frame3  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top15.frame0.frame0.frame3.label0
  label .top15.frame0.frame0.frame3.label0  -anchor {w}  -font {toucan_font}  -text {Selection background color:}

  # build widget .top15.frame0.frame0.frame3.label1
  label .top15.frame0.frame0.frame3.label1  -font {toucan_font}  -text {#c3c3c3}  -textvariable {toucanNewEditorPreferences(bgSelect)}

  # build widget .top15.frame0.frame0.frame3.button0
  button .top15.frame0.frame0.frame3.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(bgSelect) -parent .top15 -title {Select selection background color}]] != {}} {
  set toucanNewEditorPreferences(bgSelect) $cval
  .top15.frame0.frame1.text config -selectbackground $toucanNewEditorPreferences(bgSelect)
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame4
  frame .top15.frame0.frame0.frame4  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top15.frame0.frame0.frame4.label0
  label .top15.frame0.frame0.frame4.label0  -anchor {w}  -font {toucan_font}  -text {Insertion cursor background color:}

  # build widget .top15.frame0.frame0.frame4.label1
  label .top15.frame0.frame0.frame4.label1  -font {toucan_font}  -text {#000000}  -textvariable {toucanNewEditorPreferences(bgInsert)}

  # build widget .top15.frame0.frame0.frame4.button0
  button .top15.frame0.frame0.frame4.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(bgInsert) -parent .top15 -title {Select insertion cursor background color}]] != {}} {
  set toucanNewEditorPreferences(bgInsert) $cval
  .top15.frame0.frame1.text config -insertbackground $toucanNewEditorPreferences(bgInsert)
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame5
  frame .top15.frame0.frame0.frame5  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top15.frame0.frame0.frame5.label0
  label .top15.frame0.frame0.frame5.label0  -anchor {w}  -font {toucan_font}  -text {Tcl commands highlight color:}

  # build widget .top15.frame0.frame0.frame5.label1
  label .top15.frame0.frame0.frame5.label1  -font {toucan_font}  -text {#008800}  -textvariable {toucanNewEditorPreferences(highlightTclCmds)}

  # build widget .top15.frame0.frame0.frame5.button0
  button .top15.frame0.frame0.frame5.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(highlightTclCmds) -parent .top15 -title {Select Tcl commands color}]] != {}} {
  set toucanNewEditorPreferences(highlightTclCmds) $cval
  toucanEditorColors .top15.frame0.frame1.text toucanNewEditorPreferences
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame6
  frame .top15.frame0.frame0.frame6  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top15.frame0.frame0.frame6.label0
  label .top15.frame0.frame0.frame6.label0  -anchor {w}  -font {toucan_font}  -text {Tcl stack commands highlight color:}

  # build widget .top15.frame0.frame0.frame6.label1
  label .top15.frame0.frame0.frame6.label1  -font {toucan_font}  -text {#9b30cf}  -textvariable {toucanNewEditorPreferences(highlightTclStackCmds)}

  # build widget .top15.frame0.frame0.frame6.button0
  button .top15.frame0.frame0.frame6.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(highlightTclStackCmds) -parent .top15 -title {Select Tcl stack commands color}]] != {}} {
  set toucanNewEditorPreferences(highlightTclStackCmds) $cval
  toucanEditorColors .top15.frame0.frame1.text toucanNewEditorPreferences
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame7
  frame .top15.frame0.frame0.frame7  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top15.frame0.frame0.frame7.label0
  label .top15.frame0.frame0.frame7.label0  -anchor {w}  -font {toucan_font}  -text {Palm OS commands highlight color:}

  # build widget .top15.frame0.frame0.frame7.label1
  label .top15.frame0.frame0.frame7.label1  -font {toucan_font}  -text {#008800}  -textvariable {toucanNewEditorPreferences(highlightPalmosCmds)}

  # build widget .top15.frame0.frame0.frame7.button0
  button .top15.frame0.frame0.frame7.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(highlightPalmosCmds) -parent .top15 -title {Select Palm OS comands color}]] != {}} {
  set toucanNewEditorPreferences(highlightPalmosCmds) $cval
  toucanEditorColors .top15.frame0.frame1.text toucanNewEditorPreferences
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame8
  frame .top15.frame0.frame0.frame8  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top15.frame0.frame0.frame8.label0
  label .top15.frame0.frame0.frame8.label0  -anchor {w}  -font {toucan_font}  -text {Variables highlight color:}

  # build widget .top15.frame0.frame0.frame8.label1
  label .top15.frame0.frame0.frame8.label1  -font {toucan_font}  -text {#ff6500}  -textvariable {toucanNewEditorPreferences(highlightVariables)}

  # build widget .top15.frame0.frame0.frame8.button0
  button .top15.frame0.frame0.frame8.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(highlightVariables) -parent .top15 -title {Select Variables color}]] != {}} {
  set toucanNewEditorPreferences(highlightVariables) $cval
  toucanEditorColors .top15.frame0.frame1.text toucanNewEditorPreferences
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame9
  frame .top15.frame0.frame0.frame9  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top15.frame0.frame0.frame9.label0
  label .top15.frame0.frame0.frame9.label0  -anchor {w}  -font {toucan_font}  -text {Events highlight color:}

  # build widget .top15.frame0.frame0.frame9.label1
  label .top15.frame0.frame0.frame9.label1  -font {toucan_font}  -text {#ff0000}  -textvariable {toucanNewEditorPreferences(highlightEvents)}

  # build widget .top15.frame0.frame0.frame9.button0
  button .top15.frame0.frame0.frame9.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(highlightEvents) -parent .top15 -title {Select Events color}]] != {}} {
  set toucanNewEditorPreferences(highlightEvents) $cval
  toucanEditorColors .top15.frame0.frame1.text toucanNewEditorPreferences
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame10
  frame .top15.frame0.frame0.frame10  -borderwidth {2}  -height {85}  -relief {ridge}  -width {298}

  # build widget .top15.frame0.frame0.frame10.label0
  label .top15.frame0.frame0.frame10.label0  -anchor {w}  -font {toucan_font}  -text {Braces highlight color:}

  # build widget .top15.frame0.frame0.frame10.label1
  label .top15.frame0.frame0.frame10.label1  -font {toucan_font}  -text {#0000ff}  -textvariable {toucanNewEditorPreferences(highlightBraces)}

  # build widget .top15.frame0.frame0.frame10.button0
  button .top15.frame0.frame0.frame10.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(highlightBraces) -parent .top15 -title {Select Braces color}]] != {}} {
  set toucanNewEditorPreferences(highlightBraces) $cval
  toucanEditorColors .top15.frame0.frame1.text toucanNewEditorPreferences
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame11
  frame .top15.frame0.frame0.frame11  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top15.frame0.frame0.frame11.label0
  label .top15.frame0.frame0.frame11.label0  -anchor {w}  -font {toucan_font}  -text {Comments highlight color:}

  # build widget .top15.frame0.frame0.frame11.label1
  label .top15.frame0.frame0.frame11.label1  -font {toucan_font}  -text {#9a3030}  -textvariable {toucanNewEditorPreferences(highlightComments)}

  # build widget .top15.frame0.frame0.frame11.button0
  button .top15.frame0.frame0.frame11.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(highlightComments) -parent .top15 -title {Select Comments color}]] != {}} {
  set toucanNewEditorPreferences(highlightComments) $cval
  toucanEditorColors .top15.frame0.frame1.text toucanNewEditorPreferences
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame0.frame12
  frame .top15.frame0.frame0.frame12  -borderwidth {2}  -height {30}  -relief {ridge}  -width {347}

  # build widget .top15.frame0.frame0.frame12.scale0
  scale .top15.frame0.frame0.frame12.scale0  -command {ctext::setBlinkOptions .top15.frame0.frame1.text $toucanNewEditorPreferences(blinkColor) $toucanNewEditorPreferences(blinkRange)}  -font {toucan_font}  -from {100.0}  -label {Blink duration (in milliseconds)}  -orient {horizontal}  -resolution {100.0}  -to {2000.0}  -variable {toucanNewEditorPreferences(blinkTime)}

  # build widget .top15.frame0.frame0.frame12.label2
  label .top15.frame0.frame0.frame12.label2  -anchor {w}  -font {toucan_font}  -text {Brace matching}

  # build widget .top15.frame0.frame0.frame12.checkbutton0
  checkbutton .top15.frame0.frame0.frame12.checkbutton0  -command {ctext::setBlinkOptions .top15.frame0.frame1.text $toucanNewEditorPreferences(blinkColor) $toucanNewEditorPreferences(blinkRange) $toucanNewEditorPreferences(blinkTime)}  -font {toucan_font}  -relief {groove}  -text {Highlight range}  -variable {toucanNewEditorPreferences(blinkRange)}

  # build widget .top15.frame0.frame0.frame12.label0
  label .top15.frame0.frame0.frame12.label0  -anchor {w}  -font {toucan_font}  -text {Color:}

  # build widget .top15.frame0.frame0.frame12.label1
  label .top15.frame0.frame0.frame12.label1  -font {toucan_font}  -text {#00ffff}  -textvariable {toucanNewEditorPreferences(blinkColor)}

  # build widget .top15.frame0.frame0.frame12.button0
  button .top15.frame0.frame0.frame12.button0  -command {if {[set cval [tk_chooseColor -initialcolor $toucanNewEditorPreferences(blinkColor) -parent .top15 -title {Select Blink color}]] != {}} {
  set toucanNewEditorPreferences(blinkColor) $cval
  ctext::setBlinkOptions .top15.frame0.frame1.text $toucanNewEditorPreferences(blinkColor) $toucanNewEditorPreferences(blinkRange) $toucanNewEditorPreferences(blinkTime)
  unset cval
}}  -font {toucan_font}  -text {Select}

  # build widget .top15.frame0.frame1
  frame .top15.frame0.frame1  -height {203}  -width {75}

  # build widget .top15.frame1
  frame .top15.frame1  -borderwidth {2}  -height {30}  -width {336}

  # build widget .top15.frame1.button0
  button .top15.frame1.button0  -command {array set toucanEditorPreferences [array get toucanNewEditorPreferences]
toucanAdjustEditors
DestroyWindow.top15}  -font {toucan_font}  -text {OK}

  # build widget .top15.frame1.button1
  button .top15.frame1.button1  -command {DestroyWindow.top15}  -font {toucan_font}  -text {Cancel}

  # pack master .top15.frame0
  pack configure .top15.frame0.frame0  -expand 1  -fill y  -side left
  pack configure .top15.frame0.frame1  -expand 1  -fill both  -side left

  # pack master .top15.frame0.frame0
  pack configure .top15.frame0.frame0.frame0  -fill x
  pack configure .top15.frame0.frame0.frame1  -fill x
  pack configure .top15.frame0.frame0.frame2  -fill x
  pack configure .top15.frame0.frame0.frame3  -fill x
  pack configure .top15.frame0.frame0.frame4  -fill x
  pack configure .top15.frame0.frame0.frame5  -fill x
  pack configure .top15.frame0.frame0.frame6  -fill x
  pack configure .top15.frame0.frame0.frame7  -fill x
  pack configure .top15.frame0.frame0.frame8  -fill x
  pack configure .top15.frame0.frame0.frame9  -fill x
  pack configure .top15.frame0.frame0.frame10  -fill x
  pack configure .top15.frame0.frame0.frame11  -fill x
  pack configure .top15.frame0.frame0.frame12  -fill x

  # pack master .top15.frame0.frame0.frame0
  pack configure .top15.frame0.frame0.frame0.label0  -side left
  pack configure .top15.frame0.frame0.frame0.menubutton0  -fill x  -side left
  pack configure .top15.frame0.frame0.frame0.label1  -side left
  pack configure .top15.frame0.frame0.frame0.menubutton1  -side left
  pack configure .top15.frame0.frame0.frame0.checkbutton0  -side left

  # pack master .top15.frame0.frame0.frame1
  pack configure .top15.frame0.frame0.frame1.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame1.label1  -side left
  pack configure .top15.frame0.frame0.frame1.button0  -side left

  # pack master .top15.frame0.frame0.frame2
  pack configure .top15.frame0.frame0.frame2.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame2.label1  -side left
  pack configure .top15.frame0.frame0.frame2.button0  -side left

  # pack master .top15.frame0.frame0.frame3
  pack configure .top15.frame0.frame0.frame3.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame3.label1  -side left
  pack configure .top15.frame0.frame0.frame3.button0  -side left

  # pack master .top15.frame0.frame0.frame4
  pack configure .top15.frame0.frame0.frame4.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame4.label1  -side left
  pack configure .top15.frame0.frame0.frame4.button0  -side left

  # pack master .top15.frame0.frame0.frame5
  pack configure .top15.frame0.frame0.frame5.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame5.label1  -side left
  pack configure .top15.frame0.frame0.frame5.button0  -side left

  # pack master .top15.frame0.frame0.frame6
  pack configure .top15.frame0.frame0.frame6.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame6.label1  -side left
  pack configure .top15.frame0.frame0.frame6.button0  -side left

  # pack master .top15.frame0.frame0.frame7
  pack configure .top15.frame0.frame0.frame7.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame7.label1  -side left
  pack configure .top15.frame0.frame0.frame7.button0  -side left

  # pack master .top15.frame0.frame0.frame8
  pack configure .top15.frame0.frame0.frame8.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame8.label1  -side left
  pack configure .top15.frame0.frame0.frame8.button0  -side left

  # pack master .top15.frame0.frame0.frame9
  pack configure .top15.frame0.frame0.frame9.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame9.label1  -side left
  pack configure .top15.frame0.frame0.frame9.button0  -side left

  # pack master .top15.frame0.frame0.frame10
  pack configure .top15.frame0.frame0.frame10.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame10.label1  -side left
  pack configure .top15.frame0.frame0.frame10.button0  -side left

  # pack master .top15.frame0.frame0.frame11
  pack configure .top15.frame0.frame0.frame11.label0  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame11.label1  -side left
  pack configure .top15.frame0.frame0.frame11.button0  -side left

  # pack master .top15.frame0.frame0.frame12
  pack configure .top15.frame0.frame0.frame12.scale0  -fill x  -side bottom
  pack configure .top15.frame0.frame0.frame12.label2  -expand 1  -fill x  -side left
  pack configure .top15.frame0.frame0.frame12.checkbutton0  -side left
  pack configure .top15.frame0.frame0.frame12.label0  -side left
  pack configure .top15.frame0.frame0.frame12.label1  -side left
  pack configure .top15.frame0.frame0.frame12.button0  -side left

  # pack master .top15.frame1
  pack configure .top15.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top15.frame1.button1  -expand 1  -fill x  -side left

MiddleSrc.top15

  # pack master .top15
  pack configure .top15.frame0  -expand 1  -fill both
  pack configure .top15.frame1  -fill x

EndSrc.top15

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top15"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top15 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top15]" != ""} {
      global xfShowWindow.top15
      set xfShowWindow.top15 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top15; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top15"
    update
  }
}

proc MiddleSrc.top15 {} {
  if {[winfo exists .xfEdit]} {return}
  ctext .top15.frame0.frame1.text -width 45 -height 15
  pack .top15.frame0.frame1.text -expand 1 -fill both
}

proc EndSrc.top15 {} {
  global toucanEditorPreferences toucanNewEditorPreferences

  if {[winfo exists .xfEdit]} {return}
  foreach name [lsort [font families]] {
    .top15.frame0.frame0.frame0.menubutton0.m add command -font toucan_font -label $name -command "set toucanNewEditorPreferences(family) \[list $name\]
      toucanBuildFont toucanNewEditorPreferences
      .top15.frame0.frame1.text config -font \$toucanNewEditorPreferences(font)"
  }
  array set toucanNewEditorPreferences [array get toucanEditorPreferences]

  .top15.frame0.frame1.text config -font $toucanNewEditorPreferences(font) -bg $toucanNewEditorPreferences(bg) -fg $toucanNewEditorPreferences(fg)  -selectbackground $toucanNewEditorPreferences(bgSelect) -insertbackground $toucanNewEditorPreferences(bgInsert)
  ctext::setBlinkOptions .top15.frame0.frame1.text $toucanNewEditorPreferences(blinkColor) $toucanNewEditorPreferences(blinkRange) $toucanNewEditorPreferences(blinkTime)
  # syntax highlighting colors
  toucanEditorColors .top15.frame0.frame1.text toucanNewEditorPreferences
  .top15.frame0.frame1.text insert 1.0 {# Non-highlighted text appears below
This is non-highlighted text.  Use the mouse
cursor to select text to see the selection
background color

# Tcl general commands
append array catch clock concat expr fileevent
format global incr info join lappend lindex linsert
list llength lrange lreplace lsearch lsort regexp
regsub rename scan set source split string subst
time trace unset update upvar

# Tcl stack control commands
break continue default else elseif error eval for
foreach if proc return switch then uplevel while

# Palm OS-specific commands
beep clipboard dm emulator event form

# Tcl referenced varables
$referenced $variables $look $like $this

# Palm Tcl event substitutions
%A %E %N %R %S %T %W %x %y

# Tcl string enclosing characters
[  ]  {  }  (  )  "  "
Add and remove various brace characters to see
the electric brace matching highlight color

# Tcl comments
# Tcl comments start with the "number" symbol}
grab .top15
}


# procedure to show window ShowWindow.top2
proc ShowWindow.top2 { args} {
# xf ignore me 7

  # build widget .top2
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top2"
  } {
    catch "destroy .top2"
  }
  toplevel .top2 

  # Window manager configurations
  wm positionfrom .top2 ""
  wm sizefrom .top2 ""
  wm geometry .top2 331x294
  wm maxsize .top2 1000 768
  wm minsize .top2 10 10
  wm protocol .top2 WM_DELETE_WINDOW {DestroyWindow.top2}
  wm title .top2 {top2}


  # build widget .top2.frame0
  frame .top2.frame0  -borderwidth {2}  -height {30}  -width {219}

  # build widget .top2.frame0.button0
  button .top2.frame0.button0  -command {DestroyWindow.top2}  -font {toucan_font}  -text {OK}

  # build widget .top2.frame0.button1
  button .top2.frame0.button1  -command {DestroyWindow.top2}  -font {toucan_font}  -state {active}  -text {Cancel}

  # build widget .top2.frame1
  frame .top2.frame1  -borderwidth {2}  -height {71}  -width {30}

  # build widget .top2.frame1.canvas0
  canvas .top2.frame1.canvas0  -borderwidth {2}  -height {32}  -highlightthickness {0}  -relief {ridge}  -width {32}

  # build widget .top2.frame1.radiobutton0
  radiobutton .top2.frame1.radiobutton0  -command {toucanSetupIconEdit 32 32 iconreal}  -font {toucan_font}  -relief {raised}  -text {32x32}  -value {32x32}  -variable {toucanProject(iconsize)}

  # build widget .top2.frame1.radiobutton1
  radiobutton .top2.frame1.radiobutton1  -command {toucanSetupIconEdit 32 22 iconreal}  -font {toucan_font}  -relief {raised}  -text {32x22}  -value {32x22}  -variable {toucanProject(iconsize)}

  # build widget .top2.frame1.radiobutton2
  radiobutton .top2.frame1.radiobutton2  -command {toucanSetupIconEdit 22 22 iconreal}  -font {toucan_font}  -relief {raised}  -text {22x22}  -value {22x22}  -variable {toucanProject(iconsize)}

  # build widget .top2.frame1.frame0
  frame .top2.frame1.frame0  -borderwidth {2}  -height {26}  -width {74}

  # build widget .top2.frame1.frame0.label0
  label .top2.frame1.frame0.label0  -font {toucan_font}  -image {color}  -relief {ridge}  -text {label0}

  # build widget .top2.frame1.frame0.menubutton0
  menubutton .top2.frame1.frame0.menubutton0  -font {toucan_font}  -menu {.top2.frame1.frame0.menubutton0.m}  -padx {4}  -pady {3}  -relief {raised}  -text {Color}

  # build widget .top2.frame1.frame0.menubutton0.m
  menu .top2.frame1.frame0.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top2.frame1.frame0.menubutton0.m add command  -command {color put #000000 -to 0 0 16 16}  -label {Black}
  .top2.frame1.frame0.menubutton0.m add command  -command {color put #ffffff -to 0 0 16 16}  -label {White}
  .top2.frame1.frame0.menubutton0.m add command  -command {if {[set rgb [tk_chooseColor -parent . -title {Color selection} -initialcolor #ffffff]] != {}} {
  color put $rgb -to 0 0 16 16
}
unset rgb}  -label {Other...}  -state {disabled}

  # build widget .top2.frame2
  frame .top2.frame2  -borderwidth {2}  -height {264}  -width {271}

  # build widget .top2.frame2.canvas0
  canvas .top2.frame2.canvas0  -borderwidth {2}  -height {256}  -highlightthickness {0}  -relief {ridge}  -scrollregion {0 0 256 256}  -width {256}
  # bindings
  bind .top2.frame2.canvas0 <B1-Motion> {foreach {maxX maxY} [split $toucanProject(iconsize) x] {}
if {(%x >= 0) && (%x < $maxX * 8) && (%y >= 0) && (%y < $maxY * 8)} {
  set rgb [eval format "#%%02x%%02x%%02x" [color get 0 0]]
  iconmag put $rgb  -to  [expr (%x / 8) * 8] [expr (%y / 8) * 8] [expr ((%x / 8) * 8) + 8] [expr ((%y / 8) * 8) + 8]
  iconreal put $rgb -to [expr %x / 8] [expr %y / 8] [expr (%x / 8) + 1] [expr (%y / 8) + 1]
  unset rgb
}
unset maxX maxY}
  bind .top2.frame2.canvas0 <Button-1> {foreach {maxX maxY} [split $toucanProject(iconsize) x] {}
if {(%x >= 0) && (%x < $maxX * 8) && (%y >= 0) && (%y < $maxY * 8)} {
  set rgb [eval format "#%%02x%%02x%%02x" [color get 0 0]]
  iconmag put $rgb  -to  [expr (%x / 8) * 8] [expr (%y / 8) * 8] [expr ((%x / 8) * 8) + 8] [expr ((%y / 8) * 8) + 8]
  iconreal put $rgb -to [expr %x / 8] [expr %y / 8] [expr (%x / 8) + 1] [expr (%y / 8) + 1]
  unset rgb
}
unset maxX maxY}

  # pack master .top2.frame0
  pack configure .top2.frame0.button0  -expand 1  -fill x  -side left
  pack configure .top2.frame0.button1  -expand 1  -fill x  -side left

  # pack master .top2.frame1
  pack configure .top2.frame1.canvas0
  pack configure .top2.frame1.radiobutton0
  pack configure .top2.frame1.radiobutton1
  pack configure .top2.frame1.radiobutton2
  pack configure .top2.frame1.frame0

  # pack master .top2.frame1.frame0
  pack configure .top2.frame1.frame0.label0  -side left
  pack configure .top2.frame1.frame0.menubutton0  -side left

  # pack master .top2.frame2
  pack configure .top2.frame2.canvas0  -anchor nw

  # pack master .top2
  pack configure .top2.frame0  -fill x  -side bottom
  pack configure .top2.frame1  -fill y  -side left
  pack configure .top2.frame2  -expand 1  -fill both  -side left

  # build canvas items .top2.frame1.canvas0
  set xfTmpTag [.top2.frame1.canvas0 create image 2.0 2.0]
  .top2.frame1.canvas0 itemconfigure $xfTmpTag  -anchor {nw}  -image {iconreal}  -tags {actual}
  # build canvas items .top2.frame2.canvas0
  set xfTmpTag [.top2.frame2.canvas0 create image 0.0 0.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -anchor {nw}  -image {iconmag}
  .top2.frame2.canvas0 bind $xfTmpTag <B1-Motion> {# iconmag put #000000 -to  [expr (%x / 8) * 8] [expr (%y / 8) * 8] [expr ((%x / 8) * 8) + 8] [expr ((%y / 8) * 8) + 8]
# iconreal put #000000 -to [expr %x / 8] [expr %y / 8] [expr (%x / 8) + 1] [expr (%y / 8) + 1]}
  .top2.frame2.canvas0 bind $xfTmpTag <Button-1> {# iconmag put #000000 -to  [expr (%x / 8) * 8] [expr (%y / 8) * 8] [expr ((%x / 8) * 8) + 8] [expr ((%y / 8) * 8) + 8]
# iconreal put #000000 -to [expr %x / 8] [expr %y / 8] [expr (%x / 8) + 1] [expr (%y / 8) + 1]}
  set xfTmpTag [.top2.frame2.canvas0 create rectangle 0.0 0.0 255.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -outline {red}  -tags {grid rect 32x32}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 8.0 255.0 8.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 16.0 255.0 16.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 24.0 255.0 24.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 32.0 255.0 32.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 40.0 255.0 40.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 48.0 255.0 48.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 56.0 255.0 56.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 64.0 255.0 64.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 72.0 255.0 72.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 80.0 255.0 80.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 88.0 255.0 88.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 96.0 255.0 96.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 104.0 255.0 104.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 112.0 255.0 112.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 120.0 255.0 120.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 128.0 255.0 128.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 136.0 255.0 136.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 144.0 255.0 144.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 152.0 255.0 152.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 160.0 255.0 160.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 168.0 255.0 168.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 176.0 255.0 176.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 184.0 255.0 184.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 192.0 255.0 192.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 200.0 255.0 200.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 208.0 255.0 208.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 216.0 255.0 216.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 224.0 255.0 224.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 232.0 255.0 232.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 240.0 255.0 240.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 0.0 248.0 255.0 248.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 8.0 0.0 8.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 16.0 0.0 16.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 24.0 0.0 24.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 32.0 0.0 32.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 40.0 0.0 40.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 48.0 0.0 48.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 56.0 0.0 56.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 64.0 0.0 64.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 72.0 0.0 72.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 80.0 0.0 80.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 88.0 0.0 88.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 96.0 0.0 96.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 104.0 0.0 104.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 112.0 0.0 112.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 120.0 0.0 120.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 128.0 0.0 128.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 136.0 0.0 136.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 144.0 0.0 144.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 152.0 0.0 152.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 160.0 0.0 160.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 168.0 0.0 168.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 176.0 0.0 176.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 184.0 0.0 184.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 192.0 0.0 192.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 200.0 0.0 200.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 208.0 0.0 208.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 216.0 0.0 216.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 224.0 0.0 224.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 232.0 0.0 232.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 240.0 0.0 240.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}
  set xfTmpTag [.top2.frame2.canvas0 create line 248.0 0.0 248.0 255.0]
  .top2.frame2.canvas0 itemconfigure $xfTmpTag  -fill {red}  -joinstyle {miter}  -tags {grid}



EndSrc.top2

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top2"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top2 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top2]" != ""} {
      global xfShowWindow.top2
      set xfShowWindow.top2 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top2; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top2"
    update
  }
}

proc EndSrc.top2 {} {
  upvar args cargs
  global toucanProject
  
  if {[winfo exists .xfEdit]} { return }
  grab .top2
  if {[color get 0 0] == {0 0 0}} {
    color put #000000 -to 0 0 16 16
  }
  set icontype [lindex $cargs 0]
  iconmag blank
  switch $icontype {
    small {
      wm title .top2 {Small icon edit}
      destroy .top2.frame1.radiobutton0 .top2.frame1.radiobutton1 .top2.frame1.radiobutton2
      toucanSetupIconEdit 15 9 iconsml
      .top2.frame0.button0 configure -command {
        iconsml copy iconreal
        DestroyWindow.top2
      }
    }
    large {
      wm title .top2 {Large icon edit}
      set toucanProject(iconsize) [iconlrg cget -width]x[iconlrg cget -height]
      toucanSetupIconEdit [iconlrg cget -width] [iconlrg cget -height] iconlrg
      .top2.frame0.button0 configure -command {
        iconlrg configure -width [iconreal cget -width] -height [iconreal cget -height]
        iconlrg copy iconreal
        DestroyWindow.top2
      }
    }
    bitmap {
      wm title .top2 {Bitmap }
      .top2.frame0.button0 configure -text Dismiss
      destroy .top2.frame0.button1
      destroy .top2.frame1
      .top2.frame2.canvas0 delete grid
      iconmag blank
      iconmag read [lindex $cargs 1]
    }
  }
}


# procedure to show window ShowWindow.top3
proc ShowWindow.top3 { args} {
# xf ignore me 7

  # build widget .top3
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top3"
  } {
    catch "destroy .top3"
  }
  toplevel .top3   -relief {sunken}

  # Window manager configurations
  wm positionfrom .top3 ""
  wm sizefrom .top3 ""
  wm maxsize .top3 1000 768
  wm minsize .top3 10 10
  wm protocol .top3 WM_DELETE_WINDOW {DestroyWindow.top3}
  wm title .top3 {Button/Repeatbutton properties}


  # build widget .top3.frame0
  frame .top3.frame0  -height {218}  -width {717}

  # build widget .top3.frame0.frame0
  frame .top3.frame0.frame0  -height {24}  -width {717}

  # build widget .top3.frame0.frame0.frame0
  frame .top3.frame0.frame0.frame0  -borderwidth {2}  -height {20}  -relief {ridge}  -width {172}

  # build widget .top3.frame0.frame0.frame0.radiobutton0
  radiobutton .top3.frame0.frame0.frame0.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Usable}  -value {USABLE}  -variable {toucanFormObject(usability)}

  # build widget .top3.frame0.frame0.frame0.radiobutton1
  radiobutton .top3.frame0.frame0.frame0.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Nonusable}  -value {NONUSABLE}  -variable {toucanFormObject(usability)}

  # build widget .top3.frame0.frame0.frame1
  frame .top3.frame0.frame0.frame1  -borderwidth {2}  -height {40}  -relief {ridge}  -width {86}

  # build widget .top3.frame0.frame0.frame1.radiobutton0
  radiobutton .top3.frame0.frame0.frame1.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Left anchor}  -value {LEFTANCHOR}  -variable {toucanFormObject(anchor)}

  # build widget .top3.frame0.frame0.frame1.radiobutton1
  radiobutton .top3.frame0.frame0.frame1.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Right anchor}  -value {RIGHTANCHOR}  -variable {toucanFormObject(anchor)}

  # build widget .top3.frame0.frame0.frame3
  frame .top3.frame0.frame0.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top3.frame0.frame0.frame3.label6
  label .top3.frame0.frame0.frame3.label6  -font {toucan_font}  -text {Object ID}

  # build widget .top3.frame0.frame0.frame3.label7
  label .top3.frame0.frame0.frame3.label7  -font {toucan_font}  -textvariable {toucanFormObject(ID)}  -width {5}

  # build widget .top3.frame0.frame1
  frame .top3.frame0.frame1  -height {24}  -width {717}

  # build widget .top3.frame0.frame1.frame4
  frame .top3.frame0.frame1.frame4  -borderwidth {2}  -height {24}  -relief {ridge}  -width {625}

  # build widget .top3.frame0.frame1.frame4.radiobutton5
  radiobutton .top3.frame0.frame1.frame4.radiobutton5  -font {toucan_font}  -relief {raised}  -text {No frame}  -value {NOFRAME}  -variable {toucanFormObject(framing)}

  # build widget .top3.frame0.frame1.frame4.radiobutton6
  radiobutton .top3.frame0.frame1.frame4.radiobutton6  -font {toucan_font}  -relief {raised}  -text {Frame}  -value {FRAME}  -variable {toucanFormObject(framing)}

  # build widget .top3.frame0.frame1.frame4.radiobutton7
  radiobutton .top3.frame0.frame1.frame4.radiobutton7  -font {toucan_font}  -relief {raised}  -text {Bold frame}  -value {BOLDFRAME}  -variable {toucanFormObject(framing)}

  # build widget .top3.frame0.frame1.checkbutton3
  checkbutton .top3.frame0.frame1.checkbutton3  -font {toucan_font}  -offvalue {Null}  -onvalue {DISABLED}  -relief {raised}  -text {Disabled}  -variable {toucanFormObject(disabled)}

  # build widget .top3.frame0.frame1.frame3
  frame .top3.frame0.frame1.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top3.frame0.frame1.frame3.label6
  label .top3.frame0.frame1.frame3.label6  -font {toucan_font}  -text {Label}

  # build widget .top3.frame0.frame1.frame3.entry7
  entry .top3.frame0.frame1.frame3.entry7  -font {toucan_font}  -textvariable {toucanFormObject(label)}  -width {5}

  # build widget .top3.frame0.frame2
  frame .top3.frame0.frame2  -height {24}  -width {503}

  # build widget .top3.frame0.frame2.frame8
  frame .top3.frame0.frame2.frame8  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top3.frame0.frame2.frame8.checkbutton9
  checkbutton .top3.frame0.frame2.frame8.checkbutton9  -command {if {$toucanFormObject(graphical) == {Null}} {
  .top3.frame0.frame2.frame8.label10 configure -state disabled
  .top3.frame0.frame2.frame8.menubutton0 configure -state disabled
  .top3.frame0.frame2.frame8.label12 configure -state disabled
  .top3.frame0.frame2.frame8.menubutton1 configure -state disabled
  .top3.frame0.frame1.frame3.label6 configure -state normal
  .top3.frame0.frame1.frame3.entry7 configure -state normal
  .top3.frame0.frame2.frame33.label17 configure -state normal
  .top3.frame0.frame2.frame33.menubutton0 configure -state normal
  set toucanFormObject(bitmapID) None
  set toucanFormObject(selectedbitmapID) None
  set toucanFormObject(font) 0
} else {
  .top3.frame0.frame2.frame8.label10 configure -state normal
  .top3.frame0.frame2.frame8.menubutton0 configure -state normal
  .top3.frame0.frame2.frame8.label12 configure -state normal
  .top3.frame0.frame2.frame8.menubutton1 configure -state normal
  .top3.frame0.frame1.frame3.label6 configure -state disabled
  .top3.frame0.frame1.frame3.entry7 configure -state disabled
  .top3.frame0.frame2.frame33.label17 configure -state disabled
  .top3.frame0.frame2.frame33.menubutton0 configure -state disabled
  set toucanFormObject(font) None
  set toucanFormObject(label) {}
}}  -font {toucan_font}  -offvalue {Null}  -onvalue {GRAPHICAL}  -relief {raised}  -text {Graphical}  -variable {toucanFormObject(graphical)}

  # build widget .top3.frame0.frame2.frame8.label10
  label .top3.frame0.frame2.frame8.label10  -font {toucan_font}  -state {disabled}  -text {Bitmap ID}

  # build widget .top3.frame0.frame2.frame8.label12
  label .top3.frame0.frame2.frame8.label12  -font {toucan_font}  -state {disabled}  -text {Selected Bitmap ID}

  # build widget .top3.frame0.frame2.frame8.menubutton0
  menubutton .top3.frame0.frame2.frame8.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top3.frame0.frame2.frame8.menubutton0.m}  -padx {4}  -pady {3}  -state {disabled}  -text {None}  -textvariable {toucanFormObject(bitmapID)}

  # build widget .top3.frame0.frame2.frame8.menubutton0.m
  menu .top3.frame0.frame2.frame8.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top3.frame0.frame2.frame8.menubutton0.m add command  -command {set toucanFormObject(bitmapID) None}  -label {None}

  # build widget .top3.frame0.frame2.frame8.menubutton1
  menubutton .top3.frame0.frame2.frame8.menubutton1  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top3.frame0.frame2.frame8.menubutton1.m}  -padx {4}  -pady {3}  -state {disabled}  -text {None}  -textvariable {toucanFormObject(selectedbitmapID)}

  # build widget .top3.frame0.frame2.frame8.menubutton1.m
  menu .top3.frame0.frame2.frame8.menubutton1.m  -font {toucan_font}  -tearoff {0}
  .top3.frame0.frame2.frame8.menubutton1.m add command  -command {set toucanFormObject(selectedbitmapID) None}  -label {None}

  # build widget .top3.frame0.frame2.frame33
  frame .top3.frame0.frame2.frame33  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top3.frame0.frame2.frame33.label17
  label .top3.frame0.frame2.frame33.label17  -font {toucan_font}  -text {Font}

  # build widget .top3.frame0.frame2.frame33.menubutton0
  menubutton .top3.frame0.frame2.frame33.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top3.frame0.frame2.frame33.menubutton0.m}  -padx {4}  -pady {3}  -text {0}  -textvariable {toucanFormObject(font)}

  # build widget .top3.frame0.frame2.frame33.menubutton0.m
  menu .top3.frame0.frame2.frame33.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top3.frame0.frame2.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 0}  -label {0}
  .top3.frame0.frame2.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 1}  -label {1}
  .top3.frame0.frame2.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 2}  -label {2}
  .top3.frame0.frame2.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 3}  -label {3}
  .top3.frame0.frame2.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 4}  -label {4}
  .top3.frame0.frame2.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 5}  -label {5}
  .top3.frame0.frame2.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 6}  -label {6}
  .top3.frame0.frame2.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 7}  -label {7}

  # build widget .top3.frame0.frame3
  frame .top3.frame0.frame3  -height {86}  -width {454}

  # build widget .top3.frame0.frame3.scale5
  scale .top3.frame0.frame3.scale5  -font {toucan_font}  -label {Width}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(width)}

  # build widget .top3.frame0.frame3.scale6
  scale .top3.frame0.frame3.scale6  -font {toucan_font}  -label {Height}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(height)}

  # build widget .top3.frame1
  frame .top3.frame1  -height {26}  -width {717}

  # build widget .top3.frame1.button0
  button .top3.frame1.button0  -command {toucanAcceptProperties .top3
DestroyWindow.top3}  -font {toucan_font}  -text {OK}

  # build widget .top3.frame1.button1
  button .top3.frame1.button1  -command {toucanAcceptProperties .top3}  -font {toucan_font}  -text {Apply}

  # build widget .top3.frame1.button2
  button .top3.frame1.button2  -command {DestroyWindow.top3}  -font {toucan_font}  -text {Cancel}

  # pack master .top3.frame0
  pack configure .top3.frame0.frame0  -fill x
  pack configure .top3.frame0.frame1  -fill x
  pack configure .top3.frame0.frame2  -fill x
  pack configure .top3.frame0.frame3  -fill x

  # pack master .top3.frame0.frame0
  pack configure .top3.frame0.frame0.frame3  -side left
  pack configure .top3.frame0.frame0.frame0  -expand 1  -fill x  -side left
  pack configure .top3.frame0.frame0.frame1  -expand 1  -fill x  -side left

  # pack master .top3.frame0.frame0.frame0
  pack configure .top3.frame0.frame0.frame0.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top3.frame0.frame0.frame0.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top3.frame0.frame0.frame1
  pack configure .top3.frame0.frame0.frame1.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top3.frame0.frame0.frame1.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top3.frame0.frame0.frame3
  pack configure .top3.frame0.frame0.frame3.label6  -side left
  pack configure .top3.frame0.frame0.frame3.label7  -expand 1  -fill x  -side left

  # pack master .top3.frame0.frame1
  pack configure .top3.frame0.frame1.frame3  -expand 1  -fill x  -side left
  pack configure .top3.frame0.frame1.frame4  -side left
  pack configure .top3.frame0.frame1.checkbutton3  -fill y  -side left

  # pack master .top3.frame0.frame1.frame4
  pack configure .top3.frame0.frame1.frame4.radiobutton5  -expand 1  -fill x  -side left
  pack configure .top3.frame0.frame1.frame4.radiobutton6  -expand 1  -fill x  -side left
  pack configure .top3.frame0.frame1.frame4.radiobutton7  -expand 1  -fill x  -side left

  # pack master .top3.frame0.frame1.frame3
  pack configure .top3.frame0.frame1.frame3.label6  -side left
  pack configure .top3.frame0.frame1.frame3.entry7  -expand 1  -fill x  -side left

  # pack master .top3.frame0.frame2
  pack configure .top3.frame0.frame2.frame33  -fill x  -side left
  pack configure .top3.frame0.frame2.frame8  -expand 1  -fill x  -side left

  # pack master .top3.frame0.frame2.frame8
  pack configure .top3.frame0.frame2.frame8.checkbutton9  -expand 1  -fill x  -side left
  pack configure .top3.frame0.frame2.frame8.label10  -fill x  -side left
  pack configure .top3.frame0.frame2.frame8.menubutton0  -side left
  pack configure .top3.frame0.frame2.frame8.label12  -fill x  -side left
  pack configure .top3.frame0.frame2.frame8.menubutton1  -side left

  # pack master .top3.frame0.frame2.frame33
  pack configure .top3.frame0.frame2.frame33.label17  -fill x  -side left
  pack configure .top3.frame0.frame2.frame33.menubutton0  -side left

  # pack master .top3.frame0.frame3
  pack configure .top3.frame0.frame3.scale5  -expand 1  -fill x  -side left
  pack configure .top3.frame0.frame3.scale6  -expand 1  -fill x  -side left

  # pack master .top3.frame1
  pack configure .top3.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top3.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top3.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top3
  pack configure .top3.frame0  -expand 1  -fill both
  pack configure .top3.frame1  -fill x

EndSrc.top3

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top3"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top3 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top3]" != ""} {
      global xfShowWindow.top3
      set xfShowWindow.top3 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top3; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top3"
    update
  }
}

proc EndSrc.top3 {} {
  upvar args cargs
  global toucanFormObject toucanBitmapType

  if {[winfo exists .xfEdit]} { return }
  grab .top3
  set objectType [lindex $cargs 0]
  set objectID [lindex $cargs 1]
  if {$objectID == {default}} {
    append title {Default }
    .top3.frame0.frame0.frame3.label6 configure -state disabled
    .top3.frame0.frame0.frame3.label7 configure -state disabled
  }
  switch $objectType {
    Button {
      append title {Button properties}
    }
    Repeatbutton {
      append title {Repeatbutton properties}
    }
  }
  wm title .top3 $title
  global toucanFormObject$objectType
  if {$objectID != {default}} {
    array set toucanFormObject [toucanRetrieveObjectProperties $objectID]
    foreach bid [lsort -integer [array names toucanBitmapType {[0-9][0-9][0-9][0-9]}]] {
      .top3.frame0.frame2.frame8.menubutton0.m add command -label $bid -command [list set toucanFormObject(bitmapID) $bid]
      .top3.frame0.frame2.frame8.menubutton1.m add command -label $bid -command [list set toucanFormObject(selectedbitmapID) $bid]
    }
  } else {
    array set toucanFormObject [array get toucanFormObject$objectType]
  }
  if {$toucanFormObject(graphical) == {GRAPHICAL}} {
    .top3.frame0.frame2.frame8.label10 configure -state normal
    .top3.frame0.frame2.frame8.menubutton0 configure -state normal
    .top3.frame0.frame2.frame8.label12 configure -state normal
    .top3.frame0.frame2.frame8.menubutton1 configure -state normal
    .top3.frame0.frame1.frame3.label6 configure -state disabled
    .top3.frame0.frame1.frame3.entry7 configure -state disabled
    .top3.frame0.frame2.frame33.label17 configure -state disabled
    .top3.frame0.frame2.frame33.menubutton0 configure -state disabled
  }
}


# procedure to show window ShowWindow.top4
proc ShowWindow.top4 { args} {
# xf ignore me 7

  # build widget .top4
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top4"
  } {
    catch "destroy .top4"
  }
  toplevel .top4   -relief {sunken}

  # Window manager configurations
  wm positionfrom .top4 ""
  wm sizefrom .top4 ""
  wm maxsize .top4 1000 768
  wm minsize .top4 10 10
  wm protocol .top4 WM_DELETE_WINDOW {DestroyWindow.top4}
  wm title .top4 {Field properties}


  # build widget .top4.frame0
  frame .top4.frame0  -height {218}  -width {717}

  # build widget .top4.frame0.frame0
  frame .top4.frame0.frame0  -height {24}  -width {717}

  # build widget .top4.frame0.frame0.frame0
  frame .top4.frame0.frame0.frame0  -borderwidth {2}  -height {20}  -relief {ridge}  -width {172}

  # build widget .top4.frame0.frame0.frame0.radiobutton0
  radiobutton .top4.frame0.frame0.frame0.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Usable}  -value {USABLE}  -variable {toucanFormObject(usability)}

  # build widget .top4.frame0.frame0.frame0.radiobutton1
  radiobutton .top4.frame0.frame0.frame0.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Nonusable}  -value {NONUSABLE}  -variable {toucanFormObject(usability)}

  # build widget .top4.frame0.frame0.frame2
  frame .top4.frame0.frame0.frame2  -borderwidth {2}  -height {44}  -relief {ridge}  -width {44}

  # build widget .top4.frame0.frame0.frame2.radiobutton0
  radiobutton .top4.frame0.frame0.frame2.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Left align}  -value {LEFTALIGN}  -variable {toucanFormObject(align)}

  # build widget .top4.frame0.frame0.frame2.radiobutton1
  radiobutton .top4.frame0.frame0.frame2.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Right align}  -value {RIGHTALIGN}  -variable {toucanFormObject(align)}

  # build widget .top4.frame0.frame0.frame3
  frame .top4.frame0.frame0.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top4.frame0.frame0.frame3.label6
  label .top4.frame0.frame0.frame3.label6  -font {toucan_font}  -text {Object ID}

  # build widget .top4.frame0.frame0.frame3.label7
  label .top4.frame0.frame0.frame3.label7  -font {toucan_font}  -textvariable {toucanFormObject(ID)}  -width {5}

  # build widget .top4.frame0.frame1
  frame .top4.frame0.frame1  -height {24}  -width {717}

  # build widget .top4.frame0.frame1.frame33
  frame .top4.frame0.frame1.frame33  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top4.frame0.frame1.frame33.label17
  label .top4.frame0.frame1.frame33.label17  -font {toucan_font}  -text {Font ID}

  # build widget .top4.frame0.frame1.frame33.menubutton0
  menubutton .top4.frame0.frame1.frame33.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top4.frame0.frame1.frame33.menubutton0.m}  -padx {4}  -pady {3}  -text {0}  -textvariable {toucanFormObject(font)}

  # build widget .top4.frame0.frame1.frame33.menubutton0.m
  menu .top4.frame0.frame1.frame33.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top4.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 0}  -label {0}
  .top4.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 1}  -label {1}
  .top4.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 2}  -label {2}
  .top4.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 3}  -label {3}
  .top4.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 4}  -label {4}
  .top4.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 5}  -label {5}
  .top4.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 6}  -label {6}
  .top4.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 7}  -label {7}

  # build widget .top4.frame0.frame1.frame19
  frame .top4.frame0.frame1.frame19  -borderwidth {2}  -height {44}  -relief {ridge}  -width {109}

  # build widget .top4.frame0.frame1.frame19.radiobutton25
  radiobutton .top4.frame0.frame1.frame19.radiobutton25  -font {toucan_font}  -relief {raised}  -text {Editable}  -value {EDITABLE}  -variable {toucanFormObject(editing)}

  # build widget .top4.frame0.frame1.frame19.radiobutton26
  radiobutton .top4.frame0.frame1.frame19.radiobutton26  -font {toucan_font}  -relief {raised}  -text {Noneditable}  -value {NONEDITABLE}  -variable {toucanFormObject(editing)}

  # build widget .top4.frame0.frame1.frame20
  frame .top4.frame0.frame1.frame20  -borderwidth {2}  -height {44}  -relief {ridge}  -width {109}

  # build widget .top4.frame0.frame1.frame20.radiobutton27
  radiobutton .top4.frame0.frame1.frame20.radiobutton27  -font {toucan_font}  -relief {raised}  -text {Single line}  -value {SINGLELINE}  -variable {toucanFormObject(lines)}

  # build widget .top4.frame0.frame1.frame20.radiobutton28
  radiobutton .top4.frame0.frame1.frame20.radiobutton28  -font {toucan_font}  -relief {raised}  -text {Multiple lines}  -value {MULTIPLELINES}  -variable {toucanFormObject(lines)}

  # build widget .top4.frame0.frame2
  frame .top4.frame0.frame2  -height {24}  -width {717}

  # build widget .top4.frame0.frame2.checkbutton21
  checkbutton .top4.frame0.frame2.checkbutton21  -font {toucan_font}  -offvalue {Null}  -onvalue {UNDERLINED}  -relief {raised}  -text {Underlined}  -variable {toucanFormObject(underline)}

  # build widget .top4.frame0.frame2.checkbutton22
  checkbutton .top4.frame0.frame2.checkbutton22  -font {toucan_font}  -offvalue {Null}  -onvalue {AUTOSHIFT}  -relief {raised}  -text {Autoshift}  -variable {toucanFormObject(autoshift)}

  # build widget .top4.frame0.frame2.checkbutton23
  checkbutton .top4.frame0.frame2.checkbutton23  -font {toucan_font}  -offvalue {Null}  -onvalue {NUMERIC}  -relief {raised}  -text {Numeric}  -variable {toucanFormObject(numeric)}

  # build widget .top4.frame0.frame2.checkbutton24
  checkbutton .top4.frame0.frame2.checkbutton24  -font {toucan_font}  -offvalue {Null}  -onvalue {HASSCROLLBAR}  -relief {raised}  -text {Scrollbar}  -variable {toucanFormObject(scrollbar)}

  # build widget .top4.frame0.frame2.checkbutton3
  checkbutton .top4.frame0.frame2.checkbutton3  -font {toucan_font}  -offvalue {Null}  -onvalue {DISABLED}  -relief {raised}  -text {Disabled}  -variable {toucanFormObject(disabled)}

  # build widget .top4.frame0.frame2.checkbutton0
  checkbutton .top4.frame0.frame2.checkbutton0  -font {toucan_font}  -offvalue {Null}  -onvalue {DYNAMICSIZE}  -relief {raised}  -text {Dynamic Size}  -variable {toucanFormObject(dynamicSize)}

  # build widget .top4.frame0.frame4
  frame .top4.frame0.frame4  -height {59}  -width {717}

  # build widget .top4.frame0.frame4.scale2
  scale .top4.frame0.frame4.scale2  -font {toucan_font}  -label {Maximum characters}  -orient {horizontal}  -relief {raised}  -to {4096.0}  -variable {toucanFormObject(maxChars)}

  # build widget .top4.frame0.frame3
  frame .top4.frame0.frame3  -height {86}  -width {454}

  # build widget .top4.frame0.frame3.scale5
  scale .top4.frame0.frame3.scale5  -font {toucan_font}  -from {1.0}  -label {Width}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(width)}

  # build widget .top4.frame0.frame3.scale6
  scale .top4.frame0.frame3.scale6  -font {toucan_font}  -from {1.0}  -label {Height}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(height)}

  # build widget .top4.frame1
  frame .top4.frame1  -height {26}  -width {717}

  # build widget .top4.frame1.button0
  button .top4.frame1.button0  -command {toucanAcceptProperties .top4
DestroyWindow.top4}  -font {toucan_font}  -text {OK}

  # build widget .top4.frame1.button1
  button .top4.frame1.button1  -command {toucanAcceptProperties .top4}  -font {toucan_font}  -text {Apply}

  # build widget .top4.frame1.button2
  button .top4.frame1.button2  -command {DestroyWindow.top4}  -font {toucan_font}  -text {Cancel}

  # pack master .top4.frame0
  pack configure .top4.frame0.frame0  -fill x
  pack configure .top4.frame0.frame1  -fill x
  pack configure .top4.frame0.frame2  -fill x
  pack configure .top4.frame0.frame4  -fill x
  pack configure .top4.frame0.frame3  -fill x

  # pack master .top4.frame0.frame0
  pack configure .top4.frame0.frame0.frame3  -side left
  pack configure .top4.frame0.frame0.frame0  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame0.frame2  -expand 1  -fill x  -side left

  # pack master .top4.frame0.frame0.frame0
  pack configure .top4.frame0.frame0.frame0.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame0.frame0.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top4.frame0.frame0.frame2
  pack configure .top4.frame0.frame0.frame2.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame0.frame2.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top4.frame0.frame0.frame3
  pack configure .top4.frame0.frame0.frame3.label6  -side left
  pack configure .top4.frame0.frame0.frame3.label7  -side left

  # pack master .top4.frame0.frame1
  pack configure .top4.frame0.frame1.frame33  -fill x  -side left
  pack configure .top4.frame0.frame1.frame19  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame1.frame20  -expand 1  -fill x  -side left

  # pack master .top4.frame0.frame1.frame33
  pack configure .top4.frame0.frame1.frame33.label17  -fill x  -side left
  pack configure .top4.frame0.frame1.frame33.menubutton0  -side left

  # pack master .top4.frame0.frame1.frame19
  pack configure .top4.frame0.frame1.frame19.radiobutton25  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame1.frame19.radiobutton26  -expand 1  -fill x  -side left

  # pack master .top4.frame0.frame1.frame20
  pack configure .top4.frame0.frame1.frame20.radiobutton27  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame1.frame20.radiobutton28  -expand 1  -fill x  -side left

  # pack master .top4.frame0.frame2
  pack configure .top4.frame0.frame2.checkbutton21  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame2.checkbutton22  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame2.checkbutton23  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame2.checkbutton24  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame2.checkbutton3  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame2.checkbutton0

  # pack master .top4.frame0.frame4
  pack configure .top4.frame0.frame4.scale2  -expand 1  -fill x  -side left

  # pack master .top4.frame0.frame3
  pack configure .top4.frame0.frame3.scale5  -expand 1  -fill x  -side left
  pack configure .top4.frame0.frame3.scale6  -expand 1  -fill x  -side left

  # pack master .top4.frame1
  pack configure .top4.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top4.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top4.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top4
  pack configure .top4.frame0  -expand 1  -fill both
  pack configure .top4.frame1  -fill x

EndSrc.top4

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top4"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top4 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top4]" != ""} {
      global xfShowWindow.top4
      set xfShowWindow.top4 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top4; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top4"
    update
  }
}

proc EndSrc.top4 {} {
  upvar args cargs
  global toucanFormObject toucanFormObjectField

  if {[winfo exists .xfEdit]} { return }
  grab .top4
  set objectID [lindex $cargs 0]
  if {$objectID == {default}} {
    append title {Default }
    .top4.frame0.frame0.frame3.label6 configure -state disabled
    .top4.frame0.frame0.frame3.label7 configure -state disabled
  }
  append title {Field properties}
  wm title .top4 $title
  if {$objectID != {default}} {
    array set toucanFormObject [toucanRetrieveObjectProperties $objectID]
  } else {
    array set toucanFormObject [array get toucanFormObjectField]
  }
}


# procedure to show window ShowWindow.top5
proc ShowWindow.top5 { args} {
# xf ignore me 7

  # build widget .top5
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top5"
  } {
    catch "destroy .top5"
  }
  toplevel .top5 

  # Window manager configurations
  wm positionfrom .top5 ""
  wm sizefrom .top5 ""
  wm maxsize .top5 1000 768
  wm minsize .top5 10 10
  wm protocol .top5 WM_DELETE_WINDOW {DestroyWindow.top5}
  wm title .top5 {Scrollbar properties}


  # build widget .top5.frame0
  frame .top5.frame0  -height {218}  -width {717}

  # build widget .top5.frame0.frame0
  frame .top5.frame0.frame0  -height {24}  -width {717}

  # build widget .top5.frame0.frame0.frame0
  frame .top5.frame0.frame0.frame0  -borderwidth {2}  -height {20}  -relief {ridge}  -width {172}

  # build widget .top5.frame0.frame0.frame0.radiobutton0
  radiobutton .top5.frame0.frame0.frame0.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Usable}  -value {USABLE}  -variable {toucanFormObject(usability)}

  # build widget .top5.frame0.frame0.frame0.radiobutton1
  radiobutton .top5.frame0.frame0.frame0.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Nonusable}  -value {NONUSABLE}  -variable {toucanFormObject(usability)}

  # build widget .top5.frame0.frame0.frame3
  frame .top5.frame0.frame0.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top5.frame0.frame0.frame3.label6
  label .top5.frame0.frame0.frame3.label6  -font {toucan_font}  -text {Object ID}

  # build widget .top5.frame0.frame0.frame3.label7
  label .top5.frame0.frame0.frame3.label7  -font {toucan_font}  -textvariable {toucanFormObject(ID)}  -width {5}

  # build widget .top5.frame0.frame5
  frame .top5.frame0.frame5  -height {59}  -width {717}

  # build widget .top5.frame0.frame5.frame17
  frame .top5.frame0.frame5.frame17  -borderwidth {2}  -height {42}  -relief {ridge}  -width {132}

  # build widget .top5.frame0.frame5.frame17.label20
  label .top5.frame0.frame5.frame17.label20  -font {toucan_font}  -text {Minimum}

  # build widget .top5.frame0.frame5.frame17.entry21
  entry .top5.frame0.frame5.frame17.entry21  -font {toucan_font}  -textvariable {toucanFormObject(min)}  -width {10}

  # build widget .top5.frame0.frame5.frame18
  frame .top5.frame0.frame5.frame18  -borderwidth {2}  -height {42}  -relief {ridge}  -width {132}

  # build widget .top5.frame0.frame5.frame18.label22
  label .top5.frame0.frame5.frame18.label22  -font {toucan_font}  -text {Maximum}

  # build widget .top5.frame0.frame5.frame18.entry23
  entry .top5.frame0.frame5.frame18.entry23  -font {toucan_font}  -textvariable {toucanFormObject(max)}  -width {10}

  # build widget .top5.frame0.frame5.scale16
  scale .top5.frame0.frame5.scale16  -font {toucan_font}  -label {Value}  -orient {horizontal}  -relief {raised}  -variable {toucanFormObject(value)}

  # build widget .top5.frame0.frame5.scale19
  scale .top5.frame0.frame5.scale19  -font {toucan_font}  -label {Page size}  -orient {horizontal}  -relief {raised}  -variable {toucanFormObject(pagesize)}

  # build widget .top5.frame0.frame3
  frame .top5.frame0.frame3  -height {86}  -width {454}

  # build widget .top5.frame0.frame3.scale5
  scale .top5.frame0.frame3.scale5  -font {toucan_font}  -from {1.0}  -label {Width}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(width)}

  # build widget .top5.frame0.frame3.scale6
  scale .top5.frame0.frame3.scale6  -font {toucan_font}  -from {1.0}  -label {Height}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(height)}

  # build widget .top5.frame1
  frame .top5.frame1  -height {26}  -width {717}

  # build widget .top5.frame1.button0
  button .top5.frame1.button0  -command {toucanAcceptProperties .top5
DestroyWindow.top5}  -font {toucan_font}  -text {OK}

  # build widget .top5.frame1.button1
  button .top5.frame1.button1  -command {toucanAcceptProperties .top5}  -font {toucan_font}  -text {Apply}

  # build widget .top5.frame1.button2
  button .top5.frame1.button2  -command {DestroyWindow.top5}  -font {toucan_font}  -text {Cancel}

  # pack master .top5.frame0
  pack configure .top5.frame0.frame0  -fill x
  pack configure .top5.frame0.frame5  -fill x
  pack configure .top5.frame0.frame3  -fill x

  # pack master .top5.frame0.frame0
  pack configure .top5.frame0.frame0.frame3  -side left
  pack configure .top5.frame0.frame0.frame0  -expand 1  -fill x  -side left

  # pack master .top5.frame0.frame0.frame0
  pack configure .top5.frame0.frame0.frame0.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top5.frame0.frame0.frame0.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top5.frame0.frame0.frame3
  pack configure .top5.frame0.frame0.frame3.label6  -side left
  pack configure .top5.frame0.frame0.frame3.label7  -expand 1  -fill x  -side left

  # pack master .top5.frame0.frame5
  pack configure .top5.frame0.frame5.scale19  -expand 1  -fill x  -side right
  pack configure .top5.frame0.frame5.scale16  -expand 1  -fill x  -side right
  pack configure .top5.frame0.frame5.frame17  -expand 1  -fill both
  pack configure .top5.frame0.frame5.frame18  -expand 1  -fill both

  # pack master .top5.frame0.frame5.frame17
  pack configure .top5.frame0.frame5.frame17.label20  -side left
  pack configure .top5.frame0.frame5.frame17.entry21  -expand 1  -fill x  -side left

  # pack master .top5.frame0.frame5.frame18
  pack configure .top5.frame0.frame5.frame18.label22  -side left
  pack configure .top5.frame0.frame5.frame18.entry23  -expand 1  -fill x  -side left

  # pack master .top5.frame0.frame3
  pack configure .top5.frame0.frame3.scale5  -expand 1  -fill x  -side left
  pack configure .top5.frame0.frame3.scale6  -expand 1  -fill x  -side left

  # pack master .top5.frame1
  pack configure .top5.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top5.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top5.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top5
  pack configure .top5.frame0  -expand 1  -fill both
  pack configure .top5.frame1  -fill x

EndSrc.top5

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top5"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top5 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top5]" != ""} {
      global xfShowWindow.top5
      set xfShowWindow.top5 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top5; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top5"
    update
  }
}

proc EndSrc.top5 {} {
  upvar args cargs
  global toucanFormObject toucanFormObjectScrollbar

  if {[winfo exists .xfEdit]} { return }
  grab .top5
  set objectID [lindex $cargs 0]
  if {$objectID == {default}} {
    append title {Default }
    .top5.frame0.frame0.frame3.label6 configure -state disabled
    .top5.frame0.frame0.frame3.label7 configure -state disabled
  }
  append title {Scrollbar properties}
  wm title .top5 $title
  if {$objectID != {default}} {
    array set toucanFormObject [toucanRetrieveObjectProperties $objectID]
  } else {
    array set toucanFormObject [array get toucanFormObjectScrollbar]
  }
}


# procedure to show window ShowWindow.top6
proc ShowWindow.top6 { args} {
# xf ignore me 7

  # build widget .top6
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top6"
  } {
    catch "destroy .top6"
  }
  toplevel .top6 

  # Window manager configurations
  wm positionfrom .top6 ""
  wm sizefrom .top6 ""
  wm maxsize .top6 1000 768
  wm minsize .top6 10 10
  wm protocol .top6 WM_DELETE_WINDOW {DestroyWindow.top6}
  wm title .top6 {Slider properties}


  # build widget .top6.frame0
  frame .top6.frame0  -height {106}  -width {371}

  # build widget .top6.frame0.frame0
  frame .top6.frame0.frame0  -height {24}  -width {717}

  # build widget .top6.frame0.frame0.frame0
  frame .top6.frame0.frame0.frame0  -borderwidth {2}  -height {20}  -relief {ridge}  -width {172}

  # build widget .top6.frame0.frame0.frame0.radiobutton0
  radiobutton .top6.frame0.frame0.frame0.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Usable}  -value {USABLE}  -variable {toucanFormObject(usability)}

  # build widget .top6.frame0.frame0.frame0.radiobutton1
  radiobutton .top6.frame0.frame0.frame0.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Nonusable}  -value {NONUSABLE}  -variable {toucanFormObject(usability)}

  # build widget .top6.frame0.frame0.checkbutton3
  checkbutton .top6.frame0.frame0.checkbutton3  -font {toucan_font}  -offvalue {Null}  -onvalue {DISABLED}  -relief {raised}  -text {Disabled}  -variable {toucanFormObject(disabled)}

  # build widget .top6.frame0.frame0.frame3
  frame .top6.frame0.frame0.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top6.frame0.frame0.frame3.label6
  label .top6.frame0.frame0.frame3.label6  -font {toucan_font}  -text {Object ID}

  # build widget .top6.frame0.frame0.frame3.label7
  label .top6.frame0.frame0.frame3.label7  -font {toucan_font}  -textvariable {toucanFormObject(ID)}  -width {5}

  # build widget .top6.frame0.frame3
  frame .top6.frame0.frame3  -height {24}  -width {717}

  # build widget .top6.frame0.frame3.checkbutton34
  checkbutton .top6.frame0.frame3.checkbutton34  -font {toucan_font}  -offvalue {Null}  -onvalue {VERTICAL}  -relief {raised}  -text {Vertical}  -variable {toucanFormObject(vertical)}

  # build widget .top6.frame0.frame3.checkbutton35
  checkbutton .top6.frame0.frame3.checkbutton35  -font {toucan_font}  -offvalue {Null}  -onvalue {FEEDBACK}  -relief {raised}  -text {Feedback}  -variable {toucanFormObject(feedback)}

  # build widget .top6.frame0.frame3.frame36
  frame .top6.frame0.frame3.frame36  -borderwidth {2}  -height {42}  -relief {ridge}  -width {197}

  # build widget .top6.frame0.frame3.frame36.label38
  label .top6.frame0.frame3.frame36.label38  -font {toucan_font}  -text {Thumb ID}

  # build widget .top6.frame0.frame3.frame36.menubutton0
  menubutton .top6.frame0.frame3.frame36.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top6.frame0.frame3.frame36.menubutton0.m}  -padx {4}  -pady {3}  -text {None}  -textvariable {toucanFormObject(thumbID)}

  # build widget .top6.frame0.frame3.frame36.menubutton0.m
  menu .top6.frame0.frame3.frame36.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top6.frame0.frame3.frame36.menubutton0.m add command  -command {set toucanFormObject(thubmID) None}  -label {None}

  # build widget .top6.frame0.frame3.frame37
  frame .top6.frame0.frame3.frame37  -borderwidth {2}  -height {42}  -relief {ridge}  -width {198}

  # build widget .top6.frame0.frame3.frame37.label40
  label .top6.frame0.frame3.frame37.label40  -font {toucan_font}  -text {Background ID}

  # build widget .top6.frame0.frame3.frame37.menubutton0
  menubutton .top6.frame0.frame3.frame37.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top6.frame0.frame3.frame37.menubutton0.m}  -padx {4}  -pady {3}  -text {None}  -textvariable {toucanFormObject(backgroundID)}

  # build widget .top6.frame0.frame3.frame37.menubutton0.m
  menu .top6.frame0.frame3.frame37.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top6.frame0.frame3.frame37.menubutton0.m add command  -command {set toucanFormObject(backgroundID) None }  -label {None}

  # build widget .top6.frame0.frame7
  frame .top6.frame0.frame7  -height {86}  -width {454}

  # build widget .top6.frame0.frame7.scale5
  scale .top6.frame0.frame7.scale5  -font {toucan_font}  -from {1.0}  -label {Width}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(width)}

  # build widget .top6.frame0.frame7.scale6
  scale .top6.frame0.frame7.scale6  -font {toucan_font}  -from {1.0}  -label {Height}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(height)}

  # build widget .top6.frame1
  frame .top6.frame1  -height {26}  -width {371}

  # build widget .top6.frame1.button0
  button .top6.frame1.button0  -command {toucanAcceptProperties .top6
DestroyWindow.top6}  -font {toucan_font}  -text {OK}

  # build widget .top6.frame1.button1
  button .top6.frame1.button1  -command {toucanAcceptProperties .top6}  -font {toucan_font}  -text {Apply}

  # build widget .top6.frame1.button2
  button .top6.frame1.button2  -command {DestroyWindow.top6}  -font {toucan_font}  -text {Cancel}

  # pack master .top6.frame0
  pack configure .top6.frame0.frame0  -fill x
  pack configure .top6.frame0.frame3  -fill x
  pack configure .top6.frame0.frame7  -fill x

  # pack master .top6.frame0.frame0
  pack configure .top6.frame0.frame0.frame3  -side left
  pack configure .top6.frame0.frame0.frame0  -expand 1  -fill x  -side left
  pack configure .top6.frame0.frame0.checkbutton3  -expand 1  -fill both  -side left

  # pack master .top6.frame0.frame0.frame0
  pack configure .top6.frame0.frame0.frame0.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top6.frame0.frame0.frame0.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top6.frame0.frame0.frame3
  pack configure .top6.frame0.frame0.frame3.label6  -side left
  pack configure .top6.frame0.frame0.frame3.label7  -expand 1  -fill x  -side left

  # pack master .top6.frame0.frame3
  pack configure .top6.frame0.frame3.checkbutton34  -expand 1  -fill both  -side left
  pack configure .top6.frame0.frame3.checkbutton35  -expand 1  -fill both  -side left
  pack configure .top6.frame0.frame3.frame36  -expand 1  -fill x  -side left
  pack configure .top6.frame0.frame3.frame37  -expand 1  -fill x  -side left

  # pack master .top6.frame0.frame3.frame36
  pack configure .top6.frame0.frame3.frame36.label38  -side left
  pack configure .top6.frame0.frame3.frame36.menubutton0  -side left

  # pack master .top6.frame0.frame3.frame37
  pack configure .top6.frame0.frame3.frame37.label40  -side left
  pack configure .top6.frame0.frame3.frame37.menubutton0  -side left

  # pack master .top6.frame0.frame7
  pack configure .top6.frame0.frame7.scale5  -expand 1  -fill x  -side left
  pack configure .top6.frame0.frame7.scale6  -expand 1  -fill x  -side left

  # pack master .top6.frame1
  pack configure .top6.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top6.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top6.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top6
  pack configure .top6.frame0  -expand 1  -fill both
  pack configure .top6.frame1  -fill x

EndSrc.top6

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top6"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top6 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top6]" != ""} {
      global xfShowWindow.top6
      set xfShowWindow.top6 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top6; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top6"
    update
  }
}

proc EndSrc.top6 {} {
  upvar args cargs
  global toucanFormObject toucanFormObjectSlider

  if {[winfo exists .xfEdit]} { return }
  grab .top6
  set objectID [lindex $cargs 0]
  if {$objectID == {default}} {
    append title {Default }
    .top6.frame0.frame0.frame3.label6 configure -state disabled
    .top6.frame0.frame0.frame3.label7 configure -state disabled
  }
  append title {Slider properties}
  wm title .top6 $title
  if {$objectID != {default}} {
    array set toucanFormObject [toucanRetrieveObjectProperties $objectID]
    foreach bid [lsort -integer [array names toucanBitmapType {[0-9][0-9][0-9][0-9]}]] {
      .top6.frame0.frame3.frame36.menubutton0.m add command -label $bid -command [list set toucanFormObject(thumbID) $bid]
      .top6.frame0.frame3.frame37.menubutton0.m add command -label $bid -command [list set toucanFormObject(backgroundID) $bid]
    }
  } else {
    array set toucanFormObject [array get toucanFormObjectSlider]
  }
}


# procedure to show window ShowWindow.top7
proc ShowWindow.top7 { args} {
# xf ignore me 7

  # build widget .top7
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top7"
  } {
    catch "destroy .top7"
  }
  toplevel .top7 

  # Window manager configurations
  wm positionfrom .top7 ""
  wm sizefrom .top7 ""
  wm maxsize .top7 1000 768
  wm minsize .top7 10 10
  wm protocol .top7 WM_DELETE_WINDOW {DestroyWindow.top7}
  wm title .top7 {Table properties}


  # build widget .top7.frame0
  frame .top7.frame0  -height {218}  -width {717}

  # build widget .top7.frame0.frame0
  frame .top7.frame0.frame0  -height {24}  -width {717}

  # build widget .top7.frame0.frame0.frame0
  frame .top7.frame0.frame0.frame0  -borderwidth {2}  -height {20}  -relief {ridge}  -width {172}

  # build widget .top7.frame0.frame0.frame0.label6
  label .top7.frame0.frame0.frame0.label6  -font {toucan_font}  -text {Object ID}

  # build widget .top7.frame0.frame0.frame0.label7
  label .top7.frame0.frame0.frame0.label7  -font {toucan_font}  -textvariable {toucanFormObject(ID)}  -width {5}

  # build widget .top7.frame0.frame0.scale13
  scale .top7.frame0.frame0.scale13  -font {toucan_font}  -from {1.0}  -label {Rows}  -orient {horizontal}  -relief {raised}  -variable {toucanFormObject(rows)}

  # build widget .top7.frame0.frame0.scale14
  scale .top7.frame0.frame0.scale14  -command {toucanTableColumnsSet}  -font {toucan_font}  -from {1.0}  -label {Columns}  -orient {horizontal}  -relief {raised}  -to {20.0}  -variable {toucanFormObject(columns)}

  # build widget .top7.frame0.frame0.scale15
  scale .top7.frame0.frame0.scale15  -command {toucanTableColumnSet}  -font {toucan_font}  -from {1.0}  -label {Column width}  -orient {horizontal}  -relief {raised}  -variable {toucanFormObject(colWidth)}

  # build widget .top7.frame0.frame1
  frame .top7.frame0.frame1  -height {24}  -width {717}

  # build widget .top7.frame0.frame1.scrollbar12
  scrollbar .top7.frame0.frame1.scrollbar12  -command {.top7.frame0.frame1.listbox13 yview}

  # build widget .top7.frame0.frame1.listbox13
  listbox .top7.frame0.frame1.listbox13  -borderwidth {0}  -font {toucan_font}  -height {2}  -relief {flat}  -selectmode {single}  -width {10}  -yscrollcommand {.top7.frame0.frame1.scrollbar12 set}  -listvariable {toucanFormObject(columnWidths)}
  # bindings
  bind .top7.frame0.frame1.listbox13 <ButtonRelease-1> {.top7.frame0.frame0.scale15 set [%W get [%W curselection]]}

  # build widget .top7.frame0.frame3
  frame .top7.frame0.frame3  -height {86}  -width {454}

  # build widget .top7.frame0.frame3.scale5
  scale .top7.frame0.frame3.scale5  -font {toucan_font}  -label {Width}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(width)}

  # build widget .top7.frame0.frame3.scale6
  scale .top7.frame0.frame3.scale6  -font {toucan_font}  -label {Height}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(height)}

  # build widget .top7.frame1
  frame .top7.frame1  -height {26}  -width {717}

  # build widget .top7.frame1.button0
  button .top7.frame1.button0  -command {toucanAcceptProperties .top7
DestroyWindow.top7}  -font {toucan_font}  -text {OK}

  # build widget .top7.frame1.button1
  button .top7.frame1.button1  -command {toucanAcceptProperties .top7}  -font {toucan_font}  -text {Apply}

  # build widget .top7.frame1.button2
  button .top7.frame1.button2  -command {DestroyWindow.top7}  -font {toucan_font}  -text {Cancel}

  # pack master .top7.frame0
  pack configure .top7.frame0.frame3  -fill x  -side bottom
  pack configure .top7.frame0.frame0  -expand 1  -fill x  -side left
  pack configure .top7.frame0.frame1  -fill y  -side left

  # pack master .top7.frame0.frame0
  pack configure .top7.frame0.frame0.frame0  -expand 1  -fill x
  pack configure .top7.frame0.frame0.scale13  -expand 1  -fill x
  pack configure .top7.frame0.frame0.scale14  -expand 1  -fill x
  pack configure .top7.frame0.frame0.scale15  -expand 1  -fill x

  # pack master .top7.frame0.frame0.frame0
  pack configure .top7.frame0.frame0.frame0.label6  -side left
  pack configure .top7.frame0.frame0.frame0.label7  -expand 1  -fill x  -side left

  # pack master .top7.frame0.frame1
  pack configure .top7.frame0.frame1.scrollbar12  -fill y  -side left
  pack configure .top7.frame0.frame1.listbox13  -fill y  -side left

  # pack master .top7.frame0.frame3
  pack configure .top7.frame0.frame3.scale5  -expand 1  -fill x  -side left
  pack configure .top7.frame0.frame3.scale6  -expand 1  -fill x  -side left

  # pack master .top7.frame1
  pack configure .top7.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top7.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top7.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top7
  pack configure .top7.frame0  -expand 1  -fill both
  pack configure .top7.frame1  -fill x

  .top7.frame0.frame1.listbox13 insert end {10}



EndSrc.top7

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top7"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top7 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top7]" != ""} {
      global xfShowWindow.top7
      set xfShowWindow.top7 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top7; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top7"
    update
  }
}

proc EndSrc.top7 {} {
  upvar args cargs
  global toucanFormObject toucanFormObjectTable

  if {[winfo exists .xfEdit]} { return }
  grab .top7
  set objectID [lindex $cargs 0]
  if {$objectID == {default}} {
    append title {Default }
    .top7.frame0.frame0.frame0.label6 configure -state disabled
    .top7.frame0.frame0.frame0.label7 configure -state disabled
  }
  append title {Table properties}
  wm title .top7 $title
  if {$objectID != {default}} {
    array set toucanFormObject [toucanRetrieveObjectProperties $objectID]
  } else {
    array set toucanFormObject [array get toucanFormObjectTable]
  }
}


# procedure to show window ShowWindow.top8
proc ShowWindow.top8 { args} {
# xf ignore me 7

  # build widget .top8
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top8"
  } {
    catch "destroy .top8"
  }
  toplevel .top8 

  # Window manager configurations
  wm positionfrom .top8 ""
  wm sizefrom .top8 ""
  wm maxsize .top8 1000 768
  wm minsize .top8 10 10
  wm protocol .top8 WM_DELETE_WINDOW {DestroyWindow.top8}
  wm title .top8 {Checkbox properties}


  # build widget .top8.frame0
  frame .top8.frame0  -height {218}  -width {717}

  # build widget .top8.frame0.frame0
  frame .top8.frame0.frame0  -height {24}  -width {717}

  # build widget .top8.frame0.frame0.frame0
  frame .top8.frame0.frame0.frame0  -borderwidth {2}  -height {20}  -relief {ridge}  -width {172}

  # build widget .top8.frame0.frame0.frame0.radiobutton0
  radiobutton .top8.frame0.frame0.frame0.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Usable}  -value {USABLE}  -variable {toucanFormObject(usability)}

  # build widget .top8.frame0.frame0.frame0.radiobutton1
  radiobutton .top8.frame0.frame0.frame0.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Nonusable}  -value {NONUSABLE}  -variable {toucanFormObject(usability)}

  # build widget .top8.frame0.frame0.frame1
  frame .top8.frame0.frame0.frame1  -borderwidth {2}  -height {40}  -relief {ridge}  -width {86}

  # build widget .top8.frame0.frame0.frame1.radiobutton0
  radiobutton .top8.frame0.frame0.frame1.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Left anchor}  -value {LEFTANCHOR}  -variable {toucanFormObject(anchor)}

  # build widget .top8.frame0.frame0.frame1.radiobutton1
  radiobutton .top8.frame0.frame0.frame1.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Right anchor}  -value {RIGHTANCHOR}  -variable {toucanFormObject(anchor)}

  # build widget .top8.frame0.frame0.frame3
  frame .top8.frame0.frame0.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top8.frame0.frame0.frame3.label6
  label .top8.frame0.frame0.frame3.label6  -font {toucan_font}  -text {Object ID}

  # build widget .top8.frame0.frame0.frame3.label7
  label .top8.frame0.frame0.frame3.label7  -font {toucan_font}  -textvariable {toucanFormObject(ID)}  -width {5}

  # build widget .top8.frame0.frame1
  frame .top8.frame0.frame1  -height {24}  -width {717}

  # build widget .top8.frame0.frame1.checkbutton14
  checkbutton .top8.frame0.frame1.checkbutton14  -font {toucan_font}  -offvalue {Null}  -onvalue {CHECKED}  -relief {raised}  -text {Checked}  -variable {toucanFormObject(checked)}

  # build widget .top8.frame0.frame1.frame16
  frame .top8.frame0.frame1.frame16  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top8.frame0.frame1.frame16.label17
  label .top8.frame0.frame1.frame16.label17  -font {toucan_font}  -text {Group ID}

  # build widget .top8.frame0.frame1.frame16.menubutton0
  menubutton .top8.frame0.frame1.frame16.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top8.frame0.frame1.frame16.menubutton0.m}  -padx {4}  -pady {3}  -text {None}  -textvariable {toucanFormObject(group)}

  # build widget .top8.frame0.frame1.frame16.menubutton0.m
  menu .top8.frame0.frame1.frame16.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top8.frame0.frame1.frame16.menubutton0.m add command  -command {set toucanFormObject(group) None}  -label {None}
  .top8.frame0.frame1.frame16.menubutton0.m add command  -command {set toucanFormObject(group) [toucanCreateGroupVariable]}  -label {New}

  # build widget .top8.frame0.frame1.frame33
  frame .top8.frame0.frame1.frame33  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top8.frame0.frame1.frame33.label17
  label .top8.frame0.frame1.frame33.label17  -font {toucan_font}  -text {Font ID}

  # build widget .top8.frame0.frame1.frame33.menubutton0
  menubutton .top8.frame0.frame1.frame33.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top8.frame0.frame1.frame33.menubutton0.m}  -padx {4}  -pady {3}  -text {0}  -textvariable {toucanFormObject(font)}

  # build widget .top8.frame0.frame1.frame33.menubutton0.m
  menu .top8.frame0.frame1.frame33.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top8.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 0}  -label {0}
  .top8.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 1}  -label {1}
  .top8.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 2}  -label {2}
  .top8.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 3}  -label {3}
  .top8.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 4}  -label {4}
  .top8.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 5}  -label {5}
  .top8.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 6}  -label {6}
  .top8.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 7}  -label {7}

  # build widget .top8.frame0.frame1.checkbutton3
  checkbutton .top8.frame0.frame1.checkbutton3  -font {toucan_font}  -offvalue {Null}  -onvalue {DISABLED}  -relief {raised}  -text {Disabled}  -variable {toucanFormObject(disabled)}

  # build widget .top8.frame0.frame1.frame3
  frame .top8.frame0.frame1.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top8.frame0.frame1.frame3.label6
  label .top8.frame0.frame1.frame3.label6  -font {toucan_font}  -text {Label}

  # build widget .top8.frame0.frame1.frame3.entry7
  entry .top8.frame0.frame1.frame3.entry7  -font {toucan_font}  -textvariable {toucanFormObject(label)}  -width {5}

  # build widget .top8.frame0.frame3
  frame .top8.frame0.frame3  -height {86}  -width {454}

  # build widget .top8.frame0.frame3.scale5
  scale .top8.frame0.frame3.scale5  -font {toucan_font}  -label {Width}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(width)}

  # build widget .top8.frame0.frame3.scale6
  scale .top8.frame0.frame3.scale6  -font {toucan_font}  -label {Height}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(height)}

  # build widget .top8.frame1
  frame .top8.frame1  -height {26}  -width {717}

  # build widget .top8.frame1.button0
  button .top8.frame1.button0  -command {toucanAcceptProperties .top8
DestroyWindow.top8}  -font {toucan_font}  -text {OK}

  # build widget .top8.frame1.button1
  button .top8.frame1.button1  -command {toucanAcceptProperties .top8}  -font {toucan_font}  -text {Apply}

  # build widget .top8.frame1.button2
  button .top8.frame1.button2  -command {DestroyWindow.top8}  -font {toucan_font}  -text {Cancel}

  # pack master .top8.frame0
  pack configure .top8.frame0.frame0  -fill x
  pack configure .top8.frame0.frame1  -fill x
  pack configure .top8.frame0.frame3  -fill x

  # pack master .top8.frame0.frame0
  pack configure .top8.frame0.frame0.frame3  -side left
  pack configure .top8.frame0.frame0.frame0  -expand 1  -fill x  -side left
  pack configure .top8.frame0.frame0.frame1  -expand 1  -fill x  -side left

  # pack master .top8.frame0.frame0.frame0
  pack configure .top8.frame0.frame0.frame0.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top8.frame0.frame0.frame0.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top8.frame0.frame0.frame1
  pack configure .top8.frame0.frame0.frame1.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top8.frame0.frame0.frame1.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top8.frame0.frame0.frame3
  pack configure .top8.frame0.frame0.frame3.label6  -side left
  pack configure .top8.frame0.frame0.frame3.label7  -expand 1  -fill x  -side left

  # pack master .top8.frame0.frame1
  pack configure .top8.frame0.frame1.frame3  -expand 1  -fill x  -side left
  pack configure .top8.frame0.frame1.frame33  -side left
  pack configure .top8.frame0.frame1.frame16  -side left
  pack configure .top8.frame0.frame1.checkbutton14  -fill y  -side left
  pack configure .top8.frame0.frame1.checkbutton3  -fill y  -side left

  # pack master .top8.frame0.frame1.frame16
  pack configure .top8.frame0.frame1.frame16.label17  -fill x  -side left
  pack configure .top8.frame0.frame1.frame16.menubutton0  -side left

  # pack master .top8.frame0.frame1.frame33
  pack configure .top8.frame0.frame1.frame33.label17  -fill x  -side left
  pack configure .top8.frame0.frame1.frame33.menubutton0  -side left

  # pack master .top8.frame0.frame1.frame3
  pack configure .top8.frame0.frame1.frame3.label6  -side left
  pack configure .top8.frame0.frame1.frame3.entry7  -expand 1  -fill x  -side left

  # pack master .top8.frame0.frame3
  pack configure .top8.frame0.frame3.scale5  -expand 1  -fill x  -side left
  pack configure .top8.frame0.frame3.scale6  -expand 1  -fill x  -side left

  # pack master .top8.frame1
  pack configure .top8.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top8.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top8.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top8
  pack configure .top8.frame0  -expand 1  -fill both
  pack configure .top8.frame1  -fill x

EndSrc.top8

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top8"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top8 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top8]" != ""} {
      global xfShowWindow.top8
      set xfShowWindow.top8 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top8; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top8"
    update
  }
}

proc EndSrc.top8 {} {
  upvar args cargs
  global toucanFormObject toucanFormObjectCheckbox toucanGroupVariable

  if {[winfo exists .xfEdit]} { return }
  grab .top8
  set objectID [lindex $cargs 0]
  if {$objectID == {default}} {
    append title {Default }
    .top8.frame0.frame0.frame3.label6 configure -state disabled
    .top8.frame0.frame0.frame3.label7 configure -state disabled
  }
  append title {Checkbox properties}
  wm title .top8 $title
  if {$objectID != {default}} {
    array set toucanFormObject [toucanRetrieveObjectProperties $objectID]
    foreach gid [lsort -integer [array names toucanGroupVariable {[0-9][0-9][0-9][0-9]}]] {
      .top8.frame0.frame1.frame16.menubutton0.m add command -label $gid -command [list set toucanFormObject(group) $gid]
    }
  } else {
    array set toucanFormObject [array get toucanFormObjectCheckbox]
  }
}


# procedure to show window ShowWindow.top9
proc ShowWindow.top9 { args} {
# xf ignore me 7

  # build widget .top9
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top9"
  } {
    catch "destroy .top9"
  }
  toplevel .top9   -relief {sunken}

  # Window manager configurations
  wm positionfrom .top9 ""
  wm sizefrom .top9 ""
  wm maxsize .top9 1000 768
  wm minsize .top9 10 10
  wm protocol .top9 WM_DELETE_WINDOW {DestroyWindow.top9}
  wm title .top9 {Pushbutton/Popuptrigger/Selectortrigger properties}


  # build widget .top9.frame0
  frame .top9.frame0  -height {218}  -width {717}

  # build widget .top9.frame0.frame0
  frame .top9.frame0.frame0  -height {24}  -width {717}

  # build widget .top9.frame0.frame0.frame0
  frame .top9.frame0.frame0.frame0  -borderwidth {2}  -height {20}  -relief {ridge}  -width {172}

  # build widget .top9.frame0.frame0.frame0.radiobutton0
  radiobutton .top9.frame0.frame0.frame0.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Usable}  -value {USABLE}  -variable {toucanFormObject(usability)}

  # build widget .top9.frame0.frame0.frame0.radiobutton1
  radiobutton .top9.frame0.frame0.frame0.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Nonusable}  -value {NONUSABLE}  -variable {toucanFormObject(usability)}

  # build widget .top9.frame0.frame0.frame1
  frame .top9.frame0.frame0.frame1  -borderwidth {2}  -height {40}  -relief {ridge}  -width {86}

  # build widget .top9.frame0.frame0.frame1.radiobutton0
  radiobutton .top9.frame0.frame0.frame1.radiobutton0  -font {toucan_font}  -relief {raised}  -text {Left anchor}  -value {LEFTANCHOR}  -variable {toucanFormObject(anchor)}

  # build widget .top9.frame0.frame0.frame1.radiobutton1
  radiobutton .top9.frame0.frame0.frame1.radiobutton1  -font {toucan_font}  -relief {raised}  -text {Right anchor}  -value {RIGHTANCHOR}  -variable {toucanFormObject(anchor)}

  # build widget .top9.frame0.frame0.frame3
  frame .top9.frame0.frame0.frame3  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top9.frame0.frame0.frame3.label6
  label .top9.frame0.frame0.frame3.label6  -font {toucan_font}  -text {Object ID}

  # build widget .top9.frame0.frame0.frame3.label7
  label .top9.frame0.frame0.frame3.label7  -font {toucan_font}  -textvariable {toucanFormObject(ID)}  -width {5}

  # build widget .top9.frame0.frame0.frame2
  frame .top9.frame0.frame0.frame2  -borderwidth {2}  -height {60}  -relief {ridge}  -width {132}

  # build widget .top9.frame0.frame0.frame2.label6
  label .top9.frame0.frame0.frame2.label6  -font {toucan_font}  -text {Label}

  # build widget .top9.frame0.frame0.frame2.entry7
  entry .top9.frame0.frame0.frame2.entry7  -font {toucan_font}  -textvariable {toucanFormObject(label)}  -width {5}

  # build widget .top9.frame0.frame1
  frame .top9.frame0.frame1  -height {24}  -width {717}

  # build widget .top9.frame0.frame1.frame8
  frame .top9.frame0.frame1.frame8  -borderwidth {2}  -height {30}  -relief {ridge}  -width {30}

  # build widget .top9.frame0.frame1.frame8.checkbutton9
  checkbutton .top9.frame0.frame1.frame8.checkbutton9  -command {if {$toucanFormObject(graphical) == {Null}} {
  .top9.frame0.frame1.frame8.label10 configure -state disabled
  .top9.frame0.frame1.frame8.menubutton0 configure -state disabled
  .top9.frame0.frame1.frame8.label12 configure -state disabled
  .top9.frame0.frame1.frame8.menubutton3 configure -state disabled
  .top9.frame0.frame0.frame2.label6 configure -state normal
  .top9.frame0.frame0.frame2.entry7 configure -state normal
  .top9.frame0.frame1.frame33.label17 configure -state normal
  .top9.frame0.frame1.frame33.menubutton0 configure -state normal
  set toucanFormObject(bitmapID) None
  set toucanFormObject(selectedbitmapID) None
  set toucanFormObject(font) 0
} else {
  .top9.frame0.frame1.frame8.label10 configure -state normal
  .top9.frame0.frame1.frame8.menubutton0 configure -state normal
  .top9.frame0.frame1.frame8.label12 configure -state normal
  .top9.frame0.frame1.frame8.menubutton3 configure -state normal
  .top9.frame0.frame0.frame2.label6 configure -state disabled
  .top9.frame0.frame0.frame2.entry7 configure -state disabled
  .top9.frame0.frame1.frame33.label17 configure -state disabled
  .top9.frame0.frame1.frame33.menubutton0 configure -state disabled
  set toucanFormObject(font) None
  set toucanFormObject(label) {}
}}  -font {toucan_font}  -offvalue {Null}  -onvalue {GRAPHICAL}  -relief {raised}  -text {Graphical}  -variable {toucanFormObject(graphical)}

  # build widget .top9.frame0.frame1.frame8.label12
  label .top9.frame0.frame1.frame8.label12  -font {toucan_font}  -state {disabled}  -text {Selected Bitmap ID}

  # build widget .top9.frame0.frame1.frame8.label10
  label .top9.frame0.frame1.frame8.label10  -font {toucan_font}  -state {disabled}  -text {Bitmap ID}

  # build widget .top9.frame0.frame1.frame8.menubutton0
  menubutton .top9.frame0.frame1.frame8.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top9.frame0.frame1.frame8.menubutton0.m}  -padx {4}  -pady {3}  -state {disabled}  -text {None}  -textvariable {toucanFormObject(bitmapID)}

  # build widget .top9.frame0.frame1.frame8.menubutton0.m
  menu .top9.frame0.frame1.frame8.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top9.frame0.frame1.frame8.menubutton0.m add command  -command {set toucanFormObject(bitmapID) None}  -label {None}

  # build widget .top9.frame0.frame1.frame8.menubutton3
  menubutton .top9.frame0.frame1.frame8.menubutton3  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top9.frame0.frame1.frame8.menubutton3.m}  -padx {4}  -pady {3}  -state {disabled}  -text {None}  -textvariable {toucanFormObject(selectedbitmapID)}

  # build widget .top9.frame0.frame1.frame8.menubutton3.m
  menu .top9.frame0.frame1.frame8.menubutton3.m  -font {toucan_font}  -tearoff {0}
  .top9.frame0.frame1.frame8.menubutton3.m add command  -command {set toucanFormObject(selectedbitmapID) None}  -label {None}

  # build widget .top9.frame0.frame1.frame16
  frame .top9.frame0.frame1.frame16  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top9.frame0.frame1.frame16.label17
  label .top9.frame0.frame1.frame16.label17  -font {toucan_font}  -text {Group ID}

  # build widget .top9.frame0.frame1.frame16.menubutton0
  menubutton .top9.frame0.frame1.frame16.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top9.frame0.frame1.frame16.menubutton0.m}  -padx {4}  -pady {3}  -text {None}  -textvariable {toucanFormObject(group)}

  # build widget .top9.frame0.frame1.frame16.menubutton0.m
  menu .top9.frame0.frame1.frame16.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top9.frame0.frame1.frame16.menubutton0.m add command  -command {set toucanFormObject(group) None}  -label {None}
  .top9.frame0.frame1.frame16.menubutton0.m add command  -command {set toucanFormObject(group) [toucanCreateGroupVariable]}  -label {New}

  # build widget .top9.frame0.frame1.frame33
  frame .top9.frame0.frame1.frame33  -borderwidth {2}  -height {42}  -relief {ridge}  -width {138}

  # build widget .top9.frame0.frame1.frame33.label17
  label .top9.frame0.frame1.frame33.label17  -font {toucan_font}  -text {Font ID}

  # build widget .top9.frame0.frame1.frame33.menubutton0
  menubutton .top9.frame0.frame1.frame33.menubutton0  -direction {flush}  -font {toucan_font}  -indicatoron {1}  -menu {.top9.frame0.frame1.frame33.menubutton0.m}  -padx {4}  -pady {3}  -text {0}  -textvariable {toucanFormObject(font)}

  # build widget .top9.frame0.frame1.frame33.menubutton0.m
  menu .top9.frame0.frame1.frame33.menubutton0.m  -font {toucan_font}  -tearoff {0}
  .top9.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 0}  -label {0}
  .top9.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 1}  -label {1}
  .top9.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 2}  -label {2}
  .top9.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 3}  -label {3}
  .top9.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 4}  -label {4}
  .top9.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 5}  -label {5}
  .top9.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 6}  -label {6}
  .top9.frame0.frame1.frame33.menubutton0.m add command  -command {set toucanFormObject(font) 7}  -label {7}

  # build widget .top9.frame0.frame1.checkbutton3
  checkbutton .top9.frame0.frame1.checkbutton3  -font {toucan_font}  -offvalue {Null}  -onvalue {DISABLED}  -relief {raised}  -text {Disabled}  -variable {toucanFormObject(disabled)}

  # build widget .top9.frame0.frame3
  frame .top9.frame0.frame3  -height {86}  -width {454}

  # build widget .top9.frame0.frame3.scale5
  scale .top9.frame0.frame3.scale5  -font {toucan_font}  -label {Width}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(width)}

  # build widget .top9.frame0.frame3.scale6
  scale .top9.frame0.frame3.scale6  -font {toucan_font}  -label {Height}  -orient {horizontal}  -relief {raised}  -to {160.0}  -variable {toucanFormObject(height)}

  # build widget .top9.frame1
  frame .top9.frame1  -height {26}  -width {717}

  # build widget .top9.frame1.button0
  button .top9.frame1.button0  -command {toucanAcceptProperties .top9
DestroyWindow.top9}  -font {toucan_font}  -text {OK}

  # build widget .top9.frame1.button1
  button .top9.frame1.button1  -command {toucanAcceptProperties .top9}  -font {toucan_font}  -text {Apply}

  # build widget .top9.frame1.button2
  button .top9.frame1.button2  -command {DestroyWindow.top9}  -font {toucan_font}  -text {Cancel}

  # pack master .top9.frame0
  pack configure .top9.frame0.frame0  -fill x
  pack configure .top9.frame0.frame1  -fill x
  pack configure .top9.frame0.frame3  -fill x

  # pack master .top9.frame0.frame0
  pack configure .top9.frame0.frame0.frame3  -side left
  pack configure .top9.frame0.frame0.frame2  -expand 1  -fill x  -side left
  pack configure .top9.frame0.frame0.frame0  -side left
  pack configure .top9.frame0.frame0.frame1  -side left

  # pack master .top9.frame0.frame0.frame0
  pack configure .top9.frame0.frame0.frame0.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top9.frame0.frame0.frame0.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top9.frame0.frame0.frame1
  pack configure .top9.frame0.frame0.frame1.radiobutton0  -expand 1  -fill x  -side left
  pack configure .top9.frame0.frame0.frame1.radiobutton1  -expand 1  -fill x  -side left

  # pack master .top9.frame0.frame0.frame3
  pack configure .top9.frame0.frame0.frame3.label6  -side left
  pack configure .top9.frame0.frame0.frame3.label7  -expand 1  -fill x  -side left

  # pack master .top9.frame0.frame0.frame2
  pack configure .top9.frame0.frame0.frame2.label6  -side left
  pack configure .top9.frame0.frame0.frame2.entry7  -expand 1  -fill x  -side left

  # pack master .top9.frame0.frame1
  pack configure .top9.frame0.frame1.frame33  -fill x  -side left
  pack configure .top9.frame0.frame1.frame8  -expand 1  -fill x  -side left
  pack configure .top9.frame0.frame1.frame16  -expand 1  -fill x  -side left
  pack configure .top9.frame0.frame1.checkbutton3  -expand 1  -fill both  -side left

  # pack master .top9.frame0.frame1.frame8
  pack configure .top9.frame0.frame1.frame8.checkbutton9  -expand 1  -fill x  -side left
  pack configure .top9.frame0.frame1.frame8.label10  -fill x  -side left
  pack configure .top9.frame0.frame1.frame8.menubutton0  -side left
  pack configure .top9.frame0.frame1.frame8.label12  -fill x  -side left
  pack configure .top9.frame0.frame1.frame8.menubutton3  -side left

  # pack master .top9.frame0.frame1.frame16
  pack configure .top9.frame0.frame1.frame16.label17  -fill x  -side left
  pack configure .top9.frame0.frame1.frame16.menubutton0  -side left

  # pack master .top9.frame0.frame1.frame33
  pack configure .top9.frame0.frame1.frame33.label17  -fill x  -side left
  pack configure .top9.frame0.frame1.frame33.menubutton0  -side left

  # pack master .top9.frame0.frame3
  pack configure .top9.frame0.frame3.scale5  -expand 1  -fill x  -side left
  pack configure .top9.frame0.frame3.scale6  -expand 1  -fill x  -side left

  # pack master .top9.frame1
  pack configure .top9.frame1.button0  -expand 1  -fill x  -side left
  pack configure .top9.frame1.button1  -expand 1  -fill x  -side left
  pack configure .top9.frame1.button2  -expand 1  -fill x  -side left

  # pack master .top9
  pack configure .top9.frame0  -expand 1  -fill both
  pack configure .top9.frame1  -fill x

EndSrc.top9

  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree .top9"
    after 2 "catch {XFEditSetShowWindows}"
  }
}

proc DestroyWindow.top9 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top9]" != ""} {
      global xfShowWindow.top9
      set xfShowWindow.top9 0
      XFEditSetPath .
      after 2 "XFSaveAsProc .top9; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top9"
    update
  }
}

proc EndSrc.top9 {} {
  upvar args cargs
  global toucanFormObject toucanGroupVariable

  if {[winfo exists .xfEdit]} { return }
  grab .top9
  set objectType [lindex $cargs 0]
  set objectID [lindex $cargs 1]
  if {$objectID == {default}} {
    append title {Default }
    .top9.frame0.frame0.frame3.label6 configure -state disabled
    .top9.frame0.frame0.frame3.label7 configure -state disabled
  }
  switch $objectType {
    Pushbutton {
      append title {Pushbutton properties}
      foreach gid [lsort -integer [array names toucanGroupVariable {[0-9][0-9][0-9][0-9]}]] {
        .top9.frame0.frame1.frame16.menubutton0.m add command -label $gid -command [list set toucanFormObject(group) $gid]
      }
    }
    Popuptrigger {
      append title {Popuptrigger properties}
      .top9.frame0.frame1.frame16.label17 configure -text {List ID}
      .top9.frame0.frame1.frame16.menubutton0 configure -textvariable toucanFormObject(listID)
      .top9.frame0.frame1.frame16.menubutton0.m entryconfigure None -command [list set toucanFormObject(listID) None]
       if {$objectID != {default}} {
        regexp {^object([0-9][0-9])[0-9][0-9]$} $objectID junk formBase
        foreach w [winfo children .canvas0.form${formBase}00] {
          if {[regexp {list([0-9]+)$} $w junk id]} {
            .top9.frame0.frame1.frame16.menubutton0.m add command -label $id -command [list set toucanFormObject(listID) $id]
          }
        }
      }
    }
    Selectortrigger {
      append title {Selectortrigger properties}
      destroy .top9.frame0.frame1.frame16
    }
  }
  wm title .top9 $title
  global toucanFormObject$objectType toucanBitmapType
  if {$objectID != {default}} {
    array set toucanFormObject [toucanRetrieveObjectProperties $objectID]
    foreach bid [lsort -integer [array names toucanBitmapType {[0-9][0-9][0-9][0-9]}]] {
      .top9.frame0.frame1.frame8.menubutton0.m add command -label $bid -command [list set toucanFormObject(bitmapID) $bid]
      .top9.frame0.frame1.frame8.menubutton3.m add command -label $bid -command [list set toucanFormObject(selectedbitmapID) $bid]
    }
  } else {
    array set toucanFormObject [array get toucanFormObject$objectType]
  }
  if {$toucanFormObject(graphical) == {GRAPHICAL}} {
    .top9.frame0.frame1.frame8.label10 configure -state normal
    .top9.frame0.frame1.frame8.menubutton0 configure -state normal
    .top9.frame0.frame1.frame8.label12 configure -state normal
    .top9.frame0.frame1.frame8.menubutton3 configure -state normal
    .top9.frame0.frame0.frame2.label6 configure -state disabled
    .top9.frame0.frame0.frame2.entry7 configure -state disabled
    .top9.frame0.frame1.frame33.label17 configure -state disabled
    .top9.frame0.frame1.frame33.menubutton0 configure -state disabled
  }
}


# procedure to show window .
proc ShowWindow. {args} {# xf ignore me 7

  # Window manager configurations
  wm positionfrom . user
  wm sizefrom . ""
  wm maxsize . 1009 738
  wm minsize . 1 1
  wm protocol . WM_DELETE_WINDOW {.menu0.menu0 invoke Quit}
  wm title . {Toucan}

  # bindings
  bind . <Configure> {toucanResizeEditorWindow}

  # build widget .menu0
  menu .menu0 \
    -font {toucan_font}
  .menu0 add cascade \
    -menu {.menu0.menu0} \
    -label {File} \
    -underline {0}
  .menu0 add cascade \
    -menu {.menu0.menu1} \
    -label {Options} \
    -underline {0}
  .menu0 add cascade \
    -menu {.menu0.menu2} \
    -label {Edit} \
    -state {disabled} \
    -underline {0}
  .menu0 add cascade \
    -menu {.menu0.help} \
    -label {Help}

  # build widget .menu0.menu0
  menu .menu0.menu0 \
    -font {toucan_font} \
    -tearoff {0}
  .menu0.menu0 add command \
    -command {if {[tk_messageBox -type okcancel -icon warning -parent . -title {Create new PalmTcl project} -message {The project currently loaded will be deleted!}] == {ok}} {
  toucanNewProject
}} \
    -label {New Project} \
    -underline {0}
  .menu0.menu0 add command \
    -command {if {[llength [winfo children .canvas0]] > 1} {
  if {[tk_messageBox -type okcancel -icon warning -parent . -title {Load PalmTcl project} -message {The project currently loaded will be deleted!}] == {ok}} {
    toucanNewProject
  } else {
    return
  }
}
if {[set newName [tk_getOpenFile -defaultextension prj -filetypes {{{Toucan Project Files} {.tpj}}} -initialdir $toucanFile(path) -parent . -title {Load Toucan project file}]] != {}} {
  toucanLoadProjectFile $newName
  if {$toucanProject(autoload)} {
    toucanLoadAllTextFiles
  }
}
unset newName} \
    -label {Load Project...} \
    -underline {0}
  .menu0.menu0 add command \
    -command {toucanLoadTextFile $toucanDisplay(formShown)} \
    -label {Load File} \
    -state {disabled}
  .menu0.menu0 add separator
  .menu0.menu0 add command \
    -command {if {$toucanProject(name) != {unnamed}} {
  toucanGenerateProjectFile
} else {
  .menu0.menu0 invoke {Save Project As...}
}} \
    -label {Save Project} \
    -underline {0}
  .menu0.menu0 add command \
    -command {if {[set newName [tk_getSaveFile -defaultextension .tpj -filetypes {{{Toucan Project Files} {.tpj}}} -initialdir $toucanFile(path) -initialfile $toucanProject(name) -parent . -title {Save Toucan project file as}]] != {}} {
  set toucanFile(path) [file dirname $newName]
  set toucanProject(name) [file tail [file rootname $newName]]
  toucanGenerateProjectFile
}
unset newName} \
    -label {Save Project As...} \
    -underline {14}
  .menu0.menu0 add command \
    -command {toucanSaveTextFile $toucanDisplay(formShown)} \
    -label {Save File} \
    -state {disabled}
  .menu0.menu0 add separator
  .menu0.menu0 add command \
    -command {if {[tk_messageBox -type yesno -icon warning -parent . -title {Save project} -message {Do you want to save the project?}] == {yes}} {
  .menu0.menu0 invoke {Save Project}
}
toucanSaveAllTextFiles
if {[tk_messageBox -type okcancel -icon warning -parent . -title {Quit toucan} -message {Are you sure you want to quit?}] == {ok}} {
  exit
}} \
    -label {Quit} \
    -underline {0}

  # build widget .menu0.menu1
  menu .menu0.menu1 \
    -font {toucan_font} \
    -tearoff {0}
  .menu0.menu1 add cascade \
    -menu {.menu0.menu1.menu0} \
    -label {Project} \
    -underline {0}
  .menu0.menu1 add cascade \
    -menu {.menu0.menu1.menu1} \
    -label {PilRC} \
    -underline {1}
  .menu0.menu1 add cascade \
    -menu {.menu0.menu1.menu2} \
    -label {Par} \
    -underline {1}
  .menu0.menu1 add cascade \
    -menu {.menu0.menu1.menu3} \
    -label {Generate} \
    -underline {0}

  # build widget .menu0.menu1.menu0
  menu .menu0.menu1.menu0 \
    -font {toucan_font} \
    -tearoff {0}
  .menu0.menu1.menu0 add command \
    -command {if {[set path [tk_chooseDirectory -mustexist 1 -parent . -title {PalmTcl library path} -initialdir $toucanProject(path)]] != {}} {
  set toucanProject(path) $path
}

unset path} \
    -label {Output path for files...} \
    -underline {0}
  .menu0.menu1.menu0 add command \
    -command {ShowWindow.top1 version} \
    -label {Application version...} \
    -underline {0}
  .menu0.menu1.menu0 add command \
    -command {ShowWindow.top2 large} \
    -label {Large icon edit...} \
    -underline {0}
  .menu0.menu1.menu0 add command \
    -command {ShowWindow.top2 small} \
    -label {Small icon edit...} \
    -underline {0}
  .menu0.menu1.menu0 add command \
    -command {ShowWindow.top0 -B} \
    -label {Bitmaps resources...} \
    -underline {0}
  .menu0.menu1.menu0 add checkbutton \
    -variable {toucanProject(autoload)} \
    -label {Autoload STRING files}

  # build widget .menu0.menu1.menu1
  menu .menu0.menu1.menu1 \
    -font {toucan_font} \
    -tearoff {0}
  .menu0.menu1.menu1 add cascade \
    -menu {.menu0.menu1.menu1.menu0} \
    -label {Language} \
    -underline {0}
  .menu0.menu1.menu1 add cascade \
    -menu {.menu0.menu1.menu1.menu1} \
    -label {Auto font width} \
    -underline {0}
  .menu0.menu1.menu1 add checkbutton \
    -variable {toucanPilrc(-allowEditID)} \
    -label {Edit menu IDs} \
    -underline {0}
  .menu0.menu1.menu1 add checkbutton \
    -variable {toucanPilrc(-LE32)} \
    -label {Little endian resources} \
    -underline {7}
  .menu0.menu1.menu1 add checkbutton \
    -variable {toucanPilrc(-PalmRez)} \
    -label {PalmRez} \
    -underline {0}
  .menu0.menu1.menu1 add checkbutton \
    -variable {toucanPilrc(-q)} \
    -label {Quiet output} \
    -underline {0}
  .menu0.menu1.menu1 add checkbutton \
    -variable {toucanPilrc(-rtl)} \
    -label {Right-to-left} \
    -underline {1}
  .menu0.menu1.menu1 add checkbutton \
    -variable {toucanPilrc(-V)} \
    -label {MS-style output} \
    -underline {0}
  .menu0.menu1.menu1 add command \
    -command {ShowWindow.top0 -I} \
    -label {Include path(s)...} \
    -underline {7}
  .menu0.menu1.menu1 add command \
    -command {ShowWindow.top0 -D} \
    -label {Macro symbol(s)...} \
    -underline {0}
  .menu0.menu1.menu1 add command \
    -command {ShowWindow.top1 -R} \
    -label {Resource file output...} \
    -underline {0}
  .menu0.menu1.menu1 add command \
    -command {ShowWindow.top1 -H} \
    -label {Include file output...} \
    -underline {0}

  # build widget .menu0.menu1.menu1.menu0
  menu .menu0.menu1.menu1.menu0 \
    -font {toucan_font} \
    -tearoff {0}
  .menu0.menu1.menu1.menu0 add radiobutton \
    -value {ENGLISH} \
    -variable {toucanPilrc(-L)} \
    -label {English} \
    -underline {0}
  .menu0.menu1.menu1.menu0 add radiobutton \
    -value {FRENCH} \
    -variable {toucanPilrc(-L)} \
    -label {French} \
    -underline {0}
  .menu0.menu1.menu1.menu0 add radiobutton \
    -value {GERMAN} \
    -variable {toucanPilrc(-L)} \
    -label {German} \
    -underline {0}
  .menu0.menu1.menu1.menu0 add radiobutton \
    -value {ITALIAN} \
    -variable {toucanPilrc(-L)} \
    -label {Italian} \
    -underline {0}
  .menu0.menu1.menu1.menu0 add radiobutton \
    -value {SPANISH} \
    -variable {toucanPilrc(-L)} \
    -label {Spanish} \
    -underline {0}

  # build widget .menu0.menu1.menu1.menu1
  menu .menu0.menu1.menu1.menu1 \
    -font {toucan_font} \
    -tearoff {0}
  .menu0.menu1.menu1.menu1 add radiobutton \
    -value {null} \
    -variable {toucanPilrc(-F)} \
    -label {Default} \
    -underline {0}
  .menu0.menu1.menu1.menu1 add radiobutton \
    -value {5} \
    -variable {toucanPilrc(-F)} \
    -label {Chinese (Big5)} \
    -underline {10}
  .menu0.menu1.menu1.menu1 add radiobutton \
    -value {g} \
    -variable {toucanPilrc(-F)} \
    -label {Chinese (GB)} \
    -underline {10}
  .menu0.menu1.menu1.menu1 add radiobutton \
    -value {h} \
    -variable {toucanPilrc(-F)} \
    -label {Hebrew} \
    -underline {0}
  .menu0.menu1.menu1.menu1 add radiobutton \
    -value {j} \
    -variable {toucanPilrc(-F)} \
    -label {Japanese} \
    -underline {0}
  .menu0.menu1.menu1.menu1 add radiobutton \
    -value {km} \
    -variable {toucanPilrc(-F)} \
    -label {Korean (Hanme)} \
    -underline {12}
  .menu0.menu1.menu1.menu1 add radiobutton \
    -value {kt} \
    -variable {toucanPilrc(-F)} \
    -label {Korean (Hantip)} \
    -underline {12}

  # build widget .menu0.menu1.menu2
  menu .menu0.menu1.menu2 \
    -font {toucan_font} \
    -tearoff {0}
  .menu0.menu1.menu2 add command \
    -command {ShowWindow.top1 appName} \
    -label {Application name...}
  .menu0.menu1.menu2 add command \
    -command {ShowWindow.top1 creatorID} \
    -label {Creator ID...}
  .menu0.menu1.menu2 add command \
    -command {if {[set path [tk_chooseDirectory -mustexist 1 -parent . -title {PalmTcl library path} -initialdir $toucanPar(palmTclPath)]] != {}} {
  set toucanPar(palmTclPath) $path
}

unset path} \
    -label {PalmTcl library path...}

  # build widget .menu0.menu1.menu3
  menu .menu0.menu1.menu3 \
    -font {toucan_font} \
    -tearoff {0}
  .menu0.menu1.menu3 add command \
    -command {if {[tk_messageBox -icon info -type okcancel -parent . -title {Palm resource file} -message "Generate Palm resource file [file join $toucanProject(path) $toucanProject(name)].prc?"] == {ok}} {
  toucanGeneratePrcFile
}} \
    -label {Target Palm resource file}
  .menu0.menu1.menu3 add command \
    -command {if {[tk_messageBox -icon info -type okcancel -parent . -title {Resource script file} -message "Generate resource script file [file join $toucanProject(path) $toucanProject(name)].rcp?"] == {ok}} {
  toucanGeneratePilrcFile
}} \
    -label {Resource script file only}
  .menu0.menu1.menu3 add command \
    -command {if {[tk_messageBox -icon info -type okcancel -parent . -title {Palm icon file} -message "Generate Palm large icon file [file join $toucanProject(path) $toucanProject(name)].bmp?"] == {ok}} {
  iconlrg write [file join $toucanProject(path) $toucanProject(name)].bmp -format bmp
}} \
    -label {Large icon file}
  .menu0.menu1.menu3 add command \
    -command {if {[tk_messageBox -icon info -type okcancel -parent . -title {Palm small icon file} -message "Generate Palm small icon file [file join $toucanProject(path) $toucanProject(name)]_sml.bmp?"] == {ok}} {
  iconsml write [file join $toucanProject(path) $toucanProject(name)]_sml.bmp -format bmp
}} \
    -label {Small icon file}

  # build widget .menu0.menu2
  menu .menu0.menu2 \
    -font {toucan_font} \
    -tearoff {0}
  .menu0.menu2 add command \
    -accelerator {Ctrl-x} \
    -command {[.canvas0 itemcget [.canvas0 find withtag edit] -window].f2.text cut} \
    -label {Cut} \
    -underline {1}
  .menu0.menu2 add command \
    -accelerator {Ctrl-c} \
    -command {[.canvas0 itemcget [.canvas0 find withtag edit] -window].f2.text copy} \
    -label {Copy} \
    -underline {0}
  .menu0.menu2 add command \
    -accelerator {Ctrl-v} \
    -command {[.canvas0 itemcget [.canvas0 find withtag edit] -window].f2.text paste} \
    -label {Paste} \
    -underline {0}
  .menu0.menu2 add command \
    -command {eval [.canvas0 itemcget [.canvas0 find withtag edit] -window].f2.text delete [[.canvas0 itemcget [.canvas0 find withtag edit] -window].f2.text tag ranges sel]} \
    -label {Delete} \
    -underline {1}
  .menu0.menu2 add separator
  .menu0.menu2 add command \
    -command {[.canvas0 itemcget [.canvas0 find withtag edit] -window].f2.text tag add sel 1.0 end} \
    -label {Select all} \
    -underline {1}
  .menu0.menu2 add separator
  .menu0.menu2 add command \
    -command {ShowWindow.top14} \
    -label {Search/Replace...}
  .menu0.menu2 add command \
    -command {ShowWindow.top15} \
    -label {Preferences...}

  # build widget .menu0.help
  menu .menu0.help \
    -font {Helvetica 10} \
    -tearoff {0}
  .menu0.help add command \
    -command {tk_messageBox -type ok -icon info -parent . -title {About Toucan} -message "Toucan PalmTcl IDE\nVersion 1.2.1 by Mac Cody\nCopyright (c) 2001, 2002"} \
    -label {About...}

  # build widget .canvas0
  canvas .canvas0 \
    -confine {0} \
    -height {490} \
    -highlightthickness {0} \
    -relief {raised} \
    -scrollregion {26 26 345 345} \
    -width {370}

  # build widget .canvas0.label0
  label .canvas0.label0 \
    -font {toucan_font}

  # build widget .frame0
  frame .frame0 \
    -borderwidth {2} \
    -height {30} \
    -relief {raised} \
    -width {30}

  # build widget .frame0.frame0
  frame .frame0.frame0 \
    -height {316} \
    -width {145}

  # build widget .frame0.frame0.label0
  label .frame0.frame0.label0 \
    -font {toucan_bold_font} \
    -text {Form Objects}
  # bindings
  bind .frame0.frame0.label0 <ButtonRelease-3> {ShowWindow.top3 Button default}

  # build widget .frame0.frame0.label1
  label .frame0.frame0.label1 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Button}
  # bindings
  bind .frame0.frame0.label1 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label1 <Button-1> {toucanCreateDragStart Button %X %Y}
  bind .frame0.frame0.label1 <ButtonRelease-1> {toucanCreateDragEnd Button %X %Y}
  bind .frame0.frame0.label1 <ButtonRelease-3> {ShowWindow.top3 Button default}

  # build widget .frame0.frame0.label2
  label .frame0.frame0.label2 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Checkbox}
  # bindings
  bind .frame0.frame0.label2 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label2 <Button-1> {toucanCreateDragStart Checkbox %X %Y}
  bind .frame0.frame0.label2 <ButtonRelease-1> {toucanCreateDragEnd Checkbox %X %Y}
  bind .frame0.frame0.label2 <ButtonRelease-3> {ShowWindow.top8 default}

  # build widget .frame0.frame0.label3
  label .frame0.frame0.label3 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Field}
  # bindings
  bind .frame0.frame0.label3 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label3 <Button-1> {toucanCreateDragStart Field %X %Y}
  bind .frame0.frame0.label3 <ButtonRelease-1> {toucanCreateDragEnd Field %X %Y}
  bind .frame0.frame0.label3 <ButtonRelease-3> {ShowWindow.top4 default}

  # build widget .frame0.frame0.label4
  label .frame0.frame0.label4 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Form Bitmap}
  # bindings
  bind .frame0.frame0.label4 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label4 <Button-1> {toucanCreateDragStart Formbitmap %X %Y}
  bind .frame0.frame0.label4 <ButtonRelease-1> {toucanCreateDragEnd Formbitmap %X %Y}
  bind .frame0.frame0.label4 <ButtonRelease-3> {ShowWindow.top11 Formbitmap default}

  # build widget .frame0.frame0.label5
  label .frame0.frame0.label5 \
    -font {toucan_font} \
    -relief {ridge} \
    -state {disabled} \
    -text {Gadget}

  # build widget .frame0.frame0.label6
  label .frame0.frame0.label6 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Graffiti State Indicator}
  # bindings
  bind .frame0.frame0.label6 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label6 <Button-1> {toucanCreateDragStart Graffitistateindicator %X %Y}
  bind .frame0.frame0.label6 <Button-3> {%W config -cursor iron_cross
bell}
  bind .frame0.frame0.label6 <ButtonRelease-1> {toucanCreateDragEnd Graffitistateindicator %X %Y}
  bind .frame0.frame0.label6 <ButtonRelease-3> {%W config -cursor {}}

  # build widget .frame0.frame0.label7
  label .frame0.frame0.label7 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Label}
  # bindings
  bind .frame0.frame0.label7 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label7 <Button-1> {toucanCreateDragStart Label %X %Y}
  bind .frame0.frame0.label7 <ButtonRelease-1> {toucanCreateDragEnd Label %X %Y}
  bind .frame0.frame0.label7 <ButtonRelease-3> {ShowWindow.top11 Label default}

  # build widget .frame0.frame0.label8
  label .frame0.frame0.label8 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {List}
  # bindings
  bind .frame0.frame0.label8 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label8 <Button-1> {toucanCreateDragStart List %X %Y}
  bind .frame0.frame0.label8 <ButtonRelease-1> {toucanCreateDragEnd List %X %Y}
  bind .frame0.frame0.label8 <ButtonRelease-3> {ShowWindow.top10 default}

  # build widget .frame0.frame0.label9
  label .frame0.frame0.label9 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Popup Trigger}
  # bindings
  bind .frame0.frame0.label9 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label9 <Button-1> {toucanCreateDragStart Popuptrigger %X %Y}
  bind .frame0.frame0.label9 <ButtonRelease-1> {toucanCreateDragEnd Popuptrigger %X %Y}
  bind .frame0.frame0.label9 <ButtonRelease-3> {ShowWindow.top9(Popuptrigger default}

  # build widget .frame0.frame0.label10
  label .frame0.frame0.label10 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Pushbutton}
  # bindings
  bind .frame0.frame0.label10 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label10 <Button-1> {toucanCreateDragStart Pushbutton %X %Y}
  bind .frame0.frame0.label10 <ButtonRelease-1> {toucanCreateDragEnd Pushbutton %X %Y}
  bind .frame0.frame0.label10 <ButtonRelease-3> {ShowWindow.top9 Pushbutton default}

  # build widget .frame0.frame0.label11
  label .frame0.frame0.label11 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Repeat Button}
  # bindings
  bind .frame0.frame0.label11 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label11 <Button-1> {toucanCreateDragStart Repeatbutton %X %Y}
  bind .frame0.frame0.label11 <ButtonRelease-1> {toucanCreateDragEnd Repeatbutton %X %Y}
  bind .frame0.frame0.label11 <ButtonRelease-3> {ShowWindow.top3 Repeatbutton default}

  # build widget .frame0.frame0.label12
  label .frame0.frame0.label12 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Scrollbar}
  # bindings
  bind .frame0.frame0.label12 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label12 <Button-1> {toucanCreateDragStart Scrollbar %X %Y}
  bind .frame0.frame0.label12 <ButtonRelease-1> {toucanCreateDragEnd Scrollbar %X %Y}
  bind .frame0.frame0.label12 <ButtonRelease-3> {ShowWindow.top5 default}

  # build widget .frame0.frame0.label13
  label .frame0.frame0.label13 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Selector Trigger}
  # bindings
  bind .frame0.frame0.label13 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label13 <Button-1> {toucanCreateDragStart Selectortrigger %X %Y}
  bind .frame0.frame0.label13 <ButtonRelease-1> {toucanCreateDragEnd Selectortrigger %X %Y}
  bind .frame0.frame0.label13 <ButtonRelease-3> {ShowWindow.top9 Selectortrigger default}

  # build widget .frame0.frame0.label14
  label .frame0.frame0.label14 \
    -font {toucan_font} \
    -relief {ridge} \
    -state {disabled} \
    -text {Slider}
  # bindings
  bind .frame0.frame0.label14 <B1-Motion> {# toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label14 <Button-1> {# toucanCreateDragStart Slider %X %Y}
  bind .frame0.frame0.label14 <ButtonRelease-1> {# toucanCreateDragEnd Slider %X %Y}
  bind .frame0.frame0.label14 <ButtonRelease-3> {# ShowWindow.top6 default}

  # build widget .frame0.frame0.label15
  label .frame0.frame0.label15 \
    -font {toucan_font} \
    -relief {ridge} \
    -text {Table}
  # bindings
  bind .frame0.frame0.label15 <B1-Motion> {toucanCreateDragMotion %X %Y}
  bind .frame0.frame0.label15 <Button-1> {toucanCreateDragStart Table %X %Y}
  bind .frame0.frame0.label15 <ButtonRelease-1> {toucanCreateDragEnd Table %X %Y}
  bind .frame0.frame0.label15 <ButtonRelease-3> {ShowWindow.top7 default}

  # build widget .frame0.frame0.message18
  message .frame0.frame0.message18 \
    -aspect {1500} \
    -borderwidth {0} \
    -font {toucan_font} \
    -padx {5} \
    -pady {2} \
    -text {Left-Drag: Add Object
Right-Click: Default Settings}

  # build widget .frame0.button0
  button .frame0.button0 \
    -command {toucanCreateForm} \
    -font {toucan_bold_font} \
    -text {New Form}
  # bindings
  bind .frame0.button0 <ButtonRelease-3> {ShowWindow.top12 default}

  # build widget .frame0.button1
  button .frame0.button1 \
    -command {toucanCreateMenu} \
    -font {toucan_bold_font} \
    -text {New Menu}
  # bindings
  bind .frame0.button1 <Button-3> {%W config -cursor iron_cross
bell}
  bind .frame0.button1 <ButtonRelease-3> {%W config -cursor {}}

  # build widget .frame0.label0
  label .frame0.label0 \
    -borderwidth {0} \
    -font {toucan_font} \
    -image {toucan}

  # build widget .frame0.button2
  button .frame0.button2 \
    -command {toucanCreateString} \
    -font {toucan_bold_font} \
    -text {New String}
  # bindings
  bind .frame0.button2 <Button-3> {%W config -cursor iron_cross
bell}
  bind .frame0.button2 <ButtonRelease-3> {%W config -cursor {}}

  # build widget .frame0.button3
  button .frame0.button3 \
    -command {toucanCreateScript} \
    -font {toucan_bold_font} \
    -text {New Script}
  # bindings
  bind .frame0.button3 <Button-3> {%W config -cursor iron_cross
bell}
  bind .frame0.button3 <ButtonRelease-3> {%W config -cursor {}}

  # build widget .frame1
  frame .frame1 \
    -borderwidth {2} \
    -height {30} \
    -relief {raised} \
    -width {30}

  # build widget .frame1.label0
  label .frame1.label0 \
    -borderwidth {0} \
    -font {toucan_bold_font} \
    -text {Resources}

  # build widget .frame1.canvas0
  canvas .frame1.canvas0 \
    -height {0} \
    -relief {raised} \
    -scrollregion {0 0 100 0} \
    -width {110} \
    -yscrollcommand {.frame1.scrollbar1 set}

  # build widget .frame1.canvas0.frame2
  frame .frame1.canvas0.frame2 \
    -height {30} \
    -width {30}

  # build widget .frame1.scrollbar1
  scrollbar .frame1.scrollbar1 \
    -command {.frame1.canvas0 yview}

  # build widget .menu1
  menu .menu1 \
    -font {toucan_font} \
    -tearoff {0}
  .menu1 add command \
    -label {Dismiss}
  .menu1 add command \
    -label {ID}
  .menu1 add command \
    -label {Properties}
  .menu1 add command \
    -label {Delete}

  # pack master .frame0
  pack configure .frame0.frame0 \
    -fill x
  pack configure .frame0.button0 \
    -fill x
  pack configure .frame0.button1 \
    -fill x
  pack configure .frame0.button2 \
    -fill x
  pack configure .frame0.button3 \
    -fill x
  pack configure .frame0.label0 \
    -expand 1 \
    -fill both

  # pack master .frame0.frame0
  pack configure .frame0.frame0.label0 \
    -fill x
  pack configure .frame0.frame0.label1 \
    -fill x
  pack configure .frame0.frame0.label2 \
    -fill x
  pack configure .frame0.frame0.label3 \
    -fill x
  pack configure .frame0.frame0.label4 \
    -fill x
  pack configure .frame0.frame0.label5 \
    -fill x
  pack configure .frame0.frame0.label6 \
    -fill x
  pack configure .frame0.frame0.label7 \
    -fill x
  pack configure .frame0.frame0.label8 \
    -fill x
  pack configure .frame0.frame0.label9 \
    -fill x
  pack configure .frame0.frame0.label10 \
    -fill x
  pack configure .frame0.frame0.label11 \
    -fill x
  pack configure .frame0.frame0.label12 \
    -fill x
  pack configure .frame0.frame0.label13 \
    -fill x
  pack configure .frame0.frame0.label14 \
    -fill x
  pack configure .frame0.frame0.label15 \
    -fill x
  pack configure .frame0.frame0.message18 \
    -fill x

  # pack master .frame1
  pack configure .frame1.label0 \
    -fill x
  pack configure .frame1.canvas0 \
    -expand 1 \
    -fill both \
    -side left
  pack configure .frame1.scrollbar1 \
    -fill y \
    -side left

  # pack master .
  pack configure .frame0 \
    -fill y \
    -side left
  pack configure .frame1 \
    -fill y \
    -side left
  pack configure .canvas0 \
    -anchor n \
    -expand 1 \
    -fill both \
    -side left

  # build canvas items .canvas0
  set xfTmpTag [.canvas0 create image 0.0 0.0]
  .canvas0 itemconfigure $xfTmpTag \
    -anchor {nw} \
    -image {palmface}
  set xfTmpTag [.canvas0 create window 0.0 -50.0]
  .canvas0 itemconfigure $xfTmpTag \
    -anchor {nw} \
    -tags {ordinates} \
    -window {.canvas0.label0}
  # build canvas items .frame1.canvas0
  set xfTmpTag [.frame1.canvas0 create window 0.0 0.0]
  .frame1.canvas0 itemconfigure $xfTmpTag \
    -anchor {nw} \
    -window {.frame1.canvas0.frame2}



  if {"[info procs XFEdit]" != ""} {
    catch "XFMiscBindWidgetTree ."
    after 2 "catch {XFEditSetShowWindows}"
  }
}


# User defined procedures


# Procedure: tclListValidFlags
proc tclListValidFlags { v} {
    upvar $v cmd

    set len [llength [array names cmd]]
    set i 1
    set separator ""
    set errormsg ""
    foreach cmdsw [lsort [array names cmd]] {
	append errormsg "$separator$cmdsw"
	incr i
	if {$i == $len} {
	    set separator ", or "
	} else {
	    set separator ", "
	}
    }
    return $errormsg
}


# Procedure: tclParseConfigSpec
proc tclParseConfigSpec { w specs flags argList} {
    upvar #0 $w data

    # 1: Put the specs in associative arrays for faster access
    #
    foreach spec $specs {
	if {[llength $spec] < 4} {
	    error "\"spec\" should contain 5 or 4 elements"
	}
	set cmdsw [lindex $spec 0]
	set cmd($cmdsw) ""
	set rname($cmdsw)   [lindex $spec 1]
	set rclass($cmdsw)  [lindex $spec 2]
	set def($cmdsw)     [lindex $spec 3]
	set verproc($cmdsw) [lindex $spec 4]
    }

    if {[llength $argList] & 1} {
	set cmdsw [lindex $argList end]
	if {![info exists cmd($cmdsw)]} {
	    error "bad option \"$cmdsw\": must be [tclListValidFlags cmd]"
	}
	error "value for \"$cmdsw\" missing"
    }

    # 2: set the default values
    #
    foreach cmdsw [array names cmd] {
	set data($cmdsw) $def($cmdsw)
    }

    # 3: parse the argument list
    #
    foreach {cmdsw value} $argList {
	if {![info exists cmd($cmdsw)]} {
	    error "bad option \"$cmdsw\": must be [tclListValidFlags cmd]"
	}
	set data($cmdsw) $value
    }

    # Done!
}


# Procedure: tcl_endOfWord
proc tcl_endOfWord { str start} {
    global tcl_nonwordchars tcl_wordchars
    if {[regexp -indices "$tcl_nonwordchars*$tcl_wordchars+$tcl_nonwordchars"  [string range $str $start end] result]} {
	return [expr {[lindex $zesult 1] + $start}]
    }
    return -1
}


# Procedure: tcl_startOfNextWord
proc tcl_startOfNextWord { str start} {
    global tcl_nonwordchars tcl_wordchars
    if {[regexp -indices "$tcl_wordchars*$tcl_nonwordchars+$tcl_wordchars"  [string range $str $start end] result]} {
	return [expr {[lindex $result 1] + $start}]
    }
    return -1
}


# Procedure: tcl_startOfPreviousWord
proc tcl_startOfPreviousWord { str start} {
    global tcl_nonwordchars tcl_wordchars
    if {[string equal $start end]} {
	set start [string length $str]
    }
    if {[regexp -indices  "$tcl_nonwordchars*($tcl_wordchars+)$tcl_nonwordchars*\$"  [string range $str 0 [expr {$start - 1}]] result word]} {
	return [lindex $word 0]
    }
    return -1
}


# Procedure: tcl_wordBreakAfter
proc tcl_wordBreakAfter { str start} {
    global tcl_nonwordchars tcl_wordchars
    set str [string range $str $start end]
    if {[regexp -indices "$tcl_wordchars$tcl_nonwordchars|$tcl_nonwordchars$tcl_wordchars" $str result]} {
	return [expr {[lindex $result 1] + $start}]
    }
    return -1
}


# Procedure: tcl_wordBreakBefore
proc tcl_wordBreakBefore { str start} {
    global tcl_nonwordchars tcl_wordchars
    if {[string equal $start end]} {
	set start [string length $str]
    }
    if {[regexp -indices "^.*($tcl_wordchars$tcl_nonwordchars|$tcl_nonwordchars$tcl_wordchars)" [string range $str 0 $start] result]} {
	return [lindex $result 1]
    }
    return -1
}


# Procedure: toucanAcceptProperties
proc toucanAcceptProperties { topX} {
  global toucanFormObject

  set title [wm title $topX]
  if {[lindex $title 0] == {Default}} {
    set objectType [lindex $title 1]
    global toucanFormObject$objectType
    foreach {ndx val} [array get toucanFormObject$objectType] {
      set toucanFormObject${objectType}($ndx) $toucanFormObject($ndx)
    }
  } else {
    toucanApplyObjectProperties object$toucanFormObject(ID)
  }
}


# Procedure: toucanAddPulldown
proc toucanAddPulldown {} {
  set pdID [.top13.frame0.frame0.frame3.label7 cget -text] 
  set orderList [pack slaves .top13.frame0.frame1]
  if {[set pdCount [llength $orderList]] == 6} {
    tk_messageBox -icon error -type ok -parent . -title {Add Pulldown} -message {No more than six pulldowns can be placed on one menu!}
    return
  }
  set pdName [.top13.frame0.frame0.frame0.entry7 get]
  if {$pdName == {}} {
    tk_messageBox -icon error -type ok -parent . -title {Add Pulldown} -message {Pulldown needs a name!}
    return
  }
  set pdID [expr $pdID + 15 * $pdCount]
  frame .top13.frame0.frame1.pulldown$pdID -highlightthickness 0 -borderwidth 0 -relief flat
  pack .top13.frame0.frame1.pulldown$pdID -side left -anchor n
  label .top13.frame0.frame1.pulldown$pdID.label26 -highlightthickness 0 -relief flat -bg #c3c3c3 -font {toucan_font} -text $pdName
  frame .top13.frame0.frame1.pulldown$pdID.frame0 -highlightthickness 0 -borderwidth 2 -relief solid
  pack  .top13.frame0.frame1.pulldown$pdID.label26 -side top -anchor w
  pack  .top13.frame0.frame1.pulldown$pdID.frame0 -side top
  listbox .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 -highlightthickness 0 -borderwidth 0 -relief flat -height 1 -width 5 -font {toucan_font}
  bind .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 <ButtonRelease-1> {toucanInitMenuControls %W}
  .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 insert 0 <new>
  listbox .top13.frame0.frame1.pulldown$pdID.frame0.listbox2 -highlightthickness 0 -borderwidth 0 -relief flat -height 1 -width 1 -font {toucan_font}
  .top13.frame0.frame1.pulldown$pdID.frame0.listbox2 insert 0 .
  pack .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 .top13.frame0.frame1.pulldown$pdID.frame0.listbox2 -side left
  pack .top13.frame0.frame1.pulldown$pdID -after [lindex $orderList end] -side left -anchor n
  .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 selection set 0
  event generate .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 <ButtonRelease-1>
}


# Procedure: toucanAdjustDragEnd
proc toucanAdjustDragEnd { parent objectID} {
  foreach {posX posY} [$parent coords $objectID] {}
  $parent coords $objectID [expr $posX - (int($posX) % 2)] [expr $posY - (int($posY) % 2)]
  .canvas0 coords ordinates 0 -50
}


# Procedure: toucanAdjustDragMotion
proc toucanAdjustDragMotion { parent objectID X Y} {
  global toucanDisplay

  set moveX [expr $X - $toucanDisplay(oldX)]
  set moveY [expr $Y - $toucanDisplay(oldY)]
  set toucanDisplay(oldX) $X
  set toucanDisplay(oldY) $Y
  regsub -all {[.][0-9]+} [$parent coords $objectID] {} coords
  foreach {left top} $coords {}
  set left [expr int($left)]
  set top [expr int($top)]
  set right [expr $left + [winfo width [$parent itemcget $objectID -window]] - 1]
  set bot [expr $top + [winfo height [$parent itemcget $objectID -window]] - 1]
  switch -regexp $objectID {
    form {
      if {[expr $left + $moveX] <= 26} {
        set moveX [expr 26 - $left]
      } elseif {[expr $right + $moveX] >= 345} {
        set moveX [expr 345 - $right]
      }
      if {[expr $top + $moveY] <= 26} {
        set moveY [expr 26 - $top]
      } elseif {[expr $bot + $moveY] >= 345} {
        set moveY [expr 345 - $bot]
      }
      set left [expr ($left - 26) / 2]
      set top [expr ($top - 26) / 2]
    }
    default {
      set maxX [expr [$parent cget -width] - 1]
      set maxY [expr [$parent cget -height] - 1]
      if {[expr $left + $moveX] <= 0} {
        set moveX [expr 0 - $left]
      } elseif {[expr $right + $moveX] >= $maxX} {
        set moveX [expr $maxX - $right]
      }
      if {[expr $top + $moveY] <= 0} {
        set moveY [expr 0 - $top]
      } elseif {[expr $bot + $moveY] >= $maxY} {
        set moveY [expr $maxY - $bot]
      }
      set left [expr $left / 2]
      set top [expr $top / 2]
    }
  }
  $parent move $objectID $moveX $moveY
  .canvas0.label0 config -text "$left, $top"
}


# Procedure: toucanAdjustDragStart
proc toucanAdjustDragStart { parent objectID X Y} {
  global toucanDisplay

  set toucanDisplay(oldX) $X
  set toucanDisplay(oldY) $Y
  .canvas0 coords ordinates 0 0
  regsub -all {[.][0-9]+} [$parent coords $objectID] {} coords
  foreach {left top} $coords {}
  set left [expr int($left)]
  set top [expr int($top)]
  switch -regexp $objectID {
    form {
      set left [expr ($left - 26) / 2]
      set top [expr ($top - 26) / 2]
    }
    default {
      set left [expr $left / 2]
      set top [expr $top / 2]
    }
  }
  .canvas0.label0 config -text "$left, $top"
}


# Procedure: toucanAdjustEditors
proc toucanAdjustEditors {} {
  global toucanEditorPreferences

  foreach w [info commands {.canvas0.string17[0-9][0-9]}] {
    $w.f2.text config -font $toucanEditorPreferences(font) -fg $toucanEditorPreferences(fg) -bg $toucanEditorPreferences(bg) -selectbackground $toucanEditorPreferences(bgSelect) -insertbackground $toucanEditorPreferences(bgInsert)
    ctext::setBlinkOptions $w.f2.text $toucanEditorPreferences(blinkColor) $toucanEditorPreferences(blinkRange) $toucanEditorPreferences(blinkTime)
  }

  foreach w [info commands {.canvas0.string99[0-9][0-9]}] {
    $w.f2.text config -font $toucanEditorPreferences(font) -fg $toucanEditorPreferences(fg) -bg $toucanEditorPreferences(bg) -selectbackground $toucanEditorPreferences(bgSelect) -insertbackground $toucanEditorPreferences(bgInsert)
    toucanEditorColors $w.f2.text toucanEditorPreferences
    ctext::setBlinkOptions $w.f2.text $toucanEditorPreferences(blinkColor) $toucanEditorPreferences(blinkRange) $toucanEditorPreferences(blinkTime)
  }
}


# Procedure: toucanApplyBitmapData
proc toucanApplyBitmapData {} {
  global toucanTop0 toucanBitmapType

  # remove all existing bitmap definitions
  set bidList [lsort -integer [array names toucanBitmapType {[0-9][0-9][0-9][0-9]}]]
  foreach bid $bidList {
   unset toucanBitmapType($bid)
  }

  # restore bitmap elements and remember those not restored
  set nidList [lsort -integer [array names toucanTop0 {[0-9][0-9][0-9][0-9]}]]
  foreach nid $nidList {
    set toucanBitmapType($nid) $toucanTop0($nid)
    switch -exact [lindex $toucanTop0($nid) 0] {
      BITMAP {
        set paletteSpec 4
      }
      BITMAPGRAY {
        set paletteSpec 4
      }
      BITMAPGRAY16 {
        set paletteSpec 16
      }
      BITMAPCOLOR {
        set paletteSpec {7/7/4}
      }
      BITMAPCOLOR16 {
        set paletteSpec {3/3/2}
      }
      BITMAPCOLOR16K {
        set paletteSpec {7/7/4}
      }
    }
    imgTemp configure -palette $paletteSpec
    imgTemp read [lindex $toucanTop0($nid) 2] -shrink -format BMP
    if {[set ndx [lsearch -exact $bidList $nid]] != -1} {
      img$nid config -palette $paletteSpec
      set bidList [lreplace $bidList $ndx $ndx]
    } else {
      image create photo img$nid -palette $paletteSpec
    }
    img$nid copy imgTemp -shrink -zoom 2 2
  }

  foreach bid $bidList {
    image delete img$bid
  }

  foreach formW [info commands {.canvas0.form[0-9][0-9][0-9][0-9]}] {
    foreach formItem [$formW find withtag all] {
      set tagOrigList [$formW gettags $formItem]
      if {[lsearch -regexp $tagOrigList {object[0-9][0-9][0-9][0-9]}] == -1} { continue }
      set optNdx [lsearch -regexp $tagOrigList {^objectOptions}]
      set optionsOrigList [lindex $tagOrigList $optNdx]
      set objectW [$formW itemcget $formItem -window]
      regexp {^([^0-9]+)([0-9]+)$}  [lindex [split $objectW .] end] junk type id
      if {$type != {slider}} {
        if {[lsearch -exact $bidList [string trimleft [$objectW cget -image] img]] != -1} {
          $objectW config -image {}
        }
        if {$type != {formbitmap}} {
          set sbidNdx [expr [lsearch -exact $optionsOrigList {selectedbitmapID}] + 1]
          if {[lsearch -exact $bidList [lindex $optionsOrigList $sbidNdx]] != -1} {
            $formW dtag $formItem $optionsOrigList
            set optionsOrigList [lreplace $optionsOrigList $sbidNdx $sbidNdx {None}]
            $formW addtag $optionsOrigList withtag $formItem
          }
        }
      } else {
        # process slider options
      }
    }
  }
}


# Procedure: toucanApplyObjectProperties
proc toucanApplyObjectProperties { objectID} {
  global toucanPropDialog toucanObjectVariable

  regexp {^object(([0-9][0-9])[0-9][0-9])$} $objectID junk id formCent
  set formID form${formCent}00
  append parent .canvas0. $formID
  set w [$parent itemcget $objectID -window]
  regexp {[.]([^0-9.]+)[0-9]+$} $w junk type
  # check for presence of group or object variable
  if {($type == {checkbox}) || ($type == {pushbutton})} {
    set delVar [$w cget -variable]
  } else {
    set delVar {}
  }
  set type [string toupper $type 0]
  global toucanFormObject toucanFormObject$type
  foreach ndx [array names toucanFormObject$type] {
    lappend propList $ndx $toucanFormObject($ndx)
  }
  # remove the old widget(s) to make room for the updated one(s)
  destroy $w
  # determine if group or object variable needs to be deleted as well
  if {$delVar != {}} {
    if {[info exists toucanObjectVariable($id)]} {
      unset toucanObjectVariable($id)
    }
    if {[regexp {^toucanGroupVariable} $delVar]} {
      toucanRemoveGroupVariable $delVar
    }
  }
  # create the appropriate widget(s) for the form object and get back the object properties that get embedded in the tag
  set objectTags [eval toucanCreateWidget .canvas0.$formID $type $id $propList]
  # complete the structuring of the tags
  set objectTags [list object$id [concat objectOptions $objectTags]]
  # determine appropriate window item width
  if {[regexp {width ([0-9]+)} $propList junk objectWidth]} {
    set objectWidth [expr 2 * $objectWidth]
  } else {
    set objectWidth 0
  }
  # determine appropriate window item height
  if {[regexp {height ([0-9]+)} $propList junk objectHeight]} {
    set objectHeight [expr 2 * $objectHeight]
  } else {
    set objectHeight 0
  }
  # update the canvas window item that display the widgets and holds the tags
  .canvas0.$formID itemconfigure object$id -tags $objectTags -window $w -anchor nw -width $objectWidth -height $objectHeight
  # append widget name so bindings go to the appropriate widget
  set cmd [list toucanInitObjectMenu .canvas0.$formID object$id $toucanPropDialog($type) $type %X %Y]
  # add bindings to appropriate widget
  toucanCreateBindings $w $formID object$id $cmd
  return
  bind $w <Button-3> [list toucanAdjustDragStart .canvas0.$formID object$id %X %Y]
  bind $w <B3-Motion> [list toucanAdjustDragMotion .canvas0.$formID object$id %X %Y]
  bind $w <B3-ButtonRelease> [list toucanAdjustDragEnd .canvas0.$formID object$id]
  bind $w <Double-Button-3> $cmd
  foreach c [winfo children $w] {
    bind $c <Button-3> [list toucanAdjustDragStart .canvas0.$formID object$id %X %Y]
    bind $c <B3-Motion> [list toucanAdjustDragMotion .canvas0.$formID object$id %X %Y]
    bind $c <B3-ButtonRelease> [list toucanAdjustDragEnd .canvas0.$formID object$id]
    bind $c <Double-Button-3> $cmd
  }
}


# Procedure: toucanBuildFont
proc toucanBuildFont { preferences} {
  upvar #0 $preferences prefs

  if {$prefs(bold)} {
    set prefs(font) [list $prefs(family) $prefs(size) bold]
  } else {
    set prefs(font) [list $prefs(family) $prefs(size)]
  }
}


# Procedure: toucanBuildTagAndOptionLists
proc toucanBuildTagAndOptionLists { tl ol args} {
  global toucanFile
  upvar $tl tagList $ol optionList

  # guarantee at least one option in the list
  lappend optionList -highlightthickness 0
  foreach {ndx attrib} $args {
    switch -exact $ndx {
      ID {
      }
      align -
      autoshift -
      backgroundID -
      checked -
      colWidth -
      columnWidths -
      columns -
      dynamicSize -
      editing -
      graphical -
      group -
      lines -
      listID -
      maxChars -
      numeric -
      pagesize -
      rows -
      scrollbar -
      max -
      min -
      selectedbitmapID -
      thumbID -
      underline -
      usability -
      value -
      visibleItems {
        lappend tagList $ndx $attrib
      }
      anchor {
        if {$attrib == {LEFTANCHOR}} {
          lappend optionList -anchor w
        } else {
          lappend optionList -anchor e
        }
      }
      bitmap {
        if {$attrib != {None}} {
          lappend optionList -image img$attrib
        } else {
          lappend optionList -image {}
        }
      }
      bitmapID {
        if {$attrib != {None}} {
          lappend optionList -image img$attrib
        } else {
          lappend optionList -image {}
        }
      }
      defaultBtnID {
      }
      disabled {
        if {[regexp {visibleItems} $args]} {
          lappend tagList $ndx $attrib
        } else {
          if {$attrib == {DISABLED}} {
            lappend optionList -state disabled
          }
        }
      }
      editingold {
        if {$attrib == {NONEDITABLE}} {
          lappend optionList -state disabled
        }
      }
      feedback {
        if {$attrib == {FEEDBACK}} {
          lappend optionList -showvalue 1
        } else {
          lappend optionList -showvalue 0
        }
       }
      font {
        switch -exact $attrib {
          None {
            lappend optionList -font noneFont
          }
          1 {
            lappend optionList -font boldFont
          }
          2 {
            lappend optionList -font largeFont
          }
          3 -
          4 -
          5 -
          6 {
           # note: these fonts use numerical character representations
            lappend optionList -font symbolFont$attrib
          }
          7 {
            lappend optionList -font largeBoldFont
          }
          0 -
          default {
            # the default for undefined fonts
            lappend optionList -font stdFont
          }
        }
        if {[set ndx [lsearch -exact $args label]] != -1} {
          incr ndx
          set bitmapName [file join $toucanFile(libDir) fonts "font${attrib}-[lindex $args $ndx].xbm"]
          if {[file exists $bitmapName]} {
            lappend optionList -bitmap @$bitmapName
          } else {
            lappend optionList -bitmap {}
          }
        }
      }
      framing {
        if {$attrib == {FRAME}} {
          lappend optionList -relief solid -borderwidth 2
        } elseif {$attrib == {BOLDFRAME}} {
          lappend optionList -relief solid -borderwidth 4
        } elseif {$attrib == {NOFRAME}} {
          lappend optionList -relief flat
        }
      }
      height {
      }
      helpID {
      }
      items {
        lappend optionList -items $attrib
      }
      label {
        lappend optionList -text $attrib
      }
      menuID {
      }
      modal {
      }
      saving {
      }
      title {
      }
      vertical {
        if {$attrib == {VERTICAL}} {
          lappend optionList -orient vertical
        } else {
           lappend optionList -orient horizontal
        }
     }
      width {
      }
    }
  }
}


# Procedure: toucanCreateBindings
proc toucanCreateBindings { w formID objectID cmd} {
  bind $w <Button-3> [list toucanAdjustDragStart .canvas0.$formID $objectID %X %Y]
  bind $w <B3-Motion> [list toucanAdjustDragMotion .canvas0.$formID $objectID %X %Y]
  bind $w <B3-ButtonRelease> [list toucanAdjustDragEnd .canvas0.$formID $objectID]
  bind $w <Double-Button-3> $cmd
  foreach c [winfo children $w] {
    toucanCreateBindings $c $formID $objectID $cmd
  }
}


# Procedure: toucanCreateBitmapElement
proc toucanCreateBitmapElement {} {
  global toucanTop0

  if {[set path [tk_getOpenFile -parent . -defaultextension .bmp -filetypes {{{BMP files} {.bmp}}} -title {Bitmap select}]] == {}} {
    return
  }

  set bidList [array names toucanTop0 {[0-9][0-9][0-9][0-9]}]
  set bid 1600
  while {[lsearch -exact $bidList $bid] != -1} {
    incr bid
    if {$bid == 1700} {
      tk_messageBox -icon error -type ok -parent . -title {Bitmap creation aborted} -message {Bitmap ID supply has been exhausted!}
      return
    }
  }

  set toucanTop0($bid) [list $toucanTop0(type) $toucanTop0(comp) $path]
  lappend toucanTop0(list) [concat $bid : $path]
}


# Procedure: toucanCreateDragEnd
proc toucanCreateDragEnd { type X Y} {
  global toucanFormObject$type

  wm withdraw .dnd
  destroy [winfo children .dnd.c]
  .dnd.c delete all
  set w [winfo containing $X $Y]
  if {[regexp {(form[0-9]+)$} $w junk id]} {
    set x [expr $X - [winfo rootx $w]]
    set y [expr $Y - [winfo rooty $w]]
    eval toucanCreateObject $id $type $x $y [array get toucanFormObject$type]
  } else {
    bell
  }
}


# Procedure: toucanCreateDragMotion
proc toucanCreateDragMotion { X Y} {
  wm geometry .dnd +$X+$Y
}


# Procedure: toucanCreateDragStart
proc toucanCreateDragStart { type X Y} {
  global toucanFormObject$type

  eval toucanCreateWidget .dnd.c $type DND [array get toucanFormObject$type]
  if {[array names toucanFormObject$type width] != {}} {
    if {[set toucanFormObject${type}(width)] == 0} {
      set objectWidth [winfo reqwidth .dnd.c.[string tolower $type]DND]
    } else {
      set objectWidth [expr 2 * [set toucanFormObject${type}(width)]]
    }
    #set objectWidth [expr 2 * [set toucanFormObject${type}(width)]]
  } else {
    switch $type {
      Label -
      Formbitmap -
      Graffitistateindicator {
        set objectWidth [winfo reqwidth .dnd.c.[string tolower $type]DND]
      }
      default {
        set objectWidth 0
      }
    }
  }
  # determine appropriate window item height
  if {[array names toucanFormObject$type height] != {}} {
    if {[set toucanFormObject${type}(height)] == 0} {
      set objectHeight [winfo reqheight .dnd.c.[string tolower $type]DND]
    } else {
      set objectHeight [expr 2 * [set toucanFormObject${type}(height)]]
    }
  } else {
    switch $type {
      Label -
      Formbitmap -
      Graffitistateindicator {
        set objectHeight [winfo reqheight .dnd.c.[string tolower $type]DND]
      }
      default {
        set objectHeight 0
      }
    }
  }
  .dnd.c create window 0 0 -anchor nw -window [winfo children .dnd.c] -width $objectWidth -height $objectHeight
  .dnd.c configure -width $objectWidth -height $objectHeight
  wm geometry .dnd +$X+$Y
  wm deiconify .dnd
  raise .dnd
}


# Procedure: toucanCreateEditor
proc toucanCreateEditor { id type content} {
  global toucanStringVariable toucanEditorPreferences toucanDisplay

  set elementID string$id
  # main frame of editor
  frame .canvas0.$elementID
  # frame to hold embedded/file string type controls
  frame .canvas0.$elementID.f1
  # "embedded type" radiobutton
  radiobutton .canvas0.$elementID.f1.embed -font toucan_bold_font -text Embedded -value embedded -variable toucanStringVariable($id) -command {
    bind .canvas0.$toucanDisplay(formShown).f2.text <<Modified>> {}
    .canvas0.$toucanDisplay(formShown).f1.label config -state disabled
    .canvas0.$toucanDisplay(formShown).f1.filename config -state disabled -fg #c0c0c0
    .canvas0.$toucanDisplay(formShown).f1.browse config -state disabled
    .menu0.menu0 entryconfig {Load File} -state disabled
    .menu0.menu0 entryconfig {Save File} -state disabled}
  # "file type" radiobutton
  radiobutton .canvas0.$elementID.f1.file -font toucan_bold_font -text File -value file -variable toucanStringVariable($id) -command {
    bind .canvas0.$toucanDisplay(formShown).f2.text <<Modified>> {toucanModifiedEvent %W}
    .canvas0.$toucanDisplay(formShown).f1.label config -state normal
    .canvas0.$toucanDisplay(formShown).f1.filename config -state normal -fg Black
    .canvas0.$toucanDisplay(formShown).f1.browse config -state normal
    .menu0.menu0 entryconfig {Load File} -state normal
    if {[.canvas0.$toucanDisplay(formShown).f2.text edit modified]} {
      .menu0.menu0 entryconfig {Save File} -state normal
    } else {
      .menu0.menu0 entryconfig {Save File} -state disabled
    }}
  # label, entry, and file browse button for selected file
  label .canvas0.$elementID.f1.label -font toucan_bold_font -state disabled -text {File name:}
  entry .canvas0.$elementID.f1.filename -font toucan_bold_font -foreground #c0c0c0 -width 0 -state disabled
  button .canvas0.$elementID.f1.browse -font toucan_bold_font -padx 0 -pady 0 -state disabled -text Browse... -command {
    if {[set filename [tk_getOpenFile -parent . -title {String file selection} -initialdir $toucanProject(path) -filetypes {{{Text Files} {.txt}} {{Tcl Scripts} {.tcl}} {{Palm Tcl Scripts} {.ptcl}} {{All files} {*}}}]] != {}} {
      .canvas0.$toucanDisplay(formShown).f1.filename delete 0 end
      .canvas0.$toucanDisplay(formShown).f1.filename insert 0 $filename
    }
    unset filename}
  # editor close button
  button .canvas0.$elementID.f1.close -font toucan_bold_font -padx 0 -pady 0 -text X -command {
    if {[.canvas0.$toucanDisplay(formShown).f2.text edit modified] && ($toucanStringVariable([string trimleft $toucanDisplay(formShown) string]) == {file})} {
      if {[tk_messageBox -icon warning -type yesno -parent . -title {Save String resource} -message {Do you want to save this file?}] == {yes}} {
        toucanSaveTextFile
      }
    }
    if {[tk_messageBox -icon warning -type okcancel -parent . -title {Delete String resource} -message {Are you sure you want to delete this resource object?}] == {ok}} {
      .canvas0 delete $toucanDisplay(formShown)
      destroy .canvas0.$toucanDisplay(formShown)
      destroy .frame1.canvas0.frame2.$toucanDisplay(formShown)
      unset toucanStringVariable([string trimleft $toucanDisplay(formShown) string])
      .menu0 entryconfig Edit -state disabled
      .menu0.menu0 entryconfig {Load File} -state disabled
      .menu0.menu0 entryconfig {Save File} -state disabled
    }}
  # frame to hold editor window and scrollbar
  frame .canvas0.$elementID.f2
  ctext .canvas0.$elementID.f2.text -font $toucanEditorPreferences(font) -fg $toucanEditorPreferences(fg) -bg $toucanEditorPreferences(bg)  -selectbackground $toucanEditorPreferences(bgSelect) -insertbackground $toucanEditorPreferences(bgInsert) -width 0 -height 0 -yscrollcommand [list .canvas0.$elementID.f2.scrollbar set]
  ctext::setBlinkOptions .canvas0.$elementID.f2.text $toucanEditorPreferences(blinkColor) $toucanEditorPreferences(blinkRange) $toucanEditorPreferences(blinkTime)
  scrollbar .canvas0.$elementID.f2.scrollbar -command [list .canvas0.$elementID.f2.text yview]

  pack configure .canvas0.$elementID.f1.embed -side left
  pack configure .canvas0.$elementID.f1.file -side left
  pack configure .canvas0.$elementID.f1.label -side left
  pack configure .canvas0.$elementID.f1.filename -expand 1 -fill x -side left
  pack configure .canvas0.$elementID.f1.browse -side left
  pack configure .canvas0.$elementID.f1.close

  pack configure .canvas0.$elementID.f2.text -expand 1 -fill both -side left
  pack configure .canvas0.$elementID.f2.scrollbar -fill y -side left

  # pack master .canvas0.frame0
  pack configure .canvas0.$elementID.f1 -fill x
  pack configure .canvas0.$elementID.f2 -expand 1 -fill both

  bind .canvas0.$elementID.f2.text.t <Control-x> {.menu0.menu2 invoke Cut}
  bind .canvas0.$elementID.f2.text.t <Control-c> {.menu0.menu2 invoke Copy}
  bind .canvas0.$elementID.f2.text.t <Control-v> {.menu0.menu2 invoke Paste}
  if {$type == "file"} {
    .canvas0.$elementID.f1.file invoke
    .canvas0.$elementID.f1.filename insert end $content
  } else {
    .canvas0.$elementID.f1.embed invoke
    .canvas0.$elementID.f2.text insert end $content
  }

  .canvas0.$elementID.f2.text edit modified 0
}


# Procedure: toucanCreateForm
proc toucanCreateForm { {id "2000"} args} {
  global toucanDisplay

  # pick first available acceptable form ID
  set objList [winfo children .canvas0]
  while {[lsearch -regexp $objList "\[.\]canvas0\[.\]form$id"] != -1} {
    incr id 100
    if {$id == 6000} {
      tk_messageBox -icon error -type ok -parent . -title {Form creation aborted} -message {Form ID supply has been exhausted!}
      return 0
    }
  }

  if {[llength $args] == 0} {
    global toucanFormObjectForm
  } else {
    array set toucanFormObjectForm $args
  }

  foreach ndx {modal saving helpID defaultBtnID menuID} {
    lappend formTags $ndx $toucanFormObjectForm($ndx)
  }
  set formTags [list form$id [concat formOptions $formTags]]
  set options {-highlightthickness 0 -bg #d9d9d9}
  if {$toucanFormObjectForm(framing) == {FRAME}} {
    lappend options -relief solid -borderwidth 2
  } else {
    lappend options -relief flat -borderwidth 0
  }
  if {$toucanFormObjectForm(usability) == {USABLE}} {
    lappend options -state normal
  } else {
    lappend options -state disabled
  }
  eval canvas .canvas0.form$id $options -width [expr 2 * $toucanFormObjectForm(width)] -height [expr 2 * $toucanFormObjectForm(height)]
  .canvas0 create window 26 26 -tags $formTags -window .canvas0.form$id -anchor nw -width [expr 2 * $toucanFormObjectForm(width)] -height [expr 2 * $toucanFormObjectForm(height)]
  label .canvas0.form${id}.title -font boldFont -bg black -fg white -highlightthickness 0 -relief flat -text $toucanFormObjectForm(title) -padx 4 -pady 3
  .canvas0.form${id} create window 0 0 -tags title -window .canvas0.form${id}.title -anchor nw
  label .canvas0.form${id}.help -highlightthickness 0 -borderwidth 0 -relief flat -image help
  .canvas0.form${id} create window -4 6 -tags help -window .canvas0.form${id}.help -anchor ne
  .canvas0.form${id} create line 0 29 320 29 -tags titleline -fill black -width 4
  if {$toucanFormObjectForm(modal) == {MODAL}} {
    .canvas0.form${id} itemconfig title -width [expr 2 * $toucanFormObjectForm(width)]
    if {$toucanFormObjectForm(helpID) != {None}} {
      .canvas0.form${id} move help [expr 2 * $toucanFormObjectForm(width)] 0
    }
  }
  bind .canvas0.form${id} <Button-3> [list toucanAdjustDragStart .canvas0 form$id %X %Y]
  bind .canvas0.form${id} <B3-Motion> [list toucanAdjustDragMotion .canvas0 form$id %X %Y]
  bind .canvas0.form${id} <B3-ButtonRelease> [list toucanAdjustDragEnd .canvas0 form$id]
  bind .canvas0.form${id} <Double-Button-3> [list toucanInitObjectMenu .canvas0 form$id top12 Form %X %Y]
  global toucan
  radiobutton .frame1.canvas0.frame2.form$id -font toucan_bold_font -anchor w -text "Form $id" -variable toucanDisplay(formShown) -value form$id -command {
    if {[set editForm [.canvas0 find withtag edit]] != {}} {
      .canvas0 itemconfig $editForm -state hidden
      catch ".canvas0 itemconfig $editForm -state forcehidden"
      update
      .canvas0 itemconfig $editForm -state hidden
      .canvas0 dtag $editForm edit
    }
    unset editForm
    .canvas0 itemconfig $toucanDisplay(formShown) -state normal
    .canvas0 addtag edit withtag $toucanDisplay(formShown)
    .menu0 entryconfig Edit -state disabled
    .menu0.menu0 entryconfig {Load File} -state disabled
    .menu0.menu0 entryconfig {Save File} -state disabled
  }

  pack .frame1.canvas0.frame2.form$id -anchor w
  if {[set editForm [.canvas0 find withtag edit]] != {}} {
    .canvas0 itemconfig $toucanDisplay(formShown)  -state hidden
    catch ".canvas0 itemconfig $toucanDisplay(formShown)  -state forcehidden"
    update
    .canvas0 itemconfig $toucanDisplay(formShown)  -state hidden
    .canvas0 dtag $toucanDisplay(formShown) edit
  }
  .canvas0 addtag edit withtag form$id
  set toucanDisplay(formShown) form$id
  .menu0 entryconfig Edit -state disabled
  .menu0.menu0 entryconfig {Load File} -state disabled
  .menu0.menu0 entryconfig {Save File} -state disabled
  .frame1.canvas0 configure -scrollregion [list 0 0 100 [winfo reqheight .frame1.canvas0.frame2]]
}


# Procedure: toucanCreateGroupVariable
proc toucanCreateGroupVariable {} {
  global toucanGroupVariable

  # pick first available acceptable group variable ID
  set gid 1500
  while {[info exists toucanGroupVariable($gid) ]} {
    incr gid
    if {$gid == 1600} {
      tk_messageBox -icon error -type ok -parent . -title {Group ID creation aborted} -message {Group ID supply has been exhausted!}
      set gid None
      break
    }
  }

  return $gid
}


# Procedure: toucanCreateMenu
proc toucanCreateMenu { {id "6000"}} {
  global toucanDisplay

  # pick first available acceptable menu ID
  set objList [winfo children .canvas0]
  while {[lsearch -regexp $objList "\[.\]canvas0\[.\]menu$id"] != -1} {
    incr id 100
    if {$id == 10000} {
      tk_messageBox -icon error -type ok -parent . -title {Menu creation aborted} -message {Menu ID supply has been exhausted!}
      return 0
    }
  }

  set menuTags menu$id
  frame .canvas0.menu$id -width 320 -height 25 -highlightthickness 0 -bg #d9d9d9 -borderwidth 2 -relief solid
  toucanCreateMenuContent $id [list $id New {<new> {}}]
  .canvas0 create window 26 26 -tags $menuTags -window .canvas0.menu$id -anchor nw -width 320 -height 25
  bind .canvas0.menu$id <Double-Button-3> [list toucanInitObjectMenu .canvas0 menu$id top13 Menu %X %Y]
  global toucan
  radiobutton .frame1.canvas0.frame2.menu$id -font toucan_bold_font -anchor w -text "Menu $id" -variable toucanDisplay(formShown) -value menu$id -command {
    if {[set editForm [.canvas0 find withtag edit]] != {}} {
      .canvas0 itemconfig $editForm -state hidden
      catch ".canvas0 itemconfig $editForm -state forcehidden"
      update
      .canvas0 itemconfig $editForm -state hidden
      .canvas0 dtag $editForm edit
    }
    unset editForm
    .canvas0 itemconfig $toucanDisplay(formShown) -state normal
    .canvas0 addtag edit withtag $toucanDisplay(formShown)
    .menu0 entryconfig Edit -state disabled
    .menu0.menu0 entryconfig {Load File} -state disabled
    .menu0.menu0 entryconfig {Save File} -state disabled
  }

  pack .frame1.canvas0.frame2.menu$id -anchor w
  if {[set editForm [.canvas0 find withtag edit]] != {}} {
    .canvas0 itemconfig $toucanDisplay(formShown) -state hidden
    catch ".canvas0 itemconfig $toucanDisplay(formShown) -state forcehidden"
    update
    .canvas0 itemconfig $toucanDisplay(formShown) -state hidden
    .canvas0 dtag $toucanDisplay(formShown) edit
  }
  .canvas0 addtag edit withtag menu$id
  set toucanDisplay(formShown) menu$id
  .menu0 entryconfig Edit -state disabled
  .menu0.menu0 entryconfig {Load File} -state disabled
  .menu0.menu0 entryconfig {Save File} -state disabled
  .frame1.canvas0 configure -scrollregion [list 0 0 100 [winfo reqheight .frame1.canvas0.frame2]]
}


# Procedure: toucanCreateMenuContent
proc toucanCreateMenuContent { id args} {
  eval destroy [winfo children .canvas0.menu$id]
  # iterate over each pulldown
  foreach pdList $args {
    # pick out the ID of the pulldown
    set pdID [lindex $pdList 0]
    # make the frame to hold the pulldown
    menubutton .canvas0.menu$id.pulldown$pdID -menu .canvas0.menu$id.pulldown$pdID.m -highlightthickness 0 -bg #d9d9d9 -relief flat -padx 4 -pady 0 -font boldFont -text [lindex $pdList 1]
    bind .canvas0.menu$id.pulldown$pdID <Double-Button-3> [list toucanInitObjectMenu .canvas0 menu$id top13 Menu %X %Y]
    pack .canvas0.menu$id.pulldown$pdID -side left
    # make the pulldown menu
    menu .canvas0.menu$id.pulldown$pdID.m -relief solid -tearoff 0 -font boldFont
    # iterate for each pulldown item
    foreach menuItem [lrange $pdList 2 end] {
      # separate handling for separator menu items
      if {[llength $menuItem] == 2} {
        # output label of the menu item and accelerator indicator
        .canvas0.menu$id.pulldown$pdID.m add command -background #d9d9d9 -label [lindex $menuItem 0] -accelerator [lindex $menuItem 1] -font boldFont -hidemargin 1
      } else {
        # create separator designator
        .canvas0.menu$id.pulldown$pdID.m add separator -background #d9d9d9
      }
    }
  }
  update idletasks
}


# Procedure: toucanCreateMenuDialog
proc toucanCreateMenuDialog { id args} {
  eval destroy [winfo children .top13.frame0.frame1]
  .top13.frame0.frame0.frame3.label7 config -text $id
  # iterate over each pulldown
  foreach pdList $args {
    # pick out the ID of the pulldown
    set pdID [lindex $pdList 0]
    # make the frame to hold the pulldown
    frame .top13.frame0.frame1.pulldown$pdID -highlightthickness 0
    pack .top13.frame0.frame1.pulldown$pdID -side left -anchor nw
    # make the pulldown designator
    label .top13.frame0.frame1.pulldown$pdID.label26 -highlightthickness 0 -relief flat -bg #c3c3c3 -font {toucan_font} -text [lindex $pdList 1]
    pack .top13.frame0.frame1.pulldown$pdID.label26 -side top -anchor w
    # make the pulldown menu frame
    frame .top13.frame0.frame1.pulldown$pdID.frame0 -highlightthickness 0 -borderwidth 2 -relief solid
    pack .top13.frame0.frame1.pulldown$pdID.frame0
    # build the pulldown listboxes
    listbox .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 -highlightthickness 0 -borderwidth 0 -relief flat -selectmode single -font {toucan_font}
    listbox .top13.frame0.frame1.pulldown$pdID.frame0.listbox2 -highlightthickness 0 -borderwidth 0 -relief flat -width 1 -selectmode single -font {toucan_font}
    bind .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 <ButtonRelease-1> {toucanInitMenuControls %W}
    pack .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 .top13.frame0.frame1.pulldown$pdID.frame0.listbox2 -side left
    # iterate for each pulldown item
    set maxWidth 1
    set maxHeight [llength [lrange $pdList 2 end]]
    foreach menuItem [lrange $pdList 2 end] {
      set item [lindex $menuItem 0]
      # separate handling for separator menu items
      if {[llength $menuItem] == 2} {
        # output label of the menu item and accelerator indicator
        .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 insert end $item
        .top13.frame0.frame1.pulldown$pdID.frame0.listbox2 insert end [lindex $menuItem 1]
        if {[set itemWidth [string length $item]] > $maxWidth} {
          set maxWidth $itemWidth
        }
      } else {
        # create separator designator
        .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 insert end {--------------------------------------}
        .top13.frame0.frame1.pulldown$pdID.frame0.listbox2 insert end {--------------------------------------}  
      }
    }
    .top13.frame0.frame1.pulldown$pdID.frame0.listbox27 config -height $maxHeight -width $maxWidth
    .top13.frame0.frame1.pulldown$pdID.frame0.listbox2 config -height $maxHeight
  }
}


# Procedure: toucanCreateObject
proc toucanCreateObject { formID type x y args} {
  global toucanPropDialog

  if {[regexp {^([0-9][0-9])[0-9][0-9]$} $formID junk baseID]} {
    set id $formID
    set formID form${baseID}00
  } else {
    set id [expr [string trimleft $formID form] + 1]
  }
  # pick first available acceptable object ID
  set objList [winfo children .canvas0.$formID]
  set maxID [expr [string trimleft $formID form] + 100]
  while {[lsearch -regexp $objList "\[.\]canvas0\[.\]${formID}\[.\]\[^0-9\]+${id}"] != -1} {
    incr id
    if {$id == $maxID} {
      tk_messageBox -icon error -type ok -parent . -title {Object creation aborted} -message {Object ID supply for this form has been exhausted!}
      return 0
    }
  }
  # create the appropriate widget(s) for the form object and get back the object properties that get embedded in the tag
  set objectTags [eval toucanCreateWidget .canvas0.$formID $type $id $args]
  # complete the structuring of the tags
  set objectTags [list object$id [concat objectOptions $objectTags]]
  # generate the base name of the form object
  set baseObject [string tolower $type]
  append w .canvas0 . $formID . $baseObject $id
  # determine appropriate window item width
  if {[regexp {width ([0-9]+)} $args junk objectWidth]} {
    set objectWidth [expr 2 * $objectWidth]
  } else {
    set objectWidth 0
  }
  # determine appropriate window item height
  if {[regexp {height ([0-9]+)} $args junk objectHeight]} {
    set objectHeight [expr 2 * $objectHeight]    
  } else {
    set objectHeight 0
  }
  # create the canvas window item that display the widgets and holds the tags
  .canvas0.$formID create window $x $y -tags $objectTags -window $w -anchor nw -width $objectWidth -height $objectHeight
  # append widget name so bindings go to the appropriate widget
  set cmd [list toucanInitObjectMenu .canvas0.$formID object$id $toucanPropDialog($type) $type %X %Y]
  # add bindings to appropriate widget
  toucanCreateBindings $w $formID object$id $cmd
  return
  bind $w <Button-3> [list toucanAdjustDragStart .canvas0.$formID object$id %X %Y]
  bind $w <B3-Motion> [list toucanAdjustDragMotion .canvas0.$formID object$id %X %Y]
  bind $w <B3-ButtonRelease> [list toucanAdjustDragEnd .canvas0.$formID object$id]
  bind $w <Double-Button-3> $cmd
  foreach c [winfo children $w] {
    bind $c <Button-3> [list toucanAdjustDragStart .canvas0.$formID object$id %X %Y]
    bind $c <B3-Motion> [list toucanAdjustDragMotion .canvas0.$formID object$id %X %Y]
    bind $c <B3-ButtonRelease> [list toucanAdjustDragEnd .canvas0.$formID object$id]
    bind $c <Double-Button-3> $cmd
  }
}


# Procedure: toucanCreateScript
proc toucanCreateScript { {id "9999"} args} {
  global toucanDisplay toucanEditorPreferences toucanStringVariable

  # pick first available acceptable form ID
  set objList [winfo children .canvas0]
  while {[lsearch -regexp $objList "\[.\]canvas0\[.\]string$id"] != -1} {
    incr id -1
    if {$id == 9899} {
      tk_messageBox -icon error -type ok -parent . -title {Script creation aborted} -message {Script ID supply has been exhausted!}
      return 0
    }
  }

  if {[llength $args] == 0} {
    set args [list type embedded string {}]
  }

  foreach {option value} $args {
    set $option $value
  }

  set formShownOld $toucanDisplay(formShown)
  set toucanDisplay(formShown) string$id
  toucanCreateEditor $id $type $string
  # add syntax highlighting for script editing
  toucanEditorColors .canvas0.string$id.f2.text toucanEditorPreferences

  .canvas0 create window 0 0 -window .canvas0.string$id -anchor nw -tags string$id
  radiobutton .frame1.canvas0.frame2.string$id -font toucan_bold_font -anchor w -text "Script $id" -variable toucanDisplay(formShown) -value string$id -command {
    if {[set editForm [.canvas0 find withtag edit]] != {}} {
      .canvas0 itemconfig $editForm -state hidden
      catch ".canvas0 itemconfig $editForm -state forcehidden"
      update
      .canvas0 itemconfig $editForm -state hidden
      .canvas0 dtag $editForm edit
    }
    unset editForm
    .canvas0 itemconfig $toucanDisplay(formShown) -state normal
    .canvas0 addtag edit withtag $toucanDisplay(formShown)
    .menu0 entryconfig Edit -state normal
    if {$toucanStringVariable([string trimleft $toucanDisplay(formShown) string]) == {file}} {
      .menu0.menu0 entryconfig {Load File} -state normal
      if {[.canvas0.$toucanDisplay(formShown).f2.text edit modified]} {
        .menu0.menu0 entryconfig {Save File} -state normal
      } else {
        .menu0.menu0 entryconfig {Save File} -state disabled
      }
    } else {
      .menu0.menu0 entryconfig {Load File} -state disabled
      .menu0.menu0 entryconfig {Save File} -state disabled
    }
  }

  pack .frame1.canvas0.frame2.string$id -anchor w
  if {[set editForm [.canvas0 find withtag edit]] != {}} {
    .canvas0 itemconfig $formShownOld -state hidden
    catch ".canvas0 itemconfig $formShownOld -state forcehidden"
    update
    .canvas0 itemconfig $formShownOld -state hidden
    .canvas0 dtag $formShownOld edit
  }

  .canvas0 addtag edit withtag string$id
  .menu0 entryconfig Edit -state normal
  if {$toucanStringVariable($id) == {file}} {
    .menu0.menu0 entryconfig {Load File} -state normal
    .menu0.menu0 entryconfig {Save File} -state disabled
  } else {
    .menu0.menu0 entryconfig {Load File} -state disabled
    .menu0.menu0 entryconfig {Save File} -state disabled
  }
  .frame1.canvas0 configure -scrollregion [list 0 0 100 [winfo reqheight .frame1.canvas0.frame2]]
}


# Procedure: toucanCreateString
proc toucanCreateString { {id "1700"} args} {
  global toucanDisplay toucanStringVariable

  # pick first available acceptable form ID
  set objList [winfo children .canvas0]
  while {[lsearch -regexp $objList "\[.\]canvas0\[.\]string$id"] != -1} {
    incr id
    if {$id == 1800} {
      tk_messageBox -icon error -type ok -parent . -title {String creation aborted} -message {String ID supply has been exhausted!}
      return 0
    }
  }

  if {[llength $args] == 0} {
    set args [list type embedded string {}]
  }

  foreach {option value} $args {
   set $option $value
  }

  set formShownOld $toucanDisplay(formShown)
  set toucanDisplay(formShown) string$id
  toucanCreateEditor $id $type $string
  .canvas0 create window 0 0 -window .canvas0.string$id -anchor nw -tags string$id
  radiobutton .frame1.canvas0.frame2.string$id -font toucan_bold_font -anchor w -text "String $id" -variable toucanDisplay(formShown) -value string$id -command {
    if {[set editForm [.canvas0 find withtag edit]] != {}} {
      .canvas0 itemconfig $editForm -state hidden
      catch ".canvas0 itemconfig $editForm -state forcehidden"
      update
      .canvas0 itemconfig $editForm -state hidden
      .canvas0 dtag $editForm edit
    }
    unset editForm
    .canvas0 itemconfig $toucanDisplay(formShown) -state normal
    .canvas0 addtag edit withtag $toucanDisplay(formShown)
    .menu0 entryconfig Edit -state normal
    if {$toucanStringVariable([string trimleft $toucanDisplay(formShown) string]) == {file}} {
      .menu0.menu0 entryconfig {Load File} -state normal
      if {[.canvas0.$toucanDisplay(formShown).f2.text edit modified]} {
        .menu0.menu0 entryconfig {Save File} -state normal
      } else {
        .menu0.menu0 entryconfig {Save File} -state disabled
      }
    } else {
      .menu0.menu0 entryconfig {Load File} -state disabled
      .menu0.menu0 entryconfig {Save File} -state disabled
    }
  }

  pack .frame1.canvas0.frame2.string$id -anchor w
  if {[set editForm [.canvas0 find withtag edit]] != {}} {
    .canvas0 itemconfig $formShownOld -state hidden
    catch ".canvas0 itemconfig $formShownOld -state forcehidden"
    update
    .canvas0 itemconfig $formShownOld -state hidden
    .canvas0 dtag $formShownOld edit
  }

  .canvas0 addtag edit withtag string$id
  .menu0 entryconfig Edit -state normal
  if {$toucanStringVariable($id) == {file}} {
    .menu0.menu0 entryconfig {Load File} -state normal
    .menu0.menu0 entryconfig {Save File} -state disabled
  } else {
    .menu0.menu0 entryconfig {Load File} -state disabled
    .menu0.menu0 entryconfig {Save File} -state disabled
  }
  .frame1.canvas0 configure -scrollregion [list 0 0 100 [winfo reqheight .frame1.canvas0.frame2]]
}


# Procedure: toucanCreateWidget
proc toucanCreateWidget { parent type id args} {
  global toucanGroupVariable toucanObjectVariable

  set tagList {}
  set optionList {}
  # acquire the tags and options base upon the args passed
  eval toucanBuildTagAndOptionLists tagList optionList $args
  # generate the base object name for the widget
  set baseObject [string tolower $type]
  # create the name of the widget
  append w $parent . $baseObject $id
  # create the widget based upon form object type
  switch $type {
    Button -
    Repeatbutton {
      eval button $w -bg #d9d9d9 -padx 3 -pady 0 $optionList
    }
    Checkbox {
      if {[regexp {group ([0-9]+)} $tagList junk gid]} {
        if {[array names toucanGroupVariable $gid] == {}} {
          set toucanGroupVariable($gid) {null}
        }
        eval radiobutton $w -bg #d9d9d9 -pady 0 -indicatoron 1 -value object$id -variable toucanGroupVariable($gid)  $optionList
      } else {
        if {[array names toucanObjectVariable $id] == {}} {
          set toucanObjectVariable($id) 0
        }
        eval checkbutton $w -bg #d9d9d9 -pady 0 -indicatoron 1 -onvalue 1 -offvalue 0 -variable toucanObjectVariable($id) $optionList
      }
      set chkNdx [lsearch -exact $tagList checked]
      incr chkNdx
      if {[lindex $tagList $chkNdx] == {CHECKED}} {
        $w select
      } else {
        $w deselect
      }
    }
    Field {
      if {[regexp {lines SINGLELINE} $tagList]} {
        eval entry $w -relief flat -bg #c3c3c3 -borderwidth 0 $optionList
      } else {
        eval text $w -relief flat -bg #c3c3c3 -borderwidth 0 -wrap word $optionList
      }
    }
    Formbitmap {
      eval label $w -bg #d9d9d9 -relief flat -borderwidth 0 -bitmap gray50 $optionList
    }
    Graffitistateindicator {
      eval label $w -bg #d9d9d9 -relief flat -image gsi $optionList
    }
    Label {
      eval label $w -bg #d9d9d9 -relief flat $optionList
    }
    List {
      set ndx [lsearch -exact $optionList -items]
      set items [lindex $optionList [expr $ndx + 1]]
      set optionList [lreplace $optionList $ndx [expr $ndx + 1]]
      frame $w -relief flat -highlightthickness 0 -borderwidth 0
      eval listbox $w.listbox -bg #d9d9d9 -width 0 -height 0 -relief solid -highlightthickness 0 -selectmode single $optionList
      $w.listbox configure -yscrollcommand [list $w.scroll set]
      eval $w.listbox insert 0 $items
      scrollbar $w.scroll -bg #d9d9d9 -width 10 -relief flat -highlightthickness 0 -bg #d9d9d9 -command [list $w.listbox yview]
      $w config -width [expr [winfo reqwidth $w.listbox] + [winfo reqwidth $w.scroll]] -height [winfo reqheight $w.listbox]
      pack $w.listbox -side left -fill both -expand 1
      pack $w.scroll -side left -fill y
    }
    Pushbutton {
      if {[regexp {group ([0-9]+)} $tagList junk gid]} {
        if {[array names toucanGroupVariable $gid] == {}} {
          set toucanGroupVariable($gid) {null}
        }
        eval radiobutton $w -bg #d9d9d9 -pady 0 -indicatoron 0 -value object$id -variable toucanGroupVariable($gid) -highlightthickness 0 $optionList
      } else {
        if {[array names toucanObjectVariable $id] == {}} {
          set toucanObjectVariable($id) 0
        }
        eval checkbutton $w -bg #d9d9d9 -pady 0 -indicatoron 0 -onvalue 1 -offvalue 0 -variable toucanObjectVariable($id) -highlightthickness 0 $optionList
      }
    }
    Popuptrigger {
      eval menubutton $w -bg #d9d9d9 -padx 3 -pady 0 -relief flat -indicatoron 1 -padx 8 -pady 1 $optionList
    }
    Scrollbar {
      eval scrollbar $w -bg #d9d9d9 -orient vertical -width 10 -relief flat $optionList
    }
    Selectortrigger {
      eval button $w -bg #d9d9d9 -padx 3 -pady 0 -relief groove -padx 8 -pady 1 $optionList
    }
    Slider {
      eval scale $w -bg #d9d9d9 -relief flat $optionList
    }
    Table {
      canvas $w -highlightthickness 0 -bg #c3c3c3
      frame $w.frame -highlightthickness 0
      $w create window 0 0 -window $w.frame -anchor nw -tags frame
      set rows [lindex $tagList [expr [lsearch $tagList rows] + 1]]
      set colList [lindex $tagList [expr [lsearch $tagList columnWidths] + 1]]
      # iterate over rows
      for {set i 0} {$i < $rows} {incr i} {
        # iterate over columns
        set j 0
        foreach col $colList {
          frame $w.frame.cellR${i}C$j -highlightthickness 0 -width $col
          label $w.frame.cellR${i}C${j}.tbd -highlightthickness 0 -bg #d9d9d9 -borderwidth 4 -relief raised -text TBD -font toucan_font
          pack $w.frame.cellR${i}C${j}.tbd -fill both -expand 1
          grid $w.frame.cellR${i}C${j} -row $i -column $j -sticky nsew
          incr j
        }
      }
      set totalHeight [expr $rows * [winfo reqheight $w.frame.cellR0C0.tbd]]
      set totalWidth 0
      set j 0
      foreach col $colList {
        incr totalWidth [expr 2 * $col]
        grid columnconfigure $w.frame $j -minsize [expr $col * 2]
        incr j
      }
      $w.frame config -width $totalWidth -height $totalHeight
      $w config -width $totalWidth -height $totalHeight
    }
  }
  return $tagList
}


# Procedure: toucanDeleteBitmapData
proc toucanDeleteBitmapData { ndx} {
  global toucanTop0

  if {$ndx != {}} {
    set bid [lindex [lindex $toucanTop0(list) $ndx] 0]
    .top0.frame0.listbox0 delete $ndx
    unset toucanTop0($bid)
  }
}


# Procedure: toucanDeleteMenuItem
proc toucanDeleteMenuItem {} {
  if {[set w [selection own]] == {}} { return }
  set parent [winfo parent $w]
  set grandparent [winfo parent $parent]
  set frameList [winfo children .top13.frame0.frame1]
  if {[lsearch -exact $frameList $grandparent] == -1} { return }
  if {[winfo class $w] != {Listbox}} { return }
  if {[llength [$w get 0 end]] == 1} {
    tk_messageBox -icon error -type ok -parent . -title {Delete menu item} -message {At least one menu item must exist on the pulldown!}
    return
  }
  set ndx [$w curselection]
  $w delete $ndx
  ${parent}.listbox2 delete $ndx
  set ht [expr [$w cget -height] - 1]
  $w configure -height $ht
  ${parent}.listbox2 configure -height $ht
  set menuList [$w get 0 end]
  set menuMaxNdx [expr [llength $menuList] - 1]
  if {$ndx > $menuMaxNdx} {
    set ndx $menuMaxNdx
  }
  $w selection set $ndx
  event generate $w <ButtonRelease-1>
  set maxLen 0
  foreach item [$w get 0 end] {
    if {[regexp {^-+$} $item]} { continue }
    set strLen [string length $item]
    if {$strLen > $maxLen} {
      set maxLen $strLen
    }
  }
  if {$maxLen < [$w cget -width]} {
    $w config -width $maxLen
  }
  .top13.frame0.frame0.frame2.entry7 delete 0 end
  .top13.frame0.frame0.frame5.entry7 delete 0 end
}


# Procedure: toucanDeleteObject
proc toucanDeleteObject { parent objectID} {
  global toucanObjectVariable

  if {[tk_messageBox -icon warning -type okcancel -parent . -title {Resource object delete} -message {Are you sure you want to delete this resource object?}] == {ok}} {
    set w [$parent itemcget $objectID -window]
    set delVar {}
    if {[regexp {^(form|menu)([0-9]+)$} $objectID junk type id]} {
      if {$type == {menu}} {
        foreach formW [info commands {.canvas0.form[0-9][0-9][0-9][0-9]}] {
          regexp {^[.]canvas0[.](form[0-9]+)$} $formW junk formID
          # handle possible removal as a menu ID
          toucanRemoveMatchingID .canvas0 $formID menuID $id
        }
      }
      destroy .frame1.canvas0.frame2.$objectID
      .frame1.canvas0 configure -scrollregion [list 0 0 100 [winfo reqheight .frame1.canvas0.frame2]]
    } else {
      regexp {^[.]canvas0[.](form[0-9]+)$} $parent junk formID
      regexp {[.]([^.]+)([0-9][0-9][0-9][0-9])$} $w junk type id
      switch $type {
        button -
        repeatbutton {
          # handle possible removal as a default button ID
          toucanRemoveMatchingID .canvas0 $formID defaultBtnID $id
        }
        checkbox -
        pushbutton {
          # handle possible removal as a default button ID
          toucanRemoveMatchingID .canvas0 $formID defaultBtnID $id
          # handle possible removal of a group variable
          set delVar [$w cget -variable]
        }
        list {
          # handle possible removal as a popup list
          append popupMatch $parent {.popuptrigger[0-9][0-9][0-9][0-9]}
          foreach listW [info commands $popupMatch] {
            regexp {popuptrigger([0-9]+)$} $listW junk popupID
            toucanRemoveMatchingID $parent object$popupID listID $id
          }
        }
      }
    }
    destroy $w
    if {$delVar != {}} {
      if {[info exists toucanObjectVariable($id)]} {
        unset toucanObjectVariable($id)
      }
      if {[regexp {toucanGroupVariable} $delVar]} {
        toucanRemoveGroupVariable $delVar
      }
    }
    $parent delete $objectID
  }
}


# Procedure: toucanDeletePulldown
proc toucanDeletePulldown {} {
  if {[set w [selection own]] == {}} { return }
  set parent [winfo parent $w]
  set grandparent [winfo parent $parent]
  set frameList [winfo children .top13.frame0.frame1]
  if {[llength $frameList] == 1} {
    tk_messageBox -icon error -type ok -parent . -title {Delete Pulldown} -message {At least one pulldown must exist on the menu!}
    return
  }
  if {[lsearch -exact $frameList $grandparent] == -1} { return }
  if {[tk_messageBox -icon warning -type okcancel -parent . -title {Delete Pulldown} -message {Do you really want to delete the pulldown?}] == {ok}} {
    destroy $grandparent
    set pdFirst [lindex [winfo children .top13.frame0.frame1] 0]
    $pdFirst.frame0.listbox27 selection set 0
    event generate $pdFirst.frame0.listbox27 <ButtonRelease-1> 
  }
}


# Procedure: toucanDisplayBitmapFile
proc toucanDisplayBitmapFile { ndx} {
  global toucanTop0

  if {$ndx != {}} {
    set bid [lindex [lindex $toucanTop0(list) $ndx] 0]
    ShowWindow.top2 bitmap [lindex $toucanTop0($bid) 2]
  }
}


# Procedure: toucanEditorColors
proc toucanEditorColors { w preferences} {
  upvar #0 $preferences prefs

  ctext::clearHighlightClasses $w
  # add syntax highlighting for script editing
  # Palm Tcl-specific commands
  ctext::addHighlightClass $w palmos $prefs(highlightPalmosCmds) {beep clipboard dm emulator event form}
  # Tcl general commands
  ctext::addHighlightClass $w tcl $prefs(highlightTclCmds) {append array catch clock concat
    expr fileevent format global incr info join lappend lindex linsert list llength lrange lreplace lsearch
    lsort regexp regsub rename scan set source split string subst time trace unset update upvar}
  # Tcl stack control commands
  ctext::addHighlightClass $w stackControl $prefs(highlightTclStackCmds) {break continue
    default else elseif error eval for foreach if proc return switch then uplevel while}
  # Tcl referenced varables
  ctext::addHighlightClassWithOnlyCharStart $w vars $prefs(highlightVariables) "\$"
  # Palm Tcl event substitutions
  ctext::addHighlightClass $w events $prefs(highlightEvents) {%A %E %N %R %S %T %W %x %y}
  # Tcl string enclosing characters
  ctext::addHighlightClassForSpecialChars $w braces $prefs(highlightBraces) {[]{}()""}
  # Tcl comments
  ctext::addHighlightClassForRegexp $w comments $prefs(highlightComments) {#\[^\n\]*}
  # force re-highlighting of text
  $w highlight 1.0 end
  #Tcl 7.6 commands
  # append array break catch clock concat continue error eval expr fileevent for foreach format
  # global if incr info join lappend lindex linsert list llength lrange lreplace lsearch lsort proc regexp regsub
  # rename return scan set source split string subst switch time trace unset update uplevel upvar while

  # Palm Tcl commands: beep clipboard dm emulator event fatal form

  # not implemented in order to save memory: case history interp package
  # not implemented as not relevant: cd exec exit fblocked fconfigure file filename flush gets glob library
  # not implemented as not relevant: load open pkg_mkIndex pid puts pwd read seek tclvars tell unknown
  # will be implemented in Palm Tcl in a later version: after close eof flush socket vwait
}


# Procedure: toucanFormObjectOutput
proc toucanFormObjectOutput { fp type args} {
  global toucanFile

  # obtain the object id
  set id [lindex $args [expr [lsearch -exact $args ID] + 1]]
  # generate the parent form ID
  regsub {^([0-9][0-9])[0-9][0-9]$} $id {form\100} formID
  # retrieve and format the object coordinates
  regsub -all {[.][0-9]+} [.canvas0.$formID coords object$id] {} doubleCoords
  foreach val $doubleCoords {
    lappend coords [expr $val / 2]
  }
  # emit form object name
  puts -nonewline $fp "  [string toupper $type] "
  # emit object-specific leading information
  switch $type {
    Button -
    Checkbox -
    Popuptrigger -
    Pushbutton -
    Repeatbutton -
    Selectortrigger {
      set labelText [lindex $args [expr [lsearch -exact $args label] + 1]]
      set symbFont [lindex $args [expr [lsearch -exact $args font] + 1]]
      set bitmapName [file join $toucanFile(libDir) fonts "font${symbFont}-${labelText}.xbm"]
      if {[file exists $bitmapName]} {
        set labelText [format "\\%03o" $labelText]
      }
      puts -nonewline $fp "\"$labelText\" "
      puts -nonewline $fp "ID $id AT ($coords "
      if {[set widthString [lindex $args [expr [lsearch -exact $args width] + 1]]] == 0} {
        set widthString AUTO
      }
      if {[set heightString [lindex $args [expr [lsearch -exact $args height] + 1]]] == 0} {
        set heightString AUTO
      }
      puts -nonewline $fp "$widthString $heightString)"
    }
    List {
      set items [lindex $args [expr [lsearch -exact $args items] + 1]]
      if {![llength $items]} {
        set items dummy
      }
      set items [join $items {" "}]
      puts -nonewline $fp "\"$items\" "
      puts -nonewline $fp "ID $id AT ($coords "
      if {[set widthString [lindex $args [expr [lsearch -exact $args width] + 1]]] == 0} {
        set widthString AUTO
      }
      if {[set heightString [lindex $args [expr [lsearch -exact $args height] + 1]]] == 0} {
        set heightString AUTO
      }
      puts -nonewline $fp "$widthString $heightString)"
    }
    Formbitmap -
    Graffitistateindicator {
      puts -nonewline $fp "AT ($coords)"
    }
    Label {
      set labelText [lindex $args [expr [lsearch -exact $args label] + 1]]
      set symbFont [lindex $args [expr [lsearch -exact $args font] + 1]]
      set bitmapName [file join $toucanFile(libDir) fonts "font${symbFont}-${labelText}.xbm"]
      if {[file exists $bitmapName]} {
        set labelText [format "\\%03o" $labelText]
      }
      puts -nonewline $fp "\"$labelText\" "
      puts -nonewline $fp "ID $id AT ($coords)"
    }
    Popuplist {
      puts -nonewline $fp "ID $id"
    }
    default {
      puts -nonewline $fp "ID $id AT ($coords "
      puts -nonewline $fp "[lindex $args [expr [lsearch -exact $args width] + 1]] "
      puts -nonewline $fp "[lindex $args [expr [lsearch -exact $args height] + 1]])"
    }
  }

  # emit form object properties
  set listID {}
  foreach {ndx attrib} $args {
    switch -exact $ndx {
      align -
      lines -
      usability -
      anchor -
      editing -
      framing {
        puts -nonewline $fp " $attrib"
      }
      listID {
        if {$attrib != {}} {
          set listID $attrib
        }
      }
      backgroundID -
      bitmap -
      bitmapID -
      font -
      group -
      selectedbitmapID -
      thumbID {
        if {$attrib != {None}} {
          puts -nonewline $fp " [string toupper $ndx] $attrib"
        }
      }
      columnWidths -
      max -
      min {
        if {$attrib != {}} {
          puts -nonewline $fp " [string toupper $ndx] $attrib"
        }
      }
      columns -
      maxChars -
      pagesize -
      rows -
      value -
      visibleItems {
        if {$attrib != 0} {
          puts -nonewline $fp " [string toupper $ndx] $attrib"
        }
      }
      autoshift -
      checked -
      disabled -
      dynamicSize -
      feedback -
      graphical -
      numeric -
      scrollbar -
      underline -
      vertical {
        if {$attrib != {Null}} {
          puts -nonewline $fp " $attrib"
        }
      }
    }
  }
  puts $fp {}
  if {($type == {Popuptrigger}) && ($listID != {})} {
      puts $fp "  POPUPLIST $id $listID"
  }
}


# Procedure: toucanGeneralSearchReplace
proc toucanGeneralSearchReplace { win searchMode searchCase searchRegexp searchBackward searchString {replaceString ""}} {
  if {$searchString == {}} {
    return
  }

  if {$searchMode == {replaceall}} {
    set searchCurrentPosition 1.0
  } else {
    set searchCurrentPosition [$win index insert]
  }

  while 1 {
    if {!$searchCase} {
      set optionCase -nocase
    } else {
      set optionCase {}
    }

    if {$searchRegexp} {
      set optionRegexp -regexp
    } else {
      set optionRegexp {}
    }

    if {$searchBackward && ($searchMode != {replaceall})} {
      set res [eval $win search $optionRegexp $optionCase -backwards -count length -- $searchString $searchCurrentPosition 1.0] 
    } else {
      set res [eval $win search $optionRegexp $optionCase -count length -- $searchString $searchCurrentPosition end] 
    }

    if {$res != {}} {
      if {$searchMode == {find}} {
        $win tag remove sel 1.0 end
        $win tag add sel $res "$res + $length chars"
        $win see $res
        if {$searchBackward} {
          $win mark set insert "$res"
        } else {
          $win mark set insert "$res + $length chars"
        }
        break
      } else {
        $win delete $res "$res + $length chars"
        $win insert $res $replaceString
        $win see $res
        if {$searchBackward} {
          $win mark set insert "$res"
        } else {
          $win mark set insert "$res + $length chars"
        }
        if {$searchMode == {replace}} {
          break
        }
      }
    } else {
      #We've reached the end, so display a dialog.
      if {$searchBackward} {
        tk_messageBox -icon info -message "Your search has reached the start of the text." -type ok
      } else {
        tk_messageBox -icon info -message "Your search has reached the end of the text." -type ok
      }
      break
    }
  }
}


# Procedure: toucanGenerateParCmd
proc toucanGenerateParCmd {} {
  global toucanPilrc toucanPar toucanProject

  set cmd {par r}
  append cmd { } [file join $toucanProject(path) $toucanProject(name).prc]
  append cmd { "} $toucanPar(appName) {"}
  append cmd { appl } $toucanPar(creatorID)
  append cmd { } [file join $toucanPar(palmTclPath) palmtcl.prc]
  append cmd { } [glob -nocomplain [file join $toucanProject(path) *.bin]]
  return $cmd
}


# Procedure: toucanGeneratePilrcCmd
proc toucanGeneratePilrcCmd {} {
  global toucanPilrc toucanProject

  set cmd pilrc
  if {$toucanPilrc(-L) != {ENGLISH}} {
    append cmd { -L } $toucanPilrc(-L)
  }

  if {$toucanPilrc(-I) != {null}} {
    foreach path $toucanPilrc(-I) {
      append cmd { -I } $path
    }
  }

  if {$toucanPilrc(-D) != {}} {
    foreach macro $toucanPilrc(-D) {
      append cmd { -D } $macro
    }
  }

  if {$toucanPilrc(-R) != {}} {
    append cmd { -R } $toucanPilrc(-R)
  }

  if {$toucanPilrc(-H) != {}} {
    append cmd { -H } $toucanPilrc(-H)
  }

  if {$toucanPilrc(-q)} {
    append cmd { -q}
  }

  if {$toucanPilrc(-V)} {
    append cmd { -V}
  }

  if {$toucanPilrc(-F) != {null}} {
    append cmd { -F} $toucanPilrc(-F)
  }

  if {$toucanPilrc(-allowEditID) } {
    append cmd { -allowEditID}
  }

  if {$toucanPilrc(-LE32) } {
    append cmd { -LE32}
  }

  if {$toucanPilrc(-rtl) } {
    append cmd { -rlt}
  }

  if {$toucanPilrc(-PalmRez) } {
    append cmd { -PalmRez}
  }

  append cmd { } [file join $toucanProject(path) $toucanProject(name).rcp]
  append cmd { } $toucanProject(path)
  return $cmd
}


# Procedure: toucanGeneratePilrcFile
proc toucanGeneratePilrcFile {} {
  global toucanProject toucanBitmapType toucanStringVariable

  set rootname [file join $toucanProject(path) $toucanProject(name)]
  set fp [open ${rootname}.rcp w+]
  # output comment header to file
  foreach formW [lsort [info command {.canvas0.form[0-9][0-9][0-9][0-9]}]] {
    toucanOutputFormPilrc $fp $formW
  }

  foreach menuW [lsort [info command {.canvas0.menu[0-9][0-9][0-9][0-9]}]] {
    regexp {menu([0-9]+)$} $menuW junk id
    toucanOutputMenuPilrc $fp [toucanRetrieveMenuProperties $id]
  }

  foreach bid [array names toucanBitmapType {[0-9][0-9][0-9][0-9]}] {
    foreach {bType comp bitmapFile} $toucanBitmapType($bid) {}
    puts -nonewline $fp [concat [string toupper $bType] ID $bid "\""]
    puts -nonewline $fp $bitmapFile
    puts $fp [concat "\"" [string toupper $comp]]
  }
  puts $fp "VERSION 1 \"$toucanProject(version)\""
  puts $fp "ICON \"${rootname}.bmp\""
  puts $fp "SMALLICON \"${rootname}_sml.bmp\""

  foreach stringWidget [lsort [info commands {.canvas0.string17[0-9][0-9]}]] {
    regexp {string(17[0-9][0-9])$} $stringWidget junk stringID 
    if {$toucanStringVariable($stringID) == {file}} {
      puts $fp "STRING ID $stringID FILE \"[$stringWidget.f1.filename get]\""
    } else {
      # escape backslashes and double quotes
      regsub -all -- {[\\"]} [$stringWidget.f2.text get 1.0 end] {\\\0} outString
      # escape new lines and format to keep margins of complex string even
      regsub -all "\n" [string trim $outString] {\n" \\&               "} outString
      #regsub -all "\n" [string trim [$stringWidget.f2.text get 1.0 end]] {\n" \\&               "} outString
      puts $fp "STRING ID $stringID \"$outString\\n\""
    }
  }

  if {[array names toucanStringVariable 9999] == {}} {
    puts $fp "STRING ID 9999 FILE \"${rootname}.tcl\""
  }

  foreach stringWidget [lsort -decreasing [info commands {.canvas0.string99[0-9][0-9]}]] {
    regexp {string(99[0-9][0-9])$} $stringWidget junk stringID 
    if {$toucanStringVariable($stringID) == {file}} {
      puts $fp "STRING ID $stringID FILE \"[$stringWidget.f1.filename get]\""
    } else {
      # escape backslashes and double quotes
      regsub -all -- {[\\"]} [$stringWidget.f2.text get 1.0 end] {\\\0} outString
      # escape new lines and format to keep margins of complex string even
      regsub -all "\n" [string trim $outString] {\n" \\&               "} outString
      #regsub -all "\n" [string trim [$stringWidget.f2.text get 1.0 end]] {\n" \\&               "} outString
      puts $fp "STRING ID $stringID \"$outString\\n\""
    }
  }

  close $fp
}


# Procedure: toucanGeneratePrcFile
proc toucanGeneratePrcFile {} {
  global toucanProject toucanTop0

  ShowWindow.top0 -M
  update idletasks
  toucanSaveAllTextFiles
  set toucanTop0(list) {}
  lappend toucanTop0(list) {Generating Palm resource script file for Pilrc}
  toucanGeneratePilrcFile
  lappend toucanTop0(list) {Generating large icon file}
  update idletasks
  iconlrg write [file join $toucanProject(path) $toucanProject(name)].bmp -format bmp
  lappend toucanTop0(list) {Generating small icon file}
  update idletasks
  iconsml write [file join $toucanProject(path) $toucanProject(name)]_sml.bmp -format bmp
  set cmd [toucanGeneratePilrcCmd]
  lappend toucanTop0(list) {Executing Pilrc:} $cmd
  update idletasks
  # eval exec -- [toucanGeneratePilrcCmd]
  if {[catch "exec -- $cmd >[file join $toucanProject(path) results.txt] 2>[file join $toucanProject(path) errs.txt]" result]} {
    set fp [open [file join $toucanProject(path) results.txt]]
    set out [read -nonewline $fp]
    close $fp
    set toucanTop0(list) [concat $toucanTop0(list) [split $out "\n"]]
    set fp [open [file join $toucanProject(path) errs.txt]]
    set errs [read -nonewline $fp]
    close $fp
    set toucanTop0(list) [concat $toucanTop0(list) [split $errs "\n"]]
    set toucanTop0(list) [concat $toucanTop0(list) [split $result "\n"]]
    lappend toucanTop0(list) {Processing aborted}
    return
  }
  set fp [open [file join $toucanProject(path) results.txt]]
  set out [read -nonewline $fp]
  close $fp
  set toucanTop0(list) [concat $toucanTop0(list) [split $out "\n"]]
  set fp [open [file join $toucanProject(path) errs.txt]]
  set errs [read -nonewline $fp]
  close $fp
  set toucanTop0(list) [concat $toucanTop0(list) [split $errs "\n"]]
  update idletasks
  set cmd [toucanGenerateParCmd]
  lappend toucanTop0(list) {Executing Par:} $cmd
  update idletasks
  # eval exec -- [toucanGenerateParCmd]
  if {[catch "exec -- $cmd >[file join $toucanProject(path) results.txt] 2>[file join $toucanProject(path) errs.txt]" result]} {
    set fp [open [file join $toucanProject(path) results.txt]]
    set out [read -nonewline $fp]
    close $fp
    set toucanTop0(list) [concat $toucanTop0(list) [split $out "\n"]]
    set fp [open [file join $toucanProject(path) errs.txt]]
    set errs [read -nonewline $fp]
    close $fp
    set toucanTop0(list) [concat $toucanTop0(list) [split $errs "\n"]]
    set toucanTop0(list) [concat $toucanTop0(list) [split $result "\n"]]
    lappend toucanTop0(list) {Processing aborted}
    return
  }
  set fp [open [file join $toucanProject(path) results.txt]]
  set out [read -nonewline $fp]
  close $fp
  set toucanTop0(list) [concat $toucanTop0(list) [split $out "\n"]]
  set fp [open [file join $toucanProject(path) errs.txt]]
  set errs [read -nonewline $fp]
  close $fp
  set toucanTop0(list) [concat $toucanTop0(list) [split $errs "\n"]]
  update idletasks
  lappend toucanTop0(list) {Processing completed}
}


# Procedure: toucanGenerateProjectFile
proc toucanGenerateProjectFile {} {
  global toucanProject toucanPilrc toucanPar toucanDisplay toucanEditorPreferences toucanFile toucanBitmapType toucanStringVariable

  set rootname [file join $toucanFile(path) $toucanProject(name)]
  set fp [open ${rootname}.tpj w+]
  puts $fp [list toucanProject [array get toucanProject]]
  puts $fp [list toucanPilrc [array get toucanPilrc]]
  puts $fp [list toucanPar [array get toucanPar]]
  puts $fp [list toucanDisplay [array get toucanDisplay]]
  puts $fp [list toucanEditorPreferences [array get toucanEditorPreferences]]
  foreach {x y} [split $toucanProject(iconsize) x] {}
  puts $fp [list iconlrg [join [iconlrg data -format bmp -from 0 0 $x $y]]]
  puts $fp [list iconsml [join [iconsml data -format bmp -from 0 0 15 9]]]

  foreach bid [array names toucanBitmapType {[0-9][0-9][0-9][0-9]}] {
    puts $fp [list Bitmap $bid $toucanBitmapType($bid)]
  }

  foreach formW [lsort [info command {.canvas0.form[0-9][0-9][0-9][0-9]}]] {
    regexp {(form([0-9]+))$} $formW junk formID id
    regsub -all {[.][0-9]+} [.canvas0 coords $formID] {} coords
    set coords [lreplace $coords 0 0 [expr [lindex $coords 0] - 26]]
    set coords [lreplace $coords 1 1 [expr [lindex $coords 1] - 26]]
    puts $fp [list Form $id $coords [toucanRetrieveFormProperties $formID]]
    set objectList {}
    foreach objectW [winfo children $formW] {
      if {[regexp {[.]([^.0-9]+)([0-9]+)$} $objectW junk type id]} {
        set type [string toupper $type 0]
        lappend objectList [list $type $id]
      }
    }
    set objectList [lsort -integer -index 1 $objectList]
    set objectList [join $objectList]
    foreach {type id} $objectList {
      regsub -all {[.][0-9]+} [$formW coords object$id] {} coords
      puts $fp [list $type $id $coords [toucanRetrieveObjectProperties object$id]]
    }
  }

  foreach menuW [lsort [info command {.canvas0.menu[0-9][0-9][0-9][0-9]}]] {
    regexp {menu([0-9]+)$} $menuW junk id
    puts $fp [list Menu $id [toucanRetrieveMenuProperties $id]]
  }

  foreach sid [lsort [array names toucanStringVariable {[0-9][0-9][0-9][0-9]}]] {
    if {$toucanStringVariable($sid) == {file}} {
      puts $fp [list String $sid type file string [.canvas0.string$sid.f1.filename get]]
    } else {
      set editText [string trimright [.canvas0.string$sid.f2.text get 1.0 end] "\n"]
      regsub -all {[\\"]} $editText {\\\0} editText
      regsub -all "\n" $editText {\n} outText
      puts $fp "String $sid type embedded string \"$outText\""
    }
  }

  close $fp
}


# Procedure: toucanInitMenuControls
proc toucanInitMenuControls { w} {
  .top13.frame0.scale28 config -to [expr [llength [$w get 0 end]] - 1]
  set ndx [$w curselection]
  .top13.frame0.scale28 set $ndx
  set parent [winfo parent $w]
  set grandparent [winfo parent $parent]
  set greatgrandparent [winfo parent $grandparent]
  set frameList [pack slaves $greatgrandparent]
  .top13.frame0.scale24 config -to [expr [llength $frameList] - 1]
  .top13.frame0.scale24 set [lsearch -exact $frameList $grandparent]
  .top13.frame0.frame0.frame0.entry7 delete 0 end
  .top13.frame0.frame0.frame2.entry7 delete 0 end
  .top13.frame0.frame0.frame5.entry7 delete 0 end
  .top13.frame0.frame0.frame1.label3 config -text {}
  .top13.frame0.frame0.frame0.entry7 insert 0 [${grandparent}.label26 cget -text]
  if {[catch {selection get} result]} { return }
  if {![regexp {^-+$} $result]} {
    .top13.frame0.frame0.button1 config -state normal
    .top13.frame0.frame0.frame2.entry7 insert 0 [selection get]
    set accel [$parent.listbox2 get $ndx]
    if {$accel == {.}} {
      set accel {}
    }
    .top13.frame0.frame0.frame5.entry7 insert 0 $accel
    regexp {pulldown([0-9]+)$} $grandparent junk id
    .top13.frame0.frame0.frame1.label3 config -text [expr $id + $ndx + 1]
    clipboard clear
    clipboard append [expr $id + $ndx + 1]
  } else {
    .top13.frame0.frame0.button1 config -state disabled
  }
}


# Procedure: toucanInitObjectMenu
proc toucanInitObjectMenu { parent objectID top type x y} {
  regexp {^[^0-9]+([0-9]+)$} $objectID junk id
  switch $type {
    Form -
    Menu -
    Field -
    Scrollbar -
    Slider -
    Table -
    Checkbox -
    List {
      .menu1 entryconfig 1 -label "ID = $id" -state normal -command "clipboard clear\n clipboard append $id"
      .menu1 entryconfig Properties -command [list ShowWindow.$top $objectID] -state normal
    }
    Graffitistateindicator {
      .menu1 entryconfig 1 -label {No ID} -state disabled
      .menu1 entryconfig Properties -state disabled
    }
    default {
      .menu1 entryconfig 1 -label "ID = $id" -state normal -command "clipboard clear\n clipboard append $id"
      .menu1 entryconfig Properties -command [list ShowWindow.$top $type $objectID] -state normal
    }
  }
  .menu1 entryconfig Delete -command [list toucanDeleteObject $parent $objectID]
  .menu1 post $x $y
}


# Procedure: toucanInsertMenuItem
proc toucanInsertMenuItem { {separator "0"}} {
  if {[set w [selection own]] == {}} { return }
  set parent [winfo parent $w]
  set grandparent [winfo parent $parent]
  set frameList [winfo children .top13.frame0.frame1]
  if {[lsearch -exact $frameList $grandparent] == -1} { return }
  if {[winfo class $w] != {Listbox}} { return }
  if {[$w index end] == 14} {
    tk_messageBox -icon error -type ok -parent . -title {Add Menuitem} -message {No more than fourteen menuitems can be placed on one pulldown!}
    return
  }
  set ndx [$w curselection]
  if {$separator} {
    $w insert $ndx {--------------------------------------------}
    ${parent}.listbox2 insert $ndx {-}
    .top13.frame0.frame0.frame2.entry7 delete 0 end
    .top13.frame0.frame0.frame5.entry7 delete 0 end
    .top13.frame0.frame0.button1 config -state disabled
  } else {
    set miName [.top13.frame0.frame0.frame2.entry7 get]
    if {$miName == {}} {
      tk_messageBox -icon error -type ok -parent . -title {Add Menuitem} -message {Meuitem needs a name!}
      return
    }
    $w insert $ndx $miName
    set accel [.top13.frame0.frame0.frame5.entry7 get]
    if {$accel == {}} {
      set accel {.}
    }
    ${parent}.listbox2 insert $ndx $accel
    .top13.frame0.frame0.button1 config -state normal
    set strLen [string length $miName]
    if {$strLen > [$w cget -width]} {
      $w configure -width $strLen
    }
  }
  set ht [expr [$w cget -height] + 1]
  $w configure -height $ht
  ${parent}.listbox2 configure -height $ht
  $w selection clear 0 end
  $w selection set $ndx
  event generate $w <ButtonRelease-1>
}


# Procedure: toucanInternalResourceDisplay
proc toucanInternalResourceDisplay { type} {
  global toucan$type

  .top14.frame0.frame0.listbox0 delete 0 end
  foreach entry [lsort -integer [array names toucan$type {[0-9][0-9][0-9][0-9]}]] {
    set id [lindex [set $toucan$type($entry)] 0]
    set str [lindex [set $toucan$type($entry)] 2]
    set str [split $str "\n"]
    set str [lindex $str 0]
    .top14.frame0.frame0.listbox0 insert end "${id}: $str"
  }
}


# Procedure: toucanInternalResourceSelect
proc toucanInternalResourceSelect {} {
  global toucanDisplay toucanInternalResource

  if {[set idx [.top14.frame0.frame0.listbox0 curselection]] != {}} {
    set toucanDisplay(modeVar) [lindex toucanInternalResource($idx) 1]
  }
}


# Procedure: toucanLoadAllTextFiles
proc toucanLoadAllTextFiles {} {
  global toucanDisplay toucanStringVariable

  set success 1
  foreach sid [lsort [array names toucanStringVariable {[0-9][0-9][0-9][0-9]}]] {
    if {$toucanStringVariable($sid) == {file}} {
      if {![toucanLoadTextFile string$sid]} {
        set success 0
      }
    }
  }

  return $success
}


# Procedure: toucanLoadProjectFile
proc toucanLoadProjectFile { filename} {
  global toucanProject toucanPilrc toucanPar toucanDisplay toucanEditorPreferences toucanFile toucanBitmapType

  if {[catch [list open $filename r] fp]} {
    return
  }

  set toucanFile(path) [file dirname $filename]
  set got(Project) 0
  set got(Pilrc) 0
  set got(Par) 0
  set got(Display) 0
  set got(toucanEditorPreferences) 0
  set got(iconlrg) 0
  set got(iconsml) 0
  while {![eof $fp]} {
    set count [gets $fp input]
    if {$count <= 0} { continue }
    switch [set type [lindex $input 0]] {
      toucanProject {
        array set toucanProject [lindex $input 1]
        set got(Project) 1
      }
      toucanPilrc {
        array set toucanPilrc [lindex $input 1]
        set got(Pilrc) 1
      }
      toucanPar {
        array set toucanPar [lindex $input 1]
        set got(Par) 1
      }
      toucanDisplay {
        array set toucanDisplay [lindex $input 1]
        set got(Display) 1
      }
      toucanEditorPreferences {
        array set toucanEditorPreferences [lindex $input 1]
        set got(toucanEditorPreferences) 1
      }
      iconlrg {
        foreach {x y} [split $toucanProject(iconsize) x] {}
        iconlrg config -width $x -height $y
        iconlrg put [lindex $input 1] -format bmp
        set got(iconlrg) 1
      }
      iconsml {
        iconsml put [lindex $input 1] -format bmp
        set got(iconsml) 1
      }
      Form {
        eval toucanCreateForm [lindex $input 1] [lindex $input 3]
        .canvas0 coords form[lindex $input 1]  [expr 26 + [lindex [lindex $input 2] 0]] [expr 26 + [lindex [lindex $input 2] 1]] 
      }
      Menu {
        toucanCreateMenu [lindex $input 1]
        eval toucanCreateMenuContent [lindex $input 2]
      }
      Bitmap {
        set bid [lindex $input 1]
        foreach {bType comp bitmapFile} [lindex $input 2] {}
        switch -exact $bType {
          BITMAP {
            set paletteSpec 4
          }
          BITMAPGREY {
            set paletteSpec 4
          }
          BITMAPGREY16 {
            set paletteSpec 16
          }
          BITMAPCOLOR {
            set paletteSpec {7/7/4}
          }
          BITMAPCOLOR16 {
            set paletteSpec {3/3/2}
          }
          BITMAPCOLOR16K {
            set paletteSpec {7/7/4}
          }
        }
        imgTemp configure -palette $paletteSpec
        imgTemp read $bitmapFile -shrink -format BMP
        image create photo img$bid -palette $paletteSpec
        img$bid copy imgTemp -shrink -zoom 2 2
        set toucanBitmapType($bid) [concat $bType $comp $bitmapFile]
      }
      String {
        if {[lindex $input 1] < 1800} {
          eval toucanCreateString [lindex $input 1] [lrange $input 2 end]
        } else {
          eval toucanCreateScript [lindex $input 1] [lrange $input 2 end]
        }
      }
      default {
        eval toucanCreateObject [lindex $input 1] [lindex $input 0] [lindex $input 2] [lindex $input 3]
      }
    }
  }

  if {[set resList [pack slaves .frame1.canvas0.frame2]] != {}} {
    [lindex $resList 0] invoke
  }
  close $fp
}


# Procedure: toucanLoadTextFile
proc toucanLoadTextFile { elementID} {
  if {[set filename [.canvas0.$elementID.f1.filename get]] == {}} {
    tk_messageBox -type ok -icon error -parent . -title {Text file load error} -message "Enter a file name for $elementID."
    return 0
  }

  if {![file exists $filename] || ![file isfile $filename] || ![file readable $filename]} {
    tk_messageBox -type ok -icon error -parent . -title {Text file load error} -message "The file for $elementID cannot be opened for reading."
    return 0
  }

  if {[catch {open $filename} fp]} {
    tk_messageBox -type ok -icon error -parent . -title {Text file load error} -message "Failure on opening $filename for reading."
    return 0
  }
  .canvas0.$elementID.f2.text delete 1.0 end
  .canvas0.$elementID.f2.text insert 1.0 [read $fp]
  .canvas0.$elementID.f2.text edit modified 0
  ctext::linemapUpdate .canvas0.$elementID.f2.text
  close $fp
  return 1
}


# Procedure: toucanModifiedEvent
proc toucanModifiedEvent { w} {
  if {[$w edit modified]} {
    .menu0.menu0 entryconfig {Save File} -state normal
  } else {
    .menu0.menu0 entryconfig {Save File} -state disabled
  }
}


# Procedure: toucanNewProject
proc toucanNewProject {} {
  global toucanPilrc toucanPar toucanProject toucanGroupVariable toucanObjectVariable toucanBitmapType toucanStringVariable

  set toucanPar(appName) {Unnamed}
  set toucanPar(creatorID) {NONE}
  set toucanPar(palmTclPath) [pwd]
  set toucanPilrc(-D) {}
  set toucanPilrc(-F) {null}
  set toucanPilrc(-H) {}
  set toucanPilrc(-I) {}
  set toucanPilrc(-L) {ENGLISH}
  set toucanPilrc(-LE32) 0
  set toucanPilrc(-PalmRez) 0
  set toucanPilrc(-R) {}
  set toucanPilrc(-V) 0
  set toucanPilrc(-allowEditID) 0
  set toucanPilrc(-q) 0
  set toucanPilrc(-rtl) 0
  set toucanPilrc(V) 0
  set toucanProject(name) {unnamed}
  set toucanProject(path) [pwd]
  set toucanProject(version) 1.0
  iconlrg put #ffffff -to 0 0 32 32
  iconsml put #ffffff -to 0 0 15 9
  eval destroy [info commands {.canvas0.form[0-9][0-9][0-9][0-9]}]
  eval destroy [info commands {.canvas0.menu[0-9][0-9][0-9][0-9]}]
  eval destroy [info commands {.canvas0.string[0-9][0-9][0-9][0-9]}]
  foreach item [.canvas0 find all] {
    foreach tag [.canvas0 gettags $item] {
      if {[regexp {^(form|menu|string)[0-9]+$} $tag]} {
        .canvas0 delete $item
        break
      }
    }
  }
  eval destroy [winfo children .frame1.canvas0.frame2]
  .frame1.canvas0 config -scrollregion {0 0 0 0}
  unset toucanGroupVariable
  set toucanGroupVariable(None) None
  unset toucanObjectVariable
  set toucanObjectVariable(None) None
  unset toucanStringVariable
  set toucanStringVariable(None) None
  foreach bid [array names toucanBitmapType {[0-9][0-9][0-9][0-9]}] {
    image delete img$bid
    unset toucanBitmapType($bid)
  }
}


# Procedure: toucanOutputFormPilrc
proc toucanOutputFormPilrc { fp w} {
  # extract the form ID
  regexp {form([0-9]+)$} $w junk id
  # make the first line of the form element declaration
  # output the ID
  lappend str FORM ID $id AT (
  # get the coordinates of the form widget and convert to integer
  regsub -all {[.][0-9]+} [.canvas0 coords form$id] {} coords
  append str [expr ([lindex $coords 0] - 26) / 2]
  lappend str [expr ([lindex $coords 1] - 26) / 2]
  # add on the width and height
  lappend str [expr [.canvas0 itemcget form$id -width] / 2]
  lappend str [expr [.canvas0 itemcget form$id -height] / 2])
  puts $fp $str
  # emit the remaining form properties; one per line
  foreach {ndx attrib} [toucanRetrieveFormProperties form$id] {
    switch $ndx {
      title {
        set titleStr $attrib
      }
      framing -
      saving {
        puts $fp $attrib
      }
      defaultBtnID -
      helpID -
      menuID {
        if {$attrib != {None}} {
          puts $fp "[string toupper $ndx] $attrib"
        }
      }
      modal -
      usability {
        if {$attrib != {Null}} {
          puts $fp $attrib
        }
      }
    }
  }
  # emit BEGIN
  puts $fp BEGIN
  # emit the form title information
  puts $fp "  TITLE \"$titleStr\""
  set objectList {}
  foreach objectW [winfo children $w] {
    if {[regexp {[.]([^.0-9]+)([0-9]+)$} $objectW junk type oID]} {
      set type [string toupper $type 0]
      lappend objectList [list $type $oID]
    }
  }
  set objectList [lsort -integer -index 1 $objectList]
  set objectList [join $objectList]
  # emit each form element
  foreach {type oID} $objectList {
    eval toucanFormObjectOutput $fp $type [toucanRetrieveObjectProperties object$oID]
  }
  # emit END
  puts $fp "END\n"
}


# Procedure: toucanOutputMenuPilrc
proc toucanOutputMenuPilrc { fp menuList} {
  puts -nonewline $fp {MENU ID }
  # parse out the form ID and print
  puts $fp [lindex $menuList 0]
  puts $fp BEGIN
  foreach pdList [lrange $menuList 1 end] {
    set pdID [expr [lindex $pdList 0] + 1]
    puts $fp "  PULLDOWN \"[lindex $pdList 1]\""
    # indicate the beginning of menu pulldown descriptions
    puts $fp {  BEGIN}
    # retrieve information on each pulldown in the menu and print
    foreach menuItem [lrange $pdList 2 end] {
      if {[llength $menuItem] > 1} {
        puts -nonewline $fp "    MENUITEM \"[lindex $menuItem 0]\" ID $pdID"
        if {[lindex $menuItem 1] != {}} {
          puts $fp " \"[lindex $menuItem 1]\""
        } else {
          puts $fp {}
        }
      } else {
        puts $fp {    MENUITEM SEPARATOR}
      }
      incr pdID
    }
    # indicate end of menu pulldowns and the current menu
    puts $fp {  END}
  }
  # signify completion of menu generation
  puts $fp "END\n"
}


# Procedure: toucanRemoveGroupVariable
proc toucanRemoveGroupVariable { var} {
  global toucanGroupVariable

  # only remove a group variable is no other checkbox or pushbutton is using it
  foreach w [info commands {.canvas0.form[0-9][0-9][0-9][0-9].checkbox[0-9][0-9][0-9][0-9]}] {
    if {[$w cget -variable] == $var} {
      return
    } 
  }

  foreach w [info commands {.canvas0.form[0-9][0-9][0-9][0-9].pushbutton[0-9][0-9][0-9][0-9]}] {
    if {[$w cget -variable] == $var} {
      return
    } 
  }

  unset $var
}


# Procedure: toucanRemoveMatchingID
proc toucanRemoveMatchingID { canvasW elementID propName matchID} {
  set elementTags [$canvasW gettags $elementID]
  set elementOptionsNdx [lsearch -regexp $elementTags {^(form|object)Options}]
  set elementOptionsList [lindex $elementTags $elementOptionsNdx]
  set optionNdx [expr [lsearch -exact $elementOptionsList $propName] + 1]
  if {[lindex $elementOptionsList $optionNdx] == $matchID} {
    $canvasW dtag $elementID $elementOptionsList
    set elementOptionsList [lreplace $elementOptionsList $optionNdx $optionNdx None]
    #puts $elementOptionsList
    $canvasW addtag $elementOptionsList withtag $elementID
  }
}


# Procedure: toucanRenameMenuButton
proc toucanRenameMenuButton {} {
  if {[set w [selection own]] == {}} { return }
  set parent [winfo parent $w]
  set grandparent [winfo parent $parent]
  set frameList [winfo children .top13.frame0.frame1]
  if {[lsearch -exact $frameList $grandparent] == -1} { return }
  if {[winfo class $w] != {Listbox}} { return }
  set miName [.top13.frame0.frame0.frame2.entry7 get]
  if {$miName == {}} {
    tk_messageBox -icon error -type ok -parent . -title {Add Menuitem} -message {Meuitem needs a name!}
    return
  }
  set ndx [$w curselection]
  $w delete $ndx
  $w insert $ndx $miName
  ${parent}.listbox2 delete $ndx
  set accel [.top13.frame0.frame0.frame5.entry7 get]
  if {$accel == {}} {
    set accel {.}
  }
  ${parent}.listbox2 insert $ndx $accel
  .top13.frame0.frame0.button1 config -state normal
  set maxLen 0
  foreach item [$w get 0 end] {
    if {[regexp {^-+$} $item]} { continue }
    set strLen [string length $item]
    if {$strLen > $maxLen} {
      set maxLen $strLen
    }
  }
  if {$maxLen != [$w cget -width]} {
    $w config -width $maxLen
  }

  $w selection set $ndx
}


# Procedure: toucanRenamePulldown
proc toucanRenamePulldown {} {
  if {[set w [selection own]] == {}} { return }
  set parent [winfo parent $w]
  set grandparent [winfo parent $parent]
  set frameList [winfo children .top13.frame0.frame1]
  if {[lsearch -exact $frameList $grandparent] == -1} { return }
  if {[winfo class $w] != {Listbox}} { return }
  set pdName [.top13.frame0.frame0.frame0.entry7 get]
  if {$pdName == {}} {
    tk_messageBox -icon error -type ok -parent . -title {Add Pulldown} -message {Pulldown needs a name!}
    return
  }
  ${grandparent}.label26 config -text $pdName
}


# Procedure: toucanResizeEditorWindow
proc toucanResizeEditorWindow {} {
  if {[winfo exists .xfEdit]} {return}
  if {[regexp {^([0-9]+)x([0-9]+)[+][0-9]+[+][0-9]+$} [winfo geometry .canvas0] junk winWidth winHeight]} {
    # current viewable region size is winWidth x winHeight
    foreach editor [info commands {.canvas0.string????}]  {
      # editor is: $editor
      regexp {(string[0-9]+)$} $editor junk editorID
      set edWidth [.canvas0 itemcget $editorID -width]
      set edHeight [.canvas0 itemcget $editorID -height]
      if {$winWidth != $edWidth} {
        .canvas0 itemconfig $editorID -width $winWidth
      }
      if {$winHeight != $edHeight} {
        .canvas0 itemconfig $editorID -height $winHeight
      }
    }
  }
}


# Procedure: toucanRetrieveFormProperties
proc toucanRetrieveFormProperties { formID} {
  lappend propList ID [string trimleft $formID form]
  lappend propList title [.canvas0.${formID}.title cget -text]
  lappend propList height [expr [.canvas0.$formID cget -height] / 2]
  lappend propList width [expr [.canvas0.$formID cget -width] / 2]
  set formOptions [.canvas0 gettags $formID]
  foreach {ndx val} [lrange [lindex $formOptions [lsearch -regexp $formOptions {^formOptions}]] 1 end] {
    lappend propList $ndx $val
  }
  if {[.canvas0.$formID cget -relief] == {flat}} {
    lappend propList framing NOFRAME
  } else {
    lappend propList framing FRAME
  }
  if {[.canvas0.$formID cget -state] == {normal}} {
    lappend propList usability USABLE
  } else {
    lappend propList usability Null
  }

  return $propList
}


# Procedure: toucanRetrieveMenuDialog
proc toucanRetrieveMenuDialog {} {
  set propList [.top13.frame0.frame0.frame3.label7 cget -text]
  # iterate over each pulldown
  foreach mbW [pack slaves .top13.frame0.frame1] {
    # pick out the ID of the pulldown
    regexp {pulldown([0-9]+)$} $mbW junk pdID
    # get the pulldown designator
    set pdList [list $pdID [$mbW.label26 cget -text]]
    # iterate for each pulldown item
    set pdLength [$mbW.frame0.listbox27 index end]
    for {set ndx 0} {$ndx < $pdLength} {incr ndx} {
      # separate handling for separator menu items
      if {![regexp {^-+$} [$mbW.frame0.listbox27 get $ndx]]} {
        set accel [$mbW.frame0.listbox2 get $ndx]
        if {$accel == {.}} {
          set accel {}
        }
        # output label of the menu item and accelerator indicator
        lappend pdList [list [$mbW.frame0.listbox27 get $ndx] $accel]
      } else {
        # output separator designator
        lappend pdList *SEPARATOR*
      }
    }
    lappend propList $pdList
  }
  return $propList
}


# Procedure: toucanRetrieveMenuProperties
proc toucanRetrieveMenuProperties { id} {
  set propList $id
  # iterate over each pulldown
  foreach mbW [pack slaves .canvas0.menu$id] {
    # pick out the ID of the pulldown
    regexp {pulldown([0-9]+)$} $mbW junk pdID
    # get the pulldown designator
    set pdList [list $pdID [$mbW cget -text]]
    # iterate for each pulldown item
    set pdLength [expr [$mbW.m index end] + 1]
    for {set ndx 0} {$ndx < $pdLength} {incr ndx}  {
      # separate handling for separator menu items
      if {[$mbW.m type $ndx] != {separator}} {
        # output label of the menu item and accelerator indicator
        lappend pdList [list [$mbW.m entrycget $ndx -label] [$mbW.m entrycget $ndx -accelerator]]
      } else {
        # output separator designator
        lappend pdList *SEPARATOR*
      }
    }
    lappend propList $pdList
  }
  return $propList
}


# Procedure: toucanRetrieveObjectProperties
proc toucanRetrieveObjectProperties { objectID} {
  regexp {^object(([0-9][0-9])[0-9][0-9])$} $objectID junk id formCent
  set formID form${formCent}00
  append parent .canvas0. $formID
  set w [$parent itemcget $objectID -window]
  regexp {[.]([^0-9.]+)[0-9]+$} $w junk type
  set type [string toupper $type 0]
  global toucanFormObject$type
  set propList [$parent gettags $objectID]
  set ndx [lsearch -glob $propList objectOptions*]
  set propList [lrange [lindex $propList $ndx] 1 end]
  foreach ndx [array names toucanFormObject$type] {
    switch -exact $ndx {
      align -
      autoshift -
      backgroundID -
      checked -
      colList -
      colWidths -
      columns -
      dynamicSize -
      editing -
      graphical -
      group -
      lines -
      listID -
      maxChars -
      numeric -
      pagesize -
      rows -
      scrollbar -
      max -
      min -
      selectedbitmapID -
      thumbID -
      underline -
      usability -
      value -
      visibleItems {
        # should already be in the properties list
      }
      ID {
        lappend propList ID $id
      }
      anchor {
        if {[$w cget -anchor] == {w}} {
          lappend propList anchor LEFTANCHOR
        } else {
          lappend propList anchor RIGHTANCHOR
        }
      }
      bitmap {
        if {[set imgName [$w cget -image]] != {}} {
          lappend propList bitmap [string trimleft $imgName img]
        } else {
          lappend propList bitmap None
        }
      }
      bitmapID {
        if {[set imgName [$w cget -image]] != {}} {
          lappend propList bitmapID [string trimleft $imgName img]
        } else {
          lappend propList bitmapID None
        }
      }
      defaultBtnID {
      }
      disabled {
        if {$type != {List}} {
          if {[$w cget -state] == {disabled}} {
            lappend propList disabled DISABLED
          } else {
            lappend propList disabled Null
          }
        }
      }
      editingold {
        if {[$w cget -state] == {disabled}} {
          lappend propList editing NONEDITABLE
        } else {
          lappend propList editing EDITABLE
        }
      }
      feedback {
        if {[$w cget -showvalue]} {
          lappend propList feedback FEEDBACK
        } else {
          lappend propList feedback Null
        }
       }
      font {
        # for now, available fonts are 0, 1, 2, 3, 4, 5, 6, and 7
        if {$type == {List}} {
          set fontname [$w.listbox cget -font]
        } else {
          set fontname [$w cget -font]
        }
        switch $fontname {
          noneFont {
            lappend propList font None
          }
          boldFont {
            lappend propList font 1
          }
          largeFont {
            lappend propList font 2
          }
          symbolFont3 {
            lappend propList font 3
          }
          symbolFont4 {
            lappend propList font 4
          }
          symbolFont5 {
            lappend propList font 5
          }
          symbolFont6 {
            lappend propList font 6
          }
          largeBoldFont {
            lappend propList font 7
          }
          stdFont -
          default {
            lappend propList font 0
          }
        }
      }
      framing {
        if {[$w cget -relief] == {solid}} {
          if {[$w cget -borderwidth] == 2} {
            lappend propList framing FRAME
          } else {
            lappend propList framing BOLDFRAME
          }
        } else {
          lappend propList framing NOFRAME
        }
      }
      height {
        lappend propList height [expr [$parent itemcget $objectID -height] / 2]
      }
      helpID {
      }
      items {
        lappend propList items [$w.listbox get 0 end]
      }
      label {
        lappend propList label [$w cget -text]
      }
      menuID {
      }
      modal {
      }
      saving {
      }
      vertical {
        if {[$w cget -orient] == {vertical}} {
          lappend propList vertical VERTICAL
        } else {
           lappend propList vertical Null
        }
      }
      width {
        lappend propList width [expr [$parent itemcget $objectID -width] / 2]
      }
    }
  }

  return $propList
}


# Procedure: toucanSaveAllTextFiles
proc toucanSaveAllTextFiles {} {
  global toucanDisplay toucanStringVariable

  set success 1
  foreach sid [lsort [array names toucanStringVariable {[0-9][0-9][0-9][0-9]}]] {
    if {$toucanStringVariable($sid) == {file}} {
      if {[.canvas0.string${sid}.f2.text edit modified]} {
        if {[tk_messageBox -type yesno -icon warning -parent . -title {Unsaved file} -message "The file [.canvas0.string${sid}.f1.filename get] has not been saved. Do you wish to save it?"] == {yes}} {
          if {![toucanSaveTextFile string$sid]} {
            set success 0
          }
        }
      }
    }
  }

  if {[regexp {^string[0-9]+$} $toucanDisplay(formShown)] && [winfo exists .canvas0.$toucanDisplay(formShown)]} {
    .frame1.canvas0.frame2.$toucanDisplay(formShown) invoke
  }
  return $success
}


# Procedure: toucanSaveTextFile
proc toucanSaveTextFile { elementID} {
  if {[set filename [.canvas0.$elementID.f1.filename get]] == {}} {
    tk_messageBox -type ok -icon error -parent . -title {Text file save error} -message "Enter a file name for $elementID."
    return 0
  }

  if {[file exists $filename] && (![file isfile $filename] || ![file writable $filename])} {
    tk_messageBox -type ok -icon error -parent . -title {Text file save error} -message "The file $filename for $elementID cannot be opened for writing."
    return 0
  }

  if {[catch {open $filename w} fp]} {
    tk_messageBox -type ok -icon error -parent . -title {Text file save error} -message "Failure on opening $filename for writing."
    return 0
  }

  puts $fp [string trimright [.canvas0.$elementID.f2.text get 1.0 end] "\n"]
  .canvas0.$elementID.f2.text edit modified 0
  close $fp
  return 1
}


# Procedure: toucanSelectBitmapData
proc toucanSelectBitmapData { ndx} {
  global toucanTop0

  if {$ndx != {}} {
    set bid [lindex [lindex $toucanTop0(list) $ndx] 0]
    set toucanTop0(type) [lindex $toucanTop0($bid) 0]
    set toucanTop0(comp) [lindex $toucanTop0($bid) 1]
  }
}


# Procedure: toucanSetBitmapOption
proc toucanSetBitmapOption { option {value ""}} {
  global toucanTop0

  if {[set ndx [.top0.frame0.listbox0 curselection]] != {}} {
    set bid [lindex [lindex $toucanTop0(list) $ndx] 0]
    switch $option {
      type {
        set toucanTop0(type) $value
        set ndx 0
      }
      comp {
        set toucanTop0(comp) $value
        set ndx 1
      }
      file {
        set curFile [lindex $toucanTop0($bid) 2]
        set curDir [file dirname $curFile]
        set curFile [file tail $curFile]
        if {[set value [tk_getOpenFile -initialdir $curDir -initialfile $curFile -parent .top0 -defaultextension .bmp -filetypes {{{BMP files} {.bmp}}} -title {Bitmap select}]] == {}} {
          return
        }
        set listEntry [concat [lrange [lindex $toucanTop0(list) $ndx] 0 1] $value]
        set toucanTop0(list) [lreplace $toucanTop0(list) $ndx $ndx $listEntry]
        set ndx 2
      }
    }
    set toucanTop0($bid) [lreplace $toucanTop0($bid) $ndx $ndx $value]
  }
}


# Procedure: toucanSetupIconEdit
proc toucanSetupIconEdit { width height iconname} {
  foreach gridtag [.top2.frame2.canvas0 gettags rect] {
    switch $gridtag {
      32x32 {
         set dx [expr $width - 32]
         set dy [expr $height - 32]
         .top2.frame2.canvas0 dtag rect 32x32
      }
      32x22 {
         set dx [expr $width - 32]
         set dy [expr $height - 22]
         .top2.frame2.canvas0 dtag rect 32x22
      }
      22x22 {
         set dx [expr $width - 22]
         set dy [expr $height - 22]
         .top2.frame2.canvas0 dtag rect 22x22
      }
    }
  }

  .top2.frame2.canvas0 move grid [expr $dx * 8] [expr $dy * 8]
  .top2.frame2.canvas0 addtag ${width}x$height withtag rect
  iconreal configure -width $width -height $height
  if {$dx > 0} {
    iconreal put #ffffff -to [expr $width - $dx] 0 $width $height
  }
  if {$dy > 0} {
    iconreal put #ffffff -to 0 [expr $height - $dy] $width $height
  }
  iconreal copy $iconname
  iconmag configure -width [expr $width * 8] -height [expr $height * 8]
  iconmag blank
  iconmag copy iconreal -zoom 8 8
}


# Procedure: toucanShiftMenuItem
proc toucanShiftMenuItem { ndxNew} {
  if {[set w [selection own]] == {}} { return }
  set parent [winfo parent $w]
  set grandparent [winfo parent $parent]
  set frameList [winfo children .top13.frame0.frame1]
  if {[lsearch -exact $frameList $grandparent] == -1} { return }
  if {[winfo class $w] != {Listbox}} { return }
  set ndx [$w curselection]
  set val [selection get]
  $w delete $ndx $ndx
  $w insert $ndxNew $val
  $w selection set $ndxNew
  set val [${parent}.listbox2 get $ndx]
  ${parent}.listbox2 delete $ndx $ndx
  ${parent}.listbox2 insert $ndxNew $val
  if {[.top13.frame0.frame0.frame1.label3 cget -text] != {}} {
    regexp {pulldown([0-9]+)$} $grandparent junk id
    .top13.frame0.frame0.frame1.label3 config -text [expr $id + $ndxNew + 1]
  }
}


# Procedure: toucanShiftPulldown
proc toucanShiftPulldown { ndxNew} {
  if {[set w [selection own]] == {}} { return }
  set parent [winfo parent $w]
  set grandparent [winfo parent $parent]
  set orderList [pack slaves .top13.frame0.frame1]
  if {[set ndx [lsearch -exact $orderList $grandparent]] == -1} { return }
  if {[winfo class $w] != {Listbox}} { return }
  set frame [lindex $orderList $ndx]
  set orderList [lreplace $orderList $ndx $ndx]
  set orderList [linsert $orderList $ndxNew $frame]
  eval pack forget $orderList
  eval pack $orderList -side left -anchor n
}


# Procedure: toucanTableColumnSet
proc toucanTableColumnSet { cols} {
  if {[set colNdx [.top7.frame0.frame1.listbox13 curselection]] != {}} {
    set colList [.top7.frame0.frame1.listbox13 get 0 end]
    set colList [lreplace $colList $colNdx $colNdx $cols]
    .top7.frame0.frame1.listbox13 delete 0 end
    eval .top7.frame0.frame1.listbox13 insert 0 $colList
    .top7.frame0.frame1.listbox13 selection set $colNdx
  }
}


# Procedure: toucanTableColumnsSet
proc toucanTableColumnsSet { len} {
  set colList [.top7.frame0.frame1.listbox13 get 0 end]
  if {[set addLen [expr $len - [llength $colList]]] > 0} {
    set addValue [.top7.frame0.frame0.scale15 get]
    for {set i 0} {$i < $addLen} {incr i} {
      lappend colList $addValue
    }
  } else {
    incr len -1
    set colList [lrange $colList 0 $len]
  }

  .top7.frame0.frame1.listbox13 delete 0 end
  eval .top7.frame0.frame1.listbox13 insert 0 $colList
}


# User defined images

image create bitmap help \
  -data {#define info_bitmap_width 24
#define info_bitmap_height 22
static unsigned char info_bitmap_bits[] = {
  0xff, 0x00, 0xfe, 0xff, 0x00, 0xfe, 0x0f, 0x3c, 0xf0, 0x0f, 0x3c, 0xf0,
  0x0f, 0x3c, 0xf0, 0x0f, 0x3c, 0xf0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0,
  0x03, 0x3f, 0xc0, 0x03, 0x3f, 0xc0, 0x03, 0x3c, 0xc0, 0x03, 0x3c, 0xc0,
  0x03, 0x3c, 0xc0, 0x03, 0x3c, 0xc0, 0x0f, 0xff, 0xf0, 0x0f, 0xff, 0xf0,
  0x0f, 0x00, 0xf0, 0x0f, 0x00, 0xf0, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, };
} \
  -foreground {#000000}

image create photo palmface \
  -gamma {1.0} \
  -height {0} \
  -width {0}

image create photo iconreal \
  -gamma {1.0} \
  -height {32} \
  -width {32}

image create photo iconsml \
  -gamma {1.0} \
  -height {9} \
  -width {15}

image create photo iconlrg \
  -gamma {1.0} \
  -height {32} \
  -width {32}

image create photo toucan \
  -gamma {1.0} \
  -height {0} \
  -width {0}

image create photo iconmag \
  -gamma {1.0} \
  -height {256} \
  -width {256}

image create bitmap gsi \
  -data {#define gsi_bitmap_width 16
#define gsi_bitmap_height 16
static unsigned char gsi_bitmap_bits[] = {
   0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f,
   0xfc, 0x7f, 0xfe, 0xff, 0xe0, 0x0f, 0xe0, 0x0f, 0xe0, 0x0f, 0x00, 0x00,
   0x00, 0x00, 0xe0, 0x0f, 0xe0, 0x0f, 0xe0, 0x0f};
} \
  -foreground {#000000}

image create photo color \
  -gamma {1.0} \
  -height {16} \
  -width {16}

image create photo imgTemp \
  -gamma {1.0} \
  -height {0} \
  -width {0}


# Internal procedures



# application parsing procedure
proc XFLocalParseAppDefs {xfAppDefFile} {
  global xfAppDefaults tcl_platform

  # basically from: Michael Moore
  if {[file exists $xfAppDefFile] &&
      [file readable $xfAppDefFile] &&
      "[file type $xfAppDefFile]" == "link"} {
    catch "file type $xfAppDefFile" xfType
    while {"$xfType" == "link"} {
      if {[catch "file readlink $xfAppDefFile" xfAppDefFile]} {
        return
      }
      catch "file type $xfAppDefFile" xfType
    }
  }
  if {!("$xfAppDefFile" != "" &&
        [file exists $xfAppDefFile] &&
        [file readable $xfAppDefFile] &&
        "[file type $xfAppDefFile]" == "file")} {
    return
  }
  if {![catch "open $xfAppDefFile r" xfResult]} {
    set xfAppFileContents [read $xfResult]
    close $xfResult
    foreach line [split $xfAppFileContents "\n"] {
      # backup indicates how far to backup.  It applies to the
      # situation where a resource name ends in . and when it
      # ends in *.  In the second case you want to keep the *
      # in the widget name for pattern matching, but you want
      # to get rid of the . if it is the end of the name. 
      set backup -2  
      set line [string trim $line]
      if {[string index $line 0] == "#" || "$line" == ""} {
        # skip comments and empty lines
        continue
      }
      if {![string compare "windows" $tcl_platform(platform)]} {
        set list [split $line ";"]
      } {
        set list [split $line ":"]
      }
      set resource [string trim [lindex $list 0]]
      set i [string last "." $resource]
      set j [string last "*" $resource]
      if {$j > $i} { 
        set i $j
        set backup -1
      }
      incr i
      set name [string range $resource $i end]
      incr i $backup
      set widname [string range $resource 0 $i]
      set value [string trim [lindex $list 1]]
      if {"$widname" != "" && "$widname" != "*"} {
        # insert the widget and resourcename to the application
        # defaults list.
        if {![info exists xfAppDefaults]} {
          set xfAppDefaults ""
        }
        lappend xfAppDefaults [list $widname [string tolower $name] $value]
      }
    }
  }
}

# application loading procedure
proc XFLocalLoadAppDefs {{xfClasses ""} {xfPriority "startupFile"} {xfAppDefFile ""}} {
  global env tcl_platform

  if {![string compare "windows" $tcl_platform(platform)]} {
    set separator ";"
  } {
    set separator ":"
  }
  if {"$xfAppDefFile" == ""} {
    set xfFileList ""
    if {[info exists env(XUSERFILESEARCHPATH)]} {
      eval lappend xfFileList [split $env(XUSERFILESEARCHPATH) $separator]
    }
    if {[info exists env(XAPPLRESDIR)]} {
      eval lappend xfFileList [split $env(XAPPLRESDIR) $separator]
    }
    if {[info exists env(XFILESEARCHPATH)]} {
      eval lappend xfFileList [split $env(XFILESEARCHPATH) $separator]
    }
    append xfFileList " /usr/lib/X11/app-defaults"
    append xfFileList " /usr/X11/lib/X11/app-defaults"

    foreach xfCounter1 $xfClasses {
      foreach xfCounter2 $xfFileList {
        set xfPathName $xfCounter2
        if {[regsub -all "%N" "$xfPathName" "$xfCounter1" xfResult]} {
          set xfPathName $xfResult
        }
        if {[regsub -all "%T" "$xfPathName" "app-defaults" xfResult]} {
          set xfPathName $xfResult
        }
        if {[regsub -all "%S" "$xfPathName" "" xfResult]} {
          set xfPathName $xfResult
        }
        if {[regsub -all "%C" "$xfPathName" "" xfResult]} {
          set xfPathName $xfResult
        }
        if {[file exists $xfPathName] &&
            [file readable $xfPathName] &&
            ("[file type $xfPathName]" == "file" ||
             "[file type $xfPathName]" == "link")} {
          catch "option readfile $xfPathName $xfPriority"
          if {"[info commands XFParseAppDefs]" != ""} {
            XFParseAppDefs $xfPathName
          } {
            if {"[info commands XFLocalParseAppDefs]" != ""} {
              XFLocalParseAppDefs $xfPathName
            }
          }
        } {
          if {[file exists $xfCounter2/$xfCounter1] &&
              [file readable $xfCounter2/$xfCounter1] &&
              ("[file type $xfCounter2/$xfCounter1]" == "file" ||
               "[file type $xfCounter2/$xfCounter1]" == "link")} {
            catch "option readfile $xfCounter2/$xfCounter1 $xfPriority"
            if {"[info commands XFParseAppDefs]" != ""} {
              XFParseAppDefs $xfCounter2/$xfCounter1
            } {
              if {"[info commands XFLocalParseAppDefs]" != ""} {
                XFLocalParseAppDefs $xfCounter2/$xfCounter1
              }
            }
          }
        }
      }
    }
  } {
    # load a specific application defaults file
    if {[file exists $xfAppDefFile] &&
        [file readable $xfAppDefFile] &&
        ("[file type $xfAppDefFile]" == "file" ||
         "[file type $xfAppDefFile]" == "link")} {
      catch "option readfile $xfAppDefFile $xfPriority"
      if {"[info commands XFParseAppDefs]" != ""} {
        XFParseAppDefs $xfAppDefFile
      } {
        if {"[info commands XFLocalParseAppDefs]" != ""} {
          XFLocalParseAppDefs $xfAppDefFile
        }
      }
    }
  }
}

# application setting procedure
proc XFLocalSetAppDefs {{xfWidgetPath "."}} {
  global xfAppDefaults

  if {![info exists xfAppDefaults]} {
    return
  }
  foreach xfCounter $xfAppDefaults {
    if {"$xfCounter" == ""} {
      break
    }
    set widname [lindex $xfCounter 0]
    if {[string match $widname ${xfWidgetPath}] ||
        [string match "${xfWidgetPath}*" $widname]} {
      set name [string tolower [lindex $xfCounter 1]]
      set value [lindex $xfCounter 2]
      # Now lets see how many tcl commands match the name
      # pattern specified.
      set widlist [info command $widname]
      if {"$widlist" != ""} {
        foreach widget $widlist {
          # make sure this command is a widget.
          if {![catch "winfo id $widget"] &&
              [string match "${xfWidgetPath}*" $widget]} {
            catch "$widget configure -$name $value" 
          }
        }
      }
    }
  }
}

# initialize bindings for all widgets
proc XFInitAllBindings {} {
  # bindings
  bind all <<PrevWindow>> {tkTabToWindow [tk_focusPrev %W]}
  bind all <Alt-Key> {
	tkTraverseToMenu %W %A
    }
  bind all <Key-F10> {
	tkFirstMenu %W
    }
  bind all <Key-Tab> {tkTabToWindow [tk_focusNext %W]}
}


# startup source
proc StartupSrc {args} {
  global tcl_platform

  switch $tcl_platform(platform) {
    windows {
      if {[lsearch -exact [font names] toucan_font] < 0} {
        eval font create toucan_font [font actual {{MS Sans Serif} 8}]
      }
      if {[lsearch -exact [font names] toucan_bold_font] < 0} {
        eval font create toucan_bold_font [font actual {{MS Sans Serif} 8 bold}]
      }
      if {[lsearch -exact [font names] noneFont] < 0} {
        eval font create noneFont [font actual {Helvetica 10}]
      }
      if {[lsearch -exact [font names] stdFont] < 0} {
        eval font create stdFont [font actual {Helvetica 10}]
      }
      if {[lsearch -exact [font names] boldFont] < 0} {
        eval font create boldFont [font actual {Helvetica 10 bold}]
      }
      if {[lsearch -exact [font names] largeFont] < 0} {
        eval font create largeFont [font actual {Helvetica 16}]
      }
      if {[lsearch -exact [font names] largeBoldFont] < 0} {
        eval font create largeBoldFont [font actual {Helvetica 16 bold}]
      }
      if {[lsearch -exact [font names] symbolFont3] < 0} {
        eval font create symbolFont3 [font actual {Helvetica 10}]
      }
      if {[lsearch -exact [font names] symbolFont4] < 0} {
        eval font create symbolFont4 [font actual {Helvetica 10}]
      }
      if {[lsearch -exact [font names] symbolFont5] < 0} {
        eval font create symbolFont5 [font actual {Helvetica 10}]
      }
      if {[lsearch -exact [font names] symbolFont6] < 0} {
        eval font create symbolFont6 [font actual {Helvetica 10}]
      }
    }
    unix {
      if {[lsearch -exact [font names] toucan_font] < 0} {
        eval font create toucan_font [font actual {Helvetica 12}]
      }
      if {[lsearch -exact [font names] toucan_bold_font] < 0} {
        eval font create toucan_bold_font [font actual {Helvetica 12 bold}]
      }
      if {[lsearch -exact [font names] noneFont] < 0} {
        eval font create noneFont [font actual {Helvetica 14}]
      }
      if {[lsearch -exact [font names] stdFont] < 0} {
        eval font create stdFont [font actual {Helvetica 14}]
      }
      if {[lsearch -exact [font names] boldFont] < 0} {
        eval font create boldFont [font actual {Helvetica 14 bold}]
      }
      if {[lsearch -exact [font names] largeFont] < 0} {
        eval font create largeFont [font actual {Helvetica 18}]
      }
      if {[lsearch -exact [font names] largeBoldFont] < 0} {
        eval font create largeBoldFont [font actual {Helvetica 18 bold}]
      }
      if {[lsearch -exact [font names] symbolFont3] < 0} {
        eval font create symbolFont3 [font actual {Helvetica 14}]
      }
      if {[lsearch -exact [font names] symbolFont4] < 0} {
        eval font create symbolFont4 [font actual {Helvetica 14}]
      }
      if {[lsearch -exact [font names] symbolFont5] < 0} {
        eval font create symbolFont5 [font actual {Helvetica 14}]
      }
      if {[lsearch -exact [font names] symbolFont6] < 0} {
        eval font create symbolFont6 [font actual {Helvetica 14}]
      }
    }
  }
}


# end source
proc EndSrc {} {
  global toucanProject toucanPar toucanFile
  if {![winfo exists .xfEdit]} {
    package require toucanLib
    package require Img
    . configure -menu .menu0
    set toucanProject(path) [pwd]
    set toucanFile(path) [pwd]
    set toucanPar(palmTclPath) [pwd]
    iconlrg put #ffffff -to 0 0 32 32 
    iconsml put #ffffff -to 0 0 15 9
    # destroy .canvas0.canvas4
    # .canvas0 delete formX
    toplevel .dnd
    wm overrideredirect .dnd 1
    raise .dnd .
    wm withdraw .dnd
    canvas .dnd.c -highlightthickness 0 -borderwidth 0
    pack .dnd.c
   # temporary scripts to remove menu elements from Menu properties dialog
  }
}

# startup source
StartupSrc

# initialize global variables
proc InitGlobals {} {
  global {Autoload STRING files}
  set {Autoload STRING files} {0}
  global {Autoload string files}
  set {Autoload string files} {0}
  global {Edit menu IDs}
  set {Edit menu IDs} {0}
  global {Little endian resources}
  set {Little endian resources} {0}
  global {MS-style output}
  set {MS-style output} {0}
  global {PalmRez}
  set {PalmRez} {0}
  global {Quiet output}
  set {Quiet output} {0}
  global {Right-to-left}
  set {Right-to-left} {0}
  global {checkbutton0}
  set {checkbutton0} {0}
  global {checkbutton4}
  set {checkbutton4} {0}
  global {cval}
  set {cval} {#ffff00}
  global {result}
  set {result} {}
  global {tcl_nonwordchars}
  set {tcl_nonwordchars} {\W}
  global {tcl_wordchars}
  set {tcl_wordchars} {\w}
  global {toucanBitmapType}
  set {toucanBitmapType(None)} {None}
  global {toucanDisplay}
  set {toucanDisplay(formShown)} {}
  set {toucanDisplay(mode)} {}
  set {toucanDisplay(oldX)} {0}
  set {toucanDisplay(oldY)} {0}
  global {toucanEditorPreferences}
  set {toucanEditorPreferences(bg)} {#ffffff}
  set {toucanEditorPreferences(bgInsert)} {#000000}
  set {toucanEditorPreferences(bgSelect)} {#c3c3c3}
  set {toucanEditorPreferences(blinkColor)} {#00ffff}
  set {toucanEditorPreferences(blinkRange)} {1}
  set {toucanEditorPreferences(blinkTime)} {500}
  set {toucanEditorPreferences(bold)} {0}
  set {toucanEditorPreferences(family)} {helvetica}
  set {toucanEditorPreferences(fg)} {#000000}
  set {toucanEditorPreferences(font)} {helvetica 12}
  set {toucanEditorPreferences(highlightBraces)} {#0000ff}
  set {toucanEditorPreferences(highlightComments)} {#9a3030}
  set {toucanEditorPreferences(highlightEvents)} {#ff0000}
  set {toucanEditorPreferences(highlightPalmosCmds)} {#008800}
  set {toucanEditorPreferences(highlightTclCmds)} {#008800}
  set {toucanEditorPreferences(highlightTclStackCmds)} {#9b30cf}
  set {toucanEditorPreferences(highlightVariables)} {#ff6500}
  set {toucanEditorPreferences(size)} {12}
  global {toucanFile}
  set {toucanFile(libDir)} {.}
  set {toucanFile(path)} {.}
  global {toucanFormObject}
  set {toucanFormObject(ID)} {}
  set {toucanFormObject(align)} {LEFTALIGN}
  set {toucanFormObject(anchor)} {LEFTANCHOR}
  set {toucanFormObject(autoshift)} {Null}
  set {toucanFormObject(backgroundID)} {None}
  set {toucanFormObject(bitmap)} {None}
  set {toucanFormObject(bitmapID)} {None}
  set {toucanFormObject(checked)} {Null}
  set {toucanFormObject(colWidth)} {10}
  set {toucanFormObject(columnWidths)} {10}
  set {toucanFormObject(columns)} {1}
  set {toucanFormObject(defaultBtnID)} {None}
  set {toucanFormObject(disabled)} {Null}
  set {toucanFormObject(dynamicSize)} {Null}
  set {toucanFormObject(editing)} {EDITABLE}
  set {toucanFormObject(feedback)} {Null}
  set {toucanFormObject(font)} {0}
  set {toucanFormObject(framing)} {FRAME}
  set {toucanFormObject(graphical)} {Null}
  set {toucanFormObject(group)} {None}
  set {toucanFormObject(height)} {12}
  set {toucanFormObject(helpID)} {None}
  set {toucanFormObject(items)} {}
  set {toucanFormObject(label)} {}
  set {toucanFormObject(lines)} {SINGLELINE}
  set {toucanFormObject(listID)} {None}
  set {toucanFormObject(max)} {}
  set {toucanFormObject(maxChars)} {0}
  set {toucanFormObject(menuID)} {None}
  set {toucanFormObject(min)} {}
  set {toucanFormObject(modal)} {Null}
  set {toucanFormObject(numeric)} {Null}
  set {toucanFormObject(pagesize)} {0}
  set {toucanFormObject(rows)} {1}
  set {toucanFormObject(saving)} {SAVEBEHIND}
  set {toucanFormObject(scrollbar)} {Null}
  set {toucanFormObject(selectedBitmapID)} {0}
  set {toucanFormObject(selectedbitmapID)} {None}
  set {toucanFormObject(thumbID)} {None}
  set {toucanFormObject(title)} {}
  set {toucanFormObject(underline)} {Null}
  set {toucanFormObject(usability)} {USABLE}
  set {toucanFormObject(value)} {0}
  set {toucanFormObject(vertical)} {Null}
  set {toucanFormObject(visibleItems)} {0}
  set {toucanFormObject(width)} {40}
  global {toucanFormObjectButton}
  set {toucanFormObjectButton(ID)} {}
  set {toucanFormObjectButton(anchor)} {LEFTANCHOR}
  set {toucanFormObjectButton(bitmapID)} {None}
  set {toucanFormObjectButton(disabled)} {Null}
  set {toucanFormObjectButton(font)} {0}
  set {toucanFormObjectButton(framing)} {FRAME}
  set {toucanFormObjectButton(graphical)} {Null}
  set {toucanFormObjectButton(height)} {12}
  set {toucanFormObjectButton(label)} {button}
  set {toucanFormObjectButton(selectedbitmapID)} {None}
  set {toucanFormObjectButton(usability)} {USABLE}
  set {toucanFormObjectButton(width)} {80}
  global {toucanFormObjectCheckbox}
  set {toucanFormObjectCheckbox(ID)} {}
  set {toucanFormObjectCheckbox(anchor)} {LEFTANCHOR}
  set {toucanFormObjectCheckbox(checked)} {Null}
  set {toucanFormObjectCheckbox(disabled)} {Null}
  set {toucanFormObjectCheckbox(font)} {0}
  set {toucanFormObjectCheckbox(group)} {None}
  set {toucanFormObjectCheckbox(height)} {12}
  set {toucanFormObjectCheckbox(label)} {checkbox}
  set {toucanFormObjectCheckbox(usability)} {USABLE}
  set {toucanFormObjectCheckbox(width)} {80}
  global {toucanFormObjectField}
  set {toucanFormObjectField(ID)} {}
  set {toucanFormObjectField(align)} {LEFTALIGN}
  set {toucanFormObjectField(autoshift)} {Null}
  set {toucanFormObjectField(disabled)} {Null}
  set {toucanFormObjectField(dynamicSize)} {Null}
  set {toucanFormObjectField(editing)} {EDITABLE}
  set {toucanFormObjectField(font)} {0}
  set {toucanFormObjectField(height)} {12}
  set {toucanFormObjectField(lines)} {SINGLELINE}
  set {toucanFormObjectField(maxChars)} {0}
  set {toucanFormObjectField(numeric)} {Null}
  set {toucanFormObjectField(scrollbar)} {Null}
  set {toucanFormObjectField(underline)} {Null}
  set {toucanFormObjectField(usability)} {USABLE}
  set {toucanFormObjectField(width)} {80}
  global {toucanFormObjectForm}
  set {toucanFormObjectForm(ID)} {}
  set {toucanFormObjectForm(defaultBtnID)} {None}
  set {toucanFormObjectForm(framing)} {NOFRAME}
  set {toucanFormObjectForm(height)} {160}
  set {toucanFormObjectForm(helpID)} {None}
  set {toucanFormObjectForm(menuID)} {None}
  set {toucanFormObjectForm(modal)} {Null}
  set {toucanFormObjectForm(saving)} {SAVEBEHIND}
  set {toucanFormObjectForm(title)} {Form title}
  set {toucanFormObjectForm(usability)} {USABLE}
  set {toucanFormObjectForm(width)} {160}
  global {toucanFormObjectFormbitmap}
  set {toucanFormObjectFormbitmap(ID)} {}
  set {toucanFormObjectFormbitmap(bitmap)} {None}
  set {toucanFormObjectFormbitmap(usability)} {USABLE}
  global {toucanFormObjectGraffitistateindicator}
  set {toucanFormObjectGraffitistateindicator(ID)} {}
  global {toucanFormObjectLabel}
  set {toucanFormObjectLabel(ID)} {}
  set {toucanFormObjectLabel(font)} {0}
  set {toucanFormObjectLabel(label)} {label}
  set {toucanFormObjectLabel(usability)} {USABLE}
  global {toucanFormObjectList}
  set {toucanFormObjectList(ID)} {}
  set {toucanFormObjectList(disabled)} {Null}
  set {toucanFormObjectList(font)} {0}
  set {toucanFormObjectList(height)} {80}
  set {toucanFormObjectList(items)} {}
  set {toucanFormObjectList(usability)} {USABLE}
  set {toucanFormObjectList(visibleItems)} {0}
  set {toucanFormObjectList(width)} {80}
  global {toucanFormObjectPopuptrigger}
  set {toucanFormObjectPopuptrigger(ID)} {}
  set {toucanFormObjectPopuptrigger(anchor)} {LEFTANCHOR}
  set {toucanFormObjectPopuptrigger(bitmapID)} {None}
  set {toucanFormObjectPopuptrigger(disabled)} {Null}
  set {toucanFormObjectPopuptrigger(font)} {0}
  set {toucanFormObjectPopuptrigger(graphical)} {Null}
  set {toucanFormObjectPopuptrigger(height)} {12}
  set {toucanFormObjectPopuptrigger(label)} {popuptrigger}
  set {toucanFormObjectPopuptrigger(listID)} {None}
  set {toucanFormObjectPopuptrigger(selectedbitmapID)} {None}
  set {toucanFormObjectPopuptrigger(usability)} {USABLE}
  set {toucanFormObjectPopuptrigger(width)} {80}
  global {toucanFormObjectPushbutton}
  set {toucanFormObjectPushbutton(ID)} {}
  set {toucanFormObjectPushbutton(anchor)} {LEFTANCHOR}
  set {toucanFormObjectPushbutton(bitmapID)} {None}
  set {toucanFormObjectPushbutton(disabled)} {Null}
  set {toucanFormObjectPushbutton(font)} {0}
  set {toucanFormObjectPushbutton(graphical)} {Null}
  set {toucanFormObjectPushbutton(group)} {None}
  set {toucanFormObjectPushbutton(height)} {12}
  set {toucanFormObjectPushbutton(label)} {pushbutton}
  set {toucanFormObjectPushbutton(selectedbitmapID)} {None}
  set {toucanFormObjectPushbutton(usability)} {USABLE}
  set {toucanFormObjectPushbutton(width)} {80}
  global {toucanFormObjectRepeatbutton}
  set {toucanFormObjectRepeatbutton(ID)} {}
  set {toucanFormObjectRepeatbutton(anchor)} {LEFTANCHOR}
  set {toucanFormObjectRepeatbutton(bitmapID)} {None}
  set {toucanFormObjectRepeatbutton(disabled)} {Null}
  set {toucanFormObjectRepeatbutton(font)} {0}
  set {toucanFormObjectRepeatbutton(framing)} {FRAME}
  set {toucanFormObjectRepeatbutton(graphical)} {Null}
  set {toucanFormObjectRepeatbutton(height)} {12}
  set {toucanFormObjectRepeatbutton(label)} {repeatbutton}
  set {toucanFormObjectRepeatbutton(selectedbitmapID)} {None}
  set {toucanFormObjectRepeatbutton(usability)} {USABLE}
  set {toucanFormObjectRepeatbutton(width)} {80}
  global {toucanFormObjectScrollbar}
  set {toucanFormObjectScrollbar(ID)} {}
  set {toucanFormObjectScrollbar(height)} {80}
  set {toucanFormObjectScrollbar(max)} {}
  set {toucanFormObjectScrollbar(min)} {}
  set {toucanFormObjectScrollbar(pagesize)} {0}
  set {toucanFormObjectScrollbar(usability)} {USABLE}
  set {toucanFormObjectScrollbar(value)} {0}
  set {toucanFormObjectScrollbar(width)} {10}
  global {toucanFormObjectSelectortrigger}
  set {toucanFormObjectSelectortrigger(ID)} {}
  set {toucanFormObjectSelectortrigger(anchor)} {LEFTANCHOR}
  set {toucanFormObjectSelectortrigger(bitmapID)} {None}
  set {toucanFormObjectSelectortrigger(disabled)} {Null}
  set {toucanFormObjectSelectortrigger(font)} {0}
  set {toucanFormObjectSelectortrigger(graphical)} {Null}
  set {toucanFormObjectSelectortrigger(height)} {12}
  set {toucanFormObjectSelectortrigger(label)} {selectortrigger}
  set {toucanFormObjectSelectortrigger(selectedbitmapID)} {None}
  set {toucanFormObjectSelectortrigger(usability)} {USABLE}
  set {toucanFormObjectSelectortrigger(width)} {80}
  global {toucanFormObjectSlider}
  set {toucanFormObjectSlider(ID)} {}
  set {toucanFormObjectSlider(backgroundID)} {}
  set {toucanFormObjectSlider(disabled)} {Null}
  set {toucanFormObjectSlider(feedback)} {Null}
  set {toucanFormObjectSlider(height)} {12}
  set {toucanFormObjectSlider(thumbID)} {}
  set {toucanFormObjectSlider(usability)} {USABLE}
  set {toucanFormObjectSlider(vertical)} {Null}
  set {toucanFormObjectSlider(width)} {80}
  global {toucanFormObjectTable}
  set {toucanFormObjectTable(ID)} {}
  set {toucanFormObjectTable(colWidth)} {10}
  set {toucanFormObjectTable(columnWidths)} {10}
  set {toucanFormObjectTable(columns)} {1}
  set {toucanFormObjectTable(height)} {80}
  set {toucanFormObjectTable(rows)} {1}
  set {toucanFormObjectTable(width)} {80}
  global {toucanGroupVariable}
  set {toucanGroupVariable(None)} {None}
  global {toucanNewEditorPreferences}
  set {toucanNewEditorPreferences(bg)} {#ffffff}
  set {toucanNewEditorPreferences(bgInsert)} {#000000}
  set {toucanNewEditorPreferences(bgSelect)} {#c3c3c3}
  set {toucanNewEditorPreferences(blinkColor)} {#00ffff}
  set {toucanNewEditorPreferences(blinkRange)} {1}
  set {toucanNewEditorPreferences(blinkTime)} {500}
  set {toucanNewEditorPreferences(bold)} {0}
  set {toucanNewEditorPreferences(family)} {helvetica}
  set {toucanNewEditorPreferences(fg)} {#000000}
  set {toucanNewEditorPreferences(font)} {helvetica 10}
  set {toucanNewEditorPreferences(highlightBraces)} {#0000ff}
  set {toucanNewEditorPreferences(highlightComments)} {#9a3030}
  set {toucanNewEditorPreferences(highlightEvents)} {#ff0000}
  set {toucanNewEditorPreferences(highlightPalmosCmds)} {#008800}
  set {toucanNewEditorPreferences(highlightTclCmds)} {#008800}
  set {toucanNewEditorPreferences(highlightTclStackCmds)} {#9b30cf}
  set {toucanNewEditorPreferences(highlightVariables)} {#ff6500}
  set {toucanNewEditorPreferences(size)} {12}
  global {toucanObjectVariable}
  set {toucanObjectVariable(None)} {None}
  global {toucanPar}
  set {toucanPar(appName)} {Unnamed}
  set {toucanPar(creatorID)} {NONE}
  set {toucanPar(palmTclPath)} {.}
  global {toucanPilrc}
  set {toucanPilrc(-D)} {}
  set {toucanPilrc(-F)} {null}
  set {toucanPilrc(-H)} {}
  set {toucanPilrc(-I)} {}
  set {toucanPilrc(-L)} {ENGLISH}
  set {toucanPilrc(-LE32)} {0}
  set {toucanPilrc(-PalmRez)} {0}
  set {toucanPilrc(-R)} {}
  set {toucanPilrc(-V)} {0}
  set {toucanPilrc(-allowEditID)} {0}
  set {toucanPilrc(-q)} {0}
  set {toucanPilrc(-rtl)} {0}
  set {toucanPilrc(V)} {0}
  global {toucanProject}
  set {toucanProject(autoload)} {1}
  set {toucanProject(iconsize)} {32x32}
  set {toucanProject(name)} {unnamed}
  set {toucanProject(path)} {.}
  set {toucanProject(version)} {1.0}
  global {toucanPropDialog}
  set {toucanPropDialog(Button)} {top3}
  set {toucanPropDialog(Checkbox)} {top8}
  set {toucanPropDialog(Field)} {top4}
  set {toucanPropDialog(Formbitmap)} {top11}
  set {toucanPropDialog(Graffitistateindicator)} {}
  set {toucanPropDialog(Label)} {top11}
  set {toucanPropDialog(List)} {top10}
  set {toucanPropDialog(Popuptrigger)} {top9}
  set {toucanPropDialog(Pushbutton)} {top9}
  set {toucanPropDialog(Repeatbutton)} {top3}
  set {toucanPropDialog(Scrollbar)} {top5}
  set {toucanPropDialog(Selectortrigger)} {top9}
  set {toucanPropDialog(Slider)} {top6}
  set {toucanPropDialog(Table)} {top7}
  global {toucanSearchVariable}
  set {toucanSearchVariable(backward)} {0}
  set {toucanSearchVariable(case)} {0}
  set {toucanSearchVariable(regexp)} {0}
  set {toucanSearchVariable(replace)} {}
  set {toucanSearchVariable(search)} {}
  global {toucanStringVariable}
  set {toucanStringVariable(None)} {None}
  global {toucanTop0}
  set {toucanTop0(None)} {None}
  set {toucanTop0(comp)} {NOCOMPRESS}
  set {toucanTop0(list)} {}
  set {toucanTop0(type)} {BITMAP}

  # please don't modify the following
  # variables. They are needed by xf.
  global {autoLoadList}
  set {autoLoadList(toucan.tcl)} {0}
  global {internalAliasList}
  set {internalAliasList} {}
  global {moduleList}
  set {moduleList(toucan.tcl)} {}
  global {preloadList}
  set {preloadList(xfInternal)} {}
  global {symbolicName}
  set {symbolicName(root)} {.}
  global {xfWmSetPosition}
  set {xfWmSetPosition} {}
  global {xfWmSetSize}
  set {xfWmSetSize} {.top2 .top10}
  global {xfAppDefToplevels}
  set {xfAppDefToplevels} {}
}

# initialize global variables
InitGlobals

# display/remove toplevel windows.
ShowWindow.

global xfShowWindow.top0
set xfShowWindow.top0 0

global xfShowWindow.top1
set xfShowWindow.top1 0

global xfShowWindow.top10
set xfShowWindow.top10 0

global xfShowWindow.top11
set xfShowWindow.top11 0

global xfShowWindow.top12
set xfShowWindow.top12 0

global xfShowWindow.top13
set xfShowWindow.top13 0

global xfShowWindow.top14
set xfShowWindow.top14 0

global xfShowWindow.top15
set xfShowWindow.top15 0

global xfShowWindow.top2
set xfShowWindow.top2 0

global xfShowWindow.top3
set xfShowWindow.top3 0

global xfShowWindow.top4
set xfShowWindow.top4 0

global xfShowWindow.top5
set xfShowWindow.top5 0

global xfShowWindow.top6
set xfShowWindow.top6 0

global xfShowWindow.top7
set xfShowWindow.top7 0

global xfShowWindow.top8
set xfShowWindow.top8 0

global xfShowWindow.top9
set xfShowWindow.top9 0

# load default bindings.
if {[info exists env(XF_BIND_FILE)] &&
    "[info procs XFShowHelp]" == ""} {
  source $env(XF_BIND_FILE)
}

# initialize bindings for all widgets.
XFInitAllBindings


# parse and apply application defaults.
XFLocalLoadAppDefs Toucan
XFLocalSetAppDefs

# end source
EndSrc

# eof
#

