13 # |
13 # |
14 # The in_mousewheel global was added to fix strange reentrancy issues. |
14 # The in_mousewheel global was added to fix strange reentrancy issues. |
15 # The whole snipped is activated only under windows, mouse wheel |
15 # The whole snipped is activated only under windows, mouse wheel |
16 # bindings working already under MacOSX and Linux. |
16 # bindings working already under MacOSX and Linux. |
17 |
17 |
|
18 if {[catch {package require Ttk}]} { |
|
19 # use a shim |
|
20 namespace eval ttk { |
|
21 proc style args {} |
|
22 |
|
23 proc entry args { |
|
24 eval [linsert $args 0 ::entry] -relief flat |
|
25 } |
|
26 } |
|
27 |
|
28 interp alias {} ttk::button {} button |
|
29 interp alias {} ttk::frame {} frame |
|
30 interp alias {} ttk::label {} label |
|
31 interp alias {} ttk::scrollbar {} scrollbar |
|
32 interp alias {} ttk::optionMenu {} tk_optionMenu |
|
33 } else { |
|
34 proc ::ttk::optionMenu {w varName firstValue args} { |
|
35 upvar #0 $varName var |
|
36 |
|
37 if {![info exists var]} { |
|
38 set var $firstValue |
|
39 } |
|
40 ttk::menubutton $w -textvariable $varName -menu $w.menu \ |
|
41 -direction flush |
|
42 menu $w.menu -tearoff 0 |
|
43 $w.menu add radiobutton -label $firstValue -variable $varName |
|
44 foreach i $args { |
|
45 $w.menu add radiobutton -label $i -variable $varName |
|
46 } |
|
47 return $w.menu |
|
48 } |
|
49 } |
|
50 |
18 if {[tk windowingsystem] eq "win32"} { |
51 if {[tk windowingsystem] eq "win32"} { |
|
52 |
|
53 ttk::style theme use xpnative |
19 |
54 |
20 set mw_classes [list Text Listbox Table TreeCtrl] |
55 set mw_classes [list Text Listbox Table TreeCtrl] |
21 foreach class $mw_classes { bind $class <MouseWheel> {} } |
56 foreach class $mw_classes { bind $class <MouseWheel> {} } |
22 |
57 |
23 set in_mousewheel 0 |
58 set in_mousewheel 0 |
524 .ctop conf -width $geometry(width) -height $geometry(height) |
565 .ctop conf -width $geometry(width) -height $geometry(height) |
525 set texth [expr {$geometry(height) - $geometry(canvh) - 56}] |
566 set texth [expr {$geometry(height) - $geometry(canvh) - 56}] |
526 set geometry(ctexth) [expr {($texth - 8) / |
567 set geometry(ctexth) [expr {($texth - 8) / |
527 [font metrics $textfont -linespace]}] |
568 [font metrics $textfont -linespace]}] |
528 } |
569 } |
529 frame .ctop.top |
570 ttk::frame .ctop.top |
530 frame .ctop.top.bar |
571 ttk::frame .ctop.top.bar |
531 pack .ctop.top.bar -side bottom -fill x |
572 pack .ctop.top.bar -side bottom -fill x |
532 set cscroll .ctop.top.csb |
573 set cscroll .ctop.top.csb |
533 scrollbar $cscroll -command {allcanvs yview} -highlightthickness 0 |
574 ttk::scrollbar $cscroll -command {allcanvs yview} |
534 pack $cscroll -side right -fill y |
575 pack $cscroll -side right -fill y |
535 panedwindow .ctop.top.clist -orient horizontal -sashpad 0 -handlesize 4 |
576 panedwindow .ctop.top.clist -orient horizontal -sashpad 0 -handlesize 4 |
536 pack .ctop.top.clist -side top -fill both -expand 1 |
577 pack .ctop.top.clist -side top -fill both -expand 1 |
537 .ctop add .ctop.top |
578 .ctop add .ctop.top |
538 set canv .ctop.top.clist.canv |
579 set canv .ctop.top.clist.canv |
575 static unsigned char right_bits[] = { |
616 static unsigned char right_bits[] = { |
576 0x00, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x1c, |
617 0x00, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x1c, |
577 0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c, |
618 0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c, |
578 0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01}; |
619 0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01}; |
579 } |
620 } |
580 button .ctop.top.bar.leftbut -image bm-left -command goback \ |
621 ttk::button .ctop.top.bar.leftbut -image bm-left -command goback \ |
581 -state disabled -width 26 |
622 -state disabled -width 26 |
582 pack .ctop.top.bar.leftbut -side left -fill y |
623 pack .ctop.top.bar.leftbut -side left -fill y |
583 button .ctop.top.bar.rightbut -image bm-right -command goforw \ |
624 ttk::button .ctop.top.bar.rightbut -image bm-right -command goforw \ |
584 -state disabled -width 26 |
625 -state disabled -width 26 |
585 pack .ctop.top.bar.rightbut -side left -fill y |
626 pack .ctop.top.bar.rightbut -side left -fill y |
586 |
627 |
587 button .ctop.top.bar.findbut -text "Find" -command dofind |
628 ttk::button .ctop.top.bar.findbut -text "Find" -command dofind |
588 pack .ctop.top.bar.findbut -side left |
629 pack .ctop.top.bar.findbut -side left |
589 set findstring {} |
630 set findstring {} |
590 set fstring .ctop.top.bar.findstring |
631 set fstring .ctop.top.bar.findstring |
591 lappend entries $fstring |
632 lappend entries $fstring |
592 entry $fstring -width 30 -font $textfont -textvariable findstring |
633 ttk::entry $fstring -width 30 -font $textfont -textvariable findstring |
593 pack $fstring -side left -expand 1 -fill x |
634 pack $fstring -side left -expand 1 -fill x |
594 set findtype Exact |
635 set findtype Exact |
595 set findtypemenu [tk_optionMenu .ctop.top.bar.findtype \ |
636 set findtypemenu [ttk::optionMenu .ctop.top.bar.findtype \ |
596 findtype Exact IgnCase Regexp] |
637 findtype Exact IgnCase Regexp] |
597 set findloc "All fields" |
638 set findloc "All fields" |
598 tk_optionMenu .ctop.top.bar.findloc findloc "All fields" Headline \ |
639 ttk::optionMenu .ctop.top.bar.findloc findloc "All fields" Headline \ |
599 Comments Author Committer Files Pickaxe |
640 Comments Author Committer Files Pickaxe |
600 pack .ctop.top.bar.findloc -side right |
641 pack .ctop.top.bar.findloc -side right |
601 pack .ctop.top.bar.findtype -side right |
642 pack .ctop.top.bar.findtype -side right |
602 # for making sure type==Exact whenever loc==Pickaxe |
643 # for making sure type==Exact whenever loc==Pickaxe |
603 trace add variable findloc write findlocchange |
644 trace add variable findloc write findlocchange |
604 |
645 |
605 panedwindow .ctop.cdet -orient horizontal |
646 panedwindow .ctop.cdet -orient horizontal |
606 .ctop add .ctop.cdet |
647 .ctop add .ctop.cdet |
607 frame .ctop.cdet.left |
648 ttk::frame .ctop.cdet.left |
608 set ctext .ctop.cdet.left.ctext |
649 set ctext .ctop.cdet.left.ctext |
609 text $ctext -fg $fgcolor -bg $bgcolor -state disabled -font $textfont \ |
650 text $ctext -fg $fgcolor -bg $bgcolor -state disabled -font $textfont \ |
610 -width $geometry(ctextw) -height $geometry(ctexth) \ |
651 -width $geometry(ctextw) -height $geometry(ctexth) \ |
611 -yscrollcommand ".ctop.cdet.left.sb set" \ |
652 -yscrollcommand ".ctop.cdet.left.sb set" \ |
612 -xscrollcommand ".ctop.cdet.left.hb set" -wrap none |
653 -xscrollcommand ".ctop.cdet.left.hb set" -wrap none |
613 scrollbar .ctop.cdet.left.sb -command "$ctext yview" |
654 ttk::scrollbar .ctop.cdet.left.sb -command "$ctext yview" |
614 scrollbar .ctop.cdet.left.hb -orient horizontal -command "$ctext xview" |
655 ttk::scrollbar .ctop.cdet.left.hb -orient horizontal -command "$ctext xview" |
615 pack .ctop.cdet.left.sb -side right -fill y |
656 pack .ctop.cdet.left.sb -side right -fill y |
616 pack .ctop.cdet.left.hb -side bottom -fill x |
657 pack .ctop.cdet.left.hb -side bottom -fill x |
617 pack $ctext -side left -fill both -expand 1 |
658 pack $ctext -side left -fill both -expand 1 |
618 .ctop.cdet add .ctop.cdet.left |
659 .ctop.cdet add .ctop.cdet.left |
619 |
660 |
641 $ctext tag conf mresult -font [concat $textfont bold] |
682 $ctext tag conf mresult -font [concat $textfont bold] |
642 $ctext tag conf msep -font [concat $textfont bold] |
683 $ctext tag conf msep -font [concat $textfont bold] |
643 $ctext tag conf found -back yellow |
684 $ctext tag conf found -back yellow |
644 } |
685 } |
645 |
686 |
646 frame .ctop.cdet.right |
687 ttk::frame .ctop.cdet.right |
647 set cflist .ctop.cdet.right.cfiles |
688 set cflist .ctop.cdet.right.cfiles |
648 listbox $cflist -fg $fgcolor -bg $bgcolor \ |
689 listbox $cflist -fg $fgcolor -bg $bgcolor \ |
649 -selectmode extended -width $geometry(cflistw) \ |
690 -selectmode extended -width $geometry(cflistw) \ |
650 -yscrollcommand ".ctop.cdet.right.sb set" |
691 -yscrollcommand ".ctop.cdet.right.sb set" |
651 scrollbar .ctop.cdet.right.sb -command "$cflist yview" |
692 ttk::scrollbar .ctop.cdet.right.sb -command "$cflist yview" |
652 pack .ctop.cdet.right.sb -side right -fill y |
693 pack .ctop.cdet.right.sb -side right -fill y |
653 pack $cflist -side left -fill both -expand 1 |
694 pack $cflist -side left -fill both -expand 1 |
654 .ctop.cdet add .ctop.cdet.right |
695 .ctop.cdet add .ctop.cdet.right |
655 bind .ctop.cdet <Configure> {resizecdetpanes %W %w} |
696 bind .ctop.cdet <Configure> {resizecdetpanes %W %w} |
656 |
697 |
3673 set newhead [lindex $commitinfo($newid) 0] |
3713 set newhead [lindex $commitinfo($newid) 0] |
3674 set top .patch |
3714 set top .patch |
3675 set patchtop $top |
3715 set patchtop $top |
3676 catch {destroy $top} |
3716 catch {destroy $top} |
3677 toplevel $top |
3717 toplevel $top |
3678 label $top.title -text "Generate patch" |
3718 ttk::label $top.title -text "Generate patch" |
3679 grid $top.title - -pady 10 |
3719 grid $top.title - -pady 10 |
3680 label $top.from -text "From:" |
3720 ttk::label $top.from -text "From:" |
3681 entry $top.fromsha1 -width 40 -relief flat |
3721 ttk::entry $top.fromsha1 -width 40 |
3682 $top.fromsha1 insert 0 $oldid |
3722 $top.fromsha1 insert 0 $oldid |
3683 $top.fromsha1 conf -state readonly |
3723 $top.fromsha1 conf -state readonly |
3684 grid $top.from $top.fromsha1 -sticky w |
3724 grid $top.from $top.fromsha1 -sticky w |
3685 entry $top.fromhead -width 60 -relief flat |
3725 ttk::entry $top.fromhead -width 60 |
3686 $top.fromhead insert 0 $oldhead |
3726 $top.fromhead insert 0 $oldhead |
3687 $top.fromhead conf -state readonly |
3727 $top.fromhead conf -state readonly |
3688 grid x $top.fromhead -sticky w |
3728 grid x $top.fromhead -sticky w |
3689 label $top.to -text "To:" |
3729 ttk::label $top.to -text "To:" |
3690 entry $top.tosha1 -width 40 -relief flat |
3730 ttk::entry $top.tosha1 -width 40 |
3691 $top.tosha1 insert 0 $newid |
3731 $top.tosha1 insert 0 $newid |
3692 $top.tosha1 conf -state readonly |
3732 $top.tosha1 conf -state readonly |
3693 grid $top.to $top.tosha1 -sticky w |
3733 grid $top.to $top.tosha1 -sticky w |
3694 entry $top.tohead -width 60 -relief flat |
3734 ttk::entry $top.tohead -width 60 |
3695 $top.tohead insert 0 $newhead |
3735 $top.tohead insert 0 $newhead |
3696 $top.tohead conf -state readonly |
3736 $top.tohead conf -state readonly |
3697 grid x $top.tohead -sticky w |
3737 grid x $top.tohead -sticky w |
3698 button $top.rev -text "Reverse" -command mkpatchrev -padx 5 |
3738 ttk::button $top.rev -text "Reverse" -command mkpatchrev |
3699 grid $top.rev x -pady 10 |
3739 grid $top.rev x -pady 10 |
3700 label $top.flab -text "Output file:" |
3740 ttk::label $top.flab -text "Output file:" |
3701 entry $top.fname -width 60 |
3741 ttk::entry $top.fname -width 60 |
3702 $top.fname insert 0 [file normalize "patch$patchnum.patch"] |
3742 $top.fname insert 0 [file normalize "patch$patchnum.patch"] |
3703 incr patchnum |
3743 incr patchnum |
3704 grid $top.flab $top.fname -sticky w |
3744 grid $top.flab $top.fname -sticky w |
3705 frame $top.buts |
3745 ttk::frame $top.buts |
3706 button $top.buts.gen -text "Generate" -command mkpatchgo |
3746 ttk::button $top.buts.gen -text "Generate" -command mkpatchgo |
3707 button $top.buts.can -text "Cancel" -command mkpatchcan |
3747 ttk::button $top.buts.can -text "Cancel" -command mkpatchcan |
3708 grid $top.buts.gen $top.buts.can |
3748 grid $top.buts.gen $top.buts.can |
3709 grid columnconfigure $top.buts 0 -weight 1 -uniform a |
3749 grid columnconfigure $top.buts 0 -weight 1 -uniform a |
3710 grid columnconfigure $top.buts 1 -weight 1 -uniform a |
3750 grid columnconfigure $top.buts 1 -weight 1 -uniform a |
3711 grid $top.buts - -pady 10 -sticky ew |
3751 grid $top.buts - -pady 10 -sticky ew |
3712 focus $top.fname |
3752 focus $top.fname |
3753 |
3793 |
3754 set top .maketag |
3794 set top .maketag |
3755 set mktagtop $top |
3795 set mktagtop $top |
3756 catch {destroy $top} |
3796 catch {destroy $top} |
3757 toplevel $top |
3797 toplevel $top |
3758 label $top.title -text "Create tag" |
3798 ttk::label $top.title -text "Create tag" |
3759 grid $top.title - -pady 10 |
3799 grid $top.title - -pady 10 |
3760 label $top.id -text "ID:" |
3800 ttk::label $top.id -text "ID:" |
3761 entry $top.sha1 -width 40 -relief flat |
3801 ttk::entry $top.sha1 -width 40 |
3762 $top.sha1 insert 0 $rowmenuid |
3802 $top.sha1 insert 0 $rowmenuid |
3763 $top.sha1 conf -state readonly |
3803 $top.sha1 conf -state readonly |
3764 grid $top.id $top.sha1 -sticky w |
3804 grid $top.id $top.sha1 -sticky w |
3765 entry $top.head -width 60 -relief flat |
3805 ttk::entry $top.head -width 60 |
3766 $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] |
3806 $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] |
3767 $top.head conf -state readonly |
3807 $top.head conf -state readonly |
3768 grid x $top.head -sticky w |
3808 grid x $top.head -sticky w |
3769 label $top.tlab -text "Tag name:" |
3809 ttk::label $top.tlab -text "Tag name:" |
3770 entry $top.tag -width 60 |
3810 ttk::entry $top.tag -width 60 |
3771 grid $top.tlab $top.tag -sticky w |
3811 grid $top.tlab $top.tag -sticky w |
3772 frame $top.buts |
3812 ttk::frame $top.buts |
3773 button $top.buts.gen -text "Create" -command mktaggo |
3813 ttk::button $top.buts.gen -text "Create" -command mktaggo |
3774 button $top.buts.can -text "Cancel" -command mktagcan |
3814 ttk::button $top.buts.can -text "Cancel" -command mktagcan |
3775 grid $top.buts.gen $top.buts.can |
3815 grid $top.buts.gen $top.buts.can |
3776 grid columnconfigure $top.buts 0 -weight 1 -uniform a |
3816 grid columnconfigure $top.buts 0 -weight 1 -uniform a |
3777 grid columnconfigure $top.buts 1 -weight 1 -uniform a |
3817 grid columnconfigure $top.buts 1 -weight 1 -uniform a |
3778 grid $top.buts - -pady 10 -sticky ew |
3818 grid $top.buts - -pady 10 -sticky ew |
3779 focus $top.tag |
3819 focus $top.tag |
3833 |
3873 |
3834 set top .writecommit |
3874 set top .writecommit |
3835 set wrcomtop $top |
3875 set wrcomtop $top |
3836 catch {destroy $top} |
3876 catch {destroy $top} |
3837 toplevel $top |
3877 toplevel $top |
3838 label $top.title -text "Write commit to file" |
3878 ttk::label $top.title -text "Write commit to file" |
3839 grid $top.title - -pady 10 |
3879 grid $top.title - -pady 10 |
3840 label $top.id -text "ID:" |
3880 ttk::label $top.id -text "ID:" |
3841 entry $top.sha1 -width 40 -relief flat |
3881 ttk::entry $top.sha1 -width 40 |
3842 $top.sha1 insert 0 $rowmenuid |
3882 $top.sha1 insert 0 $rowmenuid |
3843 $top.sha1 conf -state readonly |
3883 $top.sha1 conf -state readonly |
3844 grid $top.id $top.sha1 -sticky w |
3884 grid $top.id $top.sha1 -sticky w |
3845 entry $top.head -width 60 -relief flat |
3885 ttk::entry $top.head -width 60 |
3846 $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] |
3886 $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] |
3847 $top.head conf -state readonly |
3887 $top.head conf -state readonly |
3848 grid x $top.head -sticky w |
3888 grid x $top.head -sticky w |
3849 label $top.clab -text "Command:" |
3889 ttk::label $top.clab -text "Command:" |
3850 entry $top.cmd -width 60 -textvariable wrcomcmd |
3890 ttk::entry $top.cmd -width 60 -textvariable wrcomcmd |
3851 grid $top.clab $top.cmd -sticky w -pady 10 |
3891 grid $top.clab $top.cmd -sticky w -pady 10 |
3852 label $top.flab -text "Output file:" |
3892 ttk::label $top.flab -text "Output file:" |
3853 entry $top.fname -width 60 |
3893 ttk::entry $top.fname -width 60 |
3854 $top.fname insert 0 [file normalize "commit-[string range $rowmenuid 0 6]"] |
3894 $top.fname insert 0 [file normalize "commit-[string range $rowmenuid 0 6]"] |
3855 grid $top.flab $top.fname -sticky w |
3895 grid $top.flab $top.fname -sticky w |
3856 frame $top.buts |
3896 ttk::frame $top.buts |
3857 button $top.buts.gen -text "Write" -command wrcomgo |
3897 ttk::button $top.buts.gen -text "Write" -command wrcomgo |
3858 button $top.buts.can -text "Cancel" -command wrcomcan |
3898 ttk::button $top.buts.can -text "Cancel" -command wrcomcan |
3859 grid $top.buts.gen $top.buts.can |
3899 grid $top.buts.gen $top.buts.can |
3860 grid columnconfigure $top.buts 0 -weight 1 -uniform a |
3900 grid columnconfigure $top.buts 0 -weight 1 -uniform a |
3861 grid columnconfigure $top.buts 1 -weight 1 -uniform a |
3901 grid columnconfigure $top.buts 1 -weight 1 -uniform a |
3862 grid $top.buts - -pady 10 -sticky ew |
3902 grid $top.buts - -pady 10 -sticky ew |
3863 focus $top.fname |
3903 focus $top.fname |