Revision: 10713 http://pure-data.svn.sourceforge.net/pure-data/?rev=10713&view=rev Author: eighthave Date: 2009-02-02 06:12:14 +0000 (Mon, 02 Feb 2009)
Log Message: ----------- - made the Find panel fully functional and look decent
- made sketch of lable that shows which patch the find panel will search
- "findagain" should be incorporated in the find panel, so that the find panel stays up until it is dismissed, but only the first time will run "find", the rest should then use "findagain"
Modified Paths: -------------- 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_menucommands.tcl branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl
Modified: branches/pd-devel/0.41.4/src/pd.tk =================================================================== --- branches/pd-devel/0.41.4/src/pd.tk 2009-02-02 03:42:03 UTC (rev 10712) +++ branches/pd-devel/0.41.4/src/pd.tk 2009-02-02 06:12:14 UTC (rev 10713) @@ -48,6 +48,9 @@ set pd_opendir [pwd] set pd_untitleddir [pwd]
+# store list of parent windows for Window menu +set menu_windowlist {} + #------------------------------------------------------------------------------# # packages for this project
@@ -121,6 +124,7 @@ {{max patch files} {.pat} } {{max text files} {.mxt} } } + set ::panel_background "grey80" } "aqua" { # set file types that open/save recognize @@ -129,6 +133,7 @@ {{Max Patch Files (.pat)} {.pat} } {{Max Text Files (.mxt)} {.mxt} } } + set ::panel_background "systemUtilityWindowBackgroundActive" } "win32" { font create menufont -family Tahoma -size -11 @@ -138,6 +143,7 @@ {{Max Patch Files} {.pat} } {{Max Text Files} {.mxt} } } + set ::panel_background "InfoBackground" } } }
Modified: branches/pd-devel/0.41.4/src/pd_bindings.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_bindings.tcl 2009-02-02 03:42:03 UTC (rev 10712) +++ branches/pd-devel/0.41.4/src/pd_bindings.tcl 2009-02-02 06:12:14 UTC (rev 10713) @@ -16,11 +16,7 @@ bind CanvasWindow <Map> "pdsend_map %W" bind CanvasWindow <Unmap> "pdsend_unmap %W" bind CanvasWindow <Configure> "pdtk_canvas_getscroll %W" - - # event bindings ----------------------------------------------------------- - - # do window maintenance when entering a window (Window menu, scrollbars...) - #bind CanvasWindow <FocusIn> {pdtk_canvaswindowmaintenance} + bind CanvasWindow <FocusIn> "window_focusin %W" }
proc ::pd_bindings::window_bindings {mytoplevel} { @@ -69,7 +65,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> {pdtk_pdwindowmaintenance} + bind $mytoplevel <FocusIn> "window_focusin %W" }
proc ::pd_bindings::panel_bindings {mytoplevel panelname} { @@ -77,11 +73,11 @@
window_bindings $mytoplevel
-# bind $mytoplevel <KeyPress-Escape> [format "%s_cancel %s" $panelname $mytoplevel] -# bind $mytoplevel <KeyPress-Return> [format "%s_ok %s" $panelname $mytoplevel] -# bind $mytoplevel <$modifier_key-Key-w> [format "%s_cancel %s" $panelname $mytoplevel] + bind $mytoplevel <KeyPress-Escape> [format "%s_cancel %s" $panelname $mytoplevel] + bind $mytoplevel <KeyPress-Return> [format "%s_ok %s" $panelname $mytoplevel] + bind $mytoplevel <$modifier-Key-w> [format "%s_cancel %s" $panelname $mytoplevel]
-# wm protocol $mytoplevel WM_DELETE_WINDOW "$panelname_cancel" + wm protocol $mytoplevel WM_DELETE_WINDOW "${panelname}_cancel $mytoplevel" }
proc ::pd_bindings::canvas_bindings {mytoplevel} {
Modified: branches/pd-devel/0.41.4/src/pd_menucommands.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_menucommands.tcl 2009-02-02 03:42:03 UTC (rev 10712) +++ branches/pd-devel/0.41.4/src/pd_menucommands.tcl 2009-02-02 06:12:14 UTC (rev 10713) @@ -46,7 +46,7 @@ }
# ------------------------------------------------------------------------------ -# various panels +# send message panel
proc ::pd_menucommands::menu_message_panel {} { if {[winfo exists .send_message]} { @@ -64,6 +64,28 @@ } }
+ +# ------------------------------------------------------------------------------ +# find panel + +proc 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} { + wm withdraw .find +} + proc ::pd_menucommands::menu_find_panel {mytoplevel} { if {[winfo exists .find]} { wm deiconify .find @@ -75,21 +97,28 @@ wm geometry .find =475x125+150+150 wm resizable .find 0 0 if {[catch {wm attributes .find -topmost}]} {puts stderr ".find -topmost failed"} - . config -bg green + .find configure -background $::panel_background ::pd_bindings::panel_bindings .find "find"
- label .find.label -text [_ "Search for:"] - entry .find.entry -width 54 -font 18 -textvariable find_string \ - -highlightthickness 2 -highlightcolor blue -relief sunken + 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.label .find.entry -side top -padx 10 + pack .find.entry -side top -padx 10
frame .find.buttonframe -background yellow button .find.button -text [_ "Find"] -default active -width 9 \ - -command "find_ok $mytoplevel" + -highlightbackground $::panel_background -command "find_ok $mytoplevel" if {$::windowingsystem eq "x11"} { button .find.close -text [_ "Close"] -default normal -width 9 \ - -command "find_cancel $mytoplevel" + -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
Modified: branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl =================================================================== --- branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl 2009-02-02 03:42:03 UTC (rev 10712) +++ branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl 2009-02-02 06:12:14 UTC (rev 10713) @@ -66,19 +66,18 @@ pdsend "[winfo toplevel $mycanvas] key $state $key $shift" }
-#array set cmd_ops {} +# 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] + } +}
-# the only arg for pd.tk is the port number to connect to 'pd' on, but this -# code would be useful for opening files via drag-n-drop, the open panel, etc. -#for {set i 0} {$i < $argc} {incr i} { -# global cmd_ops files_to_open -# set o [lindex $argv $i] -# switch -regexp -- $o { -# ^-lang$ {incr i; set cmd_ops(lang) [lindex $argv $i]} -# default {lappend files_to_open [lindex $argv $i]} -# } -#} - # ------------------------------------------------------------------------------ # lost pdtk functions...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.