Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Polished print dialog |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d21f22ea65586b415dad0dd07f655f3b |
User & Date: | peter 2019-02-10 23:19:55.441 |
Context
2019-03-12
| ||
22:16 | Adjust zoom popup for corner case. [0903a2b6b8] check-in: cf1823be38 user: peter tags: trunk | |
2019-02-10
| ||
23:19 | Polished print dialog check-in: d21f22ea65 user: peter tags: trunk | |
2019-02-06
| ||
00:06 | Release 2.8.4 check-in: e01ff53217 user: peter tags: trunk | |
Changes
Changes to Changes.
1 2 3 4 5 6 7 | Released 2.8.4 2019-02-06 Bumped revision to 2.8.4 2019-02-04 Include a file selector when committing multiple files. | > > | 1 2 3 4 5 6 7 8 9 | 2019-02-11 Released 2.8.4 2019-02-06 Bumped revision to 2.8.4 2019-02-04 Include a file selector when committing multiple files. |
︙ | ︙ |
Changes to src/print.tcl.
︙ | ︙ | |||
322 323 324 325 326 327 328 | if {!$quiet} { tk_messageBox -title "Eskil Print" -parent $top \ -message "Printed $npages pages to $pdfFile" -type ok } } # Count the length of a line during a text dump | | | | | | | | | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | if {!$quiet} { tk_messageBox -title "Eskil Print" -parent $top \ -message "Printed $npages pages to $pdfFile" -type ok } } # Count the length of a line during a text dump proc AccumulateMax {top key value index} { set index [lindex [split $index "."] 1] set len [expr {[string length $value] + $index - 1}] if {$len > 0} { lappend ::eskil($top,currentCharsPerLine) $len } } # Count the longest line length in the current display proc CountCharsPerLine {top} { set ::eskil($top,currentCharsPerLine) {} $::widgets($top,wDiff1) dump -text -command [list AccumulateMax $top] 1.0 end $::widgets($top,wDiff2) dump -text -command [list AccumulateMax $top] 1.0 end set ::eskil($top,currentCharsPerLine) \ [lsort -integer $::eskil($top,currentCharsPerLine)] return [lindex $::eskil($top,currentCharsPerLine) end] } # In a sorted list of integers, figure out where val fits # In 8.6 this could use lsearch -bisect proc FindPercentile {l val} { set len [llength $l] # No elements, so all are covered in a way |
︙ | ︙ | |||
379 380 381 382 383 384 385 386 387 388 389 | # 80 chars, and longest line used are always included. proc CharsPerLineOptions {top} { set values [list 80] set cpl [CountCharsPerLine $top] if {$cpl ne "" && $cpl != 0} { lappend values $cpl } if {[string is digit -strict $::Pref(printCharsPerLine)]} { lappend values $::Pref(printCharsPerLine) } # Include 90% if reasonable | > | | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | # 80 chars, and longest line used are always included. proc CharsPerLineOptions {top} { set values [list 80] set cpl [CountCharsPerLine $top] if {$cpl ne "" && $cpl != 0} { lappend values $cpl } # Include previous selection if {[string is digit -strict $::Pref(printCharsPerLine)]} { lappend values $::Pref(printCharsPerLine) } # Include 90% if reasonable set len [llength $::eskil($top,currentCharsPerLine)] set cpl [lindex $::eskil($top,currentCharsPerLine) [expr {9*$len/10}]] if {$cpl ne "" && $cpl != 0} { lappend values $cpl } set values [lsort -unique -integer $values] set result {} foreach value $values { set p [FindPercentile $::eskil($top,currentCharsPerLine) $value] lappend result $value "$value ($p %)" \ "$p % of the lines are within this line length" } return $result } proc BrowsePrintFileName {top entry} { |
︙ | ︙ | |||
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | } else { set cmd [list ttk::spinbox $w] lappend cmd -command [list $w selection clear] -state readonly } lappend cmd {*}$args {*}$cmd } # Create a print dialog for PDF. proc doPrint {top {quiet 0}} { if {$quiet} { PrintDiffs $top 1 return } | > > > > > > > > > > > > > > > > > > > | | | | > | > | | > | | | | | | | > > > > > < < < < < < < < | | | | | | | | | | > > > > > > > > < < < < < < | | | > | | | | | | | > | | | | > > > | < | | | > > | | | | | | | > | | | < | < | > < | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | } else { set cmd [list ttk::spinbox $w] lappend cmd -command [list $w selection clear] -state readonly } lappend cmd {*}$args {*}$cmd } proc PrintTracePrefs {W args} { set ::Pref(printColorChange) \ [list $::TmpPref(chr) $::TmpPref(chg) $::TmpPref(chb)] set ::Pref(printColorNew1) \ [list $::TmpPref(n1r) $::TmpPref(n1g) $::TmpPref(n1b)] set ::Pref(printColorNew2) \ [list $::TmpPref(n2r) $::TmpPref(n2g) $::TmpPref(n2b)] if {![winfo exists $W.cf.l1e]} return foreach w {1 2 3} p {ch n1 n2} { set r [expr {int(255*$::TmpPref(${p}r))}] set g [expr {int(255*$::TmpPref(${p}g))}] set b [expr {int(255*$::TmpPref(${p}b))}] set col [format \#%02X%02X%02X $r $g $b] $W.cf.l${w}e configure -background $col } } # Create a print dialog for PDF. proc doPrint {top {quiet 0}} { if {$quiet} { PrintDiffs $top 1 return } set W $top.pr destroy $W ttk::toplevel $W -padx 3 -pady 3 wm title $W "Print diffs to PDF" # Layout settings ttk::labelframe $W.lfs -text "Settings" -padding 3 ttk::label $W.lfs.hsl -anchor w -text "Header Size" addBalloon $W.lfs.hsl "Font size for page header" MySpinBox $W.lfs.hss -textvariable ::Pref(printHeaderSize) \ -from 5 -to 16 -width 3 -format %.0f ttk::label $W.lfs.cll -anchor w -text "Chars per line" addBalloon $W.lfs.cll "Font size is scaled to fit this" ttk::entryX $W.lfs.cle -textvariable ::Pref(printCharsPerLine) -width 4 ttk::frame $W.lfs.clf set values [CharsPerLineOptions $top] foreach {value label balloon} $values { ttk::radiobutton $W.lfs.clf.$value -variable ::Pref(printCharsPerLine) \ -value $value -text $label addBalloon $W.lfs.clf.$value $balloon pack $W.lfs.clf.$value -side left -padx 3 -pady 3 } # Select paper size set paperlist [lsort -dictionary [pdf4tcl::getPaperSizeList]] ttk::label $W.lfs.psl -anchor w -text "Paper Size" ttk::combobox $W.lfs.psc -values $paperlist -textvariable ::Pref(printPaper) \ -width 6 -state readonly grid $W.lfs.hsl $W.lfs.hss -sticky we -padx 3 -pady 3 grid $W.lfs.psl $W.lfs.psc -sticky we -padx 3 -pady 3 grid $W.lfs.cll $W.lfs.cle $W.lfs.clf - -sticky we -padx 3 -pady 3 grid columnconfigure $W.lfs 1 -weight 1 # Color foreach {::TmpPref(chr) ::TmpPref(chg) ::TmpPref(chb)} \ $::Pref(printColorChange) break foreach {::TmpPref(n1r) ::TmpPref(n1g) ::TmpPref(n1b)} \ $::Pref(printColorNew1) break foreach {::TmpPref(n2r) ::TmpPref(n2g) ::TmpPref(n2b)} \ $::Pref(printColorNew2) break ttk::labelframe $W.cf -text "Background Color" -padding 3 ttk::label $W.cf.hr -text "Red" ttk::label $W.cf.hg -text "Green" ttk::label $W.cf.hb -text "Blue" ttk::label $W.cf.l1 -text "Change" MySpinBox $W.cf.s1r -from 0.0 -to 1.0 -increment 0.1 -format %.1f \ -width 5 -textvariable ::TmpPref(chr) MySpinBox $W.cf.s1g -from 0.0 -to 1.0 -increment 0.1 -format %.1f \ -width 5 -textvariable ::TmpPref(chg) MySpinBox $W.cf.s1b -from 0.0 -to 1.0 -increment 0.1 -format %.1f \ -width 5 -textvariable ::TmpPref(chb) ttk::label $W.cf.l1e -text "Example" addBalloon $W.cf.l1e "Screen approximation of print color" ttk::label $W.cf.l2 -text "Old" MySpinBox $W.cf.s2r -from 0.0 -to 1.0 -increment 0.1 -format %.1f \ -width 5 -textvariable ::TmpPref(n1r) MySpinBox $W.cf.s2g -from 0.0 -to 1.0 -increment 0.1 -format %.1f \ -width 5 -textvariable ::TmpPref(n1g) MySpinBox $W.cf.s2b -from 0.0 -to 1.0 -increment 0.1 -format %.1f \ -width 5 -textvariable ::TmpPref(n1b) ttk::label $W.cf.l2e -text "Example" ttk::label $W.cf.l3 -text "New" MySpinBox $W.cf.s3r -from 0.0 -to 1.0 -increment 0.1 -format %.1f \ -width 5 -textvariable ::TmpPref(n2r) MySpinBox $W.cf.s3g -from 0.0 -to 1.0 -increment 0.1 -format %.1f \ -width 5 -textvariable ::TmpPref(n2g) MySpinBox $W.cf.s3b -from 0.0 -to 1.0 -increment 0.1 -format %.1f \ -width 5 -textvariable ::TmpPref(n2b) ttk::label $W.cf.l3e -text "Example" grid x $W.cf.hr $W.cf.hg $W.cf.hb -pady 1 grid $W.cf.l1 $W.cf.s1r $W.cf.s1g $W.cf.s1b $W.cf.l1e -sticky w -padx 3 -pady 3 grid $W.cf.l2 $W.cf.s2r $W.cf.s2g $W.cf.s2b $W.cf.l2e -sticky w -padx 3 -pady 3 grid $W.cf.l3 $W.cf.s3r $W.cf.s3g $W.cf.s3b $W.cf.l3e -sticky w -padx 3 -pady 3 trace add variable ::TmpPref write [list PrintTracePrefs $W] PrintTracePrefs $W # File ttk::labelframe $W.lff -text "Output File" -padding 3 ttk::entryX $W.lff.fne -textvariable ::eskil($top,printFile) -width 30 ttk::button $W.lff.fnb -text "Browse" \ -command [list BrowsePrintFileName $top $W.fne] grid $W.lff.fne $W.lff.fnb -sticky we -padx 3 -pady 3 grid columnconfigure $W.lff 0 -weight 1 if {$::eskil($top,printFile) eq ""} { set ::eskil($top,printFile) "~/eskil.pdf" } ttk::frame $W.fb ttk::button $W.b1 -text "Print to File" \ -command "destroy $W; update; PrintDiffs $top" ttk::button $W.b2 -text "Cancel" -command {destroy $W} pack $W.b1 -in $W.fb -side left -padx {0 3} -pady 3 -ipadx 5 pack $W.b2 -in $W.fb -side right -padx {3 0} -pady 3 -ipadx 5 # Top Layout grid $W.lfs -sticky we -padx 3 -pady 3 grid $W.cf -sticky we -padx 3 -pady 3 grid $W.lff -sticky we -padx 3 -pady 3 grid $W.fb -sticky swe -padx 3 -pady 3 grid columnconfigure $W 0 -weight 1 grid rowconfigure $W $W.fb -weight 1 } |