Tk Source Code

Artifact [600db465]
Login

Artifact 600db4657f1b34c78be00222340d056ceb8a970c:

Attachment "library.diff" to ticket [657656ff] added by davidw 2003-05-15 18:39:21.
? latest.diff
? library.diff
Index: tkfbox.tcl
===================================================================
RCS file: /cvsroot/tktoolkit/tk/library/tkfbox.tcl,v
retrieving revision 1.38
diff -b -u -r1.38 tkfbox.tcl
--- tkfbox.tcl	21 Feb 2003 14:13:26 -0000	1.38
+++ tkfbox.tcl	15 May 2003 11:36:30 -0000
@@ -461,6 +461,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
@@ -623,7 +624,7 @@
 }
 
 proc ::tk::IconList_FocusOut {w} {
-    IconList_Selection $w clear 0 end
+    #    IconList_Selection $w clear 0 end
 }
 
 # ::tk::IconList_UpDown --
@@ -957,6 +958,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
@@ -997,9 +1002,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,
@@ -1202,11 +1207,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)
@@ -1278,6 +1283,11 @@
 	::tk::IconList_Add $data(icons) $file $fileList
     }
 
+    for {set i 0} {$i < [::tk::IconList_Index $data(icons) end]} {incr i} {
+	if { [lsearch $data(selectFile) [::tk::IconList_Get $data(icons) $i]] != -1 } {
+	    ::tk::IconList_Selection $data(icons) set $i
+	}
+    }
     ::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 -b -u -r1.25 xmfbox.tcl
--- xmfbox.tcl	18 Feb 2003 21:19:35 -0000	1.25
+++ xmfbox.tcl	15 May 2003 11:36:32 -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
@@ -585,6 +591,16 @@
     }
     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]
+#    }
+
+    foreach item $data(selectFile) {
+	set i [lsearch [$data(fList) get 0 end] $item]
+	$data(fList) selection set $i $i
+    }
+
 
     # The user probably doesn't want to see the . files. We adjust the view
     # so that the listbox displays all the non-dot files