SmallSense__SettingsAppl.st
author Claus Gittinger <cg@exept.de>
Mon, 15 Jul 2019 15:33:58 +0200
branchcvs_MAIN
changeset 1091 8c18b8f6ff0c
parent 990 355fbc81c06c
child 1109 e07daafc5d15
permissions -rw-r--r--
#OTHER by cg unneeded subProjects method removed (already inherited)

"
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
Copyright (C) 2013-2014 Jan Vrany

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
"
"{ Package: 'stx:goodies/smallsense' }"

"{ NameSpace: SmallSense }"

AbstractSettingsApplication subclass:#SettingsAppl
	instanceVariableNames:'smallSenseBackgroundTypingEnabled smallSenseBackgroundLintEnabled
		smallSenseEnabled smallSenseElectricEditSupportEnabled
		smallSenseCompleteIfUnambiguous smallSenseCompletionEnabled'
	classVariableNames:''
	poolDictionaries:''
	category:'SmallSense-Core-Interface'
!

!SettingsAppl class methodsFor:'documentation'!

copyright
"
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
Copyright (C) 2013-2014 Jan Vrany

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
"
! !

!SettingsAppl class methodsFor:'class initialization'!

initialize

    NewLauncher
        addSettingsApplicationByClass: self name
        withName: 'Tools/SmallSense'
        icon: nil.

    "Created: / 04-02-2012 / 21:50:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 12-02-2014 / 14:23:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SettingsAppl class methodsFor:'help specs'!

helpSpec
    "This resource specification was automatically generated by the UIHelpTool of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIHelpTool may not be able to read the specification."

    "
     UIHelpTool openOnClass:SmallSenseSettingsAppl
    "



    ^ super helpSpec addPairsFrom:#(

#smallSenseBackgroundLintEnabled
'When enabled, a hint on code are shown next to the line number,\based on a static code analysis (SmallLint).\See the SmallLint settings for which rules are to be applied'

#smallSenseBackgroundTypingEnabled
'When enabled, SmallSense runs a type-inferencer on the code to give more accurate type hints and completion data'

#smallSenseElectricEditSupportEnabled
'When enabled, closing brackets, blank lines and spaces are automatically inserted,\as soon as opening bracket or other tokens are typed. Honors formatting settings.'

#smallSenseEnabled
'General enable/disable the SmallSense support package'

#smallSenseCompletionEnabled
'Enable the SmallSense completion algorithm, instead of the default one.\It is currently a matter of personal taste, which one provides better completions'

#smallSenseCompleteIfUnambiguous
'Enable automatic completion if unambigious.\Will automatically insert the completion, if there only one possible completion is found.\This may be somewhat disturbing, as it makes blind typing a little tricky.'
)
! !

!SettingsAppl class methodsFor:'interface specs'!

windowSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:SmallSense::SettingsAppl andSelector:#windowSpec
     SmallSense::SettingsAppl new openInterface:#windowSpec
     SmallSense::SettingsAppl open
    "

    <resource: #canvas>

    ^ 
    #(FullSpec
       name: windowSpec
       window: 
      (WindowSpec
         label: 'SmallSense Settings'
         name: 'SmallSense Settings'
         min: (Point 10 10)
         bounds: (Rectangle 0 0 536 651)
       )
       component: 
      (SpecCollection
         collection: (
          (CheckBoxSpec
             label: 'Enable SmallSense '
             name: 'Enable'
             layout: (LayoutFrame 0 0 0 0 0 1 30 0)
             activeHelpKey: smallSenseEnabled
             model: smallSenseEnabled
             translateLabel: true
           )
          (DividerSpec
             name: 'Separator'
             layout: (LayoutFrame 5 0 30 0 -5 1 34 0)
           )
          (VerticalPanelViewSpec
             name: 'Panel'
             layout: (LayoutFrame 0 0 37 0 0 1 0 1)
             horizontalLayout: fit
             verticalLayout: top
             horizontalSpace: 3
             verticalSpace: 3
             component: 
            (SpecCollection
               collection: (
                (CheckBoxSpec
                   label: 'Enable "as you type" Code Analysis (Lint)'
                   name: 'LintEnabled'
                   activeHelpKey: smallSenseBackgroundLintEnabled
                   enableChannel: smallSenseEnabled
                   model: smallSenseBackgroundLintEnabled
                   translateLabel: true
                   extent: (Point 536 30)
                 )
                (CheckBoxSpec
                   label: 'Enable Background Type Inferencer'
                   name: 'CheckBox2'
                   activeHelpKey: smallSenseBackgroundTypingEnabled
                   enableChannel: smallSenseEnabled
                   model: smallSenseBackgroundTypingEnabled
                   translateLabel: true
                   extent: (Point 536 30)
                 )
                (CheckBoxSpec
                   label: 'Enable "Electric Edit" Support'
                   name: 'CheckBox3'
                   activeHelpKey: smallSenseElectricEditSupportEnabled
                   enableChannel: smallSenseEnabled
                   model: smallSenseElectricEditSupportEnabled
                   translateLabel: true
                   extent: (Point 536 30)
                 )
                (CheckBoxSpec
                   label: 'Code Completion using SmallSense Completion Engine'
                   name: 'CheckBox4'
                   activeHelpKey: smallSenseCompletionEnabled
                   enableChannel: smallSenseEnabled
                   model: smallSenseCompletionEnabled
                   translateLabel: true
                   extent: (Point 536 30)
                 )
                (CheckBoxSpec
                   label: 'Auto-Complete when Unambiguous'
                   name: 'CheckBox5'
                   activeHelpKey: smallSenseCompleteIfUnambiguous
                   enableChannel: smallSenseEnabledAndCompletionEnabled
                   model: smallSenseCompleteIfUnambiguous
                   translateLabel: true
                   extent: (Point 536 30)
                 )
                )
              
             )
           )
          )
        
       )
     )
! !

!SettingsAppl methodsFor:'aspects'!

smallSenseBackgroundLintEnabled


    smallSenseBackgroundLintEnabled isNil ifTrue:[
        smallSenseBackgroundLintEnabled := true asValue.
        smallSenseBackgroundLintEnabled onChangeSend:#updateModifiedChannel to:self.
    ].
    ^ smallSenseBackgroundLintEnabled.

    "Modified: / 04-02-2012 / 21:47:56 / Jan Vrany "
!

smallSenseBackgroundTypingEnabled


    smallSenseBackgroundTypingEnabled isNil ifTrue:[
        smallSenseBackgroundTypingEnabled := true asValue.
        smallSenseBackgroundTypingEnabled onChangeSend:#updateModifiedChannel to:self.
    ].
    ^ smallSenseBackgroundTypingEnabled.

    "Modified: / 04-02-2012 / 21:48:02 / Jan Vrany "
!

smallSenseCompleteIfUnambiguous


    smallSenseCompleteIfUnambiguous isNil ifTrue:[
        smallSenseCompleteIfUnambiguous := true asValue.
        smallSenseCompleteIfUnambiguous onChangeSend:#updateModifiedChannel to:self.
    ].
    ^ smallSenseCompleteIfUnambiguous.

    "Created: / 18-01-2014 / 23:36:58 / Jan Vrany "
!

smallSenseCompletionEnabled


    smallSenseCompletionEnabled isNil ifTrue:[
        smallSenseCompletionEnabled := true asValue.
        smallSenseCompletionEnabled onChangeSend:#updateModifiedChannel to:self.
    ].
    ^ smallSenseCompletionEnabled.

    "Modified: / 27-02-2014 / 09:33:53 / Jan Vrany "
!

smallSenseElectricEditSupportEnabled


    smallSenseElectricEditSupportEnabled isNil ifTrue:[
        smallSenseElectricEditSupportEnabled := true asValue.
        smallSenseElectricEditSupportEnabled onChangeSend:#updateModifiedChannel to:self.
    ].
    ^ smallSenseElectricEditSupportEnabled.

    "Modified: / 26-07-2013 / 12:36:25 / Jan Vrany "
!

smallSenseEnabled


    smallSenseEnabled isNil ifTrue:[
        smallSenseEnabled := true asValue.
        smallSenseEnabled onChangeSend:#updateModifiedChannel to:self.
    ].
    ^ smallSenseEnabled.

    "Modified: / 04-02-2012 / 21:48:11 / Jan Vrany "
!

smallSenseEnabledAndCompletionEnabled
    ^ BlockValue forLogical: self smallSenseEnabled and: self smallSenseCompletionEnabled

    "Created: / 27-02-2014 / 09:41:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SettingsAppl methodsFor:'protocol'!

basicAspects
    ^#( 
       smallSenseEnabled

       smallSenseBackgroundLintEnabled
       smallSenseBackgroundTypingEnabled
       smallSenseElectricEditSupportEnabled

       smallSenseCompletionEnabled
       smallSenseCompleteIfUnambiguous

    )

    "Modified: / 27-02-2014 / 09:32:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

basicReadSettings
    self readAspects:self basicAspects from:currentUserPrefs.

    "Modified: / 19-07-2011 / 17:11:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

basicSaveSettings

    self writeAspects:self basicAspects to:currentUserPrefs.

    "Modified: / 26-07-2011 / 10:43:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

helpFilename
    "subclasses must return the relative name of a helpFile
     in the doc/online/<language>/help directory.
     Or nil, if no help is available."

    ^ (self class packageDirectory) / 'resources/doc/%(lang)/SmallSenseSettings.html'

    "
     self classResources
    "
! !

!SettingsAppl methodsFor:'queries'!

hasUnsavedChanges
    ^ self
        hasChangedAspectIn: self basicAspects
        asComparedTo:currentUserPrefs

    "Modified: / 19-07-2011 / 17:12:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 25-11-2011 / 15:25:16 / cg"
! !

!SettingsAppl class methodsFor:'documentation'!

version
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '$Id$'
! !


SettingsAppl initialize!