Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Tsw: Optimized the resource management. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
141f0f50caa8462b2216d8d94c4e79bc |
User & Date: | csaba 2025-07-25 18:39:11.161 |
Context
2025-07-28
| ||
13:17 | Tsw: Code cleanup. check-in: 0f25a87991 user: csaba tags: trunk | |
2025-07-25
| ||
18:39 | Tsw: Optimized the resource management. check-in: 141f0f50ca user: csaba tags: trunk | |
2025-07-24
| ||
17:16 | Tsw: Corrected a typo. check-in: 8723831003 user: csaba tags: trunk | |
Changes
Changes to modules/tsw/scripts/elements.tcl.
1 | #============================================================================== | | | 1 2 3 4 5 6 7 8 9 | #============================================================================== # Contains procedures that create the *Switch*.trough and *Switch*.slider # elements for the Toggleswitch* styles. # # Copyright (c) 2025 Csaba Nemethi (E-mail: [email protected]) #============================================================================== #------------------------------------------------------------------------------ # tsw::svgFormat |
︙ | ︙ | |||
1498 1499 1500 1501 1502 1503 1504 | Switch$n.trough -sticky {} -children [list \ Switch$n.slider -side left -sticky {} \ ] ] ] } } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 | Switch$n.trough -sticky {} -children [list \ Switch$n.slider -side left -sticky {} \ ] ] ] } } #------------------------------------------------------------------------------ # tsw::createElements #------------------------------------------------------------------------------ proc tsw::createElements {} { variable theme set themeMod $theme set mod "" if {$theme eq "default"} { set fg [ttk::style lookup . -foreground] if {[mwutil::isColorLight $fg]} { set themeMod defaultDark set mod "Dark" } } variable elemInfoArr if {[info exists elemInfoArr($themeMod)]} { if {$theme eq "aqua"} { updateElements_$theme } return "" } switch $themeMod { default - defaultDark - clam - droid - plastik - awarc - awbreeze - awbreezedark - awlight - awdark - vista - aqua { createElements_$themeMod } winnative - xpnative { ttk::style theme settings vista { createElements_vista } foreach n {1 2 3} { ttk::style element create Switch$n.trough from vista ttk::style element create Switch$n.slider from vista } } default { set fg [ttk::style lookup . -foreground {} black] if {[mwutil::isColorLight $fg] || [string match -nocase *dark* $theme]} { set mod "Dark" } ttk::style theme settings default { createElements_default$mod } foreach n {1 2 3} { ttk::style element create ${mod}Switch$n.trough from default ttk::style element create ${mod}Switch$n.slider from default } } } set elemInfoArr($themeMod) 1 if {$theme eq "aqua"} { foreach n {1 2 3} { ttk::style layout Toggleswitch$n [list \ Switch.padding -sticky nswe -children [list \ Switch$n.trough -sticky {} -children [list \ Switch$n.slider -side left -sticky {} \ ] ] ] ttk::style configure Toggleswitch$n -padding 1.5p } } else { foreach n {1 2 3} { ttk::style layout Toggleswitch$n [list \ Switch.focus -sticky nswe -children [list \ Switch.padding -sticky nswe -children [list \ ${mod}Switch$n.trough -sticky {} -children [list \ ${mod}Switch$n.slider -side left -sticky {} ] ] ] ] ttk::style configure Toggleswitch$n -padding 0.75p if {$theme eq "classic"} { ttk::style configure Toggleswitch$n -focussolid 1 } } } } |
Changes to modules/tsw/scripts/tclIndex.
︙ | ︙ | |||
18 19 20 21 22 23 24 | set auto_index(::tsw::createElements_awlight) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_awdark) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_vista) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_win11) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_win10) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_aqua) [list source [file join $dir elements.tcl]] set auto_index(::tsw::updateElements_aqua) [list source [file join $dir elements.tcl]] | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | set auto_index(::tsw::createElements_awlight) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_awdark) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_vista) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_win11) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_win10) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_aqua) [list source [file join $dir elements.tcl]] set auto_index(::tsw::updateElements_aqua) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createBindings) [list source [file join $dir toggleswitch.tcl]] set auto_index(::tsw::toggleswitch) [list source [file join $dir toggleswitch.tcl]] set auto_index(::tsw::doConfig) [list source [file join $dir toggleswitch.tcl]] set auto_index(::tsw::makeVariable) [list source [file join $dir toggleswitch.tcl]] set auto_index(::tsw::varTrace) [list source [file join $dir toggleswitch.tcl]] set auto_index(::tsw::doCget) [list source [file join $dir toggleswitch.tcl]] set auto_index(::tsw::toggleswitchWidgetCmd) [list source [file join $dir toggleswitch.tcl]] |
︙ | ︙ |
Changes to modules/tsw/scripts/toggleswitch.tcl.
︙ | ︙ | |||
76 77 78 79 80 81 82 | set scaled4 [scaleutil::scale 4 $::scaleutil::scalingPct] } else { ;# Tk 8.7b1/9 or later set scaled4 [tk::ScaleNum 4] } variable onAndroid [expr {[info exists ::tk::android] && $::tk::android}] | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | set scaled4 [scaleutil::scale 4 $::scaleutil::scalingPct] } else { ;# Tk 8.7b1/9 or later set scaled4 [tk::ScaleNum 4] } variable onAndroid [expr {[info exists ::tk::android] && $::tk::android}] variable madeElements 0 } # # Private procedure creating the default bindings # =============================================== # |
︙ | ︙ | |||
268 269 270 271 272 273 274 275 276 277 278 279 280 281 | set data($opt) [lindex $configSpecs($opt) 3] } set data(varTraceCmd) [list tsw::varTrace $win] # # Create a ttk::scale child widget of a special style # set size [lindex $configSpecs(-size) end] set scl [ttk::scale $win.scl -class TswScale -style Toggleswitch$size \ -takefocus 0 -length 0 -from 0 -to 20] pack $scl -expand 1 -fill both bindtags $scl [linsert [bindtags $scl] 3 ToggleswitchKeyNav] # | > > > > > | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | set data($opt) [lindex $configSpecs($opt) 3] } set data(varTraceCmd) [list tsw::varTrace $win] # # Create a ttk::scale child widget of a special style # variable madeElements if {!$madeElements} { createElements ;# (see elements.tcl) set madeElements 1 } set size [lindex $configSpecs(-size) end] set scl [ttk::scale $win.scl -class TswScale -style Toggleswitch$size \ -takefocus 0 -length 0 -from 0 -to 20] pack $scl -expand 1 -fill both bindtags $scl [linsert [bindtags $scl] 3 ToggleswitchKeyNav] # |
︙ | ︙ | |||
665 666 667 668 669 670 671 | #------------------------------------------------------------------------------ # tsw::onThemeChanged #------------------------------------------------------------------------------ proc tsw::onThemeChanged w { variable theme [ttk::style theme use] if {$w eq "."} { | | > > > | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | #------------------------------------------------------------------------------ # tsw::onThemeChanged #------------------------------------------------------------------------------ proc tsw::onThemeChanged w { variable theme [ttk::style theme use] if {$w eq "."} { variable madeElements if {$madeElements} { ;# for some theme (see proc tsw::toggleswitch) createElements ;# for the new theme (see elements.tcl) } } else { set stateSpec [$w state !disabled] ;# needed for $w set $w set [expr {[$w instate selected] ? [$w cget -to] : [$w cget -from]}] $w state $stateSpec ;# restores the state } } |
︙ | ︙ |