SmallSenseSettingsAppl.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 25 Jul 2013 11:34:26 +0100
changeset 39 748389119d0a
parent 32 658f47bc231e
child 41 6bbd154db308
permissions -rw-r--r--
Initial support for per-language edit support. Some work on Smalltalk edit support, namely on electric blocks. Works fine, but need more work to make it usable but not too intrusive.

"{ Package: 'jv:smallsense' }"

AbstractSettingsApplication subclass:#SmallSenseSettingsAppl
	instanceVariableNames:'smallSenseBackgroundTypingEnabled smallSenseBackgroundLintEnabled
		smallSenseEnabled'
	classVariableNames:''
	poolDictionaries:''
	category:'SmallSense-Interface'
!


!SmallSenseSettingsAppl class methodsFor:'class initialization'!

initialize

    Smalltalk addStartBlock:[
    NewLauncher
        addSettingsApplicationByClass: self name
        withName: 'Tools/SmallSense'
        icon: nil.
    ]

    "Created: / 04-02-2012 / 21:50:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmallSenseSettingsAppl 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    
    "

    <resource: #help>

    ^ super helpSpec addPairsFrom:#(

#smallSenseBackgroundLintEnabled
'When enabled, a hints on code are shown based on static code analysis (SmallLint)'

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

#smallSenseEnabled
'Enable/Disable SmallSense support'

)
! !

!SmallSenseSettingsAppl 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:SmallSenseSettingsAppl andSelector:#windowSpec
     SmallSenseSettingsAppl new openInterface:#windowSpec
     SmallSenseSettingsAppl open
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: windowSpec
        window: 
       (WindowSpec
          label: 'SmallSense Settings'
          name: 'SmallSense Settings'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 300 300)
        )
        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 Code Analysis (Lint)'
                    name: 'LintEnabled'
                    activeHelpKey: smallSenseBackgroundLintEnabled
                    enableChannel: smallSenseEnabled
                    model: smallSenseBackgroundLintEnabled
                    translateLabel: true
                    extent: (Point 300 22)
                  )
                 (CheckBoxSpec
                    label: 'Enable Background Type Inferencer'
                    name: 'CheckBox2'
                    activeHelpKey: smallSenseBackgroundTypingEnabled
                    enableChannel: smallSenseEnabled
                    model: smallSenseBackgroundTypingEnabled
                    translateLabel: true
                    extent: (Point 300 22)
                  )
                 )
               
              )
            )
           )
         
        )
      )
! !

!SmallSenseSettingsAppl methodsFor:'aspects'!

smallSenseBackgroundLintEnabled
    <resource: #uiAspect>

    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."
    "*** (and replace this comment by something more useful ;-)"

    smallSenseBackgroundLintEnabled isNil ifTrue:[
        smallSenseBackgroundLintEnabled := true asValue.
"/ if your app needs to be notified of changes, uncomment one of the lines below:
"/       smallSenseBackgroundLintEnabled addDependent:self.
       smallSenseBackgroundLintEnabled onChangeSend:#updateModifiedChannel to:self.
    ].
    ^ smallSenseBackgroundLintEnabled.

    "Modified: / 04-02-2012 / 21:47:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

smallSenseBackgroundTypingEnabled
    <resource: #uiAspect>

    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."
    "*** (and replace this comment by something more useful ;-)"

    smallSenseBackgroundTypingEnabled isNil ifTrue:[
        smallSenseBackgroundTypingEnabled := true asValue.
"/ if your app needs to be notified of changes, uncomment one of the lines below:
"/       smallSenseBackgroundTypingEnabled addDependent:self.
       smallSenseBackgroundTypingEnabled onChangeSend:#updateModifiedChannel to:self.
    ].
    ^ smallSenseBackgroundTypingEnabled.

    "Modified: / 04-02-2012 / 21:48:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

smallSenseEnabled
    <resource: #uiAspect>

    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."
    "*** (and replace this comment by something more useful ;-)"

    smallSenseEnabled isNil ifTrue:[
        smallSenseEnabled := true asValue.
"/ if your app needs to be notified of changes, uncomment one of the lines below:
"/       smallSenseEnabled addDependent:self.
       smallSenseEnabled onChangeSend:#updateModifiedChannel to:self.
    ].
    ^ smallSenseEnabled.

    "Modified: / 04-02-2012 / 21:48:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmallSenseSettingsAppl methodsFor:'protocol'!

basicAspects
    ^#( 
       smallSenseEnabled

       smallSenseBackgroundLintEnabled
       smallSenseBackgroundTypingEnabled

    )

    "Modified: / 04-02-2012 / 21:47:12 / 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 shouldImplement
! !

!SmallSenseSettingsAppl 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"
! !

!SmallSenseSettingsAppl class methodsFor:'documentation'!

version_HG

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

version_SVN
    ^ '$Id: SmallSenseSettingsAppl.st 7872 2012-02-06 22:35:36Z vranyj1 $'
! !


SmallSenseSettingsAppl initialize!