From 282671282b20fa17ab9dbbaba9d1cf2246b5029d Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Mon, 17 Aug 2009 23:31:36 +0000 Subject: merge in new tcl implementation by Steiner & Chun svn path=/trunk/; revision=11934 --- pd/tcl/AppMain.tcl | 27 ++ pd/tcl/apple_events.tcl | 53 +++ pd/tcl/dialog_find.tcl | 94 ++++ pd/tcl/dialog_font.tcl | 107 +++++ pd/tcl/dialog_gatom.tcl | 211 +++++++++ pd/tcl/dialog_iemgui.tcl | 780 ++++++++++++++++++++++++++++++++ pd/tcl/pd.tcl | 315 +++++++++++++ pd/tcl/pd_bindings.tcl | 201 +++++++++ pd/tcl/pd_connect.tcl | 90 ++++ pd/tcl/pd_menucommands.tcl | 167 +++++++ pd/tcl/pd_menus.tcl | 355 +++++++++++++++ pd/tcl/pdtk_array.tcl | 346 +++++++++++++++ pd/tcl/pdtk_canvas.tcl | 152 +++++++ pd/tcl/pdtk_text.tcl | 20 + pd/tcl/pkgIndex.tcl | 23 + pd/tcl/pkg_mkIndex.tcl | 9 + pd/tcl/wheredoesthisgo.tcl | 1054 ++++++++++++++++++++++++++++++++++++++++++++ 17 files changed, 4004 insertions(+) create mode 100644 pd/tcl/AppMain.tcl create mode 100644 pd/tcl/apple_events.tcl create mode 100644 pd/tcl/dialog_find.tcl create mode 100644 pd/tcl/dialog_font.tcl create mode 100644 pd/tcl/dialog_gatom.tcl create mode 100644 pd/tcl/dialog_iemgui.tcl create mode 100644 pd/tcl/pd.tcl create mode 100644 pd/tcl/pd_bindings.tcl create mode 100644 pd/tcl/pd_connect.tcl create mode 100644 pd/tcl/pd_menucommands.tcl create mode 100644 pd/tcl/pd_menus.tcl create mode 100644 pd/tcl/pdtk_array.tcl create mode 100644 pd/tcl/pdtk_canvas.tcl create mode 100644 pd/tcl/pdtk_text.tcl create mode 100644 pd/tcl/pkgIndex.tcl create mode 100755 pd/tcl/pkg_mkIndex.tcl create mode 100644 pd/tcl/wheredoesthisgo.tcl (limited to 'pd/tcl') diff --git a/pd/tcl/AppMain.tcl b/pd/tcl/AppMain.tcl new file mode 100644 index 00000000..26adc832 --- /dev/null +++ b/pd/tcl/AppMain.tcl @@ -0,0 +1,27 @@ +# This file is for the Wish.app on Mac OS X. It is only used when a Wish.app +# is loading embedded pd code on Mac OS X. It is completely unused on any +# other configuration, like when 'pd' launches Wish.app or when 'pd' is using +# an X11 wish on Mac OS X. GNU/Linux and Windows will never use this file. + + +puts --------------------------AppMain.tcl----------------------------------- +catch {console show} + +# FIXME apple_events must require a newer tcl than 8.4? +# package require apple_events + +puts "AppMain.tcl" +puts "argv0: $argv0" +puts "executable: [info nameofexecutable]" +puts "argc: $argc argv: $argv" + +# TODO is there anything useful to do with the psn (Process Serial Number)? +if {[string first "-psn" [lindex $argv 0]] == 0} { + set argv [lrange $argv 1 end] + set argc [expr $argc - 1] +} + +# launch pd.tk here +if [catch {source [file join [file dirname [info script]] ../tcl/pd.tcl]}] { + puts stderr $errorInfo +} diff --git a/pd/tcl/apple_events.tcl b/pd/tcl/apple_events.tcl new file mode 100644 index 00000000..b52dcdba --- /dev/null +++ b/pd/tcl/apple_events.tcl @@ -0,0 +1,53 @@ + +package provide apple_events 0.1 + +package require wheredoesthisgo + +# from http://wiki.tcl.tk/12987 + +set ::tk::mac::CGAntialiasLimit 0 ;# min line thickness to anti-alias (default: 3) +set ::tk::mac::antialiasedtext 1 ;# enable/disable anti-aliased text + +# kAEOpenDocuments +proc ::tk::mac::OpenDocument {args} { + foreach filename $args { + puts "open_file $filename" + open_file $filename + } + set ::pd_menucommands::menu_open_dir [file dirname $filename] +} + +# kEventAppHidden +proc ::tk::mac::OnHide {} { + # TODO +} + +# kEventAppShown +proc ::tk::mac::OnShow {} { + # TODO +} + +# kAEShowPreferences +proc ::tk::mac::ShowPreferences {} { + menu_preferences_panel +} + +# kAEQuitApplication +#proc ::tk::mac::Quit {} { +# # TODO sort this out... how to quit pd-gui after sending the message +# puts stderr "Custom exit proc" +# pdsend "pd verifyquit" +#} + +# these I gleaned by reading the source (tkMacOSXHLEvents.c) +proc ::tk::mac::PrintDocument {args} { + # TODO what's $mytoplevel here?. I am guessing args would be the same as + # ::tk::mac::OpenDocument + #menu_print $mytoplevel +} + +proc ::tk::mac::OpenApplication {} { +} + +proc ::tk::mac::ReopenApplication {} { +} diff --git a/pd/tcl/dialog_find.tcl b/pd/tcl/dialog_find.tcl new file mode 100644 index 00000000..92d58347 --- /dev/null +++ b/pd/tcl/dialog_find.tcl @@ -0,0 +1,94 @@ + +package provide dialog_find 0.1 + +package require pd_bindings + +namespace eval ::dialog_find:: { + namespace export menu_dialog_find +} + +# TODO figure out findagain +# TODO make targetlabel into a popup menu +# TODO make panel go away after a find + +proc find_ok {mytoplevel} {::dialog_find::ok $mytoplevel} ;# TODO temp kludge +proc ::dialog_find::ok {mytoplevel} { + # find will be on top, so use the previous window that was on top + set search_window [lindex [wm stackorder .] end-1] + if {$search_window eq "."} { + puts "search pd window not implemented yet" + } else { + puts "search_window $search_window" + set find_string [.find.entry get] + if {$find_string ne ""} { + pdsend "$search_window find $find_string" + } + } +} + +proc find_cancel {mytoplevel} {::dialog_find::cancel $mytoplevel} ;# TODO temp kludge +proc ::dialog_find::cancel {mytoplevel} { + wm withdraw .find +} + +proc ::dialog_find::set_canvas_to_search {mytoplevel} { + if {[winfo exists .find.frame.targetlabel]} { + set focusedtoplevel [winfo toplevel [lindex [wm stackorder .] end]] + if {$focusedtoplevel eq ".find"} { + set focusedtoplevel [winfo toplevel [lindex [wm stackorder .] end-1]] + } + # TODO this text should be based on $::menu_windowlist + if {$focusedtoplevel eq "."} { + .find.frame.targetlabel configure -text [wm title .] + } else { + foreach window $::menu_windowlist { + if {[lindex $window 1] eq $focusedtoplevel} { + .find.frame.targetlabel configure -text [lindex $window 0] + } + } + } + } +} + +# the find panel is opened from the menu and key bindings +proc ::dialog_find::menu_dialog_find {mytoplevel} { + if {[winfo exists .find]} { + wm deiconify .find + raise .find + } else { + create_panel $mytoplevel + } +} + +proc ::dialog_find::create_panel {mytoplevel} { + toplevel .find + wm title .find [_ "Find"] + wm geometry .find =475x125+150+150 + wm resizable .find 0 0 + if {[catch {wm attributes .find -topmost}]} {puts stderr ".find -topmost failed"} + .find configure + ::pd_bindings::panel_bindings .find "find" + + frame .find.frame + pack .find.frame -side top -fill x -pady 7 + label .find.frame.searchin -text [_ "Search in"] + label .find.frame.targetlabel -font "TkTextFont 14" + label .find.frame.for -text [_ "for:"] + pack .find.frame.searchin .find.frame.targetlabel .find.frame.for -side left + entry .find.entry -width 54 -font 18 -relief sunken \ + -highlightthickness 3 -highlightcolor blue + focus .find.entry + pack .find.entry -side top -padx 10 + + frame .find.buttonframe -background yellow + button .find.button -text [_ "Find"] -default active -width 9 \ + -command "::dialog_find::ok $mytoplevel" + if {$::windowingsystem eq "x11"} { + button .find.close -text [_ "Close"] -default normal -width 9 \ + -command "::dialog_find::cancel $mytoplevel" + pack .find.buttonframe .find.button .find.close -side right -padx 10 -pady 15 + } else { + pack .find.buttonframe .find.button -side right -padx 10 -pady 15 + } + ::dialog_find::set_canvas_to_search $mytoplevel +} diff --git a/pd/tcl/dialog_font.tcl b/pd/tcl/dialog_font.tcl new file mode 100644 index 00000000..cebfcb08 --- /dev/null +++ b/pd/tcl/dialog_font.tcl @@ -0,0 +1,107 @@ + +package provide dialog_font 0.1 + +namespace eval ::dialog_font:: { + variable fontsize 0 + variable dofont_fontsize 0 + variable stretchval 0 + variable whichstretch 0 + + namespace export pdtk_canvas_dofont +} + +proc ::dialog_font::apply {mytoplevel myfontsize} { + pdsend "$mytoplevel font $myfontsize $stretchval $whichstretch" +} + +proc ::dialog_font::close {mytoplevel} { + pdsend "$mytoplevel cancel" +} + +proc ::dialog_font::cancel {mytoplevel} { + ::dialog_font::apply $mytoplevel $fontsize ;# reinstate previous font size + pdsend "$mytoplevel cancel" +} + +proc ::dialog_font::ok {mytoplevel} { + set fontsize $::dialog_font::fontsize + ::dialog_font::apply $mytoplevel $fontsize + ::dialog_font::close $mytoplevel +} + +# this should be called pdtk_font_dialog like the rest of the panels, but it +# is called from the C side, so we'll leave it be +proc ::dialog_font::pdtk_canvas_dofont {mytoplevel initsize} { + create_panel $mytoplevel $initsize +} + +proc ::dialog_font::create_panel {mytoplevel initsize} { + set fontsize $initsize + set dofont_fontsize $initsize + set stretchval 100 + set whichstretch 1 + + toplevel $mytoplevel + wm title $mytoplevel {Patch Font} + wm protocol $mytoplevel WM_DELETE_WINDOW "::dialog_font::cancel $mytoplevel" + + pdtk_panelkeybindings $mytoplevel font + + frame $mytoplevel.buttonframe + pack $mytoplevel.buttonframe -side bottom -fill x -pady 2m + button $mytoplevel.buttonframe.cancel -text "Cancel" \ + -command "::dialog_font::cancel $mytoplevel" + button $mytoplevel.buttonframe.ok -text "OK" \ + -command "::dialog_font::ok $mytoplevel" + pack $mytoplevel.buttonframe.cancel -side left -expand 1 + pack $mytoplevel.buttonframe.ok -side left -expand 1 + + frame $mytoplevel.radiof + pack $mytoplevel.radiof -side left + + label $mytoplevel.radiof.label -text {Font Size:} + pack $mytoplevel.radiof.label -side top + + radiobutton $mytoplevel.radiof.radio8 -value 8 -variable ::dialog_font::fontsize -text "8" \ + -command "::dialog_font::apply $mytoplevel 8" + radiobutton $mytoplevel.radiof.radio10 -value 10 -variable ::dialog_font::fontsize -text "10" \ + -command "::dialog_font::apply $mytoplevel 10" + radiobutton $mytoplevel.radiof.radio12 -value 12 -variable ::dialog_font::fontsize -text "12" \ + -command "::dialog_font::apply $mytoplevel 12" + radiobutton $mytoplevel.radiof.radio16 -value 16 -variable ::dialog_font::fontsize -text "16" \ + -command "::dialog_font::apply $mytoplevel 16" + radiobutton $mytoplevel.radiof.radio24 -value 24 -variable ::dialog_font::fontsize -text "24" \ + -command "::dialog_font::apply $mytoplevel 24" + radiobutton $mytoplevel.radiof.radio36 -value 36 -variable ::dialog_font::fontsize -text "36" \ + -command "::dialog_font::apply $mytoplevel 36" + pack $mytoplevel.radiof.radio8 -side top -anchor w + pack $mytoplevel.radiof.radio10 -side top -anchor w + pack $mytoplevel.radiof.radio12 -side top -anchor w + pack $mytoplevel.radiof.radio16 -side top -anchor w + pack $mytoplevel.radiof.radio24 -side top -anchor w + pack $mytoplevel.radiof.radio36 -side top -anchor w + + set current_radiobutton [format "$mytoplevel.radiof.radio%d" $initsize] + $current_radiobutton select + + frame $mytoplevel.stretchf + pack $mytoplevel.stretchf -side left + + label $mytoplevel.stretchf.label -text "Stretch:" + pack $mytoplevel.stretchf.label -side top + + entry $mytoplevel.stretchf.entry -textvariable stretchval -width 5 + pack $mytoplevel.stretchf.entry -side left + + radiobutton $mytoplevel.stretchf.radio1 \ + -value 1 -variable whichstretch -text "X and Y" + radiobutton $mytoplevel.stretchf.radio2 \ + -value 2 -variable whichstretch -text "X only" + radiobutton $mytoplevel.stretchf.radio3 \ + -value 3 -variable whichstretch -text "Y only" + + pack $mytoplevel.stretchf.radio1 -side top -anchor w + pack $mytoplevel.stretchf.radio2 -side top -anchor w + pack $mytoplevel.stretchf.radio3 -side top -anchor w + +} diff --git a/pd/tcl/dialog_gatom.tcl b/pd/tcl/dialog_gatom.tcl new file mode 100644 index 00000000..e377657f --- /dev/null +++ b/pd/tcl/dialog_gatom.tcl @@ -0,0 +1,211 @@ + +package provide dialog_gatom 0.1 + +package require wheredoesthisgo + +namespace eval ::dialog_gatom:: { + namespace export pdtk_gatom_dialog +} + +# hashtable for communicating the position of the radiobuttons (Tk's +# radiobutton widget requires this to be global) +global gatomlabel_position + +############ pdtk_gatom_dialog -- run a gatom dialog ######### + +# dialogs like this one can come up in many copies; but in TK the easiest +# way to get data from an "entry", etc., is to set an associated variable +# name. This is especially true for grouped "radio buttons". So we have +# to synthesize variable names for each instance of the dialog. The dialog +# gets a TK pathname $id, from which it strips the leading "." to make a +# variable suffix $vid. Then you can get the actual value out by asking for +# [eval concat $$variablename]. There should be an easier way but I don't see +# it yet. + +proc ::dialog_gatom::escape {sym} { + if {[string length $sym] == 0} { + set ret "-" + } else { + if {[string equal -length 1 $sym "-"]} { + set ret [string replace $sym 0 0 "--"] + } else { + set ret [string map {"$" "#"} $sym] + } + } + return [unspace_text $ret] +} + +proc ::dialog_gatom::unescape {sym} { + if {[string equal -length 1 $sym "-"]} { + set ret [string replace $sym 0 0 ""] + } else { + set ret [string map {"#" "$"} $sym] + } + return $ret +} + +proc gatom_apply {mytoplevel} { + # TODO kludge!! until a common approach to ::pd_bindings::panel_bindings + # is sorted out + ::dialog_gatom::apply $mytoplevel +} + +proc ::dialog_gatom::apply {mytoplevel} { + global gatomlabel_position + + pdsend "$mytoplevel param \ + [$mytoplevel.width.entry get] \ + [$mytoplevel.limits.lower.entry get] \ + [$mytoplevel.limits.upper.entry get] \ + [::dialog_gatom::escape [$mytoplevel.gatomlabel.name.entry get]] \ + $gatomlabel_position($mytoplevel) \ + [::dialog_gatom::escape [$mytoplevel.s_r.send.entry get]] \ + [::dialog_gatom::escape [$mytoplevel.s_r.receive.entry get]]" +} + + +proc gatom_cancel {mytoplevel} { + # TODO kludge!! until a common approach to ::pd_bindings::panel_bindings + # is sorted out + ::dialog_gatom::cancel $mytoplevel +} + +proc ::dialog_gatom::cancel {mytoplevel} { + pdsend "$mytoplevel cancel" +} + + +proc gatom_ok {mytoplevel} { + # TODO kludge!! until a common approach to ::pd_bindings::panel_bindings + # is sorted out + ::dialog_gatom::ok $mytoplevel +} +proc ::dialog_gatom::ok {mytoplevel} { + ::dialog_gatom::apply $mytoplevel + ::dialog_gatom::cancel $mytoplevel +} + +# set up the panel with the info from pd +proc ::dialog_gatom::pdtk_gatom_dialog {mytoplevel initwidth initlower \ + initupper initgatomlabel_position initgatomlabel initsend initreceive} { + global gatomlabel_position + set gatomlabel_position($mytoplevel) $initgatomlabel_position + + if {[winfo exists $mytoplevel]} { + wm deiconify $mytoplevel + raise $mytoplevel + } else { + create_panel $mytoplevel + } + + $mytoplevel.width.entry insert 0 $initwidth + $mytoplevel.limits.lower.entry insert 0 $initlower + $mytoplevel.limits.upper.entry insert 0 $initupper + if {$initgatomlabel ne "-"} { + $mytoplevel.gatomlabel.name.entry insert 0 $initgatomlabel + } + set gatomlabel_position($mytoplevel) $initgatomlabel_position + if {$initsend ne "-"} { + $mytoplevel.s_r.send.entry insert 0 $initsend + } + if {$initreceive ne "-"} { + $mytoplevel.s_r.receive.entry insert 0 $initreceive + } +} + +proc ::dialog_gatom::create_panel {mytoplevel} { + global gatomlabel_position + + toplevel $mytoplevel + wm title $mytoplevel "atom box properties" + wm resizable $mytoplevel 0 0 + catch { # not all platforms/Tcls versions have these options + wm attributes $mytoplevel -topmost 1 + #wm attributes $mytoplevel -transparent 1 + #$mytoplevel configure -highlightthickness 1 + } + wm protocol $mytoplevel WM_DELETE_WINDOW "::dialog_gatom::cancel $mytoplevel" + + ::pd_bindings::panel_bindings $mytoplevel "gatom" + + frame $mytoplevel.width -height 7 + pack $mytoplevel.width -side top + label $mytoplevel.width.label -text "width" + entry $mytoplevel.width.entry -width 4 + pack $mytoplevel.width.label $mytoplevel.width.entry -side left + + labelframe $mytoplevel.limits -text "limits" -padx 15 -pady 4 -borderwidth 1 \ + -font highlight_font + pack $mytoplevel.limits -side top -fill x + frame $mytoplevel.limits.lower + pack $mytoplevel.limits.lower -side left + label $mytoplevel.limits.lower.label -text "lower" + entry $mytoplevel.limits.lower.entry -width 8 + pack $mytoplevel.limits.lower.label $mytoplevel.limits.lower.entry -side left + frame $mytoplevel.limits.upper + pack $mytoplevel.limits.upper -side left + frame $mytoplevel.limits.upper.spacer -width 20 + label $mytoplevel.limits.upper.label -text "upper" + entry $mytoplevel.limits.upper.entry -width 8 + pack $mytoplevel.limits.upper.spacer $mytoplevel.limits.upper.label \ + $mytoplevel.limits.upper.entry -side left + + frame $mytoplevel.spacer1 -height 7 + pack $mytoplevel.spacer1 -side top + + labelframe $mytoplevel.gatomlabel -text "label" -padx 5 -pady 4 -borderwidth 1 \ + -font highlight_font + pack $mytoplevel.gatomlabel -side top -fill x + frame $mytoplevel.gatomlabel.name + pack $mytoplevel.gatomlabel.name -side top + entry $mytoplevel.gatomlabel.name.entry -width 33 + pack $mytoplevel.gatomlabel.name.entry -side left + frame $mytoplevel.gatomlabel.radio + pack $mytoplevel.gatomlabel.radio -side top + radiobutton $mytoplevel.gatomlabel.radio.left -value 0 -text "left " \ + -variable gatomlabel_position($mytoplevel) -justify left -takefocus 0 + radiobutton $mytoplevel.gatomlabel.radio.right -value 1 -text "right" \ + -variable gatomlabel_position($mytoplevel) -justify left -takefocus 0 + radiobutton $mytoplevel.gatomlabel.radio.top -value 2 -text "top" \ + -variable gatomlabel_position($mytoplevel) -justify left -takefocus 0 + radiobutton $mytoplevel.gatomlabel.radio.bottom -value 3 -text "bottom" \ + -variable gatomlabel_position($mytoplevel) -justify left -takefocus 0 + pack $mytoplevel.gatomlabel.radio.left -side left -anchor w + pack $mytoplevel.gatomlabel.radio.right -side right -anchor w + pack $mytoplevel.gatomlabel.radio.top -side top -anchor w + pack $mytoplevel.gatomlabel.radio.bottom -side bottom -anchor w + + frame $mytoplevel.spacer2 -height 7 + pack $mytoplevel.spacer2 -side top + + labelframe $mytoplevel.s_r -text "messages" -padx 5 -pady 4 -borderwidth 1 \ + -font highlight_font + pack $mytoplevel.s_r -side top -fill x + frame $mytoplevel.s_r.send + pack $mytoplevel.s_r.send -side top -anchor e + label $mytoplevel.s_r.send.label -text "send symbol" + entry $mytoplevel.s_r.send.entry -width 21 + pack $mytoplevel.s_r.send.entry $mytoplevel.s_r.send.label -side right + + frame $mytoplevel.s_r.receive + pack $mytoplevel.s_r.receive -side top -anchor e + label $mytoplevel.s_r.receive.label -text "receive symbol" + entry $mytoplevel.s_r.receive.entry -width 21 + pack $mytoplevel.s_r.receive.entry $mytoplevel.s_r.receive.label -side right + + frame $mytoplevel.buttonframe -pady 5 + pack $mytoplevel.buttonframe -side top -fill x -pady 2m + button $mytoplevel.buttonframe.cancel -text {Cancel} \ + -command "::dialog_gatom::cancel $mytoplevel" + pack $mytoplevel.buttonframe.cancel -side left -expand 1 + button $mytoplevel.buttonframe.apply -text {Apply} \ + -command "::dialog_gatom::apply $mytoplevel" + pack $mytoplevel.buttonframe.apply -side left -expand 1 + button $mytoplevel.buttonframe.ok -text {OK} \ + -command "::dialog_gatom::ok $mytoplevel" + pack $mytoplevel.buttonframe.ok -side left -expand 1 + + $mytoplevel.width.entry select from 0 + $mytoplevel.width.entry select adjust end + focus $mytoplevel.width.entry +} diff --git a/pd/tcl/dialog_iemgui.tcl b/pd/tcl/dialog_iemgui.tcl new file mode 100644 index 00000000..5aabf4c2 --- /dev/null +++ b/pd/tcl/dialog_iemgui.tcl @@ -0,0 +1,780 @@ +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "LICENSE.txt," in this distribution. +# Copyright (c) 1997-2009 Miller Puckette. + +package provide dialog_iemgui 0.1 + +namespace eval ::dialog_iemgui:: { + variable define_min_flashhold 50 + variable define_min_flashbreak 10 + variable define_min_fontsize 4 + + namespace export pdtk_iemgui_dialog +} + +# TODO rename $mytoplevel to $mytoplevel + +proc ::dialog_iemgui::clip_dim {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_wdt [concat iemgui_wdt_$vid] + global $var_iemgui_wdt + set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid] + global $var_iemgui_min_wdt + set var_iemgui_hgt [concat iemgui_hgt_$vid] + global $var_iemgui_hgt + set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid] + global $var_iemgui_min_hgt + + if {[eval concat $$var_iemgui_wdt] < [eval concat $$var_iemgui_min_wdt]} { + set $var_iemgui_wdt [eval concat $$var_iemgui_min_wdt] + $mytoplevel.dim.w_ent configure -textvariable $var_iemgui_wdt + } + if {[eval concat $$var_iemgui_hgt] < [eval concat $$var_iemgui_min_hgt]} { + set $var_iemgui_hgt [eval concat $$var_iemgui_min_hgt] + $mytoplevel.dim.h_ent configure -textvariable $var_iemgui_hgt + } +} + +proc ::dialog_iemgui::clip_num {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_num [concat iemgui_num_$vid] + global $var_iemgui_num + + if {[eval concat $$var_iemgui_num] > 2000} { + set $var_iemgui_num 2000 + $mytoplevel.para.num_ent configure -textvariable $var_iemgui_num + } + if {[eval concat $$var_iemgui_num] < 1} { + set $var_iemgui_num 1 + $mytoplevel.para.num_ent configure -textvariable $var_iemgui_num + } +} + +proc ::dialog_iemgui::sched_rng {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_min_rng [concat iemgui_min_rng_$vid] + global $var_iemgui_min_rng + set var_iemgui_max_rng [concat iemgui_max_rng_$vid] + global $var_iemgui_max_rng + set var_iemgui_rng_sch [concat iemgui_rng_sch_$vid] + global $var_iemgui_rng_sch + + variable define_min_flashhold + variable define_min_flashbreak + + if {[eval concat $$var_iemgui_rng_sch] == 2} { + if {[eval concat $$var_iemgui_max_rng] < [eval concat $$var_iemgui_min_rng]} { + set hhh [eval concat $$var_iemgui_min_rng] + set $var_iemgui_min_rng [eval concat $$var_iemgui_max_rng] + set $var_iemgui_max_rng $hhh + $mytoplevel.rng.max_ent configure -textvariable $var_iemgui_max_rng + $mytoplevel.rng.min_ent configure -textvariable $var_iemgui_min_rng } + if {[eval concat $$var_iemgui_max_rng] < $define_min_flashhold} { + set $var_iemgui_max_rng $iemgui_define_min_flashhold + $mytoplevel.rng.max_ent configure -textvariable $var_iemgui_max_rng + } + if {[eval concat $$var_iemgui_min_rng] < $define_min_flashbreak} { + set $var_iemgui_min_rng $define_min_flashbreak + $mytoplevel.rng.min_ent configure -textvariable $var_iemgui_min_rng + } + } + if {[eval concat $$var_iemgui_rng_sch] == 1} { + if {[eval concat $$var_iemgui_min_rng] == 0.0} { + set $var_iemgui_min_rng 1.0 + $mytoplevel.rng.min_ent configure -textvariable $var_iemgui_min_rng + } + } +} + +proc ::dialog_iemgui::verify_rng {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_min_rng [concat iemgui_min_rng_$vid] + global $var_iemgui_min_rng + set var_iemgui_max_rng [concat iemgui_max_rng_$vid] + global $var_iemgui_max_rng + set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] + global $var_iemgui_lin0_log1 + + if {[eval concat $$var_iemgui_lin0_log1] == 1} { + if {[eval concat $$var_iemgui_max_rng] == 0.0 && [eval concat $$var_iemgui_min_rng] == 0.0} { + set $var_iemgui_max_rng 1.0 + $mytoplevel.rng.max_ent configure -textvariable $var_iemgui_max_rng + } + if {[eval concat $$var_iemgui_max_rng] > 0} { + if {[eval concat $$var_iemgui_min_rng] <= 0} { + set $var_iemgui_min_rng [expr [eval concat $$var_iemgui_max_rng] * 0.01] + $mytoplevel.rng.min_ent configure -textvariable $var_iemgui_min_rng + } + } else { + if {[eval concat $$var_iemgui_min_rng] > 0} { + set $var_iemgui_max_rng [expr [eval concat $$var_iemgui_min_rng] * 0.01] + $mytoplevel.rng.max_ent configure -textvariable $var_iemgui_max_rng + } + } + } +} + +proc ::dialog_iemgui::clip_fontsize {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid] + global $var_iemgui_gn_fs + + variable define_min_fontsize + + if {[eval concat $$var_iemgui_gn_fs] < $define_min_fontsize} { + set $var_iemgui_gn_fs $define_min_fontsize + $mytoplevel.label.fs_ent configure -textvariable $var_iemgui_gn_fs + } +} + +proc ::dialog_iemgui::set_col_example {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_bcol [concat iemgui_bcol_$vid] + global $var_iemgui_bcol + set var_iemgui_fcol [concat iemgui_fcol_$vid] + global $var_iemgui_fcol + set var_iemgui_lcol [concat iemgui_lcol_$vid] + global $var_iemgui_lcol + + $mytoplevel.colors.sections.lb_bk configure \ + -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -foreground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] \ + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] + + if { [eval concat $$var_iemgui_fcol] >= 0 } { + $mytoplevel.colors.sections.fr_bk configure \ + -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -foreground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] \ + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] + } else { + $mytoplevel.colors.sections.fr_bk configure \ + -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -foreground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_bcol]]} +} + +proc ::dialog_iemgui::preset_col {mytoplevel presetcol} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid] + global $var_iemgui_l2_f1_b0 + set var_iemgui_bcol [concat iemgui_bcol_$vid] + global $var_iemgui_bcol + set var_iemgui_fcol [concat iemgui_fcol_$vid] + global $var_iemgui_fcol + set var_iemgui_lcol [concat iemgui_lcol_$vid] + global $var_iemgui_lcol + + if { [eval concat $$var_iemgui_l2_f1_b0] == 0 } { set $var_iemgui_bcol $presetcol } + if { [eval concat $$var_iemgui_l2_f1_b0] == 1 } { set $var_iemgui_fcol $presetcol } + if { [eval concat $$var_iemgui_l2_f1_b0] == 2 } { set $var_iemgui_lcol $presetcol } + ::dialog_iemgui::set_col_example $mytoplevel +} + +proc ::dialog_iemgui::choose_col_bkfrlb {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid] + global $var_iemgui_l2_f1_b0 + set var_iemgui_bcol [concat iemgui_bcol_$vid] + global $var_iemgui_bcol + set var_iemgui_fcol [concat iemgui_fcol_$vid] + global $var_iemgui_fcol + set var_iemgui_lcol [concat iemgui_lcol_$vid] + global $var_iemgui_lcol + + if {[eval concat $$var_iemgui_l2_f1_b0] == 0} { + set $var_iemgui_bcol [expr [eval concat $$var_iemgui_bcol] & 0xFCFCFC] + set helpstring [tk_chooseColor -title [_ "Background color"] -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_bcol]]] + if { $helpstring != "" } { + set $var_iemgui_bcol [string replace $helpstring 0 0 "0x"] + set $var_iemgui_bcol [expr [eval concat $$var_iemgui_bcol] & 0xFCFCFC] } + } + if {[eval concat $$var_iemgui_l2_f1_b0] == 1} { + set $var_iemgui_fcol [expr [eval concat $$var_iemgui_fcol] & 0xFCFCFC] + set helpstring [tk_chooseColor -title [_ "Foreground color"] -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_fcol]]] + if { $helpstring != "" } { + set $var_iemgui_fcol [string replace $helpstring 0 0 "0x"] + set $var_iemgui_fcol [expr [eval concat $$var_iemgui_fcol] & 0xFCFCFC] } + } + if {[eval concat $$var_iemgui_l2_f1_b0] == 2} { + set $var_iemgui_lcol [expr [eval concat $$var_iemgui_lcol] & 0xFCFCFC] + set helpstring [tk_chooseColor -title [_ "Label color"] -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_lcol]]] + if { $helpstring != "" } { + set $var_iemgui_lcol [string replace $helpstring 0 0 "0x"] + set $var_iemgui_lcol [expr [eval concat $$var_iemgui_lcol] & 0xFCFCFC] } + } + ::dialog_iemgui::set_col_example $mytoplevel +} + +proc ::dialog_iemgui::lilo {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] + global $var_iemgui_lin0_log1 + set var_iemgui_lilo0 [concat iemgui_lilo0_$vid] + global $var_iemgui_lilo0 + set var_iemgui_lilo1 [concat iemgui_lilo1_$vid] + global $var_iemgui_lilo1 + + ::dialog_iemgui::sched_rng $mytoplevel + + if {[eval concat $$var_iemgui_lin0_log1] == 0} { + set $var_iemgui_lin0_log1 1 + $mytoplevel.para.lilo configure -text [eval concat $$var_iemgui_lilo1] + ::dialog_iemgui::verify_rng $mytoplevel + ::dialog_iemgui::sched_rng $mytoplevel + } else { + set $var_iemgui_lin0_log1 0 + $mytoplevel.para.lilo configure -text [eval concat $$var_iemgui_lilo0] + } +} + +proc ::dialog_iemgui::toggle_font {mytoplevel gn_f} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_gn_f [concat iemgui_gn_f_$vid] + global $var_iemgui_gn_f + + set $var_iemgui_gn_f $gn_f + + switch -- $gn_f { + 0 { set current_font $::font_family} + 1 { set current_font "Helvetica" } + 2 { set current_font "Times" } + } + set current_font_spec "{$current_font} 12 $::font_weight" + + $mytoplevel.label.fontpopup_label configure -text $current_font \ + -font $current_font_spec + $mytoplevel.label.name_entry configure -font $current_font_spec + $mytoplevel.colors.sections.fr_bk configure -font $current_font_spec + $mytoplevel.colors.sections.lb_bk configure -font $current_font_spec +} + +proc ::dialog_iemgui::lb {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_loadbang [concat iemgui_loadbang_$vid] + global $var_iemgui_loadbang + + if {[eval concat $$var_iemgui_loadbang] == 0} { + set $var_iemgui_loadbang 1 + $mytoplevel.para.lb configure -text "init" + } else { + set $var_iemgui_loadbang 0 + $mytoplevel.para.lb configure -text "no init" + } +} + +proc ::dialog_iemgui::stdy_jmp {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_steady [concat iemgui_steady_$vid] + global $var_iemgui_steady + + if {[eval concat $$var_iemgui_steady]} { + set $var_iemgui_steady 0 + $mytoplevel.para.stdy_jmp configure -text "jump on click" + } else { + set $var_iemgui_steady 1 + $mytoplevel.para.stdy_jmp configure -text "steady on click" + } +} + +proc ::dialog_iemgui::apply {mytoplevel} { + set vid [string trimleft $mytoplevel .] + + set var_iemgui_wdt [concat iemgui_wdt_$vid] + global $var_iemgui_wdt + set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid] + global $var_iemgui_min_wdt + set var_iemgui_hgt [concat iemgui_hgt_$vid] + global $var_iemgui_hgt + set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid] + global $var_iemgui_min_hgt + set var_iemgui_min_rng [concat iemgui_min_rng_$vid] + global $var_iemgui_min_rng + set var_iemgui_max_rng [concat iemgui_max_rng_$vid] + global $var_iemgui_max_rng + set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] + global $var_iemgui_lin0_log1 + set var_iemgui_lilo0 [concat iemgui_lilo0_$vid] + global $var_iemgui_lilo0 + set var_iemgui_lilo1 [concat iemgui_lilo1_$vid] + global $var_iemgui_lilo1 + set var_iemgui_loadbang [concat iemgui_loadbang_$vid] + global $var_iemgui_loadbang + set var_iemgui_num [concat iemgui_num_$vid] + global $var_iemgui_num + set var_iemgui_steady [concat iemgui_steady_$vid] + global $var_iemgui_steady + set var_iemgui_snd [concat iemgui_snd_$vid] + global $var_iemgui_snd + set var_iemgui_rcv [concat iemgui_rcv_$vid] + global $var_iemgui_rcv + set var_iemgui_gui_nam [concat iemgui_gui_nam_$vid] + global $var_iemgui_gui_nam + set var_iemgui_gn_dx [concat iemgui_gn_dx_$vid] + global $var_iemgui_gn_dx + set var_iemgui_gn_dy [concat iemgui_gn_dy_$vid] + global $var_iemgui_gn_dy + set var_iemgui_gn_f [concat iemgui_gn_f_$vid] + global $var_iemgui_gn_f + set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid] + global $var_iemgui_gn_fs + set var_iemgui_bcol [concat iemgui_bcol_$vid] + global $var_iemgui_bcol + set var_iemgui_fcol [concat iemgui_fcol_$vid] + global $var_iemgui_fcol + set var_iemgui_lcol [concat iemgui_lcol_$vid] + global $var_iemgui_lcol + + ::dialog_iemgui::clip_dim $mytoplevel + ::dialog_iemgui::clip_num $mytoplevel + ::dialog_iemgui::sched_rng $mytoplevel + ::dialog_iemgui::verify_rng $mytoplevel + ::dialog_iemgui::sched_rng $mytoplevel + ::dialog_iemgui::clip_fontsize $mytoplevel + + if {[eval concat $$var_iemgui_snd] == ""} {set hhhsnd "empty"} else {set hhhsnd [eval concat $$var_iemgui_snd]} + if {[eval concat $$var_iemgui_rcv] == ""} {set hhhrcv "empty"} else {set hhhrcv [eval concat $$var_iemgui_rcv]} + if {[eval concat $$var_iemgui_gui_nam] == ""} {set hhhgui_nam "empty" + } else { + set hhhgui_nam [eval concat $$var_iemgui_gui_nam]} + + if {[string index $hhhsnd 0] == "$"} { + set hhhsnd [string replace $hhhsnd 0 0 #] } + if {[string index $hhhrcv 0] == "$"} { + set hhhrcv [string replace $hhhrcv 0 0 #] } + if {[string index $hhhgui_nam 0] == "$"} { + set hhhgui_nam [string replace $hhhgui_nam 0 0 #] } + + set hhhsnd [unspace_text $hhhsnd] + set hhhrcv [unspace_text $hhhrcv] + set hhhgui_nam [unspace_text $hhhgui_nam] + + pdsend [concat $mytoplevel dialog \ + [eval concat $$var_iemgui_wdt] \ + [eval concat $$var_iemgui_hgt] \ + [eval concat $$var_iemgui_min_rng] \ + [eval concat $$var_iemgui_max_rng] \ + [eval concat $$var_iemgui_lin0_log1] \ + [eval concat $$var_iemgui_loadbang] \ + [eval concat $$var_iemgui_num] \ + $hhhsnd \ + $hhhrcv \ + $hhhgui_nam \ + [eval concat $$var_iemgui_gn_dx] \ + [eval concat $$var_iemgui_gn_dy] \ + [eval concat $$var_iemgui_gn_f] \ + [eval concat $$var_iemgui_gn_fs] \ + [eval concat $$var_iemgui_bcol] \ + [eval concat $$var_iemgui_fcol] \ + [eval concat $$var_iemgui_lcol] \ + [eval concat $$var_iemgui_steady]] +} + + +proc iemgui_cancel {mytoplevel} { + # TODO kludge!! until a common approach to ::pd_bindings::panel_bindings + # is sorted out + ::dialog_iemgui::cancel $mytoplevel +} +proc ::dialog_iemgui::cancel {mytoplevel} { + pdsend "$mytoplevel cancel" +} + +proc iemgui_ok {mytoplevel} { + # TODO kludge!! until a common approach to ::pd_bindings::panel_bindings + # is sorted out + ::dialog_iemgui::ok $mytoplevel +} +proc ::dialog_iemgui::ok {mytoplevel} { + ::dialog_iemgui::apply $mytoplevel + ::dialog_iemgui::cancel $mytoplevel +} + +proc ::dialog_iemgui::pdtk_iemgui_dialog {mytoplevel mainheader dim_header \ + wdt min_wdt wdt_label \ + hgt min_hgt hgt_label \ + rng_header min_rng min_rng_label max_rng \ + max_rng_label rng_sched \ + lin0_log1 lilo0_label lilo1_label \ + loadbang steady num_label num \ + snd rcv \ + gui_name \ + gn_dx gn_dy gn_f gn_fs \ + bcol fcol lcol} { + + set vid [string trimleft $mytoplevel .] + + set var_iemgui_wdt [concat iemgui_wdt_$vid] + global $var_iemgui_wdt + set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid] + global $var_iemgui_min_wdt + set var_iemgui_hgt [concat iemgui_hgt_$vid] + global $var_iemgui_hgt + set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid] + global $var_iemgui_min_hgt + set var_iemgui_min_rng [concat iemgui_min_rng_$vid] + global $var_iemgui_min_rng + set var_iemgui_max_rng [concat iemgui_max_rng_$vid] + global $var_iemgui_max_rng + set var_iemgui_rng_sch [concat iemgui_rng_sch_$vid] + global $var_iemgui_rng_sch + set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] + global $var_iemgui_lin0_log1 + set var_iemgui_lilo0 [concat iemgui_lilo0_$vid] + global $var_iemgui_lilo0 + set var_iemgui_lilo1 [concat iemgui_lilo1_$vid] + global $var_iemgui_lilo1 + set var_iemgui_loadbang [concat iemgui_loadbang_$vid] + global $var_iemgui_loadbang + set var_iemgui_num [concat iemgui_num_$vid] + global $var_iemgui_num + set var_iemgui_steady [concat iemgui_steady_$vid] + global $var_iemgui_steady + set var_iemgui_snd [concat iemgui_snd_$vid] + global $var_iemgui_snd + set var_iemgui_rcv [concat iemgui_rcv_$vid] + global $var_iemgui_rcv + set var_iemgui_gui_nam [concat iemgui_gui_nam_$vid] + global $var_iemgui_gui_nam + set var_iemgui_gn_dx [concat iemgui_gn_dx_$vid] + global $var_iemgui_gn_dx + set var_iemgui_gn_dy [concat iemgui_gn_dy_$vid] + global $var_iemgui_gn_dy + set var_iemgui_gn_f [concat iemgui_gn_f_$vid] + global $var_iemgui_gn_f + set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid] + global $var_iemgui_gn_fs + set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid] + global $var_iemgui_l2_f1_b0 + set var_iemgui_bcol [concat iemgui_bcol_$vid] + global $var_iemgui_bcol + set var_iemgui_fcol [concat iemgui_fcol_$vid] + global $var_iemgui_fcol + set var_iemgui_lcol [concat iemgui_lcol_$vid] + global $var_iemgui_lcol + + set $var_iemgui_wdt $wdt + set $var_iemgui_min_wdt $min_wdt + set $var_iemgui_hgt $hgt + set $var_iemgui_min_hgt $min_hgt + set $var_iemgui_min_rng $min_rng + set $var_iemgui_max_rng $max_rng + set $var_iemgui_rng_sch $rng_sched + set $var_iemgui_lin0_log1 $lin0_log1 + set $var_iemgui_lilo0 $lilo0_label + set $var_iemgui_lilo1 $lilo1_label + set $var_iemgui_loadbang $loadbang + set $var_iemgui_num $num + set $var_iemgui_steady $steady + if {$snd == "empty"} {set $var_iemgui_snd [format ""] + } else {set $var_iemgui_snd [format "%s" $snd]} + if {$rcv == "empty"} {set $var_iemgui_rcv [format ""] + } else {set $var_iemgui_rcv [format "%s" $rcv]} + if {$gui_name == "empty"} {set $var_iemgui_gui_nam [format ""] + } else {set $var_iemgui_gui_nam [format "%s" $gui_name]} + + if {[string index [eval concat $$var_iemgui_snd] 0] == "#"} { + set $var_iemgui_snd [string replace [eval concat $$var_iemgui_snd] 0 0 $] } + if {[string index [eval concat $$var_iemgui_rcv] 0] == "#"} { + set $var_iemgui_rcv [string replace [eval concat $$var_iemgui_rcv] 0 0 $] } + if {[string index [eval concat $$var_iemgui_gui_nam] 0] == "#"} { + set $var_iemgui_gui_nam [string replace [eval concat $$var_iemgui_gui_nam] 0 0 $] } + set $var_iemgui_gn_dx $gn_dx + set $var_iemgui_gn_dy $gn_dy + set $var_iemgui_gn_f $gn_f + set $var_iemgui_gn_fs $gn_fs + + set $var_iemgui_bcol $bcol + set $var_iemgui_fcol $fcol + set $var_iemgui_lcol $lcol + + set $var_iemgui_l2_f1_b0 0 + + toplevel $mytoplevel + wm title $mytoplevel [format [_ "%s Properties"] $mainheader] + wm resizable $mytoplevel 0 0 + wm protocol $mytoplevel WM_DELETE_WINDOW [concat ::dialog_iemgui::cancel $mytoplevel] + + ::pd_bindings::panel_bindings $mytoplevel "iemgui" + + frame $mytoplevel.dim + pack $mytoplevel.dim -side top + label $mytoplevel.dim.head -text $dim_header + label $mytoplevel.dim.w_lab -text [_ $wdt_label] -width 6 + entry $mytoplevel.dim.w_ent -textvariable $var_iemgui_wdt -width 5 + label $mytoplevel.dim.dummy1 -text " " -width 10 + label $mytoplevel.dim.h_lab -text [_ $hgt_label] -width 6 + entry $mytoplevel.dim.h_ent -textvariable $var_iemgui_hgt -width 5 + pack $mytoplevel.dim.head -side top + pack $mytoplevel.dim.w_lab $mytoplevel.dim.w_ent $mytoplevel.dim.dummy1 -side left + if { $hgt_label != "empty" } { + pack $mytoplevel.dim.h_lab $mytoplevel.dim.h_ent -side left} + + frame $mytoplevel.rng + pack $mytoplevel.rng -side top + label $mytoplevel.rng.head -text $rng_header + label $mytoplevel.rng.min_lab -text [_ $min_rng_label] -width 6 + entry $mytoplevel.rng.min_ent -textvariable $var_iemgui_min_rng -width 9 + label $mytoplevel.rng.dummy1 -text " " -width 1 + label $mytoplevel.rng.max_lab -text [_ $max_rng_label] -width 8 + entry $mytoplevel.rng.max_ent -textvariable $var_iemgui_max_rng -width 9 + if { $rng_header != "empty" } { + pack $mytoplevel.rng.head -side top + if { $min_rng_label != "empty" } { + pack $mytoplevel.rng.min_lab $mytoplevel.rng.min_ent -side left} + if { $max_rng_label != "empty" } { + pack $mytoplevel.rng.dummy1 \ + $mytoplevel.rng.max_lab $mytoplevel.rng.max_ent -side left} } + + if { [eval concat $$var_iemgui_lin0_log1] >= 0 || [eval concat $$var_iemgui_loadbang] >= 0 || [eval concat $$var_iemgui_num] > 0 || [eval concat $$var_iemgui_steady] >= 0 } { + label $mytoplevel.space1 -text "" + pack $mytoplevel.space1 -side top } + + frame $mytoplevel.para + pack $mytoplevel.para -side top + label $mytoplevel.para.dummy2 -text "" -width 1 + label $mytoplevel.para.dummy3 -text "" -width 1 + if {[eval concat $$var_iemgui_lin0_log1] == 0} { + button $mytoplevel.para.lilo -text [_ [eval concat $$var_iemgui_lilo0]] -width 5 \ + -command "::dialog_iemgui::lilo $mytoplevel" } + if {[eval concat $$var_iemgui_lin0_log1] == 1} { + button $mytoplevel.para.lilo -text [_ [eval concat $$var_iemgui_lilo1]] -width 5 \ + -command "::dialog_iemgui::lilo $mytoplevel" } + if {[eval concat $$var_iemgui_loadbang] == 0} { + button $mytoplevel.para.lb -text [_ "no init"] \ + -width [::msgcat::mcmax "no init"] \ + -command "::dialog_iemgui::lb $mytoplevel" } + if {[eval concat $$var_iemgui_loadbang] == 1} { + button $mytoplevel.para.lb -text [_ "Save"] \ + -width [::msgcat::mcmax "Save"] \ + -command "::dialog_iemgui::lb $mytoplevel" } + label $mytoplevel.para.num_lab -text [_ $num_label] -width 9 + entry $mytoplevel.para.num_ent -textvariable $var_iemgui_num -width 4 + + if {[eval concat $$var_iemgui_steady] == 0} { + button $mytoplevel.para.stdy_jmp -command "::dialog_iemgui::stdy_jmp $mytoplevel" \ + -text [_ "jump on click"] -width 12 } + if {[eval concat $$var_iemgui_steady] == 1} { + button $mytoplevel.para.stdy_jmp -command "::dialog_iemgui::stdy_jmp $mytoplevel" \ + -text [_ "steady on click"] -width 12 } + if {[eval concat $$var_iemgui_lin0_log1] >= 0} { + pack $mytoplevel.para.lilo -side left -expand 1} + if {[eval concat $$var_iemgui_loadbang] >= 0} { + pack $mytoplevel.para.dummy2 $mytoplevel.para.lb -side left -expand 1} + if {[eval concat $$var_iemgui_num] > 0} { + pack $mytoplevel.para.dummy3 $mytoplevel.para.num_lab $mytoplevel.para.num_ent -side left -expand 1} + if {[eval concat $$var_iemgui_steady] >= 0} { + pack $mytoplevel.para.dummy3 $mytoplevel.para.stdy_jmp -side left -expand 1} + + frame $mytoplevel.spacer0 -height 4 + pack $mytoplevel.spacer0 -side top + + labelframe $mytoplevel.s_r -borderwidth 1 -pady 4 -text [_ "Messages"] \ + -font highlight_font + pack $mytoplevel.s_r -side top -fill x -ipadx 5 + frame $mytoplevel.s_r.send + pack $mytoplevel.s_r.send -side top + label $mytoplevel.s_r.send.lab -text [_ "Send symbol"] -width 12 -justify right + entry $mytoplevel.s_r.send.ent -textvariable $var_iemgui_snd -width 22 + if { $snd != "nosndno" } { + pack $mytoplevel.s_r.send.lab $mytoplevel.s_r.send.ent -side left} + + frame $mytoplevel.s_r.receive + pack $mytoplevel.s_r.receive -side top + label $mytoplevel.s_r.receive.lab -text [_ "Receive symbol"] -width 12 -justify right + entry $mytoplevel.s_r.receive.ent -textvariable $var_iemgui_rcv -width 22 + if { $rcv != "norcvno" } { + pack $mytoplevel.s_r.receive.lab $mytoplevel.s_r.receive.ent -side left} + + # get the current font name from the int given from C-space (gn_f) + set current_font $::font_family + if {[eval concat $$var_iemgui_gn_f] == 1} \ + { set current_font "Helvetica" } + if {[eval concat $$var_iemgui_gn_f] == 2} \ + { set current_font "Times" } + + frame $mytoplevel.spacer1 -height 7 + pack $mytoplevel.spacer1 -side top + + labelframe $mytoplevel.label -borderwidth 1 -text [_ "Label"] -pady 4 \ + -font highlight_font + pack $mytoplevel.label -side top -fill x + entry $mytoplevel.label.name_entry -textvariable $var_iemgui_gui_nam -width 30 \ + -font [list $current_font 12 $::font_weight] + pack $mytoplevel.label.name_entry -side top -expand yes -fill both -padx 5 + + frame $mytoplevel.label.xy -padx 27 -pady 1 + pack $mytoplevel.label.xy -side top + label $mytoplevel.label.xy.x_lab -text [_ "X offset"] -width 6 + entry $mytoplevel.label.xy.x_entry -textvariable $var_iemgui_gn_dx -width 5 + label $mytoplevel.label.xy.dummy1 -text " " -width 2 + label $mytoplevel.label.xy.y_lab -text [_ "Y offset"] -width 6 + entry $mytoplevel.label.xy.y_entry -textvariable $var_iemgui_gn_dy -width 5 + pack $mytoplevel.label.xy.x_lab $mytoplevel.label.xy.x_entry $mytoplevel.label.xy.dummy1 \ + $mytoplevel.label.xy.y_lab $mytoplevel.label.xy.y_entry -side left -anchor e + + label $mytoplevel.label.fontpopup_label -text $current_font \ + -relief groove -font [list $current_font 12 $::font_weight] -padx 5 + pack $mytoplevel.label.fontpopup_label -side left -anchor w -expand yes -fill x + label $mytoplevel.label.fontsize_label -text [_ "size:"] -width 4 + entry $mytoplevel.label.fontsize_entry -textvariable $var_iemgui_gn_fs -width 5 + pack $mytoplevel.label.fontsize_entry $mytoplevel.label.fontsize_label \ + -side right -anchor e -padx 5 -pady 5 + menu $mytoplevel.popup + $mytoplevel.popup add command \ + -label $::font_family \ + -font [format {{%s} 12 %s} $::font_family $::font_weight] \ + -command "::dialog_iemgui::toggle_font $mytoplevel 0" + $mytoplevel.popup add command \ + -label "Helvetica" \ + -font [format {Helvetica 12 %s} $::font_weight] \ + -command "::dialog_iemgui::toggle_font $mytoplevel 1" + $mytoplevel.popup add command \ + -label "Times" \ + -font [format {Times 12 %s} $::font_weight] \ + -command "::dialog_iemgui::toggle_font $mytoplevel 2" + bind $mytoplevel.label.fontpopup_label