Tk Text Edit

Check-in [2dfd3b5084]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Various bug fixes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:2dfd3b50844afddd9dec902e2abaca4a114f6a66
User & Date: dennis 2001-01-22 23:11:32
Context
2001-01-24
18:39
Add delete from filelist, Add new common dialog: xdialog check-in: 306a766a08 user: dennis tags: trunk
2001-01-22
23:11
Various bug fixes check-in: 2dfd3b5084 user: dennis tags: trunk
2000-12-25
19:25
Prepare for release check-in: 9d8214e557 user: dennis tags: trunk, release_0_9_9
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/CHANGES.



1
2
3
4
5
6
7



Version 0.9.9 released 00-11-

* Logo in File menu
* Possibility to assign icons to speed buttons
* Load/Save/New/Close = new default buttons with icons
* Possibility to resize file list and textshell
>
>







1
2
3
4
5
6
7
8
9

* Various bug fixes on the file list.

Version 0.9.9 released 00-11-

* Logo in File menu
* Possibility to assign icons to speed buttons
* Load/Save/New/Close = new default buttons with icons
* Possibility to resize file list and textshell

Changes to lib/flist.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

76
77
78
79

80


81
82
83
84
85
86
87
88
89
90
91



92
93
94




95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

110
111
112
113
114
115
116
117
118
119
120
121



122
123
124
125
126
127
128
129
namespace eval flist {

namespace export Show w lasttag showdir

proc Show {w} {
global lasttag
set lasttag ""
showdir $w "*"
return $w
}

proc showitem {w index type text} {
global c
set f [file split $text]
set f [lindex $f [expr [llength $f]-1]]
set fi "_$f"
$w create text  20 [expr $index*15+5] -text $f -tag $f -anchor nw -fill $c(color-listtext)
$w create image 10 [expr $index*15+10] -image $type -tag $fi
$w bind $f <Double-Button-1> "flist::dclick $w $text"
$w bind $fi <Double-Button-1> "flist::dclick $w $text"

$w bind $f <Button-1> "flist::click $w $f"

$w bind $fi <Button-1> "flist::click $w $f"
$w bind $f <Button-3> "flist::click $w $f"
$w bind $fi <Button-3> "flist::click $w $f"
}

proc showlist {w list typelist} {
set i 0
$w delete all
foreach l $list {

showitem $w $i [lindex $typelist $i] $l
incr i
}
}

proc mark {w tag} {
global lasttag c
c $tag
set y [expr [lindex [$w coords $tag] 1]-2]

if {$y>=0} {
$w itemconfigure $lasttag -fill $c(color-listtext)
$w delete marking
$w create rectangle 1 $y 800 [expr $y+15] -tag marking -fill $c(color-listactivebg) -outline $c(color-listactivebg)
$w lower marking
$w itemconfigure $tag -fill $c(color-listactivetext)
set lasttag $tag
}
}

proc click {w tag} {
c


mark $w $tag
}


proc dclick {w file} {
if {$file==".."} {
cd ..
showdir $w *
} else {
if {[file isdir $file]} {
cd $file
showdir $w *
} else {
flist::open
}

}
}
 
proc showdir {w path} {
global current_window window
set list ".."

set typs "i_folder"
set openlist [win::pathnames]

#c $window($current_window,info)





foreach f [glob $path] {
set list "$list $f"
if {[file isdir $f]} {
set typs "$typs i_folder"
} else {
	set pos [lsearch $openlist [file join [pwd] $f]]
	if {$pos==-1} {
	set typs "$typs i_file"
	} else {
	if {$window([expr $pos +1],change)==0} { set typs "$typs i_savedfile" } else { set typs "$typs i_openfile"}



	}	
	}
}




showlist $w $list $typs
$w configure -scrollregion "0 0 200 [expr 15*[llength $list]]"
}


proc copy {} {
global lasttag
set f  [file join [pwd] $lasttag]
c $f
txt::copyfrom_clip .text $f
}

proc open {} {
global lasttag
set f  [file join [pwd] $lasttag]

set n [lsearch [win::pathnames]  $f ]

if {$n=="-1"} {
file::Load "file $f" -force
} else {
win::activate [lindex [win::names] $n ]
}
#flist::showdir .flist *
}

}




set menu .fmnu
menu $menu -tearoff 0
$menu add command -label "Open" -command flist::open
$menu add command -label "Copy" -command flist::copy
$menu add separator
$menu add command -label "Delete"







|
|
|
|



|
|
|
<
|
|
|
|
<
|
>
|
|
<



|
|
<
>
|
<
|



|
<
|
<
|
|
|
|
|
|
|
|


|
<
>
>
|




|
|
|
|
|
|
|
|
|
|
|

|
<

|
<
>
|
|

<
>

>
>

<
<
|
|
|
|
|
|
|
|
>
>
>
|
|
|
>
>
>
>
|
|



|
<
|
<
|


|
<
|
>
|

|
|
|
|
|
<


|
|
>
>
>
|
|
|
|
|
|
<
<
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19

20
21
22
23

24
25
26
27
28

29
30

31
32
33
34
35

36

37
38
39
40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

68
69

70
71
72
73

74
75
76
77
78


79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

103

104
105
106
107

108
109
110
111
112
113
114
115
116

117
118
119
120
121
122
123
124
125
126
127
128
129


namespace eval flist {

namespace export Show w lasttag showdir

proc Show {w} {
	global lasttag
	set lasttag ""
	showdir $w "*"
	return $w
}

proc showitem {w index type text} {
	global c
	set f [file split $text]
	set f [lindex $f [expr [llength $f]-1]]

	$w create text  20 [expr $index*15+5] -text $f -tag "1_$index" -anchor nw -fill $c(color-listtext)
	$w create image 10 [expr $index*15+10] -image $type -tag "2_$index"
	$w bind "1_$index" <Double-Button-1> "flist::dclick $w {$text}"
	$w bind "2_$index" <Double-Button-1> "flist::dclick $w {$text}"

	$w bind "1_$index" <Button-1> "flist::click $w 1_$index {$text}"
	$w bind "1_$index" <Button-3> "flist::click $w 1_$index {$text}"
	$w bind "2_$index" <Button-1> "flist::click $w 1_$index {$text}"
	$w bind "2_$index" <Button-3> "flist::click $w 1_$index {$text}"

}

proc showlist {w list typelist} {
	set i 0
	$w delete all

	for {set i 0} {$i <[llength $list]} {incr i } {
		showitem $w $i [lindex $typelist $i] [lindex $list $i]

	}
}

proc mark {w tag} {
	global lasttag c

	set y [expr [lindex [$w coords $tag] 1]-2]

	if {$y>=0} {
		$w itemconfigure "{$lasttag}" -fill $c(color-listtext)
		$w delete marking
		$w create rectangle 1 $y 800 [expr $y+15] -tag marking -fill $c(color-listactivebg) -outline $c(color-listactivebg)
		$w lower marking
		$w itemconfigure "{$tag}" -fill $c(color-listactivetext)
		set lasttag $tag
	}
}

proc click {w tag file} {

	global flist_lastfile
	set flist_lastfile $file
	mark $w "$tag"
}


proc dclick {w file} {
	if {$file==".."} {
		cd ..
		showdir $w *
		} else {
		if {[file isdir "$file"]} {
			cd "$file"
			showdir $w *
		} else {
		flist::open $file
		}
	}
}
 

proc showdir {w path} {
	global current_window window


	set typs ""
	set openlist [win::pathnames]


	set list [glob -nocomplain $path]

	for {set i 0} {$i <[llength $list]} {incr i } {
		set f [lindex $list $i]



		if {[file isdir $f]} {
			set typs "$typs i_folder"
		} else {
			set pos [lsearch $openlist [file join [pwd] $f]]
			if {$pos==-1} {
				set typs "$typs i_file"
			} else {
				if {$window([expr $pos +1],change)==0} { 
					set typs "$typs i_savedfile" 
				} else { 
					set typs "$typs i_openfile"
				}
			}	
		}
	}
	set list [concat ".. $list"]
	set typs "i_folder $typs"

	showlist $w "$list" $typs
	$w configure -scrollregion "0 0 200 [expr 15*[llength $list]]"
}


proc copy {file} {

	set f  [file join [pwd] $file]

	txt::copyfrom_clip .text $f
}

proc open {file} {

	set f  [file join [pwd] $file]

	set n [lsearch [win::pathnames]  $f ]

	if {$n=="-1"} {
		file::Load "file {$f}" -force
	} else {
		win::activate [lindex [win::names] $n ]
	}

}


}

	set flist_lastfile ""

	set menu .fmnu
	menu $menu -tearoff 0
	$menu add command -label "Open" -command {global flist_file;flist::dclick .flist $flist_lastfile}
	$menu add command -label "Copy" -command {global flist_file;flist::copy $flist_lastfile}
	$menu add separator
	$menu add command -label "Delete"