home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_tkcvs.idb / usr / freeware / lib / tkcvs / filebrowse.tcl.z / filebrowse.tcl
Encoding:
Text File  |  1999-04-16  |  3.1 KB  |  129 lines

  1. #
  2. # Tcl library for TkCVS
  3. #
  4.  
  5. #
  6. # $Id: filebrowse.tcl,v 1.4 1995/08/19 11:47:30 del Exp $
  7. #
  8. # Sets up a dialog to browse the contents of a module.
  9. #
  10.  
  11. proc browse_files {mcode} {
  12.   global filenames
  13.   global mtitle
  14.  
  15.   static {browser 0}
  16.  
  17.   if {! [info exists mtitle($mcode)]} {
  18.     cvserror "Sorry, this function only works on modules, not directories!"
  19.     return
  20.   }
  21.  
  22.   # Find the list of file names.
  23.   find_filenames $mcode
  24.  
  25.   if {! [info exists filenames($mcode)]} {
  26.     cvserror "There are no files in this module!"
  27.     return
  28.   }
  29.  
  30.   #
  31.   # Create the browser window.
  32.   #
  33.  
  34.   incr browser
  35.   set filebrowse ".filebrowse$browser"
  36.   toplevel $filebrowse
  37.   frame $filebrowse.up   -relief groove -border 2
  38.   frame $filebrowse.up.left
  39.   frame $filebrowse.up.right
  40.   frame $filebrowse.down -relief groove -border 2
  41.  
  42.   pack $filebrowse.up -side top -fill x
  43.   pack $filebrowse.up.left -side left -fill both
  44.   pack $filebrowse.up.right -side left -fill both -expand 1
  45.   pack $filebrowse.down -side bottom -fill x
  46.  
  47.   label $filebrowse.lver1 -anchor w -text "Version / Tag "
  48.   # label $filebrowse.lver2 -anchor w -text "Version / Tag 2 (diff)"
  49.  
  50.   entry $filebrowse.tver1 -relief sunken
  51.   # bind_motifentry $filebrowse.tver1
  52.   # entry $filebrowse.tver2 -relief sunken
  53.   # bind_motifentry $filebrowse.tver2
  54.  
  55.   pack $filebrowse.lver1 -in $filebrowse.up.left \
  56.     -side top -fill x -pady 3
  57.   pack $filebrowse.tver1 -in $filebrowse.up.right \
  58.     -side top -fill x -pady 3
  59.  
  60.   #
  61.   # Create buttons
  62.   #
  63.  
  64.   button $filebrowse.help -text "Help" \
  65.     -command file_browser
  66.   button $filebrowse.view -text "View" \
  67.     -command "fileview $filebrowse $mcode"
  68.   button $filebrowse.log -text "Log Browse" \
  69.     -command "filelog $filebrowse.list $mcode"
  70.   # button $filebrowse.diff -text "Diff" \
  71.   #   -command "filediff $filebrowse $mcode"
  72.   button $filebrowse.quit -text "Quit" \
  73.     -command "destroy $filebrowse"
  74.   pack $filebrowse.help $filebrowse.view \
  75.     $filebrowse.log $filebrowse.quit \
  76.     -in $filebrowse.down -side left \
  77.     -ipadx 2 -ipady 2 -padx 4 -pady 4 -fill both -expand 1
  78.  
  79.   #
  80.   # Create a scrollbar and a list box.
  81.   #
  82.  
  83.   scrollbar $filebrowse.scroll -relief sunken \
  84.     -command "$filebrowse.list yview"
  85.   listbox $filebrowse.list \
  86.     -yscroll "$filebrowse.scroll set" -relief sunken \
  87.     -width 40 -height 15 -setgrid yes
  88.   pack $filebrowse.scroll -side right -fill y -padx 2 -pady 2
  89.   pack $filebrowse.list -side left -fill both -expand 1
  90.  
  91.   #
  92.   # Window manager stuff.
  93.   #
  94.  
  95.   wm title $filebrowse "Files in $mcode"
  96.   wm minsize $filebrowse 1 1
  97.  
  98.   #
  99.   # Fill the list.
  100.   #
  101.   foreach file $filenames($mcode) {
  102.     $filebrowse.list insert end $file
  103.   }
  104. }
  105.  
  106. proc filelog {listname mcode} {
  107.  
  108.   foreach item [$listname curselection] {
  109.     cvs_filelog $mcode [$listname get $item]
  110.   }
  111. }
  112.  
  113. # proc filediff {toplevelname mcode} {
  114. #   set listname $toplevelname.list
  115. #   foreach item [$listname curselection] {
  116. #     cvs_filediff $mcode [$listname get $item] \
  117. #      [$toplevelname.tver1 get] [$toplevelname.tver2 get] 
  118. #   }
  119. # }
  120.  
  121. proc fileview {toplevelname mcode} {
  122.  
  123.   set listname $toplevelname.list
  124.   foreach item [$listname curselection] {
  125.     cvs_fileview $mcode [$listname get $item] [$toplevelname.tver1 get]
  126.   }
  127. }
  128.