#! /usr/local/bin/wish -f # file: fe_display.tcl # # this file sets up the main front_end tool widgets # # get rid of the old toplevel # wm withdraw . catch {destroy $p} # set new toplevel # toplevel $p wm title $p "$frontend_title" # communicate with the window manager # wm protocol $p WM_DELETE_WINDOW { exit_proc } wm geometry $p "+0+0" wm minsize $p 800 600 # create the base frames # frame $p.display_f -borderwidth 1 -background $bg_col -relief flat \ -height 600 -width 600 frame $p.ctrl_f -borderwidth 1 -background $bg_col -relief ridge \ -height 600 -width 200 pack $p.display_f $p.ctrl_f -side left -fill both # subframes for display area # frame $p.display_left_f -borderwidth 1 -relief ridge -height 760 -width 15 frame $p.display_right_f -borderwidth 1 -relief ridge -height 760 -width 600 pack $p.display_left_f $p.display_right_f -side left -pady 1 -fill both \ -expand true -in $p.display_f frame $p.text0_f -borderwidth 1 -relief ridge -height 20 -width 15 \ -background grey frame $p.list_f -borderwidth 1 -relief ridge -height 760 -width 15 pack $p.text0_f -side top -pady 1 -fill x -in $p.display_left_f pack $p.list_f -side top -pady 1 -fill both -in $p.display_left_f \ -expand true frame $p.text1_f -borderwidth 1 -relief sunken -height 20 -width 600 \ -background $bg_col frame $p.text2_f -borderwidth 1 -relief sunken -height 20 -width 600 \ -background $bg_col frame $p.plot_top_f -borderwidth 1 -relief ridge -height $canvas_height \ -width 600 frame $p.plot_mid_f -borderwidth 1 -relief ridge -height $canvas_height \ -width 600 frame $p.plot_bot_f -borderwidth 1 -relief ridge -height $canvas_height \ -width 600 pack $p.text1_f $p.plot_top_f $p.text2_f $p.plot_mid_f $p.plot_bot_f \ -side top -pady 1 -fill both -expand true -in $p.display_right_f # subframes for tool control panel # frame $p.logo_f -borderwidth 0 -relief flat -height 40 -width 200 \ -background $bg_col frame $p.ctr1_f -borderwidth 0 -relief flat -height 100 -width 200 \ -background $bg_col frame $p.ctr2_f -borderwidth 1 -relief flat -height 400 -width 200 \ -background $bg_col frame $p.ctr3_f -borderwidth 0 -relief flat -height 60 -width 200 \ pack $p.logo_f $p.ctr1_f $p.ctr2_f $p.ctr3_f -padx 5 -pady 5 -side top \ -fill both -expand true -in $p.ctrl_f # add the isip logo # label $p.title -text "$frontend_title" -background $bg_col image create photo fe_logo -file "$isip_logo" -format gif \ -palette 255/255/255 label $p.logo -image fe_logo -background $bg_col pack $p.title $p.logo -side left -fill both -expand true -in $p.logo_f # set up the control buttons # frame $p.bt1 -borderwidth 0 -relief flat -height 40 -width 200 frame $p.bt2 -borderwidth 0 -relief flat -height 40 -width 200 frame $p.bt3 -borderwidth 0 -relief flat -height 40 -width 200 pack $p.bt1 $p.bt2 $p.bt3 -side top -padx 1 -pady 1 -fill both -in $p.ctr1_f label $p.bt -text "Controls" -width 18 -relief raised -bg grey pack $p.bt -side top -padx 1 -pady 1 -fill both -expand true -in $p.bt1 button $p.input -text "Input" -width 10 -command { input_proc } button $p.config -text "Configure" -width 10 -command { config_proc } pack $p.input $p.config -side left -padx 5 -pady 5 -fill both -expand true \ -in $p.bt2 button $p.run -text "Run" -width 10 -command { set start_time 0 # if the wave_plot has not been invoked by input_proc # if {$drawflag == 0} { autoscale_wave_cc sigplot_proc } run_proc } button $p.quit -text "Quit" -width 10 -command { exit_proc } pack $p.run $p.quit -side left -padx 5 -pady 5 -fill both -expand true \ -in $p.bt3 proc exit_proc {} { global tmp_file catch {exec rm $tmp_file} catch {exec rm /tmp/plp_spec.raw} exit } # set up the algorithm entry # frame $p.algo_top_f -borderwidth 2 -relief ridge -height 40 -width 200 frame $p.algo_bot_f -borderwidth 2 -relief ridge -height 280 -width 200 pack $p.algo_top_f $p.algo_bot_f -side top -fill both -padx 5 -in $p.ctr2_f label $p.text3 -text "Algorithm" -width 18 -relief flat -wraplength 100 label $p.text4 -text "Number of Coefficients" -width 18 -relief flat \ -wraplength 100 pack $p.text3 $p.text4 -side left -padx 0 -pady 1 -fill both -in $p.algo_top_f # set up the entries for selecting the numbers of algorithm coefficients # foreach algo $algos { global $algo set limit $limits(default) catch {set limit $limits($algo)} set value $default_values(default) catch {set value $default_values($algo)} numeric_param $p.$algo -text $algo -variable $algo -upper_limit $limit \ -lower_limit 0 -twidth 15 -init $value -interger 1 pack $p.$algo -side top -padx 2 -pady 5 -in $p.algo_bot_f } frame $p.delta1 -borderwidth 2 -relief ridge frame $p.delta2 -borderwidth 2 -relief ridge label $p.delta1.lab -text "delta" -width 18 -anchor w label $p.delta2.lab -text "delta-delta" -width 18 -anchor w global force_delta1 set force_delta1 0 checkbutton $p.delta1.bt -variable delta_one -command { if {($delta_two == 1) && ($delta_one == 0)} { set delta_two 0 } } checkbutton $p.delta2.bt -variable delta_two -command { if {$delta_two == 1} { if {$delta_one == 0} { set delta_one 1 set force_delta1 1 } } if {$delta_two == 0} { if {$force_delta1 == 1} { set delta_one 0 set force_delta1 0 } } } pack $p.delta1.lab $p.delta1.bt -side left -padx 5 pack $p.delta2.lab $p.delta2.bt -side left -padx 5 pack $p.delta1 $p.delta2 -side top -fill x -padx 20 -pady 5 -in $p.ctr3_f # set up the speech waveform display area # label $p.text1 -text "Speech Waveform" -bg grey -fg black frame $p.stepscale_f -height $canvas_height -width 50 canvas $p.wave_plot -relief sunken -height 130 -width $plot_width \ -borderwidth 0 -background $bg_col canvas $p.wave_plot_scale -relief sunken -height 20 -width $plot_width \ pack $p.text1 -side right -expand true -fill both -in $p.text1_f pack $p.stepscale_f -side left -fill y -in $p.plot_top_f -anchor w pack $p.wave_plot $p.wave_plot_scale -pady 1 -fill y -side top \ -in $p.plot_top_f -expand true -anchor e label $p.stepscale_a -text "Zoom Factor" -wraplength 50 scale $p.stepscale -variable frame_step -from 5 -to 100 -orient vertical \ -length 120 -width 8 pack $p.stepscale_a $p.stepscale -side top -padx 2 -pady 2 -fill both \ -in $p.stepscale_f -expand true set plot0 [$p.wave_plot create signal_plot 0 0 \ -num_chans 1 -num_bytes 2 -sample_freq $sf -start_time 0.0 \ -end_time 0.0 -gain_factor $gain_factor -width $plot_width \ -height 120 -borderwidth 1 -relief sunken ] bind $p.stepscale { global start_time drawflag p last_scroll_moveto # if the wave_plot has not been invoked by input_proc # set start_time 0 if {$drawflag == 0} { autoscale_wave_cc sigplot_proc } sigplot_proc set ls $last_scroll_moveto window_scroll_proc moveto 0.0 ftplot_proc 0 $p.ft_plot $p.ft_plot_scale ftplot_proc 1 $p.ft_plot_2 $p.ft_plot_scale_2 window_scroll_proc moveto $ls } # set up the feature plot display area # label $p.text2 -text "Feature Coefficients Plot" -bg grey -fg black pack $p.text2 -side top -fill both -in $p.text2_f # add the first feature plot and scale canvases # canvas $p.ft_plot_scale -relief sunken -height $canvas_height -width 50 \ -background $bg_col -borderwidth 0 canvas $p.ft_plot -height $canvas_height -width $plot_width \ -background $bg_col -xscrollcommand {$p.ft_scroll set} -borderwidth 0 pack $p.ft_plot_scale -side left -in $p.plot_mid_f -anchor n pack $p.ft_plot -side top -fill both -in $p.plot_mid_f -expand true # add the second feature plot and scale canvases and the scrollbar # canvas $p.ft_plot_scale_2 -relief sunken -height $canvas_height -width 50 \ -background $bg_col -borderwidth 0 canvas $p.ft_plot_2 -height $canvas_height -width $plot_width \ -background $bg_col -xscrollcommand {$p.ft_scroll set} -borderwidth 0 scrollbar $p.ft_scroll -command window_scroll_proc -width 10 -orient horizontal pack $p.ft_plot_scale_2 -side left -in $p.plot_bot_f -anchor n pack $p.ft_plot_2 $p.ft_scroll -side top -fill both -in $p.plot_bot_f \ -expand true # add the listbox to the left of display area # label $p.text0 -text "Coefficients" -wraplength 100 -bg grey pack $p.text0 -side top -pady 1 -fill both -in $p.text0_f listbox $p.list -selectmode single -yscrollcommand "$p.yscroll set"\ -background $bg_col -width 15 scrollbar $p.yscroll -command "$p.list yview" -background $bg_col \ -width 8 pack $p.list $p.yscroll -side left -pady 1 -fill both -in $p.list_f \ -expand true # key bindings for the listbox # bind $p.list { $p config -cursor watch # decide to plot in which canvas # if { $canvas_ind == 0} { ftplot_proc [lindex [$p.list curselection] 0] $p.ft_plot \ $p.ft_plot_scale incr canvas_ind set canvas_ind [expr int(fmod($canvas_ind, 2))] } else { ftplot_proc [lindex [$p.list curselection] 0] $p.ft_plot_2 \ $p.ft_plot_scale_2 incr canvas_ind set canvas_ind [expr int(fmod($canvas_ind, 2))] } $p config -cursor top_left_arrow } # end of file #