home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / il60docedi.tcl < prev    next >
Text File  |  1996-10-29  |  4KB  |  151 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1996
  4. #
  5. #      File:           @(#)il60docedi.tcl    /main/hindenburg/2
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)il60docedi.tcl    /main/hindenburg/2   29 Oct 1996 Copyright 1996 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14. require "doceditor.tcl"
  15.  
  16. Class Il60DocEditor : {DocEditor} {
  17.     constructor
  18.     method destructor
  19.     method configDirectory
  20.     method edit
  21.     method show
  22.     method print
  23.     method getPrinterName
  24.     method findPrinterName
  25. }
  26.  
  27. constructor Il60DocEditor {class this name_1} {
  28.     set this [DocEditor::constructor $class $this $name_1]
  29.     # Start constructor user section
  30.     $this printsIncluded y
  31.     $this name Il
  32.     $this version 60
  33.     $this localSectionTypes "[$this localSectionTypes] Str Cat Doc Toc"
  34.     $this dirExtension boo
  35.     # End constructor user section
  36.     return $this
  37. }
  38.  
  39. method Il60DocEditor::destructor {this} {
  40.     # Start destructor user section
  41.     # End destructor user section
  42.     $this DocEditor::destructor
  43. }
  44.  
  45. method Il60DocEditor::configDirectory {this directory} {
  46.     set error [DocEditor::configDirectory $this $directory]
  47.     if {$error != ""} {
  48.         return $error
  49.     }
  50.  
  51.     # check if clipboard dir exists, if not create one
  52.     set desktop [[[ClientContext::global] currentPhase] path]
  53.     set desktop [path_name concat $desktop clipboard.clp]
  54.     set crntPath [pwd]
  55.     if [catch {cd $desktop}] {
  56.         catch {mkdir -path [list $desktop]} error
  57.     } else {
  58.         cd $crntPath
  59.     }
  60.     return $error
  61. }
  62.  
  63. method Il60DocEditor::edit {this docSection} {
  64.  
  65.     wmtkmessage "Starting edit for section '[$docSection name]'"
  66.     set desktop [[[ClientContext::global] currentPhase] path]
  67.     set cmd [list \
  68.         "ileaf6 -desktop $desktop -quiet [$docSection docLocation] &" \
  69.         [$docSection uiName] \
  70.     ]
  71.     $docSection execute "$cmd"
  72.     wmtkmessage ""
  73. }
  74.  
  75. method Il60DocEditor::show {this docSection} {
  76.  
  77.     wmtkmessage "Starting show for section '[$docSection name]'"
  78.     set desktop [[[ClientContext::global] currentPhase] path]
  79.     set cmd [list \
  80.         "ileaf6 -desktop $desktop -quiet [$docSection docLocation] &" \
  81.         [$docSection uiName] \
  82.     ]
  83.     $docSection execute "$cmd"
  84.     wmtkmessage ""
  85. }
  86.  
  87. method Il60DocEditor::print {this docSection} {
  88.  
  89.     set printerName [$this getPrinterName]
  90.     if {$printerName == ""} {
  91.         set printerName postscript
  92.     }
  93.  
  94.     set desktop [[[ClientContext::global] currentPhase] path]
  95.     set cmd [list "ileaf6 -desktop $desktop -print :printer $printerName \
  96.         [$docSection docLocation] " [$docSection uiName] ]
  97.     $docSection execute "$cmd"
  98. }
  99.  
  100. method Il60DocEditor::getPrinterName {this} {
  101.  
  102.     set printerName [m4_var get M4_ps_printer]
  103.  
  104.     set foundName [$this findPrinterName $printerName -P]
  105.     if {$foundName != ""} {
  106.         return $foundName
  107.     }
  108.  
  109.     catch {
  110.         set foundName $env(PRINTER)
  111.         if {$foundName != ""} {
  112.             return $foundName
  113.         }
  114.     }
  115.  
  116.     set foundName [$this findPrinterName $printerName -d]
  117.     if {$foundName != ""} {
  118.         return $foundName
  119.     }
  120.  
  121.     catch {
  122.         set foundName $env(LPDEST)
  123.         if {$foundName != ""} {
  124.             return $foundName
  125.         }
  126.     }
  127.  
  128.     return ""
  129. }
  130.  
  131. method Il60DocEditor::findPrinterName {this printerName searchString} {
  132.  
  133.     set start [string first $searchString $printerName]
  134.     if {$start == -1} {
  135.         return ""
  136.     }
  137.     incr start [string length $searchString]
  138.     set printerName [string range $printerName $start end]
  139.     set end [string first " " $printerName]
  140.     if {$end != -1} {
  141.         set printerName [string range $printerName 0 $end]
  142.     } else {
  143.         set printerName [string range $printerName 0 end]
  144.     }
  145.  
  146.     return $printerName
  147. }
  148.  
  149. # Do not delete this line -- regeneration end marker
  150.  
  151.