[PD-cvs] SF.net SVN: pure-data:[10721] branches/pd-devel/0.41.4/src
eighthave at users.sourceforge.net
eighthave at users.sourceforge.net
Tue Feb 3 06:34:51 CET 2009
Revision: 10721
http://pure-data.svn.sourceforge.net/pure-data/?rev=10721&view=rev
Author: eighthave
Date: 2009-02-03 05:34:51 +0000 (Tue, 03 Feb 2009)
Log Message:
-----------
- separated the find and font panels into their own packages, the other panels
will soon be done this way too
- created generic map, unmap, focusin procs where the specific procs can all
be registered. Then those specific procs go in the related package. I
think this should be easier to follow.
- For gatom and font, separated create_panel and the message from Pd into
separate procs. Then all panels will have a create_panel
- made iemgui panel have a customizable background like the others and
replaced the big binding kludge with panel_bindings
Modified Paths:
--------------
branches/pd-devel/0.41.4/src/gatom.tcl
branches/pd-devel/0.41.4/src/pd.tk
branches/pd-devel/0.41.4/src/pd_bindings.tcl
branches/pd-devel/0.41.4/src/pd_iemgui.tcl
branches/pd-devel/0.41.4/src/pd_menucommands.tcl
branches/pd-devel/0.41.4/src/pdtk_canvas.tcl
branches/pd-devel/0.41.4/src/pkgIndex.tcl
branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl
Added Paths:
-----------
branches/pd-devel/0.41.4/src/find_panel.tcl
branches/pd-devel/0.41.4/src/font_panel.tcl
Added: branches/pd-devel/0.41.4/src/find_panel.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/find_panel.tcl (rev 0)
+++ branches/pd-devel/0.41.4/src/find_panel.tcl 2009-02-03 05:34:51 UTC (rev 10721)
@@ -0,0 +1,85 @@
+
+package provide find_panel 0.1
+
+package require pd_bindings
+
+namespace eval ::find_panel:: {
+ namespace export menu_find_panel
+}
+
+# TODO figure out findagain
+# TODO make targetlabel into a popup menu
+# TODO make panel go away after a find
+
+proc ::find_panel::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_panel::cancel {mytoplevel} {
+ wm withdraw .find
+}
+
+proc ::find_panel::focusin {mytoplevel} {
+ if {[winfo exists .find.frame.targetlabel]} {
+ set focusedwindow [winfo toplevel [lindex [wm stackorder .] end]]
+ if {$focusedwindow eq ".find"} {
+ set focusedwindow [winfo toplevel [lindex [wm stackorder .] end - 1]]
+ }
+ # TODO this text should be based on $::menu_windowlist
+ .find.frame.targetlabel configure -text [wm title $focusedwindow]
+ }
+}
+
+# the find panel is opened from the menu and key bindings
+proc ::find_panel::menu_find_panel {mytoplevel} {
+ if {[winfo exists .find]} {
+ wm deiconify .find
+ raise .find
+ } else {
+ create_panel $mytoplevel
+ }
+}
+
+proc ::find_panel::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 -background $::panel_background
+ ::pd_bindings::panel_bindings .find "find"
+
+ frame .find.frame -background $::panel_background
+ pack .find.frame -side top -fill x -pady 7
+ label .find.frame.searchin -text [_ "Search in:"] -background $::panel_background
+ label .find.frame.targetlabel -background $::panel_background \
+ -text [wm title $mytoplevel]
+ label .find.frame.for -background $::panel_background -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 \
+ -highlightbackground $::panel_background
+ focus .find.entry
+ pack .find.entry -side top -padx 10
+
+ frame .find.buttonframe -background yellow
+ button .find.button -text [_ "Find"] -default active -width 9 \
+ -highlightbackground $::panel_background -command "find_ok $mytoplevel"
+ if {$::windowingsystem eq "x11"} {
+ button .find.close -text [_ "Close"] -default normal -width 9 \
+ -highlightbackground $::panel_background -command "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
+ }
+}
Added: branches/pd-devel/0.41.4/src/font_panel.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/font_panel.tcl (rev 0)
+++ branches/pd-devel/0.41.4/src/font_panel.tcl 2009-02-03 05:34:51 UTC (rev 10721)
@@ -0,0 +1,107 @@
+
+package provide font_panel 0.1
+
+namespace eval ::font_panel:: {
+ variable fontsize 0
+ variable dofont_fontsize 0
+ variable stretchval 0
+ variable whichstretch 0
+
+ namespace export pdtk_canvas_dofont
+}
+
+proc ::font_panel::apply {mytoplevel myfontsize} {
+ pdsend "$mytoplevel font $myfontsize $stretchval $whichstretch"
+}
+
+proc ::font_panel::close {mytoplevel} {
+ pdsend "$mytoplevel cancel"
+}
+
+proc ::font_panel::cancel {mytoplevel} {
+ ::font_panel::apply $mytoplevel $fontsize ;# reinstate previous font size
+ pdsend "$mytoplevel cancel"
+}
+
+proc ::font_panel::ok {mytoplevel} {
+ set fontsize $::font_panel::fontsize
+ ::font_panel::apply $mytoplevel $fontsize
+ ::font_panel::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 ::font_panel::pdtk_canvas_dofont {mytoplevel initsize} {
+ create_panel $mytoplevel $initsize
+}
+
+proc ::font_panel::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 "::font_panel::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 "::font_panel::cancel $mytoplevel"
+ button $mytoplevel.buttonframe.ok -text "OK" \
+ -command "::font_panel::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 ::font_panel::fontsize -text "8" \
+ -command "::font_panel::apply $mytoplevel 8"
+ radiobutton $mytoplevel.radiof.radio10 -value 10 -variable ::font_panel::fontsize -text "10" \
+ -command "::font_panel::apply $mytoplevel 10"
+ radiobutton $mytoplevel.radiof.radio12 -value 12 -variable ::font_panel::fontsize -text "12" \
+ -command "::font_panel::apply $mytoplevel 12"
+ radiobutton $mytoplevel.radiof.radio16 -value 16 -variable ::font_panel::fontsize -text "16" \
+ -command "::font_panel::apply $mytoplevel 16"
+ radiobutton $mytoplevel.radiof.radio24 -value 24 -variable ::font_panel::fontsize -text "24" \
+ -command "::font_panel::apply $mytoplevel 24"
+ radiobutton $mytoplevel.radiof.radio36 -value 36 -variable ::font_panel::fontsize -text "36" \
+ -command "::font_panel::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
+
+}
Modified: branches/pd-devel/0.41.4/src/gatom.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/gatom.tcl 2009-02-03 01:07:34 UTC (rev 10720)
+++ branches/pd-devel/0.41.4/src/gatom.tcl 2009-02-03 05:34:51 UTC (rev 10721)
@@ -84,114 +84,131 @@
::gatom::cancel $mytoplevel
}
+# set up the panel with the info from pd
proc ::gatom::pdtk_gatom_dialog {mytoplevel initwidth initlower initupper \
initgatomlabel_position \
initgatomlabel initsend initreceive} {
global gatomlabel_position
set gatomlabel_position($mytoplevel) $initgatomlabel_position
- toplevel $mytoplevel -class PdPanel
+ 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 ::gatom::create_panel {mytoplevel} {
+ global gatomlabel_position
+
+ toplevel $mytoplevel -background $::panel_background
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 "::gatom::cancel $mytoplevel"
::pd_bindings::panel_bindings $mytoplevel "gatom"
- frame $mytoplevel.width -height 7
+ frame $mytoplevel.width -height 7 -background $::panel_background
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
+ label $mytoplevel.width.label -text "width" -background $::panel_background
+ entry $mytoplevel.width.entry -width 4 -highlightbackground $::panel_background
+ pack $mytoplevel.width.label $mytoplevel.width.entry -side left
labelframe $mytoplevel.limits -text "limits" -padx 15 -pady 4 -borderwidth 1 \
- -font highlight_font
+ -font highlight_font -background $::panel_background
pack $mytoplevel.limits -side top -fill x
- frame $mytoplevel.limits.lower
+ frame $mytoplevel.limits.lower -background $::panel_background
pack $mytoplevel.limits.lower -side left
- label $mytoplevel.limits.lower.label -text "lower"
- entry $mytoplevel.limits.lower.entry -width 8
+ label $mytoplevel.limits.lower.label -text "lower" -background $::panel_background
+ entry $mytoplevel.limits.lower.entry -width 8 -highlightbackground $::panel_background
pack $mytoplevel.limits.lower.label $mytoplevel.limits.lower.entry -side left
- frame $mytoplevel.limits.upper
+ frame $mytoplevel.limits.upper -background $::panel_background
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
+ frame $mytoplevel.limits.upper.spacer -width 20 -background $::panel_background
+ label $mytoplevel.limits.upper.label -text "upper" -background $::panel_background
+ entry $mytoplevel.limits.upper.entry -width 8 -highlightbackground $::panel_background
pack $mytoplevel.limits.upper.spacer $mytoplevel.limits.upper.label \
$mytoplevel.limits.upper.entry -side left
- frame $mytoplevel.spacer1 -height 7
+ frame $mytoplevel.spacer1 -height 7 -background $::panel_background
pack $mytoplevel.spacer1 -side top
labelframe $mytoplevel.gatomlabel -text "label" -padx 5 -pady 4 -borderwidth 1 \
- -font highlight_font
+ -font highlight_font -background $::panel_background
pack $mytoplevel.gatomlabel -side top -fill x
- frame $mytoplevel.gatomlabel.name
+ frame $mytoplevel.gatomlabel.name -background $::panel_background
pack $mytoplevel.gatomlabel.name -side top
- entry $mytoplevel.gatomlabel.name.entry -width 33
+ entry $mytoplevel.gatomlabel.name.entry -width 33 -highlightbackground $::panel_background
pack $mytoplevel.gatomlabel.name.entry -side left
- frame $mytoplevel.gatomlabel.radio
+ frame $mytoplevel.gatomlabel.radio -background $::panel_background
pack $mytoplevel.gatomlabel.radio -side top
- radiobutton $mytoplevel.gatomlabel.radio.left -value 0 \
- -variable gatomlabel_position($mytoplevel) \
- -text "left " -justify left -takefocus 0
- radiobutton $mytoplevel.gatomlabel.radio.right -value 1 \
- -variable gatomlabel_position($mytoplevel) \
- -text "right" -justify left -takefocus 0
- radiobutton $mytoplevel.gatomlabel.radio.top -value 2 \
- -variable gatomlabel_position($mytoplevel) \
- -text "top" -justify left -takefocus 0
- radiobutton $mytoplevel.gatomlabel.radio.bottom -value 3 \
- -variable gatomlabel_position($mytoplevel) \
- -text "bottom" -justify left -takefocus 0
+ radiobutton $mytoplevel.gatomlabel.radio.left -value 0 -text "left " \
+ -variable gatomlabel_position($mytoplevel) -background $::panel_background \
+ -justify left -takefocus 0
+ radiobutton $mytoplevel.gatomlabel.radio.right -value 1 -text "right" \
+ -variable gatomlabel_position($mytoplevel) -background $::panel_background \
+ -justify left -takefocus 0
+ radiobutton $mytoplevel.gatomlabel.radio.top -value 2 -text "top" \
+ -variable gatomlabel_position($mytoplevel) -background $::panel_background \
+ -justify left -takefocus 0
+ radiobutton $mytoplevel.gatomlabel.radio.bottom -value 3 -text "bottom" \
+ -variable gatomlabel_position($mytoplevel) -background $::panel_background \
+ -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
+ frame $mytoplevel.spacer2 -height 7 -background $::panel_background
pack $mytoplevel.spacer2 -side top
labelframe $mytoplevel.s_r -text "messages" -padx 5 -pady 4 -borderwidth 1 \
- -font highlight_font
+ -font highlight_font -background $::panel_background
pack $mytoplevel.s_r -side top -fill x
- frame $mytoplevel.s_r.send
+ frame $mytoplevel.s_r.send -background $::panel_background
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
+ label $mytoplevel.s_r.send.label -text "send symbol" -background $::panel_background
+ entry $mytoplevel.s_r.send.entry -width 21 -highlightbackground $::panel_background
pack $mytoplevel.s_r.send.entry $mytoplevel.s_r.send.label -side right
- frame $mytoplevel.s_r.receive
+ frame $mytoplevel.s_r.receive -background $::panel_background
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
+ label $mytoplevel.s_r.receive.label -text "receive symbol" -background $::panel_background
+ entry $mytoplevel.s_r.receive.entry -width 21 -highlightbackground $::panel_background
pack $mytoplevel.s_r.receive.entry $mytoplevel.s_r.receive.label -side right
- frame $mytoplevel.buttonframe -pady 5
+ frame $mytoplevel.buttonframe -pady 5 -background $::panel_background
pack $mytoplevel.buttonframe -side top -fill x -pady 2m
button $mytoplevel.buttonframe.cancel -text {Cancel} \
- -command "::gatom::cancel $mytoplevel"
+ -command "::gatom::cancel $mytoplevel" -highlightbackground $::panel_background
pack $mytoplevel.buttonframe.cancel -side left -expand 1
button $mytoplevel.buttonframe.apply -text {Apply} \
- -command "::gatom::apply $mytoplevel"
+ -command "::gatom::apply $mytoplevel" -highlightbackground $::panel_background
pack $mytoplevel.buttonframe.apply -side left -expand 1
button $mytoplevel.buttonframe.ok -text {OK} \
- -command "::gatom::ok $mytoplevel"
+ -command "::gatom::ok $mytoplevel" -highlightbackground $::panel_background
pack $mytoplevel.buttonframe.ok -side left -expand 1
- $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
- }
-
$mytoplevel.width.entry select from 0
$mytoplevel.width.entry select adjust end
focus $mytoplevel.width.entry
Modified: branches/pd-devel/0.41.4/src/pd.tk
===================================================================
--- branches/pd-devel/0.41.4/src/pd.tk 2009-02-03 01:07:34 UTC (rev 10720)
+++ branches/pd-devel/0.41.4/src/pd.tk 2009-02-03 05:34:51 UTC (rev 10721)
@@ -60,6 +60,7 @@
package require pd_menus
package require pd_bindings
package require pd_post
+package require font_panel
package require gatom
package require pd_iemgui
package require pdtk_array
@@ -73,6 +74,7 @@
namespace import ::pd_post::pdtk_post
namespace import ::pd_iemgui::pdtk_iemgui_dialog
namespace import ::gatom::pdtk_gatom_dialog
+namespace import ::font_panel::pdtk_canvas_dofont
#------------------------------------------------------------------------------#
# coding style
Modified: branches/pd-devel/0.41.4/src/pd_bindings.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_bindings.tcl 2009-02-03 01:07:34 UTC (rev 10720)
+++ branches/pd-devel/0.41.4/src/pd_bindings.tcl 2009-02-03 05:34:51 UTC (rev 10721)
@@ -2,6 +2,7 @@
package require pd_menucommands
package require pd_post
+package require find_panel
namespace eval ::pd_bindings:: {
variable modifier
@@ -13,10 +14,10 @@
proc ::pd_bindings::class_bindings {} {
# binding by class is not recursive, so its useful for certain things
- bind CanvasWindow <Map> "pdsend_map %W"
- bind CanvasWindow <Unmap> "pdsend_unmap %W"
+ bind CanvasWindow <Map> "::pd_bindings::map %W"
+ bind CanvasWindow <Unmap> "::pd_bindings::unmap %W"
bind CanvasWindow <Configure> "pdtk_canvas_getscroll %W"
- bind CanvasWindow <FocusIn> "window_focusin %W"
+ bind CanvasWindow <FocusIn> "::pd_bindings::window_focusin %W"
}
proc ::pd_bindings::window_bindings {mytoplevel} {
@@ -65,7 +66,7 @@
wm protocol $mytoplevel WM_DELETE_WINDOW "pdsend \"pd verifyquit\""
# do window maintenance when entering the Pd window (Window menu, scrollbars, etc)
- bind $mytoplevel <FocusIn> "window_focusin %W"
+ bind $mytoplevel <FocusIn> "::pd_bindings::window_focusin %W"
}
# this is for the panels: find, font, sendmessage, gatom properties, array
@@ -166,3 +167,25 @@
wm protocol $mytoplevel WM_DELETE_WINDOW "pdsend \"$mytoplevel menuclose 0\""
}
+
+#------------------------------------------------------------------------------#
+# event handlers
+
+# do tasks when changing focus (Window menu, scrollbars, etc.)
+proc ::pd_bindings::window_focusin {mytoplevel} {
+ ::find_panel::focusin $mytoplevel
+}
+
+# "map" event tells us when the canvas becomes visible, and "unmap",
+# invisible. Invisibility means the Window Manager has minimized us. We
+# don't get a final "unmap" event when we destroy the window.
+proc ::pd_bindings::map {mytoplevel} {
+ pdsend "$mytoplevel map 1"
+ #[regsub -- "" [wm title $mytoplevel]]
+ #set ::pd_untitleddir $dirname
+}
+
+proc ::pd_bindings::unmap {mytoplevel} {
+ puts "unmap"
+ pdsend "$mytoplevel map 0"
+}
Modified: branches/pd-devel/0.41.4/src/pd_iemgui.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_iemgui.tcl 2009-02-03 01:07:34 UTC (rev 10720)
+++ branches/pd-devel/0.41.4/src/pd_iemgui.tcl 2009-02-03 05:34:51 UTC (rev 10721)
@@ -12,9 +12,8 @@
namespace export pdtk_iemgui_dialog
}
-############ pdtk_iemgui_dialog -- dialog window for iem guis #########
+# TODO rename $id to $mytoplevel
-
proc ::pd_iemgui::clip_dim {id} {
set vid [string trimleft $id .]
@@ -385,10 +384,21 @@
[eval concat $$var_iemgui_steady]]
}
+
+proc iemgui_cancel {mytoplevel} {
+ # TODO kludge!! until a common approach to ::pd_bindings::panel_bindings
+ # is sorted out
+ ::pd_iemgui::cancel $mytoplevel
+}
proc ::pd_iemgui::cancel {id} {
pdsend "$id cancel"
}
+proc iemgui_ok {mytoplevel} {
+ # TODO kludge!! until a common approach to ::pd_bindings::panel_bindings
+ # is sorted out
+ ::pd_iemgui::ok $mytoplevel
+}
proc ::pd_iemgui::ok {id} {
::pd_iemgui::apply $id
::pd_iemgui::cancel $id
@@ -494,32 +504,38 @@
set $var_iemgui_l2_f1_b0 0
- toplevel $id
+ toplevel $id -background $::panel_background
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
+
+ ::pd_bindings::panel_bindings $id "iemgui"
+
+ frame $id.dim -background $::panel_background
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
+ label $id.dim.head -text $dim_header -background $::panel_background
+ label $id.dim.w_lab -text $wdt_label -width 6 -background $::panel_background
+ entry $id.dim.w_ent -textvariable $var_iemgui_wdt -width 5 \
+ -highlightbackground $::panel_background
+ label $id.dim.dummy1 -text " " -width 10 -background $::panel_background
+ label $id.dim.h_lab -text $hgt_label -width 6 -background $::panel_background
+ entry $id.dim.h_ent -textvariable $var_iemgui_hgt -width 5 \
+ -highlightbackground $::panel_background
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
+ frame $id.rng -background $::panel_background
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
+ label $id.rng.head -text $rng_header -background $::panel_background
+ label $id.rng.min_lab -text $min_rng_label -width 6 -background $::panel_background
+ entry $id.rng.min_ent -textvariable $var_iemgui_min_rng -width 9 \
+ -highlightbackground $::panel_background
+ label $id.rng.dummy1 -text " " -width 1 -background $::panel_background
+ label $id.rng.max_lab -text $max_rng_label -width 8 -background $::panel_background
+ entry $id.rng.max_ent -textvariable $var_iemgui_max_rng -width 9 \
+ -highlightbackground $::panel_background
if { $rng_header != "empty" } {
pack $id.rng.head -side top
if { $min_rng_label != "empty" } {
@@ -529,27 +545,35 @@
$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 ""
+ label $id.space1 -text "" -background $::panel_background
pack $id.space1 -side top }
- frame $id.para
+ frame $id.para -background $::panel_background
pack $id.para -side top
- label $id.para.dummy2 -text "" -width 1
- label $id.para.dummy3 -text "" -width 1
+ label $id.para.dummy2 -text "" -width 1 -background $::panel_background
+ label $id.para.dummy3 -text "" -width 1 -background $::panel_background
if {[eval concat $$var_iemgui_lin0_log1] == 0} {
- button $id.para.lilo -text [eval concat $$var_iemgui_lilo0] -width 5 -command "::pd_iemgui::lilo $id" }
+ button $id.para.lilo -text [eval concat $$var_iemgui_lilo0] -width 5 \
+ -command "::pd_iemgui::lilo $id" -highlightbackground $::panel_background }
if {[eval concat $$var_iemgui_lin0_log1] == 1} {
- button $id.para.lilo -text [eval concat $$var_iemgui_lilo1] -width 5 -command "::pd_iemgui::lilo $id" }
+ button $id.para.lilo -text [eval concat $$var_iemgui_lilo1] -width 5 \
+ -command "::pd_iemgui::lilo $id" -highlightbackground $::panel_background }
if {[eval concat $$var_iemgui_loadbang] == 0} {
- button $id.para.lb -text "no init" -width 5 -command "::pd_iemgui::lb $id" }
+ button $id.para.lb -text "no init" -width 5 \
+ -command "::pd_iemgui::lb $id" -highlightbackground $::panel_background }
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
+ button $id.para.lb -text "init" -width 5 \
+ -command "::pd_iemgui::lb $id" -highlightbackground $::panel_background }
+ label $id.para.num_lab -text $num_label -width 9 -background $::panel_background
+ entry $id.para.num_ent -textvariable $var_iemgui_num -width 4 \
+ -highlightbackground $::panel_background
+
if {[eval concat $$var_iemgui_steady] == 0} {
- button $id.para.stdy_jmp -text "jump on click" -width 11 -command "::pd_iemgui::stdy_jmp $id" }
+ button $id.para.stdy_jmp -command "::pd_iemgui::stdy_jmp $id" \
+ -text "jump on click" -width 11 -highlightbackground $::panel_background }
if {[eval concat $$var_iemgui_steady] == 1} {
- button $id.para.stdy_jmp -text "steady on click" -width 11 -command "::pd_iemgui::stdy_jmp $id" }
+ button $id.para.stdy_jmp -command "::pd_iemgui::stdy_jmp $id" \
+ -text "steady on click" -width 11 -highlightbackground $::panel_background }
if {[eval concat $$var_iemgui_lin0_log1] >= 0} {
pack $id.para.lilo -side left -expand 1}
if {[eval concat $$var_iemgui_loadbang] >= 0} {
@@ -559,23 +583,27 @@
if {[eval concat $$var_iemgui_steady] >= 0} {
pack $id.para.dummy3 $id.para.stdy_jmp -side left -expand 1}
- frame $id.spacer0 -height 4
+ frame $id.spacer0 -height 4 -background $::panel_background
pack $id.spacer0 -side top
labelframe $id.s_r -borderwidth 1 -pady 4 -text "messages" \
- -font highlight_font
+ -font highlight_font -background $::panel_background
pack $id.s_r -side top -fill x -ipadx 5
- frame $id.s_r.send
+ frame $id.s_r.send -background $::panel_background
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
+ label $id.s_r.send.lab -text " send-symbol:" -width 12 -justify right \
+ -background $::panel_background
+ entry $id.s_r.send.ent -textvariable $var_iemgui_snd -width 22 \
+ -highlightbackground $::panel_background
if { $snd != "nosndno" } {
pack $id.s_r.send.lab $id.s_r.send.ent -side left}
- frame $id.s_r.receive
+ frame $id.s_r.receive -background $::panel_background
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
+ label $id.s_r.receive.lab -text "receive-symbol:" -width 12 -justify right \
+ -background $::panel_background
+ entry $id.s_r.receive.ent -textvariable $var_iemgui_rcv -width 22 \
+ -highlightbackground $::panel_background
if { $rcv != "norcvno" } {
pack $id.s_r.receive.lab $id.s_r.receive.ent -side left}
@@ -586,31 +614,35 @@
if {[eval concat $$var_iemgui_gn_f] == 2} \
{ set current_font "Times" }
- frame $id.spacer1 -height 7
+ frame $id.spacer1 -height 7 -background $::panel_background
pack $id.spacer1 -side top
labelframe $id.label -borderwidth 1 -text "label" -pady 4 \
- -font highlight_font
+ -font highlight_font -background $::panel_background
pack $id.label -side top -fill x
entry $id.label.name_entry -textvariable $var_iemgui_gui_nam -width 30 \
- -font [list $current_font 12 $::font_weight]
+ -font [list $current_font 12 $::font_weight] \
+ -highlightbackground $::panel_background
pack $id.label.name_entry -side top -expand yes -fill both -padx 5
- frame $id.label.xy -padx 27 -pady 1
+ frame $id.label.xy -padx 27 -pady 1 -background $::panel_background
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
+ label $id.label.xy.x_lab -text "x offset" -width 6 -background $::panel_background
+ entry $id.label.xy.x_entry -textvariable $var_iemgui_gn_dx -width 5 \
+ -highlightbackground $::panel_background
+ label $id.label.xy.dummy1 -text " " -width 2 -background $::panel_background
+ label $id.label.xy.y_lab -text "y offset" -width 6 -background $::panel_background
+ entry $id.label.xy.y_entry -textvariable $var_iemgui_gn_dy -width 5 \
+ -highlightbackground $::panel_background
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 $::font_weight] -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
+ label $id.label.fontsize_label -text "size" -width 4 -background $::panel_background
+ entry $id.label.fontsize_entry -textvariable $var_iemgui_gn_fs -width 5 \
+ -highlightbackground $::panel_background
pack $id.label.fontsize_entry $id.label.fontsize_label \
-side right -anchor e -padx 5 -pady 5
menu $id.popup
@@ -629,31 +661,35 @@
bind $id.label.fontpopup_label <Button> \
[list tk_popup $id.popup %X %Y]
- frame $id.spacer2 -height 7
+ frame $id.spacer2 -height 7 -background $::panel_background
pack $id.spacer2 -side top
- labelframe $id.colors -borderwidth 1 -text "colors" -font highlight_font
+ labelframe $id.colors -borderwidth 1 -text "colors" -font highlight_font \
+ -background $::panel_background
pack $id.colors -fill x -ipadx 5 -ipady 4
- frame $id.colors.select
+ frame $id.colors.select -background $::panel_background
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
+ $var_iemgui_l2_f1_b0 -text "background" -width 10 -justify left \
+ -background $::panel_background
radiobutton $id.colors.select.radio1 -value 1 -variable \
- $var_iemgui_l2_f1_b0 -text "front" -width 5 -justify left
+ $var_iemgui_l2_f1_b0 -text "front" -width 5 -justify left \
+ -background $::panel_background
radiobutton $id.colors.select.radio2 -value 2 -variable \
- $var_iemgui_l2_f1_b0 -text "label" -width 5 -justify left
+ $var_iemgui_l2_f1_b0 -text "label" -width 5 -justify left \
+ -background $::panel_background
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 \
- }
+ pack $id.colors.select.radio0 $id.colors.select.radio2 -side left
+ }
- frame $id.colors.sections
+ frame $id.colors.sections -background $::panel_background
pack $id.colors.sections -side top
- button $id.colors.sections.but -text "compose color" -width 12 \
- -command "::pd_iemgui::choose_col_bkfrlb $id"
+ button $id.colors.sections.but -command "::pd_iemgui::choose_col_bkfrlb $id" \
+ -text "compose color" -width 12 -highlightbackground $::panel_background
pack $id.colors.sections.but -side left -anchor w -padx 10 -pady 5 \
-expand yes -fill x
if { [eval concat $$var_iemgui_fcol] >= 0 } {
@@ -681,7 +717,7 @@
-side right -anchor e -expand yes -fill both -pady 7
# color scheme by Mary Ann Benedetto http://piR2.org
- frame $id.colors.r1
+ frame $id.colors.r1 -background $::panel_background
pack $id.colors.r1 -side top
foreach i { 0 1 2 3 4 5 6 7 8 9} \
hexcol { 0xFFFFFF 0xDFDFDF 0xBBBBBB 0xFFC7C6 0xFFE3C6 \
@@ -696,7 +732,7 @@
$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
+ frame $id.colors.r2 -background $::panel_background
pack $id.colors.r2 -side top
foreach i { 0 1 2 3 4 5 6 7 8 9 } \
hexcol { 0x9F9F9F 0x7C7C7C 0x606060 0xFF0400 0xFF8300 \
@@ -712,7 +748,7 @@
$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
+ frame $id.colors.r3 -background $::panel_background
pack $id.colors.r3 -side top
foreach i { 0 1 2 3 4 5 6 7 8 9 } \
hexcol { 0x404040 0x202020 0x000000 0x551312 0x553512 \
@@ -728,15 +764,16 @@
$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
+ frame $id.cao -pady 10 -background $::panel_background
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"
+ button $id.cao.cancel -command "::pd_iemgui::cancel $id" \
+ -text "Cancel" -width 6 -highlightbackground $::panel_background
+ label $id.cao.dummy1 -text "" -width 3 -background $::panel_background
+ button $id.cao.apply -text "Apply" -width 6 -command "::pd_iemgui::apply $id" \
+ -highlightbackground $::panel_background
+ label $id.cao.dummy2 -text "" -width 3 -background $::panel_background
+ button $id.cao.ok -text {OK} -width 6 -command "::pd_iemgui::ok $id" \
+ -highlightbackground $::panel_background
pack $id.cao.cancel $id.cao.dummy1 -side left
pack $id.cao.apply $id.cao.dummy2 -side left
@@ -750,31 +787,6 @@
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
Modified: branches/pd-devel/0.41.4/src/pd_menucommands.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menucommands.tcl 2009-02-03 01:07:34 UTC (rev 10720)
+++ branches/pd-devel/0.41.4/src/pd_menucommands.tcl 2009-02-03 05:34:51 UTC (rev 10721)
@@ -44,15 +44,11 @@
}
}
+# panel types:
+# global (only one): find, sendmessage, prefs, helpbrowser
+# per-canvas: font, canvas properties (created with a message from pd)
+# per object: gatom, iemgui, array, data structures (created with a message from pd)
-proc ::pd_menucommands::menu_showpanel {panelname mytoplevel} {
- if {[winfo exists .$panelname]} {
- wm deiconify .$panelname
- raise .$panelname
- } else {
- ::${panelname}::create_panel $mytoplevel
- }
-}
# ------------------------------------------------------------------------------
# send message panel
Modified: branches/pd-devel/0.41.4/src/pdtk_canvas.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pdtk_canvas.tcl 2009-02-03 01:07:34 UTC (rev 10720)
+++ branches/pd-devel/0.41.4/src/pdtk_canvas.tcl 2009-02-03 05:34:51 UTC (rev 10721)
@@ -102,15 +102,7 @@
pdtk_pastetext
}
-
#------------------------------------------------------------------------------#
-# canvas font
-
-proc pdtk_canvas_dofont {mytoplevel initsize} {
- # TODO this should just bring up the Font panel
-}
-
-#------------------------------------------------------------------------------#
# canvas popup menu
proc popup_action {mytoplevel action} {
@@ -139,19 +131,6 @@
#------------------------------------------------------------------------------#
# procs for canvas events
-# "map" event tells us when the canvas becomes visible (arg is "0") or
-# invisible (arg is ""). Invisibility means the Window Manager has minimized
-# us. We don't get a final "unmap" event when we destroy the window.
-proc pdsend_map {mytoplevel} {
- pdsend "$mytoplevel map 1"
- #[regsub -- "" [wm title $mytoplevel]]
- #set ::pd_untitleddir $dirname
-}
-
-proc pdsend_unmap {mytoplevel} {
- pdsend "$mytoplevel map 0"
-}
-
# check or uncheck the "edit" menu item
proc pdtk_canvas_editval {mytoplevel value} {
# TODO make this work
Modified: branches/pd-devel/0.41.4/src/pkgIndex.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pkgIndex.tcl 2009-02-03 01:07:34 UTC (rev 10720)
+++ branches/pd-devel/0.41.4/src/pkgIndex.tcl 2009-02-03 05:34:51 UTC (rev 10721)
@@ -11,6 +11,8 @@
package ifneeded apple_events 0.1 [list source [file join $dir apple_events.tcl]]
package ifneeded pd_bindings 0.1 [list source [file join $dir pd_bindings.tcl]]
package ifneeded pd_connect 0.1 [list source [file join $dir pd_connect.tcl]]
+package ifneeded find_panel 0.1 [list source [file join $dir find_panel.tcl]]
+package ifneeded font_panel 0.1 [list source [file join $dir font_panel.tcl]]
package ifneeded gatom 0.1 [list source [file join $dir gatom.tcl]]
package ifneeded pd_iemgui 0.1 [list source [file join $dir pd_iemgui.tcl]]
package ifneeded pd_menucommands 0.1 [list source [file join $dir pd_menucommands.tcl]]
Modified: branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl 2009-02-03 01:07:34 UTC (rev 10720)
+++ branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl 2009-02-03 05:34:51 UTC (rev 10721)
@@ -66,18 +66,6 @@
pdsend "[winfo toplevel $mycanvas] key $state $key $shift"
}
-# do window maintenance when entering a window (Window menu, scrollbars...)
-proc window_focusin {mytoplevel} {
- if {[winfo exists .find.frame.targetlabel]} {
- set topwindow [winfo toplevel [lindex [wm stackorder .] end]]
- if {$topwindow eq ".find"} {
- set topwindow [winfo toplevel [lindex [wm stackorder .] end - 1]]
- }
- # TODO this text should be based on $::menu_windowlist
- .find.frame.targetlabel configure -text [wm title $topwindow]
- }
-}
-
# ------------------------------------------------------------------------------
# lost pdtk functions...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Pd-cvs
mailing list