VDBSettingsApplication.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 04 Oct 2018 10:51:17 +0100
changeset 116 d0d6da74ead3
parent 73 82e202dec6cb
child 117 1ae8e04f5feb
permissions -rw-r--r--
UI: add GDB executable configuration to settings dialog Also add *File* -> *Preferences* menu option to main debugger window. and a new command line option `--gdb` to specify GDB on a command line.

"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany

This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'

You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
"{ Package: 'jv:vdb' }"

"{ NameSpace: Smalltalk }"

AbstractSettingsApplication subclass:#VDBSettingsApplication
	instanceVariableNames:'infoPanel vdbPrettyPrintingEnabled vdbFrameFiltersEnabled
		gdbExecutable'
	classVariableNames:''
	poolDictionaries:''
	category:'VDB-UI-Others'
!

!VDBSettingsApplication class methodsFor:'documentation'!

copyright
"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany

This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'

You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
! !

!VDBSettingsApplication class methodsFor:'initialization'!

initialize

    self installInSettings

    "Created: / 23-06-2005 / 09:27:10 / masca"
!

installInSettings
    
    Smalltalk addStartBlock:[
        AbstractLauncherApplication 
            addSettingsApplicationByClass:self name withName:'Tools/Visual VM Debugger' icon:self defaultIcon
    ]

    "Created: / 23-06-2005 / 09:27:10 / masca"
    "Modified: / 10-04-2018 / 16:56:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBSettingsApplication 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:VDBSettingsApplication
    "

    <resource: #help>

    ^ super helpSpec addPairsFrom:#(

#ExecutableLabel
'Path to GDB executable. If left empty, system GDB is used.'

)
! !

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

    <resource: #canvas>

    ^ 
    #(FullSpec
       name: windowSpec
       uuid: '92aa9d90-c756-11e8-8f9c-0021ccd5e3d3'
       window: 
      (WindowSpec
         label: 'Java Settings'
         name: 'Java Settings'
         uuid: '10c0dbf1-3cd7-11e8-882f-0021ccd5e3d3'
         min: (Point 10 10)
         bounds: (Rectangle 0 0 695 627)
       )
       component: 
      (SpecCollection
         collection: (
          (LabelSpec
             label: ' Visual/VM Debugger Settings'
             name: 'SettingsTitle'
             layout: (LayoutFrame 0 0 0 0 0 1 66 0)
             style: (FontDescription helvetica medium roman 18 #'iso10646-1' nil nil)
             uuid: '10c0dbf2-3cd7-11e8-882f-0021ccd5e3d3'
             backgroundColor: (Color 100.0 100.0 100.0)
             translateLabel: true
             adjust: left
           )
          (LabelSpec
             label: 'Icon'
             name: 'Icon'
             layout: (LayoutFrame -75 1 0 0 0 1 66 0)
             uuid: '10c10300-3cd7-11e8-882f-0021ccd5e3d3'
             hasCharacterOrientedLabel: false
             backgroundColor: (Color 100.0 100.0 100.0)
             translateLabel: true
             labelChannel: libjavaCupIcon
           )
          (SubCanvasSpec
             name: 'InfoPanel'
             layout: (LayoutFrame 0 0 67 0 0 1 107 0)
             uuid: '10c10301-3cd7-11e8-882f-0021ccd5e3d3'
             level: 0
             initiallyInvisible: true
             hasHorizontalScrollBar: false
             hasVerticalScrollBar: false
             clientKey: infoPanel
             createNewBuilder: false
           )
          (VerticalPanelViewSpec
             name: 'Controls'
             layout: (LayoutFrame 0 0 70 0 0 1 0 1)
             uuid: '10c10302-3cd7-11e8-882f-0021ccd5e3d3'
             horizontalLayout: fit
             verticalLayout: top
             horizontalSpace: 3
             verticalSpace: 3
             component: 
            (SpecCollection
               collection: (
                (ViewSpec
                   name: 'Panel1'
                   uuid: '7628c0d0-c755-11e8-8f9c-0021ccd5e3d3'
                   component: 
                  (SpecCollection
                     collection: (
                      (LabelSpec
                         label: 'GDB executable:'
                         name: 'ExecutableLabel'
                         layout: (LayoutFrame 5 0 0 0 130 0 25 0)
                         activeHelpKey: ExecutableLabel
                         uuid: '7628c0d1-c755-11e8-8f9c-0021ccd5e3d3'
                         translateLabel: true
                         adjust: left
                       )
                      (FilenameInputFieldSpec
                         name: 'Executable'
                         layout: (LayoutFrame 135 0 0 0 -100 1 0 1)
                         uuid: '7628c0d2-c755-11e8-8f9c-0021ccd5e3d3'
                         model: gdbExecutable
                         immediateAccept: true
                         acceptOnPointerLeave: true
                         emptyFieldReplacementText: 'Autodetect'
                       )
                      (ActionButtonSpec
                         label: 'Browse'
                         name: 'BrowseButton'
                         layout: (LayoutFrame -100 1 0 0 -8 1 0 1)
                         uuid: '7628c0d3-c755-11e8-8f9c-0021ccd5e3d3'
                         translateLabel: true
                         model: doSelectExecutable
                       )
                      )
                    
                   )
                   extent: (Point 695 25)
                 )
                (ViewSpec
                   name: 'Spacer'
                   uuid: '7628c0d4-c755-11e8-8f9c-0021ccd5e3d3'
                   extent: (Point 695 15)
                 )
                (CheckBoxSpec
                   label: 'Enable Pretty Printers'
                   name: 'EnablePrettyPrinters'
                   uuid: '10c10303-3cd7-11e8-882f-0021ccd5e3d3'
                   model: vdbPrettyPrintingEnabled
                   translateLabel: true
                   extent: (Point 695 22)
                 )
                (CheckBoxSpec
                   label: 'Enable Frame Filters'
                   name: 'EnableFrameFilters'
                   uuid: '10c10304-3cd7-11e8-882f-0021ccd5e3d3'
                   model: vdbFrameFiltersEnabled
                   translateLabel: true
                   extent: (Point 695 22)
                 )
                )
              
             )
           )
          )
        
       )
     )
! !

!VDBSettingsApplication methodsFor:'actions'!

doSelectExecutable
    | guess executable |

    guess := self gdbExecutable value asNilIfEmpty.
    guess isNil ifTrue:[
        guess := GDBProcess gdbExecutable
    ].
    [ guess notNil and:[ (guess := guess asFilename) exists not ] ] whileTrue:[ 
        | p |

        p := guess directory.
        (p notNil and:[ p pathName = guess pathName ]) ifTrue:[ 
            p := nil.
        ].
        guess := p.
    ].
    guess isNil ifTrue:[ 
        guess := GDBProcess gdbExecutable
    ].
    executable := Dialog requestFileName:(resources string:'Select GDB executable') default: guess ifFail:[ ^ self ].
    self infoPanel hide. 
    (executable includes: Character space) ifTrue:[ 
        executable := '"' , executable , '"'.
    ].
    self gdbExecutable value: executable

    "Created: / 03-10-2018 / 22:46:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBSettingsApplication methodsFor:'aspects'!

aspects
    ^ #(gdbExecutable vdbPrettyPrintingEnabled vdbFrameFiltersEnabled)

    "Created: / 10-04-2018 / 16:53:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 03-10-2018 / 22:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

gdbExecutable
    <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 ;-)"

    gdbExecutable isNil ifTrue:[
        gdbExecutable := ValueHolder new.
"/ if your app needs to be notified of changes, uncomment one of the lines below:
"/       gdbExecutable addDependent:self.
"/       gdbExecutable onChangeSend:#gdbExecutableChanged to:self.
    ].
    ^ gdbExecutable.
!

infoPanel
    infoPanel isNil ifTrue:[
        infoPanel := Tools::InlineMessageDialog new.
    ].
    ^ infoPanel

    "Created: / 10-04-2018 / 16:52:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

vdbFrameFiltersEnabled
    <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 ;-)"

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

    "Modified: / 10-04-2018 / 16:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

vdbPrettyPrintingEnabled
    <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 ;-)"

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

    "Modified: / 10-04-2018 / 16:53:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBSettingsApplication methodsFor:'protocol'!

basicSaveSettings
    self gdbExecutable value = '' ifTrue:[ 
        self gdbExecutable setValue: nil
    ].
    super basicSaveSettings.

    "Created: / 04-10-2018 / 09:46:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBSettingsApplication class methodsFor:'documentation'!

version_HG

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


VDBSettingsApplication initialize!