Manpower

Check-in [7de2e42581]
Login

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

Overview
Comment:Further updates
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7de2e42581e9c8c2c29e04a3419a6658b8885b63
User & Date: kevin 2019-08-18 02:01:57
Context
2019-08-20
12:47
More progress check-in: 1e0323ae61 user: kevin tags: trunk
2019-08-18
02:01
Further updates check-in: 7de2e42581 user: kevin tags: trunk
2019-08-16
12:41
Begin update to 7.0 check-in: 62fbdc81e8 user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

20
21
22
23
24
25
26


27
28
29
30
31
32
33
34
35
36
37
38
39
    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
    
}

proc showManFromScript {man} {

    global manitem
    set manitem ""







>
>



|
|
|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    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 ""
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

#draw the images
proc makeImage {} {

    
    #create the images
    set imagedir [file join [file dirname [info script]] images]
	
     set imagefiles [glob -directory $imagedir *.tcl]
    foreach item $imagefiles {
	source $item
    }

    softwareupdate::setIcon icon-update

}







|
|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

#draw the images
proc makeImage {} {

    
    #create the images
    set imagedir [file join [file dirname [info script]] images]
    
    set imagefiles [glob -directory $imagedir *.tcl]
    foreach item $imagefiles {
	source $item
    }

    softwareupdate::setIcon icon-update

}
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
    global copy_text
    global font_name
    global datadir

    set manitem ""
    set searchterm ""
    set manterm ""
   

    #set up menu
    menu .mb

    #apple menu
    menu .mb.apple
    .mb.apple add command -label "About Manpower" -command tkAboutDialog
    .mb.apple add command -label "License" -command regproc::getReg
    .mb.apple add command -label "Check for Updates" -command "softwareupdate::checkVersion $appname::name $appname::version"
    .mb.apple add separator
    .mb add cascade -label "Manpower" -menu .mb.apple


    #man page menu
    menu .mb.man
    .mb.man add command -label "Find Man Page" -command manSearch -accelerator "Command-F"

    menu .mb.man.save  
    .mb.man.save add command -label "Text" -command saveMan 
    .mb.man.save add command -label "HTML" -command saveHTML
    .mb.man.save add command -label "PDF" -command savePDF

    .mb.man add cascade -label "Save As" -menu .mb.man.save







|















|







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
    global copy_text
    global font_name
    global datadir

    set manitem ""
    set searchterm ""
    set manterm ""
    

    #set up menu
    menu .mb

    #apple menu
    menu .mb.apple
    .mb.apple add command -label "About Manpower" -command tkAboutDialog
    .mb.apple add command -label "License" -command regproc::getReg
    .mb.apple add command -label "Check for Updates" -command "softwareupdate::checkVersion $appname::name $appname::version"
    .mb.apple add separator
    .mb add cascade -label "Manpower" -menu .mb.apple


    #man page menu
    menu .mb.man
    .mb.man add command -label "Find Man Page" -command {.t.left.tree selection set Search} -accelerator "Command-F"

    menu .mb.man.save  
    .mb.man.save add command -label "Text" -command saveMan 
    .mb.man.save add command -label "HTML" -command saveHTML
    .mb.man.save add command -label "PDF" -command savePDF

    .mb.man add cascade -label "Save As" -menu .mb.man.save
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
    
    .mb add cascade -label "Help" -menu .mb.help
    
    . configure -menu .mb

    wm title . "Manpower"
    
    
    ttk::style configure Toolbutton -font {Iconic 22} 

    #create frame for toolbar
    pack [ttk::frame .tool] -side top -fill both -expand no

    #create toolbar
    pack [ttk::frame .tool.toolbar] -side top -fill both -expand no








<
<







168
169
170
171
172
173
174


175
176
177
178
179
180
181
    
    .mb add cascade -label "Help" -menu .mb.help
    
    . configure -menu .mb

    wm title . "Manpower"
    



    #create frame for toolbar
    pack [ttk::frame .tool] -side top -fill both -expand no

    #create toolbar
    pack [ttk::frame .tool.toolbar] -side top -fill both -expand no

233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
    pack .bottomsep1 -side bottom -fill both -expand no -side bottom

    bind .tool.toolbar.frame.browser <ButtonRelease-1>  checkManSelection


    #additional bindings
    bind .tool.toolbar.frame.browser <Return> {singleManPage}
    bind .tool.toolbar.frame.entry <Return> {manSearch; writeState}
    
    ttk::frame .bottom
    pack .bottom -side bottom -fill both -expand no

    ttk::separator .bottomsep -orient vertical 
    pack .bottomsep -side bottom -fill both -expand no -side bottom








|







233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
    pack .bottomsep1 -side bottom -fill both -expand no -side bottom

    bind .tool.toolbar.frame.browser <ButtonRelease-1>  checkManSelection


    #additional bindings
    bind .tool.toolbar.frame.browser <Return> {singleManPage}
    bind .tool.toolbar.frame.entry <Return> {manSearch}
    
    ttk::frame .bottom
    pack .bottom -side bottom -fill both -expand no

    ttk::separator .bottomsep -orient vertical 
    pack .bottomsep -side bottom -fill both -expand no -side bottom

262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
	file-system xbm_folder_sans_16
	other xbm_star_16
	macro xbm_script_16
	admin xbm_home_16
	kernel xbm_refresh_16
    } 
    
    
    
    #lay out the tree widget
    ttk::treeview .middle.left.tree  -yscrollcommand [list .middle.left.scroll set] -show tree
    pack .middle.left.tree -fill both -side left -expand yes
	
	
	 #tree display for categories
    ttk::treeview .t.left.tree -yscrollcommand [list .t.left.scroll set] -show tree
    
    pack .t.left.tree -fill both -side left -expand yes

    ttk::scrollbar .t.left.scroll -command [list .t.left.tree yview]
    pack .t.left.scroll -side right -fill y -expand no

    set entry1 [.middle.left.tree insert {} end -id All -value All -text "All" -image xbm_website_16]
    set entry2 [.middle.left.tree insert {} end -id Search -value Search -text "Search" -image xbm_search_16]
    set entry3 [ .middle.left.tree insert {} end -id Category -value Category -text "Category" -image xbm_category_16 ]

    

    set categoryman [list  users "1. User Commands" system "2. System Commands" library "3. Library Commands" special "4. Special" file-system "5. File Formats" other "6. Other" macro "7. Macros/Conventions" admin "8. Administrative" kernel "9. Kernel Commands" ]

    foreach {key value} $categoryman {
	.middle.left.tree insert $entry3 end -id $key -value $key  -text $value -image $treelabel($key)
    }


    scrollbar .middle.left.scroll -command [list .middle.left.tree yview]
    pack .middle.left.scroll -side right -fill y -expand no

    bind .middle.left.tree.c <KeyPress-Up> [list +event generate .middle.left.tree <<TreeSelect>>]
    bind .middle.left.tree.c <KeyPress-Down> [list +event generate .middle.left.tree <<TreeSelect>>]

    bind .middle.left.tree <<TreeviewSelect>> {selectCat}

    bind .middle.left.tree.c <MouseWheel> {%W yview scroll [expr {- (%D)}] units}

    .middle.left.tree opentree Category

    ttk::panedwindow .middle.right
    pack .middle.right -side right -fill both -expand yes

    ttk::frame .middle.right.upper
    pack .middle.right.upper -side right -fill both -expand yes

    ttk::frame .middle.right.upper.frame  
    pack .middle.right.upper.frame -side top -fill both -expand yes

    ttk::frame .middle.right.upper.frame.row
    pack .middle.right.upper.frame.row -side right -fill y  -expand no

    ttk::label .middle.right.upper.frame.row.corner -style TablelistHeader.TLabel 
    pack .middle.right.upper.frame.row.corner -side top -fill x -expand no

    scrollbar .middle.right.upper.frame.row.vsb -orient vertical -command [list .middle.right.upper.frame.listbox yview]
    pack .middle.right.upper.frame.row.vsb -side bottom -fill y -expand 1

    #main data display
    tablelist::tablelist .middle.right.upper.frame.listbox -columns {"Man Page" "Description"} -show headings -yscrollcommand [list .middle.right.upper.frame.row.vsb set] -displaycolumns #all
	
    pack .middle.right.upper.frame.listbox -side left -fill both -expand yes
    bind .middle.right.upper.frame.listbox <<TreeviewSelect>> {getManPage}

    foreach "item" $manlist {
	.middle.right.upper.frame.listbox insert end $item
    }


    #menu for right-clicking
    menu .popup 
    .popup add command -label "Find Man Page" -command manSearch 
    .popup add command -label "Print Man Page" -command  printFile

    bind [.middle.right.upper.frame.listbox bodypath] <Button-2> {tk_popup .popup %X %Y}

    #the rest of the display
    ttk::frame .middle.right.lower 
    pack .middle.right.lower -side bottom -fill both -expand true


    ttk::frame .middle.right.lower.right -height 100
    pack .middle.right.lower.right -side right -fill both -expand yes

    #output display--text
    text .middle.right.lower.right.log  -borderwidth .1 -relief sunken   -wrap word -highlightcolor SlateGray3 -yscrollcommand {.middle.right.lower.right.vsb set}  -bg white -state disabled

    tclservices::registerservicewidget .middle.right.lower.right.log
    bind  .middle.right.lower.right.log <<Selection>> checkTextSelection 


    scrollbar .middle.right.lower.right.vsb -command ".middle.right.lower.right.log yview" 

    pack .middle.right.lower.right.log -side left -fill both -expand yes
    pack .middle.right.lower.right.vsb -side right -fill y

    .middle.right.lower.right.log tag configure manref -foreground blue -underline on

    .middle.right.lower.right.log tag bind manref <Enter> {.middle.right.lower.right.log configure -cursor pointinghand}







<
<



|
<
|











<








|


<
<
<
|

<


















|



|
|










|













|

<
<

<
|







262
263
264
265
266
267
268


269
270
271
272

273
274
275
276
277
278
279
280
281
282
283
284

285
286
287
288
289
290
291
292
293
294
295



296
297

298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
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
352
353
354
355
356
	file-system xbm_folder_sans_16
	other xbm_star_16
	macro xbm_script_16
	admin xbm_home_16
	kernel xbm_refresh_16
    } 
    


    #lay out the tree widget
    ttk::treeview .middle.left.tree  -yscrollcommand [list .middle.left.scroll set] -show tree
    pack .middle.left.tree -fill both -side left -expand yes
    

    #tree display for categories
    ttk::treeview .t.left.tree -yscrollcommand [list .t.left.scroll set] -show tree
    
    pack .t.left.tree -fill both -side left -expand yes

    ttk::scrollbar .t.left.scroll -command [list .t.left.tree yview]
    pack .t.left.scroll -side right -fill y -expand no

    set entry1 [.middle.left.tree insert {} end -id All -value All -text "All" -image xbm_website_16]
    set entry2 [.middle.left.tree insert {} end -id Search -value Search -text "Search" -image xbm_search_16]
    set entry3 [ .middle.left.tree insert {} end -id Category -value Category -text "Category" -image xbm_category_16 ]



    set categoryman [list  users "1. User Commands" system "2. System Commands" library "3. Library Commands" special "4. Special" file-system "5. File Formats" other "6. Other" macro "7. Macros/Conventions" admin "8. Administrative" kernel "9. Kernel Commands" ]

    foreach {key value} $categoryman {
	.middle.left.tree insert $entry3 end -id $key -value $key  -text $value -image $treelabel($key)
    }


    ttk::scrollbar .middle.left.scroll -command [list .middle.left.tree yview]
    pack .middle.left.scroll -side right -fill y -expand no




    bind .middle.left.tree <<TreeviewSelect>> {setCat}



    .middle.left.tree opentree Category

    ttk::panedwindow .middle.right
    pack .middle.right -side right -fill both -expand yes

    ttk::frame .middle.right.upper
    pack .middle.right.upper -side right -fill both -expand yes

    ttk::frame .middle.right.upper.frame  
    pack .middle.right.upper.frame -side top -fill both -expand yes

    ttk::frame .middle.right.upper.frame.row
    pack .middle.right.upper.frame.row -side right -fill y  -expand no

    ttk::label .middle.right.upper.frame.row.corner -style TablelistHeader.TLabel 
    pack .middle.right.upper.frame.row.corner -side top -fill x -expand no

    ttk::scrollbar .middle.right.upper.frame.row.vsb -orient vertical -command [list .middle.right.upper.frame.listbox yview]
    pack .middle.right.upper.frame.row.vsb -side bottom -fill y -expand 1

    #main data display
    ttk::treeview .middle.right.upper.frame.listbox -columns {"Man Page" "Description"} -show headings -yscrollcommand [list .middle.right.upper.frame.row.vsb set] -displaycolumns #all
    
    pack .middle.right.upper.frame.listbox -side left -fill both -expand yes
    bind .middle.right.upper.frame.listbox <<TreeviewSelect>> {getManPage}

    foreach "item" $manlist {
	.middle.right.upper.frame.listbox insert end $item
    }


    #menu for right-clicking
    menu .popup 
    .popup add command -label "Find Man Page" -command  {.t.left.tree selection set Search}  
    .popup add command -label "Print Man Page" -command  printFile

    bind [.middle.right.upper.frame.listbox bodypath] <Button-2> {tk_popup .popup %X %Y}

    #the rest of the display
    ttk::frame .middle.right.lower 
    pack .middle.right.lower -side bottom -fill both -expand true


    ttk::frame .middle.right.lower.right -height 100
    pack .middle.right.lower.right -side right -fill both -expand yes

    #output display--text
    text .middle.right.lower.right.log  -borderwidth .1 -relief sunken -wrap word -highlightcolor SlateGray3 -yscrollcommand {.middle.right.lower.right.vsb set}  -state disabled





    ttk::scrollbar .middle.right.lower.right.vsb -command ".middle.right.lower.right.log yview" 

    pack .middle.right.lower.right.log -side left -fill both -expand yes
    pack .middle.right.lower.right.vsb -side right -fill y

    .middle.right.lower.right.log tag configure manref -foreground blue -underline on

    .middle.right.lower.right.log tag bind manref <Enter> {.middle.right.lower.right.log configure -cursor pointinghand}
375
376
377
378
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
408
409
410
411
412
413
414
415
416
417
418
419
420
421


422
423
424
425
426
427
428
    .middle add .middle.right

    toplevel .bookmarks
    tk::unsupported::MacWindowStyle style .bookmarks utility
    wm title .bookmarks "Bookmarks"
    
    #draw drawer window offscreen
    ttk::label .bookmarks.header -style TablelistHeader.TLabel -text "Bookmarks" -font {-size 12}
    pack .bookmarks.header -side top -fill both -expand yes

    ttk::frame .bookmarks.top
    pack .bookmarks.top -fill both -expand yes -side top

    ttk::frame .bookmarks.bottom -padding 2
    pack .bookmarks.bottom -fill both -expand no -side bottom


    listbox .bookmarks.top.list -yscrollcommand [list .bookmarks.top.scrollbar set] -font {-size 12} -relief flat -bd 0 -selectbackground RoyalBlue1 -selectforeground white -height 30 -activestyle none
    pack .bookmarks.top.list -side left -fill both -expand yes


    scrollbar .bookmarks.top.scrollbar -command [list .bookmarks.top.list yview]
    pack .bookmarks.top.scrollbar -side right -fill y -expand no

    ttk::button .bookmarks.bottom.add -style Toolbutton -text \u2795 -takefocus 0 -command addBookMark
    ttk::button .bookmarks.bottom.delete -style Toolbutton -text \u2796 -takefocus 0 -command deleteBookMark

    DynamicHelp::register .bookmarks.bottom.add balloon "Add bookmark" 
    DynamicHelp::register  .bookmarks.bottom.delete balloon "Delete bookmark" 
    

    bind .bookmarks.top.list <<ListboxSelect>> getManPagefromBookmark

    pack .bookmarks.bottom.add .bookmarks.bottom.delete -side left -fill both -expand no

    wm withdraw .bookmarks
    wm protocol .bookmarks WM_DELETE_WINDOW {wm withdraw .bookmarks}

    #other bindings
    bind all <Command-F> manSearch
    bind all <Command-f> manSearch
    bind all <Command-P> printFile
    bind all <Command-p>  printFile

    bind . <Command-W> {wm state .  withdrawn}
    bind . <Command-w> {wm state .  withdrawn}
    wm protocol . WM_DELETE_WINDOW {wm withdraw .} 



}

## Code to do the sorting of the tree contents when clicked on
proc SortBy {tree col direction} {

    set tree .middle.right.upper.frame.listbox







|








<
|



|
|

|
|

|
|
<









|
|





|
>
>







364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
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
408
409
410
411
412
413
414
415
416
417
    .middle add .middle.right

    toplevel .bookmarks
    tk::unsupported::MacWindowStyle style .bookmarks utility
    wm title .bookmarks "Bookmarks"
    
    #draw drawer window offscreen
    ttk::label .bookmarks.header -text "Bookmarks" 
    pack .bookmarks.header -side top -fill both -expand yes

    ttk::frame .bookmarks.top
    pack .bookmarks.top -fill both -expand yes -side top

    ttk::frame .bookmarks.bottom -padding 2
    pack .bookmarks.bottom -fill both -expand no -side bottom


    listbox .bookmarks.top.list -yscrollcommand [list .bookmarks.top.ttk::scrollbar set] -font {-size 12} -relief flat -bd 0 -height 30 -activestyle none
    pack .bookmarks.top.list -side left -fill both -expand yes


    ttk::scrollbar .bookmarks.top.ttk::scrollbar -command [list .bookmarks.top.list yview]
    pack .bookmarks.top.ttk::scrollbar -side right -fill y -expand no

    ttk::button .bookmarks.bottom.add -style Toolbutton -text "+"	-takefocus 0 -command addBookMark
    ttk::button .bookmarks.bottom.delete -style Toolbutton -text "-" -takefocus 0 -command deleteBookMark

    tooltip::tooltip .bookmarks.bottom.add  "Add bookmark" 
    tooltip::tooltip  .bookmarks.bottom.delete  "Delete bookmark" 


    bind .bookmarks.top.list <<ListboxSelect>> getManPagefromBookmark

    pack .bookmarks.bottom.add .bookmarks.bottom.delete -side left -fill both -expand no

    wm withdraw .bookmarks
    wm protocol .bookmarks WM_DELETE_WINDOW {wm withdraw .bookmarks}

    #other bindings
    bind all <Command-F> {.t.left.tree selection set Search} 
    bind all <Command-f>  {.t.left.tree selection set Search} 
    bind all <Command-P> printFile
    bind all <Command-p>  printFile

    bind . <Command-W> {wm state .  withdrawn}
    bind . <Command-w> {wm state .  withdrawn}
    wm protocol . WM_DELETE_WINDOW {wm withdraw .}

    .t.left.tree selection set All

}

## Code to do the sorting of the tree contents when clicked on
proc SortBy {tree col direction} {

    set tree .middle.right.upper.frame.listbox
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492

#get list of all man pages
proc getAllMan {} {

    global manlist
    global cachedir

    puts "home is  $::env(HOME)"

    set result [exec man -k \[a-zA-Z0-9\] > $cachedir/manpages 2>$cachedir/error]

    set fd [open $cachedir/manpages r]
    set basiclist [split [read $fd] \n]
    set displaylist [lrange $basiclist 0  end-1]

    #replace dash so we can split list more efficiently







<
<







466
467
468
469
470
471
472


473
474
475
476
477
478
479

#get list of all man pages
proc getAllMan {} {

    global manlist
    global cachedir



    set result [exec man -k \[a-zA-Z0-9\] > $cachedir/manpages 2>$cachedir/error]

    set fd [open $cachedir/manpages r]
    set basiclist [split [read $fd] \n]
    set displaylist [lrange $basiclist 0  end-1]

    #replace dash so we can split list more efficiently
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
proc getManPage {} {

    global manitem
    global status
    global rmanpath
    global cachedir

    set item [lindex [.middle.right.upper.frame.listbox get [.middle.right.upper.frame.listbox curselection]] 0]

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

    







|







528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
proc getManPage {} {

    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]

    
573
574
575
576
577
578
579
580
581
582
583
584
585
586



587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
    .middle.right.lower.right.log configure -state disabled

    set status "Open man page: $manitem"
}


#get category for browsing--bound to single-click
proc setCat {node} {

    global category 
    global manlist

    .middle.left.tree selection set $node
    



    if { $node == "Category"}  {
	return
    } 
    if {$node == "Search"} {
	manSearch
	return
    }
    if {$node == "All" } {
	refreshManList
	return
    }  else {
	manCat
    }
    
}

#get selected node in tree; we use this because setCat takes a node name as arg, can't simply be called
proc selectCat {} {
    
    global manlist
    global mynode

    set mynode [.middle.left.tree selection get]
    setCat $mynode
}

#search list of man pages for keyword
proc manSearch {} {
    global manlist 
    global searchterm 
    global status








|




|

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


<
<
<
<
<
<
<
<
<







560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578

579
580
581

582
583
584
585
586
587
588
589
590









591
592
593
594
595
596
597
    .middle.right.lower.right.log configure -state disabled

    set status "Open man page: $manitem"
}


#get category for browsing--bound to single-click
proc setCat {} {

    global category 
    global manlist

    set node [lindex [.middle.left.tree  item [.middle.left.tree selection] -values] 0]
    
    switch - $node  {
	"" {
	    return
	} "Category" {
	    return

	} "Search" {
	    manSearch
	    return

	} "All" {
	    refreshManList
	    return
	} default {
	    manCat
	}
    }
}











#search list of man pages for keyword
proc manSearch {} {
    global manlist 
    global searchterm 
    global status

806
807
808
809
810
811
812
813
814
815
816
817
818
819
820

    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
    #  convertMan

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


#print data to default printer
proc printFile {} {







<







785
786
787
788
789
790
791

792
793
794
795
796
797
798

    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 {} {
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
    set datadir [xplat::appconfig Manpower]
    set cachedir  [file join $::env(HOME) "Library" "Application Support" "Manpower" "Cache"]

    if {![file exists $cachedir]} {
	file mkdir $cachedir
    }

	if {![file exists $datadir]} {
	    file mkdir $datadir
	} 

    set resourcedir [file join [softwareupdate::findCurrentInstallation] "Contents" "Resources"]

    getAllMan
    makeImage
    softwareupdate::setVersion $appname::name $appname::version
    machelp::setAppName $appname::name $appname::version







|
|
|







916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
    set datadir [xplat::appconfig Manpower]
    set cachedir  [file join $::env(HOME) "Library" "Application Support" "Manpower" "Cache"]

    if {![file exists $cachedir]} {
	file mkdir $cachedir
    }

    if {![file exists $datadir]} {
	file mkdir $datadir
    } 

    set resourcedir [file join [softwareupdate::findCurrentInstallation] "Contents" "Resources"]

    getAllMan
    makeImage
    softwareupdate::setVersion $appname::name $appname::version
    machelp::setAppName $appname::name $appname::version
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
    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"} {







|







982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
    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"} {