Manpower

Check-in [9207cda0d8]
Login

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

Overview
Comment:Fix disappearing text in clickLink proc
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9207cda0d880106b84cd26d8d451cb821162dedd
User & Date: kevin 2019-08-24 15:01:29
Context
2019-08-24
15:41
More fixes check-in: c1e83138e0 user: kevin tags: trunk
15:01
Fix disappearing text in clickLink proc check-in: 9207cda0d8 user: kevin tags: trunk
2019-08-21
06:18
UI pretty much working now, need to polish and update user docs check-in: bb18dda27a user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to libs/manpower/manpower-main.tcl.

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
    R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAImhI+
    py+1LIsJHiBAh+BgmiEAJQITgW6DgUQIAECH4JN8IPqYuNxUAOw==}
image create photo downArrow -data {
    R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAInhI+
    py+1I4ocQ/IgDEYIPgYJICUCE4F+YIBolEoKPEJKZmVJK6ZACADs=}
image create photo noArrow -height 14 -width 14


#aem::installeventhandler CoKv sMan showManFromScript
#aem::installeventhandler GURL GURL showManURL
#handle "get URL" event for man page
proc showManURL {man} {

    global manitem
    set manitem [lindex [split $man "//"] 2]
    singleManPage
    
}


proc showManFromScript {man} {

    global manitem
    set manitem ""
    set manitem $man
    singleManPage
    set text [.middle.right.lower.right.log get 1.0 end]
    return $text







<
<
<









>
|







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
    R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAImhI+
    py+1LIsJHiBAh+BgmiEAJQITgW6DgUQIAECH4JN8IPqYuNxUAOw==}
image create photo downArrow -data {
    R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAInhI+
    py+1I4ocQ/IgDEYIPgYJICUCE4F+YIBolEoKPEJKZmVJK6ZACADs=}
image create photo noArrow -height 14 -width 14




#handle "get URL" event for man page
proc showManURL {man} {

    global manitem
    set manitem [lindex [split $man "//"] 2]
    singleManPage
    
}

#main AppleScript command
proc showPage {man} {

    global manitem
    set manitem ""
    set manitem $man
    singleManPage
    set text [.middle.right.lower.right.log get 1.0 end]
    return $text
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
    global manitem
    global manterm
    global status
    global rmanpath
    global cachedir

    .middle.left.tree selection remove [.middle.left.tree selection]
    set manitem [.tool.toolbar.frame.browser get]

    clearData
    clearText
    .middle.right.lower.right.log configure -state normal

    after 50

    set rawman [exec man $manitem > $cachedir/$manitem-man.txt  2>$cachedir/manerror]
    set getman [exec $rmanpath -f Tk $cachedir/$manitem-man.txt > $cachedir/$manitem.txt 2>$cachedir/rmanerror]
    
    after 50
    set readman [open $cachedir/$manitem.txt ]
    set mantext [read $readman]
    close $readman








<





<
<
|







486
487
488
489
490
491
492

493
494
495
496
497


498
499
500
501
502
503
504
505
    global manitem
    global manterm
    global status
    global rmanpath
    global cachedir

    .middle.left.tree selection remove [.middle.left.tree selection]


    clearData
    clearText
    .middle.right.lower.right.log configure -state normal



     set rawman [exec man $manitem > $cachedir/$manitem-man.txt  2>$cachedir/manerror]
    set getman [exec $rmanpath -f Tk $cachedir/$manitem-man.txt > $cachedir/$manitem.txt 2>$cachedir/rmanerror]
    
    after 50
    set readman [open $cachedir/$manitem.txt ]
    set mantext [read $readman]
    close $readman

521
522
523
524
525
526
527




528
529
530
531
532
533
534

    global manitem
    global status
    global rmanpath
    global cachedir

    set item [lindex [.middle.right.upper.frame.listbox item [.middle.right.upper.frame.listbox selection] -values] 0]





    #parse man page name from list
    set mansplit [split $item \(]
    set manitem [lindex $mansplit 0]
    set mansection [lindex [split [lindex $mansplit 1] \)] 0]

    







>
>
>
>







516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533

    global manitem
    global status
    global rmanpath
    global cachedir

    set item [lindex [.middle.right.upper.frame.listbox item [.middle.right.upper.frame.listbox selection] -values] 0]

    if {$item == ""} {
	return
    }

    #parse man page name from list
    set mansplit [split $item \(]
    set manitem [lindex $mansplit 0]
    set mansection [lindex [split [lindex $mansplit 1] \)] 0]

    
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775

776
777
778
779
780
781
782
783
784

785
786
787
788
789
790
791
    set getman [exec $rmanpath -f HTML $cachedir/$manitem-man.txt > $cachedir/$manitem.html  2>$cachedir/htmlerror]
    
    after 50
    file copy -force $cachedir/$manitem.html $HTMLfile
}




#bindings for clicking on link
proc clickLink { xpos ypos } {
    global manitem
    global rmanpath

    .middle.right.lower.right.log configure -cursor pointinghand


    set i [ .middle.right.lower.right.log  index @$xpos,$ypos]
    set range [ .middle.right.lower.right.log tag prevrange manref $i]
    set final [eval  .middle.right.lower.right.log get $range]
    set new [lindex [split $final \(] 0]
    set manitem $new
    singleManPage

    .middle.right.lower.right.log configure -cursor arrow

}


#print data to default printer
proc printFile {} {
    
    global manitem







<
<






>









>







760
761
762
763
764
765
766


767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
    set getman [exec $rmanpath -f HTML $cachedir/$manitem-man.txt > $cachedir/$manitem.html  2>$cachedir/htmlerror]
    
    after 50
    file copy -force $cachedir/$manitem.html $HTMLfile
}




#bindings for clicking on link
proc clickLink { xpos ypos } {
    global manitem
    global rmanpath

    .middle.right.lower.right.log configure -cursor pointinghand
    .tool.toolbar.frame.browser delete 0 end

    set i [ .middle.right.lower.right.log  index @$xpos,$ypos]
    set range [ .middle.right.lower.right.log tag prevrange manref $i]
    set final [eval  .middle.right.lower.right.log get $range]
    set new [lindex [split $final \(] 0]
    set manitem $new
    singleManPage

    .middle.right.lower.right.log configure -cursor arrow

}


#print data to default printer
proc printFile {} {
    
    global manitem
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872

proc getManPagefromBookmark {} {

    global bookmarklist 
    global manitem

    set manitem [ .bookmarks.top.list get [.bookmarks.top.list curselection]]

    puts $manitem
    
    singleManPage

}

#read bookmarks
proc readBookMarks {} {







<
<







856
857
858
859
860
861
862


863
864
865
866
867
868
869

proc getManPagefromBookmark {} {

    global bookmarklist 
    global manitem

    set manitem [ .bookmarks.top.list get [.bookmarks.top.list curselection]]


    
    singleManPage

}

#read bookmarks
proc readBookMarks {} {
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914

#"about application" command
proc tkAboutDialog {} {
    aboutWindow
}


# #display user help
# proc tk::mac::ShowHelp {} {
#     machelp::userhelp
# }

#initialize the app
proc startUp {} {
    global appname
    global appversion
    global datadir
    global rmanpath
    global cachedir







<
<
<
<
<







893
894
895
896
897
898
899





900
901
902
903
904
905
906

#"about application" command
proc tkAboutDialog {} {
    aboutWindow
}







#initialize the app
proc startUp {} {
    global appname
    global appversion
    global datadir
    global rmanpath
    global cachedir
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014

#handle program shutdown via command-q
proc  ::tk::mac::Quit {} {
    exit
}



#command for AppleScript support
proc showpage {manpage} {

    global manitem
    
    set manitem $manpage
    singleManPage

}



#command for services menu
proc ::tk::mac::PerformService {} {

    global manitem
    set manitem [clipboard get]
    singleManPage
}


#custom "about" dialog
proc aboutWindow {} {

    tk_messageBox -parent . -icon info -title "About Manpower" -message "Manpower: Man Page Viewer" -detail "Version 7.0\n(c)2019 WordTech Communications LLC"

}

#raise window if closed--dock click
proc ::tk::mac::ReopenApplication {} {

    if { [wm state .] == "withdrawn"} {
	wm state . normal
	raise .
    } else {
	wm deiconify .
	raise .
    }

}


startUp







<
<
<
<
<
<
<
<
<
<
<
<
<












|
















<

956
957
958
959
960
961
962













963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991

992

#handle program shutdown via command-q
proc  ::tk::mac::Quit {} {
    exit
}















#command for services menu
proc ::tk::mac::PerformService {} {

    global manitem
    set manitem [clipboard get]
    singleManPage
}


#custom "about" dialog
proc aboutWindow {} {

    tk_messageBox -parent . -icon info -title "About Manpower" -message "Manpower: Man Page Viewer" -detail "Version 7.0\n(c) 2019 WordTech Communications LLC"

}

#raise window if closed--dock click
proc ::tk::mac::ReopenApplication {} {

    if { [wm state .] == "withdrawn"} {
	wm state . normal
	raise .
    } else {
	wm deiconify .
	raise .
    }

}


startUp