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

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)objectdefi.tcl    1.11
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)objectdefi.tcl    1.11   12 Mar 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. require "commandpag.tcl"
  13. # End user added include file section
  14.  
  15. require "defstoredi.tcl"
  16.  
  17. Class ObjectDefineDialog : {DefStoreDialog} {
  18.     constructor
  19.     method destructor
  20.     method createInterface
  21.     method clearInterface
  22.     method fromInterface
  23.     method toInterface
  24.     method load
  25.     method save
  26.     method objName
  27.     attribute iPage
  28.     attribute cPage
  29. }
  30.  
  31. constructor ObjectDefineDialog {class this name} {
  32.     set this [DefStoreDialog::constructor $class $this $name]
  33.     # Start constructor user section
  34.     $this helpPressed { .main helpOnName editobjTypeProperties }    
  35.     # End constructor user section
  36.     return $this
  37. }
  38.  
  39. method ObjectDefineDialog::destructor {this} {
  40.     # Start destructor user section
  41.     # End destructor user section
  42.     $this DefStoreDialog::destructor
  43. }
  44.  
  45. method ObjectDefineDialog::createInterface {this} {
  46.  
  47.     #indentation of this function is 4 spaces to make it easier to read
  48.     $this DefStoreDialog::createInterface
  49.  
  50.     # create "interface" page
  51.     interface NoteBkPage $this.InterfaceNBP {
  52.         label Interface
  53.         NamedGroup NG { 
  54.             DlgColumn DC {
  55.                 DlgRow DR {
  56.                     verStretchFactor 0
  57.                     sizeEqual 1
  58.                     NamedGroup NG {
  59.                         label "Normal Icon"
  60.                         DlgColumn DC {
  61.                             Image normalIconI { 
  62.                             }
  63.                             PushButton normalIconPB {
  64.                                 label "Select Icon"
  65.                             }
  66.                         }
  67.                     }
  68.                     NamedGroup NG {
  69.                         label "Active Icon"
  70.                         DlgColumn DC {
  71.                             Image activeIconI { 
  72.                             }
  73.                             PushButton activeIconPB {
  74.                                 label "Select Icon"
  75.                             }
  76.                         }
  77.                     }
  78.                 }
  79.                 DlgRow DR {
  80.                     verStretchFactor 0
  81.                     sizeEqual 1
  82.                     NamedGroup NG {
  83.                         label "Small Icon"
  84.                         DlgColumn DC {
  85.                             Image smallIconI { 
  86.                             }
  87.                             PushButton smallIconPB {
  88.                                 label "Select Icon"
  89.                             }
  90.                         }
  91.                     }
  92.                     NamedGroup NG {
  93.                         label "Large Icon"
  94.                         DlgColumn DC {
  95.                             Image largeIconI { 
  96.                             }
  97.                             PushButton largeIconPB {
  98.                                 label "Select Icon"
  99.                             }
  100.                         }
  101.                     }
  102.                 }
  103.                 DlgRow DR {
  104.                     sizeEqual 1
  105.                     NamedGroup NG {
  106.             label "Fold state"
  107.                         DlgColumn DC {
  108.                             verStretchFactor 0
  109.                     CheckButton foldCB {
  110.                                label "Initial folded"
  111.                             }
  112.                 }
  113.                     } 
  114.                     NamedGroup NG {
  115.             label "File system extension"
  116.                         DlgColumn DC {
  117.                             verStretchFactor 0
  118.                     SingleLineText extensionSLT {
  119.                             }
  120.                 }
  121.                     } 
  122.         }
  123.             } 
  124.         }
  125.     }
  126.  
  127.     # create "command" page
  128.     $this cPage [CommandPage new $this.cPage]
  129.     [$this cPage] isMethod 1
  130.  
  131.     $this iPage $this.InterfaceNBP.NG.DC.DR.NG.DC
  132.  
  133.     [$this iPage].normalIconPB activated "[.main smallIconSelector] select \
  134.                         [$this iPage].normalIconI"
  135.     [$this iPage].activeIconPB activated "[.main activeIconSelector] select \                            [$this iPage].activeIconI"
  136.     [$this iPage].smallIconPB activated "[.main smallIconSelector] select \                            [$this iPage].smallIconI"
  137.     [$this iPage].largeIconPB activated "[.main largeIconSelector] select \                            [$this iPage].largeIconI"
  138.  
  139.  
  140. }
  141.  
  142. method ObjectDefineDialog::clearInterface {this} {
  143.  
  144.     $this DefStoreDialog::clearInterface
  145.  
  146.     # clean page "Interface"
  147.     [$this iPage].normalIconI pixmap undef_16
  148.     [$this iPage].activeIconI pixmap undef_16
  149.     [$this iPage].smallIconI pixmap undef_16
  150.     [$this iPage].largeIconI pixmap undef_32
  151.     [$this iPage].foldCB state 1
  152.     [$this iPage].extensionSLT text ""
  153.  
  154.     # clean page "Command"
  155.     [$this cPage] clearInterface
  156. }
  157.  
  158. method ObjectDefineDialog::fromInterface {this} {
  159.  
  160.     # save page "Interface"
  161.     set spec ""
  162.     set spec "$spec foldState [[$this iPage].foldCB state]"
  163.  
  164.     set extension [string trim [[$this iPage].extensionSLT text]]
  165.     if {![lempty $extension]} {
  166.         set spec "$spec fsExtension $extension"
  167.     }
  168.     set spec "$spec normalIcon [[$this iPage].normalIconI pixmap]"
  169.     set spec "$spec activeIcon [[$this iPage].activeIconI pixmap]"
  170.     set spec "$spec smallIcon [[$this iPage].smallIconI pixmap]"
  171.     set spec "$spec largeIcon [[$this iPage].largeIconI pixmap]"
  172.  
  173.     # save page "Command"
  174.     set cmdSpec [[$this cPage] fromInterface]
  175.     if {$cmdSpec == ""} {
  176.         return ""
  177.     }
  178.     set spec "$spec defaultAction $cmdSpec"
  179.     return $spec
  180. }
  181.  
  182. method ObjectDefineDialog::toInterface {this key value} {
  183.  
  184.     # page "Interface"
  185.     if {$key == "foldState"} {
  186.         [$this iPage].foldCB state $value
  187.     }
  188.     if {$key == "fsExtension"} {
  189.         [$this iPage].extensionSLT text $value
  190.     }
  191.     if {$key == "normalIcon"} {
  192.         [$this iPage].normalIconI pixmap $value
  193.     }
  194.     if {$key == "activeIcon"} {
  195.         [$this iPage].activeIconI pixmap $value
  196.     }
  197.     if {$key == "smallIcon"} {
  198.         [$this iPage].smallIconI pixmap $value
  199.     }
  200.     if {$key == "largeIcon"} {
  201.         [$this iPage].largeIconI pixmap $value
  202.     }
  203.  
  204.     # page "Command"
  205.     if {$key == "defaultAction"} {
  206.         [$this cPage] toInterface $value
  207.     }
  208. }
  209.  
  210. method ObjectDefineDialog::load {this object} {
  211.  
  212.     # fill the methods of the selected object
  213.     [$this cPage] setMethods [$object displayName]
  214.     
  215.     $this DefineDialog::load $object
  216. }
  217.  
  218. method ObjectDefineDialog::save {this popDown} {
  219.  
  220.     if {[$this DefineDialog::save $popDown] == 1} {
  221.         # reset redefined attribute
  222.         [$this curObject] redefined 0
  223.     }
  224. }
  225.  
  226. method ObjectDefineDialog::objName {this args} {
  227.     
  228.     if {$args == ""} {
  229.         # name of an objecttype can not change so return the original
  230.         return [[$this curObject] displayName]
  231.     } else {
  232.         #set nothing
  233.     }
  234. }
  235.  
  236. # Do not delete this line -- regeneration end marker
  237.  
  238.