VDBSourceApplication.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 17 Jan 2019 09:28:12 +0000
changeset 133 16a1f7a5eed0
parent 122 c992f32875bf
child 154 26937faa5a97
permissions -rw-r--r--
Fix display of "no source code available" message in source view
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
     1
"
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
     2
jv:vdb - Visual / VM Debugger
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
     3
Copyright (C) 2015-now Jan Vrany
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
     4
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
     5
This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
     6
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
     7
You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
     8
"
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
"{ Package: 'jv:vdb' }"
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
40
d766d4c854a2 Cleanup in debugger and inferior console applications to catch up changes in `jv:libgdbs`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    11
"{ NameSpace: Smalltalk }"
d766d4c854a2 Cleanup in debugger and inferior console applications to catch up changes in `jv:libgdbs`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 20
diff changeset
    12
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
VDBAbstractApplication subclass:#VDBSourceApplication
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    14
	instanceVariableNames:'frameHolder sourceFileHolder sourceStringHolder sourceView'
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
	classVariableNames:''
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
	poolDictionaries:''
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    17
	category:'VDB-UI-Source'
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
!
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
49
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    20
!VDBSourceApplication class methodsFor:'documentation'!
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    21
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    22
copyright
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    23
"
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    24
jv:vdb - Visual / VM Debugger
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    25
Copyright (C) 2015-now Jan Vrany
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    26
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    27
This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    28
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    29
You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    30
"
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
    31
! !
20
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    32
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
!VDBSourceApplication class methodsFor:'interface specs'!
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
windowSpec
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
    "This resource specification was automatically generated
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
     by the UIPainter of ST/X."
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
    "Do not manually edit this!! If it is corrupted,
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
     the UIPainter may not be able to read the specification."
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
    "
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
     UIPainter new openOnClass:VDBSourceApplication andSelector:#windowSpec
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
     VDBSourceApplication new openInterface:#windowSpec
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
     VDBSourceApplication open
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
    "
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
    <resource: #canvas>
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
    ^ 
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
    #(FullSpec
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
       name: windowSpec
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
       window: 
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
      (WindowSpec
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
         label: 'Source View'
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
         name: 'Source View'
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
         min: (Point 10 10)
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
         bounds: (Rectangle 0 0 300 300)
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
       )
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
       component: 
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
      (SpecCollection
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
         collection: (
20
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    63
          (NonScrollableArbitraryComponentSpec
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
             name: 'SourceView'
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
             model: sourceStringHolder
20
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
    67
             component: sourceView
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
           )
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
          )
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
        
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
       )
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
     )
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
! !
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
!VDBSourceApplication class methodsFor:'plugIn spec'!
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
aspectSelectors
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
    "This resource specification was automatically generated
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
     by the UIPainter of ST/X."
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
    "Do not manually edit this. If it is corrupted,
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
     the UIPainter may not be able to read the specification."
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
    "Return a description of exported aspects;
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
     these can be connected to aspects of an embedding application
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
     (if this app is embedded in a subCanvas)."
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
    ^ #(
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
        #debuggerHolder
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    90
        #frameHolder
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
      ).
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
! !
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
!VDBSourceApplication methodsFor:'aspects'!
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    97
frameHolder
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    98
    "return/create the 'frameHolder' value holder (automatically generated)"
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   100
    frameHolder isNil ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   101
        frameHolder := ValueHolder new.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   102
        frameHolder addDependent:self.
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
    ].
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   104
    ^ frameHolder
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
!
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   107
frameHolder:something
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   108
    "set the 'frameHolder' value holder (automatically generated)"
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   109
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   110
    |oldValue newValue|
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   111
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   112
    frameHolder notNil ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   113
        oldValue := frameHolder value.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   114
        frameHolder removeDependent:self.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   115
    ].
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   116
    frameHolder := something.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   117
    frameHolder notNil ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   118
        frameHolder addDependent:self.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   119
    ].
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   120
    newValue := frameHolder value.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   121
    oldValue ~~ newValue ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   122
        self update:#value with:newValue from:frameHolder.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   123
    ].
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   124
!
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   125
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   126
sourceFileHolder
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   127
    "return/create the 'sourceFileHolder' value holder (automatically generated)"
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   129
    sourceFileHolder isNil ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   130
        sourceFileHolder := ValueHolder new.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   131
        sourceFileHolder addDependent:self.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   132
    ].
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   133
    ^ sourceFileHolder
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   134
!
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   135
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   136
sourceFileHolder:something
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   137
    "set the 'sourceFileHolder' value holder (automatically generated)"
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   138
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   139
    |oldValue newValue|
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   140
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   141
    sourceFileHolder notNil ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   142
        oldValue := sourceFileHolder value.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   143
        sourceFileHolder removeDependent:self.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   144
    ].
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   145
    sourceFileHolder := something.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   146
    sourceFileHolder notNil ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   147
        sourceFileHolder addDependent:self.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   148
    ].
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   149
    newValue := sourceFileHolder value.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   150
    oldValue ~~ newValue ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   151
        self update:#value with:newValue from:sourceFileHolder.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   152
    ].
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
!
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
sourceStringHolder
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   156
    "return/create the 'sourceStringHolder' value holder (automatically generated)"
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
    sourceStringHolder isNil ifTrue:[
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   159
        sourceStringHolder := ValueHolder new.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   160
        sourceStringHolder addDependent:self.
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
    ].
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
    ^ sourceStringHolder
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   163
!
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   164
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   165
sourceStringHolder:something
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   166
    "set the 'sourceStringHolder' value holder (automatically generated)"
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   167
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   168
    |oldValue newValue|
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   169
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   170
    sourceStringHolder notNil ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   171
        oldValue := sourceStringHolder value.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   172
        sourceStringHolder removeDependent:self.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   173
    ].
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   174
    sourceStringHolder := something.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   175
    sourceStringHolder notNil ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   176
        sourceStringHolder addDependent:self.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   177
    ].
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   178
    newValue := sourceStringHolder value.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   179
    oldValue ~~ newValue ifTrue:[
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   180
        self update:#value with:newValue from:sourceStringHolder.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   181
    ].
20
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   182
!
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   183
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   184
sourceView
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   185
    sourceView isNil ifTrue:[ 
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   186
        sourceView := Tools::CodeView2 new.
94
e76206d071fc UX: Allow to set a font for text, list views and pinned menus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 68
diff changeset
   187
        sourceView font: self textFont.
68
6caeb5d7c92b Added support for inspecting expression result in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 58
diff changeset
   188
        sourceView compilerClass: (VDBEvaluator new setDebugger: debugger).    
20
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   189
        sourceView readOnly: true.
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   190
        sourceView services: #()        
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   191
    ].
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   192
    ^ sourceView
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   193
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   194
    "Created: / 21-09-2014 / 01:42:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
94
e76206d071fc UX: Allow to set a font for text, list views and pinned menus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 68
diff changeset
   195
    "Modified: / 20-08-2018 / 11:03:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   196
! !
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   197
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   198
!VDBSourceApplication methodsFor:'change & update'!
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   199
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   200
update:aspect with:param from:sender 
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   201
    "Invoked when an object that I depend upon sends a change notification."
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   202
    
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   203
    sender == frameHolder ifTrue:[
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   204
        self updateSourceFile.
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   205
        ^ self.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   206
    ].
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   207
    sender == sourceFileHolder ifTrue:[
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   208
        self updateSourceString.
17
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   209
        ^ self.
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   210
    ].
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   211
    super update:aspect with:param from:sender
c5ee4ea44165 Some more work on source displaying
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   212
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   213
    "Modified: / 02-10-2018 / 10:50:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
58
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   214
!
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   215
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   216
updateCurrentLine
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   217
    | frame file |
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   218
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   219
    frame := frameHolder value.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   220
    file := sourceFileHolder value.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   221
    (frame notNil and:[file notNil]) ifTrue:[
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   222
        | line |
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   223
        line := frame line.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   224
        line notNil ifTrue:[
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   225
            sourceView selectLine:line.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   226
            sourceView makeSelectionVisible.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   227
            ^ self.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   228
        ]
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   229
    ].
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   230
    sourceView unselect
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   231
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   232
    "Created: / 02-10-2018 / 11:03:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   233
!
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   234
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   235
updateSourceFile
58
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   236
    | frame |
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   237
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   238
    frame := frameHolder value.
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   239
    frame notNil ifTrue:[
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   240
        | file |
58
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   241
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   242
        file := frame file.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   243
        file notNil ifTrue:[ file := file asFilename ].
133
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   244
        file notNil ifTrue:[ 
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   245
            self sourceFileHolder value: file.
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   246
        ] ifFalse:[
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   247
            "/ If file is nil, this means that it is either unknown (no 
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   248
            "/ debug info) or it cannot be resolved. If the latter, a 
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   249
            "/ help text is shown, see #updateSourceString.
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   250
            "/ 
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   251
            "/ Therefore, here we force an update to make sure that
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   252
            "/ help text is regenerated.
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   253
            self sourceFileHolder 
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   254
                setValue: file;
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   255
                changed: #value
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   256
        ]
58
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   257
    ].
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   258
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   259
    "Created: / 01-02-2018 / 15:16:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
133
16a1f7a5eed0 Fix display of "no source code available" message in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   260
    "Modified: / 16-01-2019 / 23:55:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   261
!
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   262
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   263
updateSourceString
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   264
    | source file |
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   265
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   266
    source := nil.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   267
    file := sourceFileHolder value.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   268
    (file notNil and:[file exists]) ifTrue:[
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   269
        source := file contents asString.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   270
    ] ifFalse:[ 
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   271
        "/ We have no source. As a courtesy to the user, display some info
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   272
        "/ on what's the problem and
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   273
        | frame |
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   274
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   275
        frame := self frameHolder value.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   276
        source := Text streamContents:[ :info |
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   277
            | frameFile frameFullname |
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   278
            info emphasis: #color -> (UserPreferences current codeViewTheme ? UserPreferences current) commentColor.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   279
            info nextPutAll: '//' ; cr.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   280
            info nextPutAll: '// '; nextPutAll: (resources string: 'No source available :-('); cr.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   281
            info nextPutAll: '//' ; cr.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   282
            frameFile := frame propertyAt: #file.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   283
            frameFullname := frame propertyAt: #fullname.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   284
            (frameFile isNil and:[ frameFullname notNil ]) ifTrue:[ 
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   285
                info nextPutAll: '// '; nextPutLine: (resources string: 'Source file reference missing (no debug info?)').
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   286
            ] ifFalse:[ 
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   287
                info nextPutAll: '// '; nextPutLine: (resources string: 'Source file cannot be resolved:').
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   288
                info nextPutAll: '// '; cr.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   289
                frameFile notNil ifTrue:[
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   290
                    info nextPutAll: '//   '; nextPutLine: frameFile.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   291
                ].
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   292
                frameFullname notNil ifTrue:[
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   293
                    info nextPutAll: '//   '; nextPutLine: frameFullname.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   294
                ].
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   295
                info nextPutAll: '// '; cr.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   296
                info nextPutAll: '// '; nextPutLine: (resources string: 'Configured source directories:').
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   297
                debugger directories do:[:each | 
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   298
                    info nextPutAll: '//   '; nextPutLine: each.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   299
                ].
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   300
                info nextPutAll: '// '; cr.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   301
                info nextPutAll: '// '; nextPutLine: (resources string: 'See also:').
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   302
                info nextPutAll: '// [1]: https://sourceware.org/gdb/onlinedocs/gdb/Source-Path.html'.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   303
            ].
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   304
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   305
        ]
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   306
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   307
    ].
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   308
    self sourceStringHolder value:source.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   309
    self updateCurrentLine.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   310
    ^ self.
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   311
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   312
    "Modified: / 07-10-2018 / 20:47:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
58
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   313
! !
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   314
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   315
!VDBSourceApplication methodsFor:'change & update-delayed'!
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   316
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   317
delayedUpdateCurrentLine
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   318
    self updateCurrentLine
58
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   319
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   320
    "Created: / 02-10-2018 / 11:04:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
58
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   321
! !
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   322
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   323
!VDBSourceApplication methodsFor:'event handling'!
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   324
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   325
onStoppedEvent: aGDBStoppedEvent
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   326
    self enqueueDelayedUpdate: #delayedUpdateCurrentLine
58
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   327
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   328
    "Created: / 01-02-2018 / 15:23:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
122
c992f32875bf UX: show user some usefull message when source code is not available
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   329
    "Modified: / 02-10-2018 / 11:04:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
58
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   330
! !
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   331
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   332
!VDBSourceApplication methodsFor:'initialization & release'!
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   333
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   334
subscribe   
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   335
    "Register for debugger events. To be overrided by subclasses"
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   336
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   337
    debugger announcer
68
6caeb5d7c92b Added support for inspecting expression result in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 58
diff changeset
   338
        when: GDBStoppedEvent               send: #onStoppedEvent: to: self.
6caeb5d7c92b Added support for inspecting expression result in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 58
diff changeset
   339
6caeb5d7c92b Added support for inspecting expression result in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 58
diff changeset
   340
    sourceView notNil ifTrue:[ 
6caeb5d7c92b Added support for inspecting expression result in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 58
diff changeset
   341
        sourceView compilerClass setDebugger: debugger.
6caeb5d7c92b Added support for inspecting expression result in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 58
diff changeset
   342
    ].
58
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   343
df46b9c82b38 Variable objects: highlight values that have changed since last "view"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 49
diff changeset
   344
    "Created: / 01-02-2018 / 15:18:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
68
6caeb5d7c92b Added support for inspecting expression result in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 58
diff changeset
   345
    "Modified: / 21-03-2018 / 22:18:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   346
! !
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   347
20
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   348
!VDBSourceApplication class methodsFor:'documentation'!
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   349
20
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   350
version_HG
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   351
20
f323725d7b18 Fix in source view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17
diff changeset
   352
    ^ '$Changeset: <not expanded> $'
16
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   353
! !
fc1898815ab6 Temporary commit: some more work on displaying source code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   354