Check-in [3b1d6ac35e]
Not logged in

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

Overview
Comment:add search function from ticket [0083572bf6]
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3b1d6ac35ee5564d98c0fdfc95405794d14731e5
User & Date: chw 2019-05-30 09:17:18.839
Context
2019-05-30
09:29
add tcl upstream changes check-in: 1af92e6c04 user: chw tags: trunk
09:17
add search function from ticket [0083572bf6] check-in: 3b1d6ac35e user: chw tags: trunk
2019-05-29
03:47
add tk upstream changes check-in: d299632677 user: chw tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to assets/materialicons0.2/show.tcl.
1
2
3

4
5
6
7
8
9
10
# Simple viewer for MaterialIcons package.
#
# chw January 2019


package require Tk
package require MaterialIcons
package require tooltip

wm title . "MaterialIcons"




>







1
2
3
4
5
6
7
8
9
10
11
# Simple viewer for MaterialIcons package.
#
# chw January 2019
# search facility: dzach May 2019

package require Tk
package require MaterialIcons
package require tooltip

wm title . "MaterialIcons"

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
	return
    }
    clipboard clear
    clipboard append -type STRING -- $::name
}

proc showicons {} {







    canvas .v -yscrollcommand {.y set} -xscrollcommand {.x set}
    grid .v -row 0 -column 0 -sticky news
    ttk::scrollbar .y -orient vertical -command {.v yview}
    grid .y -row 0 -column 1 -sticky ns
    ttk::scrollbar .x -orient horizontal -command {.v xview}
    grid .x -row 1 -column 0 -sticky ew
    label .l -textvariable name
    grid .l -row 2 -column 0 -sticky ew
    grid rowconfigure . 0 -weight 1
    grid columnconfigure . 0 -weight 1












    set ::name ""
    set x 20
    set y 20


    set xmax [expr {[winfo screenwidth .] - 80}]






    foreach n [MaterialIcons names] {
	set i [MaterialIcons image $n 20]
	set c [.v create image $x $y -anchor nw -image $i \
	    -tags [list _icons $n]]
	lassign [.v bbox $c] x1 y1 x2 y2
	if {$x1 > $xmax} {
	    set y [expr {$y2 + 10}]
	    set x 20
	    .v coords $c $x $y
	    lassign [.v bbox $c] x1 y1 x2 y2
	}
	set x [expr {$x2 + 10}]
	tooltip::tooltip .v -items $c $n
    }



    lassign [.v bbox _icons] x1 y1 x2 y2
    .v configure -scrollregion \
	[list [expr {$x1 - 20}] [expr {$y1 - 20}] \
	     [expr {$x2 + 20}] [expr {$y2 + 20}]]



    .v bind _icons <Enter> {showname 1}
    .v bind _icons <Leave> {showname 0}
    .v bind _icons <1> putclipboard
}

showicons







>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
|
>



>
>
|
|
>
>
>
>
>
|














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



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
	return
    }
    clipboard clear
    clipboard append -type STRING -- $::name
}

proc showicons {} {
    if {![winfo exists .v]} {
	set ::pattern *
	frame .f
	label .f.s -text "Search: "
	entry .f.e -textvariable ::pattern -width 30
	pack .f.s .f.e -side left
	grid .f -row 0 -column 0 -padx 4 -pady 4 -columnspan 2 -sticky w
	canvas .v -yscrollcommand {.y set} -xscrollcommand {.x set} -bg white
	grid .v -row 1 -column 0 -sticky news
	ttk::scrollbar .y -orient vertical -command {.v yview}
	grid .y -row 1 -column 1 -sticky ns
	ttk::scrollbar .x -orient horizontal -command {.v xview}
	grid .x -row 2 -column 0 -sticky ew
	label .l -textvariable name
	grid .l -row 3 -column 0 -sticky ew
	grid rowconfigure . 1 -weight 1
	grid columnconfigure . 0 -weight 1
	bind .f.e <Return> {showicons ; break}
	bind .f.e <KP_Enter> {showicons ; break}
	bind . <Configure> {showicons ; break}
	.f.e icursor end
	.v bind _icons <Enter> {showname 1}
	.v bind _icons <Leave> {showname 0}
	.v bind _icons <1> putclipboard
    } else {
	.v delete all
	tooltip::tooltip .v -items {} {}
    }

    set ::name ""
    set x 20
    set y 20
    set xmax [winfo width .]
    if {$xmax == 1} {
	set xmax [expr {[winfo reqwidth .v] + [winfo reqwidth .y]}]
    }
    set xmax [expr {$xmax - 64}]
    if {$xmax < 200} {
	set xmax 200
    }

    foreach n [MaterialIcons names $::pattern] {
	set i [MaterialIcons image $n 20]
	set c [.v create image $x $y -anchor nw -image $i \
	    -tags [list _icons $n]]
	lassign [.v bbox $c] x1 y1 x2 y2
	if {$x1 > $xmax} {
	    set y [expr {$y2 + 10}]
	    set x 20
	    .v coords $c $x $y
	    lassign [.v bbox $c] x1 y1 x2 y2
	}
	set x [expr {$x2 + 10}]
	tooltip::tooltip .v -items $c $n
    }

    set bbox [.v bbox _icons]
    if {[llength $bbox]} {
	lassign [.v bbox _icons] x1 y1 x2 y2
	.v configure -scrollregion [list [expr {$x1 - 20}] [expr {$y1 - 20}] \

	    [expr {$x2 + 20}] [expr {$y2 + 20}]]
    } else {
	.v configure -scrollregion {}
    }



}

showicons