Tk Source Code

Artifact [232a694c]
Login

Artifact 232a694c07b0efd5db43f380275a95529b5f6709:

Attachment "fbox.diff" to ticket [657656ff] added by davidw 2004-04-01 06:03:40.
? fbox.diff
? library.diff
Index: tkfbox.tcl
===================================================================
RCS file: /cvsroot/tktoolkit/tk/library/tkfbox.tcl,v
retrieving revision 1.41
diff -u -r1.41 tkfbox.tcl
--- tkfbox.tcl	12 Nov 2003 00:07:03 -0000	1.41
+++ tkfbox.tcl	31 Mar 2004 22:57:52 -0000
@@ -467,6 +467,7 @@
     if {$data(curItem) != ""} {
 	IconList_Select $w [lindex [lindex $data(list) $data(curItem)] 2] 0
     }
+    IconList_DrawSelection $w
 }
 
 # Gets called when the user invokes the IconList (usually by double-clicking
@@ -629,7 +630,7 @@
 }
 
 proc ::tk::IconList_FocusOut {w} {
-    IconList_Selection $w clear 0 end
+    #    IconList_Selection $w clear 0 end
 }
 
 # ::tk::IconList_UpDown --
@@ -963,6 +964,10 @@
 	    set data(selectPath) [pwd]
 	}
     }
+    if { $type == "open" && $data(-multiple) != 1 && \
+	     [llength $data(-initialfile)] > 1 } {
+	error "called -initialfile with more than one file, and -multiple is not set."
+    }
     set data(selectFile) $data(-initialfile)
 
     # 5. Parse the -filetypes option
@@ -1003,9 +1008,9 @@
     set data(upBtn) [button $f1.up]
     if {![info exists Priv(updirImage)]} {
 	set Priv(updirImage) [image create bitmap -data {
-#define updir_width 28
-#define updir_height 16
-static char updir_bits[] = {
+	    #define updir_width 28
+	    #define updir_height 16
+	    static char updir_bits[] = {
    0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00,
    0x20, 0x40, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x01, 0x10, 0x00, 0x00, 0x01,
    0x10, 0x02, 0x00, 0x01, 0x10, 0x07, 0x00, 0x01, 0x90, 0x0f, 0x00, 0x01,
@@ -1207,11 +1212,11 @@
 
     if {![info exists Priv(folderImage)]} {
 	set Priv(folderImage) [image create photo -data {
-R0lGODlhEAAMAKEAAAD//wAAAPD/gAAAACH5BAEAAAAALAAAAAAQAAwAAAIghINhyycvVFsB
-QtmS3rjaH1Hg141WaT5ouprt2HHcUgAAOw==}]
+	    R0lGODlhEAAMAKEAAAD//wAAAPD/gAAAACH5BAEAAAAALAAAAAAQAAwAAAIghINhyycvVFsB
+	    QtmS3rjaH1Hg141WaT5ouprt2HHcUgAAOw==}]
 	set Priv(fileImage)   [image create photo -data {
-R0lGODlhDAAMAKEAALLA3AAAAP//8wAAACH5BAEAAAAALAAAAAAMAAwAAAIgRI4Ha+IfWHsO
-rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==}]
+	    R0lGODlhDAAMAKEAALLA3AAAAP//8wAAACH5BAEAAAAALAAAAAAMAAwAAAIgRI4Ha+IfWHsO
+	    rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==}]
     }
     set folder $Priv(folderImage)
     set file   $Priv(fileImage)
@@ -1268,6 +1273,26 @@
 	::tk::IconList_Add $data(icons) $file $fileList
     }
 
+    # Hits are the search hits.  We have to make sure that the
+    # selectFile files are all actually listed in the current
+    # directory.
+    set hits [list]
+    for {set i 0} {$i < [::tk::IconList_Index $data(icons) end]} {incr i} {
+	# Ignore errors.
+	catch {
+	    set res [lsearch $data(selectFile) [::tk::IconList_Get $data(icons) $i]]
+	    if { $res != -1 } {
+		lappend hits $res
+		::tk::IconList_Selection $data(icons) set $i
+	    }
+	}
+    }
+    # Go through the list of found files and add them.
+    set newfilelist [list]
+    foreach hit $hits {
+	lappend newfilelist [lindex $data(selectFile) $hit]
+    }
+    set data(selectFile) $newfilelist
     ::tk::IconList_Arrange $data(icons)
 
     # Update the Directory: option menu
Index: xmfbox.tcl
===================================================================
RCS file: /cvsroot/tktoolkit/tk/library/xmfbox.tcl,v
retrieving revision 1.25
diff -u -r1.25 xmfbox.tcl
--- xmfbox.tcl	18 Feb 2003 21:19:35 -0000	1.25
+++ xmfbox.tcl	31 Mar 2004 22:57:52 -0000
@@ -272,6 +272,12 @@
 	set data(selectPath) [pwd]
 	cd $old
     }
+
+    if { $type == "open" && $data(-multiple) != 1 && \
+	     [llength $data(-initialfile)] > 1 } {
+	error "called -initialfile with more than one file, and -multiple is not set."
+    }
+
     set data(selectFile) $data(-initialfile)
 
     # 5. Parse the -filetypes option. It is not used by the motif
@@ -525,11 +531,12 @@
     $data(fEnt) delete 0 end
     $data(fEnt) insert 0 \
             [::tk::dialog::file::JoinFile $data(selectPath) $data(filter)]
+
+    MotifFDialog_LoadFiles $w
+
     $data(sEnt) delete 0 end
     $data(sEnt) insert 0 [::tk::dialog::file::JoinFile $data(selectPath) \
 	    $data(selectFile)]
- 
-    MotifFDialog_LoadFiles $w
 }
 
 # ::tk::MotifFDialog_LoadFiles --
@@ -585,6 +592,22 @@
     }
     eval [list $data(dList) insert end] [lsort -dictionary $dlist]
     eval [list $data(fList) insert end] [lsort -dictionary $flist]
+
+#    foreach item [$data(fList) curselection] {
+#	lappend data(selectFile) [$data(fList) get $item]
+#    }
+
+    set newlist {}
+    catch {
+	foreach item $data(selectFile) {
+	    set i [lsearch [$data(fList) get 0 end] $item]
+	    if { $i > 0 } {
+		$data(fList) selection set $i $i
+	    lappend newlist $item
+	    }
+	}
+    }
+    set data(selectFile) $newlist
 
     # The user probably doesn't want to see the . files. We adjust the view
     # so that the listbox displays all the non-dot files