home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / fdlg.zip / SET_S.CLS < prev    next >
Text File  |  1996-02-02  |  5KB  |  176 lines

  1. "  ---- Ronald Brill 1995, 1996 ---- "
  2. "  ---- Extended File Dialogs Version 2.1 ---- "
  3.  
  4.  
  5. ExtendedFileDialogSetupController SecondaryFile !
  6.  
  7.  
  8. ! ExtendedFileDialogSetupController methods!
  9.  
  10.  
  11. deleteOnFilterEntry
  12. | selection item |
  13.    item := (formDict at: #Filters) focus controllerItem.
  14.    item name == #setupFilterMappingDroDoLi ifTrue: [ ^ self.].
  15.  
  16.    modus ~~ #change ifTrue: [ ^ self.].
  17.  
  18.    selection := setupFilterLabelList getSelection.
  19.    setupFilterLabelList put: (setupFilterLabelList getList removeAt: selection).
  20.    setupFilterValueList put: (setupFilterValueList getList removeAt: selection).
  21.    self refreshMappingList.
  22.    setupFilterLabelList display: #New.
  23.    setupFilterLabelEntry setFocus.
  24. !"end deleteOnFilterEntry"
  25.  
  26.  
  27. enterOnFilterEntry
  28. | tempLabel tempValue tempSelection |
  29.    "  ---- Plausis ---- "
  30.    setupFilterLabelEntry getValue isEmpty
  31.    ifTrue:
  32.    [  setupFilterLabelEntry setFocus.
  33.       ^ ModalMessageBox
  34.             title: 'Error'
  35.             text: 'Must enter an Label for the Filter!'
  36.             icon: #StopSign
  37.             buttons: {#OK}
  38.             action: nil
  39.             controller: self.
  40.    ].
  41.    setupFilterValueEntry getValue isEmpty
  42.    ifTrue:
  43.    [  setupFilterValueEntry setFocus.
  44.       ^ ModalMessageBox
  45.             title: 'Error'
  46.             text: 'Must enter an Filter!'
  47.             icon: #StopSign
  48.             buttons: {#OK}
  49.             action: nil
  50.             controller: self.
  51.    ].
  52.  
  53.    tempLabel := setupFilterLabelEntry getValue asSymbol.
  54.    tempValue := setupFilterValueEntry getValue asSymbol.
  55.    modus == #new
  56.    ifTrue:
  57.    [  setupFilterLabelList put: ( setupFilterLabelList getList add: tempLabel).
  58.        setupFilterValueList put: (setupFilterValueList getList add: tempValue).
  59.  
  60.       setupFilterLabelList display: #New.
  61.       setupFilterLabelEntry setFocus.
  62.    ].
  63.    modus == #change
  64.    ifTrue:
  65.    [  tempSelection := setupFilterLabelList getSelection.
  66.        setupFilterLabelList put: (setupFilterLabelList getList at: tempSelection put: tempLabel).
  67.        setupFilterValueList put: (setupFilterValueList getList at: tempSelection put: tempValue).
  68.  
  69.       setupFilterLabelEntry setFocus.
  70.    ].
  71.    self refreshMappingList.
  72. !"end enterOnFilterEntry"
  73.  
  74.  
  75. openIniForFilter
  76. | setup |
  77.    setup := FileDialogSetup load.
  78.     setupFilterLabelList put: ((Array with: #New) append: setup filterLabels).
  79.     setupFilterValueList put: ((Array with: #'') append: setup filterValues).
  80.  
  81.    self refreshMappingList.
  82.    setupFilterLabelList display: #New.
  83.     setupFilterMappingDroDoLi display: setup filterMapping.
  84. !"end openIniForFilter"
  85.  
  86.  
  87. openIniForOptions
  88.    setupOptionsReorderCheck put: FileDialogSetup load reorderFileList.
  89. !"end openIniForOptions"
  90.  
  91.  
  92. openIniForPreviewFont
  93.    setupFontFontSelectionIC putValue: (Font newArray: FileDialogSetup load previewFont).
  94. !"end openIniForPreviewFont"
  95.  
  96.  
  97. openInitializationFor: aForm
  98.    super openInitializationFor: aForm.
  99.    aForm name == #Filters
  100.    ifTrue:
  101.    [  self openIniForFilter.
  102.    ].
  103.    aForm name == #'Preview Font'
  104.    ifTrue:
  105.    [  self openIniForPreviewFont.
  106.    ].
  107.    aForm name == #Options
  108.    ifTrue:
  109.    [  self openIniForOptions.
  110.    ].
  111. !"end openInitializationFor:"
  112.  
  113.  
  114. refreshMappingList
  115. | tempSelection |
  116.     tempSelection := setupFilterMappingDroDoLi getValue.
  117.    setupFilterMappingDroDoLi put: setupFilterValueList getList cdr.
  118.     setupFilterMappingDroDoLi display: tempSelection.
  119.     setupFilterMappingDroDoLi getSelection == 0
  120.    ifTrue:
  121.    [  setupFilterMappingDroDoLi setSelectionTo: 2.
  122.    ].
  123. !"end refreshMappingList"
  124.  
  125.  
  126. selectFilter
  127. | value |
  128.    value := setupFilterLabelList getValue.
  129.  
  130.    (value == #'<All Files>') | (value == #'Class Files (*.cls)')
  131.    ifTrue:
  132.    [    setupFilterLabelEntry disable.
  133.         setupFilterValueEntry disable.
  134.       modus := #noEdit.
  135.    ]
  136.    ifFalse:
  137.    [    setupFilterLabelEntry enable.
  138.         setupFilterValueEntry enable.
  139.       modus := #change.
  140.    ].
  141.  
  142.    value == #New
  143.    ifTrue:
  144.    [  value := String new.
  145.       modus := #new.
  146.    ].
  147.  
  148.     setupFilterLabelEntry put: value.
  149.     setupFilterValueEntry put: setupFilterValueList getValue.
  150. !"end selectFilter"
  151.  
  152.  
  153. setupCancel
  154.    self close.
  155. !"end setupCancel"
  156.  
  157.  
  158. setupOk
  159. | setup filters |
  160.    setup := FileDialogSetup load.
  161.    setup previewFont: setupFontFontSelectionIC getValue asArray.
  162.  
  163.    setup filterLabels: setupFilterLabelList getList cdr.
  164.    setup filterValues: setupFilterValueList getList cdr.
  165.    setup filterMapping: setupFilterMappingDroDoLi getValue.
  166.  
  167.    setup reorderFileList: setupOptionsReorderCheck getValue.
  168.    setup save.
  169.  
  170.    self mainForm parent controller setupChanged.
  171.    self close.
  172. !"end setupOk"
  173.  
  174.  
  175. !"End of methods block"
  176.