Revision: 10464 http://pure-data.svn.sourceforge.net/pure-data/?rev=10464&view=rev Author: eighthave Date: 2008-12-25 09:30:33 +0000 (Thu, 25 Dec 2008)
Log Message: ----------- first stab at making the iemgui code a package
Added Paths: ----------- branches/pd-devel/0.41.4/src/pd_iemgui.tcl
Added: branches/pd-devel/0.41.4/src/pd_iemgui.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_iemgui.tcl (rev 0) +++ branches/pd-devel/0.41.4/src/pd_iemgui.tcl 2008-12-25 09:30:33 UTC (rev 10464) @@ -0,0 +1,784 @@ +# 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 pd_iemgui 0.1 +namespace eval ::pd_iemgui:: { + variable define_min_flashhold 50 + variable define_min_flashbreak 10 + variable define_min_fontsize 4 + + namespace export pdtk_iemgui_dialog +} + +############ pdtk_iemgui_dialog -- dialog window for iem guis ######### + + +proc ::pd_iemgui::clip_dim {id} { + set vid [string trimleft $id .] + + 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] + $id.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] + $id.dim.h_ent configure -textvariable $var_iemgui_hgt + } +} + +proc ::pd_iemgui::clip_num {id} { + set vid [string trimleft $id .] + + set var_iemgui_num [concat iemgui_num_$vid] + global $var_iemgui_num + + if {[eval concat $$var_iemgui_num] > 2000} { + set $var_iemgui_num 2000 + $id.para.num_ent configure -textvariable $var_iemgui_num + } + if {[eval concat $$var_iemgui_num] < 1} { + set $var_iemgui_num 1 + $id.para.num_ent configure -textvariable $var_iemgui_num + } +} + +proc ::pd_iemgui::sched_rng {id} { + set vid [string trimleft $id .] + + 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 + $id.rng.max_ent configure -textvariable $var_iemgui_max_rng + $id.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 + $id.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 + $id.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 + $id.rng.min_ent configure -textvariable $var_iemgui_min_rng + } + } +} + +proc ::pd_iemgui::verify_rng {id} { + set vid [string trimleft $id .] + + 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 + $id.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] + $id.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] + $id.rng.max_ent configure -textvariable $var_iemgui_max_rng + } + } + } +} + +proc ::pd_iemgui::clip_fontsize {id} { + set vid [string trimleft $id .] + + 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 + $id.label.fs_ent configure -textvariable $var_iemgui_gn_fs + } +} + +proc ::pd_iemgui::set_col_example {id} { + set vid [string trimleft $id .] + + 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 + + $id.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 } { + $id.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 { + $id.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 ::pd_iemgui::preset_col {id presetcol} { + set vid [string trimleft $id .] + + 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 } + ::pd_iemgui::set_col_example $id +} + +proc ::pd_iemgui::choose_col_bkfrlb {id} { + set vid [string trimleft $id .] + + 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 "Front-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] } + } + ::pd_iemgui::set_col_example $id +} + +proc ::pd_iemgui::lilo {id} { + set vid [string trimleft $id .] + + set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] + global $var_iemgui_lin0_log1 + set var_::pd_iemgui::lilo0 [concat ::pd_iemgui::lilo0_$vid] + global $var_::pd_iemgui::lilo0 + set var_::pd_iemgui::lilo1 [concat ::pd_iemgui::lilo1_$vid] + global $var_::pd_iemgui::lilo1 + + ::pd_iemgui::sched_rng $id + + if {[eval concat $$var_iemgui_lin0_log1] == 0} { + set $var_iemgui_lin0_log1 1 + $id.para.lilo configure -text [eval concat $$var_::pd_iemgui::lilo1] + ::pd_iemgui::verify_rng $id + ::pd_iemgui::sched_rng $id + } else { + set $var_iemgui_lin0_log1 0 + $id.para.lilo configure -text [eval concat $$var_::pd_iemgui::lilo0] + } +} + +proc ::pd_iemgui::toggle_font {id gn_f} { + set vid [string trimleft $id .] + + set var_iemgui_gn_f [concat iemgui_gn_f_$vid] + global $var_iemgui_gn_f + global fontname fontweight + + set $var_iemgui_gn_f $gn_f + + switch -- $gn_f { + 0 { set current_font $fontname} + 1 { set current_font "Helvetica" } + 2 { set current_font "Times" } + } + set current_font_spec "{$current_font} 12 $fontweight" + + $id.label.fontpopup_label configure -text $current_font \ + -font $current_font_spec + $id.label.name_entry configure -font $current_font_spec + $id.colors.sections.fr_bk configure -font $current_font_spec + $id.colors.sections.lb_bk configure -font $current_font_spec +} + +proc ::pd_iemgui::lb {id} { + set vid [string trimleft $id .] + + set var_iemgui_loadbang [concat iemgui_loadbang_$vid] + global $var_iemgui_loadbang + + if {[eval concat $$var_iemgui_loadbang] == 0} { + set $var_iemgui_loadbang 1 + $id.para.lb configure -text "init" + } else { + set $var_iemgui_loadbang 0 + $id.para.lb configure -text "no init" + } +} + +proc ::pd_iemgui::stdy_jmp {id} { + set vid [string trimleft $id .] + + set var_iemgui_steady [concat iemgui_steady_$vid] + global $var_iemgui_steady + + if {[eval concat $$var_iemgui_steady]} { + set $var_iemgui_steady 0 + $id.para.stdy_jmp configure -text "jump on click" + } else { + set $var_iemgui_steady 1 + $id.para.stdy_jmp configure -text "steady on click" + } +} + +proc ::pd_iemgui::apply {id} { + set vid [string trimleft $id .] + + 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_::pd_iemgui::lilo0 [concat ::pd_iemgui::lilo0_$vid] + global $var_::pd_iemgui::lilo0 + set var_::pd_iemgui::lilo1 [concat ::pd_iemgui::lilo1_$vid] + global $var_::pd_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 + + ::pd_iemgui::clip_dim $id + ::pd_iemgui::clip_num $id + ::pd_iemgui::sched_rng $id + ::pd_iemgui::verify_rng $id + ::pd_iemgui::sched_rng $id + ::pd_iemgui::clip_fontsize $id + + 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 [pdtk_unspace $hhhsnd] + set hhhrcv [pdtk_unspace $hhhrcv] + set hhhgui_nam [pdtk_unspace $hhhgui_nam] + + pd [concat $id 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 ::pd_iemgui::cancel {id} {pd [concat $id cancel ;]} + +proc ::pd_iemgui::ok {id} { + ::pd_iemgui::apply $id + ::pd_iemgui::cancel $id +} + +proc ::pd_iemgui::pdtk_iemgui_dialog {id 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 $id .] + + global pd_nt + global fontname fontweight + + 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_::pd_iemgui::lilo0 [concat ::pd_iemgui::lilo0_$vid] + global $var_::pd_iemgui::lilo0 + set var_::pd_iemgui::lilo1 [concat ::pd_iemgui::lilo1_$vid] + global $var_::pd_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_::pd_iemgui::lilo0 $lilo0_label + set $var_::pd_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 $id + wm title $id [format "%s Properties" $mainheader] + wm resizable $id 0 0 + wm protocol $id WM_DELETE_WINDOW [concat ::pd_iemgui::cancel $id] + + frame $id.dim + pack $id.dim -side top + label $id.dim.head -text $dim_header + label $id.dim.w_lab -text $wdt_label -width 6 + entry $id.dim.w_ent -textvariable $var_iemgui_wdt -width 5 + label $id.dim.dummy1 -text " " -width 10 + label $id.dim.h_lab -text $hgt_label -width 6 + entry $id.dim.h_ent -textvariable $var_iemgui_hgt -width 5 + pack $id.dim.head -side top + pack $id.dim.w_lab $id.dim.w_ent $id.dim.dummy1 -side left + if { $hgt_label != "empty" } { + pack $id.dim.h_lab $id.dim.h_ent -side left} + + frame $id.rng + pack $id.rng -side top + label $id.rng.head -text $rng_header + label $id.rng.min_lab -text $min_rng_label -width 6 + entry $id.rng.min_ent -textvariable $var_iemgui_min_rng -width 9 + label $id.rng.dummy1 -text " " -width 1 + label $id.rng.max_lab -text $max_rng_label -width 8 + entry $id.rng.max_ent -textvariable $var_iemgui_max_rng -width 9 + if { $rng_header != "empty" } { + pack $id.rng.head -side top + if { $min_rng_label != "empty" } { + pack $id.rng.min_lab $id.rng.min_ent -side left} + if { $max_rng_label != "empty" } { + pack $id.rng.dummy1 \ + $id.rng.max_lab $id.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 $id.space1 -text "" + pack $id.space1 -side top } + + frame $id.para + pack $id.para -side top + label $id.para.dummy2 -text "" -width 1 + label $id.para.dummy3 -text "" -width 1 + if {[eval concat $$var_iemgui_lin0_log1] == 0} { + button $id.para.lilo -text [eval concat $$var_::pd_iemgui::lilo0] -width 5 -command "::pd_iemgui::lilo $id" } + if {[eval concat $$var_iemgui_lin0_log1] == 1} { + button $id.para.lilo -text [eval concat $$var_::pd_iemgui::lilo1] -width 5 -command "::pd_iemgui::lilo $id" } + if {[eval concat $$var_iemgui_loadbang] == 0} { + button $id.para.lb -text "no init" -width 5 -command "::pd_iemgui::lb $id" } + if {[eval concat $$var_iemgui_loadbang] == 1} { + button $id.para.lb -text "init" -width 5 -command "::pd_iemgui::lb $id" } + label $id.para.num_lab -text $num_label -width 9 + entry $id.para.num_ent -textvariable $var_iemgui_num -width 4 + if {[eval concat $$var_iemgui_steady] == 0} { + button $id.para.stdy_jmp -text "jump on click" -width 11 -command "::pd_iemgui::stdy_jmp $id" } + if {[eval concat $$var_iemgui_steady] == 1} { + button $id.para.stdy_jmp -text "steady on click" -width 11 -command "::pd_iemgui::stdy_jmp $id" } + if {[eval concat $$var_iemgui_lin0_log1] >= 0} { + pack $id.para.lilo -side left -expand 1} + if {[eval concat $$var_iemgui_loadbang] >= 0} { + pack $id.para.dummy2 $id.para.lb -side left -expand 1} + if {[eval concat $$var_iemgui_num] > 0} { + pack $id.para.dummy3 $id.para.num_lab $id.para.num_ent -side left -expand 1} + if {[eval concat $$var_iemgui_steady] >= 0} { + pack $id.para.dummy3 $id.para.stdy_jmp -side left -expand 1} + + frame $id.spacer0 -height 4 + pack $id.spacer0 -side top + + labelframe $id.s_r -borderwidth 1 -pady 4 -text "messages" \ + -font highlight_font + pack $id.s_r -side top -fill x -ipadx 5 + frame $id.s_r.send + pack $id.s_r.send -side top + label $id.s_r.send.lab -text " send-symbol:" -width 12 -justify right + entry $id.s_r.send.ent -textvariable $var_iemgui_snd -width 22 + if { $snd != "nosndno" } { + pack $id.s_r.send.lab $id.s_r.send.ent -side left} + + frame $id.s_r.receive + pack $id.s_r.receive -side top + label $id.s_r.receive.lab -text "receive-symbol:" -width 12 -justify right + entry $id.s_r.receive.ent -textvariable $var_iemgui_rcv -width 22 + if { $rcv != "norcvno" } { + pack $id.s_r.receive.lab $id.s_r.receive.ent -side left} + + # get the current font name from the int given from C-space (gn_f) + set current_font $fontname + 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 $id.spacer1 -height 7 + pack $id.spacer1 -side top + + labelframe $id.label -borderwidth 1 -text "label" -pady 4 \ + -font highlight_font + pack $id.label -side top -fill x + entry $id.label.name_entry -textvariable $var_iemgui_gui_nam -width 30 \ + -font [list $current_font 12 $fontweight] + pack $id.label.name_entry -side top -expand yes -fill both -padx 5 + + frame $id.label.xy -padx 27 -pady 1 + pack $id.label.xy -side top + label $id.label.xy.x_lab -text "x offset" -width 6 + entry $id.label.xy.x_entry -textvariable $var_iemgui_gn_dx -width 5 + label $id.label.xy.dummy1 -text " " -width 2 + label $id.label.xy.y_lab -text "y offset" -width 6 + entry $id.label.xy.y_entry -textvariable $var_iemgui_gn_dy -width 5 + pack $id.label.xy.x_lab $id.label.xy.x_entry $id.label.xy.dummy1 \ + $id.label.xy.y_lab $id.label.xy.y_entry -side left -anchor e + + label $id.label.fontpopup_label -text $current_font \ + -relief groove -font [list $current_font 12 $fontweight] -padx 5 + pack $id.label.fontpopup_label -side left -anchor w -expand yes -fill x + label $id.label.fontsize_label -text "size" -width 4 + entry $id.label.fontsize_entry -textvariable $var_iemgui_gn_fs -width 5 + pack $id.label.fontsize_entry $id.label.fontsize_label \ + -side right -anchor e -padx 5 -pady 5 + menu $id.popup + $id.popup add command \ + -label $fontname \ + -font [format {{%s} 12 %s} $fontname $fontweight] \ + -command "::pd_iemgui::toggle_font $id 0" + $id.popup add command \ + -label "Helvetica" \ + -font [format {Helvetica 12 %s} $fontweight] \ + -command "::pd_iemgui::toggle_font $id 1" + $id.popup add command \ + -label "Times" \ + -font [format {Times 12 %s} $fontweight] \ + -command "::pd_iemgui::toggle_font $id 2" + bind $id.label.fontpopup_label <Button> \ + [list tk_popup $id.popup %X %Y] + + frame $id.spacer2 -height 7 + pack $id.spacer2 -side top + + labelframe $id.colors -borderwidth 1 -text "colors" -font highlight_font + pack $id.colors -fill x -ipadx 5 -ipady 4 + + frame $id.colors.select + pack $id.colors.select -side top + radiobutton $id.colors.select.radio0 -value 0 -variable \ + $var_iemgui_l2_f1_b0 -text "background" -width 10 -justify left + radiobutton $id.colors.select.radio1 -value 1 -variable \ + $var_iemgui_l2_f1_b0 -text "front" -width 5 -justify left + radiobutton $id.colors.select.radio2 -value 2 -variable \ + $var_iemgui_l2_f1_b0 -text "label" -width 5 -justify left + if { [eval concat $$var_iemgui_fcol] >= 0 } { + pack $id.colors.select.radio0 $id.colors.select.radio1 \ + $id.colors.select.radio2 -side left + } else { + pack $id.colors.select.radio0 $id.colors.select.radio2 -side left \ + } + + frame $id.colors.sections + pack $id.colors.sections -side top + button $id.colors.sections.but -text "compose color" -width 12 \ + -command "::pd_iemgui::choose_col_bkfrlb $id" + pack $id.colors.sections.but -side left -anchor w -padx 10 -pady 5 \ + -expand yes -fill x + if { [eval concat $$var_iemgui_fcol] >= 0 } { + label $id.colors.sections.fr_bk -text "o=||=o" -width 6 \ + -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]] \ + -font [list $current_font 12 $fontweight] -padx 2 -pady 2 -relief ridge + } else { + label $id.colors.sections.fr_bk -text "o=||=o" -width 6 \ + -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]] \ + -font [list $current_font 12 $fontweight] -padx 2 -pady 2 -relief ridge + } + label $id.colors.sections.lb_bk -text "testlabel" -width 9 \ + -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]] \ + -font [list $current_font 12 $fontweight] -padx 2 -pady 2 -relief ridge + pack $id.colors.sections.lb_bk $id.colors.sections.fr_bk \ + -side right -anchor e -expand yes -fill both -pady 7 + + # color scheme by Mary Ann Benedetto http://piR2.org + frame $id.colors.r1 + pack $id.colors.r1 -side top + foreach i { 0 1 2 3 4 5 6 7 8 9} \ + hexcol { 0xFFFFFF 0xDFDFDF 0xBBBBBB 0xFFC7C6 0xFFE3C6 \ + 0xFEFFC6 0xC6FFC7 0xc6FEFF 0xC7C6FF 0xE3C6FF } \ + { + label $id.colors.r1.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] -relief ridge \ + -padx 7 -pady 0 + bind $id.colors.r1.c$i <Button> [format "::pd_iemgui::preset_col %s %d" $id $hexcol] + } + pack $id.colors.r1.c0 $id.colors.r1.c1 $id.colors.r1.c2 $id.colors.r1.c3 \ + $id.colors.r1.c4 $id.colors.r1.c5 $id.colors.r1.c6 $id.colors.r1.c7 \ + $id.colors.r1.c8 $id.colors.r1.c9 -side left + + frame $id.colors.r2 + pack $id.colors.r2 -side top + foreach i { 0 1 2 3 4 5 6 7 8 9 } \ + hexcol { 0x9F9F9F 0x7C7C7C 0x606060 0xFF0400 0xFF8300 \ + 0xFAFF00 0x00FF04 0x00FAFF 0x0400FF 0x9C00FF } \ + { + label $id.colors.r2.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] -relief ridge \ + -padx 7 -pady 0 + bind $id.colors.r2.c$i <Button> \ + [format "::pd_iemgui::preset_col %s %d" $id $hexcol] + } + pack $id.colors.r2.c0 $id.colors.r2.c1 $id.colors.r2.c2 $id.colors.r2.c3 \ + $id.colors.r2.c4 $id.colors.r2.c5 $id.colors.r2.c6 $id.colors.r2.c7 \ + $id.colors.r2.c8 $id.colors.r2.c9 -side left + + frame $id.colors.r3 + pack $id.colors.r3 -side top + foreach i { 0 1 2 3 4 5 6 7 8 9 } \ + hexcol { 0x404040 0x202020 0x000000 0x551312 0x553512 \ + 0x535512 0x0F4710 0x0E4345 0x131255 0x2F004D } \ + { + label $id.colors.r3.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] -relief ridge \ + -padx 7 -pady 0 + bind $id.colors.r3.c$i <Button> \ + [format "::pd_iemgui::preset_col %s %d" $id $hexcol] + } + pack $id.colors.r3.c0 $id.colors.r3.c1 $id.colors.r3.c2 $id.colors.r3.c3 \ + $id.colors.r3.c4 $id.colors.r3.c5 $id.colors.r3.c6 $id.colors.r3.c7 \ + $id.colors.r3.c8 $id.colors.r3.c9 -side left + + frame $id.cao -pady 10 + pack $id.cao -side top + button $id.cao.cancel -text {Cancel} -width 6 \ + -command "::pd_iemgui::cancel $id" + label $id.cao.dummy1 -text "" -width 3 + button $id.cao.apply -text {Apply} -width 6 -command "::pd_iemgui::apply $id" + label $id.cao.dummy2 -text "" -width 3 + button $id.cao.ok -text {OK} -width 6 \ + -command "::pd_iemgui::ok $id" + + pack $id.cao.cancel $id.cao.dummy1 -side left + pack $id.cao.apply $id.cao.dummy2 -side left + pack $id.cao.ok -side left + + if {[info tclversion] < 8.4} { + bind $id <Key-Tab> {tkTabToWindow [tk_focusNext %W]} + bind $id <<PrevWindow>> {tkTabToWindow [tk_focusPrev %W]} + } else { + bind $id <Key-Tab> {tk::TabToWindow [tk_focusNext %W]} + bind $id <<PrevWindow>> {tk::TabToWindow [tk_focusPrev %W]} + } + + bind $id.dim.w_ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.dim.h_ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.rng.min_ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.rng.max_ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.para.num_ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.s_r.send.ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.s_r.receive.ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.label.name_entry <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.label.xy.x_entry <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.label.xy.y_entry <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.label.fontsize_entry <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.cao.ok <KeyPress-Return> [concat ::pd_iemgui::ok $id] + pdtk_standardkeybindings $id.dim.w_ent + pdtk_standardkeybindings $id.dim.h_ent + pdtk_standardkeybindings $id.rng.min_ent + pdtk_standardkeybindings $id.rng.max_ent + pdtk_standardkeybindings $id.para.num_ent + pdtk_standardkeybindings $id.s_r.send.ent + pdtk_standardkeybindings $id.s_r.receive.ent + pdtk_standardkeybindings $id.label.name_entry + pdtk_standardkeybindings $id.label.xy.x_entry + pdtk_standardkeybindings $id.label.xy.y_entry + pdtk_standardkeybindings $id.label.fontsize_entry + pdtk_standardkeybindings $id.cao.ok + + $id.dim.w_ent select from 0 + $id.dim.w_ent select adjust end + focus $id.dim.w_ent +} +
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.